优化
This commit is contained in:
@@ -132,9 +132,6 @@ public class FactorywarrantymstServiceImpl implements FactorywarrantymstService
|
||||
|
||||
JSONObject jsonSheet = sheetDtlTab.query("material_id = '" + MapUtil.getStr(map, "material_id") + "' and pcsn = '" + MapUtil.getStr(map, "pcsn") + "'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(jsonSheet)) {
|
||||
throw new BadRequestException("此批次物料质检单不存在,请联系相关人员新增!");
|
||||
}
|
||||
/*
|
||||
* 插入厂家质保书主表
|
||||
*/
|
||||
@@ -174,8 +171,7 @@ public class FactorywarrantymstServiceImpl implements FactorywarrantymstService
|
||||
* 传递参数 param:inspection_type,remark,pcsn,other_device_no,other_device_wd,inspection_code
|
||||
*/
|
||||
if (ObjectUtil.isEmpty(jsonSheet)) {
|
||||
throw new BadRequestException("此批次物料质检单不存在,请联系相关人员新增!");
|
||||
/*HashMap<String, String> param = new HashMap<>();
|
||||
HashMap<String, String> param = new HashMap<>();
|
||||
// 判断此物料是什么类型
|
||||
String material_type_id = jsonMater.getString("material_type_id");
|
||||
//是否原料
|
||||
@@ -201,7 +197,7 @@ public class FactorywarrantymstServiceImpl implements FactorywarrantymstService
|
||||
JSONObject SheetM = WQLObject.getWQLObject("QL_TEST_InspectionSheetMst").query("inspection_id = '" + SheetD.getString("inspection_id") + "'").uniqueResult(0);
|
||||
jsonFat.put("source_bill_id", SheetM.getString("inspection_id"));
|
||||
jsonFat.put("source_bill_code", SheetM.getString("inspection_code"));
|
||||
jsonFat.put("source_bill_type", SheetM.getString("inspection_type"));*/
|
||||
jsonFat.put("source_bill_type", SheetM.getString("inspection_type"));
|
||||
}
|
||||
fatMstTab.insert(jsonFat);
|
||||
|
||||
|
||||
@@ -636,60 +636,63 @@ public class InspectionsheetmstServiceImpl implements InspectionsheetmstService
|
||||
.addParam("flag", "2")
|
||||
.addParam("material_id", jsonDtl.getString("material_id"))
|
||||
.addParam("pcsn", jsonDtl.getString("pcsn")).process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonDtl.getString("source_bill_id"))) {
|
||||
if (ObjectUtil.isNotEmpty(ivtDtlArr)) {
|
||||
for (int j = 0; j < ivtDtlArr.size(); j++) {
|
||||
JSONObject json = ivtDtlArr.getJSONObject(j);
|
||||
JSONObject jsonReDtl = reDtlTab.query("receivedtl_id = '" + json.getString("source_billdtl_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonReDtl)) throw new BadRequestException("找不到到货通知单明细");
|
||||
// 如果是合格或者是放行就存入 入库数
|
||||
if (StrUtil.equals(jsonDtl.getString("result"), "01") || StrUtil.equals(jsonDtl.getString("result"), "03")) {
|
||||
jsonReDtl.put("instor_qty", json.getDoubleValue("real_qty"));
|
||||
// 如果是不合格就将入库数清0
|
||||
} else if (StrUtil.equals(jsonDtl.getString("result"), "02")) {
|
||||
jsonReDtl.put("instor_qty", 0);
|
||||
if (ObjectUtil.isNotEmpty(ivtDtlArr)) {
|
||||
for (int j = 0; j < ivtDtlArr.size(); j++) {
|
||||
JSONObject json = ivtDtlArr.getJSONObject(j);
|
||||
JSONObject jsonReDtl = reDtlTab.query("receivedtl_id = '" + json.getString("source_billdtl_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonReDtl)) {
|
||||
throw new BadRequestException("找不到到货通知单明细");
|
||||
}
|
||||
if ("99".equals(jsonReDtl.getString("status"))) {
|
||||
continue;
|
||||
}
|
||||
// 如果是合格或者是放行就存入 入库数
|
||||
if (StrUtil.equals(jsonDtl.getString("result"), "01") || StrUtil.equals(jsonDtl.getString("result"), "03")) {
|
||||
jsonReDtl.put("instor_qty", json.getDoubleValue("real_qty"));
|
||||
// 如果是不合格就将入库数清0
|
||||
} else if (StrUtil.equals(jsonDtl.getString("result"), "02")) {
|
||||
jsonReDtl.put("instor_qty", 0);
|
||||
}
|
||||
//判断到货明细表中的数量与到货入库数是否相等,相同就完成,不相等就到货中
|
||||
if (jsonReDtl.getDoubleValue("receive_qty") <= jsonReDtl.getDoubleValue("instor_qty")) {
|
||||
jsonReDtl.put("status", ReceiveStatusEnum.AFFIRM.getCode());
|
||||
} else {
|
||||
jsonReDtl.put("status", ReceiveStatusEnum.ARRIVAL_NOTICE.getCode());
|
||||
}
|
||||
reDtlTab.update(jsonReDtl);
|
||||
/*
|
||||
* 判断到货明细单中的状态是否完成,全部完成则更新到货通知单主表完成
|
||||
*/
|
||||
JSONArray reDtlArr = reDtlTab.query("receive_id = '" + jsonReDtl.getString("receive_id") + "'").getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(reDtlArr)) throw new BadRequestException("到货单明细不存在!");
|
||||
int flag = 0;
|
||||
for (int i = 0; i < reDtlArr.size(); i++) {
|
||||
JSONObject json1 = reDtlArr.getJSONObject(i);
|
||||
if (StrUtil.equals(json1.getString("status"), ReceiveStatusEnum.AFFIRM.getCode())) {
|
||||
flag = flag + 1;
|
||||
}
|
||||
//判断到货明细表中的数量与到货入库数是否相等,相同就完成,不相等就到货中
|
||||
if (jsonReDtl.getDoubleValue("receive_qty") <= jsonReDtl.getDoubleValue("instor_qty")) {
|
||||
jsonReDtl.put("status", ReceiveStatusEnum.AFFIRM.getCode());
|
||||
}
|
||||
JSONObject jsonReMst = reMstTab.query("receive_id = '" + jsonReDtl.getString("receive_id") + "'").uniqueResult(0);
|
||||
if (reDtlArr.size() == flag) {
|
||||
jsonReMst.put("status", ReceiveStatusEnum.AFFIRM.getCode());
|
||||
jsonReMst.put("confirm_optid", currentUserId);
|
||||
jsonReMst.put("confirm_optname", nickName);
|
||||
jsonReMst.put("confirm_time", now);
|
||||
reMstTab.update(jsonReMst);
|
||||
}
|
||||
/*
|
||||
* 如果到货单主表状态为确认,则需要更新采购订单接口处理表
|
||||
*/
|
||||
if (StrUtil.equals(jsonReMst.getString("status"), ReceiveStatusEnum.AFFIRM.getCode())) {
|
||||
JSONObject jsonProc = procTab.query("id = '" + jsonReDtl.getString("source_billdtl_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonProc)) throw new BadRequestException("订单不存在");
|
||||
// 到货数量 = 订单数量,为完成,否则为采购中
|
||||
if ((jsonReDtl.getDoubleValue("instor_qty") >= jsonProc.getDoubleValue("qty")) && (StrUtil.equals(jsonReDtl.getString("status"), "99"))) {
|
||||
jsonProc.put("proc_status", ProcStatusEnum.FULFILL.getCode());
|
||||
} else {
|
||||
jsonReDtl.put("status", ReceiveStatusEnum.ARRIVAL_NOTICE.getCode());
|
||||
}
|
||||
reDtlTab.update(jsonReDtl);
|
||||
/*
|
||||
* 判断到货明细单中的状态是否完成,全部完成则更新到货通知单主表完成
|
||||
*/
|
||||
JSONArray reDtlArr = reDtlTab.query("receive_id = '" + jsonReDtl.getString("receive_id") + "'").getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(reDtlArr)) throw new BadRequestException("到货单明细不存在!");
|
||||
int flag = 0;
|
||||
for (int i = 0; i < reDtlArr.size(); i++) {
|
||||
JSONObject json1 = reDtlArr.getJSONObject(i);
|
||||
if (StrUtil.equals(json1.getString("status"), ReceiveStatusEnum.AFFIRM.getCode())) {
|
||||
flag = flag + 1;
|
||||
}
|
||||
}
|
||||
JSONObject jsonReMst = reMstTab.query("receive_id = '" + jsonReDtl.getString("receive_id") + "'").uniqueResult(0);
|
||||
if (reDtlArr.size() == flag) {
|
||||
jsonReMst.put("status", ReceiveStatusEnum.AFFIRM.getCode());
|
||||
jsonReMst.put("confirm_optid", currentUserId);
|
||||
jsonReMst.put("confirm_optname", nickName);
|
||||
jsonReMst.put("confirm_time", now);
|
||||
reMstTab.update(jsonReMst);
|
||||
}
|
||||
/*
|
||||
* 如果到货单主表状态为确认,则需要更新采购订单接口处理表
|
||||
*/
|
||||
if (StrUtil.equals(jsonReMst.getString("status"), ReceiveStatusEnum.AFFIRM.getCode())) {
|
||||
JSONObject jsonProc = procTab.query("id = '" + jsonReDtl.getString("source_billdtl_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonProc)) throw new BadRequestException("订单不存在");
|
||||
// 到货数量 = 订单数量,为完成,否则为采购中
|
||||
if ((jsonReDtl.getDoubleValue("instor_qty") >= jsonProc.getDoubleValue("qty")) && (StrUtil.equals(jsonReDtl.getString("status"), "99"))) {
|
||||
jsonProc.put("proc_status", ProcStatusEnum.FULFILL.getCode());
|
||||
} else {
|
||||
jsonProc.put("proc_status", ProcStatusEnum.BUYING_CENTER.getCode());
|
||||
}
|
||||
procTab.update(jsonProc);
|
||||
jsonProc.put("proc_status", ProcStatusEnum.BUYING_CENTER.getCode());
|
||||
}
|
||||
procTab.update(jsonProc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.wms.st.core.service.impl;
|
||||
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.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -13,6 +14,7 @@ import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.pcs.Enum.ProcStatusEnum;
|
||||
import org.nl.wms.pcs.Enum.ReceiveStatusEnum;
|
||||
import org.nl.wms.st.core.service.StorPublicService;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -311,53 +313,74 @@ public class InbillServiceImpl {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(flag){
|
||||
JSONObject jsonReDtl = reDtlTab.query("receivedtl_id = '" + jo.getString("source_billdtl_id") + "'").uniqueResult(0);
|
||||
if(jsonReDtl!=null){
|
||||
// 如果是合格或者是放行就存入 入库数
|
||||
jsonReDtl.put("instor_qty", jo.getDoubleValue("real_qty")+jsonReDtl.getDouble("instor_qty"));
|
||||
//判断到货明细表中的数量与到货入库数是否相等,相同就完成,不相等就到货中
|
||||
if (jsonReDtl.getDoubleValue("receive_qty") <= jsonReDtl.getDoubleValue("instor_qty")) {
|
||||
jsonReDtl.put("status", ReceiveStatusEnum.AFFIRM.getCode());
|
||||
} else {
|
||||
jsonReDtl.put("status", ReceiveStatusEnum.ARRIVAL_NOTICE.getCode());
|
||||
}
|
||||
reDtlTab.update(jsonReDtl);
|
||||
}
|
||||
|
||||
/*
|
||||
* 判断到货明细单中的状态是否完成,全部完成则更新到货通知单主表完成
|
||||
* 更新到货通知单明细表
|
||||
*/
|
||||
JSONArray reDtlArr = reDtlTab.query("receive_id = '" + jsonReDtl.getString("receive_id") + "'").getResultJSONArray(0);
|
||||
int flag2 = 0;
|
||||
for (int j = 0; j < reDtlArr.size(); j++) {
|
||||
JSONObject json1 = reDtlArr.getJSONObject(j);
|
||||
if (StrUtil.equals(json1.getString("status"), ReceiveStatusEnum.AFFIRM.getCode())) {
|
||||
flag2 = flag2 + 1;
|
||||
JSONArray ivtDtlArr = WQL.getWO("QL_TEST_INSPECTIONSHEET002")
|
||||
.addParam("flag", "2")
|
||||
.addParam("material_id", jo.getString("material_id"))
|
||||
.addParam("pcsn", jo.getString("pcsn"))
|
||||
.process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(ivtDtlArr)) {
|
||||
for (int j = 0; j < ivtDtlArr.size(); j++) {
|
||||
JSONObject json = ivtDtlArr.getJSONObject(j);
|
||||
JSONObject jsonReDtl = reDtlTab.query("receivedtl_id = '" + json.getString("source_billdtl_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonReDtl)) {
|
||||
throw new BadRequestException("找不到到货通知单明细");
|
||||
}
|
||||
if ("99".equals(jsonReDtl.getString("status"))) {
|
||||
continue;
|
||||
}
|
||||
// 如果是合格或者是放行就存入 入库数
|
||||
jsonReDtl.put("instor_qty", json.getDoubleValue("real_qty"));
|
||||
//判断到货明细表中的数量与到货入库数是否相等,相同就完成,不相等就到货中
|
||||
if (jsonReDtl.getDoubleValue("receive_qty") <= jsonReDtl.getDoubleValue("instor_qty")) {
|
||||
jsonReDtl.put("status", ReceiveStatusEnum.AFFIRM.getCode());
|
||||
} else {
|
||||
jsonReDtl.put("status", ReceiveStatusEnum.ARRIVAL_NOTICE.getCode());
|
||||
}
|
||||
reDtlTab.update(jsonReDtl);
|
||||
/*
|
||||
* 判断到货明细单中的状态是否完成,全部完成则更新到货通知单主表完成
|
||||
*/
|
||||
JSONArray reDtlArr = reDtlTab.query("receive_id = '" + jsonReDtl.getString("receive_id") + "'").getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(reDtlArr)) {
|
||||
throw new BadRequestException("到货单明细不存在!");
|
||||
}
|
||||
int flag2 = 0;
|
||||
for (int m = 0; m < reDtlArr.size(); m++) {
|
||||
JSONObject json1 = reDtlArr.getJSONObject(m);
|
||||
if (StrUtil.equals(json1.getString("status"), ReceiveStatusEnum.AFFIRM.getCode())) {
|
||||
flag2 = flag2 + 1;
|
||||
}
|
||||
}
|
||||
JSONObject jsonReMst = reMstTab.query("receive_id = '" + jsonReDtl.getString("receive_id") + "'").uniqueResult(0);
|
||||
if (reDtlArr.size() == flag2) {
|
||||
jsonReMst.put("status", ReceiveStatusEnum.AFFIRM.getCode());
|
||||
jsonReMst.put("confirm_optid", currentUserId);
|
||||
jsonReMst.put("confirm_optname", nickName);
|
||||
jsonReMst.put("confirm_time", now);
|
||||
reMstTab.update(jsonReMst);
|
||||
}
|
||||
/*
|
||||
* 如果到货单主表状态为确认,则需要更新采购订单接口处理表
|
||||
*/
|
||||
if (StrUtil.equals(jsonReMst.getString("status"), ReceiveStatusEnum.AFFIRM.getCode())) {
|
||||
JSONObject jsonProc = procTab.query("id = '" + jsonReDtl.getString("source_billdtl_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonProc)) {
|
||||
throw new BadRequestException("订单不存在");
|
||||
}
|
||||
// 到货数量 = 订单数量,为完成,否则为采购中
|
||||
if ((jsonReDtl.getDoubleValue("instor_qty") >= jsonProc.getDoubleValue("qty")) && (StrUtil.equals(jsonReDtl.getString("status"), "99"))) {
|
||||
jsonProc.put("proc_status", ProcStatusEnum.FULFILL.getCode());
|
||||
} else {
|
||||
jsonProc.put("proc_status", ProcStatusEnum.BUYING_CENTER.getCode());
|
||||
}
|
||||
procTab.update(jsonProc);
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject jsonReMst = reMstTab.query("receive_id = '" + jsonReDtl.getString("receive_id") + "'").uniqueResult(0);
|
||||
if (reDtlArr.size() == flag2) {
|
||||
jsonReMst.put("status", ReceiveStatusEnum.AFFIRM.getCode());
|
||||
jsonReMst.put("confirm_optid", currentUserId);
|
||||
jsonReMst.put("confirm_optname", nickName);
|
||||
jsonReMst.put("confirm_time", now);
|
||||
reMstTab.update(jsonReMst);
|
||||
}
|
||||
/*
|
||||
* 如果到货单主表状态为确认,则需要更新采购订单接口处理表
|
||||
*/
|
||||
if (StrUtil.equals(jsonReMst.getString("status"), ReceiveStatusEnum.AFFIRM.getCode())) {
|
||||
JSONObject jsonProc = procTab.query("id = '" + jsonReDtl.getString("source_billdtl_id") + "'").uniqueResult(0);
|
||||
// 到货数量 = 订单数量,为完成,否则为采购中
|
||||
if ((jsonReDtl.getDoubleValue("instor_qty") >= jsonProc.getDoubleValue("qty")) && (StrUtil.equals(jsonReDtl.getString("status"), "99"))) {
|
||||
jsonProc.put("proc_status", ProcStatusEnum.FULFILL.getCode());
|
||||
} else {
|
||||
jsonProc.put("proc_status", ProcStatusEnum.BUYING_CENTER.getCode());
|
||||
}
|
||||
procTab.update(jsonProc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user