diff --git a/src/main/java/com/huaheng/api/mes/dto/Header.java b/src/main/java/com/huaheng/api/mes/dto/Header.java index 24cd92c..f014ae6 100644 --- a/src/main/java/com/huaheng/api/mes/dto/Header.java +++ b/src/main/java/com/huaheng/api/mes/dto/Header.java @@ -73,6 +73,12 @@ public class Header { private String superiorName; /** + * 日计划导入日期 + */ + @ApiModelProperty(value = "日计划导入日期") + private Date dailyScheduleImportDate; + + /** * 计划开工日期 */ @ApiModelProperty(value = "计划开工日期") @@ -112,11 +118,30 @@ public class Header { private String shipmentNote; /** - * 日计划导入日期 + * 调入仓库名称 */ - @ApiModelProperty(value = "日计划导入日期") - private Date dailyScheduleImportDate; + @ApiModelProperty(value = "调入仓库名称") + private String transferWarehouseName; + /** + * 调入仓库编码 + */ + @ApiModelProperty(value = "调入仓库编码") + private String transferWarehouseCode; + + + /** + * 删除人 + */ + @ApiModelProperty(value = "删除人") + private String delete; + + + /** + * 删除人工号 + */ + @ApiModelProperty(value = "删除人工号") + private String deleteCode; public String getProductionWorker() { diff --git a/src/main/java/com/huaheng/api/mes/service/MesServiceImpl.java b/src/main/java/com/huaheng/api/mes/service/MesServiceImpl.java index 5e6a410..873bc3c 100644 --- a/src/main/java/com/huaheng/api/mes/service/MesServiceImpl.java +++ b/src/main/java/com/huaheng/api/mes/service/MesServiceImpl.java @@ -18,16 +18,18 @@ import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService; import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService; +import com.huaheng.pc.receipt.receiptHeaderHistory.service.ReceiptHeaderHistoryService; import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; import com.huaheng.pc.shipment.shipmentDetail.service.ShipmentDetailService; import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader; import com.huaheng.pc.shipment.shipmentHeader.service.ShipmentHeaderService; +import com.huaheng.pc.shipment.shipmentHeaderHistory.service.ShipmentHeaderHistoryService; import com.huaheng.pc.task.taskDetail.service.TaskDetailService; -import org.apache.poi.ss.formula.functions.T; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -39,6 +41,10 @@ public class MesServiceImpl implements IMesService { private ReceiptHeaderService receiptHeaderService; @Resource + private ShipmentHeaderHistoryService shipmentHeaderHistoryService; + @Resource + private ReceiptHeaderHistoryService receiptHeaderHistoryService; + @Resource private ReceiptDetailService receiptDetailService; @Resource @@ -66,21 +72,21 @@ public class MesServiceImpl implements IMesService { List<Detail> details = receiptDTO.getShipemtnDetails(); LambdaQueryWrapper<ReceiptHeader> query = Wrappers.lambdaQuery(); - query.eq(ReceiptHeader::getCode,header.getReferCode()) - .eq(ReceiptHeader::getReceiptType,header.getRefeCodeType()); + query.eq(ReceiptHeader::getCode, header.getReferCode()) + .eq(ReceiptHeader::getReceiptType, header.getRefeCodeType()); List<ReceiptHeader> list = receiptHeaderService.list(query); - if(list.size()>0){ - return AjaxResult.error("添加入库单: 上游单号referCode重复[ "+header.getReferCode()+" ],请勿重复添加。"); + if (list.size() > 0) { + return AjaxResult.error("添加入库单: 上游单号referCode重复[ " + header.getReferCode() + " ],请勿重复添加。"); } AjaxResult ajaxResult = new AjaxResult(); boolean isNull = enterIsNull(ajaxResult, header, details); - if (isNull){ + if (isNull) { return ajaxResult; } List<Material> materialList = new ArrayList<>(); ReceiptHeader receiptHeader = new ReceiptHeader(); - if(StringUtils.isNotEmpty(header.getMOMID())){ + if (StringUtils.isNotEmpty(header.getMOMID())) { receiptHeader.setMOMID(header.getMOMID()); } receiptHeader.setCode(header.getReferCode()); @@ -103,30 +109,30 @@ public class MesServiceImpl implements IMesService { receiptHeader.setCreatedBy("MOM"); boolean success = receiptHeaderService.save(receiptHeader); - if(!success) { + if (!success) { throw new ServiceException("生成入库单头失败"); } List<ReceiptDetail> shipemtnDetailList = new ArrayList<>(); - for(Detail detail : details) { + for (Detail detail : details) { ReceiptDetail receiptDetail = new ReceiptDetail(); // 查询入库单据表头 LambdaQueryWrapper<Material> materialQueryWrapper = Wrappers.lambdaQuery(); materialQueryWrapper.eq(Material::getCode, detail.getMaterialCode()); Material material = materialService.getOne(materialQueryWrapper); - if(StringUtils.isNotEmpty(detail.getDetailID())){ + if (StringUtils.isNotEmpty(detail.getDetailID())) { receiptDetail.setMOMID(detail.getDetailID()); } receiptDetail.setIsVirtualBom(detail.getIsVirtual()); receiptDetail.setMaterialCode(detail.getMaterialCode()); receiptDetail.setMaterialName(detail.getMaterialName()); - if (material == null){ + if (material == null) { Material newMaterial = new Material(); newMaterial.setCode(detail.getMaterialCode()); newMaterial.setName(detail.getMaterialName()); newMaterial.setWarehouseCode("CS0001"); newMaterial.setCompanyCode("BHF"); materialList.add(newMaterial); - }else { + } else { receiptDetail.setMaterialSpec(material.getSpec()); receiptDetail.setMaterialUnit(material.getUnit()); } @@ -145,13 +151,13 @@ public class MesServiceImpl implements IMesService { shipemtnDetailList.add(receiptDetail); } success = receiptDetailService.saveBatch(shipemtnDetailList); - if(!success) { + if (!success) { throw new ServiceException("生成入库单详情失败"); } if (materialList.size() > 0) { materialList = materialList.stream().distinct().collect(Collectors.toList()); success = materialService.saveBatch(materialList); - if(!success) { + if (!success) { throw new ServiceException("保存物料信息失败"); } } @@ -165,22 +171,19 @@ public class MesServiceImpl implements IMesService { List<Detail> details = receiptDTO.getShipemtnDetails(); LambdaQueryWrapper<ShipmentHeader> query = Wrappers.lambdaQuery(); - query.eq(ShipmentHeader::getCode,header.getReferCode()) - .eq(ShipmentHeader::getShipmentType,header.getRefeCodeType()); + query.eq(ShipmentHeader::getCode, header.getReferCode()).eq(ShipmentHeader::getShipmentType, header.getRefeCodeType()); List<ShipmentHeader> list = shipmentHeaderService.list(query); - if(list.size()>0){ - return AjaxResult.error("添加出库单: 上游单号referCode重复[ "+header.getReferCode()+" ],请勿重复添加。"); + if (list.size() > 0) { + return AjaxResult.error("添加出库单: 上游单号referCode重复[ " + header.getReferCode() + " ],请勿重复添加。"); } - AjaxResult ajaxResult = new AjaxResult(); boolean inNull = enterIsNull(ajaxResult, header, details); - if (inNull){ + if (inNull) { return ajaxResult; } - ShipmentHeader shipmentHeader = new ShipmentHeader(); // shipmentHeader.setId(header.getId()); - if(StringUtils.isNotEmpty(header.getMOMID())) { + if (StringUtils.isNotEmpty(header.getMOMID())) { shipmentHeader.setMOMID(header.getMOMID()); } shipmentHeader.setCode(header.getReferCode()); @@ -198,9 +201,19 @@ public class MesServiceImpl implements IMesService { shipmentHeader.setCreatorName(header.getCreatorName()); shipmentHeader.setRequestedStartDate(header.getRequestedStartDate()); shipmentHeader.setSuperiorCode(header.getSuperiorCode()); + if (StringUtils.isNotEmpty(header.getTransferWarehouseName())) { + shipmentHeader.setTransferWarehouseName(header.getTransferWarehouseName()); + } + if (StringUtils.isNotEmpty(header.getTransferWarehouseCode())) { + shipmentHeader.setTransferWarehouseCode(header.getTransferWarehouseCode()); + } shipmentHeader.setSuperiorName(header.getSuperiorName()); shipmentHeader.setShipmentNote(header.getShipmentNote()); shipmentHeader.setRequestedDeliveryDate(header.getRequestedDeliveryDate()); + if (StringUtils.isNotEmpty(header.getTransferWarehouseCode())) { + shipmentHeader.setTransferWarehouseCode(header.getTransferWarehouseCode()); + } + shipmentHeader.setDailyScheduleImportDate(header.getDailyScheduleImportDate()); shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_CONTAINER_BUILD); shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_CONTAINER_BUILD); shipmentHeader.setTotalLines(details.size()); @@ -208,24 +221,24 @@ public class MesServiceImpl implements IMesService { shipmentHeader.setCompanyCode("BHF"); shipmentHeader.setCreatedBy("MOM"); boolean success = shipmentHeaderService.save(shipmentHeader); - if(!success) { + if (!success) { throw new ServiceException("生成出库单头失败"); } List<ShipmentDetail> shipmentDetailList = new ArrayList<>(); - details.forEach(detail->{ + details.forEach(detail -> { ShipmentDetail shipmentDetail = new ShipmentDetail(); - if(StringUtils.isNotEmpty(detail.getDetailID())){ + if (StringUtils.isNotEmpty(detail.getDetailID())) { shipmentDetail.setMOMID(detail.getDetailID()); } Material material = materialService.getOne(new LambdaQueryWrapper<Material>().eq(Material::getCode, detail.getMaterialCode())); - if (material==null) { + if (material == null) { Material newMaterial = new Material(); newMaterial.setCode(detail.getMaterialCode()); newMaterial.setName(detail.getMaterialName()); newMaterial.setWarehouseCode("CS0001"); newMaterial.setCompanyCode("BHF"); materialService.save(newMaterial); - }else { + } else { shipmentDetail.setMaterialSpec(material.getSpec()); shipmentDetail.setMaterialUnit(material.getUnit()); } @@ -248,143 +261,246 @@ public class MesServiceImpl implements IMesService { shipmentDetailList.add(shipmentDetail); }); success = shipmentDetailService.saveBatch(shipmentDetailList); - if(!success) { + if (!success) { throw new ServiceException("生成出库单详情失败"); } return AjaxResult.success(receiptDTO); } + /** + * 取消入库 + */ @Override @Transactional(rollbackFor = Exception.class) public AjaxResult cancelEnterWarehouse(ReceiptDTO receiptDTO) { Header header = receiptDTO.getShipmentHeader(); - List<Detail> details = receiptDTO.getShipemtnDetails(); - - if (StringUtils.isEmpty(header.getReferCode())){ + //List<Detail> details = receiptDTO.getShipemtnDetails(); + if (StringUtils.isEmpty(header.getReferCode())) { return AjaxResult.error().setMsg("单据单号不能为空!!!"); } - for (Detail detailIsNull:details){ - if(StringUtils.isEmpty(detailIsNull.getDetailID())){ - return AjaxResult.error().setMsg("单据明细ID不能为空!!!"); - } - } - // 查询入库单据表头 - LambdaQueryWrapper<ReceiptHeader> receiptHeaderWrapper = Wrappers.lambdaQuery(); - receiptHeaderWrapper.eq(ReceiptHeader::getId, header.getId()); - ReceiptHeader receiptHeader = receiptHeaderService.getById(receiptHeaderWrapper); + ReceiptHeader receiptHeader = receiptHeaderService.getOne(new LambdaQueryWrapper<ReceiptHeader>().eq(ReceiptHeader::getCode, header.getReferCode())); if (receiptHeader == null) { - return AjaxResult.error().setMsg("没有找到对应单据!!!"); + return AjaxResult.error().setMsg("没有找到对应单据," + header.getReferCode()); + } + //if (receiptHeader.getFirstStatus() >= QuantityConstant.RECEIPT_HEADER_POOL) { + // return AjaxResult.error("订单状态大于100不能删除"); + //} + List<ReceiptDetail> list = receiptDetailService.list(new LambdaQueryWrapper<ReceiptDetail>().eq(ReceiptDetail::getReceiptId, receiptHeader.getId())); + BigDecimal finishQty = BigDecimal.ZERO; + for (ReceiptDetail receiptDetail : list) { + finishQty = finishQty.add(receiptDetail.getTaskQty()); + } + if (finishQty.compareTo(BigDecimal.ZERO) > 0) { + return AjaxResult.error("入库单删除错误:已收数量不为零不能删除!"); + } + String name = "未知"; + if (StringUtils.isNotEmpty(header.getDelete())) { + name = header.getDelete(); } - // 查询入库单据明细 - LambdaQueryWrapper<ReceiptDetail> receiptDetailWrapper = Wrappers.lambdaQuery(); - receiptDetailWrapper.eq(ReceiptDetail::getReceiptId, receiptHeader.getId()); + //新增入库单历史 + receiptHeaderHistoryService.saveById(receiptHeader.getId().toString(), name); - List<ReceiptDetail> receiptDetailList = receiptDetailService.list(receiptDetailWrapper); - if (receiptDetailList == null) { - return AjaxResult.error().setMsg("没有找到对应单据明细!!!"); + if (!receiptHeaderService.removeById(receiptHeader)) { + throw new ServiceException("删除头表失败"); } - // 获取删除明细 - List<ReceiptDetail> removeReceiptDetails = new ArrayList<>(); - receiptDetailList.forEach(receiptDetail-> details.forEach(detail->{ - if (detail.getDetailID().equals(receiptDetail.getMOMID())){ - removeReceiptDetails.add(receiptDetail); - } - })); - ArrayList<Integer> ids = new ArrayList<>(); - if (removeReceiptDetails.size() > 0){ - removeReceiptDetails.forEach(receiptDetail->{ - ids.add(receiptDetail.getId()); - }); - } - if (ids.size() < 1 || removeReceiptDetails.size() < 1){ - return AjaxResult.error().setMsg("没有匹配到对应要取消的入库单单据明细!!!"); - } - boolean success = receiptDetailService.removeByIds(ids); - if(!success) { - throw new ServiceException("删除入库单详情失败"); - } - // 出库单明细数量和要删除的明细数量一致,则删除主表 - boolean isRemove = removeReceiptDetails.size() == receiptDetailList.size(); - if (isRemove){ - success = receiptHeaderService.removeById(receiptHeader.getId()); - if(!success) { - throw new ServiceException("删除入库单失败"); + List<Integer> receiptDetailIds = new ArrayList<>(); + for (ReceiptDetail receiptDetail : list) { + receiptDetailIds.add(receiptDetail.getId()); + } + if (receiptDetailIds.size() > 0) { + if (!receiptDetailService.removeByIds(receiptDetailIds)) { + throw new ServiceException("删除明细表失败"); } - }else{ - receiptHeader.setCreatorName(header.getCreatorName()); - receiptHeader.setCreatorCode(header.getCreatorCode()); - receiptHeader.setLastUpdatedBy(header.getCreatorName()); - receiptHeader.setWarehouse(header.getWarehouse()); - receiptHeader.setWarehouseName(header.getWarehouseName()); - receiptHeaderService.updateById(receiptHeader); } return AjaxResult.success("取消入库单成功"); } + /** + * 取消出库 + */ @Override @Transactional(rollbackFor = Exception.class) public AjaxResult cancelOutWarehouse(ReceiptDTO receiptDTO) { Header header = receiptDTO.getShipmentHeader(); - List<Detail> details = receiptDTO.getShipemtnDetails(); + if (StringUtils.isEmpty(header.getReferCode())) { + return AjaxResult.error().setMsg("单据单号不能为空!!!"); + } + // 查询入库单据表头 + ShipmentHeader shipmentHeader = shipmentHeaderService.getOne(new LambdaQueryWrapper<ShipmentHeader>().eq(ShipmentHeader::getCode, header.getReferCode())); + if (shipmentHeader == null) { + return AjaxResult.error().setMsg("没有找到对应单据," + header.getReferCode()); + } + List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(new LambdaQueryWrapper<ShipmentDetail>().eq(ShipmentDetail::getShipmentId, shipmentHeader.getId())); + BigDecimal finishQty = BigDecimal.ZERO; + for (ShipmentDetail shipmentDetail : shipmentDetailList) { + finishQty = finishQty.add(shipmentDetail.getTaskQty()); + } + if (finishQty.compareTo(BigDecimal.ZERO) > 0) { + return AjaxResult.error("出库单删除错误:单据出库数量不为零不能删除!"); + } - AjaxResult ajaxResult = isNull(header, details); - if (StringUtils.isNotEmpty(ajaxResult.getMsg())){ - return ajaxResult; + String name = "未知"; + if (StringUtils.isNotEmpty(header.getDelete())) { + name = header.getDelete(); } + //新增出库单历史 + shipmentHeaderHistoryService.saveById(shipmentHeader.getId().toString(), name); - // 查询出库单据表头 - LambdaQueryWrapper<ShipmentHeader> shipmentHeaderWrapper = Wrappers.lambdaQuery(); - shipmentHeaderWrapper.eq(ShipmentHeader::getCode, header.getSuperiorCode()); - ShipmentHeader shipmentHeader = shipmentHeaderService.getOne(shipmentHeaderWrapper); - if (shipmentHeader == null) { - return ajaxResult.setCode(RetCode.FAIL).setMsg("没有找到对应单据!!!"); - } - // 查询出库单据明细 - LambdaQueryWrapper<ShipmentDetail> shipmentDetailWrapper = Wrappers.lambdaQuery(); - shipmentDetailWrapper.eq(ShipmentDetail::getShipmentId, header.getId()); - List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(shipmentDetailWrapper); - if (shipmentDetailList == null) { - return ajaxResult.setCode(RetCode.FAIL).setMsg("没有找到对应单据明细!!!"); - } - // 获取删除明细 - List<ShipmentDetail> removeShipmentDetails = new ArrayList<>(); - shipmentDetailList.forEach(shipmentDetai-> details.forEach(detail->{ - if (detail.getMaterialCode().equals(shipmentDetai.getMaterialCode()) && detail.getTotalQty().intValue() == (shipmentDetai.getTaskQty().intValue())){ - removeShipmentDetails.add(shipmentDetai); + List<Integer> shipmentDetailIds = new ArrayList<>(); + if (!shipmentHeaderService.removeById(shipmentHeader)) { + throw new ServiceException("删除头表失败"); + } + for (ShipmentDetail shipmentDetail : shipmentDetailList) { + shipmentDetailIds.add(shipmentDetail.getId()); + } + if (shipmentDetailIds.size() > 0) { + if (!shipmentDetailService.removeByIds(shipmentDetailIds)) { + throw new ServiceException("删除明细表失败"); } - })); - if (removeShipmentDetails.size() > 0){ - ArrayList<Integer> ids = new ArrayList<>(); - removeShipmentDetails.forEach(shipmentDetail-> ids.add(shipmentDetail.getId())); - shipmentDetailService.removeByIds(ids); - }else { - return ajaxResult.setCode(RetCode.FAIL).setMsg("没有匹配到对应要取消的出库单单据明细!!!"); - } - // 出库单明细数量和要删除的明细数量一致,则删除主表 - boolean isRemove = removeShipmentDetails.size() == shipmentDetailList.size(); - if (isRemove){ - shipmentHeaderService.removeById(shipmentHeader); - }else{ - shipmentHeader.setCreatorName(header.getCreatorName()); - shipmentHeader.setCreatorCode(header.getCreatorCode()); - shipmentHeader.setLastUpdatedBy(header.getCreatorName()); - shipmentHeader.setWarehouse(header.getWarehouse()); - shipmentHeader.setWarehouseName(header.getWarehouseName()); - shipmentHeaderService.updateById(shipmentHeader); } return AjaxResult.success("取消出库单成功"); } + ///** + // * 取消入库 + // */ + //@Override + //@Transactional(rollbackFor = Exception.class) + //public AjaxResult cancelEnterWarehouse(ReceiptDTO receiptDTO) { + // Header header = receiptDTO.getShipmentHeader(); + // List<Detail> details = receiptDTO.getShipemtnDetails(); + // + // if (StringUtils.isEmpty(header.getReferCode())){ + // return AjaxResult.error().setMsg("单据单号不能为空!!!"); + // } + // for (Detail detailIsNull:details){ + // if(StringUtils.isEmpty(detailIsNull.getDetailID())){ + // return AjaxResult.error().setMsg("单据明细ID不能为空!!!"); + // } + // } + // + // // 查询入库单据表头 + // LambdaQueryWrapper<ReceiptHeader> receiptHeaderWrapper = Wrappers.lambdaQuery(); + // receiptHeaderWrapper.eq(ReceiptHeader::getId, header.getId()); + // ReceiptHeader receiptHeader = receiptHeaderService.getById(receiptHeaderWrapper); + // if (receiptHeader == null) { + // return AjaxResult.error().setMsg("没有找到对应单据!!!"); + // } + // // 查询入库单据明细 + // LambdaQueryWrapper<ReceiptDetail> receiptDetailWrapper = Wrappers.lambdaQuery(); + // receiptDetailWrapper.eq(ReceiptDetail::getReceiptId, receiptHeader.getId()); + // + // List<ReceiptDetail> receiptDetailList = receiptDetailService.list(receiptDetailWrapper); + // if (receiptDetailList == null) { + // return AjaxResult.error().setMsg("没有找到对应单据明细!!!"); + // } + // // 获取删除明细 + // List<ReceiptDetail> removeReceiptDetails = new ArrayList<>(); + // receiptDetailList.forEach(receiptDetail-> details.forEach(detail->{ + // if (detail.getDetailID().equals(receiptDetail.getMOMID())){ + // removeReceiptDetails.add(receiptDetail); + // } + // })); + // ArrayList<Integer> ids = new ArrayList<>(); + // if (removeReceiptDetails.size() > 0){ + // removeReceiptDetails.forEach(receiptDetail->{ + // ids.add(receiptDetail.getId()); + // }); + // } + // if (ids.size() < 1 || removeReceiptDetails.size() < 1){ + // return AjaxResult.error().setMsg("没有匹配到对应要取消的入库单单据明细!!!"); + // } + // boolean success = receiptDetailService.removeByIds(ids); + // if(!success) { + // throw new ServiceException("删除入库单详情失败"); + // } + // // 出库单明细数量和要删除的明细数量一致,则删除主表 + // boolean isRemove = removeReceiptDetails.size() == receiptDetailList.size(); + // if (isRemove){ + // success = receiptHeaderService.removeById(receiptHeader.getId()); + // if(!success) { + // throw new ServiceException("删除入库单失败"); + // } + // }else{ + // receiptHeader.setCreatorName(header.getCreatorName()); + // receiptHeader.setCreatorCode(header.getCreatorCode()); + // receiptHeader.setLastUpdatedBy(header.getCreatorName()); + // receiptHeader.setWarehouse(header.getWarehouse()); + // receiptHeader.setWarehouseName(header.getWarehouseName()); + // receiptHeaderService.updateById(receiptHeader); + // } + // return AjaxResult.success("取消入库单成功"); + //} + // + ///** + // * 取消入库 + // */ + //@Override + //@Transactional(rollbackFor = Exception.class) + //public AjaxResult cancelOutWarehouse(ReceiptDTO receiptDTO) { + // Header header = receiptDTO.getShipmentHeader(); + // List<Detail> details = receiptDTO.getShipemtnDetails(); + // + // AjaxResult ajaxResult = isNull(header, details); + // if (StringUtils.isNotEmpty(ajaxResult.getMsg())) { + // return ajaxResult; + // } + // + // // 查询出库单据表头 + // LambdaQueryWrapper<ShipmentHeader> shipmentHeaderWrapper = Wrappers.lambdaQuery(); + // shipmentHeaderWrapper.eq(ShipmentHeader::getCode, header.getSuperiorCode()); + // ShipmentHeader shipmentHeader = shipmentHeaderService.getOne(shipmentHeaderWrapper); + // if (shipmentHeader == null) { + // return ajaxResult.setCode(RetCode.FAIL).setMsg("没有找到对应单据!!!"); + // } + // // 查询出库单据明细 + // LambdaQueryWrapper<ShipmentDetail> shipmentDetailWrapper = Wrappers.lambdaQuery(); + // shipmentDetailWrapper.eq(ShipmentDetail::getShipmentId, header.getId()); + // List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(shipmentDetailWrapper); + // if (shipmentDetailList == null) { + // return ajaxResult.setCode(RetCode.FAIL).setMsg("没有找到对应单据明细!!!"); + // } + // // 获取删除明细 + // List<ShipmentDetail> removeShipmentDetails = new ArrayList<>(); + // shipmentDetailList.forEach(shipmentDetai-> details.forEach(detail->{ + // if (detail.getMaterialCode().equals(shipmentDetai.getMaterialCode()) && detail.getTotalQty().intValue() == (shipmentDetai.getTaskQty().intValue())){ + // removeShipmentDetails.add(shipmentDetai); + // } + // })); + // if (removeShipmentDetails.size() > 0) { + // ArrayList<Integer> ids = new ArrayList<>(); + // removeShipmentDetails.forEach(shipmentDetail -> ids.add(shipmentDetail.getId())); + // shipmentDetailService.removeByIds(ids); + // } else { + // return ajaxResult.setCode(RetCode.FAIL).setMsg("没有匹配到对应要取消的出库单单据明细!!!"); + // } + // // 出库单明细数量和要删除的明细数量一致,则删除主表 + // boolean isRemove = removeShipmentDetails.size() == shipmentDetailList.size(); + // if (isRemove) { + // shipmentHeaderService.removeById(shipmentHeader); + // } else { + // shipmentHeader.setCreatorName(header.getCreatorName()); + // shipmentHeader.setCreatorCode(header.getCreatorCode()); + // shipmentHeader.setLastUpdatedBy(header.getCreatorName()); + // shipmentHeader.setWarehouse(header.getWarehouse()); + // shipmentHeader.setWarehouseName(header.getWarehouseName()); + // shipmentHeaderService.updateById(shipmentHeader); + // } + // return AjaxResult.success("取消出库单成功"); + //} + + /** * 出库单参数_判空处理 + * * @param ajaxResult * @param shipmentHeader * @param shipemtnDetails */ - private boolean outIsNull (AjaxResult ajaxResult, Header shipmentHeader, List<Detail> shipemtnDetails){ - if (isNullData(ajaxResult, shipmentHeader, shipemtnDetails)){ + private boolean outIsNull(AjaxResult ajaxResult, Header shipmentHeader, List<Detail> shipemtnDetails) { + if (isNullData(ajaxResult, shipmentHeader, shipemtnDetails)) { return true; } @@ -393,7 +509,7 @@ public class MesServiceImpl implements IMesService { return true; } - shipemtnDetails.forEach(shipemtnDetail->{ + shipemtnDetails.forEach(shipemtnDetail -> { if (StringUtils.isEmpty(shipemtnDetail.getMaterialCode())) { ajaxResult.setCode(RetCode.FAIL).setMsg("物料编码不能为空!!!"); } @@ -409,7 +525,7 @@ public class MesServiceImpl implements IMesService { ajaxResult.setCode(RetCode.FAIL).setMsg("总数量不能为空!!!"); } }); - if (isNull || StringUtils.isNotEmpty(ajaxResult.getMsg())){ + if (isNull || StringUtils.isNotEmpty(ajaxResult.getMsg())) { return ajaxResult; } return ajaxResult; @@ -417,13 +533,14 @@ public class MesServiceImpl implements IMesService { /** * 入库单参数_判空处理 + * * @param ajaxResult * @param shipmentHeader * @param shipemtnDetails */ - private boolean enterIsNull(AjaxResult ajaxResult, Header shipmentHeader, List<Detail> shipemtnDetails){ + private boolean enterIsNull(AjaxResult ajaxResult, Header shipmentHeader, List<Detail> shipemtnDetails) { - if (isNullData(ajaxResult, shipmentHeader, shipemtnDetails)){ + if (isNullData(ajaxResult, shipmentHeader, shipemtnDetails)) { return true; } @@ -433,11 +550,11 @@ public class MesServiceImpl implements IMesService { } else if (StringUtils.isEmpty(shipmentHeader.getReferCode())) { ajaxResult.setCode(RetCode.FAIL).setMsg("单据单号不能为空!!!"); return true; - }else if (shipmentHeader.getTotalQty() == null || shipmentHeader.getTotalQty().intValue() <= 0) { + } else if (shipmentHeader.getTotalQty() == null || shipmentHeader.getTotalQty().intValue() <= 0) { ajaxResult.setCode(RetCode.FAIL).setMsg("数量不能为空!!!"); } - shipemtnDetails.forEach(shipemtnDetail->{ + shipemtnDetails.forEach(shipemtnDetail -> { if (StringUtils.isEmpty(shipemtnDetail.getMaterialCode())) { ajaxResult.setCode(RetCode.FAIL).setMsg("物料编码不能为空!!!"); } else if (shipemtnDetail.getTotalQty() == null || shipemtnDetail.getQty().intValue() <= 0) { diff --git a/src/main/java/com/huaheng/pc/receipt/receiptHeader/controller/ReceiptHeaderController.java b/src/main/java/com/huaheng/pc/receipt/receiptHeader/controller/ReceiptHeaderController.java index 67009ad..bcd37d6 100644 --- a/src/main/java/com/huaheng/pc/receipt/receiptHeader/controller/ReceiptHeaderController.java +++ b/src/main/java/com/huaheng/pc/receipt/receiptHeader/controller/ReceiptHeaderController.java @@ -280,7 +280,7 @@ public class ReceiptHeaderController extends BaseController { } //新增入库单历史 - receiptHeaderHistoryService.saveById(String.valueOf(id)); + receiptHeaderHistoryService.saveById(String.valueOf(id), ""); if (!receiptHeaderService.removeById(receiptHeader)) { throw new ServiceException("删除头表失败"); diff --git a/src/main/java/com/huaheng/pc/receipt/receiptHeaderHistory/service/ReceiptHeaderHistoryService.java b/src/main/java/com/huaheng/pc/receipt/receiptHeaderHistory/service/ReceiptHeaderHistoryService.java index 450051d..f95fc97 100644 --- a/src/main/java/com/huaheng/pc/receipt/receiptHeaderHistory/service/ReceiptHeaderHistoryService.java +++ b/src/main/java/com/huaheng/pc/receipt/receiptHeaderHistory/service/ReceiptHeaderHistoryService.java @@ -2,9 +2,11 @@ package com.huaheng.pc.receipt.receiptHeaderHistory.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.support.Convert; +import com.huaheng.common.utils.StringUtils; import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.web.domain.AjaxResult; import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; @@ -13,22 +15,19 @@ import com.huaheng.pc.receipt.receiptDetailHistory.domain.ReceiptDetailHistory; import com.huaheng.pc.receipt.receiptDetailHistory.service.ReceiptDetailHistoryService; import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService; -//import org.apache.commons.beanutils.BeanUtils; +import com.huaheng.pc.receipt.receiptHeaderHistory.domain.ReceiptHeaderHistory; +import com.huaheng.pc.receipt.receiptHeaderHistory.mapper.ReceiptHeaderHistoryMapper; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + import javax.annotation.Resource; import java.math.BigDecimal; import java.util.ArrayList; - import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.huaheng.pc.receipt.receiptHeaderHistory.domain.ReceiptHeaderHistory; -import com.huaheng.pc.receipt.receiptHeaderHistory.mapper.ReceiptHeaderHistoryMapper; -import org.springframework.transaction.annotation.Transactional; - @Service public class ReceiptHeaderHistoryService extends ServiceImpl<ReceiptHeaderHistoryMapper, ReceiptHeaderHistory> { @@ -42,61 +41,61 @@ public class ReceiptHeaderHistoryService extends ServiceImpl<ReceiptHeaderHistor private ReceiptHeaderHistoryMapper receiptHeaderHistoryMapper; @Transactional - public AjaxResult add(String ids){ + public AjaxResult add(String ids) { List<Integer> idList = Arrays.asList(Convert.toIntArray(ids)); for (Integer id : idList) { ReceiptHeader receiptHeader = receiptHeaderService.getById(id); - if (receiptHeader == null) { + if (receiptHeader == null) { return AjaxResult.error("没有找到单据" + String.valueOf(id)); } - if((receiptHeader.getFirstStatus()>= QuantityConstant.RECEIPT_HEADER_POSTING && receiptHeader.getLastStatus()>=QuantityConstant.RECEIPT_HEADER_POSTING)|| - (receiptHeader.getFirstStatus()<QuantityConstant.RECEIPT_HEADER_POOL &receiptHeader.getLastStatus()<QuantityConstant.RECEIPT_HEADER_POOL)){ + if ((receiptHeader.getFirstStatus() >= QuantityConstant.RECEIPT_HEADER_POSTING && receiptHeader.getLastStatus() >= QuantityConstant.RECEIPT_HEADER_POSTING) || + (receiptHeader.getFirstStatus() < QuantityConstant.RECEIPT_HEADER_POOL & receiptHeader.getLastStatus() < QuantityConstant.RECEIPT_HEADER_POOL)) { ReceiptHeaderHistory receiptHeaderHistory = new ReceiptHeaderHistory(); List<ReceiptDetailHistory> receiptDetailHistoryList = new ArrayList<>(); //查询入库单明细 LambdaQueryWrapper<ReceiptDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); lambdaQueryWrapper.eq(ReceiptDetail::getReceiptId, id); List<ReceiptDetail> list = receiptDetailService.list(lambdaQueryWrapper); - //复制到入库历史实体 + //复制到入库历史实体 // ConvertUtils.register(new DateConverter(null), java.util.Date.class); // BeanUtils.copyProperties(receiptHeaderHistory, receiptHeader); - receiptHeaderHistory.setId(receiptHeader.getId()); - receiptHeaderHistory.setWarehouseCode(receiptHeader.getWarehouseCode()); - receiptHeaderHistory.setCompanyCode(receiptHeader.getCompanyCode()); - receiptHeaderHistory.setCode(receiptHeader.getCode()); - receiptHeaderHistory.setReceiptType(receiptHeader.getReceiptType()); - receiptHeaderHistory.setFirstStatus(receiptHeader.getFirstStatus()); - receiptHeaderHistory.setLastStatus(receiptHeader.getLastStatus()); - receiptHeaderHistory.setTotalQty(BigDecimal.valueOf(23)); - receiptHeaderHistory.setTotalLines(receiptHeader.getTotalLines()); - receiptHeaderHistory.setReceiptNote(receiptHeader.getReceiptNote()); - receiptHeaderHistory.setCreated(receiptHeader.getCreated()); - receiptHeaderHistory.setCreatedBy(receiptHeader.getCreatedBy()); - receiptHeaderHistory.setLastUpdated(receiptHeader.getLastUpdated()); - receiptHeaderHistory.setLastUpdatedBy(receiptHeader.getLastUpdatedBy()); - receiptHeaderHistory.setVersion(receiptHeader.getVersion()); - receiptHeaderHistory.setProcessStamp(receiptHeader.getProcessStamp()); - receiptHeaderHistory.setDeleted(receiptHeader.getDeleted()); + receiptHeaderHistory.setId(receiptHeader.getId()); + receiptHeaderHistory.setWarehouseCode(receiptHeader.getWarehouseCode()); + receiptHeaderHistory.setCompanyCode(receiptHeader.getCompanyCode()); + receiptHeaderHistory.setCode(receiptHeader.getCode()); + receiptHeaderHistory.setReceiptType(receiptHeader.getReceiptType()); + receiptHeaderHistory.setFirstStatus(receiptHeader.getFirstStatus()); + receiptHeaderHistory.setLastStatus(receiptHeader.getLastStatus()); + receiptHeaderHistory.setTotalQty(BigDecimal.valueOf(23)); + receiptHeaderHistory.setTotalLines(receiptHeader.getTotalLines()); + receiptHeaderHistory.setReceiptNote(receiptHeader.getReceiptNote()); + receiptHeaderHistory.setCreated(receiptHeader.getCreated()); + receiptHeaderHistory.setCreatedBy(receiptHeader.getCreatedBy()); + receiptHeaderHistory.setLastUpdated(receiptHeader.getLastUpdated()); + receiptHeaderHistory.setLastUpdatedBy(receiptHeader.getLastUpdatedBy()); + receiptHeaderHistory.setVersion(receiptHeader.getVersion()); + receiptHeaderHistory.setProcessStamp(receiptHeader.getProcessStamp()); + receiptHeaderHistory.setDeleted(receiptHeader.getDeleted()); - for (ReceiptDetail receiptDetail: list) { - ReceiptDetailHistory receiptDetailHistory = new ReceiptDetailHistory(); - BeanUtils.copyProperties(receiptDetailHistory, receiptDetail); - receiptDetailHistoryList.add(receiptDetailHistory); - } + for (ReceiptDetail receiptDetail : list) { + ReceiptDetailHistory receiptDetailHistory = new ReceiptDetailHistory(); + BeanUtils.copyProperties(receiptDetailHistory, receiptDetail); + receiptDetailHistoryList.add(receiptDetailHistory); + } receiptHeaderHistory.setLastUpdatedBy(ShiroUtils.getName()); - if (!receiptHeaderService.removeById(receiptHeader.getId())){ + if (!receiptHeaderService.removeById(receiptHeader.getId())) { throw new ServiceException("删除头表失败"); } - if(!this.save(receiptHeaderHistory)){ + if (!this.save(receiptHeaderHistory)) { throw new ServiceException("新增历史入库单失败"); } // 当存在明细时删除 - if (list.size()!= 0){ + if (list.size() != 0) { //删除入库明细 List<Integer> receiptDetailIds = new ArrayList<>(); - for (int i=0; i<receiptDetailHistoryList.size();i++){ + for (int i = 0; i < receiptDetailHistoryList.size(); i++) { receiptDetailHistoryList.get(i).setLastUpdatedBy(ShiroUtils.getName()); receiptDetailHistoryList.get(i).setReceiptId(receiptHeaderHistory.getId()); receiptDetailIds.add(receiptDetailHistoryList.get(i).getId()); @@ -104,11 +103,12 @@ public class ReceiptHeaderHistoryService extends ServiceImpl<ReceiptHeaderHistor if (!receiptDetailService.removeByIds(receiptDetailIds)) { throw new ServiceException("删除明细表失败"); } - if (!receiptDetailHistoryService.saveBatch(receiptDetailHistoryList)){ + if (!receiptDetailHistoryService.saveBatch(receiptDetailHistoryList)) { throw new ServiceException("新增明细失败"); - } } + } + } - }else { + } else { return AjaxResult.error("入库单没有完成,无法删除"); } } @@ -118,14 +118,21 @@ public class ReceiptHeaderHistoryService extends ServiceImpl<ReceiptHeaderHistor /** * 根据删除的入库单主表ID新增历史入库单记录 + * * @param id */ @Transactional - public void saveById(String id) { + public void saveById(String id, String name) { ReceiptHeader receiptHeader = receiptHeaderService.getById(id); ReceiptHeaderHistory receiptHeaderHistory = new ReceiptHeaderHistory(); BeanUtils.copyProperties(receiptHeader, receiptHeaderHistory); - receiptHeaderHistory.setOrigin("WMS删除:"+ShiroUtils.getName()); + if (StringUtils.isNotEmpty(name) && "回传".equals(name)) { + receiptHeaderHistory.setOrigin("回传"); + } else if (StringUtils.isNotEmpty(name) && !"回传".equals(name)) { + receiptHeaderHistory.setOrigin("MOM删除:" + name); + } else { + receiptHeaderHistory.setOrigin("WMS删除:" + ShiroUtils.getName()); + } this.save(receiptHeaderHistory); List<ReceiptDetailHistory> receiptDetailHistoryList = new ArrayList<>(); List<ReceiptDetail> receiptDetailList = receiptDetailService.list(new LambdaQueryWrapper<ReceiptDetail>().eq(ReceiptDetail::getReceiptId, receiptHeader.getId())); @@ -135,7 +142,7 @@ public class ReceiptHeaderHistoryService extends ServiceImpl<ReceiptHeaderHistor receiptDetailHistoryList.add(receiptDetailHistory); } List<ReceiptDetailHistory> newList = receiptDetailHistoryList.stream().peek(detail -> detail.setReceiptId(receiptHeaderHistory.getId())).collect(Collectors.toList()); - if (!receiptDetailHistoryService.saveBatch(newList)){ + if (!receiptDetailHistoryService.saveBatch(newList)) { throw new ServiceException("批量新增失败"); } diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java index 0e47e4c..6f477c2 100644 --- a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java +++ b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java @@ -100,13 +100,15 @@ public class ShipmentHeaderController extends BaseController { @Log(title = "出库-出库单", operating = "查看出库主单", action = BusinessType.GRANT) @PostMapping("/list") @ResponseBody - public TableDataInfo list(ShipmentHeader shipmentHeader, String createdBegin, String createdEnd, String deliveryDate, String startDate) { + public TableDataInfo list(ShipmentHeader shipmentHeader, String createdBegin, String createdEnd, String deliveryDate, String startDate, String importDate) { LambdaQueryWrapper<ShipmentHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(); PageDomain pageDomain = TableSupport.buildPageRequest(); Integer pageNum = pageDomain.getPageNum(); Integer pageSize = pageDomain.getPageSize(); Date date1 = null; Date date2 = null; + Date date3 = null; + try { if (StringUtils.isNotNull(deliveryDate)) { date1 = new SimpleDateFormat("yyyy-MM-dd").parse(deliveryDate); @@ -126,6 +128,15 @@ public class ShipmentHeaderController extends BaseController { } catch (java.text.ParseException e) { } + try { + if (StringUtils.isNotNull(importDate)) { + date3 = new SimpleDateFormat("yyyy-MM-dd").parse(importDate); + } else { + date3 = null; + } + } catch (java.text.ParseException e) { + } + Date startTime1 = date1; Date endTime1 = null; if (startTime1 != null) { @@ -140,6 +151,13 @@ public class ShipmentHeaderController extends BaseController { endTime2 = DateUtils.dateAddNum(startTime2, 1, 0, -1); } + Date startTime3 = date3; + Date endTime3 = null; + if (startTime3 != null) { + //获取当前时间 + endTime3 = DateUtils.dateAddNum(startTime3, 1, 0, -1); + } + lambdaQueryWrapper.ge(StringUtils.isNotEmpty(createdBegin), ShipmentHeader::getCreated, createdBegin) .le(StringUtils.isNotEmpty(createdEnd), ShipmentHeader::getCreated, createdEnd) .eq(ShipmentHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()) @@ -155,9 +173,11 @@ public class ShipmentHeaderController extends BaseController { .like(StringUtils.isNotEmpty(shipmentHeader.getProcessType()), ShipmentHeader::getProcessType, shipmentHeader.getProcessType()) .eq(StringUtils.isNotEmpty(shipmentHeader.getShipmentType()), ShipmentHeader::getShipmentType, shipmentHeader.getShipmentType()) .eq(StringUtils.isNotEmpty(shipmentHeader.getReferCode()), ShipmentHeader::getReferCode, shipmentHeader.getReferCode()) + .like(StringUtils.isNotEmpty(shipmentHeader.getTransferWarehouseName()), ShipmentHeader::getTransferWarehouseName, shipmentHeader.getTransferWarehouseName()) .eq(StringUtils.isNotEmpty(shipmentHeader.getReferCodeType()), ShipmentHeader::getReferCodeType, shipmentHeader.getReferCodeType()) .between(StringUtils.isNotNull(startTime1), ShipmentHeader::getRequestedDeliveryDate, startTime1, endTime1) .between(StringUtils.isNotNull(startTime2), ShipmentHeader::getRequestedStartDate, startTime2, endTime2) + .between(StringUtils.isNotNull(startTime3), ShipmentHeader::getDailyScheduleImportDate, startTime3, endTime3) .eq(shipmentHeader.getFirstStatus() != null, ShipmentHeader::getFirstStatus, shipmentHeader.getFirstStatus()) .eq(shipmentHeader.getLastStatus() != null, ShipmentHeader::getLastStatus, shipmentHeader.getLastStatus()) .eq(StringUtils.isNotNull(shipmentHeader.getPushSuccessStatus()), ShipmentHeader::getPushSuccessStatus, shipmentHeader.getPushSuccessStatus()) @@ -331,7 +351,7 @@ public class ShipmentHeaderController extends BaseController { } //新增出库单历史 - shipmentHeaderHistoryService.saveById(String.valueOf(id)); + shipmentHeaderHistoryService.saveById(String.valueOf(id), ""); List<Integer> shipmentDetailIds = new ArrayList<>(); diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/domain/ShipmentHeader.java b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/domain/ShipmentHeader.java index cb4d12f..ea9ba51 100644 --- a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/domain/ShipmentHeader.java +++ b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/domain/ShipmentHeader.java @@ -3,10 +3,11 @@ package com.huaheng.pc.shipment.shipmentHeader.domain; import com.baomidou.mybatisplus.annotation.*; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; -import lombok.Data; @ApiModel(value = "com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader") @Data @@ -146,6 +147,13 @@ public class ShipmentHeader implements Serializable { // private String requestedDeliveryType; /** + * 日计划导入日期 + */ + @TableField(value = "dailyScheduleImportDate") + @ApiModelProperty(value = "日计划导入日期") + private Date dailyScheduleImportDate; + + /** * 计划发车日期 */ @TableField(value = "scheduledShipDate") @@ -229,6 +237,12 @@ public class ShipmentHeader implements Serializable { @ApiModelProperty(value = "总行数") private Integer totalLines; + /** + * 调入仓库名称 + */ + @TableField(value = "transferWarehouseName") + @ApiModelProperty(value = "调入仓库名称") + private String transferWarehouseName; /** * 调整单号 @@ -484,32 +498,31 @@ public class ShipmentHeader implements Serializable { /** * 回传错误次数 + * * @return */ @TableField(value = "pushErrorCount") - @ApiModelProperty(value="回传错误次数") + @ApiModelProperty(value = "回传错误次数") public Integer pushErrorCount; /** * 错误消息 */ @TableField(value = "ErrorMsg") - @ApiModelProperty(value="错误消息") + @ApiModelProperty(value = "错误消息") public String errorMsg; /** * 回传状态,0默认,1成功,2失败 */ @TableField(value = "pushSuccessStatus") - @ApiModelProperty(value="回传状态,0默认,1成功,2失败,3提前过账") + @ApiModelProperty(value = "回传状态,0默认,1成功,2失败,3提前过账") public Integer pushSuccessStatus; /** - * 日计划导入日期 + * 调入仓库编码 */ - @TableField(value = "dailyScheduleImportDate") - @ApiModelProperty(value="日计划导入日期") - public Date dailyScheduleImportDate; - - + @TableField(value = "transferWarehouseCode") + @ApiModelProperty(value = "调入仓库编码") + private String transferWarehouseCode; } diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentHeaderHistory/service/ShipmentHeaderHistoryService.java b/src/main/java/com/huaheng/pc/shipment/shipmentHeaderHistory/service/ShipmentHeaderHistoryService.java index ce8a9bb..d8b8a1e 100644 --- a/src/main/java/com/huaheng/pc/shipment/shipmentHeaderHistory/service/ShipmentHeaderHistoryService.java +++ b/src/main/java/com/huaheng/pc/shipment/shipmentHeaderHistory/service/ShipmentHeaderHistoryService.java @@ -3,8 +3,8 @@ package com.huaheng.pc.shipment.shipmentHeaderHistory.service; import com.baomidou.mybatisplus.extension.service.IService; import com.huaheng.pc.shipment.shipmentHeaderHistory.domain.ShipmentHeaderHistory; -public interface ShipmentHeaderHistoryService extends IService<ShipmentHeaderHistory>{ +public interface ShipmentHeaderHistoryService extends IService<ShipmentHeaderHistory> { - void saveById(String id); + void saveById(String id, String name); } diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentHeaderHistory/service/ShipmentHeaderHistoryServiceImpl.java b/src/main/java/com/huaheng/pc/shipment/shipmentHeaderHistory/service/ShipmentHeaderHistoryServiceImpl.java index 263dacf..a787862 100644 --- a/src/main/java/com/huaheng/pc/shipment/shipmentHeaderHistory/service/ShipmentHeaderHistoryServiceImpl.java +++ b/src/main/java/com/huaheng/pc/shipment/shipmentHeaderHistory/service/ShipmentHeaderHistoryServiceImpl.java @@ -4,11 +4,11 @@ package com.huaheng.pc.shipment.shipmentHeaderHistory.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.huaheng.common.exception.service.ServiceException; +import com.huaheng.common.utils.StringUtils; import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; import com.huaheng.pc.shipment.shipmentDetail.service.ShipmentDetailService; import com.huaheng.pc.shipment.shipmentDetailHistory.domain.ShipmentDetailHistory; -import com.huaheng.pc.shipment.shipmentDetailHistory.mapper.ShipmentDetailHistoryMapper; import com.huaheng.pc.shipment.shipmentDetailHistory.service.ShipmentDetailHistoryService; import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader; import com.huaheng.pc.shipment.shipmentHeader.service.ShipmentHeaderService; @@ -41,14 +41,21 @@ public class ShipmentHeaderHistoryServiceImpl extends ServiceImpl<ShipmentHeader /** * 根据删除的出库单主表ID新增历史出库单记录 + * * @param id */ @Override - public void saveById(String id) { + public void saveById(String id, String name) { ShipmentHeader shipmentHeader = shipmentHeaderService.getById(id); ShipmentHeaderHistory shipmentHeaderHistory = new ShipmentHeaderHistory(); BeanUtils.copyProperties(shipmentHeader, shipmentHeaderHistory); - shipmentHeaderHistory.setOrigin("WMS删除:"+ ShiroUtils.getName()); + if (StringUtils.isNotEmpty(name) && "回传".equals(name)) { + shipmentHeaderHistory.setOrigin("回传"); + } else if (StringUtils.isNotEmpty(name) && !"回传".equals(name)) { + shipmentHeaderHistory.setOrigin("MOM删除:" + name); + } else { + shipmentHeaderHistory.setOrigin("WMS删除:" + ShiroUtils.getName()); + } shipmentHeaderHistoryMapper.insert(shipmentHeaderHistory); List<ShipmentDetailHistory> shipmentDetailHistoryList = new ArrayList<>(); List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(new LambdaQueryWrapper<ShipmentDetail>().eq(ShipmentDetail::getShipmentId, shipmentHeader.getId())); @@ -58,7 +65,7 @@ public class ShipmentHeaderHistoryServiceImpl extends ServiceImpl<ShipmentHeader shipmentDetailHistoryList.add(shipmentDetailHistory); } List<ShipmentDetailHistory> newList = shipmentDetailHistoryList.stream().peek(detail -> detail.setShipmentId(shipmentHeaderHistory.getId())).collect(Collectors.toList()); - if (!shipmentDetailHistoryService.saveBatch(newList)){ + if (!shipmentDetailHistoryService.saveBatch(newList)) { throw new ServiceException("批量新增失败"); } } diff --git a/src/main/resources/templates/shipment/shipmentHeader/report.html b/src/main/resources/templates/shipment/shipmentHeader/report.html index cbd02c4..ae4061e 100644 --- a/src/main/resources/templates/shipment/shipmentHeader/report.html +++ b/src/main/resources/templates/shipment/shipmentHeader/report.html @@ -1,5 +1,5 @@ <!DOCTYPE HTML> -<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> +<html lang="zh" xmlns:th="http://www.thymeleaf.org"> <meta charset="utf-8"> <head th:include="include :: header"></head> <body class="white-bg" style="padding:5px 0;" id="ddd"> @@ -11,25 +11,37 @@ <thead style="display:table-header-group;"> <tr> <td colspan="7"> - <span style="padding-top:40px;width: 40%; float:left;" th:text="${#dates.format(shipmentHeader.created,'yyyy-MM-dd HH:mm:ss')}"></span> + <span style="padding-top:40px;width: 40%; float:left;" + th:text="${#dates.format(shipmentHeader.created,'yyyy-MM-dd HH:mm:ss')}"></span> <h2 style="width:20%;text-align:center;float:left;padding-top:10px;">出库单</h2> - <span style="padding-top:20px;width:38%;float:right; text-align: right"><img id="shipmentCode" th:src="@{'/image/'+${shipmentHeader.code}}"></span> + <span style="padding-top:20px;width:38%;float:right; text-align: right"><img id="shipmentCode" + th:src="@{'/image/'+${shipmentHeader.code}}"></span> </td> </tr> <tr style="padding:15px 0 5px 0;border-bottom:1px solid #606060"> <td colspan="7"> -<!-- <div style="width:40%; float:left;">客户名称:<span th:text="${shipmentHeader['customerName']}"></span></div>--> - <div style="width:40%; float:left;">生产车间:<span th:text="${shipmentHeader['workshop']}"></span></div> - <div style="width:40%; float:left;">仓库:<span th:text="${shipmentHeader['warehouseName']}"></span></div> - <div style="width:40%; float:left;">通知单号:<span th:text="${shipmentHeader['noticeNo']}"></span></div> - <div style="width:40%; float:left;">母件名称:<span th:text="${shipmentHeader['superiorName']}"></span></div> + <!-- <div style="width:40%; float:left;">客户名称:<span th:text="${shipmentHeader['customerName']}"></span></div>--> + <div style="width:40%; float:left;">生产车间:<span th:text="${shipmentHeader['workshop']}"></span> + </div> + <div style="width:40%; float:left;">仓库:<span th:text="${shipmentHeader['warehouseName']}"></span> + </div> + <div style="width:40%; float:left;">通知单号:<span th:text="${shipmentHeader['noticeNo']}"></span> + </div> + <div style="width:40%; float:left;">母件名称:<span + th:text="${shipmentHeader['superiorName']}"></span></div> <span></span> - <div style="width:40%; float:left;">母件编码:<span th:text="${shipmentHeader['superiorCode']}"></span></div> - <div style="width:40%; float:left;">备注:<span th:text="${shipmentHeader['shipmentNote']}"></span></div> + <div style="width:40%; float:left;">母件编码:<span + th:text="${shipmentHeader['superiorCode']}"></span></div> + <div style="width:40%; float:left;">备注:<span th:text="${shipmentHeader['shipmentNote']}"></span> + </div> + <div style="width:40%; float:left;">调入仓库名称:<span + th:text="${shipmentHeader['transferWarehouseName']}"></span> + </div> <div style="width:50%; float:right; text-align:right"> <span>明细条数:<span th:text="${shipmentHeader['totalLines']}"></span></span> <span style="padding-left:20px;">明细总数:<span th:text="${shipmentHeader['totalQty']}"></span></span> - <span class="noprint" style="padding-left:20px;"><button type="button" onClick="a()"><i class="fa fa-print"></i> 打印</button></span> + <span class="noprint" style="padding-left:20px;"><button type="button" onClick="a()"><i + class="fa fa-print"></i> 打印</button></span> </div> </td> </tr> @@ -98,13 +110,15 @@ </script> <style type="text/css"> @media print { - .noprint{display:none;} + .noprint { + display: none; + } } </style> <script type="text/javascript" src="../../../js/jquery-1.4.4.min.js"></script> <script type="text/javascript" src="../../../js/jquery.jqprint-0.3.js"></script> <script type="text/javascript"> - function a(){ + function a() { $("#ddd").jqprint(); } </script> diff --git a/src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html b/src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html index e00be75..74b8916 100644 --- a/src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html +++ b/src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html @@ -66,6 +66,9 @@ 调整单号:<input type="text" name="processType"/> </li> <li> + 调入仓库名称:<input type="text" name="transferWarehouseName"/> + </li> + <li> 头 状 态:<select name="firstStatus" th:with="firstStatus=${@dict.getType('shipmentHeaderStatus')}"> <option value="">所有</option> @@ -97,14 +100,22 @@ 备注:<input type="text" name="shipmentNote"/> </li> <li class="time"> + + <label>日计划导入日期: </label> + <input type="text" class="time-input" id="dailyScheduleImportDate" + placeholder="日计划导入日期" + name="importDate" autocomplete="off"/> + <label>计划开工日期: </label> <input type="text" class="time-input" id="requestedStartDate" placeholder="计划开工日期" name="startDate" autocomplete="off"/> + <label>计划完成日期: </label> <input type="text" class="time-input" id="requestedDeliveryDate" placeholder="计划完成日期" name="deliveryDate" autocomplete="off"/> + <label>创建时间: </label> <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="createdBegin" autocomplete="off"/> @@ -300,6 +311,15 @@ var shipmentId = ""; var shipmentCode = ""; + //日计划导入日期 + layui.use('laydate', function () { + var laydate = layui.laydate; + var day1 = new Date(); + day1.setTime(day1.getTime() + 24 * 60 * 60 * 1000 * 1); + // laydate.render({ elem: '#requestedDeliveryDate', theme: 'molv',value: new Date(day1), isInitValue: true}); + laydate.render({elem: '#dailyScheduleImportDate', theme: 'molv'}); + }); + //计划完工日期 layui.use('laydate', function () { var laydate = layui.laydate; @@ -456,6 +476,11 @@ return actions.join(''); } }, + + { + field: 'dailyScheduleImportDate', + title: '日计划导入日期', + }, { field: 'requestedStartDate', title: '计划开工日期', @@ -468,11 +493,16 @@ field: 'workshop', title: '生产车间', }, + { field: 'shipmentNote', title: '备注', }, { + field: 'transferWarehouseName', + title: '调入仓库名称', + }, + { field: 'errorMsg', title: '错误信息', formatter: function (value, row, index) {