From 41b9914090cee622c2c3ca090313e45645bfa605 Mon Sep 17 00:00:00 2001 From: tuqiang <437016993@qq.com> Date: Thu, 7 Nov 2024 17:43:49 +0800 Subject: [PATCH] =?UTF-8?q?rev:=E4=BC=98=E5=8C=96=E5=86=B7=E5=8D=B4?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rest/CoolPointIvtController.java | 80 +++ .../service/CoolPointIvtService.java | 79 +++ .../coolpoint/service/dao/CoolPointIvt.java | 152 ++++++ .../coolpoint/service/dao/CoolRegionIo.java | 88 ++++ .../dao/mapper/CoolPointIvtMapper.java | 8 + .../dao/mapper/CoolRegionIoMapper.java | 7 + .../service/dto/CoolPointIvtDto.java | 148 ++++++ .../service/dto/CoolPointIvtQuery.java | 4 + .../service/impl/CoolPointIvtServiceImpl.java | 208 ++++++++ .../service/dao/StIvtHotregioniomst.java | 3 +- .../pdm/ivt/rest/CoolPointIvtController.java | 164 +++---- .../pdm/ivt/service/CoolPointIvtService.java | 164 +++---- .../pdm/ivt/service/dto/CoolPointIvtDto.java | 308 ++++++------ .../service/impl/CoolPointIvtServiceImpl.java | 460 +++++++++--------- 14 files changed, 1324 insertions(+), 549 deletions(-) create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/rest/CoolPointIvtController.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/CoolPointIvtService.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dao/CoolPointIvt.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dao/CoolRegionIo.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dao/mapper/CoolPointIvtMapper.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dao/mapper/CoolRegionIoMapper.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dto/CoolPointIvtDto.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dto/CoolPointIvtQuery.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/impl/CoolPointIvtServiceImpl.java diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/rest/CoolPointIvtController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/rest/CoolPointIvtController.java new file mode 100644 index 0000000..00b4213 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/rest/CoolPointIvtController.java @@ -0,0 +1,80 @@ +package org.nl.wms.pdm.ivt.coolpoint.rest; + +import com.alibaba.fastjson.JSONObject; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.common.domain.query.PageQuery; +import org.nl.modules.logging.annotation.Log; +import org.nl.wms.pdm.ivt.coolpoint.service.CoolPointIvtService; +import org.nl.wms.pdm.ivt.coolpoint.service.dao.CoolPointIvt; +import org.nl.wms.pdm.ivt.coolpoint.service.dto.CoolPointIvtDto; +import org.springframework.beans.factory.annotation.Autowired; +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; + +@RestController +@RequiredArgsConstructor + +@RequestMapping("/api/stIvtCoolpointivt") +@Slf4j +public class CoolPointIvtController { + + @Autowired + private CoolPointIvtService coolPointIvtService; + + @GetMapping + @Log("查询冷却区库存") + + //@SaCheckPermission("@el.check('stIvtCoolpointivt:list')") + public ResponseEntity query(@RequestParam Map whereJson, PageQuery page) { + return new ResponseEntity<>(coolPointIvtService.queryAll(whereJson, page), HttpStatus.OK); + } + + @PostMapping + @Log("新增冷却区库存") + + //@SaCheckPermission("@el.check('stIvtCoolpointivt:add')") + public ResponseEntity create(@Validated @RequestBody CoolPointIvt dto) { + coolPointIvtService.create(dto); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @PutMapping + @Log("修改冷却区库存") + + //@SaCheckPermission("@el.check('stIvtCoolpointivt:edit')") + public ResponseEntity update(@Validated @RequestBody CoolPointIvt dto) { + coolPointIvtService.update(dto); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除冷却区库存") + + //@SaCheckPermission("@el.check('stIvtCoolpointivt:del')") + @DeleteMapping + public ResponseEntity delete(@RequestBody Long[] ids) { + coolPointIvtService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } + + @GetMapping("/coolRegionIOQueryAll") + @Log("冷却区出入表") + + //@SaCheckPermission("@el.check('stIvtCoolpointivt:list')") + public ResponseEntity coolRegionIOQueryAll(@RequestParam Map whereJson, PageQuery page) { + return new ResponseEntity<>(coolPointIvtService.coolRegionIOQueryAll(whereJson, page), HttpStatus.OK); + } + + @PostMapping("/uploadMes") + @Log("手动回传MES") + + public ResponseEntity uploadMes(@RequestBody JSONObject form) { + coolPointIvtService.uploadMes(form); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/CoolPointIvtService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/CoolPointIvtService.java new file mode 100644 index 0000000..899c002 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/CoolPointIvtService.java @@ -0,0 +1,79 @@ +package org.nl.wms.pdm.ivt.coolpoint.service; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.extension.service.IService; +import org.nl.common.domain.query.PageQuery; +import org.nl.wms.pdm.ivt.coolpoint.service.dao.CoolPointIvt; +import org.nl.wms.pdm.ivt.coolpoint.service.dto.CoolPointIvtDto; +import org.springframework.data.domain.Pageable; + +import java.util.List; +import java.util.Map; + +public interface CoolPointIvtService extends IService { + /** + * 查询数据分页 + * + * @param whereJson 条件 + * @param page 分页参数 + * @return Map + */ + Map queryAll(Map whereJson, PageQuery page); + + /** + * 查询所有数据不分页 + * + * @param whereJson 条件参数 + * @return List + */ + List queryAll(Map whereJson); + + /** + * 根据ID查询 + * + * @param ivt_id ID + * @return StIvtCoolpointivt + */ + CoolPointIvt findById(Long ivt_id); + + /** + * 根据编码查询 + * + * @param code code + * @return StIvtCoolpointivt + */ + CoolPointIvt findByCode(String code); + + + /** + * 创建 + * + * @param dto / + */ + void create(CoolPointIvt dto); + + /** + * 编辑 + * + * @param dto / + */ + void update(CoolPointIvt dto); + + /** + * 多选删除 + * + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 冷却区出入分页查询 + * + * @param whereJson + * @param page + * @return + */ + Map coolRegionIOQueryAll(Map whereJson, PageQuery page); + + void uploadMes(JSONObject form); +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dao/CoolPointIvt.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dao/CoolPointIvt.java new file mode 100644 index 0000000..9e63b06 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dao/CoolPointIvt.java @@ -0,0 +1,152 @@ +package org.nl.wms.pdm.ivt.coolpoint.service.dao; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("st_ivt_coolpointivt") +public class CoolPointIvt implements Serializable { + + /** 库存记录标识 */ + /** + * 防止精度丢失 + */ + @TableId(value = "ivt_id") + private Long ivt_id; + + /** + * 点位编码 + */ + private String point_code; + + /** + * 满轴位编码 + */ + private String full_point_code; + + /** + * 母卷号 + */ + private String container_name; + + /** + * 母卷工单标识 + */ + private String workorder_id; + + /** + * 母卷轴编码 + */ + private String full_vehicle_code; + + /** + * 空轴位编码 + */ + private String empty_point_code; + + /** + * 空轴编码 + */ + private String empty_vehicle_code; + + /** + * 下料区域标识 + */ + private Long region_id; + + /** + * 批次 + */ + private String pcsn; + + /** + * 库存数 + */ + private BigDecimal ivt_qty; + + /** + * 计量单位标识 + */ + private Long qty_unit_id; + + /** + * 入库时间 + */ + private String instorage_time; + + /** + * 生产区域 + */ + private String product_area; + + /** + * 位置 + */ + private String point_location; + + /** + * 顺序号 + */ + private BigDecimal sort_seq; + + /** + * 是否启用 + */ + private String is_used; + + /** + * 备注 + */ + 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; + + /** + * 满轴位状态 + */ + private String full_point_status; + + /** + * 库存状态 + **/ + private String cool_ivt_status; + + /** + * 空轴位状态 + */ + private String empty_point_status; +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dao/CoolRegionIo.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dao/CoolRegionIo.java new file mode 100644 index 0000000..2813c5f --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dao/CoolRegionIo.java @@ -0,0 +1,88 @@ +package org.nl.wms.pdm.ivt.coolpoint.service.dao; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("st_ivt_coolregionio") +public class CoolRegionIo implements Serializable { + + private Long iostorinv_id; + + private String bill_code; + + //出入类型 + private String io_type; + + //物料标识 + private Long material_id; + + //批次 + private String pcsn; + + //载具编码 + private String vehicle_code; + + //数量 + private BigDecimal qty; + + //数量单位标识 + private Long qty_unit_id; + + //单据状态 + private String bill_status; + + //起始点位编码 + private String start_point_code; + + //终点点位编码 + private String end_point_code; + + //生成方式 + private String create_mode; + + private Long cust_id; + + //任务标识 + private Long task_id; + + //备注 + private String remark; + + //创建人 + private Long create_id; + + //创建人姓名 + private String create_name; + + //创建时间 + private String create_time; + + //确认人 + private Long update_optid; + + //确认人姓名 + private String update_optname; + + //确认时间 + private String update_time; + + //确认人 + private Long confirm_optid; + + //确认人姓名 + private String confirm_optname; + + //确认时间 + private String confirm_time; + + //是否删除 + private String is_delete; + + +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dao/mapper/CoolPointIvtMapper.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dao/mapper/CoolPointIvtMapper.java new file mode 100644 index 0000000..9a84b71 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dao/mapper/CoolPointIvtMapper.java @@ -0,0 +1,8 @@ +package org.nl.wms.pdm.ivt.coolpoint.service.dao.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.nl.wms.pdm.ivt.coolpoint.service.dao.CoolPointIvt; + +public interface CoolPointIvtMapper extends BaseMapper { + +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dao/mapper/CoolRegionIoMapper.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dao/mapper/CoolRegionIoMapper.java new file mode 100644 index 0000000..03b2daa --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dao/mapper/CoolRegionIoMapper.java @@ -0,0 +1,7 @@ +package org.nl.wms.pdm.ivt.coolpoint.service.dao.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.nl.wms.pdm.ivt.coolpoint.service.dao.CoolRegionIo; + +public interface CoolRegionIoMapper extends BaseMapper { +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dto/CoolPointIvtDto.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dto/CoolPointIvtDto.java new file mode 100644 index 0000000..ff01d5f --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dto/CoolPointIvtDto.java @@ -0,0 +1,148 @@ +package org.nl.wms.pdm.ivt.coolpoint.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; + +@Data +public class CoolPointIvtDto implements Serializable { + /** 库存记录标识 */ + /** + * 防止精度丢失 + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long ivt_id; + + /** + * 点位编码 + */ + private String point_code; + + /** + * 满轴位编码 + */ + private String full_point_code; + + /** + * 母卷号 + */ + private String container_name; + + /** + * 母卷工单标识 + */ + private String workorder_id; + + /** + * 母卷轴编码 + */ + private String full_vehicle_code; + + /** + * 空轴位编码 + */ + private String empty_point_code; + + /** + * 空轴编码 + */ + private String empty_vehicle_code; + + /** + * 下料区域标识 + */ + private Long region_id; + + /** + * 批次 + */ + private String pcsn; + + /** + * 库存数 + */ + private BigDecimal ivt_qty; + + /** + * 计量单位标识 + */ + private Long qty_unit_id; + + /** + * 入库时间 + */ + private String instorage_time; + + /** + * 生产区域 + */ + private String product_area; + + /** + * 位置 + */ + private String point_location; + + /** + * 顺序号 + */ + private BigDecimal sort_seq; + + /** + * 是否启用 + */ + private String is_used; + + /** + * 备注 + */ + 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; + + /** + * 满轴位状态 + */ + private String full_point_status; + + /** + * 库存状态 + **/ + private String cool_ivt_status; + + /** + * 空轴位状态 + */ + private String empty_point_status; +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dto/CoolPointIvtQuery.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dto/CoolPointIvtQuery.java new file mode 100644 index 0000000..328f9b6 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/dto/CoolPointIvtQuery.java @@ -0,0 +1,4 @@ +package org.nl.wms.pdm.ivt.coolpoint.service.dto; + +public class CoolPointIvtQuery { +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/impl/CoolPointIvtServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/impl/CoolPointIvtServiceImpl.java new file mode 100644 index 0000000..5d471e5 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/coolpoint/service/impl/CoolPointIvtServiceImpl.java @@ -0,0 +1,208 @@ +package org.nl.wms.pdm.ivt.coolpoint.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.map.MapUtil; +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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.common.domain.query.PageQuery; +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.SpringContextHolder; +import org.nl.modules.wql.util.WqlUtil; +import org.nl.system.service.param.impl.SysParamServiceImpl; +import org.nl.wms.basedata.master.interfaceback.service.dao.InterfaceBack; +import org.nl.wms.basedata.master.interfaceback.service.dao.mapper.InterfaceBackMapper; +import org.nl.wms.basedata.st.structattr.service.dao.Structattr; +import org.nl.wms.basedata.st.userarea.service.IUserAreaPermissionService; +import org.nl.wms.ext.mes.service.LmsToMesService; +import org.nl.wms.pdm.ivt.coolpoint.service.CoolPointIvtService; +import org.nl.wms.pdm.ivt.coolpoint.service.dao.CoolPointIvt; +import org.nl.wms.pdm.ivt.coolpoint.service.dao.CoolRegionIo; +import org.nl.wms.pdm.ivt.coolpoint.service.dao.mapper.CoolPointIvtMapper; +import org.nl.wms.pdm.ivt.coolpoint.service.dao.mapper.CoolRegionIoMapper; +import org.nl.wms.pdm.ivt.coolpoint.service.dto.CoolPointIvtDto; +import org.nl.wms.pdm.ivt.hotpoint.service.dao.HotPointIvt; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +@RequiredArgsConstructor +@Slf4j +public class CoolPointIvtServiceImpl extends ServiceImpl implements CoolPointIvtService { + @Autowired + private InterfaceBackMapper interfaceBackMapper; + @Autowired + IUserAreaPermissionService userAreaPermissionService; + @Autowired + CoolPointIvtMapper coolPointIvtMapper; + @Autowired + CoolRegionIoMapper coolRegionIoMapper; + + @Override + public Map queryAll(Map whereJson, PageQuery page) { + + //获取人员对应的区域 + String currentUserId = userAreaPermissionService.getInArea(); + List in_area_id = userAreaPermissionService.getCurrentUserAreas(currentUserId); + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(CoolPointIvt.class) + .like(ObjectUtil.isNotEmpty(whereJson.get("point_code")), CoolPointIvt::getPoint_code, whereJson.get("point_code")) + .like(ObjectUtil.isNotEmpty(whereJson.get("container_name")), CoolPointIvt::getContainer_name, whereJson.get("container_name")) + .eq(ObjectUtil.isNotEmpty(whereJson.get("full_point_status")), CoolPointIvt::getFull_point_status, whereJson.get("full_point_status")) + .eq(ObjectUtil.isNotEmpty(whereJson.get("empty_point_status")), CoolPointIvt::getEmpty_point_status, whereJson.get("empty_point_status")) + .eq(ObjectUtil.isNotEmpty(whereJson.get("cool_ivt_status")), CoolPointIvt::getCool_ivt_status, whereJson.get("cool_ivt_status")) + .eq(ObjectUtil.isNotEmpty(whereJson.get("product_area")), CoolPointIvt::getProduct_area, whereJson.get("product_area")) + .eq(ObjectUtil.isNotEmpty(whereJson.get("is_used")), CoolPointIvt::getIs_used, whereJson.get("is_used")) + .eq(ObjectUtil.isNotEmpty(whereJson.get("point_location")), CoolPointIvt::getPoint_location, whereJson.get("point_location")) + .in(ObjectUtil.isNotEmpty(in_area_id), CoolPointIvt::getProduct_area, in_area_id) + .ge(ObjectUtil.isNotEmpty(whereJson.get("begin_time")), CoolPointIvt::getInstorage_time, whereJson.get("begin_time")) + .le(ObjectUtil.isNotEmpty(whereJson.get("end_time")), CoolPointIvt::getInstorage_time, whereJson.get("end_time")) + .orderByAsc(CoolPointIvt::getProduct_area) + .orderByAsc(CoolPointIvt::getPoint_code); + IPage pages = new Page<>(page.getPage() + 1, page.getSize()); + IPage coolPointIvtIPage = coolPointIvtMapper.selectPage(pages, queryWrapper); + JSONObject json = new JSONObject(); + json.put("totalElements", coolPointIvtIPage.getTotal()); + json.put("content", coolPointIvtIPage.getRecords()); + return json; + } + + @Override + public List queryAll(Map whereJson) { + List list = coolPointIvtMapper.selectList(null); + return list; + } + + @Override + public CoolPointIvt findById(Long ivt_id) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .eq(ObjectUtil.isNotEmpty(ivt_id), CoolPointIvt::getIvt_id, ivt_id); + CoolPointIvt coolPointIvt = coolPointIvtMapper.selectOne(wrapper); + return coolPointIvt; + } + + @Override + public CoolPointIvt findByCode(String code) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .eq(ObjectUtil.isNotEmpty(code), CoolPointIvt::getPoint_code, code); + CoolPointIvt coolPointIvt = coolPointIvtMapper.selectOne(wrapper); + return coolPointIvt; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(CoolPointIvt dto) { + String currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getCurrentNickName(); + String now = DateUtil.now(); + + dto.setIvt_id(IdUtil.getSnowflake(1, 1).nextId()); + dto.setCreate_id(currentUserId); + dto.setCreate_name(nickName); + dto.setUpdate_optid(currentUserId); + dto.setUpdate_optname(nickName); + dto.setUpdate_time(now); + dto.setCreate_time(now); + + coolPointIvtMapper.insert(dto); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CoolPointIvt dto) { + CoolPointIvt entity = this.findById(dto.getIvt_id()); + 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); + + coolPointIvtMapper.updateById(dto); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteAll(Long[] ids) { + List list = coolPointIvtMapper.selectBatchIds(Arrays.asList(ids)); + for (CoolPointIvt coolPointIvt : list) { + coolPointIvtMapper.deleteById(coolPointIvt); + } + } + + /** + * 冷却区出入分页查询 + * + * @param whereJson + * @param page + * @return + */ + @Override + public Map coolRegionIOQueryAll(Map whereJson, PageQuery page) { + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(CoolRegionIo.class) + .like(ObjectUtil.isNotEmpty(whereJson.get("start_point_code")), CoolRegionIo::getStart_point_code, whereJson.get("start_point_code")) + .like(ObjectUtil.isNotEmpty(whereJson.get("end_point_code")), CoolRegionIo::getEnd_point_code, whereJson.get("end_point_code")) + .like(ObjectUtil.isNotEmpty(whereJson.get("pcsn")), CoolRegionIo::getPcsn, whereJson.get("pcsn")) + .like(ObjectUtil.isNotEmpty(whereJson.get("vehicle_code")), CoolRegionIo::getVehicle_code, whereJson.get("vehicle_code")) + .ge(ObjectUtil.isNotEmpty(whereJson.get("begin_time")), CoolRegionIo::getCreate_time, whereJson.get("begin_time")) + .le(ObjectUtil.isNotEmpty(whereJson.get("end_time")), CoolRegionIo::getCreate_time, whereJson.get("end_time")); + IPage pages = new Page<>(page.getPage() + 1, page.getSize()); + IPage coolRegionIoIPage = coolRegionIoMapper.selectPage(pages, queryWrapper); + JSONObject json = new JSONObject(); + json.put("totalElements", coolRegionIoIPage.getTotal()); + json.put("content", coolRegionIoIPage.getRecords()); + return json; + } + + @Override + public void uploadMes(JSONObject form) { + //调用回传MES的半成品入库接口 + // 将入冷却信息发送给mes + JSONObject param = new JSONObject(); + String userName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue(); + String passWord = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue(); + String container_name = form.getString("container_name"); + if (StrUtil.isEmpty(container_name)) { + throw new BadRequestException("母卷号不能为空!"); + } + param.put("iContainerName", container_name); + param.put("iArrivalTime", DateUtil.now()); + param.put("iWarehouse", 2); + param.put("UserName", userName); + param.put("PassWord", passWord); + + //判断该接口是否需要回传 + LambdaQueryWrapper lam = new LambdaQueryWrapper<>(); + lam.eq(InterfaceBack::getInterface_name, "momRollSemiFGInboundComplete"); + lam.eq(InterfaceBack::getIs_back, "1"); + InterfaceBack back_jo = interfaceBackMapper.selectOne(lam); + + if (ObjectUtil.isNotEmpty(back_jo)) { + SpringContextHolder.getBean(LmsToMesService.class).momRollSemiFGInboundComplete(param); + } + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/dao/StIvtHotregioniomst.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/dao/StIvtHotregioniomst.java index 3be76f9..21d1d47 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/dao/StIvtHotregioniomst.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/dao/StIvtHotregioniomst.java @@ -8,12 +8,13 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; +import java.io.Serializable; import java.math.BigDecimal; @Data @EqualsAndHashCode(callSuper = false) @TableName("st_ivt_hotregioniomst") -public class StIvtHotregioniomst { +public class StIvtHotregioniomst implements Serializable { //出入单标识 @TableId diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/rest/CoolPointIvtController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/rest/CoolPointIvtController.java index c71c06d..091172e 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/rest/CoolPointIvtController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/rest/CoolPointIvtController.java @@ -1,82 +1,82 @@ -package org.nl.wms.pdm.ivt.rest; - - -import com.alibaba.fastjson.JSONObject; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.nl.modules.logging.annotation.Log; -import org.nl.wms.pdm.ivt.service.CoolPointIvtService; -import org.nl.wms.pdm.ivt.service.dto.CoolPointIvtDto; -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 2022-10-08 - **/ -@RestController -@RequiredArgsConstructor - -@RequestMapping("/api/stIvtCoolpointivt") -@Slf4j -public class CoolPointIvtController { - - private final CoolPointIvtService coolpointivtService; - - @GetMapping - @Log("查询冷却区库存") - - //@SaCheckPermission("@el.check('stIvtCoolpointivt:list')") - public ResponseEntity query(@RequestParam Map whereJson, Pageable page) { - return new ResponseEntity<>(coolpointivtService.queryAll(whereJson, page), HttpStatus.OK); - } - - @PostMapping - @Log("新增冷却区库存") - - //@SaCheckPermission("@el.check('stIvtCoolpointivt:add')") - public ResponseEntity create(@Validated @RequestBody CoolPointIvtDto dto) { - coolpointivtService.create(dto); - return new ResponseEntity<>(HttpStatus.CREATED); - } - - @PutMapping - @Log("修改冷却区库存") - - //@SaCheckPermission("@el.check('stIvtCoolpointivt:edit')") - public ResponseEntity update(@Validated @RequestBody CoolPointIvtDto dto) { - coolpointivtService.update(dto); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @Log("删除冷却区库存") - - //@SaCheckPermission("@el.check('stIvtCoolpointivt:del')") - @DeleteMapping - public ResponseEntity delete(@RequestBody Long[] ids) { - coolpointivtService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } - - @GetMapping("/coolRegionIOQueryAll") - @Log("冷却区出入表") - - //@SaCheckPermission("@el.check('stIvtCoolpointivt:list')") - public ResponseEntity coolRegionIOQueryAll(@RequestParam Map whereJson, Pageable page) { - return new ResponseEntity<>(coolpointivtService.coolRegionIOQueryAll(whereJson, page), HttpStatus.OK); - } - - @PostMapping("/uploadMes") - @Log("手动回传MES") - - public ResponseEntity uploadMes(@RequestBody JSONObject form) { - coolpointivtService.uploadMes(form); - return new ResponseEntity<>(HttpStatus.OK); - } - -} +//package org.nl.wms.pdm.ivt.rest; +// +// +//import com.alibaba.fastjson.JSONObject; +//import lombok.RequiredArgsConstructor; +//import lombok.extern.slf4j.Slf4j; +//import org.nl.modules.logging.annotation.Log; +//import org.nl.wms.pdm.ivt.service.CoolPointIvtService; +//import org.nl.wms.pdm.ivt.service.dto.CoolPointIvtDto; +//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 2022-10-08 +// **/ +//@RestController +//@RequiredArgsConstructor +// +//@RequestMapping("/api/stIvtCoolpointivt") +//@Slf4j +//public class CoolPointIvtController { +// +// private final CoolPointIvtService coolpointivtService; +// +// @GetMapping +// @Log("查询冷却区库存") +// +// //@SaCheckPermission("@el.check('stIvtCoolpointivt:list')") +// public ResponseEntity query(@RequestParam Map whereJson, Pageable page) { +// return new ResponseEntity<>(coolpointivtService.queryAll(whereJson, page), HttpStatus.OK); +// } +// +// @PostMapping +// @Log("新增冷却区库存") +// +// //@SaCheckPermission("@el.check('stIvtCoolpointivt:add')") +// public ResponseEntity create(@Validated @RequestBody CoolPointIvtDto dto) { +// coolpointivtService.create(dto); +// return new ResponseEntity<>(HttpStatus.CREATED); +// } +// +// @PutMapping +// @Log("修改冷却区库存") +// +// //@SaCheckPermission("@el.check('stIvtCoolpointivt:edit')") +// public ResponseEntity update(@Validated @RequestBody CoolPointIvtDto dto) { +// coolpointivtService.update(dto); +// return new ResponseEntity<>(HttpStatus.NO_CONTENT); +// } +// +// @Log("删除冷却区库存") +// +// //@SaCheckPermission("@el.check('stIvtCoolpointivt:del')") +// @DeleteMapping +// public ResponseEntity delete(@RequestBody Long[] ids) { +// coolpointivtService.deleteAll(ids); +// return new ResponseEntity<>(HttpStatus.OK); +// } +// +// @GetMapping("/coolRegionIOQueryAll") +// @Log("冷却区出入表") +// +// //@SaCheckPermission("@el.check('stIvtCoolpointivt:list')") +// public ResponseEntity coolRegionIOQueryAll(@RequestParam Map whereJson, Pageable page) { +// return new ResponseEntity<>(coolpointivtService.coolRegionIOQueryAll(whereJson, page), HttpStatus.OK); +// } +// +// @PostMapping("/uploadMes") +// @Log("手动回传MES") +// +// public ResponseEntity uploadMes(@RequestBody JSONObject form) { +// coolpointivtService.uploadMes(form); +// return new ResponseEntity<>(HttpStatus.OK); +// } +// +//} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/CoolPointIvtService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/CoolPointIvtService.java index a82690b..64395d3 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/CoolPointIvtService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/CoolPointIvtService.java @@ -1,82 +1,82 @@ -package org.nl.wms.pdm.ivt.service; - -import com.alibaba.fastjson.JSONObject; -import org.nl.wms.pdm.ivt.service.dto.CoolPointIvtDto; -import org.springframework.data.domain.Pageable; - -import java.util.List; -import java.util.Map; - -/** - * @author lyd - * @description 服务接口 - * @date 2022-10-08 - **/ -public interface CoolPointIvtService { - - /** - * 查询数据分页 - * - * @param whereJson 条件 - * @param page 分页参数 - * @return Map - */ - Map queryAll(Map whereJson, Pageable page); - - /** - * 查询所有数据不分页 - * - * @param whereJson 条件参数 - * @return List - */ - List queryAll(Map whereJson); - - /** - * 根据ID查询 - * - * @param ivt_id ID - * @return StIvtCoolpointivt - */ - CoolPointIvtDto findById(Long ivt_id); - - /** - * 根据编码查询 - * - * @param code code - * @return StIvtCoolpointivt - */ - CoolPointIvtDto findByCode(String code); - - - /** - * 创建 - * - * @param dto / - */ - void create(CoolPointIvtDto dto); - - /** - * 编辑 - * - * @param dto / - */ - void update(CoolPointIvtDto dto); - - /** - * 多选删除 - * - * @param ids / - */ - void deleteAll(Long[] ids); - - /** - * 冷却区出入分页查询 - * - * @param whereJson - * @param page - * @return - */ - Map coolRegionIOQueryAll(Map whereJson, Pageable page); - - void uploadMes(JSONObject form); -} +//package org.nl.wms.pdm.ivt.service; +// +//import com.alibaba.fastjson.JSONObject; +//import org.nl.wms.pdm.ivt.service.dto.CoolPointIvtDto; +//import org.springframework.data.domain.Pageable; +// +//import java.util.List; +//import java.util.Map; +// +///** +// * @author lyd +// * @description 服务接口 +// * @date 2022-10-08 +// **/ +//public interface CoolPointIvtService { +// +// /** +// * 查询数据分页 +// * +// * @param whereJson 条件 +// * @param page 分页参数 +// * @return Map +// */ +// Map queryAll(Map whereJson, Pageable page); +// +// /** +// * 查询所有数据不分页 +// * +// * @param whereJson 条件参数 +// * @return List +// */ +// List queryAll(Map whereJson); +// +// /** +// * 根据ID查询 +// * +// * @param ivt_id ID +// * @return StIvtCoolpointivt +// */ +// CoolPointIvtDto findById(Long ivt_id); +// +// /** +// * 根据编码查询 +// * +// * @param code code +// * @return StIvtCoolpointivt +// */ +// CoolPointIvtDto findByCode(String code); +// +// +// /** +// * 创建 +// * +// * @param dto / +// */ +// void create(CoolPointIvtDto dto); +// +// /** +// * 编辑 +// * +// * @param dto / +// */ +// void update(CoolPointIvtDto dto); +// +// /** +// * 多选删除 +// * +// * @param ids / +// */ +// void deleteAll(Long[] ids); +// +// /** +// * 冷却区出入分页查询 +// * +// * @param whereJson +// * @param page +// * @return +// */ +// Map coolRegionIOQueryAll(Map whereJson, Pageable page); +// +// void uploadMes(JSONObject form); +//} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/dto/CoolPointIvtDto.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/dto/CoolPointIvtDto.java index c550144..4d75222 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/dto/CoolPointIvtDto.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/dto/CoolPointIvtDto.java @@ -1,154 +1,154 @@ -package org.nl.wms.pdm.ivt.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; - -/** - * @author lyd - * @description / - * @date 2022-10-08 - **/ -@Data -public class CoolPointIvtDto implements Serializable { - - /** 库存记录标识 */ - /** - * 防止精度丢失 - */ - @JsonSerialize(using = ToStringSerializer.class) - private Long ivt_id; - - /** - * 点位编码 - */ - private String point_code; - - /** - * 满轴位编码 - */ - private String full_point_code; - - /** - * 母卷号 - */ - private String container_name; - - /** - * 母卷工单标识 - */ - private String workorder_id; - - /** - * 母卷轴编码 - */ - private String full_vehicle_code; - - /** - * 空轴位编码 - */ - private String empty_point_code; - - /** - * 空轴编码 - */ - private String empty_vehicle_code; - - /** - * 下料区域标识 - */ - private Long region_id; - - /** - * 批次 - */ - private String pcsn; - - /** - * 库存数 - */ - private BigDecimal ivt_qty; - - /** - * 计量单位标识 - */ - private Long qty_unit_id; - - /** - * 入库时间 - */ - private String instorage_time; - - /** - * 生产区域 - */ - private String product_area; - - /** - * 位置 - */ - private String point_location; - - /** - * 顺序号 - */ - private BigDecimal sort_seq; - - /** - * 是否启用 - */ - private String is_used; - - /** - * 备注 - */ - 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; - - /** - * 满轴位状态 - */ - private String full_point_status; - - /** - * 库存状态 - **/ - private String cool_ivt_status; - - /** - * 空轴位状态 - */ - private String empty_point_status; -} +//package org.nl.wms.pdm.ivt.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; +// +///** +// * @author lyd +// * @description / +// * @date 2022-10-08 +// **/ +//@Data +//public class CoolPointIvtDto implements Serializable { +// +// /** 库存记录标识 */ +// /** +// * 防止精度丢失 +// */ +// @JsonSerialize(using = ToStringSerializer.class) +// private Long ivt_id; +// +// /** +// * 点位编码 +// */ +// private String point_code; +// +// /** +// * 满轴位编码 +// */ +// private String full_point_code; +// +// /** +// * 母卷号 +// */ +// private String container_name; +// +// /** +// * 母卷工单标识 +// */ +// private String workorder_id; +// +// /** +// * 母卷轴编码 +// */ +// private String full_vehicle_code; +// +// /** +// * 空轴位编码 +// */ +// private String empty_point_code; +// +// /** +// * 空轴编码 +// */ +// private String empty_vehicle_code; +// +// /** +// * 下料区域标识 +// */ +// private Long region_id; +// +// /** +// * 批次 +// */ +// private String pcsn; +// +// /** +// * 库存数 +// */ +// private BigDecimal ivt_qty; +// +// /** +// * 计量单位标识 +// */ +// private Long qty_unit_id; +// +// /** +// * 入库时间 +// */ +// private String instorage_time; +// +// /** +// * 生产区域 +// */ +// private String product_area; +// +// /** +// * 位置 +// */ +// private String point_location; +// +// /** +// * 顺序号 +// */ +// private BigDecimal sort_seq; +// +// /** +// * 是否启用 +// */ +// private String is_used; +// +// /** +// * 备注 +// */ +// 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; +// +// /** +// * 满轴位状态 +// */ +// private String full_point_status; +// +// /** +// * 库存状态 +// **/ +// private String cool_ivt_status; +// +// /** +// * 空轴位状态 +// */ +// private String empty_point_status; +//} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/impl/CoolPointIvtServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/impl/CoolPointIvtServiceImpl.java index c653cad..8a1648c 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/impl/CoolPointIvtServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/impl/CoolPointIvtServiceImpl.java @@ -1,230 +1,230 @@ -package org.nl.wms.pdm.ivt.service.impl; - - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.map.MapUtil; -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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -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.SpringContextHolder; -import org.nl.modules.wql.util.WqlUtil; -import org.nl.system.service.param.impl.SysParamServiceImpl; -import org.nl.wms.basedata.master.interfaceback.service.dao.InterfaceBack; -import org.nl.wms.basedata.master.interfaceback.service.dao.mapper.InterfaceBackMapper; -import org.nl.wms.basedata.st.userarea.service.IUserAreaPermissionService; -import org.nl.wms.ext.mes.service.LmsToMesService; -import org.nl.wms.pdm.ivt.service.CoolPointIvtService; -import org.nl.wms.pdm.ivt.service.dto.CoolPointIvtDto; -import org.springframework.beans.factory.annotation.Autowired; -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; - -/** - * @author lyd - * @description 服务实现 - * @date 2022-10-08 - **/ -@Service -@RequiredArgsConstructor -@Slf4j -public class CoolPointIvtServiceImpl implements CoolPointIvtService { - @Autowired - private InterfaceBackMapper interfaceBackMapper; - @Autowired - IUserAreaPermissionService userAreaPermissionService; - @Override - public Map queryAll(Map whereJson, Pageable page) { - - //获取人员对应的区域 - String in_area_id = userAreaPermissionService.getInArea(); - HashMap map = new HashMap(); - map.put("flag", "1"); - if (whereJson.get("point_code") != null) { - map.put("point_code", "%" + whereJson.get("point_code") + "%"); - } - if (whereJson.get("container_name") != null) { - map.put("container_name", "%" + whereJson.get("container_name") + "%"); - } - map.put("full_point_status", whereJson.get("full_point_status")); - map.put("empty_point_status", whereJson.get("empty_point_status")); - map.put("cool_ivt_status", whereJson.get("cool_ivt_status")); - map.put("product_area", whereJson.get("product_area")); - map.put("is_used", whereJson.get("is_used")); - map.put("begin_time", whereJson.get("begin_time")); - map.put("end_time", whereJson.get("end_time")); - map.put("point_location", whereJson.get("point_location")); - if (ObjectUtil.isNotEmpty(in_area_id)) { - map.put("in_area_id", in_area_id); - } - JSONObject json = WQL.getWO("ST_IVT_COOLPOINTIVT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "product_area,point_code"); - return json; - } - - @Override - public List queryAll(Map whereJson) { - WQLObject wo = WQLObject.getWQLObject("st_ivt_coolpointivt"); - JSONArray arr = wo.query().getResultJSONArray(0); - if (ObjectUtil.isNotEmpty(arr)) { - return arr.toJavaList(CoolPointIvtDto.class); - } - return null; - } - - @Override - public CoolPointIvtDto findById(Long ivt_id) { - WQLObject wo = WQLObject.getWQLObject("st_ivt_coolpointivt"); - JSONObject json = wo.query("ivt_id = '" + ivt_id + "'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(json)) { - return json.toJavaObject(CoolPointIvtDto.class); - } - return null; - } - - @Override - public CoolPointIvtDto findByCode(String code) { - WQLObject wo = WQLObject.getWQLObject("st_ivt_coolpointivt"); - JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(json)) { - return json.toJavaObject(CoolPointIvtDto.class); - } - return null; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void create(CoolPointIvtDto dto) { - String currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - String now = DateUtil.now(); - - dto.setIvt_id(IdUtil.getSnowflake(1, 1).nextId()); - dto.setCreate_id(currentUserId); - dto.setCreate_name(nickName); - dto.setUpdate_optid(currentUserId); - dto.setUpdate_optname(nickName); - dto.setUpdate_time(now); - dto.setCreate_time(now); - - WQLObject wo = WQLObject.getWQLObject("st_ivt_coolpointivt"); - JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); - wo.insert(json); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(CoolPointIvtDto dto) { - CoolPointIvtDto entity = this.findById(dto.getIvt_id()); - 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("st_ivt_coolpointivt"); - 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(); - String now = DateUtil.now(); - - WQLObject wo = WQLObject.getWQLObject("st_ivt_coolpointivt"); - for (Long ivt_id : ids) { - JSONObject param = new JSONObject(); - param.put("ivt_id", String.valueOf(ivt_id)); - param.put("is_delete", "1"); - param.put("update_optid", currentUserId); - param.put("update_optname", nickName); - param.put("update_time", now); - wo.update(param); - } - } - - /** - * 冷却区出入分页查询 - * - * @param whereJson - * @param page - * @return - */ - @Override - public Map coolRegionIOQueryAll(Map whereJson, Pageable page) { - String start_point_code = MapUtil.getStr(whereJson, "start_point_code"); - String end_point_code = MapUtil.getStr(whereJson, "end_point_code"); - String pcsn = MapUtil.getStr(whereJson, "pcsn"); - String vehicle_code = MapUtil.getStr(whereJson, "vehicle_code"); - - JSONObject map = new JSONObject(); - map.put("flag", "2"); - map.put("begin_time", whereJson.get("begin_time")); - map.put("end_time", whereJson.get("end_time")); - if (ObjectUtil.isNotEmpty(start_point_code)) { - map.put("start_point_code", "%" + start_point_code + "%"); - } - if (ObjectUtil.isNotEmpty(end_point_code)) { - map.put("end_point_code", "%" + end_point_code + "%"); - } - if (ObjectUtil.isNotEmpty(pcsn)) { - map.put("pcsn", "%" + pcsn + "%"); - } - if (ObjectUtil.isNotEmpty(vehicle_code)) { - map.put("vehicle_code", "%" + vehicle_code + "%"); - } - - JSONObject json = WQL.getWO("ST_IVT_COOLPOINTIVT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "update_time desc"); - return json; - } - - @Override - public void uploadMes(JSONObject form) { - //调用回传MES的半成品入库接口 - // 将入冷却信息发送给mes - JSONObject param = new JSONObject(); - String userName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue(); - String passWord = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue(); - String container_name = form.getString("container_name"); - if (StrUtil.isEmpty(container_name)) { - throw new BadRequestException("母卷号不能为空!"); - } - param.put("iContainerName", container_name); - param.put("iArrivalTime", DateUtil.now()); - param.put("iWarehouse", 2); - param.put("UserName", userName); - param.put("PassWord", passWord); - - //判断该接口是否需要回传 - LambdaQueryWrapper lam = new LambdaQueryWrapper<>(); - lam.eq(InterfaceBack::getInterface_name, "momRollSemiFGInboundComplete"); - lam.eq(InterfaceBack::getIs_back, "1"); - InterfaceBack back_jo = interfaceBackMapper.selectOne(lam); - - if (ObjectUtil.isNotEmpty(back_jo)) { - SpringContextHolder.getBean(LmsToMesService.class).momRollSemiFGInboundComplete(param); - } - } -} +//package org.nl.wms.pdm.ivt.service.impl; +// +// +//import cn.hutool.core.date.DateUtil; +//import cn.hutool.core.map.MapUtil; +//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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +//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.SpringContextHolder; +//import org.nl.modules.wql.util.WqlUtil; +//import org.nl.system.service.param.impl.SysParamServiceImpl; +//import org.nl.wms.basedata.master.interfaceback.service.dao.InterfaceBack; +//import org.nl.wms.basedata.master.interfaceback.service.dao.mapper.InterfaceBackMapper; +//import org.nl.wms.basedata.st.userarea.service.IUserAreaPermissionService; +//import org.nl.wms.ext.mes.service.LmsToMesService; +//import org.nl.wms.pdm.ivt.service.CoolPointIvtService; +//import org.nl.wms.pdm.ivt.service.dto.CoolPointIvtDto; +//import org.springframework.beans.factory.annotation.Autowired; +//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; +// +///** +// * @author lyd +// * @description 服务实现 +// * @date 2022-10-08 +// **/ +//@Service +//@RequiredArgsConstructor +//@Slf4j +//public class CoolPointIvtServiceImpl implements CoolPointIvtService { +// @Autowired +// private InterfaceBackMapper interfaceBackMapper; +// @Autowired +// IUserAreaPermissionService userAreaPermissionService; +// @Override +// public Map queryAll(Map whereJson, Pageable page) { +// +// //获取人员对应的区域 +// String in_area_id = userAreaPermissionService.getInArea(); +// HashMap map = new HashMap(); +// map.put("flag", "1"); +// if (whereJson.get("point_code") != null) { +// map.put("point_code", "%" + whereJson.get("point_code") + "%"); +// } +// if (whereJson.get("container_name") != null) { +// map.put("container_name", "%" + whereJson.get("container_name") + "%"); +// } +// map.put("full_point_status", whereJson.get("full_point_status")); +// map.put("empty_point_status", whereJson.get("empty_point_status")); +// map.put("cool_ivt_status", whereJson.get("cool_ivt_status")); +// map.put("product_area", whereJson.get("product_area")); +// map.put("is_used", whereJson.get("is_used")); +// map.put("begin_time", whereJson.get("begin_time")); +// map.put("end_time", whereJson.get("end_time")); +// map.put("point_location", whereJson.get("point_location")); +// if (ObjectUtil.isNotEmpty(in_area_id)) { +// map.put("in_area_id", in_area_id); +// } +// JSONObject json = WQL.getWO("ST_IVT_COOLPOINTIVT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "product_area,point_code"); +// return json; +// } +// +// @Override +// public List queryAll(Map whereJson) { +// WQLObject wo = WQLObject.getWQLObject("st_ivt_coolpointivt"); +// JSONArray arr = wo.query().getResultJSONArray(0); +// if (ObjectUtil.isNotEmpty(arr)) { +// return arr.toJavaList(CoolPointIvtDto.class); +// } +// return null; +// } +// +// @Override +// public CoolPointIvtDto findById(Long ivt_id) { +// WQLObject wo = WQLObject.getWQLObject("st_ivt_coolpointivt"); +// JSONObject json = wo.query("ivt_id = '" + ivt_id + "'").uniqueResult(0); +// if (ObjectUtil.isNotEmpty(json)) { +// return json.toJavaObject(CoolPointIvtDto.class); +// } +// return null; +// } +// +// @Override +// public CoolPointIvtDto findByCode(String code) { +// WQLObject wo = WQLObject.getWQLObject("st_ivt_coolpointivt"); +// JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0); +// if (ObjectUtil.isNotEmpty(json)) { +// return json.toJavaObject(CoolPointIvtDto.class); +// } +// return null; +// } +// +// @Override +// @Transactional(rollbackFor = Exception.class) +// public void create(CoolPointIvtDto dto) { +// String currentUserId = SecurityUtils.getCurrentUserId(); +// String nickName = SecurityUtils.getCurrentNickName(); +// String now = DateUtil.now(); +// +// dto.setIvt_id(IdUtil.getSnowflake(1, 1).nextId()); +// dto.setCreate_id(currentUserId); +// dto.setCreate_name(nickName); +// dto.setUpdate_optid(currentUserId); +// dto.setUpdate_optname(nickName); +// dto.setUpdate_time(now); +// dto.setCreate_time(now); +// +// WQLObject wo = WQLObject.getWQLObject("st_ivt_coolpointivt"); +// JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); +// wo.insert(json); +// } +// +// @Override +// @Transactional(rollbackFor = Exception.class) +// public void update(CoolPointIvtDto dto) { +// CoolPointIvtDto entity = this.findById(dto.getIvt_id()); +// 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("st_ivt_coolpointivt"); +// 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(); +// String now = DateUtil.now(); +// +// WQLObject wo = WQLObject.getWQLObject("st_ivt_coolpointivt"); +// for (Long ivt_id : ids) { +// JSONObject param = new JSONObject(); +// param.put("ivt_id", String.valueOf(ivt_id)); +// param.put("is_delete", "1"); +// param.put("update_optid", currentUserId); +// param.put("update_optname", nickName); +// param.put("update_time", now); +// wo.update(param); +// } +// } +// +// /** +// * 冷却区出入分页查询 +// * +// * @param whereJson +// * @param page +// * @return +// */ +// @Override +// public Map coolRegionIOQueryAll(Map whereJson, Pageable page) { +// String start_point_code = MapUtil.getStr(whereJson, "start_point_code"); +// String end_point_code = MapUtil.getStr(whereJson, "end_point_code"); +// String pcsn = MapUtil.getStr(whereJson, "pcsn"); +// String vehicle_code = MapUtil.getStr(whereJson, "vehicle_code"); +// +// JSONObject map = new JSONObject(); +// map.put("flag", "2"); +// map.put("begin_time", whereJson.get("begin_time")); +// map.put("end_time", whereJson.get("end_time")); +// if (ObjectUtil.isNotEmpty(start_point_code)) { +// map.put("start_point_code", "%" + start_point_code + "%"); +// } +// if (ObjectUtil.isNotEmpty(end_point_code)) { +// map.put("end_point_code", "%" + end_point_code + "%"); +// } +// if (ObjectUtil.isNotEmpty(pcsn)) { +// map.put("pcsn", "%" + pcsn + "%"); +// } +// if (ObjectUtil.isNotEmpty(vehicle_code)) { +// map.put("vehicle_code", "%" + vehicle_code + "%"); +// } +// +// JSONObject json = WQL.getWO("ST_IVT_COOLPOINTIVT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "update_time desc"); +// return json; +// } +// +// @Override +// public void uploadMes(JSONObject form) { +// //调用回传MES的半成品入库接口 +// // 将入冷却信息发送给mes +// JSONObject param = new JSONObject(); +// String userName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue(); +// String passWord = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue(); +// String container_name = form.getString("container_name"); +// if (StrUtil.isEmpty(container_name)) { +// throw new BadRequestException("母卷号不能为空!"); +// } +// param.put("iContainerName", container_name); +// param.put("iArrivalTime", DateUtil.now()); +// param.put("iWarehouse", 2); +// param.put("UserName", userName); +// param.put("PassWord", passWord); +// +// //判断该接口是否需要回传 +// LambdaQueryWrapper lam = new LambdaQueryWrapper<>(); +// lam.eq(InterfaceBack::getInterface_name, "momRollSemiFGInboundComplete"); +// lam.eq(InterfaceBack::getIs_back, "1"); +// InterfaceBack back_jo = interfaceBackMapper.selectOne(lam); +// +// if (ObjectUtil.isNotEmpty(back_jo)) { +// SpringContextHolder.getBean(LmsToMesService.class).momRollSemiFGInboundComplete(param); +// } +// } +//}