diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/domain/ShipmentPrintVo.java b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/domain/ShipmentPrintVo.java index fa4edb3..10e8792 100644 --- a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/domain/ShipmentPrintVo.java +++ b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/domain/ShipmentPrintVo.java @@ -10,40 +10,47 @@ import java.util.List; public class ShipmentPrintVo { public String template = "haiwang"; - public ShipHeader data = new ShipHeader(); + public ShipHeader voHeader = new ShipHeader(); - public void setHeader(ShipmentHeader header, String totalLines, String totalQty, String pageNumber, String zoneInfo, String unionCode) { - data.created = DataUtils.formate(header.getCreated()); - data.qty = totalQty;//头表当前页明细总数 - data.count = totalLines;//头表当前页明细条数 - data.shipmentCode = header.getCode(); - data.workshop = header.getWorkshop(); - data.noticeNo = header.getNoticeNo(); - data.superiorName = header.getSuperiorName(); - data.superiorCode = header.getSuperiorCode(); - data.warehouseName = header.getWarehouseName(); - data.transferWarehouseName = header.getTransferWarehouseName(); - data.remark = header.getShipmentNote(); - data.unionCode = unionCode; - data.zoneInfo = zoneInfo; - data.pageNumber = pageNumber; - if (header.getShipmentType().equals("208")) { - data.footRight = "形态转换单据得重新维护编码,并重新入库"; + public void setHeader(ShipmentHeader shipmentHeader, String totalLines, String totalQty, String pageNumber, String zoneInfo, String unionCode) { + voHeader.created = DataUtils.formate(shipmentHeader.getCreated()); + voHeader.qty = totalQty;//头表当前页明细总数 + voHeader.count = totalLines;//头表当前页明细条数 + voHeader.shipmentCode = shipmentHeader.getCode(); + voHeader.workshop = shipmentHeader.getWorkshop(); + voHeader.noticeNo = shipmentHeader.getNoticeNo(); + voHeader.superiorName = shipmentHeader.getSuperiorName(); + voHeader.superiorCode = shipmentHeader.getSuperiorCode(); + voHeader.warehouseName = shipmentHeader.getWarehouseName(); + voHeader.transferWarehouseName = shipmentHeader.getTransferWarehouseName(); + voHeader.remark = shipmentHeader.getShipmentNote(); + voHeader.unionCode = unionCode;//合并单号 + voHeader.zoneInfo = zoneInfo; + voHeader.pageNumber = pageNumber;//页码 + if (shipmentHeader.getShipmentType().equals("208")) { + voHeader.footRight = "形态转换单据得重新维护编码,并重新入库"; } } - public ShipDetail addShipDetail(TaskDetail taskDetail) { - ShipDetail detail = new ShipDetail(); + public ShipDetail addShipDetail(TaskDetail taskDetail, String roadway) { + ShipDetail voDetail = new ShipDetail(); if (taskDetail.getFlat() == null || taskDetail.getFlat() != 1) { - detail.containerCode = taskDetail.getContainerCode(); + voDetail.containerCode = taskDetail.getContainerCode(); } - detail.zone = taskDetail.getZoneName(); - detail.materialCode = taskDetail.getMaterialCode(); - detail.materialName = taskDetail.getMaterialName(); - detail.qty = taskDetail.getQty().stripTrailingZeros().toPlainString(); - detail.taskId = String.valueOf(taskDetail.getTaskId()); - data.details.add(detail); - return detail; + if (taskDetail.getTaskType() == 300) { + voDetail.type = "整盘"; + } else { + voDetail.type = "分拣"; + } + voDetail.zone = taskDetail.getZoneName(); + voDetail.materialCode = taskDetail.getMaterialCode(); + voDetail.materialName = taskDetail.getMaterialName(); + voDetail.qty = taskDetail.getQty().stripTrailingZeros().toPlainString(); + voDetail.taskId = String.valueOf(taskDetail.getTaskId()); + voDetail.roadway = roadway;//巷道 + voDetail.recordCode = taskDetail.getRecordCode();//合并前单号 + voHeader.details.add(voDetail); + return voDetail; } public class ShipHeader { @@ -85,6 +92,9 @@ public class ShipmentPrintVo { public String materialName = ""; public String qty; public String invQty; + private String roadway;//巷道 + private String type;//任务类型 + private String recordCode;//合并前单号 } } diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderServiceImpl.java b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderServiceImpl.java index 263e8f9..d538804 100644 --- a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderServiceImpl.java +++ b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderServiceImpl.java @@ -17,6 +17,8 @@ import com.huaheng.pc.config.address.service.AddressService; import com.huaheng.pc.config.company.service.CompanyService; import com.huaheng.pc.config.customer.domain.Customer; import com.huaheng.pc.config.customer.service.CustomerServiceImpl; +import com.huaheng.pc.config.location.domain.Location; +import com.huaheng.pc.config.location.service.LocationService; import com.huaheng.pc.config.material.service.MaterialService; import com.huaheng.pc.config.shipmentType.service.ShipmentTypeService; import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; @@ -51,7 +53,7 @@ import java.util.stream.Collectors; @Service public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, ShipmentHeader> implements ShipmentHeaderService { - @Autowired + @Resource private IDictDataService dictDataService; @Resource private AddressService addressService; @@ -59,13 +61,13 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, private InventoryDetailService inventoryDetailService; @Resource private ShipmentHeaderMapper shipmentHeaderMapper; - @Autowired + @Resource private ShipmentDetailService shipmentDetailService; - @Autowired + @Resource private ShipmentContainerHeaderService shipmentContainerHeaderService; - @Autowired + @Resource private ShipmentHeaderHistoryService shipmentHeaderHistoryService; - @Autowired + @Resource private ShipmentDetailHistoryService shipmentDetailHistoryService; @Resource private CompanyService companyService; @@ -77,6 +79,8 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, private ShipmentTypeService shipmentTypeService; @Resource private TaskDetailService taskDetailService; + @Resource + private LocationService locationService; //新增出库主单 @Transactional(rollbackFor = Exception.class) @@ -504,17 +508,23 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, String totalQty = String.valueOf(currentPage.stream().map(TaskDetail::getQty).reduce(BigDecimal.ZERO, BigDecimal::add)); ShipmentPrintVo vo = new ShipmentPrintVo(); vo.setHeader(shipmentHeader, totalLines, totalQty, pageNumber, zoneInfo, unionCode); - currentPage.forEach(it -> { + + currentPage.forEach(taskDetail -> { + String roadway = ""; + Location location = locationService.getOne(new LambdaQueryWrapper<Location>().eq(Location::getCode, taskDetail.getFromLocation())); + if (location != null) { + roadway = location.getRoadway(); + } InventoryDetail inventory = new InventoryDetail(); - inventory.setWarehouseCode(it.getWarehouseCode()); - inventory.setMaterialCode(it.getMaterialCode()); - inventory.setInventorySts(it.getInventorySts()); - vo.addShipDetail(it).invQty = inventoryDetailService.getSumQty(inventory).stripTrailingZeros().toPlainString(); + inventory.setWarehouseCode(taskDetail.getWarehouseCode()); + inventory.setMaterialCode(taskDetail.getMaterialCode()); + inventory.setInventorySts(taskDetail.getInventorySts()); + inventory.setContainerCode(taskDetail.getContainerCode()); + vo.addShipDetail(taskDetail, roadway).invQty = inventoryDetailService.getSumQty(inventory).stripTrailingZeros().toPlainString(); }); String jsonParam = JSON.toJSONString(vo); - String url = "http://127.0.0.1:52099/print"; - url = addressService.selectAddress(QuantityConstant.PRINT_SER1VER_URL, shipmentHeader.getWarehouseCode(), "1"); + String url = addressService.selectAddress(QuantityConstant.PRINT_SER1VER_URL, shipmentHeader.getWarehouseCode(), "1"); ResponseEntity<JSONObject> result = RestUtil.request_post(url, "CS0001", jsonParam); if (result != null && result.getBody() != null) {