优化
This commit is contained in:
@@ -118,6 +118,11 @@ public class FormulaServiceImpl implements FormulaService {
|
||||
if(order == null){
|
||||
throw new BadRequestException("当前工令信息查询失败!");
|
||||
}
|
||||
String pcsn = order.getString("pcsn");
|
||||
if(pcsn.endsWith("R")){
|
||||
pcsn = pcsn.replace("R","");
|
||||
}
|
||||
order.put("pcsn",pcsn);
|
||||
order.put("status","20");
|
||||
order.put("startwork_id","");
|
||||
order.put("startwork_name","");
|
||||
@@ -183,7 +188,8 @@ public class FormulaServiceImpl implements FormulaService {
|
||||
String now = DateUtil.now();
|
||||
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
|
||||
Long deptId = currentUser.getDeptId();
|
||||
|
||||
WQLObject md_me_materialbase = WQLObject.getWQLObject("md_me_materialbase");
|
||||
WQLObject md_me_producmaterialext = WQLObject.getWQLObject("md_me_producmaterialext");
|
||||
WQLObject PDM_BI_WorkOrder = WQLObject.getWQLObject("PDM_BI_WorkOrder"); // 工艺路线主表
|
||||
WQLObject PDM_BI_Formula = WQLObject.getWQLObject("PDM_BI_Formula");
|
||||
WQLObject PDM_BI_FormulaDtl = WQLObject.getWQLObject("PDM_BI_FormulaDtl");
|
||||
@@ -196,6 +202,7 @@ public class FormulaServiceImpl implements FormulaService {
|
||||
if(order == null){
|
||||
throw new BadRequestException("当前工令信息查询失败!");
|
||||
}
|
||||
String pcsn = order.getString("pcsn");
|
||||
JSONObject Formula = PDM_BI_Formula.query("is_delete='0' and formula_id='"+formula_id+"'").uniqueResult(0);
|
||||
if(Formula == null){
|
||||
throw new BadRequestException("当前配方信息查询失败!");
|
||||
@@ -205,12 +212,30 @@ public class FormulaServiceImpl implements FormulaService {
|
||||
double billpure_qty = 0;
|
||||
double masterbucket_qty = 0;
|
||||
double extadd_qty = 0;
|
||||
//软废纯粉总重
|
||||
double RF_total = 0;
|
||||
//删除明细
|
||||
PDM_BI_FormulaDtl.delete("formula_id='"+formula_id+"'");
|
||||
for(int i = 0;i<tableDtl.size();i++){
|
||||
JSONObject jo = tableDtl.getJSONObject(i);
|
||||
String formuladtl_id = jo.getString("formuladtl_id");
|
||||
jo.put("seq_no",(i+1)+"");
|
||||
|
||||
if("1".equals(jo.getString("is_need_manage"))){
|
||||
billpure_qty = billpure_qty+jo.getDouble("formula_qty");
|
||||
}
|
||||
JSONObject md_jo = md_me_materialbase.query("is_delete='0' and material_id='"+jo.getString("material_id")+"'").uniqueResult(0);
|
||||
if(md_jo!=null){
|
||||
//是否软废
|
||||
if(MaterOptTypeEnum.RD_AND_PG.getClass_idStr().contains(md_jo.getString("material_type_id"))){
|
||||
JSONObject pro_jo = md_me_producmaterialext.query("material_id='"+jo.getString("material_id")+"'").uniqueResult(0);
|
||||
if(pro_jo ==null){
|
||||
throw new BadRequestException("物料"+jo.getString("material_code")+" "+jo.getString("material_name")+"未设置成品物料扩展信息!");
|
||||
|
||||
}
|
||||
RF_total = RF_total+jo.getDouble("formula_qty")*pro_jo.getDouble("net_rate")/100.0;
|
||||
}
|
||||
}
|
||||
//新增
|
||||
if(StrUtil.isEmpty(formuladtl_id)){
|
||||
jo.put("put_qty","0");
|
||||
@@ -261,6 +286,21 @@ public class FormulaServiceImpl implements FormulaService {
|
||||
}
|
||||
PDM_BI_FormulaDtl.insert(jo);
|
||||
}
|
||||
if(billpure_qty>0){
|
||||
double RF_per = RF_total/billpure_qty;
|
||||
if(RF_per>=0.5){
|
||||
if(!pcsn.endsWith("R")){
|
||||
pcsn = pcsn+"R";
|
||||
}
|
||||
}else{
|
||||
if(pcsn.endsWith("R")){
|
||||
pcsn = pcsn.replace("R","");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
pcsn = pcsn.replace("R","");
|
||||
}
|
||||
Formula.put("pcsn",pcsn);
|
||||
Formula.put("masterbucket_qty",masterbucket_qty+"");
|
||||
Formula.put("ball_time",whereJson.getString("ball_time"));
|
||||
Formula.put("extadd_qty",extadd_qty+"");
|
||||
@@ -292,6 +332,7 @@ public class FormulaServiceImpl implements FormulaService {
|
||||
order.put("update_optid", currentUserId);
|
||||
order.put("update_optname", nickName);
|
||||
order.put("update_time", now);
|
||||
order.put("pcsn", pcsn);
|
||||
PDM_BI_WorkOrder.update(order);
|
||||
|
||||
HashMap<String,String> map = new HashMap();
|
||||
|
||||
Reference in New Issue
Block a user