liejiu946
3 weeks ago
3 changed files with 427 additions and 427 deletions
@ -1,81 +1,81 @@ |
|||
package org.nl.wms.pdm.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.service.RawfoilworkorderService; |
|||
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, Pageable page) { |
|||
return new ResponseEntity<>(rawfoilworkorderService.queryAll(whereJson, page), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增生箔工序工单") |
|||
|
|||
//@SaCheckPermission("@el.check('rawfoilworkorder:add')")
|
|||
public ResponseEntity<Object> create(@Validated @RequestBody RawfoilworkorderDto dto) { |
|||
rawfoilworkorderService.create(dto); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改生箔工序工单") |
|||
|
|||
//@SaCheckPermission("@el.check('rawfoilworkorder:edit')")
|
|||
public ResponseEntity<Object> update(@Validated @RequestBody RawfoilworkorderDto 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); |
|||
} |
|||
} |
|||
//package org.nl.wms.pdm.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.service.RawfoilworkorderService;
|
|||
//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, Pageable page) {
|
|||
// return new ResponseEntity<>(rawfoilworkorderService.queryAll(whereJson, page), HttpStatus.OK);
|
|||
// }
|
|||
//
|
|||
// @PostMapping
|
|||
// @Log("新增生箔工序工单")
|
|||
//
|
|||
// //@SaCheckPermission("@el.check('rawfoilworkorder:add')")
|
|||
// public ResponseEntity<Object> create(@Validated @RequestBody RawfoilworkorderDto dto) {
|
|||
// rawfoilworkorderService.create(dto);
|
|||
// return new ResponseEntity<>(HttpStatus.CREATED);
|
|||
// }
|
|||
//
|
|||
// @PutMapping
|
|||
// @Log("修改生箔工序工单")
|
|||
//
|
|||
// //@SaCheckPermission("@el.check('rawfoilworkorder:edit')")
|
|||
// public ResponseEntity<Object> update(@Validated @RequestBody RawfoilworkorderDto 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);
|
|||
// }
|
|||
//}
|
|||
|
@ -1,85 +1,85 @@ |
|||
package org.nl.wms.pdm.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.wms.pdm.service.dto.RawfoilworkorderDto; |
|||
import org.springframework.data.domain.Pageable; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author liuxy |
|||
* @description 服务接口 |
|||
* @date 2022-10-08 |
|||
**/ |
|||
public interface RawfoilworkorderService { |
|||
|
|||
/** |
|||
* 查询数据分页 |
|||
* |
|||
* @param whereJson 条件 |
|||
* @param page 分页参数 |
|||
* @return Map<String, Object> |
|||
*/ |
|||
Map<String, Object> queryAll(Map whereJson, Pageable page); |
|||
|
|||
/** |
|||
* 查询所有数据不分页 |
|||
* |
|||
* @param whereJson 条件参数 |
|||
* @return List<RawfoilworkorderDto> |
|||
*/ |
|||
List<RawfoilworkorderDto> queryAll(Map whereJson); |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* |
|||
* @param workorder_id ID |
|||
* @return Rawfoilworkorder |
|||
*/ |
|||
RawfoilworkorderDto findById(Long workorder_id); |
|||
|
|||
/** |
|||
* 根据编码查询 |
|||
* |
|||
* @param code code |
|||
* @return Rawfoilworkorder |
|||
*/ |
|||
RawfoilworkorderDto findByCode(String code); |
|||
|
|||
|
|||
/** |
|||
* 创建 |
|||
* |
|||
* @param dto / |
|||
*/ |
|||
void create(RawfoilworkorderDto dto); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param dto / |
|||
*/ |
|||
void update(RawfoilworkorderDto dto); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(Long[] ids); |
|||
|
|||
/** |
|||
* 强制确认 |
|||
* |
|||
* @param whereJson / |
|||
*/ |
|||
void compelEnd(JSONObject whereJson); |
|||
|
|||
/** |
|||
* 称重 |
|||
* |
|||
* @param whereJson / |
|||
*/ |
|||
void confirm(JSONObject whereJson); |
|||
} |
|||
//package org.nl.wms.pdm.service;
|
|||
//
|
|||
//import com.alibaba.fastjson.JSONObject;
|
|||
//import org.nl.wms.pdm.service.dto.RawfoilworkorderDto;
|
|||
//import org.springframework.data.domain.Pageable;
|
|||
//
|
|||
//import java.util.List;
|
|||
//import java.util.Map;
|
|||
//
|
|||
///**
|
|||
// * @author liuxy
|
|||
// * @description 服务接口
|
|||
// * @date 2022-10-08
|
|||
// **/
|
|||
//public interface RawfoilworkorderService {
|
|||
//
|
|||
// /**
|
|||
// * 查询数据分页
|
|||
// *
|
|||
// * @param whereJson 条件
|
|||
// * @param page 分页参数
|
|||
// * @return Map<String, Object>
|
|||
// */
|
|||
// Map<String, Object> queryAll(Map whereJson, Pageable page);
|
|||
//
|
|||
// /**
|
|||
// * 查询所有数据不分页
|
|||
// *
|
|||
// * @param whereJson 条件参数
|
|||
// * @return List<RawfoilworkorderDto>
|
|||
// */
|
|||
// List<RawfoilworkorderDto> queryAll(Map whereJson);
|
|||
//
|
|||
// /**
|
|||
// * 根据ID查询
|
|||
// *
|
|||
// * @param workorder_id ID
|
|||
// * @return Rawfoilworkorder
|
|||
// */
|
|||
// RawfoilworkorderDto findById(Long workorder_id);
|
|||
//
|
|||
// /**
|
|||
// * 根据编码查询
|
|||
// *
|
|||
// * @param code code
|
|||
// * @return Rawfoilworkorder
|
|||
// */
|
|||
// RawfoilworkorderDto findByCode(String code);
|
|||
//
|
|||
//
|
|||
// /**
|
|||
// * 创建
|
|||
// *
|
|||
// * @param dto /
|
|||
// */
|
|||
// void create(RawfoilworkorderDto dto);
|
|||
//
|
|||
// /**
|
|||
// * 编辑
|
|||
// *
|
|||
// * @param dto /
|
|||
// */
|
|||
// void update(RawfoilworkorderDto dto);
|
|||
//
|
|||
// /**
|
|||
// * 多选删除
|
|||
// *
|
|||
// * @param ids /
|
|||
// */
|
|||
// void deleteAll(Long[] ids);
|
|||
//
|
|||
// /**
|
|||
// * 强制确认
|
|||
// *
|
|||
// * @param whereJson /
|
|||
// */
|
|||
// void compelEnd(JSONObject whereJson);
|
|||
//
|
|||
// /**
|
|||
// * 称重
|
|||
// *
|
|||
// * @param whereJson /
|
|||
// */
|
|||
// void confirm(JSONObject whereJson);
|
|||
//}
|
|||
|
@ -1,261 +1,261 @@ |
|||
package org.nl.wms.pdm.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.b_lms.sch.task.dao.SchBaseTask; |
|||
import org.nl.b_lms.sch.task.dao.mapper.SchBaseTaskMapper; |
|||
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.st.userarea.service.IUserAreaPermissionService; |
|||
import org.nl.wms.pdm.service.RawfoilworkorderService; |
|||
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.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author liuxy |
|||
* @description 服务实现 |
|||
* @date 2022-10-08 |
|||
**/ |
|||
@Service |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class RawfoilworkorderServiceImpl implements RawfoilworkorderService { |
|||
@Autowired |
|||
IUserAreaPermissionService userAreaPermissionService; |
|||
@Autowired |
|||
private SchBaseTaskMapper schBaseTaskMapper; |
|||
@Override |
|||
public Map<String, Object> queryAll(Map whereJson, Pageable page) { |
|||
String product_area = MapUtil.getStr(whereJson, "product_area"); |
|||
String resource_name = MapUtil.getStr(whereJson, "resource_name"); |
|||
String status = MapUtil.getStr(whereJson, "status"); |
|||
String container_name = MapUtil.getStr(whereJson, "container_name"); |
|||
String begin_time = MapUtil.getStr(whereJson, "begin_time"); |
|||
String end_time = MapUtil.getStr(whereJson, "end_time"); |
|||
|
|||
//获取人员对应的区域
|
|||
String in_area_id = userAreaPermissionService.getInArea(); |
|||
|
|||
JSONObject map = new JSONObject(); |
|||
map.put("flag", "1"); |
|||
if (ObjectUtil.isNotEmpty(resource_name)) { |
|||
map.put("resource_name", "%" + resource_name + "%"); |
|||
} |
|||
if (ObjectUtil.isNotEmpty(container_name)) { |
|||
map.put("container_name", "%" + container_name + "%"); |
|||
} |
|||
map.put("begin_time", begin_time); |
|||
map.put("end_time", end_time); |
|||
map.put("product_area", product_area); |
|||
map.put("status", status); |
|||
if (ObjectUtil.isNotEmpty(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"); |
|||
return json; |
|||
} |
|||
|
|||
@Override |
|||
public List<RawfoilworkorderDto> queryAll(Map whereJson) { |
|||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder"); |
|||
JSONArray arr = wo.query().getResultJSONArray(0); |
|||
if (ObjectUtil.isNotEmpty(arr)) { |
|||
return arr.toJavaList(RawfoilworkorderDto.class); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public RawfoilworkorderDto findById(Long workorder_id) { |
|||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder"); |
|||
JSONObject json = wo.query("workorder_id = '" + workorder_id + "'").uniqueResult(0); |
|||
if (ObjectUtil.isNotEmpty(json)) { |
|||
return json.toJavaObject(RawfoilworkorderDto.class); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public RawfoilworkorderDto findByCode(String code) { |
|||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder"); |
|||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0); |
|||
if (ObjectUtil.isNotEmpty(json)) { |
|||
return json.toJavaObject(RawfoilworkorderDto.class); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void create(RawfoilworkorderDto dto) { |
|||
WQLObject schBasePointService = WQLObject.getWQLObject("ST_IVT_SbPointIvt"); |
|||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder"); |
|||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); |
|||
|
|||
String container_name = dto.getContainer_name(); |
|||
JSONObject json = wo.query("container_name = '" + container_name + "' and status <> '09'").uniqueResult(0); |
|||
if (ObjectUtil.isNotEmpty(json)) { |
|||
throw new BadRequestException("母卷号已存在"); |
|||
} |
|||
|
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
JSONObject jsonPoint = schBasePointService.query("ext_code ='" + dto.getResource_name() + "'").uniqueResult(0); |
|||
if (ObjectUtil.isEmpty(jsonPoint)) { |
|||
throw new BadRequestException("点位设备不存在"); |
|||
} |
|||
|
|||
JSONObject josnMater = materTab.query("material_code ='" + dto.getProduct_name() + "' and is_delete = '0' and is_used = '1'").uniqueResult(0); |
|||
if (ObjectUtil.isEmpty(josnMater)) { |
|||
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(jsonPoint.getString("product_area")); |
|||
dto.setPoint_code(jsonPoint.getString("point_code")); |
|||
dto.setStatus("01"); |
|||
|
|||
JSONObject json1 = JSONObject.parseObject(JSON.toJSONString(dto)); |
|||
wo.insert(json1); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(RawfoilworkorderDto dto) { |
|||
RawfoilworkorderDto entity = this.findById(dto.getWorkorder_id()); |
|||
if (entity == null) { |
|||
throw new BadRequestException("被删除或无权限,操作失败!"); |
|||
} |
|||
|
|||
WQLObject schBasePointService = WQLObject.getWQLObject("ST_IVT_SbPointIvt"); |
|||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder"); |
|||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); |
|||
|
|||
String container_name = dto.getContainer_name(); |
|||
|
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
JSONObject jsonPoint = schBasePointService.query("ext_code ='" + dto.getResource_name() + "'").uniqueResult(0); |
|||
if (ObjectUtil.isEmpty(jsonPoint)) { |
|||
throw new BadRequestException("点位设备不存在"); |
|||
} |
|||
|
|||
JSONObject josnMater = materTab.query("material_code ='" + dto.getProduct_name() + "' and is_delete = '0' and is_used = '1'").uniqueResult(0); |
|||
if (ObjectUtil.isEmpty(josnMater)) { |
|||
throw new BadRequestException("物料不存在"); |
|||
} |
|||
|
|||
|
|||
dto.setUpdate_time(now); |
|||
dto.setUpdate_optid(currentUserId); |
|||
dto.setUpdate_optname(nickName); |
|||
dto.setProduct_area(jsonPoint.getString("product_area")); |
|||
dto.setPoint_code(jsonPoint.getString("point_code")); |
|||
|
|||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); |
|||
wo.update(json); |
|||
|
|||
JSONArray resultJSONArray = wo.query("container_name = '" + container_name + "' and status <> '09'").getResultJSONArray(0); |
|||
if (resultJSONArray.size() > 1) { |
|||
throw new BadRequestException("母卷号已存在"); |
|||
} |
|||
} |
|||
|
|||
@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("pdm_bi_rawfoilworkorder"); |
|||
for (Long workorder_id : ids) { |
|||
JSONObject param = new JSONObject(); |
|||
param.put("workorder_id", String.valueOf(workorder_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 |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void compelEnd(JSONObject whereJson) { |
|||
String workorder_id = whereJson.getString("workorder_id"); |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String currentUsername = SecurityUtils.getCurrentUsername(); |
|||
|
|||
//查询该生箔工单是否存在未完成的任务
|
|||
String container_name = whereJson.getString("container_name"); |
|||
|
|||
LambdaQueryWrapper<SchBaseTask> lam = new LambdaQueryWrapper<>(); |
|||
lam.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode()) |
|||
.eq(SchBaseTask::getIs_delete, "0") |
|||
.eq(SchBaseTask::getMaterial_code,container_name); |
|||
int task_jos = schBaseTaskMapper.selectCount(lam); |
|||
if (task_jos>0) { |
|||
throw new BadRequestException("该生箔工单存在未完成的任务,请先完成任务!"); |
|||
} |
|||
|
|||
WQLObject tab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); |
|||
|
|||
JSONObject json = tab.query("workorder_id = '" + workorder_id + "'").uniqueResult(0); |
|||
json.put("status", "09"); |
|||
json.put("finish_type", "02"); |
|||
json.put("realend_time", DateUtil.now()); |
|||
json.put("update_optid", currentUserId); |
|||
json.put("update_optname", currentUsername); |
|||
json.put("update_time", DateUtil.now()); |
|||
tab.update(json); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void confirm(JSONObject whereJson) { |
|||
WQLObject tab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); |
|||
String productin_qty = whereJson.getString("productin_qty"); |
|||
|
|||
JSONObject jsonRaw = tab.query("workorder_id = '" + whereJson.getString("workorder_id") + "'").uniqueResult(0); |
|||
if (ObjectUtil.isEmpty(productin_qty)) { |
|||
jsonRaw.put("productin_qty", 0); |
|||
} else { |
|||
jsonRaw.put("productin_qty", whereJson.getDoubleValue("productin_qty")); |
|||
} |
|||
tab.update(jsonRaw); |
|||
} |
|||
|
|||
} |
|||
//package org.nl.wms.pdm.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.b_lms.sch.task.dao.SchBaseTask;
|
|||
//import org.nl.b_lms.sch.task.dao.mapper.SchBaseTaskMapper;
|
|||
//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.st.userarea.service.IUserAreaPermissionService;
|
|||
//import org.nl.wms.pdm.service.RawfoilworkorderService;
|
|||
//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.util.List;
|
|||
//import java.util.Map;
|
|||
//
|
|||
///**
|
|||
// * @author liuxy
|
|||
// * @description 服务实现
|
|||
// * @date 2022-10-08
|
|||
// **/
|
|||
//@Service
|
|||
//@RequiredArgsConstructor
|
|||
//@Slf4j
|
|||
//public class RawfoilworkorderServiceImpl implements RawfoilworkorderService {
|
|||
// @Autowired
|
|||
// IUserAreaPermissionService userAreaPermissionService;
|
|||
// @Autowired
|
|||
// private SchBaseTaskMapper schBaseTaskMapper;
|
|||
// @Override
|
|||
// public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
|||
// String product_area = MapUtil.getStr(whereJson, "product_area");
|
|||
// String resource_name = MapUtil.getStr(whereJson, "resource_name");
|
|||
// String status = MapUtil.getStr(whereJson, "status");
|
|||
// String container_name = MapUtil.getStr(whereJson, "container_name");
|
|||
// String begin_time = MapUtil.getStr(whereJson, "begin_time");
|
|||
// String end_time = MapUtil.getStr(whereJson, "end_time");
|
|||
//
|
|||
// //获取人员对应的区域
|
|||
// String in_area_id = userAreaPermissionService.getInArea();
|
|||
//
|
|||
// JSONObject map = new JSONObject();
|
|||
// map.put("flag", "1");
|
|||
// if (ObjectUtil.isNotEmpty(resource_name)) {
|
|||
// map.put("resource_name", "%" + resource_name + "%");
|
|||
// }
|
|||
// if (ObjectUtil.isNotEmpty(container_name)) {
|
|||
// map.put("container_name", "%" + container_name + "%");
|
|||
// }
|
|||
// map.put("begin_time", begin_time);
|
|||
// map.put("end_time", end_time);
|
|||
// map.put("product_area", product_area);
|
|||
// map.put("status", status);
|
|||
// if (ObjectUtil.isNotEmpty(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");
|
|||
// return json;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public List<RawfoilworkorderDto> queryAll(Map whereJson) {
|
|||
// WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
|||
// JSONArray arr = wo.query().getResultJSONArray(0);
|
|||
// if (ObjectUtil.isNotEmpty(arr)) {
|
|||
// return arr.toJavaList(RawfoilworkorderDto.class);
|
|||
// }
|
|||
// return null;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public RawfoilworkorderDto findById(Long workorder_id) {
|
|||
// WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
|||
// JSONObject json = wo.query("workorder_id = '" + workorder_id + "'").uniqueResult(0);
|
|||
// if (ObjectUtil.isNotEmpty(json)) {
|
|||
// return json.toJavaObject(RawfoilworkorderDto.class);
|
|||
// }
|
|||
// return null;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public RawfoilworkorderDto findByCode(String code) {
|
|||
// WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
|||
// JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
|||
// if (ObjectUtil.isNotEmpty(json)) {
|
|||
// return json.toJavaObject(RawfoilworkorderDto.class);
|
|||
// }
|
|||
// return null;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
// public void create(RawfoilworkorderDto dto) {
|
|||
// WQLObject schBasePointService = WQLObject.getWQLObject("ST_IVT_SbPointIvt");
|
|||
// WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
|||
// WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
|||
//
|
|||
// String container_name = dto.getContainer_name();
|
|||
// JSONObject json = wo.query("container_name = '" + container_name + "' and status <> '09'").uniqueResult(0);
|
|||
// if (ObjectUtil.isNotEmpty(json)) {
|
|||
// throw new BadRequestException("母卷号已存在");
|
|||
// }
|
|||
//
|
|||
// String currentUserId = SecurityUtils.getCurrentUserId();
|
|||
// String nickName = SecurityUtils.getCurrentNickName();
|
|||
// String now = DateUtil.now();
|
|||
//
|
|||
// JSONObject jsonPoint = schBasePointService.query("ext_code ='" + dto.getResource_name() + "'").uniqueResult(0);
|
|||
// if (ObjectUtil.isEmpty(jsonPoint)) {
|
|||
// throw new BadRequestException("点位设备不存在");
|
|||
// }
|
|||
//
|
|||
// JSONObject josnMater = materTab.query("material_code ='" + dto.getProduct_name() + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
|
|||
// if (ObjectUtil.isEmpty(josnMater)) {
|
|||
// 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(jsonPoint.getString("product_area"));
|
|||
// dto.setPoint_code(jsonPoint.getString("point_code"));
|
|||
// dto.setStatus("01");
|
|||
//
|
|||
// JSONObject json1 = JSONObject.parseObject(JSON.toJSONString(dto));
|
|||
// wo.insert(json1);
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
// public void update(RawfoilworkorderDto dto) {
|
|||
// RawfoilworkorderDto entity = this.findById(dto.getWorkorder_id());
|
|||
// if (entity == null) {
|
|||
// throw new BadRequestException("被删除或无权限,操作失败!");
|
|||
// }
|
|||
//
|
|||
// WQLObject schBasePointService = WQLObject.getWQLObject("ST_IVT_SbPointIvt");
|
|||
// WQLObject wo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder");
|
|||
// WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
|||
//
|
|||
// String container_name = dto.getContainer_name();
|
|||
//
|
|||
// String currentUserId = SecurityUtils.getCurrentUserId();
|
|||
// String nickName = SecurityUtils.getCurrentNickName();
|
|||
// String now = DateUtil.now();
|
|||
//
|
|||
// JSONObject jsonPoint = schBasePointService.query("ext_code ='" + dto.getResource_name() + "'").uniqueResult(0);
|
|||
// if (ObjectUtil.isEmpty(jsonPoint)) {
|
|||
// throw new BadRequestException("点位设备不存在");
|
|||
// }
|
|||
//
|
|||
// JSONObject josnMater = materTab.query("material_code ='" + dto.getProduct_name() + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
|
|||
// if (ObjectUtil.isEmpty(josnMater)) {
|
|||
// throw new BadRequestException("物料不存在");
|
|||
// }
|
|||
//
|
|||
//
|
|||
// dto.setUpdate_time(now);
|
|||
// dto.setUpdate_optid(currentUserId);
|
|||
// dto.setUpdate_optname(nickName);
|
|||
// dto.setProduct_area(jsonPoint.getString("product_area"));
|
|||
// dto.setPoint_code(jsonPoint.getString("point_code"));
|
|||
//
|
|||
// JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
|||
// wo.update(json);
|
|||
//
|
|||
// JSONArray resultJSONArray = wo.query("container_name = '" + container_name + "' and status <> '09'").getResultJSONArray(0);
|
|||
// if (resultJSONArray.size() > 1) {
|
|||
// throw new BadRequestException("母卷号已存在");
|
|||
// }
|
|||
// }
|
|||
//
|
|||
// @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("pdm_bi_rawfoilworkorder");
|
|||
// for (Long workorder_id : ids) {
|
|||
// JSONObject param = new JSONObject();
|
|||
// param.put("workorder_id", String.valueOf(workorder_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
|
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
// public void compelEnd(JSONObject whereJson) {
|
|||
// String workorder_id = whereJson.getString("workorder_id");
|
|||
// String currentUserId = SecurityUtils.getCurrentUserId();
|
|||
// String currentUsername = SecurityUtils.getCurrentUsername();
|
|||
//
|
|||
// //查询该生箔工单是否存在未完成的任务
|
|||
// String container_name = whereJson.getString("container_name");
|
|||
//
|
|||
// LambdaQueryWrapper<SchBaseTask> lam = new LambdaQueryWrapper<>();
|
|||
// lam.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
|
|||
// .eq(SchBaseTask::getIs_delete, "0")
|
|||
// .eq(SchBaseTask::getMaterial_code,container_name);
|
|||
// int task_jos = schBaseTaskMapper.selectCount(lam);
|
|||
// if (task_jos>0) {
|
|||
// throw new BadRequestException("该生箔工单存在未完成的任务,请先完成任务!");
|
|||
// }
|
|||
//
|
|||
// WQLObject tab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder");
|
|||
//
|
|||
// JSONObject json = tab.query("workorder_id = '" + workorder_id + "'").uniqueResult(0);
|
|||
// json.put("status", "09");
|
|||
// json.put("finish_type", "02");
|
|||
// json.put("realend_time", DateUtil.now());
|
|||
// json.put("update_optid", currentUserId);
|
|||
// json.put("update_optname", currentUsername);
|
|||
// json.put("update_time", DateUtil.now());
|
|||
// tab.update(json);
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
// public void confirm(JSONObject whereJson) {
|
|||
// WQLObject tab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder");
|
|||
// String productin_qty = whereJson.getString("productin_qty");
|
|||
//
|
|||
// JSONObject jsonRaw = tab.query("workorder_id = '" + whereJson.getString("workorder_id") + "'").uniqueResult(0);
|
|||
// if (ObjectUtil.isEmpty(productin_qty)) {
|
|||
// jsonRaw.put("productin_qty", 0);
|
|||
// } else {
|
|||
// jsonRaw.put("productin_qty", whereJson.getDoubleValue("productin_qty"));
|
|||
// }
|
|||
// tab.update(jsonRaw);
|
|||
// }
|
|||
//
|
|||
//}
|
|||
|
Loading…
Reference in new issue