代码更新

This commit is contained in:
ldj_willow
2022-10-18 15:21:36 +08:00
parent a5c5a19dbb
commit 6c552cb6d9
7 changed files with 203 additions and 307 deletions

View File

@@ -8,11 +8,9 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.system.util.CodeUtil; import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.ext.acs.service.AcsToWmsService; import org.nl.wms.ext.acs.service.AcsToWmsService;
@@ -25,7 +23,6 @@ import org.nl.wms.sch.service.PointService;
import org.nl.wms.sch.service.TaskService; import org.nl.wms.sch.service.TaskService;
import org.nl.wms.sch.service.dto.TaskDto; import org.nl.wms.sch.service.dto.TaskDto;
import org.nl.wms.sch.tasks.*; import org.nl.wms.sch.tasks.*;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -114,11 +111,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
result.put("errArr", errArr); result.put("errArr", errArr);
return result; return result;
} }
@LokiLog(type = LokiLogType.ACS_TO_LMS) @LokiLog(type = LokiLogType.ACS_TO_LMS)
@Override @Override
public Map<String, Object> receivePointStatusFromAcs(Map<String, String> jsonObject) { public Map<String, Object> receivePointStatusFromAcs(Map<String, String> jsonObject) {
return null; return null;
} }
@LokiLog(type = LokiLogType.ACS_TO_LMS) @LokiLog(type = LokiLogType.ACS_TO_LMS)
@Override @Override
public Map<String, Object> orderFinish(String string) { public Map<String, Object> orderFinish(String string) {
@@ -172,286 +171,199 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
* 7.油漆线->输送线 * 7.油漆线->输送线
* 8.豪凯自动线下料入库 * 8.豪凯自动线下料入库
*/ */
JSONObject resuft = new JSONObject(); if (StrUtil.equals(type, "1")) {
try { // 1.共挤线申请空盘: 调用空托盘出库处理类创建任务
if (StrUtil.equals(type, "1")) { if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
// 1.共挤线申请空盘: 调用空托盘出库处理类创建任务
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
JSONObject param = new JSONObject();
param.put("next_point_code", point_code);
param.put("qty", vehicle_num);
// 创建任务
CallEmpVehicleTask taskBean = SpringContextHolder.getBean(CallEmpVehicleTask.class);
String task_id = taskBean.createTask(param);
// 插入空载具作业记录表
JSONObject jsonEmpParam = new JSONObject();
jsonEmpParam.put("vehicle_qty", vehicle_num);
jsonEmpParam.put("task_id", task_id);
jsonEmpParam.put("io_type", "1");
this.createEmp(jsonEmpParam);
// 下发
JSONObject jsonObject = taskBean.renotifyAcs(task_id);
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
// 成功返回 更新任务状态
resuft.put("status", "200");
resuft.put("message", "");
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
jsonTask.put("task_status", "05");
taskTab.update(jsonTask);
} else {
throw new BadRequestException(jsonObject.getString("message"));
}
} else if (StrUtil.equals(type, "2")) {
// 2.共挤线满托入库: 调用物料入库处理类创建任务
if (ObjectUtil.isEmpty(qty) || (StrUtil.equals(qty, "0")))
throw new BadRequestException("物料数量不能为空或者为0");
JSONObject param = new JSONObject();
param.put("start_point_code", point_code); // 满料位
SendMaterialTask taskBean = SpringContextHolder.getBean(SendMaterialTask.class);
String task_id = taskBean.createTask(param); // 创建任务
JSONObject param = new JSONObject();
param.put("next_point_code", point_code);
param.put("qty", vehicle_num);
// 创建任务
CallEmpVehicleTask taskBean = SpringContextHolder.getBean(CallEmpVehicleTask.class);
String task_id = taskBean.createTask(param);
// 下发
JSONObject jsonObject = taskBean.renotifyAcs(task_id);
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
// 成功返回 更新任务状态
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0); JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
// 插入区域出入库表 jsonTask.put("task_status", "05");
param.put("next_point_code", jsonTask.getString("next_point_code"));
param.put("qty", qty);
param.put("task_id", task_id);
param.put("io_type", "0");
JSONObject json = this.inCreateRegion(param);
// 回显任务载具类型
jsonTask.put("vehicle_type", json.getString("vehicle_type"));
taskTab.update(jsonTask); taskTab.update(jsonTask);
} else {
// 下发 throw new BadRequestException(jsonObject.getString("message"));
JSONObject jsonObject = taskBean.renotifyAcs(task_id); }
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
// 成功返回 更新任务状态 } else if (StrUtil.equals(type, "2")) {
resuft.put("status", "200"); // 2.共挤线满托入库: 调用物料入库处理类创建任务
resuft.put("message", ""); if (ObjectUtil.isEmpty(qty) || (StrUtil.equals(qty, "0")))
jsonTask.put("task_status", "05"); throw new BadRequestException("物料数量不能为空或者为0");
taskTab.update(jsonTask);
} else { JSONObject param = new JSONObject();
throw new BadRequestException(jsonObject.getString("message")); param.put("start_point_code", point_code); // 满料位
}
} else if (StrUtil.equals(type, "3")) { SendMaterialTask taskBean = SpringContextHolder.getBean(SendMaterialTask.class);
// 3.油漆线申请空盘: 调用空托盘出库处理类创建任务 String task_id = taskBean.createTask(param); // 创建任务
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
JSONObject param = new JSONObject(); // 插入区域出入库表
param.put("next_point_code", point_code); param.put("next_point_code", jsonTask.getString("next_point_code"));
param.put("qty", vehicle_num); param.put("qty", qty);
// 创建任务 param.put("task_id", task_id);
CallEmpVehicleTask taskBean = SpringContextHolder.getBean(CallEmpVehicleTask.class); param.put("io_type", "0");
String task_id = taskBean.createTask(param); JSONObject json = this.inCreateRegion(param);
// 回显任务载具类型
// 插入空载具作业记录表 jsonTask.put("vehicle_type", json.getString("vehicle_type"));
JSONObject jsonEmpParam = new JSONObject(); taskTab.update(jsonTask);
jsonEmpParam.put("vehicle_qty", vehicle_num);
jsonEmpParam.put("task_id", task_id); // 下发
jsonEmpParam.put("io_type", "1"); JSONObject jsonObject = taskBean.renotifyAcs(task_id);
this.createEmp(jsonEmpParam); if (StrUtil.equals(jsonObject.getString("status"), "200")) {
// 成功返回 更新任务状态
// 下发 jsonTask.put("task_status", "05");
JSONObject jsonObject = taskBean.renotifyAcs(task_id); taskTab.update(jsonTask);
if (StrUtil.equals(jsonObject.getString("status"), "200")) { } else {
// 成功返回 更新任务状态 throw new BadRequestException(jsonObject.getString("message"));
resuft.put("status", "200"); }
resuft.put("message", ""); } else if (StrUtil.equals(type, "3")) {
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0); // 3.油漆线申请空盘: 调用空托盘出库处理类创建任务
jsonTask.put("task_status", "05"); if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
taskTab.update(jsonTask);
} else { JSONObject param = new JSONObject();
throw new BadRequestException(jsonObject.getString("message")); param.put("next_point_code", point_code);
} param.put("qty", vehicle_num);
} else if (StrUtil.equals(type, "4")) { // 创建任务
// 4.油漆线申请物料: 调用物料出库库处理类创建任务 CallEmpVehicleTask taskBean = SpringContextHolder.getBean(CallEmpVehicleTask.class);
JSONObject param = new JSONObject(); String task_id = taskBean.createTask(param);
param.put("next_point_code", point_code); JSONObject jsonObject = taskBean.renotifyAcs(task_id);
param.put("io_type", "1"); if (StrUtil.equals(jsonObject.getString("status"), "200")) {
// 插入区域出库单 JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
JSONObject json = this.outCreateRegion(param); jsonTask.put("task_status", "05");
taskTab.update(jsonTask);
param.put("vehicle_type", json.getString("vehicle_type")); } else {
param.put("material_id", json.getString("material_id")); throw new BadRequestException(jsonObject.getString("message"));
param.put("create_mode", json.getString("create_mode")); }
param.put("iostorinv_id", json.getString("iostorinv_id")); } else if (StrUtil.equals(type, "4")) {
// 创建任务 // 4.油漆线申请物料: 调用物料出库库处理类创建任务
CallMaterialTask taskBean = SpringContextHolder.getBean(CallMaterialTask.class); JSONObject param = new JSONObject();
String task_id = taskBean.createTask(param); param.put("next_point_code", point_code);
param.put("io_type", "1");
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0); // 插入区域出库单
// 回显出库单起始点位、起始区域、任务id JSONObject json = this.outCreateRegion(param);
JSONObject jsonRegion = regionTab.query("iostorinv_id = '" + json.getString("iostorinv_id") + "'").uniqueResult(0);
jsonRegion.put("start_point_code", jsonTask.getString("start_point_code")); param.put("vehicle_type", json.getString("vehicle_type"));
Long start_region_id = SpringContextHolder.getBean(PointService.class).findByCode(jsonTask.getString("start_point_code")).getRegion_id(); param.put("material_id", json.getString("material_id"));
jsonRegion.put("start_region_id", String.valueOf(start_region_id)); param.put("create_mode", json.getString("create_mode"));
jsonRegion.put("task_id", Long.valueOf(task_id)); param.put("iostorinv_id", json.getString("iostorinv_id"));
regionTab.update(jsonRegion); // 创建任务
CallMaterialTask taskBean = SpringContextHolder.getBean(CallMaterialTask.class);
// 下发 String task_id = taskBean.createTask(param);
JSONObject jsonObject = taskBean.renotifyAcs(task_id);
if (StrUtil.equals(jsonObject.getString("status"), "200")) { JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
// 成功返回 更新任务状态 // 回显出库单起始点位、起始区域、任务id
resuft.put("status", "200"); JSONObject jsonRegion = regionTab.query("iostorinv_id = '" + json.getString("iostorinv_id") + "'").uniqueResult(0);
resuft.put("message", ""); jsonRegion.put("start_point_code", jsonTask.getString("start_point_code"));
jsonTask.put("task_status", "05"); Long start_region_id = SpringContextHolder.getBean(PointService.class).findByCode(jsonTask.getString("start_point_code")).getRegion_id();
taskTab.update(jsonTask); jsonRegion.put("start_region_id", String.valueOf(start_region_id));
} else { jsonRegion.put("task_id", Long.valueOf(task_id));
throw new BadRequestException(jsonObject.getString("message")); regionTab.update(jsonRegion);
}
} else if (StrUtil.equals(type, "5")) { // 下发
// 5.油漆线空盘入库: 调用空托盘入库处理类创建任务 JSONObject jsonObject = taskBean.renotifyAcs(task_id);
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空"); if (StrUtil.equals(jsonObject.getString("status"), "200")) {
jsonTask.put("task_status", "05");
JSONObject param = new JSONObject(); taskTab.update(jsonTask);
param.put("start_point_code", point_code); } else {
param.put("qty", vehicle_num); throw new BadRequestException(jsonObject.getString("message"));
// 创建任务 }
SendEmpVehicleTask taskBean = SpringContextHolder.getBean(SendEmpVehicleTask.class); } else if (StrUtil.equals(type, "5")) {
String task_id = taskBean.createTask(param); // 5.油漆线空盘入库: 调用空托盘入库处理类创建任务
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
// 插入空载具作业记录表
JSONObject jsonEmpParam = new JSONObject(); JSONObject param = new JSONObject();
jsonEmpParam.put("vehicle_qty", vehicle_num); param.put("start_point_code", point_code);
jsonEmpParam.put("task_id", task_id); param.put("qty", vehicle_num);
jsonEmpParam.put("io_type", "0"); // 创建任务
this.createEmp(jsonEmpParam); SendEmpVehicleTask taskBean = SpringContextHolder.getBean(SendEmpVehicleTask.class);
// 下发 String task_id = taskBean.createTask(param);
JSONObject jsonObject = taskBean.renotifyAcs(task_id); // 下发
if (StrUtil.equals(jsonObject.getString("status"), "200")) { JSONObject jsonObject = taskBean.renotifyAcs(task_id);
// 成功返回 更新任务状态 if (StrUtil.equals(jsonObject.getString("status"), "200")) {
resuft.put("status", "200"); JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
resuft.put("message", ""); jsonTask.put("task_status", "05");
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0); taskTab.update(jsonTask);
jsonTask.put("task_status", "05"); } else {
taskTab.update(jsonTask); throw new BadRequestException(jsonObject.getString("message"));
} else { }
throw new BadRequestException(jsonObject.getString("message"));
} } else if (StrUtil.equals(type, "6")) {
// 6.一楼空盘入库 (有载具号): 调用空托盘入库处理类创建任务
} else if (StrUtil.equals(type, "6")) { if (ObjectUtil.isEmpty(vehicle_code)) throw new BadRequestException("载具号不能为空");
// 6.一楼空盘入库 (有载具号): 调用空托盘入库处理类创建任务 JSONObject param = new JSONObject();
if (ObjectUtil.isEmpty(vehicle_code)) throw new BadRequestException("载具号不能为空");
JSONObject param = new JSONObject(); // 查询载具号对应的数量
JSONObject jsonVeQty = new JSONObject();
// 查询载具号对应的数量 if (ObjectUtil.isEmpty(qty)) {
JSONObject jsonVeQty = new JSONObject(); // jsonVeQty = veQtyTab.query("vehicle_code = '" + vehicle_code + "' and is_task = '0' order by create_time DESC").uniqueResult(0);
if (ObjectUtil.isEmpty(qty)) { if (ObjectUtil.isEmpty(jsonVeQty)) throw new BadRequestException("请先手持扫码");
// jsonVeQty = veQtyTab.query("vehicle_code = '" + vehicle_code + "' and is_task = '0' order by create_time DESC").uniqueResult(0); } else {
if (ObjectUtil.isEmpty(jsonVeQty)) throw new BadRequestException("请先手持扫码"); jsonVeQty.put("qty", qty);
} else { }
jsonVeQty.put("qty", qty);
} param.put("qty", jsonVeQty.getString("qty"));
param.put("start_point_code", point_code);
param.put("qty", jsonVeQty.getString("qty")); param.put("vehicle_code", vehicle_code);
param.put("start_point_code", point_code); // 创建任务
param.put("vehicle_code", vehicle_code); SendEmpVehicleTask taskBean = SpringContextHolder.getBean(SendEmpVehicleTask.class);
// 创建任务 String task_id = taskBean.createTask(param);
SendEmpVehicleTask taskBean = SpringContextHolder.getBean(SendEmpVehicleTask.class); // 下发
String task_id = taskBean.createTask(param); JSONObject jsonObject = taskBean.renotifyAcs(task_id);
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
// 插入空载具作业记录表 JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
JSONObject jsonEmpParam = new JSONObject(); jsonTask.put("task_status", "05");
jsonEmpParam.put("vehicle_qty", jsonVeQty.getString("qty")); taskTab.update(jsonTask);
jsonEmpParam.put("task_id", task_id); // 更新载具对应数量表
jsonEmpParam.put("io_type", "0"); // veQtyTab.update(jsonVeQty);
this.createEmp(jsonEmpParam); } else {
// 下发 throw new BadRequestException(jsonObject.getString("message"));
JSONObject jsonObject = taskBean.renotifyAcs(task_id); }
if (StrUtil.equals(jsonObject.getString("status"), "200")) { } else if (StrUtil.equals(type, "7")) {
// 成功返回 更新任务状态 JSONObject param = new JSONObject();
resuft.put("status", "200"); param.put("start_point_code", point_code);
resuft.put("message", ""); // 1.生成起点确定的任务
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0); SpringContextHolder.getBean(PointToPointTask.class).createTask(param);
jsonTask.put("task_status", "05"); } else if (StrUtil.equals(type, "8")) {
taskTab.update(jsonTask); // 8.豪凯自动线下料入库
// 更新载具对应数量表 JSONObject param = new JSONObject();
// veQtyTab.update(jsonVeQty); param.put("start_point_code", point_code);
} else { SendMaterialTask taskBean = SpringContextHolder.getBean(SendMaterialTask.class);
throw new BadRequestException(jsonObject.getString("message")); String task_id = taskBean.createTask(param);
}
} else if (StrUtil.equals(type, "7")) { JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
JSONObject param = new JSONObject(); // 插入区域出入库表
param.put("start_point_code", point_code); param.put("next_point_code", jsonTask.getString("next_point_code"));
// 1.生成起点确定的任务 if (ObjectUtil.isEmpty(qty)) {
SpringContextHolder.getBean(PointToPointTask.class).createTask(param); param.put("qty", "1"); // 为空先写死1
} else {
resuft.put("status", "200"); param.put("qty", qty);
resuft.put("message", ""); }
} else if (StrUtil.equals(type, "8")) { param.put("task_id", task_id);
// 8.豪凯自动线下料入库 param.put("io_type", "0");
JSONObject param = new JSONObject(); JSONObject json = this.inCreateRegion(param);
param.put("start_point_code", point_code); // 回显任务载具类型
SendMaterialTask taskBean = SpringContextHolder.getBean(SendMaterialTask.class); jsonTask.put("vehicle_type", json.getString("vehicle_type"));
String task_id = taskBean.createTask(param); taskTab.update(jsonTask);
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0); // 下发
// 插入区域出入库表 JSONObject jsonObject = taskBean.renotifyAcs(task_id);
param.put("next_point_code", jsonTask.getString("next_point_code")); if (StrUtil.equals(jsonObject.getString("status"), "200")) {
if (ObjectUtil.isEmpty(qty)) { jsonTask.put("task_status", "05");
param.put("qty", "1"); // 为空先写死1 taskTab.update(jsonTask);
} else { } else {
param.put("qty", qty); throw new BadRequestException(jsonObject.getString("message"));
}
param.put("task_id", task_id);
param.put("io_type", "0");
JSONObject json = this.inCreateRegion(param);
// 回显任务载具类型
jsonTask.put("vehicle_type", json.getString("vehicle_type"));
taskTab.update(jsonTask);
// 下发
JSONObject jsonObject = taskBean.renotifyAcs(task_id);
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
// 成功返回 更新任务状态
resuft.put("status", "200");
resuft.put("message", "");
jsonTask.put("task_status", "05");
taskTab.update(jsonTask);
} else {
throw new BadRequestException(jsonObject.getString("message"));
}
} }
} catch (Exception e) {
resuft.put("status", ((BadRequestException) e).getStatus());
resuft.put("message", e.getMessage());
} }
return resuft; return null;
} }
@LokiLog(type = LokiLogType.ACS_TO_LMS)
@Transactional(rollbackFor = Exception.class)
public void createEmp(JSONObject json) {
String vehicle_qty = json.getString("vehicle_qty");
String task_id = json.getString("task_id");
String io_type = json.getString("io_type");
WQLObject empTab = WQLObject.getWQLObject("st_ivt_EmptyVehicleRecord");// 空载具作业记录表
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");// 空载具作业记录表
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
JSONObject jsonEmp = new JSONObject();
jsonEmp.put("record_uuid", IdUtil.getSnowflake(1, 1).nextId());
jsonEmp.put("bill_code", CodeUtil.getNewCode("KZJ_BILL_CODE"));
jsonEmp.put("io_type", io_type);
jsonEmp.put("bill_status", "20");
jsonEmp.put("vehicle_qty", vehicle_qty);
jsonEmp.put("start_point_code", jsonTask.getString("start_point_code"));
Long start_region_id = SpringContextHolder.getBean(PointService.class).findByCode(jsonTask.getString("start_point_code")).getRegion_id();
jsonEmp.put("start_region_id", start_region_id);
jsonEmp.put("next_point_code", jsonTask.getString("next_point_code"));
Long next_region_id = SpringContextHolder.getBean(PointService.class).findByCode(jsonTask.getString("next_point_code")).getRegion_id();
jsonEmp.put("end_region_id", next_region_id);
jsonEmp.put("task_uuid", task_id);
jsonEmp.put("create_id", SecurityUtils.getCurrentUserId());
jsonEmp.put("create_name", SecurityUtils.getCurrentNickName());
jsonEmp.put("create_time", DateUtil.now());
empTab.insert(jsonEmp);
}
@LokiLog(type = LokiLogType.ACS_TO_LMS) @LokiLog(type = LokiLogType.ACS_TO_LMS)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public JSONObject inCreateRegion(JSONObject json) { public JSONObject inCreateRegion(JSONObject json) {
@@ -462,7 +374,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
String io_type = json.getString("io_type"); String io_type = json.getString("io_type");
WQLObject regionTab = WQLObject.getWQLObject("SCH_IVT_regionIO"); WQLObject regionTab = WQLObject.getWQLObject("SCH_IVT_regionIO");
WQLObject orderTab = WQLObject.getWQLObject("mps_bd_produceshiftorder"); WQLObject orderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder");
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
@@ -505,13 +417,14 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
resuft.put("create_mode", jsonRegion.getString("create_mode")); resuft.put("create_mode", jsonRegion.getString("create_mode"));
return resuft; return resuft;
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public JSONObject outCreateRegion(JSONObject json) { public JSONObject outCreateRegion(JSONObject json) {
String next_point_code = json.getString("next_point_code"); String next_point_code = json.getString("next_point_code");
String io_type = json.getString("io_type"); String io_type = json.getString("io_type");
WQLObject regionTab = WQLObject.getWQLObject("SCH_IVT_regionIO"); WQLObject regionTab = WQLObject.getWQLObject("SCH_IVT_regionIO");
WQLObject orderTab = WQLObject.getWQLObject("mps_bd_produceshiftorder"); WQLObject orderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder");
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
JSONObject jsonRegion = new JSONObject(); JSONObject jsonRegion = new JSONObject();

View File

@@ -83,7 +83,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
@Override @Override
public List<ProduceshiftorderDto> queryAll(Map whereJson) { public List<ProduceshiftorderDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder"); WQLObject wo = WQLObject.getWQLObject("PDM_BD_WorkOrder");
JSONArray arr = wo.query().getResultJSONArray(0); JSONArray arr = wo.query().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(ProduceshiftorderDto.class); if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(ProduceshiftorderDto.class);
return null; return null;
@@ -91,7 +91,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
@Override @Override
public ProduceshiftorderDto findById(Long workorder_id) { public ProduceshiftorderDto findById(Long workorder_id) {
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder"); WQLObject wo = WQLObject.getWQLObject("PDM_BD_WorkOrder");
JSONObject json = wo.query("workorder_id = '" + workorder_id + "'").uniqueResult(0); JSONObject json = wo.query("workorder_id = '" + workorder_id + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) { if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(ProduceshiftorderDto.class); return json.toJavaObject(ProduceshiftorderDto.class);
@@ -101,7 +101,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
@Override @Override
public ProduceshiftorderDto findByCode(String code) { public ProduceshiftorderDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder"); WQLObject wo = WQLObject.getWQLObject("PDM_BD_WorkOrder");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0); JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) { if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(ProduceshiftorderDto.class); return json.toJavaObject(ProduceshiftorderDto.class);
@@ -128,7 +128,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
dto.setUpdate_optname(nickName); dto.setUpdate_optname(nickName);
dto.setUpdate_time(now); dto.setUpdate_time(now);
dto.setCreate_time(now); dto.setCreate_time(now);
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder"); WQLObject wo = WQLObject.getWQLObject("PDM_BD_WorkOrder");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
json.put("sysdeptid", deptId); json.put("sysdeptid", deptId);
json.put("syscompanyid", deptId); json.put("syscompanyid", deptId);
@@ -149,7 +149,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
dto.setUpdate_optid(currentUserId); dto.setUpdate_optid(currentUserId);
dto.setUpdate_optname(nickName); dto.setUpdate_optname(nickName);
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder"); WQLObject wo = WQLObject.getWQLObject("PDM_BD_WorkOrder");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
wo.update(json); wo.update(json);
} }
@@ -161,7 +161,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
String nickName = SecurityUtils.getCurrentNickName(); String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now(); String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder"); WQLObject wo = WQLObject.getWQLObject("PDM_BD_WorkOrder");
for (Long workorder_id : ids) { for (Long workorder_id : ids) {
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("workorder_id", String.valueOf(workorder_id)); param.put("workorder_id", String.valueOf(workorder_id));
@@ -180,7 +180,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
String nickName = SecurityUtils.getCurrentNickName(); String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now(); String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder"); WQLObject wo = WQLObject.getWQLObject("PDM_BD_WorkOrder");
JSONObject json = wo.query("workorder_id = '" + param.getString("workorder_id") + "'").uniqueResult(0); JSONObject json = wo.query("workorder_id = '" + param.getString("workorder_id") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(json.getString("device_id"))) throw new BadRequestException("请先绑定设备"); if (ObjectUtil.isEmpty(json.getString("device_id"))) throw new BadRequestException("请先绑定设备");

View File

@@ -41,7 +41,6 @@ public class CallEmpVehicleTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateTaskStatus(JSONObject taskObj, String status) { public void updateTaskStatus(JSONObject taskObj, String status) {
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
WQLObject empTab = WQLObject.getWQLObject("st_ivt_EmptyVehicleRecord");
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
String task_id = taskObj.getString("task_id"); String task_id = taskObj.getString("task_id");
@@ -77,9 +76,8 @@ public class CallEmpVehicleTask extends AbstractAcsTask {
if (ObjectUtil.isEmpty(start_point_code)) throw new BadRequestException("未找到可用点位:" + next_point_code); if (ObjectUtil.isEmpty(start_point_code)) throw new BadRequestException("未找到可用点位:" + next_point_code);
// 1.更新点位数量 2.解锁点位 // 1.更新点位数量 2.解锁点位
JSONObject jsonEmp = empTab.query("task_uuid = '" + task_id + "'").uniqueResult(0);
int vehicle_qty = JSONObject.parseObject(JSON.toJSONString(start_point_code)).getIntValue("vehicle_qty"); int vehicle_qty = JSONObject.parseObject(JSON.toJSONString(start_point_code)).getIntValue("vehicle_qty");
BigDecimal vehicle_qty_point = NumberUtil.sub(String.valueOf(vehicle_qty), String.valueOf(jsonEmp.getIntValue("vehicle_qty"))); BigDecimal vehicle_qty_point = NumberUtil.sub(String.valueOf(vehicle_qty), String.valueOf(1));
start_point_code.setVehicle_qty(Integer.valueOf(vehicle_qty_point.toString())); start_point_code.setVehicle_qty(Integer.valueOf(vehicle_qty_point.toString()));
if (StrUtil.equals(vehicle_qty_point.toString(), "0")) { if (StrUtil.equals(vehicle_qty_point.toString(), "0")) {
@@ -88,13 +86,6 @@ public class CallEmpVehicleTask extends AbstractAcsTask {
} }
start_point_code.setLock_type("00"); start_point_code.setLock_type("00");
pointTab.update(JSONObject.parseObject(JSON.toJSONString(start_point_code))); pointTab.update(JSONObject.parseObject(JSON.toJSONString(start_point_code)));
// 完成单据状态
jsonEmp.put("bill_status", "50");
jsonEmp.put("update_optid", SecurityUtils.getCurrentUserId());
jsonEmp.put("update_optname", SecurityUtils.getCurrentUsername());
jsonEmp.put("update_time", DateUtil.now());
empTab.update(jsonEmp);
} }
} }
@@ -112,13 +103,11 @@ public class CallEmpVehicleTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String createTask(JSONObject form) { public String createTask(JSONObject form) {
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
WQLObject empTab = WQLObject.getWQLObject("st_ivt_EmptyVehicleRecord");
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
String start_point_code = form.getString("start_point_code"); String start_point_code = form.getString("start_point_code");
String next_point_code = form.getString("next_point_code"); String next_point_code = form.getString("next_point_code");
String qty = form.getString("qty"); String qty = form.getString("qty");
String record_uuid = form.getString("record_uuid");
String vehicle_type = form.getString("vehicle_type"); String vehicle_type = form.getString("vehicle_type");
// 出库终点不能为空 // 出库终点不能为空
@@ -127,7 +116,7 @@ public class CallEmpVehicleTask extends AbstractAcsTask {
} else { } else {
// 判断终点是否有正在执行的任务 // 判断终点是否有正在执行的任务
JSONObject beforTaskObj = taskTab.query("is_delete='0' and next_point_code='" + next_point_code + "' and task_status <>'" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0); JSONObject beforTaskObj = taskTab.query("is_delete='0' and next_point_code='" + next_point_code + "' and task_status <>'" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(beforTaskObj)) throw new BadRequestException("存在指令号为'" + beforTaskObj.getString("task_code") + "' 未完成!"); if (ObjectUtil.isNotEmpty(beforTaskObj)) throw new BadRequestException("存在任务号为'" + beforTaskObj.getString("task_code") + "' 未完成!");
} }
// 载具数量不能为空 // 载具数量不能为空
if (ObjectUtil.isEmpty(qty)) throw new BadRequestException("载具数量不能为空"); if (ObjectUtil.isEmpty(qty)) throw new BadRequestException("载具数量不能为空");
@@ -174,12 +163,6 @@ public class CallEmpVehicleTask extends AbstractAcsTask {
jsonPoint.put("lock_type", "02"); jsonPoint.put("lock_type", "02");
pointTab.update(jsonPoint); pointTab.update(jsonPoint);
// 更新空载具单据状态
if (ObjectUtil.isNotEmpty(record_uuid)) {
JSONObject jsonEmp = empTab.query("record_uuid ='" + record_uuid + "'").uniqueResult(0);
jsonEmp.put("bill_status","20");
empTab.update(jsonEmp);
}
return task_id; return task_id;
} }
@@ -209,7 +192,7 @@ public class CallEmpVehicleTask extends AbstractAcsTask {
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
WQLObject regionTab = WQLObject.getWQLObject("SCH_BASE_Region"); WQLObject regionTab = WQLObject.getWQLObject("SCH_BASE_Region");
WQLObject orderTab = WQLObject.getWQLObject("mps_bd_produceshiftorder"); WQLObject orderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder");
// 根据终点区域判断优先的起点区域 // 根据终点区域判断优先的起点区域
JSONObject jsonPointEnd = pointTab.query("point_code = '" + next_point_code + "'").uniqueResult(0); JSONObject jsonPointEnd = pointTab.query("point_code = '" + next_point_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonPointEnd)) throw new BadRequestException("终点点位不存在"); if (ObjectUtil.isEmpty(jsonPointEnd)) throw new BadRequestException("终点点位不存在");

View File

@@ -218,7 +218,7 @@ public class SendEmpVehicleTask extends AbstractAcsTask {
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); // 点位表 WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); // 点位表
WQLObject regionTab = WQLObject.getWQLObject("SCH_BASE_Region"); // 区域表 WQLObject regionTab = WQLObject.getWQLObject("SCH_BASE_Region"); // 区域表
WQLObject orderTab = WQLObject.getWQLObject("mps_bd_produceshiftorder"); //空载具记录表 WQLObject orderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder"); //空载具记录表
WQLObject velicleTab = WQLObject.getWQLObject("md_pb_storagevehicleinfo"); // 载具表 WQLObject velicleTab = WQLObject.getWQLObject("md_pb_storagevehicleinfo"); // 载具表
// 根据起点区域判断优先的终点区域 // 根据起点区域判断优先的终点区域
JSONObject jsonPointStart = pointTab.query("point_code = '" + start_point_code + "'").uniqueResult(0); JSONObject jsonPointStart = pointTab.query("point_code = '" + start_point_code + "'").uniqueResult(0);

View File

@@ -198,7 +198,7 @@ public class RegionioInServiceImpl implements RegionioInService {
String iostorinv_id = jsonObject.getString("iostorinv_id"); String iostorinv_id = jsonObject.getString("iostorinv_id");
WQLObject wo = WQLObject.getWQLObject("SCH_IVT_regionIO"); WQLObject wo = WQLObject.getWQLObject("SCH_IVT_regionIO");
WQLObject orderTab = WQLObject.getWQLObject("mps_bd_produceshiftorder"); WQLObject orderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder");
JSONObject jsonIn = wo.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0); JSONObject jsonIn = wo.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
String start_point_code = jsonIn.getString("start_point_code"); String start_point_code = jsonIn.getString("start_point_code");