diff --git a/ym-packing/src/main/java/com/cnbm/packing/controller/WoPackagingBoxController.java b/ym-packing/src/main/java/com/cnbm/packing/controller/WoPackagingBoxController.java index cf0db1b..5c64c27 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/controller/WoPackagingBoxController.java +++ b/ym-packing/src/main/java/com/cnbm/packing/controller/WoPackagingBoxController.java @@ -126,4 +126,13 @@ public class WoPackagingBoxController { // @LogOperation("获取列表") public List list() { return woPackagingBoxService.list(); } + @PostMapping(value = "printList/{id}") + @ApiOperation(value = "包装箱打印列表") + public Result printList(@PathVariable("id") Long id) { + + WoPackagingBoxDTO data = woPackagingBoxService.printList(id); + + return new Result().ok(data); + } + } \ No newline at end of file diff --git a/ym-packing/src/main/java/com/cnbm/packing/controller/WoPackagingBoxSubstrateController.java b/ym-packing/src/main/java/com/cnbm/packing/controller/WoPackagingBoxSubstrateController.java index d593282..2e837ab 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/controller/WoPackagingBoxSubstrateController.java +++ b/ym-packing/src/main/java/com/cnbm/packing/controller/WoPackagingBoxSubstrateController.java @@ -12,6 +12,7 @@ import com.cnbm.common.validator.ValidatorUtils; import com.cnbm.common.validator.group.AddGroup; import com.cnbm.common.validator.group.DefaultGroup; import com.cnbm.common.validator.group.UpdateGroup; +import com.cnbm.packing.dto.ChangePackingBoxDTO; import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO; import com.cnbm.packing.entity.WoPackagingBox; import com.cnbm.packing.entity.WoPackagingBoxSubstrate; @@ -141,12 +142,12 @@ public class WoPackagingBoxSubstrateController { @PostMapping("insertSubstrate") @ApiOperation("合箱") // @LogOperation("合箱") - public Result insertSubstrate(@RequestBody WoPackagingBoxSubstrateDTO dto){ + public Result insertSubstrate(@RequestBody ChangePackingBoxDTO dto){ String woSubstrateId = dto.getWoSubstrateId(); //验证模组是否存在 QueryWrapper substrateQueryWrapper1 = new QueryWrapper<>(); - substrateQueryWrapper1.eq(StringUtils.isNotBlank(woSubstrateId), "woSubstrateId", woSubstrateId); + substrateQueryWrapper1.eq(StringUtils.isNotBlank(woSubstrateId), WoPackagingBoxSubstrate.WO_SUBSTRATE_ID, woSubstrateId); if(woPackagingBoxSubstrateMapper.selectCount(substrateQueryWrapper1 )== 0){ return new Result().error(1,"该模组不存在,请重新输入"); } @@ -158,8 +159,8 @@ public class WoPackagingBoxSubstrateController { //验证slot是否被占用 QueryWrapper substrateQueryWrapper2 = new QueryWrapper<>(); - substrateQueryWrapper2.eq(StringUtils.isNotBlank(dto.getPackagingBoxId()), "packagingBoxId", dto.getPackagingBoxId()); - substrateQueryWrapper2.eq(ObjectUtils.isNotNull(dto.getSlot()), "slot", dto.getSlot()); + substrateQueryWrapper2.eq(StringUtils.isNotBlank(dto.getPackagingBoxId()), WoPackagingBoxSubstrate.PACKAGING_BOX_ID, dto.getPackagingBoxId()); + substrateQueryWrapper2.eq(ObjectUtils.isNotNull(dto.getSlot()), WoPackagingBoxSubstrate.SLOT, dto.getSlot()); if(woPackagingBoxSubstrateMapper.selectCount(substrateQueryWrapper2) != 0){ return new Result().error(1,"该slot已被占用"); } @@ -167,7 +168,7 @@ public class WoPackagingBoxSubstrateController { //验证该模组的线体、功率等级是否BoxID的线体、功率等级一致,一致,保存成功,数据发生更新。不一致,则显示保存失败,数据不发生更新 String packagingBoxId = dto.getPackagingBoxId(); QueryWrapper boxQueryWrapper = new QueryWrapper<>(); - boxQueryWrapper.eq(StringUtils.isNotBlank(packagingBoxId), "boxNo", packagingBoxId); + boxQueryWrapper.eq(StringUtils.isNotBlank(packagingBoxId), WoPackagingBox.BOX_NO, packagingBoxId); WoPackagingBox box = woPackagingBoxMapper.selectList(boxQueryWrapper).get(0); if((substrate.getLineBody()==box.getLineBody()) && (substrate.getPowerLevel()==box.getPowerLevel()) ) @@ -184,7 +185,7 @@ public class WoPackagingBoxSubstrateController { @PostMapping("replaceSubstrate") @ApiOperation("换箱") // @LogOperation("换箱") - public Result replaceSubstrate(@RequestBody WoPackagingBoxSubstrateDTO[] dtos){ + public Result replaceSubstrate(@RequestBody ChangePackingBoxDTO[] dtos){ woPackagingBoxSubstrateService.replaceSubstrate(dtos); @@ -194,11 +195,11 @@ public class WoPackagingBoxSubstrateController { @PostMapping("slotValidation") @ApiOperation("slot是否占用验证") // @LogOperation("slot是否占用验证") - public boolean slotValidation(@RequestBody WoPackagingBoxSubstrateDTO dto){ + public boolean slotValidation(@RequestBody ChangePackingBoxDTO dto){ QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(dto.getPackagingBoxId()), "packagingBoxId", dto.getPackagingBoxId()); - wrapper.eq(ObjectUtils.isNotNull(dto.getSlot()), "slot", dto.getSlot()); + wrapper.eq(StringUtils.isNotBlank(dto.getPackagingBoxId()), WoPackagingBoxSubstrate.PACKAGING_BOX_ID, dto.getPackagingBoxId()); + wrapper.eq(ObjectUtils.isNotNull(dto.getSlot()), WoPackagingBoxSubstrate.SLOT, dto.getSlot()); if(woPackagingBoxSubstrateMapper.selectCount(wrapper) == 0){ return true; } @@ -207,12 +208,12 @@ public class WoPackagingBoxSubstrateController { } } - @PostMapping("batchInsert") + @PostMapping("insertSubstrateManual") @ApiOperation("手动装箱") // @LogOperation("手动装箱") - public Result batchInsert(@RequestBody WoPackagingBoxSubstrateDTO[] lists){ + public Result insertSubstrateManual(@RequestBody ChangePackingBoxDTO dto){ - woPackagingBoxSubstrateService.batchInsert(lists); + woPackagingBoxSubstrateService.insertSubstrateManual(dto); return new Result(); } diff --git a/ym-packing/src/main/java/com/cnbm/packing/controller/WoPackagingPrintHistoryController.java b/ym-packing/src/main/java/com/cnbm/packing/controller/WoPackagingPrintHistoryController.java index f0ef03c..ec2aab1 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/controller/WoPackagingPrintHistoryController.java +++ b/ym-packing/src/main/java/com/cnbm/packing/controller/WoPackagingPrintHistoryController.java @@ -127,30 +127,13 @@ public class WoPackagingPrintHistoryController { } @PostMapping("print/{id}") - @ApiOperation("打印") + @ApiOperation("打印记录") // @LogOperation("打印") public Result print(@PathVariable("id") Long id) { - WoPackagingBoxDTO woPackagingBox = woPackagingBoxServiceBiz.get(id); + woPackagingPrintHistoryService.print(id); - WoPackagingPrintHistoryDTO woPackagingPrintHistory = new WoPackagingPrintHistoryDTO(); - BeanUtils.copyProperties(woPackagingBox, woPackagingPrintHistory); - woPackagingPrintHistory.setId(null); - woPackagingPrintHistory.setPrintTime(LocalDateTime.now()); - //效验数据 - ValidatorUtils.validateEntity(woPackagingPrintHistory, AddGroup.class, DefaultGroup.class); - woPackagingPrintHistoryService.save(woPackagingPrintHistory); - //更新包装箱表中打印状态和时间 - woPackagingBox.setPrintTime(woPackagingPrintHistory.getPrintTime()); - if(woPackagingBox.getPrintStatus()==0){ - woPackagingBox.setPrintCount(1); - woPackagingBox.setPrintStatus(WhetherEnum.YES.getValue()); - } - else{ - woPackagingBox.setPrintCount(woPackagingBox.getPrintCount()+1); - } - - return new Result().ok(woPackagingPrintHistory.getId()); + return new Result(); } } \ No newline at end of file diff --git a/ym-packing/src/main/java/com/cnbm/packing/dto/ChangePackingBoxDTO.java b/ym-packing/src/main/java/com/cnbm/packing/dto/ChangePackingBoxDTO.java new file mode 100644 index 0000000..cd1c001 --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/packing/dto/ChangePackingBoxDTO.java @@ -0,0 +1,25 @@ +package com.cnbm.packing.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +@ApiModel(value = "包装箱与基板关联变化对象") +public class ChangePackingBoxDTO implements Serializable { + + @ApiModelProperty(value = "WoPackagingBoxSubstrate.id") + private Long id; + + @ApiModelProperty(value = "包装箱ID,BoxId") + private String packagingBoxId; + + @ApiModelProperty(value = "基板ID") + private String woSubstrateId; + + @ApiModelProperty(value = "箱中位置") + private Integer slot; +} diff --git a/ym-packing/src/main/java/com/cnbm/packing/dto/WoPackagingBoxDTO.java b/ym-packing/src/main/java/com/cnbm/packing/dto/WoPackagingBoxDTO.java index 36b97b7..3f7939f 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/dto/WoPackagingBoxDTO.java +++ b/ym-packing/src/main/java/com/cnbm/packing/dto/WoPackagingBoxDTO.java @@ -1,5 +1,6 @@ package com.cnbm.packing.dto; +import com.cnbm.packing.entity.WoPackagingBoxSubstrate; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -8,6 +9,7 @@ import java.io.Serializable; import java.time.LocalDateTime; import java.math.BigDecimal; +import java.util.List; /** @@ -113,4 +115,7 @@ public class WoPackagingBoxDTO implements Serializable { @ApiModelProperty(value = "订单号") private String orderNum; + @ApiModelProperty(value = "基板列表") + private List substrateList;; + } \ No newline at end of file diff --git a/ym-packing/src/main/java/com/cnbm/packing/service/WoPackagingBoxServiceBiz.java b/ym-packing/src/main/java/com/cnbm/packing/service/WoPackagingBoxServiceBiz.java index 62e4d3b..0e153b6 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/service/WoPackagingBoxServiceBiz.java +++ b/ym-packing/src/main/java/com/cnbm/packing/service/WoPackagingBoxServiceBiz.java @@ -5,7 +5,6 @@ import com.cnbm.common.service.CrudService; import com.cnbm.packing.dto.WoPackagingBoxDTO; import com.cnbm.packing.dto.WoPackagingBoxDTO; import com.cnbm.packing.entity.WoPackagingBox; -import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; @@ -30,5 +29,8 @@ public interface WoPackagingBoxServiceBiz extends CrudService list(); + WoPackagingBoxDTO printList(Long id); + + int updateIsArrivedByBoxNo(Integer isArrived, String boxNo); } \ No newline at end of file diff --git a/ym-packing/src/main/java/com/cnbm/packing/service/WoPackagingBoxSubstrateServiceBiz.java b/ym-packing/src/main/java/com/cnbm/packing/service/WoPackagingBoxSubstrateServiceBiz.java index 3879717..9c869de 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/service/WoPackagingBoxSubstrateServiceBiz.java +++ b/ym-packing/src/main/java/com/cnbm/packing/service/WoPackagingBoxSubstrateServiceBiz.java @@ -4,7 +4,6 @@ import com.cnbm.common.page.PageData; import com.cnbm.common.service.CrudService; import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO; import com.cnbm.packing.entity.WoPackagingBoxSubstrate; -import org.apache.ibatis.annotations.Param; import java.util.Map; @@ -28,10 +27,12 @@ public interface WoPackagingBoxSubstrateServiceBiz extends CrudService list(); + + void print(Long id); } \ No newline at end of file diff --git a/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxServiceBizImpl.java b/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxServiceBizImpl.java index 79f87d7..8b8f1a4 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxServiceBizImpl.java +++ b/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxServiceBizImpl.java @@ -8,7 +8,11 @@ import com.cnbm.common.service.impl.CrudServiceImpl; import com.cnbm.common.utils.ConvertUtils; import com.cnbm.packing.dto.WoPackagingBoxDTO; import com.cnbm.packing.entity.WoPackagingBox; +import com.cnbm.packing.entity.WoPackagingBoxSubstrate; +import com.cnbm.packing.entity.WoPowerLevel; import com.cnbm.packing.mapper.WoPackagingBoxMapper; +import com.cnbm.packing.mapper.WoPackagingBoxMapper; +import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper; import com.cnbm.packing.service.WoPackagingBoxServiceBiz; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -103,6 +107,17 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(entity.getBoxNo()), WoPackagingBoxSubstrate.PACKAGING_BOX_ID, entity.getBoxNo()); + List woPackagingBoxSubstrateList = substrateMapper.selectList(wrapper); + dto.setSubstrateList(woPackagingBoxSubstrateList); + return dto; + } + @Override public int updateIsArrivedByBoxNo(Integer isArrived, String boxNo) { return mapper.updateIsArrivedByBoxNo(isArrived,boxNo); diff --git a/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxSubstrateServiceBizImpl.java b/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxSubstrateServiceBizImpl.java index 533e618..66d7a10 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxSubstrateServiceBizImpl.java +++ b/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxSubstrateServiceBizImpl.java @@ -9,6 +9,7 @@ import com.cnbm.common.utils.ConvertUtils; import com.cnbm.common.validator.ValidatorUtils; import com.cnbm.common.validator.group.AddGroup; import com.cnbm.common.validator.group.DefaultGroup; +import com.cnbm.packing.dto.ChangePackingBoxDTO; import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO; import com.cnbm.packing.entity.ChangePackagingBoxHistory; import com.cnbm.packing.entity.WoPackagingBoxSubstrate; @@ -41,6 +42,9 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl getWrapper(Map params){ String packagingBoxId = (String) params.get("packagingBoxId"); @@ -114,7 +118,7 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(dto.getWoSubstrateId()),WoPackagingBoxSubstrate.WO_SUBSTRATE_ID,dto.getWoSubstrateId()); + if(mapper.selectCount(wrapper)>0 && StringUtils.isNotBlank(dto.getWoSubstrateId())) { + WoPackagingBoxSubstrate substrate = mapper.selectList(wrapper).get(0); + substrate.setPackagingBoxId(dto.getPackagingBoxId()); + updateById(substrate); + } + else{ + //模组ID有时为空,用户会输入”无码“ + if(dto.getWoSubstrateId()==null) { dto.setWoSubstrateId("无码"); } //效验数据 diff --git a/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingPrintHistoryServiceBizImpl.java b/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingPrintHistoryServiceBizImpl.java index c530b2a..704a680 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingPrintHistoryServiceBizImpl.java +++ b/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingPrintHistoryServiceBizImpl.java @@ -3,9 +3,14 @@ package com.cnbm.packing.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.cnbm.admin.enums.WhetherEnum; import com.cnbm.common.page.PageData; import com.cnbm.common.service.impl.CrudServiceImpl; import com.cnbm.common.utils.ConvertUtils; +import com.cnbm.common.validator.ValidatorUtils; +import com.cnbm.common.validator.group.AddGroup; +import com.cnbm.common.validator.group.DefaultGroup; +import com.cnbm.packing.dto.WoPackagingBoxDTO; import com.cnbm.packing.dto.WoPackagingPrintHistoryDTO; import com.cnbm.packing.dto.WoPackagingPrintHistoryDTO; import com.cnbm.packing.entity.WoPackagingBox; @@ -13,8 +18,10 @@ import com.cnbm.packing.entity.WoPackagingPrintHistory; import com.cnbm.packing.entity.WoPackagingPrintHistory; import com.cnbm.packing.mapper.WoPackagingPrintHistoryMapper; import com.cnbm.packing.mapper.WoPackagingPrintHistoryMapper; +import com.cnbm.packing.service.WoPackagingBoxServiceBiz; import com.cnbm.packing.service.WoPackagingPrintHistoryServiceBiz; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -36,6 +43,9 @@ public class WoPackagingPrintHistoryServiceBizImpl extends CrudServiceImpl getWrapper(Map params){ LocalDateTime startTime = (LocalDateTime) params.get("startTime"); @@ -92,5 +102,28 @@ public class WoPackagingPrintHistoryServiceBizImpl extends CrudServiceImpl select * from t_wo_packaging_box_substrate - order by id asc + + valid = 1 + + and PACKAGING_BOX_ID = #{packagingBoxId} + + + order by slot asc