修改
This commit is contained in:
@@ -27,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -56,7 +57,7 @@ public class ChangeServiceImpl implements ChangeService {
|
||||
UserStorServiceImpl userStorService = new UserStorServiceImpl();
|
||||
String in_stor_id = userStorService.getInStor();
|
||||
|
||||
if (ObjectUtil.isNotEmpty(in_stor_id)) map.put("in_stor_id",in_stor_id);
|
||||
if (ObjectUtil.isNotEmpty(in_stor_id)) map.put("in_stor_id", in_stor_id);
|
||||
|
||||
JSONObject jo = WQL.getWO("QST_IVT_CHANGE").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "bill_code desc");
|
||||
return jo;
|
||||
@@ -72,6 +73,7 @@ public class ChangeServiceImpl implements ChangeService {
|
||||
|
||||
/**
|
||||
* 通过changeinv_id删除明细
|
||||
*
|
||||
* @param changeinv_id
|
||||
*/
|
||||
void deleteById(String changeinv_id) {
|
||||
@@ -153,14 +155,26 @@ public class ChangeServiceImpl implements ChangeService {
|
||||
double total_qty = 0;
|
||||
double detail_count = 0;
|
||||
//定义需要需要插入的库存集合
|
||||
for (int j = 0; j < rows.size(); j++) {
|
||||
HashMap row = rows.get(j);
|
||||
HashMap<String, HashMap> set = new HashMap<>();
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
HashMap row = rows.get(i);
|
||||
String package_box_sn = (String) row.get("package_box_sn");
|
||||
if (set.containsKey(package_box_sn)) {
|
||||
continue;
|
||||
} else {
|
||||
set.put(package_box_sn, row);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (String package_box_sn : set.keySet()) {
|
||||
HashMap row = set.get(package_box_sn);
|
||||
String SaleOrderItem = (String) row.get("new_sale_order_name");
|
||||
String DemandDate = (String) row.get("demand_date");
|
||||
String CustomerName = (String) row.get("new_customer_name");
|
||||
String isRePrintPackageBoxLabel = (String) row.get("isRePrintPackageBoxLabel");
|
||||
String isUnPackBox = (String) row.get("isUnPackBox");
|
||||
String UpdatedDateOfProduction = (String) row.get("date_of_FG_inbound");
|
||||
String isRePrintPackageBoxLabel = (String) row.get("isreprintpackageboxlabel");
|
||||
String isUnPackBox = (String) row.get("isunpackbox");
|
||||
String UpdatedDateOfProduction = (String) row.get("date_of_fg_inbound");
|
||||
//查询该木箱内子卷数量
|
||||
JSONArray container_rows = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + row.get("storagevehicle_code") + "'").getResultJSONArray(0);
|
||||
for (int i = 0; i < container_rows.size(); i++) {
|
||||
@@ -178,8 +192,8 @@ public class ChangeServiceImpl implements ChangeService {
|
||||
change_jo.put("customer_name", CustomerName);
|
||||
//查询对应的客户
|
||||
JSONObject customer_jo = WQLObject.getWQLObject("md_cs_customerbase").query("cust_code = '" + CustomerName + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(customer_jo)){
|
||||
throw new BadRequestException("未查询到对应客户编码为:"+CustomerName);
|
||||
if (ObjectUtil.isEmpty(customer_jo)) {
|
||||
throw new BadRequestException("未查询到对应客户编码为:" + CustomerName);
|
||||
}
|
||||
change_jo.put("customer_description", customer_jo.getString("cust_name"));
|
||||
change_jo.put("isRePrintPackageBoxLabel", isRePrintPackageBoxLabel);
|
||||
@@ -383,16 +397,16 @@ public class ChangeServiceImpl implements ChangeService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(Map whereJson) {
|
||||
//主表
|
||||
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_MoveInv");
|
||||
WQLObject wo_mst = WQLObject.getWQLObject("st_ivt_structivtchange");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
String moveinv_id = (String) whereJson.get("moveinv_id");
|
||||
String changeinv_id = (String) whereJson.get("changeinv_id");
|
||||
//查询主表
|
||||
JSONObject jo_mst = wo_mst.query("moveinv_id='" + moveinv_id + "'").uniqueResult(0);
|
||||
JSONObject jo_mst = wo_mst.query("changeinv_id='" + changeinv_id + "'").uniqueResult(0);
|
||||
//调用删除明细,还原库存方法
|
||||
this.deleteById(moveinv_id + "");
|
||||
this.deleteById(changeinv_id + "");
|
||||
//获取明细
|
||||
ArrayList<HashMap> rows = (ArrayList<HashMap>) whereJson.get("tableData");
|
||||
//调用明细处理方法
|
||||
@@ -555,38 +569,38 @@ public class ChangeServiceImpl implements ChangeService {
|
||||
JSONArray ja = wo_dtl.query("changeinv_id='" + changeinv_id + "'").getResultJSONArray(0);
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
map.put("sale_order_name",jo.getString("mfg_order_name"));
|
||||
map.put("customer_name",jo.getString("customer_name"));
|
||||
map.put("customer_description",jo.getString("customer_description"));
|
||||
map.put("isRePrintPackageBoxLabel",jo.getString("isreprintpackageboxlabel"));
|
||||
map.put("isUnPackBox",jo.getString("isunpackbox"));
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("sale_order_name", jo.getString("mfg_order_name"));
|
||||
map.put("customer_name", jo.getString("customer_name"));
|
||||
map.put("customer_description", jo.getString("customer_description"));
|
||||
map.put("isRePrintPackageBoxLabel", jo.getString("isreprintpackageboxlabel"));
|
||||
map.put("isUnPackBox", jo.getString("isunpackbox"));
|
||||
String UpdatedDateOfProduction = jo.getString("updateddateofproduction");
|
||||
String pcsn = jo.getString("pcsn");
|
||||
|
||||
JSONObject old_sub = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("container_name = '"+pcsn+"' AND status = '2'").uniqueResult(0);
|
||||
old_sub.put("change_type_scode","02");
|
||||
old_sub.put("change_order_id",jo_mst.getString("changeinv_id"));
|
||||
old_sub.put("change_order_code",jo_mst.getString("bill_code"));
|
||||
old_sub.put("create_id",currentUserId);
|
||||
old_sub.put("create_name",nickName);
|
||||
old_sub.put("change_time",DateUtil.now());
|
||||
old_sub.put("workorder_id",IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
JSONObject old_sub = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("container_name = '" + pcsn + "' AND status = '2'").uniqueResult(0);
|
||||
old_sub.put("change_type_scode", "02");
|
||||
old_sub.put("change_order_id", jo_mst.getString("changeinv_id"));
|
||||
old_sub.put("change_order_code", jo_mst.getString("bill_code"));
|
||||
old_sub.put("create_id", currentUserId);
|
||||
old_sub.put("create_name", nickName);
|
||||
old_sub.put("change_time", DateUtil.now());
|
||||
old_sub.put("workorder_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
WQLObject.getWQLObject("PDM_BI_SubPackageRelationChangeFlow").insert(old_sub);
|
||||
|
||||
if (StrUtil.isNotEmpty(UpdatedDateOfProduction)){
|
||||
map.put("date_of_FG_inbound",UpdatedDateOfProduction);
|
||||
if (StrUtil.isNotEmpty(UpdatedDateOfProduction)) {
|
||||
map.put("date_of_FG_inbound", UpdatedDateOfProduction);
|
||||
}
|
||||
WQLObject.getWQLObject("pdm_bi_subpackagerelation").update(map,"container_name = '"+pcsn+"' AND status = '2'");
|
||||
WQLObject.getWQLObject("pdm_bi_subpackagerelation").update(map, "container_name = '" + pcsn + "' AND status = '2'");
|
||||
|
||||
JSONObject new_sub = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("container_name = '"+pcsn+"' AND status = '2'").uniqueResult(0);
|
||||
new_sub.put("change_type_scode","01");
|
||||
new_sub.put("change_order_id",jo_mst.getString("changeinv_id"));
|
||||
new_sub.put("change_order_code",jo_mst.getString("bill_code"));
|
||||
new_sub.put("create_id",currentUserId);
|
||||
new_sub.put("create_name",nickName);
|
||||
new_sub.put("change_time",DateUtil.now());
|
||||
new_sub.put("workorder_id",IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
JSONObject new_sub = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("container_name = '" + pcsn + "' AND status = '2'").uniqueResult(0);
|
||||
new_sub.put("change_type_scode", "01");
|
||||
new_sub.put("change_order_id", jo_mst.getString("changeinv_id"));
|
||||
new_sub.put("change_order_code", jo_mst.getString("bill_code"));
|
||||
new_sub.put("create_id", currentUserId);
|
||||
new_sub.put("create_name", nickName);
|
||||
new_sub.put("change_time", DateUtil.now());
|
||||
new_sub.put("workorder_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
WQLObject.getWQLObject("PDM_BI_SubPackageRelationChangeFlow").insert(new_sub);
|
||||
}
|
||||
HashMap<String, String> map_mst = new HashMap<>();
|
||||
|
||||
Reference in New Issue
Block a user