小料
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
package org.nl.wms.pf.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -36,27 +37,27 @@ public class AcceptFormulaController {
|
||||
return new ResponseEntity<>(acceptFormulaService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@PostMapping("/create")
|
||||
@Log("新增配粉BOM维护")
|
||||
@ApiOperation("新增配粉BOM维护")
|
||||
public ResponseEntity<Object> create(@RequestBody Map whereJson) {
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
|
||||
acceptFormulaService.create(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@PostMapping("/update")
|
||||
@Log("修改配粉BOM维护")
|
||||
@ApiOperation("修改配粉BOM维护")
|
||||
public ResponseEntity<Object> update(@RequestBody Map whereJson) {
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
|
||||
acceptFormulaService.update(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除配粉BOM维护")
|
||||
@ApiOperation("删除配粉BOM维护")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
acceptFormulaService.deleteAll(ids);
|
||||
@PostMapping("/mydel")
|
||||
public ResponseEntity<Object> mydel(@RequestBody JSONObject whereJson) {
|
||||
acceptFormulaService.deleteAll(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -99,8 +100,21 @@ public class AcceptFormulaController {
|
||||
}
|
||||
@Log("获取成型剂类别")
|
||||
@ApiOperation("获取成型剂类别")
|
||||
@GetMapping("/getPCSNid")
|
||||
public ResponseEntity<Object> getPCSNid(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(acceptFormulaService.getPCSNid(whereJson),HttpStatus.OK);
|
||||
}
|
||||
@Log("获取成型剂类别")
|
||||
@ApiOperation("获取成型剂类别")
|
||||
@GetMapping("/createPcsn")
|
||||
public ResponseEntity<Object> createPcsn() {
|
||||
return new ResponseEntity<>(acceptFormulaService.createPcsn(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("获取成型剂类别")
|
||||
@ApiOperation("获取成型剂类别")
|
||||
@GetMapping("/autoCalculation")
|
||||
public ResponseEntity<Object> autoCalculation(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(acceptFormulaService.autoCalculation(whereJson),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,19 +50,19 @@ public interface AcceptFormulaService {
|
||||
* 创建
|
||||
* @param whereJson /
|
||||
*/
|
||||
void create(Map whereJson);
|
||||
void create(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param whereJson /
|
||||
*/
|
||||
void update(Map whereJson);
|
||||
void update(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
void deleteAll(JSONObject ids);
|
||||
|
||||
/**
|
||||
* 编辑时获取明细
|
||||
@@ -90,9 +90,17 @@ public interface AcceptFormulaService {
|
||||
* 提交
|
||||
*/
|
||||
JSONObject getBom(Map whereJson);
|
||||
/**
|
||||
* 提交
|
||||
*/
|
||||
JSONObject getPCSNid(Map whereJson);
|
||||
|
||||
/**
|
||||
* 提交
|
||||
*/
|
||||
JSONObject createPcsn();
|
||||
/**
|
||||
* 提交
|
||||
*/
|
||||
JSONArray autoCalculation(Map whereJson);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ package org.nl.wms.pf.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@@ -14,6 +16,7 @@ import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.security.service.dto.JwtUserDto;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata.master.constant.MaterOptTypeEnum;
|
||||
import org.nl.wms.pf.service.AcceptFormulaService;
|
||||
import org.nl.wms.pf.service.AcceptMarkService;
|
||||
import org.nl.wms.pf.service.dto.ProductbomDto;
|
||||
@@ -24,9 +27,11 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
@@ -99,130 +104,155 @@ public class AcceptFormulaServiceImpl implements AcceptFormulaService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(Map whereJson) {
|
||||
public void create(JSONObject whereJson) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
|
||||
Long deptId = currentUser.getDeptId();
|
||||
WQLObject QL_TEST_FactoryWarrantyMst = WQLObject.getWQLObject("QL_TEST_FactoryWarrantyMst");
|
||||
WQLObject mstTab = WQLObject.getWQLObject("QL_TEST_AcceptFormula");
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("QL_TEST_AcceptFormulaDtl");
|
||||
|
||||
WQLObject mstTab = WQLObject.getWQLObject("QL_TEST_AcceptMark");
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("QL_TEST_AcceptMarkBOM");
|
||||
|
||||
JSONArray jsonArr = JSONArray.parseArray(JSON.toJSONString(whereJson.get("tableData")));
|
||||
JSONArray jsonArr = whereJson.getJSONArray("tableData");
|
||||
// 主表
|
||||
JSONObject jsonMst = new JSONObject();
|
||||
jsonMst = (JSONObject) JSON.toJSON(whereJson);
|
||||
JSONObject jsonMst = whereJson;
|
||||
whereJson.remove("tableData");
|
||||
jsonMst.put("mark_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
long formula_id = IdUtil.getSnowflake(1, 1).nextId();
|
||||
jsonMst.put("formula_id",formula_id+"");
|
||||
String formula_code = CodeUtil.getNewCode("ACCEPTFORMULA_CODE");
|
||||
jsonMst.put("formula_code", formula_code);
|
||||
jsonMst.put("is_delete", "0");
|
||||
jsonMst.put("remark", (String) whereJson.get("remark"));
|
||||
JSONObject jonow = mstTab.query("is_delete='0' and mark_code='" + jsonMst.getString("mark_code") + "'").uniqueResult(0);
|
||||
if (jonow != null) {
|
||||
throw new BadRequestException("该牌号已存在!");
|
||||
}
|
||||
|
||||
//成品物料id
|
||||
String inspection_id = whereJson.getString("inspection_id");
|
||||
JSONObject FactoryWarrantyMst = QL_TEST_FactoryWarrantyMst.query("inspection_id='"+inspection_id+"'").uniqueResult(0);
|
||||
|
||||
String material_pcsn = FactoryWarrantyMst.getString("pcsn");
|
||||
|
||||
jsonMst.put("material_pcsn", material_pcsn);
|
||||
jsonMst.put("remark", whereJson.getString("remark"));
|
||||
jsonMst.put("create_id", currentUserId);
|
||||
jsonMst.put("create_name", nickName);
|
||||
jsonMst.put("create_time", now);
|
||||
jsonMst.put("update_optid", currentUserId);
|
||||
jsonMst.put("update_optname", nickName);
|
||||
jsonMst.put("update_time", now);
|
||||
jsonMst.put("detail_count", jsonArr.size());
|
||||
mstTab.insert(jsonMst);
|
||||
jsonMst.put("syscompanyid", deptId);
|
||||
jsonMst.put("sysdeptid", deptId);
|
||||
|
||||
double sum_qty = 0;
|
||||
// 明细表
|
||||
for (int i = 0; i < jsonArr.size(); i++) {
|
||||
JSONObject json = jsonArr.getJSONObject(i);
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
jsonDtl.put("bomdtl_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonDtl.put("mark_id", jsonMst.getString("mark_id"));
|
||||
jsonDtl.put("seqno", (i+1)+"");
|
||||
jsonDtl.put("formuladtl_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonDtl.put("formula_id", formula_id+"");
|
||||
jsonDtl.put("formula_code", formula_code+"");
|
||||
jsonDtl.put("seq_no", (i+1)+"");
|
||||
jsonDtl.put("material_type","01");
|
||||
jsonDtl.put("material_id", json.getString("material_id"));
|
||||
jsonDtl.put("standard_rate", json.getString("standard_rate"));
|
||||
jsonDtl.put("dtl_pcsn", json.getString("dtl_pcsn"));
|
||||
jsonDtl.put("formula_qty", json.getString("formula_qty"));
|
||||
jsonDtl.put("qty_unit_id", "2");
|
||||
jsonDtl.put("qty_unit_name", "克");
|
||||
|
||||
sum_qty = sum_qty + json.getDouble("formula_qty");
|
||||
dtlTab.insert(jsonDtl);
|
||||
}
|
||||
jsonMst.put("confirm_qty", sum_qty);
|
||||
mstTab.insert(jsonMst);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(Map whereJson) {
|
||||
JSONObject entity = this.findById(Long.valueOf((String) whereJson.get("mark_id")));
|
||||
if (entity == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
WQLObject mstTab = WQLObject.getWQLObject("QL_TEST_AcceptMark");
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("QL_TEST_AcceptMarkBOM");
|
||||
|
||||
public void update(JSONObject whereJson) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
|
||||
WQLObject QL_TEST_FactoryWarrantyMst = WQLObject.getWQLObject("QL_TEST_FactoryWarrantyMst");
|
||||
WQLObject mstTab = WQLObject.getWQLObject("QL_TEST_AcceptFormula");
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("QL_TEST_AcceptFormulaDtl");
|
||||
|
||||
JSONArray jsonArr = JSONArray.parseArray(JSON.toJSONString(whereJson.get("tableData")));
|
||||
JSONArray jsonArr = whereJson.getJSONArray("tableData");
|
||||
// 主表
|
||||
JSONObject jsonMst = new JSONObject();
|
||||
JSONObject jsonMst = whereJson;
|
||||
whereJson.remove("tableData");
|
||||
jsonMst = (JSONObject) JSON.toJSON(whereJson);
|
||||
String mark_code = jsonMst.getString("mark_code");
|
||||
String mark_id = jsonMst.getString("mark_id");
|
||||
|
||||
JSONObject oldJO = mstTab.query("mark_id <> '" + mark_id + "' and mark_code='"+mark_code+"'").uniqueResult(0);
|
||||
if(oldJO !=null){
|
||||
throw new BadRequestException("已存在相同牌号!");
|
||||
}
|
||||
JSONObject now = mstTab.query("mark_id = '" + mark_id + "'").uniqueResult(0);
|
||||
//主表
|
||||
now.put("mark_code", jsonMst.getString("mark_code"));
|
||||
now.put("c_balance", jsonMst.getString("c_balance"));
|
||||
now.put("liquid_rate", jsonMst.getString("liquid_rate"));
|
||||
now.put("ball_rate", jsonMst.getString("ball_rate"));
|
||||
now.put("ball_speed", jsonMst.getString("ball_speed"));
|
||||
now.put("ball_time", jsonMst.getString("ball_time"));
|
||||
now.put("remark", jsonMst.getString("remark"));
|
||||
String formula_id = jsonMst.getString("formula_id");
|
||||
JSONObject now = mstTab.query("formula_id = '" + formula_id + "'").uniqueResult(0);
|
||||
//成品物料id
|
||||
String inspection_id = whereJson.getString("inspection_id");
|
||||
JSONObject FactoryWarrantyMst = QL_TEST_FactoryWarrantyMst.query("inspection_id='"+inspection_id+"'").uniqueResult(0);
|
||||
|
||||
String material_pcsn = FactoryWarrantyMst.getString("pcsn");
|
||||
now.put("material_pcsn", material_pcsn);
|
||||
now.put("update_optid", currentUserId);
|
||||
now.put("update_optname", nickName);
|
||||
now.put("update_time", DateUtil.now());
|
||||
//删明细
|
||||
dtlTab.delete("mark_id = '" + mark_id + "'");
|
||||
dtlTab.delete("formula_id = '" + formula_id + "'");
|
||||
//明细表
|
||||
now.put("detail_count", jsonArr.size() + "");
|
||||
mstTab.update(now);
|
||||
|
||||
double sum_qty = 0;
|
||||
// 明细表
|
||||
for (int i = 0; i < jsonArr.size(); i++) {
|
||||
JSONObject json = jsonArr.getJSONObject(i);
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
jsonDtl.put("bomdtl_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonDtl.put("mark_id", mark_id);
|
||||
jsonDtl.put("seqno", (i+1)+"");
|
||||
jsonDtl.put("formuladtl_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonDtl.put("formula_id", formula_id+"");
|
||||
jsonDtl.put("formula_code", now.getString("formula_code"));
|
||||
jsonDtl.put("seq_no", (i+1)+"");
|
||||
jsonDtl.put("material_type","01");
|
||||
jsonDtl.put("material_id", json.getString("material_id"));
|
||||
jsonDtl.put("standard_rate", json.getString("standard_rate"));
|
||||
jsonDtl.put("dtl_pcsn", json.getString("dtl_pcsn"));
|
||||
jsonDtl.put("formula_qty", json.getString("formula_qty"));
|
||||
jsonDtl.put("qty_unit_id", "2");
|
||||
jsonDtl.put("qty_unit_name", "克");
|
||||
sum_qty = sum_qty + json.getDouble("formula_qty");
|
||||
dtlTab.insert(jsonDtl);
|
||||
}
|
||||
now.put("confirm_qty", sum_qty);
|
||||
mstTab.update(now);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
public void deleteAll(JSONObject jo) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject mstTab = WQLObject.getWQLObject("QL_TEST_AcceptMark");
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("QL_TEST_AcceptMarkBOM");
|
||||
for (Long mark_id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("mark_id", String.valueOf(mark_id));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
mstTab.update(param);
|
||||
dtlTab.delete("mark_id='" + String.valueOf(mark_id) + "'");
|
||||
}
|
||||
WQLObject mstTab = WQLObject.getWQLObject("QL_TEST_AcceptFormula");
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("QL_TEST_AcceptFormulaDtl");
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("formula_id", jo.getString("formula_id"));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
mstTab.update(param);
|
||||
dtlTab.delete("formula_id='" + jo.getString("formula_id") + "'");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONArray getDtl(Map whereJson) {
|
||||
String mark_id = (String) whereJson.get("mark_id");
|
||||
JSONArray jsonArr = WQL.getWO("QMD_PD_ACCEPTFORMULA01").addParam("flag", "2").addParam("mark_id", mark_id).process().getResultJSONArray(0);
|
||||
return jsonArr;
|
||||
WQLObject md_pb_classstandard = WQLObject.getWQLObject("md_pb_classstandard");
|
||||
String formula_id = (String) whereJson.get("formula_id");
|
||||
JSONArray jsonArr = WQL.getWO("QMD_PD_ACCEPTFORMULA01").addParam("flag", "2").addParam("formula_id", formula_id).process().getResultJSONArray(0);
|
||||
JSONArray newJa = new JSONArray();
|
||||
for(int i=0;i<jsonArr.size();i++){
|
||||
JSONObject jo =jsonArr.getJSONObject(i);
|
||||
String material_id = jo.getString("material_id");
|
||||
JSONObject type = md_pb_classstandard.query("class_id='"+material_id+"'").uniqueResult(0);
|
||||
if(type != null){
|
||||
jo.put("material_name",type.getString("class_name"));
|
||||
jo.put("material_code",type.getString("class_code"));
|
||||
}
|
||||
newJa.add(jo);
|
||||
}
|
||||
return newJa;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -255,6 +285,7 @@ public class AcceptFormulaServiceImpl implements AcceptFormulaService {
|
||||
map.put("flag", "6");
|
||||
JSONArray ret = WQL.getWO("QMD_PD_ACCEPTFORMULA01").addParamMap(map).process().getResultJSONArray(0);
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("inspection_id",map.get("inspection_id"));
|
||||
jo.put("CJZB00007","0");
|
||||
jo.put("CJZB00001","0");
|
||||
jo.put("CJZB00002","0");
|
||||
@@ -263,6 +294,7 @@ public class AcceptFormulaServiceImpl implements AcceptFormulaService {
|
||||
jo.put("CJZB00020","0");
|
||||
jo.put("CJZB00004","0");
|
||||
if(ret.size() > 0){
|
||||
jo.put("manufactor",ret.getJSONObject(0).getString("manufactor"));
|
||||
for(int i=0;i<ret.size();i++){
|
||||
JSONObject now = ret.getJSONObject(i);
|
||||
String inspection_item_code = now.getString("inspection_item_code");
|
||||
@@ -294,6 +326,18 @@ public class AcceptFormulaServiceImpl implements AcceptFormulaService {
|
||||
JSONObject jo = mstTab.query("mark_id='"+mark_id+"'").uniqueResult(0);
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getPCSNid(Map whereJson) {
|
||||
HashMap<String, String> map = new HashMap<>(whereJson);
|
||||
WQLObject mstTab = WQLObject.getWQLObject("QL_TEST_FactoryWarrantyMst");
|
||||
String material_id = map.get("material_id");
|
||||
String material_pcsn = map.get("material_pcsn");
|
||||
JSONObject jo = mstTab.query("is_delete='0' and material_id='"+material_id+"' and pcsn='"+material_pcsn+"'").uniqueResult(0);
|
||||
whereJson.put("inspection_id",jo.getString("inspection_id"));
|
||||
jo = this.getPCSN(whereJson);
|
||||
return jo;
|
||||
}
|
||||
@Override
|
||||
public JSONObject createPcsn() {
|
||||
JSONObject jo = new JSONObject();
|
||||
@@ -301,4 +345,586 @@ public class AcceptFormulaServiceImpl implements AcceptFormulaService {
|
||||
jo.put("accept_pcsn",ACCEPT_PCSN);
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONArray autoCalculation(Map map) {
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(map));
|
||||
JSONArray result = this.autoCalculationBy01(json);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新料模式开单
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
JSONArray autoCalculationBy01(JSONObject json){
|
||||
//需配新料集合
|
||||
JSONArray xl_list = new JSONArray();
|
||||
//需配成型剂集合
|
||||
JSONArray cxj_list = new JSONArray();
|
||||
//需抑制剂剂集合
|
||||
JSONArray yzj_list = new JSONArray();
|
||||
//需抑碳粉钨粉集合
|
||||
JSONArray cw_list = new JSONArray();
|
||||
//新料配粉环节
|
||||
JSONObject ret = this.autoCalculationBy01_xinliao(json);
|
||||
xl_list = ret.getJSONArray("xl_list");
|
||||
cxj_list = ret.getJSONArray("cxj_list");
|
||||
yzj_list = ret.getJSONArray("yzj_list");
|
||||
cw_list = ret.getJSONArray("cw_list");
|
||||
|
||||
/*12、分别返回主桶、副桶配粉物料:
|
||||
单次投料:主桶:新料+软废+成型剂;
|
||||
二次投料:主桶:新料+成型剂;副桶:各软废
|
||||
其中:软废还要返回各成型剂含量*/
|
||||
//主桶
|
||||
JSONArray tableDtl = new JSONArray();
|
||||
if(xl_list!=null){
|
||||
List<JSONObject> list = JSONObject.parseArray(xl_list.toJSONString(), JSONObject.class);
|
||||
Collections.sort(list, (JSONObject o1, JSONObject o2) -> {
|
||||
//转成JSON对象中保存的值类型
|
||||
double a = Double.parseDouble(o1.getString("seqno"));
|
||||
double b = Double.parseDouble(o2.getString("seqno"));
|
||||
// 如果a, b数据类型为int,可直接 return a - b ;(升序,降序为 return b - a;)
|
||||
if (a > b) { //降序排列,升序改成a>b
|
||||
return 1;
|
||||
} else if(a == b) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
});
|
||||
xl_list = JSONArray.parseArray(JSON.toJSONString(list));
|
||||
|
||||
xl_list.forEach((value)->{
|
||||
JSONObject jo = (JSONObject) value;
|
||||
tableDtl.add(jo);
|
||||
});
|
||||
}
|
||||
yzj_list.forEach((value)->{
|
||||
JSONObject jo = (JSONObject) value;
|
||||
jo.put("is_need_manage","1");
|
||||
jo.put("bucket_type","01");
|
||||
tableDtl.add(jo);
|
||||
});
|
||||
cw_list.forEach((value)->{
|
||||
JSONObject jo = (JSONObject) value;
|
||||
jo.put("bucket_type","01");
|
||||
tableDtl.add(jo);
|
||||
});
|
||||
cxj_list.forEach((value)->{
|
||||
JSONObject jo = (JSONObject) value;
|
||||
jo.put("bucket_type","01");
|
||||
tableDtl.add(jo);
|
||||
});
|
||||
JSONArray dtl_new = new JSONArray();
|
||||
for(int i=0;i<tableDtl.size();i++){
|
||||
JSONObject jo = tableDtl.getJSONObject(i);
|
||||
double formula_qty = jo.getDouble("formula_qty");
|
||||
if(formula_qty < 0.001){
|
||||
continue;
|
||||
}
|
||||
String material_type_id = jo.getString("material_type_id");
|
||||
//成型剂
|
||||
if (StrUtil.isNotEmpty(jo.getString("formingtype_code"))) {
|
||||
jo.put("is_"+jo.getString("formingtype_code"),"100");
|
||||
}else if(StrUtil.isNotEmpty(material_type_id) && MaterOptTypeEnum.THW.getClass_idStr().contains(material_type_id)){//碳化钨新料
|
||||
//获取修正值
|
||||
double change_qty = this.getWCChange(jo.getString("material_id"),jo.getString("pcsn"));
|
||||
jo.put("change_qty",change_qty);
|
||||
|
||||
//获取碳含量
|
||||
JSONObject FactoryWarranty = WQL.getWO("QPF_AUTOFORMULA02")
|
||||
.addParam("material_id",jo.getString("material_id"))
|
||||
.addParam("pcsn",jo.getString("pcsn"))
|
||||
.addParam("flag","3")
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
if(FactoryWarranty==null){
|
||||
jo.put("is_tan","0");
|
||||
}else{
|
||||
//含碳比
|
||||
double value = FactoryWarranty.getDouble("value");
|
||||
//更新含碳比
|
||||
jo.put("is_tan",value);
|
||||
}
|
||||
//获取碳化铬
|
||||
JSONObject FactoryWarranty2 = WQL.getWO("QPF_AUTOFORMULA02")
|
||||
.addParam("material_id",jo.getString("material_id"))
|
||||
.addParam("dtlmaterial_id","CJZB00021")
|
||||
.addParam("pcsn",jo.getString("pcsn"))
|
||||
.addParam("flag","33")
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
if(FactoryWarranty2==null){
|
||||
jo.put("is_CJZB00021","0");
|
||||
}else{
|
||||
//含碳比
|
||||
double value = FactoryWarranty2.getDouble("value");
|
||||
//更新含碳比
|
||||
jo.put("is_CJZB00021",value);
|
||||
}
|
||||
//获取碳化钒
|
||||
JSONObject FactoryWarranty3 = WQL.getWO("QPF_AUTOFORMULA02")
|
||||
.addParam("material_id",jo.getString("material_id"))
|
||||
.addParam("dtlmaterial_id","CJZB00020")
|
||||
.addParam("pcsn",jo.getString("pcsn"))
|
||||
.addParam("flag","33")
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
if(FactoryWarranty3==null){
|
||||
jo.put("is_CJZB00020","0");
|
||||
}else{
|
||||
//含碳比
|
||||
double value = FactoryWarranty3.getDouble("value");
|
||||
//更新含碳比
|
||||
jo.put("is_CJZB00020",value);
|
||||
}
|
||||
}else if(MaterOptTypeEnum.GF.getClass_idStr().contains(jo.getString("material_id")) ||(StrUtil.isNotEmpty(material_type_id) && MaterOptTypeEnum.GF.getClass_idStr().contains(material_type_id))){//钴粉新料
|
||||
//如果该物料是钴粉
|
||||
jo.put("is_09030102","100");
|
||||
}else if(MaterOptTypeEnum.TF.getClass_idStr().contains(jo.getString("material_id")) ||(StrUtil.isNotEmpty(material_type_id) && MaterOptTypeEnum.TF.getClass_idStr().contains(material_type_id))){//C粉新料
|
||||
//如果该物料是c粉
|
||||
jo.put("is_tan","100");
|
||||
}
|
||||
dtl_new.add(jo);
|
||||
}
|
||||
JSONArray result = dtl_new;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 纯新料
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
JSONObject autoCalculationBy01_xinliao(JSONObject json){
|
||||
WQLObject md_me_materialbase = WQLObject.getWQLObject("md_me_materialbase");
|
||||
WQLObject QL_TEST_FactoryWarrantyMst = WQLObject.getWQLObject("QL_TEST_FactoryWarrantyMst");
|
||||
//定义返回值
|
||||
JSONObject ret = new JSONObject();
|
||||
//总重
|
||||
double workorder_qty = json.getDouble("accept_qty");
|
||||
//成品碳平衡
|
||||
double c_balance = json.getDouble("c_balance");
|
||||
//成品物料id
|
||||
String material_id = json.getString("material_id");
|
||||
//成品物料id
|
||||
String mark_id = json.getString("mark_id");
|
||||
//查物料
|
||||
JSONObject mater = md_me_materialbase.query("material_id ='"+material_id+"'").uniqueResult(0);
|
||||
//成品物料编码
|
||||
String material_code = mater.getString("material_code");
|
||||
//成品物料id
|
||||
String inspection_id = json.getString("inspection_id");
|
||||
JSONObject FactoryWarrantyMst = QL_TEST_FactoryWarrantyMst.query("inspection_id='"+inspection_id+"'").uniqueResult(0);
|
||||
|
||||
String material_pcsn = FactoryWarrantyMst.getString("pcsn");
|
||||
//需配新料集合
|
||||
JSONArray xl_list = new JSONArray();
|
||||
//需配成型剂集合
|
||||
JSONArray cxj_list = new JSONArray();
|
||||
//需抑制剂剂集合
|
||||
JSONArray yzj_list = new JSONArray();
|
||||
//需抑碳粉钨粉集合
|
||||
JSONArray cw_list = new JSONArray();
|
||||
//需分配新料重量
|
||||
double new_qty = workorder_qty;
|
||||
//新料配粉环节
|
||||
JSONArray bomdlts = WQL.getWO("QPF_AUTOFORMULA02")
|
||||
.addParam("mark_id",mark_id)
|
||||
.addParam("flag","1")
|
||||
.addParam("is_need_manage","1")
|
||||
.process().getResultJSONArray(0);
|
||||
if(bomdlts.size() == 0 ){
|
||||
throw new BadRequestException("当前物料"+material_code+" "+json.getString("material_name")+",bom异常!");
|
||||
}
|
||||
//各批次配粉开单重量
|
||||
HashMap<String,JSONObject> bomdlts_plan_map = new HashMap<String,JSONObject>();
|
||||
//不需要移库的添加剂(抑制剂)集合
|
||||
HashMap<String,JSONObject> yzj_map = new HashMap<String,JSONObject>();
|
||||
//各批次碳化钨配粉开单重量
|
||||
JSONArray bomdlts_Cr3C2 = new JSONArray();
|
||||
//各碳化乌含量百比分之和
|
||||
double sum_Cr3C2 = 0;
|
||||
int num = 0;
|
||||
for(int i=0;i<bomdlts.size();i++){
|
||||
JSONObject bomdlt = bomdlts.getJSONObject(i);
|
||||
double nedd_qty = new_qty*bomdlt.getDouble("standard_rate")/100.0;
|
||||
nedd_qty = NumberUtil.round(nedd_qty,3).doubleValue();
|
||||
bomdlt.put("need_qty",nedd_qty);
|
||||
String material_type_id = bomdlt.getString("material_type_id");
|
||||
String bomdtl_material_id = bomdlt.getString("material_id");
|
||||
//如果该物料是碳化钨
|
||||
if(MaterOptTypeEnum.THW.getClass_idStr().contains(material_type_id)){
|
||||
if(!bomdtl_material_id.equals(material_id)){
|
||||
throw new BadRequestException("当前Bom碳化钨与输入的碳化钨不同!");
|
||||
}
|
||||
bomdlt.put("is_thw","1");
|
||||
bomdlt.put("dtl_pcsn",material_pcsn);
|
||||
sum_Cr3C2 = sum_Cr3C2 + bomdlt.getDouble("standard_rate");
|
||||
num++;
|
||||
}
|
||||
String is_need_move = bomdlt.getString("is_need_move");
|
||||
if("1".equals(is_need_move)){
|
||||
bomdlt.put("need_sum_qty",nedd_qty);
|
||||
bomdlt.put("bom_ivt_qty",nedd_qty);
|
||||
//如果该物料是碳化钨
|
||||
if(MaterOptTypeEnum.THW.getClass_idStr().contains(material_type_id)){
|
||||
bomdlts_Cr3C2.add(bomdlt);
|
||||
}
|
||||
bomdlts_plan_map.put(bomdtl_material_id,bomdlt);
|
||||
}
|
||||
else{//抑制剂
|
||||
|
||||
bomdlt.put("finished_qty",0);
|
||||
bomdlt.put("need_sum_qty",nedd_qty);
|
||||
bomdlt.put("dtl_pcsn","");
|
||||
yzj_map.put(bomdtl_material_id,bomdlt);
|
||||
}
|
||||
}
|
||||
if(num>1){
|
||||
throw new BadRequestException("当前Bom碳化钨有多个!");
|
||||
}
|
||||
//计算碳化钨总碳
|
||||
double CT1 = 0;
|
||||
//计算碳化钨总重
|
||||
double CT1_weight = 0;
|
||||
for(int i=0;i<bomdlts_Cr3C2.size();i++){
|
||||
JSONObject bomdlt_Cr3C2 = bomdlts_Cr3C2.getJSONObject(i);
|
||||
//获取碳含量
|
||||
JSONObject FactoryWarranty = WQL.getWO("QPF_AUTOFORMULA02")
|
||||
.addParam("material_id",bomdlt_Cr3C2.getString("material_id"))
|
||||
.addParam("pcsn",material_pcsn)
|
||||
.addParam("flag","3")
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
if(FactoryWarranty==null){
|
||||
throw new BadRequestException("物料"+bomdlt_Cr3C2.getString("material_code")+" "+bomdlt_Cr3C2.getString("material_name")+"厂家质保书数据异常!");
|
||||
}
|
||||
//重量
|
||||
double bom_ivt_qty = bomdlt_Cr3C2.getDouble("bom_ivt_qty");
|
||||
//含碳比
|
||||
double value = FactoryWarranty.getDouble("value");
|
||||
//获取修正值
|
||||
double change_qty = this.getWCChange(bomdlt_Cr3C2.getString("material_id"),bomdlt_Cr3C2.getString("pcsn"));
|
||||
value = value + change_qty;
|
||||
//总碳
|
||||
CT1 = CT1 + bom_ivt_qty*value/100.0;
|
||||
CT1_weight = CT1_weight + bom_ivt_qty;
|
||||
//更新含碳比
|
||||
bomdlt_Cr3C2.put("is_tan",value);
|
||||
bomdlts_plan_map.put(bomdlt_Cr3C2.getString("material_id"),bomdlt_Cr3C2);
|
||||
}
|
||||
//BOM中碳化钨需含总碳
|
||||
double CT2 = new_qty*(sum_Cr3C2/100.0)*(c_balance/100.0);
|
||||
//配粉结束
|
||||
if(CT1==CT2){
|
||||
//假设碳粉重量为W
|
||||
JSONObject bomdlt_Cr3C2 = bomdlts_Cr3C2.getJSONObject(0);
|
||||
//统计除钨以外其他总重
|
||||
AtomicReference<Double> total_sum = new AtomicReference<>(0.0);
|
||||
|
||||
double bom_ivt_qty = bomdlt_Cr3C2.getDouble("bom_ivt_qty");
|
||||
total_sum.set(total_sum.get() + bom_ivt_qty);
|
||||
//计算不需要移库的添加剂(抑制剂)
|
||||
yzj_map.forEach((key,tjj_map_jo)->{
|
||||
//获取添加剂id
|
||||
String tjj_material_id = tjj_map_jo.getString("material_id");
|
||||
JSONObject tjj_finished = WQL.getWO("QPF_AUTOFORMULA02")
|
||||
.addParam("material_id",bomdlt_Cr3C2.getString("material_id"))
|
||||
.addParam("pcsn",bomdlt_Cr3C2.getString("pcsn"))
|
||||
.addParam("item_material_id",tjj_material_id)
|
||||
.addParam("flag","5")
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
if(tjj_finished!=null){
|
||||
//已配重量
|
||||
double finished_qty = tjj_map_jo.getDouble("finished_qty");
|
||||
//质保书含量比
|
||||
double value = tjj_finished.getDouble("value");
|
||||
//当前含量重量
|
||||
double finished = bom_ivt_qty*value/100.0;
|
||||
//累计各碳化钨中已含添加剂重量
|
||||
tjj_map_jo.put("finished_qty",finished_qty+finished);
|
||||
yzj_map.put(tjj_material_id,tjj_map_jo);
|
||||
}
|
||||
});
|
||||
//判断已含添加剂与需配添加剂大小
|
||||
yzj_map.forEach((key,tjj_map_now)->{
|
||||
//需配添加剂重量
|
||||
double need_qty = NumberUtil.round(tjj_map_now.getDouble("need_qty"),3).doubleValue();
|
||||
//当前添加剂已配
|
||||
double finished_qty = NumberUtil.round(tjj_map_now.getDouble("finished_qty"),3).doubleValue();
|
||||
//已配小于需配
|
||||
if(finished_qty<need_qty){
|
||||
tjj_map_now.put("formula_qty",need_qty-finished_qty);
|
||||
tjj_map_now.put("material_type","01");
|
||||
tjj_map_now.put("is_need_move","0");
|
||||
tjj_map_now.put("is_need_manage","1");
|
||||
tjj_map_now.put("is_rf_xl","0");
|
||||
tjj_map_now.put("ivt_level","01");
|
||||
tjj_map_now.put("is_active","1");
|
||||
tjj_map_now.put("quality_scode","01");
|
||||
yzj_list.add(tjj_map_now);
|
||||
total_sum.set(total_sum.get() + need_qty-finished_qty);
|
||||
}
|
||||
});
|
||||
double W = new_qty - total_sum.get();
|
||||
if(W>0){
|
||||
JSONObject W_weight = new JSONObject();
|
||||
W_weight.put("formula_qty",W);
|
||||
//钨分类id
|
||||
W_weight.put("material_id","1503644362234531840");
|
||||
W_weight.put("material_name","钨粉");
|
||||
W_weight.put("material_code","09030103");
|
||||
W_weight.put("material_type","02");
|
||||
W_weight.put("is_need_move","0");
|
||||
W_weight.put("is_need_manage","1");
|
||||
W_weight.put("is_rf_xl","0");
|
||||
W_weight.put("ivt_level","01");
|
||||
W_weight.put("is_active","1");
|
||||
W_weight.put("quality_scode","01");
|
||||
cw_list.add(W_weight);
|
||||
}
|
||||
}else
|
||||
//需配碳粉
|
||||
if(CT1<CT2){
|
||||
//只配库存明细时
|
||||
if(bomdlts_Cr3C2.size()==1){
|
||||
//假设碳粉重量为W
|
||||
JSONObject bomdlt_Cr3C2 = bomdlts_Cr3C2.getJSONObject(0);
|
||||
|
||||
//该批次配粉重量
|
||||
double X22p = bomdlt_Cr3C2.getDouble("bom_ivt_qty");
|
||||
|
||||
//获取碳含量
|
||||
JSONObject FactoryWarranty = bomdlts_plan_map.get(bomdlt_Cr3C2.getString("material_id"));
|
||||
//该批次含碳比
|
||||
double X22 = FactoryWarranty.getDouble("is_tan");
|
||||
// X1减=[产品碳平衡*X1- X1* X22碳含量]/(1- * X22碳含量)
|
||||
|
||||
double X22_jian = CT1_weight*(c_balance/100.0-X22/100.0)/(1-X22/100.0);
|
||||
//更新碳化钨配粉重量
|
||||
double bom_ivt_qty = X22p-X22_jian;
|
||||
if(bom_ivt_qty < 0){
|
||||
throw new BadRequestException("碳化钨配粉结果为负数,当前配粉无解!");
|
||||
}
|
||||
double C = X22_jian;
|
||||
if(C < 0){
|
||||
throw new BadRequestException("补碳结果为负数,当前配粉无解!");
|
||||
}else if(C >= 0){
|
||||
bomdlt_Cr3C2.put("bom_ivt_qty",bom_ivt_qty);
|
||||
bomdlts_plan_map.put(bomdlt_Cr3C2.getString("material_id"),bomdlt_Cr3C2);
|
||||
|
||||
//统计除钨以外其他总重
|
||||
AtomicReference<Double> total_sum = new AtomicReference<>(0.0);
|
||||
|
||||
total_sum.set(total_sum.get() + bomdlt_Cr3C2.getDouble("bom_ivt_qty"));
|
||||
//计算不需要移库的添加剂(抑制剂)
|
||||
yzj_map.forEach((key,tjj_map_jo)->{
|
||||
//获取添加剂id
|
||||
String tjj_material_id = tjj_map_jo.getString("material_id");
|
||||
JSONObject tjj_finished = WQL.getWO("QPF_AUTOFORMULA02")
|
||||
.addParam("material_id",bomdlt_Cr3C2.getString("material_id"))
|
||||
.addParam("pcsn",bomdlt_Cr3C2.getString("pcsn"))
|
||||
.addParam("item_material_id",tjj_material_id)
|
||||
.addParam("flag","5")
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
if(tjj_finished!=null){
|
||||
//已配重量
|
||||
double finished_qty = tjj_map_jo.getDouble("finished_qty");
|
||||
//质保书含量比
|
||||
double value = tjj_finished.getDouble("value");
|
||||
//当前含量重量
|
||||
double finished = bom_ivt_qty*value/100.0;
|
||||
//累计各碳化钨中已含添加剂重量
|
||||
tjj_map_jo.put("finished_qty",finished_qty+finished);
|
||||
yzj_map.put(tjj_material_id,tjj_map_jo);
|
||||
}
|
||||
});
|
||||
//判断已含添加剂与需配添加剂大小
|
||||
yzj_map.forEach((key,tjj_map_now)->{
|
||||
//需配添加剂重量
|
||||
double need_qty = NumberUtil.round(tjj_map_now.getDouble("need_qty"),3).doubleValue();
|
||||
//当前添加剂已配
|
||||
double finished_qty = NumberUtil.round(tjj_map_now.getDouble("finished_qty"),3).doubleValue();
|
||||
//已配小于需配
|
||||
if(finished_qty<need_qty){
|
||||
tjj_map_now.put("formula_qty",need_qty-finished_qty);
|
||||
tjj_map_now.put("material_type","01");
|
||||
tjj_map_now.put("is_need_move","0");
|
||||
tjj_map_now.put("is_need_manage","1");
|
||||
tjj_map_now.put("is_rf_xl","0");
|
||||
tjj_map_now.put("ivt_level","01");
|
||||
tjj_map_now.put("is_active","1");
|
||||
tjj_map_now.put("quality_scode","01");
|
||||
yzj_list.add(tjj_map_now);
|
||||
total_sum.set(total_sum.get() + need_qty-finished_qty);
|
||||
}
|
||||
});
|
||||
if(C>0){
|
||||
JSONObject C_weight = new JSONObject();
|
||||
C_weight.put("formula_qty",C);
|
||||
//钨分类id
|
||||
C_weight.put("material_id","1503644362788179968");
|
||||
C_weight.put("material_name","碳粉");
|
||||
C_weight.put("material_code","09030104");
|
||||
C_weight.put("material_type","02");
|
||||
C_weight.put("is_need_move","0");
|
||||
C_weight.put("is_need_manage","1");
|
||||
C_weight.put("is_tan","100");
|
||||
C_weight.put("is_rf_xl","1");
|
||||
C_weight.put("ivt_level","01");
|
||||
C_weight.put("is_active","1");
|
||||
C_weight.put("quality_scode","01");
|
||||
cw_list.add(C_weight);
|
||||
total_sum.set(total_sum.get() + C);
|
||||
}
|
||||
double W = new_qty - total_sum.get();
|
||||
if(W>0){
|
||||
JSONObject W_weight = new JSONObject();
|
||||
W_weight.put("formula_qty",W);
|
||||
//钨分类id
|
||||
W_weight.put("material_id","1503644362234531840");
|
||||
W_weight.put("material_name","钨粉");
|
||||
W_weight.put("material_code","09030103");
|
||||
W_weight.put("material_type","02");
|
||||
W_weight.put("is_need_move","0");
|
||||
W_weight.put("is_need_manage","1");
|
||||
W_weight.put("is_rf_xl","0");
|
||||
W_weight.put("ivt_level","01");
|
||||
W_weight.put("is_active","1");
|
||||
W_weight.put("quality_scode","01");
|
||||
cw_list.add(W_weight);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else
|
||||
//需配钨粉
|
||||
if(CT1>CT2){
|
||||
//只配库存明细时
|
||||
if(bomdlts_Cr3C2.size()==1){
|
||||
//假设钨粉重量为W
|
||||
JSONObject bomdlt_Cr3C2 = bomdlts_Cr3C2.getJSONObject(0);
|
||||
//获取碳含量
|
||||
JSONObject FactoryWarranty = bomdlts_plan_map.get(bomdlt_Cr3C2.getString("material_id"));
|
||||
//该批次含碳比
|
||||
double X22 = FactoryWarranty.getDouble("is_tan");
|
||||
//该批次配粉重量
|
||||
double X22p = bomdlt_Cr3C2.getDouble("bom_ivt_qty");
|
||||
|
||||
// X1减=[产品碳平衡*X1-(X1)* X1碳含量]/(1-X1碳含量)
|
||||
//解得钨粉重量
|
||||
double X22_jian = CT1_weight*(c_balance/100.0-X22/100.0) / (1-X22/100.0);
|
||||
//更新碳化钨配粉重量
|
||||
double bom_ivt_qty = X22p-X22_jian;
|
||||
if(bom_ivt_qty<=0){
|
||||
throw new BadRequestException("碳化钨为非正数,当前配粉无解!");
|
||||
}
|
||||
bomdlt_Cr3C2.put("bom_ivt_qty",bom_ivt_qty);
|
||||
bomdlts_plan_map.put(bomdlt_Cr3C2.getString("material_id"),bomdlt_Cr3C2);
|
||||
//统计除钨以外其他总重
|
||||
AtomicReference<Double> total_sum = new AtomicReference<>(0.0);
|
||||
|
||||
total_sum.set(total_sum.get() + bomdlt_Cr3C2.getDouble("bom_ivt_qty"));
|
||||
//计算不需要移库的添加剂
|
||||
yzj_map.forEach((key,tjj_map_jo)->{
|
||||
//获取添加剂id
|
||||
String tjj_material_id = tjj_map_jo.getString("material_id");
|
||||
JSONObject tjj_finished = WQL.getWO("QPF_AUTOFORMULA02")
|
||||
.addParam("material_id",bomdlt_Cr3C2.getString("material_id"))
|
||||
.addParam("pcsn",bomdlt_Cr3C2.getString("pcsn"))
|
||||
.addParam("item_material_id",tjj_material_id)
|
||||
.addParam("flag","5")
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
if(tjj_finished!=null){
|
||||
//已配重量
|
||||
double finished_qty = tjj_map_jo.getDouble("finished_qty");
|
||||
//质保书含量比
|
||||
double value = tjj_finished.getDouble("value");
|
||||
//当前含量重量
|
||||
double finished = bom_ivt_qty*value/100.0;
|
||||
//累计各碳化钨中已含添加剂重量
|
||||
tjj_map_jo.put("finished_qty",finished_qty+finished);
|
||||
yzj_map.put(tjj_material_id,tjj_map_jo);
|
||||
}
|
||||
});
|
||||
//判断已含添加剂与需配添加剂大小
|
||||
yzj_map.forEach((key,tjj_map_now)->{
|
||||
//需配添加剂重量
|
||||
double need_qty = NumberUtil.round(tjj_map_now.getDouble("need_qty"),3).doubleValue();
|
||||
//当前添加剂已配
|
||||
double finished_qty = NumberUtil.round(tjj_map_now.getDouble("finished_qty"),3).doubleValue();
|
||||
//已配小于需配
|
||||
if(finished_qty<need_qty){
|
||||
tjj_map_now.put("formula_qty",need_qty-finished_qty);
|
||||
tjj_map_now.put("material_type","01");
|
||||
tjj_map_now.put("is_need_move","0");
|
||||
tjj_map_now.put("is_need_manage","1");
|
||||
tjj_map_now.put("is_rf_xl","0");
|
||||
tjj_map_now.put("ivt_level","01");
|
||||
tjj_map_now.put("is_active","1");
|
||||
tjj_map_now.put("quality_scode","01");
|
||||
yzj_list.add(tjj_map_now);
|
||||
total_sum.set(total_sum.get() + need_qty-finished_qty);
|
||||
}
|
||||
});
|
||||
double W = new_qty - total_sum.get();
|
||||
if(W>0){
|
||||
JSONObject W_weight = new JSONObject();
|
||||
W_weight.put("formula_qty",W);
|
||||
//钨分类id
|
||||
W_weight.put("material_id","1503644362234531840");
|
||||
W_weight.put("material_name","钨粉");
|
||||
W_weight.put("material_code","09030103");
|
||||
W_weight.put("material_type","02");
|
||||
W_weight.put("is_need_move","0");
|
||||
W_weight.put("is_need_manage","1");
|
||||
W_weight.put("is_rf_xl","0");
|
||||
W_weight.put("ivt_level","01");
|
||||
W_weight.put("is_active","1");
|
||||
W_weight.put("quality_scode","01");
|
||||
cw_list.add(W_weight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bomdlts_plan_map.forEach((key,bomdlts_plan)->{
|
||||
bomdlts_plan.put("formula_qty",bomdlts_plan.getDouble("bom_ivt_qty"));
|
||||
bomdlts_plan.put("is_rf_xl","1");
|
||||
xl_list.add(bomdlts_plan);
|
||||
});
|
||||
ret.put("xl_list",xl_list);
|
||||
ret.put("cxj_list",cxj_list);
|
||||
ret.put("yzj_list",yzj_list);
|
||||
ret.put("cw_list",cw_list);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public double getWCChange(String material_id,String pcsn){
|
||||
WQLObject PDM_BI_SuppWCChange = WQLObject.getWQLObject("PDM_BI_SuppWCChange"); // 工艺路线主表
|
||||
double wcchange = 0.0;
|
||||
|
||||
//获取碳化钒
|
||||
JSONObject FactoryWarranty = WQL.getWO("QPF_INITFORMULA01")
|
||||
.addParam("material_id",material_id)
|
||||
.addParam("pcsn",pcsn)
|
||||
.addParam("flag","9")
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
if(FactoryWarranty!=null){
|
||||
String source_id = FactoryWarranty.getString("source_id");
|
||||
JSONObject jo = PDM_BI_SuppWCChange.query("material_id='"+material_id+"' and supp_id='"+source_id+"'").uniqueResult(0);
|
||||
if(jo!=null){
|
||||
wcchange = jo.getDouble("change_qty");
|
||||
}
|
||||
}
|
||||
|
||||
return wcchange;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.material_id TYPEAS s_string
|
||||
输入.inspection_id TYPEAS s_string
|
||||
|
||||
输入.formula_id TYPEAS s_string
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
@@ -87,14 +87,14 @@
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
AcceptMarkBOM.*,
|
||||
AcceptFormulaDtl.*,
|
||||
mater.material_code,
|
||||
mater.material_name
|
||||
FROM
|
||||
QL_TEST_AcceptMarkBOM AcceptMarkBOM
|
||||
LEFT JOIN MD_ME_MaterialBase mater ON AcceptMarkBOM.material_id = mater.material_id
|
||||
QL_TEST_AcceptFormulaDtl AcceptFormulaDtl
|
||||
LEFT JOIN MD_ME_MaterialBase mater ON AcceptFormulaDtl.material_id = mater.material_id
|
||||
WHERE 1=1
|
||||
and AcceptMarkBOM.mark_id = 输入.mark_id
|
||||
and AcceptFormulaDtl.formula_id = 输入.formula_id
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -154,10 +154,12 @@
|
||||
SELECT
|
||||
FactoryWarrantyDtl.*,
|
||||
inspectionitempoint.inspection_item_code,
|
||||
inspectionitempoint.inspection_item_name
|
||||
inspectionitempoint.inspection_item_name,
|
||||
FactoryWarrantyMst.manufactor
|
||||
FROM
|
||||
QL_TEST_FactoryWarrantyDtl FactoryWarrantyDtl
|
||||
LEFT JOIN ql_test_inspectionitempoint inspectionitempoint ON FactoryWarrantyDtl.inspection_item_id = inspectionitempoint.inspection_item_id
|
||||
LEFT JOIN QL_TEST_FactoryWarrantyMst FactoryWarrantyMst ON FactoryWarrantyMst.inspection_id = FactoryWarrantyDtl.inspection_id
|
||||
WHERE
|
||||
1 = 1
|
||||
OPTION 输入.inspection_id <> ""
|
||||
|
||||
@@ -0,0 +1,352 @@
|
||||
[交易说明]
|
||||
交易名: 工艺路线分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.quality_scode TYPEAS s_string
|
||||
输入.prior_level TYPEAS s_string
|
||||
输入.material_id TYPEAS s_string
|
||||
输入.mark_id TYPEAS s_string
|
||||
输入.dtlmaterial_id TYPEAS s_string
|
||||
输入.material_code TYPEAS s_string
|
||||
输入.is_need_manage TYPEAS s_string
|
||||
输入.formingtype_id TYPEAS s_string
|
||||
输入.item_material_id TYPEAS s_string
|
||||
输入.is_active TYPEAS s_string
|
||||
输入.workorder_id TYPEAS s_string
|
||||
输入.pcsn TYPEAS s_string
|
||||
输入.nots TYPEAS f_string
|
||||
输入.is_pure TYPEAS s_string
|
||||
输入.set_type TYPEAS s_string
|
||||
输入.set_material_id TYPEAS s_string
|
||||
输入.material_type_id TYPEAS f_string
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
QUERY
|
||||
SELECT
|
||||
bomdtl.*,
|
||||
mater.is_need_move,
|
||||
MaterialBase.material_type_id,
|
||||
classstandard.class_code,
|
||||
MaterialBase.material_name,
|
||||
MaterialBase.material_code,
|
||||
FormingMaterial.formingtype_code
|
||||
FROM
|
||||
QL_TEST_AcceptMark bom
|
||||
LEFT JOIN QL_TEST_AcceptMarkBOM bomdtl ON bom.mark_id = bomdtl.mark_id
|
||||
LEFT JOIN MD_ME_StockMaterialExt mater ON mater.material_id = bomdtl.material_id
|
||||
LEFT JOIN MD_ME_MaterialBase MaterialBase ON MaterialBase.material_id = bomdtl.material_id
|
||||
LEFT JOIN md_pb_classstandard classstandard ON classstandard.class_id = MaterialBase.material_type_id
|
||||
LEFT JOIN MD_PD_FormingMaterial FormingMaterial ON FormingMaterial.material_id = bomdtl.material_id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND bom.is_delete = '0'
|
||||
OPTION 输入.mark_id <> ""
|
||||
bom.mark_id = 输入.mark_id
|
||||
ENDOPTION
|
||||
OPTION 输入.nots <> ""
|
||||
MaterialBase.material_type_id not in 输入.nots
|
||||
ENDOPTION
|
||||
ORDER BY bomdtl.seqno
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
structivt.*, mater.material_type_id,
|
||||
mater.material_code,
|
||||
mater.material_name
|
||||
FROM
|
||||
st_ivt_structivt structivt
|
||||
LEFT JOIN MD_ME_MaterialBase mater ON mater.material_id = structivt.material_id
|
||||
WHERE
|
||||
1 = 1
|
||||
OPTION 输入.material_id <> ""
|
||||
structivt.material_id = 输入.material_id
|
||||
ENDOPTION
|
||||
OPTION 输入.is_active <> ""
|
||||
structivt.is_active = 输入.is_active
|
||||
ENDOPTION
|
||||
ORDER BY structivt.material_id,structivt.pcsn
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "22"
|
||||
QUERY
|
||||
SELECT
|
||||
structivt.*,
|
||||
mb.material_name,
|
||||
mb.material_code,
|
||||
mb.material_type_id,
|
||||
stockmaterialext.is_need_move,
|
||||
CASE
|
||||
|
||||
WHEN FormulaDtl3.used__qty > 0 THEN
|
||||
structivt.sum_qty - FormulaDtl3.used__qty ELSE structivt.sum_qty
|
||||
END AS sum_ivt_qty
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SUM( ivt.canuse_qty ) AS sum_qty,
|
||||
ivt.qty_unit_id,
|
||||
ivt.qty_unit_name,
|
||||
ivt.material_id,
|
||||
ivt.pcsn,
|
||||
ivt.is_active,
|
||||
ivt.ivt_level,
|
||||
ivt.quality_scode
|
||||
FROM
|
||||
st_ivt_structivt ivt
|
||||
GROUP BY
|
||||
ivt.material_id,
|
||||
ivt.pcsn,
|
||||
ivt.is_active,
|
||||
ivt.ivt_level,
|
||||
ivt.quality_scode,
|
||||
ivt.qty_unit_id,
|
||||
ivt.qty_unit_name
|
||||
) structivt
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = structivt.material_id
|
||||
LEFT JOIN md_me_stockmaterialext stockmaterialext ON mb.material_id = stockmaterialext.material_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
SUM( FormulaDtl2.formula_qty - FormulaDtl2.put_qty ) AS used__qty,
|
||||
FormulaDtl2.material_id,
|
||||
FormulaDtl2.pcsn,
|
||||
FormulaDtl2.is_active,
|
||||
FormulaDtl2.ivt_level,
|
||||
FormulaDtl2.quality_scode
|
||||
FROM
|
||||
PDM_BI_FormulaDtl FormulaDtl2
|
||||
LEFT JOIN PDM_BI_Formula Formula2 ON FormulaDtl2.formula_id = Formula2.formula_id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND FormulaDtl2.STATUS <> '99'
|
||||
OPTION 输入.workorder_id <> ""
|
||||
Formula2.workorder_id <> 输入.workorder_id
|
||||
ENDOPTION
|
||||
GROUP BY
|
||||
FormulaDtl2.material_id,
|
||||
FormulaDtl2.pcsn,
|
||||
FormulaDtl2.is_active,
|
||||
FormulaDtl2.ivt_level,
|
||||
FormulaDtl2.quality_scode
|
||||
) FormulaDtl3 ON (
|
||||
FormulaDtl3.material_id = structivt.material_id
|
||||
AND FormulaDtl3.pcsn = structivt.pcsn
|
||||
AND FormulaDtl3.is_active = structivt.is_active
|
||||
AND FormulaDtl3.ivt_level = structivt.ivt_level
|
||||
AND FormulaDtl3.quality_scode = structivt.quality_scode
|
||||
)
|
||||
WHERE
|
||||
1 = 1
|
||||
AND structivt.sum_qty > 0
|
||||
OPTION 输入.material_id <> ""
|
||||
structivt.material_id = 输入.material_id
|
||||
ENDOPTION
|
||||
OPTION 输入.is_active <> ""
|
||||
structivt.is_active = 输入.is_active
|
||||
ENDOPTION
|
||||
OPTION 输入.quality_scode <> ""
|
||||
structivt.quality_scode = 输入.quality_scode
|
||||
ENDOPTION
|
||||
OPTION 输入.prior_level <> ""
|
||||
structivt.ivt_level <= 输入.prior_level
|
||||
ENDOPTION
|
||||
OPTION 输入.is_pure <> ""
|
||||
stockmaterialext.is_pure = 输入.is_pure
|
||||
ENDOPTION
|
||||
ORDER BY structivt.material_id,structivt.ivt_level desc,structivt.pcsn, structivt.sum_qty desc
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
FactoryWarrantyDtl.*
|
||||
FROM
|
||||
QL_TEST_FactoryWarrantyMst FactoryWarrantyMst
|
||||
LEFT JOIN QL_TEST_FactoryWarrantyDtl FactoryWarrantyDtl ON FactoryWarrantyDtl.inspection_id = FactoryWarrantyMst.inspection_id
|
||||
LEFT JOIN ql_test_inspectionitempoint inspectionitempoint ON inspectionitempoint.inspection_item_id = FactoryWarrantyDtl.inspection_item_id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND inspectionitempoint.inspection_item_code = 'CJZB00004'
|
||||
AND FactoryWarrantyMst.is_delete = '0'
|
||||
AND FactoryWarrantyMst.bill_status = '99'
|
||||
OPTION 输入.material_id <> ""
|
||||
FactoryWarrantyMst.material_id = 输入.material_id
|
||||
ENDOPTION
|
||||
OPTION 输入.pcsn <> ""
|
||||
FactoryWarrantyMst.pcsn = 输入.pcsn
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "33"
|
||||
QUERY
|
||||
SELECT
|
||||
FactoryWarrantyDtl.*
|
||||
FROM
|
||||
QL_TEST_FactoryWarrantyMst FactoryWarrantyMst
|
||||
LEFT JOIN QL_TEST_FactoryWarrantyDtl FactoryWarrantyDtl ON FactoryWarrantyDtl.inspection_id = FactoryWarrantyMst.inspection_id
|
||||
LEFT JOIN ql_test_inspectionitempoint inspectionitempoint ON inspectionitempoint.inspection_item_id = FactoryWarrantyDtl.inspection_item_id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND FactoryWarrantyMst.is_delete = '0'
|
||||
AND FactoryWarrantyMst.bill_status = '99'
|
||||
OPTION 输入.dtlmaterial_id <> ""
|
||||
inspectionitempoint.inspection_item_code = 输入.dtlmaterial_id
|
||||
ENDOPTION
|
||||
OPTION 输入.material_id <> ""
|
||||
FactoryWarrantyMst.material_id = 输入.material_id
|
||||
ENDOPTION
|
||||
OPTION 输入.pcsn <> ""
|
||||
FactoryWarrantyMst.pcsn = 输入.pcsn
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "4"
|
||||
QUERY
|
||||
SELECT
|
||||
bomdtl.*
|
||||
FROM
|
||||
MD_PD_ProductBOM bom
|
||||
LEFT JOIN md_pd_productbomdtl bomdtl ON bom.bom_id = bomdtl.bom_id
|
||||
LEFT JOIN MD_PD_FormingMaterial FormingMaterial ON FormingMaterial.material_id = bomdtl.material_id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND bom.is_delete = '0'
|
||||
AND bom.is_used = '1'
|
||||
AND bomdtl.is_need_manage='0'
|
||||
OPTION 输入.material_id <> ""
|
||||
bom.material_id = 输入.material_id
|
||||
ENDOPTION
|
||||
OPTION 输入.formingtype_id <> ""
|
||||
FormingMaterial.formingtype_id = 输入.formingtype_id
|
||||
ENDOPTION
|
||||
ORDER BY bomdtl.seqno
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "5"
|
||||
QUERY
|
||||
SELECT
|
||||
FactoryWarrantyDtl.*
|
||||
FROM
|
||||
QL_TEST_FactoryWarrantyMst FactoryWarrantyMst
|
||||
LEFT JOIN QL_TEST_FactoryWarrantyDtl FactoryWarrantyDtl ON FactoryWarrantyDtl.inspection_id = FactoryWarrantyMst.inspection_id
|
||||
LEFT JOIN ql_test_inspectionitempoint inspectionitempoint ON inspectionitempoint.inspection_item_id = FactoryWarrantyDtl.inspection_item_id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND FactoryWarrantyMst.is_delete = '0'
|
||||
AND FactoryWarrantyMst.bill_status = '99'
|
||||
OPTION 输入.material_id <> ""
|
||||
FactoryWarrantyMst.material_id = 输入.material_id
|
||||
ENDOPTION
|
||||
OPTION 输入.item_material_id <> ""
|
||||
inspectionitempoint.material_uuid = 输入.item_material_id
|
||||
ENDOPTION
|
||||
OPTION 输入.pcsn <> ""
|
||||
FactoryWarrantyMst.pcsn = 输入.pcsn
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "6"
|
||||
QUERY
|
||||
SELECT
|
||||
FactoryWarrantyDtl.* ,
|
||||
materialbase.material_name
|
||||
FROM
|
||||
QL_TEST_FactoryWarrantyMst FactoryWarrantyMst
|
||||
LEFT JOIN QL_TEST_FactoryWarrantyDtl FactoryWarrantyDtl ON FactoryWarrantyDtl.inspection_id = FactoryWarrantyMst.inspection_id
|
||||
LEFT JOIN ql_test_inspectionitempoint inspectionitempoint ON inspectionitempoint.inspection_item_id = FactoryWarrantyDtl.inspection_item_id
|
||||
LEFT JOIN md_me_materialbase materialbase ON materialbase.material_id = inspectionitempoint.material_uuid
|
||||
WHERE
|
||||
1 = 1
|
||||
AND FactoryWarrantyMst.is_delete = '0'
|
||||
AND FactoryWarrantyMst.bill_status = '99'
|
||||
AND FactoryWarrantyDtl.VALUE> 0
|
||||
OPTION 输入.material_id <> ""
|
||||
FactoryWarrantyMst.material_id = 输入.material_id
|
||||
ENDOPTION
|
||||
OPTION 输入.material_type_id <> ""
|
||||
materialbase.material_type_id in 输入.material_type_id
|
||||
ENDOPTION
|
||||
OPTION 输入.pcsn <> ""
|
||||
FactoryWarrantyMst.pcsn = 输入.pcsn
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "7"
|
||||
QUERY
|
||||
SELECT
|
||||
ProductMaterialSet.*,
|
||||
classstandard.class_code
|
||||
FROM
|
||||
MD_PD_ProductMaterialSet ProductMaterialSet
|
||||
left join md_me_materialbase materialbase on materialbase.material_id = ProductMaterialSet.set_material_id
|
||||
LEFT JOIN md_pb_classstandard classstandard ON classstandard.class_id = materialbase.material_type_id
|
||||
LEFT JOIN md_me_producmaterialext producmaterialext ON producmaterialext.material_id = materialbase.material_id
|
||||
WHERE
|
||||
1 = 1
|
||||
and producmaterialext.net_rate>0
|
||||
OPTION 输入.material_id <> ""
|
||||
ProductMaterialSet.material_id = 输入.material_id
|
||||
ENDOPTION
|
||||
OPTION 输入.set_material_id <> ""
|
||||
ProductMaterialSet.set_material_id = 输入.set_material_id
|
||||
ENDOPTION
|
||||
OPTION 输入.set_type <> ""
|
||||
ProductMaterialSet.set_type = 输入.set_type
|
||||
ENDOPTION
|
||||
order by classstandard.class_code asc,ProductMaterialSet.set_material_id
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -90,11 +90,11 @@ public class RawUatWcQueryServiceImpl implements RawUatWcQueryService {
|
||||
String inspection_item_id = jsonItem.getString("inspection_item_id");
|
||||
double value = jsonItem.getDoubleValue("value");
|
||||
if (value > 0 && value < 1){
|
||||
jsonResuft.put(inspection_item_id,"0"+NumberUtil.decimalFormat("#.00", value));
|
||||
jsonResuft.put(inspection_item_id,"0"+NumberUtil.decimalFormat("#.0000", value));
|
||||
} else if (value == 0){
|
||||
jsonResuft.put(inspection_item_id,"0.00");
|
||||
jsonResuft.put(inspection_item_id,"0.0000");
|
||||
} else {
|
||||
jsonResuft.put(inspection_item_id,NumberUtil.decimalFormat("#.00", value));
|
||||
jsonResuft.put(inspection_item_id,NumberUtil.decimalFormat("#.0000", value));
|
||||
}
|
||||
}
|
||||
// 根据物料批次查找理化单对应的项点
|
||||
@@ -104,11 +104,11 @@ public class RawUatWcQueryServiceImpl implements RawUatWcQueryService {
|
||||
String inspection_item_id = jsonItem.getString("inspection_item_id");
|
||||
double value = jsonItem.getDoubleValue("value");
|
||||
if (value > 0 && value < 1) {
|
||||
jsonResuft.put(inspection_item_id,"0"+NumberUtil.decimalFormat("#.00", value));
|
||||
jsonResuft.put(inspection_item_id,"0"+NumberUtil.decimalFormat("#.0000", value));
|
||||
} else if (value == 0){
|
||||
jsonResuft.put(inspection_item_id,"0.00");
|
||||
jsonResuft.put(inspection_item_id,"0.0000");
|
||||
} else {
|
||||
jsonResuft.put(inspection_item_id,NumberUtil.decimalFormat("#.00", value));
|
||||
jsonResuft.put(inspection_item_id,NumberUtil.decimalFormat("#.0000", value));
|
||||
}
|
||||
}
|
||||
jsonResuftArr.add(jsonResuft);
|
||||
|
||||
@@ -8,11 +8,11 @@ export function add(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
export function mydel(data) {
|
||||
return request({
|
||||
url: 'api/acceptformula/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
url: 'api/acceptformula/mydel',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -23,7 +23,21 @@ export function edit(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
export function create(data) {
|
||||
return request({
|
||||
url: 'api/acceptformula/create',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function update(data) {
|
||||
return request({
|
||||
url: 'api/acceptformula/update',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function getDtl(params) {
|
||||
return request({
|
||||
url: 'api/acceptformula/getDtl',
|
||||
@@ -70,4 +84,18 @@ export function createPcsn() {
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
export default { add, edit, del, getDtl, getBoms, getTHWs, getPCSNs, getPCSN, getBom, createPcsn }
|
||||
export function autoCalculation(params) {
|
||||
return request({
|
||||
url: 'api/acceptformula/autoCalculation',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
export function getPCSNid(params) {
|
||||
return request({
|
||||
url: 'api/acceptformula/getPCSNid',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
export default { create, update, mydel, getDtl, getBoms, getTHWs, getPCSNs, getPCSN, getBom, createPcsn, autoCalculation, getPCSNid }
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
style="padding-top: 0px;"
|
||||
:title="crud.status.title"
|
||||
title="小线试验维护"
|
||||
v-loading.fullscreen.lock="fullscreenLoading"
|
||||
:visible.sync="dialogVisible"
|
||||
append-to-body
|
||||
fullscreen
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<el-row v-show="crud.status.cu > 0" :gutter="20">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="20" style="border: 1px solid white">
|
||||
<span />
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<span>
|
||||
<el-button icon="el-icon-check" size="mini" :loading="crud.cu === 2" type="primary" @click="crud.submitCU">保存</el-button>
|
||||
<el-button icon="el-icon-close" size="mini" type="info" @click="crud.cancelCU">关闭</el-button>
|
||||
<el-button icon="el-icon-check" size="mini" type="primary" @click="mysubmitCU">保存</el-button>
|
||||
<el-button icon="el-icon-close" size="mini" type="info" @click="dialogVisible = false">关闭</el-button>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -29,7 +31,6 @@
|
||||
placeholder="物料"
|
||||
style="width: 210px"
|
||||
class="filter-item"
|
||||
:disabled="crud.status.view > 0"
|
||||
@change="storChange"
|
||||
>
|
||||
<el-option
|
||||
@@ -43,7 +44,7 @@
|
||||
<el-form-item label="批号" prop="inspection_id">
|
||||
<el-select
|
||||
v-model="form.inspection_id"
|
||||
clearable
|
||||
style="width: 210px"
|
||||
size="mini"
|
||||
placeholder="批号"
|
||||
class="filter-item"
|
||||
@@ -138,8 +139,7 @@
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form ref="form2" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="150px" label-suffix=":">
|
||||
<el-divider></el-divider>
|
||||
<el-form-item label="验收牌号" prop="mark_id">
|
||||
<el-select
|
||||
v-model="form.mark_id"
|
||||
@@ -231,10 +231,10 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="开单人" align="center">
|
||||
<el-input v-model="form.create_name" placeholder="开单人" style="width: 210px" disabled />
|
||||
<el-input v-model="form.create_name" style="width: 210px" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="开单日期" align="center">
|
||||
<el-input v-model="form.create_time" placeholder="开单人" style="width: 210px" disabled />
|
||||
<el-input v-model="form.create_time" style="width: 210px" disabled />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="crud-opts2" style="margin-bottom: 5px;">
|
||||
@@ -247,7 +247,7 @@
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="insertdtl"
|
||||
@click="autoCalculation"
|
||||
>
|
||||
开单计算
|
||||
</el-button>
|
||||
@@ -255,7 +255,7 @@
|
||||
</div>
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="form.tableData"
|
||||
:data="tableData"
|
||||
style="width: 100%;"
|
||||
size="mini"
|
||||
border
|
||||
@@ -271,15 +271,14 @@
|
||||
size="mini"
|
||||
:controls="false"
|
||||
:precision="4"
|
||||
:max="100"
|
||||
:min="0"
|
||||
:disabled="scope.row.edit"
|
||||
:disabled="scope.row.is_thw"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dtl_pcsn" label="批次" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.dtl_pcsn" placeholder="批次" />
|
||||
<el-input v-model="scope.row.dtl_pcsn" placeholder="批次" :disabled="scope.row.is_thw" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -293,6 +292,7 @@ import Date from '@/utils/datetime'
|
||||
const defaultForm = {
|
||||
formula_code: '',
|
||||
material_id: '',
|
||||
manufactor: '',
|
||||
inspection_id: '',
|
||||
CJZB00001: 0,
|
||||
CJZB00002: 0,
|
||||
@@ -318,6 +318,7 @@ const defaultForm = {
|
||||
|
||||
import crudacceptformula from '@/api/wms/pf/acceptformula'
|
||||
import CRUD, { form, crud } from '@crud/crud'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'AddDialog',
|
||||
@@ -327,6 +328,9 @@ export default {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
rowmst: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -338,6 +342,8 @@ export default {
|
||||
boms: [],
|
||||
THWs: [],
|
||||
PCSNs: [],
|
||||
tableData: [],
|
||||
fullscreenLoading: false,
|
||||
rules: {
|
||||
material_id: [
|
||||
{ required: true, message: '物料不能为空', trigger: 'blur' }
|
||||
@@ -362,8 +368,18 @@ export default {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
},
|
||||
rowmst: {
|
||||
handler(newValue) {
|
||||
this.form = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
user: 'user'
|
||||
})
|
||||
},
|
||||
created() {
|
||||
crudacceptformula.getBoms().then(res => {
|
||||
this.boms = res
|
||||
@@ -371,9 +387,18 @@ export default {
|
||||
crudacceptformula.getTHWs().then(res => {
|
||||
this.THWs = res
|
||||
})
|
||||
this.tableData = []
|
||||
},
|
||||
methods: {
|
||||
[CRUD.HOOK.beforeSubmit]() {
|
||||
mysubmitCU() {
|
||||
if (!this.form.material_id) {
|
||||
this.crud.notify('物料不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (!this.form.inspection_id) {
|
||||
this.crud.notify('批号不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (!this.form.mark_id) {
|
||||
this.crud.notify('验收牌号不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
@@ -383,19 +408,71 @@ export default {
|
||||
return false
|
||||
}
|
||||
if (this.form.accept_qty <= 0) {
|
||||
this.crud.notify('试验重量不能为0!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
this.crud.notify('试验重量不能为0或空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (this.form.tableData.length === 0) {
|
||||
if (this.tableData.length === 0) {
|
||||
this.crud.notify('开单明细不能为空', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
for (let i = 0; i < this.tableData.length; i++) {
|
||||
if (!this.tableData[i].dtl_pcsn) {
|
||||
this.crud.notify('批次不能为空,明细序号为' + (i + 1) + '请检查!')
|
||||
return false
|
||||
}
|
||||
if (this.tableData[i].formula_qty <= 0) {
|
||||
this.crud.notify('明细重量不能为0或空,明细序号为' + (i + 1) + '请检查!')
|
||||
return false
|
||||
}
|
||||
}
|
||||
this.form.tableData = this.tableData
|
||||
|
||||
if (!this.form.formula_id) {
|
||||
crudacceptformula.create(this.form).then(res => {
|
||||
this.$refs['form'].resetFields()
|
||||
this.tableData = []
|
||||
this.$emit('AddChanged')
|
||||
this.$emit('update:dialogShow', false)
|
||||
})
|
||||
} else {
|
||||
crudacceptformula.update(this.form).then(res => {
|
||||
this.$refs['form'].resetFields()
|
||||
this.tableData = []
|
||||
this.$emit('AddChanged')
|
||||
this.$emit('update:dialogShow', false)
|
||||
})
|
||||
}
|
||||
},
|
||||
[CRUD.HOOK.afterToEdit]() {
|
||||
// 编辑之后获取明细
|
||||
crudacceptformula.getDtl({ 'mark_id': this.form.mark_id }).then(res => {
|
||||
this.form.tableData = res
|
||||
})
|
||||
open() {
|
||||
if (this.form.formula_id) {
|
||||
// 编辑之后获取明细
|
||||
crudacceptformula.getDtl({ 'formula_id': this.form.formula_id }).then(res => {
|
||||
this.tableData = res
|
||||
})
|
||||
crudacceptformula.getPCSNs({ 'material_id': this.form.material_id }).then(res => {
|
||||
this.PCSNs = res
|
||||
})
|
||||
crudacceptformula.getPCSNid(this.form).then(res => {
|
||||
this.form.inspection_id = res.inspection_id
|
||||
this.form.CJZB00007 = res.CJZB00007
|
||||
this.form.CJZB00001 = res.CJZB00001
|
||||
this.form.CJZB00002 = res.CJZB00002
|
||||
this.form.CJZB00006 = res.CJZB00006
|
||||
this.form.CJZB00021 = res.CJZB00021
|
||||
this.form.CJZB00020 = res.CJZB00020
|
||||
this.form.CJZB00004 = res.CJZB00004
|
||||
this.form.manufactor = res.manufactor
|
||||
})
|
||||
crudacceptformula.getBom({ 'mark_id': this.form.mark_id }).then(res => {
|
||||
this.form.c_balance = res.c_balance
|
||||
this.form.ball_rate = res.ball_rate
|
||||
this.form.liquid_rate = res.liquid_rate
|
||||
this.form.ball_time = res.ball_time
|
||||
this.form.ball_speed = res.ball_speed
|
||||
this.form.ball_qty = this.form.ball_rate * this.form.accept_qty / 100.0
|
||||
this.form.liquid_qty = this.form.liquid_rate * this.form.accept_qty / 100.0
|
||||
})
|
||||
}
|
||||
},
|
||||
storChange(row) {
|
||||
crudacceptformula.getPCSNs({ 'material_id': row }).then(res => {
|
||||
@@ -419,6 +496,7 @@ export default {
|
||||
this.form.CJZB00021 = res.CJZB00021
|
||||
this.form.CJZB00020 = res.CJZB00020
|
||||
this.form.CJZB00004 = res.CJZB00004
|
||||
this.form.manufactor = res.manufactor
|
||||
})
|
||||
},
|
||||
storChange3(row) {
|
||||
@@ -445,30 +523,25 @@ export default {
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$refs['form'].resetFields()
|
||||
this.tableData = []
|
||||
this.$emit('AddChanged')
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
handleEdit(index, row) {
|
||||
// 判断是否可以关闭编辑状态
|
||||
if (!row.edit) {
|
||||
if (parseFloat(row.standard_rate) <= 0) {
|
||||
this.crud.notify('标准值必须大于0!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (!row.material_code) {
|
||||
this.crud.notify('物料不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
}
|
||||
row.edit = !row.edit
|
||||
this.form.tableData.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
|
||||
},
|
||||
insertdtl() {
|
||||
this.form.tableData.push({ material_id: '', material_code: '', material_name: '', standard_rate: '0', seqno: '', edit: false })
|
||||
},
|
||||
createPcsn() {
|
||||
crudacceptformula.createPcsn().then(res => {
|
||||
this.form.accept_pcsn = res.accept_pcsn
|
||||
})
|
||||
},
|
||||
autoCalculation() {
|
||||
this.fullscreenLoading = true
|
||||
crudacceptformula.autoCalculation(this.form).then(res => {
|
||||
this.crud.notify('自动计算成功!')
|
||||
this.tableData = res
|
||||
this.fullscreenLoading = false
|
||||
}).catch(() => {
|
||||
this.fullscreenLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,343 +0,0 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
style="padding-top: 0px;"
|
||||
:title="crud.status.title"
|
||||
append-to-body
|
||||
fullscreen
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
|
||||
>
|
||||
<el-row v-show="crud.status.cu > 0" :gutter="20">
|
||||
<el-col :span="20" style="border: 1px solid white">
|
||||
<span />
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<span>
|
||||
<el-button icon="el-icon-check" size="mini" :loading="crud.cu === 2" type="primary" @click="crud.submitCU">保存</el-button>
|
||||
<el-button icon="el-icon-close" size="mini" type="info" @click="crud.cancelCU">关闭</el-button>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="150px" label-suffix=":">
|
||||
<el-form-item label="实验序号" prop="formula_code">
|
||||
<el-input v-model="form.formula_code" placeholder="系统生成" style="width: 210px" disabled>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料" prop="material_id">
|
||||
<el-select
|
||||
v-model="form.material_id"
|
||||
placeholder="物料"
|
||||
style="width: 210px"
|
||||
class="filter-item"
|
||||
:disabled="crud.status.view > 0"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in THWs"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="批号" prop="inspection_id">
|
||||
<el-select
|
||||
v-model="form.inspection_id"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="批号"
|
||||
class="filter-item"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in PCSNs"
|
||||
:key="item.id"
|
||||
:label="item.code"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="生产厂家" prop="manufactor">
|
||||
<el-input v-model="form.manufactor" placeholder="生产厂家" style="width: 210px" disabled>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="CT(%)" prop="c_balance">
|
||||
<label slot="label">CT(%):</label>
|
||||
<el-input-number
|
||||
v-model="form.c_balance"
|
||||
:controls="false"
|
||||
:precision="3"
|
||||
:min="0"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="Cr3C2" prop="c_balance">
|
||||
<label slot="label">Cr3C2:</label>
|
||||
<el-input-number
|
||||
v-model="form.liquid_rate"
|
||||
:controls="false"
|
||||
:precision="3"
|
||||
:min="0"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="氧含量" prop="c_balance">
|
||||
<label slot="label">氧含量:</label>
|
||||
<el-input-number
|
||||
v-model="form.ball_rate"
|
||||
:controls="false"
|
||||
:precision="3"
|
||||
:min="0"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="VC(%)" prop="c_balance">
|
||||
<label slot="label">VC(%):</label>
|
||||
<el-input-number
|
||||
v-model="form.ball_speed"
|
||||
:controls="false"
|
||||
:precision="3"
|
||||
:min="0"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="CF(%)" prop="c_balance">
|
||||
<label slot="label">CF(%):</label>
|
||||
<el-input-number
|
||||
v-model="form.ball_time"
|
||||
:controls="false"
|
||||
:precision="0"
|
||||
:min="0"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="FSSS(μm)">
|
||||
<label slot="label">FSSS(μm):</label>
|
||||
<el-input-number
|
||||
v-model="form.total_value"
|
||||
:controls="false"
|
||||
:precision="4"
|
||||
:min="0"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="BET(㎡/g)">
|
||||
<label slot="label">BET(㎡/g):</label>
|
||||
<el-input-number
|
||||
v-model="form.total_value2"
|
||||
:controls="false"
|
||||
:precision="4"
|
||||
:min="0"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="明细数">
|
||||
<el-input v-model="form.tableData.length" :disabled="true" style="width: 210px;" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<label slot="label">备 注:</label>
|
||||
<el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea" :disabled="crud.status.view > 0" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div class="crud-opts2" style="margin-bottom: 5px;">
|
||||
<span class="crud-opts-right2">
|
||||
<!--左侧插槽-->
|
||||
<slot name="left" />
|
||||
<el-button
|
||||
slot="left"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="insertdtl"
|
||||
>
|
||||
开单计算
|
||||
</el-button>
|
||||
</span>
|
||||
</div>
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="form.tableData"
|
||||
style="width: 100%;"
|
||||
size="mini"
|
||||
border
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="55" align="center" />
|
||||
<el-table-column prop="material_code" label="物料编码" align="center" />
|
||||
<el-table-column prop="material_name" label="物料名称" align="center" />
|
||||
<el-table-column prop="standard_rate" label="标准值%" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
v-model="scope.row.standard_rate"
|
||||
size="mini"
|
||||
:controls="false"
|
||||
:precision="4"
|
||||
:max="100"
|
||||
:min="0"
|
||||
:disabled="scope.row.edit"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="seqno" label="顺序号" align="center" />
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
const defaultForm = {
|
||||
formula_code: '',
|
||||
material_id: '',
|
||||
inspection_id: '',
|
||||
c_balance: 0,
|
||||
liquid_rate: 0,
|
||||
ball_rate: 0,
|
||||
ball_speed: 0,
|
||||
ball_time: 0,
|
||||
detail_count: 0,
|
||||
manufactor: '',
|
||||
total_value: 0,
|
||||
total_value2: 0,
|
||||
remark: '',
|
||||
tableData: []
|
||||
}
|
||||
|
||||
import crudacceptformula from '@/api/wms/pf/acceptformula'
|
||||
import CRUD, { form, crud } from '@crud/crud'
|
||||
|
||||
export default {
|
||||
name: 'AddDialog',
|
||||
components: {},
|
||||
mixins: [crud(), form(defaultForm)],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
dtlMaterShow: false,
|
||||
nowrow: {},
|
||||
boms: [],
|
||||
THWs: [],
|
||||
PCSNs: [],
|
||||
nowindex: '',
|
||||
rules: {
|
||||
material_id: [
|
||||
{ required: true, message: '牌号不能为空', trigger: 'blur' }
|
||||
],
|
||||
inspection_id: [
|
||||
{ required: true, message: '批次不能为空', trigger: 'blur' }
|
||||
],
|
||||
c_balance: [
|
||||
{ required: true, message: '碳平衡不能为空', trigger: 'blur' }
|
||||
],
|
||||
liquid_rate: [
|
||||
{ required: true, message: '液料比不能为空', trigger: 'blur' }
|
||||
],
|
||||
ball_rate: [
|
||||
{ required: true, message: '球料比不能为空', trigger: 'blur' }
|
||||
],
|
||||
ball_speed: [
|
||||
{ required: true, message: '球磨转速不能为空', trigger: 'blur' }
|
||||
],
|
||||
ball_time: [
|
||||
{ required: true, message: '研磨时间不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
crudacceptformula.getBoms().then(res => {
|
||||
this.boms = res
|
||||
})
|
||||
crudacceptformula.getTHWs().then(res => {
|
||||
this.THWs = res
|
||||
})
|
||||
crudacceptformula.getPCSNs().then(res => {
|
||||
this.PCSNs = res
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
[CRUD.HOOK.beforeSubmit]() {
|
||||
if (this.form.tableData.length === 0) {
|
||||
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
},
|
||||
[CRUD.HOOK.afterToEdit]() {
|
||||
// 编辑之后获取明细
|
||||
crudacceptformula.getDtl({ 'mark_id': this.form.mark_id }).then(res => {
|
||||
this.form.tableData = res
|
||||
})
|
||||
},
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?')
|
||||
.then(_ => {
|
||||
done()
|
||||
})
|
||||
.catch(_ => {
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
handleEdit(index, row) {
|
||||
// 判断是否可以关闭编辑状态
|
||||
if (!row.edit) {
|
||||
if (parseFloat(row.standard_rate) <= 0) {
|
||||
this.crud.notify('标准值必须大于0!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (!row.material_code) {
|
||||
this.crud.notify('物料不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
}
|
||||
row.edit = !row.edit
|
||||
this.form.tableData.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
|
||||
},
|
||||
insertdtl() {
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.crud-opts2 {
|
||||
padding: 4px 0;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.crud-opts2 .crud-opts-right2 {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
padding-top: 0px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,16 +1,164 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
style="padding-top: 0px;"
|
||||
title="小线实验牌号详情"
|
||||
title="碳化钨小线验收试验"
|
||||
:visible.sync="dialogVisible"
|
||||
append-to-body
|
||||
fullscreen
|
||||
@open="open"
|
||||
@close="close"
|
||||
>
|
||||
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" size="mini" label-width="150px" label-suffix=":">
|
||||
<el-form-item label="牌号" prop="mark_code">
|
||||
<el-input v-model="form.mark_code" placeholder="牌号" style="width: 210px" disabled />
|
||||
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" size="mini" label-width="150px" label-suffix=":">
|
||||
<el-form-item label="实验序号" prop="formula_code">
|
||||
<el-input v-model="form.formula_code" placeholder="系统生成" style="width: 210px" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料" prop="material_id">
|
||||
<el-select
|
||||
v-model="form.material_id"
|
||||
placeholder="物料"
|
||||
style="width: 210px"
|
||||
class="filter-item"
|
||||
disabled
|
||||
>
|
||||
<el-option
|
||||
v-for="item in THWs"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="批号" prop="inspection_id">
|
||||
<el-select
|
||||
v-model="form.inspection_id"
|
||||
style="width: 210px"
|
||||
size="mini"
|
||||
placeholder="批号"
|
||||
class="filter-item"
|
||||
disabled
|
||||
>
|
||||
<el-option
|
||||
v-for="item in PCSNs"
|
||||
:key="item.id"
|
||||
:label="item.code"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="生产厂家" prop="manufactor">
|
||||
<el-input v-model="form.manufactor" placeholder="生产厂家" style="width: 210px" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="CT(%)" prop="CJZB00004">
|
||||
<label slot="label">CT(%):</label>
|
||||
<el-input-number
|
||||
v-model="form.CJZB00004"
|
||||
:controls="false"
|
||||
:precision="3"
|
||||
:min="0"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="Cr3C2" prop="CJZB00021">
|
||||
<label slot="label">Cr3C2:</label>
|
||||
<el-input-number
|
||||
v-model="form.CJZB00021"
|
||||
:controls="false"
|
||||
:precision="3"
|
||||
:min="0"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="氧含量" prop="CJZB00007">
|
||||
<label slot="label">氧含量:</label>
|
||||
<el-input-number
|
||||
v-model="form.CJZB00007"
|
||||
:controls="false"
|
||||
:precision="3"
|
||||
:min="0"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="VC(%)" prop="CJZB00020">
|
||||
<label slot="label">VC(%):</label>
|
||||
<el-input-number
|
||||
v-model="form.CJZB00020"
|
||||
:controls="false"
|
||||
:precision="3"
|
||||
:min="0"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="CF(%)" prop="CJZB00006">
|
||||
<label slot="label">CF(%):</label>
|
||||
<el-input-number
|
||||
v-model="form.CJZB00006"
|
||||
:controls="false"
|
||||
:precision="0"
|
||||
:min="0"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="FSSS(μm)" prop="CJZB00001">
|
||||
<label slot="label">FSSS(μm):</label>
|
||||
<el-input-number
|
||||
v-model="form.CJZB00001"
|
||||
:controls="false"
|
||||
:precision="4"
|
||||
:min="0"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="BET(㎡/g)" prop="CJZB00002">
|
||||
<label slot="label">BET(㎡/g):</label>
|
||||
<el-input-number
|
||||
v-model="form.CJZB00002"
|
||||
:controls="false"
|
||||
:precision="4"
|
||||
:min="0"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form ref="form2" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" size="mini" label-width="150px" label-suffix=":">
|
||||
<el-form-item label="验收牌号" prop="mark_id">
|
||||
<el-select
|
||||
v-model="form.mark_id"
|
||||
placeholder="验收牌号"
|
||||
style="width: 210px"
|
||||
class="filter-item"
|
||||
disabled
|
||||
>
|
||||
<el-option
|
||||
v-for="item in boms"
|
||||
:key="item.id"
|
||||
:label="item.code"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="试验批号" prop="accept_pcsn">
|
||||
<label slot="label">试验批号:</label>
|
||||
<el-input v-model="form.accept_pcsn" style="width: 210px" disabled >
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="试验重量(g)" prop="accept_qty">
|
||||
<label slot="label">试验重量(g):</label>
|
||||
<el-input-number
|
||||
v-model="form.accept_qty"
|
||||
:controls="false"
|
||||
:precision="3"
|
||||
:min="0"
|
||||
style="width: 210px"
|
||||
disabled
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="碳平衡" prop="c_balance">
|
||||
<label slot="label">碳平衡:</label>
|
||||
@@ -23,21 +171,10 @@
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="液料比" prop="c_balance">
|
||||
<label slot="label">液料比:</label>
|
||||
<el-form-item label="溶剂量(ml)" prop="liquid_qty">
|
||||
<label slot="label">溶剂量(ml):</label>
|
||||
<el-input-number
|
||||
v-model="form.liquid_rate"
|
||||
:controls="false"
|
||||
:precision="3"
|
||||
:min="0"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="球料比" prop="c_balance">
|
||||
<label slot="label">球料比:</label>
|
||||
<el-input-number
|
||||
v-model="form.ball_rate"
|
||||
v-model="form.liquid_qty"
|
||||
:controls="false"
|
||||
:precision="3"
|
||||
:min="0"
|
||||
@@ -46,10 +183,10 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="球磨转速(RPM)" prop="c_balance">
|
||||
<label slot="label">球磨转速(RPM):</label>
|
||||
<el-form-item label="合金球(KG)" prop="ball_qty">
|
||||
<label slot="label">合金球(KG):</label>
|
||||
<el-input-number
|
||||
v-model="form.ball_speed"
|
||||
v-model="form.ball_qty"
|
||||
:controls="false"
|
||||
:precision="3"
|
||||
:min="0"
|
||||
@@ -57,10 +194,10 @@
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="研磨时间(H)" prop="c_balance">
|
||||
<label slot="label">研磨时间(H):</label>
|
||||
<el-form-item label="球磨转速(RPM)" prop="ball_speed">
|
||||
<label slot="label">球磨转速(RPM):</label>
|
||||
<el-input-number
|
||||
v-model="form.ball_time"
|
||||
v-model="form.ball_speed"
|
||||
:controls="false"
|
||||
:precision="0"
|
||||
:min="0"
|
||||
@@ -68,10 +205,10 @@
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="标准值合计(%)">
|
||||
<label slot="label">标准值合计(%):</label>
|
||||
<el-form-item label="研磨时间(H)" prop="ball_time">
|
||||
<label slot="label">研磨时间(H):</label>
|
||||
<el-input-number
|
||||
v-model="form.total_value"
|
||||
v-model="form.ball_time"
|
||||
:controls="false"
|
||||
:precision="4"
|
||||
:min="0"
|
||||
@@ -79,16 +216,13 @@
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="明细数">
|
||||
<el-input v-model="tableData.length" disabled style="width: 210px;" />
|
||||
<el-form-item label="开单人" align="center">
|
||||
<el-input v-model="form.create_name" style="width: 210px" disabled />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<label slot="label">备 注:</label>
|
||||
<el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea" disabled />
|
||||
<el-form-item label="开单日期" align="center">
|
||||
<el-input v-model="form.create_time" style="width: 210px" disabled />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="tableData"
|
||||
@@ -100,33 +234,65 @@
|
||||
<el-table-column type="index" label="序号" width="55" align="center" />
|
||||
<el-table-column prop="material_code" label="物料编码" align="center" />
|
||||
<el-table-column prop="material_name" label="物料名称" align="center" />
|
||||
<el-table-column prop="standard_rate" label="标准值%" align="center">
|
||||
<el-table-column prop="formula_qty" label="重量" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
v-model="scope.row.standard_rate"
|
||||
v-model="scope.row.formula_qty"
|
||||
size="mini"
|
||||
:controls="false"
|
||||
:precision="4"
|
||||
:max="100"
|
||||
:min="0"
|
||||
disabled
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="seqno" label="顺序号" align="center" />
|
||||
<el-table-column prop="dtl_pcsn" label="批次" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.dtl_pcsn" placeholder="批次" disabled />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { crud } from '@crud/crud'
|
||||
import crudacceptmark from '@/api/wms/pf/acceptmark'
|
||||
import Date from '@/utils/datetime'
|
||||
import crudacceptformula from '@/api/wms/pf/acceptformula'
|
||||
import CRUD, { form, crud } from '@crud/crud'
|
||||
|
||||
const defaultForm = {
|
||||
formula_code: '',
|
||||
material_id: '',
|
||||
manufactor: '',
|
||||
inspection_id: '',
|
||||
CJZB00001: 0,
|
||||
CJZB00002: 0,
|
||||
CJZB00006: 0,
|
||||
CJZB00020: 0,
|
||||
CJZB00021: 0,
|
||||
CJZB00004: 0,
|
||||
CJZB00007: 0,
|
||||
mark_id: '',
|
||||
create_name: '',
|
||||
create_time: (new Date()).strftime('%F', 'zh'),
|
||||
accept_pcsn: '',
|
||||
accept_qty: 1000,
|
||||
c_balance: 0,
|
||||
ball_rate: 0,
|
||||
liquid_rate: 0,
|
||||
ball_qty: 0,
|
||||
liquid_qty: 0,
|
||||
ball_time: 0,
|
||||
ball_speed: 0,
|
||||
tableData: []
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
name: 'ViewDialog',
|
||||
components: {},
|
||||
mixins: [crud()],
|
||||
mixins: [crud(), form(defaultForm)],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
@@ -140,6 +306,9 @@ export default {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
form: {},
|
||||
boms: [],
|
||||
THWs: [],
|
||||
PCSNs: [],
|
||||
tableData: []
|
||||
}
|
||||
},
|
||||
@@ -155,20 +324,42 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
crudacceptformula.getBoms().then(res => {
|
||||
this.boms = res
|
||||
})
|
||||
crudacceptformula.getTHWs().then(res => {
|
||||
this.THWs = res
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
// 编辑之后获取明细
|
||||
crudacceptmark.getDtl({ 'mark_id': this.form.mark_id }).then(res => {
|
||||
crudacceptformula.getDtl({ 'formula_id': this.form.formula_id }).then(res => {
|
||||
this.tableData = res
|
||||
// 计算合计值
|
||||
let all = 0
|
||||
for (let i = 0; i < this.tableData.length; i++) {
|
||||
const row = this.tableData[i]
|
||||
row.edit = true
|
||||
this.tableData.splice(i, 1, row)
|
||||
all = all + parseFloat(row.standard_rate)
|
||||
}
|
||||
this.form.total_value = all
|
||||
})
|
||||
crudacceptformula.getPCSNs({ 'material_id': this.form.material_id }).then(res => {
|
||||
this.PCSNs = res
|
||||
})
|
||||
crudacceptformula.getPCSNid(this.form).then(res => {
|
||||
this.form.inspection_id = res.inspection_id
|
||||
this.form.CJZB00007 = res.CJZB00007
|
||||
this.form.CJZB00001 = res.CJZB00001
|
||||
this.form.CJZB00002 = res.CJZB00002
|
||||
this.form.CJZB00006 = res.CJZB00006
|
||||
this.form.CJZB00021 = res.CJZB00021
|
||||
this.form.CJZB00020 = res.CJZB00020
|
||||
this.form.CJZB00004 = res.CJZB00004
|
||||
this.form.manufactor = res.manufactor
|
||||
})
|
||||
crudacceptformula.getBom({ 'mark_id': this.form.mark_id }).then(res => {
|
||||
this.form.c_balance = res.c_balance
|
||||
this.form.ball_rate = res.ball_rate
|
||||
this.form.liquid_rate = res.liquid_rate
|
||||
this.form.ball_time = res.ball_time
|
||||
this.form.ball_speed = res.ball_speed
|
||||
this.form.ball_qty = this.form.ball_rate * this.form.accept_qty / 100.0
|
||||
this.form.liquid_qty = this.form.liquid_rate * this.form.accept_qty / 100.0
|
||||
})
|
||||
},
|
||||
close() {
|
||||
|
||||
@@ -82,6 +82,16 @@
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
@click="typeChange"
|
||||
>
|
||||
新增
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
@@ -95,12 +105,10 @@
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="45" />
|
||||
<el-table-column v-permission="[]" label="操作" fixed="right" width="120px" align="center">
|
||||
<el-table-column v-permission="[]" label="操作" fixed="right" width="160px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
<el-button type="text" size="mini" icon="el-icon-edit" @click="mytoEdit(scope.row)">修改</el-button>
|
||||
<el-button type="text" size="mini" icon="el-icon-delete" @click="mytodelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="formula_code" width="120px" label="实验序号" align="center">
|
||||
@@ -113,7 +121,6 @@
|
||||
<el-table-column prop="material_pcsn" label="碳化钨批次" width="120px" align="center" />
|
||||
<el-table-column prop="mark_code" label="验收牌号" width="120px" align="center" />
|
||||
<el-table-column prop="accept_pcsn" label="试验批号" width="120px" align="center" />
|
||||
<el-table-column prop="detail_count" label="明细数" align="center" min-width="60" />
|
||||
<el-table-column prop="accept_qty" label="重量" align="center" min-width="80" :formatter="crud.formatNum3" />
|
||||
<el-table-column prop="confirm_qty" label="开单重量" align="center" min-width="80" :formatter="crud.formatNum3" />
|
||||
<el-table-column prop="remark" label="备注" align="center" min-width="135" />
|
||||
@@ -125,7 +132,7 @@
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<AddDialog />
|
||||
<AddDialog :dialog-show.sync="newShow" :rowmst="mstrow" @AddChanged="querytable"/>
|
||||
<ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -153,7 +160,7 @@ export default {
|
||||
sort: 'create_time desc',
|
||||
crudMethod: { ...crudacceptformula },
|
||||
optShow: {
|
||||
add: true,
|
||||
add: false,
|
||||
del: false,
|
||||
edit: false,
|
||||
reset: true
|
||||
@@ -167,6 +174,7 @@ export default {
|
||||
mstrow: {},
|
||||
boms: [],
|
||||
viewShow: false,
|
||||
newShow: false,
|
||||
query_flag: true,
|
||||
rules: {
|
||||
}}
|
||||
@@ -195,6 +203,20 @@ export default {
|
||||
this.mstrow = row
|
||||
this.viewShow = true
|
||||
},
|
||||
typeChange() {
|
||||
this.newShow = true
|
||||
},
|
||||
mytoEdit(row) {
|
||||
this.mstrow = row
|
||||
this.newShow = true
|
||||
},
|
||||
mytodelete(row) {
|
||||
debugger
|
||||
crudacceptformula.mydel(row).then(res => {
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('删除成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
})
|
||||
},
|
||||
mytoQuery(array1) {
|
||||
if (array1 === null) {
|
||||
this.crud.query.begin_time = ''
|
||||
|
||||
Reference in New Issue
Block a user