编辑设备类型和出入库调度
This commit is contained in:
@@ -143,6 +143,11 @@ public interface IApiService
|
||||
*/
|
||||
public AjaxResult createInMydoJob(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 入库请求作业异常反馈(扫码失败、外形、称重等异常)
|
||||
*/
|
||||
public AjaxResult createInMydoJobException(Map<String, Object> param);
|
||||
|
||||
public AjaxResult selectMydoJobByNoTrayCode(Map<String, Object> param);
|
||||
|
||||
AjaxResult receiveOutMydoJob(ReceiveJob receiveOutJob);
|
||||
|
||||
@@ -431,6 +431,22 @@ public class ApiServiceImpl implements IApiService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 入库请求作业异常反馈(扫码失败、外形、称重等异常)
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult createInMydoJobException(Map<String, Object> param) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(WMS_STOCKIN_MYDOJOB, "入库异常反馈", JSONUtil.toJsonStr(param));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
InterfaceReceive bean = JSONUtil.toBean(requestLog.getResponseBody(), InterfaceReceive.class);
|
||||
return AjaxResult.success(bean.getData());
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult receiveOutMydoJob(ReceiveJob receiveOutJob) {
|
||||
@@ -440,9 +456,10 @@ public class ApiServiceImpl implements IApiService {
|
||||
job.setTaskNo(receiveOutJob.getTaskNo());
|
||||
List<MydoJob> tasks = mydoJobService.selectMydoJobList(job);
|
||||
|
||||
//校验:任务已存在
|
||||
if (tasks.size() != 0) {
|
||||
log.info("【请求异常】wms下发出库任务失败,该任务已存在,任务号:{}", receiveOutJob.getTaskNo());
|
||||
return AjaxResult.error("【请求异常】wms下发出库任务失败,该任务已存在,任务号:" + receiveOutJob.getTaskNo());
|
||||
log.info("【请求异常】wms下发出库任务失败,该任务已存在,单号:{},任务号:{}", receiveOutJob.getJobId(), receiveOutJob.getTaskNo());
|
||||
return AjaxResult.error("【请求异常】wms下发出库任务失败,该任务已存在,单号:" + receiveOutJob.getJobId() + ",任务号:" + receiveOutJob.getTaskNo());
|
||||
}
|
||||
|
||||
//生成出库作业
|
||||
|
||||
@@ -157,7 +157,7 @@ public class RequestLogServiceImpl implements IRequestLogService
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequestLog getRequestLog2(String url, String endPoint,String param) {
|
||||
public RequestLog getRequestLog2(String url, String endPoint, String param) {
|
||||
RequestLog requestLog = new RequestLog();
|
||||
Date requestTime = new Date();
|
||||
requestLog.setRequestTime(DateUtil.format(requestTime, "yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
@@ -60,4 +60,13 @@ public interface IBasCargoSpaceService
|
||||
public int deleteBasCargoSpaceByCargoSpaceId(String cargoSpaceId);
|
||||
|
||||
BasCargoSpace selectBasCargoSpaceByWmsCargoSpaceId(String cargoSpaceId);
|
||||
|
||||
|
||||
/**
|
||||
* 清空【出库无货】的异常库存 - 重置为空货位状态
|
||||
* @param cargoSpaceId
|
||||
* @return
|
||||
*/
|
||||
public int resetCargoSpaceByStockoutException(String cargoSpaceId);
|
||||
|
||||
}
|
||||
|
||||
@@ -95,4 +95,21 @@ public class BasCargoSpaceServiceImpl implements IBasCargoSpaceService
|
||||
public BasCargoSpace selectBasCargoSpaceByWmsCargoSpaceId(String cargoSpaceId) {
|
||||
return basCargoSpaceMapper.selectBasCargoSpaceByWmsCargoSpaceId(cargoSpaceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空【出库无货】的异常库存
|
||||
* @param cargoSpaceId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int resetCargoSpaceByStockoutException(String cargoSpaceId){
|
||||
//清空该异常货位库存信息
|
||||
BasCargoSpace cargoSpace = new BasCargoSpace();
|
||||
cargoSpace.setTrayCode("");
|
||||
cargoSpace.setStatus("1");
|
||||
cargoSpace.setCargoSpaceId(cargoSpaceId);
|
||||
return basCargoSpaceMapper.updateBasCargoSpace(cargoSpace);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ruoyi.common;
|
||||
|
||||
/**
|
||||
* 输送机报警
|
||||
*/
|
||||
public class ConvException {
|
||||
|
||||
/**
|
||||
* 外形检测异常
|
||||
*/
|
||||
public static final int CHECK_SIZE_EXCEPTION = 0;
|
||||
|
||||
|
||||
/**
|
||||
* 超重
|
||||
*/
|
||||
public static final int CHECK_OVERWEIGHT_EXCEPTION = 1;
|
||||
|
||||
/**
|
||||
* 扫码异常
|
||||
*/
|
||||
public static final int CHECK_BARCODE_EXCEPTION = 2;
|
||||
|
||||
/**
|
||||
* 输送机非自动
|
||||
*/
|
||||
public static final int CHECK_MODE_EXCEPTION = 3;
|
||||
|
||||
|
||||
}
|
||||
@@ -101,4 +101,15 @@ public class MsgDdjController extends BaseController
|
||||
{
|
||||
return toAjax(msgDdjService.deleteMsgDdjByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getStackerStatus/{id}")
|
||||
public MsgDdj getStackerStatus(@PathVariable Long id){
|
||||
if (id == 1) {
|
||||
return msgDdjService.selectMsgDdjById(id);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -74,6 +74,9 @@ public class DeviceSsj extends BaseEntity
|
||||
@Excel(name = "任务号")
|
||||
private int taskNo;
|
||||
|
||||
/**
|
||||
* 输送机报警
|
||||
*/
|
||||
@Excel(name = "异常")
|
||||
private int exception;
|
||||
|
||||
|
||||
@@ -58,6 +58,14 @@ public interface MydoJobMapper
|
||||
*/
|
||||
public int deleteMydoJobByJobId(String jobId);
|
||||
|
||||
/**
|
||||
* 删除作业信息
|
||||
*
|
||||
* @param taskNo 任务号主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMydoJobByTaskNo(String taskNo);
|
||||
|
||||
/**
|
||||
* 批量删除作业信息
|
||||
*
|
||||
|
||||
@@ -88,6 +88,8 @@ public interface IMydoJobService
|
||||
|
||||
AjaxResult OuthandFinish(String[] jobIds);
|
||||
|
||||
public AjaxResult ManuelTaskFinish(String[] taskNos);
|
||||
|
||||
List<MydoJob> getInJobByEntranceId(String exitId);
|
||||
|
||||
MydoJob selectMydoJobByExitId(String exitId);
|
||||
|
||||
@@ -133,7 +133,7 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
map.put("v_rwh", rwh);
|
||||
map.put("v_ddj_id", id);
|
||||
mydoJobMapper.InvalidMydoJob(map);
|
||||
if (Convert.toInt(map.get("v_result"))==10){
|
||||
if (Convert.toInt(map.get("v_result")) == 10){
|
||||
return true;
|
||||
}else {
|
||||
throw new RuntimeException(map.get("v_result").toString());
|
||||
@@ -170,11 +170,18 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
return mydoJobMapper.selectMydoJobByEntranceList1(entranceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动处理同一【作业单号】的作业
|
||||
* 如果【jobid】和【taskno】是一对多的情况,使用上一个方法<OuthandFinish>手动完成作业会导致整个【jobid】单据完成回传
|
||||
* @param jobIds
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult OuthandFinish(String[] jobIds) {
|
||||
//获取所有符合【任务单号】的作业
|
||||
for (String jobId : jobIds) {
|
||||
mydoJobMapper.insertHistory(jobId);
|
||||
MydoJob mydoJob = mydoJobMapper.selectMydoJobByJobId(jobId);
|
||||
MydoJob mydoJob = mydoJobMapper.selectMydoJobByJobId(jobId);
|
||||
JobCallBack jobCallBack = new JobCallBack();
|
||||
long jobIdNum = Long.parseLong(mydoJob.getInOrOut());
|
||||
if (jobIdNum > 20){
|
||||
@@ -192,6 +199,39 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
return AjaxResult.success("操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动处理指定批量【任务号】的作业
|
||||
* @param taskNos
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult ManuelTaskFinish(String[] taskNos) {
|
||||
//todo 需要确定【jobid】是否由wms下发
|
||||
// 如果【jobid】和【taskno】是一对多的情况,使用上一个方法<OuthandFinish>手动完成作业会导致整个【jobid】单据完成回传
|
||||
// 如果【jobid】和【taskno】是一对一的情况,则直接使用<OuthandFinish>方法手动完成即可
|
||||
//获取所有符合【任务号】的作业
|
||||
for (String taskNo : taskNos) {
|
||||
MydoJob mydoJob = mydoJobMapper.selectMydoJobByTaskNo(taskNo);
|
||||
mydoJobMapper.insertHistory(mydoJob.getInOrOut());
|
||||
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(taskNo));
|
||||
jobCallBack.setCreateTime(new Date());
|
||||
jobCallBack.setSpare1("0");
|
||||
jobCallBackService.insertJobCallBack(jobCallBack);
|
||||
mydoJobMapper.deleteMydoJobByTaskNo(taskNo);
|
||||
}
|
||||
|
||||
return AjaxResult.success("操作成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MydoJob> getInJobByEntranceId(String exitId) {
|
||||
return mydoJobMapper.getInJobByEntranceId(exitId);
|
||||
|
||||
@@ -137,71 +137,71 @@ public class PlcSsjRead implements Runnable {
|
||||
*
|
||||
* @param ssjDevice
|
||||
*/
|
||||
// private void readPlcSmSsj(DeviceSsj ssjDevice) {
|
||||
// OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("30"));
|
||||
// String ddsx1 = "0";
|
||||
// if (read2.IsSuccess) {
|
||||
// ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
// ssjDevice.setDw(ParseUtil.optInt(0, ddsx1));
|
||||
// ssjDevice.setKx(ParseUtil.optInt(2, ddsx1));
|
||||
// ssjDevice.setTaskNo(ParseUtil.optDInt(4, ddsx1));
|
||||
// ssjDevice.setSszt(ParseUtil.optInt(8, ddsx1));
|
||||
// ssjDevice.setRkqq(ParseUtil.optInt(10, ddsx1));
|
||||
// ssjDevice.setTraySize(ParseUtil.optInt(12, ddsx1));
|
||||
// ssjDevice.setInOrOut(ParseUtil.optInt(24, ddsx1));
|
||||
// ssjDevice.setException(ParseUtil.optInt(28, ddsx1));
|
||||
//
|
||||
// String trayCodeReadAddress="";
|
||||
// String allot="";
|
||||
// switch (ssjDevice.getDeviceCode()){
|
||||
// case "G1005":
|
||||
// trayCodeReadAddress = "DB503.0";
|
||||
// allot = "DB802.24";
|
||||
// break;
|
||||
// case "L2004":
|
||||
// trayCodeReadAddress = "DB503.600";
|
||||
// break;
|
||||
// case "L2006":
|
||||
// trayCodeReadAddress = "DB503.800";
|
||||
// break;
|
||||
// case "L1001":
|
||||
// trayCodeReadAddress = "DB503.200";
|
||||
// allot = "DB802.0";
|
||||
// break;
|
||||
// case "L1003":
|
||||
// trayCodeReadAddress = "DB503.400";
|
||||
// allot = "DB802.12";
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// if(!"".equals(allot)){
|
||||
// OperateResultExOne<byte[]> agvSsj = readWriteNet.Read(allot, Short.parseShort("2"));
|
||||
// if (agvSsj.IsSuccess){
|
||||
// //去除bytes中
|
||||
// ddsx1 = SoftBasic.ByteToHexString(agvSsj.Content);
|
||||
// ssjDevice.setAllowPut(ParseUtil.optInt(0, ddsx1));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// OperateResultExOne<byte[]> agvSsjTask = readWriteNet.Read("DB501.280", Short.parseShort("16"));
|
||||
// String ddsx2 = "0";
|
||||
// if (agvSsjTask.IsSuccess) {
|
||||
// ddsx2 = SoftBasic.ByteToHexString(agvSsjTask.Content);
|
||||
// if("L1001".equals(ssjDevice.getDeviceCode())){
|
||||
// ssjDevice.setTaskNo2(ParseUtil.optDInt(0, ddsx2));
|
||||
// }
|
||||
// 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));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
private void readPlcSmSsj(DeviceSsj ssjDevice) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("30"));
|
||||
String ddsx1 = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
ssjDevice.setDw(ParseUtil.optInt(0, ddsx1));
|
||||
ssjDevice.setKx(ParseUtil.optInt(2, ddsx1));
|
||||
ssjDevice.setTaskNo(ParseUtil.optDInt(4, ddsx1));
|
||||
ssjDevice.setSszt(ParseUtil.optInt(8, ddsx1));
|
||||
ssjDevice.setRkqq(ParseUtil.optInt(10, ddsx1));
|
||||
ssjDevice.setTraySize(ParseUtil.optInt(12, ddsx1));
|
||||
ssjDevice.setInOrOut(ParseUtil.optInt(24, ddsx1));
|
||||
ssjDevice.setException(ParseUtil.optInt(28, ddsx1));
|
||||
|
||||
String trayCodeReadAddress="";
|
||||
String allot="";
|
||||
switch (ssjDevice.getDeviceCode()){
|
||||
case "G1005":
|
||||
trayCodeReadAddress = "DB503.0";
|
||||
allot = "DB802.24";
|
||||
break;
|
||||
case "L2004":
|
||||
trayCodeReadAddress = "DB503.600";
|
||||
break;
|
||||
case "L2006":
|
||||
trayCodeReadAddress = "DB503.800";
|
||||
break;
|
||||
case "L1001":
|
||||
trayCodeReadAddress = "DB503.200";
|
||||
allot = "DB802.0";
|
||||
break;
|
||||
case "L1003":
|
||||
trayCodeReadAddress = "DB503.400";
|
||||
allot = "DB802.12";
|
||||
break;
|
||||
}
|
||||
|
||||
if(!"".equals(allot)){
|
||||
OperateResultExOne<byte[]> agvSsj = readWriteNet.Read(allot, Short.parseShort("2"));
|
||||
if (agvSsj.IsSuccess){
|
||||
//去除bytes中
|
||||
ddsx1 = SoftBasic.ByteToHexString(agvSsj.Content);
|
||||
ssjDevice.setAllowPut(ParseUtil.optInt(0, ddsx1));
|
||||
}
|
||||
}
|
||||
|
||||
OperateResultExOne<byte[]> agvSsjTask = readWriteNet.Read("DB501.280", Short.parseShort("16"));
|
||||
String ddsx2 = "0";
|
||||
if (agvSsjTask.IsSuccess) {
|
||||
ddsx2 = SoftBasic.ByteToHexString(agvSsjTask.Content);
|
||||
if("L1001".equals(ssjDevice.getDeviceCode())){
|
||||
ssjDevice.setTaskNo2(ParseUtil.optDInt(0, ddsx2));
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -192,6 +192,9 @@ public class DdjThread implements Runnable {
|
||||
if (ajaxResult.isSuccess()) {
|
||||
//作废作业
|
||||
InvalidMydoJob(rwh, ddj.getId());
|
||||
|
||||
//重置【取货无货】的出库异常货位库存信息
|
||||
basCargoSpaceService.resetCargoSpaceByStockoutException(mydoJob.getCargoSpaceId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
||||
import com.ruoyi.common.ConvException;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
@@ -37,6 +40,7 @@ public class PortConvThread implements Runnable {
|
||||
private IAgvQueueService agvQueueService;
|
||||
private IMydoJobService mydoJobService;
|
||||
private IJobCallBackService jobCallBackService;
|
||||
private IBasCargoSpaceService cargoSpaceService;
|
||||
|
||||
public boolean isRun = true;
|
||||
|
||||
@@ -92,38 +96,86 @@ public class PortConvThread implements Runnable {
|
||||
//---------------------------入库模式---------------------------
|
||||
case 1:
|
||||
//---------------------------入口取输送机(叉车取放货位置)---------------------------
|
||||
//【不空闲】、【输送到位】、【条码不为空】
|
||||
if (inSsjDevice.getKx() != 1 && inSsjDevice.getDw() == 1 && inSsjDevice.getTrayCode() != "") {
|
||||
|
||||
//todo 外形校验
|
||||
|
||||
|
||||
//todo 称重校验
|
||||
|
||||
|
||||
//todo 条码校验 异常入库退回
|
||||
|
||||
//输送机【非空闲】、【输送到位】、【条码不为空】、有【入库请求】
|
||||
if (inSsjDevice.getKx() != 1 && inSsjDevice.getDw() == 1) {
|
||||
AjaxResult ajaxResult;
|
||||
|
||||
//请求参数
|
||||
//todo 核对请求wms接口参数数量
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
//托盘条码
|
||||
paramMap.put("trayCode", inSsjDevice.getTrayCode());
|
||||
paramMap.put("trayCode", inSsjDevice.getTrayCode());//托盘条码
|
||||
int height = inSsjDevice.getHeight();
|
||||
int weight = inSsjDevice.getWeight();
|
||||
//重量
|
||||
paramMap.put("weight", weight);
|
||||
//高度
|
||||
paramMap.put("height", height);
|
||||
paramMap.put("errorInfo", null);
|
||||
paramMap.put("weight", weight);//重量
|
||||
paramMap.put("height", height);//高度
|
||||
|
||||
//入库口异常校验
|
||||
switch (inSsjDevice.getException()) {
|
||||
|
||||
//外形检测异常
|
||||
case ConvException.CHECK_SIZE_EXCEPTION:
|
||||
paramMap.put("errorInfo", "外形检测异常-货物超高");
|
||||
ajaxResult = apiService.createInMydoJobException(paramMap);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
//向输送机下发退回
|
||||
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 99, 1);
|
||||
}
|
||||
return;
|
||||
|
||||
//超重检测
|
||||
case ConvException.CHECK_OVERWEIGHT_EXCEPTION:
|
||||
paramMap.put("errorInfo", "外形检测异常-货物超重");
|
||||
ajaxResult = apiService.createInMydoJobException(paramMap);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
//向输送机下发退回
|
||||
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 99, 1);
|
||||
}
|
||||
return;
|
||||
|
||||
//扫码异常
|
||||
case ConvException.CHECK_BARCODE_EXCEPTION:
|
||||
if (inSsjDevice.getTrayCode() == "") {
|
||||
paramMap.put("errorInfo", "条码扫描失败:扫描结果为空");
|
||||
ajaxResult = apiService.createInMydoJobException(paramMap);
|
||||
}else{
|
||||
//条码格式校验
|
||||
paramMap.put("errorInfo", "条码扫描异常:格式错误");
|
||||
ajaxResult = apiService.createInMydoJobException(paramMap);
|
||||
}
|
||||
if (ajaxResult.isSuccess()) {
|
||||
//向输送机下发退回
|
||||
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 99, 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//校验:有【入库请求】再请求获取wcs任务
|
||||
if (inSsjDevice.getRkqq() != 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
//校验:当前条码任务已存在
|
||||
MydoJob job = new MydoJob();
|
||||
job.setTrayCode(inSsjDevice.getTrayCode());
|
||||
if (mydoJobService.selectMydoJobList(job).size() > 0) {
|
||||
log.warn("【生成wcs任务异常】该托盘号已有作业,托盘条码:{}",inSsjDevice.getTrayCode());
|
||||
return;
|
||||
}
|
||||
|
||||
//校验:当前条码已有库存
|
||||
BasCargoSpace cargoSpace = new BasCargoSpace();
|
||||
cargoSpace.setTrayCode(inSsjDevice.getTrayCode());
|
||||
if (cargoSpaceService.selectBasCargoSpaceList(cargoSpace).size() > 0) {
|
||||
log.warn("【生成wcs任务异常】该托盘号已有库存,托盘条码:{}",inSsjDevice.getTrayCode());
|
||||
return;
|
||||
}
|
||||
|
||||
//请求生成wcs任务
|
||||
AjaxResult ajaxResult = apiService.createInMydoJob(paramMap);
|
||||
ajaxResult = apiService.createInMydoJob(paramMap);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
//获取wms下发的任务号和分配货位
|
||||
MydoJob mydoJob = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
|
||||
|
||||
//todo wms分配的货位(排列层)校验
|
||||
//todo 校验wms分配的货位(排列层)是否合法
|
||||
if (mydoJob.getCargoSpaceId() == null) {
|
||||
log.info("【请求参数异常】分配货位:null,托盘条码:{}",inSsjDevice.getTrayCode());
|
||||
return;
|
||||
@@ -140,19 +192,21 @@ public class PortConvThread implements Runnable {
|
||||
mydoJob.setPriority(Long.valueOf(10));
|
||||
|
||||
//拿到正常作业,插到wcs作业表,下发给输送机任务号,覆盖任务号
|
||||
mydoJobService.insertMydoJob(mydoJob);
|
||||
|
||||
log.info("请求生成wcs作业成功,wms下发任务单号:{}, 任务号:{},托盘条码:{},分配货位:{}", mydoJob.getJobId(), mydoJob.getTaskNo(), mydoJob.getTrayCode(), mydoJob.getCargoSpaceId());
|
||||
|
||||
//向输送机下发任务号
|
||||
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), mydoJob.getTaskNo(), Integer.parseInt(mydoJob.getTraySize()), 1);
|
||||
if (i == 1) {
|
||||
//写入成功则更新执行阶段
|
||||
mydoJob.setExecutionPhase(TASK_EP_LINE_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
log.info("G1004入口输送机下发任务号成功:{}", mydoJob.getTaskNo());
|
||||
if (mydoJobService.insertMydoJob(mydoJob) == 1) {
|
||||
log.info("请求生成wcs作业成功,wms下发任务单号:{}, 任务号:{},托盘条码:{},分配货位:{}", mydoJob.getJobId(), mydoJob.getTaskNo(), mydoJob.getTrayCode(), mydoJob.getCargoSpaceId());
|
||||
}else{
|
||||
//向输送机下发任务号
|
||||
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), mydoJob.getTaskNo(), Integer.parseInt(mydoJob.getTraySize()), 1);
|
||||
if (i == 1) {
|
||||
//写入成功则更新执行阶段
|
||||
mydoJob.setExecutionPhase(TASK_EP_LINE_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
log.info("G1004入口输送机下发任务号成功:{}", mydoJob.getTaskNo());
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
//请求生成wcs任务失败
|
||||
//todo 向输送机下发退回
|
||||
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 99, 1);
|
||||
|
||||
|
||||
@@ -66,10 +66,10 @@ spring:
|
||||
# 热部署开关
|
||||
enabled: true
|
||||
# redis 配置
|
||||
redis:
|
||||
spring.redis:
|
||||
# 地址
|
||||
# host: 192.168.58.10
|
||||
host: 172.16.4.12
|
||||
host: 127.0.0.1
|
||||
# host: 172.16.4.12
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
|
||||
@@ -36,21 +36,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectDeviceSsjList" parameterType="DeviceSsj" resultMap="DeviceSsjResult">
|
||||
<include refid="selectDeviceSsjVo"/>
|
||||
<where>
|
||||
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode }</if>
|
||||
<if test="name != null and name != ''"> and name = #{name }</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if>
|
||||
<if test="plcDbReadAddress != null and plcDbReadAddress != ''"> and plc_db_read_address = #{plcDbReadAddress}</if>
|
||||
<if test="isActive != null and isActive != ''"> and is_active = #{isActive}</if>
|
||||
<if test="plcDbWriteAddress != null and plcDbWriteAddress != ''"> and plc_db_write_address = #{plcDbWriteAddress}</if>
|
||||
<if test="rkqq != null and rkqq != ''"> and rkqq = #{rkqq}</if>
|
||||
<if test="kx != null and kx != ''"> and kx = #{kx}</if>
|
||||
<if test="dw != null and dw != ''"> and dw = #{dw}</if>
|
||||
<if test="trayCode != null and trayCode != ''"> and tray_code = #{trayCode}</if>
|
||||
<if test="taskNo != null and taskNo != ''"> and task_no = #{taskNo}</if>
|
||||
<if test="exception != null and exception != ''"> and exception = #{exception}</if>
|
||||
<if test="traySize != null and traySize != ''"> and tray_size = #{traySize}</if>
|
||||
<if test="allowPut != null and allowPut != ''"> and allow_put = #{allowPut}</if>
|
||||
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode}</if>
|
||||
<if test="name != null and name != ''"> and name = #{name}</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if>
|
||||
<if test="plcDbReadAddress != null and plcDbReadAddress != ''"> and plc_db_read_address = #{plcDbReadAddress}</if>
|
||||
<if test="isActive != null and isActive != ''"> and is_active = #{isActive}</if>
|
||||
<if test="plcDbWriteAddress != null and plcDbWriteAddress != ''"> and plc_db_write_address = #{plcDbWriteAddress}</if>
|
||||
<if test="rkqq != null and rkqq != ''"> and rkqq = #{rkqq}</if>
|
||||
<if test="kx != null and kx != ''"> and kx = #{kx}</if>
|
||||
<if test="dw != null and dw != ''"> and dw = #{dw}</if>
|
||||
<if test="trayCode != null and trayCode != ''"> and tray_code = #{trayCode}</if>
|
||||
<if test="taskNo != null and taskNo != ''"> and task_no = #{taskNo}</if>
|
||||
<if test="exception != null and exception != ''"> and exception = #{exception}</if>
|
||||
<if test="traySize != null and traySize != ''"> and tray_size = #{traySize}</if>
|
||||
<if test="allowPut != null and allowPut != ''"> and allow_put = #{allowPut}</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -206,6 +206,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
delete from mydo_job_wcs where job_id = #{jobId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMydoJobByTaskNo" parameterType="String">
|
||||
delete from mydo_job_wcs where task_no = #{taskNo}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMydoJobByJobIds" parameterType="String">
|
||||
delete from mydo_job_wcs where job_id in
|
||||
<foreach item="jobId" collection="array" open="(" separator="," close=")">
|
||||
|
||||
Reference in New Issue
Block a user