|
|
@@ -0,0 +1,71 @@
|
|
|
+package com.uas.eis.task;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.uas.eis.config.DonlimConfig;
|
|
|
+import com.uas.eis.dao.BaseDao;
|
|
|
+import com.uas.eis.dao.SqlRowList;
|
|
|
+import com.uas.eis.dto.InventoryReq;
|
|
|
+import com.uas.eis.dto.InventoryResp;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.HttpHeaders;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+@Component
|
|
|
+public class InventoryTask extends BaseTask{
|
|
|
+ @Autowired
|
|
|
+ private DonlimConfig donlimConfig;
|
|
|
+ @Autowired
|
|
|
+ private BaseDao baseDao;
|
|
|
+
|
|
|
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
+ public void execute() {
|
|
|
+ Object ob=baseDao.getFieldDataByCondition("DOCKING_XB_WH_CHANGE","max(ID_)","NVL(DEALSTATE,0)=0");
|
|
|
+ if(ob!=null){
|
|
|
+ try{
|
|
|
+ String Sql = "select * from DOCKING_Inventory where YM_VIEW_PARAM.SET_ID_("+ob+")<="+ob+" order by WAREHOUSENO, MATERIALNO";
|
|
|
+ SqlRowList rs = baseDao.queryForRowSet(Sql);
|
|
|
+ while (rs.next()) {
|
|
|
+ JSONObject jsonobj=new JSONObject();
|
|
|
+ jsonobj.put("supplyCode", donlimConfig.getSupplyCode());
|
|
|
+ jsonobj.put("supplyName", donlimConfig.getSupplyName());
|
|
|
+ jsonobj.put("warehouseNo", rs.getGeneralString("warehouseNo"));
|
|
|
+ jsonobj.put("warehouseName", rs.getGeneralString("warehouseName"));
|
|
|
+ jsonobj.put("materialNo", rs.getGeneralString("materialNo"));
|
|
|
+ jsonobj.put("materialName", rs.getGeneralString("materialName"));
|
|
|
+ jsonobj.put("materialSpecification", rs.getGeneralString("materialSpecification"));
|
|
|
+ jsonobj.put("stockNum", rs.getGeneralInt("stockNum"));
|
|
|
+ jsonobj.put("updateTime", rs.getGeneralString("updateTime"));
|
|
|
+ jsonobj.put("bakOne", rs.getGeneralString("bakOne"));
|
|
|
+ jsonobj.put("bakTwo", rs.getGeneralString("bakTwo"));
|
|
|
+ jsonobj.put("bakThree", rs.getGeneralString("bakThree"));
|
|
|
+ jsonobj.put("bakFour", rs.getGeneralString("bakFour"));
|
|
|
+
|
|
|
+ InventoryReq req= new InventoryReq();
|
|
|
+ req.setSupplyCode(donlimConfig.getSupplyCode());
|
|
|
+ req.configSign();
|
|
|
+ req.setData(jsonobj);
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
+ ResponseEntity<InventoryResp> resp = restTemplate.postForEntity(donlimConfig.getRoute()+"/wms/inventory", configHttpEntity(req), InventoryResp.class);
|
|
|
+ assertOK(resp);
|
|
|
+ logger.info("Inventory code {} ,msg {} ",resp.getBody().getCode(),resp.getBody().getMsg());
|
|
|
+ }
|
|
|
+ baseDao.execute("update DOCKING_XB_WH_CHANGE set dealdate_=sysdate ,DEALSTATE=1 where ID_<="+ob+" and NVL(DEALSTATE,0)=0");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*else{
|
|
|
+ logger.info("InventoryTask 无数据变更,无须对接 ");
|
|
|
+ }*/
|
|
|
+ }
|
|
|
+}
|