Browse Source

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

hejq 7 years ago
parent
commit
84ebdd40e1

+ 22 - 17
src/main/java/com/uas/platform/b2b/erp/service/impl/PurchaseNotifyServiceImpl.java

@@ -71,24 +71,29 @@ public class PurchaseNotifyServiceImpl implements PurchaseNotifyService {
 				}
 				// 对卖家传输状态 // 待上传
 				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 needQty = sendQty + notice.getQty();
+                    if (needQty <= 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 = "空";