Merge branch 'master' of http://121.40.234.130:8899/root/lanzhouhailiang_one
This commit is contained in:
@@ -2,11 +2,13 @@ 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;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
@@ -24,6 +26,8 @@ import org.nl.wms.sch.tasks.EmptyVehicleTask;
|
||||
import org.nl.wms.sch.tasks.SendOutTask;
|
||||
import org.nl.wms.st.inbill.service.RawAssistIStorService;
|
||||
import org.nl.wms.st.inbill.service.StorPublicService;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -33,6 +37,7 @@ import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -47,6 +52,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
private final CutConveyorTask cutConveyorTask;
|
||||
|
||||
private final RedissonClient redissonClient;
|
||||
|
||||
/**
|
||||
* task_id:任务标识
|
||||
* task_code:任务编码
|
||||
@@ -179,230 +186,271 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@SneakyThrows
|
||||
public JSONObject apply(JSONObject whereJson) {
|
||||
log.info("apply请求参数:---------------------------------------------"+whereJson.toString());
|
||||
String type = whereJson.getString("type");
|
||||
String device_code = whereJson.getString("device_code");
|
||||
String vehicle_code = whereJson.getString("vehicle_code");
|
||||
|
||||
WQLObject point_table = WQLObject.getWQLObject("SCH_BASE_Point");
|
||||
WQLObject struct_table = WQLObject.getWQLObject("ST_IVT_StructAttr");
|
||||
|
||||
if (ObjectUtil.isEmpty(type)) throw new BadRequestException("ACS申请任务失败!任务类型不能为空");
|
||||
if (ObjectUtil.isEmpty(device_code)) throw new BadRequestException("ACS申请任务失败!点位不能为空");
|
||||
|
||||
/*
|
||||
* 根据type判断是什么业务类型:
|
||||
* 1.入库任务
|
||||
* 2.空盘入库任务
|
||||
* 3.空盘出库任务
|
||||
* 4.出库口申请入发货区任务
|
||||
*/
|
||||
if (type.equals("1")) {
|
||||
boolean checked = true;
|
||||
boolean auto_div = false;
|
||||
if (ObjectUtil.isEmpty(vehicle_code)) throw new BadRequestException("ACS申请任务失败!载具不能为空");
|
||||
//通过该木箱码查询对应的分配明细
|
||||
JSONArray dis_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("box_no",vehicle_code).addParam("flag","28").process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(dis_rows)) {
|
||||
throw new BadRequestException("未查询到木箱:" + vehicle_code + "相关入库分配明细记录!");
|
||||
}
|
||||
ArrayList<HashMap> dis_list = new ArrayList<>();
|
||||
for (int i = 0; i < dis_rows.size(); i++) {
|
||||
HashMap<String,String> dis_map = new HashMap<>();
|
||||
JSONObject dis_row = dis_rows.getJSONObject(i);
|
||||
dis_map.put("box_no",dis_row.getString("box_no"));
|
||||
dis_map.put("point_code",device_code);
|
||||
dis_map.put("sect_id",dis_row.getString("sect_id"));
|
||||
dis_map.put("sect_code",dis_row.getString("sect_code"));
|
||||
dis_map.put("sect_name",dis_row.getString("sect_name"));
|
||||
dis_map.put("struct_id",dis_row.getString("struct_id"));
|
||||
dis_map.put("struct_code",dis_row.getString("struct_code"));
|
||||
if (StrUtil.isNotEmpty(dis_row.getString("struct_code"))){
|
||||
auto_div = true;
|
||||
checked = false;
|
||||
}
|
||||
dis_map.put("struct_name",dis_row.getString("struct_name"));
|
||||
dis_map.put("iostorinv_id",dis_row.getString("iostorinv_id"));
|
||||
dis_list.add(dis_map);
|
||||
}
|
||||
Map map = new HashMap();
|
||||
//查询主存区的sect
|
||||
JSONObject sect_jo = WQLObject.getWQLObject("st_ivt_sectattr").query("sect_type_attr = '00' AND is_used = '1'").uniqueResult(0);
|
||||
map.put("tableMater", dis_list);
|
||||
map.put("point_code", device_code);
|
||||
map.put("sect_id", sect_jo.getString("sect_id"));
|
||||
map.put("checked", checked);
|
||||
map.put("auto_div", auto_div);
|
||||
map.put("auto_issue", "1");
|
||||
//自动分配货位并下发任务
|
||||
rawAssistIStorService.divStruct(map);
|
||||
}
|
||||
if (type.equals("2")) {
|
||||
//查询一个可用的空载具点位并下发给ACS
|
||||
/*
|
||||
* 1、优先存放空托盘区、托盘号默认99999;空托盘区没有位置,再找空巷道,或者空巷道有空位置的货位。
|
||||
2、分配货位规则:
|
||||
a、查找片区内,有空位的巷道,并且两头能够通畅的巷道排;判断巷道的任务类型,只能为入库或者无任务类型;
|
||||
b、没有,则优先找空的巷道;按空位置顺序分配;
|
||||
3、任务下发,判断巷道的任务类型,只能为空盘入库或者无任务类型;
|
||||
* */
|
||||
vehicle_code = CodeUtil.getNewCode("VEHICCLE_CODE_KTP");
|
||||
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "21").process().uniqueResult(0);
|
||||
|
||||
JSONObject struct_jo = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(empty_row)) {
|
||||
String block_num = empty_row.getString("block_num");
|
||||
String row_num = empty_row.getString("row_num");
|
||||
String placement_type = empty_row.getString("placement_type");
|
||||
|
||||
if (placement_type.equals("01") || placement_type.equals("03")) {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq desc").uniqueResult(0);
|
||||
} else {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq").uniqueResult(0);
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(struct_jo)) {
|
||||
throw new BadRequestException("未查询到可用的空载具存放点位!");
|
||||
}
|
||||
|
||||
JSONObject task_jo = new JSONObject();
|
||||
task_jo.put("point_code1", device_code);
|
||||
task_jo.put("point_code2", struct_jo.getString("struct_code"));
|
||||
task_jo.put("task_type", "010502");
|
||||
task_jo.put("vehicle_code", vehicle_code);
|
||||
EmptyVehicleTask task = new EmptyVehicleTask();
|
||||
task.createTask(task_jo);
|
||||
|
||||
//锁定终点、货位点位
|
||||
HashMap map = new HashMap();
|
||||
map.put("lock_type", "5");
|
||||
point_table.update(map, "point_code = '" + struct_jo.getString("struct_code") + "'");
|
||||
struct_table.update(map, "struct_code = '" + struct_jo.getString("struct_code") + "'");
|
||||
}
|
||||
if (type.equals("3")) {
|
||||
//查询一个可用的空载具点位并下发给ACS
|
||||
/*
|
||||
* 1、优先存放空托盘区、托盘号默认99999;空托盘区没有位置,再找空巷道,或者空巷道有空位置的货位。
|
||||
2、分配货位规则:
|
||||
a、查找片区内,有空位的巷道,并且两头能够通畅的巷道排;判断巷道的任务类型,只能为入库或者无任务类型;
|
||||
b、没有,则优先找空的巷道;按空位置顺序分配;
|
||||
3、任务下发,判断巷道的任务类型,只能为空盘入库或者无任务类型;
|
||||
* */
|
||||
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "22").process().uniqueResult(0);
|
||||
|
||||
JSONObject struct_jo = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(empty_row)) {
|
||||
String block_num = empty_row.getString("block_num");
|
||||
String row_num = empty_row.getString("row_num");
|
||||
String placement_type = empty_row.getString("placement_type");
|
||||
|
||||
if (placement_type.equals("01") || placement_type.equals("03")) {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq").uniqueResult(0);
|
||||
} else {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq desc").uniqueResult(0);
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(struct_jo)) {
|
||||
throw new BadRequestException("未查询到可用的空载具!");
|
||||
}
|
||||
|
||||
JSONObject task_jo = new JSONObject();
|
||||
task_jo.put("point_code1", struct_jo.getString("struct_code"));
|
||||
task_jo.put("point_code2", device_code);
|
||||
task_jo.put("task_type", "010504");
|
||||
task_jo.put("vehicle_code", struct_jo.getString("storagevehicle_code"));
|
||||
EmptyVehicleTask task = new EmptyVehicleTask();
|
||||
task.createTask(task_jo);
|
||||
|
||||
//锁定终点、货位点位
|
||||
HashMap map = new HashMap();
|
||||
map.put("lock_type", "4");
|
||||
point_table.update(map, "point_code = '" + struct_jo.getString("struct_code") + "'");
|
||||
struct_table.update(map, "struct_code = '" + struct_jo.getString("struct_code") + "'");
|
||||
}
|
||||
if (type.equals("4")) {
|
||||
//查询该木箱对应的包装关系
|
||||
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + vehicle_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(sub_jo)) {
|
||||
throw new BadRequestException("未查询到该木箱对应的包装关系!");
|
||||
}
|
||||
String sale_order_name = sub_jo.getString("sale_order_name");
|
||||
|
||||
//查询是否存在可用的空位
|
||||
String point_code = "";
|
||||
JSONArray joArr = new JSONArray();
|
||||
|
||||
// 查找此订单号所在的所有排
|
||||
JSONArray joRow = WQL.getWO("QST_ACSTOLMSTYPE4").addParam("flag", "1").addParam("sale_order_name", sale_order_name).process().getResultJSONArray(0);
|
||||
for (int j = 0; j < joRow.size(); j++) {
|
||||
JSONObject json = joRow.getJSONObject(j);
|
||||
String row_num = json.getString("row_num");
|
||||
|
||||
// 查找此排下的所有空位
|
||||
JSONArray joEmpPoint = WQL.getWO("QST_ACSTOLMSTYPE4").addParam("flag", "2").addParam("row_num", row_num).process().getResultJSONArray(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(joEmpPoint)) {
|
||||
for (int n = 0; n < joEmpPoint.size(); n++) {
|
||||
joArr.add(joEmpPoint.getJSONObject(n));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(joArr)) {
|
||||
//查询新的一排
|
||||
JSONObject point_jo = WQL.getWO("QST_ACSTOLMSTYPE4").addParam("flag", "3").process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(point_jo)) {
|
||||
throw new BadRequestException("未查询到相同销售订单的放货区点位或空的一排!");
|
||||
} else {
|
||||
JSONObject jsonNewRow = WQLObject.getWQLObject("sch_base_point").query("row_num = '" + point_jo.getString("row_num") + "' AND point_type ='9' AND is_delete = '0' order by out_order_seq ASC").uniqueResult(0);
|
||||
point_code = jsonNewRow.getString("point_code");
|
||||
}
|
||||
} else {
|
||||
// 校验此货位是否被堵住:1.如果被堵住则判断下一个是否被堵住 2.如果全部被堵住则新开一排
|
||||
for (int i = 0; i < joArr.size(); i++) {
|
||||
JSONObject json = joArr.getJSONObject(i);
|
||||
// 判断是否被挡住
|
||||
JSONArray jsonArray = WQL.getWO("QST_ACSTOLMSTYPE4")
|
||||
.addParam("flag", "4")
|
||||
.addParam("point_code", json.getString("point_code"))
|
||||
.process().getResultJSONArray(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonArray)) {
|
||||
// 堵住则判断下一个
|
||||
continue;
|
||||
} else {
|
||||
// 未堵住: 跳出循环
|
||||
point_code = json.getString("point_code");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(point_code)) {
|
||||
// 为空则新开一排
|
||||
JSONObject point_jo = WQL.getWO("QST_ACSTOLMSTYPE4").addParam("flag", "3").process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(point_jo)) {
|
||||
throw new BadRequestException("未查询到相同销售订单的放货区点位或空的一排!");
|
||||
} else {
|
||||
JSONObject jsonNewRow = WQLObject.getWQLObject("sch_base_point").query("row_num = '" + point_jo.getString("row_num") + "' AND point_type ='9' AND is_delete = '0' order by out_order_seq ASC").uniqueResult(0);
|
||||
point_code = jsonNewRow.getString("point_code");
|
||||
}
|
||||
}
|
||||
|
||||
//创建任务
|
||||
JSONObject task_jo = new JSONObject();
|
||||
task_jo.put("point_code1", device_code);
|
||||
task_jo.put("point_code2", point_code);
|
||||
task_jo.put("vehicle_code", vehicle_code);
|
||||
task_jo.put("task_type", "010506");
|
||||
SendOutTask sendOutTask = new SendOutTask();
|
||||
sendOutTask.createTask(task_jo);
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "下发成功!");
|
||||
RLock lock = redissonClient.getLock("acs_wms_apply:" + type);
|
||||
boolean isLock = lock.tryLock(3,TimeUnit.SECONDS);
|
||||
try {
|
||||
if (isLock){
|
||||
String device_code = whereJson.getString("device_code");
|
||||
String vehicle_code = whereJson.getString("vehicle_code");
|
||||
|
||||
WQLObject point_table = WQLObject.getWQLObject("SCH_BASE_Point");
|
||||
WQLObject struct_table = WQLObject.getWQLObject("ST_IVT_StructAttr");
|
||||
|
||||
if (ObjectUtil.isEmpty(type)) throw new BadRequestException("ACS申请任务失败!任务类型不能为空");
|
||||
if (ObjectUtil.isEmpty(device_code)) throw new BadRequestException("ACS申请任务失败!点位不能为空");
|
||||
|
||||
/*
|
||||
* 根据type判断是什么业务类型:
|
||||
* 1.入库任务
|
||||
* 2.空盘入库任务
|
||||
* 3.空盘出库任务
|
||||
* 4.出库口申请入发货区任务
|
||||
*/
|
||||
if (type.equals("1")) {
|
||||
boolean checked = true;
|
||||
boolean auto_div = false;
|
||||
if (ObjectUtil.isEmpty(vehicle_code)) throw new BadRequestException("ACS申请任务失败!载具不能为空");
|
||||
//通过该木箱码查询对应的分配明细
|
||||
JSONArray dis_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("box_no",vehicle_code).addParam("flag","28").process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(dis_rows)) {
|
||||
throw new BadRequestException("未查询到木箱:" + vehicle_code + "相关入库分配明细记录!");
|
||||
}
|
||||
ArrayList<HashMap> dis_list = new ArrayList<>();
|
||||
for (int i = 0; i < dis_rows.size(); i++) {
|
||||
HashMap<String,String> dis_map = new HashMap<>();
|
||||
JSONObject dis_row = dis_rows.getJSONObject(i);
|
||||
dis_map.put("box_no",dis_row.getString("box_no"));
|
||||
dis_map.put("point_code",device_code);
|
||||
dis_map.put("sect_id",dis_row.getString("sect_id"));
|
||||
dis_map.put("sect_code",dis_row.getString("sect_code"));
|
||||
dis_map.put("sect_name",dis_row.getString("sect_name"));
|
||||
dis_map.put("struct_id",dis_row.getString("struct_id"));
|
||||
dis_map.put("struct_code",dis_row.getString("struct_code"));
|
||||
if (StrUtil.isNotEmpty(dis_row.getString("struct_code"))){
|
||||
auto_div = true;
|
||||
checked = false;
|
||||
}
|
||||
dis_map.put("struct_name",dis_row.getString("struct_name"));
|
||||
dis_map.put("iostorinv_id",dis_row.getString("iostorinv_id"));
|
||||
dis_list.add(dis_map);
|
||||
}
|
||||
Map map = new HashMap();
|
||||
//查询主存区的sect
|
||||
JSONObject sect_jo = WQLObject.getWQLObject("st_ivt_sectattr").query("sect_type_attr = '00' AND is_used = '1'").uniqueResult(0);
|
||||
map.put("tableMater", dis_list);
|
||||
map.put("point_code", device_code);
|
||||
map.put("sect_id", sect_jo.getString("sect_id"));
|
||||
map.put("checked", checked);
|
||||
map.put("auto_div", auto_div);
|
||||
map.put("auto_issue", "1");
|
||||
//自动分配货位并下发任务
|
||||
rawAssistIStorService.divStruct(map);
|
||||
}
|
||||
if (type.equals("2")) {
|
||||
//查询一个可用的空载具点位并下发给ACS
|
||||
/*
|
||||
* 1、优先存放空托盘区、托盘号默认99999;空托盘区没有位置,再找空巷道,或者空巷道有空位置的货位。
|
||||
2、分配货位规则:
|
||||
a、查找片区内,有空位的巷道,并且两头能够通畅的巷道排;判断巷道的任务类型,只能为入库或者无任务类型;
|
||||
b、没有,则优先找空的巷道;按空位置顺序分配;
|
||||
3、任务下发,判断巷道的任务类型,只能为空盘入库或者无任务类型;
|
||||
* */
|
||||
vehicle_code = CodeUtil.getNewCode("VEHICCLE_CODE_KTP");
|
||||
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "21").process().uniqueResult(0);
|
||||
|
||||
JSONObject struct_jo = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(empty_row)) {
|
||||
String block_num = empty_row.getString("block_num");
|
||||
String row_num = empty_row.getString("row_num");
|
||||
String placement_type = empty_row.getString("placement_type");
|
||||
|
||||
if (placement_type.equals("03")) {
|
||||
// 右通
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq desc").uniqueResult(0);
|
||||
} else if (placement_type.equals("02")) {
|
||||
// 左通
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq").uniqueResult(0);
|
||||
} else {
|
||||
// 双通
|
||||
|
||||
// 先倒序找到第一个托盘、判断上一个是否有货位
|
||||
JSONObject jsonDescBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0);
|
||||
String out_order_seq = jsonDescBox.getString("out_order_seq");
|
||||
// 上一个货位顺序号
|
||||
String out_order_seq_desc = String.valueOf(NumberUtil.add(out_order_seq, "1"));
|
||||
JSONObject jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq = '" + out_order_seq_desc + "'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonDescStruct)) {
|
||||
struct_jo = jsonDescStruct;
|
||||
} else {
|
||||
// 没有就正序找到第一个托盘、判断上一个是否有货位
|
||||
JSONObject jsonAscBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
|
||||
String out_order_seq2 = jsonAscBox.getString("out_order_seq");
|
||||
// 上一个货位顺序号
|
||||
String out_order_seq_asc = String.valueOf(NumberUtil.sub(out_order_seq2, "1"));
|
||||
JSONObject jsonAscStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq = '"+out_order_seq_asc+"'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonAscStruct)) {
|
||||
struct_jo = jsonAscStruct;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(struct_jo)) {
|
||||
throw new BadRequestException("未查询到可用的空载具存放点位!");
|
||||
}
|
||||
|
||||
JSONObject task_jo = new JSONObject();
|
||||
task_jo.put("point_code1", device_code);
|
||||
task_jo.put("point_code2", struct_jo.getString("struct_code"));
|
||||
task_jo.put("task_type", "010502");
|
||||
task_jo.put("vehicle_code", vehicle_code);
|
||||
EmptyVehicleTask task = new EmptyVehicleTask();
|
||||
task.createTask(task_jo);
|
||||
|
||||
//锁定终点、货位点位
|
||||
HashMap map = new HashMap();
|
||||
map.put("lock_type", "5");
|
||||
point_table.update(map, "point_code = '" + struct_jo.getString("struct_code") + "'");
|
||||
struct_table.update(map, "struct_code = '" + struct_jo.getString("struct_code") + "'");
|
||||
}
|
||||
if (type.equals("3")) {
|
||||
//查询一个可用的空载具点位并下发给ACS
|
||||
/*
|
||||
* 1、优先存放空托盘区、托盘号默认99999;空托盘区没有位置,再找空巷道,或者空巷道有空位置的货位。
|
||||
2、分配货位规则:
|
||||
a、查找片区内,有空位的巷道,并且两头能够通畅的巷道排;判断巷道的任务类型,只能为入库或者无任务类型;
|
||||
b、没有,则优先找空的巷道;按空位置顺序分配;
|
||||
3、任务下发,判断巷道的任务类型,只能为空盘入库或者无任务类型;
|
||||
* */
|
||||
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "22").process().uniqueResult(0);
|
||||
|
||||
JSONObject struct_jo = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(empty_row)) {
|
||||
String block_num = empty_row.getString("block_num");
|
||||
String row_num = empty_row.getString("row_num");
|
||||
String placement_type = empty_row.getString("placement_type");
|
||||
|
||||
if (placement_type.equals("01") || placement_type.equals("03")) {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq").uniqueResult(0);
|
||||
} else {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq desc").uniqueResult(0);
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(struct_jo)) {
|
||||
throw new BadRequestException("未查询到可用的空载具!");
|
||||
}
|
||||
|
||||
JSONObject task_jo = new JSONObject();
|
||||
task_jo.put("point_code1", struct_jo.getString("struct_code"));
|
||||
task_jo.put("point_code2", device_code);
|
||||
task_jo.put("task_type", "010504");
|
||||
task_jo.put("vehicle_code", struct_jo.getString("storagevehicle_code"));
|
||||
EmptyVehicleTask task = new EmptyVehicleTask();
|
||||
task.createTask(task_jo);
|
||||
|
||||
//锁定终点、货位点位
|
||||
HashMap map = new HashMap();
|
||||
map.put("lock_type", "4");
|
||||
point_table.update(map, "point_code = '" + struct_jo.getString("struct_code") + "'");
|
||||
struct_table.update(map, "struct_code = '" + struct_jo.getString("struct_code") + "'");
|
||||
}
|
||||
if (type.equals("4")) {
|
||||
//查询该木箱对应的包装关系
|
||||
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + vehicle_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(sub_jo)) {
|
||||
throw new BadRequestException("未查询到该木箱对应的包装关系!");
|
||||
}
|
||||
String sale_order_name = sub_jo.getString("sale_order_name");
|
||||
|
||||
//查询是否存在可用的空位
|
||||
String point_code = "";
|
||||
JSONArray joArr = new JSONArray();
|
||||
|
||||
// 查找此订单号所在的所有排
|
||||
JSONArray joRow = WQL.getWO("QST_ACSTOLMSTYPE4").addParam("flag", "1").addParam("sale_order_name", sale_order_name).process().getResultJSONArray(0);
|
||||
for (int j = 0; j < joRow.size(); j++) {
|
||||
JSONObject json = joRow.getJSONObject(j);
|
||||
String row_num = json.getString("row_num");
|
||||
|
||||
// 查找此排下的所有空位
|
||||
JSONArray joEmpPoint = WQL.getWO("QST_ACSTOLMSTYPE4").addParam("flag", "2").addParam("row_num", row_num).process().getResultJSONArray(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(joEmpPoint)) {
|
||||
for (int n = 0; n < joEmpPoint.size(); n++) {
|
||||
joArr.add(joEmpPoint.getJSONObject(n));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(joArr)) {
|
||||
//查询新的一排
|
||||
JSONObject point_jo = WQL.getWO("QST_ACSTOLMSTYPE4").addParam("flag", "3").process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(point_jo)) {
|
||||
throw new BadRequestException("未查询到相同销售订单的放货区点位或空的一排!");
|
||||
} else {
|
||||
JSONObject jsonNewRow = WQLObject.getWQLObject("sch_base_point").query("row_num = '" + point_jo.getString("row_num") + "' AND point_type ='9' AND is_delete = '0' order by out_order_seq ASC").uniqueResult(0);
|
||||
point_code = jsonNewRow.getString("point_code");
|
||||
}
|
||||
} else {
|
||||
// 校验此货位是否被堵住:1.如果被堵住则判断下一个是否被堵住 2.如果全部被堵住则新开一排
|
||||
for (int i = 0; i < joArr.size(); i++) {
|
||||
JSONObject json = joArr.getJSONObject(i);
|
||||
// 判断是否被挡住
|
||||
JSONArray jsonArray = WQL.getWO("QST_ACSTOLMSTYPE4")
|
||||
.addParam("flag", "4")
|
||||
.addParam("point_code", json.getString("point_code"))
|
||||
.process().getResultJSONArray(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonArray)) {
|
||||
// 堵住则判断下一个
|
||||
continue;
|
||||
} else {
|
||||
// 未堵住: 跳出循环
|
||||
point_code = json.getString("point_code");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(point_code)) {
|
||||
// 为空则新开一排
|
||||
JSONObject point_jo = WQL.getWO("QST_ACSTOLMSTYPE4").addParam("flag", "3").process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(point_jo)) {
|
||||
throw new BadRequestException("未查询到相同销售订单的放货区点位或空的一排!");
|
||||
} else {
|
||||
JSONObject jsonNewRow = WQLObject.getWQLObject("sch_base_point").query("row_num = '" + point_jo.getString("row_num") + "' AND point_type ='9' AND is_delete = '0' order by out_order_seq ASC").uniqueResult(0);
|
||||
point_code = jsonNewRow.getString("point_code");
|
||||
}
|
||||
}
|
||||
|
||||
//创建任务
|
||||
JSONObject task_jo = new JSONObject();
|
||||
task_jo.put("point_code1", device_code);
|
||||
task_jo.put("point_code2", point_code);
|
||||
task_jo.put("vehicle_code", vehicle_code);
|
||||
task_jo.put("task_type", "010506");
|
||||
SendOutTask sendOutTask = new SendOutTask();
|
||||
sendOutTask.createTask(task_jo);
|
||||
}
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "下发成功!");
|
||||
return result;
|
||||
}
|
||||
}finally {
|
||||
if (isLock){
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
result.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
result.put("message", "锁超时下发失败");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author liuxy
|
||||
@@ -83,6 +84,7 @@ public class PrintServiceImpl implements PrintService {
|
||||
String date_of_FG_inbound = jsonInbound.getString("date_of_fg_inbound");
|
||||
//毛重
|
||||
String box_weight = NumberUtil.round(box_jo.getString("box_weight"),2).toString();
|
||||
// String box_weight = NumberUtil.round(box_jo.getString("real_weight"),2).toString();
|
||||
//生产日期:取此箱子中最晚的生产日期
|
||||
JSONObject jsonProduction = subTab.query("package_box_sn = '" + box_no + "' order by date_of_production DESC").uniqueResult(0);
|
||||
String date_of_production = jsonProduction.getString("date_of_production");
|
||||
@@ -211,7 +213,13 @@ public class PrintServiceImpl implements PrintService {
|
||||
//入库日期:取此箱子中最晚的入库日期
|
||||
JSONObject jsonInbound= subTab.query("package_box_sn = '" + box_no + "' order by date_of_fg_inbound DESC").uniqueResult(0);
|
||||
String date_of_FG_inbound = jsonInbound.getString("date_of_fg_inbound");
|
||||
//毛重
|
||||
//更新实际重量
|
||||
double real_weight = whereJson.getDoubleValue("box_weight");
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("real_weight",real_weight);
|
||||
|
||||
subTab.update(map,"package_box_sn = '"+package_box_sn+"'");
|
||||
|
||||
String box_weight = NumberUtil.round(whereJson.getString("box_weight"),2).toString();
|
||||
//生产日期:取此箱子中最晚的生产日期
|
||||
JSONObject jsonProduction = subTab.query("package_box_sn = '" + box_no + "' order by date_of_production DESC").uniqueResult(0);
|
||||
|
||||
@@ -67,6 +67,10 @@ public class ProductionOutServiceImpl implements ProductionOutService {
|
||||
if (ObjectUtil.isEmpty(box_no)) throw new BadRequestException("木箱不能为空");
|
||||
|
||||
JSONObject jsonPoint = pointTab.query("vehicle_code = '" + box_no + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(jsonPoint)) {
|
||||
throw new BadRequestException("请输入正确的木箱");
|
||||
}
|
||||
/*
|
||||
* 生产区确认
|
||||
* a.解锁出库点位、清除木箱号
|
||||
|
||||
Binary file not shown.
@@ -177,7 +177,7 @@ public class BookTwoConfirmTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
/*SchTaskDto dto = SchTaskDto.builder().task_id(org.nl.wms.util.IdUtil.getLongId())
|
||||
.task_code(CodeUtil.getNewCode("TASK_CODE"))
|
||||
.task_code(IdUtil.getSnowflake(1,1).nextId())
|
||||
.task_type("")
|
||||
.task_name("共挤线叫空载具")
|
||||
.task_status(TaskStatusEnum.SURE_END.getCode())
|
||||
@@ -193,7 +193,7 @@ public class BookTwoConfirmTask extends AbstractAcsTask {
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id",IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
json.put("task_code", IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("task_type", "05");
|
||||
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
json.put("point_code1", form.getString("start_pint_code"));
|
||||
|
||||
@@ -284,7 +284,7 @@ public class CallEmpReelTask extends AbstractAcsTask {
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
json.put("task_code", IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
json.put("material_code", form.getString("material_code"));
|
||||
json.put("point_code1", form.getString("point_code1"));
|
||||
|
||||
@@ -283,7 +283,7 @@ public class CoolCutTask extends AbstractAcsTask {
|
||||
}
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
json.put("task_code", IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("task_type", form.getString("task_type"));
|
||||
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
json.put("point_code1", point_code1);
|
||||
|
||||
@@ -265,7 +265,7 @@ public class CutConveyorTask extends AbstractAcsTask {
|
||||
}
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
json.put("task_code", IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("task_type", form.getString("task_type"));
|
||||
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
json.put("point_code1", point_code1);
|
||||
|
||||
@@ -281,7 +281,7 @@ public class CutTrussTask extends AbstractAcsTask {
|
||||
}*/
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
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"));
|
||||
|
||||
@@ -185,7 +185,7 @@ public class EmptyVehicleTask extends AbstractAcsTask {
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
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("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
|
||||
@@ -186,13 +186,13 @@ public class InCoolIvtTask extends AbstractAcsTask {
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id",IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
json.put("task_code", IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("task_type", "010204");
|
||||
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
json.put("point_code1", point_code1);
|
||||
json.put("point_code2", point_code2);
|
||||
json.put("material_code", form.getString("container_name"));
|
||||
json.put("material_code", form.getString("product_area"));
|
||||
json.put("product_area", form.getString("product_area"));
|
||||
json.put("sort_seq", "1");
|
||||
json.put("handle_class", THIS_CLASS);
|
||||
json.put("create_id", currentUserId);
|
||||
|
||||
@@ -244,7 +244,7 @@ public class InHotTask extends AbstractAcsTask {
|
||||
}
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
json.put("task_code", IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("task_type", "010201");
|
||||
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
json.put("point_code1", form.getString("point_code1"));
|
||||
@@ -292,7 +292,7 @@ public class InHotTask extends AbstractAcsTask {
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
json.put("task_code", IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("task_type", "010203");
|
||||
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
json.put("point_code1", form.getString("point_code1"));
|
||||
|
||||
@@ -223,7 +223,7 @@ public class InTask extends AbstractAcsTask {
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
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("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
|
||||
@@ -175,7 +175,7 @@ public class OutHotTask extends AbstractAcsTask {
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
json.put("task_code", IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("task_type", "010202");
|
||||
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
json.put("point_code1", form.getString("point_code1"));
|
||||
|
||||
@@ -190,7 +190,7 @@ public class OutTask extends AbstractAcsTask {
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
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"));
|
||||
|
||||
@@ -125,7 +125,7 @@ public class SendOutTask extends AbstractAcsTask {
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
json.put("task_code", IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("task_type", form.getString("task_type"));
|
||||
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
json.put("point_code1", form.getString("point_code1"));
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SbCallEmptyTask extends AbstractAcsTask {
|
||||
@Override
|
||||
public String createTask(JSONObject form) {
|
||||
SchTaskDto dto = SchTaskDto.builder().task_id(IdUtil.getLongId())
|
||||
.task_code(CodeUtil.getNewCode("TASK_CODE"))
|
||||
.task_code(IdUtil.getStringId())
|
||||
.task_type("")
|
||||
.task_name("生箔呼叫空轴")
|
||||
.task_status(TaskStatusEnum.SURE_END.getCode())
|
||||
|
||||
@@ -852,21 +852,71 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
String out_order_seq = jsonDescBox.getString("out_order_seq");
|
||||
// 上一个货位顺序号
|
||||
String out_order_seq_desc = String.valueOf(NumberUtil.add(out_order_seq, "1"));
|
||||
JSONObject jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq = '"+out_order_seq_desc+"'").uniqueResult(0);
|
||||
JSONObject jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq = '" + out_order_seq_desc + "'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonDescStruct)) {
|
||||
struct_jo = jsonDescStruct;
|
||||
} else {
|
||||
// 没有就正序找到第一个物料、判断上一个是否有货位
|
||||
// 没有就正序找到第一个物料、判断上一个是否有货位
|
||||
JSONObject jsonAscBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
|
||||
String out_order_seq2 = jsonAscBox.getString("out_order_seq");
|
||||
// 上一个货位顺序号
|
||||
String out_order_seq_asc = String.valueOf(NumberUtil.sub(out_order_seq2, "1"));
|
||||
JSONObject jsonAscStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq = '"+out_order_seq_asc+"'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonAscStruct)) struct_jo = jsonAscStruct;
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(jsonAscStruct)) {
|
||||
struct_jo = jsonAscStruct;
|
||||
} else {
|
||||
// 说明这排有任务在执行,新开一排
|
||||
//根据分切计划查询该订单物料大概还有多少未入
|
||||
row_map.put("flag", "12");
|
||||
JSONArray plan_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(plan_rows)) {
|
||||
plan_rows = new JSONArray();
|
||||
}
|
||||
//查询该销售订单及行号有多少个生成状态的箱子
|
||||
row_map.put("flag", "27");
|
||||
JSONArray box_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(box_rows)) {
|
||||
box_rows = new JSONArray();
|
||||
}
|
||||
int box_num = (int) Math.ceil(plan_rows.size() / 2) + box_rows.size();
|
||||
|
||||
//查询数量与订单物料箱子数量相近的一排
|
||||
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("sect_id", sect_id).addParam("flag", "13").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num),block_num,row_num").process().uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(empty_row)) {
|
||||
String block_num2 = empty_row.getString("block_num");
|
||||
String row_num2 = empty_row.getString("row_num");
|
||||
String placement_type2 = empty_row.getString("placement_type");
|
||||
|
||||
if (placement_type.equals("02")) {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num2 + "' AND row_num = '" + row_num2 + "' AND placement_type = '" + placement_type2 + "' AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq ASC").uniqueResult(0);
|
||||
} else {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num2 + "' AND row_num = '" + row_num2 + "' AND placement_type = '" + placement_type2 + "'AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq DESC").uniqueResult(0);
|
||||
}
|
||||
} else {
|
||||
|
||||
//如果查询不到空的一排,则查询有空位双通的一排
|
||||
JSONObject have_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(have_row)) {
|
||||
String block_num3 = have_row.getString("block_num");
|
||||
String row_num3 = have_row.getString("row_num");
|
||||
|
||||
//判断该排是左边为空,还是右边为空
|
||||
JSONObject right_str = WQLObject.getWQLObject("st_ivt_structattr").query("block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' order by out_order_seq").uniqueResult(0);
|
||||
JSONObject left_str = WQLObject.getWQLObject("st_ivt_structattr").query("block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' order by out_order_seq desc").uniqueResult(0);
|
||||
if (StrUtil.isNotEmpty(right_str.getString("storagevehicle_code")) || !right_str.getString("lock_type").equals("1")) {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq").uniqueResult(0);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(left_str.getString("storagevehicle_code")) || !left_str.getString("lock_type").equals("1")) {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq desc").uniqueResult(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//如果不存在相同订单物料的巷道
|
||||
@@ -904,7 +954,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND placement_type = '" + placement_type + "'AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq DESC").uniqueResult(0);
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
//如果查询不到空的一排,则查询有空位双通的一排
|
||||
JSONObject have_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().uniqueResult(0);
|
||||
|
||||
|
||||
@@ -789,6 +789,7 @@
|
||||
AND IFNULL( sa.storagevehicle_code, '' ) = ''
|
||||
AND sa.lock_type = '1'
|
||||
AND sa.is_delete = '0'
|
||||
AND sa.is_used = '1'
|
||||
GROUP BY
|
||||
sa.block_num,
|
||||
sa.row_num,
|
||||
|
||||
@@ -321,7 +321,7 @@ public class ChangeServiceImpl implements ChangeService {
|
||||
} else {
|
||||
task = new JSONObject();
|
||||
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
String task_code = CodeUtil.getNewCode("TASK_CODE");
|
||||
String task_code = IdUtil.getSnowflake(1,1).nextId()+"";
|
||||
|
||||
task.put("taskdtl_id", task_id);
|
||||
task.put("task_id", task_id);
|
||||
|
||||
@@ -248,7 +248,7 @@ public class HandMoveStorServiceImpl implements HandMoveStorService {
|
||||
} else {
|
||||
task = new JSONObject();
|
||||
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
String task_code = CodeUtil.getNewCode("TASK_CODE");
|
||||
String task_code = IdUtil.getSnowflake(1,1).nextId()+"";
|
||||
|
||||
task.put("taskdtl_id", task_id);
|
||||
task.put("task_id", task_id);
|
||||
@@ -416,16 +416,14 @@ public class HandMoveStorServiceImpl implements HandMoveStorService {
|
||||
} else {
|
||||
task = new JSONObject();
|
||||
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
String task_code = CodeUtil.getNewCode("TASK_CODE");
|
||||
String task_code = IdUtil.getSnowflake(1,1).nextId()+"";
|
||||
|
||||
task.put("taskdtl_id", task_id);
|
||||
task.put("task_id", task_id);
|
||||
task.put("task_code", task_code);
|
||||
task.put("task_type", "05");
|
||||
task.put("taskdtl_type", "07");
|
||||
task.put("task_status", "01");
|
||||
task.put("start_point_code", jo.getString("start_point_code"));
|
||||
task.put("next_point_code", point.getString("point_code"));
|
||||
task.put("task_type", "010505");
|
||||
task.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
task.put("point_code1", jo.getString("start_point_code"));
|
||||
task.put("point_code2", point.getString("point_code"));
|
||||
task.put("vehicle_code", jo.getString("storagevehicle_code"));
|
||||
task.put("handle_class", HandMoveStorAcsTask.class.getName());
|
||||
task.put("finished_type", "");
|
||||
@@ -460,7 +458,7 @@ public class HandMoveStorServiceImpl implements HandMoveStorService {
|
||||
storPublicService.IOStor(jo, "31");
|
||||
//锁定起点点位、仓位
|
||||
JSONObject from_start = new JSONObject();
|
||||
from_start.put("lock_type", "03");
|
||||
from_start.put("lock_type", "6");
|
||||
from_start.put("struct_id", jo.getString("turnout_struct_id"));
|
||||
from_start.put("inv_type", jo_mst.getString("bill_type"));
|
||||
from_start.put("inv_id", jo_mst.getString("moveinv_id"));
|
||||
@@ -471,6 +469,7 @@ public class HandMoveStorServiceImpl implements HandMoveStorService {
|
||||
storPublicService.updateStructAndPoint(from_start);
|
||||
//锁定终点点位、仓位
|
||||
from_start.put("struct_id", turnin_struct_id);
|
||||
from_start.put("lock_type", "7");
|
||||
storPublicService.updateStructAndPoint(from_start);
|
||||
}
|
||||
ret.put("total_qty", total_qty);
|
||||
|
||||
@@ -943,12 +943,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "5");
|
||||
map.put("material_id", dtl.getString("material_id"));
|
||||
map.put("box_no", dtl.getString("box_no"));
|
||||
map.put("iostorinv_id", iostorinv_id);
|
||||
map.put("iostorinvdtl_id", dtl.getString("iostorinvdtl_id"));
|
||||
JSONArray dtlArr = WQL.getWO("ST_OUTIVT01").addParamMap(map).process().getResultJSONArray(0);
|
||||
if (dtlArr.size() == 0) {
|
||||
Struct_map.put(jsonIvt.getString("struct_id"), jsonIvt);
|
||||
}
|
||||
|
||||
}
|
||||
HashMap<String, String> map_dtl = new HashMap<String, String>();
|
||||
//更新明细
|
||||
|
||||
@@ -226,6 +226,10 @@
|
||||
dtl.iostorinvdtl_id <> 输入.iostorinvdtl_id
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.box_no <> ""
|
||||
dtl.box_no = 输入.box_no
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
Reference in New Issue
Block a user