fix:异常任务相关处理

This commit is contained in:
zhouz
2024-05-21 14:53:49 +08:00
parent 8217df4480
commit 8664d7943f
17 changed files with 130 additions and 34 deletions

View File

@@ -46,4 +46,11 @@ public class VehicleTwoController {
public ResponseEntity<Object> returnIn(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(vehicleTwoService.returnIn(whereJson), HttpStatus.OK);
}
@PostMapping("/reback")
@Log("返检、改切入库")
@SaIgnore
public ResponseEntity<Object> reback(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(vehicleTwoService.reback(whereJson), HttpStatus.OK);
}
}

View File

@@ -41,4 +41,15 @@ public interface VehicleTwoService {
* @return JSONObject返回前端参数~
*/
JSONObject returnIn(JSONObject whereJson);
/**
*
* @param whereJson {
* box_no: 木箱号
* vehicle_code: 载具号
* point_code: 点位
* }
* @return JSONObject返回前端参数~
*/
JSONObject reback(JSONObject whereJson);
}

View File

@@ -11,8 +11,10 @@ import org.nl.b_lms.sch.point.service.IschBasePointService;
import org.nl.b_lms.sch.tasks.TwoInEmpExcepTask;
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.InBoxManageService;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.InBussManageService;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.InVehicleManageService;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -46,6 +48,9 @@ public class VehicleTwoServiceImpl implements VehicleTwoService {
@Autowired
private IschBasePointService ischBasePointService;
@Autowired
private InBussManageService inBussManageService;
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject vehicleIn(JSONObject whereJson) {
@@ -77,7 +82,7 @@ public class VehicleTwoServiceImpl implements VehicleTwoService {
JSONObject data = device_data.getJSONArray("data").getJSONObject(0);
// 判断是否有货 且托盘类型相同、数量小于5
if (vehicle_type.equals(data.getString("container_type")) && data.getIntValue("qty") < 5 || data.getIntValue("qty") == 0){
if (vehicle_type.equals(data.getString("container_type")) && data.getIntValue("qty") < 5 || data.getIntValue("qty") == 0) {
// 生成入库叠盘机输送任务
JSONObject jsonTaskParam = new JSONObject();
jsonTaskParam.put("task_type", "010715");
@@ -87,6 +92,8 @@ public class VehicleTwoServiceImpl implements VehicleTwoService {
jsonTaskParam.put("vehicle_code", whereJson.getString("vehicle_code"));
JSONObject param = new JSONObject();
param.put("containerType", whereJson.getString("vehicle_type"));
//0表示为空托盘
param.put("heightLevel", "0");
jsonTaskParam.put("request_param", param.toString());
TwoInEmpExcepTask taskBean = new TwoInEmpExcepTask();
@@ -119,19 +126,20 @@ public class VehicleTwoServiceImpl implements VehicleTwoService {
(data2.getString("move").equals(IOSEnum.IS_NOTANDYES.code("是"))
&& data2.getIntValue("qty") < 5)
) {*/
// 生层到出库口叠盘机任务
JSONObject jsonTaskParam = new JSONObject();
jsonTaskParam.put("task_type", "010714");
jsonTaskParam.put("start_device_code", point_code);
jsonTaskParam.put("next_device_code", next_device_code);
jsonTaskParam.put("vehicle_code", whereJson.getString("vehicle_code"));
jsonTaskParam.put("vehicle_type", whereJson.getString("vehicle_type"));
JSONObject param = new JSONObject();
param.put("containerType", whereJson.getString("vehicle_type"));
jsonTaskParam.put("request_param", param.toString());
TwoInEmpExcepTask taskBean = new TwoInEmpExcepTask();
taskBean.createTask(jsonTaskParam);
taskBean.immediateNotifyAcs(null);
// 生层到出库口叠盘机任务
JSONObject jsonTaskParam = new JSONObject();
jsonTaskParam.put("task_type", "010714");
jsonTaskParam.put("start_device_code", point_code);
jsonTaskParam.put("next_device_code", next_device_code);
jsonTaskParam.put("vehicle_code", whereJson.getString("vehicle_code"));
jsonTaskParam.put("vehicle_type", whereJson.getString("vehicle_type"));
JSONObject param = new JSONObject();
param.put("containerType", whereJson.getString("vehicle_type"));
param.put("heightLevel", "0");
jsonTaskParam.put("request_param", param.toString());
TwoInEmpExcepTask taskBean = new TwoInEmpExcepTask();
taskBean.createTask(jsonTaskParam);
taskBean.immediateNotifyAcs(null);
/*} else {
result.put("message", "入库失败! 出库叠盘位已叠满!" + next_device_code);
return result;
@@ -158,4 +166,35 @@ public class VehicleTwoServiceImpl implements VehicleTwoService {
return result;
}
@Override
public JSONObject reback(JSONObject whereJson) {
String bill_type = whereJson.getString("bill_type");
//1-返检入库2-改切入库
if (bill_type.equals("1")){
whereJson.put("bill_type", IOSEnum.IN_TYPE.code("返检入库"));
}else if (bill_type.equals("2")){
whereJson.put("bill_type", IOSEnum.IN_TYPE.code("改切入库"));
}
whereJson.put("box_no", whereJson.getString("box_no"));
JSONArray resultJSONArray = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + whereJson.getString("material_barcode") + "' AND status = '0'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(resultJSONArray)) {
throw new BadRequestException("未查询到子卷包装信息!");
}
String material_barcode = "";
for (int i = 0; i < resultJSONArray.size(); i++) {
JSONObject resultObj = resultJSONArray.getJSONObject(i);
if (i==0){
material_barcode = resultObj.getString("container_name");
}else {
material_barcode += "," + resultObj.getString("container_name");
}
}
whereJson.put("material_barcode", material_barcode);
inBussManageService.inTask(whereJson);
JSONObject result = new JSONObject();
result.put("message", "入库成功!");
return result;
}
}

View File

@@ -165,7 +165,7 @@ public class TwoExcepionalMoveTask extends AbstractAcsTask {
json.put("create_id", SecurityUtils.getCurrentUserId());
json.put("create_name", SecurityUtils.getCurrentUsername());
json.put("create_time", DateUtil.now());
json.put("priority", "1");
json.put("priority", "3");
json.put("acs_task_type", "7");
WQLObject.getWQLObject("SCH_BASE_Task").insert(json);

View File

@@ -50,6 +50,7 @@ public class TwoInEmpTask extends AbstractAcsTask {
.task_type(json.getString("acs_task_type"))
.start_device_code(json.getString("point_code1"))
.next_device_code(json.getString("point_code2"))
.interaction_json(json.getJSONObject("request_param"))
.vehicle_code(json.getString("vehicle_code"))
.priority(json.getString("priority"))
.class_type(json.getString("task_type"))
@@ -165,6 +166,7 @@ public class TwoInEmpTask extends AbstractAcsTask {
json.put("point_code1", form.getString("start_device_code"));
json.put("point_code2", form.getString("next_device_code"));
json.put("handle_class", this.getClass().getName());
json.put("request_param",form.getString("request_param"));
json.put("create_id", SecurityUtils.getCurrentUserId());
json.put("create_name", SecurityUtils.getCurrentUsername());
json.put("create_time", DateUtil.now());

View File

@@ -2,6 +2,7 @@ package org.nl.b_lms.storage_manage.ios.service.iostorInv.util.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -176,11 +177,29 @@ public class InBoxManageServiceImpl implements InBoxManageService {
* 插入木箱对应载具表
*/
String box_no = whereJson.getString("box_no");
String[] split = box_no.split(",");
String boxType = "";
for (int i = 0; i < split.length; i++) {
String boxNo = split[i];
BstIvtBoxinfo boxinfo = iBstIvtBoxinfoService.getOne(
new QueryWrapper<BstIvtBoxinfo>().lambda()
.eq(BstIvtBoxinfo::getBox_no, boxNo));
if (StrUtil.isEmpty(boxType)) {
boxType = boxinfo.getMaterial_code();
} else {
if (!boxType.equals(boxinfo.getMaterial_code())) {
throw new BadRequestException("请扫码相同规格的木箱进行堆叠入库!");
}
}
}
//查询对应的木箱信息
// 查询木箱信息
BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne(
new QueryWrapper<BstIvtBoxinfo>().lambda()
.eq(BstIvtBoxinfo::getBox_no, whereJson.getString("box_no"))
.eq(BstIvtBoxinfo::getBox_no, split[0])
);
if (boxDao == null) {
throw new BadRequestException("木箱不存在!");
@@ -254,6 +273,19 @@ public class InBoxManageServiceImpl implements InBoxManageService {
param.put("height", boxDao.getBox_high());
param.put("containerType", boxDao.getVehicle_type());
param.put("barcode", whereJson.getString("box_no"));
//根据木箱高度,判断入库仓位的高度
String height = "";
String heightLevel1 = iSysParamService.findByCode("height_level_1").getValue();
String heightLevel2 = iSysParamService.findByCode("height_level_2").getValue();
String box_high = boxDao.getBox_high();
if (Integer.parseInt(box_high) <= Integer.parseInt(heightLevel1)) {
height = "1";
} else if (Integer.parseInt(box_high) > Integer.parseInt(heightLevel1) && Integer.parseInt(box_high) <= Integer.parseInt(heightLevel2)) {
height = "2";
} else {
height = "3";
}
param.put("heightLevel", height);
taskParam.put("request_param", param.toString());
TwoInBoxTrussTask taskBean = new TwoInBoxTrussTask();
taskBean.createTask(taskParam);
@@ -323,7 +355,7 @@ public class InBoxManageServiceImpl implements InBoxManageService {
@Override
@Transactional
public String taskExceptional(JSONObject jsonObject) {
public JSONObject taskExceptional(JSONObject jsonObject) {
// 仓位表
WQLObject attrTab = WQLObject.getWQLObject("ST_IVT_StructAttr");
@@ -365,7 +397,7 @@ public class InBoxManageServiceImpl implements InBoxManageService {
taskDao.setPoint_code2(jsonAttrNow.getString("struct_code"));
ischBaseTaskService.updateById(taskDao);
return jsonAttrNow.getString("struct_code");
return jsonAttrNow;
}
/**

View File

@@ -281,7 +281,7 @@ public class InBussManageServiceImpl implements InBussManageService {
@Override
@Transactional
public String taskExceptional(JSONObject jsonObject) {
public JSONObject taskExceptional(JSONObject jsonObject) {
/*
* 1.锁定原货位
* 2.重新找新货位
@@ -356,7 +356,7 @@ public class InBussManageServiceImpl implements InBussManageService {
taskDao.setPoint_code2(disListNow.get(0).getStruct_code());
ischBaseTaskService.updateById(taskDao);
return disListNow.get(0).getStruct_code();
return JSONObject.parseObject(JSON.toJSONString(disListNow.get(0)));
}
/**

View File

@@ -89,6 +89,10 @@ public class InVehicleManageServiceImpl implements InVehicleManageService {
jsonTaskParam.put("next_device_code", jsonAttr.getString("struct_code"));
jsonTaskParam.put("vehicle_code", whereJson.getString("vehicle_code"));
jsonTaskParam.put("vehicle_type", whereJson.getString("vehicle_type"));
JSONObject param = new JSONObject();
param.put("containerType", whereJson.getString("vehicle_type"));
//0表示为空托盘
jsonTaskParam.put("request_param", param.toString());
TwoInEmpTask taskBean = new TwoInEmpTask();
taskBean.createTask(jsonTaskParam);
@@ -106,7 +110,7 @@ public class InVehicleManageServiceImpl implements InVehicleManageService {
@Override
@Transactional
public String taskExceptional(JSONObject jsonObject) {
public JSONObject taskExceptional(JSONObject jsonObject) {
// 仓位表
WQLObject attrTab = WQLObject.getWQLObject("ST_IVT_StructAttr");
@@ -141,7 +145,7 @@ public class InVehicleManageServiceImpl implements InVehicleManageService {
taskDao.setPoint_code2(jsonAttrNow.getString("struct_code"));
ischBaseTaskService.updateById(taskDao);
return jsonAttrNow.getString("struct_code");
return jsonAttrNow;
}
/**

View File

@@ -116,7 +116,7 @@ public class OutBoxManageServiceImpl implements OutBoxManageService {
@Override
@Transactional
public String taskExceptional(JSONObject jsonObject) {
public JSONObject taskExceptional(JSONObject jsonObject) {
// 仓位表
WQLObject attrTab = WQLObject.getWQLObject("ST_IVT_StructAttr");
@@ -160,7 +160,7 @@ public class OutBoxManageServiceImpl implements OutBoxManageService {
taskDao.setVehicle_code(jsonAttrNow.getString("storagevehicle_code"));
ischBaseTaskService.updateById(taskDao);
return jsonAttrNow.getString("struct_code");
return jsonAttrNow;
}
@Override

View File

@@ -113,7 +113,7 @@ public class OutVehicleManageServiceImpl implements OutVehicleManageService {
@Override
@Transactional
public String taskExceptional(JSONObject jsonObject) {
public JSONObject taskExceptional(JSONObject jsonObject) {
// 仓位表
WQLObject attrTab = WQLObject.getWQLObject("ST_IVT_StructAttr");
@@ -150,7 +150,7 @@ public class OutVehicleManageServiceImpl implements OutVehicleManageService {
taskDao.setVehicle_code(jsonAttrNow.getString("storagevehicle_code"));
ischBaseTaskService.updateById(taskDao);
return jsonAttrNow.getString("struct_code");
return jsonAttrNow;
}
@Override

View File

@@ -44,7 +44,7 @@ public interface InBoxManageService {
* }
* @return point_code: 货位编码
*/
String taskExceptional(JSONObject jsonObject);
JSONObject taskExceptional(JSONObject jsonObject);
void returnIn(JSONObject whereJson);

View File

@@ -60,6 +60,6 @@ public interface InBussManageService {
* }
* @return point_code: 货位编码
*/
String taskExceptional(JSONObject jsonObject);
JSONObject taskExceptional(JSONObject jsonObject);
}

View File

@@ -29,6 +29,6 @@ public interface InVehicleManageService {
* }
* @return point_code: 货位编码
*/
String taskExceptional(JSONObject jsonObject);
JSONObject taskExceptional(JSONObject jsonObject);
}

View File

@@ -32,7 +32,7 @@ public interface OutBoxManageService {
* }
* @return point_code: 货位编码
*/
String taskExceptional(JSONObject jsonObject);
JSONObject taskExceptional(JSONObject jsonObject);
/**
* 任务异常处理(2.浅货位有货-取货时)

View File

@@ -28,7 +28,7 @@ public interface OutVehicleManageService {
* }
* @return point_code: 货位编码
*/
String taskExceptional(JSONObject jsonObject);
JSONObject taskExceptional(JSONObject jsonObject);
/**
* 任务异常处理(2.浅货位有货-取货时)

View File

@@ -2000,7 +2000,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
.eq(SchBaseTask::getTask_code, whereJson.getString("task_code"))
);
String point_code = "";
JSONObject point_code = new JSONObject();
// 判断任务类型
if (taskDao.getTask_type().equals(TASKEnum.BOX_TYPE.code("木箱入库"))) {
// 木箱入库:满入、浅货位有货-放货时
@@ -2043,7 +2043,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
result.put("status", HttpStatus.OK.value());
result.put("message", "下发成功!");
result.put("point_code", point_code);
result.put("point_code", point_code.getString("struct_code"));
result.put("vehicle_code", point_code.getString("struct_code"));
log.info("deviceApplyExceptional返回参数---------------------------------------------" + result.toString());
return result;
}

View File

@@ -50,7 +50,7 @@ public class AcsUtil {
throw new BadRequestException("未查询到区域对应的acs地址");
}
//String url =acs_url + api;
String url ="10.1.3.96:8011/"+ api;
String url =acs_url+ api;
try {
JSONArray rows = new JSONArray();
rows.add(jo);