doc/20260313_À¤Ì©»¯¹¤.sql
@@ -25,3 +25,6 @@ update_time datetime null comment 'æ´æ°æ¶é´', unique idx_raw_material_id_quality_inspect_item_id (raw_material_id, quality_inspect_item_id) ); alter table approve_process add approve_record_id bigint not null default 0; src/main/java/com/ruoyi/approve/controller/ApproveProcessController.java
@@ -192,4 +192,14 @@ ExcelUtil<ApproveProcess> util = new ExcelUtil<ApproveProcess>(ApproveProcess.class); util.exportExcel(response, accountExpenses, "å±é©ä½ä¸å®¡æ¹å¯¼åº"); } @ApiOperation(value = "åæå®¡æ¹å¯¼åº") @PostMapping("/exportNine") public void exportNine(HttpServletResponse response) { List<ApproveProcess> accountExpenses = approveProcessService.list(new LambdaQueryWrapper<ApproveProcess>() .eq(ApproveProcess::getApproveDelete, 0) .eq(ApproveProcess::getApproveType, 9)); ExcelUtil<ApproveProcess> util = new ExcelUtil<ApproveProcess>(ApproveProcess.class); util.exportExcel(response, accountExpenses, "åæå®¡æ¹å¯¼åº"); } } src/main/java/com/ruoyi/approve/pojo/ApproveProcess.java
@@ -127,10 +127,15 @@ private Long tenantId; /** * 审æ¹ç±»å 1-å ¬åºç®¡ç 2-请å管ç 3-åºå·®ç®¡ç 4-æ¥é管ç 5-éè´å®¡æ¹ 6-æ¥ä»·å®¡æ¹ 7-åè´§å®¡æ¹ 8-å±é©ä½ä¸å®¡æ¹ * 审æ¹ç±»å 1-å ¬åºç®¡ç 2-请å管ç 3-åºå·®ç®¡ç 4-æ¥é管ç 5-éè´å®¡æ¹ 6-æ¥ä»·å®¡æ¹ 7-åè´§å®¡æ¹ 8-å±é©ä½ä¸å®¡æ¹ 9-åæå®¡æ¹ */ private Integer approveType; /** * 审æ¹å ³èè®°å½id */ private Long approveRecordId; @TableField(exist = false) private String approveTypeName; src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
@@ -325,6 +325,8 @@ return "å货审æ¹"; case 8: return "å±é©ä½ä¸å®¡æ¹"; case 9: return "åæå®¡æ¹"; } return null; } src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java
@@ -115,6 +115,9 @@ approveProcess.setApproveStatus(0); approveProcess.setApproveDelete(0); approveProcess.setApproveType(approveProcessVO.getApproveType()); if (approveProcessVO.getApproveRecordId() != null) { approveProcess.setApproveRecordId(approveProcessVO.getApproveRecordId()); } approveProcess.setCreateTime(LocalDateTime.now()); approveProcess.setTenantId(approveProcessVO.getApproveDeptId()); approveProcess.setApproveUserIds(approveProcessVO.getApproveUserIds()); @@ -441,6 +444,8 @@ return "å货审æ¹"; case 8: return "å±é©ä½ä¸å®¡æ¹"; case 9: return "åæå®¡æ¹"; } return null; } src/main/java/com/ruoyi/approve/vo/ApproveProcessVO.java
@@ -67,6 +67,10 @@ * 审æ¹ç±»å */ private Integer approveType; /** * 审æ¹å ³èè®°å½id */ private Long approveRecordId; /** * è®¾å¤æ¥ä¿®id */ src/main/java/com/ruoyi/common/enums/FileNameType.java
@@ -14,7 +14,8 @@ SHIP(9),//åè´§å°è´¦ INSPECTION_PRODUCTION_BEFORE(10), INSPECTION_PRODUCTION_AFTER(11), INSPECTION(12);//å·¡æ£ ç产å INSPECTION(12),//å·¡æ£ ç产å DeviceRepair(13);// 设å¤ç»´ä¿® private final int value; src/main/java/com/ruoyi/common/enums/RawMaterialCheckResult.java
@@ -26,10 +26,10 @@ */ public static RawMaterialCheckResult fromValue(Integer value) { for (RawMaterialCheckResult type : values()) { if (type.getValue().equals(value)) { if (type.getCode().equals(value)) { return type; } } throw new IllegalArgumentException("æªç¥ç RawMaterialCheckResult å¼: " + value); return null; } } src/main/java/com/ruoyi/common/enums/RawMaterialCheckType.java
@@ -27,10 +27,10 @@ */ public static RawMaterialCheckType fromValue(Integer value) { for (RawMaterialCheckType type : values()) { if (type.getValue().equals(value)) { if (type.getCode().equals(value)) { return type; } } throw new IllegalArgumentException("æªç¥ç RawMaterialCheckType å¼: " + value); return null; } } src/main/java/com/ruoyi/common/enums/RawMaterialInspectState.java
@@ -26,10 +26,10 @@ */ public static RawMaterialInspectState fromValue(Integer value) { for (RawMaterialInspectState type : values()) { if (type.getValue().equals(value)) { if (type.getCode().equals(value)) { return type; } } throw new IllegalArgumentException("æªç¥ç RawMaterialInspectState å¼: " + value); return null; } } src/main/java/com/ruoyi/consumables/controller/ConsumablesInRecordController.java
@@ -26,8 +26,8 @@ @GetMapping("/listPage") @Log(title = "çäº§å ¥åº-å ¥åºç®¡ç-å表", businessType = BusinessType.OTHER) @ApiOperation(value = "å ¥åºç®¡çå表") public AjaxResult listPage(Page page, ConsumablesInRecordDto ConsumablesInRecordDto) { IPage<ConsumablesInRecordDto> result = consumablesInRecordService.listPage(page, ConsumablesInRecordDto); public AjaxResult listPage(Page page, ConsumablesInRecordDto consumablesInRecordDto) { IPage<ConsumablesInRecordDto> result = consumablesInRecordService.listPage(page, consumablesInRecordDto); return AjaxResult.success(result); } @@ -44,8 +44,8 @@ @PostMapping("/exportConsumablesInRecord") @ApiOperation("导åºå ¥åºè®°å½") public void exportConsumablesInRecord(HttpServletResponse response, ConsumablesInRecordDto ConsumablesInRecordDto) { consumablesInRecordService.exportConsumablesInRecord(response,ConsumablesInRecordDto); public void exportConsumablesInRecord(HttpServletResponse response, ConsumablesInRecordDto consumablesInRecordDto) { consumablesInRecordService.exportConsumablesInRecord(response,consumablesInRecordDto); } } src/main/java/com/ruoyi/consumables/controller/ConsumablesInventoryController.java
@@ -35,37 +35,37 @@ public class ConsumablesInventoryController { @Autowired private ConsumablesInventoryService ConsumablesInventoryService; private ConsumablesInventoryService consumablesInventoryService; @GetMapping("/pageConsumablesInventory") @ApiOperation("å页æ¥è¯¢åºå") public R pageConsumablesInventory(Page page, ConsumablesInventoryDto ConsumablesInventoryDto) { IPage<ConsumablesInventoryDto> ConsumablesInventoryDtoIPage = ConsumablesInventoryService.pageConsumablesInventory(page, ConsumablesInventoryDto); public R pageConsumablesInventory(Page page, ConsumablesInventoryDto consumablesInventoryDto) { IPage<ConsumablesInventoryDto> ConsumablesInventoryDtoIPage = consumablesInventoryService.pageConsumablesInventory(page, consumablesInventoryDto); return R.ok(ConsumablesInventoryDtoIPage); } @PostMapping("/addConsumablesInventory") @ApiOperation("æ°å¢åºå") public R addConsumablesInventory(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) { ConsumablesInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_IN.getCode())); ConsumablesInventoryDto.setRecordId(0L); return R.ok(ConsumablesInventoryService.addConsumablesInventory(ConsumablesInventoryDto)); public R addConsumablesInventory(@RequestBody ConsumablesInventoryDto consumablesInventoryDto) { consumablesInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_IN.getCode())); consumablesInventoryDto.setRecordId(0L); return R.ok(consumablesInventoryService.addConsumablesInventory(consumablesInventoryDto)); } @PostMapping("/subtractConsumablesInventory") @ApiOperation("æ£ååºå") public R subtractConsumablesInventory(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) { ConsumablesInventoryDto.setRecordType(String.valueOf(StockOutQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_OUT.getCode())); ConsumablesInventoryDto.setRecordId(0L); return R.ok(ConsumablesInventoryService.subtractConsumablesInventory(ConsumablesInventoryDto)); public R subtractConsumablesInventory(@RequestBody ConsumablesInventoryDto consumablesInventoryDto) { consumablesInventoryDto.setRecordType(String.valueOf(StockOutQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_OUT.getCode())); consumablesInventoryDto.setRecordId(0L); return R.ok(consumablesInventoryService.subtractConsumablesInventory(consumablesInventoryDto)); } @PostMapping("importConsumablesInventory") @ApiOperation("å¯¼å ¥åºå") public R importConsumablesInventory(MultipartFile file) { return ConsumablesInventoryService.importConsumablesInventory(file); return consumablesInventoryService.importConsumablesInventory(file); } @Log(title = "ä¸è½½åºåå¯¼å ¥æ¨¡æ¿", businessType = BusinessType.EXPORT) @@ -78,31 +78,31 @@ @PostMapping("/exportConsumablesInventory") @ApiOperation("导åºåºå") public void exportConsumablesInventory(HttpServletResponse response, ConsumablesInventoryDto ConsumablesInventoryDto) { ConsumablesInventoryService.exportConsumablesInventory(response, ConsumablesInventoryDto); public void exportConsumablesInventory(HttpServletResponse response, ConsumablesInventoryDto consumablesInventoryDto) { consumablesInventoryService.exportConsumablesInventory(response, consumablesInventoryDto); } @GetMapping("ConsumablesInventoryPage") @ApiOperation("åºåæ¥è¡¨æ¥è¯¢") public R ConsumablesInventoryPage(Page page, ConsumablesInventoryDto consumablesInventoryDto) { return R.ok(ConsumablesInventoryService.consumablesInventoryPage(consumablesInventoryDto,page)); return R.ok(consumablesInventoryService.consumablesInventoryPage(consumablesInventoryDto,page)); } @GetMapping("ConsumablesInAndOutRecord") @ApiOperation("ç»è®¡å个产åçå ¥åºååºåºè®°å½") public R ConsumablesInAndOutRecord(ConsumablesInventoryDto consumablesInventoryDto, Page page) { return R.ok(ConsumablesInventoryService.consumablesInAndOutRecord(consumablesInventoryDto,page)); return R.ok(consumablesInventoryService.consumablesInAndOutRecord(consumablesInventoryDto,page)); } @PostMapping("/frozenConsumables") @ApiOperation("å»ç»åºå") public R frozenConsumables(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) { return R.ok(ConsumablesInventoryService.frozenConsumables(ConsumablesInventoryDto)); public R frozenConsumables(@RequestBody ConsumablesInventoryDto consumablesInventoryDto) { return R.ok(consumablesInventoryService.frozenConsumables(consumablesInventoryDto)); } @PostMapping("/thawConsumables") @ApiOperation("è§£å»åºå") public R thawConsumables(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) { return R.ok(ConsumablesInventoryService.thawConsumables(ConsumablesInventoryDto)); public R thawConsumables(@RequestBody ConsumablesInventoryDto consumablesInventoryDto) { return R.ok(consumablesInventoryService.thawConsumables(consumablesInventoryDto)); } } src/main/java/com/ruoyi/consumables/controller/ConsumablesOutRecordController.java
@@ -34,21 +34,21 @@ @GetMapping("/listPage") @Log(title = "ç产åºåº-åºåºç®¡ç-å表", businessType = BusinessType.OTHER) @ApiOperation(value = "åºåºç®¡çå表") public AjaxResult listPage(Page page, ConsumablesOutRecordDto ConsumablesOutRecordDto) { IPage<ConsumablesOutRecordDto> result = consumablesUnInventoryDto.listPage(page, ConsumablesOutRecordDto); public AjaxResult listPage(Page page, ConsumablesOutRecordDto consumablesOutRecordDto) { IPage<ConsumablesOutRecordDto> result = consumablesUnInventoryDto.listPage(page, consumablesOutRecordDto); return AjaxResult.success(result); } @PostMapping("") @Log(title = "åºåºç®¡ç-æ°å¢åºåº", businessType = BusinessType.INSERT) public AjaxResult add(@RequestBody ConsumablesOutRecordDto ConsumablesOutRecordDto) { return AjaxResult.success(consumablesUnInventoryDto.add(ConsumablesOutRecordDto)); public AjaxResult add(@RequestBody ConsumablesOutRecordDto consumablesOutRecordDto) { return AjaxResult.success(consumablesUnInventoryDto.add(consumablesOutRecordDto)); } @PutMapping("/{id}") @Log(title = "åºåºç®¡ç-æ´æ°åºåº", businessType = BusinessType.UPDATE) public AjaxResult update(@PathVariable("id") Long id, @RequestBody ConsumablesOutRecordDto ConsumablesOutRecordDto) { return AjaxResult.success(consumablesUnInventoryDto.update(id, ConsumablesOutRecordDto)); public AjaxResult update(@PathVariable("id") Long id, @RequestBody ConsumablesOutRecordDto consumablesOutRecordDto) { return AjaxResult.success(consumablesUnInventoryDto.update(id, consumablesOutRecordDto)); } @DeleteMapping("") @@ -62,8 +62,8 @@ @PostMapping("/exportConsumablesOutRecord") @ApiOperation("导åºåºåºè®°å½") public void exportConsumablesOutRecord(HttpServletResponse response, ConsumablesOutRecordDto ConsumablesOutRecordDto) { consumablesUnInventoryDto.exportConsumablesOutRecord(response,ConsumablesOutRecordDto); public void exportConsumablesOutRecord(HttpServletResponse response, ConsumablesOutRecordDto consumablesOutRecordDto) { consumablesUnInventoryDto.exportConsumablesOutRecord(response,consumablesOutRecordDto); } } src/main/java/com/ruoyi/consumables/controller/ConsumablesUnInventoryController.java
@@ -33,8 +33,8 @@ @GetMapping("/pageConsumablesUnInventory") @ApiOperation("å页æ¥è¯¢åºå") public R pageConsumablesUnInventory(Page page, ConsumablesUnInventoryDto consumablesUnInventoryDto) { IPage<ConsumablesUnInventoryDto> ConsumablesUnInventoryDtoIPage = consumablesUnInventoryService.pageConsumablesUnInventory(page, consumablesUnInventoryDto); return R.ok(ConsumablesUnInventoryDtoIPage); IPage<ConsumablesUnInventoryDto> consumablesUnInventoryDtoIPage = consumablesUnInventoryService.pageConsumablesUnInventory(page, consumablesUnInventoryDto); return R.ok(consumablesUnInventoryDtoIPage); } @PostMapping("/addConsumablesUnInventory") src/main/java/com/ruoyi/consumables/mapper/ConsumablesInventoryMapper.java
@@ -36,9 +36,9 @@ List<ConsumablesInventoryExportData> listConsumablesInventoryExportData(@Param("ew") ConsumablesInventoryDto ConsumablesInventoryDto); IPage<ConsumablesInRecordDto> ConsumablesInventoryPage(@Param("ew") ConsumablesInventoryDto ConsumablesInventoryDto, Page page); IPage<ConsumablesInRecordDto> consumablesInventoryPage(@Param("ew") ConsumablesInventoryDto ConsumablesInventoryDto, Page page); IPage<ConsumablesInventoryDto> ConsumablesInAndOutRecord(@Param("ew") ConsumablesInventoryDto ConsumablesInventoryDto, Page page); IPage<ConsumablesInventoryDto> consumablesInAndOutRecord(@Param("ew") ConsumablesInventoryDto ConsumablesInventoryDto, Page page); BigDecimal selectTotal(); src/main/java/com/ruoyi/consumables/mapper/ConsumablesUnInventoryMapper.java
@@ -22,11 +22,11 @@ @Mapper public interface ConsumablesUnInventoryMapper extends BaseMapper<ConsumablesUnInventory> { IPage<ConsumablesUnInventoryDto> pageConsumablesUnInventory(Page page, @Param("ew") ConsumablesUnInventoryDto ConsumablesUnInventoryDto); IPage<ConsumablesUnInventoryDto> pageConsumablesUnInventory(Page page, @Param("ew") ConsumablesUnInventoryDto consumablesUnInventoryDto); int updateSubtractConsumablesUnInventory(@Param("ew") ConsumablesUnInventoryDto ConsumablesUnInventoryDto); int updateSubtractConsumablesUnInventory(@Param("ew") ConsumablesUnInventoryDto consumablesUnInventoryDto); int updateAddConsumablesUnInventory(@Param("ew") ConsumablesUnInventoryDto ConsumablesUnInventoryDto); int updateAddConsumablesUnInventory(@Param("ew") ConsumablesUnInventoryDto consumablesUnInventoryDto); List<ConsumablesUnInventoryExportData> listConsumablesInventoryExportData(@Param("ew") ConsumablesUnInventoryDto ConsumablesUnInventoryDto); List<ConsumablesUnInventoryExportData> listConsumablesInventoryExportData(@Param("ew") ConsumablesUnInventoryDto consumablesUnInventoryDto); } src/main/java/com/ruoyi/consumables/pojo/ConsumablesInRecord.java
@@ -27,7 +27,7 @@ private String inboundBatches; @ApiModelProperty(value = "å ¥åºæ°é") private BigDecimal consumablesInNum; private BigDecimal stockInNum; @ApiModelProperty(value = "è®°å½ç±»å æä¸¾") private String recordType; src/main/java/com/ruoyi/consumables/pojo/ConsumablesOutRecord.java
@@ -35,7 +35,7 @@ private String outboundBatches; @ApiModelProperty("å ¥åºæ°é") private BigDecimal consumablesOutNum; private BigDecimal stockOutNum; @ApiModelProperty("å ¥åºæ¥æºid") private Long recordId; @@ -94,4 +94,7 @@ @ApiModelProperty("产åid") private Long productId; @ApiModelProperty("ç£ åæä»¶è·¯å¾") private String weighbridgeDocPath; } src/main/java/com/ruoyi/consumables/service/ConsumablesOutRecordService.java
@@ -18,13 +18,13 @@ * @since 2026-01-21 05:27:04 */ public interface ConsumablesOutRecordService extends IService<ConsumablesOutRecord> { IPage<ConsumablesOutRecordDto> listPage(Page page, ConsumablesOutRecordDto ConsumablesOutRecordDto); IPage<ConsumablesOutRecordDto> listPage(Page page, ConsumablesOutRecordDto consumablesOutRecordDto); int add(ConsumablesOutRecordDto ConsumablesOutRecordDto); int add(ConsumablesOutRecordDto consumablesOutRecordDto); int update(Long id, ConsumablesOutRecordDto ConsumablesOutRecordDto); int update(Long id, ConsumablesOutRecordDto consumablesOutRecordDto); int batchDelete(List<Long> ids); void exportConsumablesOutRecord(HttpServletResponse response, ConsumablesOutRecordDto ConsumablesOutRecordDto); void exportConsumablesOutRecord(HttpServletResponse response, ConsumablesOutRecordDto consumablesOutRecordDto); } src/main/java/com/ruoyi/consumables/service/ConsumablesUnInventoryService.java
@@ -19,15 +19,15 @@ */ public interface ConsumablesUnInventoryService extends IService<ConsumablesUnInventory> { IPage<ConsumablesUnInventoryDto> pageConsumablesUnInventory(Page page, ConsumablesUnInventoryDto ConsumablesUnInventoryDto); IPage<ConsumablesUnInventoryDto> pageConsumablesUnInventory(Page page, ConsumablesUnInventoryDto consumablesUnInventoryDto); Integer addConsumablesUnInventory(ConsumablesUnInventoryDto ConsumablesUnInventoryDto); Integer addConsumablesUnInventory(ConsumablesUnInventoryDto consumablesUnInventoryDto); Integer subtractConsumablesUnInventory(ConsumablesUnInventoryDto ConsumablesUnInventoryDto); Integer subtractConsumablesUnInventory(ConsumablesUnInventoryDto consumablesUnInventoryDto); void exportConsumablesUnInventory(HttpServletResponse response, ConsumablesUnInventoryDto ConsumablesUnInventoryDto); void exportConsumablesUnInventory(HttpServletResponse response, ConsumablesUnInventoryDto consumablesUnInventoryDto); Boolean frozenConsumables(ConsumablesInventoryDto ConsumablesInventoryDto); Boolean frozenConsumables(ConsumablesInventoryDto consumablesInventoryDto); Boolean thawConsumables(ConsumablesInventoryDto ConsumablesInventoryDto); Boolean thawConsumables(ConsumablesInventoryDto consumablesInventoryDto); } src/main/java/com/ruoyi/consumables/service/impl/ConsumablesInRecordServiceImpl.java
@@ -79,7 +79,7 @@ }else { ConsumablesInventoryDto consumablesInRecordDto = new ConsumablesInventoryDto(); consumablesInRecordDto.setProductModelId(consumablesInventory.getProductModelId()); consumablesInRecordDto.setQualitity(consumablesInRecord.getConsumablesInNum()); consumablesInRecordDto.setQualitity(consumablesInRecord.getStockInNum()); consumablesInventoryMapper.updateSubtractConsumablesInventory(consumablesInRecordDto); } }else if (consumablesInRecord.getType().equals("1")) { @@ -89,7 +89,7 @@ }else { ConsumablesUnInventoryDto consumablesUnInventoryDto = new ConsumablesUnInventoryDto(); consumablesUnInventoryDto.setProductModelId(consumablesUnInventory.getProductModelId()); consumablesUnInventoryDto.setQualitity(consumablesInRecord.getConsumablesInNum()); consumablesUnInventoryDto.setQualitity(consumablesInRecord.getStockInNum()); consumablesUnInventoryMapper.updateSubtractConsumablesUnInventory(consumablesUnInventoryDto); } } src/main/java/com/ruoyi/consumables/service/impl/ConsumablesInventoryServiceImpl.java
@@ -19,8 +19,10 @@ import com.ruoyi.framework.web.domain.R; import com.ruoyi.sales.mapper.SalesLedgerProductMapper; import com.ruoyi.sales.pojo.SalesLedgerProduct; import com.ruoyi.stock.dto.StockInRecordDto; import com.ruoyi.stock.word.WeighbridgeDocGenerator; import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -43,14 +45,15 @@ @RequiredArgsConstructor(onConstructor_ = @Autowired) public class ConsumablesInventoryServiceImpl extends ServiceImpl<ConsumablesInventoryMapper, ConsumablesInventory> implements ConsumablesInventoryService { private final ConsumablesInventoryMapper ConsumablesInventoryMapper; private final ConsumablesInRecordService ConsumablesInRecordService; private final ConsumablesOutRecordService ConsumablesOutRecordService; private final ConsumablesInventoryMapper consumablesInventoryMapper; private final ConsumablesInRecordService consumablesInRecordService; private final ConsumablesOutRecordService consumablesOutRecordService; private final SalesLedgerProductMapper salesLedgerProductMapper; private final WeighbridgeDocGenerator weighbridgeDocGenerator; @Override public IPage<ConsumablesInventoryDto> pageConsumablesInventory(Page page, ConsumablesInventoryDto ConsumablesInventoryDto) { return ConsumablesInventoryMapper.pageConsumablesInventory(page, ConsumablesInventoryDto); public IPage<ConsumablesInventoryDto> pageConsumablesInventory(Page page, ConsumablesInventoryDto consumablesInventoryDto) { return consumablesInventoryMapper.pageConsumablesInventory(page, consumablesInventoryDto); } //å ¥åºè°ç¨ @@ -61,7 +64,7 @@ ConsumablesInRecordDto consumablesInRecordDto = new ConsumablesInRecordDto(); consumablesInRecordDto.setRecordId(consumablesInventoryDto.getRecordId()); consumablesInRecordDto.setRecordType(consumablesInventoryDto.getRecordType()); consumablesInRecordDto.setConsumablesInNum(consumablesInventoryDto.getNetWeight()); consumablesInRecordDto.setStockInNum(consumablesInventoryDto.getNetWeight()); consumablesInRecordDto.setWeighingDate(consumablesInventoryDto.getWeighingDate()); consumablesInRecordDto.setNetWeight(consumablesInventoryDto.getNetWeight()); consumablesInRecordDto.setGrossWeight(consumablesInventoryDto.getGrossWeight()); @@ -71,10 +74,15 @@ consumablesInRecordDto.setProductModelId(consumablesInventoryDto.getProductModelId()); consumablesInRecordDto.setProductId(consumablesInventoryDto.getProductId()); consumablesInRecordDto.setType("0"); ConsumablesInRecordService.add(consumablesInRecordDto); //çæç£ å StockInRecordDto stockInRecordDto = new StockInRecordDto(); BeanUtils.copyProperties(consumablesInventoryDto, stockInRecordDto); String absoluteDocPath = weighbridgeDocGenerator.generateWeighbridgeDoc(stockInRecordDto); consumablesInRecordDto.setWeighbridgeDocPath(absoluteDocPath); consumablesInRecordService.add(consumablesInRecordDto); //åè¿è¡æ°å¢åºåæ°éåºå //å æ¥è¯¢åºå表ä¸çäº§åæ¯å¦åå¨ï¼ä¸å卿°å¢ï¼å卿´æ° ConsumablesInventory oldConsumablesInventory = ConsumablesInventoryMapper.selectOne(new QueryWrapper<ConsumablesInventory>().lambda().eq(ConsumablesInventory::getProductModelId, consumablesInventoryDto.getProductModelId())); ConsumablesInventory oldConsumablesInventory = consumablesInventoryMapper.selectOne(new QueryWrapper<ConsumablesInventory>().lambda().eq(ConsumablesInventory::getProductModelId, consumablesInventoryDto.getProductModelId())); if (ObjectUtils.isEmpty(oldConsumablesInventory)) { ConsumablesInventory newConsumablesInventory = new ConsumablesInventory(); newConsumablesInventory.setProductModelId(consumablesInventoryDto.getProductModelId()); @@ -83,10 +91,11 @@ newConsumablesInventory.setRemark(consumablesInventoryDto.getRemark()); newConsumablesInventory.setLockedQuantity(consumablesInventoryDto.getLockedQuantity()); newConsumablesInventory.setWarnNum(consumablesInventoryDto.getWarnNum()); ConsumablesInventoryMapper.insert(newConsumablesInventory); newConsumablesInventory.setProductId(consumablesInventoryDto.getProductId()); consumablesInventoryMapper.insert(newConsumablesInventory); } else { consumablesInventoryDto.setQualitity(consumablesInventoryDto.getNetWeight()); ConsumablesInventoryMapper.updateAddConsumablesInventory(consumablesInventoryDto); consumablesInventoryMapper.updateAddConsumablesInventory(consumablesInventoryDto); } return true; } @@ -100,7 +109,7 @@ consumablesOutRecordDto.setRecordId(consumablesInventoryDto.getRecordId()); consumablesOutRecordDto.setRecordType(consumablesInventoryDto.getRecordType()); consumablesOutRecordDto.setWeighingDate(consumablesInventoryDto.getWeighingDate()); consumablesOutRecordDto.setConsumablesOutNum(consumablesInventoryDto.getNetWeight()); consumablesOutRecordDto.setStockOutNum(consumablesInventoryDto.getNetWeight()); consumablesOutRecordDto.setNetWeight(consumablesInventoryDto.getNetWeight()); consumablesOutRecordDto.setGrossWeight(consumablesInventoryDto.getGrossWeight()); consumablesOutRecordDto.setTareWeight(consumablesInventoryDto.getTareWeight()); @@ -109,8 +118,13 @@ consumablesOutRecordDto.setLicensePlateNo(consumablesInventoryDto.getLicensePlateNo()); consumablesOutRecordDto.setProductId(consumablesInventoryDto.getProductId()); consumablesOutRecordDto.setType("0"); ConsumablesOutRecordService.add(consumablesOutRecordDto); ConsumablesInventory oldConsumablesInventory = ConsumablesInventoryMapper.selectOne(new QueryWrapper<ConsumablesInventory>().lambda().eq(ConsumablesInventory::getProductModelId, consumablesInventoryDto.getProductModelId())); //çæç£ å StockInRecordDto stockInRecordDto = new StockInRecordDto(); BeanUtils.copyProperties(consumablesInventoryDto, stockInRecordDto); String absoluteDocPath = weighbridgeDocGenerator.generateWeighbridgeDoc(stockInRecordDto); consumablesOutRecordDto.setWeighbridgeDocPath(absoluteDocPath); consumablesOutRecordService.add(consumablesOutRecordDto); ConsumablesInventory oldConsumablesInventory = consumablesInventoryMapper.selectOne(new QueryWrapper<ConsumablesInventory>().lambda().eq(ConsumablesInventory::getProductModelId, consumablesInventoryDto.getProductModelId())); if (ObjectUtils.isEmpty(oldConsumablesInventory)) { throw new RuntimeException("产ååºåä¸åå¨"); } @@ -122,7 +136,7 @@ throw new RuntimeException("åºåä¸è¶³æ æ³åºåº"); } ConsumablesInventoryMapper.updateSubtractConsumablesInventory(consumablesInventoryDto); consumablesInventoryMapper.updateSubtractConsumablesInventory(consumablesInventoryDto); return true; } @@ -143,18 +157,18 @@ for (SalesLedgerProduct item : salesLedgerProducts) { if (item.getProductCategory().equals(dto.getProductName()) && item.getSpecificationModel().equals(dto.getModel())) { ConsumablesInventoryDto ConsumablesInventoryDto = new ConsumablesInventoryDto(); ConsumablesInventoryDto.setRecordId(0L); ConsumablesInventoryDto.setRecordType(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_IN.getCode()); ConsumablesInventoryDto.setQualitity(dto.getQualitity()); ConsumablesInventoryDto.setRemark(dto.getRemark()); ConsumablesInventoryDto.setWarnNum(dto.getWarnNum()); ConsumablesInventoryDto consumablesInventoryDto = new ConsumablesInventoryDto(); consumablesInventoryDto.setRecordId(0L); consumablesInventoryDto.setRecordType(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_IN.getCode()); consumablesInventoryDto.setQualitity(dto.getQualitity()); consumablesInventoryDto.setRemark(dto.getRemark()); consumablesInventoryDto.setWarnNum(dto.getWarnNum()); if (ObjectUtils.isNotEmpty(dto.getLockedQuantity()) && dto.getLockedQuantity().compareTo(dto.getQualitity()) > 0) { throw new RuntimeException("å»ç»æ°éä¸è½è¶ è¿æ¬æ¬¡å¯¼å ¥çåºåæ°é"); } ConsumablesInventoryDto.setLockedQuantity(dto.getLockedQuantity()); ConsumablesInventoryDto.setProductModelId(item.getProductModelId()); this.addConsumablesInventory(ConsumablesInventoryDto); consumablesInventoryDto.setLockedQuantity(dto.getLockedQuantity()); consumablesInventoryDto.setProductModelId(item.getProductModelId()); this.addConsumablesInventory(consumablesInventoryDto); matched = true; break; // æ¾å°å¹é 项åè·³åºå¾ªç¯ } @@ -184,44 +198,44 @@ @Override public void exportConsumablesInventory(HttpServletResponse response, ConsumablesInventoryDto ConsumablesInventoryDto) { public void exportConsumablesInventory(HttpServletResponse response, ConsumablesInventoryDto consumablesInventoryDto) { List<ConsumablesInventoryExportData> list = ConsumablesInventoryMapper.listConsumablesInventoryExportData(ConsumablesInventoryDto); List<ConsumablesInventoryExportData> list = consumablesInventoryMapper.listConsumablesInventoryExportData(consumablesInventoryDto); ExcelUtil<ConsumablesInventoryExportData> util = new ExcelUtil<>(ConsumablesInventoryExportData.class); util.exportExcel(response, list, "åºåä¿¡æ¯"); } @Override public IPage<ConsumablesInRecordDto> consumablesInventoryPage(ConsumablesInventoryDto consumablesInventoryDto, Page page) { return ConsumablesInventoryMapper.ConsumablesInventoryPage(consumablesInventoryDto, page); return consumablesInventoryMapper.consumablesInventoryPage(consumablesInventoryDto, page); } @Override public IPage<ConsumablesInventoryDto> consumablesInAndOutRecord(ConsumablesInventoryDto consumablesInventoryDto, Page page) { return ConsumablesInventoryMapper.ConsumablesInAndOutRecord(consumablesInventoryDto, page); return consumablesInventoryMapper.consumablesInAndOutRecord(consumablesInventoryDto, page); } @Override public Boolean frozenConsumables(ConsumablesInventoryDto ConsumablesInventoryDto) { ConsumablesInventory ConsumablesInventory = ConsumablesInventoryMapper.selectById(ConsumablesInventoryDto.getId()); if (ConsumablesInventory.getQualitity().compareTo(ConsumablesInventoryDto.getLockedQuantity()) < 0) { public Boolean frozenConsumables(ConsumablesInventoryDto consumablesInventoryDto) { ConsumablesInventory consumablesInventory = consumablesInventoryMapper.selectById(consumablesInventoryDto.getId()); if (consumablesInventory.getQualitity().compareTo(consumablesInventoryDto.getLockedQuantity()) < 0) { throw new RuntimeException("å»ç»æ°éä¸è½è¶ è¿åºåæ°é"); } if (ObjectUtils.isEmpty(ConsumablesInventory.getLockedQuantity())) { ConsumablesInventory.setLockedQuantity(ConsumablesInventoryDto.getLockedQuantity()); if (ObjectUtils.isEmpty(consumablesInventory.getLockedQuantity())) { consumablesInventory.setLockedQuantity(consumablesInventoryDto.getLockedQuantity()); } else { ConsumablesInventory.setLockedQuantity(ConsumablesInventory.getLockedQuantity().add(ConsumablesInventoryDto.getLockedQuantity())); consumablesInventory.setLockedQuantity(consumablesInventory.getLockedQuantity().add(consumablesInventoryDto.getLockedQuantity())); } return this.updateById(ConsumablesInventory); return this.updateById(consumablesInventory); } @Override public Boolean thawConsumables(ConsumablesInventoryDto ConsumablesInventoryDto) { ConsumablesInventory ConsumablesInventory = ConsumablesInventoryMapper.selectById(ConsumablesInventoryDto.getId()); if (ConsumablesInventory.getLockedQuantity().compareTo(ConsumablesInventoryDto.getLockedQuantity()) < 0) { public Boolean thawConsumables(ConsumablesInventoryDto consumablesInventoryDto) { ConsumablesInventory consumablesInventory = consumablesInventoryMapper.selectById(consumablesInventoryDto.getId()); if (consumablesInventory.getLockedQuantity().compareTo(consumablesInventoryDto.getLockedQuantity()) < 0) { throw new RuntimeException("è§£å»æ°éä¸è½è¶ è¿å»ç»æ°é"); } ConsumablesInventory.setLockedQuantity(ConsumablesInventory.getLockedQuantity().subtract(ConsumablesInventoryDto.getLockedQuantity())); return this.updateById(ConsumablesInventory); consumablesInventory.setLockedQuantity(consumablesInventory.getLockedQuantity().subtract(consumablesInventoryDto.getLockedQuantity())); return this.updateById(consumablesInventory); } } src/main/java/com/ruoyi/consumables/service/impl/ConsumablesOutRecordServiceImpl.java
@@ -18,7 +18,6 @@ import com.ruoyi.consumables.mapper.ConsumablesInventoryMapper; import com.ruoyi.consumables.mapper.ConsumablesOutRecordMapper; import com.ruoyi.consumables.mapper.ConsumablesUnInventoryMapper; import com.ruoyi.consumables.pojo.ConsumablesInRecord; import com.ruoyi.consumables.pojo.ConsumablesInventory; import com.ruoyi.consumables.pojo.ConsumablesOutRecord; import com.ruoyi.consumables.pojo.ConsumablesUnInventory; @@ -45,30 +44,28 @@ private ConsumablesUnInventoryMapper consumablesUnInventoryMapper; @Override public IPage<ConsumablesOutRecordDto> listPage(Page page, ConsumablesOutRecordDto ConsumablesOutRecordDto) { return consumablesOutRecordMapper.listPage(page, ConsumablesOutRecordDto); public IPage<ConsumablesOutRecordDto> listPage(Page page, ConsumablesOutRecordDto consumablesOutRecordDto) { return consumablesOutRecordMapper.listPage(page, consumablesOutRecordDto); } @Override public int add(ConsumablesOutRecordDto ConsumablesOutRecordDto) { public int add(ConsumablesOutRecordDto consumablesOutRecordDto) { String no = OrderUtils.countTodayByCreateTime(consumablesOutRecordMapper, "CK"); ConsumablesOutRecordDto.setOutboundBatches(no); ConsumablesInRecord ConsumablesInRecord = new ConsumablesInRecord(); BeanUtils.copyProperties(ConsumablesOutRecordDto, ConsumablesInRecord); return consumablesOutRecordMapper.insert(ConsumablesOutRecordDto); consumablesOutRecordDto.setOutboundBatches(no); return consumablesOutRecordMapper.insert(consumablesOutRecordDto); } @Override public int update(Long id, ConsumablesOutRecordDto ConsumablesOutRecordDto) { public int update(Long id, ConsumablesOutRecordDto consumablesOutRecordDto) { // å¤æå¯¹è±¡æ¯å¦åå¨ ConsumablesOutRecord ConsumablesOutRecord = consumablesOutRecordMapper.selectById(id); if (ConsumablesOutRecord == null){ ConsumablesOutRecord consumablesOutRecord = consumablesOutRecordMapper.selectById(id); if (consumablesOutRecord == null){ throw new BaseException("该åºåºè®°å½ä¸åå¨,æ æ³æ´æ°!!!"); } String[] ignoreProperties = {"id", "outbound_batches"};//æé¤id屿§ BeanUtils.copyProperties(ConsumablesOutRecordDto, ConsumablesOutRecord, ignoreProperties); return consumablesOutRecordMapper.updateById(ConsumablesOutRecord); BeanUtils.copyProperties(consumablesOutRecordDto, consumablesOutRecord, ignoreProperties); return consumablesOutRecordMapper.updateById(consumablesOutRecord); } @Override @@ -82,7 +79,7 @@ }else { ConsumablesInventoryDto consumablesInRecordDto = new ConsumablesInventoryDto(); consumablesInRecordDto.setProductModelId(consumablesInventory.getProductModelId()); consumablesInRecordDto.setQualitity(consumablesOutRecord.getConsumablesOutNum()); consumablesInRecordDto.setQualitity(consumablesOutRecord.getStockOutNum()); consumablesInventoryMapper.updateAddConsumablesInventory(consumablesInRecordDto); } }else if (consumablesOutRecord.getType().equals("1")) { @@ -92,7 +89,7 @@ }else { ConsumablesUnInventoryDto consumablesUnInventoryDto = new ConsumablesUnInventoryDto(); consumablesUnInventoryDto.setProductModelId(consumablesUnInventory.getProductModelId()); consumablesUnInventoryDto.setQualitity(consumablesOutRecord.getConsumablesOutNum()); consumablesUnInventoryDto.setQualitity(consumablesOutRecord.getStockOutNum()); consumablesUnInventoryMapper.updateAddConsumablesUnInventory(consumablesUnInventoryDto); } } @@ -101,8 +98,8 @@ } @Override public void exportConsumablesOutRecord(HttpServletResponse response, ConsumablesOutRecordDto ConsumablesOutRecordDto) { List<ConsumablesOutRecordExportData> list = consumablesOutRecordMapper.listConsumablesOutRecordExportData(ConsumablesOutRecordDto); public void exportConsumablesOutRecord(HttpServletResponse response, ConsumablesOutRecordDto consumablesOutRecordDto) { List<ConsumablesOutRecordExportData> list = consumablesOutRecordMapper.listConsumablesOutRecordExportData(consumablesOutRecordDto); for (ConsumablesOutRecordExportData consumablesInRecordExportData : list) { if (consumablesInRecordExportData.getType().equals("0")) { consumablesInRecordExportData.setRecordType(EnumUtil.fromCode(StockOutQualifiedRecordTypeEnum.class, Integer.parseInt(consumablesInRecordExportData.getRecordType())).getValue()); src/main/java/com/ruoyi/consumables/service/impl/ConsumablesUnInventoryServiceImpl.java
@@ -35,91 +35,91 @@ @AllArgsConstructor public class ConsumablesUnInventoryServiceImpl extends ServiceImpl<ConsumablesUnInventoryMapper, ConsumablesUnInventory> implements ConsumablesUnInventoryService { private ConsumablesUnInventoryMapper ConsumablesUnInventoryMapper; private ConsumablesUnInventoryMapper consumablesUnInventoryMapper; private ConsumablesOutRecordService ConsumablesOutRecordService; private ConsumablesInRecordService ConsumablesInRecordService; @Override public IPage<ConsumablesUnInventoryDto> pageConsumablesUnInventory(Page page, ConsumablesUnInventoryDto ConsumablesUnInventoryDto) { return ConsumablesUnInventoryMapper.pageConsumablesUnInventory(page, ConsumablesUnInventoryDto); public IPage<ConsumablesUnInventoryDto> pageConsumablesUnInventory(Page page, ConsumablesUnInventoryDto consumablesUnInventoryDto) { return consumablesUnInventoryMapper.pageConsumablesUnInventory(page, consumablesUnInventoryDto); } @Override @Transactional(rollbackFor = Exception.class) public Integer addConsumablesUnInventory(ConsumablesUnInventoryDto ConsumablesUnInventoryDto) { public Integer addConsumablesUnInventory(ConsumablesUnInventoryDto consumablesUnInventoryDto) { //æ°å¢å ¥åºè®°å½åæ·»å åºå ConsumablesInRecordDto ConsumablesInRecordDto = new ConsumablesInRecordDto(); ConsumablesInRecordDto.setRecordId(ConsumablesUnInventoryDto.getRecordId()); ConsumablesInRecordDto.setRecordType(ConsumablesUnInventoryDto.getRecordType()); ConsumablesInRecordDto.setConsumablesInNum(ConsumablesUnInventoryDto.getQualitity()); ConsumablesInRecordDto.setProductModelId(ConsumablesUnInventoryDto.getProductModelId()); ConsumablesInRecordDto.setType("1"); ConsumablesInRecordService.add(ConsumablesInRecordDto); ConsumablesInRecordDto consumablesInRecordDto = new ConsumablesInRecordDto(); consumablesInRecordDto.setRecordId(consumablesUnInventoryDto.getRecordId()); consumablesInRecordDto.setRecordType(consumablesUnInventoryDto.getRecordType()); consumablesInRecordDto.setStockInNum(consumablesUnInventoryDto.getQualitity()); consumablesInRecordDto.setProductModelId(consumablesUnInventoryDto.getProductModelId()); consumablesInRecordDto.setType("1"); ConsumablesInRecordService.add(consumablesInRecordDto); //åè¿è¡æ°å¢åºåæ°éåºå //å æ¥è¯¢åºå表ä¸çäº§åæ¯å¦åå¨ï¼ä¸å卿°å¢ï¼å卿´æ° ConsumablesUnInventory oldConsumablesUnInventory = ConsumablesUnInventoryMapper.selectOne(new QueryWrapper<ConsumablesUnInventory>().lambda().eq(ConsumablesUnInventory::getProductModelId, ConsumablesUnInventoryDto.getProductModelId())); ConsumablesUnInventory oldConsumablesUnInventory = consumablesUnInventoryMapper.selectOne(new QueryWrapper<ConsumablesUnInventory>().lambda().eq(ConsumablesUnInventory::getProductModelId, consumablesUnInventoryDto.getProductModelId())); if (ObjectUtils.isEmpty(oldConsumablesUnInventory)) { ConsumablesUnInventory newConsumablesUnInventory = new ConsumablesUnInventory(); newConsumablesUnInventory.setProductModelId(ConsumablesUnInventoryDto.getProductModelId()); newConsumablesUnInventory.setQualitity(ConsumablesUnInventoryDto.getQualitity()); newConsumablesUnInventory.setProductModelId(consumablesUnInventoryDto.getProductModelId()); newConsumablesUnInventory.setQualitity(consumablesUnInventoryDto.getQualitity()); newConsumablesUnInventory.setVersion(1); newConsumablesUnInventory.setRemark(ConsumablesUnInventoryDto.getRemark()); ConsumablesUnInventoryMapper.insert(newConsumablesUnInventory); newConsumablesUnInventory.setRemark(consumablesUnInventoryDto.getRemark()); consumablesUnInventoryMapper.insert(newConsumablesUnInventory); }else { ConsumablesUnInventoryMapper.updateAddConsumablesUnInventory(ConsumablesUnInventoryDto); consumablesUnInventoryMapper.updateAddConsumablesUnInventory(consumablesUnInventoryDto); } return 1; } @Override @Transactional(rollbackFor = Exception.class) public Integer subtractConsumablesUnInventory(ConsumablesUnInventoryDto ConsumablesUnInventoryDto) { public Integer subtractConsumablesUnInventory(ConsumablesUnInventoryDto consumablesUnInventoryDto) { // æ°å¢åºåºè®°å½ ConsumablesOutRecordDto ConsumablesOutRecordDto = new ConsumablesOutRecordDto(); ConsumablesOutRecordDto.setRecordId(ConsumablesUnInventoryDto.getRecordId()); ConsumablesOutRecordDto.setRecordType(ConsumablesUnInventoryDto.getRecordType()); ConsumablesOutRecordDto.setConsumablesOutNum(ConsumablesUnInventoryDto.getQualitity()); ConsumablesOutRecordDto.setProductModelId(ConsumablesUnInventoryDto.getProductModelId()); ConsumablesOutRecordDto.setType("1"); ConsumablesOutRecordService.add(ConsumablesOutRecordDto); ConsumablesUnInventory oldConsumablesInventory = ConsumablesUnInventoryMapper.selectOne(new QueryWrapper<ConsumablesUnInventory>().lambda().eq(ConsumablesUnInventory::getProductModelId, ConsumablesUnInventoryDto.getProductModelId())); ConsumablesOutRecordDto consumablesOutRecordDto = new ConsumablesOutRecordDto(); consumablesOutRecordDto.setRecordId(consumablesUnInventoryDto.getRecordId()); consumablesOutRecordDto.setRecordType(consumablesUnInventoryDto.getRecordType()); consumablesOutRecordDto.setStockOutNum(consumablesUnInventoryDto.getQualitity()); consumablesOutRecordDto.setProductModelId(consumablesUnInventoryDto.getProductModelId()); consumablesOutRecordDto.setType("1"); ConsumablesOutRecordService.add(consumablesOutRecordDto); ConsumablesUnInventory oldConsumablesInventory = consumablesUnInventoryMapper.selectOne(new QueryWrapper<ConsumablesUnInventory>().lambda().eq(ConsumablesUnInventory::getProductModelId, consumablesUnInventoryDto.getProductModelId())); if (ObjectUtils.isEmpty(oldConsumablesInventory)) { throw new RuntimeException("产ååºåä¸åå¨"); }else { ConsumablesUnInventoryMapper.updateSubtractConsumablesUnInventory(ConsumablesUnInventoryDto); consumablesUnInventoryMapper.updateSubtractConsumablesUnInventory(consumablesUnInventoryDto); } return 1; } @Override public void exportConsumablesUnInventory(HttpServletResponse response, ConsumablesUnInventoryDto ConsumablesUnInventoryDto) { List<ConsumablesUnInventoryExportData> list = ConsumablesUnInventoryMapper.listConsumablesInventoryExportData(ConsumablesUnInventoryDto); public void exportConsumablesUnInventory(HttpServletResponse response, ConsumablesUnInventoryDto consumablesUnInventoryDto) { List<ConsumablesUnInventoryExportData> list = consumablesUnInventoryMapper.listConsumablesInventoryExportData(consumablesUnInventoryDto); ExcelUtil<ConsumablesUnInventoryExportData> util = new ExcelUtil<>(ConsumablesUnInventoryExportData.class); util.exportExcel(response,list, "ä¸åæ ¼åºåä¿¡æ¯"); } @Override public Boolean frozenConsumables(ConsumablesInventoryDto ConsumablesInventoryDto) { ConsumablesUnInventory ConsumablesUnInventory = ConsumablesUnInventoryMapper.selectById(ConsumablesInventoryDto.getId()); if (ConsumablesUnInventory.getQualitity().compareTo(ConsumablesInventoryDto.getLockedQuantity())<0) { public Boolean frozenConsumables(ConsumablesInventoryDto consumablesInventoryDto) { ConsumablesUnInventory consumablesUnInventory = consumablesUnInventoryMapper.selectById(consumablesInventoryDto.getId()); if (consumablesUnInventory.getQualitity().compareTo(consumablesInventoryDto.getLockedQuantity())<0) { throw new RuntimeException("å»ç»æ°éä¸è½è¶ è¿åºåæ°é"); } if (ObjectUtils.isEmpty(ConsumablesUnInventory.getLockedQuantity())) { ConsumablesUnInventory.setLockedQuantity(ConsumablesInventoryDto.getLockedQuantity()); if (ObjectUtils.isEmpty(consumablesUnInventory.getLockedQuantity())) { consumablesUnInventory.setLockedQuantity(consumablesInventoryDto.getLockedQuantity()); }else { ConsumablesUnInventory.setLockedQuantity(ConsumablesUnInventory.getLockedQuantity().add(ConsumablesInventoryDto.getLockedQuantity())); consumablesUnInventory.setLockedQuantity(consumablesUnInventory.getLockedQuantity().add(consumablesInventoryDto.getLockedQuantity())); } return this.updateById(ConsumablesUnInventory); return this.updateById(consumablesUnInventory); } @Override public Boolean thawConsumables(ConsumablesInventoryDto ConsumablesInventoryDto) { ConsumablesUnInventory ConsumablesUnInventory = ConsumablesUnInventoryMapper.selectById(ConsumablesInventoryDto.getId()); if (ConsumablesUnInventory.getLockedQuantity().compareTo(ConsumablesInventoryDto.getLockedQuantity())<0) { public Boolean thawConsumables(ConsumablesInventoryDto consumablesInventoryDto) { ConsumablesUnInventory consumablesUnInventory = consumablesUnInventoryMapper.selectById(consumablesInventoryDto.getId()); if (consumablesUnInventory.getLockedQuantity().compareTo(consumablesInventoryDto.getLockedQuantity())<0) { throw new RuntimeException("è§£å»æ°éä¸è½è¶ è¿å»ç»æ°é"); } ConsumablesUnInventory.setLockedQuantity(ConsumablesUnInventory.getLockedQuantity().subtract(ConsumablesInventoryDto.getLockedQuantity())); return this.updateById(ConsumablesUnInventory); consumablesUnInventory.setLockedQuantity(consumablesUnInventory.getLockedQuantity().subtract(consumablesInventoryDto.getLockedQuantity())); return this.updateById(consumablesUnInventory); } } src/main/java/com/ruoyi/device/dto/DeviceRepairDto.java
@@ -3,11 +3,13 @@ import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; import com.ruoyi.sales.pojo.CommonFile; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.time.LocalDateTime; import java.util.Date; import java.util.List; @Data public class DeviceRepairDto { @@ -74,5 +76,7 @@ private String sparePartsNames; private List<CommonFile> fileList; } src/main/java/com/ruoyi/device/pojo/DeviceRepair.java
@@ -4,12 +4,14 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.other.pojo.TempFile; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDateTime; import java.util.Date; import java.util.List; @Data @TableName("device_repair") @@ -76,5 +78,6 @@ @ApiModelProperty("é¢ç¨å¤ä»¶ids") private String sparePartsIds; @ApiModelProperty("æä»¶å表") private List<TempFile> fileList; } src/main/java/com/ruoyi/device/service/impl/DeviceRepairServiceImpl.java
@@ -1,11 +1,12 @@ package com.ruoyi.device.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.xiaoymin.knife4j.core.util.CollectionUtils; import com.github.xiaoymin.knife4j.core.util.StrUtil; import com.google.common.collect.Lists; import com.ruoyi.common.enums.FileNameType; import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.device.dto.DeviceDefectRecordDto; @@ -20,14 +21,15 @@ import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.measuringinstrumentledger.mapper.SparePartsMapper; import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; import com.ruoyi.measuringinstrumentledger.service.SparePartsService; import com.ruoyi.other.pojo.TempFile; import com.ruoyi.other.service.TempFileService; import com.ruoyi.sales.mapper.CommonFileMapper; import com.ruoyi.sales.pojo.CommonFile; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import javax.servlet.http.HttpServletResponse; import java.util.*; @@ -46,12 +48,20 @@ private IDeviceLedgerService deviceLedgerService; @Autowired private SparePartsMapper sparePartsMapper; @Autowired private TempFileService tempFileService; @Autowired private CommonFileMapper commonFileMapper; @Override public IPage<DeviceRepairDto> queryPage(Page page, DeviceRepairDto deviceRepairDto) { IPage<DeviceRepairDto> deviceRepairDtoIPage = deviceRepairMapper.queryPage(page, deviceRepairDto); List<DeviceRepairDto> records = deviceRepairDtoIPage.getRecords(); List<Long> recordIds = records.stream() .map(DeviceRepairDto::getId) .collect(Collectors.toList()); if (!CollectionUtils.isEmpty(records)) { // 1. è·åææå¯ä¸çå¤ä»¶ID Set<String> allIds = records.stream() @@ -86,6 +96,12 @@ record.setSparePartsNames(names); }); } // å¤çæä»¶ List<CommonFile> commonFiles = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>().in(CommonFile::getCommonId, recordIds) .eq(CommonFile::getType, FileNameType.DeviceRepair.getValue())); Map<Long, List<CommonFile>> collect = commonFiles.stream() .collect(Collectors.groupingBy(CommonFile::getCommonId)); records.forEach(record -> record.setFileList(collect.get(record.getId()))); } return deviceRepairDtoIPage; @@ -94,6 +110,17 @@ @Override public AjaxResult saveDeviceRepair(DeviceRepair deviceRepair) { DeviceLedger byId = deviceLedgerService.getById(deviceRepair.getDeviceLedgerId()); if (CollectionUtils.isNotEmpty(deviceRepair.getFileList())) { List<String> fileIds = deviceRepair.getFileList().stream() .map(TempFile::getTempId) .collect(Collectors.toList()); try { tempFileService.migrateTempFilesToFormal(deviceRepair.getId(), fileIds, FileNameType.DeviceRepair.getValue()); } catch (Exception e) { log.error("设å¤ç»´ä¿®æä»¶è¿ç§»é误", e); } } deviceRepair.setDeviceName(byId.getDeviceName()); deviceRepair.setDeviceModel(byId.getDeviceModel()); boolean save = this.save(deviceRepair); @@ -106,6 +133,16 @@ @Override public AjaxResult updateDeviceRepair(DeviceRepair deviceRepair) { if (this.updateById(deviceRepair)) { if (CollectionUtils.isNotEmpty(deviceRepair.getFileList())) { List<String> fileIds = deviceRepair.getFileList().stream() .map(TempFile::getTempId) .collect(Collectors.toList()); try { tempFileService.migrateTempFilesToFormal(deviceRepair.getId(), fileIds, FileNameType.DeviceRepair.getValue()); } catch (Exception e) { log.error("设å¤ç»´ä¿®æä»¶è¿ç§»é误", e); } } Long id = deviceRepair.getId(); // DeviceDefectRecordDto deviceDefectRecordDto = new DeviceDefectRecordDto(); src/main/java/com/ruoyi/inspectiontask/pojo/QualityInspectItem.java
@@ -1,10 +1,12 @@ package com.ruoyi.inspectiontask.pojo; import com.baomidou.mybatisplus.annotation.*; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.time.LocalDateTime; import lombok.Data; /** * è´¨éæ£æµé¡¹ @@ -59,12 +61,16 @@ * */ @TableField(value = "create_time",fill = FieldFill.INSERT) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime createTime; /** * */ @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime updateTime; /** src/main/java/com/ruoyi/other/service/TempFileService.java
@@ -4,9 +4,12 @@ import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.util.List; public interface TempFileService { TempFile uploadFile(MultipartFile file,Integer type) throws IOException; String uploadByCommon(MultipartFile file, Integer type, Long id) throws IOException; void migrateTempFilesToFormal(Long businessId, List<String> tempFileIds, Integer fileType) throws IOException; } src/main/java/com/ruoyi/other/service/impl/TempFileServiceImpl.java
@@ -9,16 +9,13 @@ import com.ruoyi.sales.mapper.CommonFileMapper; import com.ruoyi.sales.pojo.CommonFile; import lombok.extern.slf4j.Slf4j; import org.apache.catalina.util.URLEncoder; import org.apache.commons.io.FilenameUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -98,6 +95,7 @@ * @param fileType æä»¶ç±»å(æ¥èªFileNameType) * @throws IOException æä»¶æä½å¼å¸¸ */ @Override public void migrateTempFilesToFormal(Long businessId, List<String> tempFileIds, Integer fileType) throws IOException { if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isEmpty(tempFileIds)) { return; src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
@@ -171,41 +171,40 @@ /*æ°å¢è´¨æ£*/ List<ProductProcessRouteItem> productProcessRouteItems = productProcessRouteItemMapper.selectList(Wrappers.<ProductProcessRouteItem>lambdaQuery().eq(ProductProcessRouteItem::getProductRouteId, productProcessRouteItem.getProductRouteId())); if (productProcessRouteItem.getIsQuality()) { //对åºçè¿ç¨æ£æè åºåæ£ int inspectType = 1; String process = productProcess.getName();//å·¥åº if (productProcessRouteItem.getDragSort() == productProcessRouteItems.size()) { //æåä¸éå·¥åºçæåºåæ£ inspectType = 2; process = null; } Product product = productMapper.selectById(productModel.getProductId()); QualityInspect qualityInspect = new QualityInspect(); qualityInspect.setProductId(product.getId()); qualityInspect.setProductName(product.getProductName()); qualityInspect.setModel(productModel.getModel()); qualityInspect.setUnit(productModel.getUnit()); qualityInspect.setQuantity(productQty); qualityInspect.setProcess(process); qualityInspect.setInspectState(0); qualityInspect.setInspectType(inspectType); qualityInspect.setProductMainId(productionProductMain.getId()); qualityInspect.setProductModelId(productModel.getId()); qualityInspectMapper.insert(qualityInspect); List<QualityTestStandard> qualityTestStandard = qualityTestStandardMapper.getQualityTestStandardByProductId(product.getId(), inspectType, process); if (qualityTestStandard.size() > 0) { qualityInspect.setTestStandardId(qualityTestStandard.get(0).getId()); qualityInspectMapper.updateById(qualityInspect); qualityTestStandardParamMapper.selectList(Wrappers.<QualityTestStandardParam>lambdaQuery() .eq(QualityTestStandardParam::getTestStandardId, qualityTestStandard.get(0).getId()))//é»è®¤è·åææ°ç .forEach(qualityTestStandardParam -> { QualityInspectParam param = new QualityInspectParam(); BeanUtils.copyProperties(qualityTestStandardParam, param); param.setId(null); param.setInspectId(qualityInspect.getId()); qualityInspectParamMapper.insert(param); }); } // int inspectType = 1; // String process = productProcess.getName();//å·¥åº // if (productProcessRouteItem.getDragSort() == productProcessRouteItems.size()) { // //æåä¸éå·¥åºçæåºåæ£ // inspectType = 2; // process = null; // } // Product product = productMapper.selectById(productModel.getProductId()); // QualityInspect qualityInspect = new QualityInspect(); // qualityInspect.setProductId(product.getId()); // qualityInspect.setProductName(product.getProductName()); // qualityInspect.setModel(productModel.getModel()); // qualityInspect.setUnit(productModel.getUnit()); // qualityInspect.setQuantity(productQty); // qualityInspect.setProcess(process); // qualityInspect.setInspectState(0); // qualityInspect.setInspectType(inspectType); // qualityInspect.setProductMainId(productionProductMain.getId()); // qualityInspect.setProductModelId(productModel.getId()); // qualityInspectMapper.insert(qualityInspect); // List<QualityTestStandard> qualityTestStandard = qualityTestStandardMapper.getQualityTestStandardByProductId(product.getId(), inspectType, process); // if (qualityTestStandard.size() > 0) { // qualityInspect.setTestStandardId(qualityTestStandard.get(0).getId()); // qualityInspectMapper.updateById(qualityInspect); // qualityTestStandardParamMapper.selectList(Wrappers.<QualityTestStandardParam>lambdaQuery() // .eq(QualityTestStandardParam::getTestStandardId, qualityTestStandard.get(0).getId()))//é»è®¤è·åææ°ç // .forEach(qualityTestStandardParam -> { // QualityInspectParam param = new QualityInspectParam(); // BeanUtils.copyProperties(qualityTestStandardParam, param); // param.setId(null); // param.setInspectId(qualityInspect.getId()); // qualityInspectParamMapper.insert(param); // }); // } }else { //ç´æ¥å ¥åº stockUtils.addStock(productProcessRouteItem.getProductModelId(), productQty, StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode(), productionProductMain.getId()); src/main/java/com/ruoyi/quality/controller/RawMaterialController.java
@@ -1,12 +1,20 @@ package com.ruoyi.quality.controller; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.enums.RawMaterialInspectState; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.quality.dto.RawMaterialDto; import com.ruoyi.quality.pojo.*; import com.ruoyi.quality.service.IQualityInspectFileService; import com.ruoyi.quality.service.RawMaterialQualityInspectItemService; import com.ruoyi.quality.service.RawMaterialService; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.util.List; /** @@ -23,6 +31,12 @@ @Resource private RawMaterialService rawMaterialService; @Resource private RawMaterialQualityInspectItemService rawMaterialQualityInspectItemService; @Resource private IQualityInspectFileService qualityInspectFileService; /** * åæå页æ¥è¯¢ */ @@ -31,6 +45,13 @@ return AjaxResult.success(rawMaterialService.listPage(page, rawMaterialDto)); } /** * åæè¯¦æ */ @GetMapping("/detail/{id}") public AjaxResult detail(@PathVariable Long id) { return AjaxResult.success(rawMaterialService.detail(id)); } /** * åææ°å¢ @@ -41,18 +62,72 @@ } /** * æ£æµæäº¤ * @param id åæid * @return */ @PatchMapping("/submit/{id}") public AjaxResult submit(@PathVariable Long id) { return AjaxResult.success(rawMaterialService.submit(id)); } /** * ä¿®æ¹æ£éªäºº * @param rawMaterialDto åæ * @return */ @PatchMapping("/updateCheckUserName") public AjaxResult updateCheckUserName(@RequestBody RawMaterialDto rawMaterialDto) { RawMaterial rawMaterial = new RawMaterial(); rawMaterial.setId(rawMaterialDto.getId()); rawMaterial.setCheckUserName(rawMaterialDto.getCheckUserName()); return AjaxResult.success(rawMaterialService.updateById(rawMaterial)); } /** * åææ´æ° */ @PutMapping("") public AjaxResult update(@RequestBody RawMaterialDto rawMaterialDto) { return AjaxResult.success(rawMaterialService.updateById(rawMaterialDto)); return AjaxResult.success(rawMaterialService.update(rawMaterialDto)); } /** * åæå é¤ */ @DeleteMapping("") @Transactional(rollbackFor = Exception.class) public AjaxResult delete(@RequestBody List<Integer> ids) { return AjaxResult.success(rawMaterialService.removeByIds(ids)); if(CollectionUtils.isEmpty(ids)){ return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); } //å¦æå·²ç»æäº¤å°±ä¸å 许å é¤ List<RawMaterial> rawMaterials = rawMaterialService.list(Wrappers.<RawMaterial>lambdaQuery() .in(RawMaterial::getId,ids) .eq(RawMaterial::getInspectState, RawMaterialInspectState.RawMaterialInspectStateSubmitted.getCode())); if(!CollectionUtils.isEmpty(rawMaterials)){ throw new RuntimeException("å·²æäº¤çæ°æ®ä¸å 许å é¤"); } //å 餿£éªåæ° rawMaterialQualityInspectItemService.remove(Wrappers.<RawMaterialQualityInspectItem>lambdaQuery() .in(RawMaterialQualityInspectItem::getRawMaterialId,ids)); //å 餿£éªéä»¶ qualityInspectFileService.remove(Wrappers.<QualityInspectFile>lambdaQuery() .in(QualityInspectFile::getInspectId,ids)); //å 餿£éªå return AjaxResult.success(rawMaterialService.removeBatchByIds(ids)); } /** * 导åºåææ°æ® */ @PostMapping("/export") public void export(HttpServletResponse response, RawMaterialDto rawMaterialDto) { rawMaterialService.export(response, rawMaterialDto); } @PostMapping("/down") public void down(HttpServletResponse response,@RequestBody RawMaterialDto rawMaterialDto) { rawMaterialService.down(response, rawMaterialDto); } } src/main/java/com/ruoyi/quality/dto/RawMaterialDto.java
@@ -1,16 +1,13 @@ package com.ruoyi.quality.dto; import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.framework.aspectj.lang.annotation.Excel; import com.ruoyi.inspectiontask.pojo.QualityInspectItem; import com.ruoyi.quality.pojo.RawMaterial; import com.ruoyi.quality.pojo.RawMaterialQualityInspectItem; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.time.LocalDate; import java.util.List; /** @@ -24,18 +21,14 @@ /** * å¼å§æ¶é´ */ @JsonFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("表åæç´¢æ¶é´èå´ï¼å¼å§æ¶é´") private LocalDate entryDateStart; private String entryDateStart; /** * ç»ææ¶é´ */ @JsonFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("表åæç´¢æ¶é´èå´ï¼ç»ææ¶é´") private LocalDate entryDateEnd; private String entryDateEnd; @ApiModelProperty("æ£éªç±»å 0å ¥åºæ£ 1è½¦é´æ£ 2åºåæ£") private String checkTypeText; @@ -46,6 +39,23 @@ @ApiModelProperty("ç±»å«(0:æªæäº¤;1:å·²æäº¤)") private String inspectStateText; @ApiModelProperty("åææ£æµé¡¹å表ids") private List<Long> qualityInspectItemIds; @ApiModelProperty("åææ£æµé¡¹å表") private List<QualityInspectItem> qualityInspectItem; @ApiModelProperty("产ååç§°") @Excel(name = "产ååç§°") private String productName; @ApiModelProperty("è§æ ¼åå·") @Excel(name = "è§æ ¼åå·") private String model; @ApiModelProperty("产åid") private Long productId; @ApiModelProperty("åä½") private String unit; @ApiModelProperty("æ£éªæ¥æ") private String checkTimeText; } src/main/java/com/ruoyi/quality/dto/RawMaterialQualityInspectItemDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,27 @@ package com.ruoyi.quality.dto; import com.ruoyi.quality.pojo.RawMaterialQualityInspectItem; import lombok.Data; @Data public class RawMaterialQualityInspectItemDto extends RawMaterialQualityInspectItem { /** * 项ç®åç§° */ private String name; /** * åä½ */ private String unit; /** * æ åå¼ */ private String standardValue; /** * å æ§å¼ */ private String internalControl; } src/main/java/com/ruoyi/quality/pojo/RawMaterial.java
@@ -3,8 +3,10 @@ import com.baomidou.mybatisplus.annotation.*; import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.framework.aspectj.lang.annotation.Excel; @@ -12,6 +14,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; import org.springframework.format.annotation.DateTimeFormat; /** * <p> @@ -35,25 +38,31 @@ @ApiModelProperty("产ååå·id") private Long productModelId; @ApiModelProperty("æ¹æ¬¡å·") private String batchNo; @ApiModelProperty("æ£éªç±»å 0å ¥åºæ£ 1è½¦é´æ£ 2åºåæ£") @ApiModelProperty("æ£éªç±»å 0å ¥åæ£ 1è½¦é´æ£ 2åºåæ£") @Excel(name = "æ£éªç±»å", readConverterExp = "0=å ¥åæ£,1=è½¦é´æ£,2=åºåæ£") private Integer checkType; @ApiModelProperty("æ¹æ¬¡å·") @Excel(name = "æ¹æ¬¡å·") private String batchNo; @ApiModelProperty("æ£éªç»æ 0åæ ¼ 1ä¸åæ ¼") @Excel(name = "æ£éªç»æ", readConverterExp = "0=åæ ¼,1=ä¸åæ ¼") private Integer checkResult; @ApiModelProperty("ç±»å«(0:æªæäº¤;1:å·²æäº¤)") @Excel(name = "æäº¤ç¶æ", readConverterExp = "0=æªæäº¤,1=å·²æäº¤") private Integer inspectState; @ApiModelProperty("æ£éªååç§°") @Excel(name = "æ£éªå") private String checkUserName; @ApiModelProperty("æ£éªæ¥æ") @JsonFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") @Excel(name = "æ£æµæ¥æ", width = 30, dateFormat = "yyyy-MM-dd") private LocalDate checkTime; private Date checkTime; @ApiModelProperty(value = "å建æ¶é´") @TableField(fill = FieldFill.INSERT) src/main/java/com/ruoyi/quality/pojo/RawMaterialQualityInspectItem.java
@@ -1,16 +1,13 @@ package com.ruoyi.quality.pojo; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.time.LocalDateTime; import com.baomidou.mybatisplus.annotation.*; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; import java.io.Serializable; import java.time.LocalDateTime; /** * <p> @@ -37,6 +34,9 @@ @ApiModelProperty("è´¨éæ£éªé¡¹id") private Long qualityInspectItemId; @ApiModelProperty("åéªå¼") private String testValue; @ApiModelProperty("å½å ¥æ¶é´") @TableField(fill = FieldFill.INSERT) private LocalDateTime createTime; @@ -44,4 +44,7 @@ @ApiModelProperty("æ´æ°æ¶é´") @TableField(fill = FieldFill.INSERT_UPDATE) private LocalDateTime updateTime; @TableField(select = false, exist = false) private Integer index; } src/main/java/com/ruoyi/quality/service/RawMaterialService.java
@@ -2,10 +2,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.quality.dto.RawMaterialDto; import com.ruoyi.quality.pojo.QualityInspectFile; import com.ruoyi.quality.pojo.RawMaterial; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.quality.dto.RawMaterialDto; import com.ruoyi.quality.pojo.RawMaterial; import javax.servlet.http.HttpServletResponse; /** * <p> @@ -18,5 +19,15 @@ public interface RawMaterialService extends IService<RawMaterial> { IPage<RawMaterialDto> listPage(Page page, RawMaterialDto rawMaterialDto); RawMaterialDto detail(Long id); boolean submit(Long id); boolean add(RawMaterialDto rawMaterialDto); boolean update(RawMaterialDto rawMaterialDto); void export(HttpServletResponse response, RawMaterialDto rawMaterialDto); void down(HttpServletResponse response, RawMaterialDto rawMaterialDto); } src/main/java/com/ruoyi/quality/service/impl/RawMaterialServiceImpl.java
@@ -1,31 +1,55 @@ package com.ruoyi.quality.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.collaborativeApproval.dto.DutyPlanDTO; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.config.Configure; import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl; import com.ruoyi.approve.vo.ApproveProcessVO; import com.ruoyi.basic.mapper.ProductMapper; import com.ruoyi.basic.mapper.ProductModelMapper; import com.ruoyi.basic.pojo.Product; import com.ruoyi.basic.pojo.ProductModel; import com.ruoyi.common.enums.RawMaterialCheckResult; import com.ruoyi.common.enums.RawMaterialCheckType; import com.ruoyi.common.enums.RawMaterialInspectState; import com.ruoyi.production.mapper.ProductProcessRouteMapper; import com.ruoyi.common.utils.HackLoopTableRenderPolicy; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.security.LoginUser; import com.ruoyi.inspectiontask.mapper.QualityInspectItemMapper; import com.ruoyi.inspectiontask.pojo.QualityInspectItem; import com.ruoyi.quality.dto.RawMaterialDto; import com.ruoyi.quality.mapper.RawMaterialQualityInspectItemMapper; import com.ruoyi.quality.pojo.RawMaterial; import com.ruoyi.quality.dto.RawMaterialQualityInspectItemDto; import com.ruoyi.quality.mapper.QualityUnqualifiedMapper; import com.ruoyi.quality.mapper.RawMaterialMapper; import com.ruoyi.quality.pojo.RawMaterialQualityInspectItem; import com.ruoyi.quality.pojo.*; import com.ruoyi.quality.service.RawMaterialQualityInspectItemService; import com.ruoyi.quality.service.RawMaterialService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.AllArgsConstructor; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; import javax.servlet.http.HttpServletResponse; import java.io.InputStream; import java.io.OutputStream; import java.net.URLEncoder; import java.time.LocalDate; import java.util.*; import java.util.stream.Collectors; import static com.ruoyi.home.service.impl.HomeServiceImpl.formatDate; /** * <p> * æå¡å®ç°ç±» * æå¡å®ç°ç±» * </p> * * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå ¬å¸ @@ -38,33 +62,304 @@ private RawMaterialQualityInspectItemService rawMaterialQualityInspectItemService; private QualityInspectItemMapper qualityInspectItemMapper; private ProductModelMapper productModelMapper; private ProductMapper productMapper; private QualityUnqualifiedMapper qualityUnqualifiedMapper; @Autowired private ApproveProcessServiceImpl approveProcessService; @Override public IPage<RawMaterialDto> listPage(Page page, RawMaterialDto rawMaterialDto) { IPage<RawMaterialDto> rawMaterials = rawMaterialMapper.listPage(page, rawMaterialDto); for (RawMaterialDto rawMaterial : rawMaterials.getRecords()) { rawMaterial.setCheckTypeText(RawMaterialCheckType.fromValue(rawMaterial.getCheckType()).getValue()); rawMaterial.setCheckResultText(RawMaterialCheckResult.fromValue(rawMaterial.getCheckResult()).getValue()); rawMaterial.setInspectStateText(RawMaterialInspectState.fromValue(rawMaterial.getInspectState()).getValue()); IPage<RawMaterialDto> pageRes = rawMaterialMapper.listPage(page, rawMaterialDto); List<RawMaterialDto> rawMaterials = pageRes.getRecords(); Map<Long, ProductModel> productModelMap = new HashMap<>(); Map<Long, Product> productMap = new HashMap<>(); if (CollectionUtils.isNotEmpty(rawMaterials)) { List<Long> productModelIds = rawMaterials.stream().map(RawMaterialDto::getProductModelId).collect(Collectors.toList()); List<ProductModel> productModels = productModelMapper.selectList(new LambdaQueryWrapper<ProductModel>() .in(ProductModel::getId, productModelIds)); productModelMap = productModels.stream().collect(Collectors.toMap(ProductModel::getId, productModel -> productModel)); List<Long> productIds = productModels.stream().map(ProductModel::getProductId).collect(Collectors.toList()); List<Product> products = productMapper.selectList(new LambdaQueryWrapper<Product>() .in(Product::getId, productIds)); productMap = products.stream().collect(Collectors.toMap(Product::getId, product -> product)); } return rawMaterials; for (RawMaterialDto rawMaterial : pageRes.getRecords()) { rawMaterial.setCheckTypeText(RawMaterialCheckType.fromValue(rawMaterial.getCheckType()) == null ? "" : RawMaterialCheckType.fromValue(rawMaterial.getCheckType()).getValue()); rawMaterial.setCheckResultText(RawMaterialCheckResult.fromValue(rawMaterial.getCheckResult()) == null ? "" : RawMaterialCheckResult.fromValue(rawMaterial.getCheckResult()).getValue()); rawMaterial.setInspectStateText(RawMaterialInspectState.fromValue(rawMaterial.getInspectState()) == null ? "" : RawMaterialInspectState.fromValue(rawMaterial.getInspectState()).getValue()); rawMaterial.setProductName(productMap.get(productModelMap.get(rawMaterial.getProductModelId()).getProductId()).getProductName()); rawMaterial.setModel(productModelMap.get(rawMaterial.getProductModelId()).getModel()); rawMaterial.setProductId(productModelMap.get(rawMaterial.getProductModelId()).getProductId()); } return pageRes; } @Override public RawMaterialDto detail(Long id) { RawMaterial rawMaterial = rawMaterialMapper.selectById(id); RawMaterialDto rawMaterialDto = new RawMaterialDto(); if (rawMaterial == null) { return rawMaterialDto; } BeanUtils.copyBeanProp(rawMaterialDto, rawMaterial); // è·åæ£æµé¡¹å ³èå ³ç³» List<RawMaterialQualityInspectItem> rawQualityList = rawMaterialQualityInspectItemService.list(new LambdaQueryWrapper<RawMaterialQualityInspectItem>() .eq(RawMaterialQualityInspectItem::getRawMaterialId, id)); Map<Long, RawMaterialQualityInspectItem> map = rawQualityList.stream().collect(Collectors.toMap(RawMaterialQualityInspectItem::getQualityInspectItemId, qualityInspectItem -> qualityInspectItem)); // è·åæ£éªé¡¹ç® List<QualityInspectItem> qualityInspectItems = new ArrayList<>(); if (CollectionUtils.isNotEmpty(rawQualityList)) { List<Long> qualityInspectItemIds = rawQualityList.stream().map(RawMaterialQualityInspectItem::getQualityInspectItemId).collect(Collectors.toList()); qualityInspectItems = qualityInspectItemMapper.selectList(new LambdaQueryWrapper<QualityInspectItem>() .in(QualityInspectItem::getId, qualityInspectItemIds)); } // æ¿æ¢åéªå¼ qualityInspectItems.forEach(qualityInspectItem -> { qualityInspectItem.setTestValue(map.get(qualityInspectItem.getId()).getTestValue()); }); rawMaterialDto.setQualityInspectItem(qualityInspectItems); // æ¥è¯¢äº§åid ProductModel productModel = productModelMapper.selectById(rawMaterialDto.getProductModelId()); Product product = productMapper.selectById(productModel.getProductId()); rawMaterialDto.setProductId(productModel.getProductId()); rawMaterialDto.setProductName(product.getProductName()); rawMaterialDto.setModel(productModel.getModel()); rawMaterialDto.setUnit(productModel.getUnit()); rawMaterialDto.setCheckResultText(RawMaterialCheckResult.fromValue(rawMaterial.getCheckResult()) == null ? "" : RawMaterialCheckResult.fromValue(rawMaterial.getCheckResult()).getValue()); rawMaterialDto.setCheckTypeText(RawMaterialCheckType.fromValue(rawMaterial.getCheckType()) == null ? "" : RawMaterialCheckType.fromValue(rawMaterial.getCheckType()).getValue()); return rawMaterialDto; } @Override @Transactional(rollbackFor = Exception.class) public boolean submit(Long id) { RawMaterial rawMaterial = rawMaterialMapper.selectById(id); if (rawMaterial.getCheckResult() == null) { throw new RuntimeException("请å 夿æ¯å¦åæ ¼"); } // ä¸åæ ¼ï¼çæä¸åæ ¼è®°å½ if (rawMaterial.getCheckResult().equals(RawMaterialCheckResult.RawMaterialCheckResultUnqualified.getCode())) { QualityUnqualified qualityUnqualified = new QualityUnqualified(); qualityUnqualified.setInspectId(rawMaterial.getId());//æ£éªid qualityUnqualified.setInspectType(rawMaterial.getCheckType());//æ£éªç±»å qualityUnqualified.setInspectState(0);//å¾ å¤ç qualityUnqualified.setCheckName(rawMaterial.getCheckUserName());//æ£éªååç§° qualityUnqualified.setCheckTime(rawMaterial.getCheckTime());//æ£éªæ¥æ ProductModel productModel = productModelMapper.selectById(rawMaterial.getProductModelId()); Product product = productMapper.selectById(productModel.getProductId()); qualityUnqualified.setProductId(productModel.getProductId());//产åid qualityUnqualified.setProductName(product.getProductName());//产ååç§° qualityUnqualified.setModel(productModel.getModel());//è§æ ¼åå· qualityUnqualified.setUnit(productModel.getUnit());//åä½ List<RawMaterialQualityInspectItem> inspectParams = rawMaterialQualityInspectItemService.list(Wrappers.<RawMaterialQualityInspectItem>lambdaQuery().eq(RawMaterialQualityInspectItem::getRawMaterialId, rawMaterial.getId())); // è·åå ³èçQualityInspectItem项ç®å String text = inspectParams.stream().map(item -> { QualityInspectItem qualityInspectItem = qualityInspectItemMapper.selectById(item.getQualityInspectItemId()); return qualityInspectItem != null ? qualityInspectItem.getName() : ""; }).collect(Collectors.joining(",")); qualityUnqualified.setDefectivePhenomena(text + "è¿äºé¡¹ç®ä¸åå¨ä¸åæ ¼");//ä¸åæ ¼ç°è±¡ qualityUnqualifiedMapper.insert(qualityUnqualified); } else { //åæ ¼: 产çåæå®¡æ ¸è®°å½ LoginUser loginUser = SecurityUtils.getLoginUser(); ApproveProcessVO approveProcessVO = new ApproveProcessVO(); approveProcessVO.setApproveType(9); approveProcessVO.setApproveRecordId(rawMaterial.getId()); approveProcessVO.setApproveDeptId(loginUser.getCurrentDeptId()); approveProcessVO.setApproveReason( "åæå®¡æ ¸æ¹å·ï¼"+rawMaterial.getBatchNo()); Long adminUserId = 1L; // todo å设第ä¸ä¸ªç®¡çåçID为1 approveProcessVO.setApproveUserIds(String.valueOf(adminUserId)); approveProcessVO.setApproveUser(loginUser.getUserId()); approveProcessVO.setApproveTime(LocalDate.now().toString()); try { approveProcessService.addApprove(approveProcessVO); }catch (Exception e){ log.error("RawMaterialServiceImpl error:{}", e); throw new RuntimeException("审æ¹å¤±è´¥"); } } rawMaterial.setInspectState(RawMaterialInspectState.RawMaterialInspectStateSubmitted.getCode()); return rawMaterialMapper.updateById(rawMaterial) > 0; } @Override @Transactional(rollbackFor = Exception.class) public boolean add(RawMaterialDto rawMaterialDto) { rawMaterialDto.setInspectState(RawMaterialInspectState.RawMaterialInspectStateUnsubmitted.getCode()); // æ°å¢åæ int i = rawMaterialMapper.insert(rawMaterialDto); // æ°å¢æ£æµé¡¹å ³èå ³ç³» if (rawMaterialDto.getQualityInspectItemIds() != null && !rawMaterialDto.getQualityInspectItemIds().isEmpty()) { List<RawMaterialQualityInspectItem> rawMaterialQualityInspectItems = rawMaterialDto.getQualityInspectItemIds().stream() .map(id -> { if (CollectionUtils.isNotEmpty(rawMaterialDto.getQualityInspectItem())) { List<RawMaterialQualityInspectItem> rawMaterialQualityInspectItems = rawMaterialDto.getQualityInspectItem().stream() .map(qualityInspectItem -> { RawMaterialQualityInspectItem item = new RawMaterialQualityInspectItem(); item.setRawMaterialId(rawMaterialDto.getId()); item.setQualityInspectItemId(id); item.setQualityInspectItemId(qualityInspectItem.getId()); item.setTestValue(qualityInspectItem.getTestValue()); return item; }) .collect(Collectors.toList()); rawMaterialQualityInspectItemService.saveBatch(rawMaterialQualityInspectItems); } // æ°å¢åæ return rawMaterialMapper.insert(rawMaterialDto) > 0; return i > 0; } } @Override @Transactional(rollbackFor = Exception.class) public boolean update(RawMaterialDto rawMaterialDto) { // æ´æ°åæ if (rawMaterialMapper.updateById(rawMaterialDto) <= 0) { return false; } Long rawMaterialId = rawMaterialDto.getId(); List<QualityInspectItem> newQualityInspectItems = rawMaterialDto.getQualityInspectItem(); // è·åç°ææ£éªé¡¹å ³èè®°å½ List<RawMaterialQualityInspectItem> existingItems = rawMaterialQualityInspectItemService.list( new LambdaQueryWrapper<RawMaterialQualityInspectItem>() .eq(RawMaterialQualityInspectItem::getRawMaterialId, rawMaterialId) ); // å é¤ä¸åå¨çå ³èè®°å½ if (CollectionUtils.isEmpty(newQualityInspectItems)) { // å¦ææ²¡ææ£éªé¡¹ï¼å 餿æç°æå ³èè®°å½ if (CollectionUtils.isNotEmpty(existingItems)) { List<Long> existingIds = existingItems.stream() .map(RawMaterialQualityInspectItem::getId) .collect(Collectors.toList()); rawMaterialQualityInspectItemService.removeByIds(existingIds); } return true; } // è·åæ°æ£éªé¡¹çIDéååæµè¯å¼æ å° Set<Long> newItemIds = newQualityInspectItems.stream() .map(QualityInspectItem::getId) .collect(Collectors.toSet()); Map<Long, String> testValueMap = newQualityInspectItems.stream() .collect(Collectors.toMap(QualityInspectItem::getId, QualityInspectItem::getTestValue)); // å é¤ä¸åå¨çå ³èè®°å½ List<Long> toDelete = existingItems.stream() .filter(item -> !newItemIds.contains(item.getQualityInspectItemId())) .map(RawMaterialQualityInspectItem::getId) .collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(toDelete)) { rawMaterialQualityInspectItemService.removeByIds(toDelete); } // å¤çæ´æ°æ°æ® List<RawMaterialQualityInspectItem> toUpdate = existingItems.stream() .filter(item -> newItemIds.contains(item.getQualityInspectItemId())) .peek(item -> item.setTestValue(testValueMap.get(item.getQualityInspectItemId()))) .collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(toUpdate)) { rawMaterialQualityInspectItemService.updateBatchById(toUpdate); } // å¤çæ°å¢æ°æ® Set<Long> existingItemIds = existingItems.stream() .map(RawMaterialQualityInspectItem::getQualityInspectItemId) .collect(Collectors.toSet()); List<RawMaterialQualityInspectItem> toCreate = newQualityInspectItems.stream() .filter(item -> !existingItemIds.contains(item.getId())) .map(item -> { RawMaterialQualityInspectItem newItem = new RawMaterialQualityInspectItem(); newItem.setRawMaterialId(rawMaterialId); newItem.setQualityInspectItemId(item.getId()); newItem.setTestValue(item.getTestValue()); return newItem; }) .collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(toCreate)) { rawMaterialQualityInspectItemService.saveBatch(toCreate); } return true; } @Override public void export(HttpServletResponse response, RawMaterialDto rawMaterialDto) { List<RawMaterialDto> rawMaterials = rawMaterialMapper.listPage(new Page<>(1, Integer.MAX_VALUE), rawMaterialDto).getRecords(); ExcelUtil<RawMaterialDto> util = new ExcelUtil<RawMaterialDto>(RawMaterialDto.class); util.exportExcel(response, rawMaterials, "åææ£éªå¯¼åº"); } @Override public void down(HttpServletResponse response, RawMaterialDto rawMaterialDto) { RawMaterial rawMaterial = rawMaterialMapper.selectById(rawMaterialDto.getId()); // è·å产ååå·ä¿¡æ¯ ProductModel productModel = productModelMapper.selectById(rawMaterial.getProductModelId()); Product product = productMapper.selectById(productModel.getProductId()); RawMaterialDto inspect = new RawMaterialDto(); BeanUtils.copyProperties(rawMaterial, inspect); inspect.setModel(productModel.getModel()); inspect.setProductName(product.getProductName()); inspect.setCheckTypeText(RawMaterialCheckType.fromValue(rawMaterial.getCheckType()) == null ? "" : RawMaterialCheckType.fromValue(rawMaterial.getCheckType()).getValue()); inspect.setCheckResultText(RawMaterialCheckResult.fromValue(rawMaterial.getCheckResult()) == null ? "" : RawMaterialCheckResult.fromValue(rawMaterial.getCheckResult()).getValue()); inspect.setCheckTimeText(formatDate(rawMaterial.getCheckTime())); List<RawMaterialQualityInspectItem> paramList = rawMaterialQualityInspectItemService.list( new LambdaQueryWrapper<RawMaterialQualityInspectItem>() .eq(RawMaterialQualityInspectItem::getRawMaterialId, rawMaterialDto.getId()) ); List<RawMaterialQualityInspectItemDto> inspectItems = new ArrayList<>(); int index = 1; for (RawMaterialQualityInspectItem item : paramList) { RawMaterialQualityInspectItemDto dto = new RawMaterialQualityInspectItemDto(); BeanUtils.copyProperties(item, dto); QualityInspectItem qualityInspectItem = qualityInspectItemMapper.selectById(item.getQualityInspectItemId()); dto.setName(qualityInspectItem.getName()); dto.setUnit(qualityInspectItem.getUnit()); dto.setStandardValue(qualityInspectItem.getStandardValue()); dto.setInternalControl(qualityInspectItem.getInternalControl()); dto.setIndex(index); inspectItems.add(dto); index++; } InputStream inputStream = this.getClass().getResourceAsStream("/static/report-template.docx"); Configure configure = Configure.builder() .bind("paramList", new HackLoopTableRenderPolicy()) .build(); XWPFTemplate template = XWPFTemplate.compile(inputStream, configure).render( new HashMap<String, Object>() {{ put("inspect", inspect); put("paramList", inspectItems); }}); try { response.setContentType("application/msword"); String fileName = URLEncoder.encode( "æ£éªæ¥å", "UTF-8"); response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".docx"); OutputStream os = response.getOutputStream(); template.write(os); os.flush(); os.close(); inputStream.close(); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("导åºå¤±è´¥"); } } } src/main/java/com/ruoyi/stock/pojo/StockOutRecord.java
@@ -94,4 +94,7 @@ @ApiModelProperty("产åid") private Long productId; @ApiModelProperty("ç£ åæä»¶è·¯å¾") private String weighbridgeDocPath; } src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
@@ -21,6 +21,7 @@ import com.ruoyi.stock.service.StockOutRecordService; import com.ruoyi.stock.word.WeighbridgeDocGenerator; import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -71,6 +72,7 @@ stockInRecordDto.setWeighingOperator(stockInventoryDto.getWeighingOperator()); stockInRecordDto.setProductModelId(stockInventoryDto.getProductModelId()); stockInRecordDto.setProductId(stockInventoryDto.getProductId()); stockInRecordDto.setRemark(stockInventoryDto.getRemark()); stockInRecordDto.setType("0"); //çæç£ å String absoluteDocPath = weighbridgeDocGenerator.generateWeighbridgeDoc(stockInRecordDto); @@ -87,6 +89,7 @@ newStockInventory.setRemark(stockInventoryDto.getRemark()); newStockInventory.setLockedQuantity(stockInventoryDto.getLockedQuantity()); newStockInventory.setWarnNum(stockInventoryDto.getWarnNum()); newStockInventory.setProductId(stockInventoryDto.getProductId()); stockInventoryMapper.insert(newStockInventory); } else { stockInventoryDto.setQualitity(stockInventoryDto.getNetWeight()); @@ -103,7 +106,7 @@ StockOutRecordDto stockOutRecordDto = new StockOutRecordDto(); stockOutRecordDto.setRecordId(stockInventoryDto.getRecordId()); stockOutRecordDto.setRecordType(stockInventoryDto.getRecordType()); stockInventoryDto.setWeighingDate(stockInventoryDto.getWeighingDate()); stockOutRecordDto.setWeighingDate(stockInventoryDto.getWeighingDate()); stockOutRecordDto.setStockOutNum(stockInventoryDto.getNetWeight()); stockOutRecordDto.setNetWeight(stockInventoryDto.getNetWeight()); stockOutRecordDto.setGrossWeight(stockInventoryDto.getGrossWeight()); @@ -112,7 +115,13 @@ stockOutRecordDto.setProductModelId(stockInventoryDto.getProductModelId()); stockOutRecordDto.setLicensePlateNo(stockInventoryDto.getLicensePlateNo()); stockOutRecordDto.setProductId(stockInventoryDto.getProductId()); stockOutRecordDto.setRemark(stockInventoryDto.getRemark()); stockOutRecordDto.setType("0"); //çæç£ å StockInRecordDto stockInRecordDto = new StockInRecordDto(); BeanUtils.copyProperties(stockOutRecordDto, stockInRecordDto); String absoluteDocPath = weighbridgeDocGenerator.generateWeighbridgeDoc(stockInRecordDto); stockOutRecordDto.setWeighbridgeDocPath(absoluteDocPath); stockOutRecordService.add(stockOutRecordDto); StockInventory oldStockInventory = stockInventoryMapper.selectOne(new QueryWrapper<StockInventory>().lambda().eq(StockInventory::getProductModelId, stockInventoryDto.getProductModelId())); if (ObjectUtils.isEmpty(oldStockInventory)) { src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java
@@ -4,8 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum; import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; import com.ruoyi.common.exception.base.BaseException; import com.ruoyi.common.utils.EnumUtil; import com.ruoyi.common.utils.OrderUtils; @@ -18,7 +18,6 @@ import com.ruoyi.stock.mapper.StockInventoryMapper; import com.ruoyi.stock.mapper.StockOutRecordMapper; import com.ruoyi.stock.mapper.StockUninventoryMapper; import com.ruoyi.stock.pojo.StockInRecord; import com.ruoyi.stock.pojo.StockInventory; import com.ruoyi.stock.pojo.StockOutRecord; import com.ruoyi.stock.pojo.StockUninventory; @@ -53,8 +52,6 @@ public int add(StockOutRecordDto stockOutRecordDto) { String no = OrderUtils.countTodayByCreateTime(stockOutRecordMapper, "CK"); stockOutRecordDto.setOutboundBatches(no); StockInRecord stockInRecord = new StockInRecord(); BeanUtils.copyProperties(stockOutRecordDto, stockInRecord); return stockOutRecordMapper.insert(stockOutRecordDto); } src/main/java/com/ruoyi/stock/word/WeighbridgeDocGenerator.java
@@ -5,6 +5,7 @@ import com.ruoyi.stock.dto.StockInRecordDto; import org.apache.poi.xwpf.usermodel.*; import org.apache.poi.xwpf.usermodel.XWPFTable.XWPFBorderType; import org.openxmlformats.schemas.wordprocessingml.x2006.main.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @@ -13,6 +14,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -61,7 +63,7 @@ document.write(out); out.flush(); // è¿åç»å¯¹è·¯å¾ï¼ç¨äºæ°æ®åºåå¨ï¼ // è¿åç»å¯¹è·¯å¾ return absolutePath; } catch (Exception e) { @@ -84,9 +86,22 @@ /** * æå»ºææ¡£å 容 * @param document Wordææ¡£å¯¹è±¡ * @param dto å ¥åºè®°å½DTO */ private void buildDocumentContent(XWPFDocument document, StockInRecordDto dto) { // 1. æ·»å æ é¢ "ç£ ç å" - 使ç¨é»ä½ // è®¾ç½®çº¸å¼ å¤§å°ä¸ºA5横å CTSectPr sectPr = document.getDocument().getBody().isSetSectPr() ? document.getDocument().getBody().getSectPr() : document.getDocument().getBody().addNewSectPr(); CTPageSz pageSize = sectPr.isSetPgSz() ? sectPr.getPgSz() : sectPr.addNewPgSz(); pageSize.setW(BigInteger.valueOf(11906)); // A5横å宽度 210mm pageSize.setH(BigInteger.valueOf(8392)); // A5横åé«åº¦ 148mm pageSize.setOrient(STPageOrientation.LANDSCAPE); // æ é¢ "ç£ ç å" XWPFParagraph titlePara = document.createParagraph(); titlePara.setAlignment(ParagraphAlignment.CENTER); titlePara.setSpacingAfter(200); @@ -97,22 +112,71 @@ titleRun.setFontSize(28); titleRun.setFontFamily("é»ä½"); // 2. 空ä¸è¡ document.createParagraph(); // å®ä¹ç»ä¸ç页é¢å®½åº¦å¼ï¼ææè¡¨æ ¼ä½¿ç¨ç¸åçæ»å®½åº¦ï¼ int pageWidth = 9000; // ç»ä¸ç页é¢å®½åº¦å¼ // 3. 头é¨ä¿¡æ¯ï¼å¹´ææ¥å计éåä½åå¹¶å¨ä¸è¡ï¼- 使ç¨å®ä½ XWPFParagraph headerPara = document.createParagraph(); headerPara.setSpacingAfter(200); XWPFRun headerRun = headerPara.createRun(); // å建ä¸è¡ä¸¤åè¡¨æ ¼æ¥æ¾ç½®æ¥æå计éåä½ XWPFTable headerTable = document.createTable(1, 2); headerTable.setWidth("100%"); // æ ¼å¼åæ¥æä¸º yyyy-MM-dd // è®¾ç½®è¡¨æ ¼æ è¾¹æ¡ headerTable.setInsideHBorder(XWPFBorderType.NONE, 0, 0, "000000"); headerTable.setInsideVBorder(XWPFBorderType.NONE, 0, 0, "000000"); headerTable.setTopBorder(XWPFBorderType.NONE, 0, 0, "000000"); headerTable.setBottomBorder(XWPFBorderType.NONE, 0, 0, "000000"); headerTable.setLeftBorder(XWPFBorderType.NONE, 0, 0, "000000"); headerTable.setRightBorder(XWPFBorderType.NONE, 0, 0, "000000"); // è®¾ç½®è¡¨å¤´è¡¨æ ¼åå®½ï¼æ¥æå50%ï¼è®¡éåä½å50% CTTbl headerTbl = headerTable.getCTTbl(); CTTblGrid headerTblGrid = headerTbl.addNewTblGrid(); // 使ç¨ç»ä¸ç页é¢å®½åº¦ int headerColWidth = pageWidth / 2; // 4500 CTTblGridCol col1 = headerTblGrid.addNewGridCol(); col1.setW(BigInteger.valueOf(headerColWidth)); CTTblGridCol col2 = headerTblGrid.addNewGridCol(); col2.setW(BigInteger.valueOf(headerColWidth)); // 设置è¡é« headerTable.getRow(0).setHeight(300); // ä¸ºè¡¨å¤´è¡¨æ ¼çæ¯ä¸ªåå æ ¼è®¾ç½®å®½åº¦ for (int colIndex = 0; colIndex < 2; colIndex++) { XWPFTableCell cell = headerTable.getRow(0).getCell(colIndex); CTTcPr tcPr = cell.getCTTc().addNewTcPr(); CTTblWidth cellWidth = tcPr.addNewTcW(); cellWidth.setType(STTblWidth.DXA); cellWidth.setW(BigInteger.valueOf(headerColWidth)); } // 左侧åå æ ¼ï¼æ¥æï¼å·¦å¯¹é½ï¼ XWPFTableCell dateCell = headerTable.getRow(0).getCell(0); dateCell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); // æ¸ é¤åå æ ¼ä¸å¯è½åå¨çé»è®¤æ®µè½ for (int i = dateCell.getParagraphs().size() - 1; i > 0; i--) { dateCell.removeParagraph(i); } XWPFParagraph datePara = dateCell.getParagraphs().get(0); datePara.setAlignment(ParagraphAlignment.LEFT); // æ¸ é¤æ®µè½ä¸å¯è½åå¨çé»è®¤Run for (int i = datePara.getRuns().size() - 1; i > 0; i--) { datePara.removeRun(i); } XWPFRun dateRun = datePara.createRun(); // æ ¼å¼åæ¥æ String weighDate = ""; if (dto.getWeighingDate() != null) { try { // å设 weighingDate æ¯ LocalDateTime ç±»å weighDate = dto.getWeighingDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); } catch (Exception e) { // 妿æ¯å符串类åï¼å°è¯è½¬æ¢ weighDate = dto.getWeighingDate().toString(); if (weighDate.length() > 10) { weighDate = weighDate.substring(0, 10); @@ -120,17 +184,37 @@ } } headerRun.setText("å¹´ææ¥ï¼" + weighDate + " 计éåä½ï¼ï¼å¨ï¼"); headerRun.setFontSize(12); headerRun.setFontFamily("å®ä½"); dateRun.setText("æ¥ æï¼" + weighDate); dateRun.setFontSize(12); dateRun.setFontFamily("å®ä½"); // 4. åå»ºä¸»è¡¨æ ¼ - 4è¡6åï¼è¡¨å¤´1è¡+æ°æ®1è¡+å计1è¡+空è¡1è¡ï¼ XWPFTable table = document.createTable(4, 6); // 计éåä½ï¼å³å¯¹é½ï¼ XWPFTableCell unitCell = headerTable.getRow(0).getCell(1); unitCell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); for (int i = unitCell.getParagraphs().size() - 1; i > 0; i--) { unitCell.removeParagraph(i); } XWPFParagraph unitPara = unitCell.getParagraphs().get(0); unitPara.setAlignment(ParagraphAlignment.RIGHT); for (int i = unitPara.getRuns().size() - 1; i > 0; i--) { unitPara.removeRun(i); } XWPFRun unitRun = unitPara.createRun(); unitRun.setText("计éåä½ï¼ï¼å¨ï¼"); unitRun.setFontSize(12); unitRun.setFontFamily("å®ä½"); // åå»ºä¸»è¡¨æ ¼ - 3è¡6å XWPFTable table = document.createTable(3, 6); // è®¾ç½®è¡¨æ ¼å®½åº¦ table.setWidth("100%"); // è®¾ç½®è¡¨æ ¼è¾¹æ¡å ç²ï¼è¾¹æ¡å®½åº¦è®¾ä¸º2ï¼ // è®¾ç½®è¡¨æ ¼è¾¹æ¡å ç² table.setInsideHBorder(XWPFBorderType.SINGLE, 2, 0, "000000"); table.setInsideVBorder(XWPFBorderType.SINGLE, 2, 0, "000000"); table.setTopBorder(XWPFBorderType.SINGLE, 2, 0, "000000"); @@ -142,7 +226,47 @@ table.getRow(0).setHeight(400); table.getRow(1).setHeight(400); table.getRow(2).setHeight(400); table.getRow(3).setHeight(400); // è®¾ç½®ä¸»è¡¨æ ¼åå®½ç½æ ¼ - 使ç¨ç¸åçæ»å®½åº¦ pageWidth CTTbl mainTbl = table.getCTTbl(); CTTblGrid mainTblGrid = mainTbl.addNewTblGrid(); // å宽æ¯ä¾ int[] colWidths = { (int)(pageWidth * 0.20), (int)(pageWidth * 0.24), (int)(pageWidth * 0.14), (int)(pageWidth * 0.14), (int)(pageWidth * 0.14), (int)(pageWidth * 0.14) }; // ç¡®ä¿æ»åçäºpageWidth int sum = 0; for (int width : colWidths) { sum += width; } // 妿æè¯¯å·®ï¼è°æ´æåä¸å if (sum != pageWidth) { colWidths[5] += (pageWidth - sum); } for (int width : colWidths) { CTTblGridCol col = mainTblGrid.addNewGridCol(); col.setW(BigInteger.valueOf(width)); } // 为æ¯ä¸è¡çæ¯ä¸ªåå æ ¼è®¾ç½®å ·ä½ç宽度 for (int rowIndex = 0; rowIndex < 3; rowIndex++) { XWPFTableRow row = table.getRow(rowIndex); for (int colIndex = 0; colIndex < 6; colIndex++) { XWPFTableCell cell = row.getCell(colIndex); CTTcPr tcPr = cell.getCTTc().addNewTcPr(); CTTblWidth cellWidth = tcPr.addNewTcW(); cellWidth.setType(STTblWidth.DXA); cellWidth.setW(BigInteger.valueOf(colWidths[colIndex])); } } // 设置表头 - 使ç¨é»ä½å ç² String[] headers = {"车å·", "åå", "æ¯é", "ç®é", "åé", "夿³¨"}; @@ -152,8 +276,18 @@ cell.setText(headers[i]); cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); // æ¸ é¤å¯è½åå¨çå¤ä½æ®µè½ while (cell.getParagraphs().size() > 1) { cell.removeParagraph(1); } XWPFParagraph cellPara = cell.getParagraphs().get(0); cellPara.setAlignment(ParagraphAlignment.CENTER); while (cellPara.getRuns().size() > 1) { cellPara.removeRun(1); } XWPFRun cellRun = cellPara.getRuns().get(0); cellRun.setBold(true); cellRun.setFontSize(12); @@ -180,8 +314,17 @@ cell.setText(data[i]); cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); while (cell.getParagraphs().size() > 1) { cell.removeParagraph(1); } XWPFParagraph cellPara = cell.getParagraphs().get(0); cellPara.setAlignment(ParagraphAlignment.CENTER); while (cellPara.getRuns().size() > 1) { cellPara.removeRun(1); } XWPFRun cellRun = cellPara.getRuns().get(0); cellRun.setFontSize(12); cellRun.setFontFamily("å®ä½"); @@ -194,43 +337,68 @@ XWPFTableCell totalLabelCell = totalRow.getCell(0); totalLabelCell.setText("å计ï¼å¤§åï¼"); totalLabelCell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); // æ¸ é¤å¯è½åå¨çå¤ä½æ®µè½ while (totalLabelCell.getParagraphs().size() > 1) { totalLabelCell.removeParagraph(1); } XWPFParagraph totalLabelPara = totalLabelCell.getParagraphs().get(0); totalLabelPara.setAlignment(ParagraphAlignment.CENTER); // æ¸ é¤å¯è½åå¨çå¤ä½Run while (totalLabelPara.getRuns().size() > 1) { totalLabelPara.removeRun(1); } XWPFRun totalLabelRun = totalLabelPara.getRuns().get(0); totalLabelRun.setBold(true); totalLabelRun.setFontSize(12); totalLabelRun.setFontFamily("å®ä½"); totalLabelRun.setFontFamily("é»ä½"); XWPFTableCell contentCell = totalRow.getCell(1); // å°åé转æ¢ä¸ºå¤§å String netWeightChinese = ChineseNumberUtil.numberToChinese( dto.getNetWeight() != null ? dto.getNetWeight() : BigDecimal.ZERO ); contentCell.setText(netWeightChinese + "å¨"); contentCell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); XWPFParagraph contentPara = contentCell.getParagraphs().get(0); contentPara.setAlignment(ParagraphAlignment.LEFT); XWPFRun contentRun = contentPara.getRuns().get(0); contentRun.setFontSize(12); contentRun.setFontFamily("å®ä½"); // å并第3-6åå°ç¬¬2å for (int i = 2; i < 6; i++) { XWPFTableCell cell = totalRow.getCell(i); // 设置è¿äºåå æ ¼ä¸ºåå¹¶ç¶æï¼ç»§æ¿èªç¬¬2åï¼ cell.getCTTc().addNewTcPr().addNewHMerge().setVal(org.openxmlformats.schemas.wordprocessingml.x2006.main.STMerge.CONTINUE); XWPFTableCell startCell = totalRow.getCell(1); startCell.setText(netWeightChinese + "å¨"); startCell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); while (startCell.getParagraphs().size() > 1) { startCell.removeParagraph(1); } // 6. å建è¿ç£ åè¡ï¼åç¬ä¸è¡ï¼å·¦å¯¹é½ï¼ XWPFParagraph startPara = startCell.getParagraphs().get(0); startPara.setAlignment(ParagraphAlignment.CENTER); while (startPara.getRuns().size() > 1) { startPara.removeRun(1); } XWPFRun startRun = startPara.getRuns().get(0); startRun.setFontSize(12); startRun.setFontFamily("å®ä½"); // æ 记第2å为åå¹¶èµ·å§ startCell.getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.RESTART); // 第3-6ååå¹¶ for (int i = 2; i < 6; i++) { XWPFTableCell cell = totalRow.getCell(i); cell.setText(""); cell.getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.CONTINUE); } // å建è¿ç£ åè¡ï¼åç¬ä¸è¡ï¼å·¦å¯¹é½ï¼ XWPFParagraph operatorPara = document.createParagraph(); operatorPara.setSpacingAfter(100); operatorPara.setAlignment(ParagraphAlignment.LEFT); XWPFRun operatorRun = operatorPara.createRun(); String operator = dto.getWeighingOperator() != null ? dto.getWeighingOperator() : ""; operatorRun.setText("è¿ç£ åï¼" + operator); operatorRun.setFontSize(8); operatorRun.setFontSize(12); operatorRun.setFontFamily("å®ä½"); } /** @@ -242,10 +410,10 @@ String month = String.format("%02d", now.getMonthValue()); String day = String.format("%02d", now.getDayOfMonth()); // æä»¶åæ ¼å¼ï¼ç£ å_车çå·_å¹´ææ¥æ¶åç§.docx // æä»¶åæ ¼å¼ï¼ç£ å_车çå·_å¹´ææ¥.docx String fileName = String.format("ç£ å_%s_%s.docx", dto.getLicensePlateNo() != null ? dto.getLicensePlateNo() : "æªç¥è½¦ç", now.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); now.format(DateTimeFormatter.ofPattern("yyyyMMdd"))); return uploadDir + File.separator + year + File.separator + month + File.separator + day + File.separator + fileName; } src/main/resources/application-kthg.yml
@@ -75,7 +75,7 @@ # ä¸»åºæ°æ®æº master: # url: jdbc:mysql://localhost:3306/product-inventory-management-new?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://1.15.17.182:9999/product-inventory-management-kthg?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-kthg?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root password: xd@123456.. # ä»åºæ°æ®æº @@ -256,4 +256,4 @@ # temp-dir: D:/ruoyi/temp/uploads # 临æ¶ç®å½ # upload-dir: D:/ruoyi/prod/uploads # æ£å¼ç®å½ temp-dir: /javaWork/product-inventory-management/file/temp/uploads upload-dir: /javaWork/product-inventory-management/file/prod/uploads upload-dir: /javaWork/product-inventory-management/file/prod/uploads src/main/resources/mapper/consumables/ConsumablesInRecordMapper.xml
@@ -8,6 +8,7 @@ p.product_name as product_name, pm.model, pm.unit, sir.weighbridge_doc_path, u.nick_name as createBy FROM consumables_in_record as sir LEFT JOIN product_model as pm on sir.product_model_id = pm.id src/main/resources/mapper/consumables/ConsumablesInventoryMapper.xml
@@ -14,8 +14,11 @@ <result column="warn_num" property="warnNum"/> </resultMap> <update id="updateAddConsumablesInventory"> update Consumables_inventory update consumables_inventory <set> <if test="ew.productId != null"> product_id = #{ew.productId}, </if> <if test="ew.qualitity != null"> qualitity = qualitity + #{ew.qualitity}, </if> @@ -37,7 +40,7 @@ where product_model_id = #{ew.productModelId} </update> <update id="updateSubtractConsumablesInventory"> update Consumables_inventory update consumables_inventory <set> <if test="ew.netWeight != null"> qualitity = qualitity - #{ew.netWeight}, @@ -71,9 +74,9 @@ pm.unit, p.product_name, p1.product_name as parent_name, p1.id as parent_id from Consumables_inventory si p1.id as parent_id, si.product_id as productId from consumables_inventory si left join product_model pm on si.product_model_id = pm.id left join product p on pm.product_id = p.id left join product p1 on p.parent_id = p1.id @@ -114,7 +117,7 @@ coalesce(si.locked_quantity, 0) as locked_quantity, si.remark, si.update_time from Consumables_inventory si from consumables_inventory si left join product_model pm on si.product_model_id = pm.id left join product p on pm.product_id = p.id where 1 = 1 @@ -123,10 +126,10 @@ </if> </select> <select id="ConsumablesInventoryPage" resultType="com.ruoyi.consumables.dto.ConsumablesInRecordDto"> <select id="consumablesInventoryPage" resultType="com.ruoyi.consumables.dto.ConsumablesInRecordDto"> select sir.*, si.qualitity as current_Consumables, si.qualitity as current_consumables, pm.model, pm.unit, p.product_name, @@ -137,7 +140,7 @@ from Consumables_in_record sir left join Consumables_inventory si left join consumables_inventory si on sir.product_model_id = si.product_model_id left join product_model pm @@ -183,12 +186,12 @@ </where> </select> <select id="ConsumablesInAndOutRecord" resultType="com.ruoyi.consumables.dto.ConsumablesInventoryDto"> <select id="consumablesInAndOutRecord" resultType="com.ruoyi.consumables.dto.ConsumablesInventoryDto"> SELECT pm.model, pm.unit, p.product_name, MAX(current_inventory) as current_Consumables, MAX(current_inventory) as current_consumables, SUM(CASE WHEN record_type = 'in' THEN amount ELSE 0 END) as total_Consumables_in, SUM(CASE WHEN record_type = 'out' THEN amount ELSE 0 END) as total_Consumables_out FROM ( @@ -197,7 +200,7 @@ SUM(qualitity) as current_inventory, 0 as amount, '' as record_type FROM Consumables_inventory FROM consumables_inventory GROUP BY product_model_id UNION ALL src/main/resources/mapper/consumables/ConsumablesOutRecordMapper.xml
@@ -6,7 +6,7 @@ <resultMap id="BaseResultMap" type="com.ruoyi.consumables.pojo.ConsumablesOutRecord"> <id column="id" property="id" /> <result column="outbound_batches" property="outboundBatches" /> <result column="Consumables_out_num" property="consumablesOutNum" /> <result column="stock_out_num" property="stockOutNum" /> <result column="record_id" property="recordId" /> <result column="record_type" property="recordType" /> <result column="product_model_id" property="productModelId" /> @@ -24,8 +24,9 @@ p.product_name as productName, pm.model, pm.unit, sor.weighbridge_doc_path, u.nick_name as createBy FROM Consumables_out_record as sor FROM consumables_out_record as sor LEFT JOIN product_model as pm on sor.product_model_id = pm.id LEFT JOIN product as p on pm.product_id = p.id LEFT JOIN sys_user as u on sor.create_user = u.user_id @@ -52,7 +53,7 @@ pm.model, pm.unit, u.nick_name as createBy FROM Consumables_out_record as sor FROM consumables_out_record as sor LEFT JOIN product_model as pm on sor.product_model_id = pm.id LEFT JOIN product as p on pm.product_id = p.id LEFT JOIN sys_user as u on sor.create_user = u.user_id src/main/resources/mapper/consumables/ConsumablesUninventoryMapper.xml
@@ -43,7 +43,7 @@ </set> where product_model_id = #{ew.productModelId} </update> <select id="pageConsumablesUninventory" resultType="com.ruoyi.consumables.dto.ConsumablesUnInventoryDto"> <select id="pageConsumablesUnInventory" resultType="com.ruoyi.consumables.dto.ConsumablesUnInventoryDto"> select su.id, su.qualitity, COALESCE(su.locked_quantity, 0) as locked_quantity, src/main/resources/mapper/quality/RawMaterialMapper.xml
@@ -27,11 +27,17 @@ <if test="params.checkType != null "> AND rm.check_type = #{params.checkType} </if> <if test="params.batchNo != null and params.batchNo != ''"> and rm.batch_no like concat('%', #{params.batchNo}, '%') </if> <if test="params.inspectState != null "> AND rm.inspect_state = #{params.inspectState} </if> <if test="params.entryDateStart != null and params.entryDateStart != '' "> AND rm.check_time >= DATE_FORMAT(#{params.entryDateStart},'%Y-%m-%d') AND rm.check_time >= #{params.entryDateStart} </if> <if test="params.entryDateEnd != null and params.entryDateEnd != '' "> AND rm.check_time <= DATE_FORMAT(#{params.entryDateEnd},'%Y-%m-%d') AND rm.check_time <= #{params.entryDateEnd} </if> ORDER BY rm.check_time DESC </select> src/main/resources/mapper/stock/StockInRecordMapper.xml
@@ -8,6 +8,7 @@ p.product_name as product_name, pm.model, pm.unit, sir.weighbridge_doc_path, u.nick_name as createBy FROM stock_in_record as sir LEFT JOIN product_model as pm on sir.product_model_id = pm.id src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -16,6 +16,9 @@ <update id="updateAddStockInventory"> update stock_inventory <set> <if test="ew.productId != null"> product_id = #{ew.productId}, </if> <if test="ew.qualitity != null"> qualitity = qualitity + #{ew.qualitity}, </if> @@ -71,8 +74,8 @@ pm.unit, p.product_name, p1.product_name as parent_name, p1.id as parent_id p1.id as parent_id, si.product_id as productId from stock_inventory si left join product_model pm on si.product_model_id = pm.id left join product p on pm.product_id = p.id src/main/resources/mapper/stock/StockOutRecordMapper.xml
@@ -24,6 +24,7 @@ p.product_name as productName, pm.model, pm.unit, sor.weighbridge_doc_path, u.nick_name as createBy FROM stock_out_record as sor LEFT JOIN product_model as pm on sor.product_model_id = pm.id src/main/resources/static/report-template.docxBinary files differ