Commit 0af51f91 authored by tank.li@mushiny.com's avatar tank.li@mushiny.com

新版的WCS需要从队列取当前工作站消息,我们存在WMS_POD_STATION表里

parent 56a06cb1
...@@ -61,6 +61,8 @@ public class MqListener { ...@@ -61,6 +61,8 @@ public class MqListener {
int stopCellId = CommonUtils.parseInteger("stopCellId",data); int stopCellId = CommonUtils.parseInteger("stopCellId",data);
String sectionId = this.getSectionIdBySid(CommonUtils.parseInteger("sectionId",data)); String sectionId = this.getSectionIdBySid(CommonUtils.parseInteger("sectionId",data));
String workstationId = this.getWorkstationIdByStopPoint(stopCellId,sectionId); String workstationId = this.getWorkstationIdByStopPoint(stopCellId,sectionId);
int podIndex = CommonUtils.parseInteger("podId",data);
String podId = this.getPodIdByIndex(sectionId, podIndex);
/*Integer sectionId; /*Integer sectionId;
Integer stopCellId; //停止点 Integer stopCellId; //停止点
Integer direction;//工作站相对停止点方向 Integer direction;//工作站相对停止点方向
...@@ -68,31 +70,56 @@ public class MqListener { ...@@ -68,31 +70,56 @@ public class MqListener {
Integer podDirection; Integer podDirection;
String taskId;*/ String taskId;*/
List<Map> rows = this.jdbcRepository.queryBySql(Sql_Table.SQL_QUERY_POD_STATION,stopCellId,workstationId); List<Map> rows = this.jdbcRepository.queryBySql(Sql_Table.SQL_QUERY_POD_STATION,stopCellId,workstationId);
/* `STATION_ID` varchar(255) NOT NULL,
`POD_INDEX` int(11) NOT NULL,
`TOWARD` varchar(255) DEFAULT NULL COMMENT 'ABCD',
`PLACEMARK` int(11) DEFAULT NULL COMMENT '*/
Integer podDirection = CommonUtils.parseInteger("podDirection",data);
int toward = 0;
switch (podDirection){
case 1 : toward = 90; break;
case 2 : toward = 180; break;
case 3 : toward = 270; break;
}
if(rows.isEmpty()){ if(rows.isEmpty()){
Map record = new HashMap(); Map record = new HashMap();
record.putAll(data); //record.putAll(data);
//替换掉 便于查询 //替换掉 便于查询
record.put("stopCellId",workstationId); record.put("PLACEMARK",CommonUtils.parseInteger("stopCellId",data));
record.put("sectionId",sectionId); record.put("SECTION_ID",sectionId);
record.put("STATION_ID",workstationId);
record.put("POD_INDEX",podIndex);
record.put("POD_ID",podId);
record.put("TOWARD",toward);
CommonUtils.genUselessInfo(record); CommonUtils.genUselessInfo(record);
this.jdbcRepository.insertRecord(Sql_Table.TABLE_WMS_POD_STATION,record); this.jdbcRepository.insertRecord(Sql_Table.TABLE_WMS_POD_STATION,record);
logger.debug("新增记录成功"); logger.debug("新增记录成功");
}else{ }else{
Map newValue = new HashMap(); Map newValue = new HashMap();
newValue.putAll(data); newValue.put("PLACEMARK",CommonUtils.parseInteger("stopCellId",data));
newValue.put("stopCellId",workstationId); newValue.put("SECTION_ID",sectionId);
newValue.put("sectionId",sectionId); newValue.put("STATION_ID",workstationId);
newValue.put("POD_ID",podId);
newValue.put("POD_INDEX",CommonUtils.parseInteger("podId",data));
newValue.put("TOWARD",toward);
CommonUtils.modifyUselessInfo(newValue); CommonUtils.modifyUselessInfo(newValue);
Map con = new HashMap(); Map con = new HashMap();
con.put("stopCellId",workstationId); con.put("STATION_ID",workstationId);
con.put("sectionId",sectionId); con.put("SECTION_ID",sectionId);
int ret = this.jdbcRepository.updateRecords(Sql_Table.TABLE_WMS_POD_STATION, newValue, con); int ret = this.jdbcRepository.updateRecords(Sql_Table.TABLE_WMS_POD_STATION, newValue, con);
logger.debug("更新记录:"+data+" 结果为:"+ret); logger.debug("更新记录:"+data+" 结果为:"+ret);
} }
} }
private String getPodIdByIndex(String sectionId, int podIndex) {
Map pod = this.jdbcRepository.queryOneBySql(Sql_Table.SQL_QUERYPODBYINDEX,sectionId,podIndex);
return CommonUtils.parseString("ID",pod);
}
private String getWorkstationIdByStopPoint(int stopCellId, String sectionId) { private String getWorkstationIdByStopPoint(int stopCellId, String sectionId) {
Map row = this.jdbcRepository.queryOneBySql(Sql_Table.SQL_QUERYWDBYSTOP,stopCellId,sectionId); Map row = this.jdbcRepository.queryOneBySql(Sql_Table.SQL_QUERYWDBYSTOP,stopCellId,sectionId);
return CommonUtils.parseString("ID",row); return CommonUtils.parseString("ID",row);
......
...@@ -94,10 +94,10 @@ public interface Sql_Table { ...@@ -94,10 +94,10 @@ public interface Sql_Table {
"AND RCS_TRIP.TRIP_TYPE=? " + "AND RCS_TRIP.TRIP_TYPE=? " +
"AND RCS_TRIP.POD_ID=? limit 1"; "AND RCS_TRIP.POD_ID=? limit 1";
String SQL_QUERY_CURRENTPOD = "SELECT MD_POD.ID, MD_POD.POD_INDEX, MD_POD.TOWARD, \n" + 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" + " MD_WORKSTATION.WORKING_FACE_ORIENTATION, \n" +
" MD_POD.PLACEMARK FROM MD_POD, MD_WORKSTATION \n" + " WMS_POD_STATION.PLACEMARK FROM WMS_POD_STATION, MD_WORKSTATION \n" +
" WHERE MD_POD.PLACEMARK = MD_WORKSTATION.STOPPOINT \n" + " WHERE WMS_POD_STATION.PLACEMARK = MD_WORKSTATION.STOPPOINT \n" +
" AND MD_WORKSTATION.ID = ?"; " AND MD_WORKSTATION.ID = ?";
...@@ -192,4 +192,5 @@ public interface Sql_Table { ...@@ -192,4 +192,5 @@ public interface Sql_Table {
String TABLE_WMS_POD_STATION = "WMS_POD_STATION"; String TABLE_WMS_POD_STATION = "WMS_POD_STATION";
String SQL_QUERYSECTIONBYSID = "SELECT * FROM WD_SECTION WHERE RCS_SECTIONID=?"; String SQL_QUERYSECTIONBYSID = "SELECT * FROM WD_SECTION WHERE RCS_SECTIONID=?";
String SQL_QUERYWDBYSTOP = "SELECT * FROM MD_WORKSTATION WHERE STOPPOINT = ? AND SECTION_ID=?"; String SQL_QUERYWDBYSTOP = "SELECT * FROM MD_WORKSTATION WHERE STOPPOINT = ? AND SECTION_ID=?";
String SQL_QUERYPODBYINDEX = "SELECT * FROM MD_POD WHERE SECTION_ID=? AND POD_INDEX=?";
} }
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