This commit is contained in:
2022-06-27 20:25:22 +08:00
parent 6d299427b2
commit 8d10c420c4
4 changed files with 173 additions and 67 deletions

View File

@@ -244,7 +244,7 @@ public class HandCleanOutIvtServiceImpl implements HandCleanOutIvtService {
// 插入到【配粉间桶记录表】
String area_type = pointJO.getString("area_type");
if (left_qty.doubleValue() == 0) {
if (left_qty.doubleValue() == 0 && bill_type.equals("010501")) {
if (StrUtil.equals("22", area_type) || StrUtil.equals("23", area_type) || StrUtil.equals("24", area_type)) {
bucketjo.put("area_type", area_type);
bucketjo.put("create_time", DateUtil.now());

View File

@@ -336,7 +336,7 @@ public class HandPFOutIvtServiceImpl implements HandPFOutIvtService {
//当对抑制剂、碳粉、钨粉等不需要配粉移库的物料进行扫桶出库后,更新【配粉间桶记录表】桶数量,假如不是整桶出,则不用管
JSONObject ProducMaterialExtObj = WQLObject.getWQLObject("MD_ME_ProducMaterialExt").query("material_id='" + material_id + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(ProducMaterialExtObj)) {
if (ObjectUtil.isNotEmpty(ProducMaterialExtObj) && bill_type.equals("010501")) {
String is_need_move = ProducMaterialExtObj.getString("is_need_move");
if (StrUtil.equals(is_need_move, "1") && bucketflag.doubleValue() == 0) ;
if (StrUtil.equals(area_type, "22") || StrUtil.equals(area_type, "23") || StrUtil.equals(area_type, "24")) {
@@ -643,7 +643,7 @@ public class HandPFOutIvtServiceImpl implements HandPFOutIvtService {
//当对抑制剂、碳粉、钨粉等不需要配粉移库的物料进行扫桶出库后,更新【配粉间桶记录表】桶数量,假如不是整桶出,则不用管
JSONObject ProducMaterialExtObj = WQLObject.getWQLObject("MD_ME_ProducMaterialExt").query("material_id='" + material_id + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(ProducMaterialExtObj)) {
if (ObjectUtil.isNotEmpty(ProducMaterialExtObj) && bill_type.equals("010501")) {
String is_need_move = ProducMaterialExtObj.getString("is_need_move");
if (StrUtil.equals(is_need_move, "1") && bucketflag.doubleValue() == 0) ;
if (StrUtil.equals(area_type, "22") || StrUtil.equals(area_type, "23") || StrUtil.equals(area_type, "24")) {

View File

@@ -244,7 +244,7 @@ public class HandReturnOutIvtServiceImpl implements HandReturnOutIvtService {
// 插入到【配粉间桶记录表】
String area_type = pointJO.getString("area_type");
if (left_qty.doubleValue() == 0) {
if (left_qty.doubleValue() == 0 && bill_type.equals("010501")) {
if (StrUtil.equals("22", area_type) || StrUtil.equals("23", area_type) || StrUtil.equals("24", area_type)) {
bucketjo.put("area_type", area_type);
bucketjo.put("create_time", DateUtil.now());

View File

@@ -2334,6 +2334,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
JSONArray yzj_list = new JSONArray();
//需抑碳粉钨粉集合
JSONArray cw_list = new JSONArray();
//new
JSONArray xl_list2 = new JSONArray();
//需分配新料重量
double new_qty = workorder_qty;
//纯粉重量
@@ -2519,71 +2521,83 @@ public class AutoformulaServiceImpl implements AutoformulaService {
bomdlts_need_map.forEach((key,bomdlt)->{
String bomdtl_material_id = bomdlt.getString("material_id");
double left_qty = bomdlt.getDouble("left_qty");
String is_need_move = bomdlt.getString("is_need_move");
//获取Y1、X1、X2….剩余>0的物料
if(left_qty>0){
JSONArray now_ivts = WQL.getWO("QPF_AUTOFORMULA01")
.addParam("material_id",bomdtl_material_id)
.addParam("quality_scode","01")
.addParam("workorder_id",workorder_id)
.addParam("flag","22")
.process().getResultJSONArray(0);
boolean flag = false;
for(int i=0;i<now_ivts.size();i++){
JSONObject now_ivt = now_ivts.getJSONObject(i);
//查询该物料的厂家质保书是否含有添加剂
JSONArray is_tjj = WQL.getWO("QPF_AUTOFORMULA01")
.addParam("material_id",now_ivt.getString("material_id"))
.addParam("pcsn",now_ivt.getString("pcsn"))
.addParam("material_type_id",MaterOptTypeEnum.TJJ.getClass_idStr())
.addParam("flag","6")
if(is_need_move.equals("1")){
JSONArray now_ivts = WQL.getWO("QPF_AUTOFORMULA01")
.addParam("material_id",bomdtl_material_id)
.addParam("quality_scode","01")
.addParam("workorder_id",workorder_id)
.addParam("flag","22")
.process().getResultJSONArray(0);
if(is_tjj.size()>0){
continue;
}
double ivt_qty = now_ivt.getDouble("sum_ivt_qty");
if(now_ivt.getDouble("sum_ivt_qty") <=0){
continue;
}
if(left_qty<ivt_qty){
flag = true;
now_ivt.put("formula_qty",left_qty);
now_ivt.put("bom_ivt_qty",left_qty);
now_ivt.put("need_qty",left_qty);
now_ivt.put("material_type","01");
now_ivt.put("is_need_move",bomdlt.getString("is_need_move"));
now_ivt.put("is_need_manage","1");
xl_list.add(now_ivt);
left_qty = 0;
//如果该物料是碳化钨
if(MaterOptTypeEnum.THW.getClass_idStr().contains(now_ivt.getString("material_type_id"))){
bomdlts_Cr3C2.add(now_ivt);
boolean flag = false;
for(int i=0;i<now_ivts.size();i++){
JSONObject now_ivt = now_ivts.getJSONObject(i);
//查询该物料的厂家质保书是否含有添加剂
JSONArray is_tjj = WQL.getWO("QPF_AUTOFORMULA01")
.addParam("material_id",now_ivt.getString("material_id"))
.addParam("pcsn",now_ivt.getString("pcsn"))
.addParam("material_type_id",MaterOptTypeEnum.TJJ.getClass_idStr())
.addParam("flag","6")
.process().getResultJSONArray(0);
if(is_tjj.size()>0){
continue;
}
break;
}else{
flag = true;
now_ivt.put("formula_qty",ivt_qty);
now_ivt.put("bom_ivt_qty",ivt_qty);
now_ivt.put("need_qty",ivt_qty);
now_ivt.put("material_type","01");
now_ivt.put("is_need_move",bomdlt.getString("is_need_move"));
now_ivt.put("is_need_manage","1");
left_qty = NumberUtil.round(left_qty - ivt_qty,3).doubleValue();
xl_list.add(now_ivt);
//如果该物料是碳化钨
if(MaterOptTypeEnum.THW.getClass_idStr().contains(now_ivt.getString("material_type_id"))){
bomdlts_Cr3C2.add(now_ivt);
double ivt_qty = now_ivt.getDouble("sum_ivt_qty");
if(now_ivt.getDouble("sum_ivt_qty") <=0){
continue;
}
if(left_qty<ivt_qty){
flag = true;
now_ivt.put("formula_qty",left_qty);
now_ivt.put("bom_ivt_qty",left_qty);
now_ivt.put("seqno",bomdlt.getString("seqno"));
now_ivt.put("need_sum_qty",bomdlt.getString("need_sum_qty"));
now_ivt.put("material_type","01");
now_ivt.put("is_need_move",bomdlt.getString("is_need_move"));
now_ivt.put("is_need_manage","1");
xl_list.add(now_ivt);
left_qty = 0;
//如果该物料是碳化钨
if(MaterOptTypeEnum.THW.getClass_idStr().contains(now_ivt.getString("material_type_id"))){
bomdlts_Cr3C2.add(now_ivt);
}
break;
}else{
flag = true;
now_ivt.put("formula_qty",ivt_qty);
now_ivt.put("bom_ivt_qty",ivt_qty);
now_ivt.put("seqno",bomdlt.getString("seqno"));
now_ivt.put("material_type","01");
now_ivt.put("need_sum_qty",bomdlt.getString("need_sum_qty"));
now_ivt.put("is_need_move",bomdlt.getString("is_need_move"));
now_ivt.put("is_need_manage","1");
left_qty = NumberUtil.round(left_qty - ivt_qty,3).doubleValue();
xl_list.add(now_ivt);
//如果该物料是碳化钨
if(MaterOptTypeEnum.THW.getClass_idStr().contains(now_ivt.getString("material_type_id"))){
bomdlts_Cr3C2.add(now_ivt);
}
}
}
if(left_qty>0){
throw new BadRequestException("物料"+bomdlt.getString("material_code")+" "+bomdlt.getString("material_name")+",新料库存不足!");
}
if(flag){
bomdlt.put("is_flag","1");
}
//bomdlt.put("need_qty", bomdlt.getDouble("left_qty"));
bomdlts_need_map.put(bomdlt.getString("material_id"),bomdlt);
}else{
bomdlt.put("formula_qty", bomdlt.getDouble("left_qty"));
bomdlt.put("is_need_manage","1");
bomdlt.put("ivt_level","01");
bomdlt.put("is_active","1");
bomdlt.put("quality_scode","01");
bomdlts_need_map.put(bomdlt.getString("material_id"),bomdlt);
}
if(left_qty>0){
throw new BadRequestException("物料"+bomdlt.getString("material_code")+" "+bomdlt.getString("material_name")+",新料库存不足!");
}
if(flag){
bomdlt.put("is_flag","1");
}
bomdlt.put("need_qty", bomdlt.getDouble("left_qty"));
bomdlts_need_map.put(bomdlt.getString("material_id"),bomdlt);
}else{
bomdlt.put("need_qty", "0");
bomdlt.put("formula_qty", "0");
@@ -2845,6 +2859,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
//Y12p=Y12p+Y1补
Y1p = Y1p + Y1_bu;
now_bomdtl.put("need_qty",Y1p);
now_bomdtl.put("is_flag","-1");
now_bomdtl.put("formula_qty",Y1p);
bomdlts_need_map.put(key,now_bomdtl);
}
}
@@ -2963,6 +2979,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
Y1p = Y1p + Y1_bu;
}
now_bomdtl.put("need_qty",Y1p);
now_bomdtl.put("is_flag","-1");
now_bomdtl.put("formula_qty",Y1p);
bomdlts_need_map.put(key,now_bomdtl);
}
});
@@ -3183,6 +3201,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
//Y12p=Y12p+Y1补
Y1p = Y1p + Y1_bu;
now_bomdtl.put("need_qty",Y1p);
now_bomdtl.put("is_flag","-1");
now_bomdtl.put("formula_qty",Y1p);
bomdlts_need_map.put(key,now_bomdtl);
}
}
@@ -3253,6 +3273,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
Y1p = Y1p + Y1_bu;
}
now_bomdtl.put("need_qty",Y1p);
now_bomdtl.put("is_flag","-1");
now_bomdtl.put("formula_qty",Y1p);
bomdlts_need_map.put(key,now_bomdtl);
}
});
@@ -3377,24 +3399,108 @@ public class AutoformulaServiceImpl implements AutoformulaService {
}
});
bomdlts_need_map.forEach((key,bomdlts_plan)->{
if(!bomdlts_plan.getString("is_flag").equals("1")){
if(bomdlts_plan.getString("is_flag").equals("0")){
bomdlts_plan.put("formula_qty","0");
bomdlts_plan.put("is_rf_xl","1");
bomdlts_plan.put("material_type","01");
bomdlts_plan.put("is_rf_xl","0");
bomdlts_plan.put("ivt_level","01");
bomdlts_plan.put("is_active","1");
bomdlts_plan.put("quality_scode","01");
//bomdlts_plan.put("ivt_level","01");
//bomdlts_plan.put("is_active","1");
//bomdlts_plan.put("quality_scode","01");
xl_list.add(bomdlts_plan);
}else if(bomdlts_plan.getString("is_flag").equals("-1")){
String bomdtl_material_id = bomdlts_plan.getString("material_id");
double left_qty = bomdlts_plan.getDouble("formula_qty");
String is_need_move = bomdlts_plan.getString("is_need_move");
if(is_need_move.equals("1")){
//二次分配新料库存
JSONArray now_ivts = WQL.getWO("QPF_AUTOFORMULA01")
.addParam("material_id",bomdtl_material_id)
.addParam("quality_scode","01")
.addParam("workorder_id",workorder_id)
.addParam("flag","22")
.process().getResultJSONArray(0);
for(int i=0;i<now_ivts.size();i++){
JSONObject now_ivt = now_ivts.getJSONObject(i);
//查询该物料的厂家质保书是否含有添加剂
JSONArray is_tjj = WQL.getWO("QPF_AUTOFORMULA01")
.addParam("material_id",now_ivt.getString("material_id"))
.addParam("pcsn",now_ivt.getString("pcsn"))
.addParam("material_type_id",MaterOptTypeEnum.TJJ.getClass_idStr())
.addParam("flag","6")
.process().getResultJSONArray(0);
if(is_tjj.size()>0){
continue;
}
double ivt_qty = now_ivt.getDouble("sum_ivt_qty");
if(now_ivt.getDouble("sum_ivt_qty") <=0){
continue;
}
if(left_qty<ivt_qty){
now_ivt.put("formula_qty",left_qty);
now_ivt.put("bom_ivt_qty",left_qty);
now_ivt.put("seqno",bomdlts_plan.getString("seqno"));
now_ivt.put("need_sum_qty",bomdlts_plan.getString("need_sum_qty"));
now_ivt.put("material_type","01");
now_ivt.put("is_need_move",bomdlts_plan.getString("is_need_move"));
now_ivt.put("is_need_manage","1");
xl_list.add(now_ivt);
left_qty = 0;
break;
}else{
now_ivt.put("formula_qty",ivt_qty);
now_ivt.put("bom_ivt_qty",ivt_qty);
now_ivt.put("seqno",bomdlts_plan.getString("seqno"));
now_ivt.put("need_sum_qty",bomdlts_plan.getString("need_sum_qty"));
now_ivt.put("material_type","01");
now_ivt.put("is_need_move",bomdlts_plan.getString("is_need_move"));
now_ivt.put("is_need_manage","1");
left_qty = NumberUtil.round(left_qty - ivt_qty,3).doubleValue();
xl_list.add(now_ivt);
}
}
if(left_qty>0){
throw new BadRequestException("物料"+bomdlts_plan.getString("material_code")+" "+bomdlts_plan.getString("material_name")+",新料库存不足!");
}
}else{
bomdlts_plan.put("is_rf_xl","1");
bomdlts_plan.put("material_type","01");
bomdlts_plan.put("ivt_level","01");
bomdlts_plan.put("is_active","1");
bomdlts_plan.put("quality_scode","01");
xl_list.add(bomdlts_plan);
}
}
});
//汇总新料库存
HashMap<String,JSONObject> xl_list_map = new HashMap<String,JSONObject>();
for(int i=0;i<xl_list.size();i++){
JSONObject jo_xl = xl_list.getJSONObject(i);
String key = jo_xl.getString("material_id")+"__"
+jo_xl.getString("pcsn")+"__"
+jo_xl.getString("ivt_level")+"__"
+jo_xl.getString("is_active")+"__"
+jo_xl.getString("quality_scode");
if(xl_list_map.containsKey(key)){
JSONObject jo_old = xl_list_map.get(key);
jo_old.put("formula_qty",jo_old.getDouble("formula_qty")+jo_xl.getDouble("formula_qty"));
xl_list_map.put(key,jo_old);
}else{
xl_list_map.put(key,jo_xl);
}
}
xl_list_map.forEach((key, bomdlts_plan)->{
xl_list2.add(bomdlts_plan);
});
rf_map.forEach((key,bomdlts_plan)->{
rf_list2.add(bomdlts_plan);
});
}
}
ret.put("rf_list",rf_list2);
ret.put("xl_list",xl_list);
ret.put("xl_list",xl_list2);
ret.put("cxj_list",cxj_list);
ret.put("yzj_list",yzj_list);
ret.put("cw_list",cw_list);