diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java index 3c11d0707..d751ec895 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java @@ -1068,14 +1068,15 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb } // 运单修改 else{ -// // 检查是否已锁单 -// checkDBBillIsLock(emisWaybillOld); -// -// emisWaybillSave.setId(emisWaybillOld.getId()); -// // 把历史发货日期带过来用于重新计算预估到到时间 -// emisWaybillSave.setSendDate(emisWaybillOld.getSendDate()); -// -// reUpdateWayBill(emisWaybillOld,emisWaybillSave); + if( !"0".equals(emisWaybillSave.getWaybillStatus()) ){ + throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"已揽件,不能修改!"); + } + if(OrderStatus.CANCEL.statusCode.equals(emisWaybillSave.getOrderStatus()) ){ + throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"已取消,不能修改!"); + } + + emisWaybillSave.setId(emisWaybillOld.getId()); + realSubmitOrderByOms(emisWaybillSave); } return 1; @@ -2887,6 +2888,78 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb } + public void reUpdateWayBillByOms(EmisWaybill oldEmisWaybill,EmisWaybill emisWaybillSave) throws EmisBizError { + + // 公共计算部分 + emisWaybillSave.setId(oldEmisWaybill.getId()); + + calcWayBillCommonInfoByOms(emisWaybillSave,false); + + // 基础信息更新 + emisWaybillMapper.updateEmisWaybill(emisWaybillSave); + + // 绑定专属业务员 + String bindEmpCode=emisWaybillSave.getTakePieceEmployeeCode(); + if(StringUtils.isEmpty(bindEmpCode)){ + bindEmpCode=emisWaybillSave.getOperateEmployeeCode(); + } + String customerCode=emisWaybillSave.getCustomerCode(); + + if(!StringUtils.isEmpty(bindEmpCode)&&!StringUtils.isEmpty(customerCode)) { + bindSalesmen(bindEmpCode,customerCode); + } + + // 删除旧信息 + emisWaybillFeeitemMapper.deleteEmisWaybillFeeitemByWaybillId(emisWaybillSave.getId()); + + emisWaybillCargoMapper.deleteEmisWaybillCargoByWaybillId(emisWaybillSave.getId()); + + // 产生主键插入其他数据 + // 插入费用 + List feeitemList=emisWaybillSave.getFeeitemList(); + if(!CollectionUtils.isEmpty(feeitemList)){ + for (EmisWaybillFeeitem feeItem:feeitemList) { + feeItem.setWaybillId(emisWaybillSave.getId()); + emisWaybillFeeitemMapper.insertEmisWaybillFeeitem(feeItem); + } + } + + // 插入商品信息 + if(!CollectionUtil.isEmpty(emisWaybillSave.getCargoList() )){ + List cargoList=emisWaybillSave.getCargoList(); + for (EmisWaybillCargo cargoItem:cargoList) { + cargoItem.setWaybillId(emisWaybillSave.getId()); + emisWaybillCargoMapper.insertEmisWaybillCargo(cargoItem); + } + } + + // 保存货物图片 + if(!StringUtils.isEmpty(emisWaybillSave.getGoodsPics())){ + // 删除图片插入新图片 + emisWaybillAttachmentMapper.deleteByBillCodeAndAttachType(emisWaybillSave.getBillCode(),WaybillAttachType.GOODS_PIC.typeCode); + + EmisWaybillAttachment goodsPicAttachment = new EmisWaybillAttachment(); + goodsPicAttachment.setWaybillId(emisWaybillSave.getId()); + goodsPicAttachment.setAttachType(WaybillAttachType.GOODS_PIC.typeCode); + goodsPicAttachment.setBillCode(emisWaybillSave.getBillCode()); + goodsPicAttachment.setFileUrl(emisWaybillSave.getGoodsPics()); + + emisWaybillAttachmentMapper.insertEmisWaybillAttachment(goodsPicAttachment); + + } + + // 插入其他附件信息 + if(!CollectionUtil.isEmpty(emisWaybillSave.getAttachmentList() )){ + List attachmentList=emisWaybillSave.getAttachmentList(); + for (EmisWaybillAttachment attachmentItem:attachmentList) { + attachmentItem.setWaybillId(emisWaybillSave.getId()); + emisWaybillAttachmentMapper.insertEmisWaybillAttachment(attachmentItem); + } + } + + } + + /** * 生成电子底单信息并上传 * @param billCode