Просмотр исходного кода

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	src/main/java/com/uas/erp/schedular/b2b/domain/PurchaseDetail.java
#	src/main/java/com/uas/erp/schedular/b2b/domain/PurchaseNotify.java
#	src/main/java/com/uas/erp/schedular/b2b/domain/SaleDownDetail.java
hejq 7 лет назад
Родитель
Сommit
46540326ee
35 измененных файлов с 850 добавлено и 76 удалено
  1. 18 0
      src/main/java/com/uas/erp/schedular/b2b/domain/PurchaseChange.java
  2. 92 0
      src/main/java/com/uas/erp/schedular/b2b/domain/PurchaseDetail.java
  3. 10 0
      src/main/java/com/uas/erp/schedular/b2b/domain/PurchaseNotify.java
  4. 42 4
      src/main/java/com/uas/erp/schedular/b2b/domain/SaleDownDetail.java
  5. 3 3
      src/main/java/com/uas/erp/schedular/b2b/task/CheckTransTask.java
  6. 3 3
      src/main/java/com/uas/erp/schedular/b2b/task/InquiryMouldTask.java
  7. 7 7
      src/main/java/com/uas/erp/schedular/b2b/task/InquiryTask.java
  8. 2 2
      src/main/java/com/uas/erp/schedular/b2b/task/MakeProdInOutTask.java
  9. 5 3
      src/main/java/com/uas/erp/schedular/b2b/task/MakeTask.java
  10. 2 2
      src/main/java/com/uas/erp/schedular/b2b/task/PurchaseAPBillTask.java
  11. 1 1
      src/main/java/com/uas/erp/schedular/b2b/task/PurchaseChangeTask.java
  12. 1 1
      src/main/java/com/uas/erp/schedular/b2b/task/PurchaseForecastTask.java
  13. 1 1
      src/main/java/com/uas/erp/schedular/b2b/task/PurchaseMRBTask.java
  14. 4 4
      src/main/java/com/uas/erp/schedular/b2b/task/PurchaseNotifyTask.java
  15. 5 4
      src/main/java/com/uas/erp/schedular/b2b/task/PurchaseProdInOutTask.java
  16. 4 4
      src/main/java/com/uas/erp/schedular/b2b/task/PurchaseSampleTask.java
  17. 6 6
      src/main/java/com/uas/erp/schedular/b2b/task/PurchaseTask.java
  18. 2 2
      src/main/java/com/uas/erp/schedular/b2b/task/SaleAPCheckTask.java
  19. 1 1
      src/main/java/com/uas/erp/schedular/b2b/task/SaleDownTask.java
  20. 1 1
      src/main/java/com/uas/erp/schedular/b2b/task/VendorPerformanceAssessTask.java
  21. 31 9
      src/main/java/com/uas/erp/schedular/entity/MasterTaskConfigEntity.java
  22. 16 0
      src/main/java/com/uas/erp/schedular/entity/Setting.java
  23. 6 0
      src/main/java/com/uas/erp/schedular/init/DefaultInitializer.java
  24. 36 0
      src/main/java/com/uas/erp/schedular/init/ReplyInitializer.java
  25. 90 0
      src/main/java/com/uas/erp/schedular/listen/DiskUtil.java
  26. 46 0
      src/main/java/com/uas/erp/schedular/listen/ListenDomain.java
  27. 173 0
      src/main/java/com/uas/erp/schedular/listen/ListenTask.java
  28. 13 9
      src/main/java/com/uas/erp/schedular/publicinquiry/task/EnterInquiryTask.java
  29. 1 1
      src/main/java/com/uas/erp/schedular/publicinquiry/task/PubInquiryTask.java
  30. 1 1
      src/main/java/com/uas/erp/schedular/publicproduct/task/AbstractTask.java
  31. 2 0
      src/main/java/com/uas/erp/schedular/repository/MasterTaskConfigRepository.java
  32. 4 0
      src/main/java/com/uas/erp/schedular/util/ContextHolder.java
  33. 1 1
      src/main/resources/database/template/inquiryEnRemind.xml
  34. 7 6
      src/main/resources/init/setting.json
  35. 213 0
      src/test/java/com/uas/erp/test/PurchaseChangeTest.java

+ 18 - 0
src/main/java/com/uas/erp/schedular/b2b/domain/PurchaseChange.java

@@ -20,6 +20,8 @@ public class PurchaseChange extends KeyEntity{
 	private Float pc_newrate;
 	private String pc_apvendname;
 	private String pc_newapvendname;
+	private String pc_apvendcode;
+	private String pc_newapvendcode;
 	private String pc_description;
 	private String pc_remark;
 	private Short pc_agreed;
@@ -171,6 +173,22 @@ public class PurchaseChange extends KeyEntity{
 		this.pc_newapvendname = pc_newapvendname;
 	}
 
+	public String getPc_apvendcode() {
+		return pc_apvendcode;
+	}
+
+	public void setPc_apvendcode(String pc_apvendcode) {
+		this.pc_apvendcode = pc_apvendcode;
+	}
+
+	public String getPc_newapvendcode() {
+		return pc_newapvendcode;
+	}
+
+	public void setPc_newapvendcode(String pc_newapvendcode) {
+		this.pc_newapvendcode = pc_newapvendcode;
+	}
+
 	@Override
 	public Object getKey() {
 		return pc_id;

+ 92 - 0
src/main/java/com/uas/erp/schedular/b2b/domain/PurchaseDetail.java

@@ -45,8 +45,100 @@ public class PurchaseDetail {
 	private Float pd_purctaxrate;
 	//终端币别
 	private String pd_purccurrency;
+	//税收分类编码
+    private String pd_taxcode;
+    //开票名称
+    private String pd_billname;
+    //开票型号
+    private String pd_orispeccode;
 	private List<Attach> attaches;
 
+	//替代料号
+	private String pd_repprodcode;
+	//替代料名称
+	private String pd_repdetail;
+	//替代料规格
+	private String pd_repspec;
+
+	//旧料编号
+	private String pr_oldcode;
+	//旧料名称
+	private String pr_oldname;
+	//旧料规格
+	private String pr_oldspec;
+
+	public String getPr_oldcode() {
+		return pr_oldcode;
+	}
+
+	public void setPr_oldcode(String pr_oldcode) {
+		this.pr_oldcode = pr_oldcode;
+	}
+
+	public String getPr_oldname() {
+		return pr_oldname;
+	}
+
+	public void setPr_oldname(String pr_oldname) {
+		this.pr_oldname = pr_oldname;
+	}
+
+	public String getPr_oldspec() {
+		return pr_oldspec;
+	}
+
+	public void setPr_oldspec(String pr_oldspec) {
+		this.pr_oldspec = pr_oldspec;
+	}
+
+	public String getPd_repprodcode() {
+		return pd_repprodcode;
+	}
+
+	public void setPd_repprodcode(String pd_repprodcode) {
+		this.pd_repprodcode = pd_repprodcode;
+	}
+
+	public String getPd_repdetail() {
+		return pd_repdetail;
+	}
+
+	public void setPd_repdetail(String pd_repdetail) {
+		this.pd_repdetail = pd_repdetail;
+	}
+
+	public String getPd_repspec() {
+		return pd_repspec;
+	}
+
+	public void setPd_repspec(String pd_repspec) {
+		this.pd_repspec = pd_repspec;
+	}
+
+	public String getPd_taxcode() {
+		return pd_taxcode;
+	}
+
+	public void setPd_taxcode(String pd_taxcode) {
+		this.pd_taxcode = pd_taxcode;
+	}
+
+	public String getPd_billname() {
+		return pd_billname;
+	}
+
+	public void setPd_billname(String pd_billname) {
+		this.pd_billname = pd_billname;
+	}
+
+	public String getPd_orispeccode() {
+		return pd_orispeccode;
+	}
+
+	public void setPd_orispeccode(String pd_orispeccode) {
+		this.pd_orispeccode = pd_orispeccode;
+	}
+
 	public Float getPd_purcprice() {
 		return pd_purcprice;
 	}

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

@@ -26,6 +26,16 @@ public class PurchaseNotify extends KeyEntity{
 	//终端供应商,为0表示正常送货提醒
 	private Long pn_terminalvenduu;
 
+	private Long pn_custb2bid;
+
+	public Long getPn_custb2bid() {
+		return pn_custb2bid;
+	}
+
+	public void setPn_custb2bid(Long pn_custb2bid) {
+		this.pn_custb2bid = pn_custb2bid;
+	}
+
 	public int getPn_id() {
 		return pn_id;
 	}

+ 42 - 4
src/main/java/com/uas/erp/schedular/b2b/domain/SaleDownDetail.java

@@ -44,8 +44,38 @@ public class SaleDownDetail {
 	private Float sd_SpecTaxRate;
 	//终端币别
 	private String sd_SpecCurrency;
-
-	public Float getSd_SpecPrice() {
+	//客户物料税收分类编码
+    private String sd_prodtaxcode;
+    //客户物料开票名称
+    private String sd_prodbillname;
+    //客户物料开票型号
+    private String sd_prodorispeccode;
+
+    public String getSd_prodtaxcode() {
+        return sd_prodtaxcode;
+    }
+
+    public void setSd_prodtaxcode(String sd_prodtaxcode) {
+        this.sd_prodtaxcode = sd_prodtaxcode;
+    }
+
+    public String getSd_prodbillname() {
+        return sd_prodbillname;
+    }
+
+    public void setSd_prodbillname(String sd_prodbillname) {
+        this.sd_prodbillname = sd_prodbillname;
+    }
+
+    public String getSd_prodorispeccode() {
+        return sd_prodorispeccode;
+    }
+
+    public void setSd_prodorispeccode(String sd_prodorispeccode) {
+        this.sd_prodorispeccode = sd_prodorispeccode;
+    }
+
+    public Float getSd_SpecPrice() {
 		return sd_SpecPrice;
 	}
 
@@ -264,7 +294,8 @@ public class SaleDownDetail {
 	public String toSqlString(int foreignKey) {
 		return "insert into SaleDownDetail(b2b_pd_id,sd_id,sd_said,sd_code,sd_detno,sd_custprodcode,sd_custproddetail,sd_prodname,sd_custprodspec,sd_prodspec,"
 				+ "sd_custprodunit,sd_replyqty,sd_replydate,sd_replydetail,sd_price,sd_qty,sd_total,sd_taxrate,sd_SpecPrice,sd_SpecTaxRate,sd_SpecCurrency,"
-				+ "sd_taxtotal,sd_delivery,sd_remark,sd_purcvendname,sd_purcvenduu,sd_purcdetno,sd_acceptcustname,sd_acceptcustaddress,sd_purcvendcode) VALUES ("
+				+ "sd_taxtotal,sd_delivery,sd_remark,sd_purcvendname,sd_purcvenduu,sd_purcdetno,sd_acceptcustname,sd_acceptcustaddress,sd_purcvendcode,sd_prodtaxcode,"
+                + "sd_prodbillname,sd_prodorispeccode) VALUES ("
 				+ b2b_pd_id
 				+ ",SaleDownDetail_SEQ.nextval,"
 				+ foreignKey
@@ -320,7 +351,14 @@ public class SaleDownDetail {
 				+StringUtil.nvl(sd_acceptcustname, "")
 				+ "','"
 				+StringUtil.nvl(sd_acceptcustaddress, "")
-				+"',(select ve_code from vendor where ve_uu="+sd_purcvenduu+" and rownum=1))";
+				+"',(select ve_code from vendor where ve_uu="+sd_purcvenduu+" and rownum=1)"
+                +",'"
+                + StringUtil.nvl(sd_prodtaxcode, "")
+                + "','"
+                + StringUtil.nvl(sd_prodbillname, "")
+                + "','"
+                + StringUtil.nvl(sd_prodorispeccode, "")
+                + "')";
 	}
 
 }

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

@@ -20,7 +20,7 @@ public class CheckTransTask extends AbstractTask {
 
     @TaskMapping(title = "采购询价单", fixedDelay = 60000)
     public void uploadInquiry() {
-        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",
+        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 coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1) order by in_date desc) where rowNum <= 100",
                 Inquiry.class);
         if (!CollectionUtils.isEmpty(inquiryList)) {
             ContextHolder.setDataSize(inquiryList.size());
@@ -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 coalesce(ve_uu, '0') <> '0' 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());
@@ -66,7 +66,7 @@ public class CheckTransTask extends AbstractTask {
 
     @TaskMapping(title = "发货提醒", fixedDelay = 60000)
     public void uploadPurchaseNotify() {
-        List<PurchaseNotify> notifyList = jdbcTemplate.queryForBeanList("select * from (select pn_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",
+        List<PurchaseNotify> notifyList = jdbcTemplate.queryForBeanList("select * from (select pn_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 coalesce(ve_uu, '0') <> '0' and nvl(ve_b2bEnable, 0)=1 order by pn_inDate) where rowNum <= 100",
                 PurchaseNotify.class);
         if (!CollectionUtils.isEmpty(notifyList)) {
             ContextHolder.setDataSize(notifyList.size());

+ 3 - 3
src/main/java/com/uas/erp/schedular/b2b/task/InquiryMouldTask.java

@@ -35,7 +35,7 @@ public class InquiryMouldTask extends AbstractTask {
      * @return
      */
     public List<InquiryMould> getInquiryMouldUpload() {
-        List<InquiryMould> inquiryMoulds = jdbcTemplate.queryForBeanList("select InquiryMould.*,ve_uu in_veuu,em_uu in_recorderuu from InquiryMould left join employee on in_recorderid = em_id left join vendor on ve_code=in_vendcode where (in_statuscode='AUDITED' and (IN_SENDSTATUS='待上传' or IN_SENDSTATUS='上传中')) and nvl(in_sourcetype,' ')='模具报价单' and exists (select 1 from InquiryMould left join vendor on in_vendcode=ve_code and ve_uu is not null and nvl(ve_b2benable,0)=1) order by in_code",
+        List<InquiryMould> inquiryMoulds = jdbcTemplate.queryForBeanList("select InquiryMould.*,ve_uu in_veuu,em_uu in_recorderuu from InquiryMould left join employee on in_recorderid = em_id left join vendor on ve_code=in_vendcode where (in_statuscode='AUDITED' and (IN_SENDSTATUS='待上传' or IN_SENDSTATUS='上传中')) and nvl(in_sourcetype,' ')='模具报价单' and exists (select 1 from InquiryMould left join vendor on in_vendcode=ve_code and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1) order by in_code",
                 InquiryMould.class);
         for (InquiryMould inquiryMould : inquiryMoulds) {
             List<InquiryMouldDet> dets = jdbcTemplate.queryForBeanList(
@@ -237,7 +237,7 @@ public class InquiryMouldTask extends AbstractTask {
 
     @TaskMapping(title = "上传买家对报价信息是否采纳的决策到平台", fixedDelay = 60000)
     public void uploadInquiryMouldDecide() {
-        List<InquiryMouldDecide> decides = jdbcTemplate.queryForBeanList("select in_id,in_code,in_adoptstatus,b2b_im_id,in_checksendstatus from InquiryMould left join vendor on in_vendcode=ve_code where IN_SENDSTATUS='已上传' and nvl(in_sourcetype,' ')='模具报价单' and IN_CHECKSENDSTATUS='待上传' and (in_adoptstatus is not null and nvl (in_adoptstatus,'')<>'待审核') and ve_uu is not null and nvl(ve_b2benable,0)=1 order by in_code,in_id",
+        List<InquiryMouldDecide> decides = jdbcTemplate.queryForBeanList("select in_id,in_code,in_adoptstatus,b2b_im_id,in_checksendstatus from InquiryMould left join vendor on in_vendcode=ve_code where IN_SENDSTATUS='已上传' and nvl(in_sourcetype,' ')='模具报价单' and IN_CHECKSENDSTATUS='待上传' and (in_adoptstatus is not null and nvl (in_adoptstatus,'')<>'待审核') and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 order by in_code,in_id",
                 InquiryMouldDecide.class);
         if (!CollectionUtils.isEmpty(decides)) {
             ContextHolder.setDataSize(decides.size());
@@ -250,7 +250,7 @@ public class InquiryMouldTask extends AbstractTask {
 
     @TaskMapping(title = "上传作废模具询价单信息传到平台", fixedDelay = 60000)
     public void invalidateInquiryMould() {
-        List<InquiryMould> moulds = jdbcTemplate.queryForBeanList("select InquiryMould.* from InquiryMould left join vendor on in_vendcode=ve_code where IN_SENDSTATUS='已上传' and nvl(in_sourcetype,' ')='模具报价单' and nvl(in_checksendstatus,' ')<>'作废已上传' and in_status = '已作废' and ve_uu is not null order by in_code,in_id",
+        List<InquiryMould> moulds = jdbcTemplate.queryForBeanList("select InquiryMould.* from InquiryMould left join vendor on in_vendcode=ve_code where IN_SENDSTATUS='已上传' and nvl(in_sourcetype,' ')='模具报价单' and nvl(in_checksendstatus,' ')<>'作废已上传' and in_status = '已作废' and coalesce(ve_uu, '0') <> '0' order by in_code,in_id",
                 InquiryMould.class);
         if (!CollectionUtils.isEmpty(moulds)) {
             ContextHolder.setDataSize(moulds.size());

+ 7 - 7
src/main/java/com/uas/erp/schedular/b2b/task/InquiryTask.java

@@ -66,7 +66,7 @@ public class InquiryTask extends AbstractTask {
     private Integer uploadProduct() {
         return jdbcTemplate.count("select count(1) from product where exists (select 1 from inquirydetail left join vendor on id_vendcode=ve_code " +
                         "left join inquiry on in_id=id_inid where (IN_SENDSTATUS='待上传' or IN_SENDSTATUS='上传中') and nvl(in_class,' ')<>'主动报价' " +
-                        "and ve_uu is not null and nvl(ve_b2benable,0)=1 and id_prodcode=pr_code) and nvl(pr_sendstatus,' ')<>'已上传'");
+                        "and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 and id_prodcode=pr_code) and nvl(pr_sendstatus,' ')<>'已上传'");
     }
 
     /**
@@ -75,11 +75,11 @@ public class InquiryTask extends AbstractTask {
      * @return
      */
     private List<Inquiry> getInquiryUpload() {
-        List<Inquiry> inquiries = jdbcTemplate.queryForBeanList("select Inquiry.*,em_uu in_recorderuu from Inquiry left join employee on in_recorderid = em_id where in_statuscode='AUDITED' and (IN_SENDSTATUS='待上传' or IN_SENDSTATUS='上传中') 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) and  rowNum <= 200 order by in_code  ",
+        List<Inquiry> inquiries = jdbcTemplate.queryForBeanList("select Inquiry.*,em_uu in_recorderuu from Inquiry left join employee on in_recorderid = em_id where in_statuscode='AUDITED' and (IN_SENDSTATUS='待上传' or IN_SENDSTATUS='上传中') and nvl(in_class,' ')<>'主动报价' and exists (select 1 from InquiryDetail left join vendor on id_vendcode=ve_code where id_inid=in_id and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1) and  rowNum <= 200 order by in_code  ",
                 Inquiry.class);
         for (Inquiry inquiry : inquiries) {
             // 获取询价单明细
-            List<InquiryDetail> details = jdbcTemplate.queryForBeanList("select InquiryDetail.*,ve_uu,nvl(id_vendcontact,ve_contact) ve_contact,nvl(id_vendcontactuu,ve_contactuu) ve_contactuu,em_uu ve_buyeruu from InquiryDetail left join vendor on id_vendcode=ve_code left join employee on ve_buyercode=em_code where id_inid=? and ve_uu is not null and nvl(ve_b2benable,0)=1",
+            List<InquiryDetail> details = jdbcTemplate.queryForBeanList("select InquiryDetail.*,ve_uu,nvl(id_vendcontact,ve_contact) ve_contact,nvl(id_vendcontactuu,ve_contactuu) ve_contactuu,em_uu ve_buyeruu from InquiryDetail left join vendor on id_vendcode=ve_code left join employee on ve_buyercode=em_code where id_inid=? and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1",
                     InquiryDetail.class, inquiry.getIn_id());
             for (InquiryDetail detail : details) {
                 // 获取询价单明细的价格分段
@@ -201,7 +201,7 @@ public class InquiryTask extends AbstractTask {
 
     @TaskMapping(title = "上传买家对报价信息是否采纳的决策到平台", fixedDelay = 60000)
     public void uploadInquiryDecide() {
-        List<InquiryDecide> replies = jdbcTemplate.queryForBeanList("select id_id,in_code,id_detno,id_isagreed id_agreed from InquiryDetail left join Inquiry on id_inid=in_id left join vendor on id_vendcode=ve_code where IN_SENDSTATUS='已上传' and nvl(in_class,' ')<>'主动报价' and ID_SENDSTATUS='待上传' and id_isagreed is not null and ve_uu is not null and nvl(ve_b2benable,0)=1 and rownum < 100 order by in_code,id_detno",
+        List<InquiryDecide> replies = jdbcTemplate.queryForBeanList("select id_id,in_code,id_detno,id_isagreed id_agreed from InquiryDetail left join Inquiry on id_inid=in_id left join vendor on id_vendcode=ve_code where IN_SENDSTATUS='已上传' and nvl(in_class,' ')<>'主动报价' and ID_SENDSTATUS='待上传' and id_isagreed is not null and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 and rownum < 100 order by in_code,id_detno",
                 InquiryDecide.class);
         if (!CollectionUtils.isEmpty(replies)) {
             ContextHolder.setDataSize(replies.size());
@@ -213,7 +213,7 @@ public class InquiryTask extends AbstractTask {
 
     @TaskMapping(title = "上传买家对报价信息作废的决策到平台", fixedDelay = 60000)
     public void uploadInquiryInvalid() {
-        List<Inquiry> inquiries = jdbcTemplate.queryForBeanList("select * from Inquiry left join InquiryDetail on id_inid=in_id left join vendor on id_vendcode=ve_code where in_status = '已作废' and in_sendstatus <> '作废已上传' and nvl(in_class,' ')<>'主动报价'  and ve_uu is not null and nvl(ve_b2benable,0)=1 and rownum <= 100 order by in_code",
+        List<Inquiry> inquiries = jdbcTemplate.queryForBeanList("select * from Inquiry left join InquiryDetail on id_inid=in_id left join vendor on id_vendcode=ve_code where in_status = '已作废' and in_sendstatus <> '作废已上传' and nvl(in_class,' ')<>'主动报价'  and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 and rownum <= 100 order by in_code",
                 Inquiry.class);
         if (!CollectionUtils.isEmpty(inquiries)) {
             ContextHolder.setDataSize(inquiries.size());
@@ -297,7 +297,7 @@ public class InquiryTask extends AbstractTask {
 
     @TaskMapping(title = "上传买家对主动报价询价单的报价信息作废的决策到平台", fixedDelay = 60000)
     public void uploadQuotationInvalid() {
-        List<Inquiry> inquiries = jdbcTemplate.queryForBeanList("select * from Inquiry left join InquiryDetail on id_inid=in_id left join vendor on id_vendcode=ve_code where in_status = '已作废' and in_sendstatus <> '作废已上传' and nvl(in_class,' ')='主动报价'  and ve_uu is not null and nvl(ve_b2benable,0)=1 and rownum <= 100 order by in_code",
+        List<Inquiry> inquiries = jdbcTemplate.queryForBeanList("select * from Inquiry left join InquiryDetail on id_inid=in_id left join vendor on id_vendcode=ve_code where in_status = '已作废' and in_sendstatus <> '作废已上传' and nvl(in_class,' ')='主动报价'  and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 and rownum <= 100 order by in_code",
                 Inquiry.class);
         if (!CollectionUtils.isEmpty(inquiries)) {
             ContextHolder.setDataSize(inquiries.size());
@@ -309,7 +309,7 @@ public class InquiryTask extends AbstractTask {
 
     @TaskMapping(title = "上传买家对主动报价信息是否采纳的决策到平台", fixedDelay = 60000)
     public void uploadQuotationDecide() {
-        List<InquiryDecide> decides = jdbcTemplate.queryForBeanList("select id_id,id_detno,b2b_qu_id,id_isagreed id_agreed from InquiryDetail left join Inquiry on id_inid=in_id left join vendor on id_vendcode=ve_code where IN_SENDSTATUS='已上传' and in_class='主动报价' and ID_SENDSTATUS='待上传' and id_isagreed is not null and ve_uu is not null and nvl(ve_b2benable,0)=1 and b2b_qu_id is not null order by in_code,id_detno",
+        List<InquiryDecide> decides = jdbcTemplate.queryForBeanList("select id_id,id_detno,b2b_qu_id,id_isagreed id_agreed from InquiryDetail left join Inquiry on id_inid=in_id left join vendor on id_vendcode=ve_code where IN_SENDSTATUS='已上传' and in_class='主动报价' and ID_SENDSTATUS='待上传' and id_isagreed is not null and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 and b2b_qu_id is not null order by in_code,id_detno",
                 InquiryDecide.class);
         if (!CollectionUtils.isEmpty(decides)) {
             ContextHolder.setDataSize(decides.size());

+ 2 - 2
src/main/java/com/uas/erp/schedular/b2b/task/MakeProdInOutTask.java

@@ -40,7 +40,7 @@ public class MakeProdInOutTask extends AbstractTask {
                 "select * from (select prodinout.*, ve_uu pi_vendoruu from "
                         + " prodinout left join vendor on prodinout.pi_cardcode = vendor.ve_code where"
                         + " pi_class='委外验收单' and pi_status = '已过账' and (pi_sendstatus = '待上传' or pi_sendstatus='上传中')"
-                        + "and ve_uu is not null and nvl(ve_b2benable,0)=1 ) where rownum<=200", MakeProdInOut.class);
+                        + "and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 ) where rownum<=200", MakeProdInOut.class);
         for (MakeProdInOut prodInOut : prodInOuts) {
             List<MakeProdInOutDetail> details = jdbcTemplate.queryForBeanList(
                     "select prodiodetail.* , pd_pdno pd_detno from prodiodetail where pd_piid = ? ",
@@ -81,7 +81,7 @@ public class MakeProdInOutTask extends AbstractTask {
     public List<MakeProdInOut> getProdReturnUpload() {
         List<MakeProdInOut> prodInOuts = jdbcTemplate.queryForBeanList("select * from (select prodinout.*, ve_uu pi_vendoruu from"
                         + " prodinout left join vendor on prodinout.pi_cardcode = vendor.ve_code where"
-                        + " pi_class='委外验退单' and pi_status = '已过账' and (pi_sendstatus = '待上传' or pi_sendstatus='上传中') and ve_uu is not null and nvl(ve_b2benable,0)=1) where rownum <= 200 ",
+                        + " pi_class='委外验退单' and pi_status = '已过账' and (pi_sendstatus = '待上传' or pi_sendstatus='上传中') and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1) where rownum <= 200 ",
                 MakeProdInOut.class);
         for (MakeProdInOut prodInOut : prodInOuts) {
             List<MakeProdInOutDetail> details = jdbcTemplate.queryForBeanList(

+ 5 - 3
src/main/java/com/uas/erp/schedular/b2b/task/MakeTask.java

@@ -19,7 +19,9 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- * Created by Pro1 on 2017/8/2.
+ *
+ * @author Pro1
+ * @date 2017/8/2
  */
 @Component
 @TaskMapping(title = "委外工单", role = Role.BUYER)
@@ -29,7 +31,7 @@ public class MakeTask extends AbstractTask {
     public void uploadMake() {
         Integer size = uploadProduct();
         if (size == 0) {
-            List<Make> makes = jdbcTemplate.queryForBeanList("select * from (select make.*, ve_uu from make left join vendor on ma_vendcode=ve_code where nvl(ve_b2benable,0)=1 and ve_uu is not null and nvl(ma_tasktype, '')='OS' and ma_checkstatuscode='APPROVE' and (ma_sendstatus='待上传' or ma_sendstatus='上传中')) where rownum <= 100",
+            List<Make> makes = jdbcTemplate.queryForBeanList("select * from (select make.*, ve_uu from make left join vendor on ma_vendcode=ve_code where nvl(ve_b2benable,0)=1 and coalesce(ve_uu, '0') <> '0' and nvl(ma_tasktype, '')='OS' and ma_checkstatuscode='APPROVE' and (ma_sendstatus='待上传' or ma_sendstatus='上传中')) where rownum <= 100",
                     Make.class);
             if (!CollectionUtils.isEmpty(makes)) {
                 ContextHolder.setDataSize(makes.size());
@@ -43,7 +45,7 @@ public class MakeTask extends AbstractTask {
      * 上传物料资料
      */
     private Integer uploadProduct() {
-        final List<Prod> prods = jdbcTemplate.queryForBeanList("select * from (select pr_id,pr_code,pr_detail,pr_spec,pr_unit,pr_zxbzs,pr_zxdhl,pr_leadtime,pr_ltinstock,pr_brand from product where exists (select 1 from make left join vendor on ve_code = ma_vendcode where ma_tasktype='OS'  and ve_uu is not null and nvl(ve_b2benable,0)=1 and make.ma_prodcode = product.pr_code) and nvl(pr_sendstatus,' ')<>'已上传' order by pr_id) where rownum <= 500",
+        final List<Prod> prods = jdbcTemplate.queryForBeanList("select * from (select pr_id,pr_code,pr_detail,pr_spec,pr_unit,pr_zxbzs,pr_zxdhl,pr_leadtime,pr_ltinstock,pr_brand from product where exists (select 1 from make left join vendor on ve_code = ma_vendcode where ma_tasktype='OS'  and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 and make.ma_prodcode = product.pr_code) and nvl(pr_sendstatus,' ')<>'已上传' order by pr_id) where rownum <= 500",
                 Prod.class);
         if (!CollectionUtils.isEmpty(prods)) {
             return prods.size();

+ 2 - 2
src/main/java/com/uas/erp/schedular/b2b/task/PurchaseAPBillTask.java

@@ -47,7 +47,7 @@ public class PurchaseAPBillTask extends AbstractTask {
         List<PurchaseAPBill> purchaseAPBills = jdbcTemplate.queryForBeanList(
                 "select * from (select apbill.*, ve_uu ab_vendoruu from apbill"
                         + " left join vendor on apbill.ab_vendcode = vendor.ve_code where ab_class = '应付发票' and ab_status = '已过账'"
-                        + " and ab_sendstatus = '待上传' and ve_uu is not null and nvl(ab_kind,' ')<>'货款调账' and nvl(ve_b2benable,0)=1 ) where rownum <= 50",
+                        + " and ab_sendstatus = '待上传' and coalesce(ve_uu, '0') <> '0' and nvl(ab_kind,' ')<>'货款调账' and nvl(ve_b2benable,0)=1 ) where rownum <= 10",
                 PurchaseAPBill.class);
         for (PurchaseAPBill purchaseAPBill : purchaseAPBills) {
             List<PurchaseAPBillDetail> apBillDetails = jdbcTemplate.queryForBeanList(
@@ -89,7 +89,7 @@ public class PurchaseAPBillTask extends AbstractTask {
      */
     private List<PurchaseAPBill> getApbillAdjustmentUpload() {
         List<PurchaseAPBill> purchaseAPBills = jdbcTemplate.queryForBeanList("select * from (select apbill.*, ve_uu ab_vendoruu from apbill left join vendor on apbill.ab_vendcode = vendor.ve_code where vendor.ve_b2bcheck = -1 and ab_class = '其它应付单' and ab_status = '已过账'"
-                                + " and ab_sendstatus = '待上传' and ve_uu is not null  and nvl(ab_kind,' ')='货款调账' and nvl(ve_b2benable,0)=1 ) where rownum <= 200",
+                                + " and ab_sendstatus = '待上传' and coalesce(ve_uu, '0') <> '0'  and nvl(ab_kind,' ')='货款调账' and nvl(ve_b2benable,0)=1 ) where rownum <= 200",
                 PurchaseAPBill.class);
         for (PurchaseAPBill purchaseAPBill : purchaseAPBills) {
             List<PurchaseAPBillDetail> apBillDetails = jdbcTemplate.queryForBeanList(

+ 1 - 1
src/main/java/com/uas/erp/schedular/b2b/task/PurchaseChangeTask.java

@@ -42,7 +42,7 @@ public class PurchaseChangeTask extends AbstractTask {
      * @return
      */
     private List<PurchaseChange> getPurchaseChangeUpload() {
-        List<PurchaseChange> purchaseChanges = jdbcTemplate.queryForBeanList("select purchasechange.* from purchasechange left join Purchase on pc_purccode=pu_code left join vendor on ve_code=pu_vendcode where PC_SENDSTATUS='待上传' and pu_sendstatus='已上传' and nvl(pu_ordertype,' ')<>'B2C' and nvl(pc_agreed,1)<>0 and pc_statuscode in ('AUDITED','TO_CONFIRM') and ve_uu is not null and nvl(ve_b2benable,0)=1 order by pc_code",
+        List<PurchaseChange> purchaseChanges = jdbcTemplate.queryForBeanList("select purchasechange.* from purchasechange left join Purchase on pc_purccode=pu_code left join vendor on ve_code=pu_vendcode where PC_SENDSTATUS='待上传' and pu_sendstatus='已上传' and nvl(pu_ordertype,' ')<>'B2C' and nvl(pc_agreed,1)<>0 and pc_statuscode in ('AUDITED','TO_CONFIRM') and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 order by pc_code",
                 PurchaseChange.class);
         for (PurchaseChange purchaseChange : purchaseChanges) {
             List<PurchaseChangeDetail> changeDetails = jdbcTemplate.queryForBeanList(

+ 1 - 1
src/main/java/com/uas/erp/schedular/b2b/task/PurchaseForecastTask.java

@@ -40,7 +40,7 @@ public class PurchaseForecastTask extends AbstractTask {
                         + "on pf_buyerid=em_id where Pf_SENDSTATUS='待上传' order by pf_code", PurchaseForecast.class);
         for (PurchaseForecast purchaseForecast : purchaseForecasts) {
             List<PurchaseForecastDetail> purchaseForecastDetails = jdbcTemplate.queryForBeanList("select purchaseforecastdetail.*, ve_uu, ve_contact, ve_contactuu from purchaseforecastDetail "
-                                    + "left join vendor on pfd_vendcode=ve_code where pfd_pfid=? and ve_uu is not null and nvl(ve_b2benable,0)=1 ",
+                                    + "left join vendor on pfd_vendcode=ve_code where pfd_pfid=? and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 ",
                     PurchaseForecastDetail.class, purchaseForecast.getPf_id());
             // 存在有效的明细的单上传,明细都无效的不上传
             if (purchaseForecastDetails.size() > 0) {

+ 1 - 1
src/main/java/com/uas/erp/schedular/b2b/task/PurchaseMRBTask.java

@@ -45,7 +45,7 @@ public class PurchaseMRBTask extends AbstractTask {
         List<PurchaseQuaMRB> purchaseMRBs = jdbcTemplate.queryForBeanList(
                 "select qua_mrb.*, vendor.ve_uu mr_venduu, qua_mrb.mr_presult mr_result from qua_mrb "
                         + " left join vendor on qua_mrb.mr_vendcode = vendor.ve_code where mr_sendstatus = '待上传' "
-                        + " and mr_status = '已审核' and mr_qctype = '采购检验单' and ve_uu is not null and nvl(ve_b2benable,0)=1 ",
+                        + " and mr_status = '已审核' and mr_qctype = '采购检验单' and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 ",
                 PurchaseQuaMRB.class);
         for (PurchaseQuaMRB purchaseMRB : purchaseMRBs) {
             List<PurchaseQuaMRBCheckItem> checkItems = jdbcTemplate.queryForBeanList("select * from qua_mrbdet where md_mrid = ? ",

+ 4 - 4
src/main/java/com/uas/erp/schedular/b2b/task/PurchaseNotifyTask.java

@@ -26,7 +26,7 @@ public class PurchaseNotifyTask extends AbstractTask {
 
     @TaskMapping(title = "上传送货提醒", fixedDelay = 30000)
     public void uploadPurchaseNotify() {
-        List<PurchaseNotify> notifies = jdbcTemplate.queryForBeanList("select * from (select purchasenotify.*,ve_uu,pr_zxbzs 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,' ')='待上传' or nvl(pn_sendstatus,' ')='上传中') and pn_status<>'已取消' and nvl(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",
+        List<PurchaseNotify> notifies = jdbcTemplate.queryForBeanList("select * from (select purchasenotify.*,ve_uu,pr_zxbzs 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_status<>'已取消' and nvl(pu_sendstatus, '') = '已上传' and nvl(pu_ordertype,' ')<>'B2C' and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 order by pn_indate) where rownum <= 100",
                 PurchaseNotify.class);
         if (!CollectionUtils.isEmpty(notifies)) {
             ContextHolder.setDataSize(notifies.size());
@@ -126,7 +126,7 @@ public class PurchaseNotifyTask extends AbstractTask {
 
     @TaskMapping(title = "上传结案送货提醒", fixedDelay = 60000)
     public void uploadPurchaseNotifyEnd() {
-        List<PurchaseNotify> notifies = jdbcTemplate.queryForBeanList("select * from (select purchasenotify.pn_id,ve_uu from purchasenotify left join purchase on pn_ordercode=pu_code left join vendor on pu_vendcode=ve_code where PN_SENDSTATUS='待上传' and pn_statuscode='CANCELED' and pu_sendstatus='已上传' and nvl(pu_ordertype,' ')<>'B2C' and pn_b2bid is not null and ve_uu is not null and nvl(ve_b2benable,0)=1 order by pn_indate) where rownum<=400",
+        List<PurchaseNotify> notifies = jdbcTemplate.queryForBeanList("select * from (select purchasenotify.pn_id,ve_uu from purchasenotify left join purchase on pn_ordercode=pu_code left join vendor on pu_vendcode=ve_code where PN_SENDSTATUS='待上传' and pn_statuscode='CANCELED' and pu_sendstatus='已上传' and nvl(pu_ordertype,' ')<>'B2C' and pn_b2bid is not null and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 order by pn_indate) where rownum<=400",
                 PurchaseNotify.class);
         if (!CollectionUtils.isEmpty(notifies)) {
             ContextHolder.setDataSize(notifies.size());
@@ -155,7 +155,7 @@ public class PurchaseNotifyTask extends AbstractTask {
      * @return
      */
     private List<AcceptNotify> getAcceptNotify() {
-        List<AcceptNotify> accepts = jdbcTemplate.queryForBeanList("select AcceptNotify.* from AcceptNotify left join vendor on an_vendcode=ve_code where AN_SENDSTATUS='待上传' and an_statuscode='AUDITED' and ve_uu is not null and nvl(ve_b2benable,0)=1 and B2B_SS_ID is not null order by an_date",
+        List<AcceptNotify> accepts = jdbcTemplate.queryForBeanList("select AcceptNotify.* from AcceptNotify left join vendor on an_vendcode=ve_code where AN_SENDSTATUS='待上传' and an_statuscode='AUDITED' and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 and B2B_SS_ID is not null order by an_date",
                 AcceptNotify.class);
         for (AcceptNotify accept : accepts) {
             List<AcceptNotifyDetail> details = jdbcTemplate.queryForBeanList("select * from AcceptNotifyDetail where and_anid=?",
@@ -173,7 +173,7 @@ public class PurchaseNotifyTask extends AbstractTask {
      */
     @TaskMapping(title = "上传收料通知修改的确认数", fixedDelay = 60000)
     public void uploadAcceptNotifyConfirm() {
-        List<AcceptNotifyConfirm> confirms = jdbcTemplate.queryForBeanList("select b2b_ss_id,and_id,and_detno,and_inqty from AcceptNotify left join vendor on an_vendcode=ve_code left join AcceptNotifyDetail on and_anid=an_id where b2b_ss_id is not null and an_statuscode in ('AUDITED','TURNVA', 'PART2VA') and and_sendstatus='待上传' and and_inqty<nvl(and_b2bqty,and_inqty) and ve_uu is not null and nvl(ve_b2benable,0)=1 order by b2b_ss_id,and_detno",
+        List<AcceptNotifyConfirm> confirms = jdbcTemplate.queryForBeanList("select b2b_ss_id,and_id,and_detno,and_inqty from AcceptNotify left join vendor on an_vendcode=ve_code left join AcceptNotifyDetail on and_anid=an_id where b2b_ss_id is not null and an_statuscode in ('AUDITED','TURNVA', 'PART2VA') and and_sendstatus='待上传' and and_inqty<nvl(and_b2bqty,and_inqty) and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 order by b2b_ss_id,and_detno",
                 AcceptNotifyConfirm.class);
         if (!CollectionUtils.isEmpty(confirms)) {
             ContextHolder.setDataSize(confirms.size());

+ 5 - 4
src/main/java/com/uas/erp/schedular/b2b/task/PurchaseProdInOutTask.java

@@ -37,8 +37,9 @@ public class PurchaseProdInOutTask extends AbstractTask {
      */
     private List<PurchaseProdInOut> getProInOutUpload() {
         List<PurchaseProdInOut> prodInOuts = jdbcTemplate.queryForBeanList(
-                "select * from (select prodinout.*, ve_uu pi_vendoruu from prodinout left join vendor on prodinout.pi_cardcode = vendor.ve_code where pi_class='采购验收单' and pi_status = '已过账' and (pi_sendstatus = '待上传' or pi_sendstatus='上传中') and ve_uu is not null and nvl(ve_b2benable,0)=1 ) where rownum <= 50 and exists (select 1 from purchase,prodiodetail where pd_piid=pi_id and pu_sendstatus='已上传')",
+                "select * from (select prodinout.*, ve_uu pi_vendoruu from prodinout left join vendor on prodinout.pi_cardcode = vendor.ve_code where pi_class='采购验收单' and pi_status = '已过账' and (pi_sendstatus = '待上传' or pi_sendstatus='上传中') and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 ) where rownum <= 20 and exists (select 1 from purchase,prodiodetail where pd_piid=pi_id and pu_sendstatus='已上传')",
                 PurchaseProdInOut.class);
+        System.out.println(CollectionUtil.getKeyString(prodInOuts));
         for (PurchaseProdInOut prodInOut : prodInOuts) {
             List<PurchaseProdInOutDetail> details = jdbcTemplate.queryForBeanList(
                     "select prodiodetail.* , pd_pdno pd_detno from prodiodetail where pd_piid = ? ",
@@ -69,7 +70,7 @@ public class PurchaseProdInOutTask extends AbstractTask {
      * @return
      */
     private List<PurchaseProdInOut> getProdReturnUpload() {
-        List<PurchaseProdInOut> prodInOuts = jdbcTemplate.queryForBeanList("select * from (select prodinout.*, ve_uu pi_vendoruu from prodinout left join vendor on prodinout.pi_cardcode = vendor.ve_code where pi_class='采购验退单' and pi_status = '已过账' and (pi_sendstatus = '待上传' or pi_sendstatus='上传中') and exists (select 1 from prodiodetail left join purchase on pu_code=pd_ordercode where pd_piid=pi_id and (pd_ordercode is null or pu_sendstatus='已上传')) and ve_uu is not null and nvl(ve_b2benable,0)=1) where rownum <= 200 ",
+        List<PurchaseProdInOut> prodInOuts = jdbcTemplate.queryForBeanList("select * from (select prodinout.*, ve_uu pi_vendoruu from prodinout left join vendor on prodinout.pi_cardcode = vendor.ve_code where pi_class='采购验退单' and pi_status = '已过账' and (pi_sendstatus = '待上传' or pi_sendstatus='上传中') and exists (select 1 from prodiodetail left join purchase on pu_code=pd_ordercode where pd_piid=pi_id and (pd_ordercode is null or pu_sendstatus='已上传')) and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1) where rownum <= 200 ",
                 PurchaseProdInOut.class);
         for (PurchaseProdInOut prodInOut : prodInOuts) {
             List<PurchaseProdInOutDetail> details = jdbcTemplate.queryForBeanList(
@@ -101,7 +102,7 @@ public class PurchaseProdInOutTask extends AbstractTask {
      * @return
      */
     private List<PurchaseProdInOut> getProdBadInUpload() {
-        List<PurchaseProdInOut> prodInOuts = jdbcTemplate.queryForBeanList("select * from (select prodinout.*, ve_uu pi_vendoruu from prodinout left join vendor on prodinout.pi_cardcode = vendor.ve_code where pi_class='不良品入库单' and pi_type='PURC' and pi_status = '已过账' and (pi_sendstatus = '待上传' or pi_sendstatus='上传中') and ve_uu is not null and nvl(ve_b2benable,0)=1) where rownum<=200 ",
+        List<PurchaseProdInOut> prodInOuts = jdbcTemplate.queryForBeanList("select * from (select prodinout.*, ve_uu pi_vendoruu from prodinout left join vendor on prodinout.pi_cardcode = vendor.ve_code where pi_class='不良品入库单' and pi_type='PURC' and pi_status = '已过账' and (pi_sendstatus = '待上传' or pi_sendstatus='上传中') and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1) where rownum<=200 ",
                 PurchaseProdInOut.class);
         for (PurchaseProdInOut prodInOut : prodInOuts) {
             List<PurchaseProdInOutDetail> details = jdbcTemplate.queryForBeanList(
@@ -133,7 +134,7 @@ public class PurchaseProdInOutTask extends AbstractTask {
      * @return
      */
     private List<PurchaseProdInOut> getProdBadOutUpload() {
-        List<PurchaseProdInOut> prodInOuts = jdbcTemplate.queryForBeanList("select * from (select prodinout.*, ve_uu pi_vendoruu from prodinout left join vendor on prodinout.pi_cardcode = vendor.ve_code where pi_class='不良品出库单' and pi_type = 'PURC' and pi_status = '已过账' and (pi_sendstatus = '待上传' or pi_sendstatus='上传中') and ve_uu is not null and nvl(ve_b2benable,0)=1) where rownum <= 200 ",
+        List<PurchaseProdInOut> prodInOuts = jdbcTemplate.queryForBeanList("select * from (select prodinout.*, ve_uu pi_vendoruu from prodinout left join vendor on prodinout.pi_cardcode = vendor.ve_code where pi_class='不良品出库单' and pi_type = 'PURC' and pi_status = '已过账' and (pi_sendstatus = '待上传' or pi_sendstatus='上传中') and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1) where rownum <= 200 ",
                 PurchaseProdInOut.class);
         for (PurchaseProdInOut prodInOut : prodInOuts) {
             List<PurchaseProdInOutDetail> details = jdbcTemplate.queryForBeanList(

+ 4 - 4
src/main/java/com/uas/erp/schedular/b2b/task/PurchaseSampleTask.java

@@ -48,11 +48,11 @@ public class PurchaseSampleTask extends AbstractTask {
         List<ProductSample> productSamples = jdbcTemplate.queryForBeanList("select productsample.*,em_uu ps_appmanuu from productsample left join employee"
                         + " on productsample.ps_appmanid = em_id where (ps_sendstatus='待上传' or"
                         + " ps_sendstatus='上传中') and ps_status='已审核' and exists (select 1 from productsampledetail left"
-                        + " join vendor on pd_vendcode=ve_code where pd_psid=ps_id and ve_uu is not null and nvl(ve_b2benable,0)=1) order by ps_code",
+                        + " join vendor on pd_vendcode=ve_code where pd_psid=ps_id and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1) order by ps_code",
                 ProductSample.class);
         for (ProductSample productSample : productSamples) {
             List<ProductSampleDetail> details = jdbcTemplate.queryForBeanList("select productsampledetail.*,ve_contactuu pd_contactuu from productsampledetail"
-                            + " left join vendor on pd_vendcode=ve_code where pd_psid=? and ve_uu is not null and nvl(ve_b2benable,0)=1",
+                            + " left join vendor on pd_vendcode=ve_code where pd_psid=? and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1",
                     ProductSampleDetail.class, productSample.getPs_id());
             productSample.setDetails(details);
             // 附件信息
@@ -172,7 +172,7 @@ public class PurchaseSampleTask extends AbstractTask {
         List<ProductSampleApproval> saleSampleSends = jdbcTemplate.queryForBeanList("select * from (select productapproval.*, "
                                 + "to_number(ve_uu) pa_venduu, pr_detail, pr_spec, pr_unit from productapproval left join vendor on "
                                 + "productapproval.pa_providecode = vendor.ve_code left join product on productapproval.pa_prodcode = "
-                                + "product.pr_code where pa_status='已审核' and pa_sendstatus='待上传'  and ve_uu is not null and nvl(ve_b2benable,0)=1 and rownum<10)",
+                                + "product.pr_code where pa_status='已审核' and pa_sendstatus='待上传'  and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 and rownum<10)",
                 ProductSampleApproval.class);
         if (!CollectionUtils.isEmpty(saleSampleSends)) {
             for (ProductSampleApproval approval : saleSampleSends) {
@@ -201,7 +201,7 @@ public class PurchaseSampleTask extends AbstractTask {
     public void invalidateSaleSampleSend() {
         List<Long> sampleIds = jdbcTemplate.queryIdList("select productsample.ps_id id from productsample left join employee" +
                 " on productsample.ps_appmanid = em_id where ps_sendstatus = '已上传' and ps_status='已作废' and exists (select 1 from productsampledetail left" +
-                " join vendor on pd_vendcode=ve_code where pd_psid=ps_id and ve_uu is not null and nvl(ve_b2benable,0)=1) order by ps_code",
+                " join vendor on pd_vendcode=ve_code where pd_psid=ps_id and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1) order by ps_code",
                 IdObject.class);
         if (!CollectionUtils.isEmpty(sampleIds)) {
             ContextHolder.setDataSize(sampleIds.size());

+ 6 - 6
src/main/java/com/uas/erp/schedular/b2b/task/PurchaseTask.java

@@ -48,7 +48,7 @@ public class PurchaseTask extends AbstractTask {
      * 上传物料资料
      */
     private Integer uploadProduct() {
-        final List<Prod> prods = jdbcTemplate.queryForBeanList("select * from (select pr_id,pr_code,pr_detail,pr_spec,pr_unit,pr_zxbzs,pr_zxdhl,pr_leadtime,pr_ltinstock,pr_brand from product where exists (select 1 from purchase left join vendor on pu_vendcode=ve_code left join purchasedetail on pd_puid=pu_id where (PU_SENDSTATUS='待上传' or PU_SENDSTATUS='上传中' or pu_sendstatus='已上传') and nvl(pu_ordertype,' ')<>'B2C' and pu_statuscode='AUDITED' and ve_uu is not null and nvl(ve_b2benable,0)=1 and pd_prodcode=pr_code) and nvl(pr_sendstatus,' ')<>'已上传' order by pr_id) where rownum <= 500",
+        final List<Prod> prods = jdbcTemplate.queryForBeanList("select * from (select pr_id,pr_code,pr_detail,pr_spec,pr_unit,pr_zxbzs,pr_zxdhl,pr_leadtime,pr_ltinstock,pr_brand from product where exists (select 1 from purchase left join vendor on pu_vendcode=ve_code left join purchasedetail on pd_puid=pu_id where (PU_SENDSTATUS='待上传' or PU_SENDSTATUS='上传中' or pu_sendstatus='已上传') and nvl(pu_ordertype,' ')<>'B2C' and pu_statuscode='AUDITED' and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 and pd_prodcode=pr_code) and nvl(pr_sendstatus,' ')<>'已上传' order by pr_id) where rownum <= 500",
                 Prod.class);
         if (!CollectionUtils.isEmpty(prods)) {
             return prods.size();
@@ -62,12 +62,12 @@ public class PurchaseTask extends AbstractTask {
      * @return
      */
     private List<Purchase> getPurchasesUpload() {
-        List<Purchase> purchases = jdbcTemplate.queryForBeanList("select * from (select purchase.*,em_uu,em_name,em_sex,em_mobile,em_email,vendor.ve_uu,pu_vendcontact ve_contact,purchase.pu_vendcontactuu ve_contactuu from purchase left join vendor on pu_vendcode=ve_code left join employee on pu_buyerid=em_id where (PU_SENDSTATUS='待上传' or 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<>'已上传') order by pu_code) where rownum < 100",
+        List<Purchase> purchases = jdbcTemplate.queryForBeanList("select * from (select purchase.*,em_uu,em_name,em_sex,em_mobile,em_email,vendor.ve_uu,pu_vendcontact ve_contact,purchase.pu_vendcontactuu ve_contactuu from purchase left join vendor on pu_vendcode=ve_code left join employee on pu_buyerid=em_id where (PU_SENDSTATUS='待上传' or PU_SENDSTATUS='上传中') and pu_statuscode='AUDITED' and nvl(pu_ordertype,' ')<>'B2C' and coalesce(ve_uu, '0') <> '0' 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<>'已上传') order by pu_code) where rownum < 100",
                 Purchase.class);
         List<Purchase> thisPost = new ArrayList<>();
         int count = 0;
         for (Purchase purchase : purchases) {
-            List<PurchaseDetail> purchaseDetails = jdbcTemplate.queryForBeanList("select * from (select p.*,(select max(pv_vendprodspec) from productvendor where pv_prodcode=pd_prodcode and pv_vendcode=?) as pd_vendspec from purchasedetail p where pd_puid=?)",
+            List<PurchaseDetail> purchaseDetails = jdbcTemplate.queryForBeanList("select * from (select p.*,product.pr_oldcode ,product.pr_oldname,product.pr_oldspec,(select max(pv_vendprodspec) from productvendor where pv_prodcode=pd_prodcode and pv_vendcode=?) as pd_vendspec from purchasedetail p left join product on pr_code=pd_prodcode where pd_puid=?)",
                     PurchaseDetail.class, purchase.getPu_vendcode(), purchase.getPu_id());
             if (!CollectionUtils.isEmpty(purchaseDetails)) {
                 for(PurchaseDetail detail : purchaseDetails) {
@@ -172,9 +172,9 @@ public class PurchaseTask extends AbstractTask {
         post("/erp/purchase/reply/back", dataWrap(idStr));
     }
 
-    @TaskMapping(title = "上传主动回复的记录到平台", fixedDelay = 60000)
+    @TaskMapping(title = "上传主动回复的记录到平台", fixedDelay = 60000, enabled = false)
     public void uploadPurchaseReply() {
-        List<PurchaseReply> replies = jdbcTemplate.queryForBeanList("select * from (select pr_id,pr_qty,pr_delivery,pr_remark,pr_pucode,pr_pddetno,pr_date,pr_recorder,b2b_pr_id,pr_type from PurchaseReply left join PurchaseDetail on pr_pucode=pd_code and pr_pddetno=pd_detno left join purchase on pd_puid=pu_id left join vendor on pu_vendcode=ve_code where PR_SENDSTATUS='待上传' and ve_uu is not null and nvl(ve_b2benable,0)=1 and nvl(b2b_pr_id,0)=0 order by pr_date) where rownum <= 500",
+        List<PurchaseReply> replies = jdbcTemplate.queryForBeanList("select * from (select pr_id,pr_qty,pr_delivery,pr_remark,pr_pucode,pr_pddetno,pr_date,pr_recorder,b2b_pr_id,pr_type from PurchaseReply left join PurchaseDetail on pr_pucode=pd_code and pr_pddetno=pd_detno left join purchase on pd_puid=pu_id left join vendor on pu_vendcode=ve_code where PR_SENDSTATUS='待上传' and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 and nvl(b2b_pr_id,0)=0 order by pr_date) where rownum <= 10",
                 PurchaseReply.class);
         if (!CollectionUtils.isEmpty(replies)) {
             ContextHolder.setDataSize(replies.size());
@@ -187,7 +187,7 @@ public class PurchaseTask extends AbstractTask {
 
     @TaskMapping(title = "上传结案、反结案采购订单", fixedDelay = 60000)
     public void uploadPurchaseEnd() {
-        List<PurchaseDetailEnd> details = jdbcTemplate.queryForBeanList("select * from (select pd_id,pd_code,pd_detno,case when pd_mrpstatuscode='FINISH' then 1 else 0 end pd_ended from PurchaseDetail left join purchase on pd_puid=pu_id left join vendor on pu_vendcode=ve_code where PU_SENDSTATUS='已上传' and nvl(pu_ordertype,' ')<>'B2C' and pd_endstatus='待上传' and ve_uu is not null and nvl(ve_b2benable,0)=1 order by pd_code,pd_detno) where rownum <= 200",
+        List<PurchaseDetailEnd> details = jdbcTemplate.queryForBeanList("select * from (select pd_id,pd_code,pd_detno,case when pd_mrpstatuscode='FINISH' then 1 else 0 end pd_ended from PurchaseDetail left join purchase on pd_puid=pu_id left join vendor on pu_vendcode=ve_code where PU_SENDSTATUS='已上传' and nvl(pu_ordertype,' ')<>'B2C' and pd_endstatus='待上传' and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 order by pd_code,pd_detno) where rownum <= 200",
                 PurchaseDetailEnd.class);
         if (!CollectionUtils.isEmpty(details)) {
             ContextHolder.setDataSize(details.size());

+ 2 - 2
src/main/java/com/uas/erp/schedular/b2b/task/SaleAPCheckTask.java

@@ -47,7 +47,7 @@ public class SaleAPCheckTask extends AbstractTask {
                 if (!CollectionUtils.isEmpty(aPCheck.getDetails())) {
                     for (APCheckDetail aPCheckDetail : aPCheck.getDetails()) {
                         String orderClass = null;
-                        if (aPCheckDetail.getAd_orderclass().equals("货款调账")) {
+                        if ("货款调账".equals(aPCheckDetail.getAd_orderclass())) {
                             orderClass = "APBILL";
                         } else {
                             orderClass = "PRODINOUT";
@@ -63,7 +63,7 @@ public class SaleAPCheckTask extends AbstractTask {
         }
         if (idStr.length() > 0) {
             // 完善明细
-            sqls.add("update ApcheckDetail set (ad_pdid,ad_taxrate) = (select pd_id,pd_taxrate from prodinout left join prodiodetail on pi_id=pd_piid  "
+            sqls.add("update ApcheckDetail set (ad_pdid,ad_taxrate,ad_prodcode) = (select pd_id,pd_taxrate,pd_prodcode from prodinout left join prodiodetail on pi_id=pd_piid  "
                     + " where pi_inoutno=ad_sourcecode and pd_pdno = ad_sourcedetno) where nvl(ad_sourcetype, ' ') = 'PRODINOUT' and ad_acid in ("
                     + idStr.toString() + ")");
             // 完善主记录

+ 1 - 1
src/main/java/com/uas/erp/schedular/b2b/task/SaleDownTask.java

@@ -78,7 +78,7 @@ public class SaleDownTask extends AbstractTask {
             sqls.add("update SaleDown set (sa_custid,sa_custcode,sa_custname,sa_apcustcode,sa_apcustname,sa_shcustcode,sa_shcustname,sa_sellerid,sa_seller,sa_sellercode)=(select cu_id,cu_code,cu_name,cu_arcode,cu_arname,cu_shcustcode,cu_shcustname,cu_sellerid,cu_sellername,em_code from customer left join employee on em_id=cu_sellerid where cu_uu=sa_customeruu) where sa_id in ("
                     + idStr.toString() + ")");
             sqls.add("merge into SaleDownDetail d " +
-                    "using (select pc_prodid,pc_prodcode,pc_custproddetail,pc_custprodspec,pc_custprodcode from saledown " +
+                    "using (select distinct pc_prodid,pc_prodcode,pc_custproddetail,pc_custprodspec,pc_custprodcode from saledown " +
                     "inner join productcustomer on pc_custcode = sa_custcode and sa_id in (" + idStr.toString() + ")) p " +
                     "on (d.sd_custprodcode = p.pc_custprodcode and sd_said in (" + idStr.toString() + ")) " +
                     "when matched then " +

+ 1 - 1
src/main/java/com/uas/erp/schedular/b2b/task/VendorPerformanceAssessTask.java

@@ -40,7 +40,7 @@ public class VendorPerformanceAssessTask extends AbstractTask {
     public List<VendorPerformanceAssess> getVendorPerformanceAssesss() {
         try {
             List<VendorPerformanceAssess> vpas = jdbcTemplate.queryForBeanList(
-                    "select * from (select * from VendorPerformanceAssess  LEFT JOIN vendor  on vpa_vendorcode = ve_code where  nvl(vpa_sendstatus,' ')<>'已上传' and  nvl(vpa_status, ' ') = '已审核' and nvl(ve_b2benable, 0) = 1 and ve_uu is not null order by vpa_id) where rownum <= 500",
+                    "select * from (select * from VendorPerformanceAssess  LEFT JOIN vendor  on vpa_vendorcode = ve_code where  nvl(vpa_sendstatus,' ')<>'已上传' and  nvl(vpa_status, ' ') = '已审核' and nvl(ve_b2benable, 0) = 1 and coalesce(ve_uu, '0') <> '0' order by vpa_id) where rownum <= 500",
                     VendorPerformanceAssess.class);
             return vpas;
         } catch (EmptyResultDataAccessException e) {

+ 31 - 9
src/main/java/com/uas/erp/schedular/entity/MasterTaskConfigEntity.java

@@ -4,22 +4,27 @@ import com.uas.erp.schedular.task.support.Method;
 import com.uas.erp.schedular.task.support.Role;
 import com.uas.erp.schedular.task.support.TaskConfig;
 import com.uas.erp.schedular.task.support.TaskMapping;
+import com.uas.erp.schedular.util.DateUtil;
 import com.uas.erp.schedular.util.StringUtil;
 import org.springframework.util.StringUtils;
 
 import javax.persistence.*;
+import java.io.*;
+import java.util.Date;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 /**
- * Created by Pro1 on 2017/7/26.
  * 基于各个账套的任务配置
+ *
+ * @author Pro1
+ * @date 2017/7/26
  */
 @Entity
 @IdClass(MasterTaskConfigId.class)
 @Table(indexes = {@Index(name = "idx_mod_role_master", columnList = "module,masterName,role"),
         @Index(name = "idx_transfer", columnList = "transferMethod")})
-public class MasterTaskConfigEntity {
+public class MasterTaskConfigEntity implements Serializable {
 
     private String module;
 
@@ -118,6 +123,9 @@ public class MasterTaskConfigEntity {
 
     public void setEnabled(boolean enabled) {
         this.enabled = enabled;
+        // 记录被禁用启用的记录
+        System.out.println(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss") + " MasterTaskConfig disabled, masterName: " + this.masterName +
+                ", beanTitle: " + this.beanTitle + ", methodTitle: " + this.methodTitle + ", enabled: " + this.enabled + ".");
     }
 
     public String getCron() {
@@ -203,16 +211,30 @@ public class MasterTaskConfigEntity {
 
     @Override
     public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
 
         MasterTaskConfigEntity entity = (MasterTaskConfigEntity) o;
 
-        if (beanName != null ? !beanName.equals(entity.beanName) : entity.beanName != null) return false;
-        if (methodName != null ? !methodName.equals(entity.methodName) : entity.methodName != null) return false;
-        if (masterName != null ? !masterName.equals(entity.masterName) : entity.masterName != null) return false;
-        if (cron != null ? !cron.equals(entity.cron) : entity.cron != null) return false;
-        if (fixedDelay != null ? !fixedDelay.equals(entity.fixedDelay) : entity.fixedDelay != null) return false;
+        if (beanName != null ? !beanName.equals(entity.beanName) : entity.beanName != null) {
+            return false;
+        }
+        if (methodName != null ? !methodName.equals(entity.methodName) : entity.methodName != null) {
+            return false;
+        }
+        if (masterName != null ? !masterName.equals(entity.masterName) : entity.masterName != null) {
+            return false;
+        }
+        if (cron != null ? !cron.equals(entity.cron) : entity.cron != null) {
+            return false;
+        }
+        if (fixedDelay != null ? !fixedDelay.equals(entity.fixedDelay) : entity.fixedDelay != null) {
+            return false;
+        }
         return fixedRate != null ? fixedRate.equals(entity.fixedRate) : entity.fixedRate == null;
 
     }

+ 16 - 0
src/main/java/com/uas/erp/schedular/entity/Setting.java

@@ -6,6 +6,7 @@ import org.springframework.util.StringUtils;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;
+import javax.persistence.Transient;
 
 /**
  * Created by Pro1 on 2017/7/26.
@@ -21,6 +22,13 @@ public class Setting {
     @Column(name = "value_")
     private String value;
 
+    /**
+     * 是否需要用代码配置重置数据库配置,默认:否 <br/>
+     * 可以通过配置setting.json中的选项配置修改
+     */
+    @Transient
+    private boolean resetDefault = false;
+
     public Setting() {
     }
 
@@ -62,4 +70,12 @@ public class Setting {
     public void setValue(String value) {
         this.value = value;
     }
+
+    public boolean isResetDefault() {
+        return resetDefault;
+    }
+
+    public void setResetDefault(boolean resetDefault) {
+        this.resetDefault = resetDefault;
+    }
 }

+ 6 - 0
src/main/java/com/uas/erp/schedular/init/DefaultInitializer.java

@@ -30,6 +30,12 @@ public class DefaultInitializer implements CommandLineRunner {
                 Setting oldOne = settingService.findOne(setting.getKey());
                 if (null == oldOne) {
                     settingService.save(setting);
+                } else {
+                    // 需要用代码配置重置数据库配置,修改数据库配置内容
+                    if (setting.isResetDefault()) {
+                        oldOne.setValue(setting.getValue());
+                        settingService.save(oldOne);
+                    }
                 }
                 // 不修改已设置项
             }

+ 36 - 0
src/main/java/com/uas/erp/schedular/init/ReplyInitializer.java

@@ -0,0 +1,36 @@
+package com.uas.erp.schedular.init;
+
+import com.uas.erp.schedular.entity.MasterTaskConfigEntity;
+import com.uas.erp.schedular.repository.MasterTaskConfigRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by Pro1 on 2017/7/26.
+ */
+@Component
+public class ReplyInitializer implements CommandLineRunner {
+
+    @Autowired
+    private MasterTaskConfigRepository masterTaskConfigRepository;
+
+    @Override
+    public void run(String... strings) throws Exception {
+        List<MasterTaskConfigEntity> entity = masterTaskConfigRepository
+                .findByBeanNameAndMethodName("purchaseTask", "uploadPurchaseReply");
+        List<MasterTaskConfigEntity> entities = new ArrayList<>();
+        if (!CollectionUtils.isEmpty(entity)) {
+            for (MasterTaskConfigEntity configEntity : entity) {
+                configEntity.setEnabled(false);
+                entities.add(configEntity);
+            }
+        }
+        if (!CollectionUtils.isEmpty(entities)) {
+            masterTaskConfigRepository.save(entities);
+        }
+    }
+}

+ 90 - 0
src/main/java/com/uas/erp/schedular/listen/DiskUtil.java

@@ -0,0 +1,90 @@
+package com.uas.erp.schedular.listen;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * 获取mac地址工具类
+ * @Author: huj
+ * @Date: Created in 15:05 2018/11/27.
+ */
+public class DiskUtil {
+
+    private static String macAddressStr = null;
+    private static final String[] windowsCommand = { "ipconfig", "/all" };
+    private static final String[] linuxCommand = { "/sbin/ifconfig", "-a" };
+    private static final Pattern macPattern = Pattern.compile(".*((:?[0-9a-f]{2}[-:]){5}[0-9a-f]{2}).*",
+            Pattern.CASE_INSENSITIVE);
+
+    /**
+     * 测试用的main方法.
+     *
+     */
+    public static String getAllMacAddress() {
+        if (macAddressStr == null || macAddressStr.equals("")) {
+            // 存放多个网卡地址用,目前只取一个非0000000000E0隧道的值
+            StringBuffer sb = new StringBuffer();
+            try {
+                List<String> macList = getMacAddressList();
+                for (Iterator<String> iter = macList.iterator(); iter.hasNext();) {
+                    String amac = iter.next();
+                    if (!amac.equals("0000000000E0")) {
+                        sb.append(amac);
+                        break;
+                    }
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+
+            macAddressStr = sb.toString();
+
+        }
+
+        return macAddressStr;
+    }
+
+    /**
+     * 获取多个网卡地址
+     *
+     * @return
+     * @throws IOException
+     */
+    private final static List<String> getMacAddressList() throws IOException {
+        final ArrayList<String> macAddressList = new ArrayList<String>();
+        final String os = System.getProperty("os.name");
+        final String command[];
+
+        if (os.startsWith("Windows")) {
+            command = windowsCommand;
+        } else if (os.startsWith("Linux")) {
+            command = linuxCommand;
+        } else {
+            throw new IOException("Unknow operating system:" + os);
+        }
+        // 执行命令
+        final Process process = Runtime.getRuntime().exec(command);
+
+        BufferedReader bufReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+        for (String line = null; (line = bufReader.readLine()) != null;) {
+            Matcher matcher = macPattern.matcher(line);
+            if (matcher.matches()) {
+                macAddressList.add(matcher.group(1).replaceAll("[-:]","-"));
+//                macAddressList.add(matcher.group(1).replaceAll("[-:]",
+//                ""));//去掉MAC中的“-”
+            }
+        }
+
+        process.destroy();
+        bufReader.close();
+        return macAddressList;
+    }
+
+}

+ 46 - 0
src/main/java/com/uas/erp/schedular/listen/ListenDomain.java

@@ -0,0 +1,46 @@
+package com.uas.erp.schedular.listen;
+
+/**
+ * @Author: huj
+ * @Date: Created in 15:34 2018/11/27.
+ */
+public class ListenDomain {
+
+    String macAddress;
+
+    String name;
+
+    String description;
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getMacAddress() {
+        return macAddress;
+    }
+
+    public void setMacAddress(String macAddress) {
+        this.macAddress = macAddress;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public ListenDomain(String macAddress, String name) {
+        this.macAddress = macAddress;
+        this.name = name;
+    }
+
+    public ListenDomain() {
+    }
+}

+ 173 - 0
src/main/java/com/uas/erp/schedular/listen/ListenTask.java

@@ -0,0 +1,173 @@
+package com.uas.erp.schedular.listen;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.TypeReference;
+import com.uas.erp.schedular.database.RestJdbcTemplate;
+import com.uas.erp.schedular.entity.Master;
+import com.uas.erp.schedular.entity.MasterTaskConfigEntity;
+import com.uas.erp.schedular.entity.MasterTaskConfigId;
+import com.uas.erp.schedular.service.ScheduledTaskService;
+import com.uas.erp.schedular.service.SettingService;
+import com.uas.erp.schedular.util.ContextHolder;
+import com.uas.erp.schedular.web.ResultListWrap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.util.StringUtils;
+import org.springframework.web.client.RestTemplate;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @Author: huj
+ * @Date: Created in 14:41 2018/11/27.
+ */
+@Component
+public class ListenTask {
+
+    @Autowired
+    private ScheduledTaskService scheduledTaskService;
+
+    @Autowired
+    private RestTemplate restTemplate;
+
+    @Autowired
+    private SettingService settingService;
+
+    @Autowired
+    private RestJdbcTemplate jdbcTemplate;
+
+    private String getUrl() {
+        return settingService.getValue("api.database.url");
+    }
+
+    private final static String MACADDRESS = DiskUtil.getAllMacAddress();
+
+    /**
+     * 按账套环境,使用不同接口地址
+     * @return
+     */
+    private String getApiDomain() {
+        return settingService.getValue("api.b2b.url");
+    }
+
+    /**
+     * 每十分钟发送一次
+     */
+    @Scheduled(cron = "0 */10 * * * *")
+    public void listen() {
+        List<Master> masters = new ArrayList<>();
+        List<Master> all = new ArrayList<>();
+        try {
+            String allStr = restTemplate.getForObject(getUrl() + "/v1/master/list", String.class);
+            ResultListWrap<Master> allList = JSON.parseObject(allStr, new TypeReference<ResultListWrap<Master>>(Master.class) {
+            });
+            if (allList.isSuccess()) {
+                all = allList.getContent();
+            }
+            String resultStr = restTemplate.getForObject(getUrl() + "/v1/master/list?cloudEnabled=true", String.class);
+            ResultListWrap<Master> result = JSON.parseObject(resultStr, new TypeReference<ResultListWrap<Master>>(Master.class) {
+            });
+            if (result.isSuccess()) {
+                masters = result.getContent();
+            }
+        } catch (Exception e) {
+
+        } finally {
+            if (CollectionUtils.isEmpty(masters)) {
+                StringBuilder str = new StringBuilder();
+                if (!CollectionUtils.isEmpty(all)) {
+                    for (Master master : all) {
+                        if ("".equals(str.toString())) {
+                            str.append(StringUtils.isEmpty(master.getMa_function()) ? master.getMa_name() : master.getMa_function());
+                        } else {
+                            str.append("、" + (StringUtils.isEmpty(master.getMa_function()) ? master.getMa_name() : master.getMa_function()));
+                        }
+                    }
+                }
+                ListenDomain listenDomain = new ListenDomain(MACADDRESS, str == null ? "" : str.toString());
+                List<ListenDomain> listenDomains = new ArrayList<>();
+                if (!"".equals(str.toString())) {
+                    listenDomain.setDescription("所有账套都未启用轮询");
+                } else {
+                    listenDomain.setDescription("h2数据库查询异常或oracle数据库设置异常");
+                }
+                listenDomains.add(listenDomain);
+                postForList(getApiDomain() + "/erp/listen", ListenDomain.class, dataWrap(listenDomains));
+                return;
+            }
+        }
+        if (!CollectionUtils.isEmpty(masters)) {
+            ContextHolder.setMaster(masters.get(0));
+            int dual = jdbcTemplate.getInt("select 1 from dual");
+            if (dual == 1) {
+                StringBuilder str = new StringBuilder();
+                for (Master master : masters) {
+                    if ("".equals(str.toString())) {
+                        str.append(StringUtils.isEmpty(master.getMa_function()) ? master.getMa_name() : master.getMa_function());
+                    } else {
+                        str.append("、" + (StringUtils.isEmpty(master.getMa_function()) ? master.getMa_name() : master.getMa_function()));
+                    }
+                }
+                MasterTaskConfigId configId = new MasterTaskConfigId(null, null,
+                        masters.get(0).getMa_name().toUpperCase());
+                List<MasterTaskConfigEntity> taskConfigs = scheduledTaskService.getTaskConfigs(configId, "b2b", "BUYER");
+                if (!CollectionUtils.isEmpty(taskConfigs)) {
+                    ListenDomain listenDomain = new ListenDomain(MACADDRESS,
+                            str == null ? "" : str.toString());
+                    List<ListenDomain> listenDomains = new ArrayList<>();
+                    listenDomains.add(listenDomain);
+                    postForList(getApiDomain() + "/erp/listen", ListenDomain.class, dataWrap(listenDomains));
+                }
+            } else {
+                ListenDomain listenDomain = new ListenDomain(MACADDRESS, "" );
+                List<ListenDomain> listenDomains = new ArrayList<>();
+                listenDomain.setDescription("oracle查询异常");
+                listenDomains.add(listenDomain);
+                postForList(getApiDomain() + "/erp/listen", ListenDomain.class, dataWrap(listenDomains));
+                return;
+            }
+            ContextHolder.clear();
+        }
+    }
+
+    /**
+     * 封装成平台接口数据格式
+     * @param data
+     * @return
+     */
+    protected static MultiValueMap<String, String> dataWrap(Object data) {
+        MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
+        String dataStr =  JSON.toJSONString(data);
+        try {
+            dataStr = URLEncoder.encode(dataStr, "UTF-8");
+        } catch (UnsupportedEncodingException e) {
+
+        }
+        map.set("data", dataStr);
+        return map;
+    }
+
+    protected ResponseEntity postForEntity(String url, MultiValueMap<String, String> vars) {
+        HttpHeaders headers = new HttpHeaders();
+        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+        HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(vars, headers);
+        return restTemplate.postForEntity(url, request, String.class);
+    }
+
+    protected <T> List<T> postForList(String url, Class<T> objectClass, MultiValueMap<String, String> vars) {
+        ResponseEntity<String> resultEntity = postForEntity(url, vars);
+        return JSON.parseArray(resultEntity.getBody(), objectClass);
+    }
+}

+ 13 - 9
src/main/java/com/uas/erp/schedular/publicinquiry/task/EnterInquiryTask.java

@@ -272,47 +272,51 @@ public class EnterInquiryTask extends AbstractTask{
         }
         try{
             //从平台获取企业商机,保存到本地
+            String ids = "";
             List<InquiryEnRemind> downs = getForList("/inquiry/public/enremind?vendUU="+enterpriseMap.get("EN_UU"), InquiryEnRemind.class);
             if(!CollectionUtils.isEmpty(downs)){
                 ContextHolder.setDataSize(downs.size());
-                saveInquiryEnRemind(downs);
+                ids = saveInquiryEnRemind(downs);
             }
             // 回执
-            onReplySuccess(downs, enterpriseMap.get("EN_UU"));
+            onReplySuccess(ids, enterpriseMap.get("EN_UU"));
         }catch (Exception e){
             e.printStackTrace();
         }
 
     }
 
-    private void onReplySuccess(List<InquiryEnRemind> downs, Object en_uu) {
-        String idStr = CollectionUtil.getKeyString(downs);
+    private void onReplySuccess(String ids, Object en_uu) {
         MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
         map.set("vendUU", String.valueOf(en_uu));
-        map.set("ids", idStr);
-        if(!StringUtils.isEmpty(idStr)){
+        map.set("ids", ids);
+        if(!StringUtils.isEmpty(ids)){
             post("/inquiry/public/enremind/back", map);
         }
     }
 
-    private void saveInquiryEnRemind(List<InquiryEnRemind> downs) throws Exception {
+    private String saveInquiryEnRemind(List<InquiryEnRemind> downs) throws Exception {
+        StringBuilder sb = new StringBuilder();
         Map<String, Object> model = new HashMap<String, Object>();
         model.put("inquiryEnRemind", downs);
         try{
             String sql = SqlTemplate.fromXmlFile("database/template/inquiryEnRemind.xml", model);
             jdbcTemplate.execute(sql);
+            sb.append(CollectionUtil.getKeyString(downs));
         }catch (Exception e){
-            for(int i = 0; i < downs.size(); i=i+2){
+            for(int i = 0; i < downs.size(); i=i+1){
                 try {
-                    List<InquiryEnRemind> tempList = downs.subList(i,i+2);
+                    List<InquiryEnRemind> tempList = downs.subList(i,i+1);
                     model.put("inquiryEnRemind", tempList);
                     String sql = SqlTemplate.fromXmlFile("database/template/inquiryEnRemind.xml", model);
                     jdbcTemplate.execute(sql);
+                    sb.append(downs.get(i).getId() + ",");
                 }catch (Exception e1){
                     continue;
                 }
             }
         }
+        return sb.substring(0, sb.length()-2);
     }
 
 }

+ 1 - 1
src/main/java/com/uas/erp/schedular/publicinquiry/task/PubInquiryTask.java

@@ -194,7 +194,7 @@ public class PubInquiryTask extends AbstractTask {
     public void uploadInquiryInvalid() {
         Enterprise enterprise = getEnterprise();
         if (null != enterprise) {
-            List<Inquiry> inquiries = jdbcTemplate.queryForBeanList("select * from InquiryAuto left join InquiryAutoDetail on id_inid=in_id left join vendor on id_vendcode=ve_code where in_status = '已作废' and in_sendStatus <> '作废已上传' and nvl(in_class,' ')<>'主动报价'  and ve_uu is not null and nvl(ve_b2benable,0)=1 and rownum <= 100 order by in_code",
+            List<Inquiry> inquiries = jdbcTemplate.queryForBeanList("select * from InquiryAuto left join InquiryAutoDetail on id_inid=in_id left join vendor on id_vendcode=ve_code where in_status = '已作废' and in_sendStatus <> '作废已上传' and nvl(in_class,' ')<>'主动报价'  and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)=1 and rownum <= 100 order by in_code",
                     Inquiry.class);
             if (!CollectionUtils.isEmpty(inquiries)) {
                 ContextHolder.setDataSize(inquiries.size());

+ 1 - 1
src/main/java/com/uas/erp/schedular/publicproduct/task/AbstractTask.java

@@ -255,7 +255,7 @@ public class AbstractTask {
 
         @Override
         protected void onBefore() {
-            jdbcTemplate.execute(String.format("update %s set %s='上传' where %s in (%s)", tableName, statusColumn, idColumn, idStr));
+            jdbcTemplate.execute(String.format("update %s set %s='上传' where %s in (%s)", tableName, statusColumn, idColumn, idStr));
         }
 
         @Override

+ 2 - 0
src/main/java/com/uas/erp/schedular/repository/MasterTaskConfigRepository.java

@@ -34,4 +34,6 @@ public interface MasterTaskConfigRepository extends JpaRepository<MasterTaskConf
 
     List<MasterTaskConfigEntity> findByMasterNameAndModule(String masterName, String module);
 
+    List<MasterTaskConfigEntity> findByBeanNameAndMethodName(String beanName, String methodName);
+
 }

+ 4 - 0
src/main/java/com/uas/erp/schedular/util/ContextHolder.java

@@ -13,6 +13,10 @@ public class ContextHolder {
         threadLocalMaster.set(master);
     }
 
+    public static void clear() {
+        threadLocalMaster.set(null);
+    }
+
     public static Master getMaster() {
         return threadLocalMaster.get();
     }

+ 1 - 1
src/main/resources/database/template/inquiryEnRemind.xml

@@ -37,7 +37,7 @@
                 ${detail.needQty},${detail.endDate},${detail.enUU},v_cu_code);
                 select count(*) into v_count from product left join productsaler on ps_prcode=pr_code where pr_orispeccode=${detail.cmpCode};
                 if v_count > 0 then
-                select ps_emcode,ps_emname into v_domancode,v_doman from productsaler left join product on pr_code=ps_prcode where pr_orispeccode=${detail.cmpCode} and rownum=1 order by ps_data desc;
+                select ps_emcode,ps_emname into v_domancode,v_doman from product left join productsaler on pr_code=ps_prcode where pr_orispeccode=${detail.cmpCode} and rownum=1 order by ps_data desc;
                 update businesschance set bc_domancode=v_domancode,bc_doman=v_doman where bc_id=v_id;
                 end if;
                 end if;

+ 7 - 6
src/main/resources/init/setting.json

@@ -13,11 +13,12 @@
 },{
   "key": "api.b2b.test.url",
   "description": "优软B2B平台测试接口地址",
-  "value": "http://218.17.158.219:9000/b2b_test"
+  "value": "http://test-b2b.uuzcc.cn"
 },{
   "key": "api.b2b.url",
   "description": "优软B2B平台正式接口地址",
-  "value": "http://uas-api.ubtob.com"
+  "value": "http://b2b-api.usoftchina.com",
+  "resetDefault": false
 },{
   "key": "api.finance.url",
   "description": "金融保理平台(后台)正式接口地址",
@@ -41,17 +42,17 @@
 },{
   "key": "api.publicinquiry.test.url",
   "description": "公共询价测试地址",
-  "value": "http://192.168.253.12:24000/"
+  "value": "http://test-inquiry.uuzcc.cn"
 },{
   "key": "api.publicinquiry.url",
   "description": "公共询价正式地址",
-  "value": "https://api-inquiry.usoftmall.com/"
+  "value": "http://api-inquiry.usoftchina.com/"
 },{
   "key": "api.publicproduct.test.url",
   "description": "公共物料测试地址",
-  "value": "http://192.168.253.12:24000/"
+  "value": "http://test-product.uuzcc.cn"
 },{
   "key": "api.publicproduct.url",
   "description": "公共物料正式地址",
-  "value": "https://api-product.usoftmall.com/"
+  "value": "http://api-product.usoftchina.com/"
 }]

+ 213 - 0
src/test/java/com/uas/erp/test/PurchaseChangeTest.java

@@ -0,0 +1,213 @@
+package com.uas.erp.test;
+
+import com.uas.erp.schedular.UasSchedulingApplication;
+import com.uas.erp.schedular.b2b.task.*;
+import com.uas.erp.schedular.entity.Master;
+import com.uas.erp.schedular.publicproduct.task.ProdTask;
+import com.uas.erp.schedular.util.ContextHolder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+/**
+ * @Author: huj
+ * @Date: Created in 8:56 2018/6/28.
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = UasSchedulingApplication.class)
+public class PurchaseChangeTest extends AbstractTask {
+
+    @Autowired
+    SaleDownChangeTask saleDownChangeTask;
+
+    @Autowired
+    ApplicationContext applicationContext;
+
+    @Autowired
+    SaleDownTask saleDownTask;
+
+    @Autowired
+    PurchaseTask purchaseTask;
+
+    @Autowired
+    ProdCheckTask prodCheckTask;
+
+
+    @Autowired
+    InquiryTask inquiryTask;
+
+    @Autowired
+    PurchaseSampleTask purchaseSampleTask;
+
+    @Autowired
+    MakeTask makeTask;
+
+    @Autowired
+    PurchaseNotifyTask purchaseNotifyTask;
+
+
+    @Autowired
+    CheckTransTask checkTransTask;
+
+    @Autowired
+    PurchaseProdInOutTask purchaseProdInOutTask;
+
+    @Autowired
+    ProdTask prodTask;
+
+    @Autowired
+    PurchaseChangeTask purchaseChangeTask;
+
+    @Autowired
+    OrderCheckTask orderCheckTask;
+
+    @Autowired
+    SaleProdInOutDownTask saleProdInOutDownTask;
+
+    @Autowired
+    MakeProdInOutTask makeProdInOutTask;
+
+    @Autowired
+    InquiryMouldTask inquiryMouldTask;
+
+    @Autowired
+    SaleAPCheckTask saleAPCheckTask;
+
+
+    @Test
+    public void uploadPurchaseChangeTest() {
+
+        Master master = new Master();
+        master.setMa_user("UAS");
+        master.setMa_uu(10041166L);
+        master.setMa_accesssecret("2c1ea0898633796fe050007f01002ea6");
+        master.setMa_env("test");
+        master.setMa_name("UAS");
+
+        ContextHolder.setMaster(master);
+        purchaseNotifyTask.downloadAcceptNotify();
+    }
+
+    // 胜芳SAAS_10041559
+    @Test
+    public void uploadPurchaseChangeTestSF() {
+
+        Master master = new Master();
+        master.setMa_user("SAAS_10041559");
+        master.setMa_uu(10041559L);
+        master.setMa_accesssecret("2c1ea089876b796fe050007f01002ea6");
+        master.setMa_env("test");
+        master.setMa_name("SAAS_10041559");
+
+        ContextHolder.setMaster(master);
+        purchaseTask.downloadhasIssued();
+    }
+
+    //天派电子
+    @Test
+    public void uploadPurchaseChangeTestTianPai() {
+
+        Master master = new Master();
+        master.setMa_user("skypine_el");
+        master.setMa_uu(10006098L);
+        master.setMa_accesssecret("2c1ea0898035796fe050007f01002ea6");
+        master.setMa_env("prod");
+        master.setMa_name("skypine_el");
+        ContextHolder.setMaster(master);
+        purchaseTask.uploadPurchase();
+    }
+
+    //欧盛
+    @Test
+    public void uploadPurchaseChangeTestOusheng() {
+
+        Master master = new Master();
+        master.setMa_user("OSAUTO");
+        master.setMa_uu(10046539L);
+        master.setMa_accesssecret("aff1d9aac85042a491b21ef3d382abd1");
+        master.setMa_env("prod");
+        master.setMa_name("OSAUTO");
+        ContextHolder.setMaster(master);
+        purchaseTask.uploadPurchase();
+    }
+
+    //英唐智控
+    @Test
+    public void uploadPurchaseChangeTestYt() {
+
+        Master master = new Master();
+        master.setMa_user("YITOA_INTCON");
+        master.setMa_uu(10041961L);
+        master.setMa_accesssecret("2c1ea08988a6796fe050007f01002ea6");
+        master.setMa_env("prod");
+        master.setMa_name("YITOA_INTCON");
+        ContextHolder.setMaster(master);
+        saleProdInOutDownTask.downloadSaleProdInOut();
+    }
+
+    //漳州万利达
+    @Test
+    public void uploadPurchaseChangeTestZZ() {
+
+        Master master = new Master();
+        master.setMa_user("N_MALATA_ZZ");
+        master.setMa_uu(10048097L);
+        master.setMa_accesssecret("6952e099cb75a780e050007f01000762");
+        master.setMa_env("prod");
+        master.setMa_name("N_MALATA_ZZ");
+        ContextHolder.setMaster(master);
+        purchaseProdInOutTask.uploadProdInOut();
+    }
+
+    //深圳华商龙
+    @Test
+    public void uploadPurchaseChangeTestHSL() {
+
+        Master master = new Master();
+        master.setMa_user("N_HUASL_SZ");
+        master.setMa_uu(10000666L);
+        master.setMa_accesssecret("2c1ea0897c1a796fe050007f01002ea6");
+        master.setMa_env("prod");
+        master.setMa_name("N_HUASL_SZ");
+        ContextHolder.setMaster(master);
+        orderCheckTask.checkSaleMain();
+    }
+
+    //香港华商龙
+    @Test
+    public void uploadPurchaseChangeTestHKHSL() {
+
+        Master master = new Master();
+        master.setMa_user("N_HUASL");
+        master.setMa_uu(10041191L);
+        master.setMa_accesssecret("2c1ea0898649796fe050007f01002ea6");
+        master.setMa_env("prod");
+        master.setMa_name("N_HUASL");
+        ContextHolder.setMaster(master);
+        prodTask.uploadProduct();
+    }
+
+    //数码科技
+    @Test
+    public void uploadPurchaseChangeTestYITOA_TECHNO() {
+
+        Master master = new Master();
+        master.setMa_user("YITOA_TECHNO");
+        master.setMa_uu(10044101L);
+        master.setMa_accesssecret("1d6824b48a2a437eb3c810b59659ccbc");
+        master.setMa_env("prod");
+        master.setMa_name("YITOA_TECHNO");
+        ContextHolder.setMaster(master);
+        saleAPCheckTask.downloadSaleARCheck();
+    }
+
+    @Test
+    public void test() {
+        for (int i = 0;i < 10;i++) {
+            uploadPurchaseChangeTestHKHSL();
+        }
+    }
+}