diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java index 6f6e9c3..7299687 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java @@ -639,6 +639,7 @@ public class HFHandServiceImpl implements HFHandService { instdto.setStart_device_code(taskjo.getString("start_device_code")); instdto.setNext_device_code(taskjo.getString("next_device_code")); instdto.setInstruction_status("0"); + instdto.setIs_delete("0"); InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); WQLObject instwo = WQLObject.getWQLObject("acs_instruction"); JSONObject instcheckjson = instwo.query(" instruction_status <2 and next_point_code= '" + next_point_code + "'" + " and start_point_code = '" + start_point_code + "'" + " and task_id = '" + task_id + "'").uniqueResult(0); diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/amb/wql/QJN_QUERY001.wql b/acs/nladmin-system/src/main/java/org/nl/hand/amb/wql/QJN_QUERY001.wql index 5f7702e..2f2e235 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/amb/wql/QJN_QUERY001.wql +++ b/acs/nladmin-system/src/main/java/org/nl/hand/amb/wql/QJN_QUERY001.wql @@ -172,18 +172,17 @@ LEFT JOIN sys_dict_detail dtl3 ON dtl3.VALUE = inst.send_status AND dtl3.NAME = 'send_status' WHERE - inst.is_delete = '0' - AND inst.instruction_status <> '2' - AND inst.instruction_status < '2' + inst.is_delete = '0' + AND inst.instruction_status < '2' OPTION 输入.key <> "" - inst.instruction_code like 输入.key - ENDOPTION - OPTION 输入.start_point <> "" - inst.start_point_code like 输入.start_point - ENDOPTION - OPTION 输入.next_point <> "" - inst.next_point_code like 输入.next_point - ENDOPTION + inst.instruction_code like 输入.key + ENDOPTION + OPTION 输入.start_point <> "" + inst.start_point_code like 输入.start_point + ENDOPTION + OPTION 输入.next_point <> "" + inst.next_point_code like 输入.next_point + ENDOPTION ORDER BY inst.create_time DESC ENDSELECT diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java b/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java index be68a17..760924e 100644 --- a/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java +++ b/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java @@ -115,6 +115,7 @@ public class AutoCreateInst { instdto.setInstruction_status("0"); instdto.setExecute_device_code(start_point_code); instdto.setVehicle_type(vehicleType); + instdto.setIs_delete("0"); try { instructionService.create(instdto); } catch (Exception e) { diff --git a/acs/nladmin-system/src/main/resources/config/application-prod.yml b/acs/nladmin-system/src/main/resources/config/application-prod.yml index 14fab3e..8b85a81 100644 --- a/acs/nladmin-system/src/main/resources/config/application-prod.yml +++ b/acs/nladmin-system/src/main/resources/config/application-prod.yml @@ -52,7 +52,7 @@ spring: multi-statement-allow: true redis: #数据库索引 - database: ${REDIS_DB:15} + database: ${REDIS_DB:0} host: ${REDIS_HOST:127.0.0.1} port: ${REDIS_PORT:6379} password: ${REDIS_PWD:} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/service/impl/MaterialbaseServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/service/impl/MaterialbaseServiceImpl.java index 33ab220..d3ef598 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/service/impl/MaterialbaseServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/service/impl/MaterialbaseServiceImpl.java @@ -135,6 +135,14 @@ public class MaterialbaseServiceImpl implements MaterialbaseService { String nickName = SecurityUtils.getCurrentNickName(); String now = DateUtil.now(); + JSONObject existMaterial = WQLObject + .getWQLObject("md_me_materialbase") + .query("material_code = '" + dto.getMaterial_code() + "'") + .uniqueResult(0); + if (ObjectUtil.isNotEmpty(existMaterial)) { + throw new BadRequestException("该物料号已存在"); + } + dto.setMaterial_id(IdUtil.getSnowflake(1L, 1L).nextId()); dto.setIs_used("1"); dto.setCreate_id(currentUserId); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/service/impl/VehicleServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/service/impl/VehicleServiceImpl.java index 776e0af..68103fe 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/service/impl/VehicleServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/service/impl/VehicleServiceImpl.java @@ -123,8 +123,8 @@ public class VehicleServiceImpl implements VehicleService { throw new BadRequestException("载具号" + vehicleCode + "存在组盘信息"); } JSONObject point = new JSONObject(); - point.put("vehicle_code", null); - pointTable.update(point, "vehicle_code = " + vehicleCode); + point.put("vehicle_code", ""); + pointTable.update(point, "vehicle_code = '" + vehicleCode + "'"); vehicleTable.delete("vehicle_id = " + vehicleId); } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java index 4d494ad..f01b97a 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java @@ -93,7 +93,7 @@ public class PdaController { @PostMapping("/queryInventory") @Log("查询可出库信息") @ApiOperation("查询可出库信息") - public ResponseEntity queryInventory(@RequestBody JSONObject param) { + public ResponseEntity queryInventory(@RequestBody JSONObject param) { return new ResponseEntity<>(pdaService.queryInventory(param.getString("material_code"), param.getString("vehicle_code")), HttpStatus.OK); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/PdaService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/PdaService.java index b5c3d96..ec68cd4 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/PdaService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/PdaService.java @@ -25,7 +25,7 @@ public interface PdaService { JSONArray queryMaterial(); - JSONObject queryInventory(String materialCode, String vehicleCode); + JSONArray queryInventory(String materialCode, String vehicleCode); void task(String type, String pointId, String startPointId, String nextPointId); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java index 5559965..979f91c 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java @@ -16,17 +16,11 @@ import org.nl.wms.sch.base.point.LockType; import org.nl.wms.sch.base.point.PointStatus; import org.nl.wms.sch.base.point.PointType; import org.nl.wms.sch.base.region.RegionEnum; -import org.nl.wms.sch.task.CallEmptyVehicleTask; -import org.nl.wms.sch.task.CallMaterialTask; -import org.nl.wms.sch.task.SendFullVehicleTask; -import org.nl.wms.sch.task.SendResiduesMaterialTask; -import org.nl.wms.sch.task.SendEmptyVehicleTask; +import org.nl.wms.sch.task.*; import org.nl.wms.util.CommonUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.concurrent.locks.Lock; - /** * @author 张江玮 * @date 2022/11/04 18:25 @@ -65,12 +59,7 @@ public class PdaServiceImpl implements PdaService { point.put("status", "2"); } } -// for (Object o : points) { -// JSONObject point = (JSONObject) o; -// if (StrUtil.equals(point.getString("lock_type"), LockType.TASK_LOCKED.getCode())) { -// point.put("status", "3"); -// } -// } + return points; } @@ -117,7 +106,7 @@ public class PdaServiceImpl implements PdaService { if (StrUtil.isNotEmpty(vehicleCode)) { JSONObject vehicle = WQLObject.getWQLObject("md_pb_vehicle").query("vehicle_code = '" + vehicleCode + "'").uniqueResult(0); if (ObjectUtil.isEmpty(vehicle)) { - throw new BadRequestException("该载具号不存在,请从组盘功能添加"); + throw new BadRequestException("该载具号不存在"); } JSONObject existPoint = pointTable.query("vehicle_code = '" + vehicleCode + "'").uniqueResult(0); @@ -185,7 +174,7 @@ public class PdaServiceImpl implements PdaService { .query("material_code = '" + materialCode + "'") .uniqueResult(0); if (ObjectUtil.isEmpty(material)) { - throw new BadRequestException("条码为" + code + "的物料信息不存在,请从后台管理界面添加"); + throw new BadRequestException("条码为" + code + "的物料信息不存在"); } JSONObject vm = new JSONObject(); @@ -248,10 +237,6 @@ public class PdaServiceImpl implements PdaService { vm.put("create_time", oldVm.getString("create_time")); vmTable.insert(vm); } -// for (Object o : materials) { -// JSONObject material = (JSONObject) o; -// -// } vehicle.put("vehicle_status", VehicleStatus.HAS_MATERIAL.getCode()); } else { @@ -268,52 +253,56 @@ public class PdaServiceImpl implements PdaService { } @Override - public JSONObject queryInventory(String materialCode, String vehicleCode) { - JSONObject vehicle = WQLObject - .getWQLObject("md_pb_vehicle") - .query("vehicle_code = '" + vehicleCode + "'") - .uniqueResult(0); - if (ObjectUtil.isEmpty(vehicle)) { - throw new BadRequestException("该载具号不存在,请从组盘功能添加"); - } - if (StrUtil.equals(vehicle.getString("vehicle_status"), VehicleStatus.EMPTY.getCode())) { - throw new BadRequestException("该载具为空载具"); + public JSONArray queryInventory(String materialCode, String vehicleCode) { + if (StrUtil.isNotEmpty(materialCode)) { + JSONObject material = WQLObject + .getWQLObject("md_me_materialbase") + .query("material_code = '" + materialCode + "'") + .uniqueResult(0); + + if (ObjectUtil.isEmpty(material)) { + throw new BadRequestException("该物料号不存在"); + } } - JSONObject point = WQLObject - .getWQLObject("sch_base_point") - .query("vehicle_code = '" + vehicleCode + "'") - .uniqueResult(0); - if (ObjectUtil.isEmpty(point)) { - throw new BadRequestException("该载具不存在于点位上"); - } - if (!StrUtil.equals(point.getString("region_code"), RegionEnum.ZC.getCode())) { - throw new BadRequestException("该载具不在暂存区"); - } - if (StrUtil.equals(point.getString("is_used"), "0")) { - throw new BadRequestException("该载具所在点位已被禁用"); - } - JSONObject result = new JSONObject(); - result.put("point_id", point.getString("point_id")); - result.put("point_name", point.getString("point_name")); + if (StrUtil.isNotEmpty(vehicleCode)) { + JSONObject vehicle = WQLObject + .getWQLObject("md_pb_vehicle") + .query("vehicle_code = '" + vehicleCode + "'") + .uniqueResult(0); + if (ObjectUtil.isEmpty(vehicle)) { + throw new BadRequestException("该载具号不存在"); + } + if (StrUtil.equals(vehicle.getString("vehicle_status"), VehicleStatus.EMPTY.getCode())) { + throw new BadRequestException("该载具为空载具"); + } - JSONObject material = WQLObject - .getWQLObject("md_me_materialbase") - .query("material_code = '" + materialCode + "'") - .uniqueResult(0); - if (ObjectUtil.isEmpty(material)) { - throw new BadRequestException("该物料号不存在"); + JSONObject point = WQLObject + .getWQLObject("sch_base_point") + .query("vehicle_code = '" + vehicleCode + "'") + .uniqueResult(0); + if (ObjectUtil.isEmpty(point)) { + throw new BadRequestException("该载具不存在于点位上"); + } + if (!StrUtil.equals(point.getString("region_code"), RegionEnum.ZC.getCode())) { + throw new BadRequestException("该载具不在暂存区"); + } + if (StrUtil.equals(point.getString("is_used"), "0")) { + throw new BadRequestException("该载具所在点位已被禁用"); + } } - JSONArray detail = WQL + JSONArray result = WQL .getWO("PDA") .addParam("flag", "5") - .addParam("vehicle_id", vehicle.getString("vehicle_id")) - .addParam("material_id", material.getString("material_id")) + .addParam("material_code", materialCode) + .addParam("vehicle_code", vehicleCode) .process() .getResultJSONArray(0); - result.put("detail", detail); + if (ObjectUtil.isEmpty(result)) { + throw new BadRequestException("未找到符合条件的暂存区点位"); + } return result; } @@ -355,14 +344,11 @@ public class PdaServiceImpl implements PdaService { if (StrUtil.equals(point.getString("point_status"), PointStatus.EMPTY.getCode())) { throw new BadRequestException("该点位为空位"); } - if (StrUtil.equals(point.getString("region_id"), RegionEnum.ZC.getId())) { - throw new BadRequestException("暂存区不能生成入库任务"); - } - String regionId = point.getString("region_id"); - if (StrUtil.equals(regionId, RegionEnum.JJ.getId()) - && point.getString("point_code").startsWith("JJC")) { - throw new BadRequestException("交接区出库位不能生成入库任务"); + if (StrUtil.equals(regionId, RegionEnum.ZC.getId()) + || (StrUtil.equals(regionId, RegionEnum.JJ.getId()) + && point.getString("point_code").startsWith("JJC"))) { + throw new BadRequestException("只有交接区的入库位和接料区才能发起入库任务"); } JSONObject vehicle = WQLObject @@ -420,7 +406,7 @@ public class PdaServiceImpl implements PdaService { throw new BadRequestException("终点有载具"); } if (!StrUtil.equals(nextPoint.getString("region_id"), RegionEnum.JJ.getId()) - && nextPoint.getString("point_code").startsWith("JJC")) { + && nextPoint.getString("point_code").startsWith("JJC")) { throw new BadRequestException("只有终点为交接区的出库位才能生成出库任务"); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/wql/PDA.wql b/lms/nladmin-system/src/main/java/org/nl/wms/pda/wql/PDA.wql index 9039aba..f74fe17 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/wql/PDA.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/wql/PDA.wql @@ -16,8 +16,7 @@ 输入.flag TYPEAS s_string 输入.region_id TYPEAS s_string 输入.vehicle_code TYPEAS s_string - 输入.vehicle_id TYPEAS s_string - 输入.material_id TYPEAS s_string + 输入.material_code TYPEAS s_string [临时表] --这边列出来的临时表就会在运行期动态创建 @@ -99,16 +98,32 @@ IF 输入.flag = "5" QUERY SELECT - material.material_code, + point.point_id, + point.point_name, + point.vehicle_code, + material.material_code, material.material_name, - vm.material_qty, - vm.material_batch AS batch + vm.material_batch, + SUM( vm.material_qty ) AS material_qty FROM - st_ivt_vehicle_material vm + sch_base_point point + LEFT JOIN md_pb_vehicle vehicle ON point.vehicle_code = vehicle.vehicle_code + LEFT JOIN st_ivt_vehicle_material vm ON vehicle.vehicle_id = vm.vehicle_id LEFT JOIN md_me_materialbase material ON vm.material_id = material.material_id WHERE - vm.vehicle_id = 输入.vehicle_id - AND vm.material_id = 输入.material_id + point.point_status = '1' + AND point.is_used = '1' + AND point.lock_type = '1' + AND point.region_id = 1585921595338264576 + AND vehicle.vehicle_status = '2' + OPTION 输入.material_code <> "" + material.material_code = 输入.material_code + ENDOPTION + OPTION 输入.vehicle_code <> "" + vehicle.vehicle_code = 输入.vehicle_code + ENDOPTION + GROUP BY + point.point_id ENDSELECT ENDQUERY ENDIF \ No newline at end of file diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/structivt/wql/ST_IVT_STRUCTIVT.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/structivt/wql/ST_IVT_STRUCTIVT.wql index e2928a9..9cde1f1 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/structivt/wql/ST_IVT_STRUCTIVT.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/structivt/wql/ST_IVT_STRUCTIVT.wql @@ -47,12 +47,12 @@ PAGEQUERY SELECT ivt.stockrecord_id, - ANY_VALUE( region.region_name ) AS region_name, - ANY_VALUE( point.point_name ) AS point_name, - ANY_VALUE( vehicle.vehicle_id ) AS vehicle_id, - ANY_VALUE( vehicle.vehicle_code ) AS vehicle_code, + region.region_name, + point.point_name, + vehicle.vehicle_id, + vehicle.vehicle_code, SUM( vm.material_qty ) AS qty, - ANY_VALUE( ivt.instorage_time ) AS instorage_time + ivt.instorage_time FROM st_ivt_structivt ivt LEFT JOIN sch_base_point point ON ivt.point_id = point.point_id diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/vm/rest/VMController.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/vm/rest/VMController.java index 1fa5d8b..a41353f 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/vm/rest/VMController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/vm/rest/VMController.java @@ -41,4 +41,12 @@ public class VMController { public ResponseEntity queryDetail(@RequestBody JSONObject param) { return new ResponseEntity<>(vmService.queryDetail(param), HttpStatus.OK); } + + @DeleteMapping + @Log("删除组盘信息") + @ApiOperation("删除组盘信息") + public ResponseEntity delete(@RequestBody Long[] ids) { + vmService.delete(ids); + return new ResponseEntity<>(HttpStatus.OK); + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/vm/service/VMService.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/vm/service/VMService.java index f46e42c..8b031a5 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/vm/service/VMService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/vm/service/VMService.java @@ -16,7 +16,7 @@ public interface VMService { * 查询组盘信息 * * @param param String search 载具编码 - * @param page 分页 + * @param page 分页 * @return 组盘信息 */ JSONObject query(Map param, Pageable page); @@ -28,4 +28,11 @@ public interface VMService { * @return 所有组盘信息 */ JSONArray queryDetail(JSONObject param); + + /** + * 删除组盘 + * + * @param ids 载具id数组 + */ + void delete(Long[] ids); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/vm/service/impl/VMServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/vm/service/impl/VMServiceImpl.java index 41db170..e51940c 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/vm/service/impl/VMServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/vm/service/impl/VMServiceImpl.java @@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.modules.wql.WQL; +import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.util.WqlUtil; +import org.nl.wms.md.pb.VehicleStatus; import org.nl.wms.st.vm.service.VMService; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; @@ -49,4 +51,20 @@ public class VMServiceImpl implements VMService { param.put("flag", "2"); return WQL.getWO("ST_IVT_VEHICLE_MATERIAL").addParamMap(param).process().getResultJSONArray(0); } + + /** + * 删除组盘 + * + * @param ids 载具id数组 + */ + @Override + public void delete(Long[] ids) { + for (Long id : ids) { + WQLObject.getWQLObject("st_ivt_vehicle_material").delete("vehicle_id = " + id); + + JSONObject vehicleUpdate = new JSONObject(); + vehicleUpdate.put("vehicle_status", VehicleStatus.EMPTY); + WQLObject.getWQLObject("md_pb_vehicle").update(vehicleUpdate, "vehicle_id = " + id); + } + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/vm/wql/ST_IVT_VEHICLE_MATERIAL.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/vm/wql/ST_IVT_VEHICLE_MATERIAL.wql index 5667cf6..0dee97d 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/vm/wql/ST_IVT_VEHICLE_MATERIAL.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/vm/wql/ST_IVT_VEHICLE_MATERIAL.wql @@ -43,16 +43,17 @@ PAGEQUERY SELECT vehicle.vehicle_id, - ANY_VALUE( vm.vm_id ) AS vm_id, - ANY_VALUE( vehicle.vehicle_code) AS vehicle_code, + vm.vm_id, + vehicle.vehicle_code, SUM( vm.material_qty ) AS qty, - ANY_VALUE( vm.create_name ) AS create_name, - ANY_VALUE( vm.create_time ) AS create_time + vm.create_name, + vm.create_time FROM md_pb_vehicle vehicle LEFT JOIN st_ivt_vehicle_material vm ON vehicle.vehicle_id = vm.vehicle_id WHERE vehicle.vehicle_status = '2' + AND vm.vm_id IS NOT NULL OPTION 输入.vehicle_code <> "" vehicle.vehicle_code LIKE CONCAT( '%', 输入.vehicle_code, '%' ) ENDOPTION diff --git a/lms/nladmin-ui/src/views/wms/st/vm/index.vue b/lms/nladmin-ui/src/views/wms/st/vm/index.vue index 4c2644a..b3e31ac 100644 --- a/lms/nladmin-ui/src/views/wms/st/vm/index.vue +++ b/lms/nladmin-ui/src/views/wms/st/vm/index.vue @@ -129,7 +129,7 @@ export default { title: '组盘', optShow: { reset: true, del: true }, url: 'api/vm', - idField: 'vm_id', + idField: 'vehicle_id', sort: 'vm_id,desc', crudMethod: { ...crudVM } })