|
@@ -1,13 +1,19 @@
|
|
|
package com.uas.platform.b2b.erp.service.impl;
|
|
package com.uas.platform.b2b.erp.service.impl;
|
|
|
|
|
|
|
|
import com.uas.platform.b2b.core.util.SqlDateFormdateUtils;
|
|
import com.uas.platform.b2b.core.util.SqlDateFormdateUtils;
|
|
|
-import com.uas.platform.b2b.dao.*;
|
|
|
|
|
|
|
+import com.uas.platform.b2b.dao.PurchaseNoticeDao;
|
|
|
|
|
+import com.uas.platform.b2b.dao.PurchaseOrderItemDao;
|
|
|
|
|
+import com.uas.platform.b2b.dao.SaleSendItemDao;
|
|
|
|
|
+import com.uas.platform.b2b.dao.SaleSendItemVerifyDao;
|
|
|
import com.uas.platform.b2b.erp.model.AcceptNotify;
|
|
import com.uas.platform.b2b.erp.model.AcceptNotify;
|
|
|
import com.uas.platform.b2b.erp.model.AcceptNotifyConfirm;
|
|
import com.uas.platform.b2b.erp.model.AcceptNotifyConfirm;
|
|
|
import com.uas.platform.b2b.erp.model.AcceptNotifyVerify;
|
|
import com.uas.platform.b2b.erp.model.AcceptNotifyVerify;
|
|
|
import com.uas.platform.b2b.erp.model.PurchaseNotify;
|
|
import com.uas.platform.b2b.erp.model.PurchaseNotify;
|
|
|
import com.uas.platform.b2b.erp.service.PurchaseNotifyService;
|
|
import com.uas.platform.b2b.erp.service.PurchaseNotifyService;
|
|
|
-import com.uas.platform.b2b.model.*;
|
|
|
|
|
|
|
+import com.uas.platform.b2b.model.PurchaseNotice;
|
|
|
|
|
+import com.uas.platform.b2b.model.SaleSend;
|
|
|
|
|
+import com.uas.platform.b2b.model.SaleSendItem;
|
|
|
|
|
+import com.uas.platform.b2b.model.SaleSendItemVerify;
|
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
|
import com.uas.platform.core.model.Status;
|
|
import com.uas.platform.core.model.Status;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
@@ -40,13 +46,11 @@ public class PurchaseNotifyServiceImpl implements PurchaseNotifyService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private SaleSendItemVerifyDao saleSendItemVerifyDao;
|
|
private SaleSendItemVerifyDao saleSendItemVerifyDao;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private CommunalLogDao communalLogDao;
|
|
|
|
|
- @Autowired
|
|
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<PurchaseNotice> convertPurchaseNotify(List<PurchaseNotify> notifies) {
|
|
public List<PurchaseNotice> convertPurchaseNotify(List<PurchaseNotify> notifies) {
|
|
|
- List<PurchaseNotice> notices = new ArrayList<PurchaseNotice>();
|
|
|
|
|
|
|
+ List<PurchaseNotice> notices = new ArrayList<>();
|
|
|
for (PurchaseNotify notify : notifies) {
|
|
for (PurchaseNotify notify : notifies) {
|
|
|
PurchaseNotice notice = notify.convert();
|
|
PurchaseNotice notice = notify.convert();
|
|
|
List<PurchaseNotice> existNotices = purchaseNoticeDao.findByEnUUAndSourceId(notice.getEnUU(),
|
|
List<PurchaseNotice> existNotices = purchaseNoticeDao.findByEnUUAndSourceId(notice.getEnUU(),
|
|
@@ -100,7 +104,11 @@ public class PurchaseNotifyServiceImpl implements PurchaseNotifyService {
|
|
|
}
|
|
}
|
|
|
if (!existDeliveryStr.equals(deliveryStr)) {
|
|
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()));
|
|
|
|
|
|
|
+ Double ltinStock = 0.00;
|
|
|
|
|
+ if (notice.getOrderItem() != null && notice.getOrderItem().getLtinstock() != null) {
|
|
|
|
|
+ ltinStock = notice.getOrderItem().getLtinstock();
|
|
|
|
|
+ }
|
|
|
|
|
+ existNotice.setWaiting(getNoticeWaiting(SqlDateFormdateUtils.DATE_FORMAT.format(notice.getDelivery()), ltinStock));
|
|
|
}
|
|
}
|
|
|
existNotice.setDelivery(notice.getDelivery());
|
|
existNotice.setDelivery(notice.getDelivery());
|
|
|
notices.add(existNotice);
|
|
notices.add(existNotice);
|
|
@@ -111,20 +119,18 @@ public class PurchaseNotifyServiceImpl implements PurchaseNotifyService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 更新发货提醒备料状态
|
|
|
|
|
|
|
+ * 根据函数获取备料状态
|
|
|
*
|
|
*
|
|
|
- * @param noticeId 发货单id
|
|
|
|
|
- * @param deliveryStr 新的交货周期
|
|
|
|
|
|
|
+ * @param deliveryStr 格式化日期
|
|
|
|
|
+ * @param ltinStock 物料备料提前期
|
|
|
|
|
+ * @return
|
|
|
*/
|
|
*/
|
|
|
- private void mergeWaitingStatus(Long noticeId, String deliveryStr) {
|
|
|
|
|
- String sql = "update purc$notice,purc$orderitems set is_waiting = PURC_NOTICE_WAIT_TO_SEND('" + deliveryStr + "', coalesce(pr_ltinstock, 0)) " +
|
|
|
|
|
- "where pn_pdid = pd_id and pn_id = " + noticeId;
|
|
|
|
|
- jdbcTemplate.execute(sql);
|
|
|
|
|
- communalLogDao.save(new CommunalLog("更新发货提醒备料状态", "通过发货提醒更新备料状态", "发货单id: " + noticeId,
|
|
|
|
|
- SystemSession.getUser().getEnterprise().getUu()));
|
|
|
|
|
|
|
+ private Short getNoticeWaiting(String deliveryStr, double ltinStock) {
|
|
|
|
|
+ String sql = String.format("select PURC_NOTICE_WAIT_TO_SEND('%s', %f)", deliveryStr, ltinStock);
|
|
|
|
|
+ Short waitStatus = jdbcTemplate.queryForObject(sql, Short.class);
|
|
|
|
|
+ return waitStatus;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 将平台的发货提醒封装成ERP系统的发货提醒
|
|
* 将平台的发货提醒封装成ERP系统的发货提醒
|
|
|
*
|
|
*
|