Merge branch 'master' of http://121.40.234.130:8899/root/lanzhouhailiang_one
This commit is contained in:
@@ -21,9 +21,12 @@ import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl;
|
||||
import org.nl.wms.st.inbill.service.OutChargeService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
@@ -73,10 +76,12 @@ public class OutChargeServiceImpl implements OutChargeService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void charge(Map whereJson) {
|
||||
WQLObject dtl_wql = WQLObject.getWQLObject("st_ivt_iostorinvdtl");
|
||||
WQLObject mst_wql = WQLObject.getWQLObject("ST_IVT_IOStorInv");
|
||||
WQLObject dis_wql = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
|
||||
WQLObject ivtTab = WQLObject.getWQLObject("st_ivt_structivt");
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
@@ -128,10 +133,19 @@ public class OutChargeServiceImpl implements OutChargeService {
|
||||
whereJson.put("upload_sap", "");
|
||||
mst_wql.insert(whereJson);
|
||||
|
||||
ArrayList<String> ivtList = new ArrayList<>(); // 存在库存的集合
|
||||
for (int i = 0; i < dis_rows.size(); i++) {
|
||||
//插入明细表
|
||||
String iostorinvdtl_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
JSONObject dis_row = dis_rows.getJSONObject(i);
|
||||
|
||||
// 校验是否存在库存
|
||||
JSONObject jsonIvt = ivtTab.query("pcsn = '" + dis_row.getString("pcsn") + "'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonIvt)) {
|
||||
ivtList.add(jsonIvt.getString("pcsn"));
|
||||
}
|
||||
|
||||
//查询对应的出库单明细
|
||||
JSONObject dtl_row = dtl_wql.query("iostorinvdtl_id = '" + dis_row.getString("iostorinvdtl_id") + "'").uniqueResult(0);
|
||||
dis_row.put("iostorinvdtl_id", iostorinvdtl_id);
|
||||
@@ -174,6 +188,13 @@ public class OutChargeServiceImpl implements OutChargeService {
|
||||
WQLObject.getWQLObject("PDM_BI_SubPackageRelation").update(map, "package_box_SN = '" + dis_row.getString("box_no") + "'");
|
||||
}
|
||||
}
|
||||
|
||||
// 判断是否存在库存
|
||||
if (ivtList.size() > 0) {
|
||||
String msg = String.join(",", ivtList);
|
||||
throw new BadRequestException("此子卷已存在库存:"+msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* PC端出入库新增
|
||||
@@ -64,7 +65,27 @@ public class CheckServiceImpl implements CheckService {
|
||||
JSONObject jo = WQL.getWO("QST_IVT_CHECK").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "check_code desc");
|
||||
JSONArray content = jo.getJSONArray("content");
|
||||
|
||||
// 拼接主表id
|
||||
String check_id = content.stream()
|
||||
.map(row -> (JSONObject) row)
|
||||
.map(row -> row.getString("check_id"))
|
||||
.collect(Collectors.joining(","));
|
||||
|
||||
JSONArray resultJSONArray = WQL.getWO("QST_IVT_CHECK").addParam("flag", "13").addParam("check_id_in", "(" + check_id + ")").process().getResultJSONArray(0);
|
||||
|
||||
for (int i = 0; i < content.size(); i++) {
|
||||
JSONObject json = content.getJSONObject(i);
|
||||
|
||||
// 匹配相同check_id的数据条数
|
||||
int pcsn_num = (int) resultJSONArray.stream()
|
||||
.map(row -> (JSONObject) row)
|
||||
.filter(row -> row.getString("check_id").equals(json.getString("check_id")))
|
||||
.count();
|
||||
|
||||
json.put("pcsn_num",pcsn_num);
|
||||
}
|
||||
|
||||
/* for (int i = 0; i < content.size(); i++) {
|
||||
int pcsn_num = 0;
|
||||
|
||||
JSONObject jsonObject = content.getJSONObject(i);
|
||||
@@ -77,7 +98,7 @@ public class CheckServiceImpl implements CheckService {
|
||||
pcsn_num += boxNum.size();
|
||||
}
|
||||
jsonObject.put("pcsn_num",pcsn_num);
|
||||
}
|
||||
}*/
|
||||
return jo;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
输入.box_no TYPEAS s_string
|
||||
输入.deptIds TYPEAS f_string
|
||||
输入.in_stor_id TYPEAS f_string
|
||||
输入.check_id_in TYPEAS f_string
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
@@ -567,3 +568,22 @@
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "13"
|
||||
QUERY
|
||||
SELECT
|
||||
sub.*,
|
||||
dtl.check_id
|
||||
FROM
|
||||
pdm_bi_subpackagerelation sub
|
||||
LEFT JOIN st_ivt_checkdtl dtl ON sub.package_box_sn = dtl.storagevehicle_code
|
||||
WHERE
|
||||
1 = 1
|
||||
|
||||
OPTION 输入.check_id_in <> ""
|
||||
dtl.check_id in 输入.check_id_in
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -5014,7 +5014,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
order_no = jsonSub.getString("sale_order_name");
|
||||
|
||||
// 规格: 厚度*幅宽
|
||||
String material_spec = jsonSub.getString("thickness_request") + "*" + jsonSub.getString("width");
|
||||
String material_spec = jsonSub.getString("thickness_request") + "*" + jsonSub.getString("width_standard");
|
||||
// 箱号
|
||||
String box_no = json.getString("box_no");
|
||||
String sub_box_no = "";
|
||||
@@ -5073,7 +5073,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
order_no = jsonSub.getString("sale_order_name");
|
||||
|
||||
// 规格: 厚度*幅宽
|
||||
String material_spec = jsonSub.getString("thickness_request") + "*" + jsonSub.getString("width");
|
||||
String material_spec = jsonSub.getString("thickness_request") + "*" + jsonSub.getString("width_standard");
|
||||
// 箱号
|
||||
String box_no = json.getString("box_no");
|
||||
String sub_box_no = "";
|
||||
|
||||
@@ -553,22 +553,24 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
// 调拨入库
|
||||
if (StrUtil.equals(bill_type, "0004")) {
|
||||
// 回传sap
|
||||
JSONObject param = new JSONObject();
|
||||
|
||||
JSONArray paramSapMstArr = new JSONArray();
|
||||
JSONArray disArr = wo_dis.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0);
|
||||
JSONObject jsonDtl = wo_dtl.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||
|
||||
param.put("ZDBSQD",jsonDtl.getString("vbeln"));
|
||||
param.put("LGORT2", jo_mst.getString("stor_code"));
|
||||
JSONObject jsonStorOut = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id = '" + jo_mst.getString("out_stor_id") + "'").uniqueResult(0);
|
||||
param.put("LGORT1", jsonStorOut.getString("stor_code"));
|
||||
|
||||
for (int j = 0; j < disArr.size(); j++) {
|
||||
JSONObject jsonDis = disArr.getJSONObject(j);
|
||||
JSONObject paramDis = new JSONObject();
|
||||
paramDis.put("ZDBSQD", jsonDtl.getString("vbeln"));
|
||||
paramDis.put("ZVBELN", jsonDtl.getString("source_bill_code"));
|
||||
|
||||
JSONObject jsonMater = materTab.query("material_id = '" + jsonDis.getString("material_id") + "'").uniqueResult(0);
|
||||
paramDis.put("MATNR", jsonMater.getString("material_code"));
|
||||
paramDis.put("LGORT2", jo_mst.getString("stor_code"));
|
||||
|
||||
JSONObject jsonStorOut = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id = '" + jo_mst.getString("out_stor_id") + "'").uniqueResult(0);
|
||||
paramDis.put("LGORT1", jsonStorOut.getString("stor_code"));
|
||||
|
||||
JSONObject jsonSub = subTab.query("container_name = '" + jsonDis.getString("pcsn") + "'").uniqueResult(0);
|
||||
paramDis.put("ZHL02", jsonSub.getString("width"));
|
||||
@@ -578,8 +580,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
paramDis.put("WERKS", "2460");
|
||||
paramSapMstArr.add(paramDis);
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("HEAD", paramSapMstArr);
|
||||
param.put("ITEM", paramSapMstArr);
|
||||
System.out.println(param.toString());
|
||||
|
||||
// 调用接口回传
|
||||
@@ -900,22 +901,24 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
// 调拨入库
|
||||
if (StrUtil.equals(bill_type, "0004")) {
|
||||
// 回传sap
|
||||
JSONObject param = new JSONObject();
|
||||
|
||||
JSONArray paramSapMstArr = new JSONArray();
|
||||
JSONArray disArr = wo_dis.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0);
|
||||
JSONObject jsonDtl = wo_dtl.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||
|
||||
param.put("ZDBSQD",jsonDtl.getString("vbeln"));
|
||||
param.put("LGORT2", jo_mst.getString("stor_code"));
|
||||
JSONObject jsonStorOut = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id = '" + jo_mst.getString("out_stor_id") + "'").uniqueResult(0);
|
||||
param.put("LGORT1", jsonStorOut.getString("stor_code"));
|
||||
|
||||
for (int j = 0; j < disArr.size(); j++) {
|
||||
JSONObject jsonDis = disArr.getJSONObject(j);
|
||||
JSONObject paramDis = new JSONObject();
|
||||
paramDis.put("ZDBSQD", jsonDtl.getString("vbeln"));
|
||||
paramDis.put("ZVBELN", jsonDtl.getString("source_bill_code"));
|
||||
|
||||
JSONObject jsonMater = materTab.query("material_id = '" + jsonDis.getString("material_id") + "'").uniqueResult(0);
|
||||
paramDis.put("MATNR", jsonMater.getString("material_code"));
|
||||
paramDis.put("LGORT2", jo_mst.getString("stor_code"));
|
||||
|
||||
JSONObject jsonStorOut = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id = '" + jo_mst.getString("out_stor_id") + "'").uniqueResult(0);
|
||||
paramDis.put("LGORT1", jsonStorOut.getString("stor_code"));
|
||||
|
||||
JSONObject jsonSub = subTab.query("container_name = '" + jsonDis.getString("pcsn") + "'").uniqueResult(0);
|
||||
paramDis.put("ZHL02", jsonSub.getString("width"));
|
||||
@@ -925,8 +928,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
paramDis.put("WERKS", "2460");
|
||||
paramSapMstArr.add(paramDis);
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("HEAD", paramSapMstArr);
|
||||
param.put("ITEM", paramSapMstArr);
|
||||
System.out.println(param.toString());
|
||||
|
||||
// 调用接口回传
|
||||
|
||||
@@ -96,7 +96,23 @@
|
||||
END AS confirm_time_class
|
||||
|
||||
FROM
|
||||
st_ivt_iostorinvdis dis
|
||||
(
|
||||
SELECT
|
||||
pcsn,
|
||||
MAX(iostorinv_id) AS iostorinv_id,
|
||||
MAX(sect_id) AS sect_id,
|
||||
MAX(material_id) AS material_id,
|
||||
MAX(box_no) AS box_no,
|
||||
MAX(sect_name) AS sect_name,
|
||||
MAX(struct_code) AS struct_code,
|
||||
MAX(struct_name) AS struct_name,
|
||||
MAX(qty_unit_name) AS qty_unit_name
|
||||
FROM
|
||||
st_ivt_iostorinvdis
|
||||
WHERE
|
||||
1 = 1
|
||||
GROUP BY pcsn
|
||||
) AS dis
|
||||
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
|
||||
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = dis.sect_id
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id
|
||||
@@ -194,7 +210,23 @@
|
||||
END AS confirm_time_class
|
||||
|
||||
FROM
|
||||
st_ivt_iostorinvdis dis
|
||||
(
|
||||
SELECT
|
||||
pcsn,
|
||||
MAX(iostorinv_id) AS iostorinv_id,
|
||||
MAX(sect_id) AS sect_id,
|
||||
MAX(material_id) AS material_id,
|
||||
MAX(box_no) AS box_no,
|
||||
MAX(sect_name) AS sect_name,
|
||||
MAX(struct_code) AS struct_code,
|
||||
MAX(struct_name) AS struct_name,
|
||||
MAX(qty_unit_name) AS qty_unit_name
|
||||
FROM
|
||||
st_ivt_iostorinvdis
|
||||
WHERE
|
||||
1 = 1
|
||||
GROUP BY pcsn
|
||||
) AS dis
|
||||
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
|
||||
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = dis.sect_id
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id
|
||||
@@ -304,7 +336,23 @@
|
||||
END AS confirm_time_class
|
||||
|
||||
FROM
|
||||
st_ivt_iostorinvdis dis
|
||||
(
|
||||
SELECT
|
||||
pcsn,
|
||||
MAX(iostorinv_id) AS iostorinv_id,
|
||||
MAX(sect_id) AS sect_id,
|
||||
MAX(material_id) AS material_id,
|
||||
MAX(box_no) AS box_no,
|
||||
MAX(sect_name) AS sect_name,
|
||||
MAX(struct_code) AS struct_code,
|
||||
MAX(struct_name) AS struct_name,
|
||||
MAX(qty_unit_name) AS qty_unit_name
|
||||
FROM
|
||||
st_ivt_iostorinvdis
|
||||
WHERE
|
||||
1 = 1
|
||||
GROUP BY pcsn
|
||||
) AS dis
|
||||
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
|
||||
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = dis.sect_id
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id
|
||||
@@ -404,7 +452,23 @@
|
||||
END AS confirm_time_class
|
||||
|
||||
FROM
|
||||
st_ivt_iostorinvdis dis
|
||||
(
|
||||
SELECT
|
||||
pcsn,
|
||||
MAX(iostorinv_id) AS iostorinv_id,
|
||||
MAX(sect_id) AS sect_id,
|
||||
MAX(material_id) AS material_id,
|
||||
MAX(box_no) AS box_no,
|
||||
MAX(sect_name) AS sect_name,
|
||||
MAX(struct_code) AS struct_code,
|
||||
MAX(struct_name) AS struct_name,
|
||||
MAX(qty_unit_name) AS qty_unit_name
|
||||
FROM
|
||||
st_ivt_iostorinvdis
|
||||
WHERE
|
||||
1 = 1
|
||||
GROUP BY pcsn
|
||||
) AS dis
|
||||
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
|
||||
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = dis.sect_id
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id
|
||||
|
||||
Reference in New Issue
Block a user