fix: 修复了一些bug

This commit is contained in:
2023-05-19 10:00:59 +08:00
parent b81b19dd91
commit 36ee02b1d7
15 changed files with 359 additions and 123 deletions

View File

@@ -18,6 +18,7 @@ import org.nl.modules.security.service.dto.AuthUserDto;
import org.nl.modules.system.service.RoleService;
import org.nl.modules.system.service.UserService;
import org.nl.modules.system.service.dto.UserDto;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;

View File

@@ -50,7 +50,7 @@ public class VehicleServiceImpl implements VehicleService {
map.put("vehicle_type", MapUtil.getStr(whereJson, "vehicle_type"));
if (ObjectUtil.isNotEmpty(vehicle_code)) map.put("vehicle_code","%"+vehicle_code+"%");
JSONObject json = WQL.getWO("QMD_PB_VEHICLE").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "create_time DESC");
JSONObject json = WQL.getWO("QMD_PB_VEHICLE").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "vehicle_code");
return json;
}

View File

@@ -264,17 +264,17 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
JSONObject param = new JSONObject();
// 查询载具号对应的数量
JSONObject jsonVeQty = new JSONObject();
if (ObjectUtil.isEmpty(vehicle_num)) {
if (ObjectUtil.isEmpty(jsonVeQty)) throw new BadRequestException("请先手持扫码");
} else {
jsonVeQty.put("qty", vehicle_num);
}
// JSONObject jsonVeQty = new JSONObject();
// if (ObjectUtil.isEmpty(vehicle_num)) {
// if (ObjectUtil.isEmpty(jsonVeQty)) throw new BadRequestException("请先手持扫码");
// } else {
// jsonVeQty.put("qty", vehicle_num);
// }
param.put("qty", jsonVeQty.getString("qty"));
// param.put("qty", jsonVeQty.getString("qty"));
param.put("point_code1", point_code);
param.put("vehicle_code", vehicle_code);
param.put("vehicle_type", vehicle_type);
// param.put("vehicle_type", vehicle_type);
// 创建任务
HtSendEmpVehicleTask taskBean = SpringContextHolder.getBean(HtSendEmpVehicleTask.class);
String task_id = taskBean.createTask(param);

View File

@@ -0,0 +1,36 @@
package org.nl.wms.pda.group;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.wms.pda.group.service.GroupService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author: lyd
* @Description: 组盘
* @Date: 2023/4/18
*/
@Slf4j
@RestController
@RequestMapping("/api/pda/emptyAndQty")
@RequiredArgsConstructor
@Api(tags = "手持:系统授权接口")
public class GroupController {
private final GroupService groupService;
// 组盘
@ApiOperation("手持组盘")
@PostMapping(value = "/confirm")
@SaIgnore
public ResponseEntity<Object> confirm(@RequestBody JSONObject object) {
return new ResponseEntity<>(groupService.confirm(object), HttpStatus.OK);
}
}

View File

@@ -0,0 +1,16 @@
package org.nl.wms.pda.group.service;
import com.alibaba.fastjson.JSONObject;
/**
* @Author: lyd
* @Description:
* @Date: 2023/4/18
*/
public interface GroupService {
/**
* 确认组盘
* @param object
*/
JSONObject confirm(JSONObject object);
}

View File

@@ -0,0 +1,61 @@
package org.nl.wms.pda.group.service.impl;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.pda.group.service.GroupService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @Author: lyd
* @Description:
* @Date: 2023/4/18
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class GroupServiceImpl implements GroupService {
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject confirm(JSONObject object) {
JSONObject result = new JSONObject();
WQLObject groupTab = WQLObject.getWQLObject("md_pb_group");
WQLObject vehicleTab = WQLObject.getWQLObject("md_pb_vehicle");
String qty = object.getString("qty");
String vehicleCode = object.getString("vehicle_code");
if (ObjectUtil.isEmpty(qty) || ObjectUtil.isEmpty(vehicleCode)) {
result.put("result", "");
result.put("code", "0");
result.put("desc", "载具编码或载具数量不能为空");
return result;
}
JSONObject jsonObject = vehicleTab.query("vehicle_code = '" + vehicleCode + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonObject)) {
result.put("result", "");
result.put("code", "0");
result.put("desc", "载具不存在");
return result;
}
// 判断是否存在
JSONObject res = groupTab.query("vehicle_code = '" + vehicleCode + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(res)) {
groupTab.delete(res);
}
// 插入数据
JSONObject insert = new JSONObject();
insert.put("group_id", IdUtil.getSnowflake(1,1).nextIdStr());
insert.put("vehicle_code", vehicleCode);
insert.put("vehicle_qty", qty);
insert.put("vehicle_type", jsonObject.getString("vehicle_type"));
groupTab.insert(insert);
result.put("result", "");
result.put("code", "1");
result.put("desc", "操作成功");
return result;
}
}

View File

@@ -250,7 +250,7 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("")
.acs_task_type("2")
.task_name("暂存位->叠盘架空载具")
.task_name("B暂存位->B叠盘架空载具")
.task_status(TaskStatusEnum.START_AND_POINT.getCode())
.point_code1(jsonZcKtp.getString("point_code"))
.point_code2(jsonDpjStart2.getString("point_code"))
@@ -269,14 +269,14 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
} else {
// 空托盘暂存区没有就到养生A区找: 先找到出库等待点
JSONObject jsonEmpWait = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() +
"' and col_num = '9' and can_vehicle_type = '" + vehicle_type +
"' and col_num in ('9', '13') and can_vehicle_type = '" + vehicle_type +
"' and is_used = '1' and is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonEmpWait)) continue;
JSONObject jsonStartPoint = pointTab.query("region_id = '" + jsonEmpWait.getString("region_id") +
"' and block_num = '" + jsonEmpWait.getString("block_num") +
"' and row_num = '" + jsonEmpWait.getString("row_num") +
"' and point_status = '2' and lock_type = '1' order by out_empty_seq DESC").uniqueResult(0);
"' and point_status = '2' and lock_type = '1'", "out_empty_seq DESC").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonStartPoint)) continue;
// 判断找到的空载具点位是否是等待点
@@ -287,7 +287,7 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("")
.acs_task_type("2")
.task_name("养生A区->叠盘架空载具")
.task_name("养生A区->B叠盘架空载具")
.task_status(TaskStatusEnum.START_AND_POINT.getCode())
.point_code1(jsonStartPoint.getString("point_code"))
.point_code2(jsonDpjStart2.getString("point_code"))
@@ -312,7 +312,7 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("")
.acs_task_type("2")
.task_name("养生A区->叠盘架空载具")
.task_name("养生A区->B叠盘架空载具")
.task_status(TaskStatusEnum.START_AND_POINT.getCode())
.point_code1(jsonStartPoint.getString("point_code"))
.point_code2(jsonDpjStart2.getString("point_code"))

View File

@@ -62,35 +62,43 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
if (StrUtil.equals(jsonEnd.getString("region_id"), RegionTypeEnum.DPJQB.getId())) {
JSONObject jsonStart = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
// 判断此起点是否是等待点
if (!StrUtil.equals(jsonStart.getString("col_num"), "9")) {
if (!StrUtil.equals(jsonStart.getString("col_num"), "9") &&
!StrUtil.equals(jsonStart.getString("col_num"), "13")) {
// 如果不是等待点更新等待点状态
JSONObject jsonEmpWait = pointTab.query("region_id = '" + jsonStart.getString("region_id") +
"' and block_num = '" + jsonStart.getString("block_num") +
"' and row_num = '" + jsonStart.getString("row_num") +
"' and col_num = '9'").uniqueResult(0);
"' and can_vehicle_type = '" + jsonTask.getString("vehicle_type") +
"' and col_num in ('9', '13')").uniqueResult(0);
jsonEmpWait.put("lock_type", "1");
jsonEmpWait.put("update_time", DateUtil.now());
pointTab.update(jsonEmpWait);
}
jsonStart.put("lock_type", "1");
jsonStart.put("update_time", DateUtil.now());
pointTab.update(jsonStart);
// 更新终点(叠盘架状态)
jsonEnd.put("lock_type", "1");
jsonEnd.put("update_time", DateUtil.now());
pointTab.update(jsonEnd);
if (ObjectUtil.isNotEmpty(jsonStart)) {
jsonStart.put("lock_type", "1");
jsonStart.put("update_time", DateUtil.now());
pointTab.update(jsonStart);
}
if (ObjectUtil.isNotEmpty(jsonEnd)) {
// 更新终点(叠盘架状态)
jsonEnd.put("lock_type", "1");
jsonEnd.put("update_time", DateUtil.now());
pointTab.update(jsonEnd);
}
} else {
// 终点在油漆线
JSONObject jsonStart = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
jsonStart.put("lock_type", "1");
jsonStart.put("update_time", DateUtil.now());
pointTab.update(jsonStart);
if (ObjectUtil.isNotEmpty(jsonStart)) {
jsonStart.put("lock_type", "1");
jsonStart.put("update_time", DateUtil.now());
pointTab.update(jsonStart);
}
}
taskTab.delete("task_id = '" + task_id + "'");
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
jsonTask.put("update_time", DateUtil.now());
jsonTask.put("remark", "任务取消");
taskTab.update(jsonTask);
}
if (StrUtil.equals(status, "1")) {
@@ -107,9 +115,6 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
* 1.终点为叠盘架更新叠盘架数量、起点点位状态、等待位状态,更新任务组状态
* 2.终点为油漆线,更新起点载具数量
*/
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
// 判断终点在哪里
String point_code1 = jsonTask.getString("point_code1");
@@ -123,12 +128,14 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
// 判断起点是不是养生A区空载具
if (StrUtil.equals(jsonStart.getString("region_id"), RegionTypeEnum.YSAQKTPQ01.getId())) {
// 判断此起点是否是等待点
if (!StrUtil.equals(jsonStart.getString("col_num"), "9")) {
if (!StrUtil.equals(jsonStart.getString("col_num"), "9") &&
!StrUtil.equals(jsonStart.getString("col_num"), "13")) {
// 如果不是等待点更新等待点状态
JSONObject jsonEmpWait = pointTab.query("region_id = '" + jsonStart.getString("region_id") +
"' and block_num = '" + jsonStart.getString("block_num") +
"' and row_num = '" + jsonStart.getString("row_num") +
"' and col_num = '9'").uniqueResult(0);
"' and can_vehicle_type = '" + jsonTask.getString("vehicle_type") +
"' and col_num in ('9', '13')").uniqueResult(0);
jsonEmpWait.put("lock_type", "1");
jsonEmpWait.put("update_time", DateUtil.now());
@@ -136,21 +143,25 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
}
}
jsonStart.put("point_status", "1");
jsonStart.put("lock_type", "1");
jsonStart.put("vehicle_type", "");
jsonStart.put("vehicle_code", "");
jsonStart.put("vehicle_qty", 0);
jsonStart.put("update_time", DateUtil.now());
pointTab.update(jsonStart);
if (ObjectUtil.isNotEmpty(jsonStart)) {
jsonStart.put("point_status", "1");
jsonStart.put("lock_type", "1");
jsonStart.put("vehicle_type", "");
jsonStart.put("vehicle_code", "");
jsonStart.put("vehicle_qty", 0);
jsonStart.put("update_time", DateUtil.now());
pointTab.update(jsonStart);
}
// 更新终点(叠盘架状态)
jsonEnd.put("vehicle_qty", NumberUtil.add(jsonEnd.getString("vehicle_qty"),jsonTask.getString("vehicle_qty")));
jsonEnd.put("lock_type", "1");
jsonEnd.put("point_status", "2");
jsonEnd.put("update_time", DateUtil.now());
jsonEnd.put("vehicle_type", jsonTask.getString("vehicle_type"));
pointTab.update(jsonEnd);
if (ObjectUtil.isNotEmpty(jsonEnd)) {
// 更新终点(叠盘架状态)
jsonEnd.put("vehicle_qty", NumberUtil.add(jsonEnd.getString("vehicle_qty"),jsonTask.getString("vehicle_qty")));
jsonEnd.put("lock_type", "1");
jsonEnd.put("point_status", "2");
jsonEnd.put("update_time", DateUtil.now());
jsonEnd.put("vehicle_type", jsonTask.getString("vehicle_type"));
pointTab.update(jsonEnd);
}
// 更新任务组状态
JSONObject jsonTask2 = taskTab.query("task_group_id = '" + jsonTask.getString("task_group_id") + "' and task_id <> '" + jsonTask.getString("task_id") + "'").uniqueResult(0);
@@ -165,15 +176,22 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
} else {
// 终点在油漆线: 更新起点(叠盘架)数量
JSONObject jsonStart = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
jsonStart.put("vehicle_qty",NumberUtil.sub(jsonStart.getString("vehicle_qty"),jsonTask.getString("vehicle_qty")));
jsonStart.put("lock_type", "1");
if (StrUtil.equals(jsonStart.getString("vehicle_qty"),"0")) {
jsonStart.put("point_status", "1");
jsonStart.put("vehicle_type", "");
if (ObjectUtil.isNotEmpty(jsonStart)) {
jsonStart.put("vehicle_qty",NumberUtil.sub(jsonStart.getString("vehicle_qty"),jsonTask.getString("vehicle_qty")));
jsonStart.put("lock_type", "1");
if (StrUtil.equals(jsonStart.getString("vehicle_qty"),"0")) {
jsonStart.put("point_status", "1");
jsonStart.put("vehicle_type", "");
}
jsonStart.put("update_time", DateUtil.now());
pointTab.update(jsonStart);
}
jsonStart.put("update_time", DateUtil.now());
pointTab.update(jsonStart);
}
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
jsonTask.put("update_time", DateUtil.now());
jsonTask.put("remark", "任务完成");
taskTab.update(jsonTask);
}
}
@@ -190,7 +208,7 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
for (int i = 0; i < taskArr.size(); i++) {
// 创建任务
JSONObject jsonTask = taskArr.getJSONObject(i);
String vehicle_type = jsonTask.getString("vehicle_type");
String vehicle_type = jsonTask.getString("vehicle_type"); // 需要的载具个数
// 更新碟盘架
Map query = new HashMap<>();
query.put("flag", "2");
@@ -203,9 +221,14 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
if (ObjectUtil.isNotEmpty(jsonDpjStart)) {
// 判断叠盘架是否有任务 有就下一个任务
boolean is_point = this.isTask(jsonDpjStart.getString("point_code"));
if (!is_point) continue;
if (!is_point) {
jsonTask.put("remark", "当前叠盘架有任务");
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
continue;
}
// 判断叠盘架数量是否 < 需求数量 (暂时只能<需求数量)
// 判断叠盘架数量是否 < 需求数量 (暂时只能<需求数量) 就把剩下的都搬走
if (jsonDpjStart.getIntValue("vehicle_qty") < jsonTask.getIntValue("vehicle_qty")) {
jsonTask.put("vehicle_qty", jsonDpjStart.getIntValue("vehicle_qty"));
}
@@ -217,6 +240,7 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
// 更新任务起点
jsonTask.put("point_code1", jsonDpjStart.getString("point_code"));
jsonTask.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
@@ -227,7 +251,12 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
// 判断叠盘架是否有任务
boolean is_point = this.isTask(jsonDpjStart2.getString("point_code"));
if (!is_point) continue;
if (!is_point) {
jsonTask.put("remark", "当前叠盘架有任务");
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
continue;
}
// 找叠盘架暂存位是否有空托盘
JSONObject map = new JSONObject();
@@ -242,7 +271,7 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("")
.acs_task_type("2")
.task_name("暂存位>叠盘架空载具")
.task_name("A暂存位->A叠盘架空载具")
.task_status(TaskStatusEnum.START_AND_POINT.getCode())
.point_code1(jsonZcKtp.getString("point_code"))
.point_code2(jsonDpjStart2.getString("point_code"))
@@ -261,15 +290,25 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
} else {
// 空托盘暂存区没有就到养生A区找: 先找到出库等待点
JSONObject jsonEmpWait = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() +
"' and col_num = '9' and can_vehicle_type = '" + vehicle_type +
"' and col_num in ('9', '13') and can_vehicle_type = '" + vehicle_type +
"' and is_used = '1' and is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonEmpWait)) continue;
if (ObjectUtil.isEmpty(jsonEmpWait)) {
jsonTask.put("remark", "出库等待点异常");
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
continue;
}
JSONObject jsonStartPoint = pointTab.query("region_id = '" + jsonEmpWait.getString("region_id") +
"' and block_num = '" + jsonEmpWait.getString("block_num") +
"' and row_num = '" + jsonEmpWait.getString("row_num") +
"' and point_status = '2' and lock_type = '1' order by out_empty_seq DESC").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonStartPoint)) continue;
"' and point_status = '2' and lock_type = '1'", "out_empty_seq DESC").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonStartPoint)) {
jsonTask.put("remark", "养生A区无所需载具");
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
continue;
}
// 判断找到的空载具点位是否是等待点
if (StrUtil.equals(jsonEmpWait.getString("point_code"), jsonStartPoint.getString("point_code"))) {
@@ -279,7 +318,7 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("")
.acs_task_type("2")
.task_name("养生A区>叠盘架空载具")
.task_name("养生A区->A叠盘架空载具")
.task_status(TaskStatusEnum.START_AND_POINT.getCode())
.point_code1(jsonStartPoint.getString("point_code"))
.point_code2(jsonDpjStart2.getString("point_code"))
@@ -324,8 +363,9 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
jsonEmpWait.put("lock_type", "2");
pointTab.update(jsonEmpWait);
} else {
continue;
jsonTask.put("remark", "叠盘架/缓存区/养生A区均无所需载具");
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
}
}
}
@@ -354,10 +394,9 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
String point_code2 = form.getString("point_code2");
String sub_device_code = point_code2.substring(0, point_code2.indexOf("_"));
String point_code2 = form.getString("point_code2");// YQX01_KS
String device_code = pointTab.query("point_code = '" + sub_device_code + "'").uniqueResult(0).getString("device_code");
String device_code = pointTab.query("point_code = '" + point_code2 + "'").uniqueResult(0).getString("device_code");
JSONObject workOrderObj = workOrderTab.query("device_code = '" + device_code + "' and order_status = '3' and is_delete ='0'").uniqueResult(0);
if (ObjectUtil.isEmpty(workOrderObj)) throw new BadRequestException("该设备当前未生产或者已删除");
@@ -372,7 +411,7 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
.priority("8")
.vehicle_code(form.getString("vehicle_code"))
.vehicle_type(workOrderObj.getString("vehicle_type"))
.vehicle_qty(1)
.vehicle_qty(8)
.task_group_id(org.nl.wms.util.IdUtil.getLongId())
.handle_class(THIS_CLASS)
.create_time(DateUtil.now())

View File

@@ -66,6 +66,7 @@
FROM
SCH_BASE_Point
WHERE
1 = 1
OPTION 输入.region_code <> ""
region_code = 输入.region_code
ENDOPTION

View File

@@ -37,6 +37,7 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
public void updateTaskStatus(JSONObject taskObj, String status) {
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
WQLObject groupTab = WQLObject.getWQLObject("md_pb_group");
String task_id = taskObj.getString("task_id");
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
@@ -46,21 +47,30 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
if (StrUtil.equals(jsonTask.getString("task_status"), TaskStatusEnum.FINISHED.getCode())) {
throw new BadRequestException("已完成不能取消!");
}
String point_code3 = jsonTask.getString("point_code3");
String point_code1 = jsonTask.getString("point_code1");
String point_code2 = jsonTask.getString("point_code2");
if (ObjectUtil.isNotEmpty(point_code3)) {
JSONObject jsonPoint3 = pointTab.query("point_code ='" + point_code3 + "'").uniqueResult(0);
jsonPoint3.put("point_status", "1");
jsonPoint3.put("update_time", DateUtil.now());
pointTab.update(jsonPoint3);
if (ObjectUtil.isNotEmpty(point_code1)) {
JSONObject jsonPoint1 = pointTab.query("point_code ='" + point_code1 + "'").uniqueResult(0);
jsonPoint1.put("point_status", "1");
jsonPoint1.put("lock_type", "1");
jsonPoint1.put("update_time", DateUtil.now());
pointTab.update(jsonPoint1);
}
if (ObjectUtil.isNotEmpty(point_code2)) {
JSONObject jsonPoint2 = pointTab.query("point_code ='" + point_code2 + "'").uniqueResult(0);
jsonPoint2.put("point_status", "1");
jsonPoint2.put("lock_type", "1");
jsonPoint2.put("update_time", DateUtil.now());
pointTab.update(jsonPoint2);
}
taskTab.delete("task_id = '" + task_id + "'");
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
jsonTask.put("update_time", DateUtil.now());
jsonTask.put("remark", "任务取消");
taskTab.update(jsonTask);
// 删除组盘表数据
if (ObjectUtil.isNotEmpty(jsonTask.getString("vehicle_code"))) {
groupTab.delete("vehicle_code = '" + jsonTask.getString("vehicle_code") + "'");
}
}
if (StrUtil.equals(status, "1")) {
@@ -115,6 +125,10 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
endPoint.put("update_time", DateUtil.now());
pointTab.update(endPoint);
}
// 删除组盘表数据
if (ObjectUtil.isNotEmpty(jsonTask.getString("vehicle_code"))) {
groupTab.delete("vehicle_code = '" + jsonTask.getString("vehicle_code") + "'");
}
}
}
@@ -129,17 +143,21 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
*/
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
//任务表【SCH_BASE_Task】
//判断当前点是否有未完成的任务
String point_code1 = form.getString("point_code1");
JSONObject taskObj = taskTab.query("is_delete='0' and point_code1 = '" + point_code1 + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(taskObj)) throw new BadRequestException("当前点位" + point_code1 + "存在未完成的任务");
SchTaskDto dto = SchTaskDto.builder().task_id(org.nl.wms.util.IdUtil.getLongId())
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("")
.acs_task_type("2")
.task_name("电梯送空载具")
.task_status(TaskStatusEnum.SURE_START.getCode())
.point_code1(point_code1)
.vehicle_code(form.getString("vehicle_code"))
.vehicle_type(form.getString("vehicle_type"))
.vehicle_qty(form.getIntValue("qty"))
.handle_class(THIS_CLASS)
.create_time(DateUtil.now())
.build();
@@ -157,15 +175,26 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
*/
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
WQLObject groupTab = WQLObject.getWQLObject("md_pb_group");
JSONArray taskArr = taskTab.query("handle_class = '" + THIS_CLASS + "'and is_delete = '0' and task_status = '2'").getResultJSONArray(0);
for (int i = 0; i < taskArr.size(); i++) {
JSONObject jsonTask = taskArr.getJSONObject(i);
String point_code_ht = "";
//判断SSX01A1是否有任务没有则判断其他的三个点位
// 查找组盘信息
JSONObject groupObj = groupTab.query("vehicle_code = '" + jsonTask.getString("vehicle_code") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(groupObj)) {
// 没有组盘信息
jsonTask.put("remark", "没有组盘信息");
taskTab.update(jsonTask);
continue;
}
// 设置信息
jsonTask.put("vehicle_type", groupObj.getString("vehicle_type"));
jsonTask.put("vehicle_qty", groupObj.getString("vehicle_qty"));
//判断SSX01A1是否有任务, 没有则判断其他的三个点位
boolean ssx_1 = this.isTask("SSX01A1");
if (ssx_1) {
if (ssx_1) { // ssx01a1没任务
String like = "SSX01%";
JSONArray taskArrNum = new JSONArray();
@@ -175,6 +204,7 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
JSONObject json = pointArr.getJSONObject(j);
boolean is_empTask = this.isTask(json.getString("point_code"));
// 有任务就添加进去
if (!is_empTask) taskArrNum.add(json);
}
@@ -211,6 +241,8 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
// 如果此时point_code_ht为空则循环下一个任务
if (ObjectUtil.isEmpty(point_code_ht)) {
jsonTask.put("remark", "货梯存在其他任务");
taskTab.update(jsonTask);
continue;
}
@@ -222,12 +254,15 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
// 如果此时endPoint为空则循环下一个任务
if (ObjectUtil.isEmpty(endPoint)) {
jsonTask.put("remark", "找不到放货点,检查是否锁住");
taskTab.update(jsonTask);
continue;
}
// 更新任务表point_code2
jsonTask.put("point_code2", endPoint);
jsonTask.put("task_status", "4");
jsonTask.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
jsonTask.put("remark", "");
taskTab.update(jsonTask);
// 锁定终点
@@ -291,16 +326,25 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
if (ObjectUtil.isNotEmpty(jsonZcwEnd)) {
end_code = jsonZcwEnd.getString("point_code");
} else {
// 为空就去养生A区的等待位
JSONObject jsonEmpWait = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() + "' and col_num = '1' and can_vehicle_type = '" + vehicle_type + "' and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '1'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonEmpWait)) {
// 判断是否有任务
boolean is_point = this.isTask(jsonEmpWait.getString("point_code"));
if (is_point) {
JSONArray jsonEmpArr = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() + "' and row_num = '" + jsonEmpWait.getString("row_num") + "' and can_vehicle_type = '" + vehicle_type + "' and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '1'").getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(jsonEmpArr)) end_code = jsonEmpWait.getString("point_code");
}
// 为空就直接去养生a区
// 1、查看是否有放过的托盘位置、获取其下一个位置
JSONObject inOrderSeqAsc = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() + "' " +
"and can_vehicle_type = '" + vehicle_type + "' " +
"and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '2' " +
"and col_num <> '1'",
"in_order_seq asc").uniqueResult(0);
if (ObjectUtil.isNotEmpty(inOrderSeqAsc)) {
Integer block_num = inOrderSeqAsc.getInteger("block_num");
Integer col_num = inOrderSeqAsc.getInteger("col_num"); // 列
Integer row_num = inOrderSeqAsc.getInteger("row_num"); // 排
JSONObject firstRow = pointTab.query("block_num = '" + block_num + "' and row_num = '" + row_num + "'and col_num = '" + (col_num - 1) +"' and lock_type = '1' and point_status = '1' and is_used = '1' and is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(firstRow)) end_code = firstRow.getString("point_code");
} else {
// 2、没有就直接找个位置
JSONObject inOrderSeqDesc = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() + "' " +
"and can_vehicle_type = '" + vehicle_type + "' " +
"and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '1'", "in_order_seq desc").uniqueResult(0);
if (ObjectUtil.isNotEmpty(inOrderSeqDesc)) end_code = inOrderSeqDesc.getString("point_code");
}
}
}
@@ -310,17 +354,37 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
if (ObjectUtil.isNotEmpty(jsonZcwEnd)) {
end_code = jsonZcwEnd.getString("point_code");
} else {
// 为空就去养生A区的等待位
JSONObject jsonEmpWait = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() + "' and col_num = '1' and can_vehicle_type = '" + vehicle_type + "' and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '1'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonEmpWait)) {
// 判断是否有任务
boolean is_point = this.isTask(jsonEmpWait.getString("point_code"));
if (is_point) {
JSONArray jsonEmpArr = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() + "' and row_num = '" + jsonEmpWait.getString("row_num") + "' and can_vehicle_type = '" + vehicle_type + "' and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '1'").getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(jsonEmpArr)) end_code = jsonEmpWait.getString("point_code");
}
// 为空就直接去养生a区
// 1、查看是否有放过的托盘位置、获取其下一个位置
JSONObject inOrderSeqAsc = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() + "' " +
"and can_vehicle_type = '" + vehicle_type + "' " +
"and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '2' " +
"and col_num <> '1'",
"in_order_seq asc").uniqueResult(0);
if (ObjectUtil.isNotEmpty(inOrderSeqAsc)) {
Integer block_num = inOrderSeqAsc.getInteger("block_num");
Integer col_num = inOrderSeqAsc.getInteger("col_num"); // 列
Integer row_num = inOrderSeqAsc.getInteger("row_num"); // 排
JSONObject firstRow = pointTab.query("block_num = '" + block_num + "' and row_num = '" + row_num + "'and col_num = '" + (col_num - 1) +"' and lock_type = '1' and point_status = '1' and is_used = '1' and is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(firstRow)) end_code = firstRow.getString("point_code");
} else {
// 2、没有就直接找个位置
JSONObject inOrderSeqDesc = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() + "' " +
"and can_vehicle_type = '" + vehicle_type + "' " +
"and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '1'", "in_order_seq desc").uniqueResult(0);
if (ObjectUtil.isNotEmpty(inOrderSeqDesc)) end_code = inOrderSeqDesc.getString("point_code");
}
// 为空就去养生A区的等待位
// JSONObject jsonEmpWait = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() + "' and col_num = '1' and can_vehicle_type = '" + vehicle_type + "' and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '1'").uniqueResult(0);
//
// if (ObjectUtil.isNotEmpty(jsonEmpWait)) {
// // 判断是否有任务
// boolean is_point = this.isTask(jsonEmpWait.getString("point_code"));
// if (is_point) {
// JSONArray jsonEmpArr = pointTab.query("region_id = '" + RegionTypeEnum.YSAQKTPQ01.getId() + "' and row_num = '" + jsonEmpWait.getString("row_num") + "' and can_vehicle_type = '" + vehicle_type + "' and lock_type = '1' and is_used = '1' and is_delete = '0' and point_status = '1'").getResultJSONArray(0);
// if (ObjectUtil.isNotEmpty(jsonEmpArr)) end_code = jsonEmpWait.getString("point_code");
// }
// }
}
}
@@ -336,10 +400,10 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
boolean result;
JSONObject jsonPointCode1 = tab.query("point_code1 = '" + point_code + "' and task_status <> '7' and is_delete = '0'").uniqueResult(0);
JSONObject jsonPointCode2 = tab.query("point_code2 = '" + point_code + "' and task_status <> '7' and is_delete = '0'").uniqueResult(0);
JSONObject jsonPointCode3 = tab.query("point_code3 = '" + point_code + "' and task_status <> '7' and is_delete = '0'").uniqueResult(0);
JSONObject jsonPointCode4 = tab.query("point_code4 = '" + point_code + "' and task_status <> '7' and is_delete = '0'").uniqueResult(0);
JSONObject jsonPointCode1 = tab.query("point_code1 = '" + point_code + "' and task_status <> '7' and handle_class <> '" + THIS_CLASS + "' and is_delete = '0'").uniqueResult(0);
JSONObject jsonPointCode2 = tab.query("point_code2 = '" + point_code + "' and task_status <> '7' and handle_class <> '" + THIS_CLASS + "' and is_delete = '0'").uniqueResult(0);
JSONObject jsonPointCode3 = tab.query("point_code3 = '" + point_code + "' and task_status <> '7' and handle_class <> '" + THIS_CLASS + "' and is_delete = '0'").uniqueResult(0);
JSONObject jsonPointCode4 = tab.query("point_code4 = '" + point_code + "' and task_status <> '7' and handle_class <> '" + THIS_CLASS + "' and is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonPointCode1) && ObjectUtil.isEmpty(jsonPointCode2) && ObjectUtil.isEmpty(jsonPointCode3) && ObjectUtil.isEmpty(jsonPointCode4)) {
result = true;
@@ -442,6 +506,7 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
.task_type(json.getString("acs_task_type"))
.start_device_code(json.getString("point_code1"))
.next_device_code(point_code3)
.vehicle_qty(json.getString("vehicle_qty"))
.vehicle_code(json.getString("vehicle_code"))
.vehicle_type(json.getString("vehicle_type"))
.priority(json.getString("priority"))

View File

@@ -44,13 +44,13 @@ public class YqxSendEmpVehicleTask extends AbstractAcsTask {
if (StrUtil.equals(jsonTask.getString("task_status"), TaskStatusEnum.FINISHED.getCode())) {
throw new BadRequestException("已完成不能取消!");
}
String point_code3 = jsonTask.getString("point_code3");
String point_code1 = jsonTask.getString("point_code1");
String point_code2 = jsonTask.getString("point_code2");
if (ObjectUtil.isNotEmpty(point_code3)) {
JSONObject jsonPoint3 = pointTab.query("point_code ='" + point_code3 + "'").uniqueResult(0);
jsonPoint3.put("point_status", "1");
jsonPoint3.put("update_time", DateUtil.now());
pointTab.update(jsonPoint3);
if (ObjectUtil.isNotEmpty(point_code1)) {
JSONObject jsonPoint1 = pointTab.query("point_code ='" + point_code1 + "'").uniqueResult(0);
jsonPoint1.put("point_status", "1");
jsonPoint1.put("update_time", DateUtil.now());
pointTab.update(jsonPoint1);
}
if (ObjectUtil.isNotEmpty(point_code2)) {
JSONObject jsonPoint2 = pointTab.query("point_code ='" + point_code2 + "'").uniqueResult(0);
@@ -58,7 +58,10 @@ public class YqxSendEmpVehicleTask extends AbstractAcsTask {
jsonPoint2.put("update_time", DateUtil.now());
pointTab.update(jsonPoint2);
}
taskTab.delete("task_id = '" + task_id + "'");
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
jsonTask.put("update_time", DateUtil.now());
jsonTask.put("remark", "任务取消");
taskTab.update(jsonTask);
}
if (StrUtil.equals(status, "1")) {
@@ -72,6 +75,7 @@ public class YqxSendEmpVehicleTask extends AbstractAcsTask {
if (StrUtil.equals(status, "2")) {
// 更改任务状态为完成
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
jsonTask.put("remark", "任务完成");
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
@@ -157,7 +161,7 @@ public class YqxSendEmpVehicleTask extends AbstractAcsTask {
.priority("8")
.vehicle_code(form.getString("vehicle_code"))
.vehicle_type(vehicleType)
.vehicle_qty(form.getIntValue("qty"))
.vehicle_qty(8)
.handle_class(THIS_CLASS)
.create_time(DateUtil.now())
.build();
@@ -199,7 +203,7 @@ public class YqxSendEmpVehicleTask extends AbstractAcsTask {
// 更新任务表point_code2
jsonTask.put("point_code2", endPoint);
jsonTask.put("task_status", "4");
jsonTask.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
taskTab.update(jsonTask);
// 锁定终点

View File

@@ -29,7 +29,8 @@ public class PointUpdateUtil {
JSONObject pointObj = deviceDatas.getJSONObject(j);
String point_code = pointObj.getString("device_code");
JSONObject pointObj2 = pointTable.query("point_code = '" + point_code + "'").uniqueResult(0);
if (pointObj2.getString("region_code").equals(RegionTypeEnum.DPJQB.getCode())) { // 碟盘机
if (pointObj2.getString("region_code").equals(RegionTypeEnum.DPJQB.getCode()) ||
pointObj2.getString("region_code").equals(RegionTypeEnum.DPJQA.getCode())) { // 碟盘机
String vehicleNum = pointObj.getString("vehicle_num");
pointObj2.put("vehicle_qty", vehicleNum);
pointObj2.put("point_status", vehicleNum.equals("0")?"1":"2");

View File

@@ -48,5 +48,4 @@ export function getPointTypeSelectById(id) {
})
}
export default { add, edit, del, changeActive, getPointStatusSelectById, getPointTypeSelectById }

View File

@@ -288,25 +288,33 @@ export default {
return true
},
getSubTypes(id) {
console.log('id', id)
crudClassstandard.getClassSuperior(id).then(res => {
console.log('sub', res)
const date = res.content
this.buildClass(date)
console.log('classes', date)
this.classes = date
})
},
getClass() {
crudClassstandard.getClass({ enabled: true }).then(res => {
this.classes = res.content.map(function(obj) {
console.log('obj', obj)
if (obj.hasChildren) {
console.log(obj.hasChildren)
obj.children = null
}
return obj
})
console.log(this.classes)
})
},
buildClass(classes) {
console.log('开始构建树')
classes.forEach(data => {
if (data.children) {
console.log(data)
this.buildClass(data.children)
}
if (data.hasChildren && !data.children) {
@@ -318,10 +326,11 @@ export default {
loadClass({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
crudClassstandard.getClass({ pid: parentNode.id }).then(res => {
console.log('load', res)
parentNode.children = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
// if (obj.hasChildren) {
// obj.children = null
// }
return obj
})
setTimeout(() => {

View File

@@ -296,6 +296,9 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="载具数量" prop="vehicle_qty">
<el-input-number :controls="false" class="clear-number-input" v-model="form.vehicle_qty" :min="0" :precision="3" :max="99999" label="载具数量" size="mini" />
</el-form-item>
<el-form-item v-if="form.point_status === '3'" label="库存数" prop="ivt_qty">
<el-input-number :controls="false" class="clear-number-input" v-model="form.ivt_qty" type="number" :min="1" :precision="3" :max="99999" label="库存数" size="mini" />
</el-form-item>
@@ -402,6 +405,7 @@ const defaultForm = {
vehicle_code: null,
vehicle_type: null,
can_vehicle_types: null,
vehicle_qty: null,
source_id: null,
remark: null,
is_used: null,