opt: 生箔工单 注释之前WQL代码
This commit is contained in:
@@ -1,81 +1,81 @@
|
|||||||
package org.nl.wms.pdm.rest;
|
//package org.nl.wms.pdm.rest;
|
||||||
|
//
|
||||||
|
//
|
||||||
import com.alibaba.fastjson.JSONObject;
|
//import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.modules.logging.annotation.Log;
|
//import org.nl.modules.logging.annotation.Log;
|
||||||
import org.nl.wms.pdm.service.RawfoilworkorderService;
|
//import org.nl.wms.pdm.service.RawfoilworkorderService;
|
||||||
import org.nl.wms.pdm.service.dto.RawfoilworkorderDto;
|
//import org.nl.wms.pdm.service.dto.RawfoilworkorderDto;
|
||||||
import org.springframework.data.domain.Pageable;
|
//import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
//import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
//import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
//import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
//import org.springframework.web.bind.annotation.*;
|
||||||
|
//
|
||||||
import java.util.Map;
|
//import java.util.Map;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* @author liuxy
|
// * @author liuxy
|
||||||
* @date 2022-10-08
|
// * @date 2022-10-08
|
||||||
**/
|
// **/
|
||||||
@RestController
|
//@RestController
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
|
//
|
||||||
@RequestMapping("/api/rawfoilworkorder")
|
//@RequestMapping("/api/rawfoilworkorder")
|
||||||
@Slf4j
|
//@Slf4j
|
||||||
public class RawfoilworkorderController {
|
//public class RawfoilworkorderController {
|
||||||
|
//
|
||||||
private final RawfoilworkorderService rawfoilworkorderService;
|
// private final RawfoilworkorderService rawfoilworkorderService;
|
||||||
|
//
|
||||||
@GetMapping
|
// @GetMapping
|
||||||
@Log("查询生箔工序工单")
|
// @Log("查询生箔工序工单")
|
||||||
|
//
|
||||||
//@SaCheckPermission("@el.check('rawfoilworkorder:list')")
|
// //@SaCheckPermission("@el.check('rawfoilworkorder:list')")
|
||||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
// public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||||
return new ResponseEntity<>(rawfoilworkorderService.queryAll(whereJson, page), HttpStatus.OK);
|
// return new ResponseEntity<>(rawfoilworkorderService.queryAll(whereJson, page), HttpStatus.OK);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@PostMapping
|
// @PostMapping
|
||||||
@Log("新增生箔工序工单")
|
// @Log("新增生箔工序工单")
|
||||||
|
//
|
||||||
//@SaCheckPermission("@el.check('rawfoilworkorder:add')")
|
// //@SaCheckPermission("@el.check('rawfoilworkorder:add')")
|
||||||
public ResponseEntity<Object> create(@Validated @RequestBody RawfoilworkorderDto dto) {
|
// public ResponseEntity<Object> create(@Validated @RequestBody RawfoilworkorderDto dto) {
|
||||||
rawfoilworkorderService.create(dto);
|
// rawfoilworkorderService.create(dto);
|
||||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
// return new ResponseEntity<>(HttpStatus.CREATED);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@PutMapping
|
// @PutMapping
|
||||||
@Log("修改生箔工序工单")
|
// @Log("修改生箔工序工单")
|
||||||
|
//
|
||||||
//@SaCheckPermission("@el.check('rawfoilworkorder:edit')")
|
// //@SaCheckPermission("@el.check('rawfoilworkorder:edit')")
|
||||||
public ResponseEntity<Object> update(@Validated @RequestBody RawfoilworkorderDto dto) {
|
// public ResponseEntity<Object> update(@Validated @RequestBody RawfoilworkorderDto dto) {
|
||||||
rawfoilworkorderService.update(dto);
|
// rawfoilworkorderService.update(dto);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
// return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Log("删除生箔工序工单")
|
// @Log("删除生箔工序工单")
|
||||||
|
//
|
||||||
//@SaCheckPermission("@el.check('rawfoilworkorder:del')")
|
// //@SaCheckPermission("@el.check('rawfoilworkorder:del')")
|
||||||
@DeleteMapping
|
// @DeleteMapping
|
||||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
// public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||||
rawfoilworkorderService.deleteAll(ids);
|
// rawfoilworkorderService.deleteAll(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
// return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Log("强制确认")
|
// @Log("强制确认")
|
||||||
|
//
|
||||||
@PostMapping("/compelEnd")
|
// @PostMapping("/compelEnd")
|
||||||
public ResponseEntity<Object> compelEnd(@RequestBody JSONObject whereJson) {
|
// public ResponseEntity<Object> compelEnd(@RequestBody JSONObject whereJson) {
|
||||||
rawfoilworkorderService.compelEnd(whereJson);
|
// rawfoilworkorderService.compelEnd(whereJson);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
// return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Log("称重")
|
// @Log("称重")
|
||||||
|
//
|
||||||
@PostMapping("/confirm")
|
// @PostMapping("/confirm")
|
||||||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
|
// public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
|
||||||
rawfoilworkorderService.confirm(whereJson);
|
// rawfoilworkorderService.confirm(whereJson);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
// return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,85 +1,85 @@
|
|||||||
package org.nl.wms.pdm.service;
|
//package org.nl.wms.pdm.service;
|
||||||
|
//
|
||||||
import com.alibaba.fastjson.JSONObject;
|
//import com.alibaba.fastjson.JSONObject;
|
||||||
import org.nl.wms.pdm.service.dto.RawfoilworkorderDto;
|
//import org.nl.wms.pdm.service.dto.RawfoilworkorderDto;
|
||||||
import org.springframework.data.domain.Pageable;
|
//import org.springframework.data.domain.Pageable;
|
||||||
|
//
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
import java.util.Map;
|
//import java.util.Map;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* @author liuxy
|
// * @author liuxy
|
||||||
* @description 服务接口
|
// * @description 服务接口
|
||||||
* @date 2022-10-08
|
// * @date 2022-10-08
|
||||||
**/
|
// **/
|
||||||
public interface RawfoilworkorderService {
|
//public interface RawfoilworkorderService {
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 查询数据分页
|
// * 查询数据分页
|
||||||
*
|
// *
|
||||||
* @param whereJson 条件
|
// * @param whereJson 条件
|
||||||
* @param page 分页参数
|
// * @param page 分页参数
|
||||||
* @return Map<String, Object>
|
// * @return Map<String, Object>
|
||||||
*/
|
// */
|
||||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
// Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 查询所有数据不分页
|
// * 查询所有数据不分页
|
||||||
*
|
// *
|
||||||
* @param whereJson 条件参数
|
// * @param whereJson 条件参数
|
||||||
* @return List<RawfoilworkorderDto>
|
// * @return List<RawfoilworkorderDto>
|
||||||
*/
|
// */
|
||||||
List<RawfoilworkorderDto> queryAll(Map whereJson);
|
// List<RawfoilworkorderDto> queryAll(Map whereJson);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 根据ID查询
|
// * 根据ID查询
|
||||||
*
|
// *
|
||||||
* @param workorder_id ID
|
// * @param workorder_id ID
|
||||||
* @return Rawfoilworkorder
|
// * @return Rawfoilworkorder
|
||||||
*/
|
// */
|
||||||
RawfoilworkorderDto findById(Long workorder_id);
|
// RawfoilworkorderDto findById(Long workorder_id);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 根据编码查询
|
// * 根据编码查询
|
||||||
*
|
// *
|
||||||
* @param code code
|
// * @param code code
|
||||||
* @return Rawfoilworkorder
|
// * @return Rawfoilworkorder
|
||||||
*/
|
// */
|
||||||
RawfoilworkorderDto findByCode(String code);
|
// RawfoilworkorderDto findByCode(String code);
|
||||||
|
//
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 创建
|
// * 创建
|
||||||
*
|
// *
|
||||||
* @param dto /
|
// * @param dto /
|
||||||
*/
|
// */
|
||||||
void create(RawfoilworkorderDto dto);
|
// void create(RawfoilworkorderDto dto);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 编辑
|
// * 编辑
|
||||||
*
|
// *
|
||||||
* @param dto /
|
// * @param dto /
|
||||||
*/
|
// */
|
||||||
void update(RawfoilworkorderDto dto);
|
// void update(RawfoilworkorderDto dto);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 多选删除
|
// * 多选删除
|
||||||
*
|
// *
|
||||||
* @param ids /
|
// * @param ids /
|
||||||
*/
|
// */
|
||||||
void deleteAll(Long[] ids);
|
// void deleteAll(Long[] ids);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 强制确认
|
// * 强制确认
|
||||||
*
|
// *
|
||||||
* @param whereJson /
|
// * @param whereJson /
|
||||||
*/
|
// */
|
||||||
void compelEnd(JSONObject whereJson);
|
// void compelEnd(JSONObject whereJson);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 称重
|
// * 称重
|
||||||
*
|
// *
|
||||||
* @param whereJson /
|
// * @param whereJson /
|
||||||
*/
|
// */
|
||||||
void confirm(JSONObject whereJson);
|
// void confirm(JSONObject whereJson);
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,261 +1,261 @@
|
|||||||
package org.nl.wms.pdm.service.impl;
|
//package org.nl.wms.pdm.service.impl;
|
||||||
|
//
|
||||||
|
//
|
||||||
import cn.hutool.core.date.DateUtil;
|
//import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.map.MapUtil;
|
//import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
//import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
//import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
//import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
//import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
//import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
//import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||||
import org.nl.b_lms.sch.task.dao.mapper.SchBaseTaskMapper;
|
//import org.nl.b_lms.sch.task.dao.mapper.SchBaseTaskMapper;
|
||||||
import org.nl.common.utils.SecurityUtils;
|
//import org.nl.common.utils.SecurityUtils;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
//import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.modules.wql.WQL;
|
//import org.nl.modules.wql.WQL;
|
||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
//import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
import org.nl.modules.wql.util.WqlUtil;
|
//import org.nl.modules.wql.util.WqlUtil;
|
||||||
import org.nl.wms.basedata.st.userarea.service.IUserAreaPermissionService;
|
//import org.nl.wms.basedata.st.userarea.service.IUserAreaPermissionService;
|
||||||
import org.nl.wms.pdm.service.RawfoilworkorderService;
|
//import org.nl.wms.pdm.service.RawfoilworkorderService;
|
||||||
import org.nl.wms.pdm.service.dto.RawfoilworkorderDto;
|
//import org.nl.wms.pdm.service.dto.RawfoilworkorderDto;
|
||||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
//import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.Pageable;
|
//import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
//import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
//import org.springframework.transaction.annotation.Transactional;
|
||||||
|
//
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
import java.util.Map;
|
//import java.util.Map;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* @author liuxy
|
// * @author liuxy
|
||||||
* @description 服务实现
|
// * @description 服务实现
|
||||||
* @date 2022-10-08
|
// * @date 2022-10-08
|
||||||
**/
|
// **/
|
||||||
@Service
|
//@Service
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
@Slf4j
|
//@Slf4j
|
||||||
public class RawfoilworkorderServiceImpl implements RawfoilworkorderService {
|
//public class RawfoilworkorderServiceImpl implements RawfoilworkorderService {
|
||||||
@Autowired
|
// @Autowired
|
||||||
IUserAreaPermissionService userAreaPermissionService;
|
// IUserAreaPermissionService userAreaPermissionService;
|
||||||
@Autowired
|
// @Autowired
|
||||||
private SchBaseTaskMapper schBaseTaskMapper;
|
// private SchBaseTaskMapper schBaseTaskMapper;
|
||||||
@Override
|
// @Override
|
||||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
// public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||||
String product_area = MapUtil.getStr(whereJson, "product_area");
|
// String product_area = MapUtil.getStr(whereJson, "product_area");
|
||||||
String resource_name = MapUtil.getStr(whereJson, "resource_name");
|
// String resource_name = MapUtil.getStr(whereJson, "resource_name");
|
||||||
String status = MapUtil.getStr(whereJson, "status");
|
// String status = MapUtil.getStr(whereJson, "status");
|
||||||
String container_name = MapUtil.getStr(whereJson, "container_name");
|
// String container_name = MapUtil.getStr(whereJson, "container_name");
|
||||||
String begin_time = MapUtil.getStr(whereJson, "begin_time");
|
// String begin_time = MapUtil.getStr(whereJson, "begin_time");
|
||||||
String end_time = MapUtil.getStr(whereJson, "end_time");
|
// String end_time = MapUtil.getStr(whereJson, "end_time");
|
||||||
|
//
|
||||||
//获取人员对应的区域
|
// //获取人员对应的区域
|
||||||
String in_area_id = userAreaPermissionService.getInArea();
|
// String in_area_id = userAreaPermissionService.getInArea();
|
||||||
|
//
|
||||||
JSONObject map = new JSONObject();
|
// JSONObject map = new JSONObject();
|
||||||
map.put("flag", "1");
|
// map.put("flag", "1");
|
||||||
if (ObjectUtil.isNotEmpty(resource_name)) {
|
// if (ObjectUtil.isNotEmpty(resource_name)) {
|
||||||
map.put("resource_name", "%" + resource_name + "%");
|
// map.put("resource_name", "%" + resource_name + "%");
|
||||||
}
|
// }
|
||||||
if (ObjectUtil.isNotEmpty(container_name)) {
|
// if (ObjectUtil.isNotEmpty(container_name)) {
|
||||||
map.put("container_name", "%" + container_name + "%");
|
// map.put("container_name", "%" + container_name + "%");
|
||||||
}
|
// }
|
||||||
map.put("begin_time", begin_time);
|
// map.put("begin_time", begin_time);
|
||||||
map.put("end_time", end_time);
|
// map.put("end_time", end_time);
|
||||||
map.put("product_area", product_area);
|
// map.put("product_area", product_area);
|
||||||
map.put("status", status);
|
// map.put("status", status);
|
||||||
if (ObjectUtil.isNotEmpty(in_area_id)) {
|
// if (ObjectUtil.isNotEmpty(in_area_id)) {
|
||||||
map.put("in_area_id", in_area_id);
|
// map.put("in_area_id", in_area_id);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
JSONObject json = WQL.getWO("PDM_BI_RAWFOILWORKORDER_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "der.container_name");
|
// JSONObject json = WQL.getWO("PDM_BI_RAWFOILWORKORDER_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "der.container_name");
|
||||||
return json;
|
// return json;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public List<RawfoilworkorderDto> queryAll(Map whereJson) {
|
// public List<RawfoilworkorderDto> queryAll(Map whereJson) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
// WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
||||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
// JSONArray arr = wo.query().getResultJSONArray(0);
|
||||||
if (ObjectUtil.isNotEmpty(arr)) {
|
// if (ObjectUtil.isNotEmpty(arr)) {
|
||||||
return arr.toJavaList(RawfoilworkorderDto.class);
|
// return arr.toJavaList(RawfoilworkorderDto.class);
|
||||||
}
|
// }
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public RawfoilworkorderDto findById(Long workorder_id) {
|
// public RawfoilworkorderDto findById(Long workorder_id) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
// WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
||||||
JSONObject json = wo.query("workorder_id = '" + workorder_id + "'").uniqueResult(0);
|
// JSONObject json = wo.query("workorder_id = '" + workorder_id + "'").uniqueResult(0);
|
||||||
if (ObjectUtil.isNotEmpty(json)) {
|
// if (ObjectUtil.isNotEmpty(json)) {
|
||||||
return json.toJavaObject(RawfoilworkorderDto.class);
|
// return json.toJavaObject(RawfoilworkorderDto.class);
|
||||||
}
|
// }
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public RawfoilworkorderDto findByCode(String code) {
|
// public RawfoilworkorderDto findByCode(String code) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
// WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
||||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
// JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||||
if (ObjectUtil.isNotEmpty(json)) {
|
// if (ObjectUtil.isNotEmpty(json)) {
|
||||||
return json.toJavaObject(RawfoilworkorderDto.class);
|
// return json.toJavaObject(RawfoilworkorderDto.class);
|
||||||
}
|
// }
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
public void create(RawfoilworkorderDto dto) {
|
// public void create(RawfoilworkorderDto dto) {
|
||||||
WQLObject schBasePointService = WQLObject.getWQLObject("ST_IVT_SbPointIvt");
|
// WQLObject schBasePointService = WQLObject.getWQLObject("ST_IVT_SbPointIvt");
|
||||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
// WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
||||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
// WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||||
|
//
|
||||||
String container_name = dto.getContainer_name();
|
// String container_name = dto.getContainer_name();
|
||||||
JSONObject json = wo.query("container_name = '" + container_name + "' and status <> '09'").uniqueResult(0);
|
// JSONObject json = wo.query("container_name = '" + container_name + "' and status <> '09'").uniqueResult(0);
|
||||||
if (ObjectUtil.isNotEmpty(json)) {
|
// if (ObjectUtil.isNotEmpty(json)) {
|
||||||
throw new BadRequestException("母卷号已存在");
|
// throw new BadRequestException("母卷号已存在");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
// String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
// String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String now = DateUtil.now();
|
// String now = DateUtil.now();
|
||||||
|
//
|
||||||
JSONObject jsonPoint = schBasePointService.query("ext_code ='" + dto.getResource_name() + "'").uniqueResult(0);
|
// JSONObject jsonPoint = schBasePointService.query("ext_code ='" + dto.getResource_name() + "'").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(jsonPoint)) {
|
// if (ObjectUtil.isEmpty(jsonPoint)) {
|
||||||
throw new BadRequestException("点位设备不存在");
|
// throw new BadRequestException("点位设备不存在");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
JSONObject josnMater = materTab.query("material_code ='" + dto.getProduct_name() + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
|
// JSONObject josnMater = materTab.query("material_code ='" + dto.getProduct_name() + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(josnMater)) {
|
// if (ObjectUtil.isEmpty(josnMater)) {
|
||||||
throw new BadRequestException("物料不存在");
|
// throw new BadRequestException("物料不存在");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
dto.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextId());
|
// dto.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||||
dto.setCreate_id(currentUserId);
|
// dto.setCreate_id(currentUserId);
|
||||||
dto.setCreate_name(nickName);
|
// dto.setCreate_name(nickName);
|
||||||
dto.setUpdate_optid(currentUserId);
|
// dto.setUpdate_optid(currentUserId);
|
||||||
dto.setUpdate_optname(nickName);
|
// dto.setUpdate_optname(nickName);
|
||||||
dto.setUpdate_time(now);
|
// dto.setUpdate_time(now);
|
||||||
dto.setCreate_time(now);
|
// dto.setCreate_time(now);
|
||||||
dto.setIs_delete("0");
|
// dto.setIs_delete("0");
|
||||||
dto.setProduct_area(jsonPoint.getString("product_area"));
|
// dto.setProduct_area(jsonPoint.getString("product_area"));
|
||||||
dto.setPoint_code(jsonPoint.getString("point_code"));
|
// dto.setPoint_code(jsonPoint.getString("point_code"));
|
||||||
dto.setStatus("01");
|
// dto.setStatus("01");
|
||||||
|
//
|
||||||
JSONObject json1 = JSONObject.parseObject(JSON.toJSONString(dto));
|
// JSONObject json1 = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||||
wo.insert(json1);
|
// wo.insert(json1);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
public void update(RawfoilworkorderDto dto) {
|
// public void update(RawfoilworkorderDto dto) {
|
||||||
RawfoilworkorderDto entity = this.findById(dto.getWorkorder_id());
|
// RawfoilworkorderDto entity = this.findById(dto.getWorkorder_id());
|
||||||
if (entity == null) {
|
// if (entity == null) {
|
||||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
// throw new BadRequestException("被删除或无权限,操作失败!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
WQLObject schBasePointService = WQLObject.getWQLObject("ST_IVT_SbPointIvt");
|
// WQLObject schBasePointService = WQLObject.getWQLObject("ST_IVT_SbPointIvt");
|
||||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
// WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
||||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
// WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||||
|
//
|
||||||
String container_name = dto.getContainer_name();
|
// String container_name = dto.getContainer_name();
|
||||||
|
//
|
||||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
// String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
// String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String now = DateUtil.now();
|
// String now = DateUtil.now();
|
||||||
|
//
|
||||||
JSONObject jsonPoint = schBasePointService.query("ext_code ='" + dto.getResource_name() + "'").uniqueResult(0);
|
// JSONObject jsonPoint = schBasePointService.query("ext_code ='" + dto.getResource_name() + "'").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(jsonPoint)) {
|
// if (ObjectUtil.isEmpty(jsonPoint)) {
|
||||||
throw new BadRequestException("点位设备不存在");
|
// throw new BadRequestException("点位设备不存在");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
JSONObject josnMater = materTab.query("material_code ='" + dto.getProduct_name() + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
|
// JSONObject josnMater = materTab.query("material_code ='" + dto.getProduct_name() + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(josnMater)) {
|
// if (ObjectUtil.isEmpty(josnMater)) {
|
||||||
throw new BadRequestException("物料不存在");
|
// throw new BadRequestException("物料不存在");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
dto.setUpdate_time(now);
|
// dto.setUpdate_time(now);
|
||||||
dto.setUpdate_optid(currentUserId);
|
// dto.setUpdate_optid(currentUserId);
|
||||||
dto.setUpdate_optname(nickName);
|
// dto.setUpdate_optname(nickName);
|
||||||
dto.setProduct_area(jsonPoint.getString("product_area"));
|
// dto.setProduct_area(jsonPoint.getString("product_area"));
|
||||||
dto.setPoint_code(jsonPoint.getString("point_code"));
|
// dto.setPoint_code(jsonPoint.getString("point_code"));
|
||||||
|
//
|
||||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
// JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||||
wo.update(json);
|
// wo.update(json);
|
||||||
|
//
|
||||||
JSONArray resultJSONArray = wo.query("container_name = '" + container_name + "' and status <> '09'").getResultJSONArray(0);
|
// JSONArray resultJSONArray = wo.query("container_name = '" + container_name + "' and status <> '09'").getResultJSONArray(0);
|
||||||
if (resultJSONArray.size() > 1) {
|
// if (resultJSONArray.size() > 1) {
|
||||||
throw new BadRequestException("母卷号已存在");
|
// throw new BadRequestException("母卷号已存在");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
public void deleteAll(Long[] ids) {
|
// public void deleteAll(Long[] ids) {
|
||||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
// String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
// String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String now = DateUtil.now();
|
// String now = DateUtil.now();
|
||||||
|
//
|
||||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
// WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
||||||
for (Long workorder_id : ids) {
|
// for (Long workorder_id : ids) {
|
||||||
JSONObject param = new JSONObject();
|
// JSONObject param = new JSONObject();
|
||||||
param.put("workorder_id", String.valueOf(workorder_id));
|
// param.put("workorder_id", String.valueOf(workorder_id));
|
||||||
param.put("is_delete", "1");
|
// param.put("is_delete", "1");
|
||||||
param.put("update_optid", currentUserId);
|
// param.put("update_optid", currentUserId);
|
||||||
param.put("update_optname", nickName);
|
// param.put("update_optname", nickName);
|
||||||
param.put("update_time", now);
|
// param.put("update_time", now);
|
||||||
wo.update(param);
|
// wo.update(param);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
public void compelEnd(JSONObject whereJson) {
|
// public void compelEnd(JSONObject whereJson) {
|
||||||
String workorder_id = whereJson.getString("workorder_id");
|
// String workorder_id = whereJson.getString("workorder_id");
|
||||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
// String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
// String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
|
//
|
||||||
//查询该生箔工单是否存在未完成的任务
|
// //查询该生箔工单是否存在未完成的任务
|
||||||
String container_name = whereJson.getString("container_name");
|
// String container_name = whereJson.getString("container_name");
|
||||||
|
//
|
||||||
LambdaQueryWrapper<SchBaseTask> lam = new LambdaQueryWrapper<>();
|
// LambdaQueryWrapper<SchBaseTask> lam = new LambdaQueryWrapper<>();
|
||||||
lam.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
|
// lam.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
|
||||||
.eq(SchBaseTask::getIs_delete, "0")
|
// .eq(SchBaseTask::getIs_delete, "0")
|
||||||
.eq(SchBaseTask::getMaterial_code,container_name);
|
// .eq(SchBaseTask::getMaterial_code,container_name);
|
||||||
int task_jos = schBaseTaskMapper.selectCount(lam);
|
// int task_jos = schBaseTaskMapper.selectCount(lam);
|
||||||
if (task_jos>0) {
|
// if (task_jos>0) {
|
||||||
throw new BadRequestException("该生箔工单存在未完成的任务,请先完成任务!");
|
// throw new BadRequestException("该生箔工单存在未完成的任务,请先完成任务!");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
WQLObject tab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder");
|
// WQLObject tab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder");
|
||||||
|
//
|
||||||
JSONObject json = tab.query("workorder_id = '" + workorder_id + "'").uniqueResult(0);
|
// JSONObject json = tab.query("workorder_id = '" + workorder_id + "'").uniqueResult(0);
|
||||||
json.put("status", "09");
|
// json.put("status", "09");
|
||||||
json.put("finish_type", "02");
|
// json.put("finish_type", "02");
|
||||||
json.put("realend_time", DateUtil.now());
|
// json.put("realend_time", DateUtil.now());
|
||||||
json.put("update_optid", currentUserId);
|
// json.put("update_optid", currentUserId);
|
||||||
json.put("update_optname", currentUsername);
|
// json.put("update_optname", currentUsername);
|
||||||
json.put("update_time", DateUtil.now());
|
// json.put("update_time", DateUtil.now());
|
||||||
tab.update(json);
|
// tab.update(json);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
public void confirm(JSONObject whereJson) {
|
// public void confirm(JSONObject whereJson) {
|
||||||
WQLObject tab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder");
|
// WQLObject tab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder");
|
||||||
String productin_qty = whereJson.getString("productin_qty");
|
// String productin_qty = whereJson.getString("productin_qty");
|
||||||
|
//
|
||||||
JSONObject jsonRaw = tab.query("workorder_id = '" + whereJson.getString("workorder_id") + "'").uniqueResult(0);
|
// JSONObject jsonRaw = tab.query("workorder_id = '" + whereJson.getString("workorder_id") + "'").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(productin_qty)) {
|
// if (ObjectUtil.isEmpty(productin_qty)) {
|
||||||
jsonRaw.put("productin_qty", 0);
|
// jsonRaw.put("productin_qty", 0);
|
||||||
} else {
|
// } else {
|
||||||
jsonRaw.put("productin_qty", whereJson.getDoubleValue("productin_qty"));
|
// jsonRaw.put("productin_qty", whereJson.getDoubleValue("productin_qty"));
|
||||||
}
|
// }
|
||||||
tab.update(jsonRaw);
|
// tab.update(jsonRaw);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|||||||
Reference in New Issue
Block a user