Przeglądaj źródła

发货提醒修改数量时增加已发货数量的判断,如果已发货数量+本次需求数量超出需求数量,则不作处理,其他正常修改

hejq 7 lat temu
rodzic
commit
c6928a08a6

+ 24 - 19
src/main/java/com/uas/platform/b2b/erp/service/impl/PurchaseNotifyServiceImpl.java

@@ -70,25 +70,30 @@ public class PurchaseNotifyServiceImpl implements PurchaseNotifyService {
 					remark = existNotice.getRemark() + "; ";
 				}
 				// 对卖家传输状态 // 待上传
-				existNotice.setSendStatus((short) Status.NOT_UPLOAD.value());
+                existNotice.setSendStatus((short) Status.NOT_UPLOAD.value());
+                Double sendQty = purchaseNoticeDao.getSendQtyByItemId(notice.getOrderItemId());
 				if (existNotice.getQty() != null && !existNotice.getQty().equals(notice.getQty())) {
-					if (existNotice.getEndQty() > notice.getQty()) {
-						// 已发货数大于新的需求数,修改平台上的需求数为已发货数,将已发货数量传回买家ERP修改发货提醒的数量
-						existNotice.setRemark(remark + dateString + "修改需求数量," + existNotice.getQty() + " -> "
-								+ existNotice.getEndQty());
-                        // 需求数量
-						existNotice.setQty(existNotice.getEndQty());
-                        // 状态  已回复
-						existNotice.setStatus((short) Status.REPLIED.value());
-						notices.add(existNotice);
-					} else {
-						// 已发货数小于或等于新的需求数,修改平台上的需求数为新的需求数
-						existNotice.setRemark(
-								remark + dateString + "修改需求数量," + existNotice.getQty() + " -> " + notice.getQty());
-						existNotice.setQty(notice.getQty());
-						existNotice.setDelivery(notice.getDelivery());
-						notices.add(existNotice);
-					}
+				    // 本次需求数量加上已发货数量不得超过订单明细的需求数量
+                    Double neeQty = sendQty + notice.getQty();
+                    if (neeQty <= notice.getOrderItem().getQty()) {
+                        if (existNotice.getEndQty() > notice.getQty()) {
+                            // 已发货数大于新的需求数,修改平台上的需求数为已发货数,将已发货数量传回买家ERP修改发货提醒的数量
+                            existNotice.setRemark(remark + dateString + "修改需求数量:" + existNotice.getQty() + " -> "
+                                    + existNotice.getEndQty());
+                            // 需求数量
+                            existNotice.setQty(existNotice.getEndQty());
+                            // 状态  已回复
+                            existNotice.setStatus((short) Status.REPLIED.value());
+                            notices.add(existNotice);
+                        } else {
+                            // 已发货数小于或等于新的需求数,修改平台上的需求数为新的需求数
+                            existNotice.setRemark(
+                                    remark + dateString + "修改需求数量:" + existNotice.getQty() + " -> " + notice.getQty());
+                            existNotice.setQty(notice.getQty());
+                            existNotice.setDelivery(notice.getDelivery());
+                            notices.add(existNotice);
+                        }
+                    }
 				} else {
 					String existDeliveryStr = "空";
 					String deliveryStr = "空";
@@ -99,7 +104,7 @@ public class PurchaseNotifyServiceImpl implements PurchaseNotifyService {
 						deliveryStr = dateFormat.format(notice.getDelivery());
 					}
 					if (!existDeliveryStr.equals(deliveryStr)) {
-						existNotice.setRemark(remark + dateString + "修改交期" + existDeliveryStr + " -> " + deliveryStr);
+						existNotice.setRemark(remark + dateString + "修改交期: " + existDeliveryStr + " -> " + deliveryStr);
                         mergeWaitingStatus(existNotice.getId(), SqlDateFormdateUtils.DATE_FORMAT.format(notice.getDelivery()));
 					}
 					existNotice.setDelivery(notice.getDelivery());