Commit 89a5dbc6 authored by Jie Wang's avatar Jie Wang

Merge remote-tracking branch 'origin/master'

# Conflicts: # src/main/java/com/mushiny/heli/xnr/service/WMSRespService.java
parents 35ad9d9a c1d2cb27
...@@ -29,6 +29,7 @@ public class OutboundService { ...@@ -29,6 +29,7 @@ public class OutboundService {
Map obs = finishedObps.get(i); Map obs = finishedObps.get(i);
Map newValue = new HashMap(); Map newValue = new HashMap();
newValue.put("STATE",Sql_Table.FINISH); newValue.put("STATE",Sql_Table.FINISH);
newValue.put("PICKED",CommonUtils.parseInteger("AMOUNT_PICKED",obs));
CommonUtils.modifyUselessInfo(newValue); CommonUtils.modifyUselessInfo(newValue);
Map con = new HashMap(); Map con = new HashMap();
...@@ -36,5 +37,20 @@ public class OutboundService { ...@@ -36,5 +37,20 @@ public class OutboundService {
this.jdbcRepository.updateRecords(Sql_Table.TABLE_OUTBOUND_ORDERPOSITION, newValue, con); this.jdbcRepository.updateRecords(Sql_Table.TABLE_OUTBOUND_ORDERPOSITION, newValue, con);
} }
//如果明细都已结束 将主表更新为已完成,减少操作时的判断
List<Map> list = this.jdbcRepository
.queryBySql(Sql_Table.SQL_OUTBOUNDORDERPOSITION_BYSTATE);
for (int i = 0; i < list.size(); i++) {
Map rows = list.get(i);
Map newValue = new HashMap();
newValue.put("STATE", Sql_Table.FINISH);
newValue.put("NEED_RESP", 1);
CommonUtils.modifyUselessInfo(newValue);
Map con = new HashMap();
con.put("ORDERID",CommonUtils.parseString("ORDERID",rows));
this.jdbcRepository.updateRecords(Sql_Table.WMS_OUTBOUND_ORDER,newValue,con);
}
} }
} }
...@@ -140,7 +140,7 @@ public interface Sql_Table { ...@@ -140,7 +140,7 @@ public interface Sql_Table {
String NEW = "New"; String NEW = "New";
String TABLE_OB_CUSTOMERSHIPMENT = "OB_CUSTOMERSHIPMENT"; String TABLE_OB_CUSTOMERSHIPMENT = "OB_CUSTOMERSHIPMENT";
String TABLE_OB_CUSTOMERSHIPMENTPOSITION = "OB_CUSTOMERSHIPMENTPOSITION"; String TABLE_OB_CUSTOMERSHIPMENTPOSITION = "OB_CUSTOMERSHIPMENTPOSITION";
String SQL_QUERY_OBORDER = "SELECT WMS_OUTBOUND_ORDERPOSITION.* FROM WMS_OUTBOUND_ORDERPOSITION,OB_CUSTOMERSHIPMENTPOSITION \n" + String SQL_QUERY_OBORDER = "SELECT WMS_OUTBOUND_ORDERPOSITION.*,OB_CUSTOMERSHIPMENTPOSITION.AMOUNT_PICKED FROM WMS_OUTBOUND_ORDERPOSITION,OB_CUSTOMERSHIPMENTPOSITION \n" +
"WHERE WMS_OUTBOUND_ORDERPOSITION.SHIPMENTPOSITION_ID=OB_CUSTOMERSHIPMENTPOSITION.ID \n" + "WHERE WMS_OUTBOUND_ORDERPOSITION.SHIPMENTPOSITION_ID=OB_CUSTOMERSHIPMENTPOSITION.ID \n" +
"AND WMS_OUTBOUND_ORDERPOSITION.STATE<>'Finish' AND OB_CUSTOMERSHIPMENTPOSITION.STATE >= 600 "; "AND WMS_OUTBOUND_ORDERPOSITION.STATE<>'Finish' AND OB_CUSTOMERSHIPMENTPOSITION.STATE >= 600 ";
String TABLE_OUTBOUND_ORDERPOSITION = "WMS_OUTBOUND_ORDERPOSITION"; String TABLE_OUTBOUND_ORDERPOSITION = "WMS_OUTBOUND_ORDERPOSITION";
......
package com.mushiny.heli.xnr.service; package com.mushiny.heli.xnr.service;
import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;
import com.mushiny.heli.xnr.beans.BaseBpo; 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;
...@@ -21,8 +19,10 @@ import org.springframework.stereotype.Service; ...@@ -21,8 +19,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import java.text.SimpleDateFormat; import java.util.ArrayList;
import java.util.*; import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* Created by Lisi on 2019-11-18. * Created by Lisi on 2019-11-18.
...@@ -30,8 +30,7 @@ import java.util.*; ...@@ -30,8 +30,7 @@ import java.util.*;
@Service @Service
public class WMSRespService { public class WMSRespService {
private final static Logger logger = LoggerFactory.getLogger(WMSRespService.class); private final static Logger logger = LoggerFactory.getLogger(WMSRespService.class);
private SimpleDateFormat OrderDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
private static Gson gson = new Gson();
public static final String SQL_QUERYALL_INBOUNDORDER = public static final String SQL_QUERYALL_INBOUNDORDER =
"SELECT * FROM WMS_INBOUND_ORDER ,WMS_INBOUND_ORDERPOSITION " + "SELECT * FROM WMS_INBOUND_ORDER ,WMS_INBOUND_ORDERPOSITION " +
"WHERE WMS_INBOUND_ORDER.ENTRYID=WMS_INBOUND_ORDERPOSITION.ENTRYID " + "WHERE WMS_INBOUND_ORDER.ENTRYID=WMS_INBOUND_ORDERPOSITION.ENTRYID " +
...@@ -88,23 +87,20 @@ public class WMSRespService { ...@@ -88,23 +87,20 @@ public class WMSRespService {
List<Map> data = this.jdbcRepository.queryBySql(SQL_QUERYALL_ICQAORDER,FINISH); List<Map> data = this.jdbcRepository.queryBySql(SQL_QUERYALL_ICQAORDER,FINISH);
List<IcqaOrderDTO> data2 = this.transfer2IcqaDTO(data);//合并主表记录 List<IcqaOrderDTO> data2 = this.transfer2IcqaDTO(data);//合并主表记录
List<IcqaOrderRespHeliDto> icqaOrderRespHeliDtos = this.transfer2IcqaOrderRespHeliDto(data2);
for (int i = 0; i < data2.size(); i++) { for (int i = 0; i < data2.size(); i++) {
//IcqaOrderDTO icqaOrderDTO = data2.get(i); IcqaOrderDTO icqaOrderDTO = data2.get(i);
IcqaOrderRespHeliDto icqaOrderRespHeliDto = icqaOrderRespHeliDtos.get(i); String json = JsonUtils.bean2Json(icqaOrderDTO);
//String json = JsonUtils.bean2Json(icqaOrderRespHeliDto);
String json = gson.toJson(icqaOrderRespHeliDto);
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.icqaResp_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){
logger.debug("成功回调"+icqaOrderRespHeliDto.getICQAID()); logger.debug("成功回调"+icqaOrderDTO.getTASKID());
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("TASKID",icqaOrderRespHeliDto.getICQAID()); con.put("TASKID",icqaOrderDTO.getTASKID());
this.jdbcRepository.updateRecords(TABLE_ICQAORDER,newValue,con); this.jdbcRepository.updateRecords(TABLE_ICQAORDER,newValue,con);
} }
} }
...@@ -124,37 +120,6 @@ public class WMSRespService { ...@@ -124,37 +120,6 @@ public class WMSRespService {
} }
} }
// public static void main(String[] args) {
// IcqaOrderRespHeliDto icqaOrderRespHeliDto = new IcqaOrderRespHeliDto();
// icqaOrderRespHeliDto.setFACTORY("1111111");
// Gson gson = new Gson();
// String s1 = gson.toJson(icqaOrderRespHeliDto);
// String s = JsonUtils.bean2Json(icqaOrderRespHeliDto);//JSON.toJSONString(icqaOrderRespHeliDto);
// System.out.println(s1);
// }
private List<IcqaOrderRespHeliDto> transfer2IcqaOrderRespHeliDto(List<IcqaOrderDTO> list){
List<IcqaOrderRespHeliDto> icqaOrderRespHeliDtos = new ArrayList<IcqaOrderRespHeliDto>();
for (IcqaOrderDTO icqaOrderDTO: list
) {
IcqaOrderRespHeliDto icqaOrderRespHeliDto = new IcqaOrderRespHeliDto();
icqaOrderRespHeliDto.setICQAID(icqaOrderDTO.getTASKID());
icqaOrderRespHeliDto.setFACTORY(icqaOrderDTO.getFACTORY());
icqaOrderRespHeliDto.setSECTION(icqaOrderDTO.getSECTION());
icqaOrderRespHeliDto.setCREATED_DATE(OrderDateFormat.format(new Date()));
List<IcqaOrderPositionRespHeliDto> icqaOrderPositionRespHeliDtos = new ArrayList<IcqaOrderPositionRespHeliDto>();
for (IcqaOrderPosition icqaOrderPosition:icqaOrderDTO.getDATA()){
IcqaOrderPositionRespHeliDto icqaOrderPositionRespHeliDto = new IcqaOrderPositionRespHeliDto();
icqaOrderPositionRespHeliDto.setSKUID(icqaOrderPosition.getSKUID());
icqaOrderPositionRespHeliDto.setAMOUNT(icqaOrderPosition.getAMOUNT());
icqaOrderPositionRespHeliDto.setCOUNT(icqaOrderPosition.getCOUNT());
icqaOrderPositionRespHeliDtos.add(icqaOrderPositionRespHeliDto);
}
icqaOrderRespHeliDto.setDATA(icqaOrderPositionRespHeliDtos);
icqaOrderRespHeliDtos.add(icqaOrderRespHeliDto);
}
return icqaOrderRespHeliDtos;
}
private List<IcqaOrderDTO> transfer2IcqaDTO(List<Map> data) { private List<IcqaOrderDTO> transfer2IcqaDTO(List<Map> data) {
//return new ArrayList<>(); //return new ArrayList<>();
Map<String,IcqaOrderDTO> temp = new HashMap(); Map<String,IcqaOrderDTO> temp = new HashMap();
...@@ -268,19 +233,6 @@ public class WMSRespService { ...@@ -268,19 +233,6 @@ public class WMSRespService {
} }
} }
//如果明细都已结束 将主表更新为已完成,减少操作时的判断
List<Map> list = this.jdbcRepository
.queryBySql(Sql_Table.SQL_OUTBOUNDORDERPOSITION_BYSTATE);
for (int i = 0; i < list.size(); i++) {
Map rows = list.get(i);
Map newValue = new HashMap();
newValue.put("STATE", Sql_Table.FINISH);
CommonUtils.modifyUselessInfo(newValue);
Map con = new HashMap();
con.put("ENTRYID",CommonUtils.parseString("ENTRYID",rows));
this.jdbcRepository.updateRecords(Sql_Table.WMS_OUTBOUND_ORDER,newValue,con);
}
} }
...@@ -289,17 +241,18 @@ public class WMSRespService { ...@@ -289,17 +241,18 @@ public class WMSRespService {
for (int i = 0; i < data.size(); i++) { for (int i = 0; i < data.size(); i++) {
Map map = data.get(i); Map map = data.get(i);
String entryId = (String) map.get("ORDERID"); String orderId = (String) map.get("ORDERID");
if(temp.get(entryId) == null){ if(temp.get(orderId) == null){
OutboundOrderDTO outboundOrderDTO = new OutboundOrderDTO(); OutboundOrderDTO outboundOrderDTO = new OutboundOrderDTO();
outboundOrderDTO.setORDERID(entryId); outboundOrderDTO.setORDERID(orderId);
outboundOrderDTO.setSECTION((String) map.get("SECTION_ID"));//TODO outboundOrderDTO.setSECTION(CommonUtils.getSection((String) map.get("SECTION_ID")));
outboundOrderDTO.setFACTORY((String) map.get("WAREHOUSE_ID"));//TODO //outboundOrderDTO.setFACTORY((String) map.get("FACTORY"));
outboundOrderDTO.setFACTORY(CommonUtils.getWarehouse((String) map.get("WAREHOUSE_ID")));
outboundOrderDTO.setTIMES(CommonUtils.parseInteger("TIMES",map)); outboundOrderDTO.setTIMES(CommonUtils.parseInteger("TIMES",map));
outboundOrderDTO.setDATA(new ArrayList<>()); outboundOrderDTO.setDATA(new ArrayList<>());
temp.put(entryId,outboundOrderDTO); temp.put(orderId,outboundOrderDTO);
} }
OutboundOrderDTO outboundOrderDTO = temp.get(entryId); OutboundOrderDTO outboundOrderDTO = temp.get(orderId);
//每行一条明细记录 //每行一条明细记录
OutboundOrderPosition outboundOrderPosition = new OutboundOrderPosition(); OutboundOrderPosition outboundOrderPosition = new OutboundOrderPosition();
outboundOrderPosition.setSHIPMENTID(CommonUtils.parseString("SHIPMENTID",map)); outboundOrderPosition.setSHIPMENTID(CommonUtils.parseString("SHIPMENTID",map));
......
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