优化0116

This commit is contained in:
zj
2026-01-16 17:13:04 +08:00
parent 5dcb72148e
commit 6c2d8fcb0f
8 changed files with 111 additions and 50 deletions

View File

@@ -71,6 +71,7 @@ public interface MydoJobMapper
void InvalidMydoJob(HashMap<String, Object> map); void InvalidMydoJob(HashMap<String, Object> map);
MydoJob selectMydoJobByExitList(@Param("exitList") List<String> exitList ); MydoJob selectMydoJobByExitList(@Param("exitList") List<String> exitList );
MydoJob selectMydoJobByExitList1(@Param("exitList") List<String> exitList ,@Param("roadwayId") String roadwayId);
void insertHistory(String jobId); void insertHistory(String jobId);
@@ -85,4 +86,6 @@ public interface MydoJobMapper
List<MydoJob> getInJobByEntrance(@Param("exitList") List<String> exitList); List<MydoJob> getInJobByEntrance(@Param("exitList") List<String> exitList);
MydoJob selectJobByTaskNo(String taskNo); MydoJob selectJobByTaskNo(String taskNo);
MydoJob selectMydoJobByEntranceList1(@Param("entranceId") String entranceId);
} }

View File

@@ -66,6 +66,7 @@ public interface IMydoJobService
boolean InvalidMydoJob(Long rwh, Integer id); boolean InvalidMydoJob(Long rwh, Integer id);
MydoJob selectMydoJobByExitList(List<String> exitList); MydoJob selectMydoJobByExitList(List<String> exitList);
MydoJob selectMydoJobByExitList1(List<String> exitList,String roadwayId);
void insertHistory(String jobId); void insertHistory(String jobId);
@@ -80,4 +81,6 @@ public interface IMydoJobService
List<MydoJob> getInJobByEntrance(List<String> exitList); List<MydoJob> getInJobByEntrance(List<String> exitList);
MydoJob selectJobByTaskNo(String taskNo); MydoJob selectJobByTaskNo(String taskNo);
MydoJob selectMydoJobByEntranceList1(String entranceId);
} }

View File

@@ -134,6 +134,11 @@ public class MydoJobServiceImpl implements IMydoJobService
return mydoJobMapper.selectMydoJobByExitList(exitList); return mydoJobMapper.selectMydoJobByExitList(exitList);
} }
@Override
public MydoJob selectMydoJobByExitList1(List<String> exitList ,String roadwayId) {
return mydoJobMapper.selectMydoJobByExitList1(exitList,roadwayId);
}
@Override @Override
public void insertHistory(String jobId) { public void insertHistory(String jobId) {
mydoJobMapper.insertHistory(jobId); mydoJobMapper.insertHistory(jobId);
@@ -149,6 +154,11 @@ public class MydoJobServiceImpl implements IMydoJobService
return mydoJobMapper.selectMydoJobByEntranceList(entranceList); return mydoJobMapper.selectMydoJobByEntranceList(entranceList);
} }
@Override
public MydoJob selectMydoJobByEntranceList1(String entranceId) {
return mydoJobMapper.selectMydoJobByEntranceList1(entranceId);
}
@Override @Override
public List<MydoJob> selectMydoJobFinishList(MydoJob mydoJob) { public List<MydoJob> selectMydoJobFinishList(MydoJob mydoJob) {
return mydoJobMapper.selectMydoJobFinishList(mydoJob); return mydoJobMapper.selectMydoJobFinishList(mydoJob);

View File

@@ -99,7 +99,8 @@ public class Floor1BothWayInSsjThread implements Runnable {
if (ssj.getDw() == 1 && ssj.getTaskNo() > 1000) { if (ssj.getDw() == 1 && ssj.getTaskNo() > 1000) {
int taskNo = ssj.getTaskNo(); int taskNo = ssj.getTaskNo();
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(taskNo)); MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(taskNo));
if (ObjUtil.isNotNull(mydoJob) && TASK_STATUS_CREATE.equals(mydoJob.getStatus()) && TASK_EP_SSJ.equals(mydoJob.getExecutionPhase()) && Convert.toInt(mydoJob.getInOrOut()) < 20) { if (ObjUtil.isNotNull(mydoJob) && TASK_STATUS_CREATE.equals(mydoJob.getStatus())
&& TASK_EP_SSJ.equals(mydoJob.getExecutionPhase()) && Convert.toInt(mydoJob.getInOrOut()) < 20) {
//修改作业执行状态 //修改作业执行状态
mydoJob.setStatus(TASK_STATUS_RUNNING); mydoJob.setStatus(TASK_STATUS_RUNNING);
mydoJob.setStartTime(DateUtil.formatDateTime(DateUtil.date())); mydoJob.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
@@ -109,7 +110,7 @@ public class Floor1BothWayInSsjThread implements Runnable {
mydoJob.setExecutionPhase(TASK_EP_ROADWAY_SSJ); mydoJob.setExecutionPhase(TASK_EP_ROADWAY_SSJ);
mydoJobService.updateMydoJob(mydoJob); mydoJobService.updateMydoJob(mydoJob);
} }
if (ObjUtil.isNotNull(mydoJob) && mydoJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ)) { if (ObjUtil.isNotNull(mydoJob) && mydoJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ) && Convert.toInt(mydoJob.getInOrOut()) < 20) {
List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueListByRwlx(DDJ_RWLX_3, Convert.toInt(mydoJob.getRoadwayId())); List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueListByRwlx(DDJ_RWLX_3, Convert.toInt(mydoJob.getRoadwayId()));
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId()); BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
List<Integer> pclList = roadwayMap.get(ssj.getDeviceCode()); List<Integer> pclList = roadwayMap.get(ssj.getDeviceCode());

View File

@@ -41,9 +41,6 @@ public class Floor1BothWayOutSsjThread implements Runnable {
private final Map<String, List<Integer>> roadwayMap = new HashMap<>(); private final Map<String, List<Integer>> roadwayMap = new HashMap<>();
private IJobCallBackService jobCallBackService; private IJobCallBackService jobCallBackService;
private final Map<String,DeviceSsj> roadwayOutMap = new HashMap<>();
public boolean isRun = true; public boolean isRun = true;
@@ -51,14 +48,11 @@ public class Floor1BothWayOutSsjThread implements Runnable {
ssjCodeList = new HashMap<>(); ssjCodeList = new HashMap<>();
ArrayList<DeviceSsj> roadway1 = new ArrayList<>(); ArrayList<DeviceSsj> roadway1 = new ArrayList<>();
roadway1.add(PlcSsjRead.deviceSsjMap.get("L2003")); roadway1.add(PlcSsjRead.deviceSsjMap.get("L2003"));
roadway1.add(PlcSsjRead.deviceSsjMap.get("L2004"));
roadwayOutMap.put("L2003", PlcSsjRead.deviceSsjMap.get("L2004"));
ssjCodeList.put("roadway1", roadway1); ssjCodeList.put("roadway1", roadway1);
ArrayList<DeviceSsj> roadway2 = new ArrayList<>(); ArrayList<DeviceSsj> roadway2 = new ArrayList<>();
roadway2.add(PlcSsjRead.deviceSsjMap.get("L2005")); roadway2.add(PlcSsjRead.deviceSsjMap.get("L2005"));
roadway2.add(PlcSsjRead.deviceSsjMap.get("L2006"));
roadwayOutMap.put("L2005", PlcSsjRead.deviceSsjMap.get("L2006"));
ssjCodeList.put("roadway2", roadway2); ssjCodeList.put("roadway2", roadway2);
ArrayList<DeviceSsj> ou1 = new ArrayList<>(); ArrayList<DeviceSsj> ou1 = new ArrayList<>();
ou1.add(PlcSsjRead.deviceSsjMap.get("L2004")); ou1.add(PlcSsjRead.deviceSsjMap.get("L2004"));
ssjCodeList.put("ou1", ou1); ssjCodeList.put("ou1", ou1);
@@ -66,7 +60,13 @@ public class Floor1BothWayOutSsjThread implements Runnable {
out2.add(PlcSsjRead.deviceSsjMap.get("L2006")); out2.add(PlcSsjRead.deviceSsjMap.get("L2006"));
ssjCodeList.put("out2", out2); ssjCodeList.put("out2", out2);
ArrayList<DeviceSsj> roadway1Both = new ArrayList<>();
roadway1Both.add(PlcSsjRead.deviceSsjMap.get("L2001"));
ssjCodeList.put("roadway1Both", roadway1Both);
ArrayList<DeviceSsj> roadway2Both = new ArrayList<>();
roadway2Both.add(PlcSsjRead.deviceSsjMap.get("L2007"));
ssjCodeList.put("roadway2Both", roadway2Both);
mydoJobService = SpringUtils.getBean(IMydoJobService.class); mydoJobService = SpringUtils.getBean(IMydoJobService.class);
basCargoSpaceService = SpringUtils.getBean(IBasCargoSpaceService.class); basCargoSpaceService = SpringUtils.getBean(IBasCargoSpaceService.class);
@@ -111,6 +111,7 @@ public class Floor1BothWayOutSsjThread implements Runnable {
if (ssj.getTaskNo() > 0) { if (ssj.getTaskNo() > 0) {
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(ssj.getTaskNo())); MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(ssj.getTaskNo()));
if(Convert.toInt(mydoJob.getInOrOut()) > 20){
if (ObjUtil.isNotNull(mydoJob) && mydoJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ)) { if (ObjUtil.isNotNull(mydoJob) && mydoJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ)) {
mydoJob.setExecutionPhase(TASK_EP_SSJ); mydoJob.setExecutionPhase(TASK_EP_SSJ);
mydoJobService.updateMydoJob(mydoJob); mydoJobService.updateMydoJob(mydoJob);
@@ -132,7 +133,7 @@ public class Floor1BothWayOutSsjThread implements Runnable {
mydoJobService.updateMydoJob(mydoJob); mydoJobService.updateMydoJob(mydoJob);
mydoJobService.insertHistory(mydoJob.getJobId()); mydoJobService.insertHistory(mydoJob.getJobId());
mydoJobService.deleteMydoJobByJobId(mydoJob.getJobId()); mydoJobService.deleteMydoJobByJobId(mydoJob.getJobId());
}
} }
} }
} }
@@ -142,13 +143,28 @@ public class Floor1BothWayOutSsjThread implements Runnable {
* 出库堆垛机队列生成 * 出库堆垛机队列生成
*/ */
public void dispatch(List<DeviceSsj> ssjList) { public void dispatch(List<DeviceSsj> ssjList) {
DeviceSsj deviceSsj = roadwayOutMap.get(ssjList.get(0).getDeviceCode()); DeviceSsj deviceSsj = ssjList.get(0);
DeviceSsj ssj = new DeviceSsj();
String roadwayId = "";
String entrance_id = "";
if ("L2003".equals(deviceSsj.getDeviceCode())) {
roadwayId = "1";
ssj = ssjCodeList.get("roadway1Both").get(0);
entrance_id = "L2004";
}
if("L2005".equals(deviceSsj.getDeviceCode())) {
roadwayId = "2";
ssj = ssjCodeList.get("roadway2Both").get(0);
entrance_id = "L2006";
}
List<String> exitList = new ArrayList<>(); List<String> exitList = new ArrayList<>();
exitList.add("1"); exitList.add("1");
MydoJob mydoJob = mydoJobService.selectMydoJobByExitList(exitList); MydoJob mydoJob = mydoJobService.selectMydoJobByExitList1(exitList, roadwayId);
MydoJob inJob = mydoJobService.selectMydoJobByEntranceList(Collections.singletonList(deviceSsj.getDeviceCode())); MydoJob inJob = mydoJobService.selectMydoJobByEntranceList1(entrance_id);
boolean allKx = ssjList.stream().allMatch(ssj -> ssj.getKx() == 1); if (ObjUtil.isNotNull(mydoJob) && deviceSsj.getKx() == 1 && ssj.getKx() == 0
if (ObjUtil.isNotNull(mydoJob) && allKx && ObjUtil.isNull(inJob) && deviceSsj.getInOrOut() == 1) { && ObjUtil.isNull(inJob) && ssj.getInOrOut() == 1) {
//所有线体为空闲 并且存在出库作业 并且不存在入库作业 //所有线体为空闲 并且存在出库作业 并且不存在入库作业
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId()); BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
if (ObjUtil.isNull(basCargoSpace)) { if (ObjUtil.isNull(basCargoSpace)) {

View File

@@ -152,7 +152,14 @@ public class Floor1SingleSsjThread implements Runnable {
if (ssj.getKx() == 1) { if (ssj.getKx() == 1) {
List<String> exitList = new ArrayList<>(); List<String> exitList = new ArrayList<>();
exitList.add("1"); exitList.add("1");
MydoJob mydoJob = mydoJobService.selectMydoJobByExitList(exitList); String roadwayId = "";
if("L2001".equals(ssj.getDeviceCode())){
roadwayId = "1";
}
if("L2007".equals(ssj.getDeviceCode())){
roadwayId = "2";
}
MydoJob mydoJob = mydoJobService.selectMydoJobByExitList1(exitList,roadwayId);
if (ObjUtil.isNotNull(mydoJob)) { if (ObjUtil.isNotNull(mydoJob)) {
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId()); BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
if (ObjUtil.isNull(basCargoSpace)) { if (ObjUtil.isNull(basCargoSpace)) {

View File

@@ -99,7 +99,8 @@ public class Floor2RoadWaySsjThread implements Runnable {
mydoJob.setExecutionPhase(TASK_EP_ROADWAY_SSJ); mydoJob.setExecutionPhase(TASK_EP_ROADWAY_SSJ);
mydoJobService.updateMydoJob(mydoJob); mydoJobService.updateMydoJob(mydoJob);
} }
if (ObjUtil.isNotNull(mydoJob) && mydoJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ)) { if (ObjUtil.isNotNull(mydoJob) && mydoJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ)
&& Convert.toInt(mydoJob.getInOrOut()) < 20) {
List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueListByRwlx(DDJ_RWLX_1, Convert.toInt(mydoJob.getRoadwayId())); List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueListByRwlx(DDJ_RWLX_1, Convert.toInt(mydoJob.getRoadwayId()));
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId()); BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
List<Integer> pclList = roadwayMap.get(roadSsjDevice.getDeviceCode()); List<Integer> pclList = roadwayMap.get(roadSsjDevice.getDeviceCode());

View File

@@ -114,6 +114,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by priority desc,create_time order by priority desc,create_time
</select> </select>
<select id="selectMydoJobByExitList1" resultMap="MydoJobResult">
select TOP 1 job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag,flag,tray_code,tray_size from mydo_job_wcs
where exit_id in
<foreach item="item" index="index" collection="exitList" separator="," open="(" close=")">
#{item}
</foreach>
and roadway_id = #{roadwayId}
and in_or_out &gt; 20
and status = 1 and execution_phase= 0
order by priority desc,create_time
</select>
<insert id="insertMydoJob" parameterType="MydoJob"> <insert id="insertMydoJob" parameterType="MydoJob">
insert into mydo_job_wcs insert into mydo_job_wcs
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -239,6 +251,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and in_or_out &lt;= 20 and status = 3 and in_or_out &lt;= 20 and status = 3
order by priority desc,create_time desc order by priority desc,create_time desc
</select> </select>
<select id="selectMydoJobByEntranceList1" resultMap="MydoJobResult">
select TOP 1 job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag,flag, tray_code from mydo_job_wcs
where entrance_id = #{entranceId}
and in_or_out &lt;= 20 and status = 3
order by priority desc,create_time desc
</select>
<select id="selectMydoJobFinishList" resultMap="MydoJobResult"> <select id="selectMydoJobFinishList" resultMap="MydoJobResult">
<include refid="selectMydoJobFinishVo"/> <include refid="selectMydoJobFinishVo"/>
<where> <where>