代码更新
This commit is contained in:
@@ -155,6 +155,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
WQLObject empTab = WQLObject.getWQLObject("st_ivt_EmptyVehicleRecord");// 空载具作业记录表
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");// 空载具作业记录表
|
||||
WQLObject regionTab = WQLObject.getWQLObject("ST_IVT_regionIO"); // 区域出入库表
|
||||
WQLObject veQtyTab = WQLObject.getWQLObject("PDM_BI_vehicleQty"); // 托盘对应数量表
|
||||
|
||||
|
||||
/*
|
||||
@@ -201,7 +202,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
} else if (StrUtil.equals(type, "2")) {
|
||||
// 2.共挤线满托入库: 调用物料入库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(qty) || (StrUtil.equals(qty, "0"))) throw new BadRequestException("物料数量不能为空或者为0");
|
||||
if (ObjectUtil.isEmpty(qty) || (StrUtil.equals(qty, "0")))
|
||||
throw new BadRequestException("物料数量不能为空或者为0");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("start_point_code", point_code);
|
||||
@@ -328,12 +330,14 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
} else if (StrUtil.equals(type, "6")) {
|
||||
// 6.一楼空盘入库 (有载具号): 调用空托盘入库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
|
||||
if (ObjectUtil.isEmpty(vehicle_code)) throw new BadRequestException("载具号不能为空");
|
||||
// 查询载具号对应的数量
|
||||
JSONObject jsonVeQty = veQtyTab.query("vehicle_code = '" + vehicle_code + "' and is_task = '0' order by create_time DESC").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonVeQty)) throw new BadRequestException("请先手持扫码");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("start_point_code", point_code);
|
||||
param.put("qty", vehicle_num);
|
||||
param.put("qty", jsonVeQty.getString("qty"));
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
// 创建任务
|
||||
SendEmpVehicleTask taskBean = SpringContextHolder.getBean(SendEmpVehicleTask.class);
|
||||
@@ -341,7 +345,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
// 插入空载具作业记录表
|
||||
JSONObject jsonEmpParam = new JSONObject();
|
||||
jsonEmpParam.put("vehicle_qty", vehicle_num);
|
||||
jsonEmpParam.put("vehicle_qty", jsonVeQty.getString("qty"));
|
||||
jsonEmpParam.put("task_id", task_id);
|
||||
jsonEmpParam.put("io_type", "0");
|
||||
this.createEmp(jsonEmpParam);
|
||||
@@ -354,6 +358,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
jsonTask.put("task_status", "05");
|
||||
taskTab.update(jsonTask);
|
||||
// 更新载具对应数量表
|
||||
jsonVeQty.put("is_task", "1");
|
||||
veQtyTab.update(jsonVeQty);
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
}
|
||||
@@ -385,7 +392,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
|
||||
JSONObject jsonEmp = new JSONObject();
|
||||
jsonEmp.put("record_uuid", IdUtil.getSnowflake(1,1).nextId());
|
||||
jsonEmp.put("record_uuid", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonEmp.put("bill_code", CodeUtil.getNewCode("KZJ_BILL_CODE"));
|
||||
jsonEmp.put("io_type", io_type);
|
||||
jsonEmp.put("bill_status", "20");
|
||||
@@ -417,10 +424,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
|
||||
JSONObject jsonRegion = new JSONObject();
|
||||
jsonRegion.put("iostorinv_id",IdUtil.getSnowflake(1,1).nextId());
|
||||
jsonRegion.put("bill_code",CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||
jsonRegion.put("io_type",io_type);
|
||||
jsonRegion.put("bill_status","20");
|
||||
jsonRegion.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonRegion.put("bill_code", CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||
jsonRegion.put("io_type", io_type);
|
||||
jsonRegion.put("bill_status", "20");
|
||||
// 根据起点点位找到起点设备,根据设备找到对应工单, 根据工单找到对应物料及托盘类型
|
||||
String device_code = start_point_code.substring(0, start_point_code.indexOf("_"));
|
||||
|
||||
@@ -430,23 +437,23 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
JSONObject jsonOrder = orderTab.query("device_id = '" + deviceDto.getDevice_id() + "' and order_status = '02' and is_delete = '0'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonOrder)) throw new BadRequestException("此设备未在生产中或不存在");
|
||||
|
||||
jsonRegion.put("material_id",jsonOrder.getString("material_id"));
|
||||
jsonRegion.put("qty",qty);
|
||||
jsonRegion.put("material_id", jsonOrder.getString("material_id"));
|
||||
jsonRegion.put("qty", qty);
|
||||
JSONObject jsonMater = materTab.query("material_id ='" + jsonOrder.getString("material_id") + "'").uniqueResult(0);
|
||||
jsonRegion.put("qty_unit_id",jsonMater.getString("base_unit_id"));
|
||||
jsonRegion.put("qty_unit_id", jsonMater.getString("base_unit_id"));
|
||||
|
||||
jsonRegion.put("start_point_code",start_point_code);
|
||||
jsonRegion.put("start_point_code", start_point_code);
|
||||
Long start_region_id = SpringContextHolder.getBean(PointService.class).findByCode(start_point_code).getRegion_id();
|
||||
jsonRegion.put("start_region_id",String.valueOf(start_region_id));
|
||||
jsonRegion.put("end_point_code",next_point_code);
|
||||
jsonRegion.put("start_region_id", String.valueOf(start_region_id));
|
||||
jsonRegion.put("end_point_code", next_point_code);
|
||||
Long end_region_id = SpringContextHolder.getBean(PointService.class).findByCode(next_point_code).getRegion_id();
|
||||
jsonRegion.put("end_region_id",String.valueOf(end_region_id));
|
||||
jsonRegion.put("end_region_id", String.valueOf(end_region_id));
|
||||
|
||||
jsonRegion.put("create_mode","02");
|
||||
jsonRegion.put("task_id",task_id);
|
||||
jsonRegion.put("create_id",SecurityUtils.getCurrentUserId());
|
||||
jsonRegion.put("create_name",SecurityUtils.getNickName());
|
||||
jsonRegion.put("create_time",DateUtil.now());
|
||||
jsonRegion.put("create_mode", "02");
|
||||
jsonRegion.put("task_id", task_id);
|
||||
jsonRegion.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
jsonRegion.put("create_name", SecurityUtils.getNickName());
|
||||
jsonRegion.put("create_time", DateUtil.now());
|
||||
regionTab.insert(jsonRegion);
|
||||
|
||||
JSONObject resuft = new JSONObject();
|
||||
@@ -466,10 +473,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||
|
||||
JSONObject jsonRegion = new JSONObject();
|
||||
jsonRegion.put("iostorinv_id",IdUtil.getSnowflake(1,1).nextId());
|
||||
jsonRegion.put("bill_code",CodeUtil.getNewCode("OUT_STORE_CODE"));
|
||||
jsonRegion.put("io_type",io_type);
|
||||
jsonRegion.put("bill_status","20");
|
||||
jsonRegion.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonRegion.put("bill_code", CodeUtil.getNewCode("OUT_STORE_CODE"));
|
||||
jsonRegion.put("io_type", io_type);
|
||||
jsonRegion.put("bill_status", "20");
|
||||
// 根据起点点位找到起点设备,根据设备找到对应工单, 根据工单找到对应物料及托盘类型
|
||||
String device_code = next_point_code.substring(0, next_point_code.indexOf("_"));
|
||||
|
||||
@@ -479,27 +486,27 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
JSONObject jsonOrder = orderTab.query("device_id = '" + deviceDto.getDevice_id() + "' and order_status = '02' and is_delete = '0'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonOrder)) throw new BadRequestException("此设备未在生产中或不存在");
|
||||
|
||||
jsonRegion.put("material_id",jsonOrder.getString("material_id"));
|
||||
jsonRegion.put("qty","100"); // 暂时先按照100
|
||||
jsonRegion.put("material_id", jsonOrder.getString("material_id"));
|
||||
jsonRegion.put("qty", "100"); // 暂时先按照100
|
||||
JSONObject jsonMater = materTab.query("material_id ='" + jsonOrder.getString("material_id") + "'").uniqueResult(0);
|
||||
jsonRegion.put("qty_unit_id",jsonMater.getString("base_unit_id"));
|
||||
jsonRegion.put("qty_unit_id", jsonMater.getString("base_unit_id"));
|
||||
|
||||
jsonRegion.put("end_point_code",next_point_code);
|
||||
jsonRegion.put("end_point_code", next_point_code);
|
||||
Long end_region_id = SpringContextHolder.getBean(PointService.class).findByCode(next_point_code).getRegion_id();
|
||||
jsonRegion.put("end_region_id",String.valueOf(end_region_id));
|
||||
jsonRegion.put("end_region_id", String.valueOf(end_region_id));
|
||||
|
||||
jsonRegion.put("create_mode","02");
|
||||
jsonRegion.put("create_id",SecurityUtils.getCurrentUserId());
|
||||
jsonRegion.put("create_name",SecurityUtils.getNickName());
|
||||
jsonRegion.put("create_time",DateUtil.now());
|
||||
jsonRegion.put("create_mode", "02");
|
||||
jsonRegion.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
jsonRegion.put("create_name", SecurityUtils.getNickName());
|
||||
jsonRegion.put("create_time", DateUtil.now());
|
||||
regionTab.insert(jsonRegion);
|
||||
|
||||
// 需回显起始点位、起始区域、任务id
|
||||
JSONObject resuft = new JSONObject();
|
||||
resuft.put("iostorinv_id",jsonRegion.getString("iostorinv_id"));
|
||||
resuft.put("vehicle_type",jsonOrder.getString("vehicle_type"));
|
||||
resuft.put("create_mode",jsonRegion.getString("create_mode"));
|
||||
resuft.put("material_id",jsonOrder.getString("material_id"));
|
||||
resuft.put("iostorinv_id", jsonRegion.getString("iostorinv_id"));
|
||||
resuft.put("vehicle_type", jsonOrder.getString("vehicle_type"));
|
||||
resuft.put("create_mode", jsonRegion.getString("create_mode"));
|
||||
resuft.put("material_id", jsonOrder.getString("material_id"));
|
||||
return resuft;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class AutoQueryTask {
|
||||
/*
|
||||
* 1.查找输送线有没有空位 输送线1对1关系 调用获取点位状态接口
|
||||
* 2.判断有空位的输送线是否有任务:起点和终点都要判断
|
||||
* 输送线点位:SSX01A1 - SSX01A2 ,SSX01B1 - SSX01B2
|
||||
* 输送线点位:SSX01A1 - SSX01A2 ,SSX02A1 - SSX02A2
|
||||
*/
|
||||
// 2.查找输送线空位,调用获取点位状态接口
|
||||
JSONArray paramArr = new JSONArray();
|
||||
@@ -49,11 +49,11 @@ public class AutoQueryTask {
|
||||
paramArr.add(pointA2);
|
||||
|
||||
JSONObject pointB1 = new JSONObject();
|
||||
pointB1.put("device_code", "SSX01B1");
|
||||
pointB1.put("device_code", "SSX02A1");
|
||||
paramArr.add(pointB1);
|
||||
|
||||
JSONObject pointB2 = new JSONObject();
|
||||
pointB2.put("device_code", "SSX01B2");
|
||||
pointB2.put("device_code", "SSX02A2");
|
||||
paramArr.add(pointB2);
|
||||
|
||||
JSONObject result = wmsToAcsService.getPointStatus(paramArr);
|
||||
@@ -66,7 +66,7 @@ public class AutoQueryTask {
|
||||
for (int j = 0; j < dataArr.size(); j++) {
|
||||
JSONObject jsonObject = dataArr.getJSONObject(j);
|
||||
|
||||
String device_code = jsonObject.getString("barcode");
|
||||
String device_code = jsonObject.getString("device_code");
|
||||
switch (device_code) {
|
||||
case "SSX01A1" :
|
||||
jsonPointAfter.put("SSX01A1",jsonObject.getString("move"));
|
||||
@@ -74,11 +74,11 @@ public class AutoQueryTask {
|
||||
case "SSX01A2" :
|
||||
jsonPointAfter.put("SSX01A2",jsonObject.getString("move"));
|
||||
break;
|
||||
case "SSX01B1" :
|
||||
jsonPointAfter.put("SSX01B1",jsonObject.getString("move"));
|
||||
case "SSX02A1" :
|
||||
jsonPointAfter.put("SSX02A1",jsonObject.getString("move"));
|
||||
break;
|
||||
case "SSX01B2" :
|
||||
jsonPointAfter.put("SSX01B2",jsonObject.getString("move"));
|
||||
case "SSX02A2" :
|
||||
jsonPointAfter.put("SSX02A2",jsonObject.getString("move"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -97,40 +97,40 @@ public class AutoQueryTask {
|
||||
|
||||
if (ObjectUtil.isEmpty(is_stara) && ObjectUtil.isEmpty(is_end)) {
|
||||
// 4.3.更新任务终点点位
|
||||
jsonTask.put("next_point_code", "SSX01A2");
|
||||
jsonTask.put("next_point_code", "SSX01A1");
|
||||
taskTab.update(jsonTask);
|
||||
// 4.4.下发ACS
|
||||
JSONObject jsonResultAcs = pointTaskBean.renotifyAcs(jsonTask.getString("task_id"));
|
||||
|
||||
if (StrUtil.equals(jsonResultAcs.getString("status"), "200")) {
|
||||
// 4.5.下发成功、更新任务状态
|
||||
jsonTask.put("task_status", "02");
|
||||
jsonTask.put("task_status", "05");
|
||||
taskTab.update(jsonTask);
|
||||
}
|
||||
}
|
||||
// 5.1判断SSX01B1 、 SSX01B2是否是空位 无任务
|
||||
} else if (StrUtil.equals(jsonPointAfter.getString("SSX01B1"), "0") && StrUtil.equals(jsonPointAfter.getString("SSX01B2"), "0")) {
|
||||
// 5.2如果都是空位 则判断是否有正在进行的任务
|
||||
map.put("flag", "2");
|
||||
map.put("start_point_code", "('SSX01B1','SSX01B2')");
|
||||
// 查找起点是否有任务
|
||||
JSONArray is_stara = WQL.getWO("AUTO_QUERYTASK").addParamMap(map).process().getResultJSONArray(0);
|
||||
// 查询终点是否有任务
|
||||
map.put("flag", "3");
|
||||
map.put("end_point_code", "('SSX01B1','SSX01B2')");
|
||||
JSONArray is_end = WQL.getWO("AUTO_QUERYTASK").addParamMap(map).process().getResultJSONArray(0);
|
||||
// 5.1判断SSX02A1 、 SSX02A2是否是空位 无任务
|
||||
} else if (StrUtil.equals(jsonPointAfter.getString("SSX02A1"), "0") && StrUtil.equals(jsonPointAfter.getString("SSX02A2"), "0")) {
|
||||
// 5.2如果都是空位 则判断是否有正在进行的任务
|
||||
map.put("flag", "2");
|
||||
map.put("start_point_code", "('SSX02A1','SSX02A2')");
|
||||
// 查找起点是否有任务
|
||||
JSONArray is_stara2 = WQL.getWO("AUTO_QUERYTASK").addParamMap(map).process().getResultJSONArray(0);
|
||||
// 查询终点是否有任务
|
||||
map.put("flag", "3");
|
||||
map.put("end_point_code", "('SSX02A1','SSX02A2')");
|
||||
JSONArray is_end2 = WQL.getWO("AUTO_QUERYTASK").addParamMap(map).process().getResultJSONArray(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(is_stara) && ObjectUtil.isEmpty(is_end)) {
|
||||
// 5.3.更新任务终点点位
|
||||
jsonTask.put("next_point_code", "SSX01B2");
|
||||
taskTab.update(jsonTask);
|
||||
// 5.4.下发ACS
|
||||
JSONObject jsonResultAcs = pointTaskBean.renotifyAcs(jsonTask.getString("task_id"));
|
||||
|
||||
if (StrUtil.equals(jsonResultAcs.getString("status"), "200")) {
|
||||
// 4.5.下发成功、更新任务状态
|
||||
jsonTask.put("task_status", "02");
|
||||
if (ObjectUtil.isEmpty(is_stara2) && ObjectUtil.isEmpty(is_end2)) {
|
||||
// 5.3.更新任务终点点位
|
||||
jsonTask.put("next_point_code", "SSX02A1");
|
||||
taskTab.update(jsonTask);
|
||||
// 5.4.下发ACS
|
||||
JSONObject jsonResultAcs = pointTaskBean.renotifyAcs(jsonTask.getString("task_id"));
|
||||
|
||||
if (StrUtil.equals(jsonResultAcs.getString("status"), "200")) {
|
||||
// 4.5.下发成功、更新任务状态
|
||||
jsonTask.put("task_status", "05");
|
||||
taskTab.update(jsonTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.start_point_code TYPEAS s_string
|
||||
输入.end_point_code TYPEAS s_string
|
||||
输入.start_point_code TYPEAS f_string
|
||||
输入.end_point_code TYPEAS f_string
|
||||
|
||||
|
||||
[临时表]
|
||||
|
||||
Binary file not shown.
@@ -10,6 +10,8 @@ import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -17,6 +19,7 @@ import java.util.HashMap;
|
||||
/**
|
||||
* 普通点对点任务
|
||||
*/
|
||||
@Service
|
||||
public class PointToPointTask extends AbstractAcsTask {
|
||||
@Override
|
||||
@Transactional
|
||||
|
||||
@@ -282,8 +282,9 @@ public class SendMaterialTask extends AbstractAcsTask {
|
||||
JSONObject jsonStartRegion = regionTab.query("region_id = '" + startDto.getRegion_id() + "'").uniqueResult(0);
|
||||
|
||||
/*
|
||||
* 物料入库业务:目前只有1个业务,如果区域不正确则报错
|
||||
* 物料入库业务:目前只有2个业务,如果区域不正确则报错
|
||||
* 1.共挤线 --> 养生区A
|
||||
* 2.豪凯线 --> 成品区
|
||||
*/
|
||||
String next_point_code = "";
|
||||
if (StrUtil.equals(jsonStartRegion.getString("region_code"),RegionTypeEnum.GJQY.getCode())) {
|
||||
|
||||
Reference in New Issue
Block a user