hejq před 8 roky
rodič
revize
ea85f08b91

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

@@ -23,8 +23,54 @@ public class PurchaseDetail {
 	private String pd_vendspec;
 	private Integer pd_beipin;
 	private String pd_prattach;
+	//终端供应商名称
+	private String pd_purcvendname;
+	//终端供应商uu
+	private Long pd_purcvenduu;
+	//客户采购订单号
+	private String pd_custpurchasecode;
+	//客户采购订单序号
+	private Short pd_custpurchasedetno;
+	//收货客户
+	private String pd_acceptcustname;
+	//收货地址
+	private String pd_acceptcustaddress;
+	//收货客户uu
+	private Long pd_acceptcustuu;
+	//是否能发货
+	private String pd_hasissued;
+	//终端价格
+	private Float pd_purcprice;
+	//终端税率
+	private Float pd_purctaxrate;
+	//终端币别
+	private String pd_purccurrency;
 	private List<Attach> attaches;
 
+	public Float getPd_purcprice() {
+		return pd_purcprice;
+	}
+
+	public void setPd_purcprice(Float pd_purcprice) {
+		this.pd_purcprice = pd_purcprice;
+	}
+
+	public Float getPd_purctaxrate() {
+		return pd_purctaxrate;
+	}
+
+	public void setPd_purctaxrate(Float pd_purctaxrate) {
+		this.pd_purctaxrate = pd_purctaxrate;
+	}
+
+	public String getPd_purccurrency() {
+		return pd_purccurrency;
+	}
+
+	public void setPd_purccurrency(String pd_purccurrency) {
+		this.pd_purccurrency = pd_purccurrency;
+	}
+
 	public String getPd_vendspec() {
 		return pd_vendspec;
 	}
@@ -33,6 +79,22 @@ public class PurchaseDetail {
 		this.pd_vendspec = pd_vendspec;
 	}
 
+	public Long getPd_acceptcustuu() {
+		return pd_acceptcustuu;
+	}
+
+	public void setPd_acceptcustuu(Long pd_acceptcustuu) {
+		this.pd_acceptcustuu = pd_acceptcustuu;
+	}
+
+	public String getPd_hasissued() {
+		return pd_hasissued;
+	}
+
+	public void setPd_hasissued(String pd_hasissued) {
+		this.pd_hasissued = pd_hasissued;
+	}
+
 	public String getPd_factory() {
 		return pd_factory;
 	}
@@ -128,4 +190,53 @@ public class PurchaseDetail {
 	public void setAttaches(List<Attach> attaches) {
 		this.attaches = attaches;
 	}
+
+	public String getPd_purcvendname() {
+		return pd_purcvendname;
+	}
+
+	public void setPd_purcvendname(String pd_purcvendname) {
+		this.pd_purcvendname = pd_purcvendname;
+	}
+
+	public Long getPd_purcvenduu() {
+		return pd_purcvenduu;
+	}
+
+	public void setPd_purcvenduu(Long pd_purcvenduu) {
+		this.pd_purcvenduu = pd_purcvenduu;
+	}
+
+	public String getPd_custpurchasecode() {
+		return pd_custpurchasecode;
+	}
+
+	public void setPd_custpurchasecode(String pd_custpurchasecode) {
+		this.pd_custpurchasecode = pd_custpurchasecode;
+	}
+
+	public Short getPd_custpurchasedetno() {
+		return pd_custpurchasedetno;
+	}
+
+	public void setPd_custpurchasedetno(Short pd_custpurchasedetno) {
+		this.pd_custpurchasedetno = pd_custpurchasedetno;
+	}
+
+	public String getPd_acceptcustname() {
+		return pd_acceptcustname;
+	}
+
+	public void setPd_acceptcustname(String pd_acceptcustname) {
+		this.pd_acceptcustname = pd_acceptcustname;
+	}
+
+	public String getPd_acceptcustaddress() {
+		return pd_acceptcustaddress;
+	}
+
+	public void setPd_acceptcustaddress(String pd_acceptcustaddress) {
+		this.pd_acceptcustaddress = pd_acceptcustaddress;
+	}
+
 }

+ 14 - 2
src/main/java/com/uas/erp/schedular/b2b/domain/PurchaseNotify.java

@@ -19,8 +19,12 @@ public class PurchaseNotify extends KeyEntity{
 	private Short pn_orderdetno;
 	private String pn_remark;
 	private Double pn_endqty;
-	private Double pr_zxbzs;// 物料最小包装数
-	private Long pn_b2bid; //b2bid
+	// 物料最小包装数
+	private Double pr_zxbzs;
+	//b2bid
+	private Long pn_b2bid;
+	//终端供应商,为0表示正常送货提醒
+	private Long pn_terminalvenduu;
 
 	public int getPn_id() {
 		return pn_id;
@@ -110,6 +114,14 @@ public class PurchaseNotify extends KeyEntity{
 		this.pn_b2bid = pn_b2bid;
 	}
 
+	public Long getPn_terminalvenduu() {
+		return pn_terminalvenduu;
+	}
+
+	public void setPn_terminalvenduu(Long pn_terminalvenduu) {
+		this.pn_terminalvenduu = pn_terminalvenduu;
+	}
+
 	@Override
 	public Object getKey() {
 		return pn_id;

+ 110 - 3
src/main/java/com/uas/erp/schedular/b2b/domain/SaleDownDetail.java

@@ -26,6 +26,56 @@ public class SaleDownDetail {
 	private Double sd_taxtotal;
 	private String sd_factory;
 	private String sd_remark;
+	//终端供应商名称
+	private String sd_purcvendname;
+	//终端供应商uu
+	private Long sd_purcvenduu;
+	//客户采购订单序号
+	private Short sd_purcdetno;
+	//收货客户
+	private String sd_acceptcustname;
+	//收货地址
+	private String sd_acceptcustaddress;
+	//终端供应商编号
+	private String sd_purcvendcode;
+	//终端单价
+	private Float sd_SpecPrice;
+	//终端税率
+	private Float sd_SpecTaxRate;
+	//终端币别
+	private String sd_SpecCurrency;
+
+	public Float getSd_SpecPrice() {
+		return sd_SpecPrice;
+	}
+
+	public void setSd_SpecPrice(Float sd_SpecPrice) {
+		this.sd_SpecPrice = sd_SpecPrice;
+	}
+
+	public Float getSd_SpecTaxRate() {
+		return sd_SpecTaxRate;
+	}
+
+	public void setSd_SpecTaxRate(Float sd_SpecTaxRate) {
+		this.sd_SpecTaxRate = sd_SpecTaxRate;
+	}
+
+	public String getSd_SpecCurrency() {
+		return sd_SpecCurrency;
+	}
+
+	public void setSd_SpecCurrency(String sd_SpecCurrency) {
+		this.sd_SpecCurrency = sd_SpecCurrency;
+	}
+
+	public String getSd_purcvendcode() {
+		return sd_purcvendcode;
+	}
+
+	public void setSd_purcvendcode(String sd_purcvendcode) {
+		this.sd_purcvendcode = sd_purcvendcode;
+	}
 
 	public long getB2b_pd_id() {
 		return b2b_pd_id;
@@ -171,10 +221,50 @@ public class SaleDownDetail {
 		this.sd_remark = sd_remark;
 	}
 
+	public String getSd_purcvendname() {
+		return sd_purcvendname;
+	}
+
+	public void setSd_purcvendname(String sd_purcvendname) {
+		this.sd_purcvendname = sd_purcvendname;
+	}
+
+	public Long getSd_purcvenduu() {
+		return sd_purcvenduu;
+	}
+
+	public void setSd_purcvenduu(Long sd_purcvenduu) {
+		this.sd_purcvenduu = sd_purcvenduu;
+	}
+
+	public Short getSd_purcdetno() {
+		return sd_purcdetno;
+	}
+
+	public void setSd_purcdetno(Short sd_purcdetno) {
+		this.sd_purcdetno = sd_purcdetno;
+	}
+
+	public String getSd_acceptcustname() {
+		return sd_acceptcustname;
+	}
+
+	public void setSd_acceptcustname(String sd_acceptcustname) {
+		this.sd_acceptcustname = sd_acceptcustname;
+	}
+
+	public String getSd_acceptcustaddress() {
+		return sd_acceptcustaddress;
+	}
+
+	public void setSd_acceptcustaddress(String sd_acceptcustaddress) {
+		this.sd_acceptcustaddress = sd_acceptcustaddress;
+	}
+
 	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_taxtotal,sd_delivery,sd_remark) VALUES ("
+				+ "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 ("
 				+ b2b_pd_id
 				+ ",SaleDownDetail_SEQ.nextval,"
 				+ foreignKey
@@ -209,11 +299,28 @@ public class SaleDownDetail {
 				+ ","
 				+ NumberUtil.nvl(sd_taxrate, 0)
 				+ ","
+				+ NumberUtil.nvl(sd_SpecPrice, 0)
+				+ ","
+				+ NumberUtil.nvl(sd_SpecTaxRate, 0)
+				+ ",'"
+				+ StringUtil.nvl(sd_SpecCurrency, "")
+				+ "',"
 				+ NumberUtil.nvl(sd_taxtotal, 0)
 				+ ","
 				+ (sd_delivery == null ? "null" : DateUtil.parseDateToOracleString(null, sd_delivery))
 				+ ",'"
-				+ sd_remark +"')";
+				+ sd_remark
+				+ "','"
+				+sd_purcvendname
+				+ "',"
+				+sd_purcvenduu
+				+ ","
+				+sd_purcdetno
+				+ ",'"
+				+StringUtil.nvl(sd_acceptcustname, "")
+				+ "','"
+				+StringUtil.nvl(sd_acceptcustaddress, "")
+				+"',(select ve_code from vendor where ve_uu="+sd_purcvenduu+" and rownum=1))";
 	}
 
 }

+ 12 - 2
src/main/java/com/uas/erp/schedular/b2b/domain/SaleProdInOutDown.java

@@ -24,8 +24,18 @@ public class SaleProdInOutDown {
 	private String pi_inoutman;//过账人
 	private Date pi_date1;//过账日期
 	private String pi_remark;//备注
+	private String pi_class; //出入库单据类型
+
 	private List<SaleProdInOutDownDetail> details;//明细
-	
+
+
+	public String getPi_class() {
+		return pi_class;
+	}
+
+	public void setPi_class(String pi_class) {
+		this.pi_class = pi_class;
+	}
 	public Long getPi_b2bid() {
 		return pi_b2bid;
 	}
@@ -240,7 +250,7 @@ public class SaleProdInOutDown {
 				+ ", '"
 				+ StringUtil.nvl(this.pi_remark, "")
 				+ "', '"
-				+ "客户不良品出库单"
+				+ this.pi_class
 				+ "', "
 				+ "sysdate" 
 				+ ", '"

+ 10 - 1
src/main/java/com/uas/erp/schedular/b2b/domain/SaleProdInOutDownDetail.java

@@ -19,6 +19,15 @@ public class SaleProdInOutDownDetail {
 	private Double pd_taxrate;//税率
 	private String pd_batchcode;//批号
 	private String pd_remark;//备注
+	private String pd_piclass; //出入库单据类型
+	public String getPd_piclass() {
+		return pd_piclass;
+	}
+
+	public void setPd_piclass(String pd_piclass) {
+		this.pd_piclass = pd_piclass;
+	}
+
 	public Long getPd_b2bid() {
 		return pd_b2bid;
 	}
@@ -202,7 +211,7 @@ public class SaleProdInOutDownDetail {
 				+ "', '"
 				+ StringUtil.nvl(this.pd_remark, "")
 				+ "', '"
-				+ "客户不良品出库单"
+				+ this.pd_piclass
 				+ "'"
 				+ ")";
 	}

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

@@ -97,6 +97,38 @@ public class PurchaseTask extends AbstractTask {
         }
     }
 
+    @TaskMapping(title = "从平台下载更新代采订单可发货状态", fixedDelay = 30000, method = Method.DOWNLOAD)
+    public void downloadhasIssued() {
+        List<PurchaseDetail> issued = getForList("/erp/purchase/issued", PurchaseDetail.class);
+        if (!CollectionUtils.isEmpty(issued)) {
+            ContextHolder.setDataSize(issued.size());
+            savePurchaseIssued(issued);
+            // 回执
+            onIssuedSuccess(issued);
+            // TODO notice++
+        }
+    }
+
+    /**
+     * 更新可发货状态
+     * @param issued
+     */
+    private void savePurchaseIssued(List<PurchaseDetail> issued) {
+        List<String> sqls = new ArrayList<String>();
+        for (PurchaseDetail detail : issued) {
+            sqls.add("update purchasedetail set pd_hasissued = '是' where pd_detno="+detail.getPd_custpurchasedetno()+" and pd_puid=(select pu_id from purchase where pu_code='"+detail.getPd_custpurchasecode()+"')");
+        }
+        jdbcTemplate.batchExecute(sqls);
+    }
+
+    /**
+     * 回执给平台
+     * @param issued
+     */
+    private void onIssuedSuccess(List<PurchaseDetail> issued) {
+        post("/erp/purchase/issued/back", dataWrap(issued));
+    }
+
     /**
      * 保存回复记录,并更新到采购单明细
      *

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

@@ -83,9 +83,11 @@ public class SaleProdInOutDownTask extends AbstractTask {
             int count = jdbcTemplate.count("from prodiodown where pi_class=? and pi_b2bid=?", pi_class, prodInOutDown.getPi_b2bid());
             if (count == 0) {
                 int sioId = jdbcTemplate.generate("prodiodown_SEQ");// 获取主键序列
+                prodInOutDown.setPi_class(pi_class);
                 sqls.add(prodInOutDown.toBadOutSql(sioId));// 插入主记录
                 if (!CollectionUtils.isEmpty(prodInOutDown.getDetails())) {
                     for (SaleProdInOutDownDetail detail : prodInOutDown.getDetails()) {
+                        detail.setPd_piclass(pi_class);
                         sqls.add(detail.toBadOutSql(sioId));// 插入明细记录
                     }
                 }

+ 1 - 1
src/main/java/com/uas/erp/schedular/database/RestJdbcTemplate.java

@@ -32,7 +32,7 @@ public class RestJdbcTemplate {
     private SettingService settingService;
 
     private String getUrl() {
-        return settingService.getValue("api.database.url");
+        return settingService.getValue("api.database.url") == null ? "http://127.0.0.1:9002/uas_database" : settingService.getValue("api.database.url");
     }
 
     /**