liejiu946
3 weeks ago
7 changed files with 652 additions and 0 deletions
@ -0,0 +1,84 @@ |
|||
package org.nl.wms.pdm.rawfoilworkorder.controller; |
|||
|
|||
|
|||
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.rawfoilworkorder.service.RawfoilWorkOrderService; |
|||
import org.nl.wms.pdm.rawfoilworkorder.service.dao.RawfoilWorkOrder; |
|||
import org.nl.wms.pdm.rawfoilworkorder.service.dto.RawfoilWorkOrderDto; |
|||
import org.nl.wms.pdm.service.dto.RawfoilworkorderDto; |
|||
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 liuxy |
|||
* @date 2022-10-08 |
|||
**/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
|
|||
@RequestMapping("/api/rawfoilworkorder") |
|||
@Slf4j |
|||
public class RawfoilWorkOrderController { |
|||
|
|||
private final RawfoilWorkOrderService rawfoilworkorderService; |
|||
|
|||
@GetMapping |
|||
@Log("查询生箔工序工单") |
|||
|
|||
//@SaCheckPermission("@el.check('rawfoilworkorder:list')")
|
|||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) { |
|||
return new ResponseEntity<>(rawfoilworkorderService.queryAll(whereJson, page), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增生箔工序工单") |
|||
|
|||
//@SaCheckPermission("@el.check('rawfoilworkorder:add')")
|
|||
public ResponseEntity<Object> create(@Validated @RequestBody RawfoilWorkOrder dto) { |
|||
rawfoilworkorderService.create(dto); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改生箔工序工单") |
|||
|
|||
//@SaCheckPermission("@el.check('rawfoilworkorder:edit')")
|
|||
public ResponseEntity<Object> update(@Validated @RequestBody RawfoilWorkOrder dto) { |
|||
rawfoilworkorderService.update(dto); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@Log("删除生箔工序工单") |
|||
|
|||
//@SaCheckPermission("@el.check('rawfoilworkorder:del')")
|
|||
@DeleteMapping |
|||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) { |
|||
rawfoilworkorderService.deleteAll(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@Log("强制确认") |
|||
|
|||
@PostMapping("/compelEnd") |
|||
public ResponseEntity<Object> compelEnd(@RequestBody JSONObject whereJson) { |
|||
rawfoilworkorderService.compelEnd(whereJson); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@Log("称重") |
|||
|
|||
@PostMapping("/confirm") |
|||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) { |
|||
rawfoilworkorderService.confirm(whereJson); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
} |
@ -0,0 +1,79 @@ |
|||
package org.nl.wms.pdm.rawfoilworkorder.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.rawfoilworkorder.service.dao.RawfoilWorkOrder; |
|||
import org.nl.wms.pdm.rawfoilworkorder.service.dto.RawfoilWorkOrderDto; |
|||
import org.nl.wms.pdm.service.dto.RawfoilworkorderDto; |
|||
import org.springframework.data.domain.Pageable; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author dsh |
|||
* @description 服务接口 |
|||
**/ |
|||
public interface RawfoilWorkOrderService extends IService<RawfoilWorkOrder> { |
|||
|
|||
/** |
|||
* 查询数据分页 |
|||
* |
|||
* @param whereJson 条件 |
|||
* @param page 分页参数 |
|||
* @return Map<String, Object> |
|||
*/ |
|||
Map<String, Object> queryAll(Map whereJson, PageQuery page); |
|||
|
|||
/** |
|||
* 查询所有数据不分页 |
|||
* |
|||
* @param whereJson 条件参数 |
|||
* @return List<RawfoilworkorderDto> |
|||
*/ |
|||
List<RawfoilWorkOrder> queryAll(Map whereJson); |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* |
|||
* @param workorder_id ID |
|||
* @return Rawfoilworkorder |
|||
*/ |
|||
RawfoilWorkOrder findById(Long workorder_id); |
|||
|
|||
/** |
|||
* 创建 |
|||
* |
|||
* @param dto / |
|||
*/ |
|||
void create(RawfoilWorkOrder dto); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param dto / |
|||
*/ |
|||
void update(RawfoilWorkOrder dto); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(Long[] ids); |
|||
|
|||
/** |
|||
* 强制确认 |
|||
* |
|||
* @param whereJson / |
|||
*/ |
|||
void compelEnd(JSONObject whereJson); |
|||
|
|||
/** |
|||
* 称重 |
|||
* |
|||
* @param whereJson / |
|||
*/ |
|||
void confirm(JSONObject whereJson); |
|||
} |
@ -0,0 +1,171 @@ |
|||
package org.nl.wms.pdm.rawfoilworkorder.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 java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* @author dsh |
|||
*/ |
|||
@Data |
|||
@TableName("pdm_bi_rawfoilworkorder") |
|||
public class RawfoilWorkOrder implements Serializable { |
|||
|
|||
/** 工单标识 */ |
|||
/** |
|||
* 防止精度丢失 |
|||
*/ |
|||
@TableId |
|||
@JsonSerialize(using = ToStringSerializer.class) |
|||
private Long workorder_id; |
|||
|
|||
/** |
|||
* 母卷号 |
|||
*/ |
|||
private String container_name; |
|||
|
|||
/** |
|||
* 机台编码 |
|||
*/ |
|||
private String resource_name; |
|||
|
|||
/** |
|||
* 生产工单 |
|||
*/ |
|||
private String mfg_order_name; |
|||
|
|||
/** |
|||
* 产品编码 |
|||
*/ |
|||
private String product_name; |
|||
|
|||
/** |
|||
* 产品名称 |
|||
*/ |
|||
private String description; |
|||
|
|||
/** |
|||
* 理论长度 |
|||
*/ |
|||
private BigDecimal theory_height; |
|||
|
|||
/** |
|||
* 设备生产速度 |
|||
*/ |
|||
private BigDecimal eqp_velocity; |
|||
|
|||
/** |
|||
* 上卷开始时间 |
|||
*/ |
|||
private String up_coiler_date; |
|||
|
|||
/** |
|||
* 是否重新更新 |
|||
*/ |
|||
private String is_reload_send; |
|||
|
|||
/** |
|||
* 重量 |
|||
*/ |
|||
private BigDecimal productin_qty; |
|||
|
|||
/** |
|||
* 开始时间 |
|||
*/ |
|||
private String realstart_time; |
|||
|
|||
/** |
|||
* 结束时间 |
|||
*/ |
|||
private String realend_time; |
|||
|
|||
/** |
|||
* 状态 |
|||
*/ |
|||
private String status; |
|||
|
|||
/** |
|||
* 完成方式 |
|||
*/ |
|||
private String finish_type; |
|||
|
|||
/** |
|||
* 车号 |
|||
*/ |
|||
private String agvno; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
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 is_delete; |
|||
|
|||
/** |
|||
* 生产区域 |
|||
*/ |
|||
private String product_area; |
|||
|
|||
/** |
|||
* 点位编码 |
|||
*/ |
|||
private String point_code; |
|||
|
|||
/** |
|||
* 请求烘烤 |
|||
*/ |
|||
private String is_baking; |
|||
|
|||
/** |
|||
* 请求入半成品库 |
|||
*/ |
|||
private String is_instor; |
|||
|
|||
/** |
|||
* 收卷辊 |
|||
*/ |
|||
private String wind_roll; |
|||
|
|||
/** |
|||
* 类型 |
|||
*/ |
|||
private String order_type; |
|||
} |
@ -0,0 +1,13 @@ |
|||
package org.nl.wms.pdm.rawfoilworkorder.service.dao.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.nl.wms.pdm.rawfoilworkorder.service.dao.RawfoilWorkOrder; |
|||
import org.nl.wms.pdm.rawfoilworkorder.service.dto.RawfoilWorkOrderDto; |
|||
|
|||
@Mapper |
|||
public interface RawfoilWorkOrderMapper extends BaseMapper<RawfoilWorkOrder> { |
|||
IPage<RawfoilWorkOrderDto> queryAllPage(@Param("rawfoilWorkOrderDto")RawfoilWorkOrderDto rawfoilWorkOrderDto , @Param("page") IPage<RawfoilWorkOrderDto> page); |
|||
} |
@ -0,0 +1,28 @@ |
|||
<?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.rawfoilworkorder.service.dao.mapper.RawfoilWorkOrderMapper"> |
|||
|
|||
<select id="queryAllPage" resultType="org.nl.wms.pdm.rawfoilworkorder.service.dto.RawfoilWorkOrderDto"> |
|||
SELECT |
|||
der.*, |
|||
ivt.point_code AS point_code2 |
|||
FROM |
|||
pdm_bi_rawfoilworkorder der |
|||
LEFT JOIN ST_IVT_SbPointIvt ivt ON ivt.ext_code = der.resource_name |
|||
<where> |
|||
der.is_delete = '0' |
|||
<if test="rawfoilWorkOrderDto.in_area_id!=null"> |
|||
AND der.product_area in |
|||
<foreach collection="rawfoilWorkOrderDto.in_area_id" item="item" index="index" open="(" separator="," close=")">#{item}</foreach> |
|||
</if> |
|||
<if test="rawfoilWorkOrderDto.resource_name!=null">and der.resource_name like #{rawfoilWorkOrderDto.resource_name}</if> |
|||
<if test="rawfoilWorkOrderDto.container_name!=null">and der.container_name like #{rawfoilWorkOrderDto.container_name}</if> |
|||
<if test="rawfoilWorkOrderDto.product_area!=null">and der.product_area = #{rawfoilWorkOrderDto.product_area}</if> |
|||
<if test="rawfoilWorkOrderDto.status!=null">and der.status = #{rawfoilWorkOrderDto.status}</if> |
|||
<if test="rawfoilWorkOrderDto.begin_time!=null">and der.create_time >= #{rawfoilWorkOrderDto.begin_time}</if> |
|||
<if test="rawfoilWorkOrderDto.end_time!=null">and der.create_time <= #{rawfoilWorkOrderDto.end_time}</if> |
|||
</where> |
|||
order by der.container_name |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,32 @@ |
|||
package org.nl.wms.pdm.rawfoilworkorder.service.dto; |
|||
|
|||
import lombok.Data; |
|||
import org.nl.wms.pdm.rawfoilworkorder.service.dao.RawfoilWorkOrder; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author dsh |
|||
*/ |
|||
@Data |
|||
public class RawfoilWorkOrderDto extends RawfoilWorkOrder { |
|||
/** |
|||
* 点位编码 |
|||
*/ |
|||
private String point_code2; |
|||
|
|||
/** |
|||
* 开始时间 |
|||
*/ |
|||
private String begin_time; |
|||
|
|||
/** |
|||
* 结束时间 |
|||
*/ |
|||
private String end_time; |
|||
|
|||
/** |
|||
* 人员对应的区域 |
|||
*/ |
|||
private List<String> in_area_id; |
|||
} |
@ -0,0 +1,245 @@ |
|||
package org.nl.wms.pdm.rawfoilworkorder.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 com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
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.b_lms.sch.point.dao.StIvtSbpointivt; |
|||
import org.nl.b_lms.sch.point.dao.mapper.StIvtSbpointivtMapper; |
|||
import org.nl.b_lms.sch.task.dao.SchBaseTask; |
|||
import org.nl.b_lms.sch.task.dao.mapper.SchBaseTaskMapper; |
|||
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.WqlUtil; |
|||
import org.nl.wms.basedata.master.materialbase.service.dao.Materialbase; |
|||
import org.nl.wms.basedata.master.materialbase.service.dao.mapper.MaterialbaseMapper; |
|||
import org.nl.wms.basedata.st.userarea.service.IUserAreaPermissionService; |
|||
import org.nl.wms.basedata.st.userstor.service.dto.UserStorDto; |
|||
import org.nl.wms.pdm.rawfoilworkorder.service.RawfoilWorkOrderService; |
|||
import org.nl.wms.pdm.rawfoilworkorder.service.dao.RawfoilWorkOrder; |
|||
import org.nl.wms.pdm.rawfoilworkorder.service.dao.mapper.RawfoilWorkOrderMapper; |
|||
import org.nl.wms.pdm.rawfoilworkorder.service.dto.RawfoilWorkOrderDto; |
|||
import org.nl.wms.pdm.service.dto.RawfoilworkorderDto; |
|||
import org.nl.wms.sch.manage.TaskStatusEnum; |
|||
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.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author dsh |
|||
**/ |
|||
@Service |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class RawfoilWorkOrderServiceImpl extends ServiceImpl<RawfoilWorkOrderMapper,RawfoilWorkOrder> implements RawfoilWorkOrderService { |
|||
@Autowired |
|||
IUserAreaPermissionService userAreaPermissionService; |
|||
|
|||
@Autowired |
|||
RawfoilWorkOrderMapper rawfoilWorkOrderMapper; |
|||
|
|||
@Autowired |
|||
StIvtSbpointivtMapper stIvtSbpointivtMapper; |
|||
|
|||
@Autowired |
|||
MaterialbaseMapper materialbaseMapper; |
|||
|
|||
@Autowired |
|||
SchBaseTaskMapper schBaseTaskMapper; |
|||
|
|||
@Override |
|||
public Map<String, Object> queryAll(Map whereJson, PageQuery page) { |
|||
RawfoilWorkOrderDto rawfoilWorkOrderDto = new RawfoilWorkOrderDto(); |
|||
rawfoilWorkOrderDto.setProduct_area(MapUtil.getStr(whereJson, "product_area")); |
|||
rawfoilWorkOrderDto.setResource_name(MapUtil.getStr(whereJson, "resource_name")); |
|||
rawfoilWorkOrderDto.setStatus(MapUtil.getStr(whereJson,"status")); |
|||
rawfoilWorkOrderDto.setContainer_name(MapUtil.getStr(whereJson,"container_name")); |
|||
rawfoilWorkOrderDto.setBegin_time(MapUtil.getStr(whereJson,"begin_time")); |
|||
rawfoilWorkOrderDto.setEnd_time(MapUtil.getStr(whereJson,"end_time")); |
|||
//获取人员对应的区域
|
|||
List<String> in_area_id = userAreaPermissionService.getCurrentUserAreas(SecurityUtils.getCurrentUserId()); |
|||
if (ObjectUtil.isNotEmpty(in_area_id)) { |
|||
rawfoilWorkOrderDto.setIn_area_id(in_area_id); |
|||
} |
|||
IPage<RawfoilWorkOrderDto> pages = new Page<>(page.getPage() + 1, page.getSize()); |
|||
IPage<RawfoilWorkOrderDto> rawfoilWorkOrderList = rawfoilWorkOrderMapper.queryAllPage(rawfoilWorkOrderDto,pages); |
|||
JSONObject jsonObject = new JSONObject(); |
|||
jsonObject.put("totalElements", rawfoilWorkOrderList.getTotal()); |
|||
jsonObject.put("content", rawfoilWorkOrderList.getRecords()); |
|||
return jsonObject; |
|||
} |
|||
|
|||
@Override |
|||
public List<RawfoilWorkOrder> queryAll(Map whereJson) { |
|||
return rawfoilWorkOrderMapper.selectList(new QueryWrapper<RawfoilWorkOrder>()); |
|||
} |
|||
|
|||
@Override |
|||
public RawfoilWorkOrder findById(Long workorder_id) { |
|||
return rawfoilWorkOrderMapper.selectById(workorder_id); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void create(RawfoilWorkOrder dto) { |
|||
String container_name = dto.getContainer_name(); |
|||
RawfoilWorkOrder rawfoilWorkOrder = rawfoilWorkOrderMapper.selectOne(new LambdaQueryWrapper<>(RawfoilWorkOrder.class) |
|||
.eq(RawfoilWorkOrder::getContainer_name,container_name) |
|||
.ne(RawfoilWorkOrder::getStatus,"09")); |
|||
|
|||
if (ObjectUtil.isNotEmpty(rawfoilWorkOrder)) { |
|||
throw new BadRequestException("母卷号已存在"); |
|||
} |
|||
|
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
StIvtSbpointivt stIvtSbpointivt = stIvtSbpointivtMapper.selectOne(new LambdaQueryWrapper<>(StIvtSbpointivt.class) |
|||
.eq(StIvtSbpointivt::getExt_code,dto.getResource_name())); |
|||
if (ObjectUtil.isEmpty(stIvtSbpointivt)) { |
|||
throw new BadRequestException("点位设备不存在"); |
|||
} |
|||
|
|||
Materialbase materialbase = materialbaseMapper.selectOne(new LambdaQueryWrapper<>(Materialbase.class) |
|||
.eq(Materialbase::getMaterial_code,dto.getProduct_name()) |
|||
.eq(Materialbase::getIs_delete,"0").eq(Materialbase::getIs_used,"1")); |
|||
if (ObjectUtil.isEmpty(materialbase)) { |
|||
throw new BadRequestException("物料不存在"); |
|||
} |
|||
|
|||
|
|||
dto.setWorkorder_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); |
|||
dto.setIs_delete("0"); |
|||
dto.setProduct_area(stIvtSbpointivt.getProduct_area()); |
|||
dto.setPoint_code(stIvtSbpointivt.getPoint_code()); |
|||
dto.setStatus("01"); |
|||
|
|||
rawfoilWorkOrderMapper.insert(dto); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(RawfoilWorkOrder dto) { |
|||
RawfoilWorkOrder entity = this.findById(dto.getWorkorder_id()); |
|||
if (entity == null) { |
|||
throw new BadRequestException("被删除或无权限,操作失败!"); |
|||
} |
|||
|
|||
String container_name = dto.getContainer_name(); |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
int count = rawfoilWorkOrderMapper.selectCount(new LambdaQueryWrapper<>(RawfoilWorkOrder.class) |
|||
.eq(RawfoilWorkOrder::getContainer_name,container_name) |
|||
.ne(RawfoilWorkOrder::getStatus,"09")); |
|||
if (count > 1) { |
|||
throw new BadRequestException("母卷号已存在"); |
|||
} |
|||
|
|||
StIvtSbpointivt stIvtSbpointivt = stIvtSbpointivtMapper.selectOne(new LambdaQueryWrapper<>(StIvtSbpointivt.class) |
|||
.eq(StIvtSbpointivt::getExt_code,dto.getResource_name())); |
|||
if (ObjectUtil.isEmpty(stIvtSbpointivt)) { |
|||
throw new BadRequestException("点位设备不存在"); |
|||
} |
|||
|
|||
Materialbase materialbase = materialbaseMapper.selectOne(new LambdaQueryWrapper<>(Materialbase.class) |
|||
.eq(Materialbase::getMaterial_code,dto.getProduct_name()) |
|||
.eq(Materialbase::getIs_delete,"0") |
|||
.eq(Materialbase::getIs_used,"1")); |
|||
if (ObjectUtil.isEmpty(materialbase)) { |
|||
throw new BadRequestException("物料不存在"); |
|||
} |
|||
|
|||
dto.setUpdate_time(now); |
|||
dto.setUpdate_optid(currentUserId); |
|||
dto.setUpdate_optname(nickName); |
|||
dto.setProduct_area(stIvtSbpointivt.getProduct_area()); |
|||
dto.setPoint_code(stIvtSbpointivt.getPoint_code()); |
|||
|
|||
rawfoilWorkOrderMapper.updateById(dto); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void deleteAll(Long[] ids) { |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
for (Long workorder_id : ids) { |
|||
RawfoilWorkOrder rawfoilWorkOrder = new RawfoilWorkOrder(); |
|||
rawfoilWorkOrder.setWorkorder_id(workorder_id); |
|||
rawfoilWorkOrder.setIs_delete("1"); |
|||
rawfoilWorkOrder.setUpdate_optid(currentUserId); |
|||
rawfoilWorkOrder.setUpdate_optname(nickName); |
|||
rawfoilWorkOrder.setUpdate_time(now); |
|||
|
|||
rawfoilWorkOrderMapper.updateById(rawfoilWorkOrder); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void compelEnd(JSONObject whereJson) { |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String currentUsername = SecurityUtils.getCurrentUsername(); |
|||
|
|||
//查询该生箔工单是否存在未完成的任务
|
|||
String container_name = whereJson.getString("container_name"); |
|||
|
|||
SchBaseTask schBaseTask = schBaseTaskMapper.selectOne(new LambdaQueryWrapper<>(SchBaseTask.class) |
|||
.eq(SchBaseTask::getMaterial_code,container_name) |
|||
.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode()) |
|||
.eq(SchBaseTask::getIs_delete,"0")); |
|||
if (ObjectUtil.isNotEmpty(schBaseTask)) { |
|||
throw new BadRequestException("该生箔工单存在未完成的任务,请先完成任务!"); |
|||
} |
|||
|
|||
RawfoilWorkOrder rawfoilWorkOrder = new RawfoilWorkOrder(); |
|||
rawfoilWorkOrder.setWorkorder_id(whereJson.getLong("workorder_id")); |
|||
rawfoilWorkOrder.setStatus("09"); |
|||
rawfoilWorkOrder.setFinish_type("02"); |
|||
rawfoilWorkOrder.setRealend_time(DateUtil.now()); |
|||
rawfoilWorkOrder.setUpdate_optid(currentUserId); |
|||
rawfoilWorkOrder.setUpdate_optname(currentUsername); |
|||
rawfoilWorkOrder.setUpdate_time(DateUtil.now()); |
|||
rawfoilWorkOrderMapper.updateById(rawfoilWorkOrder); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void confirm(JSONObject whereJson) { |
|||
RawfoilWorkOrder rawfoilWorkOrder = new RawfoilWorkOrder(); |
|||
rawfoilWorkOrder.setWorkorder_id(whereJson.getLong("workorder_id")); |
|||
rawfoilWorkOrder.setProductin_qty(ObjectUtil.isEmpty(whereJson.getString("productin_qty")) ? BigDecimal.valueOf(0) : whereJson.getBigDecimal("productin_qty")); |
|||
rawfoilWorkOrderMapper.updateById(rawfoilWorkOrder); |
|||
} |
|||
|
|||
} |
Loading…
Reference in new issue