rev
This commit is contained in:
@@ -14,11 +14,11 @@ import java.util.stream.Collectors;
|
||||
@RequiredArgsConstructor
|
||||
public enum StandStatus {
|
||||
|
||||
WITHOUT("无需静置", "1"),
|
||||
STANDING("静置中", "2"),
|
||||
COMPLETED("静置完成", "3"),
|
||||
FORCE_COMPLETION("强制静置完成", "4"),
|
||||
TIMEOUT("静置超时", "5");
|
||||
STANDING("静置中", "1"),
|
||||
COMPLETED("静置完成", "2"),
|
||||
FORCE_COMPLETION("强制静置完成", "3"),
|
||||
TIMEOUT("静置超时", "4"),
|
||||
FORCE_TIMEOUT("强制静置超时", "5");
|
||||
|
||||
|
||||
private final String label;
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.nl.modules.system.util.CodeUtil;
|
||||
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.basedata.eum.StandStatus;
|
||||
import org.nl.wms.basedata.eum.TrueOrFalse;
|
||||
import org.nl.wms.basedata.eum.VehicleType;
|
||||
import org.nl.wms.basedata.service.dto.VehicleDto;
|
||||
@@ -255,6 +256,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
vd.put("create_name", ACSSystem.nick_name);
|
||||
vd.put("create_time", DateUtil.now());
|
||||
vd.put("is_delete", TrueOrFalse.FALSE.value());
|
||||
vd.put("stand_status", StandStatus.STANDING.value());
|
||||
WQLObject.getWQLObject("st_ivt_vehicle_detail").insert(vd);
|
||||
methodParam.put("vd", vd);
|
||||
|
||||
@@ -272,7 +274,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
vd = WQLObject.getWQLObject("st_ivt_vehicle_detail").query("is_delete = '0' AND vehicle_type = '2' AND vehicle_code = '" + vehicleCode + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(vd)) {
|
||||
throw new BadRequestException("[" + vehicleCode + "] 未找到组盘信息!");
|
||||
JSONObject temp = new JSONObject();
|
||||
temp.put("status", HttpStatus.NO_CONTENT.value());
|
||||
temp.put("message", "[" + vehicleCode + "] 未找到组盘信息!");
|
||||
return temp;
|
||||
}
|
||||
methodParam.put("vd", vd);
|
||||
methodParam.put("workorder", WQLObject.getWQLObject("pdm_bd_workorder").query("workorder_id = " + vd.getString("workorder_id")).uniqueResult(0));
|
||||
@@ -570,7 +575,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
JSONObject device = WQLObject.getWQLObject("pdm_bi_device").query("device_id = " + workOrder.getString("device_id")).uniqueResult(0);
|
||||
if (Region.FJ.value().equals(device.getString("region_code"))) {
|
||||
JSONObject vd = WQLObject.getWQLObject("st_ivt_vehicle_detail").query("vehicle_code = '2' AND material_id = " + workOrder.getString("material_id"), "create_time DESC").uniqueResult(0);
|
||||
JSONObject vd = WQLObject.getWQLObject("st_ivt_vehicle_detail").query("vehicle_type = '2' AND material_id = " + workOrder.getString("material_id"), "create_time DESC").uniqueResult(0);
|
||||
avgPieceWeightKG = vd.getDoubleValue("dz") * 0.95;
|
||||
weightKG = (int) avgPieceWeightKG * qty;
|
||||
}
|
||||
@@ -589,6 +594,30 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
workOrder.put("realproduceend_date", DateUtil.now());
|
||||
TaskUtils.addACSUpdateColum(workOrder);
|
||||
workOrderTable.update(workOrder);
|
||||
|
||||
// 反馈ERP
|
||||
if (Region.YZ.value().equals(device.getString("region_code"))) {
|
||||
JSONObject material = WQLObject.getWQLObject("md_me_materialbase").query("material_id = " + workOrder.getString("material_id")).uniqueResult(0);
|
||||
String dd = material.getString("dd");
|
||||
String extCode = workOrder.getString("ext_code");
|
||||
if (StrUtil.isNotBlank(dd) && StrUtil.isNotBlank(extCode)) {
|
||||
JSONObject regionIn = new JSONObject();
|
||||
regionIn.put("id", IdUtil.getSnowflake(1L, 1L).nextId());
|
||||
regionIn.put("cCode", CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||
regionIn.put("dDate", DateUtil.now());
|
||||
regionIn.put("cVouchType", RegionInType.FPRK.label());
|
||||
regionIn.put("cMocode", dd);
|
||||
regionIn.put("cInvCode", material.getString("material_number"));
|
||||
int unqualifiedQty1 = workOrder.getIntValue("unqualified_qty");
|
||||
double avgPieceWeight = workOrder.getDoubleValue("avg_piece_weight");
|
||||
regionIn.put("iQuantity", String.format("%.3f", unqualifiedQty1 * avgPieceWeight / 1000));
|
||||
regionIn.put("iNum", unqualifiedQty1);
|
||||
regionIn.put("iinvexchrate", String.format("%.5f", avgPieceWeight / 1000));
|
||||
regionIn.put("cBatch", dd);
|
||||
regionIn.put("PLANSID", extCode);
|
||||
WQLObject.getWQLObject("st_ivt_regionio").insert(regionIn);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "3":
|
||||
@@ -601,6 +630,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
int avgPieceWeightG = jsonObject.getIntValue("avg_piece_weight");
|
||||
double avgPieceWeightKG = avgPieceWeightG / 1000.00;
|
||||
|
||||
JSONObject device = WQLObject.getWQLObject("pdm_bi_device").query("device_id = " + workOrder.getString("device_id")).uniqueResult(0);
|
||||
if (Region.FJ.value().equals(device.getString("region_code"))) {
|
||||
JSONObject vd = WQLObject.getWQLObject("st_ivt_vehicle_detail").query("vehicle_type = '2' AND material_id = " + workOrder.getString("material_id"), "create_time DESC").uniqueResult(0);
|
||||
avgPieceWeightKG = vd.getDoubleValue("dz") * 0.95;
|
||||
weightKG = (int) avgPieceWeightKG * qty;
|
||||
}
|
||||
|
||||
// 报工
|
||||
workordeService.reportWorkOrderDaily(workOrderId, qty, qualifiedQty, unqualifiedQty, weightKG, avgPieceWeightKG);
|
||||
|
||||
@@ -905,6 +941,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
int avgPieceWeightG = param.getIntValue("avg_piece_weight");
|
||||
double avgPieceWeightKG = avgPieceWeightG / 1000.00;
|
||||
|
||||
JSONObject device = WQLObject.getWQLObject("pdm_bi_device").query("device_id = " + workOrder.getString("device_id")).uniqueResult(0);
|
||||
if (Region.FJ.value().equals(device.getString("region_code"))) {
|
||||
JSONObject vd = WQLObject.getWQLObject("st_ivt_vehicle_detail").query("vehicle_type = '2' AND material_id = " + workOrder.getString("material_id"), "create_time DESC").uniqueResult(0);
|
||||
avgPieceWeightKG = vd.getDoubleValue("dz") * 0.95;
|
||||
weightKG = (int) avgPieceWeightKG * qty;
|
||||
}
|
||||
|
||||
String today = DateUtil.today();
|
||||
WQLObject wodTable = WQLObject.getWQLObject("pdm_bd_work_order_daily");
|
||||
JSONObject workOrderDaily = wodTable.query("workorder_id = " + workOrderId + " AND date = '" + today + "'").uniqueResult(0);
|
||||
@@ -924,20 +967,24 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
wodTable.insert(workOrderDaily);
|
||||
} else {
|
||||
if ("1".equals(workOrderDaily.getString("is_report"))) {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.CREATED.value());
|
||||
result.put("message", "当日已报工!");
|
||||
return result;
|
||||
workOrderDaily.put("qty", qty + workOrderDaily.getIntValue("qty"));
|
||||
workOrderDaily.put("qualified_qty", qualifiedQty + workOrderDaily.getIntValue("qualified_qty"));
|
||||
workOrderDaily.put("unqualified_qty", unqualifiedQty + workOrderDaily.getIntValue("unqualified_qty"));
|
||||
workOrderDaily.put("weight", weightKG + workOrderDaily.getDoubleValue("weight"));
|
||||
workOrderDaily.put("avg_piece_weight", avgPieceWeightKG);
|
||||
workOrderDaily.put("is_report", TrueOrFalse.TRUE.value());
|
||||
TaskUtils.addACSUpdateColum(workOrderDaily);
|
||||
wodTable.update(workOrderDaily);
|
||||
} else {
|
||||
workOrderDaily.put("qty", qty);
|
||||
workOrderDaily.put("qualified_qty", qualifiedQty);
|
||||
workOrderDaily.put("unqualified_qty", unqualifiedQty);
|
||||
workOrderDaily.put("weight", weightKG);
|
||||
workOrderDaily.put("avg_piece_weight", avgPieceWeightKG);
|
||||
workOrderDaily.put("is_report", TrueOrFalse.TRUE.value());
|
||||
TaskUtils.addACSUpdateColum(workOrderDaily);
|
||||
wodTable.update(workOrderDaily);
|
||||
}
|
||||
|
||||
workOrderDaily.put("qty", qty);
|
||||
workOrderDaily.put("qualified_qty", qualifiedQty);
|
||||
workOrderDaily.put("unqualified_qty", unqualifiedQty);
|
||||
workOrderDaily.put("weight", weightKG);
|
||||
workOrderDaily.put("avg_piece_weight", avgPieceWeightKG);
|
||||
workOrderDaily.put("is_report", TrueOrFalse.TRUE.value());
|
||||
TaskUtils.addACSUpdateColum(workOrderDaily);
|
||||
wodTable.update(workOrderDaily);
|
||||
}
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
@@ -961,8 +1008,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
throw new BadRequestException("是否满垛不能为空!");
|
||||
}
|
||||
|
||||
JSONObject point = WQLObject
|
||||
.getWQLObject("sch_base_point")
|
||||
WQLObject pointTable = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject point = pointTable
|
||||
.query("is_used = '1' AND point_code = '" + point_code + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
@@ -983,8 +1030,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
vd.put("material_id", materialId);
|
||||
vd.put("qty", qty);
|
||||
double dz = vdTable.query("vehicle_type = '2' AND material_id = " + materialId, "create_time DESC").uniqueResult(0).getDoubleValue("dz");
|
||||
vd.put("weight", dz * qty);
|
||||
vd.put("dz", dz);
|
||||
vd.put("weight", dz * qty * 0.95);
|
||||
vd.put("dz", dz * 0.95);
|
||||
vd.put("is_full", is_full);
|
||||
vd.put("workorder_id", workOrder.getString("workorder_id"));
|
||||
vd.put("point_code", point_code);
|
||||
@@ -1042,7 +1089,25 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
vd.put("is_delete", TrueOrFalse.FALSE.value());
|
||||
|
||||
vdTable.insert(vd);
|
||||
// todo 反馈ERP成品入库
|
||||
|
||||
// 反馈ERP
|
||||
JSONObject detail = WQL.getWO("SEND_MATERIAL_TASK").addParam("flag", "6").addParam("vd_id", vd.getString("vd_id")).process().uniqueResult(0);
|
||||
String dd = detail.getString("dd");
|
||||
if (StrUtil.isNotBlank(dd)) {
|
||||
JSONObject regionIn = new JSONObject();
|
||||
regionIn.put("id", IdUtil.getSnowflake(1L, 1L).nextId());
|
||||
regionIn.put("cCode", CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||
regionIn.put("dDate", DateUtil.now());
|
||||
regionIn.put("cVouchType", RegionInType.BCPRK.label());
|
||||
regionIn.put("cMocode", dd);
|
||||
regionIn.put("cInvCode", detail.getString("material_number"));
|
||||
regionIn.put("iQuantity", String.format("%.3f", detail.getDoubleValue("weight") / 1000));
|
||||
regionIn.put("iNum", detail.getIntValue("qty"));
|
||||
regionIn.put("iinvexchrate", String.format("%.5f", detail.getDoubleValue("dz") / 1000));
|
||||
regionIn.put("cBatch", dd);
|
||||
regionIn.put("PLANSID", dd);
|
||||
WQLObject.getWQLObject("st_ivt_regionio").insert(regionIn);
|
||||
}
|
||||
} else {
|
||||
// 半托
|
||||
JSONObject vd = vdTable.query("vd_id = " + vdId).uniqueResult(0);
|
||||
@@ -1103,8 +1168,34 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
vd.put("tool_coordinate", param.get("tool_coordinate"));
|
||||
TaskUtils.addACSUpdateColum(vd);
|
||||
vdTable.update(vd);
|
||||
|
||||
// 反馈ERP
|
||||
JSONObject detail = WQL.getWO("SEND_MATERIAL_TASK").addParam("flag", "6").addParam("vd_id", vd.getString("vd_id")).process().uniqueResult(0);
|
||||
String dd = detail.getString("dd");
|
||||
if (StrUtil.isNotBlank(dd)) {
|
||||
JSONObject regionIn = new JSONObject();
|
||||
regionIn.put("id", IdUtil.getSnowflake(1L, 1L).nextId());
|
||||
regionIn.put("cCode", CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||
regionIn.put("dDate", DateUtil.now());
|
||||
regionIn.put("cVouchType", RegionInType.BCPRK.label());
|
||||
regionIn.put("cMocode", dd);
|
||||
regionIn.put("cInvCode", detail.getString("material_number"));
|
||||
regionIn.put("iQuantity", String.format("%.3f", detail.getDoubleValue("weight2") / 1000));
|
||||
regionIn.put("iNum", detail.getIntValue("qty2"));
|
||||
regionIn.put("iinvexchrate", String.format("%.5f", detail.getDoubleValue("dz") / 1000));
|
||||
regionIn.put("cBatch", dd);
|
||||
regionIn.put("PLANSID", dd);
|
||||
WQLObject.getWQLObject("st_ivt_regionio").insert(regionIn);
|
||||
}
|
||||
}
|
||||
|
||||
point.put("vehicle_type", "");
|
||||
point.put("vehicle_code", "");
|
||||
point.put("vd_id", null);
|
||||
point.put("point_status", PointStatus.EMPTY.value());
|
||||
TaskUtils.addACSUpdateColum(point);
|
||||
pointTable.update(point);
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "反馈成功!");
|
||||
@@ -1126,7 +1217,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
TaskUtils.isLocked(point);
|
||||
JSONObject workOrder = TaskUtils.hasWorkOrder(point);
|
||||
JSONObject data = WQLObject.getWQLObject("st_ivt_vehicle_detail").query("is_delete = '0' AND if_full = '0' AND vehicle_type = '" + workOrder.getString("vehicle_type") + "' AND material_id = " + workOrder.getString("material_id")).uniqueResult(0);
|
||||
JSONObject data = WQLObject.getWQLObject("st_ivt_vehicle_detail").query("is_delete = '0' AND is_full = '0' AND vehicle_type = '" + workOrder.getString("vehicle_type") + "' AND material_id = " + workOrder.getString("material_id")).uniqueResult(0);
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
输入.flag TYPEAS s_string
|
||||
输入.vehicle_type TYPEAS s_string
|
||||
输入.vehicle_code TYPEAS s_string
|
||||
输入.vd_id TYPEAS f_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
@@ -96,3 +97,20 @@
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "4"
|
||||
QUERY
|
||||
SELECT
|
||||
vd.qty2,
|
||||
vd.weight2,
|
||||
vd.dz,
|
||||
material.material_number,
|
||||
material.dd
|
||||
FROM
|
||||
st_ivt_vehicle_detail vd
|
||||
LEFT JOIN md_me_materialbase material ON vd.material_id = material.material_id
|
||||
WHERE
|
||||
vd.vd_id = 输入.vd_id
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -61,19 +61,6 @@ public class PdaController {
|
||||
return PdaUtils.buildSuccessResultJSON(pdaService.point(func, region_code));
|
||||
}
|
||||
|
||||
@PostMapping("/device")
|
||||
@Log("查询设备")
|
||||
@ApiOperation("查询设备")
|
||||
@PdaAnnotation
|
||||
public JSONObject device(@RequestBody JSONObject param) {
|
||||
String func = param.getString("func");
|
||||
if (StrUtil.isBlank(func)) {
|
||||
throw new BadRequestException("未知功能!");
|
||||
}
|
||||
|
||||
return PdaUtils.buildSuccessResultJSON(pdaService.device(func));
|
||||
}
|
||||
|
||||
@PostMapping("/vehicleType")
|
||||
@Log("查询载具类型")
|
||||
@ApiOperation("查询载具类型")
|
||||
@@ -87,24 +74,6 @@ public class PdaController {
|
||||
return PdaUtils.buildSuccessResultJSON(pdaService.vehicleType(func));
|
||||
}
|
||||
|
||||
@PostMapping("/report")
|
||||
@Log("不合格品上报")
|
||||
@ApiOperation("不合格品上报")
|
||||
@PdaAnnotation
|
||||
public JSONObject report(@RequestBody JSONObject param) {
|
||||
String device_code = param.getString("device_code");
|
||||
if (StrUtil.isBlank(device_code)) {
|
||||
throw new BadRequestException("区域不能为空!");
|
||||
}
|
||||
String unqualified_qty = param.getString("unqualified_qty");
|
||||
if (StrUtil.isBlank(unqualified_qty)) {
|
||||
throw new BadRequestException("不合格数量不能为空!");
|
||||
}
|
||||
|
||||
pdaService.report(device_code, unqualified_qty);
|
||||
return PdaUtils.buildSuccessResultJSON(null);
|
||||
}
|
||||
|
||||
@PostMapping("/sendMaterial")
|
||||
@Log("送料")
|
||||
@ApiOperation("送料")
|
||||
@@ -119,20 +88,16 @@ public class PdaController {
|
||||
if ("0000".equals(vehicle_code)) {
|
||||
throw new BadRequestException("载具编码不能为空!");
|
||||
}
|
||||
String qty = param.getString("qty");
|
||||
if (StrUtil.isBlank(qty)) {
|
||||
throw new BadRequestException("数量不能为空!");
|
||||
int qty = param.getIntValue("qty");
|
||||
if (qty == 0) {
|
||||
throw new BadRequestException("数量不能为零!");
|
||||
}
|
||||
String weight = param.getString("weight");
|
||||
if (StrUtil.isBlank(weight)) {
|
||||
throw new BadRequestException("重量不能为空!");
|
||||
}
|
||||
String is_full = param.getString("is_full");
|
||||
if (StrUtil.isBlank(is_full)) {
|
||||
throw new BadRequestException("是否满垛不能为空!");
|
||||
double weight = param.getDoubleValue("weight");
|
||||
if (weight == 0) {
|
||||
throw new BadRequestException("重量不能为零!");
|
||||
}
|
||||
|
||||
pdaService.sendMaterial(point_code, vehicle_code, qty, weight, is_full, param.toJSONString());
|
||||
pdaService.sendMaterial(point_code, vehicle_code, qty, weight, param.toJSONString());
|
||||
return PdaUtils.buildSuccessResultJSON(null);
|
||||
}
|
||||
|
||||
@@ -200,24 +165,6 @@ public class PdaController {
|
||||
return PdaUtils.buildSuccessResultJSON(null);
|
||||
}
|
||||
|
||||
@PostMapping("/inKiln")
|
||||
@Log("入窑管理")
|
||||
@ApiOperation("入窑管理")
|
||||
@PdaAnnotation
|
||||
public JSONObject inKiln(@RequestBody JSONObject param) {
|
||||
String vehicle_code = TaskUtils.formatVehicleCode(param.getString("vehicle_code"));
|
||||
if ("0000".equals(vehicle_code)) {
|
||||
throw new BadRequestException("载具编码不能为空!");
|
||||
}
|
||||
String type = param.getString("type");
|
||||
if (StrUtil.isBlank(type)) {
|
||||
throw new BadRequestException("操作类型不能为空!");
|
||||
}
|
||||
|
||||
pdaService.inKiln(vehicle_code, type);
|
||||
return PdaUtils.buildSuccessResultJSON(null);
|
||||
}
|
||||
|
||||
@PostMapping("/vehicleBind")
|
||||
@Log("载具绑定")
|
||||
@ApiOperation("载具绑定")
|
||||
@@ -254,17 +201,29 @@ public class PdaController {
|
||||
return PdaUtils.buildSuccessResultJSON(null);
|
||||
}
|
||||
|
||||
@PostMapping("/callDefective")
|
||||
@Log("呼叫次品料")
|
||||
@ApiOperation("呼叫次品料")
|
||||
@PostMapping("/fjPoint")
|
||||
@Log("查询人工拆垛起点终点")
|
||||
@ApiOperation("查询人工拆垛起点终点")
|
||||
@PdaAnnotation
|
||||
public JSONObject callDefective(@RequestBody JSONObject param) {
|
||||
String device_code = param.getString("device_code");
|
||||
if (StrUtil.isBlank(device_code)) {
|
||||
throw new BadRequestException("设备不能为空!");
|
||||
public JSONObject fjPoint() {
|
||||
return PdaUtils.buildSuccessResultJSON(pdaService.fjPoint());
|
||||
}
|
||||
|
||||
@PostMapping("/createTask")
|
||||
@Log("人工拆垛创建任务")
|
||||
@ApiOperation("人工拆垛创建任务")
|
||||
@PdaAnnotation
|
||||
public JSONObject createTask(@RequestBody JSONObject param) {
|
||||
String startPointCode = param.getString("start_point_code");
|
||||
if (StrUtil.isBlank(startPointCode)) {
|
||||
throw new BadRequestException("起点不能为空!");
|
||||
}
|
||||
String endPointCode = param.getString("end_point_code");
|
||||
if (StrUtil.isBlank(endPointCode)) {
|
||||
throw new BadRequestException("终点不能为空!");
|
||||
}
|
||||
|
||||
pdaService.callDefective(device_code, param.toJSONString());
|
||||
pdaService.createTask(startPointCode, endPointCode, param.toJSONString());
|
||||
return PdaUtils.buildSuccessResultJSON(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.wms.pda.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* 辽宁晟华手持服务层接口
|
||||
@@ -28,14 +29,6 @@ public interface PdaService {
|
||||
*/
|
||||
JSONArray point(String func, String region_code);
|
||||
|
||||
/**
|
||||
* 查询设备
|
||||
*
|
||||
* @param func 手持功能
|
||||
* @return 设备号 设备名称
|
||||
*/
|
||||
JSONArray device(String func);
|
||||
|
||||
/**
|
||||
* 查询载具类型
|
||||
*
|
||||
@@ -44,14 +37,6 @@ public interface PdaService {
|
||||
*/
|
||||
JSONArray vehicleType(String func);
|
||||
|
||||
/**
|
||||
* 不合格品上报
|
||||
*
|
||||
* @param device_code 设备号
|
||||
* @param unqualified_qty 不合格数量
|
||||
*/
|
||||
void report(String device_code, String unqualified_qty);
|
||||
|
||||
/**
|
||||
* 送料
|
||||
*
|
||||
@@ -59,9 +44,8 @@ public interface PdaService {
|
||||
* @param vehicle_code 载具编码
|
||||
* @param qty 数量
|
||||
* @param weight 重量
|
||||
* @param is_full 是否满垛
|
||||
*/
|
||||
void sendMaterial(String point_code, String vehicle_code, String qty, String weight, String is_full, String request_param);
|
||||
void sendMaterial(String point_code, String vehicle_code, int qty, double weight, String request_param);
|
||||
|
||||
/**
|
||||
* 叫料
|
||||
@@ -93,14 +77,6 @@ public interface PdaService {
|
||||
*/
|
||||
void standStatus(String vehicle_code, String type);
|
||||
|
||||
/**
|
||||
* 入窑管理
|
||||
*
|
||||
* @param vehicle_code 载具编码
|
||||
* @param type 操作类型
|
||||
*/
|
||||
void inKiln(String vehicle_code, String type);
|
||||
|
||||
/**
|
||||
* 载具绑定
|
||||
*
|
||||
@@ -118,9 +94,17 @@ public interface PdaService {
|
||||
void vehicleUnbind(String point_code);
|
||||
|
||||
/**
|
||||
* 呼叫次品料
|
||||
* 查询人工拆垛起点终点
|
||||
*
|
||||
* @param device_code 设备号
|
||||
* @return 起点集合 终点集合
|
||||
*/
|
||||
void callDefective(String device_code, String request_param);
|
||||
JSONObject fjPoint();
|
||||
|
||||
/**
|
||||
* 人工拆垛创建任务
|
||||
*
|
||||
* @param startPointCode 起点点位号
|
||||
* @param endPointCode 终点点位号
|
||||
*/
|
||||
void createTask(String startPointCode, String endPointCode, String requestParam);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.nl.modules.common.exception.BadRequestException;
|
||||
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.StandStatus;
|
||||
import org.nl.wms.basedata.eum.TrueOrFalse;
|
||||
import org.nl.wms.basedata.eum.VehicleType;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
@@ -23,6 +24,7 @@ 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.p2p.RGCDTask;
|
||||
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.HLSendMaterialTask;
|
||||
@@ -56,25 +58,21 @@ public class PdaServiceImpl implements PdaService {
|
||||
|
||||
private final YZCallEmptyTask yzCallEmptyTask;
|
||||
|
||||
private final WmsToAcsService wmsToAcsService;
|
||||
private final RGCDTask recdTask;
|
||||
|
||||
@Override
|
||||
public JSONArray region(String func) {
|
||||
switch (func) {
|
||||
case "call_empty":
|
||||
// 叫空
|
||||
case "send_material":
|
||||
// 送料
|
||||
case "call_empty":
|
||||
return WQL
|
||||
.getWO("PDA")
|
||||
.addParam("flag", "1")
|
||||
.addParam("where", "('HL', 'YZ', 'FJ')")
|
||||
.addParam("where", "('HL', 'YZ')")
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
case "call_material":
|
||||
// 叫料
|
||||
case "send_empty":
|
||||
// 送空
|
||||
return WQL
|
||||
.getWO("PDA")
|
||||
.addParam("flag", "1")
|
||||
@@ -120,14 +118,6 @@ public class PdaServiceImpl implements PdaService {
|
||||
.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() + "没有送料点位!");
|
||||
}
|
||||
@@ -135,21 +125,13 @@ public class PdaServiceImpl implements PdaService {
|
||||
// 叫料
|
||||
switch (region) {
|
||||
case YZ:
|
||||
JSONArray result = WQL
|
||||
return WQL
|
||||
.getWO("PDA")
|
||||
.addParam("flag", "2")
|
||||
.addParam("region_code", region_code)
|
||||
.addParam("point_type", "('2')")
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
result.addAll(WQL
|
||||
.getWO("PDA")
|
||||
.addParam("flag", "2")
|
||||
.addParam("region_code", Region.KLHJ.value())
|
||||
.addParam("point_type", "('2')")
|
||||
.process()
|
||||
.getResultJSONArray(0));
|
||||
return result;
|
||||
case FJ:
|
||||
return WQL
|
||||
.getWO("PDA")
|
||||
@@ -169,14 +151,14 @@ public class PdaServiceImpl implements PdaService {
|
||||
.getWO("PDA")
|
||||
.addParam("flag", "2")
|
||||
.addParam("region_code", region_code)
|
||||
.addParam("point_type", "('2', '3')")
|
||||
.addParam("point_type", "('2')")
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
result.addAll(WQL
|
||||
.getWO("PDA")
|
||||
.addParam("flag", "2")
|
||||
.addParam("region_code", Region.KLHJ.value())
|
||||
.addParam("point_type", "('3')")
|
||||
.addParam("point_type", "('4')")
|
||||
.process()
|
||||
.getResultJSONArray(0));
|
||||
return result;
|
||||
@@ -210,14 +192,6 @@ public class PdaServiceImpl implements PdaService {
|
||||
.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() + "没有叫空点位!");
|
||||
}
|
||||
@@ -234,27 +208,6 @@ public class PdaServiceImpl implements PdaService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray device(String func) {
|
||||
switch (func) {
|
||||
case "unqualified_report":
|
||||
return WQL
|
||||
.getWO("PDA")
|
||||
.addParam("flag", "3")
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
case "call_defective":
|
||||
return WQL
|
||||
.getWO("PDA")
|
||||
.addParam("flag", "3")
|
||||
.addParam("region_code", "YZ")
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
default:
|
||||
throw new BadRequestException("未知功能!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray vehicleType(String func) {
|
||||
return WQLObject.getWQLObject("sys_dict_detail").query("name = 'vehicle_type'", "dict_sort ASC").getResultJSONArray(0);
|
||||
@@ -262,28 +215,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void report(String device_code, String unqualified_qty) {
|
||||
JSONObject device = WQLObject.getWQLObject("pdm_bi_device").query("is_used = '1' AND is_delete = '0' AND device_code = '" + device_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new BadRequestException("设备不存在或未启用!");
|
||||
}
|
||||
|
||||
WQLObject workorder_table = WQLObject.getWQLObject("pdm_bd_workorder");
|
||||
JSONObject work_order = workorder_table
|
||||
.query("is_delete = '0' AND device_code = '" + device_code + "' AND order_status = '3'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(work_order)) {
|
||||
throw new BadRequestException("设备 [" + device.getString("device_name") + "] 未开始生产!");
|
||||
}
|
||||
|
||||
int current_qty = work_order.getIntValue("unqualified_qty");
|
||||
work_order.put("unqualified_qty", current_qty + Integer.parseInt(unqualified_qty));
|
||||
workorder_table.update(work_order);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void sendMaterial(String point_code, String vehicle_code, String qty, String weight, String is_full, String request_param) {
|
||||
public void sendMaterial(String point_code, String vehicle_code, int qty, double weight, String request_param) {
|
||||
JSONObject point = WQLObject
|
||||
.getWQLObject("sch_base_point")
|
||||
.query("is_used = '1' AND point_code = '" + point_code + "'")
|
||||
@@ -308,7 +240,6 @@ public class PdaServiceImpl implements PdaService {
|
||||
vd.put("material_id", workorder.getString("material_id"));
|
||||
vd.put("qty", qty);
|
||||
vd.put("weight", weight);
|
||||
vd.put("is_full", is_full);
|
||||
vd.put("workorder_id", workorder.getString("workorder_id"));
|
||||
vd.put("point_code", point_code);
|
||||
Long user_id = SecurityUtils.getCurrentUserId();
|
||||
@@ -318,20 +249,14 @@ public class PdaServiceImpl implements PdaService {
|
||||
vd.put("create_time", DateUtil.now());
|
||||
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", 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());
|
||||
}
|
||||
|
||||
Region region = Region.get(point.getString("region_code"));
|
||||
if (region == Region.HL) {
|
||||
vd.put("stand_status", StandStatus.STANDING.value());
|
||||
} else if (region == Region.YZ) {
|
||||
vd.put("dz", weight / qty);
|
||||
}
|
||||
vd_table.insert(vd);
|
||||
|
||||
JSONObject method_param = new JSONObject();
|
||||
method_param.put("point", point);
|
||||
method_param.put("workorder", workorder);
|
||||
@@ -339,36 +264,13 @@ public class PdaServiceImpl implements PdaService {
|
||||
method_param.put("request_param", request_param);
|
||||
method_param.put("create_id", user_id);
|
||||
method_param.put("create_name", nick_name);
|
||||
method_param.put("vd", vd);
|
||||
|
||||
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);
|
||||
}});
|
||||
}});
|
||||
JSONObject device = WQLObject.getWQLObject("acs_device").query("device_code = '" + device_code + "'").uniqueResult(0);
|
||||
if (!"200".equals(result.getString("status"))) {
|
||||
throw new BadRequestException("[" + device.getString("device_name") + "] ACS未返回设备信息!");
|
||||
}
|
||||
JSONArray data = result.getJSONArray("data");
|
||||
if (ObjectUtil.isEmpty(data)) {
|
||||
throw new BadRequestException("[" + device.getString("device_name") + "] 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;
|
||||
default:
|
||||
@@ -399,7 +301,6 @@ public class PdaServiceImpl implements PdaService {
|
||||
method_param.put("create_name", SecurityUtils.getCurrentNickName());
|
||||
|
||||
switch (region) {
|
||||
case KLHJ:
|
||||
case YZ:
|
||||
yzCallMaterialTask.createTask(method_param);
|
||||
break;
|
||||
@@ -457,7 +358,15 @@ public class PdaServiceImpl implements PdaService {
|
||||
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 + "'");
|
||||
yzSendEmptyTask.createTask(method_param);
|
||||
break;
|
||||
case YZ:
|
||||
vd_update = new JSONObject();
|
||||
vd_update.put("is_delete", TrueOrFalse.TRUE.value());
|
||||
TaskUtils.addACSUpdateColum(vd_update);
|
||||
WQLObject
|
||||
.getWQLObject("st_ivt_vehicle_detail")
|
||||
.update(vd_update, "vehicle_type = '1' AND vehicle_code = '" + vehicle_code + "'");
|
||||
yzSendEmptyTask.createTask(method_param);
|
||||
break;
|
||||
case FJ:
|
||||
@@ -493,22 +402,17 @@ public class PdaServiceImpl implements PdaService {
|
||||
method_param.put("request_param", request_param);
|
||||
method_param.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
method_param.put("create_name", SecurityUtils.getCurrentNickName());
|
||||
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);
|
||||
|
||||
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;
|
||||
default:
|
||||
@@ -521,39 +425,29 @@ public class PdaServiceImpl implements PdaService {
|
||||
JSONObject vehicle_update = new JSONObject();
|
||||
switch (type) {
|
||||
case "1":
|
||||
vehicle_update.put("stand_status", "4");
|
||||
vehicle_update.put("stand_status", StandStatus.FORCE_COMPLETION.value());
|
||||
break;
|
||||
case "2":
|
||||
vehicle_update.put("stand_status", "5");
|
||||
vehicle_update.put("stand_status", StandStatus.FORCE_TIMEOUT.value());
|
||||
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 + "'");
|
||||
WQLObject.getWQLObject("st_ivt_vehicle_detail").update(vehicle_update, "is_delete = '0' AND vehicle_type = '1' AND vehicle_code = '" + vehicle_code + "'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vehicleBind(String point_code, String vehicle_type, String vehicle_code) {
|
||||
JSONObject vd = WQLObject.getWQLObject("st_ivt_vehicle_detail").query("is_delete = '0' AND vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
|
||||
|
||||
JSONObject point_update = new JSONObject();
|
||||
point_update.put("point_status", PointStatus.EMPTY_VEHICLE.value());
|
||||
if (ObjectUtil.isNotEmpty(vd)) {
|
||||
point_update.put("point_status", PointStatus.HAS_GOODS.value());
|
||||
point_update.put("vd_id", vd.getString("vd_id"));
|
||||
} else {
|
||||
point_update.put("point_status", PointStatus.EMPTY_VEHICLE.value());
|
||||
}
|
||||
point_update.put("vehicle_type", vehicle_type);
|
||||
point_update.put("vehicle_code", vehicle_code);
|
||||
TaskUtils.addCurrentUpdateColum(point_update);
|
||||
@@ -566,37 +460,55 @@ public class PdaServiceImpl implements PdaService {
|
||||
point_update.put("point_status", PointStatus.EMPTY.value());
|
||||
point_update.put("vehicle_type", "");
|
||||
point_update.put("vehicle_code", "");
|
||||
point_update.put("vd_id", null);
|
||||
TaskUtils.addCurrentUpdateColum(point_update);
|
||||
WQLObject.getWQLObject("sch_base_point").update(point_update, "point_code = '" + point_code + "'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callDefective(String device_code, String request_param) {
|
||||
JSONObject device = WQLObject.getWQLObject("pdm_bi_device").query("is_used = '1' AND is_delete = '0' AND device_code = '" + device_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new BadRequestException("[" + device_code + "] 不存在或未启用!");
|
||||
}
|
||||
public JSONObject fjPoint() {
|
||||
WQLObject pointTable = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
JSONObject point = WQLObject.getWQLObject("sch_base_point").query("region_code = 'YZ' AND point_type = '3' AND device_code LIKE '%" + device_code + "%'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("[" + device.getString("device_name") + "] 未找到次品料对接位!");
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("start", pointTable.query("is_used = '1' AND lock_type = '1' AND region_code = 'YHHJ' AND point_type = '1' AND point_status = '3'").getResultJSONArray(0));
|
||||
result.put("end", pointTable.query("is_used = '1' AND lock_type = '1' AND region_code = 'FJ' AND point_type = '3'").getResultJSONArray(0));
|
||||
return result;
|
||||
}
|
||||
|
||||
JSONObject workorder = WQLObject
|
||||
.getWQLObject("pdm_bd_workorder")
|
||||
.query("is_delete = '0' AND device_code = '" + device_code + "' AND order_status = '3'")
|
||||
@Override
|
||||
public void createTask(String startPointCode, String endPointCode, String requestParam) {
|
||||
JSONObject point1 = WQLObject
|
||||
.getWQLObject("sch_base_point")
|
||||
.query("is_used = '1' AND point_code = '" + startPointCode + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(workorder)) {
|
||||
throw new BadRequestException("[" + point.getString("point_code") + "] 所属设备 [" + device_code + "] 未开始生产!");
|
||||
if (ObjectUtil.isEmpty(point1)) {
|
||||
throw new BadRequestException("[" + startPointCode + "] 已删除或未启用!");
|
||||
}
|
||||
JSONObject point2 = WQLObject
|
||||
.getWQLObject("sch_base_point")
|
||||
.query("is_used = '1' AND point_code = '" + endPointCode + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(point2)) {
|
||||
throw new BadRequestException("[" + endPointCode + "] 已删除或未启用!");
|
||||
}
|
||||
|
||||
JSONObject method_param = new JSONObject();
|
||||
method_param.put("workorder", workorder);
|
||||
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());
|
||||
yzCallMaterialTask.createTask(method_param);
|
||||
TaskUtils.pointNameIsLocked(point1);
|
||||
TaskUtils.pointNameIsLocked(point2);
|
||||
|
||||
JSONObject vd = WQLObject.getWQLObject("st_ivt_vehicle_detail").query("is_delete = '0' AND vd_id = " + point1.getString("vd_id")).uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(vd)) {
|
||||
throw new BadRequestException("[" + point1.getString("point_name") + "] 上的组盘信息已被删除!");
|
||||
}
|
||||
|
||||
JSONObject methodParam = new JSONObject();
|
||||
methodParam.put("point1", point1);
|
||||
methodParam.put("point2", point2);
|
||||
methodParam.put("vd", vd);
|
||||
methodParam.put("create_mode", CreateMode.SCCJ.value());
|
||||
methodParam.put("request_param", requestParam);
|
||||
methodParam.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
methodParam.put("create_name", SecurityUtils.getCurrentNickName());
|
||||
|
||||
recdTask.createTask(methodParam);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,4 +167,22 @@ public class WorkorderController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/hlPause")
|
||||
@Log("混料暂停工单")
|
||||
@ApiOperation("混料暂停工单")
|
||||
//@SaCheckPermission("materialtype:list")
|
||||
public ResponseEntity<Object> hlPause(@RequestBody JSONObject param) {
|
||||
workordeService.hlPause(param);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/hlFinish")
|
||||
@Log("混料完成工单")
|
||||
@ApiOperation("混料完成工单")
|
||||
//@SaCheckPermission("materialtype:list")
|
||||
public ResponseEntity<Object> hlFinish(@RequestBody JSONObject param) {
|
||||
workordeService.hlFinish(param);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -130,4 +130,8 @@ public interface WorkordeService {
|
||||
void reportWorkOrderDaily(long workOrderId, int qty, int qualifiedQty, int unqualifiedQty, double weight, double avgPieceWeight);
|
||||
|
||||
void synchronize();
|
||||
|
||||
void hlPause(JSONObject param);
|
||||
|
||||
void hlFinish(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.pdm.service.WorkordeService;
|
||||
import org.nl.wms.pdm.service.dto.WorkorderDto;
|
||||
import org.nl.wms.sch.manage.Region;
|
||||
import org.nl.wms.sch.manage.RegionInType;
|
||||
import org.nl.wms.sch.manage.WorkOrderEnum;
|
||||
import org.nl.wms.sch.task.util.TaskUtils;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -448,32 +449,56 @@ public class WorkorderServiceImpl implements WorkordeService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finish(JSONObject param) {
|
||||
JSONObject row = param.getJSONObject("row");
|
||||
String workorder_id = row.getString("workorder_id");
|
||||
WQLObject workorder_table = WQLObject.getWQLObject("pdm_bd_workorder");
|
||||
JSONObject workorder = workorder_table.query("is_delete = '0' AND workorder_id = " + workorder_id).uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(workorder)) {
|
||||
WQLObject workOrderTable = WQLObject.getWQLObject("pdm_bd_workorder");
|
||||
long workOrderId = row.getLongValue("workorder_id");
|
||||
JSONObject workOrder = workOrderTable.query("is_delete = '0' AND workorder_id = " + workOrderId).uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(workOrder)) {
|
||||
throw new BadRequestException("工单不存在或已删除!");
|
||||
}
|
||||
if (!WorkOrderEnum.ORDER_STATUS_PRODUCING.value().equals(workOrder.getString("order_status")) && !WorkOrderEnum.ORDER_STATUS_STOP.value().equals(workOrder.getString("order_status"))) {
|
||||
throw new BadRequestException("只能完成生产中或暂停的工单!");
|
||||
}
|
||||
|
||||
if (workorder.getIntValue("order_status") < 5) {
|
||||
workorder.put("order_status", WorkOrderEnum.ORDER_STATUS_FINISH.value());
|
||||
String qty = row.getString("qty");
|
||||
if (!StrUtil.isBlank(qty)) {
|
||||
workorder.put("real_qty", qty);
|
||||
}
|
||||
String unqualified_qty = row.getString("unqualified_qty");
|
||||
if (StrUtil.isNotBlank(unqualified_qty) && !"0".equals(unqualified_qty)) {
|
||||
workorder.put("unqualified_qty", unqualified_qty);
|
||||
}
|
||||
int qty = row.getIntValue("qty");
|
||||
int qualifiedQty = row.getIntValue("qualified_qty");
|
||||
int unqualifiedQty = row.getIntValue("unqualified_qty");
|
||||
double weight = row.getDoubleValue("weight");
|
||||
this.reportWorkOrderDaily(workOrderId, qty, qualifiedQty, unqualifiedQty, weight, weight / qty);
|
||||
|
||||
String qualified_qty = row.getString("qualified_qty");
|
||||
if (StrUtil.isNotBlank(qualified_qty) && !"0".equals(qualified_qty)) {
|
||||
workorder.put("qualified_qty", qualified_qty);
|
||||
}
|
||||
// 汇总
|
||||
JSONArray workOrderDailyList = WQLObject.getWQLObject("pdm_bd_work_order_daily").query("workorder_id = " + workOrderId).getResultJSONArray(0);
|
||||
workOrder.put("real_qty", workOrderDailyList.stream().mapToInt(o -> ((JSONObject) o).getIntValue("qty")).sum());
|
||||
workOrder.put("real_weight", workOrderDailyList.stream().mapToDouble(o -> ((JSONObject) o).getDoubleValue("weight")).sum());
|
||||
workOrder.put("qualified_qty", workOrderDailyList.stream().mapToInt(o -> ((JSONObject) o).getIntValue("qualified_qty")).sum());
|
||||
workOrder.put("unqualified_qty", workOrderDailyList.stream().mapToInt(o -> ((JSONObject) o).getIntValue("unqualified_qty")).sum());
|
||||
workOrder.put("avg_piece_weight", workOrderDailyList.stream().mapToDouble(o -> ((JSONObject) o).getDoubleValue("avg_piece_weight")).sum() / workOrderDailyList.size());
|
||||
workOrder.put("order_status", WorkOrderEnum.ORDER_STATUS_FINISH.value());
|
||||
TaskUtils.addACSUpdateColum(workOrder);
|
||||
workOrderTable.update(workOrder);
|
||||
|
||||
workorder.put("realproduceend_date", DateUtil.now());
|
||||
TaskUtils.addCurrentUpdateColum(workorder);
|
||||
workorder_table.update(workorder);
|
||||
// 反馈ERP
|
||||
JSONObject device = WQLObject.getWQLObject("pdm_bi_device").query("device_id = " + workOrder.getString("device_id")).uniqueResult(0);
|
||||
if (Region.YZ.value().equals(device.getString("region_code"))) {
|
||||
JSONObject material = WQLObject.getWQLObject("md_me_materialbase").query("material_id = " + workOrder.getString("material_id")).uniqueResult(0);
|
||||
String dd = material.getString("dd");
|
||||
String extCode = workOrder.getString("ext_code");
|
||||
if (StrUtil.isNotBlank(dd) && StrUtil.isNotBlank(extCode)) {
|
||||
JSONObject regionIn = new JSONObject();
|
||||
regionIn.put("id", IdUtil.getSnowflake(1L, 1L).nextId());
|
||||
regionIn.put("cCode", CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||
regionIn.put("dDate", DateUtil.now());
|
||||
regionIn.put("cVouchType", RegionInType.FPRK.label());
|
||||
regionIn.put("cMocode", dd);
|
||||
regionIn.put("cInvCode", material.getString("material_number"));
|
||||
int unqualifiedQty1 = workOrder.getIntValue("unqualified_qty");
|
||||
double avgPieceWeight = workOrder.getDoubleValue("avg_piece_weight");
|
||||
regionIn.put("iQuantity", String.format("%.3f", unqualifiedQty1 * avgPieceWeight / 1000));
|
||||
regionIn.put("iNum", unqualifiedQty1);
|
||||
regionIn.put("iinvexchrate", String.format("%.5f", avgPieceWeight / 1000));
|
||||
regionIn.put("cBatch", dd);
|
||||
regionIn.put("PLANSID", extCode);
|
||||
WQLObject.getWQLObject("st_ivt_regionio").insert(regionIn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -650,4 +675,56 @@ public class WorkorderServiceImpl implements WorkordeService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hlPause(JSONObject param) {
|
||||
WQLObject workOrderTable = WQLObject.getWQLObject("pdm_bd_workorder");
|
||||
String workOrderId = param.getString("workorder_id");
|
||||
JSONObject workOrder = workOrderTable.query("is_delete = '0' AND workorder_id = " + workOrderId).uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(workOrder)) {
|
||||
throw new BadRequestException("工单不存在或已删除!");
|
||||
}
|
||||
if (!WorkOrderEnum.ORDER_STATUS_PRODUCING.value().equals(workOrder.getString("order_status"))) {
|
||||
throw new BadRequestException("只能暂停生产中的工单!");
|
||||
}
|
||||
|
||||
// 汇总
|
||||
JSONArray workOrderDailyList = WQLObject.getWQLObject("pdm_bd_work_order_daily").query("workorder_id = " + workOrderId).getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(workOrderDailyList)) {
|
||||
workOrder.put("real_qty", workOrderDailyList.stream().mapToInt(o -> ((JSONObject) o).getIntValue("qty")).sum());
|
||||
workOrder.put("real_weight", workOrderDailyList.stream().mapToDouble(o -> ((JSONObject) o).getDoubleValue("weight")).sum());
|
||||
workOrder.put("qualified_qty", workOrderDailyList.stream().mapToInt(o -> ((JSONObject) o).getIntValue("qualified_qty")).sum());
|
||||
workOrder.put("unqualified_qty", workOrderDailyList.stream().mapToInt(o -> ((JSONObject) o).getIntValue("unqualified_qty")).sum());
|
||||
workOrder.put("avg_piece_weight", workOrderDailyList.stream().mapToDouble(o -> ((JSONObject) o).getDoubleValue("avg_piece_weight")).sum() / workOrderDailyList.size());
|
||||
workOrder.put("order_status", WorkOrderEnum.ORDER_STATUS_STOP.value());
|
||||
TaskUtils.addACSUpdateColum(workOrder);
|
||||
workOrderTable.update(workOrder);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hlFinish(JSONObject param) {
|
||||
WQLObject workOrderTable = WQLObject.getWQLObject("pdm_bd_workorder");
|
||||
String workOrderId = param.getString("workorder_id");
|
||||
JSONObject workOrder = workOrderTable.query("is_delete = '0' AND workorder_id = " + workOrderId).uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(workOrder)) {
|
||||
throw new BadRequestException("工单不存在或已删除!");
|
||||
}
|
||||
if (!WorkOrderEnum.ORDER_STATUS_PRODUCING.value().equals(workOrder.getString("order_status")) && !WorkOrderEnum.ORDER_STATUS_STOP.value().equals(workOrder.getString("order_status"))) {
|
||||
throw new BadRequestException("只能完成生产中或暂停的工单!");
|
||||
}
|
||||
|
||||
// 汇总
|
||||
JSONArray workOrderDailyList = WQLObject.getWQLObject("pdm_bd_work_order_daily").query("workorder_id = " + workOrderId).getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(workOrderDailyList)) {
|
||||
workOrder.put("real_qty", workOrderDailyList.stream().mapToInt(o -> ((JSONObject) o).getIntValue("qty")).sum());
|
||||
workOrder.put("real_weight", workOrderDailyList.stream().mapToDouble(o -> ((JSONObject) o).getDoubleValue("weight")).sum());
|
||||
workOrder.put("qualified_qty", workOrderDailyList.stream().mapToInt(o -> ((JSONObject) o).getIntValue("qualified_qty")).sum());
|
||||
workOrder.put("unqualified_qty", workOrderDailyList.stream().mapToInt(o -> ((JSONObject) o).getIntValue("unqualified_qty")).sum());
|
||||
workOrder.put("avg_piece_weight", workOrderDailyList.stream().mapToDouble(o -> ((JSONObject) o).getDoubleValue("avg_piece_weight")).sum() / workOrderDailyList.size());
|
||||
workOrder.put("order_status", WorkOrderEnum.ORDER_STATUS_FINISH.value());
|
||||
TaskUtils.addACSUpdateColum(workOrder);
|
||||
workOrderTable.update(workOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,14 +79,14 @@ public abstract class AbstractAcsTask {
|
||||
;
|
||||
|
||||
/**
|
||||
* @param taskObj 代表一条任务对象
|
||||
* @param task 代表一条任务对象
|
||||
* @param status 代表wcs任务完成状态: //0:acs,取消,:执行中,2:完成
|
||||
* @return
|
||||
* @discription wcs请求wms任务完成状态反馈接口, 比如agv从a点往b点走。生成任务的时候绑定b的物料信息,任务完成的时候,清除a的物料信息
|
||||
* @author ldjun
|
||||
* @created 2019年4月17日 下午8:51:50
|
||||
*/
|
||||
public abstract void updateTaskStatus(JSONObject taskObj, String status);
|
||||
public abstract void updateTaskStatus(JSONObject task, String status);
|
||||
|
||||
/**
|
||||
* @returninvoke
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.nl.modules.common.utils.CommonUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.basedata.eum.StandStatus;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.sch.task.util.TaskUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -23,10 +23,9 @@ import java.util.ArrayList;
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Component("autoUpdateStandStatus")
|
||||
@SuppressWarnings("unused")
|
||||
public class AutoUpdateStandStatus {
|
||||
|
||||
private final WmsToAcsService wmsToAcsService;
|
||||
|
||||
@SneakyThrows
|
||||
public void run() {
|
||||
JSONArray vds = WQL.getWO("MANAGE_QUERY").addParam("flag", "1").process().getResultJSONArray(0);
|
||||
@@ -46,6 +45,7 @@ public class AutoUpdateStandStatus {
|
||||
if (!ids.isEmpty()) {
|
||||
JSONObject update = new JSONObject();
|
||||
update.put("stand_status", StandStatus.COMPLETED.value());
|
||||
TaskUtils.addAutoUpdateColum(update);
|
||||
WQLObject.getWQLObject("st_ivt_vehicle_detail").update(update, "vd_id IN " + CommonUtils.idsArrayToInStr(ids.toArray(new Long[0])));
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class AutoUpdateStandStatus {
|
||||
DateTime create_time = DateUtil.parse(vd.getString("create_time"));
|
||||
int threshold_time = vd.getIntValue("threshold_time");
|
||||
int stand_time = vd.getIntValue("stand_time");
|
||||
if (threshold_time != 0 && threshold_time < stand_time) {
|
||||
if (threshold_time > stand_time) {
|
||||
DateTime time = DateUtil.offsetMinute(create_time, threshold_time);
|
||||
int compare = DateUtil.compare(DateUtil.date(), time);
|
||||
if (compare >= 0) {
|
||||
@@ -71,18 +71,9 @@ public class AutoUpdateStandStatus {
|
||||
if (!ids.isEmpty()) {
|
||||
JSONObject update = new JSONObject();
|
||||
update.put("stand_status", StandStatus.TIMEOUT.value());
|
||||
TaskUtils.addAutoUpdateColum(update);
|
||||
WQLObject.getWQLObject("st_ivt_vehicle_detail").update(update, "vd_id IN " + CommonUtils.idsArrayToInStr(ids.toArray(new Long[0])));
|
||||
}
|
||||
}
|
||||
|
||||
JSONArray points = WQL.getWO("MANAGE_QUERY").addParam("flag", "3").process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(vds)) {
|
||||
JSONArray point_codes = new JSONArray();
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
JSONObject point = points.getJSONObject(i);
|
||||
point_codes.add(point.getString("point_code"));
|
||||
}
|
||||
wmsToAcsService.light(point_codes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.nl.wms.sch.manage;
|
||||
|
||||
/**
|
||||
* @author zhangjiangwei
|
||||
*/
|
||||
public class AutoUpdateWorkOrderDaily {
|
||||
}
|
||||
@@ -15,8 +15,7 @@ public enum RegionInType {
|
||||
|
||||
WGRK("完工入库", "F"),
|
||||
BCPRK("半成品入库", "W"),
|
||||
BCPFPRK("废品入库", "W"),
|
||||
CCPFPRK("废品入库", "F");
|
||||
FPRK("废品入库", "W");
|
||||
|
||||
private final String label;
|
||||
private final String value;
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
WHERE
|
||||
vd.is_delete = '0'
|
||||
AND vd.vehicle_type = '1'
|
||||
AND vd.stand_status = '2'
|
||||
AND vd.stand_status = '1'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -65,23 +65,7 @@
|
||||
WHERE
|
||||
vd.is_delete = '0'
|
||||
AND vd.vehicle_type = '1'
|
||||
AND vd.stand_status = '3'
|
||||
AND vd.stand_status = '2'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sch_base_point point
|
||||
LEFT JOIN st_ivt_vehicle_detail vd ON point.vehicle_type = vd.vehicle_type
|
||||
AND point.vehicle_code = vd.vehicle_code AND vd.is_delete = '0'
|
||||
WHERE
|
||||
point.region_code = 'KLHJ'
|
||||
AND point.point_type = '2'
|
||||
AND vd.stand_status > '2'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -1,10 +1,13 @@
|
||||
package org.nl.wms.sch.task.call.material;
|
||||
|
||||
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.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
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.basedata.eum.TrueOrFalse;
|
||||
@@ -212,6 +215,24 @@ public class FJCallMaterialTask extends AbstractAcsTask {
|
||||
}
|
||||
point_table.update(point2, "point_code = '" + point_code2 + "'");
|
||||
}
|
||||
|
||||
JSONObject detail = WQL.getWO("CALL_MATERIAL_TASK").addParam("flag", "5").addParam("vd_id", task.getString("group_id")).process().uniqueResult(0);
|
||||
String dd = detail.getString("dd");
|
||||
String extCode = detail.getString("ext_code");
|
||||
if (StrUtil.isNotBlank(dd) && StrUtil.isNotBlank(extCode)) {
|
||||
JSONObject regionOut = new JSONObject();
|
||||
regionOut.put("id", IdUtil.getSnowflake(1L, 1L).nextId());
|
||||
regionOut.put("cCode", CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||
regionOut.put("dDate", DateUtil.now());
|
||||
regionOut.put("cMocode", dd);
|
||||
regionOut.put("cInvCode", detail.getString("material_number"));
|
||||
regionOut.put("iQuantity", String.format("%.3f", detail.getDoubleValue("weight") / 1000));
|
||||
regionOut.put("iNum", detail.getString("qty"));
|
||||
regionOut.put("iinvexchrate", String.format("%.5f", detail.getDoubleValue("dz") / 1000));
|
||||
regionOut.put("cBatch", dd);
|
||||
regionOut.put("PLANSID", extCode);
|
||||
WQLObject.getWQLObject("st_ivt_regionout").insert(regionOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
输入.flag TYPEAS s_string
|
||||
输入.material_id TYPEAS f_string
|
||||
输入.device_code TYPEAS s_string
|
||||
输入.vd_id TYPEAS f_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
@@ -105,6 +106,7 @@
|
||||
AND p.device_code = 输入.device_code
|
||||
AND p.vehicle_type = '1'
|
||||
AND vd.material_id = 输入.material_id
|
||||
AND vd.stand_status IN ('2', '3')
|
||||
ORDER BY
|
||||
wo.is_pri DESC,
|
||||
vd.create_time ASC
|
||||
@@ -128,9 +130,29 @@
|
||||
AND p.point_status = '3'
|
||||
AND p.vehicle_type = '1'
|
||||
AND vd.material_id = 输入.material_id
|
||||
AND vd.stand_status IN ('2', '3')
|
||||
ORDER BY
|
||||
wo.is_pri DESC,
|
||||
vd.create_time ASC
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "5"
|
||||
QUERY
|
||||
SELECT
|
||||
vd.qty,
|
||||
vd.weight,
|
||||
vd.dz,
|
||||
material.material_number,
|
||||
material.dd,
|
||||
wo.ext_code
|
||||
FROM
|
||||
st_ivt_vehicle_detail vd
|
||||
LEFT JOIN pdm_bd_workorder wo ON vd.workorder_id = wo.workorder_id
|
||||
LEFT JOIN md_me_materialbase material ON vd.material_id = material.material_id
|
||||
WHERE
|
||||
vd.vd_id = 输入.vd_id
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package org.nl.wms.sch.task.to.pack;
|
||||
package org.nl.wms.sch.task.p2p;
|
||||
|
||||
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 org.nl.modules.common.exception.BadRequestException;
|
||||
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.basedata.eum.TrueOrFalse;
|
||||
import org.nl.wms.common.PickType;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.sch.manage.*;
|
||||
import org.nl.wms.sch.task.util.TaskUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -20,9 +19,8 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Component
|
||||
public class BTHCToPackageTask extends AbstractAcsTask {
|
||||
public class RGCDTask extends AbstractAcsTask {
|
||||
|
||||
private final WmsToAcsService wmsToAcsService;
|
||||
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject task, String status) {
|
||||
@@ -39,73 +37,44 @@ public class BTHCToPackageTask extends AbstractAcsTask {
|
||||
|
||||
@Override
|
||||
public String createTask(JSONObject form) {
|
||||
JSONObject point = form.getJSONObject("point");
|
||||
JSONObject point1 = form.getJSONObject("point1");
|
||||
JSONObject point2 = form.getJSONObject("point2");
|
||||
JSONObject vd = form.getJSONObject("vd");
|
||||
|
||||
JSONObject task = TaskUtils.buildTask(
|
||||
"半托缓存区去包装",
|
||||
TaskType.TO_PACKAGE.value(),
|
||||
TaskStatus.SURE_START.value(),
|
||||
point.getString("point_code"),
|
||||
null,
|
||||
"人工拆垛",
|
||||
TaskType.CALL_MATERIAL.value(),
|
||||
TaskStatus.START_AND_END.value(),
|
||||
point1.getString("point_code"),
|
||||
point2.getString("point_code"),
|
||||
vd.getLongValue("vd_id"),
|
||||
vd.getString("material_id"),
|
||||
vd.getString("vehicle_type"),
|
||||
vd.getString("vehicle_code"),
|
||||
1,
|
||||
BTHCToPackageTask.class.getName(),
|
||||
RGCDTask.class.getName(),
|
||||
form.getString("create_mode"),
|
||||
form.getString("request_param"),
|
||||
form.getString("create_id"),
|
||||
form.getString("create_name")
|
||||
);
|
||||
WQLObject.getWQLObject("sch_base_task").insert(task);
|
||||
|
||||
point.put("lock_type", LockType.TASK_LOCKED.value());
|
||||
point.put("task_code", task.getString("task_code"));
|
||||
TaskUtils.addFormUpdateColum(point, form);
|
||||
WQLObject.getWQLObject("sch_base_point").update(point);
|
||||
point1.put("lock_type", LockType.TASK_LOCKED.value());
|
||||
point1.put("task_code", task.getString("task_code"));
|
||||
TaskUtils.addFormUpdateColum(point1, form);
|
||||
WQLObject pointTable = WQLObject.getWQLObject("sch_base_point");
|
||||
pointTable.update(point1);
|
||||
|
||||
point2.put("lock_type", LockType.TASK_LOCKED.value());
|
||||
point2.put("task_code", task.getString("task_code"));
|
||||
TaskUtils.addFormUpdateColum(point2, form);
|
||||
pointTable.update(point2);
|
||||
|
||||
WQLObject.getWQLObject("sch_base_task").insert(task);
|
||||
|
||||
return task.getString("task_code");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void findNextPoint() {
|
||||
WQLObject task_table = WQLObject.getWQLObject("sch_base_task");
|
||||
JSONArray tasks = task_table
|
||||
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_START.value() + "' AND handle_class = '" + BTHCToPackageTask.class.getName() + "'", "priority DESC, create_time ASC")
|
||||
.getResultJSONArray(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(tasks)) {
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
for (int i = 0; i < tasks.size(); i++) {
|
||||
JSONObject task = tasks.getJSONObject(i);
|
||||
|
||||
JSONObject point = WQL
|
||||
.getWO("TO_PACKAGE_TASK")
|
||||
.addParam("flag", "1")
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(point)) {
|
||||
task.put("task_status", TaskStatus.START_AND_END.value());
|
||||
task.put("point_code2", point.getString("point_code"));
|
||||
task.put("remark", "");
|
||||
TaskUtils.addAutoUpdateColum(task);
|
||||
task_table.update(task);
|
||||
|
||||
point.put("lock_type", LockType.TASK_LOCKED.value());
|
||||
point.put("task_code", task.getString("task_code"));
|
||||
TaskUtils.addAutoUpdateColum(point);
|
||||
point_table.update(point);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_id) {
|
||||
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
|
||||
@@ -125,7 +94,6 @@ public class BTHCToPackageTask extends AbstractAcsTask {
|
||||
this.cancelTask(task, OperationType.MANUAL);
|
||||
}
|
||||
|
||||
|
||||
public void cancelTask(JSONObject task, OperationType operation_type) {
|
||||
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
|
||||
task.put("task_status", TaskStatus.CANCELLED.value());
|
||||
@@ -141,7 +109,8 @@ public class BTHCToPackageTask extends AbstractAcsTask {
|
||||
String point_code1 = task.getString("point_code1");
|
||||
if (StrUtil.isNotBlank(point_code1)) {
|
||||
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
|
||||
if (ObjectUtil.isNotEmpty(point1)
|
||||
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
|
||||
&& task.getString("task_code").equals(point1.getString("task_code"))) {
|
||||
point1.put("lock_type", LockType.UNLOCKED.value());
|
||||
point1.put("task_code", "");
|
||||
@@ -166,8 +135,6 @@ public class BTHCToPackageTask extends AbstractAcsTask {
|
||||
}
|
||||
point_table.update(point2, "point_code = '" + point_code2 + "'");
|
||||
}
|
||||
|
||||
WQLObject.getWQLObject("das_produce_number").delete("data_id = " + task.getLongValue("table_fk_id"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,13 +160,13 @@ public class BTHCToPackageTask extends AbstractAcsTask {
|
||||
String point_code1 = task.getString("point_code1");
|
||||
if (StrUtil.isNotBlank(point_code1)) {
|
||||
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(point1)
|
||||
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
|
||||
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
|
||||
&& task.getString("task_code").equals(point1.getString("task_code"))) {
|
||||
point1.put("lock_type", LockType.UNLOCKED.value());
|
||||
point1.put("task_code", "");
|
||||
point1.put("vehicle_type", "");
|
||||
point1.put("vehicle_code", "");
|
||||
point1.put("vd_id", null);
|
||||
point1.put("point_status", PointStatus.EMPTY.value());
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(point1);
|
||||
@@ -215,6 +182,10 @@ public class BTHCToPackageTask extends AbstractAcsTask {
|
||||
JSONObject point2 = new JSONObject();
|
||||
point2.put("lock_type", LockType.UNLOCKED.value());
|
||||
point2.put("task_code", "");
|
||||
point2.put("vehicle_type", task.getString("vehicle_type"));
|
||||
point2.put("vehicle_code", task.getString("vehicle_code"));
|
||||
point2.put("vd_id", task.getString("group_id"));
|
||||
point2.put("point_status", PointStatus.HAS_GOODS.value());
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(point2);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
@@ -222,6 +193,24 @@ public class BTHCToPackageTask extends AbstractAcsTask {
|
||||
}
|
||||
point_table.update(point2, "point_code = '" + point_code2 + "'");
|
||||
}
|
||||
|
||||
JSONObject detail = WQL.getWO("CALL_MATERIAL_TASK").addParam("flag", "1").addParam("vd_id", task.getString("group_id")).process().uniqueResult(0);
|
||||
String dd = detail.getString("dd");
|
||||
String extCode = detail.getString("ext_code");
|
||||
if (StrUtil.isNotBlank(dd) && StrUtil.isNotBlank(extCode)) {
|
||||
JSONObject regionOut = new JSONObject();
|
||||
regionOut.put("id", IdUtil.getSnowflake(1L, 1L).nextId());
|
||||
regionOut.put("cCode", CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||
regionOut.put("dDate", DateUtil.now());
|
||||
regionOut.put("cMocode", dd);
|
||||
regionOut.put("cInvCode", detail.getString("material_number"));
|
||||
regionOut.put("iQuantity", String.format("%.3f", detail.getDoubleValue("weight") / 1000));
|
||||
regionOut.put("iNum", detail.getString("qty"));
|
||||
regionOut.put("iinvexchrate", String.format("%.5f", detail.getDoubleValue("dz") / 1000));
|
||||
regionOut.put("cBatch", dd);
|
||||
regionOut.put("PLANSID", extCode);
|
||||
WQLObject.getWQLObject("st_ivt_regionout").insert(regionOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,14 @@
|
||||
package org.nl.wms.sch.task.send.material;
|
||||
|
||||
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 org.nl.modules.common.exception.BadRequestException;
|
||||
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.basedata.eum.TrueOrFalse;
|
||||
@@ -223,6 +226,25 @@ public class GZSendMaterialTask extends AbstractAcsTask {
|
||||
}
|
||||
point_table.update(point2, "point_code = '" + point_code2 + "'");
|
||||
}
|
||||
|
||||
JSONObject detail = WQL.getWO("SEND_MATERIAL_TASK").addParam("flag", "6").addParam("vd_id", task.getString("group_id")).process().uniqueResult(0);
|
||||
String dd = detail.getString("dd");
|
||||
String extCode = detail.getString("ext_code");
|
||||
if (StrUtil.isNotBlank(dd) && StrUtil.isNotBlank(extCode)) {
|
||||
JSONObject regionIn = new JSONObject();
|
||||
regionIn.put("id", IdUtil.getSnowflake(1L, 1L).nextId());
|
||||
regionIn.put("cCode", CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||
regionIn.put("dDate", DateUtil.now());
|
||||
regionIn.put("cVouchType", RegionInType.BCPRK.label());
|
||||
regionIn.put("cMocode", dd);
|
||||
regionIn.put("cInvCode", detail.getString("material_number"));
|
||||
regionIn.put("iQuantity", String.format("%.3f", detail.getDoubleValue("weight") / 1000));
|
||||
regionIn.put("iNum", detail.getIntValue("qty"));
|
||||
regionIn.put("iinvexchrate", String.format("%.5f", detail.getDoubleValue("dz") / 1000));
|
||||
regionIn.put("cBatch", dd);
|
||||
regionIn.put("PLANSID", extCode);
|
||||
WQLObject.getWQLObject("st_ivt_regionio").insert(regionIn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,22 +255,21 @@ public class HLSendMaterialTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
JSONObject vd = WQLObject.getWQLObject("st_ivt_vehicle_detail").query("vd_id = " + task.getString("group_id")).uniqueResult(0);
|
||||
String workOrderId = vd.getString("workorder_id");
|
||||
|
||||
String today = DateUtil.today();
|
||||
WQLObject wodTable = WQLObject.getWQLObject("pdm_bd_work_order_daily");
|
||||
String workOrderId = vd.getString("workorder_id");
|
||||
JSONObject workOrderDaily = wodTable.query("workorder_id = " + workOrderId + " AND date = '" + today + "'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(workOrderDaily)) {
|
||||
workOrderDaily = new JSONObject();
|
||||
workOrderDaily.put("id", IdUtil.getSnowflake().nextId());
|
||||
workOrderDaily.put("date", today);
|
||||
workOrderDaily.put("workorder_id", workOrderId);
|
||||
workOrderDaily.put("weight", vd.getDouble("weight"));
|
||||
workOrderDaily.put("is_report", TrueOrFalse.TRUE.value());
|
||||
workOrderDaily.put("weight", vd.getDoubleValue("weight"));
|
||||
TaskUtils.addACSCreateColum(workOrderDaily);
|
||||
wodTable.insert(workOrderDaily);
|
||||
} else {
|
||||
workOrderDaily.put("weight", workOrderDaily.getDouble("weight") + vd.getDouble("weight"));
|
||||
workOrderDaily.put("weight", workOrderDaily.getDoubleValue("weight") + vd.getDoubleValue("weight"));
|
||||
TaskUtils.addACSUpdateColum(workOrderDaily);
|
||||
wodTable.update(workOrderDaily);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.material_id TYPEAS f_string
|
||||
输入.vd_id TYPEAS f_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
@@ -123,3 +124,22 @@
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "6"
|
||||
QUERY
|
||||
SELECT
|
||||
vd.qty,
|
||||
vd.weight,
|
||||
vd.dz,
|
||||
material.material_number,
|
||||
material.dd,
|
||||
wo.ext_code
|
||||
FROM
|
||||
st_ivt_vehicle_detail vd
|
||||
LEFT JOIN pdm_bd_workorder wo ON vd.workorder_id = wo.workorder_id
|
||||
LEFT JOIN md_me_materialbase material ON vd.material_id = material.material_id
|
||||
WHERE
|
||||
vd.vd_id = 输入.vd_id
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -1,229 +0,0 @@
|
||||
package org.nl.wms.sch.task.to.pack;
|
||||
|
||||
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 org.nl.modules.common.exception.BadRequestException;
|
||||
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.common.PickType;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.sch.manage.*;
|
||||
import org.nl.wms.sch.task.util.TaskUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author zhangjiangwei
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Component
|
||||
public class FJToPackageTask extends AbstractAcsTask {
|
||||
|
||||
private final WmsToAcsService wmsToAcsService;
|
||||
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject task, String status) {
|
||||
if (TaskStatus.EXECUTING.value().equals(status)) {
|
||||
task.put("task_status", TaskStatus.EXECUTING.value());
|
||||
TaskUtils.addACSUpdateColum(task);
|
||||
WQLObject.getWQLObject("sch_base_task").update(task);
|
||||
} else if (TaskStatus.FINISHED.value().equals(status)) {
|
||||
this.finishTask(task, OperationType.AUTO);
|
||||
} else if (TaskStatus.CANCELLED.value().equals(status)) {
|
||||
this.cancelTask(task, OperationType.AUTO);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createTask(JSONObject form) {
|
||||
JSONObject point = form.getJSONObject("point");
|
||||
JSONObject work_order = form.getJSONObject("workorder");
|
||||
int priority = TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? 100 : 1;
|
||||
JSONObject vd = form.getJSONObject("vd");
|
||||
|
||||
JSONObject task = TaskUtils.buildTask(
|
||||
"分拣区去包装",
|
||||
TaskType.TO_PACKAGE.value(),
|
||||
TaskStatus.SURE_START.value(),
|
||||
point.getString("point_code"),
|
||||
null,
|
||||
vd.getLongValue("vd_id"),
|
||||
vd.getString("material_id"),
|
||||
vd.getString("vehicle_type"),
|
||||
vd.getString("vehicle_code"),
|
||||
priority,
|
||||
FJToPackageTask.class.getName(),
|
||||
form.getString("create_mode"),
|
||||
form.getString("request_param"),
|
||||
form.getString("create_id"),
|
||||
form.getString("create_name")
|
||||
);
|
||||
WQLObject.getWQLObject("sch_base_task").insert(task);
|
||||
|
||||
point.put("lock_type", LockType.TASK_LOCKED.value());
|
||||
point.put("task_code", task.getString("task_code"));
|
||||
TaskUtils.addFormUpdateColum(point, form);
|
||||
WQLObject.getWQLObject("sch_base_point").update(point);
|
||||
|
||||
return task.getString("task_code");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void findNextPoint() {
|
||||
WQLObject task_table = WQLObject.getWQLObject("sch_base_task");
|
||||
JSONArray tasks = task_table
|
||||
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_START.value() + "' AND handle_class = '" + FJToPackageTask.class.getName() + "'", "priority DESC, create_time ASC")
|
||||
.getResultJSONArray(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(tasks)) {
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
for (int i = 0; i < tasks.size(); i++) {
|
||||
JSONObject task = tasks.getJSONObject(i);
|
||||
|
||||
JSONObject point = WQL
|
||||
.getWO("TO_PACKAGE_TASK")
|
||||
.addParam("flag", "1")
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(point)) {
|
||||
task.put("task_status", TaskStatus.START_AND_END.value());
|
||||
task.put("point_code2", point.getString("point_code"));
|
||||
task.put("remark", "");
|
||||
TaskUtils.addAutoUpdateColum(task);
|
||||
task_table.update(task);
|
||||
|
||||
point.put("lock_type", LockType.TASK_LOCKED.value());
|
||||
point.put("task_code", task.getString("task_code"));
|
||||
TaskUtils.addAutoUpdateColum(point);
|
||||
point_table.update(point);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_id) {
|
||||
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(task)) {
|
||||
throw new BadRequestException("未找到任务!");
|
||||
}
|
||||
this.finishTask(task, OperationType.MANUAL);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(task)) {
|
||||
throw new BadRequestException("未找到任务!");
|
||||
}
|
||||
this.cancelTask(task, OperationType.MANUAL);
|
||||
}
|
||||
|
||||
|
||||
public void cancelTask(JSONObject task, OperationType operation_type) {
|
||||
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
|
||||
task.put("task_status", TaskStatus.CANCELLED.value());
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(task);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(task);
|
||||
}
|
||||
WQLObject.getWQLObject("sch_base_task").update(task);
|
||||
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
String point_code1 = task.getString("point_code1");
|
||||
if (StrUtil.isNotBlank(point_code1)) {
|
||||
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
|
||||
&& task.getString("task_code").equals(point1.getString("task_code"))) {
|
||||
point1.put("lock_type", LockType.UNLOCKED.value());
|
||||
point1.put("task_code", "");
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(point1);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(point1);
|
||||
}
|
||||
point_table.update(point1);
|
||||
}
|
||||
}
|
||||
|
||||
String point_code2 = task.getString("point_code2");
|
||||
if (StrUtil.isNotBlank(point_code2)) {
|
||||
JSONObject point2 = new JSONObject();
|
||||
point2.put("lock_type", LockType.UNLOCKED.value());
|
||||
point2.put("task_code", "");
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(point2);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(point2);
|
||||
}
|
||||
point_table.update(point2, "point_code = '" + point_code2 + "'");
|
||||
}
|
||||
|
||||
WQLObject.getWQLObject("das_produce_number").delete("data_id = " + task.getLongValue("table_fk_id"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void finishTask(JSONObject task, OperationType operation_type) {
|
||||
int current_task_status = task.getIntValue("task_status");
|
||||
if (current_task_status < Integer.parseInt(TaskStatus.FINISHED.value())) {
|
||||
if (operation_type == OperationType.MANUAL
|
||||
&& current_task_status < Integer.parseInt(TaskStatus.START_AND_END.value())) {
|
||||
throw new BadRequestException("只能手动完成 [确认起点和终点] 之后的任务!");
|
||||
}
|
||||
|
||||
task.put("task_status", TaskStatus.FINISHED.value());
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(task);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(task);
|
||||
}
|
||||
WQLObject.getWQLObject("sch_base_task").update(task);
|
||||
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
String point_code1 = task.getString("point_code1");
|
||||
if (StrUtil.isNotBlank(point_code1)) {
|
||||
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(point1)
|
||||
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
|
||||
&& task.getString("task_code").equals(point1.getString("task_code"))) {
|
||||
point1.put("lock_type", LockType.UNLOCKED.value());
|
||||
point1.put("task_code", "");
|
||||
point1.put("vehicle_type", "");
|
||||
point1.put("vehicle_code", "");
|
||||
point1.put("point_status", PointStatus.EMPTY.value());
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(point1);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(point1);
|
||||
}
|
||||
point_table.update(point1);
|
||||
}
|
||||
}
|
||||
|
||||
String point_code2 = task.getString("point_code2");
|
||||
if (StrUtil.isNotBlank(point_code2)) {
|
||||
JSONObject point2 = new JSONObject();
|
||||
point2.put("lock_type", LockType.UNLOCKED.value());
|
||||
point2.put("task_code", "");
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(point2);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(point2);
|
||||
}
|
||||
point_table.update(point2, "point_code = '" + point_code2 + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
[交易说明]
|
||||
交易名: 去包装
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
IF 输入.flag = "1"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sch_base_point
|
||||
WHERE
|
||||
is_used = '1'
|
||||
AND lock_type = '1'
|
||||
AND point_status = '0'
|
||||
AND region_code = 'FJ'
|
||||
AND point_type = '5'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -8,6 +8,7 @@ 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.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.sch.manage.*;
|
||||
|
||||
@@ -118,10 +119,6 @@ public class TaskUtils {
|
||||
public static String formatVehicleCode(String vehicle_code) {
|
||||
if (StrUtil.isBlank(vehicle_code)) {
|
||||
vehicle_code = "0000";
|
||||
} else {
|
||||
if (vehicle_code.length() > 4 || !vehicle_code.matches("^\\d+$")) {
|
||||
throw new BadRequestException("载具编码错误!");
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder vehicle_code_builder = new StringBuilder(vehicle_code);
|
||||
|
||||
@@ -43,12 +43,14 @@
|
||||
QUERY
|
||||
SELECT
|
||||
vd.qty,
|
||||
vd.weight AS vd_weight,
|
||||
material.weight AS material_weight,
|
||||
vd.weight,
|
||||
vd.dz,
|
||||
material.material_number,
|
||||
material.order_code
|
||||
material.dd,
|
||||
wo.ext_code
|
||||
FROM
|
||||
st_ivt_vehicle_detail vd
|
||||
LEFT JOIN pdm_bd_workorder wo ON vd.workorder_id = wo.workorder_id
|
||||
LEFT JOIN md_me_materialbase material ON vd.material_id = material.material_id
|
||||
WHERE
|
||||
vd.vd_id = 输入.vd_id
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user