|
|
@ -13,12 +13,16 @@ import org.nl.modules.common.utils.SecurityUtils; |
|
|
|
import org.nl.modules.wql.WQL; |
|
|
|
import org.nl.modules.wql.core.bean.WQLObject; |
|
|
|
import org.nl.wms.basedata.eum.TrueOrFalse; |
|
|
|
import org.nl.wms.basedata.eum.VehicleType; |
|
|
|
import org.nl.wms.pda.service.PdaService; |
|
|
|
import org.nl.wms.sch.manage.ACSSystem; |
|
|
|
import org.nl.wms.sch.manage.CreateMode; |
|
|
|
import org.nl.wms.sch.manage.PointStatus; |
|
|
|
import org.nl.wms.sch.manage.Region; |
|
|
|
import org.nl.wms.sch.task.call.material.FJCallMaterialTask; |
|
|
|
import org.nl.wms.sch.task.call.material.YZCallMaterialTask; |
|
|
|
import org.nl.wms.sch.task.send.empty.FJSendEmptyTask; |
|
|
|
import org.nl.wms.sch.task.send.empty.YZSendEmptyTask; |
|
|
|
import org.nl.wms.sch.task.send.material.FJSendMaterialTask; |
|
|
|
import org.nl.wms.sch.task.send.material.HLSendMaterialTask; |
|
|
|
import org.nl.wms.sch.task.send.material.YZSendMaterialTask; |
|
|
@ -45,19 +49,31 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
|
|
|
|
private final FJCallMaterialTask fjCallMaterialTask; |
|
|
|
|
|
|
|
private final YZSendEmptyTask yzSendEmptyTask; |
|
|
|
|
|
|
|
private final FJSendEmptyTask fjSendEmptyTask; |
|
|
|
|
|
|
|
@Override |
|
|
|
public JSONArray region(String func) { |
|
|
|
switch (func) { |
|
|
|
case "send_material": |
|
|
|
// 送料
|
|
|
|
case "call_material": |
|
|
|
// 送料
|
|
|
|
return WQL |
|
|
|
.getWO("PDA") |
|
|
|
.addParam("flag", "1") |
|
|
|
.addParam("where", "('HL', 'YZ', 'FJ')") |
|
|
|
.process() |
|
|
|
.getResultJSONArray(0); |
|
|
|
case "call_material": |
|
|
|
// 叫料
|
|
|
|
case "send_empty": |
|
|
|
// 送空
|
|
|
|
return WQL |
|
|
|
.getWO("PDA") |
|
|
|
.addParam("flag", "1") |
|
|
|
.addParam("where", "('YZ', 'FJ')") |
|
|
|
.process() |
|
|
|
.getResultJSONArray(0); |
|
|
|
default: |
|
|
|
throw new BadRequestException("未知功能!"); |
|
|
|
} |
|
|
@ -131,6 +147,36 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
default: |
|
|
|
throw new BadRequestException(region.label() + "没有叫料点位!"); |
|
|
|
} |
|
|
|
case "send_empty": |
|
|
|
// 送空
|
|
|
|
switch (region) { |
|
|
|
case YZ: |
|
|
|
JSONArray result = WQL |
|
|
|
.getWO("PDA") |
|
|
|
.addParam("flag", "2") |
|
|
|
.addParam("region_code", region_code) |
|
|
|
.addParam("point_type", "('2', '3')") |
|
|
|
.process() |
|
|
|
.getResultJSONArray(0); |
|
|
|
result.addAll(WQL |
|
|
|
.getWO("PDA") |
|
|
|
.addParam("flag", "2") |
|
|
|
.addParam("region_code", Region.KLHJ.value()) |
|
|
|
.addParam("point_type", "('3')") |
|
|
|
.process() |
|
|
|
.getResultJSONArray(0)); |
|
|
|
return result; |
|
|
|
case FJ: |
|
|
|
return WQL |
|
|
|
.getWO("PDA") |
|
|
|
.addParam("flag", "2") |
|
|
|
.addParam("region_code", region_code) |
|
|
|
.addParam("point_type", "('1')") |
|
|
|
.process() |
|
|
|
.getResultJSONArray(0); |
|
|
|
default: |
|
|
|
throw new BadRequestException(region.label() + "没有送空点位!"); |
|
|
|
} |
|
|
|
default: |
|
|
|
throw new BadRequestException("未知功能!"); |
|
|
|
} |
|
|
@ -174,11 +220,11 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
TaskUtils.isLocked(point); |
|
|
|
JSONObject workorder = TaskUtils.hasWorkOrder(point); |
|
|
|
String vehicle_type = workorder.getString("vehicle_type"); |
|
|
|
String device_code = workorder.getString("device_code"); |
|
|
|
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail"); |
|
|
|
JSONObject vd_update = new JSONObject(); |
|
|
|
vd_update.put("is_delete", TrueOrFalse.TRUE.value()); |
|
|
|
vd_table.update(vd_update, "vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'"); |
|
|
|
TaskUtils.addCurrentUpdateColum(vd_update); |
|
|
|
vd_table.update(vd_update, "is_delete = '0' AND vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'"); |
|
|
|
|
|
|
|
// 组盘
|
|
|
|
JSONObject vd = new JSONObject(); |
|
|
@ -191,17 +237,25 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
vd.put("is_full", is_full); |
|
|
|
vd.put("workorder_id", workorder.getString("workorder_id")); |
|
|
|
vd.put("point_code", point_code); |
|
|
|
vd.put("create_id", SecurityUtils.getCurrentUserId()); |
|
|
|
vd.put("create_name", SecurityUtils.getCurrentNickName()); |
|
|
|
Long user_id = SecurityUtils.getCurrentUserId(); |
|
|
|
vd.put("create_id", user_id); |
|
|
|
String nick_name = SecurityUtils.getCurrentNickName(); |
|
|
|
vd.put("create_name", nick_name); |
|
|
|
vd.put("create_time", DateUtil.now()); |
|
|
|
vd.put("is_delete", "0"); |
|
|
|
if (device_code.startsWith("FJ")) { |
|
|
|
vd.put("is_delete", TrueOrFalse.FALSE.value()); |
|
|
|
|
|
|
|
String region_code = point.getString("region_code"); |
|
|
|
vd.put("is_fire", TrueOrFalse.FALSE.value()); |
|
|
|
if (Region.FJ.value().equals(region_code)) { |
|
|
|
vd.put("is_fire", TrueOrFalse.TRUE.value()); |
|
|
|
} |
|
|
|
vd.put("is_in_kiln", TrueOrFalse.trueOrFalse(is_full) ? TrueOrFalse.TRUE.value() : TrueOrFalse.FALSE.value()); |
|
|
|
if (device_code.startsWith("FJ")) { |
|
|
|
vd.put("is_in_kiln", is_full); |
|
|
|
if (Region.FJ.value().equals(region_code)) { |
|
|
|
vd.put("is_in_kiln", TrueOrFalse.FALSE.value()); |
|
|
|
} |
|
|
|
if (Region.FJ.value().equals(region_code)) { |
|
|
|
vd.put("is_package", TrueOrFalse.TRUE.value()); |
|
|
|
} |
|
|
|
vd_table.insert(vd); |
|
|
|
|
|
|
|
Region region = Region.get(point.getString("region_code")); |
|
|
@ -211,8 +265,8 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
method_param.put("vd", vd); |
|
|
|
method_param.put("create_mode", CreateMode.SCCJ.value()); |
|
|
|
method_param.put("request_param", request_param); |
|
|
|
method_param.put("create_id", SecurityUtils.getCurrentUserId()); |
|
|
|
method_param.put("create_name", SecurityUtils.getCurrentNickName()); |
|
|
|
method_param.put("create_id", user_id); |
|
|
|
method_param.put("create_name", nick_name); |
|
|
|
|
|
|
|
switch (region) { |
|
|
|
case HL: |
|
|
@ -250,6 +304,7 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
method_param.put("create_name", SecurityUtils.getCurrentNickName()); |
|
|
|
|
|
|
|
switch (region) { |
|
|
|
case KLHJ: |
|
|
|
case YZ: |
|
|
|
yzCallMaterialTask.createTask(method_param); |
|
|
|
break; |
|
|
@ -260,4 +315,54 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
throw new BadRequestException("[" + region.label() + "] 不能发起叫料任务!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void sendEmpty(String point_code, String vehicle_code, String request_param) { |
|
|
|
JSONObject point = WQLObject |
|
|
|
.getWQLObject("sch_base_point") |
|
|
|
.query("is_used = '1' AND point_code = '" + point_code + "'") |
|
|
|
.uniqueResult(0); |
|
|
|
if (ObjectUtil.isEmpty(point)) { |
|
|
|
throw new BadRequestException("[" + point_code + "] 已删除或未启用!"); |
|
|
|
} |
|
|
|
|
|
|
|
JSONObject workorder = WQLObject |
|
|
|
.getWQLObject("pdm_bd_workorder") |
|
|
|
.query("is_delete = '0' AND device_code = '" + point.getString("device_code") + "' AND order_status = '3'") |
|
|
|
.uniqueResult(0); |
|
|
|
|
|
|
|
Region region = Region.get(point.getString("region_code")); |
|
|
|
JSONObject method_param = new JSONObject(); |
|
|
|
method_param.put("point", point); |
|
|
|
method_param.put("workorder", workorder); |
|
|
|
method_param.put("create_mode", CreateMode.SCCJ.value()); |
|
|
|
method_param.put("request_param", request_param); |
|
|
|
method_param.put("create_id", SecurityUtils.getCurrentUserId()); |
|
|
|
method_param.put("create_name", SecurityUtils.getCurrentNickName()); |
|
|
|
|
|
|
|
switch (region) { |
|
|
|
case KLHJ: |
|
|
|
WQLObject point_table = WQLObject.getWQLObject("sch_base_point"); |
|
|
|
point.put("vehicle_type", VehicleType.CUP.value()); |
|
|
|
point.put("vehicle_code", vehicle_code); |
|
|
|
point.put("point_status", PointStatus.NOT_EMPTY.value()); |
|
|
|
TaskUtils.addCurrentUpdateColum(point); |
|
|
|
point_table.update(point); |
|
|
|
JSONObject point_update = new JSONObject(); |
|
|
|
point_update.put("vehicle_type", ""); |
|
|
|
point_update.put("vehicle_code", ""); |
|
|
|
point_update.put("point_status", PointStatus.EMPTY.value()); |
|
|
|
TaskUtils.addCurrentUpdateColum(point_update); |
|
|
|
point_table.update(point_update, "region_code = 'KLHJ' AND point_type = '2' AND vehicle_type = '1' AND vehicle_code = '" + vehicle_code + "'"); |
|
|
|
case YZ: |
|
|
|
yzSendEmptyTask.createTask(method_param); |
|
|
|
break; |
|
|
|
case FJ: |
|
|
|
method_param.put("vehicle_code", vehicle_code); |
|
|
|
fjSendEmptyTask.createTask(method_param); |
|
|
|
break; |
|
|
|
default: |
|
|
|
throw new BadRequestException("[" + region.label() + "] 不能发起送空任务!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|