|
|
@ -4,6 +4,7 @@ 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.JSON; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
@ -14,11 +15,15 @@ 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.ext.acs.service.WmsToAcsService; |
|
|
|
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.empty.FJCallEmptyTask; |
|
|
|
import org.nl.wms.sch.task.call.empty.HLCallEmptyTask; |
|
|
|
import org.nl.wms.sch.task.call.empty.YZCallEmptyTask; |
|
|
|
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; |
|
|
@ -53,9 +58,19 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
|
|
|
|
private final FJSendEmptyTask fjSendEmptyTask; |
|
|
|
|
|
|
|
private final HLCallEmptyTask hlCallEmptyTask; |
|
|
|
|
|
|
|
private final YZCallEmptyTask yzCallEmptyTask; |
|
|
|
|
|
|
|
private final FJCallEmptyTask fjCallEmptyTask; |
|
|
|
|
|
|
|
private final WmsToAcsService wmsToAcsService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public JSONArray region(String func) { |
|
|
|
switch (func) { |
|
|
|
case "call_empty": |
|
|
|
// 叫空
|
|
|
|
case "send_material": |
|
|
|
// 送料
|
|
|
|
return WQL |
|
|
@ -177,6 +192,36 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
default: |
|
|
|
throw new BadRequestException(region.label() + "没有送空点位!"); |
|
|
|
} |
|
|
|
case "call_empty": |
|
|
|
// 叫空
|
|
|
|
switch (region) { |
|
|
|
case HL: |
|
|
|
return WQL |
|
|
|
.getWO("PDA") |
|
|
|
.addParam("flag", "2") |
|
|
|
.addParam("region_code", region_code) |
|
|
|
.addParam("point_type", "('1', '2')") |
|
|
|
.process() |
|
|
|
.getResultJSONArray(0); |
|
|
|
case YZ: |
|
|
|
return WQL |
|
|
|
.getWO("PDA") |
|
|
|
.addParam("flag", "2") |
|
|
|
.addParam("region_code", region_code) |
|
|
|
.addParam("point_type", "('1')") |
|
|
|
.process() |
|
|
|
.getResultJSONArray(0); |
|
|
|
case FJ: |
|
|
|
return WQL |
|
|
|
.getWO("PDA") |
|
|
|
.addParam("flag", "2") |
|
|
|
.addParam("region_code", region_code) |
|
|
|
.addParam("point_type", "('2')") |
|
|
|
.process() |
|
|
|
.getResultJSONArray(0); |
|
|
|
default: |
|
|
|
throw new BadRequestException(region.label() + "没有叫空点位!"); |
|
|
|
} |
|
|
|
default: |
|
|
|
throw new BadRequestException("未知功能!"); |
|
|
|
} |
|
|
@ -191,6 +236,11 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
.getResultJSONArray(0); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public JSONArray vehicleType(String func) { |
|
|
|
return WQLObject.getWQLObject("sys_dict_detail").query("name = 'vehicle_type'", "dict_sort ASC").getResultJSONArray(0); |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public void report(String device_code, String unqualified_qty) { |
|
|
@ -261,13 +311,11 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
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")); |
|
|
|
JSONObject method_param = new JSONObject(); |
|
|
|
method_param.put("point", point); |
|
|
|
method_param.put("workorder", workorder); |
|
|
|
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", user_id); |
|
|
@ -275,12 +323,37 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
|
|
|
|
switch (region) { |
|
|
|
case HL: |
|
|
|
String device_code = workorder.getString("device_code"); |
|
|
|
JSONObject result = wmsToAcsService.getDeviceStatus( |
|
|
|
new JSONArray() {{ |
|
|
|
add(new JSONObject() {{ |
|
|
|
put("device_code", device_code); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
if (!"200".equals(result.getString("status"))) { |
|
|
|
throw new BadRequestException("[" + device_code + "] ACS未返回设备信息!"); |
|
|
|
} |
|
|
|
JSONArray data = result.getJSONArray("data"); |
|
|
|
if (ObjectUtil.isEmpty(data)) { |
|
|
|
throw new BadRequestException("[" + device_code + "] ACS未返回设备信息!"); |
|
|
|
} |
|
|
|
String mix_num = data.getJSONObject(0).getString("mix_num"); |
|
|
|
if (StrUtil.isBlank(mix_num)) { |
|
|
|
throw new BadRequestException("未知碾次!"); |
|
|
|
} |
|
|
|
vd.put("mix_num", mix_num); |
|
|
|
vd_table.insert(vd); |
|
|
|
method_param.put("vd", vd); |
|
|
|
hlSendMaterialTask.createTask(method_param); |
|
|
|
break; |
|
|
|
case YZ: |
|
|
|
vd_table.insert(vd); |
|
|
|
method_param.put("vd", vd); |
|
|
|
yzSendMaterialTask.createTask(method_param); |
|
|
|
break; |
|
|
|
case FJ: |
|
|
|
vd_table.insert(vd); |
|
|
|
method_param.put("vd", vd); |
|
|
|
fjSendMaterialTask.createTask(method_param); |
|
|
|
default: |
|
|
|
throw new BadRequestException("[" + region.label() + "] 不能发起送料任务!"); |
|
|
@ -385,4 +458,84 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
throw new BadRequestException("[" + region.label() + "] 不能发起送空任务!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void callEmpty(String point_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 + "] 已删除或未启用!"); |
|
|
|
} |
|
|
|
TaskUtils.pointNameIsLocked(point); |
|
|
|
|
|
|
|
Region region = Region.get(point.getString("region_code")); |
|
|
|
JSONObject method_param = new JSONObject(); |
|
|
|
method_param.put("point", point); |
|
|
|
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 HL: |
|
|
|
JSONObject workorder = WQLObject |
|
|
|
.getWQLObject("pdm_bd_workorder") |
|
|
|
.query("is_delete = '0' AND device_code = '" + point.getString("device_code") + "' AND order_status = '3'") |
|
|
|
.uniqueResult(0); |
|
|
|
method_param.put("workorder", workorder); |
|
|
|
hlCallEmptyTask.createTask(method_param); |
|
|
|
break; |
|
|
|
case YZ: |
|
|
|
workorder = WQLObject |
|
|
|
.getWQLObject("pdm_bd_workorder") |
|
|
|
.query("is_delete = '0' AND device_code = '" + point.getString("device_code") + "' AND order_status = '3'") |
|
|
|
.uniqueResult(0); |
|
|
|
method_param.put("workorder", workorder); |
|
|
|
yzCallEmptyTask.createTask(method_param); |
|
|
|
break; |
|
|
|
case FJ: |
|
|
|
workorder = TaskUtils.hasWorkOrder(point); |
|
|
|
method_param.put("workorder", workorder); |
|
|
|
fjCallEmptyTask.createTask(method_param); |
|
|
|
break; |
|
|
|
default: |
|
|
|
throw new BadRequestException("[" + region.label() + "] 不能发起叫空任务!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void standStatus(String vehicle_code, String type) { |
|
|
|
JSONObject vehicle_update = new JSONObject(); |
|
|
|
switch (type) { |
|
|
|
case "1": |
|
|
|
vehicle_update.put("stand_status", "4"); |
|
|
|
break; |
|
|
|
case "2": |
|
|
|
vehicle_update.put("stand_status", "5"); |
|
|
|
break; |
|
|
|
default: |
|
|
|
throw new BadRequestException("未知操作!"); |
|
|
|
} |
|
|
|
TaskUtils.addCurrentUpdateColum(vehicle_update); |
|
|
|
WQLObject.getWQLObject("st_ivt_vehicle_detail").update(vehicle_update, "vehicle_type = '1' AND vehicle_code = '" + vehicle_code + "'"); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void inKiln(String vehicle_code, String type) { |
|
|
|
JSONObject vehicle_update = new JSONObject(); |
|
|
|
switch (type) { |
|
|
|
case "1": |
|
|
|
vehicle_update.put("is_in_kiln", "1"); |
|
|
|
break; |
|
|
|
case "2": |
|
|
|
vehicle_update.put("is_in_kiln", "0"); |
|
|
|
break; |
|
|
|
default: |
|
|
|
throw new BadRequestException("未知操作!"); |
|
|
|
} |
|
|
|
TaskUtils.addCurrentUpdateColum(vehicle_update); |
|
|
|
WQLObject.getWQLObject("st_ivt_vehicle_detail").update(vehicle_update, "vehicle_type = '2' AND vehicle_code = '" + vehicle_code + "'"); |
|
|
|
} |
|
|
|
} |
|
|
|