This commit is contained in:
2024-05-13 11:11:37 +08:00
21 changed files with 125 additions and 123 deletions

View File

@@ -146,10 +146,8 @@ public class VehicleTwoServiceImpl implements VehicleTwoService {
public JSONObject boxIn(JSONObject whereJson) {
// 调用接口
inBoxManageService.boxBinVehicle(whereJson);
JSONObject result = new JSONObject();
result.put("message", "入库成功!");
return result;
}

View File

@@ -46,7 +46,7 @@ public class TwoInBoxTask extends AbstractAcsTask {
.task_type(json.getString("acs_task_type"))
.start_device_code(json.getString("point_code1"))
.next_device_code(json.getString("point_code2"))
.vehicle_code(json.getString("vehicle_code"))
.vehicle_code(json.getString("vehicle_code2"))
.priority(json.getString("priority"))
.class_type(json.getString("task_type"))
.dtl_type(String.valueOf(dtl_type))
@@ -156,6 +156,7 @@ public class TwoInBoxTask extends AbstractAcsTask {
json.put("task_code", IdUtil.getSnowflake(1, 1).nextId());
json.put("task_type", form.getString("task_type"));
json.put("vehicle_code", form.getString("vehicle_code"));
json.put("vehicle_code2", form.getString("vehicle_code2"));
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
json.put("point_code1", form.getString("start_device_code"));
json.put("point_code2", form.getString("next_device_code"));

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
@@ -16,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 二期入木箱行架任务类
@@ -34,12 +36,10 @@ public class TwoInBoxTrussTask extends AbstractAcsTask {
* 下发给ACS时需要特殊处理
*/
JSONArray arr = WQLObject.getWQLObject("SCH_BASE_Task").query("handle_class = '" + THIS_CLASS + "' and task_status = '" + TaskStatusEnum.START_AND_POINT.getCode() + "' and is_delete ='0'").getResultJSONArray(0);
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
for (int i = 0; i < arr.size(); i++) {
JSONObject json = arr.getJSONObject(i);
JSONObject params = json.getJSONObject("params");
//JSONObject params = json.getJSONObject("params");
char dtl_type = json.getString("task_type").charAt(json.getString("task_type").length() - 1);
AcsTaskDto dto = AcsTaskDto.builder()
.ext_task_id(json.getString("task_id"))
@@ -51,12 +51,8 @@ public class TwoInBoxTrussTask extends AbstractAcsTask {
.priority(json.getString("priority"))
.class_type(json.getString("task_type"))
.dtl_type(String.valueOf(dtl_type))
.remark(json.getString("remark"))
.layer(json.getString("layer"))
.barcode(params.getString("box_no"))
.height(params.getString("height"))
.width(params.getString("width"))
.length(params.getString("length"))
.interaction_json(json.getJSONObject("request_param"))
.remark(json.getString("rem ark"))
.build();
resultList.add(dto);
}
@@ -148,8 +144,8 @@ public class TwoInBoxTrussTask extends AbstractAcsTask {
json.put("create_name", SecurityUtils.getCurrentUsername());
json.put("create_time", DateUtil.now());
json.put("priority", "1");
json.put("acs_task_type", "7");
json.put("acs_task_type", "6");
json.put("request_param", form.getString("request_param"));
WQLObject.getWQLObject("SCH_BASE_Task").insert(json);
return json.getString("task_id");
}

View File

@@ -89,7 +89,6 @@ public class TwoOutEmpTask extends AbstractAcsTask {
JSONObject jsonAttr = attrTab.query("struct_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
jsonAttr.put("lock_type",IOSEnum.LOCK_TYPE.code("未锁定"));
jsonAttr.put("storagevehicle_code","");
jsonAttr.put("storagevehicle_type","");
attrTab.update(jsonAttr);
}

View File

@@ -99,6 +99,7 @@ public class InBoxManageServiceImpl implements InBoxManageService {
jsonParam.put("box_length", boxDao.getBox_length());
jsonParam.put("box_width", boxDao.getBox_width());
jsonParam.put("box_high", boxDao.getBox_high());
jsonParam.put("vehicle_type", boxDao.getVehicle_type());
JSONObject jsonAttr = getStruct(jsonParam);
@@ -114,6 +115,7 @@ public class InBoxManageServiceImpl implements InBoxManageService {
jsonTaskParam.put("start_device_code", whereJson.getString("device_code"));
jsonTaskParam.put("next_device_code", jsonAttr.getString("struct_code"));
jsonTaskParam.put("vehicle_code", whereJson.getString("box_no"));
jsonTaskParam.put("vehicle_code2", whereJson.getString("vehicle_code"));
TwoInBoxTask taskBean = new TwoInBoxTask();
taskBean.createTask(jsonTaskParam);
@@ -155,40 +157,37 @@ public class InBoxManageServiceImpl implements InBoxManageService {
new QueryWrapper<BstIvtBoxinfo>().lambda()
.eq(BstIvtBoxinfo::getBox_no, whereJson.getString("box_no"))
);
if (boxDao == null) {
throw new BadRequestException("木箱不存在!");
}
JSONObject jsonVehicle = vehicleTab.query("storagevehicle_code = '" + whereJson.getString("vehicle_code") + "'")
.uniqueResult(0);
if (ObjectUtil.isEmpty(jsonVehicle)) {
throw new BadRequestException("载具不存在!");
}
JSONObject jsonVeExt = new JSONObject();
jsonVeExt.put("storagevehicleext_id", IdUtil.getLongId());
jsonVeExt.put("storagevehicle_id", jsonVehicle.getLongValue("storagevehicle_id"));
jsonVeExt.put("storagevehicle_code", jsonVehicle.getString("storagevehicle_code"));
jsonVeExt.put("storagevehicle_type", jsonVehicle.getString("storagevehicle_type"));
jsonVeExt.put("pcsn", whereJson.getString("box_no"));
jsonVeExt.put("device_uuid", IdUtil.getLongId());
veExtTab.insert(jsonVeExt);
// if (ObjectUtil.isEmpty(jsonVehicle)) {
// throw new BadRequestException("载具不存在!");
// }
// JSONObject jsonVeExt = new JSONObject();
// jsonVeExt.put("storagevehicleext_id", IdUtil.getLongId());
// jsonVeExt.put("storagevehicle_id", jsonVehicle.getLongValue("storagevehicle_id"));
// jsonVeExt.put("storagevehicle_code", jsonVehicle.getString("storagevehicle_code"));
// jsonVeExt.put("storagevehicle_type", jsonVehicle.getString("storagevehicle_type"));
// jsonVeExt.put("pcsn", whereJson.getString("box_no"));
// jsonVeExt.put("device_uuid", IdUtil.getLongId());
// veExtTab.insert(jsonVeExt);
// 下发桁架任务
JSONObject taskParam = new JSONObject();
taskParam.put("task_type", "010713");
taskParam.put("start_device_code", whereJson.getString("point_code"));
taskParam.put("next_device_code", "1001");
taskParam.put("next_device_code", "RK1005");
taskParam.put("vehicle_code", whereJson.getString("vehicle_code"));
taskParam.put("vehicle_code2", whereJson.getString("vehicle_code"));
JSONObject param = new JSONObject();
param.put("layer",whereJson.getString("layer"));
param.put("box_length",boxDao.getBox_length());
param.put("box_width",boxDao.getBox_width());
param.put("box_high",boxDao.getBox_high());
param.put("vehicle_type", boxDao.getVehicle_type());
param.put("box_no", whereJson.getString("box_no"));
param.put("layer", whereJson.getString("layer"));
param.put("length", boxDao.getBox_length());
param.put("width", boxDao.getBox_width());
param.put("height", boxDao.getBox_high());
param.put("containerType", boxDao.getVehicle_type());
param.put("barcode", whereJson.getString("box_no"));
taskParam.put("request_param", param.toString());
TwoInBoxTrussTask taskBean = new TwoInBoxTrussTask();
taskBean.createTask(taskParam);
taskBean.immediateNotifyAcs(null);
@@ -243,13 +242,14 @@ public class InBoxManageServiceImpl implements InBoxManageService {
/**
* 找一个空仓位(木箱区)
*
* @param jsonParam {
* stor_id仓库标识
* sect_id库区标识
* box_length木箱长度
* box_width木箱宽度
* box_high木箱高度
* }
* }
* @return JSONObject 仓位对象
*/
public JSONObject getStruct(JSONObject jsonParam) {
@@ -262,8 +262,9 @@ public class InBoxManageServiceImpl implements InBoxManageService {
*/
JSONArray structArray = attrTab.query("IFNULL(storagevehicle_code,'') = '' " +
"AND is_used = '" + IOSEnum.IS_NOTANDYES.code("") + "' AND is_delete = '" + IOSEnum.IS_NOTANDYES.code("") + "' " +
"AND lock_type = '" + IOSEnum.LOCK_TYPE.code("未锁定") + "' AND stor_id = '"+jsonParam.getString("stor_id")+"' " +
"AND sect_id = '"+jsonParam.getString("sect_id")+"'").getResultJSONArray(0);
"AND storagevehicle_type = '" + jsonParam.getString("vehicle_type") + "'" +
"AND lock_type = '" + IOSEnum.LOCK_TYPE.code("未锁定") + "' AND stor_id = '" + jsonParam.getString("stor_id") + "' " +
"AND sect_id = '" + jsonParam.getString("sect_id") + "'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(structArray)) {
notInRowList.clear();
@@ -275,11 +276,11 @@ public class InBoxManageServiceImpl implements InBoxManageService {
String block_num = getMinBlock(jsonParam);
// 确定排:查看每排的木箱数量,找到数量最小的那排
jsonParam.put("block_num",block_num);
jsonParam.put("block_num", block_num);
String row_num = getMinRow(jsonParam);
// 确定仓位: 找到仓位
jsonParam.put("row_num",row_num);
jsonParam.put("row_num", row_num);
JSONObject jsonAttr = queryStruct(jsonParam);
// 为空则新找巷道
@@ -303,7 +304,7 @@ public class InBoxManageServiceImpl implements InBoxManageService {
json.put("box_high", jsonParam.getString("box_high"));
String row_num_2 = getMinRow(json);
json.put("row_num",row_num_2);
json.put("row_num", row_num_2);
JSONObject jsonAttr_2 = queryStruct(json);
if (ObjectUtil.isNotEmpty(jsonAttr_2)) {
@@ -321,13 +322,14 @@ public class InBoxManageServiceImpl implements InBoxManageService {
/**
* 确定巷道
*
* @param jsonParam {
* stor_id: 仓库标识
* sect_id: 库区标识
* box_length木箱长度
* box_width木箱宽度
* box_high木箱高度
* }
* stor_id: 仓库标识
* sect_id: 库区标识
* box_length木箱长度
* box_width木箱宽度
* box_high木箱高度
* }
* @return String 巷道
*/
private String getMinBlock(JSONObject jsonParam) {
@@ -345,7 +347,7 @@ public class InBoxManageServiceImpl implements InBoxManageService {
.collect(Collectors.joining("','"));
jsonParam.put("flag", "2");
jsonParam.put("block_in", "('"+block_in+"')");
jsonParam.put("block_in", "('" + block_in + "')");
List<JSONObject> boxAllList = WQL.getWO("BST_INBOX").addParamMap(jsonParam)
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
@@ -379,14 +381,15 @@ public class InBoxManageServiceImpl implements InBoxManageService {
/**
* 确定排
*
* @param jsonParam {
* stor_id: 仓库标识
* sect_id: 库区标识
* stor_id: 仓库标识
* sect_id: 库区标识
* block_num 巷道
* box_length木箱长度
* box_width木箱宽度
* box_high木箱高度
* }
* box_length木箱长度
* box_width木箱宽度
* box_high木箱高度
* }
* @return String 排
*/
private String getMinRow(JSONObject jsonParam) {
@@ -405,7 +408,7 @@ public class InBoxManageServiceImpl implements InBoxManageService {
.collect(Collectors.joining("','"));
jsonParam.put("flag", "2");
jsonParam.put("row_in", "('"+row_in+"')");
jsonParam.put("row_in", "('" + row_in + "')");
List<JSONObject> boxAllList = WQL.getWO("BST_INBOX").addParamMap(jsonParam)
.process().getResultJSONArray(0).toJavaList(JSONObject.class);
@@ -446,15 +449,16 @@ public class InBoxManageServiceImpl implements InBoxManageService {
/**
* 确定仓位
*
* @param jsonParam {
* stor_id: 仓库标识
* sect_id: 库区标识
* block_num 巷道
* row_num
* box_length木箱长度
* box_width木箱宽度
* box_high木箱高度
* }
* stor_id: 仓库标识
* sect_id: 库区标识
* block_num 巷道
* row_num
* box_length木箱长度
* box_width木箱宽度
* box_high木箱高度
* }
* @return JSONObject 仓位对象
*/
private JSONObject queryStruct(JSONObject jsonParam) {
@@ -473,7 +477,7 @@ public class InBoxManageServiceImpl implements InBoxManageService {
// 新的一排
String row_num_new = this.getMinRow(jsonParam);
jsonParam.put("row_num",row_num_new);
jsonParam.put("row_num", row_num_new);
jsonAttr = this.getStructOne(jsonParam);
}
@@ -482,15 +486,16 @@ public class InBoxManageServiceImpl implements InBoxManageService {
/**
* 获取一个货位公共方法
*
* @param jsonParam {
* stor_id: 仓库标识
* sect_id: 库区标识
* block_num 巷道
* row_num
* box_length木箱长度
* box_width木箱宽度
* box_high木箱高度
* }
* stor_id: 仓库标识
* sect_id: 库区标识
* block_num 巷道
* row_num
* box_length木箱长度
* box_width木箱宽度
* box_high木箱高度
* }
* @return JSONObject 仓位对象
*/
private JSONObject getStructOne(JSONObject jsonParam) {

View File

@@ -164,6 +164,7 @@ public class InVehicleManageServiceImpl implements InVehicleManageService {
JSONArray structArray = attrTab.query("IFNULL(storagevehicle_code,'') = '' " +
"AND is_used = '" + IOSEnum.IS_NOTANDYES.code("") + "' AND is_delete = '" + IOSEnum.IS_NOTANDYES.code("") + "' " +
"AND lock_type = '" + IOSEnum.LOCK_TYPE.code("未锁定") + "' AND stor_id = '"+jsonParam.getString("stor_id")+"' " +
"AND storagevehicle_type = '" +jsonParam.getString("vehicle_type")+"'"+
"AND sect_id = '"+jsonParam.getString("sect_id")+"'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(structArray)) {

View File

@@ -140,7 +140,7 @@
AND attr.block_num = 输入.block_num
AND attr.row_num = 输入.row_num
order by attr.col_num,attr.layer_num ASC,attr.zdepth DESC
order by attr.col_num DESC,attr.layer_num ASC,attr.zdepth DESC
ENDSELECT
ENDQUERY

View File

@@ -212,7 +212,7 @@
attr.row_num = 输入.row_num
ENDOPTION
order by attr.col_num DESC ,attr.layer_num ASC,attr.zdepth DESC
order by attr.col_num,attr.layer_num ASC,attr.zdepth DESC
ENDSELECT
ENDQUERY

View File

@@ -22,7 +22,7 @@
输入.row_in TYPEAS f_string
输入.not_row_in TYPEAS f_string
输入.not_block TYPEAS f_string
输入.storagevehicle_type TYPEAS s_string
输入.vehicle_type TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
@@ -64,8 +64,8 @@
attr.block_num NOT IN 输入.not_block
ENDOPTION
OPTION 输入.storagevehicle_type <> ""
attr.storagevehicle_type = 输入.storagevehicle_type
OPTION 输入.vehicle_type <> ""
attr.storagevehicle_type = 输入.vehicle_type
ENDOPTION
group by attr.block_num
@@ -147,7 +147,7 @@
AND attr.block_num = 输入.block_num
AND attr.row_num = 输入.row_num
order by attr.col_num,attr.layer_num ASC,attr.zdepth DESC
order by attr.col_num DESC,attr.layer_num ASC,attr.zdepth DESC
ENDSELECT
ENDQUERY

View File

@@ -228,7 +228,7 @@
box.num = 输入.num
ENDOPTION
order by attr.col_num, attr.zdepth, attr.layer_num
order by attr.col_num DESC, attr.zdepth, attr.layer_num
ENDSELECT
ENDQUERY

View File

@@ -168,7 +168,7 @@
attr.row_num = 输入.row_num
ENDOPTION
order by attr.col_num, attr.zdepth
order by attr.col_num DESC, attr.zdepth
ENDSELECT
ENDQUERY

View File

@@ -128,6 +128,9 @@ public class StoragevehicleinfoServiceImpl implements StoragevehicleinfoService
case "0002":
code = "VEHICLE_CODE_GXTP";
break;
case "0003":
code = "VEHICLE_CODE_LK";
break;
default:
break;
}

View File

@@ -1,4 +1,5 @@
package org.nl.wms.ext.acs.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
@@ -1323,11 +1324,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
WQLObject.getWQLObject("st_ivt_shaftivt").update(rgv_device);
//如果套管工位有货且套轴区域无轴,搬运一根轴到穿拔轴机上
if (rgv_device.getIntValue("have_qzz") == 0){
if (rgv_device.getIntValue("have_qzz") == 0) {
//判断当前穿拔轴机构上是否存在可用的气涨轴
String cbj_qzz = cbz_jo.getString("have_qzz");
//判断是否存在未完成的成品下卷任务
JSONObject container_jo = WQLObject.getWQLObject("sch_base_task").query("task_type = '010605' AND product_area = '"+product_area+"' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
JSONObject container_jo = WQLObject.getWQLObject("sch_base_task").query("task_type = '010605' AND product_area = '" + product_area + "' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
if ("0".equals(cbj_qzz) && ObjectUtil.isEmpty(container_jo)) {
PaperTrussTask paperTrussTask = SpringContextHolder.getBean(PaperTrussTask.class);
//查询套管工位的库存信息
@@ -1814,46 +1815,40 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public JSONObject applyTwo(JSONObject whereJson) {
log.info("applyTwo请求参数---------------------------------------------" + whereJson.toString());
JSONObject result = new JSONObject();
String type = whereJson.getString("type");
RLock lock = redissonClient.getLock("acs_to_wms_two_a:" + type);
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
try {
if (tryLock) {
// 基础校验
if (ObjectUtil.isEmpty(whereJson.getString("device_code"))) {
throw new BadRequestException("设备不能为空!");
}
if (type.equals(IOSEnum.ACSTOLMS_TYPE.code("空盘入库"))) {
String vehicleCode = whereJson.getString("vehicle_code");
if (StrUtil.isEmpty(vehicleCode)) {
vehicleCode = CodeUtil.getNewCode("VEHICCLE_CODE_KTP");
whereJson.put("vehicle_code", vehicleCode);
}
if (ObjectUtil.isEmpty(whereJson.getString("container_type"))) {
throw new BadRequestException("载具类型不能为空!");
}
if (ObjectUtil.isEmpty(whereJson.getString("vehicle_code"))) {
throw new BadRequestException("载具不能为空!");
}
}
// 1-成品入库任务
if (type.equals(IOSEnum.ACSTOLMS_TYPE.code("成品入库任务"))) {
// 调用服务处理
if (ObjectUtil.isEmpty(whereJson.getString("material_barcode"))) {
throw new BadRequestException("子卷号不能为空!");
}
inBussManageService.inTask(whereJson);
} else if (type.equals(IOSEnum.ACSTOLMS_TYPE.code("空盘入库"))) {
// 2-空盘入库
whereJson.put("vehicle_type", whereJson.getString("container_type"));
inVehicleManageService.inVehicle(whereJson);
} else if (type.equals(IOSEnum.ACSTOLMS_TYPE.code("空盘出库"))) {
// 3-空盘出库
if (ObjectUtil.isEmpty(whereJson.getString("container_type"))) {
throw new BadRequestException("载具类型不能为空!");
@@ -1861,28 +1856,22 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
whereJson.put("vehicle_type", whereJson.getString("container_type"));
outVehicleManageService.outVehicle(whereJson);
} else if (type.equals(IOSEnum.ACSTOLMS_TYPE.code("异常处理位"))) {
// 4-空木箱异常处理
if (ObjectUtil.isEmpty(whereJson.getString("material_barcode"))) {
throw new BadRequestException("木箱号不能为空!");
}
JSONObject jsonTaskParam = new JSONObject();
jsonTaskParam.put("task_type", "010710");
jsonTaskParam.put("start_device_code", whereJson.getString("device_code"));
jsonTaskParam.put("next_device_code", "B1_ERRO");
jsonTaskParam.put("vehicle_code", whereJson.getString("material_barcode"));
TwoBoxExcepTask taskBean = new TwoBoxExcepTask();
taskBean.createTask(jsonTaskParam);
} else if (type.equals(IOSEnum.ACSTOLMS_TYPE.code("木箱入库"))) {
// 5-木箱入库
whereJson.put("box_no", whereJson.getString("material_barcode"));
inBoxManageService.inBox(whereJson);
}
result.put("status", HttpStatus.OK.value());
result.put("message", "下发成功!");
log.info("applyTwo返回参数---------------------------------------------" + result.toString());
@@ -1893,7 +1882,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
lock.unlock();
}
}
result.put("status", HttpStatus.BAD_REQUEST.value());
result.put("message", "申请任务超时!" + type);
log.info("applyTwo返回参数---------------------------------------------" + result.toString());

View File

@@ -59,6 +59,10 @@ public class AcsTaskDto {
* 扩展参数
*/
private String params;
/**
* 温度
*/

View File

@@ -375,6 +375,7 @@ public class CheckOutBillController {
@PostMapping("/testInEmp")
@Log("空载具入库测试")
@SaIgnore
public ResponseEntity<Object> testInEmp(@RequestBody JSONObject whereJson) {
new InVehicleManageServiceImpl().inVehicle(whereJson);
return new ResponseEntity<>(HttpStatus.OK);