Explorar o código

批量价格修改增加采购验退、委外验收、委外验退单上传

hejq %!s(int64=7) %!d(string=hai) anos
pai
achega
6fbeb0c3a7

+ 65 - 9
src/main/java/com/uas/erp/schedular/b2b/domain/ProdInOutRefreshPrice.java

@@ -1,43 +1,99 @@
 package com.uas.erp.schedular.b2b.domain;
 
+/**
+ * 批量更新采购单价
+ */
 public class ProdInOutRefreshPrice extends KeyEntity {
 
-	private Short pbu_pdno;// 明细行序号
-	private String pbu_inoutno; // 单据编号
-	private Double pbu_orderprice;// 采购成本
-	private Long pbu_id; //erpid
-	private String pbu_piclass;// 单据类型
+	/**
+	 * 明细行序号
+	 */
+	private Short pbu_pdno;
+
+	/**
+	 * 单据编号
+	 */
+	private String pbu_inoutno;
+
+	/**
+	 * 采购成本
+	 */
+	private Double pbu_orderprice;
+
+	/**
+	 * 税率
+	 */
+	private Double pbu_taxrate;
+
+	/**
+	 *  erpid
+	 */
+	private Long pbu_id;
+
+	/**
+	 * 物料编号
+	 */
+	private String pd_prodcode;
+
+	/**
+	 * 订单序号
+	 */
+	private Short pd_orderdetno;
+
 	public Short getPbu_pdno() {
 		return pbu_pdno;
 	}
+
 	public void setPbu_pdno(Short pbu_pdno) {
 		this.pbu_pdno = pbu_pdno;
 	}
+
 	public String getPbu_inoutno() {
 		return pbu_inoutno;
 	}
+
 	public void setPbu_inoutno(String pbu_inoutno) {
 		this.pbu_inoutno = pbu_inoutno;
 	}
+
 	public Double getPbu_orderprice() {
 		return pbu_orderprice;
 	}
+
 	public void setPbu_orderprice(Double pbu_orderprice) {
 		this.pbu_orderprice = pbu_orderprice;
 	}
+
+	public Double getPbu_taxrate() {
+		return pbu_taxrate;
+	}
+
+	public void setPbu_taxrate(Double pbu_taxrate) {
+		this.pbu_taxrate = pbu_taxrate;
+	}
+
 	public Long getPbu_id() {
 		return pbu_id;
 	}
+
 	public void setPbu_id(Long pbu_id) {
 		this.pbu_id = pbu_id;
 	}
 
-	public String getPbu_piclass() {
-		return pbu_piclass;
+	public String getPd_prodcode() {
+		return pd_prodcode;
+	}
+
+	public void setPd_prodcode(String pd_prodcode) {
+		this.pd_prodcode = pd_prodcode;
+	}
+
+	public Short getPd_orderdetno() {
+		return pd_orderdetno;
 	}
 
-	public void setPbu_piclass(String pbu_piclass) {
-		this.pbu_piclass = pbu_piclass;
+	public void setPd_orderdetno(Short pd_orderdetno) {
+		this.pd_orderdetno = pd_orderdetno;
 	}
 
 	@Override

+ 35 - 20
src/main/java/com/uas/erp/schedular/b2b/task/PurchaseProdInOutTask.java

@@ -178,56 +178,71 @@ public class PurchaseProdInOutTask extends AbstractTask {
         }
     }
 
+    private final String TYPE_PURC_ACCETP = "采购验收单";
+    private final String TYPE_PURC_RETURN = "采购验退单";
+    private final String TYPE_MAKE_ACCETP = "委外验收单";
+    private final String TYPE_MAKE_RETURN = "委外验退单";
+
     @TaskMapping(title = "批量更新采购验收单明细单价", fixedDelay = 60000)
     public void uploadUpdatePriceByBatch() {
-        List<ProdInOutRefreshPrice> prods = jdbcTemplate.queryForBeanList("select pbu_pdno,pbu_inoutno,pbu_orderprice,pbu_id from PriceBatchUpdate where pbu_piclass = '采购验收单' and pbu_status = '99' and pbu_sendstatus = '待上传' and rownum < 200",
-                ProdInOutRefreshPrice.class);
+        List<ProdInOutRefreshPrice> prods = getPriceBatchUpdate(TYPE_PURC_ACCETP);
         if (!CollectionUtils.isEmpty(prods)) {
             ContextHolder.setDataSize(prods.size());
             post("/erp/purchase/prodInOut/refreshPrice", dataWrap(prods));
-            // 更新状态
-            String idStr = CollectionUtil.getKeyString(prods);
-            jdbcTemplate.execute("update PriceBatchUpdate set pbu_sendstatus='已上传' where pbu_id in (" + idStr + ")");
+            updateSendStatus(prods);
         }
     }
 
     @TaskMapping(title = "批量更新采购验退单明细单价", fixedDelay = 60000)
     public void uploadUpdatePurcReturnPriceByBatch() {
-        List<ProdInOutRefreshPrice> prods = jdbcTemplate.queryForBeanList("select pbu_pdno,pbu_inoutno,pbu_orderprice,pbu_id from PriceBatchUpdate where pbu_piclass = '采购验退单' and pbu_status = '99' and pbu_sendstatus = '待上传' and rownum < 200",
-                ProdInOutRefreshPrice.class);
+        List<ProdInOutRefreshPrice> prods = getPriceBatchUpdate(TYPE_PURC_RETURN);
         if (!CollectionUtils.isEmpty(prods)) {
             ContextHolder.setDataSize(prods.size());
             post("/erp/purchase/prodInOut/refreshPrice/purc/return", dataWrap(prods));
-            // 更新状态
-            String idStr = CollectionUtil.getKeyString(prods);
-            jdbcTemplate.execute("update PriceBatchUpdate set pbu_sendstatus='已上传' where pbu_id in (" + idStr + ")");
+            updateSendStatus(prods);
         }
     }
 
     @TaskMapping(title = "批量更新委外验收单明细单价", fixedDelay = 60000)
     public void uploadUpdateMakeAcceptPriceByBatch() {
-        List<ProdInOutRefreshPrice> prods = jdbcTemplate.queryForBeanList("select pbu_pdno,pbu_inoutno,pbu_orderprice,pbu_id from PriceBatchUpdate where pbu_piclass = '委外验收单' and pbu_status = '99' and pbu_sendstatus = '待上传' and rownum < 200",
-                ProdInOutRefreshPrice.class);
+        List<ProdInOutRefreshPrice> prods = getPriceBatchUpdate(TYPE_MAKE_ACCETP);
         if (!CollectionUtils.isEmpty(prods)) {
             ContextHolder.setDataSize(prods.size());
             post("/erp/purchase/prodInOut/refreshPrice/make/accept", dataWrap(prods));
-            // 更新状态
-            String idStr = CollectionUtil.getKeyString(prods);
-            jdbcTemplate.execute("update PriceBatchUpdate set pbu_sendstatus='已上传' where pbu_id in (" + idStr + ")");
+            updateSendStatus(prods);
         }
     }
 
     @TaskMapping(title = "批量更新委外验退单明细单价", fixedDelay = 60000)
     public void uploadUpdateMakeReutrnPriceByBatch() {
-        List<ProdInOutRefreshPrice> prods = jdbcTemplate.queryForBeanList("select pbu_pdno,pbu_inoutno,pbu_orderprice,pbu_id from PriceBatchUpdate where pbu_piclass = '委外验退单' and pbu_status = '99' and pbu_sendstatus = '待上传' and rownum < 200",
-                ProdInOutRefreshPrice.class);
+        List<ProdInOutRefreshPrice> prods = getPriceBatchUpdate(TYPE_MAKE_RETURN);
         if (!CollectionUtils.isEmpty(prods)) {
             ContextHolder.setDataSize(prods.size());
             post("/erp/purchase/prodInOut/refreshPrice/make/return", dataWrap(prods));
-            // 更新状态
-            String idStr = CollectionUtil.getKeyString(prods);
-            jdbcTemplate.execute("update PriceBatchUpdate set pbu_sendstatus='已上传' where pbu_id in (" + idStr + ")");
+            updateSendStatus(prods);
         }
     }
 
+    /**
+     * 获取批量更新单价的待上传的单据
+     *
+     * @param type 单据类型
+     * @return
+     */
+    List<ProdInOutRefreshPrice> getPriceBatchUpdate(String type) {
+        String sql = "select pbu_pdNo,pbu_inoutNo,pbu_orderPrice,pbu_id,pbu_taxRate,pd_prodCode,pd_orderDetNo from PriceBatchUpdate " +
+                "left join prodIoDetail on pbu_pdId = pd_id " +
+                "where pbu_piClass = '" + type + "' and pbu_status = '99' and pbu_sendStatus = '待上传' and rowNum < 200";
+        return jdbcTemplate.queryForBeanList(sql, ProdInOutRefreshPrice.class);
+    }
+
+    /**
+     * 上传之后更新状态
+     *
+     * @param prods
+     */
+    private void updateSendStatus(List<ProdInOutRefreshPrice> prods) {
+        String idStr = CollectionUtil.getKeyString(prods);
+        jdbcTemplate.execute("update PriceBatchUpdate set pbu_sendstatus='已上传' where pbu_id in (" + idStr + ")");
+    }
 }