rev:手持无袋组盘功能;add:新增粉料计划日表数据排序

This commit is contained in:
zhangzq
2024-10-17 20:04:34 +08:00
parent 5e103f07e4
commit 4b51f1ca9d
5 changed files with 53 additions and 7 deletions

View File

@@ -2,13 +2,19 @@
package org.nl.pda.st.set.rest;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
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.exception.BadRequestException;
import org.nl.modules.system.util.MapOf;
import org.nl.pda.st.set.service.PdaBucketNoBagService;
import org.nl.pda.st.set.service.PdaBucketService;
import org.nl.wms.basedata.master.service.MaterialbaseService;
import org.nl.wms.basedata.master.service.dto.MaterialbaseDto;
import org.nl.wql.core.content.HttpContext;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -32,6 +38,8 @@ public class PdaBucketNotBagController {
private final PdaBucketNoBagService bucketNoBagService;
private final MaterialbaseService materialbaseService;
@PostMapping("/queryInfoBybucket")
@Log("根据桶码查询信息")
@ApiOperation("根据桶码查询信息")
@@ -40,7 +48,22 @@ public class PdaBucketNotBagController {
}
@PostMapping("/confirmGroupBucket")
@PostMapping("/queryErpId")
@Log("根据ERPID查询物料编码")
public ResponseEntity<Object> queryErpId(@RequestBody Map<String, String> whereJson) {
String materialCode = whereJson.get("material_code");
MaterialbaseDto materDto = materialbaseService.findByErpId(materialCode);
if (materDto==null){
throw new BadRequestException(materialCode+"ERP_ID对应MES物料信息不存在");
}
JSONObject result = new JSONObject();
result.put("code", "1");
result.put("desc", "查询成功!");
result.put("result", MapOf.of("material_code",materDto.getMaterial_code()));
return new ResponseEntity<>(result, HttpStatus.OK);
}
@PostMapping("confirmGroupBucket")
@Log("确定组桶")
@ApiOperation("确定组桶")
public ResponseEntity<Object> confirmGroupBucket( @RequestBody Map whereJson) {

View File

@@ -139,7 +139,7 @@ public class PdaBucketNoBagServiceImpl implements PdaBucketNoBagService {
String is_active = mst.getString("is_active");
String material_code = mst.getString("material_code");
//从ERP查物料
MaterialbaseDto materDto = materialbaseService.findByErpId(material_code);
MaterialbaseDto materDto = materialbaseService.findByCode(material_code);
if (materDto==null){
throw new BadRequestException(material_code+"ERP_ID对应MES物料信息不存在");
}

View File

@@ -141,9 +141,7 @@ public class MaterialbaseServiceImpl implements MaterialbaseService {
throw new BadRequestException("ERPID编码不能为空");
}
WQLObject wo = WQLObject.getWQLObject("md_me_materialbase");
JSONObject json = wo.query("ext_id =" + erpId + "").uniqueResult(0);
String unit_name = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id= '" + json.getString("base_unit_id") + "'").uniqueResult(0).getString("unit_name");
json.put("base_unit_name", unit_name);
JSONObject json = wo.query("ext_id = '" + erpId + "'").uniqueResult(0);
final MaterialbaseDto obj = json.toJavaObject(MaterialbaseDto.class);
return obj;
}

View File

@@ -17,10 +17,12 @@ import org.nl.modules.system.repository.DeptRepository;
import org.nl.modules.system.service.DeptService;
import org.nl.modules.system.service.UserService;
import org.nl.modules.system.service.dto.UserDto;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.system.util.MapOf;
import org.nl.pda.exception.PdaRequestException;
import org.nl.utils.FileUtil;
import org.nl.utils.SecurityUtils;
import org.nl.utils.SpringContextHolder;
import org.nl.wms.common.util.DataAuthUtil;
import org.nl.wms.statistics.service.StatisticalReportService;
import org.nl.wql.WQL;
@@ -43,6 +45,7 @@ import java.nio.file.Paths;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.ToDoubleFunction;
import java.util.stream.Collectors;
@@ -556,6 +559,11 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
@Override
public JSONArray getHeader() {
List<String> header = new ArrayList();
String headerFilter = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("Header_Filter").getValue();
if (StringUtils.isNotEmpty(headerFilter)){
header = JSONArray.parseArray(headerFilter, String.class);
}
JSONArray jsonArr = WQL.getWO("statistical_report_query_01").addParam("flag", "3").process().getResultJSONArray(0);
JSONArray jonsResuftArr = new JSONArray();
JSONObject jsonResuft1 = new JSONObject();
@@ -565,8 +573,13 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
for (int i = 0; i < jsonArr.size(); i++) {
JSONObject json = jsonArr.getJSONObject(i);
JSONObject jsonResuft2 = new JSONObject();
String materialName = json.getString("material_name");
boolean present = header.stream().filter(s -> materialName.contains(s)).findAny().isPresent();
if (present){
continue;
}
jsonResuft2.put("prop", json.getString("material_id"));
jsonResuft2.put("label", json.getString("material_name"));
jsonResuft2.put("label", materialName);
jonsResuftArr.add(jsonResuft2);
}
return jonsResuftArr;
@@ -574,6 +587,11 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
@Override
public JSONArray getHeader2() {
List<String> header = new ArrayList();
String headerFilter = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("Header_Filter").getValue();
if (StringUtils.isNotEmpty(headerFilter)){
header = JSONArray.parseArray(headerFilter, String.class);
}
JSONArray jsonArr = WQL.getWO("statistical_report_query_01").addParam("flag", "3").process().getResultJSONArray(0);
JSONArray jonsResuftArr = new JSONArray();
JSONObject jsonResuft1 = new JSONObject();
@@ -599,9 +617,15 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
for (int i = 0; i < jsonArr.size(); i++) {
JSONObject json = jsonArr.getJSONObject(i);
JSONObject jsonResuft4 = new JSONObject();
String materialName = json.getString("material_name");
boolean present = header.stream().filter(s -> materialName.contains(s)).findAny().isPresent();
if (present){
continue;
}
jsonResuft4.put("prop", json.getString("material_id"));
jsonResuft4.put("label", json.getString("material_name"));
jsonResuft4.put("label", materialName);
jonsResuftArr.add(jsonResuft4);
}
return jonsResuftArr;
}

View File

@@ -365,6 +365,7 @@
INNER JOIN md_pb_classstandard class ON class.class_id = mb.material_type_id
ORDER BY
order_no,
material_name,
material_code
ENDSELECT
ENDQUERY