优化0120

This commit is contained in:
zj
2026-01-20 16:45:46 +08:00
parent 6c2d8fcb0f
commit d2d871baf1
26 changed files with 335 additions and 226 deletions

View File

@@ -38,7 +38,6 @@ public class AgvController extends BaseController {
}
/**
* agv搬运作业
* @param param{

View File

@@ -279,16 +279,21 @@ public class ApiServiceImpl implements IApiService {
agvQueue.setReqTime(DateUtil.formatDateTime(DateUtil.date()));
agvQueue.setAgvType("AGV");
agvQueue.setPositionCode1(code1);
agvQueue.setPositionCode2(code2);
agvQueue.setTaskType("A22");
// agvQueue.setCtnrType("1");
//rcslite开启托盘自动调整位置后 - 测试一巷道放货区分托盘类型
if (traySize == "2" || traySize == "3") {
agvQueue.setCtnrType("3");
if("4".equals(traySize) && "L1001".equals(code2)){
agvQueue.setPositionCode2("L1001-1");
}else{
agvQueue.setCtnrType("1");
agvQueue.setPositionCode2(code2);
}
agvQueue.setTaskType("A22");
agvQueue.setCtnrType("1");
//rcslite开启托盘自动调整位置后 - 测试一巷道放货区分托盘类型
// if (traySize == "2" || traySize == "3") {
// agvQueue.setCtnrType("3");
// }else{
// agvQueue.setCtnrType("1");
// }
agvQueue.setCtnrCode(traySize);
agvQueue.setCtnrNum("0");
agvQueue.setTaskMode("0");
@@ -379,9 +384,11 @@ public class ApiServiceImpl implements IApiService {
mydoJob.setTaskNo(receiveOutJob.getTaskNo());
mydoJob.setCargoSpaceId(receiveOutJob.getCargoSpaceId());
if("L2002".equals(receiveOutJob.getExitId()) || "L2008".equals(receiveOutJob.getCargoSpaceId())
|| "L2004".equals(receiveOutJob.getCargoSpaceId()) || "L2006".equals(receiveOutJob.getExitId())) {
if("L2002".equals(receiveOutJob.getExitId()) || "L2008".equals(receiveOutJob.getExitId())
|| "L2004".equals(receiveOutJob.getExitId()) || "L2006".equals(receiveOutJob.getExitId())) {
mydoJob.setExitId("1");
}else{
mydoJob.setExitId(receiveOutJob.getExitId());
}
mydoJob.setInOrOut(receiveOutJob.getInOrOut());
mydoJob.setStatus("1");
@@ -414,7 +421,7 @@ public class ApiServiceImpl implements IApiService {
return AjaxResult.error();
}
}
//todo 新增agv站点
@Override
public AjaxResult deleteAgvTray(AgvQueue agvQueue) {
Map<String, String> paramMap = new HashMap<>();
@@ -428,6 +435,9 @@ public class ApiServiceImpl implements IApiService {
if("L1003".equals(agvQueue.getPositionCode2())){
paramMap.put("stgBinCode", "JT000206001013");
}
if("L1001-1".equals(agvQueue.getPositionCode2())){
paramMap.put("stgBinCode", "JT000407001013");
}
// paramMap.put("binName", agvQueue.getPositionCode2());
paramMap.put("indBind", "0");

View File

@@ -4,14 +4,7 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@@ -113,4 +106,12 @@ public class MydoJobController extends BaseController
{
return toAjax(mydoJobService.deleteMydoJobByJobIds(jobIds));
}
@PreAuthorize("@ss.hasAnyPermi('job:mydoJob:OuthandFinish')")
@Log(title = "出库手动完成", businessType = BusinessType.OTHER)
@RequestMapping("/OuthandFinish")
public AjaxResult manualCompleted(@RequestParam("jobIds")String[] jobIds)
{
return mydoJobService.OuthandFinish(jobIds);
}
}

View File

@@ -1,6 +1,8 @@
package com.ruoyi.job.service;
import java.util.List;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.job.domain.MydoJob;
/**
@@ -83,4 +85,6 @@ public interface IMydoJobService
MydoJob selectJobByTaskNo(String taskNo);
MydoJob selectMydoJobByEntranceList1(String entranceId);
AjaxResult OuthandFinish(String[] jobIds);
}

View File

@@ -1,11 +1,15 @@
package com.ruoyi.job.service.impl;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import cn.hutool.core.convert.Convert;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.job.domain.JobCallBack;
import com.ruoyi.job.service.IJobCallBackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.job.mapper.MydoJobMapper;
@@ -23,6 +27,8 @@ public class MydoJobServiceImpl implements IMydoJobService
{
@Autowired
private MydoJobMapper mydoJobMapper;
@Autowired
private IJobCallBackService jobCallBackService;
/**
* 查询作业信息
@@ -82,6 +88,9 @@ public class MydoJobServiceImpl implements IMydoJobService
@Override
public int deleteMydoJobByJobIds(String[] jobIds)
{
for (String jobId : jobIds) {
mydoJobMapper.insertHistory(jobId);
}
return mydoJobMapper.deleteMydoJobByJobIds(jobIds);
}
@@ -159,6 +168,28 @@ public class MydoJobServiceImpl implements IMydoJobService
return mydoJobMapper.selectMydoJobByEntranceList1(entranceId);
}
@Override
public AjaxResult OuthandFinish(String[] jobIds) {
for (String jobId : jobIds) {
mydoJobMapper.insertHistory(jobId);
MydoJob mydoJob = mydoJobMapper.selectMydoJobByJobId(jobId);
JobCallBack jobCallBack = new JobCallBack();
long jobIdNum = Long.parseLong(mydoJob.getInOrOut());
if (jobIdNum > 20){
jobCallBack.setType("2");
}else{jobCallBack.setType("1");}
jobCallBack.setMydojobId(mydoJob.getJobId());
jobCallBack.setStatus("0");
jobCallBack.setTaskNo(Convert.toLong(mydoJob.getTaskNo()));
jobCallBack.setCreateTime(new Date());
jobCallBack.setSpare1("0");
jobCallBackService.insertJobCallBack(jobCallBack);
mydoJobMapper.deleteMydoJobByJobId(jobId);
}
return AjaxResult.success("操作成功");
}
@Override
public List<MydoJob> selectMydoJobFinishList(MydoJob mydoJob) {
return mydoJobMapper.selectMydoJobFinishList(mydoJob);

View File

@@ -70,4 +70,6 @@ public interface AgvQueueMapper
void insertHistory(String reqCode);
AgvQueue selectAgvQueueByWmsTask(@Param("wmsTaskNo") int wmsTaskNo);
List<AgvQueue> selectAgvQueueList1(AgvQueue agvQueue);
}

View File

@@ -73,4 +73,6 @@ public interface IAgvQueueService
void insertHistory(String reqCode);
AgvQueue selectAgvQueueByWmsTask(int taskNo);
List<AgvQueue> selectAgvQueueList1(AgvQueue agvQueue);
}

View File

@@ -43,6 +43,12 @@ public class AgvQueueServiceImpl implements IAgvQueueService
return agvQueueMapper.selectAgvQueueList(agvQueue);
}
@Override
public List<AgvQueue> selectAgvQueueList1(AgvQueue agvQueue)
{
return agvQueueMapper.selectAgvQueueList1(agvQueue);
}
/**
* 新增AGV任务队列
*

View File

@@ -91,6 +91,7 @@ public class DdjDeviceExecutionQueueController extends BaseController
return toAjax(ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue));
}
/**
* 删除堆垛机执行队列
*/

View File

@@ -43,6 +43,7 @@ public interface DdjDeviceExecutionQueueMapper
* @return 结果
*/
public int updateDdjDeviceExecutionQueue(DdjDeviceExecutionQueue ddjDeviceExecutionQueue);
public int updateDdjDeviceExecutionQueue1(DdjDeviceExecutionQueue ddjDeviceExecutionQueue);
/**
* 删除堆垛机执行队列

View File

@@ -64,9 +64,12 @@ public class DdjDeviceExecutionQueueServiceImpl implements IDdjDeviceExecutionQu
@Override
public int updateDdjDeviceExecutionQueue(DdjDeviceExecutionQueue ddjDeviceExecutionQueue)
{
ddjDeviceExecutionQueue.setDdjxf("0");
return ddjDeviceExecutionQueueMapper.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
}
/**
* 批量删除堆垛机执行队列
*

View File

@@ -197,7 +197,7 @@ public class PlcSsjRead implements Runnable {
// }
}
}
OperateResultExOne<byte[]> agvSsjTask = readWriteNet.Read("DB501.280", Short.parseShort("8"));
OperateResultExOne<byte[]> agvSsjTask = readWriteNet.Read("DB501.280", Short.parseShort("16"));
String ddsx2 = "0";
if (agvSsjTask.IsSuccess) {
ddsx2 = SoftBasic.ByteToHexString(agvSsjTask.Content);
@@ -207,6 +207,12 @@ public class PlcSsjRead implements Runnable {
if("L1003".equals(ssjDevice.getDeviceCode())){
ssjDevice.setTaskNo2(ParseUtil.optDInt(4, ddsx2));
}
if("L2004".equals(ssjDevice.getDeviceCode())){
ssjDevice.setTaskNo2(ParseUtil.optDInt(8, ddsx2));
}
if("L2006".equals(ssjDevice.getDeviceCode())){
ssjDevice.setTaskNo2(ParseUtil.optDInt(12, ddsx2));
}
}
}
}

View File

@@ -53,9 +53,9 @@ public class Floor1BothWayOutSsjThread implements Runnable {
roadway2.add(PlcSsjRead.deviceSsjMap.get("L2005"));
ssjCodeList.put("roadway2", roadway2);
ArrayList<DeviceSsj> ou1 = new ArrayList<>();
ou1.add(PlcSsjRead.deviceSsjMap.get("L2004"));
ssjCodeList.put("ou1", ou1);
ArrayList<DeviceSsj> out1 = new ArrayList<>();
out1.add(PlcSsjRead.deviceSsjMap.get("L2004"));
ssjCodeList.put("out1", out1);
ArrayList<DeviceSsj> out2 = new ArrayList<>();
out2.add(PlcSsjRead.deviceSsjMap.get("L2006"));
ssjCodeList.put("out2", out2);
@@ -87,10 +87,14 @@ public class Floor1BothWayOutSsjThread implements Runnable {
switch (type) {
case "roadway1":
dispatch(ssjCodeList.get(type));
break;
case "roadway2":
dispatch(ssjCodeList.get(type));
break;
case "out1":
dispatch1(ssjCodeList.get(type));
break;
case "out2":
dispatch1(ssjCodeList.get(type));
break;
@@ -109,9 +113,9 @@ public class Floor1BothWayOutSsjThread implements Runnable {
private void dispatch1(List<DeviceSsj> ssjList) {
for (DeviceSsj ssj : ssjList) {
if (ssj.getTaskNo() > 0) {
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(ssj.getTaskNo()));
if(Convert.toInt(mydoJob.getInOrOut()) > 20){
if (ssj.getTaskNo2() > 0) {
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(ssj.getTaskNo2()));
if(mydoJob != null && Convert.toInt(mydoJob.getInOrOut()) > 20){
if (ObjUtil.isNotNull(mydoJob) && mydoJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ)) {
mydoJob.setExecutionPhase(TASK_EP_SSJ);
mydoJobService.updateMydoJob(mydoJob);
@@ -145,18 +149,21 @@ public class Floor1BothWayOutSsjThread implements Runnable {
public void dispatch(List<DeviceSsj> ssjList) {
DeviceSsj deviceSsj = ssjList.get(0);
DeviceSsj ssj = new DeviceSsj();
DeviceSsj inOutSsj = new DeviceSsj();
String roadwayId = "";
String entrance_id = "";
if ("L2003".equals(deviceSsj.getDeviceCode())) {
roadwayId = "1";
ssj = ssjCodeList.get("roadway1Both").get(0);
entrance_id = "L2004";
inOutSsj = PlcSsjRead.deviceSsjMap.get("L2004");
}
if("L2005".equals(deviceSsj.getDeviceCode())) {
roadwayId = "2";
ssj = ssjCodeList.get("roadway2Both").get(0);
entrance_id = "L2006";
inOutSsj = PlcSsjRead.deviceSsjMap.get("L2006");
}
List<String> exitList = new ArrayList<>();
@@ -164,7 +171,7 @@ public class Floor1BothWayOutSsjThread implements Runnable {
MydoJob mydoJob = mydoJobService.selectMydoJobByExitList1(exitList, roadwayId);
MydoJob inJob = mydoJobService.selectMydoJobByEntranceList1(entrance_id);
if (ObjUtil.isNotNull(mydoJob) && deviceSsj.getKx() == 1 && ssj.getKx() == 0
&& ObjUtil.isNull(inJob) && ssj.getInOrOut() == 1) {
&& ObjUtil.isNull(inJob) && inOutSsj.getInOrOut() == 1 ) {
//所有线体为空闲 并且存在出库作业 并且不存在入库作业
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
if (ObjUtil.isNull(basCargoSpace)) {

View File

@@ -120,7 +120,7 @@ public class Floor1SingleSsjThread implements Runnable {
private void dispatch2(DeviceSsj ssj) {
if (ssj.getTaskNo() > 0) {
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(ssj.getTaskNo()));
if (ObjUtil.isNotNull(mydoJob)) {
if (ObjUtil.isNotNull(mydoJob) && Convert.toInt(mydoJob.getInOrOut()) > 20) {
mydoJob.setExecutionPhase(TASK_EP_SSJ);
mydoJobService.updateMydoJob(mydoJob);
JobCallBack jobCallBack = new JobCallBack();

View File

@@ -97,7 +97,7 @@ public class Floor2InOutSsjThread implements Runnable {
//agvQueue.setStatus("4");
//todo 与agv对点
agvQueue.setPositionCode2(inSsjDevice.getDeviceCode());
List<AgvQueue> agvQueues = agvQueueService.selectAgvQueueList(agvQueue);
List<AgvQueue> agvQueues = agvQueueService.selectAgvQueueList1(agvQueue);
//不允许放货 等着
if (!agvQueues.isEmpty() && inSsjDevice.getAllowPut() == 0 && "L1001".equals(inSsjDevice.getDeviceCode())) {
//下发输送线切换导向 DB未知
@@ -131,7 +131,7 @@ public class Floor2InOutSsjThread implements Runnable {
agvQueue.setStatus("7"); //end
//todo 与agv对点
agvQueue.setPositionCode2(inSsjDevice.getDeviceCode());
List<AgvQueue> agvQueues = agvQueueService.selectAgvQueueList(agvQueue);
List<AgvQueue> agvQueues = agvQueueService.selectAgvQueueList1(agvQueue);
if (!agvQueues.isEmpty()) {
//解绑AGV容器
apiService.deleteAgvTray(agvQueues.get(0));
@@ -162,7 +162,7 @@ public class Floor2InOutSsjThread implements Runnable {
agvQueue.setStatus("7"); //end
//todo 与agv对点
agvQueue.setPositionCode2(inSsjDevice.getDeviceCode());
List<AgvQueue> agvQueues = agvQueueService.selectAgvQueueList(agvQueue);
List<AgvQueue> agvQueues = agvQueueService.selectAgvQueueList1(agvQueue);
if(agvQueues.size() > 0){
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(agvQueues.get(0).getTaskCode());
mydoJob.setExecutionPhase(TASK_EP_SSJ);

View File

@@ -133,10 +133,10 @@ public class Floor2RoadWaySsjThread implements Runnable {
if(roadSsjDevice.getKx()==1 && roadSsjDevice.getTaskNo() == 0){
List<String> exitList = new ArrayList<>();
if("L1002".equals(roadSsjDevice.getDeviceCode())){
exitList.add("l1001");
exitList.add("L1001");
}
if("L1004".equals(roadSsjDevice.getDeviceCode())){
exitList.add("l1003");
exitList.add("L1003");
}
List<MydoJob> inList = mydoJobService.getInJobByEntrance(exitList);
if(inList.size() == 0){

View File

@@ -241,10 +241,10 @@ public class LineSsjThread implements Runnable {
//log.info("设备:{} 位置:{} 条码:{} 托盘大小:{}", SsjDevice.getDeviceCode(), "产线收到wcs任务号", SsjDevice.getTrayCode(), SsjDevice.getTraySize());
//任务号查wcs作业,查巷道,看目标输送线是否空闲,查是否有出库作业,生成agv队列
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(SsjDevice.getTaskNo()));
String deviceCode = "";
if (mydoJob != null) {
if ("1".equals(mydoJob.getRoadwayId())) {
deviceCode = "L1001";
} else {

View File

@@ -26,7 +26,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectAgvQueueVo">
select req_code, req_time, position_code_1, position_code_2, task_type, ctnr_type, ctnr_code, ctnr_num, task_mode, priority, agv_type, request, finish_time, wms_traycode, wms_task_no,status,task_code,wms_task_type from agv_queue
select req_code, req_time, position_code_1, position_code_2, task_type, ctnr_type, ctnr_code,
ctnr_num, task_mode, priority, agv_type, request, finish_time, wms_traycode, wms_task_no,
status,task_code,wms_task_type from agv_queue
</sql>
<select id="selectAgvQueueList" parameterType="AgvQueue" resultMap="AgvQueueResult">
@@ -53,6 +55,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by req_time desc
</select>
<select id="selectAgvQueueList1" parameterType="AgvQueue" resultMap="AgvQueueResult">
select * from agv_queue where status=#{status} and position_code_2 like concat('%',#{positionCode2},'%')
</select>
<select id="selectAgvQueueByReqCode" parameterType="String" resultMap="AgvQueueResult">
<include refid="selectAgvQueueVo"/>
where req_code = #{reqCode}

View File

@@ -255,6 +255,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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>

View File

@@ -148,6 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where uuid = #{uuid}
</update>
<delete id="deleteDdjDeviceExecutionQueueByUuid" parameterType="String">
delete from ddj_device_execution_queue where uuid = #{uuid}
</delete>