This commit is contained in:
2022-12-01 10:16:21 +08:00
parent 3c6b6b1c45
commit b4f1ee22c2
4 changed files with 119 additions and 1 deletions

View File

@@ -49,7 +49,7 @@
SELECT
sub.product_name AS material_code,
sub.product_description AS material_name,
sub.container_name AS pcsn,
sub.sap_pcsn AS pcsn,
sub.sale_order_name AS mfgordername,
sub.customer_name AS customername,
sub.customer_description AS customerdescription,

View File

@@ -54,6 +54,7 @@
WHEN '1001' THEN '发货出库'
WHEN '1002' THEN '报废出库'
WHEN '1003' THEN '改切出库'
WHEN '1004' THEN '调拨出库'
WHEN '1009' THEN '手工出库'
END
) AS bill_type_name,

View File

@@ -274,6 +274,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
map.put("update_time", now);
map.put("is_delete", "0");
map.put("is_upload", "0");
map.put("out_stor_id",map.getString("out_stor_id"));
if (ObjectUtil.isNotEmpty(user)) {
if (!user.equals("mes") || user.equals("sap")) {
Long deptId = SecurityUtils.getDeptId();
@@ -1934,6 +1935,88 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
subTab.update(jsonSub);
}
JSONObject out_jo = WQLObject.getWQLObject("ST_IVT_IOStorInv").query("iostorinv_id = '"+iostorinv_id+"'").uniqueResult(0);
if (out_jo.getString("bill_type").equals("1004")){
//调拨出库自动生成调拨入库单
WQLObject dtl_wql = WQLObject.getWQLObject("st_ivt_iostorinvdtl");
WQLObject mst_wql = WQLObject.getWQLObject("ST_IVT_IOStorInv");
WQLObject dis_wql = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
//校验主表状态为生成
if (!out_jo.getString("bill_status").equals("99")) {
throw new BadRequestException("主表状态必须为完成!");
}
JSONObject mst_row = mst_wql.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
JSONArray dis_rows = dis_wql.query("iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0);
//生成手工入库单
String new_iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
String bill_code = CodeUtil.getNewCode("IO_CODE");
jo_mst.put("iostorinv_id", new_iostorinv_id);
jo_mst.put("bill_code", bill_code);
jo_mst.put("io_type", "0");
jo_mst.put("bill_type", "0004");
jo_mst.put("buss_type", ((String) jo_mst.get("bill_type")).substring(0, 4));
//查询移入仓库的信息
JSONObject in_stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id = '"+out_jo.getString("out_stor_id")+"'").uniqueResult(0);
if (ObjectUtil.isEmpty(in_stor)){
throw new BadRequestException("未查询到对应的移入仓库信息!");
}
jo_mst.put("stor_id",in_stor.getString("stor_id"));
jo_mst.put("stor_code",in_stor.getString("stor_code"));
jo_mst.put("stor_name",in_stor.getString("stor_name"));
jo_mst.put("bill_status", "30");
jo_mst.put("input_optid", currentUserId + "");
jo_mst.put("input_optname", nickName);
jo_mst.put("input_time", now);
jo_mst.put("update_optid", currentUserId + "");
jo_mst.put("update_optname", nickName);
jo_mst.put("update_time", now);
jo_mst.put("out_stor_id", "");
mst_wql.insert(jo_mst);
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 dtl_row = dtl_wql.query("iostorinvdtl_id = '" + dis_row.getString("iostorinvdtl_id") + "'").uniqueResult(0);
dis_row.put("iostorinvdtl_id", iostorinvdtl_id);
dis_row.put("iostorinv_id", new_iostorinv_id);
dis_row.put("seq_no", i + 1);
dis_row.put("bill_status", "30");
dis_row.put("real_qty", "0");
dis_row.put("source_billdtl_id", dtl_row.getString("iostorinvdtl_id"));
dis_row.put("source_bill_type", mst_row.getString("bill_type"));
dis_row.put("source_bill_code", mst_row.getString("bill_code"));
dis_row.put("source_bill_table", "ST_IVT_IOStorInvDtl");
dis_row.put("assign_qty", dis_row.getString("plan_qty"));
dis_row.put("unassign_qty", "0");
//插入调拨明细表
dtl_wql.insert(dis_row);
dis_row.put("iostorinvdis_id", IdUtil.getSnowflake(1, 1).nextId());
dis_row.put("seq_no", 1);
dis_row.put("sect_id", "");
dis_row.put("sect_code", "");
dis_row.put("sect_name", "");
dis_row.put("struct_id", "");
dis_row.put("struct_code", "");
dis_row.put("struct_name", "");
dis_row.put("work_status", "00");
dis_row.put("real_qty", "0");
//插入分配表
dis_wql.insert(dis_row);
//将包装关系中对应的记录状态改为包装
HashMap<String, String> map = new HashMap<>();
map.put("status", "1");
WQLObject.getWQLObject("PDM_BI_SubPackageRelation").update(map, "package_box_SN = '" + dis_row.getString("box_no") + "' AND status = '3'");
}
}
/*
* 回传:
* 销售出库sap、mes