Commit 570ac0af authored by tank.li@mushiny.com's avatar tank.li@mushiny.com

拣货任务完善,出库单与系统绑定 完成后反馈

parent 5082c6fd
package com.mushiny.heli.xnr.controller;
import com.mushiny.heli.xnr.comm.JsonUtils;
import com.mushiny.heli.xnr.dto.ItemDTO;
import com.mushiny.heli.xnr.dto.MessageDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 用于模拟合力WMS接收
*/
@RestController
@RequestMapping("/heli")
public class HeliWMSController {
private final static Logger logger = LoggerFactory.getLogger(HeliWMSController.class);
@PostMapping(value = "/icqaResp", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<MessageDTO> syncItem(
@RequestBody String json){
logger.debug("icqaResp: " + json);
MessageDTO dto = MessageDTO.success();
return ResponseEntity.ok(dto);
}
}
...@@ -203,4 +203,9 @@ public interface Sql_Table { ...@@ -203,4 +203,9 @@ public interface Sql_Table {
" AND MD_ITEMDATA.ITEM_NO=MD_ITEMDATA_SKUNO.ITEM_NO \n" + " AND MD_ITEMDATA.ITEM_NO=MD_ITEMDATA_SKUNO.ITEM_NO \n" +
" AND MD_ITEMDATA_SKUNO.SKU_NO = ? \n" + " AND MD_ITEMDATA_SKUNO.SKU_NO = ? \n" +
" AND MD_STORAGELOCATION.NAME = ? LIMIT 1"; " AND MD_STORAGELOCATION.NAME = ? LIMIT 1";
String SQL_QUERY_ICQA_POSFINISH = "SELECT * FROM WMS_ICQA_ORDER WHERE NOT EXISTS \n" +
" (SELECT 1 FROM WMS_ICQA_ORDERPOSITION \n" +
" WHERE WMS_ICQA_ORDERPOSITION.TASKID=WMS_ICQA_ORDER.TASKID\n" +
" AND WMS_ICQA_ORDERPOSITION.STATE<>'Finish') \n" +
" AND WMS_ICQA_ORDER.STATE<>'Finish'";
} }
package com.mushiny.heli.xnr.service; package com.mushiny.heli.xnr.service;
import com.mushiny.heli.xnr.beans.BaseBpo;
import com.mushiny.heli.xnr.comm.CommonUtils; import com.mushiny.heli.xnr.comm.CommonUtils;
import com.mushiny.heli.xnr.comm.JsonUtils; import com.mushiny.heli.xnr.comm.JsonUtils;
import com.mushiny.heli.xnr.dto.InboundOrderDTO; import com.mushiny.heli.xnr.dto.InboundOrderDTO;
...@@ -84,13 +85,13 @@ public class WMSRespService { ...@@ -84,13 +85,13 @@ public class WMSRespService {
HttpHeaders headers = this.getHttpHeaders(); HttpHeaders headers = this.getHttpHeaders();
List<Map> data = this.jdbcRepository.queryBySql(SQL_QUERYALL_ICQAORDER,FINISH); List<Map> data = this.jdbcRepository.queryBySql(SQL_QUERYALL_ICQAORDER,FINISH);
List<InboundOrderDTO> data2 = this.transfer2InDTO(data);//合并主表记录 List<InboundOrderDTO> data2 = this.transfer2IcqaDTO(data);//合并主表记录
for (int i = 0; i < data2.size(); i++) { for (int i = 0; i < data2.size(); i++) {
InboundOrderDTO inboundOrderDTO = data2.get(i); InboundOrderDTO inboundOrderDTO = data2.get(i);
String json = JsonUtils.bean2Json(inboundOrderDTO); String json = JsonUtils.bean2Json(inboundOrderDTO);
logger.debug("post data: " + json); logger.debug("post data: " + json);
HttpEntity<String> httpEntity = new HttpEntity<String>(json, headers); HttpEntity<String> httpEntity = new HttpEntity<String>(json, headers);
ResponseEntity<String> res = restTemplate.postForEntity(this.inboundResp_url, httpEntity, String.class); ResponseEntity<String> res = restTemplate.postForEntity(this.icqaResp_url, httpEntity, String.class);
Map result = JsonUtils.json2Map(res.getBody()); Map result = JsonUtils.json2Map(res.getBody());
logger.debug("result: " + result); logger.debug("result: " + result);
if(CommonUtils.parseInteger("CODE",result) == 0){ if(CommonUtils.parseInteger("CODE",result) == 0){
...@@ -98,11 +99,27 @@ public class WMSRespService { ...@@ -98,11 +99,27 @@ public class WMSRespService {
Map newValue = new HashMap(); Map newValue = new HashMap();
newValue.put("NEED_RESP",2); newValue.put("NEED_RESP",2);
Map con = new HashMap(); Map con = new HashMap();
con.put("ENTRYID",inboundOrderDTO.getENTRYID()); con.put("TASKID",inboundOrderDTO.getENTRYID());
this.jdbcRepository.updateRecords(TABLE_IBORDER,newValue,con); this.jdbcRepository.updateRecords(TABLE_IBORDER,newValue,con);
} }
} }
//检查是否有明细已完成 需要将主表记录更新为完成Finish //检查是否有明细已完成 需要将主表记录更新为完成Finish 本来是一条语句完成的
List<Map> allTasks = this.jdbcRepository.queryBySql(Sql_Table.SQL_QUERY_ICQA_POSFINISH);
for (int i = 0; i < allTasks.size(); i++) {
Map icqaOrder = allTasks.get(i);
BaseBpo baseBpo = new BaseBpo();
baseBpo.setTable(Sql_Table.WMS_ICQA_ORDER);
baseBpo.setId(CommonUtils.parseString("TASKID",icqaOrder));
baseBpo.setIdName("TASKID");
baseBpo.addKV("STATE",Sql_Table.FINISH);
baseBpo.addKV("NEED_RESP", 1);
CommonUtils.modifyUselessInfo(baseBpo.getKv());
this.jdbcRepository.updateBusinessObject(baseBpo);
}
}
private List<InboundOrderDTO> transfer2IcqaDTO(List<Map> data) {
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment