add:x
This commit is contained in:
@@ -39,8 +39,11 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
public class AppRun {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
SpringApplication.run(AppRun.class, args);
|
||||
try {
|
||||
SpringApplication.run(AppRun.class, args);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -28,6 +28,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;
|
||||
@@ -55,6 +57,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
private final CutConveyorTask cutConveyorTask;
|
||||
|
||||
private final RedissonClient redissonClient;
|
||||
|
||||
/**
|
||||
* task_id:任务标识
|
||||
* task_code:任务编码
|
||||
@@ -192,64 +196,68 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
log.info("apply请求参数:---------------------------------------------"+whereJson.toString());
|
||||
String type = whereJson.getString("type");
|
||||
JSONObject result = new JSONObject();
|
||||
synchronized (lock.intern(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");
|
||||
RLock lock = redissonClient.getLock("acs_to_wms:" + type);
|
||||
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock){
|
||||
{
|
||||
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申请任务失败!点位不能为空");
|
||||
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;
|
||||
/*
|
||||
* 根据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 + "相关入库分配明细记录!");
|
||||
}
|
||||
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);
|
||||
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);
|
||||
}
|
||||
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
|
||||
if (type.equals("2")) {
|
||||
//查询一个可用的空载具点位并下发给ACS
|
||||
/*
|
||||
* 1、优先存放空托盘区、托盘号默认99999;空托盘区没有位置,再找空巷道,或者空巷道有空位置的货位。
|
||||
2、分配货位规则:
|
||||
@@ -257,191 +265,199 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
b、没有,则优先找空的巷道;按空位置顺序分配;
|
||||
3、任务下发,判断巷道的任务类型,只能为空盘入库或者无任务类型;
|
||||
* */
|
||||
vehicle_code = CodeUtil.getNewCode("VEHICCLE_CODE_KTP");
|
||||
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "21").process().uniqueResult(0);
|
||||
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");
|
||||
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;
|
||||
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 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;
|
||||
// 先倒序找到第一个托盘、判断上一个是否有货位
|
||||
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(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;
|
||||
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 {
|
||||
// 未堵住: 跳出循环
|
||||
point_code = json.getString("point_code");
|
||||
break;
|
||||
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");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
// 校验此货位是否被堵住: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 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;
|
||||
}
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "下发成功!");
|
||||
return result;
|
||||
|
||||
}
|
||||
}finally {
|
||||
if (tryLock){
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
result.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
result.put("message", "申请任务超时!"+type);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,22 +1,27 @@
|
||||
server:
|
||||
port: 8010
|
||||
port: 8013
|
||||
#配置数据源
|
||||
spring:
|
||||
datasource:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:10.16.1.25}:${DB_PORT:3306}/${DB_NAME:whxr_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME:lms_test2}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:hl_tb_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
# username: ${DB_USER:root}
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:whxr_root}
|
||||
password: ${DB_PWD:123456}
|
||||
# password: ${DB_PWD:root}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
min-idle: 15
|
||||
# 最大连接数
|
||||
max-active: 60
|
||||
max-active: 30
|
||||
# 超时时间(以秒数为单位)
|
||||
remove-abandoned-timeout: 180
|
||||
# 获取连接超时时间
|
||||
max-wait: 5000
|
||||
max-wait: 3000
|
||||
# 连接有效性检测时间
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 连接在池中最小生存的时间
|
||||
@@ -36,11 +41,8 @@ spring:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
# 控制台管理用户名和密码
|
||||
url-pattern: /druid/*
|
||||
reset-enable: false
|
||||
login-username: admin
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
@@ -53,14 +55,13 @@ spring:
|
||||
multi-statement-allow: true
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:15}
|
||||
host: ${REDIS_HOST:10.16.1.25}
|
||||
database: ${REDIS_DB:14}
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
#连接超时时间
|
||||
timeout: 5000
|
||||
redisson:
|
||||
config: classpath:/config/redisson.yml
|
||||
# redisson:
|
||||
# config: classpath:/config/redisson.yml
|
||||
|
||||
# 登录相关配置
|
||||
login:
|
||||
# 登录缓存
|
||||
@@ -79,7 +80,7 @@ login:
|
||||
heigth: 36
|
||||
# 内容长度
|
||||
length: 2
|
||||
# 字体名称,为空则使用默认字体,如遇到线上乱码,设置其他字体即可
|
||||
# 字体名称,为空则使用默认字体
|
||||
font-name:
|
||||
# 字体大小
|
||||
font-size: 25
|
||||
@@ -91,36 +92,29 @@ jwt:
|
||||
token-start-with: Bearer
|
||||
# 必须使用最少88位的Base64对该令牌进行编码
|
||||
base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI=
|
||||
# 令牌过期时间 此处单位/毫秒 ,默认2小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html
|
||||
token-validity-in-seconds: 7200000
|
||||
# 令牌过期时间 此处单位/毫秒 ,默认4小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html
|
||||
token-validity-in-seconds: 14400000
|
||||
# 在线用户key
|
||||
online-key: online-token-
|
||||
# 验证码
|
||||
code-key: code-key-
|
||||
# token 续期检查时间范围(默认30分钟,单位默认毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期
|
||||
# token 续期检查时间范围(默认30分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期
|
||||
detect: 1800000
|
||||
# 续期时间范围,默认 1小时,这里单位毫秒
|
||||
# 续期时间范围,默认1小时,单位毫秒
|
||||
renew: 3600000
|
||||
|
||||
#是否允许生成代码,生产环境设置为false
|
||||
generator:
|
||||
enabled: true
|
||||
|
||||
#是否开启 swagger-ui
|
||||
swagger:
|
||||
enabled: true
|
||||
|
||||
# IP 本地解析
|
||||
ip:
|
||||
local-parsing: true
|
||||
|
||||
#是否允许生成代码,生产环境设置为false
|
||||
generator:
|
||||
enabled: false
|
||||
|
||||
#如果生产环境要开启swagger,需要配置请求地址
|
||||
#springfox:
|
||||
# documentation:
|
||||
# swagger:
|
||||
# v2:
|
||||
# host: # 接口域名或外网ip
|
||||
|
||||
#是否开启 swagger-ui
|
||||
swagger:
|
||||
enabled: false
|
||||
|
||||
# 文件存储路径
|
||||
file:
|
||||
mac:
|
||||
@@ -137,5 +131,32 @@ file:
|
||||
avatarMaxSize: 5
|
||||
logging:
|
||||
file:
|
||||
path: /app/jar/logs
|
||||
path: C:\log\wms
|
||||
config: classpath:logback-spring.xml
|
||||
|
||||
# Sa-Token配置
|
||||
sa-token:
|
||||
# token 名称 (同时也是cookie名称)
|
||||
token-name: Authorization
|
||||
# token 有效期,单位s 默认30天, -1代表永不过期
|
||||
timeout: 2592000
|
||||
# token 临时有效期 (指定时间内无操作就视为token过期) 单位: 秒
|
||||
activity-timeout: -1
|
||||
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
|
||||
is-concurrent: true
|
||||
# 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
|
||||
is-share: false
|
||||
# token风格
|
||||
token-style: random-128
|
||||
# 是否输出操作日志
|
||||
is-log: false
|
||||
jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq
|
||||
# token 前缀
|
||||
token-prefix:
|
||||
cookie:
|
||||
# 配置 Cookie 作用域:根据二级域名实现sso登入如lms.sso.com;acs.sso.com
|
||||
domain:
|
||||
|
||||
loki:
|
||||
url: http://localhost:3100/loki/api/v1
|
||||
systemName: lms
|
||||
|
||||
@@ -2,7 +2,7 @@ spring:
|
||||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
active: dev
|
||||
active: prod
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
data:
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
singleServerConfig:
|
||||
connectionMinimumIdleSize: 8
|
||||
connectionPoolSize: 8
|
||||
address: redis://10.16.1.25:6379
|
||||
password: 942464Yy
|
||||
address: redis://127.0.0.1:6379
|
||||
idleConnectionTimeout: 10000
|
||||
timeout: 3000
|
||||
threads: 8
|
||||
|
||||
@@ -56,6 +56,26 @@ https://juejin.cn/post/6844903775631572999
|
||||
|
||||
</appender>
|
||||
|
||||
<appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/%d{yyyy-MM-dd}.%i.error.log</file>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>error</level>
|
||||
</filter>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}.%i.error.log</fileNamePattern>
|
||||
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||
<maxHistory>15</maxHistory>
|
||||
<totalSizeCap>300MB</totalSizeCap>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>3</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--异步到文件-->
|
||||
<appender name="asyncFileAppender" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<discardingThreshold>0</discardingThreshold>
|
||||
@@ -68,6 +88,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
<root level="debug">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="ERROR" />
|
||||
</root>
|
||||
<logger name="org.springframework" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
@@ -113,6 +134,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
<root level="debug">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="ERROR" />
|
||||
</root>
|
||||
<logger name="org.springframework" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
@@ -137,23 +159,23 @@ https://juejin.cn/post/6844903775631572999
|
||||
</logger>
|
||||
<logger name="org.quartz" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
|
||||
|
||||
</logger>
|
||||
<logger name="com.google" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
|
||||
|
||||
</logger>
|
||||
<logger name="springfox" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
|
||||
|
||||
</logger>
|
||||
<logger name="log4jdbc" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
|
||||
|
||||
</logger>
|
||||
<logger name="nl.basjes" level="ERROR" additivity="false">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
|
||||
|
||||
</logger>
|
||||
</springProfile>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user