Browse Source

新增发货提醒上传检测

hejq 8 years ago
parent
commit
b4887e0c0d

+ 9 - 0
src/main/java/com/uas/erp/schedular/b2b/domain/PurchaseNotify.java

@@ -20,6 +20,7 @@ public class PurchaseNotify extends KeyEntity{
 	private String pn_remark;
 	private Double pn_endqty;
 	private Double pr_zxbzs;// 物料最小包装数
+	private Long pn_b2bid; //b2bid
 
 	public int getPn_id() {
 		return pn_id;
@@ -101,6 +102,14 @@ public class PurchaseNotify extends KeyEntity{
 		this.pr_zxbzs = pr_zxbzs;
 	}
 
+	public Long getPn_b2bid() {
+		return pn_b2bid;
+	}
+
+	public void setPn_b2bid(Long pn_b2bid) {
+		this.pn_b2bid = pn_b2bid;
+	}
+
 	@Override
 	public Object getKey() {
 		return pn_id;

+ 27 - 5
src/main/java/com/uas/erp/schedular/b2b/task/CheckTransTask.java

@@ -20,11 +20,11 @@ public class CheckTransTask extends AbstractTask {
 
     @TaskMapping(title = "采购询价单", fixedDelay = 60000)
     public void uploadInquiry() {
-        List<Inquiry> inquiries = jdbcTemplate.queryForBeanList("select * from (select in_id from Inquiry left join employee on in_recorderid = em_id where in_statuscode='AUDITED' and IN_SENDSTATUS='已上传' and in_b2bid is null and nvl(in_class,' ')<>'主动报价' and exists (select 1 from InquiryDetail left join vendor on id_vendcode=ve_code where id_inid=in_id and ve_uu is not null and nvl(ve_b2benable,0)=1) order by in_date desc) where rownum <= 100",
+        List<Inquiry> inquiryList = jdbcTemplate.queryForBeanList("select * from (select in_id from Inquiry left join employee on in_recorderid = em_id where in_statuscode='AUDITED' and IN_SENDSTATUS='已上传' and in_b2bid is null and nvl(in_class,' ')<>'主动报价' and exists (select 1 from InquiryDetail left join vendor on id_vendcode=ve_code where id_inid=in_id and ve_uu is not null and nvl(ve_b2benable,0)=1) order by in_date desc) where rowNum <= 100",
                 Inquiry.class);
-        if (!CollectionUtils.isEmpty(inquiries)) {
-            ContextHolder.setDataSize(inquiries.size());
-            List<Inquiry> inquiryList = postForList("/erp/buyer/inquiry", Inquiry.class, dataWrap(inquiries));
+        if (!CollectionUtils.isEmpty(inquiryList)) {
+            ContextHolder.setDataSize(inquiryList.size());
+            inquiryList = postForList("/erp/buyer/inquiry", Inquiry.class, dataWrap(inquiryList));
             if (!CollectionUtils.isEmpty(inquiryList)) {
                 List<String> sqls = new ArrayList<>();
                for (Inquiry inquiry : inquiryList) {
@@ -43,7 +43,7 @@ public class CheckTransTask extends AbstractTask {
 
     @TaskMapping(title = "采购订单", fixedDelay = 60000)
     public void uploadPurchase() {
-        List<Purchase> purchaseList = jdbcTemplate.queryForBeanList("select * from (select pu_id from purchase left join vendor on pu_vendcode=ve_code left join employee on pu_buyerid=em_id where PU_SENDSTATUS='已上传' and pu_statuscode='AUDITED' and nvl(pu_ordertype,' ')<>'B2C' and ve_uu is not null and nvl(ve_b2benable,0)=1 and not exists (select 1 from purchasedetail,product where pd_puid=pu_id and pr_code=pd_prodcode and pr_sendstatus<>'已上传' and pu_b2bid is null) order by pu_code) where rownum <= 100",
+        List<Purchase> purchaseList = jdbcTemplate.queryForBeanList("select * from (select pu_id from purchase left join vendor on pu_vendcode=ve_code left join employee on pu_buyerid=em_id where PU_SENDSTATUS='已上传' and pu_statuscode='AUDITED' and nvl(pu_ordertype,' ')<>'B2C' and ve_uu is not null and nvl(ve_b2benable,0)=1 and not exists (select 1 from purchasedetail,product where pd_puid=pu_id and pr_code=pd_prodcode and pr_sendstatus<>'已上传' and pu_b2bid is null) order by pu_code) where rowNum <= 100",
                 Purchase.class);
         if (!CollectionUtils.isEmpty(purchaseList)) {
             ContextHolder.setDataSize(purchaseList.size());
@@ -64,4 +64,26 @@ public class CheckTransTask extends AbstractTask {
         }
     }
 
+    @TaskMapping(title = "发货提醒", fixedDelay = 60000)
+    public void uploadPurchaseNotify() {
+        List<PurchaseNotify> notifyList = jdbcTemplate.queryForBeanList("select * from (select pu_id from purchaseNotify left join purchase on pn_orderCode=pu_code left join vendor on pu_vendCode=ve_code left join product on pr_code=pn_prodCode where nvl(PN_SENDSTATUS,' ')='已上传' and pn_b2bid is null and pn_status<>'已取消' and pu_sendStatus='已上传' and nvl(pu_orderType,' ')<>'B2C' and ve_uu is not null and nvl(ve_b2bEnable, 0)=1 order by pn_inDate) where rowNum <= 100",
+                PurchaseNotify.class);
+        if (!CollectionUtils.isEmpty(notifyList)) {
+            ContextHolder.setDataSize(notifyList.size());
+            notifyList = postForList("/erp/buyer/notify", PurchaseNotify.class, dataWrap(notifyList));
+            if (!CollectionUtils.isEmpty(notifyList)) {
+                List<String> sqls = new ArrayList<>();
+                for (PurchaseNotify notify : notifyList) {
+                    if (null != notify.getPn_b2bid()) {
+                        sqls.add("update purchaseNotify set pn_b2bid = " + notify.getPn_b2bid() + " where pn_id = " + notify.getPn_id());
+                    } else {
+                        sqls.add("update purchaseNotify set pn_sendStatus = '待上传' where pn_id = " + notify.getPn_id());
+                    }
+                }
+                if (!CollectionUtils.isEmpty(sqls)) {
+                    jdbcTemplate.batchExecute(sqls);
+                }
+            }
+        }
+    }
 }