|
|
|
@ -250,11 +250,12 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
|
|
|
|
|
if (mesSaleOrderRelatesBySale != null && !mesSaleOrderRelatesBySale.isEmpty()) {
|
|
|
|
|
throw new ServiceException("选择的销售订单已经合并过,不能绑定");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
if (orderBind.getSaleOrderId() != null) {
|
|
|
|
|
throw new ServiceException("安全库存标识为是的不需要选择销售订单");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (orderBind.getSafeFlag().equals(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES)
|
|
|
|
|
&& orderBind.getSaleOrderId() != null) {
|
|
|
|
|
throw new ServiceException("安全库存标识为是的不需要选择销售订单");
|
|
|
|
|
orderBind.setSaleOrderId(0L);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BigDecimal bindAmount = orderBind.getBindAmount() == null ?
|
|
|
|
@ -348,15 +349,15 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
|
|
|
|
|
MesPurchaseOrder dbMesPurchaseOrder = mesPurchaseOrderMapper.
|
|
|
|
|
unbindPurchaseOrderListByPurchaseAndSaleOrderId(purchaseOrderId, mesSaleOrder.getSaleOrderId());
|
|
|
|
|
if (!mesPurchaseOrder.equals(dbMesPurchaseOrder)) {
|
|
|
|
|
throw new ServiceException("数据有变化,请重新更新");
|
|
|
|
|
throw new ServiceException("序号: " + mesPurchaseOrder.getSerialNumber() +",数据有变化,请重新更新");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dbMesPurchaseOrder.getOrderStatus().equals(MesConstants.MES_PURCHASE_ORDER_STATUS_PURCHASE_COMPLETE)) {
|
|
|
|
|
throw new ServiceException("此采购订单已经采购完成,无需再绑定");
|
|
|
|
|
throw new ServiceException("序号: " + mesPurchaseOrder.getSerialNumber() +",此采购订单已经采购完成,无需再绑定");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dbMesPurchaseOrder.getOrderStatus().equals(MesConstants.MES_PURCHASE_ORDER_STATUS_AUTO_OUTSTOCK_COMPLETE)) {
|
|
|
|
|
throw new ServiceException("此采购订单已经自动出库完成,无需再绑定");
|
|
|
|
|
throw new ServiceException("序号: " + mesPurchaseOrder.getSerialNumber() +",此采购订单已经自动出库完成,无需再绑定");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -426,10 +427,15 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
|
|
|
|
|
mesOrderBindMapper.insertMesOrderBind(orderBind);
|
|
|
|
|
} else {
|
|
|
|
|
MesOrderBind bind = bindList.get(0);
|
|
|
|
|
if(purchaseOrder.getUpdateAmount().compareTo(BigDecimal.ZERO)>0){
|
|
|
|
|
bind.setBindAmount(purchaseOrder.getUpdateAmount());
|
|
|
|
|
bind.setUpdateBy(SecurityUtils.getUsername());
|
|
|
|
|
bind.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
mesOrderBindMapper.updateMesOrderBind(bind);
|
|
|
|
|
}else{
|
|
|
|
|
mesOrderBindMapper.deleteMesOrderBindByOrderBindId(bind.getOrderBindId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|