Browse Source

feat(收料通知):收料通知同步发货单明细id

Hu Jie 7 years ago
parent
commit
c067255e28

+ 0 - 1
src/main/java/com/uas/erp/schedular/b2b/domain/AcceptNotify.java

@@ -35,7 +35,6 @@ public class AcceptNotify extends KeyEntity{
 		this.b2b_ss_id = b2b_ss_id;
 	}
 
-	@JsonIgnore
 	public Integer getAn_id() {
 		return an_id;
 	}

+ 20 - 2
src/main/java/com/uas/erp/schedular/b2b/domain/AcceptNotifyDetail.java

@@ -10,6 +10,7 @@ import com.uas.erp.schedular.util.StringUtil;
  */
 public class AcceptNotifyDetail {
 
+	private Long b2b_si_id;
 	private short and_detno;
 	private String and_ordercode;
 	private Short and_orderdetno;
@@ -17,6 +18,15 @@ public class AcceptNotifyDetail {
 	private Double and_inqty;
 	private Double and_price;
 	private String and_remark;
+	private Long and_id;
+
+	public Long getB2b_si_id() {
+		return b2b_si_id;
+	}
+
+	public void setB2b_si_id(Long b2b_si_id) {
+		this.b2b_si_id = b2b_si_id;
+	}
 
 	public short getAnd_detno() {
 		return and_detno;
@@ -74,8 +84,16 @@ public class AcceptNotifyDetail {
 		this.and_price = and_price;
 	}
 
+	public Long getAnd_id() {
+		return and_id;
+	}
+
+	public void setAnd_id(Long and_id) {
+		this.and_id = and_id;
+	}
+
 	public String toSqlString(int foreignKey) {
-		return "insert into AcceptNotifyDetail(and_id,and_anid,and_detno,and_ordercode,and_orderdetno,and_inqty,and_b2bqty,and_remark,and_price,and_pnid) values (AcceptNotifyDetail_seq.nextval,"
+		return "insert into AcceptNotifyDetail(and_id,and_anid,and_detno,and_ordercode,and_orderdetno,and_inqty,and_b2bqty,and_remark,and_price,and_pnid,b2b_si_id) values (AcceptNotifyDetail_seq.nextval,"
 				+ foreignKey
 				+ ","
 				+ and_detno
@@ -88,7 +106,7 @@ public class AcceptNotifyDetail {
 				+ ","
 				+ and_inqty
 				+ ",'"
-				+ StringUtil.nvl(and_remark, "") + "'," + and_price + "," + this.and_pnid + ")";
+				+ StringUtil.nvl(and_remark, "") + "'," + and_price + "," + this.and_pnid + "," + this.b2b_si_id + ")";
 	}
 
 }

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

@@ -11,6 +11,7 @@ import com.uas.erp.schedular.util.ContextHolder;
 import com.uas.erp.schedular.util.DateUtil;
 import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
 
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -142,10 +143,29 @@ public class PurchaseNotifyTask extends AbstractTask {
         List<AcceptNotify> accepts = getAcceptNotify();
         if (!CollectionUtils.isEmpty(accepts)) {
             ContextHolder.setDataSize(accepts.size());
-            post("/erp/purchase/notice/accept", dataWrap(accepts));
-            // 修改状态
-            String idStr = CollectionUtil.getKeyString(accepts);
-            jdbcTemplate.execute("update AcceptNotify set an_sendstatus='已下载' where an_id in(" + idStr + ")");
+            List<AcceptNotify> acceptNotifies = postForList("/erp/purchase/notice/accept", AcceptNotify.class, dataWrap(accepts));
+            if (!CollectionUtils.isEmpty(acceptNotifies)) {
+                List<String> sqlList = new ArrayList<>();
+                for (AcceptNotify acceptNotify : acceptNotifies) {
+                    if (!StringUtils.isEmpty(acceptNotify.getB2b_ss_id())) {
+                        sqlList.add("update AcceptNotify set an_sendstatus='已下载', b2b_ss_id = " + acceptNotify.getB2b_ss_id() + " where an_id = " + acceptNotify.getAn_id());
+                        List<AcceptNotifyDetail> details = acceptNotify.getDetails();
+                        if (!CollectionUtils.isEmpty(details)) {
+                            for (AcceptNotifyDetail detail : details) {
+                                if (!StringUtils.isEmpty(detail.getB2b_si_id())) {
+                                    sqlList.add("update AcceptNotifyDetail set b2b_si_id = " + detail.getB2b_si_id() + " where and_id = " + detail.getAnd_id());
+                                }
+                            }
+                        }
+                    }
+                }
+                if (!CollectionUtils.isEmpty(sqlList)) {
+                    jdbcTemplate.batchExecute(sqlList);
+                }
+            }
+//            // 修改状态
+//            String idStr = CollectionUtil.getKeyString(accepts);
+//            jdbcTemplate.execute("update AcceptNotify set an_sendstatus='已下载' where an_id in(" + idStr + ")");
         }
     }