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