add:型材出库添加强制出库功能

This commit is contained in:
zhangzhiqiang
2023-02-22 23:12:24 +08:00
parent b3d7410833
commit f473d92db6
3 changed files with 68 additions and 31 deletions

View File

@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONArray;
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.apache.commons.lang3.StringUtils;
import org.nl.modules.system.service.UserService; import org.nl.modules.system.service.UserService;
import org.nl.modules.system.service.dto.UserDto; import org.nl.modules.system.service.dto.UserDto;
import org.nl.modules.system.util.CodeUtil; import org.nl.modules.system.util.CodeUtil;
@@ -30,6 +31,7 @@ import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@@ -56,6 +58,7 @@ public class HandXCOutIvtServiceImpl implements HandXCOutIvtService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Map<String, Object> queryStoragevehicle(Map<String, String> jsonObject) { public Map<String, Object> queryStoragevehicle(Map<String, String> jsonObject) {
Boolean result =Boolean.TRUE;
JSONObject returnjo = new JSONObject(); JSONObject returnjo = new JSONObject();
String storagevehicle_code = jsonObject.get("storagevehicle_code"); String storagevehicle_code = jsonObject.get("storagevehicle_code");
String workorder_code = jsonObject.get("workorder_code"); String workorder_code = jsonObject.get("workorder_code");
@@ -68,26 +71,31 @@ public class HandXCOutIvtServiceImpl implements HandXCOutIvtService {
// 仓位属性表【ST_IVT_StructAttr】 // 仓位属性表【ST_IVT_StructAttr】
WQLObject PDM_BI_ProcedureOffline = WQLObject.getWQLObject("PDM_BI_ProcedureOffline"); WQLObject PDM_BI_ProcedureOffline = WQLObject.getWQLObject("PDM_BI_ProcedureOffline");
WQLObject pdm_bi_workorder = WQLObject.getWQLObject("pdm_bi_workorder"); WQLObject pdm_bi_workorder = WQLObject.getWQLObject("pdm_bi_workorder");
JSONObject workorder = pdm_bi_workorder.query("workorder_code='" + workorder_code + "'").uniqueResult(0);
String workorderId = workorder.getString("workorder_id");
JSONObject jo = PDM_BI_ProcedureOffline.query("storagevehicle_code='"+storagevehicle_code+"'").uniqueResult(0); JSONArray jo = PDM_BI_ProcedureOffline.query("storagevehicle_code='"+storagevehicle_code+"'").getResultJSONArray(0);
if(jo==null){ if(jo==null || jo.size() == 0){
throw new PdaRequestException("该载具"+storagevehicle_code+"无组盘记录!"); throw new PdaRequestException("该载具"+storagevehicle_code+"无组盘记录!");
} }
String is_send = jo.getString("is_send"); Optional<Object> has = jo.stream().filter(o -> workorderId.equals(((JSONObject) o).get("workorder_id"))).findAny();
if("1".equals(is_send)){ if(!has.isPresent()){
throw new PdaRequestException("该载具"+storagevehicle_code+"已发货,不允许再次发货!"); result = Boolean.FALSE;
} }else {
String workorder_id = jo.getString("workorder_id"); JSONObject o = (JSONObject)has.get();
JSONObject wo = pdm_bi_workorder.query("workorder_id='"+workorder_id+"'").uniqueResult(0); String is_send = o.getString("is_send");
if(wo == null ||!workorder_code.equals(wo.getString("workorder_code"))){ if("1".equals(is_send)){
throw new PdaRequestException("该载具"+storagevehicle_code+"组盘工令与所选工令不一致!"); throw new PdaRequestException("该载具"+storagevehicle_code+"已发货,不允许再次发货!");
}
} }
//3、 通过托盘,查询【桶记录表】状态=入库,得到载具桶库存信息,无结果提示错误; //3、 通过托盘,查询【桶记录表】状态=入库,得到载具桶库存信息,无结果提示错误;
JSONArray bucketrow = WQL.getWO("QPADST_OUT_SERVICE2").addParam("flag", "2").addParam("storagevehicle_code", storagevehicle_code).process().getResultJSONArray(0); //4通过工令查询
JSONArray bucketrow = WQL.getWO("QPADST_OUT_SERVICE2").addParam("flag", "3").addParam("workorderId",workorderId).process().getResultJSONArray(0);
returnjo.put("code", "1"); returnjo.put("code", "1");
returnjo.put("desc", "查询成功"); returnjo.put("desc", "查询成功");
returnjo.put("content", bucketrow); returnjo.put("content", bucketrow);
returnjo.put("result", result);
return returnjo; return returnjo;
} }
@@ -103,9 +111,6 @@ public class HandXCOutIvtServiceImpl implements HandXCOutIvtService {
String storagevehicle_code = mst.getString("vehicle_code"); String storagevehicle_code = mst.getString("vehicle_code");
String workorder_code = mst.getString("workorder_code"); String workorder_code = mst.getString("workorder_code");
if (StrUtil.isEmpty(storagevehicle_code)) {
throw new PdaRequestException("载具不能为空!");
}
if (StrUtil.isEmpty(workorder_code)) { if (StrUtil.isEmpty(workorder_code)) {
throw new PdaRequestException("工令不能为空!"); throw new PdaRequestException("工令不能为空!");
} }
@@ -113,22 +118,26 @@ public class HandXCOutIvtServiceImpl implements HandXCOutIvtService {
// 仓位属性表【ST_IVT_StructAttr】 // 仓位属性表【ST_IVT_StructAttr】
WQLObject PDM_BI_ProcedureOffline = WQLObject.getWQLObject("PDM_BI_ProcedureOffline"); WQLObject PDM_BI_ProcedureOffline = WQLObject.getWQLObject("PDM_BI_ProcedureOffline");
WQLObject pdm_bi_workorder = WQLObject.getWQLObject("pdm_bi_workorder"); WQLObject pdm_bi_workorder = WQLObject.getWQLObject("pdm_bi_workorder");
JSONObject workorder = pdm_bi_workorder.query("workorder_code='" + workorder_code + "'").uniqueResult(0);
JSONObject jo = PDM_BI_ProcedureOffline.query("storagevehicle_code='"+storagevehicle_code+"'").uniqueResult(0); String workorderId = workorder.getString("workorder_id");
if(jo==null){ if (StringUtils.isNotEmpty(storagevehicle_code)){
throw new PdaRequestException("该载具"+storagevehicle_code+"无组盘记录!"); JSONArray jo = PDM_BI_ProcedureOffline.query("storagevehicle_code='"+storagevehicle_code+"'").getResultJSONArray(0);
if(jo==null ||jo.size() == 0){
throw new PdaRequestException("该载具"+storagevehicle_code+"无组盘记录!");
}
Optional<Object> any = jo.stream().filter(o -> workorderId.equals(((JSONObject) o).get("workorder_id"))).findAny();
if(!any.isPresent()){
throw new PdaRequestException("该载具"+storagevehicle_code+"无对应工令的组盘信息!");
}else {
JSONObject o = (JSONObject)any.get();
String is_send = o.getString("is_send");
if("1".equals(is_send)){
throw new PdaRequestException("该载具"+storagevehicle_code+"已发货,不允许再次发货!");
}
}
} }
String is_send = jo.getString("is_send"); //4通过工令查询
if("1".equals(is_send)){ JSONArray dtls = WQL.getWO("QPADST_OUT_SERVICE2").addParam("flag", "3").addParam("workorderId",workorderId).process().getResultJSONArray(0);
throw new PdaRequestException("该载具"+storagevehicle_code+"已发货,不允许再次发货!");
}
String workorder_id = jo.getString("workorder_id");
JSONObject wo = pdm_bi_workorder.query("workorder_id='"+workorder_id+"'").uniqueResult(0);
String workorder_code2 = wo.getString("workorder_code");
if(!workorder_code2.equals(workorder_code)){
throw new PdaRequestException("该载具"+storagevehicle_code+"组盘工令与所选工令不一致!");
}
JSONArray dtls = jsonObject.getJSONArray("dtl");
Set set = new HashSet(); Set set = new HashSet();
for(int i=0;i<dtls.size();i++){ for(int i=0;i<dtls.size();i++){
JSONObject dtl = dtls.getJSONObject(i); JSONObject dtl = dtls.getJSONObject(i);

View File

@@ -15,6 +15,7 @@
################################################# #################################################
输入.flag TYPEAS s_string 输入.flag TYPEAS s_string
输入.storagevehicle_code TYPEAS s_string 输入.storagevehicle_code TYPEAS s_string
输入.workorderId TYPEAS s_string
输入.bucketunique TYPEAS s_string 输入.bucketunique TYPEAS s_string
输入.material_id TYPEAS s_string 输入.material_id TYPEAS s_string
输入.height TYPEAS s_string 输入.height TYPEAS s_string
@@ -98,3 +99,27 @@
ENDSELECT ENDSELECT
ENDQUERY ENDQUERY
ENDIF ENDIF
IF 输入.flag = "3"
QUERY
SELECT
mb.material_code,
mb.material_name,
procedureoffline.material_id,
procedureoffline.diskrecord_id,
procedureoffline.pcsn,
procedureoffline.qty,
procedureoffline.bucketunique,
procedureoffline.storagevehicle_code
FROM
pdm_bi_procedureoffline procedureoffline
LEFT JOIN md_me_materialbase mb ON mb.material_id = procedureoffline.material_id
WHERE
1 = 1
OPTION 输入.workorderId <> ""
procedureoffline.workorder_id = 输入.workorderId
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -591,11 +591,14 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
WQLObject PDM_BI_ProcedureOffline = WQLObject.getWQLObject("PDM_BI_ProcedureOffline"); WQLObject PDM_BI_ProcedureOffline = WQLObject.getWQLObject("PDM_BI_ProcedureOffline");
JSONArray array = PDM_BI_ProcedureOffline.query("storagevehicle_code='" + storagevehicle_code + "'").getResultJSONArray(0); JSONArray array = PDM_BI_ProcedureOffline.query("storagevehicle_code='" + storagevehicle_code + "'").getResultJSONArray(0);
if(array==null || array.size() == 0){ String pcsn = jsonObject.getString("pcsn");
Optional<Object> any = array.stream().filter(o -> pcsn.equals(((JSONObject) o).get("pcsn"))).findAny();
if(!any.isPresent()){
throw new BadRequestException("该载具"+storagevehicle_code+"无组盘记录!"); throw new BadRequestException("该载具"+storagevehicle_code+"无组盘记录!");
} }
List<Object> collect1 = array.stream().filter(o -> pcsn.equals(((JSONObject) o).get("pcsn"))).collect(Collectors.toList());
List<String> diskrecordIds = new ArrayList<>(); List<String> diskrecordIds = new ArrayList<>();
for (Object o : array) { for (Object o : collect1) {
JSONObject jo = (JSONObject) o; JSONObject jo = (JSONObject) o;
String is_send = jo.getString("is_send"); String is_send = jo.getString("is_send");
if(!"1".equals(is_send)){ if(!"1".equals(is_send)){