代码更新
This commit is contained in:
@@ -138,13 +138,13 @@ public class PrintServiceImpl implements PrintService {
|
||||
+ width + ","
|
||||
+ pcsn + ","
|
||||
+ date_of_FG_inbound + ","
|
||||
+ box_weight + ","
|
||||
+ box_weight + "KG,"
|
||||
+ date_of_production + ","
|
||||
+ quanlity_in_box + ","
|
||||
+ quality_guaran_period + ","
|
||||
+ nspector + ","
|
||||
+ storage_conditions + ","
|
||||
+ NumberUtil.round(weight,2).toString() + ","
|
||||
+ NumberUtil.round(weight,2).toString() + "KG,"
|
||||
+ box_jo.getString("customer_name") + ","
|
||||
+ box_jo.getString("customer_description") + ","
|
||||
+ box_jo.getString("thickness") + ","
|
||||
|
||||
@@ -193,6 +193,7 @@ public class InchargeServiceImpl implements InchargeService {
|
||||
WQLObject disTab = WQLObject.getWQLObject("ST_IVT_IOStorInvDis"); // 出入库分配表
|
||||
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt"); // 仓位库存表
|
||||
WQLObject attrTab = WQLObject.getWQLObject("ST_IVT_StructAttr"); // 仓位表
|
||||
WQLObject wo_sect = WQLObject.getWQLObject("st_ivt_sectattr"); // 库区表
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
@@ -274,7 +275,8 @@ public class InchargeServiceImpl implements InchargeService {
|
||||
jsonOutDis.put("box_no", json2.getString("box_no"));
|
||||
jsonOutDis.put("quality_scode", "01");
|
||||
// 如果是虚拟库区则将执行状态改为生成:01
|
||||
if (StrUtil.equals(jsonOutDis.getString("sect_code"), "XN01")) {
|
||||
JSONObject jsonSect = wo_sect.query("sect_id = '" + json2.getString("sect_id") + "'").uniqueResult(0);
|
||||
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
|
||||
jsonOutDis.put("work_status", "01");
|
||||
} else {
|
||||
jsonOutDis.put("work_status", "00");
|
||||
|
||||
@@ -700,6 +700,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl");
|
||||
//出库主表
|
||||
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv");
|
||||
//库区表
|
||||
WQLObject wo_sect = WQLObject.getWQLObject("st_ivt_sectattr");
|
||||
|
||||
//定义需要更新的仓位集合
|
||||
HashMap<String, JSONObject> Struct_map = new HashMap<String, JSONObject>();
|
||||
@@ -803,7 +805,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
dtl.put("plan_qty", ivt2.getDoubleValue("change_qty"));
|
||||
dtl.put("real_qty", ivt2.getDoubleValue("change_qty"));
|
||||
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
|
||||
if (StrUtil.equals(ivt2.getString("sect_code"), "XN01")) {
|
||||
JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt2.getString("sect_id") + "'").uniqueResult(0);
|
||||
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
|
||||
dtl.put("work_status", "01");
|
||||
} else {
|
||||
dtl.put("work_status", "00");
|
||||
@@ -857,7 +860,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
dtl.put("plan_qty", jsonIvt.getDoubleValue("change_qty"));
|
||||
dtl.put("real_qty", jsonIvt.getDoubleValue("change_qty"));
|
||||
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
|
||||
if (StrUtil.equals(jsonIvt.getString("sect_code"), "XN01")) {
|
||||
JSONObject jsonSect = wo_sect.query("sect_id = '" + jsonIvt.getString("sect_id") + "'").uniqueResult(0);
|
||||
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
|
||||
dtl.put("work_status", "01");
|
||||
} else {
|
||||
dtl.put("work_status", "00");
|
||||
@@ -914,6 +918,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl");
|
||||
//出库主表
|
||||
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv");
|
||||
//库区表
|
||||
WQLObject wo_sect = WQLObject.getWQLObject("ST_IVT_IOStorInv");
|
||||
|
||||
//定义需要更新的仓位集合
|
||||
HashMap<String, JSONObject> Struct_map = new HashMap<String, JSONObject>();
|
||||
@@ -1016,7 +1022,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
dtl.put("plan_qty", ivt2.getDoubleValue("change_qty"));
|
||||
dtl.put("real_qty", ivt2.getDoubleValue("change_qty"));
|
||||
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
|
||||
if (StrUtil.equals(ivt2.getString("sect_code"), "XN01")) {
|
||||
JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt2.getString("sect_id") + "'").uniqueResult(0);
|
||||
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
|
||||
dtl.put("work_status", "01");
|
||||
} else {
|
||||
dtl.put("work_status", "00");
|
||||
@@ -1070,7 +1077,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
dtl.put("plan_qty", jsonIvt.getDoubleValue("change_qty"));
|
||||
dtl.put("real_qty", jsonIvt.getDoubleValue("change_qty"));
|
||||
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
|
||||
if (StrUtil.equals(jsonIvt.getString("sect_code"), "XN01")) {
|
||||
JSONObject jsonSect = wo_sect.query("sect_id = '" + jsonIvt.getString("sect_id") + "'").uniqueResult(0);
|
||||
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
|
||||
dtl.put("work_status", "01");
|
||||
} else {
|
||||
dtl.put("work_status", "00");
|
||||
@@ -1132,7 +1140,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
json.put("plan_qty", ivt.getDoubleValue("change_qty"));
|
||||
json.put("real_qty", ivt.getDoubleValue("change_qty"));
|
||||
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
|
||||
if (StrUtil.equals(ivt.getString("sect_code"), "XN01")) {
|
||||
JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt.getString("sect_id") + "'").uniqueResult(0);
|
||||
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
|
||||
json.put("work_status", "01");
|
||||
} else {
|
||||
json.put("work_status", "00");
|
||||
@@ -1779,6 +1788,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl");
|
||||
//出库主表
|
||||
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv");
|
||||
//库区表
|
||||
WQLObject wo_sect = WQLObject.getWQLObject("st_ivt_sectattr");
|
||||
|
||||
//定义需要更新的仓位集合
|
||||
HashMap<String, JSONObject> Struct_map = new HashMap<>();
|
||||
@@ -1804,8 +1815,28 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
throw new BadRequestException("当前订单无可分配出库明细");
|
||||
}
|
||||
|
||||
// 判断此明细是否有相同仓位的明细:如果没有则将此仓位下的所有库存出出来
|
||||
JSONArray jsonDtl = wo_dtl.query("iostorinv_id = '"+iostorinv_id+"' and material_id = '"+dtl.getString("material_id")+"' and source_bill_code = '"+dtl.getString("source_bill_code")+"'").getResultJSONArray(0);
|
||||
// 判断此明细是否有子卷号:没有则过滤箱号、将此箱子里的所有子卷带出来
|
||||
if (ObjectUtil.isEmpty(dtl.getString("pcsn"))) {
|
||||
HashSet<String> boxSet = new HashSet<>();
|
||||
JSONArray boxArr = new JSONArray();
|
||||
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject json = rows.getJSONObject(i);
|
||||
boxSet.add(json.getString("storagevehicle_code"));
|
||||
}
|
||||
|
||||
for (String box_no : boxSet) {
|
||||
JSONArray boxIvtArr = WQL.getWO("QST_IVT_CHECKOUTBILL")
|
||||
.addParam("flag", "3")
|
||||
.addParam("box_no", box_no)
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
|
||||
boxArr.addAll(boxIvtArr);
|
||||
}
|
||||
rows.clear();
|
||||
rows.addAll(boxArr);
|
||||
}
|
||||
|
||||
double assign_qty = dtl.getDoubleValue("assign_qty");
|
||||
double unassign_qty = dtl.getDoubleValue("unassign_qty");
|
||||
@@ -1848,7 +1879,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
dtl.put("plan_qty", ivt.getDoubleValue("change_qty"));
|
||||
dtl.put("real_qty", ivt.getDoubleValue("change_qty"));
|
||||
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
|
||||
if (StrUtil.equals(ivt.getString("sect_code"), "XN01")) {
|
||||
JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt.getString("sect_id") + "'").uniqueResult(0);
|
||||
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
|
||||
dtl.put("work_status", "01");
|
||||
} else {
|
||||
dtl.put("work_status", "00");
|
||||
@@ -1873,246 +1905,62 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
}
|
||||
|
||||
// 判断是否还有相同物料相同仓位的明细
|
||||
JSONObject jsonMap = new JSONObject();
|
||||
jsonMap.put("flag", "4");
|
||||
jsonMap.put("material_id", dtl.getString("material_id"));
|
||||
jsonMap.put("iostorinv_id", iostorinv_id);
|
||||
jsonMap.put("iostorinvdtl_id", whereJson.getString("iostorinvdtl_id"));
|
||||
if (ObjectUtil.isNotEmpty(dtl.getString("pcsn"))) {
|
||||
JSONObject jsonMap = new JSONObject();
|
||||
jsonMap.put("flag", "4");
|
||||
jsonMap.put("material_id", dtl.getString("material_id"));
|
||||
jsonMap.put("iostorinv_id", iostorinv_id);
|
||||
jsonMap.put("iostorinvdtl_id", whereJson.getString("iostorinvdtl_id"));
|
||||
|
||||
JSONArray dtlArr = WQL.getWO("ST_OUTIVT01").addParamMap(jsonMap).process().getResultJSONArray(0);
|
||||
for (int i = 0; i < dtlArr.size(); i++) {
|
||||
JSONObject json = dtlArr.getJSONObject(i);
|
||||
JSONArray dtlArr = WQL.getWO("ST_OUTIVT01").addParamMap(jsonMap).process().getResultJSONArray(0);
|
||||
for (int i = 0; i < dtlArr.size(); i++) {
|
||||
JSONObject json = dtlArr.getJSONObject(i);
|
||||
|
||||
JSONObject ivt = WQL.getWO("ST_OUTIVT01")
|
||||
.addParam("flag", "1")
|
||||
.addParam("material_id", json.getString("material_id"))
|
||||
.addParam("pcsn", json.getString("pcsn"))
|
||||
.process().uniqueResult(0);
|
||||
JSONObject ivt = WQL.getWO("ST_OUTIVT01")
|
||||
.addParam("flag", "1")
|
||||
.addParam("material_id", json.getString("material_id"))
|
||||
.addParam("pcsn", json.getString("pcsn"))
|
||||
.process().uniqueResult(0);
|
||||
|
||||
//更新库存
|
||||
ivt.put("change_qty", ivt.getDoubleValue("canuse_qty"));
|
||||
ivt.put("bill_type_scode", jo_mst.getString("bill_type"));
|
||||
ivt.put("inv_id", json.getString("iostorinv_id"));
|
||||
ivt.put("bill_code", jo_mst.getString("bill_code"));
|
||||
ivt.put("bill_table", "ST_IVT_IOStorInv");
|
||||
storPublicService.IOStor(ivt, "11");
|
||||
//生成分配明细
|
||||
json.put("iostorinvdis_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("sect_id", ivt.getString("sect_id"));
|
||||
json.put("sect_code", ivt.getString("sect_code"));
|
||||
json.put("sect_name", ivt.getString("sect_name"));
|
||||
json.put("struct_id", ivt.getString("struct_id"));
|
||||
json.put("struct_code", ivt.getString("struct_code"));
|
||||
json.put("struct_name", ivt.getString("struct_name"));
|
||||
json.put("pcsn", ivt.getString("pcsn"));
|
||||
json.put("box_no", ivt.getString("storagevehicle_code"));
|
||||
json.put("storagevehicle_id", ivt.getString("storagevehicle_id"));
|
||||
json.put("storagevehicle_code", ivt.getString("storagevehicle_code"));
|
||||
json.put("storagevehicle_type", ivt.getString("storagevehicle_type"));
|
||||
json.put("is_issued", "0");
|
||||
json.put("plan_qty", ivt.getDoubleValue("change_qty"));
|
||||
json.put("real_qty", ivt.getDoubleValue("change_qty"));
|
||||
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
|
||||
if (StrUtil.equals(ivt.getString("sect_code"), "XN01")) {
|
||||
json.put("work_status", "01");
|
||||
} else {
|
||||
json.put("work_status", "00");
|
||||
}
|
||||
wo_dis.insert(json);
|
||||
|
||||
// 更新明细
|
||||
HashMap<String, String> map_dtl = new HashMap<String, String>();
|
||||
map_dtl.put("unassign_qty", "0");
|
||||
map_dtl.put("assign_qty", ivt.getString("change_qty"));
|
||||
map_dtl.put("bill_status", "40");
|
||||
wo_dtl.update(map_dtl, "iostorinvdtl_id='" + json.getString("iostorinvdtl_id") + "'");
|
||||
}
|
||||
|
||||
//更新主表状态
|
||||
this.updateMststatus(iostorinv_id);
|
||||
//锁定点位、仓位
|
||||
Collection<JSONObject> c = Struct_map.values();
|
||||
Iterator<JSONObject> it = c.iterator();
|
||||
for (; it.hasNext(); ) {
|
||||
JSONObject Struct = it.next();
|
||||
//锁定起点仓位点位
|
||||
JSONObject from_start = new JSONObject();
|
||||
from_start.put("struct_id", Struct.getString("struct_id"));
|
||||
from_start.put("lock_type", "2");
|
||||
from_start.put("inv_type", jo_mst.getString("bill_type"));
|
||||
from_start.put("inv_id", jo_mst.getString("iostorinv_id"));
|
||||
from_start.put("inv_code", jo_mst.getString("bill_code"));
|
||||
storPublicService.updateStructAndPoint(from_start);
|
||||
}
|
||||
}
|
||||
|
||||
public void manualDiv2(JSONObject form) {
|
||||
//出库分配表
|
||||
WQLObject wo_dis = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
|
||||
//出库明细表
|
||||
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl");
|
||||
//出库主表
|
||||
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv");
|
||||
|
||||
//定义需要更新的仓位集合
|
||||
HashMap<String, JSONObject> Struct_map = new HashMap<>();
|
||||
JSONObject whereJson = form.getJSONObject("row");
|
||||
JSONArray rows = form.getJSONArray("rows");
|
||||
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||
//查询主表信息
|
||||
JSONObject jo_mst = wo_mst.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jo_mst)) {
|
||||
throw new BadRequestException("当前订单无可分配出库明细");
|
||||
}
|
||||
|
||||
//查询生成和未分配完的明细
|
||||
JSONObject dtl = WQL.getWO("QST_IVT_CHECKOUTBILL")
|
||||
.addParam("flag", "2")
|
||||
.addParam("bill_status", "30")
|
||||
.addParam("unassign_flag", "1")
|
||||
.addParam("iostorinv_id", iostorinv_id)
|
||||
.addParam("iostorinvdtl_id", whereJson.getString("iostorinvdtl_id"))
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(dtl)) {
|
||||
throw new BadRequestException("当前订单无可分配出库明细");
|
||||
}
|
||||
|
||||
rows = WQL.getWO("QST_IVT_CHECKOUTBILL")
|
||||
.addParam("flag", "3")
|
||||
.addParam("box_no", dtl.get("box_no"))
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
|
||||
double assign_qty = dtl.getDoubleValue("assign_qty");
|
||||
double unassign_qty = dtl.getDoubleValue("unassign_qty");
|
||||
double plan_qty = dtl.getDoubleValue("plan_qty");
|
||||
|
||||
// 判断此明细是否有相同仓位的明细:如果没有则将此仓位下的所有库存出出来
|
||||
JSONArray jsonDtl = wo_dtl.query("box_no = '" + dtl.getString("box_no") + "'").getResultJSONArray(0);
|
||||
if (jsonDtl.size() == 1) {
|
||||
rows = WQL.getWO("QST_IVT_CHECKOUTBILL")
|
||||
.addParam("flag", "3")
|
||||
.addParam("box_no", dtl.get("source_bill_code"))
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
}
|
||||
|
||||
if (rows.size() != 0) {
|
||||
for (int j = 0; j < rows.size(); j++) {
|
||||
JSONObject ivt = rows.getJSONObject(j);
|
||||
|
||||
double canuse_qty = ivt.getDoubleValue("ivt_qty");
|
||||
assign_qty = NumberUtil.add(assign_qty,canuse_qty);
|
||||
|
||||
if (unassign_qty >= canuse_qty) {
|
||||
unassign_qty = unassign_qty - canuse_qty;
|
||||
ivt.put("change_qty", canuse_qty + "");
|
||||
} else {
|
||||
ivt.put("change_qty", canuse_qty + "");
|
||||
unassign_qty = 0;
|
||||
}
|
||||
//更新库存
|
||||
ivt.put("change_qty", ivt.getDoubleValue("canuse_qty"));
|
||||
ivt.put("bill_type_scode", jo_mst.getString("bill_type"));
|
||||
ivt.put("inv_id", dtl.getString("iostorinv_id"));
|
||||
ivt.put("inv_id", json.getString("iostorinv_id"));
|
||||
ivt.put("bill_code", jo_mst.getString("bill_code"));
|
||||
ivt.put("bill_table", "ST_IVT_IOStorInv");
|
||||
storPublicService.IOStor(ivt, "11");
|
||||
//生成分配明细
|
||||
dtl.put("iostorinvdis_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
dtl.put("sect_id", ivt.getString("sect_id"));
|
||||
dtl.put("sect_code", ivt.getString("sect_code"));
|
||||
dtl.put("sect_name", ivt.getString("sect_name"));
|
||||
dtl.put("struct_id", ivt.getString("struct_id"));
|
||||
dtl.put("struct_code", ivt.getString("struct_code"));
|
||||
dtl.put("struct_name", ivt.getString("struct_name"));
|
||||
dtl.put("pcsn", ivt.getString("pcsn"));
|
||||
dtl.put("box_no", ivt.getString("storagevehicle_code"));
|
||||
dtl.put("storagevehicle_id", ivt.getString("storagevehicle_id"));
|
||||
dtl.put("storagevehicle_code", ivt.getString("storagevehicle_code"));
|
||||
dtl.put("storagevehicle_type", ivt.getString("storagevehicle_type"));
|
||||
dtl.put("is_issued", "0");
|
||||
dtl.put("plan_qty", ivt.getDoubleValue("change_qty"));
|
||||
dtl.put("real_qty", ivt.getDoubleValue("change_qty"));
|
||||
json.put("iostorinvdis_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("sect_id", ivt.getString("sect_id"));
|
||||
json.put("sect_code", ivt.getString("sect_code"));
|
||||
json.put("sect_name", ivt.getString("sect_name"));
|
||||
json.put("struct_id", ivt.getString("struct_id"));
|
||||
json.put("struct_code", ivt.getString("struct_code"));
|
||||
json.put("struct_name", ivt.getString("struct_name"));
|
||||
json.put("pcsn", ivt.getString("pcsn"));
|
||||
json.put("box_no", ivt.getString("storagevehicle_code"));
|
||||
json.put("storagevehicle_id", ivt.getString("storagevehicle_id"));
|
||||
json.put("storagevehicle_code", ivt.getString("storagevehicle_code"));
|
||||
json.put("storagevehicle_type", ivt.getString("storagevehicle_type"));
|
||||
json.put("is_issued", "0");
|
||||
json.put("plan_qty", ivt.getDoubleValue("change_qty"));
|
||||
json.put("real_qty", ivt.getDoubleValue("change_qty"));
|
||||
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
|
||||
if (StrUtil.equals(ivt.getString("sect_code"), "XN01")) {
|
||||
dtl.put("work_status", "01");
|
||||
JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt.getString("sect_id") + "'").uniqueResult(0);
|
||||
if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) {
|
||||
json.put("work_status", "01");
|
||||
} else {
|
||||
dtl.put("work_status", "00");
|
||||
json.put("work_status", "00");
|
||||
}
|
||||
wo_dis.insert(dtl);
|
||||
//记录需锁定的仓位
|
||||
Struct_map.put(ivt.getString("struct_id"), ivt);
|
||||
if (unassign_qty == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
HashMap<String, String> map_dtl = new HashMap<String, String>();
|
||||
//更新明细
|
||||
map_dtl.put("unassign_qty", unassign_qty + "");
|
||||
map_dtl.put("assign_qty", assign_qty + "");
|
||||
if (unassign_qty == 0) {
|
||||
wo_dis.insert(json);
|
||||
|
||||
// 更新明细
|
||||
HashMap<String, String> map_dtl = new HashMap<String, String>();
|
||||
map_dtl.put("unassign_qty", "0");
|
||||
map_dtl.put("assign_qty", ivt.getString("change_qty"));
|
||||
map_dtl.put("bill_status", "40");
|
||||
} else {
|
||||
map_dtl.put("bill_status", "30");
|
||||
wo_dtl.update(map_dtl, "iostorinvdtl_id='" + json.getString("iostorinvdtl_id") + "'");
|
||||
}
|
||||
wo_dtl.update(map_dtl, "iostorinvdtl_id='" + dtl.getString("iostorinvdtl_id") + "'");
|
||||
}
|
||||
|
||||
// 判断是否还有相同物料相同仓位的明细
|
||||
JSONObject jsonMap = new JSONObject();
|
||||
jsonMap.put("flag", "4");
|
||||
jsonMap.put("material_id", dtl.getString("material_id"));
|
||||
jsonMap.put("iostorinv_id", iostorinv_id);
|
||||
jsonMap.put("iostorinvdtl_id", whereJson.getString("iostorinvdtl_id"));
|
||||
|
||||
JSONArray dtlArr = WQL.getWO("ST_OUTIVT01").addParamMap(jsonMap).process().getResultJSONArray(0);
|
||||
for (int i = 0; i < dtlArr.size(); i++) {
|
||||
JSONObject json = dtlArr.getJSONObject(i);
|
||||
|
||||
JSONObject ivt = WQL.getWO("ST_OUTIVT01")
|
||||
.addParam("flag", "1")
|
||||
.addParam("material_id", json.getString("material_id"))
|
||||
.addParam("pcsn", json.getString("pcsn"))
|
||||
.process().uniqueResult(0);
|
||||
|
||||
//更新库存
|
||||
ivt.put("change_qty", ivt.getDoubleValue("canuse_qty"));
|
||||
ivt.put("bill_type_scode", jo_mst.getString("bill_type"));
|
||||
ivt.put("inv_id", json.getString("iostorinv_id"));
|
||||
ivt.put("bill_code", jo_mst.getString("bill_code"));
|
||||
ivt.put("bill_table", "ST_IVT_IOStorInv");
|
||||
storPublicService.IOStor(ivt, "11");
|
||||
//生成分配明细
|
||||
json.put("iostorinvdis_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("sect_id", ivt.getString("sect_id"));
|
||||
json.put("sect_code", ivt.getString("sect_code"));
|
||||
json.put("sect_name", ivt.getString("sect_name"));
|
||||
json.put("struct_id", ivt.getString("struct_id"));
|
||||
json.put("struct_code", ivt.getString("struct_code"));
|
||||
json.put("struct_name", ivt.getString("struct_name"));
|
||||
json.put("pcsn", ivt.getString("pcsn"));
|
||||
json.put("box_no", ivt.getString("storagevehicle_code"));
|
||||
json.put("storagevehicle_id", ivt.getString("storagevehicle_id"));
|
||||
json.put("storagevehicle_code", ivt.getString("storagevehicle_code"));
|
||||
json.put("storagevehicle_type", ivt.getString("storagevehicle_type"));
|
||||
json.put("is_issued", "0");
|
||||
json.put("plan_qty", ivt.getDoubleValue("change_qty"));
|
||||
json.put("real_qty", ivt.getDoubleValue("change_qty"));
|
||||
// 如果所属仓位是虚拟区 则将分配明细状态变为生成
|
||||
if (StrUtil.equals(ivt.getString("sect_code"), "XN01")) {
|
||||
json.put("work_status", "01");
|
||||
} else {
|
||||
json.put("work_status", "00");
|
||||
}
|
||||
wo_dis.insert(json);
|
||||
|
||||
// 更新明细
|
||||
HashMap<String, String> map_dtl = new HashMap<String, String>();
|
||||
map_dtl.put("unassign_qty", "0");
|
||||
map_dtl.put("assign_qty", ivt.getString("change_qty"));
|
||||
map_dtl.put("bill_status", "40");
|
||||
wo_dtl.update(map_dtl, "iostorinvdtl_id='" + json.getString("iostorinvdtl_id") + "'");
|
||||
}
|
||||
|
||||
//更新主表状态
|
||||
|
||||
Reference in New Issue
Block a user