add:无袋打印;rev:粉料计划不计算未开工
This commit is contained in:
@@ -8,6 +8,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.nl.annotation.Log;
|
import org.nl.annotation.Log;
|
||||||
|
import org.nl.pda.st.set.service.PdaBucketNoBagService;
|
||||||
import org.nl.pda.st.set.service.PdaBucketService;
|
import org.nl.pda.st.set.service.PdaBucketService;
|
||||||
import org.nl.wql.core.content.HttpContext;
|
import org.nl.wql.core.content.HttpContext;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -32,6 +33,8 @@ public class PdaBucketController {
|
|||||||
|
|
||||||
private final PdaBucketService bucketService;
|
private final PdaBucketService bucketService;
|
||||||
|
|
||||||
|
private final PdaBucketNoBagService bucketNoBagService;
|
||||||
|
|
||||||
@PostMapping("/queryMaterialList")
|
@PostMapping("/queryMaterialList")
|
||||||
@Log("手持物料查询")
|
@Log("手持物料查询")
|
||||||
@ApiOperation("手持物料查询")
|
@ApiOperation("手持物料查询")
|
||||||
@@ -90,4 +93,28 @@ public class PdaBucketController {
|
|||||||
public ResponseEntity<Object> delete() {
|
public ResponseEntity<Object> delete() {
|
||||||
return new ResponseEntity<>(bucketService.getLevel(), HttpStatus.OK);
|
return new ResponseEntity<>(bucketService.getLevel(), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/queryInfoBybucket2")
|
||||||
|
@Log("根据桶码查询信息")
|
||||||
|
@ApiOperation("根据桶码查询信息")
|
||||||
|
public ResponseEntity<Object> queryInfoBybucket2(@RequestBody Map<String, String> whereJson) {
|
||||||
|
return new ResponseEntity<>(bucketNoBagService.queryInfoBybucket(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/confirmGroupBucket2")
|
||||||
|
@Log("确定组桶")
|
||||||
|
@ApiOperation("确定组桶")
|
||||||
|
public ResponseEntity<Object> confirmGroupBucket2( @RequestBody Map whereJson) {
|
||||||
|
return new ResponseEntity<>(bucketNoBagService.confirmGroupBucket(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/print2")
|
||||||
|
@Log("打印")
|
||||||
|
@ApiOperation("打印")
|
||||||
|
public ResponseEntity<Object> print2(@RequestBody Map<String, String> whereJson) {
|
||||||
|
return new ResponseEntity<>(bucketNoBagService.print(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
|
||||||
|
package org.nl.pda.st.set.rest;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.annotation.Log;
|
||||||
|
import org.nl.pda.st.set.service.PdaBucketNoBagService;
|
||||||
|
import org.nl.pda.st.set.service.PdaBucketService;
|
||||||
|
import org.nl.wql.core.content.HttpContext;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ldjun
|
||||||
|
* @date 2021-07-26
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "手持软废桶标签打印")
|
||||||
|
@RequestMapping("api/pda/set/bucketNotbag")
|
||||||
|
@Slf4j
|
||||||
|
public class PdaBucketNotBagController {
|
||||||
|
|
||||||
|
private final PdaBucketNoBagService bucketNoBagService;
|
||||||
|
|
||||||
|
@PostMapping("/queryInfoBybucket")
|
||||||
|
@Log("根据桶码查询信息")
|
||||||
|
@ApiOperation("根据桶码查询信息")
|
||||||
|
public ResponseEntity<Object> queryInfoBybucket(@RequestBody Map<String, String> whereJson) {
|
||||||
|
return new ResponseEntity<>(bucketNoBagService.queryInfoBybucket(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/confirmGroupBucket")
|
||||||
|
@Log("确定组桶")
|
||||||
|
@ApiOperation("确定组桶")
|
||||||
|
public ResponseEntity<Object> confirmGroupBucket( @RequestBody Map whereJson) {
|
||||||
|
return new ResponseEntity<>(bucketNoBagService.confirmGroupBucket(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/print")
|
||||||
|
@Log("打印")
|
||||||
|
@ApiOperation("打印")
|
||||||
|
public ResponseEntity<Object> print(@RequestBody Map<String, String> whereJson) {
|
||||||
|
return new ResponseEntity<>(bucketNoBagService.print(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package org.nl.pda.st.set.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.nl.wql.core.content.HttpContext;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface PdaBucketNoBagService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手持物料查询
|
||||||
|
*
|
||||||
|
* @param jsonObject 条件
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
Map<String, Object> queryMaterialList(Map<String, String> jsonObject, HttpContext ctx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据桶码查询信息
|
||||||
|
*
|
||||||
|
* @param jsonObject 条件
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
Map<String, Object> queryInfoBybucket(Map<String, String> jsonObject);
|
||||||
|
/**
|
||||||
|
* 根据袋码码查询信息
|
||||||
|
*
|
||||||
|
* @param jsonObject 条件
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
Map<String, Object> queryInfoByBag(Map<String, String> jsonObject);
|
||||||
|
/**
|
||||||
|
* 确定组桶
|
||||||
|
*
|
||||||
|
* @param jsonObject 条件
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
Map<String, Object> confirmGroupBucket(Map jsonObject);
|
||||||
|
/**
|
||||||
|
* 打印
|
||||||
|
*
|
||||||
|
* @param jsonObject 条件
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
Map<String, Object> print(Map<String, String> jsonObject);
|
||||||
|
|
||||||
|
Map<String, Object> getpcsn(Map<String, String> jsonObject);
|
||||||
|
/**
|
||||||
|
* 打印
|
||||||
|
*
|
||||||
|
* @param jsonObject 删除行
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
Map<String, Object> delete(Map<String, String> jsonObject);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取等级下拉框
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
JSONObject getLevel();
|
||||||
|
}
|
||||||
@@ -0,0 +1,324 @@
|
|||||||
|
package org.nl.pda.st.set.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.exception.BadRequestException;
|
||||||
|
import org.nl.modules.system.service.UserService;
|
||||||
|
import org.nl.modules.system.service.dto.UserDto;
|
||||||
|
import org.nl.modules.system.util.CodeUtil;
|
||||||
|
import org.nl.pda.exception.PdaRequestException;
|
||||||
|
import org.nl.pda.st.set.service.PdaBucketNoBagService;
|
||||||
|
import org.nl.pda.st.set.service.PdaBucketService;
|
||||||
|
import org.nl.utils.SecurityUtils;
|
||||||
|
import org.nl.wms.basedata.master.constant.MaterOptTypeEnum;
|
||||||
|
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||||
|
import org.nl.wms.basedata.master.service.MaterialbaseService;
|
||||||
|
import org.nl.wms.basedata.master.service.dto.MaterialbaseDto;
|
||||||
|
import org.nl.wql.WQL;
|
||||||
|
import org.nl.wql.core.bean.WQLObject;
|
||||||
|
import org.nl.wql.core.content.HttpContext;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class PdaBucketNoBagServiceImpl implements PdaBucketNoBagService {
|
||||||
|
private final ClassstandardService classstandardService;
|
||||||
|
private final MaterialbaseService materialbaseService;
|
||||||
|
private final UserService userService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryMaterialList(Map<String, String> jsonObject, HttpContext ctx) {
|
||||||
|
//输入物料查询
|
||||||
|
String searchbar = jsonObject.get("searchbar");
|
||||||
|
int page = Integer.valueOf(jsonObject.get("page"));
|
||||||
|
int size = Integer.valueOf(jsonObject.get("size"));
|
||||||
|
//类型 1 是pg粉 2 是软废 3 合金球
|
||||||
|
String option_type = jsonObject.get("option_type");
|
||||||
|
String allChildIdStr = "";
|
||||||
|
if (StrUtil.equals("1", option_type)) {
|
||||||
|
allChildIdStr = classstandardService.getAllChildIdStr(MaterOptTypeEnum.PGF.getClass_idStr());
|
||||||
|
}
|
||||||
|
if (StrUtil.equals("2", option_type)) {
|
||||||
|
allChildIdStr = classstandardService.getAllChildIdStr(MaterOptTypeEnum.RF.getClass_idStr());
|
||||||
|
}
|
||||||
|
if (StrUtil.equals("3", option_type)) {
|
||||||
|
allChildIdStr = classstandardService.getAllChildIdStr(MaterOptTypeEnum.HJQ.getClass_idStr());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrUtil.isEmpty(allChildIdStr)) {
|
||||||
|
allChildIdStr = classstandardService.getAllChildIdStr(MaterOptTypeEnum.QBWL.getClass_idStr());
|
||||||
|
}
|
||||||
|
JSONObject returnjo = new JSONObject();
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
Pageable pageable = PageRequest.of(page - 1, size);
|
||||||
|
param.put("class_idStr", allChildIdStr);
|
||||||
|
param.put("search", searchbar);
|
||||||
|
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(materialbaseService.queryAll(param, pageable)));
|
||||||
|
|
||||||
|
returnjo.put("code", "1");
|
||||||
|
returnjo.put("desc", "查询成功!");
|
||||||
|
returnjo.put("rows", jo.getJSONArray("content"));
|
||||||
|
returnjo.put("size", jo.getJSONArray("content").size());
|
||||||
|
return returnjo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryInfoBybucket(Map<String, String> jsonObject) {
|
||||||
|
String bucketunique = (String) jsonObject.get("bucketunique");
|
||||||
|
JSONObject returnjo = new JSONObject();
|
||||||
|
if (StrUtil.isEmpty(bucketunique)) {
|
||||||
|
throw new PdaRequestException("桶码不能为空!");
|
||||||
|
|
||||||
|
}
|
||||||
|
JSONObject result = WQL.getWO("QPADSTSETSERVICE").addParam("flag", "5").addParam("bucketunique", bucketunique).process().uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(result)) {
|
||||||
|
throw new PdaRequestException("桶码为【'" + bucketunique + "'】的记录未找到!");
|
||||||
|
}
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("result", result);
|
||||||
|
|
||||||
|
returnjo.put("code", "1");
|
||||||
|
returnjo.put("desc", "查询成功!");
|
||||||
|
returnjo.put("result", jo);
|
||||||
|
return returnjo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryInfoByBag(Map<String, String> jsonObject) {
|
||||||
|
String bag_id = (String) jsonObject.get("bag_id");
|
||||||
|
JSONObject returnjo = new JSONObject();
|
||||||
|
|
||||||
|
if (StrUtil.isEmpty(bag_id)) {
|
||||||
|
throw new PdaRequestException("袋码不能为空");
|
||||||
|
|
||||||
|
}
|
||||||
|
JSONObject result = WQL.getWO("QPADSTSETSERVICE").addParam("flag", "7").addParam("bag_id", bag_id).process().uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(result)) {
|
||||||
|
result = new JSONObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
returnjo.put("code", "1");
|
||||||
|
returnjo.put("desc", "查询成功!");
|
||||||
|
returnjo.put("result", result);
|
||||||
|
return returnjo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Map<String, Object> confirmGroupBucket(Map jsonObject) {
|
||||||
|
JSONObject returnjo = new JSONObject();
|
||||||
|
//桶记录表
|
||||||
|
WQLObject bucketRecordTable = WQLObject.getWQLObject("md_pb_bucketrecord");
|
||||||
|
WQLObject bucketChangeTable = WQLObject.getWQLObject("MD_PB_BucketChangeFlow");
|
||||||
|
JSONObject mst = JSONObject.parseObject(JSON.toJSONString(jsonObject)).getJSONObject("mst");
|
||||||
|
|
||||||
|
//
|
||||||
|
BigDecimal change_qty = new BigDecimal(0);
|
||||||
|
BigDecimal result_qty = BigDecimal.valueOf(mst.getDoubleValue("storage_qty"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
String bucketunique = mst.getString("bucketunique");
|
||||||
|
String is_active = mst.getString("is_active");
|
||||||
|
String material_code = mst.getString("material_code");
|
||||||
|
MaterialbaseDto materDto = materialbaseService.findByCode(material_code);
|
||||||
|
if (materDto==null){
|
||||||
|
throw new BadRequestException(material_code+"物料信息不存在");
|
||||||
|
}
|
||||||
|
String input_optid = mst.getString("accountId");
|
||||||
|
String input_optname = mst.getString("user");
|
||||||
|
String pcsn = mst.getString("pcsn");
|
||||||
|
String ivt_level = mst.getString("ivt_level");
|
||||||
|
|
||||||
|
|
||||||
|
//2.假如桶码没有就插入,有就更新 桶记录表
|
||||||
|
JSONObject bucketJo = bucketRecordTable.query("bucketunique='" + bucketunique + "'").uniqueResult(0);
|
||||||
|
if (bucketJo!=null){
|
||||||
|
throw new BadRequestException("当前桶码已存在组桶记录");
|
||||||
|
}
|
||||||
|
bucketJo = new JSONObject();
|
||||||
|
bucketJo.put("bucket_record_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||||
|
bucketJo.put("bucketunique", bucketunique);
|
||||||
|
bucketJo.put("storagevehicle_type", "04");
|
||||||
|
bucketJo.put("material_id", materDto.getMaterial_id());
|
||||||
|
bucketJo.put("pcsn", pcsn);
|
||||||
|
bucketJo.put("qty_unit_id", materDto.getBase_unit_id());
|
||||||
|
bucketJo.put("qty_unit_name",materDto.getBase_unit_name());
|
||||||
|
bucketJo.put("ivt_level", ivt_level);
|
||||||
|
bucketJo.put("quality_scode", "02");
|
||||||
|
bucketJo.put("storage_qty", mst.getString("storage_qty"));
|
||||||
|
bucketJo.put("is_active", is_active);
|
||||||
|
bucketJo.put("record_order", "1");
|
||||||
|
bucketJo.put("status", "01");
|
||||||
|
bucketJo.put("print_times", "1");
|
||||||
|
bucketJo.put("create_id", input_optid);
|
||||||
|
bucketJo.put("create_name", input_optid);
|
||||||
|
bucketJo.put("create_time", DateUtil.now());
|
||||||
|
bucketJo.put("print_type", "04");
|
||||||
|
bucketJo.put("print_times", "1");
|
||||||
|
//插入变更数量就是总数
|
||||||
|
change_qty = NumberUtil.add(change_qty, BigDecimal.valueOf(mst.getDoubleValue("storage_qty")));
|
||||||
|
bucketRecordTable.insert(bucketJo);
|
||||||
|
//3.更新袋记录表 将之前该桶的袋记录的桶号删除,2将新的袋更新
|
||||||
|
//4、插桶物料变动记录表,
|
||||||
|
JSONObject changeObj = new JSONObject();
|
||||||
|
changeObj.put("change_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||||
|
changeObj.put("bucket_code", bucketunique);
|
||||||
|
changeObj.put("material_id", materDto.getMaterial_id());
|
||||||
|
changeObj.put("pcsn", pcsn);
|
||||||
|
changeObj.put("ivt_level", ivt_level);
|
||||||
|
changeObj.put("is_active", is_active);
|
||||||
|
changeObj.put("quality_scode", "02");
|
||||||
|
String change_type_scode = "";
|
||||||
|
if (change_qty.doubleValue() < 0) {
|
||||||
|
change_type_scode = "02";
|
||||||
|
} else {
|
||||||
|
change_type_scode = "01";
|
||||||
|
}
|
||||||
|
changeObj.put("change_type_scode", change_type_scode);
|
||||||
|
changeObj.put("change_time", DateUtil.now());
|
||||||
|
changeObj.put("rec_person", input_optid);
|
||||||
|
changeObj.put("change_qty", change_qty);
|
||||||
|
changeObj.put("result_qty", result_qty);
|
||||||
|
changeObj.put("qty_unit_id", materDto.getBase_unit_id());
|
||||||
|
changeObj.put("qty_unit_name", materDto.getBase_unit_name());
|
||||||
|
bucketChangeTable.insert(changeObj);
|
||||||
|
//查询打印信息
|
||||||
|
JSONObject result = WQL.getWO("QPADSTSETSERVICE").addParam("flag", "8").addParam("bucketunique", bucketunique).process().uniqueResult(0);
|
||||||
|
result.put("create_date", DateUtil.now());
|
||||||
|
returnjo.put("code", "1");
|
||||||
|
returnjo.put("desc", "组桶成功!");
|
||||||
|
returnjo.put("result", result);
|
||||||
|
return returnjo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Map<String, Object> print(Map<String, String> jsonObject) {
|
||||||
|
JSONObject returnjo = new JSONObject();
|
||||||
|
String bucketunique = jsonObject.get("bucketunique");
|
||||||
|
if (StrUtil.isEmpty(bucketunique)) {
|
||||||
|
returnjo.put("code", "0");
|
||||||
|
returnjo.put("desc", "桶码不能为空!");
|
||||||
|
returnjo.put("result", new JSONObject());
|
||||||
|
return returnjo;
|
||||||
|
}
|
||||||
|
JSONObject result = WQL.getWO("QPADSTSETSERVICE").addParam("flag", "8").addParam("bucketunique", bucketunique).process().uniqueResult(0);
|
||||||
|
//更新打印次数
|
||||||
|
JSONObject bucketObj = WQLObject.getWQLObject("MD_PB_BucketRecord").query("bucketunique='" + bucketunique + "'").uniqueResult(0);
|
||||||
|
int before_print_times = bucketObj.getInteger("print_times");
|
||||||
|
bucketObj.put("print_times", before_print_times + 1);
|
||||||
|
WQLObject.getWQLObject("MD_PB_BucketRecord").update(bucketObj);
|
||||||
|
returnjo.put("code", "1");
|
||||||
|
returnjo.put("desc", "打印成功!");
|
||||||
|
returnjo.put("result", result);
|
||||||
|
return returnjo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getpcsn(Map<String, String> jsonObject) {
|
||||||
|
JSONObject returnjo = new JSONObject();
|
||||||
|
String today= DateUtil.format(new DateTime(), "yyyyMMdd");
|
||||||
|
returnjo.put("code", "1");
|
||||||
|
returnjo.put("desc", "打印成功!");
|
||||||
|
returnjo.put("result", today);
|
||||||
|
return returnjo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Map<String, Object> delete(Map<String, String> jsonObject) {
|
||||||
|
String bucket_record_id = (String) jsonObject.get("bucket_record_id");
|
||||||
|
String bucketunique = (String) jsonObject.get("bucketunique");
|
||||||
|
String bag_id = (String) jsonObject.get("bag_id");
|
||||||
|
if (StrUtil.isEmpty(bucketunique)) {
|
||||||
|
throw new PdaRequestException("桶码不能为空!");
|
||||||
|
}
|
||||||
|
if (StrUtil.isEmpty(bag_id)) {
|
||||||
|
throw new PdaRequestException("桶码不能为空!");
|
||||||
|
}
|
||||||
|
JSONObject bucketObj = WQLObject.getWQLObject("MD_PB_BucketRecord").query("bucketunique='" + bucketunique + "'").uniqueResult(0);
|
||||||
|
JSONObject bagObj = WQLObject.getWQLObject("MD_PB_BagRecord").query("bag_id='" + bag_id + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(bucketObj)) {
|
||||||
|
throw new PdaRequestException("未找到记录信息!");
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isEmpty(bagObj)) {
|
||||||
|
throw new PdaRequestException("未找到袋记录信息!");
|
||||||
|
}
|
||||||
|
if (!StrUtil.equals(bucketObj.getString("status"), "01")) {
|
||||||
|
throw new PdaRequestException("该桶状态必须是生成状态!");
|
||||||
|
}
|
||||||
|
if (!StrUtil.equals(bagObj.getString("status"), "02")) {
|
||||||
|
throw new PdaRequestException("该袋状态必须是组桶状态!");
|
||||||
|
}
|
||||||
|
//2 更新袋记录表
|
||||||
|
bagObj.put("status", "01");
|
||||||
|
bagObj.put("bucketunique", "");
|
||||||
|
bagObj.put("makeup_optid", "");
|
||||||
|
bagObj.put("makeup_optname", "");
|
||||||
|
bagObj.put("makeup_time", "");
|
||||||
|
WQLObject.getWQLObject("MD_PB_BagRecord").update(bagObj);
|
||||||
|
//3 更新桶记录表
|
||||||
|
double before_bag_qty = bucketObj.getDoubleValue("bag_qty");
|
||||||
|
double before_storage_qty = bucketObj.getDoubleValue("storage_qty");
|
||||||
|
bucketObj.put("bag_qty", before_bag_qty - 1);
|
||||||
|
bucketObj.put("storage_qty", before_storage_qty - bagObj.getDoubleValue("storage_qty"));
|
||||||
|
WQLObject.getWQLObject("MD_PB_BucketRecord").update(bucketObj);
|
||||||
|
//4、插桶物料变动记录表
|
||||||
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
UserDto userDto = userService.findById(currentUserId);
|
||||||
|
JSONObject change_jo = new JSONObject();
|
||||||
|
change_jo.put("change_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||||
|
change_jo.put("bucket_code", bucketObj.getString("bucketunique"));
|
||||||
|
change_jo.put("material_id", bucketObj.getString("material_id"));
|
||||||
|
change_jo.put("pcsn", bucketObj.getString("pcsn"));
|
||||||
|
change_jo.put("ivt_level", bucketObj.getString("ivt_level"));
|
||||||
|
change_jo.put("is_active", bucketObj.getString("is_active"));
|
||||||
|
change_jo.put("quality_scode", bucketObj.getString("quality_scode"));
|
||||||
|
change_jo.put("change_type_scode", "02");
|
||||||
|
change_jo.put("change_time", DateUtil.now());
|
||||||
|
change_jo.put("rec_person", userDto.getId());
|
||||||
|
change_jo.put("change_qty", 0-bagObj.getDoubleValue("storage_qty"));
|
||||||
|
change_jo.put("result_qty",before_storage_qty-bagObj.getDoubleValue("storage_qty") );
|
||||||
|
change_jo.put("qty_unit_id", bucketObj.getString("qty_unit_id"));
|
||||||
|
change_jo.put("qty_unit_name", bucketObj.getString("qty_unit_name"));
|
||||||
|
|
||||||
|
WQLObject.getWQLObject("MD_PB_BucketChangeFlow").insert(change_jo);
|
||||||
|
JSONObject returnjo = new JSONObject();
|
||||||
|
returnjo.put("code", "1");
|
||||||
|
returnjo.put("desc", "删除成功!");
|
||||||
|
return returnjo;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject getLevel() {
|
||||||
|
|
||||||
|
JSONArray resultJSONArray = WQL.getWO("QPADSTSETSERVICE").addParam("flag", "17").process().getResultJSONArray(0);
|
||||||
|
|
||||||
|
JSONObject returnjo = new JSONObject();
|
||||||
|
returnjo.put("code", "1");
|
||||||
|
returnjo.put("desc", "查询成功!");
|
||||||
|
returnjo.put("result", resultJSONArray);
|
||||||
|
return returnjo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.nl.exception.BadRequestException;
|
import org.nl.exception.BadRequestException;
|
||||||
import org.nl.ext.erp.service.WmsToErpService;
|
import org.nl.ext.erp.service.WmsToErpService;
|
||||||
import org.nl.utils.SecurityUtils;
|
import org.nl.utils.SecurityUtils;
|
||||||
@@ -136,6 +137,9 @@ public class MaterialbaseServiceImpl implements MaterialbaseService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MaterialbaseDto findByCode(String code) {
|
public MaterialbaseDto findByCode(String code) {
|
||||||
|
if (StringUtils.isEmpty(code)){
|
||||||
|
throw new BadRequestException("物料编码不能为空");
|
||||||
|
}
|
||||||
WQLObject wo = WQLObject.getWQLObject("md_me_materialbase");
|
WQLObject wo = WQLObject.getWQLObject("md_me_materialbase");
|
||||||
if (StrUtil.isNotEmpty(code) && code.contains("\\")) {
|
if (StrUtil.isNotEmpty(code) && code.contains("\\")) {
|
||||||
code = code.replace("\\", "\\\\");
|
code = code.replace("\\", "\\\\");
|
||||||
|
|||||||
@@ -5425,9 +5425,15 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
}
|
}
|
||||||
//BOM中碳化钨需含总碳
|
//BOM中碳化钨需含总碳
|
||||||
double CT2 = new_qty*(sum_Cr3C2/100.0)*(c_balance/100.0);
|
double CT2 = new_qty*(sum_Cr3C2/100.0)*(c_balance/100.0);
|
||||||
CT2 = new BigDecimal(CT2).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
if (CT1>0){
|
||||||
CT1 = new BigDecimal(CT1).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
String s_ct1 = String.valueOf(CT1);
|
||||||
|
int accuracy = s_ct1.length() - s_ct1.indexOf(".")-1;
|
||||||
|
if (accuracy>4){
|
||||||
|
accuracy = 4;
|
||||||
|
CT1 = new BigDecimal(CT1).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||||
|
}
|
||||||
|
CT2 = new BigDecimal(CT2).setScale(accuracy, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||||
|
}
|
||||||
//配粉结束
|
//配粉结束
|
||||||
if(CT1==CT2){
|
if(CT1==CT2){
|
||||||
//用新料补足剩余部分
|
//用新料补足剩余部分
|
||||||
|
|||||||
@@ -427,7 +427,7 @@
|
|||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
IF 输入.flag = "6"
|
IF 输入.flag = "16"
|
||||||
QUERY
|
QUERY
|
||||||
SELECT
|
SELECT
|
||||||
dtl.material_id,
|
dtl.material_id,
|
||||||
@@ -491,6 +491,52 @@
|
|||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "6"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
dtl.material_id,
|
||||||
|
SUM(ROUND((b.qty*dtl.standard_rate*0.01),3)) AS qty
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
material_id,
|
||||||
|
SUM( qty ) AS qty
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
material_id,
|
||||||
|
workorder_qty AS qty
|
||||||
|
FROM
|
||||||
|
pdm_bi_workorder wo
|
||||||
|
WHERE
|
||||||
|
wo.`status` < 50
|
||||||
|
AND is_delete = '0'
|
||||||
|
OPTION 输入.begin_date <> ""
|
||||||
|
wo.planstart_time >= 输入.begin_date
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.end_date <> ""
|
||||||
|
wo.planstart_time <= 输入.end_date
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.org_ids <> ""
|
||||||
|
wo.org_id in 输入.org_ids
|
||||||
|
ENDOPTION
|
||||||
|
) a
|
||||||
|
GROUP BY
|
||||||
|
a.material_id
|
||||||
|
) b
|
||||||
|
LEFT JOIN md_pd_productbom mst ON mst.material_id = b.material_id
|
||||||
|
LEFT JOIN md_pd_productbomdtl dtl ON mst.bom_id = dtl.bom_id
|
||||||
|
WHERE
|
||||||
|
1=1
|
||||||
|
OPTION 输入.material_id <> ""
|
||||||
|
dtl.material_id = 输入.material_id
|
||||||
|
ENDOPTION
|
||||||
|
GROUP BY
|
||||||
|
dtl.material_id
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
IF 输入.flag = "7"
|
IF 输入.flag = "7"
|
||||||
QUERY
|
QUERY
|
||||||
SELECT
|
SELECT
|
||||||
@@ -692,7 +738,7 @@
|
|||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
IF 输入.flag = "10"
|
IF 输入.flag = "20"
|
||||||
QUERY
|
QUERY
|
||||||
SELECT
|
SELECT
|
||||||
dtl.material_id,
|
dtl.material_id,
|
||||||
@@ -740,6 +786,40 @@
|
|||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "10"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
dtl.material_id,
|
||||||
|
b.currentDate,
|
||||||
|
ROUND((b.qty * dtl.standard_rate * 0.01),3) as qty
|
||||||
|
FROM (
|
||||||
|
SELECT
|
||||||
|
material_id,SUM( qty ) AS qty,currentDate
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
material_id,
|
||||||
|
workorder_qty AS qty,
|
||||||
|
wo.planstart_time as currentDate
|
||||||
|
FROM
|
||||||
|
pdm_bi_workorder wo
|
||||||
|
WHERE wo.`status` < 50 AND is_delete = '0'
|
||||||
|
OPTION 输入.begin_time <> ""
|
||||||
|
wo.planstart_time >= 输入.begin_time
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.end_time <> ""
|
||||||
|
wo.planstart_time <= 输入.end_time
|
||||||
|
ENDOPTION
|
||||||
|
) a GROUP BY a.material_id,currentDate
|
||||||
|
) b
|
||||||
|
LEFT JOIN md_pd_productbom mst ON mst.material_id = b.material_id
|
||||||
|
LEFT JOIN md_pd_productbomdtl dtl ON mst.bom_id = dtl.bom_id
|
||||||
|
WHERE
|
||||||
|
1=1 order by currentDate
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
IF 输入.flag = "11"
|
IF 输入.flag = "11"
|
||||||
QUERY
|
QUERY
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
|
|||||||
BIN
mes/qd/dist.zip
BIN
mes/qd/dist.zip
Binary file not shown.
Reference in New Issue
Block a user