diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/position/rest/CachelinePositionController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/position/rest/CachelinePositionController.java new file mode 100644 index 00000000..2b379058 --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/position/rest/CachelinePositionController.java @@ -0,0 +1,66 @@ +package org.nl.wms.cacheline.position.rest; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.common.anno.Log; +import org.nl.wms.cacheline.position.service.CachelinePositionService; +import org.nl.wms.cacheline.position.service.dto.CachelinePositionDto; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +/** +* @author lyd +* @date 2023-03-17 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "缓存线位置管理") +@RequestMapping("/api/cachelinePosition") +@Slf4j +public class CachelinePositionController { + + private final CachelinePositionService cachelinePositionService; + + @GetMapping + @Log("查询缓存线位置") + @ApiOperation("查询缓存线位置") + //@PreAuthorize("@el.check('cachelinePosition:list')") + public ResponseEntity query(@RequestParam Map whereJson, Pageable page){ + return new ResponseEntity<>(cachelinePositionService.queryAll(whereJson,page),HttpStatus.OK); + } + + @PostMapping + @Log("新增缓存线位置") + @ApiOperation("新增缓存线位置") + //@PreAuthorize("@el.check('cachelinePosition:add')") + public ResponseEntity create(@Validated @RequestBody CachelinePositionDto dto){ + cachelinePositionService.create(dto); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @PutMapping + @Log("修改缓存线位置") + @ApiOperation("修改缓存线位置") + //@PreAuthorize("@el.check('cachelinePosition:edit')") + public ResponseEntity update(@Validated @RequestBody CachelinePositionDto dto){ + cachelinePositionService.update(dto); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除缓存线位置") + @ApiOperation("删除缓存线位置") + //@PreAuthorize("@el.check('cachelinePosition:del')") + @DeleteMapping + public ResponseEntity delete(@RequestBody String[] ids) { + cachelinePositionService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/position/service/CachelinePositionService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/position/service/CachelinePositionService.java new file mode 100644 index 00000000..5059e555 --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/position/service/CachelinePositionService.java @@ -0,0 +1,64 @@ +package org.nl.wms.cacheline.position.service; + +import org.nl.wms.cacheline.position.service.dto.CachelinePositionDto; +import org.springframework.data.domain.Pageable; + +import java.util.Map; +import java.util.List; + +/** +* @description 服务接口 +* @author lyd +* @date 2023-03-17 +**/ +public interface CachelinePositionService { + + /** + * 查询数据分页 + * @param whereJson 条件 + * @param page 分页参数 + * @return Map + */ + Map queryAll(Map whereJson, Pageable page); + + /** + * 查询所有数据不分页 + * @param whereJson 条件参数 + * @return List + */ + List queryAll(Map whereJson); + + /** + * 根据ID查询 + * @param position_code ID + * @return CachelinePosition + */ + CachelinePositionDto findById(String position_code); + + /** + * 根据编码查询 + * @param code code + * @return CachelinePosition + */ + CachelinePositionDto findByCode(String code); + + + /** + * 创建 + * @param dto / + */ + void create(CachelinePositionDto dto); + + /** + * 编辑 + * @param dto / + */ + void update(CachelinePositionDto dto); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(String[] ids); + +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/position/service/dto/CachelinePositionDto.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/position/service/dto/CachelinePositionDto.java new file mode 100644 index 00000000..2b65068f --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/position/service/dto/CachelinePositionDto.java @@ -0,0 +1,55 @@ +package org.nl.wms.cacheline.position.service.dto; + +import lombok.Data; +import java.util.Date; + +import java.math.BigDecimal; +import java.io.Serializable; + +/** +* @description / +* @author lyd +* @date 2023-03-17 +**/ +@Data +public class CachelinePositionDto implements Serializable { + + /** 缓存线位置编码 */ + private String position_code; + + /** 缓存线位置名字 */ + private String position_name; + + /** 位置顺序号 */ + private BigDecimal positionOrder_no; + + /** 缓存线编码 */ + private String cacheLine_code; + + /** 缓存线层数 */ + private BigDecimal layer_num; + + /** 优先层顺序 */ + private BigDecimal priority_layer_no; + + /** 料箱展示顺序号 */ + private BigDecimal order_no; + + /** 载具编码 */ + private String vehicle_code; + + /** 生产区域 */ + private String product_area; + + /** 是否空位 */ + private String is_empty; + + /** 是否展示 */ + private String is_show; + + /** 是否可用 */ + private String is_active; + + /** 是否删除 */ + private String is_delete; +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/position/service/impl/CachelinePositionServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/position/service/impl/CachelinePositionServiceImpl.java new file mode 100644 index 00000000..505cb3cf --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/position/service/impl/CachelinePositionServiceImpl.java @@ -0,0 +1,112 @@ +package org.nl.wms.cacheline.position.service.impl; + +import com.alibaba.fastjson.JSON; +import lombok.RequiredArgsConstructor; +import org.nl.modules.common.exception.BadRequestException; +import org.nl.modules.wql.core.bean.ResultBean; +import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.modules.wql.util.WqlUtil; +import org.nl.wms.cacheline.position.service.CachelinePositionService; +import org.nl.wms.cacheline.position.service.dto.CachelinePositionDto; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import org.nl.common.utils.SecurityUtils; + +import lombok.extern.slf4j.Slf4j; +import cn.hutool.core.util.ObjectUtil; + +/** +* @description 服务实现 +* @author lyd +* @date 2023-03-17 +**/ +@Service +@RequiredArgsConstructor +@Slf4j +public class CachelinePositionServiceImpl implements CachelinePositionService { + + @Override + public Map queryAll(Map whereJson, Pageable page){ + WQLObject wo = WQLObject.getWQLObject("sch_cacheline_position"); + ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "1=1", "position_code"); + final JSONObject json = rb.pageResult(); + return json; + } + + @Override + public List queryAll(Map whereJson){ + WQLObject wo = WQLObject.getWQLObject("sch_cacheline_position"); + JSONArray arr = wo.query().getResultJSONArray(0); + if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(CachelinePositionDto.class); + return null; + } + + @Override + public CachelinePositionDto findById(String position_code) { + WQLObject wo = WQLObject.getWQLObject("sch_cacheline_position"); + JSONObject json = wo.query("position_code = '" + position_code + "'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(json)){ + return json.toJavaObject( CachelinePositionDto.class); + } + return null; + } + + @Override + public CachelinePositionDto findByCode(String code) { + WQLObject wo = WQLObject.getWQLObject("sch_cacheline_position"); + JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(json)){ + return json.toJavaObject( CachelinePositionDto.class); + } + return null; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(CachelinePositionDto dto) { + dto.setPosition_code(IdUtil.getSnowflake(1, 1).nextIdStr()); + + WQLObject wo = WQLObject.getWQLObject("sch_cacheline_position"); + JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); + wo.insert(json); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CachelinePositionDto dto) { + CachelinePositionDto entity = this.findById(dto.getPosition_code()); + if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); + + WQLObject wo = WQLObject.getWQLObject("sch_cacheline_position"); + JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); + wo.update(json); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteAll(String[] ids) { + String currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getCurrentNickName(); + + WQLObject wo = WQLObject.getWQLObject("sch_cacheline_position"); + for (String position_code: ids) { + JSONObject param = new JSONObject(); + param.put("position_code", String.valueOf(position_code)); + param.put("is_delete", "1"); + param.put("update_optid", currentUserId); + param.put("update_optname", nickName); + param.put("update_time", DateUtil.now()); + wo.update(param); + } + } + +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/rest/AcsCacheLineController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/rest/AcsCacheLineController.java deleted file mode 100644 index f7dfadb9..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/rest/AcsCacheLineController.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.nl.wms.cacheline.rest; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; - import lombok.RequiredArgsConstructor; -import org.nl.common.anno.Log; -import lombok.extern.slf4j.Slf4j; -import org.nl.wms.cacheline.service.AcsCacheLineService; -import org.nl.wms.cacheline.service.CacheLineHandService; -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; - -import java.util.Map; - -/** - * @author qinx - * @date 2022-05-25 - **/ -@RestController -@RequiredArgsConstructor -@Api(tags = "缓存线条码管理") -@RequestMapping("/api/acs/cacheLine/") -@Slf4j -public class AcsCacheLineController { - - private final AcsCacheLineService acsCacheLineService; - - @PostMapping("/getEmptyStruct") - @Log("获取一个空的缓存线货位") - @ApiOperation("获取一个空的缓存线货位") - public ResponseEntity getEmptyStruct(@RequestBody Map whereJson) { - - return new ResponseEntity<>(acsCacheLineService.getEmptyStruct(whereJson), HttpStatus.OK); - } - - @PostMapping("/getFullStruct") - @Log("获取一个有料的缓存线货位") - @ApiOperation("获取一个有料的缓存线货位") - public ResponseEntity getFullStruct(@RequestBody Map whereJson) { - - return new ResponseEntity<>(acsCacheLineService.getFullStruct(whereJson), HttpStatus.OK); - } - - @PostMapping("/updateStruct") - @Log("更新缓存线货位") - @ApiOperation("更新缓存线货位") - public ResponseEntity updateStruct(@RequestBody Map whereJson) { - return new ResponseEntity<>(acsCacheLineService.updateStruct(whereJson), HttpStatus.OK); - } - -} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/rest/CacheLineHandController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/rest/CacheLineHandController.java deleted file mode 100644 index 29607bb7..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/rest/CacheLineHandController.java +++ /dev/null @@ -1,206 +0,0 @@ -package org.nl.wms.cacheline.rest; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; - import lombok.RequiredArgsConstructor; -import org.nl.common.anno.Log; -import lombok.extern.slf4j.Slf4j; -import org.nl.wms.cacheline.service.CacheLineHandService; -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; - -import java.util.Map; - -/** - * @author qinx - * @date 2022-05-25 - **/ -@RestController -@RequiredArgsConstructor -@Api(tags = "缓存线条码管理") -@RequestMapping("/api/cacheLine/pda") -@Slf4j -public class CacheLineHandController { - - private final CacheLineHandService cacheLineHandService; - - @PostMapping("/semiMaterialSpecQuery") - @Log("半成品物料规格查询") - @ApiOperation("半成品物料规格查询") - public ResponseEntity semiMaterialSpecQuery(@RequestBody Map whereJson) { - - return new ResponseEntity<>(cacheLineHandService.semiMaterialSpecQuery(whereJson), HttpStatus.OK); - } - - @PostMapping("/workprocedureQuery") - @Log("工序下拉框查询") - @ApiOperation("工序下拉框查询") - public ResponseEntity workprocedureQuery(@RequestBody Map whereJson) { - - return new ResponseEntity<>(cacheLineHandService.workprocedureQuery(whereJson), HttpStatus.OK); - } - - - @PostMapping("/cacheLineMaterInfoQuery") - @Log("缓存线料箱条码查询料箱信息") - @ApiOperation("缓存线料箱条码查询料箱信息") - public ResponseEntity cacheLineMaterInfoQuery(@RequestBody Map whereJson) { - return new ResponseEntity<>(cacheLineHandService.cacheLineMaterInfoQuery(whereJson), HttpStatus.OK); - } - - @PostMapping("/deviceQuery") - @Log("缓存线设备下拉框查询") - @ApiOperation("缓存线设备下拉框查询") - public ResponseEntity deviceQuery(@RequestBody Map whereJson) { - return new ResponseEntity<>(cacheLineHandService.deviceQuery(whereJson), HttpStatus.OK); - } - - @PostMapping("/inOutEmptyBox") - @Log("空箱初始化--出入空箱") - @ApiOperation("空箱初始化--出入空箱") - public ResponseEntity inOutEmptyBox(@RequestBody Map whereJson) { - return new ResponseEntity<>(cacheLineHandService.inOutEmptyBox(whereJson), HttpStatus.OK); - } - - @PostMapping("/inOutExceptionInstQuery") - @Log("缓存线出入箱异常指令查询") - @ApiOperation("缓存线出入箱异常指令查询") - public ResponseEntity inOutExceptionInstQuery(@RequestBody Map whereJson) { - - return new ResponseEntity<>(cacheLineHandService.inOutExceptionInstQuery(whereJson), HttpStatus.OK); - } - - @PostMapping("/inOutExceptionInstConfirm") - @Log("缓存线出入箱异常指令确认") - @ApiOperation("缓存线出入箱异常指令确认") - public ResponseEntity inOutExceptionInstConfirm(@RequestBody Map whereJson) { - - return new ResponseEntity<>(cacheLineHandService.inOutExceptionInstConfirm(whereJson), HttpStatus.OK); - } - - @PostMapping("/setfullBox") - @Log("设置满匡") - @ApiOperation("设置满匡") - public ResponseEntity setfullBox(@RequestBody Map whereJson) { - return new ResponseEntity<>(cacheLineHandService.setfullBox(whereJson), HttpStatus.OK); - } - - @PostMapping("/setEmptyBox") - @Log("设置空匡") - @ApiOperation("设置空匡") - public ResponseEntity setEmptyBox(@RequestBody Map whereJson) { - - return new ResponseEntity<>(cacheLineHandService.setEmptyBox(whereJson), HttpStatus.OK); - } - - @PostMapping("/agvInBoxExceptionQuery") - @Log("AGV入箱异常-查询") - @ApiOperation("AGV入箱异常-查询") - public ResponseEntity agvInBoxExceptionQuery(@RequestBody Map whereJson) { - - return new ResponseEntity<>(cacheLineHandService.agvInBoxExceptionQuery(whereJson), HttpStatus.OK); - } - - @PostMapping("/agvInBoxExceptionConfirm") - @Log("AGV入箱异常-确认") - @ApiOperation("AGV入箱异常-确认") - public ResponseEntity agvInBoxExceptionConfirm(@RequestBody Map whereJson) { - - return new ResponseEntity<>(cacheLineHandService.agvInBoxExceptionConfirm(whereJson), HttpStatus.OK); - } - - @PostMapping("/agvOutBoxExceptionQuery") - @Log("AGV出箱异常-查询") - @ApiOperation("AGV出箱异常-查询") - public ResponseEntity agvOutBoxExceptionQuery(@RequestBody Map whereJson) { - - return new ResponseEntity<>(cacheLineHandService.agvOutBoxExceptionQuery(whereJson), HttpStatus.OK); - } - - @PostMapping("/agvOutBoxExceptionConfirm") - @Log(" AGV出箱异常-确认") - @ApiOperation(" AGV出箱异常-确认") - public ResponseEntity agvOutBoxExceptionConfirm(@RequestBody Map whereJson) { - - return new ResponseEntity<>(cacheLineHandService.agvOutBoxExceptionConfirm(whereJson), HttpStatus.OK); - } - - @PostMapping("/cacheLineOutBoxExceptionQuery") - @Log("缓存线出箱异常-查询") - @ApiOperation("缓存线出箱异常-查询") - public ResponseEntity cacheLineOutBoxExceptionQuery(@RequestBody Map whereJson) { - - return new ResponseEntity<>(cacheLineHandService.cacheLineOutBoxExceptionQuery(whereJson), HttpStatus.OK); - } - - @PostMapping("/cacheLineOutBoxExceptionConfirm") - @Log("缓存线出箱异常-确认") - @ApiOperation("缓存线出箱异常-确认") - public ResponseEntity cacheLineOutBoxExceptionConfirm(@RequestBody Map whereJson) { - - return new ResponseEntity<>(cacheLineHandService.cacheLineOutBoxExceptionConfirm(whereJson), HttpStatus.OK); - } - - - @PostMapping("/materialQuery") - @Log("物料信息查询") - @ApiOperation("物料信息查询") - public ResponseEntity materialQuery(@RequestBody Map whereJson) { - - return new ResponseEntity<>(cacheLineHandService.materialQuery(whereJson), HttpStatus.OK); - } - - @PostMapping("/setBlankPos") - @Log("设置缓存线货位为空位置") - @ApiOperation("设置缓存线货位为空位置") - public ResponseEntity setBlankPos(@RequestBody Map whereJson) { - - return new ResponseEntity<>(cacheLineHandService.setBlankPos(whereJson), HttpStatus.OK); - } - - @PostMapping("/instStatusQuery") - @Log("指令状态下拉框查询") - @ApiOperation("指令状态下拉框查询") - public ResponseEntity instStatusQuery(@RequestBody Map whereJson) { - - return new ResponseEntity<>(cacheLineHandService.instStatusQuery(whereJson), HttpStatus.OK); - } - - @PostMapping("/cacheLineExcepOpt") - @Log("缓存线异常处理") - @ApiOperation("缓存线异常处理") - public ResponseEntity cacheLineExcepOpt(@RequestBody Map whereJson) { - - return new ResponseEntity<>(cacheLineHandService.cacheLineExcepOpt(whereJson), HttpStatus.OK); - } - - @PostMapping("/instPageQuery") - @Log("指令分页查询") - @ApiOperation("指令分页查询") - public ResponseEntity instPageQuery(@RequestBody Map whereJson) { - - return new ResponseEntity<>(cacheLineHandService.instPageQuery(whereJson), HttpStatus.OK); - } - - @PostMapping("/instOperation") - @Log("指令操作") - @ApiOperation("指令操作") - public ResponseEntity instOperation(@RequestBody Map whereJson) { - - return new ResponseEntity<>(cacheLineHandService.instOperation(whereJson), HttpStatus.OK); - } - - @PostMapping("/pourMaterial") - @Log("倒料操作") - @ApiOperation("倒料操作") - public ResponseEntity pourMaterial(@RequestBody Map whereJson) { - - return new ResponseEntity<>(cacheLineHandService.pourMaterial(whereJson), HttpStatus.OK); - } - - -} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/rest/MateriorecordController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/rest/MateriorecordController.java deleted file mode 100644 index 0e7d51bf..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/rest/MateriorecordController.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.nl.wms.cacheline.rest; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; - import lombok.RequiredArgsConstructor; -import org.nl.common.anno.Log; -import lombok.extern.slf4j.Slf4j; -import org.nl.wms.cacheline.service.MateriorecordService; -import org.nl.wms.cacheline.service.dto.MateriorecordDto; -import org.springframework.data.domain.Pageable; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.util.Map; - -/** -* @author qinx -* @date 2022-05-26 -**/ -@RestController -@RequiredArgsConstructor -@Api(tags = "缓存线物料出入记录管理") -@RequestMapping("/api/materiorecord") -@Slf4j -public class MateriorecordController { - - private final MateriorecordService materiorecordService; - - @GetMapping - @Log("查询缓存线物料出入记录") - @ApiOperation("查询缓存线物料出入记录") - //@PreAuthorize("@el.check('materiorecord:list')") - public ResponseEntity query(@RequestParam Map whereJson, Pageable page){ - return new ResponseEntity<>(materiorecordService.queryAll(whereJson,page),HttpStatus.OK); - } - - @PostMapping - @Log("新增缓存线物料出入记录") - @ApiOperation("新增缓存线物料出入记录") - //@PreAuthorize("@el.check('materiorecord:add')") - public ResponseEntity create(@Validated @RequestBody MateriorecordDto dto){ - materiorecordService.create(dto); - return new ResponseEntity<>(HttpStatus.CREATED); - } - - @PutMapping - @Log("修改缓存线物料出入记录") - @ApiOperation("修改缓存线物料出入记录") - //@PreAuthorize("@el.check('materiorecord:edit')") - public ResponseEntity update(@Validated @RequestBody MateriorecordDto dto){ - materiorecordService.update(dto); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @Log("删除缓存线物料出入记录") - @ApiOperation("删除缓存线物料出入记录") - //@PreAuthorize("@el.check('materiorecord:del')") - @DeleteMapping - public ResponseEntity delete(@RequestBody Long[] ids) { - materiorecordService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } - -} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/rest/VehicleController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/rest/VehicleController.java deleted file mode 100644 index 626a44b9..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/rest/VehicleController.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.nl.wms.cacheline.rest; - - -import com.alibaba.fastjson.JSONObject; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; - import lombok.RequiredArgsConstructor; -import org.nl.common.anno.Log; -import lombok.extern.slf4j.Slf4j; - -import org.nl.wms.cacheline.service.VehicleService; -import org.nl.wms.cacheline.service.dto.VehicleDto; -import org.springframework.data.domain.Pageable; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.util.Map; - -/** -* @author qinx -* @date 2022-05-25 -**/ -@RestController -@RequiredArgsConstructor -@Api(tags = "缓存线条码管理") -@RequestMapping("/api/vehicle") -@Slf4j -public class VehicleController { - - private final VehicleService vehicleService; - - @GetMapping - @Log("查询缓存线条码") - @ApiOperation("查询缓存线条码") - //@PreAuthorize("@el.check('vehicle:list')") - public ResponseEntity query(@RequestParam Map whereJson, Pageable page){ - return new ResponseEntity<>(vehicleService.queryAll(whereJson,page),HttpStatus.OK); - } - - @PostMapping - @Log("新增缓存线条码") - @ApiOperation("新增缓存线条码") - //@PreAuthorize("@el.check('vehicle:add')") - public ResponseEntity create(@Validated @RequestBody VehicleDto dto){ - vehicleService.create(dto); - return new ResponseEntity<>(HttpStatus.CREATED); - } - - @PutMapping - @Log("修改缓存线条码") - @ApiOperation("修改缓存线条码") - //@PreAuthorize("@el.check('vehicle:edit')") - public ResponseEntity update(@Validated @RequestBody VehicleDto dto){ - vehicleService.update(dto); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @Log("删除缓存线条码") - @ApiOperation("删除缓存线条码") - //@PreAuthorize("@el.check('vehicle:del')") - @DeleteMapping - public ResponseEntity delete(@RequestBody Long[] ids) { - vehicleService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } - @PutMapping("/changeActive") - @Log("修改点位启用状态") - @ApiOperation("修改点位启用状态") - //@PreAuthorize("@el.check('store:edit')") - public ResponseEntity changeActive(@RequestBody JSONObject json) { - vehicleService.changeActive(json); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - @PutMapping("/changePrint") - @Log("修改点位启用状态") - @ApiOperation("修改点位启用状态") - //@PreAuthorize("@el.check('store:edit')") - public ResponseEntity changePrint(@RequestBody JSONObject json) { - vehicleService.changePrint(json); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } -} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/rest/VehilematerialController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/rest/VehilematerialController.java deleted file mode 100644 index 418eaa74..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/rest/VehilematerialController.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.nl.wms.cacheline.rest; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; - import lombok.RequiredArgsConstructor; -import org.nl.common.anno.Log; -import lombok.extern.slf4j.Slf4j; -import org.nl.wms.cacheline.service.VehilematerialService; -import org.nl.wms.cacheline.service.dto.VehilematerialDto; -import org.springframework.data.domain.Pageable; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.util.Map; - -/** -* @author qinx -* @date 2022-05-25 -**/ -@RestController -@RequiredArgsConstructor -@Api(tags = "缓存线载具物料管理") -@RequestMapping("/api/vehilematerial") -@Slf4j -public class VehilematerialController { - - private final VehilematerialService vehilematerialService; - - @GetMapping - @Log("查询缓存线载具物料") - @ApiOperation("查询缓存线载具物料") - //@PreAuthorize("@el.check('vehilematerial:list')") - public ResponseEntity query(@RequestParam Map whereJson, Pageable page){ - return new ResponseEntity<>(vehilematerialService.queryAll(whereJson,page),HttpStatus.OK); - } - - @PostMapping - @Log("新增缓存线载具物料") - @ApiOperation("新增缓存线载具物料") - //@PreAuthorize("@el.check('vehilematerial:add')") - public ResponseEntity create(@Validated @RequestBody VehilematerialDto dto){ - vehilematerialService.create(dto); - return new ResponseEntity<>(HttpStatus.CREATED); - } - - @PutMapping - @Log("修改缓存线载具物料") - @ApiOperation("修改缓存线载具物料") - //@PreAuthorize("@el.check('vehilematerial:edit')") - public ResponseEntity update(@Validated @RequestBody VehilematerialDto dto){ - vehilematerialService.update(dto); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @Log("删除缓存线载具物料") - @ApiOperation("删除缓存线载具物料") - //@PreAuthorize("@el.check('vehilematerial:del')") - @DeleteMapping - public ResponseEntity delete(@RequestBody Long[] ids) { - vehilematerialService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } - -} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/AcsCacheLineService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/AcsCacheLineService.java deleted file mode 100644 index f83c53dd..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/AcsCacheLineService.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.nl.wms.cacheline.service; - -import java.util.Map; - -/** - * @author qinx - * @description 服务接口 - * @date 2022-05-25 - **/ -public interface AcsCacheLineService { - - /** - * 获取一个空的缓存线货位 - */ - Map getEmptyStruct(Map jsonObject); - - /** - * 获取一个有料的缓存线货位 - */ - Map getFullStruct(Map jsonObject); - - /** - * 更新缓存线货位 - */ - Map updateStruct(Map jsonObject); - - -} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/CacheLineHandService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/CacheLineHandService.java deleted file mode 100644 index d3736ce3..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/CacheLineHandService.java +++ /dev/null @@ -1,118 +0,0 @@ -package org.nl.wms.cacheline.service; - -import java.util.Map; - -/** - * @author qinx - * @description 服务接口 - * @date 2022-05-25 - **/ -public interface CacheLineHandService { - - /** - * 半成品物料规格查询 - */ - Map semiMaterialSpecQuery(Map jsonObject); - - /** - * 工序下拉框查询 - */ - Map workprocedureQuery(Map jsonObject); - - /** - * 缓存线料箱条码查询料箱信息 - */ - Map deviceQuery(Map jsonObject); - /** - * 缓存线料箱条码查询料箱信息 - */ - Map cacheLineMaterInfoQuery(Map jsonObject); - - /** - * 空箱初始化--出入空箱 - */ - Map inOutEmptyBox(Map jsonObject); - - /** - * 缓存线出入箱异常指令查询 - */ - Map inOutExceptionInstQuery(Map jsonObject); - - /** - * 缓存线出入箱异常指令确认 - */ - Map inOutExceptionInstConfirm(Map jsonObject); - - /** - * 设置满匡 - */ - Map setfullBox(Map jsonObject); - - /** - * 设置空匡 - */ - Map setEmptyBox(Map jsonObject); - - /** - * AGV入箱异常-查询 - */ - Map agvInBoxExceptionQuery(Map jsonObject); - - /** - * AGV入箱异常-确认 - */ - Map agvInBoxExceptionConfirm(Map jsonObject); - /** - * AGV出箱异常-查询 - */ - Map agvOutBoxExceptionQuery(Map jsonObject); - /** - * AGV出箱异常-确认 - */ - Map agvOutBoxExceptionConfirm(Map jsonObject); - - /** - * 缓存线出箱异常-查询 - */ - Map cacheLineOutBoxExceptionQuery(Map jsonObject); - - /** - * 缓存线出箱异常-确认 - */ - Map cacheLineOutBoxExceptionConfirm(Map jsonObject); - - /** - * 物料信息查询 - */ - Map materialQuery(Map jsonObject); - - /** - * 设置缓存线货位为空位置 - */ - Map setBlankPos(Map jsonObject); - - /** - * 缓存线异常处理 - */ - Map instStatusQuery(Map jsonObject); - - /** - * 缓存线异常处理 - */ - Map cacheLineExcepOpt(Map jsonObject); - - /** - * 指令操作 - */ - Map instOperation(Map jsonObject); - /** - * 倒料操作 - */ - Map pourMaterial(Map jsonObject); - /** - * 指令分页查询 - */ - Map instPageQuery(Map jsonObject); - - -} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/MateriorecordService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/MateriorecordService.java deleted file mode 100644 index bb5e40e4..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/MateriorecordService.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.nl.wms.cacheline.service; - -import org.nl.wms.cacheline.service.dto.MateriorecordDto; -import org.springframework.data.domain.Pageable; - -import java.util.List; -import java.util.Map; - -/** - * @author qinx - * @description 服务接口 - * @date 2022-05-26 - **/ -public interface MateriorecordService { - - /** - * 查询数据分页 - * - * @param whereJson 条件 - * @param page 分页参数 - * @return Map - */ - Map queryAll(Map whereJson, Pageable page); - - /** - * 查询所有数据不分页 - * - * @param whereJson 条件参数 - * @return List - */ - List queryAll(Map whereJson); - - /** - * 根据ID查询 - * - * @param record_uuid ID - * @return Materiorecord - */ - MateriorecordDto findById(Long record_uuid); - - /** - * 根据编码查询 - * - * @param code code - * @return Materiorecord - */ - MateriorecordDto findByCode(String code); - - - /** - * 创建 - * - * @param dto / - */ - void create(MateriorecordDto dto); - - /** - * 编辑 - * - * @param dto / - */ - void update(MateriorecordDto dto); - - /** - * 多选删除 - * - * @param ids / - */ - void deleteAll(Long[] ids); - -} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/VehicleService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/VehicleService.java deleted file mode 100644 index 7d5a4327..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/VehicleService.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.nl.wms.cacheline.service; - -import com.alibaba.fastjson.JSONObject; -import org.nl.wms.cacheline.service.dto.VehicleDto; -import org.springframework.data.domain.Pageable; - -import java.util.List; -import java.util.Map; - -/** -* @description 服务接口 -* @author qinx -* @date 2022-05-25 -**/ -public interface VehicleService { - - /** - * 查询数据分页 - * @param whereJson 条件 - * @param page 分页参数 - * @return Map - */ - Map queryAll(Map whereJson, Pageable page); - - /** - * 查询所有数据不分页 - * @param whereJson 条件参数 - * @return List - */ - List queryAll(Map whereJson); - - /** - * 根据ID查询 - * @param vehicle_uuid ID - * @return Vehicle - */ - VehicleDto findById(Long vehicle_uuid); - - /** - * 根据编码查询 - * @param code code - * @return Vehicle - */ - VehicleDto findByCode(String code); - - - /** - * 创建 - * @param dto / - */ - void create(VehicleDto dto); - - /** - * 编辑 - * @param dto / - */ - void update(VehicleDto dto); - - /** - * 多选删除 - * @param ids / - */ - void deleteAll(Long[] ids); - - void changeActive(JSONObject json); - void changePrint(JSONObject json); - -} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/dto/MateriorecordDto.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/dto/MateriorecordDto.java deleted file mode 100644 index cd44f62a..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/dto/MateriorecordDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.nl.wms.cacheline.service.dto; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import lombok.Data; -import java.util.Date; - - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.Date; - -/** -* @description / -* @author qinx -* @date 2022-05-26 -**/ -@Data -public class MateriorecordDto implements Serializable { - - /** 记录标识 */ - /** 防止精度丢失 */ - @JsonSerialize(using= ToStringSerializer.class) - private Long record_uuid; - - /** 缓存线标识 */ - private Long device_uuid; - - /** 缓存线编码 */ - private String extdevice_code; - - /** 缓存线名字 */ - private String device_name; - - /** 缓存线层数 */ - private BigDecimal layer_num; - - /** 出入类型 */ - private String io_type; - - /** 载具标识 */ - private Long vehicle_uuid; - - /** 载具编码 */ - private String vehicle_code; - - /** 工序标识 */ - private Long workprocedure_uuid; - - /** 载具状态 */ - private String vehicle_status; - - /** 物料标识 */ - private Long material_uuid; - - /** 料箱物料数量 */ - private BigDecimal quantity; - - /** 料箱物料重量 */ - private BigDecimal weight; - - /** 物料工单标识 */ - private Long produceorder_uuid; - - /** 物料工单编码 */ - private String produceorder_code; - - /** 创建时间 */ - private String create_time; - - /** 更新时间 */ - private String update_time; - - /** 是否可用 */ - private String is_active; - - /** 是否删除 */ - private String is_delete; -} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/dto/VehicleDto.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/dto/VehicleDto.java deleted file mode 100644 index 31aadaa4..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/dto/VehicleDto.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.nl.wms.cacheline.service.dto; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import lombok.Data; -import java.util.Date; - - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.Date; - -/** -* @description / -* @author qinx -* @date 2022-05-25 -**/ -@Data -public class VehicleDto implements Serializable { - - /** 载具标识 */ - /** 防止精度丢失 */ - @JsonSerialize(using= ToStringSerializer.class) - private Long vehicle_uuid; - - /** 载具编码 */ - private String vehicle_code; - - /** 打印次数 */ - private BigDecimal print_num; - - /** 是否打印 */ - private String is_print; - - /** 创建时间 */ - private String create_time; - - /** 更新时间 */ - private String update_time; - - /** 打印时间 */ - private String print_time; - - /** 是否可用 */ - private String is_active; - - /** 是否删除 */ - private String is_delete; - - /** 创建人 */ - private String create_id; - - /** 创建人姓名 */ - private String create_name; - - /** 修改人 */ - private String update_id; - - /** 修改人姓名 */ - private String update_name; -} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/dto/VehilematerialDto.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/dto/VehilematerialDto.java deleted file mode 100644 index aa6f9414..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/dto/VehilematerialDto.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.nl.wms.cacheline.service.dto; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import lombok.Data; - - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.Date; - -/** -* @description / -* @author qinx -* @date 2022-05-25 -**/ -@Data -public class VehilematerialDto implements Serializable { - - /** 载具库存标识 */ - /** 防止精度丢失 */ - @JsonSerialize(using= ToStringSerializer.class) - private Long vehmaterial_uuid; - - private Long position_uuid; - - /** 载具标识 */ - private Long vehicle_uuid; - - /** 载具编码 */ - private String vehicle_code; - - /** 载具状态 */ - private String vehicle_status; - - /** 缓存线编码 */ - private String extdevice_code; - - /** 异常类型 */ - private String err_type; - - /** 物料工单标识 */ - private Long produceorder_uuid; - - /** 物料工单编码 */ - private String produceorder_code; - - /** 工序标识 */ - private Long workprocedure_uuid; - - /** 工序编号 */ - private String workprocedure_code; - - /** 工序名称 */ - private String workprocedure_name; - - /** 物料标识 */ - private Long material_uuid; - - /** 料箱物料数量 */ - private BigDecimal quantity; - - /** 料箱物料重量 */ - private BigDecimal weight; - - /** 创建时间 */ - private String create_time; - - /** 更新时间 */ - private String update_time; - - /** 是否可用 */ - private String is_active; - - /** 是否删除 */ - private String is_delete; -} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/impl/AcsCacheLineServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/impl/AcsCacheLineServiceImpl.java deleted file mode 100644 index df219faa..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/impl/AcsCacheLineServiceImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.nl.wms.cacheline.service.impl; - -import cn.hutool.core.util.ObjectUtil; -import com.alibaba.fastjson.JSONObject; - import lombok.RequiredArgsConstructor; -import org.nl.common.anno.Log; -import lombok.extern.slf4j.Slf4j; -import org.nl.modules.common.exception.BadRequestException; -import org.nl.modules.wql.WQL; -import org.nl.modules.wql.core.bean.WQLObject; -import org.nl.wms.cacheline.service.AcsCacheLineService; - - -import org.springframework.stereotype.Service; - -import java.util.Map; - -/** - * @author qinx - * @description 服务实现 - * @date 2022-05-25 - **/ -@Service -@RequiredArgsConstructor -@Slf4j -public class AcsCacheLineServiceImpl implements AcsCacheLineService { - - @Override - public Map getEmptyStruct(Map jsonObject) { - JSONObject result = WQL.getWO("QACS_CACHE_005").addParam("flag", "1").process().uniqueResult(0); - if (ObjectUtil.isEmpty(result)) { - throw new BadRequestException("未知道合适的位置!"); - } - return result; - } - - @Override - public Map getFullStruct(Map jsonObject) { - - //物料,工序 默认能取到 - String produceorder_uuid = jsonObject.get("produceorder_uuid"); - String material_uuid = jsonObject.get("material_uuid"); - JSONObject result = WQL.getWO("QACS_CACHE_005").addParam("flag", "2").addParam("material_uuid", material_uuid).addParam("produceorder_uuid", produceorder_uuid).process().uniqueResult(0); - if (ObjectUtil.isEmpty(result)) { - throw new BadRequestException("未知道合适的位置!"); - } - return result; - } - - @Override - public Map updateStruct(Map jsonObject) { - //默认取到 position_code(缓存线位置编码) vehicle_uuid vehicle_code - String position_code = jsonObject.get("position_code"); - String vehicle_uuid = jsonObject.get("vehicle_uuid"); - String vehicle_code = jsonObject.get("vehicle_code"); - JSONObject positionObj = WQLObject.getWQLObject("ST_CacheLine_Position").query("position_code='" + position_code + "'").uniqueResult(0); - positionObj.put("vehicle_uuid", vehicle_uuid); - positionObj.put("vehicle_code", vehicle_code); - WQLObject.getWQLObject("ST_CacheLine_Position").update(positionObj); - return null; - } -} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/impl/CacheLineHandServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/impl/CacheLineHandServiceImpl.java deleted file mode 100644 index 65ad89ca..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/impl/CacheLineHandServiceImpl.java +++ /dev/null @@ -1,808 +0,0 @@ -package org.nl.wms.cacheline.service.impl; - - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.NumberUtil; -import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; - import lombok.RequiredArgsConstructor; -import org.nl.common.anno.Log; -import lombok.extern.slf4j.Slf4j; -import org.nl.modules.common.exception.BadRequestException; -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.cacheline.service.CacheLineHandService; - -import org.springframework.data.domain.PageRequest; -import org.springframework.data.domain.Pageable; -import org.springframework.stereotype.Service; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author qinx - * @description 服务实现 - * @date 2022-05-25 - **/ -@Service -@RequiredArgsConstructor -@Slf4j -public class CacheLineHandServiceImpl implements CacheLineHandService { - - @Override - public Map semiMaterialSpecQuery(Map jsonObject) { - // 半成品规格下拉框查询 - JSONArray arr = WQL.getWO("QWCS_CACHE_004").addParam("flag", "1").process().getResultJSONArray(0); - JSONObject srb = new JSONObject(); - srb.put("result", arr); - srb.put("code", 1); - srb.put("desc", "查询成功!"); - return srb; - } - - @Override - public Map workprocedureQuery(Map jsonObject) { - // 工序下拉框查询 - JSONArray arr = WQL.getWO("QWCS_CACHE_004").addParam("flag", "2").process().getResultJSONArray(0); - JSONObject srb = new JSONObject(); - srb.put("result", arr); - srb.put("code", 1); - srb.put("desc", "查询成功!"); - return srb; - } - - @Override - public Map deviceQuery(Map jsonObject) { - //查询缓存线设备 - JSONArray arr = WQL.getWO("QWCS_CACHE_004").addParam("flag", "5").process().getResultJSONArray(0); - JSONObject srb = new JSONObject(); - srb.put("result", arr); - srb.put("code", 1); - srb.put("desc", "查询成功!"); - return srb; - } - - @Override - public Map cacheLineMaterInfoQuery(Map jsonObject) { - // 缓存线位置表【ST_cacheLine_Position】 - WQLObject positionTab = WQLObject.getWQLObject("ST_cacheLine_Position"); - JSONArray arr = positionTab - .query("extdevice_code like '%" + jsonObject.get("wcsdevice_code") + "%'", "layer_num desc,order_no") - .getResultJSONArray(0); - // 缓存线载具物料表【IF_cacheLine_VehileMaterial】 - WQLObject ivtTab = WQLObject.getWQLObject("IF_cacheLine_VehileMaterial"); - - JSONObject srb = new JSONObject(); - for (int i = 0; i < arr.size(); i++) { - JSONObject json = arr.getJSONObject(i); - json.put("seat_order_num", json.get("order_no")); - // 0空位 status = 1: 绿色空箱 || status = 2:黄色满箱 || status = 3:红色异常 || status = 4 :不显示 - json.put("weight", "0"); - json.put("quantity", "0"); - if ("0".equals(json.getString("is_show"))) { - json.put("vehicle_status", "04"); - } else {// 显示 - if ("1".equals(json.getString("is_blank"))) { - json.put("vehicle_status", "00"); - } else {// 载具不为空 - String vehicle_code = json.getString("vehicle_code"); - JSONObject ivtObj = ivtTab.query("vehicle_code = '" + vehicle_code + "' and extdevice_code like '%" - + jsonObject.get("wcsdevice_code") + "%'").uniqueResult(0); - if (ivtObj == null) { - // 异常 - json.put("vehicle_status", "03"); - } else { - json.put("vehicle_status", ivtObj.getString("vehicle_status")); - json.put("weight", ivtObj.getString("weight")); - json.put("quantity", ivtObj.getString("quantity")); - json.putAll(ivtObj); - - } - } - } - json.put("is_err", "0"); - json.put("wcsdevice_code", json.getString("extdevice_code")); - // 去掉小数 - json.put("weight", NumberUtil.roundStr(json.getString("weight"), 0)); - json.put("status", json.getString("vehicle_status").substring(1, 2)); - - if (!"00".equals(json.getString("err_type"))) { - json.put("is_err", "1"); - } - - } - - srb.put("code", 1); - srb.put("result", arr); - srb.put("desc", "操作成功!"); - return srb; - } - - @Override - public Map inOutEmptyBox(Map jsonObject) { - String inOut_type = jsonObject.get("inOut_type"); - String extdevice_code = jsonObject.get("wcsdevice_code"); - String vehicle_code = jsonObject.get("vehicle_code"); - - // 缓存线位置表【ST_cacheLine_Position】 - WQLObject positionTab = WQLObject.getWQLObject("ST_cacheLine_Position"); - WQLObject vehMaterTab = WQLObject.getWQLObject("IF_cacheLine_VehileMaterial"); - // 入空箱 - if ("1".equals(inOut_type)) { - // 判断是否可以放入空箱子 - JSONObject ivtObj = positionTab.query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0); - // 判断箱子是否在缓存线内 - if (ivtObj != null) { - throw new BadRequestException("箱子【" + vehicle_code + "】已在库内,无法入空箱!"); - } - - // 判断是否可以放入空箱子 - JSONObject json = positionTab.query("extdevice_code = '" + extdevice_code + "' and is_blank= '1'") - .uniqueResult(0); - if (json == null) { - throw new BadRequestException("无法找到缓存线【" + extdevice_code + "】的空位,无法入空箱!"); - } - - // 入了空箱子 - JSONObject afterIvt = new JSONObject(); - afterIvt.put("vehmaterial_uuid", IdUtil.getSnowflake(1, 1).nextId()); - afterIvt.put("vehicle_uuid", vehicle_code); - afterIvt.put("vehicle_code", vehicle_code); - afterIvt.put("extdevice_code", extdevice_code); - afterIvt.put("vehicle_status", "01"); - afterIvt.put("update_time", DateUtil.now()); - afterIvt.put("create_time", DateUtil.now()); - vehMaterTab.insert(afterIvt); - - } - // 出空箱 - if ("2".equals(inOut_type)) { - // 缓存线载具物料表【IF_cacheLine_VehileMaterial】 - JSONObject json = vehMaterTab.query("extdevice_code = '" + extdevice_code - + "' and vehicle_status= '01' and vehicle_code = '" + vehicle_code + "'").uniqueResult(0); - if (json == null) { - throw new BadRequestException("无法找到缓存线【" + extdevice_code + "】的空箱【" + vehicle_code + "】,出空箱失败"); - } - - // 删除掉出库的箱子 - vehMaterTab.delete("extdevice_code = '" + extdevice_code + "' and vehicle_code = '" + vehicle_code + "'"); - - } - JSONObject srb = new JSONObject(); - srb.put("code", 1); - srb.put("desc", "操作成功!"); - return srb; - } - - @Override - public Map inOutExceptionInstQuery(Map jsonObject) { - String vehicle_code = jsonObject.get("vehicle_code"); - String wcsdevice_code = jsonObject.get("wcsdevice_code"); - String inOut_type = jsonObject.get("inOut_type"); - - WQLObject instructTab = WQLObject.getWQLObject("sch_base_task"); - - JSONArray result = new JSONArray(); - - // 入箱扫码异常 - if ("1".equals(inOut_type)) { - String where = "next_point_code = '" + wcsdevice_code + "' and task_status <> '06'"; - - if (StrUtil.isNotBlank(vehicle_code)) { - where = "next_point_code = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code - + "' and task_status <> '06'"; - } - JSONArray arr = instructTab.query(where).getResultJSONArray(0); - - for (int i = 0; i < arr.size(); i++) { - JSONObject row = arr.getJSONObject(i); - JSONObject json = new JSONObject(); - json.put("instruct_uuid", row.getString("instruct_uuid")); - json.put("instructorder_no", row.getString("instructorder_no")); - json.put("wcsdevice_code", row.getString("next_point_code")); - json.put("vehicle_code", row.getString("invehicle_code")); - json.put("start_point_code", row.getString("start_point_code")); - json.put("nextpoint_code", row.getString("next_point_code")); - json.put("nextpoint_code2", row.getString("next_point_code")); - result.add(json); - } - } - // 出箱扫码异常 - if ("2".equals(inOut_type)) { - String where = "start_point_code = '" + wcsdevice_code + "' and task_status <> '06'"; - - if (StrUtil.isNotBlank(vehicle_code)) { - where = "start_point_code = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code - + "' and task_status <> '06'"; - } - - JSONArray arr = instructTab.query(where).getResultJSONArray(0); - for (int i = 0; i < arr.size(); i++) { - JSONObject row = arr.getJSONObject(i); - JSONObject json = new JSONObject(); - json.put("instruct_uuid", row.getString("instruct_uuid")); - json.put("instructorder_no", row.getString("instructorder_no")); - json.put("vehicle_code", row.getString("outvehicle_code")); - json.put("wcsdevice_code", row.getString("start_point_code")); - json.put("start_point_code", row.getString("start_point_code")); - json.put("nextpoint_code", row.getString("nextpoint_code")); - json.put("nextpoint_code2", row.getString("nextpoint_code2")); - result.add(json); - } - } - - JSONObject srb = new JSONObject(); - srb.put("code", 1); - srb.put("desc", "操作成功!"); - return srb; - } - - @Override - public Map inOutExceptionInstConfirm(Map jsonObject) { - WQLObject instructTab = WQLObject.getWQLObject("sch_base_task"); - // 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码 - String inOut_type = jsonObject.get("inOut_type"); - // 缓存线编码 - String wcsdevice_code = jsonObject.get("wcsdevice_code"); - // - String vehicle_code = jsonObject.get("vehicle_code"); - // 指令标识 - // String instruct_uuid = jsonObject.optString("instruct_uuid"); - // JSONObject instObj = instructTab.query("instruct_uuid = '" + instruct_uuid + - // "'").uniqueResult(0); - - // 封装给wcs的数据 - Object[] data = new Object[3]; - data[0] = inOut_type; - data[1] = wcsdevice_code; - data[2] = vehicle_code; - // TODO: 2022/5/27 - /* uWcsSchedule.notifyWcs(99, 3001, data);*/ - - JSONObject srb = new JSONObject(); - srb.put("code", 1); - srb.put("desc", "操作成功!"); - return srb; - - } - - @Override - public Map setfullBox(Map jsonObject) { - String semimanufactures_uuid = jsonObject.get("material_uuid"); - // 料箱码 - String vehicle_code = jsonObject.get("vehicle_code"); - // 层数 - String layer_num = jsonObject.get("layer_num"); - // 顺序号 - String seat_order_num = jsonObject.get("seat_order_num"); - // 缓存线 - String wcsdevice_code = jsonObject.get("wcsdevice_code"); - String weight = jsonObject.get("weight"); - String quantity = jsonObject.get("quantity"); - JSONObject srb = new JSONObject(); - if (StrUtil.isEmpty(quantity) || Double.valueOf(jsonObject.get("quantity")) <= 0) { - throw new BadRequestException("数量必须大于0"); - } - - String workprocedure_code = jsonObject.get("workprocedure_uuid"); - WQLObject positionTab = WQLObject.getWQLObject("ST_cacheLine_Position"); - JSONObject vehiobj = positionTab.query("order_no = " + seat_order_num + " and layer_num = " + layer_num - + " and extdevice_code like '%" + wcsdevice_code + "%'").uniqueResult(0); - if (vehiobj == null) { - throw new BadRequestException("位置不存在,设置有误!"); - } - // 判断物料去的缓存线是否正确 - // PDM_BI_WorkshopMaterialCorr - WQLObject corrTab = WQLObject.getWQLObject("PDM_BI_WorkshopMaterialCorr"); - WQLObject wpTab = WQLObject.getWQLObject("PDM_BI_WorkProcedure"); - - // 设置工序信息 - JSONObject wpObj = wpTab.query("workprocedure_code = '" + workprocedure_code + "'").uniqueResult(0); - // 物料系列 - String materialprocess_series = corrTab.query("semimanufactures_uuid = '" + semimanufactures_uuid + "'") - .uniqueResult(0).getString("materialprocess_series"); - // TODO: 2022/5/27 - /* AgvTwoInst inst = new AgvTwoInst(); - String cacheLineCode2 = inst.getcacheLineCode(materialprocess_series, wpObj.optString("workprocedure_code")); -*/ - String cacheLineCode2 = ""; - if (!wcsdevice_code.equals(cacheLineCode2)) { - String materialprocess_seriesname = WQLObject.getWQLObject("PF_PB_SysDicInfo") - .query("sysdic_type = 'IF_WCS_DEVICESERIES' and sysdic_code = '" + materialprocess_series + "'") - .uniqueResult(0).getString("sysdic_name"); - throw new BadRequestException("该缓存线【" + wcsdevice_code + "】不能存放【" + materialprocess_seriesname + "】物料,操作失败!"); - } - - vehiobj.put("vehicle_code", vehicle_code); - vehiobj.put("vehicle_uuid", vehicle_code); - positionTab.update(vehiobj); - - WQLObject materTab = WQLObject.getWQLObject("PDM_BI_SemiMaterialCorr"); - // 缓存线载具物料表【IF_cacheLine_VehileMaterial】 - WQLObject ivtTab = WQLObject.getWQLObject("IF_cacheLine_VehileMaterial"); - - // ivtTab.delete("extdevice_code = '" + wcsdevice_code + "' and vehicle_code = - // '" + vehicle_code + "'"); - ivtTab.delete("vehicle_code = '" + vehicle_code + "'"); - - // 物料信息 - JSONObject materObj = materTab.query("semimanufactures_uuid = '" + semimanufactures_uuid + "'").uniqueResult(0); - - HashMap json = new HashMap(); - json.put("vehmaterial_uuid", IdUtil.getSnowflake(1, 1).nextId() + ""); - json.put("vehicle_code", vehicle_code); - json.put("vehicle_uuid", vehicle_code); - json.put("extdevice_code", wcsdevice_code); - json.put("material_uuid", materObj.getString("semimanufactures_uuid")); - json.put("material_code", materObj.getString("semimanufactures_code")); - json.put("material_spec", materObj.getString("semimanufactures_spec")); - json.put("material_name", materObj.getString("semimanufactures_name")); - json.put("weight", weight); - json.put("quantity", quantity); - - json.put("workprocedure_uuid", wpObj.getString("workprocedure_uuid")); - json.put("workprocedure_code", wpObj.getString("workprocedure_code")); - json.put("workprocedure_name", wpObj.getString("workprocedure_name")); - - // 有箱有料 - json.put("vehicle_status", "02"); - json.put("create_time", DateUtil.now()); - - ivtTab.insert(json); - - srb.put("code", 1); - srb.put("desc", "操作成功!"); - return srb; - - } - - @Override - public Map setEmptyBox(Map jsonObject) { - JSONObject srb = new JSONObject(); - // 层数 - String layer_num = jsonObject.get("layer_num"); - // 顺序号 - String seat_order_num = jsonObject.get("seat_order_num"); - // 载具条码 - String vehicle_code = jsonObject.get("vehicle_code"); - // 缓存线编码 - String wcsdevice_code = jsonObject.get("wcsdevice_code"); - - // 判断载具编码是否存在 - // 缓存线载具条码表【IF_cacheLine_Vehicle】 - /* - * WQLObject wql=WQLObject.getWQLObject("IF_cacheLine_Vehicle"); JSONObject - * vehiobj = - * wql.query("is_delete='0' AND is_active='1' AND vehicle_code = '"+vehicle_code - * +"'").uniqueResult(0); if (vehiobj==null) { srb.setFailure(); - * srb.setDesc("条码【" + vehicle_code + "】不存在或已被删除,操作失败!"); return srb; } - */ - // 缓存线位置表【ST_cacheLine_Position】 - WQLObject positionTab = WQLObject.getWQLObject("ST_cacheLine_Position"); - JSONObject vehiobj = positionTab.query("order_no = " + seat_order_num + " and layer_num = " + layer_num - + " and extdevice_code like '%" + wcsdevice_code + "%'").uniqueResult(0); - if (vehiobj == null) { - throw new BadRequestException("位置不存在,设置有误!"); - } - vehiobj.put("vehicle_code", vehicle_code); - vehiobj.put("vehicle_uuid", vehicle_code); - positionTab.update(vehiobj); - - // 缓存线载具物料表【IF_cacheLine_VehileMaterial】 - WQLObject ivtTab = WQLObject.getWQLObject("IF_cacheLine_VehileMaterial"); - - // 先删除空箱子位置 - // ivtTab.delete("extdevice_code = '" + wcsdevice_code + "' and vehicle_code = - // '" + vehicle_code + "'"); - ivtTab.delete("vehicle_code = '" + vehicle_code + "'"); - - JSONObject json = new JSONObject(); - // 状态设置为空箱 - json.put("vehmaterial_uuid", IdUtil.getSnowflake(1, 1).nextId() + ""); - json.put("vehicle_code", vehicle_code); - json.put("vehicle_uuid", vehicle_code); - json.put("extdevice_code", wcsdevice_code); - json.put("vehicle_status", "01"); - json.put("vehicle_code", vehicle_code); - // json.put("vehicle_uuid", vehiobj.optString("vehicle_uuid")); - - json.put("material_uuid", ""); - json.put("material_code", ""); - json.put("material_spec", ""); - json.put("material_name", ""); - json.put("weight", "0"); - json.put("quantity", "0"); - - json.put("workprocedure_uuid", ""); - json.put("workprocedure_code", ""); - json.put("workprocedure_name", ""); - json.put("create_time", DateUtil.now()); - ivtTab.insert(json); - - srb.put("code", 1); - srb.put("desc", "操作成功!"); - return srb; - } - - @Override - public Map agvInBoxExceptionQuery(Map jsonObject) { - String vehicle_code = jsonObject.get("vehicle_code"); - String wcsdevice_code = jsonObject.get("wcsdevice_code"); - WQLObject instructTab = WQLObject.getWQLObject("sch_base_task"); - String where = "next_point_code = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code - + "' and task_status <> '06'"; - if (StrUtil.isEmpty(vehicle_code)) { - where = "next_point_code = '" + wcsdevice_code + "' and task_status <> '06'"; - } - - JSONArray arr = instructTab.query(where).getResultJSONArray(0); - JSONArray result = new JSONArray(); - for (int i = 0; i < arr.size(); i++) { - JSONObject row = arr.getJSONObject(i); - JSONObject json = new JSONObject(); - json.put("instruct_uuid", row.getString("instruct_uuid")); - json.put("instructorder_no", row.getString("instructorder_no")); - json.put("wcsdevice_code", row.getString("next_point_code")); - json.put("start_point_code", row.getString("start_point_code")); - json.put("nextpoint_code", row.getString("next_point_code")); - json.put("nextpoint_code2", row.getString("next_point_code")); - result.add(json); - } - - JSONObject srb = new JSONObject(); - srb.put("code", 1); - srb.put("result", arr); - srb.put("desc", "操作成功!"); - return srb; - - } - - @Override - public Map agvInBoxExceptionConfirm(Map jsonObject) { - WQLObject instructTab = WQLObject.getWQLObject("sch_base_task"); - String instruct_uuid = jsonObject.get("instruct_uuid"); - String extdevice_code = jsonObject.get("wcsdevice_code"); - String empty_vehicle_code = jsonObject.get("empty_vehicle_code"); - String full_vehicle_code = jsonObject.get("full_vehicle_code"); - // 缓存线位置表【ST_cacheLine_Position】 - WQLObject positionTab = WQLObject.getWQLObject("ST_cacheLine_Position"); - JSONObject srb = new JSONObject(); - - /* - * JSONObject emptyObj = positionTab - * .query("is_active = '1' and is_delete = '0' and vehicle_code = '" + - * empty_vehicle_code + "'") .uniqueResult(0); - * - * // 判断箱子是否存在 if (emptyObj == null) { srb.setFailure(); srb.setDesc("条码【" + - * empty_vehicle_code + "】不存在,操作失败"); return srb; } JSONObject fullObj = - * positionTab .query("is_active = '1' and is_delete = '0' and vehicle_code = '" - * + full_vehicle_code + "'") .uniqueResult(0); // 判断箱子是否存在 if (fullObj == null) - * { srb.setFailure(); srb.setDesc("条码【" + full_vehicle_code + "】不存在,操作失败"); - * return srb; } - */ - - JSONObject instObj = instructTab.query("instruct_uuid = '" + instruct_uuid + "'").uniqueResult(0); - - // 缓存线载具物料表【IF_cacheLine_VehileMaterial】 - WQLObject ivtTab = WQLObject.getWQLObject("IF_cacheLine_VehileMaterial"); - - // TODO: 2022/5/27 - /*AgvTwoInst inst = new AgvTwoInst(); - instObj.put("inboxtxm", full_vehicle_code); - instObj.put("outboxtxm", empty_vehicle_code); - inst.updateInstStatus(instObj, "1"); - inst.updateInstStatus(instObj, "2");*/ - - srb.put("code", 1); - srb.put("desc", "操作成功!"); - return srb; - - } - - @Override - public Map agvOutBoxExceptionQuery(Map jsonObject) { - String vehicle_code = jsonObject.get("vehicle_code"); - String wcsdevice_code = jsonObject.get("wcsdevice_code"); - JSONObject srb = new JSONObject(); - JSONArray arr = new JSONArray(); - WQLObject instructTab = WQLObject.getWQLObject("sch_base_task"); - if (StrUtil.isEmpty(vehicle_code)) { - arr = instructTab.query("start_point_code = '" + wcsdevice_code + "' and task_status <> '06'") - .getResultJSONArray(0); - } else { - arr = instructTab.query("start_point_code = '" + wcsdevice_code + "' and vehicle_code = '" - + vehicle_code + "' and task_status <> '06'").getResultJSONArray(0); - } - - JSONArray result = new JSONArray(); - for (int i = 0; i < arr.size(); i++) { - JSONObject row = arr.getJSONObject(i); - JSONObject json = new JSONObject(); - json.put("instruct_uuid", row.getString("instruct_uuid")); - json.put("instructorder_no", row.getString("instructorder_no")); - json.put("wcsdevice_code", row.getString("start_point_code")); - json.put("vehicle_code", row.getString("outvehicle_code")); - json.put("start_point_code", row.getString("start_point_code")); - json.put("nextpoint_code", row.getString("next_point_code")); - json.put("nextpoint_code2", row.getString("next_point_code")); - result.add(json); - } - - srb.put("code", 1); - srb.put("result", arr); - srb.put("desc", "操作成功!"); - return srb; - - } - - @Override - public Map agvOutBoxExceptionConfirm(Map jsonObject) { - WQLObject instructTab = WQLObject.getWQLObject("sch_base_task"); - String instruct_uuid = jsonObject.get("instruct_uuid"); - String vehicle_code = jsonObject.get("vehicle_code"); - String extdevice_code = jsonObject.get("wcsdevice_code"); - JSONObject instObj = instructTab.query("instruct_uuid = '" + instruct_uuid + "'").uniqueResult(0); - -// TODO: 2022/5/27 - /* AgvTwoInst inst = new AgvTwoInst(); - // 出箱的时候入箱码和出箱码相同 - instObj.put("inboxtxm", vehicle_code); - instObj.put("outboxtxm", vehicle_code); - inst.updateInstStatus(instObj, "1"); - inst.updateInstStatus(instObj, "2"); -*/ - JSONObject srb = new JSONObject(); - srb.put("code", 1); - srb.put("desc", "操作成功!"); - return srb; - - } - - @Override - public Map cacheLineOutBoxExceptionQuery(Map jsonObject) { - String agv_no = jsonObject.get("agv_no"); - String wcsdevice_code = jsonObject.get("wcsdevice_code"); - WQLObject instructTab = WQLObject.getWQLObject("sch_base_task"); - JSONArray arr = instructTab.query("(start_point_code = '" + wcsdevice_code + "' or next_point_code = '" - + wcsdevice_code + "') and task_status <> '06' and car_no like '%" + agv_no + "%'") - .getResultJSONArray(0); - JSONArray result = new JSONArray(); - for (int i = 0; i < arr.size(); i++) { - JSONObject row = arr.getJSONObject(i); - JSONObject json = new JSONObject(); - json.put("instruct_uuid", row.getString("instruct_uuid")); - json.put("instructorder_no", row.getString("instructorder_no")); - json.put("wcsdevice_code", row.getString("start_point_code")); - json.put("vehicle_code", "0"); - json.put("start_point_code", row.getString("start_point_code")); - json.put("nextpoint_code", row.getString("next_point_code")); - json.put("nextpoint_code2", row.getString("next_point_code")); - result.add(json); - } - - JSONObject srb = new JSONObject(); - srb.put("code", 1); - srb.put("result", arr); - srb.put("desc", "操作成功!"); - return srb; - } - - @Override - public Map cacheLineOutBoxExceptionConfirm(Map jsonObject) { - WQLObject instructTab = WQLObject.getWQLObject("sch_base_task"); - String instruct_uuid = jsonObject.get("instruct_uuid"); - JSONObject instObj = instructTab.query("instruct_uuid = '" + instruct_uuid + "'").uniqueResult(0); - if (instObj != null) { - instObj.put("task_type", "06"); - instObj.put("instructfinish_mode", "02"); - instObj.put("update_time", DateUtil.now()); - instObj.put("remark", "缓存线出箱异常确认完成!"); - instructTab.update(instObj); - // 把所以来该缓存线的AGV指令都完成掉 - if (instObj.getString("next_point_code").contains("HCX")) { - HashMap map = new HashMap<>(); - map.put("task_type", "06"); - map.put("instructfinish_mode", "02"); - map.put("update_time", DateUtil.now()); - map.put("remark", "缓存线出箱异常确认完成!"); - instructTab.update(map, "next_point_code = '" + instObj.getString("next_point_code") - + "' and task_type <> '06'"); - } - - // 把所以从该缓存线出AGV指令都完成掉 - if (instObj.getString("start_point_code").contains("HCX")) { - HashMap map = new HashMap<>(); - map.put("task_type", "06"); - map.put("instructfinish_mode", "02"); - map.put("update_time", DateUtil.now()); - map.put("remark", "缓存线出箱异常确认完成!"); - instructTab.update(map, "start_point_code = '" + instObj.getString("start_point_code") - + "' and task_type <> '06'"); - } - - // 得到异常的载具号 - String vehicle_codeStr = instObj.getString("vehicle_code"); - String[] arr = vehicle_codeStr.split(","); - // 缓存线载具物料表【IF_cacheLine_VehileMaterial】 - WQLObject ivtTab = WQLObject.getWQLObject("IF_cacheLine_VehileMaterial"); - for (String vehicle_code : arr) { - HashMap map = new HashMap<>(); - // 异常 - map.put("vehicle_status", "03"); - ivtTab.update(map, "vehicle_code = '" + vehicle_code + "'"); - } - } - - JSONObject srb = new JSONObject(); - srb.put("code", 1); - srb.put("desc", "操作成功!"); - return srb; - - - } - - @Override - public Map materialQuery(Map jsonObject) { - HashMap map = new HashMap<>(); - map.put("flag", "6"); - map.put("searchBar", "%" + jsonObject.get("search_bar") + "%"); - JSONArray arr = WQL.getWO("QWCS_CACHE_004").addParamMap(map).process().getResultJSONArray(0); - JSONObject srb = new JSONObject(); - srb.put("code", 1); - srb.put("result", arr); - srb.put("desc", "操作成功!"); - return srb; - - - } - - @Override - public Map setBlankPos(Map jsonObject) { - // 层数 - String layer_num = jsonObject.get("layer_num"); - // 顺序号 - String seat_order_num = jsonObject.get("seat_order_num"); - // 缓存线编码 - String wcsdevice_code = jsonObject.get("wcsdevice_code"); - // 缓存线位置表【ST_cacheLine_Position】 - - WQLObject ivtTab = WQLObject.getWQLObject("ST_cacheLine_Position"); - JSONObject json = ivtTab.query("layer_num = " + layer_num + " and extdevice_code like '%" + wcsdevice_code - + "%' and order_no = " + seat_order_num + "").uniqueResult(0); - // 状态设置为空位 - json.put("is_blank", "1"); - json.put("vehicle_uuid", ""); - json.put("vehicle_code", ""); - ivtTab.update(json); - - JSONObject srb = new JSONObject(); - srb.put("code", 1); - srb.put("desc", "操作成功!"); - return srb; - - - } - - @Override - public Map instStatusQuery(Map jsonObject) { - HashMap map = new HashMap<>(); - map.put("flag", "7"); - JSONArray arr = WQL.getWO("QWCS_CACHE_004").addParamMap(map).process().getResultJSONArray(0); - JSONObject srb = new JSONObject(); - srb.put("code", 1); - srb.put("result", arr); - srb.put("desc", "操作成功!"); - return srb; - - - } - - @Override - public Map cacheLineExcepOpt(Map jsonObject) { - // 缓存线编码 - String wcsdevice_code = jsonObject.get("wcsdevice_code"); - // 01-暂停、02-启动 - String opt_type = jsonObject.get("opt_type"); - System.out.println("操作类型:" + opt_type); - - Object[] objs = new Object[2]; - objs[0] = wcsdevice_code; - // 类型:恢复是0,暂停是1 - String type = "1"; - if ("02".equals(opt_type)) { - type = "0"; - } - objs[1] = type; - // TODO: 2022/5/27 - /*// 下发给wcs - uWcsSchedule.notifyWcs(99, 1000, objs);*/ - - JSONObject srb = new JSONObject(); - srb.put("code", 1); - srb.put("desc", "操作成功!"); - return srb; - - - } - - @Override - public Map instOperation(Map jsonObject) { - return null; - } - - @Override - public Map pourMaterial(Map jsonObject) { - // 指令标识 - String instruct_uuid = jsonObject.get("instruct_uuid"); - // 指令点位表【sch_base_task】 - JSONObject instObj = WQLObject.getWQLObject("sch_base_task") - .query("instruct_uuid = '" + instruct_uuid + "'").uniqueResult(0); - int putquantity = instObj.getInteger("quantity"); - String producer = instObj.getString("next_point_code"); - Object[] objs = new Object[2]; - objs[0] = producer; - objs[1] = putquantity; - // TODO: 2022/5/27 - // 下发给wcs - /* uWcsSchedule.notifyWcs(99, 3002, objs);*/ - - JSONObject srb = new JSONObject(); - srb.put("code", 1); - srb.put("desc", "操作成功!"); - return srb; - - - } - - @Override - public Map instPageQuery(Map jsonObject) { - String nPageStart = jsonObject.get("nPageStart"); - String nPageRecordNum = jsonObject.get("nPageRecordNum"); - String date_begin = jsonObject.get("start_date"); - String date_end = jsonObject.get("end_date"); - if (StrUtil.isEmpty(date_begin) || date_begin.equals("null")) { - date_begin = ""; - } - if (StrUtil.isEmpty(date_end) || date_end.equals("null")) { - date_end = ""; - } - HashMap map = new HashMap<>(); - map.put("agv_no", jsonObject.get("agv_num")); - map.put("instructoperate_num", jsonObject.get("inst_num")); - map.put("vehicle_code", jsonObject.get("vehicle_code")); - map.put("startwcsdevice_name", jsonObject.get("start_point")); - map.put("nextwcsdevice_name", jsonObject.get("end_point")); - map.put("date_begin", date_begin); - map.put("date_end", date_end); - - String sql = ""; - // 指令状态未完成 - if ("90".equals(jsonObject.get("status"))) { - sql = " inst.task_type <> '06' "; - } - if (StrUtil.isNotEmpty(jsonObject.get("status")) && !"90".equals(jsonObject.get("status"))) { - sql = " inst.task_type = '" + jsonObject.get("status") + "'"; - } - map.put("sql", sql); - // AGV双工 - map.put("instruct_type", "01"); - JSONObject param = new JSONObject(); - int page = Integer.valueOf(jsonObject.get("page")); - int size = Integer.valueOf(jsonObject.get("size")); - Pageable pageable = PageRequest.of(page - 1, size); - - - JSONObject result = WQL.getWO("QWMS_WCS7").addParamMap(map).pageQuery(WqlUtil.getHttpContext(pageable), ""); - JSONArray results = result.getJSONArray("rows"); - JSONObject srb = new JSONObject(); - srb.put("code", 1); - srb.put("desc", "操作成功!"); - return srb; - - - } -} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/impl/MateriorecordServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/impl/MateriorecordServiceImpl.java deleted file mode 100644 index 3e196d19..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/impl/MateriorecordServiceImpl.java +++ /dev/null @@ -1,139 +0,0 @@ -package org.nl.wms.cacheline.service.impl; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.ObjectUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; - import lombok.RequiredArgsConstructor; -import org.nl.common.anno.Log; -import lombok.extern.slf4j.Slf4j; -import org.nl.modules.common.exception.BadRequestException; - import org.nl.common.utils.SecurityUtils; -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.cacheline.service.MateriorecordService; -import org.nl.wms.cacheline.service.dto.MateriorecordDto; - -import org.springframework.data.domain.Pageable; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** -* @description 服务实现 -* @author qinx -* @date 2022-05-26 -**/ -@Service -@RequiredArgsConstructor -@Slf4j -public class MateriorecordServiceImpl implements MateriorecordService { - - @Override - public Map queryAll(Map whereJson, Pageable page){ - HashMap map = new HashMap(); - map.put("flag","3"); - map.put("extdevice_code",whereJson.get("extdevice_code")); - map.put("search",whereJson.get("search")); - JSONObject jsonObject = WQL.getWO("cacheLine_VEHICLE_001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "vehicle_code"); - return jsonObject; - } - - @Override - public List queryAll(Map whereJson){ - WQLObject wo = WQLObject.getWQLObject("if_cacheLine_materiorecord"); - JSONArray arr = wo.query().getResultJSONArray(0); - if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(MateriorecordDto.class); - return null; - } - - @Override - public MateriorecordDto findById(Long record_uuid) { - WQLObject wo = WQLObject.getWQLObject("if_cacheLine_materiorecord"); - JSONObject json = wo.query("record_uuid = '" + record_uuid + "'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(json)){ - return json.toJavaObject( MateriorecordDto.class); - } - return null; - } - - @Override - public MateriorecordDto findByCode(String code) { - WQLObject wo = WQLObject.getWQLObject("if_cacheLine_materiorecord"); - JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(json)){ - return json.toJavaObject( MateriorecordDto.class); - } - return null; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void create(MateriorecordDto dto) { - String currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - - - dto.setRecord_uuid(IdUtil.getSnowflake(1, 1).nextId()); - dto.setUpdate_time(DateUtil.now()); - dto.setCreate_time(DateUtil.now()); - String extdevice_code =dto.getExtdevice_code(); - JSONObject postionObj = WQLObject.getWQLObject("ST_cacheLine_Position").query("extdevice_code='" + extdevice_code + "'").uniqueResult(0); - Long device_uuid = Long.valueOf(postionObj.getString("device_uuid")); - String device_name = postionObj.getString("device_name"); - dto.setDevice_uuid(device_uuid); - dto.setDevice_name(device_name); - - WQLObject wo = WQLObject.getWQLObject("if_cacheLine_materiorecord"); - JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); - wo.insert(json); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(MateriorecordDto dto) { - MateriorecordDto entity = this.findById(dto.getRecord_uuid()); - if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); - - String currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - String extdevice_code =dto.getExtdevice_code(); - JSONObject postionObj = WQLObject.getWQLObject("ST_cacheLine_Position").query("extdevice_code='" + extdevice_code + "'").uniqueResult(0); - Long device_uuid = Long.valueOf(postionObj.getString("device_uuid")); - String device_name = postionObj.getString("device_name"); - dto.setDevice_uuid(device_uuid); - dto.setDevice_name(device_name); - - dto.setUpdate_time(DateUtil.now()); - WQLObject wo = WQLObject.getWQLObject("if_cacheLine_materiorecord"); - JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); - wo.update(json); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteAll(Long[] ids) { - String currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - - - WQLObject wo = WQLObject.getWQLObject("if_cacheLine_materiorecord"); - for (Long record_uuid: ids) { - JSONObject param = new JSONObject(); - param.put("record_uuid", String.valueOf(record_uuid)); - param.put("is_delete", "1"); - param.put("update_optid", currentUserId); - param.put("update_optname", nickName); - param.put("update_time", DateUtil.now()); - wo.update(param); - } - } - -} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/impl/VehicleServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/impl/VehicleServiceImpl.java deleted file mode 100644 index 5be773f5..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/impl/VehicleServiceImpl.java +++ /dev/null @@ -1,178 +0,0 @@ -package org.nl.wms.cacheline.service.impl; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; - import lombok.RequiredArgsConstructor; -import org.nl.common.anno.Log; -import lombok.extern.slf4j.Slf4j; -import org.nl.modules.common.exception.BadRequestException; - import org.nl.common.utils.SecurityUtils; -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.cacheline.service.VehicleService; -import org.nl.wms.cacheline.service.dto.VehicleDto; - -import org.springframework.data.domain.Pageable; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - - import lombok.Data; -import java.util.Date; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @author qinx - * @description 服务实现 - * @date 2022-05-25 - **/ -@Service -@RequiredArgsConstructor -@Slf4j -public class VehicleServiceImpl implements VehicleService { - - @Override - public Map queryAll(Map whereJson, Pageable page) { - HashMap map = new HashMap(); - map.put("flag","1"); - map.put("search",whereJson.get("search")); - JSONObject jsonObject = WQL.getWO("cacheLine_VEHICLE_001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "vehicle_code"); - return jsonObject; - } - - @Override - public List queryAll(Map whereJson) { - WQLObject wo = WQLObject.getWQLObject("st_cacheLine_vehicle"); - JSONArray arr = wo.query().getResultJSONArray(0); - if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(VehicleDto.class); - return null; - } - - @Override - public VehicleDto findById(Long vehicle_uuid) { - WQLObject wo = WQLObject.getWQLObject("st_cacheLine_vehicle"); - JSONObject json = wo.query("vehicle_uuid = '" + vehicle_uuid + "'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(json)) { - return json.toJavaObject(VehicleDto.class); - } - return null; - } - - @Override - public VehicleDto findByCode(String code) { - WQLObject wo = WQLObject.getWQLObject("st_cacheLine_vehicle"); - JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(json)) { - return json.toJavaObject(VehicleDto.class); - } - return null; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void create(VehicleDto dto) { - String currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - - String vehicle_code = dto.getVehicle_code(); - JSONObject vehicleObj = WQLObject.getWQLObject("st_cacheLine_vehicle").query("vehicle_code='" + vehicle_code + "' and is_delete='0'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(vehicleObj)) { - throw new BadRequestException("载具编码为'" + vehicle_code + "'已经存在!"); - } - dto.setVehicle_uuid(IdUtil.getSnowflake(1, 1).nextId()); - dto.setCreate_id(currentUserId); - dto.setCreate_name(nickName); - dto.setUpdate_id(currentUserId); - dto.setUpdate_name(nickName); - dto.setUpdate_time(DateUtil.now()); - dto.setCreate_time(DateUtil.now()); - - WQLObject wo = WQLObject.getWQLObject("st_cacheLine_vehicle"); - JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); - wo.insert(json); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(VehicleDto dto) { - VehicleDto entity = this.findById(dto.getVehicle_uuid()); - if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); - String currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - String vehicle_code = dto.getVehicle_code(); - JSONObject vehicleObj = WQLObject.getWQLObject("st_cacheLine_vehicle").query("vehicle_code='" + vehicle_code + "' and is_delete='0'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(vehicleObj)) { - throw new BadRequestException("载具编码为'" + vehicle_code + "'已经存在!"); - } - - dto.setUpdate_time(DateUtil.now()); - dto.setUpdate_id(currentUserId); - dto.setUpdate_name(nickName); - WQLObject wo = WQLObject.getWQLObject("st_cacheLine_vehicle"); - JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); - wo.update(json); - - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteAll(Long[] ids) { - String currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - - - WQLObject wo = WQLObject.getWQLObject("st_cacheLine_vehicle"); - for (Long vehicle_uuid : ids) { - JSONObject param = new JSONObject(); - param.put("vehicle_uuid", String.valueOf(vehicle_uuid)); - param.put("is_delete", "1"); - param.put("update_optid", currentUserId); - param.put("update_optname", nickName); - param.put("update_time", DateUtil.now()); - wo.update(param); - } - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void changeActive(JSONObject json) { - String currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - - String is_active = "1"; - if (StrUtil.equals("1", json.getString("is_active"))) { - is_active = "0"; - } - json.put("is_active", is_active); - json.put("update_optid", currentUserId); - json.put("update_optname", nickName); - json.put("update_time", DateUtil.now()); - WQLObject.getWQLObject("st_cacheLine_vehicle").update(json); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void changePrint(JSONObject json) { - String currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - - String is_print = "1"; - if (StrUtil.equals("1", json.getString("is_print"))) { - is_print = "0"; - } - json.put("is_print", is_print); - json.put("update_optid", currentUserId); - json.put("update_optname", nickName); - json.put("update_time", DateUtil.now()); - WQLObject.getWQLObject("st_cacheLine_vehicle").update(json); - } - -} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/impl/VehilematerialServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/impl/VehilematerialServiceImpl.java deleted file mode 100644 index 31b2c796..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/impl/VehilematerialServiceImpl.java +++ /dev/null @@ -1,150 +0,0 @@ -package org.nl.wms.cacheline.service.impl; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; - import lombok.RequiredArgsConstructor; -import org.nl.common.anno.Log; -import lombok.extern.slf4j.Slf4j; -import org.nl.modules.common.exception.BadRequestException; - import org.nl.common.utils.SecurityUtils; - -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.cacheline.service.VehilematerialService; -import org.nl.wms.cacheline.service.dto.VehilematerialDto; - -import org.springframework.data.domain.Pageable; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @author qinx - * @description 服务实现 - * @date 2022-05-25 - **/ -@Service -@RequiredArgsConstructor -@Slf4j -public class VehilematerialServiceImpl implements VehilematerialService { - - @Override - public Map queryAll(Map whereJson, Pageable page) { - HashMap map = new HashMap(); - map.put("extdevice_code", whereJson.get("extdevice_code")); - map.put("flag", "4"); - map.put("search", whereJson.get("search")); - JSONObject jsonObject = WQL.getWO("cacheLine_VEHICLE_001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "extdevice_code,position_code"); - return jsonObject; - } - - @Override - public List queryAll(Map whereJson) { - WQLObject wo = WQLObject.getWQLObject("if_cacheLine_vehilematerial"); - JSONArray arr = wo.query().getResultJSONArray(0); - if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(VehilematerialDto.class); - return null; - } - - @Override - public VehilematerialDto findById(Long vehmaterial_uuid) { - WQLObject wo = WQLObject.getWQLObject("if_cacheLine_vehilematerial"); - JSONObject json = wo.query("vehmaterial_uuid = '" + vehmaterial_uuid + "'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(json)) { - return json.toJavaObject(VehilematerialDto.class); - } - return null; - } - - @Override - public VehilematerialDto findByCode(String code) { - WQLObject wo = WQLObject.getWQLObject("if_cacheLine_vehilematerial"); - JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(json)) { - return json.toJavaObject(VehilematerialDto.class); - } - return null; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void create(VehilematerialDto dto) { - String currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - - dto.setVehmaterial_uuid(IdUtil.getSnowflake(1, 1).nextId()); - dto.setUpdate_time(DateUtil.now()); - dto.setCreate_time(DateUtil.now()); - - WQLObject wo = WQLObject.getWQLObject("if_cacheLine_vehilematerial"); - JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); - wo.insert(json); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(VehilematerialDto dto) { - Long vehmaterial_uuid = dto.getVehmaterial_uuid(); - Long vehicle_uuid = dto.getVehicle_uuid(); - WQLObject wo = WQLObject.getWQLObject("if_cacheLine_vehilematerial"); - //假如有记录则更新 没记录则插入 - if (vehmaterial_uuid != null && StrUtil.isNotEmpty(String.valueOf(vehmaterial_uuid))) { - VehilematerialDto entity = this.findById(dto.getVehmaterial_uuid()); - if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); - String currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - - dto.setUpdate_time(DateUtil.now()); - JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); - //假如载具为空则删除 - if (vehicle_uuid != null && StrUtil.isNotEmpty(String.valueOf(vehicle_uuid))) { - wo.delete(json); - } - wo.update(json); - } else { - //插入之前 删除该位置托盘的物料的记录 - if (vehicle_uuid != null && StrUtil.isNotEmpty(String.valueOf(vehicle_uuid))) { - wo.delete("vehicle_uuid='"+vehicle_uuid+"'"); - } - this.create(dto); - } - - //更新缓存线位置表 - Long position_uuid = dto.getPosition_uuid(); - String vehicle_code = dto.getVehicle_code(); - JSONObject postionObj = WQLObject.getWQLObject("ST_cacheLine_Position").query("position_uuid='" + position_uuid + "'").uniqueResult(0); - postionObj.put("vehicle_code", vehicle_code); - postionObj.put("vehicle_uuid", vehicle_uuid); - WQLObject.getWQLObject("ST_cacheLine_Position").update(postionObj); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteAll(Long[] ids) { - String currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - - - WQLObject wo = WQLObject.getWQLObject("if_cacheLine_vehilematerial"); - for (Long vehmaterial_uuid : ids) { - JSONObject param = new JSONObject(); - param.put("vehmaterial_uuid", String.valueOf(vehmaterial_uuid)); - param.put("is_delete", "1"); - param.put("update_optid", currentUserId); - param.put("update_optname", nickName); - param.put("update_time", DateUtil.now()); - wo.update(param); - } - } - -} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/vehicle/rest/CachelineVehicleController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/vehicle/rest/CachelineVehicleController.java new file mode 100644 index 00000000..faa9705e --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/vehicle/rest/CachelineVehicleController.java @@ -0,0 +1,67 @@ +package org.nl.wms.cacheline.vehicle.rest; + + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.common.anno.Log; +import org.nl.wms.cacheline.vehicle.service.CachelineVehicleService; +import org.nl.wms.cacheline.vehicle.service.dto.CachelineVehicleDto; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +/** +* @author lyd +* @date 2023-03-17 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "缓存线载具管理") +@RequestMapping("/api/cachelineVehicle") +@Slf4j +public class CachelineVehicleController { + + private final CachelineVehicleService cachelineVehicleService; + + @GetMapping + @Log("查询缓存线载具") + @ApiOperation("查询缓存线载具") + //@PreAuthorize("@el.check('cachelineVehicle:list')") + public ResponseEntity query(@RequestParam Map whereJson, Pageable page){ + return new ResponseEntity<>(cachelineVehicleService.queryAll(whereJson,page),HttpStatus.OK); + } + + @PostMapping + @Log("新增缓存线载具") + @ApiOperation("新增缓存线载具") + //@PreAuthorize("@el.check('cachelineVehicle:add')") + public ResponseEntity create(@Validated @RequestBody CachelineVehicleDto dto){ + cachelineVehicleService.create(dto); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @PutMapping + @Log("修改缓存线载具") + @ApiOperation("修改缓存线载具") + //@PreAuthorize("@el.check('cachelineVehicle:edit')") + public ResponseEntity update(@Validated @RequestBody CachelineVehicleDto dto){ + cachelineVehicleService.update(dto); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除缓存线载具") + @ApiOperation("删除缓存线载具") + //@PreAuthorize("@el.check('cachelineVehicle:del')") + @DeleteMapping + public ResponseEntity delete(@RequestBody String[] ids) { + cachelineVehicleService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/VehilematerialService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/vehicle/service/CachelineVehicleService.java similarity index 52% rename from mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/VehilematerialService.java rename to mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/vehicle/service/CachelineVehicleService.java index c3e873e1..00052ae1 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/service/VehilematerialService.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/vehicle/service/CachelineVehicleService.java @@ -1,6 +1,6 @@ -package org.nl.wms.cacheline.service; +package org.nl.wms.cacheline.vehicle.service; -import org.nl.wms.cacheline.service.dto.VehilematerialDto; +import org.nl.wms.cacheline.vehicle.service.dto.CachelineVehicleDto; import org.springframework.data.domain.Pageable; import java.util.List; @@ -8,10 +8,10 @@ import java.util.Map; /** * @description 服务接口 -* @author qinx -* @date 2022-05-25 +* @author lyd +* @date 2023-03-17 **/ -public interface VehilematerialService { +public interface CachelineVehicleService { /** * 查询数据分页 @@ -24,41 +24,41 @@ public interface VehilematerialService { /** * 查询所有数据不分页 * @param whereJson 条件参数 - * @return List + * @return List */ - List queryAll(Map whereJson); + List queryAll(Map whereJson); /** * 根据ID查询 - * @param vehmaterial_uuid ID - * @return Vehilematerial + * @param vehicle_code ID + * @return CachelineVehicle */ - VehilematerialDto findById(Long vehmaterial_uuid); + CachelineVehicleDto findById(String vehicle_code); /** * 根据编码查询 * @param code code - * @return Vehilematerial + * @return CachelineVehicle */ - VehilematerialDto findByCode(String code); + CachelineVehicleDto findByCode(String code); /** * 创建 * @param dto / */ - void create(VehilematerialDto dto); + void create(CachelineVehicleDto dto); /** * 编辑 * @param dto / */ - void update(VehilematerialDto dto); + void update(CachelineVehicleDto dto); /** * 多选删除 * @param ids / */ - void deleteAll(Long[] ids); + void deleteAll(String[] ids); } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/vehicle/service/dto/CachelineVehicleDto.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/vehicle/service/dto/CachelineVehicleDto.java new file mode 100644 index 00000000..c53e2198 --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/vehicle/service/dto/CachelineVehicleDto.java @@ -0,0 +1,57 @@ +package org.nl.wms.cacheline.vehicle.service.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** +* @description / +* @author lyd +* @date 2023-03-17 +**/ +@Data +public class CachelineVehicleDto implements Serializable { + + /** 载具编码 */ + private String vehicle_code; + + /** 载具条码值 */ + private String vehicle_value; + + /** 打印次数 */ + private BigDecimal print_num; + + /** 是否打印 */ + private String is_print; + + /** 打印时间 */ + private String print_time; + + /** 生产区域 */ + private String product_area; + + /** 是否可用 */ + private String is_active; + + /** 是否删除 */ + private String is_delete; + + /** 创建人 */ + private String create_id; + + /** 创建人 */ + private String create_name; + + /** 创建时间 */ + private String create_time; + + /** 修改人 */ + private String update_id; + + /** 修改人 */ + private String update_name; + + /** 修改时间 */ + private String update_time; +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/vehicle/service/impl/CachelineVehicleServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/vehicle/service/impl/CachelineVehicleServiceImpl.java new file mode 100644 index 00000000..e0ca5587 --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/vehicle/service/impl/CachelineVehicleServiceImpl.java @@ -0,0 +1,135 @@ +package org.nl.wms.cacheline.vehicle.service.impl; + + +import com.alibaba.fastjson.JSON; +import lombok.RequiredArgsConstructor; +import org.nl.modules.common.exception.BadRequestException; +import org.nl.modules.wql.core.bean.ResultBean; +import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.modules.wql.util.WqlUtil; +import org.nl.wms.cacheline.vehicle.service.CachelineVehicleService; +import org.nl.wms.cacheline.vehicle.service.dto.CachelineVehicleDto; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import org.nl.common.utils.SecurityUtils; + +import lombok.extern.slf4j.Slf4j; +import cn.hutool.core.util.ObjectUtil; + +/** +* @description 服务实现 +* @author lyd +* @date 2023-03-17 +**/ +@Service +@RequiredArgsConstructor +@Slf4j +public class CachelineVehicleServiceImpl implements CachelineVehicleService { + + @Override + public Map queryAll(Map whereJson, Pageable page){ + WQLObject wo = WQLObject.getWQLObject("sch_cacheline_vehicle"); + String where = "1=1"; + Object search = whereJson.get("search"); + if (ObjectUtil.isNotEmpty(search)) + where = where + " AND vehicle_code like %" + search.toString() + "%"; + ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), where, "vehicle_code"); + final JSONObject json = rb.pageResult(); + return json; + } + + @Override + public List queryAll(Map whereJson){ + WQLObject wo = WQLObject.getWQLObject("sch_cacheline_vehicle"); + JSONArray arr = wo.query().getResultJSONArray(0); + if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(CachelineVehicleDto.class); + return null; + } + + @Override + public CachelineVehicleDto findById(String vehicle_code) { + WQLObject wo = WQLObject.getWQLObject("sch_cacheline_vehicle"); + JSONObject json = wo.query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(json)){ + return json.toJavaObject( CachelineVehicleDto.class); + } + return null; + } + + @Override + public CachelineVehicleDto findByCode(String code) { + WQLObject wo = WQLObject.getWQLObject("sch_cacheline_vehicle"); + JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(json)){ + return json.toJavaObject( CachelineVehicleDto.class); + } + return null; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(CachelineVehicleDto dto) { + String currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getCurrentNickName(); + + dto.setVehicle_code(IdUtil.getSnowflake(1, 1).nextIdStr()); + dto.setCreate_id(currentUserId); + dto.setCreate_name(nickName); + dto.setUpdate_id(currentUserId); + dto.setUpdate_name(nickName); + dto.setUpdate_time(DateUtil.now()); + dto.setCreate_time(DateUtil.now()); + + WQLObject wo = WQLObject.getWQLObject("sch_cacheline_vehicle"); + JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); + wo.insert(json); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CachelineVehicleDto dto) { + CachelineVehicleDto entity = this.findById(dto.getVehicle_code()); + if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); + + String currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getCurrentNickName(); + + + dto.setUpdate_time(DateUtil.now()); + dto.setUpdate_id(currentUserId); + dto.setUpdate_name(nickName); + + WQLObject wo = WQLObject.getWQLObject("sch_cacheline_vehicle"); + JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); + wo.update(json); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteAll(String[] ids) { + String currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getCurrentNickName(); + + + WQLObject wo = WQLObject.getWQLObject("sch_cacheline_vehicle"); + for (String vehicle_code: ids) { + JSONObject param = new JSONObject(); + param.put("vehicle_code", String.valueOf(vehicle_code)); + param.put("is_delete", "1"); + param.put("update_optid", currentUserId); + param.put("update_optname", nickName); + param.put("update_time", DateUtil.now()); + wo.update(param); + } + } + +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/wql/CACHELINE_VEHICLE_001.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/wql/CACHELINE_VEHICLE_001.wql deleted file mode 100644 index dccb6202..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/wql/CACHELINE_VEHICLE_001.wql +++ /dev/null @@ -1,174 +0,0 @@ -[交易说明] - 交易名: 载具扩展属性设置分页查询 - 所属模块: - 功能简述: - 版权所有: - 表引用: - 版本经历: - -[数据库] - --指定数据库,为空采用默认值,默认为db.properties中列出的第一个库 - -[IO定义] - ################################################# - ## 表字段对应输入参数 - ################################################# - 输入.flag TYPEAS s_string - 输入.search TYPEAS s_string - 输入.extdevice_code TYPEAS s_string - - - -[临时表] - --这边列出来的临时表就会在运行期动态创建 - -[临时变量] - --所有中间过程变量均可在此处定义 - -[业务过程] - - ########################################## - # 1、输入输出检查 # - ########################################## - - - ########################################## - # 2、主过程前处理 # - ########################################## - - - ########################################## - # 3、业务主过程 # - ########################################## - - IF 输入.flag = "1" - PAGEQUERY - SELECT - * - FROM - st_cacheline_vehicle vehicle - WHERE - 1=1 - OPTION 输入.search <> "" - vehicle.vehicle_code like "%" 输入.search "%" - ENDOPTION - ENDSELECT - ENDPAGEQUERY - ENDIF - - IF 输入.flag = "2" - PAGEQUERY - SELECT - position.position_uuid, - position.position_code, - position.position_name, - position.positionOrder_no, - position.device_uuid, - position.extdevice_code, - position.device_name, - position.layer_num, - position.priority_layer_no, - position.order_no, - position.vehicle_uuid, - position.vehicle_code, - vehicle.vehmaterial_uuid, - vehicle.vehicle_status, - vehicle.err_type, - vehicle.produceorder_uuid, - vehicle.produceorder_code, - vehicle.workprocedure_uuid, - vehicle.workprocedure_code, - vehicle.workprocedure_name, - vehicle.material_uuid, - vehicle.quantity, - vehicle.weight, - vehicle.create_time, - vehicle.update_time - FROM - st_cacheline_position position - LEFT JOIN IF_CacheLine_VehileMaterial vehicle ON vehicle.vehicle_uuid = position.vehicle_uuid - where - 1=1 - OPTION 输入.search <> "" - ( position.position_name like "%" 输入.search "%" - or position.position_code like "%" 输入.search "%" - ) - ENDOPTION - OPTION 输入.extdevice_code <> "" - position.extdevice_code = 输入.extdevice_code - ENDOPTION - ENDSELECT - ENDPAGEQUERY - ENDIF - - IF 输入.flag = "3" - PAGEQUERY - SELECT - record.*, - material.material_id, - material.material_code, - material.material_name, - material.material_spec, - workprocedure.workprocedure_id, - workprocedure.workprocedure_code, - workprocedure.workprocedure_name - FROM - IF_CacheLine_MaterIORecord record - LEFT JOIN md_me_materialbase material ON material.material_id = record.material_uuid - LEFT JOIN pdm_bi_workprocedure workprocedure ON workprocedure.workprocedure_id = record.workprocedure_uuid - WHERE - 1 =1 - OPTION 输入.search <> "" - record.vehicle_code like "%" 输入.search "%" - ENDOPTION - OPTION 输入.extdevice_code <> "" - cacheLine.extdevice_code = 输入.extdevice_code - ENDOPTION - ENDSELECT - ENDPAGEQUERY - ENDIF - - IF 输入.flag = "4" - PAGEQUERY - SELECT - position.position_uuid, - position.position_code, - position.position_name, - position.positionOrder_no, - position.device_uuid, - position.extdevice_code, - position.device_name, - position.layer_num, - position.priority_layer_no, - position.order_no, - position.vehicle_uuid, - position.vehicle_code, - vehicle.vehmaterial_uuid, - vehicle.vehicle_status, - vehicle.err_type, - vehicle.produceorder_uuid, - vehicle.produceorder_code, - vehicle.workprocedure_uuid, - vehicle.workprocedure_code, - vehicle.workprocedure_name, - vehicle.material_uuid, - vehicle.quantity, - vehicle.weight, - vehicle.create_time, - vehicle.update_time - FROM - st_cacheline_position position - LEFT JOIN IF_CacheLine_VehileMaterial vehicle ON vehicle.vehicle_uuid = position.vehicle_uuid - where - 1=1 - OPTION 输入.search <> "" - ( position.position_name like "%" 输入.search "%" - or position.position_code like "%" 输入.search "%" - ) - ENDOPTION - OPTION 输入.extdevice_code <> "" - position.extdevice_code = 输入.extdevice_code - ENDOPTION - ENDSELECT - ENDPAGEQUERY - ENDIF \ No newline at end of file diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/wql/QACS_CACHE_005.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/wql/QACS_CACHE_005.wql deleted file mode 100644 index 2dcb923e..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/wql/QACS_CACHE_005.wql +++ /dev/null @@ -1,74 +0,0 @@ -[交易说明] - 交易名: Acs交互 - 所属模块: - 功能简述: - 版权所有: - 表引用: - 版本经历: - -[数据库] - --指定数据库,为空采用默认值,默认为db.properties中列出的第一个库 - -[IO定义] - ################################################# - ## 表字段对应输入参数 - ################################################# - 输入.flag TYPEAS s_string - 输入.produceorder_uuid TYPEAS s_string - 输入.material_uuid TYPEAS s_string - - -[临时表] - --这边列出来的临时表就会在运行期动态创建 - -[临时变量] - --所有中间过程变量均可在此处定义 - -[业务过程] - - ########################################## - # 1、输入输出检查 # - ########################################## - - - ########################################## - # 2、主过程前处理 # - ########################################## - - - ########################################## - # 3、业务主过程 # - ########################################## - -IF 输入.flag = "1" - QUERY - SELECT - * - FROM - ST_CacheLine_Position position - LEFT JOIN IF_CacheLine_VehileMaterial vehicle ON position.vehicle_uuid = vehicle.vehicle_uuid - WHERE - vehicle.vehicle_status = '01' - ENDSELECT - ENDQUERY -ENDIF - -IF 输入.flag = "2" - QUERY - SELECT - * - FROM - ST_CacheLine_Position position - LEFT JOIN IF_CacheLine_VehileMaterial vehicle ON position.vehicle_uuid = vehicle.vehicle_uuid - WHERE - vehicle.vehicle_status = '02' - OPTION 输入.produceorder_uuid <> "" - vehicle.produceorder_uuid=输入.produceorder_uuid - ENDOPTION - OPTION 输入.material_uuid <> "" - vehicle.material_uuid=输入.material_uuid - ENDOPTION - ENDSELECT - ENDQUERY -ENDIF - diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/wql/QWCS_CACHE_004.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/wql/QWCS_CACHE_004.wql deleted file mode 100644 index e6f90811..00000000 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/cacheline/wql/QWCS_CACHE_004.wql +++ /dev/null @@ -1,194 +0,0 @@ -[交易说明] - 交易名: 查找缺料的生产中的设备 - 所属模块: - 功能简述: - 版权所有: - 表引用: - 版本经历: - -[数据库] - --指定数据库,为空采用默认值,默认为db.properties中列出的第一个库 - -[IO定义] - ################################################# - ## 表字段对应输入参数 - ################################################# - 输入.flag TYPEAS s_string - 输入.extdevice_code TYPEAS s_string - 输入.searchBar TYPEAS s_string - - -[临时表] - --这边列出来的临时表就会在运行期动态创建 - -[临时变量] - --所有中间过程变量均可在此处定义 - -[业务过程] - - ########################################## - # 1、输入输出检查 # - ########################################## - - - ########################################## - # 2、主过程前处理 # - ########################################## - - - ########################################## - # 3、业务主过程 # - ########################################## - -IF 输入.flag = "1" - QUERY - SELECT - material_spec as label , - material_spec as value - FROM - md_me_materialbase mb - LEFT JOIN MD_PB_ClassStandard class ON class.class_id = mb.material_type_id - LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = mb.base_unit_id - WHERE - mb.is_delete = '0' - AND 1 = 1 - AND class.class_id IN ( '1528555445302726656', '1528555443906023424', '1528555445080428544' ) - GROUP BY - material_spec - ENDSELECT - ENDQUERY -ENDIF - -IF 输入.flag = "2" - QUERY - SELECT - workprocedure_code as value, - workprocedure_name as label - FROM - PDM_BI_WorkProcedure - WHERE 1=1 - Order BY - workprocedure_code, - workprocedure_name - ENDSELECT - ENDQUERY -ENDIF - -IF 输入.flag = "3" - QUERY - SELECT - device_uuid, - extdevice_code AS wcsdevice_code, - device_name, - vehicle_code, - workprocedure_uuid, - workprocedure_code, - workprocedure_name, - material_uuid, - material_code, - material_name, - material_spec, - quantity, - weight, - layer_num, - order_no AS seat_order_num, - vehicle_status as status, - err_type - FROM - IF_CacheLine_Ivt - where 1=1 - OPTION 输入.extdevice_code <> "" - extdevice_code=输入.extdevice_code - ENDOPTION - order by layer_num desc,order_no - ENDSELECT - ENDQUERY -ENDIF - - -IF 输入.flag = "4" - QUERY - SELECT - semimanufactures_uuid AS material_uuid, - semimanufactures_code AS material_code, - semimanufactures_name AS material_name, - semimanufactures_spec AS material_spec, - p.sysdic_name AS deviceprocess_seriesname - FROM - PDM_BI_WorkshopMaterialCorr c - LEFT JOIN PF_PB_SysDicInfo p ON c.materialprocess_series = p.sysdic_code AND p.sysdic_type = 'IF_WCS_DEVICESERIES' - where 1=1 - OPTION 输入.searchBar <> "" - ( c.semimanufactures_code LIKE 输入.searchBar or c.semimanufactures_code LIKE 输入.searchBar or - c.semimanufactures_code LIKE 输入.searchBar ) - ENDOPTION - GROUP BY - semimanufactures_uuid, - semimanufactures_code, - semimanufactures_name, - semimanufactures_spec, - p.sysdic_name - ENDSELECT - ENDQUERY -ENDIF - -IF 输入.flag = "5" - QUERY - SELECT - cacheline.device_uuid, - cacheline.extdevice_code as wcsdevice_code, - cacheline.device_name - FROM - st_cacheline_position cacheline - WHERE - 1 = 1 - - GROUP BY - device_uuid, - device_uuid, - extdevice_code - ENDSELECT - ENDQUERY -ENDIF - -IF 输入.flag = "6" - QUERY - SELECT - mb.material_id, - mb.material_code, - mb.material_name, - mb.material_spec, - class_code, - class_name deviceprocess_seriesname - FROM - md_me_materialbase mb - LEFT JOIN MD_PB_ClassStandard class ON class.class_id = mb.material_type_id - WHERE - mb.is_delete = '0' - AND 1 = 1 - AND class.class_id IN ( '1528555445302726656', '1528555443906023424', '1528555445080428544' ) - OPTION 输入.searchBar <> "" - ( mb.material_code LIKE 输入.searchBar or mb.material_name LIKE 输入.searchBar ) - ENDOPTION - GROUP BY - material_spec - ENDSELECT - ENDQUERY -ENDIF - -IF 输入.flag = "7" - QUERY - SELECT - det.`value` as value, - det.label as label - FROM - sys_dict dict - LEFT JOIN sys_dict_detail det ON det.dict_id = dict.dict_id - WHERE - 1 = 1 - AND dict.`name` = 'task_status' - GROUP BY - material_spec - ENDSELECT - ENDQUERY -ENDIF \ No newline at end of file diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/rest/RegionController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/rest/RegionController.java new file mode 100644 index 00000000..8bee5650 --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/rest/RegionController.java @@ -0,0 +1,83 @@ +package org.nl.wms.sch.rest; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.common.anno.Log; +import org.nl.wms.sch.service.RegionService; +import org.nl.wms.sch.service.dto.RegionDto; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +/** +* @author lyd +* @date 2023-03-17 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "区域管理管理") +@RequestMapping("/api/region") +@Slf4j +public class RegionController { + + private final RegionService regionService; + + @GetMapping + @Log("查询区域管理") + @ApiOperation("查询区域管理") + //@SaCheckPermission("region:list") + public ResponseEntity query(@RequestParam Map whereJson, Pageable page) { + return new ResponseEntity<>(regionService.queryAll(whereJson, page), HttpStatus.OK); + } + + @PostMapping + @Log("新增区域管理") + @ApiOperation("新增区域管理") + //@SaCheckPermission("region:add") + public ResponseEntity create(@Validated @RequestBody RegionDto dto) { + regionService.create(dto); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @PutMapping + @Log("修改区域管理") + @ApiOperation("修改区域管理") + //@SaCheckPermission("region:edit") + public ResponseEntity update(@Validated @RequestBody RegionDto dto) { + regionService.update(dto); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除区域管理") + @ApiOperation("删除区域管理") + //@SaCheckPermission("region:del") + @DeleteMapping + public ResponseEntity delete(@RequestBody String[] codes) { + regionService.deleteAll(codes); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/getPointStatusSelectById") + @Log("获取点位状态下拉框") + @ApiOperation("获取点位状态下拉框") + //@SaCheckPermission("region:add") + public ResponseEntity getPointStatusSelectById(@RequestBody Long region_id) { + return new ResponseEntity<>(regionService.getPointStatusSelectById(region_id), HttpStatus.CREATED); + } + + @PostMapping("/getPointTypeSelectById") + @Log("获取点位类型下拉框") + @ApiOperation("获取点位类型下拉框") + //@SaCheckPermission("region:add") + public ResponseEntity getPointTypeSelectById(@RequestBody Long region_id) { + return new ResponseEntity<>(regionService.getPointTypeSelectById(region_id), HttpStatus.CREATED); + } + +} + diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/service/RegionService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/service/RegionService.java new file mode 100644 index 00000000..834c7478 --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/service/RegionService.java @@ -0,0 +1,77 @@ +package org.nl.wms.sch.service; + +import com.alibaba.fastjson.JSONArray; +import org.nl.wms.sch.service.dto.RegionDto; +import org.springframework.data.domain.Pageable; + +import java.util.List; +import java.util.Map; + +/** + * @description 服务接口 + * @author lyd + * @date 2023-03-17 + **/ +public interface RegionService { + + /** + * 查询数据分页 + * + * @param whereJson 条件 + * @param page 分页参数 + * @return Map + */ + Map queryAll(Map whereJson, Pageable page); + + /** + * 查询所有数据不分页 + * + * @param whereJson 条件参数 + * @return List + */ + List queryAll(Map whereJson); + + /** + * 根据编码查询 + * + * @param code code + * @return Region + */ + RegionDto findByCode(String code); + + + /** + * 创建 + * + * @param dto / + */ + void create(RegionDto dto); + + /** + * 编辑 + * + * @param dto / + */ + void update(RegionDto dto); + + /** + * 多选删除 + * + * @param codes / + */ + void deleteAll(String[] codes); + + /** + * 获取点位状态下拉框 + * @param region_id + * @return + */ + JSONArray getPointStatusSelectById(Long region_id); + + /** + * 获取点位类型下拉框 + * @param region_id + * @return + */ + JSONArray getPointTypeSelectById(Long region_id); +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/service/dto/RegionDto.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/service/dto/RegionDto.java new file mode 100644 index 00000000..f4228023 --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/service/dto/RegionDto.java @@ -0,0 +1,51 @@ +package org.nl.wms.sch.service.dto; + +import lombok.Data; +import java.util.Date; + +import java.io.Serializable; + +/** +* @description / +* @author lyd +* @date 2023-03-17 +**/ +@Data +public class RegionDto implements Serializable { + + /** 区域编码 */ + private String region_code; + + /** 区域名称 */ + private String region_name; + + /** 点位类型说明 */ + private String point_type_explain; + + /** 点位状态说明 */ + private String point_status_explain; + + /** 生产区域 */ + private String product_area; + + /** 备注 */ + private String remark; + + /** 创建人 */ + private String create_id; + + /** 创建人 */ + private String create_name; + + /** 创建时间 */ + private String create_time; + + /** 修改人 */ + private String update_optid; + + /** 修改人 */ + private String update_optname; + + /** 修改时间 */ + private String update_time; +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/service/impl/RegionServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/service/impl/RegionServiceImpl.java new file mode 100644 index 00000000..c64fe732 --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/service/impl/RegionServiceImpl.java @@ -0,0 +1,169 @@ +package org.nl.wms.sch.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.common.utils.SecurityUtils; +import org.nl.modules.common.exception.BadRequestException; +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.sch.service.RegionService; +import org.nl.wms.sch.service.dto.RegionDto; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @description 服务实现 + * @author lyd + * @date 2023-03-17 + **/ +@Service +@RequiredArgsConstructor +@Slf4j +public class RegionServiceImpl implements RegionService { + + @Override + public Map queryAll(Map whereJson, Pageable page) { + String region_code = MapUtil.getStr(whereJson, "region_code"); + + HashMap map = new HashMap<>(); + map.put("flag", "1"); + if (ObjectUtil.isNotEmpty(region_code)) map.put("region_code",region_code+"%"); + + JSONObject json = WQL.getWO("QSCH_REGION_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "region.region_code ASC"); + return json; + } + + @Override + public List queryAll(Map whereJson) { + WQLObject wo = WQLObject.getWQLObject("sch_base_region"); + JSONArray arr = wo.query().getResultJSONArray(0); + if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(RegionDto.class); + return null; + } + + @Override + public RegionDto findByCode(String code) { + WQLObject wo = WQLObject.getWQLObject("sch_base_region"); + JSONObject json = wo.query("region_code ='" + code + "'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(json)) { + return json.toJavaObject(RegionDto.class); + } + return null; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(RegionDto dto) { + WQLObject wo = WQLObject.getWQLObject("sch_base_region"); + + String currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getCurrentNickName(); + String now = DateUtil.now(); + + JSONObject jsonDto = wo.query("region_code = '" + dto.getRegion_code() + "'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(jsonDto)) throw new BadRequestException("编码已存在"); + + dto.setCreate_id(currentUserId); + dto.setCreate_name(nickName); + dto.setUpdate_optid(currentUserId); + dto.setUpdate_optname(nickName); + dto.setUpdate_time(now); + dto.setCreate_time(now); + + JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); + wo.insert(json); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(RegionDto dto) { + RegionDto entity = this.findByCode(dto.getRegion_code()); + if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); + + String currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getCurrentNickName(); + + String now = DateUtil.now(); + dto.setUpdate_time(now); + dto.setUpdate_optid(currentUserId); + dto.setUpdate_optname(nickName); + + WQLObject wo = WQLObject.getWQLObject("sch_base_region"); + JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); + wo.update(json); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteAll(String[] codes) { + WQLObject wo = WQLObject.getWQLObject("sch_base_region"); + for (String region_code : codes) { + wo.delete("region_code ='" + region_code + "'"); + } + } + + /** + * 获取点位状态下拉框 + * + * @param region_id + * @return + */ + @Override + public JSONArray getPointStatusSelectById(Long region_id) { + /** + * label,value + */ +// JSONArray res = new JSONArray(); +// String point_status_explain = findByCode(region_id).getPoint_status_explain(); +// if (ObjectUtil.isEmpty(point_status_explain)) return res; +// String[] explain = point_status_explain.split(","); +// for (int i = 0; i < explain.length; i++) { +// String[] status = explain[i].split("-"); +// JSONObject point_status = new JSONObject(); +// point_status.put("label", status[1]); +// point_status.put("value", status[0]); +// res.add(point_status); +// } +// return res; + return null; + } + + /** + * 获取点位类型下拉框 + * + * @param region_id + * @return + */ + @Override + public JSONArray getPointTypeSelectById(Long region_id) { + /** + * label,value + */ +// JSONArray res = new JSONArray(); +// String point_type_explain = findById(region_id).getPoint_type_explain(); +// if (ObjectUtil.isEmpty(point_type_explain)) return res; +// String[] explain = point_type_explain.split(","); +// for (int i = 0; i < explain.length; i++) { +// String[] types = explain[i].split("-"); +// JSONObject point_type = new JSONObject(); +// point_type.put("label", types[1]); +// point_type.put("value", types[0]); +// res.add(point_type); +// } +// return res; + return null; + } + +} diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/wql/QSCH_REGION_01.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/wql/QSCH_REGION_01.wql new file mode 100644 index 00000000..9bb640f3 --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/wql/QSCH_REGION_01.wql @@ -0,0 +1,57 @@ +[交易说明] + 交易名: 区域分页查询 + 所属模块: + 功能简述: + 版权所有: + 表引用: + 版本经历: + +[数据库] + --指定数据库,为空采用默认值,默认为db.properties中列出的第一个库 + +[IO定义] + ################################################# + ## 表字段对应输入参数 + ################################################# + 输入.flag TYPEAS s_string + 输入.region_code TYPEAS s_string + +[临时表] + --这边列出来的临时表就会在运行期动态创建 + +[临时变量] + --所有中间过程变量均可在此处定义 + +[业务过程] + + ########################################## + # 1、输入输出检查 # + ########################################## + + + ########################################## + # 2、主过程前处理 # + ########################################## + + + ########################################## + # 3、业务主过程 # + ########################################## + + IF 输入.flag = "1" + PAGEQUERY + SELECT + region.* + FROM + SCH_BASE_Region region + WHERE + 1=1 + + OPTION 输入.region_code <> "" + (region.region_code like 输入.region_code or + region.region_name like 输入.region_code) + ENDOPTION + + ENDSELECT + ENDPAGEQUERY + ENDIF diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/wql/sch.xls b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/wql/sch.xls index cc92739d..838bc2e5 100644 Binary files a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/wql/sch.xls and b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/wql/sch.xls differ diff --git a/mes/hd/nladmin-system/src/main/resources/template/generator/admin/Controller.ftl b/mes/hd/nladmin-system/src/main/resources/template/generator/admin/Controller.ftl index 75c343a2..e98f5c32 100644 --- a/mes/hd/nladmin-system/src/main/resources/template/generator/admin/Controller.ftl +++ b/mes/hd/nladmin-system/src/main/resources/template/generator/admin/Controller.ftl @@ -1,21 +1,19 @@ - package ${package}.rest; - -import org.springframework.data.domain.Pageable; - import lombok.RequiredArgsConstructor; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.nl.common.anno.Log; -import org.nl.annotation.Log; +import ${package}.service.${className}Service; +import ${package}.service.dto.${className}Dto; +import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import io.swagger.annotations.*; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; + import java.util.Map; -import lombok.extern.slf4j.Slf4j; /** * @author ${author} diff --git a/mes/hd/nladmin-system/src/main/resources/template/generator/admin/Dto.ftl b/mes/hd/nladmin-system/src/main/resources/template/generator/admin/Dto.ftl index 100f6d6d..9a5cf7d5 100644 --- a/mes/hd/nladmin-system/src/main/resources/template/generator/admin/Dto.ftl +++ b/mes/hd/nladmin-system/src/main/resources/template/generator/admin/Dto.ftl @@ -4,15 +4,15 @@ import lombok.Data; import java.util.Date; <#if hasTimestamp> - import java.sql.Timestamp; +import java.sql.Timestamp; <#if hasBigDecimal> - import java.math.BigDecimal; +import java.math.BigDecimal; import java.io.Serializable; <#if !auto && pkColumnType = 'Long'> - import com.fasterxml.jackson.databind.annotation.JsonSerialize; - import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; /** @@ -23,18 +23,18 @@ import java.io.Serializable; @Data public class ${className}Dto implements Serializable { <#if columns??> - <#list columns as column> +<#list columns as column> - <#if column.remark != ''> - /** ${column.remark} */ - - <#if column.columnKey = 'PRI'> - <#if !auto && pkColumnType = 'Long'> - /** 防止精度丢失 */ - @JsonSerialize(using= ToStringSerializer.class) - - - private ${column.columnType} ${column.changeColumnName}; - +<#if column.remark != ''> + /** ${column.remark} */ + +<#if column.columnKey = 'PRI'> +<#if !auto && pkColumnType = 'Long'> + /** 防止精度丢失 */ + @JsonSerialize(using= ToStringSerializer.class) + + + private ${column.columnType} ${column.changeColumnName}; + } diff --git a/mes/hd/nladmin-system/src/main/resources/template/generator/admin/Service.ftl b/mes/hd/nladmin-system/src/main/resources/template/generator/admin/Service.ftl index 3c8282e7..fcaa8f15 100644 --- a/mes/hd/nladmin-system/src/main/resources/template/generator/admin/Service.ftl +++ b/mes/hd/nladmin-system/src/main/resources/template/generator/admin/Service.ftl @@ -1,11 +1,10 @@ - package ${package}.service; +import ${package}.service.dto.${className}Dto; import org.springframework.data.domain.Pageable; + import java.util.Map; import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; /** * @description 服务接口 diff --git a/mes/hd/nladmin-system/src/main/resources/template/generator/admin/ServiceImpl.ftl b/mes/hd/nladmin-system/src/main/resources/template/generator/admin/ServiceImpl.ftl index 86406f53..5a1f78ef 100644 --- a/mes/hd/nladmin-system/src/main/resources/template/generator/admin/ServiceImpl.ftl +++ b/mes/hd/nladmin-system/src/main/resources/template/generator/admin/ServiceImpl.ftl @@ -1,8 +1,13 @@ - package ${package}.service.impl; - - import lombok.RequiredArgsConstructor; +import com.alibaba.fastjson.JSON; +import lombok.RequiredArgsConstructor; +import org.nl.modules.common.exception.BadRequestException; +import org.nl.modules.wql.core.bean.ResultBean; +import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.modules.wql.util.WqlUtil; +import ${package}.service.${className}Service; +import ${package}.service.dto.${className}Dto; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -14,9 +19,7 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; - import org.nl.common.utils.SecurityUtils; - - +import org.nl.common.utils.SecurityUtils; import lombok.extern.slf4j.Slf4j; import cn.hutool.core.util.ObjectUtil; @@ -33,18 +36,18 @@ public class ${className}ServiceImpl implements ${className}Service { @Override public Map queryAll(Map whereJson, Pageable page){ - WQLObject wo = WQLObject.getWQLObject("${tableName}"); - ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "1=1", "update_time desc"); - final JSONObject json = rb.pageResult(); - return json; + WQLObject wo = WQLObject.getWQLObject("${tableName}"); + ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "1=1", "update_time desc"); + final JSONObject json = rb.pageResult(); + return json; } @Override public List<${className}Dto> queryAll(Map whereJson){ - WQLObject wo = WQLObject.getWQLObject("${tableName}"); - JSONArray arr = wo.query().getResultJSONArray(0); - if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(${className}Dto.class); - return null; + WQLObject wo = WQLObject.getWQLObject("${tableName}"); + JSONArray arr = wo.query().getResultJSONArray(0); + if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(${className}Dto.class); + return null; } @Override @@ -52,7 +55,7 @@ public class ${className}ServiceImpl implements ${className}Service { WQLObject wo = WQLObject.getWQLObject("${tableName}"); JSONObject json = wo.query("${pkChangeColName} = '" + ${pkChangeColName} + "'").uniqueResult(0); if (ObjectUtil.isNotEmpty(json)){ - return json.toJavaObject( ${className}Dto.class); + return json.toJavaObject( ${className}Dto.class); } return null; } @@ -62,7 +65,7 @@ public class ${className}ServiceImpl implements ${className}Service { WQLObject wo = WQLObject.getWQLObject("${tableName}"); JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0); if (ObjectUtil.isNotEmpty(json)){ - return json.toJavaObject( ${className}Dto.class); + return json.toJavaObject( ${className}Dto.class); } return null; } @@ -73,7 +76,6 @@ public class ${className}ServiceImpl implements ${className}Service { String currentUserId = SecurityUtils.getCurrentUserId(); String nickName = SecurityUtils.getCurrentNickName(); - dto.set${pkChangeColName ? cap_first }(IdUtil.getSnowflake(1, 1).nextId()); dto.setCreate_id(currentUserId); dto.setCreate_name(nickName); diff --git a/mes/hd/nladmin-system/src/main/resources/template/generator/front/index.ftl b/mes/hd/nladmin-system/src/main/resources/template/generator/front/index.ftl index 1c4665fe..9ce05cb5 100644 --- a/mes/hd/nladmin-system/src/main/resources/template/generator/front/index.ftl +++ b/mes/hd/nladmin-system/src/main/resources/template/generator/front/index.ftl @@ -113,13 +113,19 @@ - - diff --git a/mes/qd/src/views/wms/cacheline/position/index.vue b/mes/qd/src/views/wms/cacheline/position/index.vue new file mode 100644 index 00000000..98a05ef3 --- /dev/null +++ b/mes/qd/src/views/wms/cacheline/position/index.vue @@ -0,0 +1,170 @@ + + + + + diff --git a/mes/qd/src/views/wms/cacheline/vehicle/index.vue b/mes/qd/src/views/wms/cacheline/vehicle/index.vue index 531182f1..a53db327 100644 --- a/mes/qd/src/views/wms/cacheline/vehicle/index.vue +++ b/mes/qd/src/views/wms/cacheline/vehicle/index.vue @@ -16,18 +16,24 @@ - + - + + + + - {{ item.label }} + - - + + - {{ item.label }} + + + +