diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/wms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index 8d03c43..0c93ef2 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -46,7 +46,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @Override @Transactional(rollbackFor = Exception.class) public void receiveTaskFromAcs(Map jsonObject) { - log.debug("WCS的请求参数为:" + jsonObject); + log.info("ACS的请求参数为:" + jsonObject); String device_code = (String) jsonObject.get("device_code"); String type = (String) jsonObject.get("type"); JSONObject produceInfoByCode = new JSONObject(); @@ -168,7 +168,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { String material_id = (String) produceInfoByCode.get("material_id"); String cust_id = (String) produceInfoByCode.get("cust_id"); String producetask_id = (String) produceInfoByCode.get("producetask_id"); - JSONObject materialObj = WQLObject.getWQLObject("MD_ME_Material").query("material_id='" + material_id + "'").uniqueResult(0); + JSONObject materialObj = WQLObject + .getWQLObject("MD_ME_Material") + .query("material_id='" + material_id + "'") + .uniqueResult(0); JSONObject groubObj = new JSONObject(); groubObj.put("group_id", IdUtil.getSnowflake(1, 1).nextId()); groubObj.put("vehicle_code", vehicle_code); diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/rest/DeviceController.java b/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/rest/DeviceController.java index 8a89d29..3db056c 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/rest/DeviceController.java +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/rest/DeviceController.java @@ -83,6 +83,14 @@ public class DeviceController { return new ResponseEntity<>(HttpStatus.NO_CONTENT); } + @PutMapping("/changeIsWorkDevice") + @Log("修改是否生产设备") + @ApiOperation("修改是否生产设备") + public ResponseEntity changeIsWorkDevice(@RequestBody JSONObject json) { + deviceService.changeIsWorkDevice(json); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + @GetMapping("/getDevice") @Log("点位下拉获取设备信息") @ApiOperation("点位下拉获取设备信息") diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/rest/ProducetaskController.java b/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/rest/ProducetaskController.java index 6968691..c70efaa 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/rest/ProducetaskController.java +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/rest/ProducetaskController.java @@ -2,27 +2,29 @@ package org.nl.wms.pdm.rest; +import com.alibaba.fastjson.JSONArray; 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.annotation.Log; import org.nl.wms.pdm.service.ProducetaskService; import org.nl.wms.pdm.service.dto.ProducetaskDto; import org.springframework.data.domain.Pageable; -import lombok.RequiredArgsConstructor; -import org.nl.annotation.Log; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import io.swagger.annotations.*; -import java.util.Map; -import lombok.extern.slf4j.Slf4j; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; +import java.util.Map; /** -* @author geng by -* @date 2022-04-26 -**/ + * @author geng by + * @date 2022-04-26 + **/ @RestController @RequiredArgsConstructor @Api(tags = "生产任务管理") @@ -36,15 +38,15 @@ public class ProducetaskController { @Log("查询生产任务") @ApiOperation("查询生产任务") //@PreAuthorize("@el.check('producetask:list')") - public ResponseEntity query(@RequestParam Map whereJson, Pageable page){ - return new ResponseEntity<>(producetaskService.queryAll(whereJson,page),HttpStatus.OK); + public ResponseEntity query(@RequestParam Map whereJson, Pageable page) { + return new ResponseEntity<>(producetaskService.queryAll(whereJson, page), HttpStatus.OK); } @PostMapping @Log("新增生产任务") @ApiOperation("新增生产任务") //@PreAuthorize("@el.check('producetask:add')") - public ResponseEntity create(@Validated @RequestBody ProducetaskDto dto){ + public ResponseEntity create(@Validated @RequestBody ProducetaskDto dto) { producetaskService.create(dto); return new ResponseEntity<>(HttpStatus.CREATED); } @@ -53,7 +55,7 @@ public class ProducetaskController { @Log("修改生产任务") @ApiOperation("修改生产任务") //@PreAuthorize("@el.check('producetask:edit')") - public ResponseEntity update(@Validated @RequestBody ProducetaskDto dto){ + public ResponseEntity update(@Validated @RequestBody ProducetaskDto dto) { producetaskService.update(dto); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @@ -71,55 +73,55 @@ public class ProducetaskController { @Log("查询物料") @ApiOperation("查询物料") //@PreAuthorize("@el.check('producetask:list')") - public ResponseEntity getMaterial(){ - return new ResponseEntity<>(producetaskService.getMaterial(),HttpStatus.OK); + public ResponseEntity getMaterial() { + return new ResponseEntity<>(producetaskService.getMaterial(), HttpStatus.OK); } @PostMapping("/getDevice") @Log("查询设备") @ApiOperation("查询设备") //@PreAuthorize("@el.check('producetask:list')") - public ResponseEntity getDevice(@RequestBody JSONObject param){ - return new ResponseEntity<>(producetaskService.getDevice(param),HttpStatus.OK); + public ResponseEntity getDevice(@RequestBody JSONObject param) { + return new ResponseEntity<>(producetaskService.getDevice(param), HttpStatus.OK); } @GetMapping("/getDevice1") @Log("查询设备") @ApiOperation("查询设备") //@PreAuthorize("@el.check('producetask:list')") - public ResponseEntity getDevice1(){ - return new ResponseEntity<>(producetaskService.getDevice1(),HttpStatus.OK); + public ResponseEntity getDevice1() { + return new ResponseEntity<>(producetaskService.getDevice1(), HttpStatus.OK); } @GetMapping("/getProduceline") @Log("查询生产产线") @ApiOperation("查询生产产线") //@PreAuthorize("@el.check('producetask:list')") - public ResponseEntity getProduceline(){ - return new ResponseEntity<>(producetaskService.getProduceline(),HttpStatus.OK); + public ResponseEntity getProduceline() { + return new ResponseEntity<>(producetaskService.getProduceline(), HttpStatus.OK); } @GetMapping("/getCust") @Log("查询客户") @ApiOperation("查询客户") //@PreAuthorize("@el.check('producetask:list')") - public ResponseEntity getCust(){ - return new ResponseEntity<>(producetaskService.getCust(),HttpStatus.OK); + public ResponseEntity getCust() { + return new ResponseEntity<>(producetaskService.getCust(), HttpStatus.OK); } @GetMapping("/getWorkprocedure") @Log("查询工序") @ApiOperation("查询工序") //@PreAuthorize("@el.check('producetask:list')") - public ResponseEntity getWorkprocedure(){ - return new ResponseEntity<>(producetaskService.getWorkprocedure(),HttpStatus.OK); + public ResponseEntity getWorkprocedure() { + return new ResponseEntity<>(producetaskService.getWorkprocedure(), HttpStatus.OK); } @PostMapping("/excelImport") @Log("excel导入") @ApiOperation("excel导入") - public ResponseEntity excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request){ - producetaskService.excelImport(file,request); + public ResponseEntity excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request) { + producetaskService.excelImport(file, request); return new ResponseEntity<>(HttpStatus.OK); } @@ -127,7 +129,7 @@ public class ProducetaskController { @Log("复制新增") @ApiOperation("复制新增") //@PreAuthorize("@el.check('producetask:list')") - public ResponseEntity copyAdd(@RequestBody JSONObject param){ + public ResponseEntity copyAdd(@RequestBody JSONObject param) { producetaskService.copyAdd(param); return new ResponseEntity<>(HttpStatus.OK); } @@ -136,15 +138,15 @@ public class ProducetaskController { @Log("根据设备查询任务") @ApiOperation("根据设备查询任务") //@PreAuthorize("@el.check('producetask:list')") - public ResponseEntity getTaskByDeviceId(@RequestParam Map whereJson, Pageable page){ - return new ResponseEntity<>(producetaskService.getTaskByDeviceId(whereJson,page),HttpStatus.OK); + public ResponseEntity getTaskByDeviceId(@RequestParam Map whereJson, Pageable page) { + return new ResponseEntity<>(producetaskService.getTaskByDeviceId(whereJson, page), HttpStatus.OK); } @PutMapping("/sortUpdate") @Log("排序") @ApiOperation("排序") //@PreAuthorize("@el.check('producetask:list')") - public ResponseEntity sortUpdate(@RequestBody JSONObject param){ + public ResponseEntity sortUpdate(@RequestBody JSONObject param) { producetaskService.sortUpdate(param); return new ResponseEntity<>(HttpStatus.OK); } @@ -153,7 +155,7 @@ public class ProducetaskController { @Log("强制完成") @ApiOperation("强制完成") //@PreAuthorize("@el.check('producetask:list')") - public ResponseEntity mandFinish(@RequestBody JSONObject param){ + public ResponseEntity mandFinish(@RequestBody JSONObject param) { producetaskService.mandFinish(param); return new ResponseEntity<>(HttpStatus.OK); } @@ -162,9 +164,16 @@ public class ProducetaskController { @Log("下发") @ApiOperation("下发") //@PreAuthorize("@el.check('producetask:list')") - public ResponseEntity issued(@RequestBody JSONObject param){ + public ResponseEntity issued(@RequestBody JSONObject param) { producetaskService.issued(param); return new ResponseEntity<>(HttpStatus.OK); } + @PostMapping("/getVehicleType") + @Log("通过设备查询可用载具类型") + @ApiOperation("通过设备查询可用载具类型") + public ResponseEntity getVehicleTypeByDeviceId(@RequestBody JSONObject device) { + return new ResponseEntity<>(producetaskService.getVehicleTypeByDeviceId(device.getLong("device_id")), HttpStatus.OK); + } + } diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/service/DeviceService.java b/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/service/DeviceService.java index 9c02fcd..49505e0 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/service/DeviceService.java +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/service/DeviceService.java @@ -77,4 +77,10 @@ public interface DeviceService { * @param json */ void changeActive(JSONObject json); + + /** + * 改变是否工作设备 + * @param json + */ + void changeIsWorkDevice(JSONObject json); } diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/service/ProducetaskService.java b/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/service/ProducetaskService.java index 7eaeaad..542744f 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/service/ProducetaskService.java +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/service/ProducetaskService.java @@ -142,4 +142,11 @@ public interface ProducetaskService { * @param param */ void issued(JSONObject param); + + /** + * 通过设备查询可用载具类型 + * @param deviceId 设备id + * @return 字典表数组 + */ + JSONObject getVehicleTypeByDeviceId(Long deviceId); } diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java b/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java index 678518e..2ec33c2 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java @@ -178,4 +178,20 @@ public class DeviceServiceImpl implements DeviceService { WQLObject.getWQLObject("pdm_base_device").update(json); } + @Override + public void changeIsWorkDevice(JSONObject json) { + Long currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getNickName(); + String now = DateUtil.now(); + + String is_work_device = "1"; + if (StrUtil.equals("1", json.getString("is_work_device"))) { + is_work_device = "0"; + } + json.put("is_work_device", is_work_device); + json.put("update_optid", currentUserId); + json.put("update_optname", nickName); + json.put("update_time", now); + WQLObject.getWQLObject("pdm_base_device").update(json); + } } diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/ProducetaskServiceImpl.java b/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/ProducetaskServiceImpl.java index a81fe2b..a1c4a36 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/ProducetaskServiceImpl.java +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/ProducetaskServiceImpl.java @@ -12,6 +12,7 @@ import lombok.RequiredArgsConstructor; import org.nl.exception.BadRequestException; import org.nl.modules.system.util.CodeUtil; import org.nl.utils.SpringContextHolder; +import org.nl.wms.WorkProcedureEnum; import org.nl.wms.ext.acs.service.AcsToWmsService; import org.nl.wms.ext.acs.service.WmsToAcsService; import org.nl.wms.pdm.service.ProducetaskService; @@ -28,6 +29,7 @@ import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; @@ -106,6 +108,12 @@ public class ProducetaskServiceImpl implements ProducetaskService { @Override @Transactional(rollbackFor = Exception.class) public void create(ProducetaskDto dto) { + Long device_id = dto.getDevice_id(); + if (ObjectUtil.isNotEmpty(device_id) + && device_id.equals(1518136519804719104L) + && ObjectUtil.isEmpty(dto.getCust_id())) { + throw new BadRequestException("新增分拣拆垛机械手的生产任务, 客户不能为空!"); + } //编码唯一性校验 String producetask_code = dto.getProducetask_code(); @@ -185,9 +193,10 @@ public class ProducetaskServiceImpl implements ProducetaskService { @Override public JSONArray getDevice1() { - WQLObject wo = WQLObject.getWQLObject("pdm_base_device"); - JSONArray arr = wo.query(" is_delete = '0'", "device_code").getResultJSONArray(0); - return arr; + return WQLObject + .getWQLObject("pdm_base_device") + .query(" is_delete = '0' AND is_work_device = '1'", "device_code") + .getResultJSONArray(0); } @Override @@ -275,8 +284,8 @@ public class ProducetaskServiceImpl implements ProducetaskService { String now = DateUtil.now(); String producetask_id = param.getString("producetask_id"); WQLObject wo = WQLObject.getWQLObject("pdm_mg_producetask"); - JSONObject taskObj= WQL.getWO("PDM_ProduceTask_01").addParam("flag", "3").addParam("producetask_id", producetask_id).process().uniqueResult(0); - taskObj.put("product_code","wms"); + JSONObject taskObj = WQL.getWO("PDM_ProduceTask_01").addParam("flag", "3").addParam("producetask_id", producetask_id).process().uniqueResult(0); + taskObj.put("product_code", "wms"); WmsToAcsService wmsToAcsService = SpringContextHolder.getBean(WmsToAcsService.class); JSONArray arr = new JSONArray(); arr.add(taskObj); @@ -410,4 +419,62 @@ public class ProducetaskServiceImpl implements ProducetaskService { return m.matches(); } + @Override + public JSONObject getVehicleTypeByDeviceId(Long deviceId) { + WQLObject dict = WQLObject.getWQLObject("sys_dict_detail"); + JSONObject result = new JSONObject(); + result.put("isHLJ", false); + if (ObjectUtil.isEmpty(deviceId)) { + // 如果请求参数为空返回所有 + result.put("vehicleTypeList", dict.query("dict_id = 25").getResultJSONArray(0)); + return result; + } + + // 根据设备id查询设备 + JSONObject device = WQLObject + .getWQLObject("pdm_base_device") + .query("device_id = '" + deviceId + "'") + .uniqueResult(0); + if (ObjectUtil.isEmpty(device)) { + throw new BadRequestException("设备不存在!"); + } + + // 根据设备工序id获取工序枚举对象 + WorkProcedureEnum workProcedure = WorkProcedureEnum.get(device.getString("workprocedure_id")); + if (ObjectUtil.isEmpty(workProcedure)) { + throw new BadRequestException("此设备工序不存在!"); + } + + // 根据工序区分不同的设备 + assert workProcedure != null; + switch (workProcedure) { + case HNGX: + result.put("isHLJ", true); + // 混料机只能使用料盅 + result.put("vehicleTypeList", + dict + .query("dict_id = 25 AND (value = '01' OR value = '09')") + .getResultJSONArray(0)); + break; + case YZGX: + // 压制机只能使用钢托 + result.put("vehicleTypeList", + dict + .query("dict_id = 25 AND value = '02'") + .getResultJSONArray(0)); + break; + case FJGX: + // 分拣机只能使用木托盘 + result.put("vehicleTypeList", + dict + .query("dict_id = 25 AND value IN ('03', '04', '05', '06', '07', '08')") + .getResultJSONArray(0)); + break; + default: + // 其它返回所有 + result.put("vehicleTypeList", dict.query("dict_id = 25").getResultJSONArray(0)); + } + + return result; + } } diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/wms.xls b/wms/hd/nladmin-system/src/main/java/org/nl/wms/wms.xls index 5b7382a..d61bf39 100644 Binary files a/wms/hd/nladmin-system/src/main/java/org/nl/wms/wms.xls and b/wms/hd/nladmin-system/src/main/java/org/nl/wms/wms.xls differ diff --git a/wms/hd/nladmin-system/src/main/resources/AcsToWms.xml b/wms/hd/nladmin-system/src/main/resources/AcsToWms.xml new file mode 100644 index 0000000..f0e7c88 --- /dev/null +++ b/wms/hd/nladmin-system/src/main/resources/AcsToWms.xml @@ -0,0 +1,28 @@ + + + + + + + + + ${LOG_HOME}/acstowms/%d{yyyy-MM-dd}.%i.log + + 15 + + 200MB + + 20GB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + + + + + + + + + diff --git a/wms/hd/nladmin-system/src/main/resources/WmsToAcs.xml b/wms/hd/nladmin-system/src/main/resources/WmsToAcs.xml new file mode 100644 index 0000000..857d3b5 --- /dev/null +++ b/wms/hd/nladmin-system/src/main/resources/WmsToAcs.xml @@ -0,0 +1,28 @@ + + + + + + + + + ${LOG_HOME}/wmstoacs/%d{yyyy-MM-dd}.%i.log + + 15 + + 200MB + + 20GB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + + + + + + + + + diff --git a/wms/hd/nladmin-system/src/main/resources/config/application-dev.yml b/wms/hd/nladmin-system/src/main/resources/config/application-dev.yml index b28db24..a37d777 100644 --- a/wms/hd/nladmin-system/src/main/resources/config/application-dev.yml +++ b/wms/hd/nladmin-system/src/main/resources/config/application-dev.yml @@ -8,10 +8,12 @@ spring: druid: db-type: com.alibaba.druid.pool.DruidDataSource driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy - url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:llsh_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true +# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:llsh_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true + url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:llsh_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true username: ${DB_USER:root} #password: ${DB_PWD:P@ssw0rd} - password: ${DB_PWD:Root.123456} +# password: ${DB_PWD:Root.123456} + password: ${DB_PWD:zjw123} # 初始连接数 initial-size: 5 # 最小连接数 diff --git a/wms/hd/nladmin-system/src/main/resources/logback-spring.xml b/wms/hd/nladmin-system/src/main/resources/logback-spring.xml index 3a25bd7..bf6f290 100644 --- a/wms/hd/nladmin-system/src/main/resources/logback-spring.xml +++ b/wms/hd/nladmin-system/src/main/resources/logback-spring.xml @@ -16,7 +16,8 @@ https://juejin.cn/post/6844903775631572999 - + + diff --git a/wms/qd/src/api/wms/pdm/device.js b/wms/qd/src/api/wms/pdm/device.js index 239b6df..96add27 100644 --- a/wms/qd/src/api/wms/pdm/device.js +++ b/wms/qd/src/api/wms/pdm/device.js @@ -32,6 +32,14 @@ export function changeActive(data) { }) } +export function changeIsWorkDevice(data) { + return request({ + url: 'api/device/changeIsWorkDevice', + method: 'put', + data + }) +} + export function getDevice() { return request({ url: 'api/device/getDevice', diff --git a/wms/qd/src/api/wms/pdm/producetask.js b/wms/qd/src/api/wms/pdm/producetask.js index fd3121b..555b87b 100644 --- a/wms/qd/src/api/wms/pdm/producetask.js +++ b/wms/qd/src/api/wms/pdm/producetask.js @@ -107,4 +107,12 @@ export function issued(data) { }) } -export default { add, edit, del, getMaterial, getDevice, getProduceline, getCust, getWorkprocedure, excelImport, getDevice1, copyAdd, sortUpdate, mandFinish, issued } +export function getVehicleType(data) { + return request({ + url: 'api/producetask/getVehicleType', + method: 'post', + data + }) +} + +export default { add, edit, del, getMaterial, getDevice, getProduceline, getCust, getWorkprocedure, excelImport, getDevice1, copyAdd, sortUpdate, mandFinish, issued, getVehicleType } diff --git a/wms/qd/src/views/wms/pdm/device/index.vue b/wms/qd/src/views/wms/pdm/device/index.vue index c9a26c1..18a8b77 100644 --- a/wms/qd/src/views/wms/pdm/device/index.vue +++ b/wms/qd/src/views/wms/pdm/device/index.vue @@ -23,7 +23,7 @@ - + @@ -45,6 +45,10 @@ /> + + + +