Commit 57b06d39 authored by tank.li@mushiny.com's avatar tank.li@mushiny.com

wcs任务发送

parent 07915eeb
......@@ -6,6 +6,7 @@ import com.mushiny.heli.xnr.comm.JsonUtils;
import com.mushiny.heli.xnr.dto.MessageDTO;
import com.mushiny.heli.xnr.dto.StorageLocation;
import com.mushiny.heli.xnr.jdbc.repositories.JdbcRepository;
import com.mushiny.heli.xnr.wcs.WmsToWcsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -26,6 +27,8 @@ public class ICQAService {
private final static Logger logger = LoggerFactory.getLogger(ICQAService.class);
@Autowired
private SystemPropertiesManager systemPropertiesManager;
@Autowired
private WmsToWcsService wmsToWcsService;
/**
* 当前货架的盘点任务
......@@ -165,9 +168,9 @@ public class ICQAService {
String needFace = CommonUtils.parseString("POD_FACE",podOrder);
//int sameFaceIndex = index.get(needFace);
String tripPositionID;
List<Map> tripPositions = this.inboundService.existTripPosition(workStation, podId, needFace,"ICQAPod");
List<Map> tripPositions = this.existTripPosition(workStation, podId, needFace);
if (tripPositions.isEmpty()) {
BaseBpo baseBpo2 = new BaseBpo();
/*BaseBpo baseBpo2 = new BaseBpo();
baseBpo2.setTable("RCS_TRIPPOSITION");
tripPositionID = CommonUtils.genUUID();
baseBpo2.addKV("ID", tripPositionID);
......@@ -177,14 +180,21 @@ public class ICQAService {
baseBpo2.addKV("POSITION_NO", j + 1);
baseBpo2.addKV("WAREHOUSE_ID", CommonUtils.parseString("WAREHOUSE_ID", map));
baseBpo2.addKV("SECTION_ID", CommonUtils.parseString("SECTION_ID", map));
this.jdbcRepository.insertBusinessObject(baseBpo2);
this.jdbcRepository.insertBusinessObject(baseBpo2);*/
Integer podIndex = CommonUtils.parseInteger("POD_INDEX",podOrder);
Integer stopCellId = CommonUtils.parseInteger("STOPPOINT",podOrder);
Integer sectId = CommonUtils.parseInteger("RCS_SECTIONID",podOrder);
Integer face = CommonUtils.faceToInteger(needFace);
Integer wsDirect = CommonUtils.wsFace2Direct(
CommonUtils.parseInteger("WORKING_FACE_ORIENTATION",podOrder));
tripPositionID = this.wmsToWcsService.sendSingleTripToWcs(podIndex,sectId,stopCellId,wsDirect,face);
}else{
Map data = tripPositions.get(0);
tripPositionID = CommonUtils.parseString("ID",data);
}
Map newValue = new HashMap();
newValue.put("STATE", Sql_Table.AVAILABLE);//生成就结束了 是不是执行完看TRIPPOSITION_ID
newValue.put("STATE", Sql_Table.PROCESS);//生成就结束了 是不是执行完看TRIPPOSITION_ID
newValue.put("TRIPPOSITION_ID", tripPositionID);
CommonUtils.modifyUselessInfo(newValue);
......@@ -196,6 +206,12 @@ public class ICQAService {
}
}
public List<Map> existTripPosition(String workStation, String podId, String needFace) {
List<Map> datas = this.jdbcRepository.queryBySql(Sql_Table.SQL_QUERY_ICQA_PODORDER,
needFace,podId,workStation);
return datas;
}
public Map searchIcqa(Map data) {
String taskId = CommonUtils.parseString("taskId", data);
......@@ -329,7 +345,7 @@ public class ICQAService {
baseBpo.addKV("WORKSTATION_ID", stationName);
baseBpo.addKV("PODINDEX", storageLocation.getPodIndex());
baseBpo.addKV("AMOUNT", CommonUtils.parseString("AMOUNT", map));
baseBpo.addKV("STATE", Sql_Table.NEW);
baseBpo.addKV("STATE", Sql_Table.AVAILABLE);
baseBpo.addKV("WAREHOUSE_ID", CommonUtils.parseString("WAREHOUSE_ID", map));
baseBpo.addKV("SECTION_ID", CommonUtils.parseString("SECTION_ID", map));
//插入货架搬运任务 指令
......
......@@ -98,6 +98,7 @@ public interface Sql_Table {
String SQL_QUERY_CURRENTPOD = "SELECT WMS_POD_STATION.POD_ID, WMS_POD_STATION.POD_INDEX, WMS_POD_STATION.TOWARD, \n" +
" MD_WORKSTATION.WORKING_FACE_ORIENTATION, \n" +
" WMS_POD_STATION.TRIP_TASKID, \n" +
" WMS_POD_STATION.SECTION_ID, \n" +
" WMS_POD_STATION.PLACEMARK FROM WMS_POD_STATION, MD_WORKSTATION \n" +
" WHERE WMS_POD_STATION.PLACEMARK = MD_WORKSTATION.STOPPOINT \n" +
" AND MD_WORKSTATION.ID = ?";
......@@ -207,4 +208,11 @@ public interface Sql_Table {
"AND RCS_TRIP.TRIP_STATE= ?\n" +
"AND RCS_TRIPPOSITION.TRIPPOSITION_STATE=? \n" +
"ORDER BY POD_INDEX";
String SQL_QUERY_INBOUND_PODORDER = "SELECT * FROM WMS_INBOUND_PODORDER " +
"WHERE STATE='Available' AND POD_FACE=? " +
"AND POD_ID=? AND WORKSTATION_ID=? limit 1";
String SQL_QUERY_ICQA_PODORDER = "SELECT * FROM WMS_ICQA_PODORDER " +
"WHERE STATE='Available' AND POD_FACE=? " +
"AND POD_ID=? AND WORKSTATION_ID=? limit 1";
String SQL_QUERY_INBOUND_PODORDER_BYENTRYID = "SELECT * FROM WMS_INBOUND_PODORDER WHERE ENTRYID=?";
}
......@@ -331,8 +331,8 @@ public class WMSService {
public void podRelease(Map req) {
//货架号(数字)、工作站号(ID)/ SectionID
Integer podIndex = CommonUtils.parseInteger("podIndex", req);
String stationId = CommonUtils.parseString("stationId",req);
String sectionId = CommonUtils.parseString("sectionId",req);
this.wmsToWcsService.releasePod(stationId,sectionId,podIndex);
String stationId = CommonUtils.parseString("stationName",req);
//String sectionId = CommonUtils.parseString("sectionId",req);
this.wmsToWcsService.releasePod(stationId,podIndex);
}
}
......@@ -130,10 +130,10 @@ public class WmsToWcsService{
@Transactional
public void releasePod(String workStationId,String sectionId, Integer podIndex) {
logger.info("工作站 = {} 释放pod = {} ,sectionId = {} ",workStationId,podIndex,sectionId);
public void releasePod(String workStationId,Integer podIndex) {
logger.info("工作站 = {} 释放pod = {} ",workStationId,podIndex);
//先查询该停止点是否有任务
Map podStation = this.getByWorkStationIdAndPodIndex(workStationId,sectionId,podIndex);
Map podStation = this.getByWorkStationIdAndPodIndex(workStationId,podIndex);
if(podStation == null){
logger.info("工作站 :{} 没有pod : {} ,无法释放。。",workStationId, podIndex);
......@@ -152,6 +152,7 @@ public class WmsToWcsService{
logger.info("工作站 = {} 释放pod = {} ,wcs返回taskId:{}", workStationId, podIndex);
//更显pod状态
String sectionId = CommonUtils.parseString("SECTION_ID",podStation);
updatePodState(podIndex,sectionId, Sql_Table.AVAILABLE);
}
......@@ -159,9 +160,8 @@ public class WmsToWcsService{
return this.jdbcRepository.queryOneBySql(Sql_Table.SQL_QUERYPODBYINDEX, sectionId, podIndex);
}
private Map getByWorkStationIdAndPodIndex(String workStationId, String sectionId, Integer podIndex) {
logger.debug("条件 workStationId :"+workStationId+" sectionId:"
+sectionId+" pod: "+podIndex);
private Map getByWorkStationIdAndPodIndex(String workStationId, Integer podIndex) {
logger.debug("条件 workStationId :"+workStationId+" pod: "+podIndex);
Map data = this.jdbcRepository.queryOneBySql(Sql_Table.SQL_QUERY_CURRENTPOD, workStationId);
if(Objects.equals(podIndex, CommonUtils.parseInteger("POD_INDEX",data))){
return data;
......@@ -172,7 +172,15 @@ public class WmsToWcsService{
private void updatePodState(Integer podId, String sectionId,String status) {
Map newValue = new HashMap();
newValue.put("STATE",Sql_Table.AVAILABLE);
CommonUtils.modifyUselessInfo(newValue);
Map con = new HashMap();
con.put("SECTION_ID",sectionId);
con.put("POD_INDEX",podId);
this.jdbcRepository.updateRecords("MD_POD",newValue,con);
}
......
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