Browse Source

rev:优化烘箱区域代码

master
涂强 3 weeks ago
parent
commit
7adecbd78b
  1. 80
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/rest/HotPointIvtController.java
  2. 83
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/HotPointIvtService.java
  3. 142
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/dao/HotPointIvt.java
  4. 93
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/dao/StIvtHotregioniomst.java
  5. 19
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/dao/mapper/HotPointIvtMappper.java
  6. 50
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/dao/mapper/HotPointIvtMappper.xml
  7. 138
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/dto/HotPointIvtDto.java
  8. 21
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/dto/HotPointIvtQuery.java
  9. 236
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/impl/HotPointIvtServiceImpl.java
  10. 160
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/rest/HotPointIvtController.java
  11. 166
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/HotPointIvtService.java
  12. 268
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/dto/HotPointIvtDto.java
  13. 524
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/impl/HotPointIvtServiceImpl.java

80
lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/rest/HotPointIvtController.java

@ -0,0 +1,80 @@
package org.nl.wms.pdm.ivt.hotpoint.rest;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.TableDataInfo;
import org.nl.common.domain.query.PageQuery;
import org.nl.modules.logging.annotation.Log;
import org.nl.wms.pdm.ivt.hotpoint.service.HotPointIvtService;
import org.nl.wms.pdm.ivt.hotpoint.service.dto.HotPointIvtDto;
import org.nl.wms.pdm.ivt.hotpoint.service.dto.HotPointIvtQuery;
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/hotpointivt")
@Slf4j
public class HotPointIvtController {
private final HotPointIvtService hotPointIvtService;
@GetMapping
@Log("查询烘烤区点位库存")
//@SaCheckPermission("@el.check('hotpointivt:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(hotPointIvtService.queryAll(whereJson, page), HttpStatus.OK);
}
@PostMapping
@Log("新增烘烤区点位库存")
//@SaCheckPermission("@el.check('hotpointivt:add')")
public ResponseEntity<Object> create(@Validated @RequestBody HotPointIvtDto dto) {
hotPointIvtService.create(dto);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@Log("修改烘烤区点位库存")
//@SaCheckPermission("@el.check('hotpointivt:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody HotPointIvtDto dto) {
hotPointIvtService.update(dto);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除烘烤区点位库存")
//@SaCheckPermission("@el.check('hotpointivt:del')")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
hotPointIvtService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@GetMapping("/taskDtlQuery")
@Log("查询烘烤任务明细")
public ResponseEntity<Object> taskDtlQuery(HotPointIvtQuery whereJson, PageQuery page) {
return new ResponseEntity<>(hotPointIvtService.taskDtlQuery(whereJson, page), HttpStatus.OK);
}
@PostMapping("/uploadMes")
@Log("手动回传MES")
public ResponseEntity<Object> uploadMes(@RequestBody JSONObject form) {
hotPointIvtService.uploadMes(form);
return new ResponseEntity<>(HttpStatus.OK);
}
}

83
lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/HotPointIvtService.java

@ -0,0 +1,83 @@
package org.nl.wms.pdm.ivt.hotpoint.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.pdm.ivt.hotpoint.service.dao.HotPointIvt;
import org.nl.wms.pdm.ivt.hotpoint.service.dao.StIvtHotregioniomst;
import org.nl.wms.pdm.ivt.hotpoint.service.dto.HotPointIvtDto;
import org.nl.wms.pdm.ivt.hotpoint.service.dto.HotPointIvtQuery;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
public interface HotPointIvtService extends IService<HotPointIvt> {
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
*
* @param whereJson 条件参数
* @return List<HotpointivtDto>
*/
List<HotPointIvtDto> queryAll(Map whereJson);
/**
* 根据ID查询
*
* @param ivt_id ID
* @return Hotpointivt
*/
HotPointIvtDto findById(Long ivt_id);
/**
* 根据编码查询
*
* @param code code
* @return Hotpointivt
*/
HotPointIvtDto findByCode(String code);
/**
* 创建
*
* @param dto /
*/
void create(HotPointIvtDto dto);
/**
* 更新
*
* @param dto /
*/
void update(HotPointIvtDto dto);
/**
* 多选删除
*
* @param ids /
*/
void deleteAll(Long[] ids);
/**
* 任务明细分页查询
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
// IPage<HotPointIvt> taskDtlQuery(HotPointIvtQuery whereJson, PageQuery page);
Map<String, Object> taskDtlQuery(HotPointIvtQuery whereJson, PageQuery page);
void uploadMes(JSONObject form);
}

142
lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/dao/HotPointIvt.java

@ -0,0 +1,142 @@
package org.nl.wms.pdm.ivt.hotpoint.service.dao;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("st_ivt_hotpointivt")
public class HotPointIvt {
/** 库存记录标识 */
/**
* 防止精度丢失
*/
@TableId
private Long ivt_id;
/**
* 点位编码
*/
private String point_code;
/**
* 点位状态
*/
private String point_status;
/**
* 母卷号
*/
private String container_name;
/**
* 母卷工单标识
*/
private String workorder_id;
/**
* 母卷轴编码
*/
private String full_vehicle_code;
/**
* 批次
*/
private String pcsn;
/**
* 库存数
*/
private BigDecimal ivt_qty;
/**
* 计量单位标识
*/
private Long qty_unit_id;
/**
* 入库时间
*/
private String instorage_time;
/**
* 生产区域
*/
private String product_area;
/**
* 温度
*/
private BigDecimal temperature;
/**
* 组别
*/
private String group_name;
/**
* 位置
*/
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 last_time;
/**
* 是否删除
*/
private String is_delete;
}

93
lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/dao/StIvtHotregioniomst.java

@ -0,0 +1,93 @@
package org.nl.wms.pdm.ivt.hotpoint.service.dao;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("st_ivt_hotregioniomst")
public class StIvtHotregioniomst {
//出入单标识
@TableId
private Long iostorinv_id;
//出入类型
private String io_type;
//单据编号
private String bill_code;
//母卷号
private String container_name;
//母卷工单标识
private String workorder_id;
//物料标识
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 create_mode;
//起始点位编码
private String start_point_code;
//终点点位编码
private String end_point_code;
//任务类型
private String task_type;
//任务标识
private Long task_id;
//烘箱温度
private BigDecimal temperature;
//烘烤时间
private BigDecimal oven_time;
//备注
private String remark;
//创建人
private Long create_id;
//创建人姓名
private String create_name;
//创建时间
private String create_time;
//确认人
private Long confirm_optid;
//确认人姓名
private String confirm_optname;
//确认时间
private String confirm_time;
//是否删除
private String is_delete;
}

19
lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/dao/mapper/HotPointIvtMappper.java

@ -0,0 +1,19 @@
package org.nl.wms.pdm.ivt.hotpoint.service.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.pdm.ivt.hotpoint.service.dao.HotPointIvt;
import org.nl.wms.pdm.ivt.hotpoint.service.dao.StIvtHotregioniomst;
import org.nl.wms.pdm.ivt.hotpoint.service.dto.HotPointIvtQuery;
import java.util.HashMap;
import java.util.List;
public interface HotPointIvtMappper extends BaseMapper<HotPointIvt> {
Page<StIvtHotregioniomst> taskDtlQuery(@Param("pages") Page<StIvtHotregioniomst> pages, @Param("whereJson") HotPointIvtQuery whereJson);
}

50
lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/dao/mapper/HotPointIvtMappper.xml

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="org.nl.wms.pdm.ivt.hotpoint.service.dao.mapper.HotPointIvtMappper">
<select id="taskDtlQuery" resultType="org.nl.wms.pdm.ivt.hotpoint.service.dao.StIvtHotregioniomst">
SELECT
mst.bill_code,
mst.container_name,
mst.start_point_code,
mst.end_point_code,
mst.temperature,
mst.oven_time,
mst.create_name,
mst.create_time,
mst.confirm_optname,
mst.confirm_time,
task.task_code
FROM
st_ivt_hotregioniomst mst
LEFT JOIN sch_base_task task ON task.task_id = mst.task_id
<where>
<if test="whereJson.bill_code != null">
AND mst.bill_code = #{whereJson.bill_code}
</if>
<if test="whereJson.task_code != null">
AND task.task_code LIKE CONCAT('%', #{whereJson.task_code}, '%')
</if>
<if test="whereJson.start_point_code != null">
AND mst.start_point_code LIKE CONCAT('%', #{whereJson.start_point_code}, '%')
</if>
<if test="whereJson.next_point_code != null">
AND mst.next_point_code = LIKE CONCAT('%', #{whereJson.next_point_code}, '%')
</if>
<if test="whereJson.start_point_code != null">
AND mst.start_point_code = #{whereJson.start_point_code}
</if>
<if test="whereJson.end_time != null">
AND mst.create_time <![CDATA[<=]]> #{whereJson.end_time}
</if>
<if test="whereJson.begin_time != null">
AND mst.create_time <![CDATA[>=]]> #{whereJson.begin_time}
</if>
<if test="whereJson.container_name != null">
AND mst.container_name = #{whereJson.container_name}
</if>
AND mst.is_delete = '0'
</where>
ORDER BY mst.create_time DESC
</select>
</mapper>

138
lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/dto/HotPointIvtDto.java

@ -0,0 +1,138 @@
package org.nl.wms.pdm.ivt.hotpoint.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 HotPointIvtDto implements Serializable {
/** 库存记录标识 */
/**
* 防止精度丢失
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long ivt_id;
/**
* 点位编码
*/
private String point_code;
/**
* 点位状态
*/
private String point_status;
/**
* 母卷号
*/
private String container_name;
/**
* 母卷工单标识
*/
private String workorder_id;
/**
* 母卷轴编码
*/
private String full_vehicle_code;
/**
* 批次
*/
private String pcsn;
/**
* 库存数
*/
private BigDecimal ivt_qty;
/**
* 计量单位标识
*/
private Long qty_unit_id;
/**
* 入库时间
*/
private String instorage_time;
/**
* 生产区域
*/
private String product_area;
/**
* 温度
*/
private BigDecimal temperature;
/**
* 组别
*/
private String group_name;
/**
* 位置
*/
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 last_time;
/**
* 是否删除
*/
private String is_delete;
}

21
lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/dto/HotPointIvtQuery.java

@ -0,0 +1,21 @@
package org.nl.wms.pdm.ivt.hotpoint.service.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class HotPointIvtQuery implements Serializable {
private String task_code;
private String start_point_code;
private String next_point_code;
private String bill_code;
private String dtl_status;
private String begin_time;
private String end_time;
private String container_name;
}

236
lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/hotpoint/service/impl/HotPointIvtServiceImpl.java

@ -0,0 +1,236 @@
package org.nl.wms.pdm.ivt.hotpoint.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
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 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.CollectionUtils;
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.common.utils.RedisUtils;
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.areapermissions.service.IUserAreaPermissionService;
import org.nl.wms.ext.mes.service.LmsToMesService;
import org.nl.wms.pdm.ivt.hotpoint.service.HotPointIvtService;
import org.nl.wms.pdm.ivt.hotpoint.service.dao.HotPointIvt;
import org.nl.wms.pdm.ivt.hotpoint.service.dao.StIvtHotregioniomst;
import org.nl.wms.pdm.ivt.hotpoint.service.dao.mapper.HotPointIvtMappper;
import org.nl.wms.pdm.ivt.hotpoint.service.dto.HotPointIvtDto;
import org.nl.wms.pdm.ivt.hotpoint.service.dto.HotPointIvtQuery;
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.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
@Slf4j
public class HotPointIvtServiceImpl extends ServiceImpl<HotPointIvtMappper, HotPointIvt> implements HotPointIvtService {
@Autowired
private HotPointIvtMappper hotPointIvtMappper;
@Autowired
private InterfaceBackMapper interfaceBackMapper;
@Autowired
private RedisUtils redisUtils;
@Autowired
IUserAreaPermissionService userAreaPermissionService;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
//获取人员对应的区域
String in_area_id = userAreaPermissionService.getInArea();
String area_id = in_area_id.substring(1, in_area_id.length() - 1).replace("'", "");
String[] split = area_id.split(",");
LambdaQueryWrapper<HotPointIvt> wrapper = Wrappers.lambdaQuery(HotPointIvt.class)
.like(ObjectUtil.isNotEmpty(whereJson.get("point_code")), HotPointIvt::getPoint_code, whereJson.get("point_code"))
.eq(ObjectUtil.isNotEmpty(whereJson.get("point_status")), HotPointIvt::getPoint_status, whereJson.get("point_status"))
.eq(ObjectUtil.isNotEmpty(whereJson.get("product_area")), HotPointIvt::getProduct_area, whereJson.get("product_area"))
.eq(ObjectUtil.isNotEmpty(whereJson.get("is_used")), HotPointIvt::getIs_used, whereJson.get("is_used"))
.eq(ObjectUtil.isNotEmpty(whereJson.get("point_location")), HotPointIvt::getPoint_location, whereJson.get("point_location"))
.in(ObjectUtil.isNotEmpty(split), HotPointIvt::getProduct_area, split)
.eq(ObjectUtil.isNotEmpty(whereJson.get("begin_time")), HotPointIvt::getInstorage_time, whereJson.get("begin_time"))
.eq(ObjectUtil.isNotEmpty(whereJson.get("end_time")), HotPointIvt::getInstorage_time, whereJson.get("end_time"));
IPage<HotPointIvt> pages = new Page<>(page.getOffset() + 1, page.getPageSize());
IPage<HotPointIvt> hotPointIvtList = hotPointIvtMappper.selectPage(pages, wrapper);
if (hotPointIvtList.getRecords().size() > 0) {
hotPointIvtList.getRecords().forEach(hotPointIvt -> {
BigDecimal temperature = (BigDecimal) redisUtils.hget(hotPointIvt.getPoint_code(), "temperature");
String last_time = (String) redisUtils.hget(hotPointIvt.getPoint_code(), "last_time");
hotPointIvt.setTemperature(temperature);
hotPointIvt.setLast_time(last_time);
});
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("totalElements", hotPointIvtList.getTotal());
jsonObject.put("content", hotPointIvtList.getRecords());
return jsonObject;
}
@Override
public List<HotPointIvtDto> queryAll(Map whereJson) {
List<HotPointIvt> list = hotPointIvtMappper.selectList(null);
if (ObjectUtil.isNotEmpty(list)) {
return BeanUtil.copyToList(list, HotPointIvtDto.class);
}
return null;
}
@Override
public HotPointIvtDto findById(Long ivt_id) {
HotPointIvt hotPointIvt = hotPointIvtMappper.selectOne(Wrappers.lambdaQuery(HotPointIvt.class).eq(ObjectUtil.isNotEmpty(ivt_id), HotPointIvt::getIvt_id, ivt_id));
if (ObjectUtil.isNotEmpty(hotPointIvt)) {
HotPointIvtDto hotPointIvtDto = BeanUtil.copyProperties(hotPointIvt, HotPointIvtDto.class);
return hotPointIvtDto;
}
return null;
}
@Override
public HotPointIvtDto findByCode(String code) {
LambdaQueryWrapper<HotPointIvt> wrapper = new LambdaQueryWrapper<HotPointIvt>()
.eq(ObjectUtil.isNotEmpty(code), HotPointIvt::getPoint_code, code);
HotPointIvt hotPointIvt = hotPointIvtMappper.selectOne(wrapper);
if (ObjectUtil.isNotEmpty(hotPointIvt)) {
HotPointIvtDto hotPointIvtDto = BeanUtil.copyProperties(hotPointIvt, HotPointIvtDto.class);
return hotPointIvtDto;
}
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(HotPointIvtDto 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);
HotPointIvt hotPointIvt = BeanUtil.copyProperties(dto, HotPointIvt.class);
hotPointIvtMappper.insert(hotPointIvt);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(HotPointIvtDto dto) {
HotPointIvtDto ivtDto = this.findById(dto.getIvt_id());
if (ivtDto == 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);
HotPointIvt hotPointIvt = BeanUtil.copyProperties(dto, HotPointIvt.class);
hotPointIvtMappper.updateById(hotPointIvt);
}
@Override
public void deleteAll(Long[] ids) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
List<HotPointIvt> list = hotPointIvtMappper.selectBatchIds(Arrays.asList(ids));
for (HotPointIvt hotPointIvt : list) {
hotPointIvt.setIs_delete("1");
hotPointIvt.setUpdate_optid(currentUserId);
hotPointIvt.setUpdate_optname(nickName);
hotPointIvt.setUpdate_time(now);
hotPointIvtMappper.updateById(hotPointIvt);
}
}
@Override
public Map<String, Object> taskDtlQuery(HotPointIvtQuery whereJson, PageQuery page) {
Page<StIvtHotregioniomst> pages = new Page<>(page.getPage() + 1, page.getSize());
Page<StIvtHotregioniomst> hotregioniomstPage = hotPointIvtMappper.taskDtlQuery(pages, whereJson);
JSONObject jsonObject = new JSONObject();
jsonObject.put("totalElements", hotregioniomstPage.getTotal());
jsonObject.put("content", hotregioniomstPage.getRecords());
return jsonObject;
}
@Override
public void uploadMes(JSONObject form) {
String flag = form.getString("flag");
LmsToMesService lmsToMesService = SpringContextHolder.getBean(LmsToMesService.class);
// 将入烘箱信息发送给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();
param.put("iContainerName", form.getString("container_name"));
param.put("iResourceName", form.getString("ext_code"));
param.put("UserName", userName);
param.put("PassWord", passWord);
//入箱回传
if ("1".equals(flag)) {
//判断该接口是否需要回传
param.put("iMoveInDate", DateUtil.now());
param.put("iPlanBakingTemperature", form.getDoubleValue("temperature"));
param.put("iPlanBakingTimer", form.getDoubleValue("oven_time"));
LambdaQueryWrapper<InterfaceBack> lam = new LambdaQueryWrapper<>();
lam.eq(InterfaceBack::getInterface_name, "momRollBakeInBound");
lam.eq(InterfaceBack::getIs_back, "1");
InterfaceBack back_jo = interfaceBackMapper.selectOne(lam);
if (ObjectUtil.isNotEmpty(back_jo)) {
lmsToMesService.momRollBakeInBound(param);
}
//将该母卷的入烘箱标识改为0
HashMap<String, String> map = new HashMap<>();
map.put("is_baking", "0");
WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map, "container_name = '" + form.getString("container_name") + "'");
log.info("母卷:" + form.getString("container_name") + "对应的入烘箱任务完成,请求烘烤标识改为0");
}
//出箱回传
if ("2".equals(flag)) {
param.put("MoveOutDate", DateUtil.now());
param.put("ActualBakingTemperature", form.getDoubleValue("temperature"));
param.put("ActualBakingTimer", form.getDoubleValue("oven_time"));
//判断该接口是否需要回传
LambdaQueryWrapper<InterfaceBack> lam = new LambdaQueryWrapper<>();
lam.eq(InterfaceBack::getInterface_name, "momRollBakeOutBound");
lam.eq(InterfaceBack::getIs_back, "1");
InterfaceBack back_jo = interfaceBackMapper.selectOne(lam);
if (ObjectUtil.isNotEmpty(back_jo)) {
lmsToMesService.momRollBakeOutBound(param);
}
}
}
}

160
lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/rest/HotPointIvtController.java

@ -1,80 +1,80 @@
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.HotPointIvtService;
import org.nl.wms.pdm.ivt.service.dto.HotPointIvtDto;
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-09
**/
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/hotpointivt")
@Slf4j
public class HotPointIvtController {
private final HotPointIvtService hotpointivtService;
@GetMapping
@Log("查询烘烤区点位库存")
//@SaCheckPermission("@el.check('hotpointivt:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(hotpointivtService.queryAll(whereJson, page), HttpStatus.OK);
}
@PostMapping
@Log("新增烘烤区点位库存")
//@SaCheckPermission("@el.check('hotpointivt:add')")
public ResponseEntity<Object> create(@Validated @RequestBody HotPointIvtDto dto) {
hotpointivtService.create(dto);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@Log("修改烘烤区点位库存")
//@SaCheckPermission("@el.check('hotpointivt:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody HotPointIvtDto dto) {
hotpointivtService.update(dto);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除烘烤区点位库存")
//@SaCheckPermission("@el.check('hotpointivt:del')")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
hotpointivtService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@GetMapping("/taskDtlQuery")
@Log("查询烘烤任务明细")
public ResponseEntity<Object> taskDtlQuery(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(hotpointivtService.taskDtlQuery(whereJson, page), HttpStatus.OK);
}
@PostMapping("/uploadMes")
@Log("手动回传MES")
public ResponseEntity<Object> uploadMes(@RequestBody JSONObject form) {
hotpointivtService.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.HotPointIvtService;
//import org.nl.wms.pdm.ivt.service.dto.HotPointIvtDto;
//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-09
// **/
//@RestController
//@RequiredArgsConstructor
//
//@RequestMapping("/api/hotpointivt")
//@Slf4j
//public class HotPointIvtController {
//
// private final HotPointIvtService hotpointivtService;
//
// @GetMapping
// @Log("查询烘烤区点位库存")
//
// //@SaCheckPermission("@el.check('hotpointivt:list')")
// public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
// return new ResponseEntity<>(hotpointivtService.queryAll(whereJson, page), HttpStatus.OK);
// }
//
// @PostMapping
// @Log("新增烘烤区点位库存")
//
// //@SaCheckPermission("@el.check('hotpointivt:add')")
// public ResponseEntity<Object> create(@Validated @RequestBody HotPointIvtDto dto) {
// hotpointivtService.create(dto);
// return new ResponseEntity<>(HttpStatus.CREATED);
// }
//
// @PutMapping
// @Log("修改烘烤区点位库存")
//
// //@SaCheckPermission("@el.check('hotpointivt:edit')")
// public ResponseEntity<Object> update(@Validated @RequestBody HotPointIvtDto dto) {
// hotpointivtService.update(dto);
// return new ResponseEntity<>(HttpStatus.NO_CONTENT);
// }
//
// @Log("删除烘烤区点位库存")
//
// //@SaCheckPermission("@el.check('hotpointivt:del')")
// @DeleteMapping
// public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
// hotpointivtService.deleteAll(ids);
// return new ResponseEntity<>(HttpStatus.OK);
// }
//
// @GetMapping("/taskDtlQuery")
// @Log("查询烘烤任务明细")
//
// public ResponseEntity<Object> taskDtlQuery(@RequestParam Map whereJson, Pageable page) {
// return new ResponseEntity<>(hotpointivtService.taskDtlQuery(whereJson, page), HttpStatus.OK);
// }
//
// @PostMapping("/uploadMes")
// @Log("手动回传MES")
//
// public ResponseEntity<Object> uploadMes(@RequestBody JSONObject form) {
// hotpointivtService.uploadMes(form);
// return new ResponseEntity<>(HttpStatus.OK);
// }
//}

166
lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/HotPointIvtService.java

@ -1,83 +1,83 @@
package org.nl.wms.pdm.ivt.service;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.pdm.ivt.service.dto.HotPointIvtDto;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* @author lyd
* @description 服务接口
* @date 2022-10-09
**/
public interface HotPointIvtService {
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
*
* @param whereJson 条件参数
* @return List<HotpointivtDto>
*/
List<HotPointIvtDto> queryAll(Map whereJson);
/**
* 根据ID查询
*
* @param ivt_id ID
* @return Hotpointivt
*/
HotPointIvtDto findById(Long ivt_id);
/**
* 根据编码查询
*
* @param code code
* @return Hotpointivt
*/
HotPointIvtDto findByCode(String code);
/**
* 创建
*
* @param dto /
*/
void create(HotPointIvtDto dto);
/**
* 编辑
*
* @param dto /
*/
void update(HotPointIvtDto dto);
/**
* 多选删除
*
* @param ids /
*/
void deleteAll(Long[] ids);
/**
* 任务明细分页查询
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> taskDtlQuery(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.HotPointIvtDto;
//import org.springframework.data.domain.Pageable;
//
//import java.util.List;
//import java.util.Map;
//
///**
// * @author lyd
// * @description 服务接口
// * @date 2022-10-09
// **/
//public interface HotPointIvtService {
//
// /**
// * 查询数据分页
// *
// * @param whereJson 条件
// * @param page 分页参数
// * @return Map<String, Object>
// */
// Map<String, Object> queryAll(Map whereJson, Pageable page);
//
// /**
// * 查询所有数据不分页
// *
// * @param whereJson 条件参数
// * @return List<HotpointivtDto>
// */
// List<HotPointIvtDto> queryAll(Map whereJson);
//
// /**
// * 根据ID查询
// *
// * @param ivt_id ID
// * @return Hotpointivt
// */
// HotPointIvtDto findById(Long ivt_id);
//
// /**
// * 根据编码查询
// *
// * @param code code
// * @return Hotpointivt
// */
// HotPointIvtDto findByCode(String code);
//
//
// /**
// * 创建
// *
// * @param dto /
// */
// void create(HotPointIvtDto dto);
//
// /**
// * 编辑
// *
// * @param dto /
// */
// void update(HotPointIvtDto dto);
//
// /**
// * 多选删除
// *
// * @param ids /
// */
// void deleteAll(Long[] ids);
//
// /**
// * 任务明细分页查询
// *
// * @param whereJson 条件
// * @param page 分页参数
// * @return Map<String, Object>
// */
// Map<String, Object> taskDtlQuery(Map whereJson, Pageable page);
//
// void uploadMes(JSONObject form);
//
//}

268
lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/dto/HotPointIvtDto.java

@ -1,134 +1,134 @@
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-09
**/
@Data
public class HotPointIvtDto implements Serializable {
/** 库存记录标识 */
/**
* 防止精度丢失
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long ivt_id;
/**
* 点位编码
*/
private String point_code;
/**
* 点位状态
*/
private String point_status;
/**
* 母卷号
*/
private String container_name;
/**
* 母卷工单标识
*/
private String workorder_id;
/**
* 母卷轴编码
*/
private String full_vehicle_code;
/**
* 批次
*/
private String pcsn;
/**
* 库存数
*/
private BigDecimal ivt_qty;
/**
* 计量单位标识
*/
private Long qty_unit_id;
/**
* 入库时间
*/
private String instorage_time;
/**
* 生产区域
*/
private String product_area;
/**
* 温度
*/
private BigDecimal temperature;
/**
* 组别
*/
private String group_name;
/**
* 位置
*/
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;
}
//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-09
// **/
//@Data
//public class HotPointIvtDto implements Serializable {
//
// /** 库存记录标识 */
// /**
// * 防止精度丢失
// */
// @JsonSerialize(using = ToStringSerializer.class)
// private Long ivt_id;
//
// /**
// * 点位编码
// */
// private String point_code;
//
// /**
// * 点位状态
// */
// private String point_status;
//
// /**
// * 母卷号
// */
// private String container_name;
//
// /**
// * 母卷工单标识
// */
// private String workorder_id;
//
// /**
// * 母卷轴编码
// */
// private String full_vehicle_code;
//
// /**
// * 批次
// */
// private String pcsn;
//
// /**
// * 库存数
// */
// private BigDecimal ivt_qty;
//
// /**
// * 计量单位标识
// */
// private Long qty_unit_id;
//
// /**
// * 入库时间
// */
// private String instorage_time;
//
// /**
// * 生产区域
// */
// private String product_area;
//
// /**
// * 温度
// */
// private BigDecimal temperature;
//
// /**
// * 组别
// */
// private String group_name;
//
// /**
// * 位置
// */
// 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;
//}

524
lms/nladmin-system/src/main/java/org/nl/wms/pdm/ivt/service/impl/HotPointIvtServiceImpl.java

@ -1,262 +1,262 @@
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 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.common.utils.RedisUtils;
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.HotPointIvtService;
import org.nl.wms.pdm.ivt.service.dto.HotPointIvtDto;
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-09
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class HotPointIvtServiceImpl implements HotPointIvtService {
@Autowired
private InterfaceBackMapper interfaceBackMapper;
@Autowired
private RedisUtils redisUtils;
@Autowired
IUserAreaPermissionService userAreaPermissionService;
@Override
public Map<String, Object> 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") + "%");
}
map.put("point_status", whereJson.get("point_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_HOTPOINTIVT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "product_area,point_code");
JSONArray rows = json.getJSONArray("content");
JSONArray new_rows = new JSONArray();
for (int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i);
String temperature = (String) redisUtils.hget(row.getString("point_code"), "temperature");
String last_time = (String) redisUtils.hget(row.getString("point_code"), "last_time");
row.put("temperature", temperature);
row.put("last_time", last_time);
new_rows.add(row);
}
json.put("content", new_rows);
return json;
}
@Override
public List<HotPointIvtDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("st_ivt_hotpointivt");
JSONArray arr = wo.query().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(arr)) {
return arr.toJavaList(HotPointIvtDto.class);
}
return null;
}
@Override
public HotPointIvtDto findById(Long ivt_id) {
WQLObject wo = WQLObject.getWQLObject("st_ivt_hotpointivt");
JSONObject json = wo.query("ivt_id = '" + ivt_id + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(HotPointIvtDto.class);
}
return null;
}
@Override
public HotPointIvtDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("st_ivt_hotpointivt");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(HotPointIvtDto.class);
}
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(HotPointIvtDto 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_hotpointivt");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
wo.insert(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(HotPointIvtDto dto) {
HotPointIvtDto 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_hotpointivt");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
if (!json.containsKey("temperature")) {
json.put("temperature", null);
}
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_hotpointivt");
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);
}
}
@Override
public void uploadMes(JSONObject form) {
String flag = form.getString("flag");
LmsToMesService lmsToMesService = SpringContextHolder.getBean(LmsToMesService.class);
// 将入烘箱信息发送给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();
param.put("iContainerName", form.getString("container_name"));
param.put("iResourceName", form.getString("ext_code"));
param.put("UserName", userName);
param.put("PassWord", passWord);
//入箱回传
if ("1".equals(flag)) {
//判断该接口是否需要回传
param.put("iMoveInDate", DateUtil.now());
param.put("iPlanBakingTemperature", form.getDoubleValue("temperature"));
param.put("iPlanBakingTimer", form.getDoubleValue("oven_time"));
LambdaQueryWrapper<InterfaceBack> lam = new LambdaQueryWrapper<>();
lam.eq(InterfaceBack::getInterface_name, "momRollBakeInBound");
lam.eq(InterfaceBack::getIs_back, "1");
InterfaceBack back_jo = interfaceBackMapper.selectOne(lam);
if (ObjectUtil.isNotEmpty(back_jo)) {
lmsToMesService.momRollBakeInBound(param);
}
//将该母卷的入烘箱标识改为0
HashMap<String, String> map = new HashMap<>();
map.put("is_baking", "0");
WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map, "container_name = '" + form.getString("container_name") + "'");
log.info("母卷:" + form.getString("container_name") + "对应的入烘箱任务完成,请求烘烤标识改为0");
}
//出箱回传
if ("2".equals(flag)) {
param.put("MoveOutDate", DateUtil.now());
param.put("ActualBakingTemperature", form.getDoubleValue("temperature"));
param.put("ActualBakingTimer", form.getDoubleValue("oven_time"));
//判断该接口是否需要回传
LambdaQueryWrapper<InterfaceBack> lam = new LambdaQueryWrapper<>();
lam.eq(InterfaceBack::getInterface_name, "momRollBakeOutBound");
lam.eq(InterfaceBack::getIs_back, "1");
InterfaceBack back_jo = interfaceBackMapper.selectOne(lam);
if (ObjectUtil.isNotEmpty(back_jo)) {
lmsToMesService.momRollBakeOutBound(param);
}
}
}
@Override
public Map<String, Object> taskDtlQuery(Map whereJson, Pageable page) {
String task_code = MapUtil.getStr(whereJson, "task_code");
String start_point_code = MapUtil.getStr(whereJson, "start_point_code");
String next_point_code = MapUtil.getStr(whereJson, "next_point_code");
String container_name = MapUtil.getStr(whereJson, "container_name");
JSONObject map = new JSONObject();
map.put("flag", "2");
map.put("bill_code", MapUtil.getStr(whereJson, "bill_code"));
map.put("dtl_status", MapUtil.getStr(whereJson, "dtl_status"));
map.put("begin_time", whereJson.get("begin_time"));
map.put("end_time", whereJson.get("end_time"));
map.put("container_name", container_name);
if (ObjectUtil.isNotEmpty(task_code)) {
map.put("task_code", "%" + task_code + "%");
}
if (ObjectUtil.isNotEmpty(start_point_code)) {
map.put("start_point_code", "%" + start_point_code + "%");
}
if (ObjectUtil.isNotEmpty(next_point_code)) {
map.put("next_point_code", "%" + next_point_code + "%");
}
JSONObject json = WQL.getWO("ST_IVT_HOTPOINTIVT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "create_time DESC");
return json;
}
}
//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 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.common.utils.RedisUtils;
//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.areapermissions.service.IUserAreaPermissionService;
//import org.nl.wms.ext.mes.service.LmsToMesService;
//import org.nl.wms.pdm.ivt.service.HotPointIvtService;
//import org.nl.wms.pdm.ivt.service.dto.HotPointIvtDto;
//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-09
// **/
//@Service
//@RequiredArgsConstructor
//@Slf4j
//public class HotPointIvtServiceImpl implements HotPointIvtService {
// @Autowired
// private InterfaceBackMapper interfaceBackMapper;
// @Autowired
// private RedisUtils redisUtils;
// @Autowired
// IUserAreaPermissionService userAreaPermissionService;
// @Override
// public Map<String, Object> 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") + "%");
// }
// map.put("point_status", whereJson.get("point_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_HOTPOINTIVT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "product_area,point_code");
// JSONArray rows = json.getJSONArray("content");
// JSONArray new_rows = new JSONArray();
// for (int i = 0; i < rows.size(); i++) {
// JSONObject row = rows.getJSONObject(i);
// String temperature = (String) redisUtils.hget(row.getString("point_code"), "temperature");
// String last_time = (String) redisUtils.hget(row.getString("point_code"), "last_time");
// row.put("temperature", temperature);
// row.put("last_time", last_time);
// new_rows.add(row);
// }
// json.put("content", new_rows);
// return json;
// }
//
// @Override
// public List<HotPointIvtDto> queryAll(Map whereJson) {
// WQLObject wo = WQLObject.getWQLObject("st_ivt_hotpointivt");
// JSONArray arr = wo.query().getResultJSONArray(0);
// if (ObjectUtil.isNotEmpty(arr)) {
// return arr.toJavaList(HotPointIvtDto.class);
// }
// return null;
// }
//
// @Override
// public HotPointIvtDto findById(Long ivt_id) {
// WQLObject wo = WQLObject.getWQLObject("st_ivt_hotpointivt");
// JSONObject json = wo.query("ivt_id = '" + ivt_id + "'").uniqueResult(0);
// if (ObjectUtil.isNotEmpty(json)) {
// return json.toJavaObject(HotPointIvtDto.class);
// }
// return null;
// }
//
// @Override
// public HotPointIvtDto findByCode(String code) {
// WQLObject wo = WQLObject.getWQLObject("st_ivt_hotpointivt");
// JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
// if (ObjectUtil.isNotEmpty(json)) {
// return json.toJavaObject(HotPointIvtDto.class);
// }
// return null;
// }
//
// @Override
// @Transactional(rollbackFor = Exception.class)
// public void create(HotPointIvtDto 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_hotpointivt");
// JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
// wo.insert(json);
// }
//
// @Override
// @Transactional(rollbackFor = Exception.class)
// public void update(HotPointIvtDto dto) {
// HotPointIvtDto 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_hotpointivt");
// JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
// if (!json.containsKey("temperature")) {
// json.put("temperature", null);
// }
// 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_hotpointivt");
// 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);
// }
// }
//
// @Override
// public void uploadMes(JSONObject form) {
// String flag = form.getString("flag");
//
// LmsToMesService lmsToMesService = SpringContextHolder.getBean(LmsToMesService.class);
// // 将入烘箱信息发送给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();
// param.put("iContainerName", form.getString("container_name"));
// param.put("iResourceName", form.getString("ext_code"));
// param.put("UserName", userName);
// param.put("PassWord", passWord);
//
// //入箱回传
// if ("1".equals(flag)) {
// //判断该接口是否需要回传
// param.put("iMoveInDate", DateUtil.now());
// param.put("iPlanBakingTemperature", form.getDoubleValue("temperature"));
// param.put("iPlanBakingTimer", form.getDoubleValue("oven_time"));
//
// LambdaQueryWrapper<InterfaceBack> lam = new LambdaQueryWrapper<>();
// lam.eq(InterfaceBack::getInterface_name, "momRollBakeInBound");
// lam.eq(InterfaceBack::getIs_back, "1");
// InterfaceBack back_jo = interfaceBackMapper.selectOne(lam);
// if (ObjectUtil.isNotEmpty(back_jo)) {
// lmsToMesService.momRollBakeInBound(param);
// }
//
// //将该母卷的入烘箱标识改为0
// HashMap<String, String> map = new HashMap<>();
// map.put("is_baking", "0");
// WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map, "container_name = '" + form.getString("container_name") + "'");
// log.info("母卷:" + form.getString("container_name") + "对应的入烘箱任务完成,请求烘烤标识改为0");
// }
// //出箱回传
// if ("2".equals(flag)) {
// param.put("MoveOutDate", DateUtil.now());
// param.put("ActualBakingTemperature", form.getDoubleValue("temperature"));
// param.put("ActualBakingTimer", form.getDoubleValue("oven_time"));
// //判断该接口是否需要回传
// LambdaQueryWrapper<InterfaceBack> lam = new LambdaQueryWrapper<>();
// lam.eq(InterfaceBack::getInterface_name, "momRollBakeOutBound");
// lam.eq(InterfaceBack::getIs_back, "1");
// InterfaceBack back_jo = interfaceBackMapper.selectOne(lam);
// if (ObjectUtil.isNotEmpty(back_jo)) {
// lmsToMesService.momRollBakeOutBound(param);
// }
// }
//
//
// }
//
// @Override
// public Map<String, Object> taskDtlQuery(Map whereJson, Pageable page) {
//
// String task_code = MapUtil.getStr(whereJson, "task_code");
// String start_point_code = MapUtil.getStr(whereJson, "start_point_code");
// String next_point_code = MapUtil.getStr(whereJson, "next_point_code");
// String container_name = MapUtil.getStr(whereJson, "container_name");
//
// JSONObject map = new JSONObject();
// map.put("flag", "2");
// map.put("bill_code", MapUtil.getStr(whereJson, "bill_code"));
// map.put("dtl_status", MapUtil.getStr(whereJson, "dtl_status"));
// map.put("begin_time", whereJson.get("begin_time"));
// map.put("end_time", whereJson.get("end_time"));
// map.put("container_name", container_name);
// if (ObjectUtil.isNotEmpty(task_code)) {
// map.put("task_code", "%" + task_code + "%");
// }
// if (ObjectUtil.isNotEmpty(start_point_code)) {
// map.put("start_point_code", "%" + start_point_code + "%");
// }
// if (ObjectUtil.isNotEmpty(next_point_code)) {
// map.put("next_point_code", "%" + next_point_code + "%");
// }
//
// JSONObject json = WQL.getWO("ST_IVT_HOTPOINTIVT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "create_time DESC");
//
// return json;
// }
//
//}

Loading…
Cancel
Save