修改
This commit is contained in:
@@ -9,6 +9,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||
@@ -17,12 +18,17 @@ import org.nl.wms.log.LokiLogType;
|
||||
import org.nl.wms.pda.st.service.PrintService;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.service.TaskService;
|
||||
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.impl.RawAssistIStorServiceImpl;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@@ -30,9 +36,9 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
private final TaskService taskService;
|
||||
|
||||
private final PrintService printService;
|
||||
|
||||
private final RawAssistIStorService rawAssistIStorService;
|
||||
/**
|
||||
* task_id:任务标识
|
||||
* task_code:任务编码
|
||||
@@ -171,29 +177,148 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject apply(JSONObject whereJson) {
|
||||
String type = whereJson.getString("type");
|
||||
String point_code = whereJson.getString("point_code");
|
||||
String vehicle_type = whereJson.getString("vehicle_type");
|
||||
String device_code = whereJson.getString("device_code");
|
||||
String vehicle_code = whereJson.getString("vehicle_code");
|
||||
//载具数量
|
||||
String vehicle_num = whereJson.getString("vehicle_num");
|
||||
//物料数量
|
||||
String material_num = whereJson.getString("material_num");
|
||||
|
||||
if (ObjectUtil.isEmpty(type)) throw new BadRequestException("类型不能为空");
|
||||
if (ObjectUtil.isEmpty(point_code)) throw new BadRequestException("点位不能为空");
|
||||
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(vehicle_code)) throw new BadRequestException("ACS申请任务失败!载具不能为空");
|
||||
|
||||
/*
|
||||
* 根据type判断是什么业务类型:
|
||||
* 1.共挤线申请空盘
|
||||
* 2.共挤线满托入库
|
||||
* 3.油漆线申请空盘
|
||||
* 4.油漆线申请物料
|
||||
* 5.油漆线空盘入库
|
||||
* 6.一楼空盘入库 (有载具号)
|
||||
* 7.油漆线->输送线(油漆线满料)
|
||||
* 8.豪凯自动线下料入库
|
||||
* 1.入库任务
|
||||
* 2.空盘入库任务
|
||||
* 3.空盘出库任务
|
||||
* 4.出库口申请入发货区任务
|
||||
*/
|
||||
if (type.equals("1")){
|
||||
//通过该木箱码查询对应的分配明细
|
||||
JSONArray dis_rows = WQLObject.getWQLObject("st_ivt_iostorinvdis").query("work_status = '00' AND box_no = '"+vehicle_code+"'").getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(dis_rows)){
|
||||
throw new BadRequestException("未查询到木箱:"+vehicle_code+"相关入库分配明细记录!");
|
||||
}
|
||||
Map map = new HashMap();
|
||||
map.put("tableMater",dis_rows);
|
||||
map.put("point_code",device_code);
|
||||
map.put("checked",true);
|
||||
map.put("auto_issue","1");
|
||||
//自动分配货位并下发任务
|
||||
rawAssistIStorService.divStruct(map);
|
||||
}
|
||||
if (type.equals("2")){
|
||||
//查询一个可用的空载具点位并下发给ACS
|
||||
/*
|
||||
* 1、优先存放空托盘区、托盘号默认99999;空托盘区没有位置,再找空巷道,或者空巷道有空位置的货位。
|
||||
2、分配货位规则:
|
||||
a、查找片区内,有空位的巷道,并且两头能够通畅的巷道排;判断巷道的任务类型,只能为入库或者无任务类型;
|
||||
b、没有,则优先找空的巷道;按空位置顺序分配;
|
||||
3、任务下发,判断巷道的任务类型,只能为空盘入库或者无任务类型;
|
||||
* */
|
||||
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("vehicle_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");
|
||||
|
||||
//查询是否存在可用的空位
|
||||
JSONObject jo = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag","19").addParam("sale_order_name",sale_order_name).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jo)){
|
||||
//查询新的一排
|
||||
JSONObject point_jo = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag","20").process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(point_jo)){
|
||||
throw new BadRequestException("未查询到相同销售订单的放货区点位或空的一排!");
|
||||
}else {
|
||||
jo = WQLObject.getWQLObject("sch_base_point").query("row_num = '"+point_jo.getString("row_num")+"' AND point_type ='9' AND is_delete = '0'").uniqueResult(0);
|
||||
}
|
||||
}
|
||||
|
||||
//创建任务
|
||||
JSONObject task_jo = new JSONObject();
|
||||
task_jo.put("point_code1",device_code);
|
||||
task_jo.put("point_code2",jo.getString("point_cde"));
|
||||
task_jo.put("vehicle_code",vehicle_code);
|
||||
task_jo.put("task_type","010506");
|
||||
SendOutTask sendOutTask = new SendOutTask();
|
||||
sendOutTask.createTask(task_jo);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -85,14 +85,14 @@ public class LmsToMesController {
|
||||
return new ResponseEntity<>(lmsToMesService.childRollFGOutboundComplete(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/LMSUnPackakge")
|
||||
@PostMapping("/lmsUnPackage")
|
||||
@Log("拆箱出库回传mes箱号、子卷号")
|
||||
@ApiOperation("拆箱出库回传mes箱号、子卷号")
|
||||
public ResponseEntity<Object> lmsSunPackage(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(lmsToMesService.LmsSunPackage(jo), HttpStatus.OK);
|
||||
public ResponseEntity<Object> lmsUnPackage(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(lmsToMesService.lmsUnPackage(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/LMSPackakge")
|
||||
@PostMapping("/lmsPackage")
|
||||
@Log("拆箱入库回传mes箱号、子卷号")
|
||||
@ApiOperation("拆箱入库回传mes箱号、子卷号")
|
||||
public ResponseEntity<Object> lmsPackage(@RequestBody JSONObject jo) {
|
||||
|
||||
@@ -97,7 +97,7 @@ public interface LmsToMesService {
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
JSONObject LmsSunPackage(JSONObject jo);
|
||||
JSONObject lmsUnPackage(JSONObject jo);
|
||||
|
||||
/**
|
||||
* 拆箱入库:回传mes箱号、子卷号
|
||||
|
||||
@@ -479,7 +479,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
*/
|
||||
@LokiLog(type = LokiLogType.LMS_TO_MES)
|
||||
@Override
|
||||
public JSONObject LmsSunPackage(JSONObject param) {
|
||||
public JSONObject lmsUnPackage(JSONObject param) {
|
||||
log.info("LMSUnPackakge接口输入参数为:-------------------" + param.toString());
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
@@ -490,18 +490,22 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
return result;
|
||||
}
|
||||
|
||||
JSONArray list = new JSONArray();
|
||||
|
||||
// String url = acsUrl + api;
|
||||
String url = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_URL").getValue();
|
||||
String api = "CamstarApi/LMSUnPackakge";
|
||||
String api = "CamstarApi/LMSUnPackage";
|
||||
url = url + api;
|
||||
|
||||
String UserName = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
|
||||
String Password = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
|
||||
param.put("UserName",UserName);
|
||||
param.put("Password",Password);
|
||||
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(param))
|
||||
.execute().body();
|
||||
result = JSONObject.parseObject(resultMsg);
|
||||
log.info("LMSUnPackakge接口输出参数为:-------------------" + result.toString());
|
||||
log.info("LMSUnPackage接口输出参数为:-------------------" + result.toString());
|
||||
|
||||
|
||||
String RTYPE = result.getString("RTYPE");
|
||||
@@ -534,12 +538,16 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
return result;
|
||||
}
|
||||
|
||||
JSONArray list = new JSONArray();
|
||||
|
||||
// String url = acsUrl + api;
|
||||
String url = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_URL").getValue();
|
||||
String api = "CamstarApi/LMSPackakge";
|
||||
String api = "CamstarApi/LMSPackage";
|
||||
url = url + api;
|
||||
|
||||
String UserName = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
|
||||
String Password = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
|
||||
param.put("UserName",UserName);
|
||||
param.put("Password",Password);
|
||||
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(param))
|
||||
|
||||
@@ -126,9 +126,12 @@ public class ShippingServiceImpl implements ShippingService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//通过气涨轴对应的分切计划来判断要送到哪个机台编号附近
|
||||
String qzzno = rows.getJSONObject(0).getString("qzzno");
|
||||
|
||||
|
||||
HashMap map = new HashMap();
|
||||
map.put("flag", "6");
|
||||
|
||||
@@ -141,6 +144,18 @@ public class ShippingServiceImpl implements ShippingService {
|
||||
String product_area = cut_jo.getString("product_area");
|
||||
String point_location = cut_jo.getString("point_location");
|
||||
|
||||
//判断当前输送线上是否超过最大负荷任务数量组3组
|
||||
JSONArray cut_rows = WQL.getWO("PDA_02").addParam("flag","13").addParam("qzzno",qzzno).addParam("product_area",product_area).addParam("point_location",point_location).process().getResultJSONArray(0);
|
||||
|
||||
if (cut_rows.size()>3){
|
||||
if (point_location.equals("0")){
|
||||
throw new BadRequestException("已超过上半段输送线最大负荷任务数,请等下一子卷送出再进行配送,并将该空载具送回!");
|
||||
}
|
||||
if (point_location.equals("1")){
|
||||
throw new BadRequestException("已超过下半段输送线最大负荷任务数,请等下一子卷送出再进行配送,并将该空载具送回!");
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject vehicle_area = WQLObject.getWQLObject("md_pb_vehiclearea").query("product_area = '"+product_area+"' AND point_location = '"+point_location+"' AND vehicle_code = '"+vehicle_code+"'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(vehicle_area)){
|
||||
@@ -207,6 +222,9 @@ public class ShippingServiceImpl implements ShippingService {
|
||||
|
||||
//根据起点判断区域查询对应的输送线空点位
|
||||
JSONObject point_jo = WQL.getWO("PDA_02").addParam("flag","4").addParam("product_area",vehicle_area.getString("product_area")).addParam("point_location",vehicle_area.getString("point_location")).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(point_jo)){
|
||||
throw new BadRequestException("对应输送线不存在可用的空位!");
|
||||
}
|
||||
//下发输送线任务
|
||||
JSONObject form = new JSONObject();
|
||||
form.put("point_code1",point_code);
|
||||
@@ -242,6 +260,18 @@ public class ShippingServiceImpl implements ShippingService {
|
||||
throw new BadRequestException("该气涨轴无法放在该载具上!");
|
||||
}
|
||||
|
||||
//判断当前输送线上是否超过最大负荷任务数量组3组
|
||||
JSONArray cut_rows = WQL.getWO("PDA_02").addParam("flag","13").addParam("qzzno",qzzno).addParam("product_area",product_area).addParam("point_location",point_location).process().getResultJSONArray(0);
|
||||
|
||||
if (cut_rows.size()>3){
|
||||
if (point_location.equals("0")){
|
||||
throw new BadRequestException("已超过上半段输送线最大负荷任务数,请等下一子卷送出再进行配送,并将该空载具送回!");
|
||||
}
|
||||
if (point_location.equals("1")){
|
||||
throw new BadRequestException("已超过下半段输送线最大负荷任务数,请等下一子卷送出再进行配送,并将该空载具送回!");
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("message","校验无误,可以进行配送!");
|
||||
return jo;
|
||||
|
||||
@@ -369,6 +369,64 @@
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "13"
|
||||
QUERY
|
||||
SELECT DISTINCT
|
||||
plan.resource_name,
|
||||
plan.split_group,
|
||||
( CASE WHEN plan.order_type = '1' THEN parent_container_name WHEN plan.order_type = '2' THEN restruct_container_name END ) AS source_container_name
|
||||
FROM
|
||||
sch_base_task task
|
||||
INNER JOIN pdm_bi_slittingproductionplan plan ON plan.qzzno = task.vehicle_code
|
||||
LEFT JOIN st_ivt_cutpointivt cut ON cut.ext_code = plan.resource_name
|
||||
WHERE
|
||||
task.task_type = '010402'
|
||||
AND IFNULL( plan.qzzno, '' ) <> ''
|
||||
AND task.is_delete = '0'
|
||||
AND task.task_status < '07'
|
||||
OPTION 输入.product_area <> ""
|
||||
cut.product_area = 输入.product_area
|
||||
ENDOPTION
|
||||
OPTION 输入.product_area <> ""
|
||||
cut.point_location = 输入.point_location
|
||||
ENDOPTION
|
||||
UNION
|
||||
SELECT DISTINCT
|
||||
plan.resource_name,
|
||||
plan.split_group,
|
||||
( CASE WHEN plan.order_type = '1' THEN parent_container_name WHEN plan.order_type = '2' THEN restruct_container_name END ) AS source_container_name
|
||||
FROM
|
||||
st_ivt_deliverypointivt ivt
|
||||
INNER JOIN pdm_bi_slittingproductionplan plan ON plan.qzzno = ivt.qzzno
|
||||
LEFT JOIN st_ivt_cutpointivt cut ON cut.ext_code = plan.resource_name
|
||||
WHERE
|
||||
ivt.point_status = '03'
|
||||
OPTION 输入.product_area <> ""
|
||||
cut.product_area = 输入.product_area
|
||||
ENDOPTION
|
||||
OPTION 输入.product_area <> ""
|
||||
cut.point_location = 输入.point_location
|
||||
ENDOPTION
|
||||
UNION
|
||||
SELECT DISTINCT
|
||||
plan.resource_name,
|
||||
plan.split_group,
|
||||
( CASE WHEN plan.order_type = '1' THEN parent_container_name WHEN plan.order_type = '2' THEN restruct_container_name END ) AS source_container_name
|
||||
FROM
|
||||
pdm_bi_slittingproductionplan plan
|
||||
LEFT JOIN st_ivt_cutpointivt cut ON cut.ext_code = plan.resource_name
|
||||
WHERE
|
||||
plan.qzzno = 输入.qzzno
|
||||
OPTION 输入.product_area <> ""
|
||||
cut.product_area = 输入.product_area
|
||||
ENDOPTION
|
||||
OPTION 输入.product_area <> ""
|
||||
cut.point_location = 输入.point_location
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -36,4 +36,6 @@ public class AcsTaskDto {
|
||||
private String temperature;
|
||||
//烘烤时间
|
||||
private String oven_time;
|
||||
//密集库明细类型
|
||||
private String dtl_type;
|
||||
}
|
||||
|
||||
@@ -164,6 +164,11 @@ public class PointServiceImpl implements PointService {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
Long region_id = dto.getRegion_id();
|
||||
JSONObject region = WQLObject.getWQLObject("sch_base_region").query("region_id = '"+region_id+"'").uniqueResult(0);
|
||||
dto.setRegion_code(region.getString("region_code"));
|
||||
dto.setRegion_name(region.getString("region_name"));
|
||||
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
|
||||
@@ -310,7 +310,7 @@ public class CallEmpReelTask extends AbstractAcsTask {
|
||||
}
|
||||
tab.insert(json);
|
||||
|
||||
this.immediateNotifyAcs(null);
|
||||
this.immediateNotifyAcs(json.getString("task_id"));
|
||||
return json.getString("task_id");
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
package org.nl.wms.sch.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.service.TaskService;
|
||||
import org.nl.wms.st.inbill.service.impl.InbillServiceImpl;
|
||||
import org.nl.wms.st.inbill.service.impl.RawAssistIStorServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by ZZ on 2021/12/22.
|
||||
*/
|
||||
public class EmptyVehicleTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = EmptyVehicleTask.class.getName();
|
||||
|
||||
@Override
|
||||
public List<AcsTaskDto> addTask() {
|
||||
/*
|
||||
* 下发给ACS时需要特殊处理
|
||||
*/
|
||||
JSONArray arr = WQLObject.getWQLObject("SCH_BASE_Task").query("handle_class = '" + THIS_CLASS + "' and task_status = '" + TaskStatusEnum.START_AND_POINT.getCode() + "' and is_delete ='0'").getResultJSONArray(0);
|
||||
|
||||
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
//判断该任务所在的块、排存在其他任务
|
||||
String point_code2 = json.getString("point_code2");
|
||||
JSONObject struct_jo = WQLObject.getWQLObject("ST_IVT_StructAttr").query("struct_code = '"+point_code2+"'").uniqueResult(0);
|
||||
String row_num = struct_jo.getString("row_num");
|
||||
String block_num = struct_jo.getString("block_num");
|
||||
JSONObject task_jo = WQLObject.getWQLObject("ST_IVT_StructAttr").query("block_num = '"+block_num+"' AND row_num = '"+row_num+"' AND lock_type in ('3','6')").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(task_jo)){
|
||||
continue;
|
||||
}
|
||||
|
||||
char dtl_type = json.getString("acs_task_type").charAt(json.getString("acs_task_type").length()-1);
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
.task_type(json.getString("acs_task_type"))
|
||||
.start_device_code(json.getString("point_code1"))
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.priority(json.getString("priority"))
|
||||
.dtl_type(String.valueOf(dtl_type))
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
WQLObject point_table = WQLObject.getWQLObject("SCH_BASE_Point");
|
||||
WQLObject struct_table = WQLObject.getWQLObject("ST_IVT_StructAttr");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
HashMap map = new HashMap();
|
||||
//1:执行中,2:完成 ,3:acs取消
|
||||
if (status.equals("1")) {
|
||||
map.put("task_status", "03");
|
||||
}
|
||||
if (status.equals("2")) {
|
||||
map.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
//解锁货位、点位。更新点位仓位状态
|
||||
if (taskObj.getString("task_type").equals("010502")){
|
||||
String vehicle_code = taskObj.getString("vehicle_code");
|
||||
map.put("lock_type", "1");
|
||||
map.put("point_status", "03");
|
||||
map.put("vehicle_code", vehicle_code);
|
||||
point_table.update(map, "point_code = '" + taskObj.getString("point_code2") + "'");
|
||||
HashMap<String, String> struct_map = new HashMap<>();
|
||||
struct_map.put("lock_type", "1");
|
||||
struct_map.put("storagevehicle_code", vehicle_code);
|
||||
struct_table.update(struct_map, "struct_code = '" + taskObj.getString("point_code2") + "'");
|
||||
}
|
||||
if (taskObj.getString("task_type").equals("010504")){
|
||||
map.put("lock_type", "1");
|
||||
map.put("point_status", "01");
|
||||
map.put("vehicle_code", "");
|
||||
point_table.update(map, "point_code = '" + taskObj.getString("point_code2") + "'");
|
||||
HashMap<String, String> struct_map = new HashMap<>();
|
||||
struct_map.put("lock_type", "1");
|
||||
struct_map.put("storagevehicle_code", "");
|
||||
struct_table.update(struct_map, "struct_code = '" + taskObj.getString("point_code2") + "'");
|
||||
}
|
||||
|
||||
}
|
||||
map.put("update_optid", currentUserId);
|
||||
map.put("update_optname", nickName);
|
||||
map.put("update_time", now);
|
||||
WQLObject.getWQLObject("SCH_BASE_Task").update(map, "task_id = '" + taskObj.getString("task_id") + "'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findStartPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findNextPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String createTask(JSONObject form) {
|
||||
|
||||
TaskService taskService = SpringContextHolder.getBean(TaskService.class);
|
||||
String task_type = form.getString("task_type");
|
||||
if (StrUtil.isBlank(task_type)) {
|
||||
throw new BadRequestException("业务类型不能为空");
|
||||
}
|
||||
String point_code1 = form.getString("point_code1");
|
||||
if (StrUtil.isBlank(point_code1)) {
|
||||
throw new BadRequestException("起点不能为空");
|
||||
}
|
||||
String point_code2 = form.getString("point_code2");
|
||||
if (StrUtil.isBlank(point_code2)) {
|
||||
throw new BadRequestException("下一点不能为空");
|
||||
}
|
||||
String vehicle_code = form.getString("vehicle_code");
|
||||
if (StrUtil.isBlank(vehicle_code)) {
|
||||
throw new BadRequestException("载具号不能为空");
|
||||
}
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
json.put("task_type", form.getString("task_type"));
|
||||
json.put("vehicle_code", form.getString("vehicle_code"));
|
||||
json.put("task_status", "01");
|
||||
json.put("point_code1", point_code1);
|
||||
json.put("point_code2", point_code2);
|
||||
json.put("handle_class", this.getClass().getName());
|
||||
json.put("create_id", currentUserId);
|
||||
json.put("create_name", currentUsername);
|
||||
json.put("create_time", DateUtil.now());
|
||||
json.put("priority", "1");
|
||||
json.put("acs_task_type", "7");
|
||||
WQLObject.getWQLObject("SCH_BASE_Task").insert(json);
|
||||
|
||||
//下发
|
||||
this.immediateNotifyAcs(json.getString("task_id"));
|
||||
return json.getString("task_id");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void forceFinish(String taskdtl_id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, "0");
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,8 @@ public class InTask extends AbstractAcsTask {
|
||||
if (ObjectUtil.isNotEmpty(task_jo)){
|
||||
continue;
|
||||
}
|
||||
|
||||
char dtl_type = json.getString("acs_task_type").charAt(json.getString("acs_task_type").length()-1);
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
@@ -58,6 +60,7 @@ public class InTask extends AbstractAcsTask {
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.priority(json.getString("priority"))
|
||||
.dtl_type(String.valueOf(dtl_type))
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
@@ -126,10 +129,6 @@ public class InTask extends AbstractAcsTask {
|
||||
if (StrUtil.isBlank(vehicle_code)) {
|
||||
throw new BadRequestException("载具号不能为空");
|
||||
}
|
||||
String taskdtl_type = form.getString("taskdtl_type");
|
||||
if (StrUtil.isBlank(taskdtl_type)) {
|
||||
throw new BadRequestException("任务类型不能为空");
|
||||
}
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
package org.nl.wms.sch.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
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.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class SendOutTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = SendOutTask.class.getName();
|
||||
|
||||
@Override
|
||||
public List<AcsTaskDto> addTask() {
|
||||
/*
|
||||
* 下发给ACS时需要特殊处理
|
||||
*/
|
||||
JSONArray arr = WQLObject.getWQLObject("SCH_BASE_Task").query("handle_class = '" + THIS_CLASS + "' and task_status = '" + TaskStatusEnum.START_AND_POINT.getCode() + "' and is_delete ='0'").getResultJSONArray(0);
|
||||
|
||||
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
.task_type(json.getString("acs_task_type"))
|
||||
.start_device_code(json.getString("point_code1"))
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.priority(json.getString("priority"))
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); // 点位表
|
||||
|
||||
String task_id = taskObj.getString("task_id");
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
|
||||
if (StrUtil.equals(status, "0")) {
|
||||
// 更新删除字段
|
||||
jsonTask.put("is_delete","1");
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
}
|
||||
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
}
|
||||
|
||||
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
|
||||
// 更改任务状态为完成
|
||||
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("update_optid", currentUserId);
|
||||
jsonTask.put("update_optname", currentUsername);
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
// 更新暂存区点位状态
|
||||
JSONObject jsonPoint2 = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
|
||||
jsonPoint2.put("point_status", "02");
|
||||
jsonPoint2.put("vehicle_code", jsonTask.getString("vehicle_code"));
|
||||
pointTab.update(jsonPoint2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findStartPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findNextPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public String createTask(JSONObject form) {
|
||||
WQLObject tab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
CutConveyorTask cutConveyorTask = new CutConveyorTask();
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
|
||||
String point_code2 = form.getString("point_code2");
|
||||
if (cutConveyorTask.isSingleTask(point_code2)) {
|
||||
throw new BadRequestException("点位:" + point_code2 + "存在未完成的任务!");
|
||||
}
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
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"));
|
||||
json.put("point_code2", form.getString("point_code2"));
|
||||
json.put("vehicle_code", form.getString("vehicle_code"));
|
||||
json.put("handle_class", THIS_CLASS);
|
||||
json.put("create_id", currentUserId);
|
||||
json.put("create_name", currentUsername);
|
||||
json.put("create_time", DateUtil.now());
|
||||
//根据类型获取对应的任务优先级
|
||||
JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag","3").addParam("task_type",json.getString("task_type")).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(priority_jo)){
|
||||
json.put("priority", "1");
|
||||
}else {
|
||||
json.put("priority", priority_jo.getString("value"));
|
||||
}
|
||||
json.put("acs_task_type", "4");
|
||||
tab.insert(json);
|
||||
immediateNotifyAcs(json.getString("task_id"));
|
||||
return json.getString("task_id");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void forceFinish(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, TaskStatusEnum.FINISHED.getCode());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, "0");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -491,11 +491,11 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("sect_id = '"+need_sect+"' AND lock_type = '1' AND is_delete = '0' AND IFNULL( storagevehicle_code, '' ) = ''").uniqueResult(0);
|
||||
}else {
|
||||
jo_form.put("sect_id", "1582991348217286656");
|
||||
this.autoDis(jo_form);
|
||||
struct_jo = this.autoDis(jo_form);
|
||||
}
|
||||
}else {
|
||||
jo_form.put("sect_id", "1582991348217286656");
|
||||
this.autoDis(jo_form);
|
||||
struct_jo = this.autoDis(jo_form);
|
||||
}
|
||||
|
||||
|
||||
@@ -572,8 +572,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
//创建任务
|
||||
AbstractAcsTask task = new InTask();
|
||||
JSONObject task_form = new JSONObject();
|
||||
task_form.put("task_type", "01");
|
||||
task_form.put("taskdtl_type", "01");
|
||||
task_form.put("task_type", "010501");
|
||||
task_form.put("start_device_code", map.get("point_code"));
|
||||
task_form.put("next_device_code", struct_code);
|
||||
task_form.put("vehicle_code", map.get("box_no"));
|
||||
|
||||
@@ -136,7 +136,7 @@
|
||||
OPTION 输入.package_box_sn <> ""
|
||||
sub.package_box_sn = 输入.package_box_sn
|
||||
ENDOPTION
|
||||
OPTION 输入.package_box_sn <> ""
|
||||
OPTION 输入.sap_pcsn <> ""
|
||||
sub.sap_pcsn = 输入.sap_pcsn
|
||||
ENDOPTION
|
||||
OPTION 输入.container_name <> ""
|
||||
@@ -450,7 +450,7 @@
|
||||
sub.sale_order_name = 输入.sale_order_name
|
||||
ENDOPTION
|
||||
GROUP BY
|
||||
sa2.block_num,sa2.row_num
|
||||
sa2.block_num,sa2.row_num,sa2.placement_type
|
||||
ORDER BY
|
||||
sa.placement_type desc,num
|
||||
ENDSELECT
|
||||
@@ -694,6 +694,122 @@
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "19"
|
||||
SELECT
|
||||
po2.point_code
|
||||
FROM
|
||||
sch_base_point po
|
||||
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.package_box_sn = po.vehicle_code
|
||||
LEFT JOIN sch_base_point po2 ON po2.row_num = po.row_num
|
||||
WHERE
|
||||
IFNULL( po2.vehicle_code, '' ) = ''
|
||||
AND
|
||||
po2.point_type = '9'
|
||||
OPTION 输入.sale_order_name <> ""
|
||||
sub.sale_order_name = 输入.sale_order_name
|
||||
ENDOPTION
|
||||
AND NOT EXISTS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sch_base_task
|
||||
WHERE
|
||||
( point_code1 = po2.point_code OR point_code2 = po2.point_code )
|
||||
AND task_status < '07'
|
||||
AND is_delete = '0'
|
||||
)
|
||||
ORDER BY po2.out_order_seq
|
||||
LIMIT 1
|
||||
ENDSELECT
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "20"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
po.row_num
|
||||
FROM
|
||||
sch_base_point po
|
||||
WHERE
|
||||
po.is_delete = '0'
|
||||
AND is_used = '1'
|
||||
AND po.point_type = '9'
|
||||
GROUP BY
|
||||
po.row_num
|
||||
) a
|
||||
WHERE
|
||||
NOT EXISTS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
row_num
|
||||
FROM
|
||||
sch_base_point po2
|
||||
WHERE
|
||||
IFNULL( po2.vehicle_code, '' ) <> ''
|
||||
AND po2.point_type = '9'
|
||||
GROUP BY
|
||||
po2.row_num
|
||||
) b
|
||||
WHERE
|
||||
b.row_num = a.row_num
|
||||
)
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "21"
|
||||
QUERY
|
||||
SELECT
|
||||
sa.block_num,
|
||||
sa.row_num,
|
||||
sa.placement_type
|
||||
FROM
|
||||
st_ivt_structattr sa
|
||||
WHERE
|
||||
sa.sect_code = 'KTP01'
|
||||
AND IFNULL( sa.storagevehicle_code, '' ) = ''
|
||||
AND sa.lock_type = '1'
|
||||
AND sa.is_delete = '0'
|
||||
GROUP BY
|
||||
sa.block_num,
|
||||
sa.row_num,
|
||||
sa.placement_type
|
||||
ORDER BY
|
||||
sa.placement_type DESC
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "22"
|
||||
QUERY
|
||||
SELECT
|
||||
sa.block_num,
|
||||
sa.row_num,
|
||||
sa.placement_type
|
||||
FROM
|
||||
st_ivt_structattr sa
|
||||
WHERE
|
||||
sa.sect_code = 'KTP01'
|
||||
AND IFNULL( sa.storagevehicle_code, '' ) <> ''
|
||||
AND sa.lock_type = '1'
|
||||
AND sa.is_delete = '0'
|
||||
GROUP BY
|
||||
sa.block_num,
|
||||
sa.row_num,
|
||||
sa.placement_type
|
||||
ORDER BY
|
||||
sa.placement_type DESC
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package org.nl.wms.st.instor.task;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
@@ -9,16 +11,54 @@ import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.tasks.EmptyVehicleTask;
|
||||
import org.nl.wms.st.instor.service.impl.HandMoveStorServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class HandMoveStorAcsTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = EmptyVehicleTask.class.getName();
|
||||
|
||||
@Override
|
||||
public List<AcsTaskDto> addTask() {
|
||||
return null;
|
||||
/*
|
||||
* 下发给ACS时需要特殊处理
|
||||
*/
|
||||
JSONArray arr = WQLObject.getWQLObject("SCH_BASE_Task").query("handle_class = '" + THIS_CLASS + "' and task_status = '" + TaskStatusEnum.START_AND_POINT.getCode() + "' and is_delete ='0'").getResultJSONArray(0);
|
||||
|
||||
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
//判断该任务所在的块、排存在其他任务
|
||||
String point_code2 = json.getString("point_code2");
|
||||
JSONObject struct_jo = WQLObject.getWQLObject("ST_IVT_StructAttr").query("struct_code = '"+point_code2+"'").uniqueResult(0);
|
||||
String row_num = struct_jo.getString("row_num");
|
||||
String block_num = struct_jo.getString("block_num");
|
||||
JSONObject task_jo = WQLObject.getWQLObject("ST_IVT_StructAttr").query("block_num = '"+block_num+"' AND row_num = '"+row_num+"' AND lock_type in ('3','6')").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(task_jo)){
|
||||
continue;
|
||||
}
|
||||
|
||||
char dtl_type = json.getString("acs_task_type").charAt(json.getString("acs_task_type").length()-1);
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
.task_type(json.getString("acs_task_type"))
|
||||
.start_device_code(json.getString("point_code1"))
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.priority(json.getString("priority"))
|
||||
.dtl_type(String.valueOf(dtl_type))
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -161,7 +161,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
details.add(jsonParamDtl);
|
||||
}
|
||||
param.put("Details", details);
|
||||
new LmsToMesServiceImpl().LmsSunPackage(param);
|
||||
new LmsToMesServiceImpl().lmsUnPackage(param);
|
||||
}
|
||||
|
||||
// 销售出库
|
||||
@@ -257,11 +257,6 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
}
|
||||
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst);
|
||||
}
|
||||
|
||||
// 拆分入库
|
||||
if (StrUtil.equals(bill_type, "1005")) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -658,7 +653,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
details.add(jsonParamDtl);
|
||||
}
|
||||
param.put("Details", details);
|
||||
new LmsToMesServiceImpl().LmsSunPackage(param);
|
||||
new LmsToMesServiceImpl().lmsUnPackage(param);
|
||||
}
|
||||
|
||||
// 销售出库
|
||||
@@ -848,13 +843,6 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
jo_mst.put("is_upload", "1");
|
||||
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst);
|
||||
}
|
||||
|
||||
// 拆分入库
|
||||
if (StrUtil.equals(bill_type, "1005")) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user