优化
This commit is contained in:
@@ -22,6 +22,8 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@@ -39,6 +41,12 @@ public class EquipmentfileController {
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(equipmentfileService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
@Log("导出月计划模板")
|
||||
@ApiOperation("导出月计划模板")
|
||||
@GetMapping(value = "/download")
|
||||
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||
equipmentfileService.download(equipmentfileService.query(whereJson), response);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增工令")
|
||||
|
||||
@@ -3,8 +3,12 @@ package org.nl.wms.basedata.em.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.pcs.service.dto.ProductplanprocDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -18,6 +22,21 @@ public interface EquipmentfileService {
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
JSONArray query(Map whereJson);
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @param ja 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(JSONArray ja, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param json /
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.wms.basedata.em.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -16,11 +17,13 @@ import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.security.service.dto.JwtUserDto;
|
||||
import org.nl.modules.system.service.DeptService;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.FileUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wms.basedata.em.service.EquipmentfileService;
|
||||
import org.nl.wms.basedata.master.constant.MaterOptTypeEnum;
|
||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||
import org.nl.wms.pcs.service.dto.ProductplanprocDto;
|
||||
import org.nl.wms.pdm.service.WorkOrdereService;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
@@ -29,6 +32,8 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@@ -71,6 +76,41 @@ public class EquipmentfileServiceImpl implements EquipmentfileService {
|
||||
JSONObject json = WQL.getWO("QEM_EQUIPMENTFILE01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "equipmentfile.devicerecord_code");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray query(Map whereJson) {
|
||||
HashMap<String, String> map = new HashMap<>(whereJson);
|
||||
DeptService deptService = SpringContextHolder.getBean(DeptService.class);
|
||||
map.put("flag", "11");
|
||||
String device_code = map.get("device_code");
|
||||
if (StrUtil.isNotEmpty(device_code)) {
|
||||
map.put("device_code", "%" + device_code + "%");
|
||||
}
|
||||
String manufacturer = map.get("manufacturer");
|
||||
if (StrUtil.isNotEmpty(manufacturer)) {
|
||||
map.put("manufacturer", "%" + manufacturer + "%");
|
||||
}
|
||||
String material_type_id = map.get("material_type_id");
|
||||
if (!StrUtil.isEmpty(material_type_id)) {
|
||||
String classIds = classstandardService.getChildIdStr(material_type_id);
|
||||
map.put("classIds", classIds);
|
||||
}
|
||||
String use_deptid = map.get("use_deptid");
|
||||
if (!StrUtil.isEmpty(use_deptid)) {
|
||||
String deptIds = deptService.getChildIdStr(Long.parseLong(use_deptid));
|
||||
map.put("deptIds", deptIds);
|
||||
}
|
||||
String begin_time = map.get("begin_time");
|
||||
if (StrUtil.isNotEmpty(begin_time)) {
|
||||
map.put("begin_time", begin_time.substring(0,10));
|
||||
}
|
||||
String end_time = map.get("end_time");
|
||||
if (StrUtil.isNotEmpty(end_time)) {
|
||||
map.put("end_time", end_time.substring(0,10));
|
||||
}
|
||||
JSONArray json = WQL.getWO("QEM_EQUIPMENTFILE01").addParamMap(map).process().getResultJSONArray(0);
|
||||
return json;
|
||||
}
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(JSONObject json) {
|
||||
@@ -283,4 +323,73 @@ public class EquipmentfileServiceImpl implements EquipmentfileService {
|
||||
JSONArray ja = EM_BI_DeviceBOM.query("is_delete='0' and is_used='1' and material_type_id='"+material_type_id+"'").getResultJSONArray(0);
|
||||
return ja;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void download(JSONArray ja, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
WQLObject pdm_bi_workprocedure = WQLObject.getWQLObject("pdm_bi_workprocedure");
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
Map<String, Object> dtl_map = new LinkedHashMap<>();
|
||||
dtl_map.put("设备代码", jo.getString("device_code"));
|
||||
dtl_map.put("设备名称", jo.getString("device_name"));
|
||||
dtl_map.put("内部自编号", jo.getString("extend_code"));
|
||||
dtl_map.put("设备型号", jo.getString("device_model"));
|
||||
dtl_map.put("设备规格", jo.getString("material_type_name"));
|
||||
if(jo.getString("is_produceuse").equals("1")){
|
||||
dtl_map.put("生产用途", "生产");
|
||||
}else{
|
||||
dtl_map.put("生产用途", "非生产");
|
||||
}
|
||||
String status = jo.getString("status");
|
||||
if(status.equals("00")){
|
||||
dtl_map.put("设备状态", "生成");
|
||||
}else if(status.equals("10")){
|
||||
dtl_map.put("设备状态", "正常");
|
||||
}else if(status.equals("11")){
|
||||
dtl_map.put("设备状态", "闲置");
|
||||
}else if(status.equals("20")){
|
||||
dtl_map.put("设备状态", "故障");
|
||||
}else if(status.equals("30")){
|
||||
dtl_map.put("设备状态", "维修");
|
||||
}else if(status.equals("40")){
|
||||
dtl_map.put("设备状态", "保养");
|
||||
}else if(status.equals("90")){
|
||||
dtl_map.put("设备状态", "报废");
|
||||
}else if(status.equals("91")){
|
||||
dtl_map.put("设备状态", "报废处理");
|
||||
}
|
||||
dtl_map.put("启用日期", jo.getString("beginuse_date"));
|
||||
dtl_map.put("使用部门", jo.getString("use_deptname"));
|
||||
dtl_map.put("使用班组", jo.getString("use_groupname"));
|
||||
dtl_map.put("供应商", jo.getString("supplier_name"));
|
||||
dtl_map.put("制造商", jo.getString("manufacturer"));
|
||||
dtl_map.put("制造国别", jo.getString("country_manufactur"));
|
||||
dtl_map.put("出厂日期", jo.getString("leavefactory_date"));
|
||||
dtl_map.put("出厂编号", jo.getString("leavefactory_number"));
|
||||
dtl_map.put("图号", jo.getString("drawing_number"));
|
||||
|
||||
String device_type = jo.getString("device_type");
|
||||
if(device_type.equals("01")){
|
||||
dtl_map.put("设备属性", "资产");
|
||||
}else if(device_type.equals("02")){
|
||||
dtl_map.put("设备属性", "普通设备");
|
||||
}else if(device_type.equals("03")){
|
||||
dtl_map.put("设备属性", "其他");
|
||||
}
|
||||
dtl_map.put("工序", jo.getString("workprocedure_name"));
|
||||
dtl_map.put("资产编码", jo.getString("assets_code"));
|
||||
dtl_map.put("资产名称", jo.getString("assets_name"));
|
||||
dtl_map.put("生成人", jo.getString("create_name"));
|
||||
dtl_map.put("生成时间", jo.getString("create_time"));
|
||||
|
||||
dtl_map.put("修改人", jo.getString("update_optname"));
|
||||
dtl_map.put("修改时间", jo.getString("update_time"));
|
||||
list.add(dtl_map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,59 @@
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "11"
|
||||
QUERY
|
||||
SELECT
|
||||
equipmentfile.*,
|
||||
workprocedure.workprocedure_name,
|
||||
classstandard.class_name AS material_type_name,
|
||||
dept1.name AS use_deptname,
|
||||
dept2.name AS belong_deptname,
|
||||
dept3.name AS use_groupname
|
||||
FROM
|
||||
em_bi_equipmentfile equipmentfile
|
||||
LEFT JOIN pdm_bi_workprocedure workprocedure ON workprocedure.workprocedure_id = equipmentfile.workprocedure_id
|
||||
LEFT JOIN md_pb_classstandard classstandard ON classstandard.class_id = equipmentfile.material_type_id
|
||||
LEFT JOIN sys_dept dept1 ON dept1.dept_id = equipmentfile.use_deptid
|
||||
LEFT JOIN sys_dept dept2 ON dept2.dept_id = equipmentfile.belong_deptid
|
||||
LEFT JOIN sys_dept dept3 ON dept3.dept_id = equipmentfile.use_groupid
|
||||
WHERE
|
||||
equipmentfile.is_delete = '0'
|
||||
OPTION 输入.is_produceuse <> ""
|
||||
equipmentfile.is_produceuse = 输入.is_produceuse
|
||||
ENDOPTION
|
||||
OPTION 输入.status <> ""
|
||||
equipmentfile.status = 输入.status
|
||||
ENDOPTION
|
||||
OPTION 输入.use_deptid <> ""
|
||||
equipmentfile.use_deptid in 输入.deptIds
|
||||
ENDOPTION
|
||||
OPTION 输入.workprocedure_id <> ""
|
||||
equipmentfile.workprocedure_id = 输入.workprocedure_id
|
||||
ENDOPTION
|
||||
OPTION 输入.device_type <> ""
|
||||
equipmentfile.device_type = 输入.device_type
|
||||
ENDOPTION
|
||||
OPTION 输入.material_type_id <> ""
|
||||
equipmentfile.material_type_id in 输入.classIds
|
||||
ENDOPTION
|
||||
OPTION 输入.device_code <> ""
|
||||
(equipmentfile.device_code like 输入.device_code or equipmentfile.device_name like 输入.device_code)
|
||||
ENDOPTION
|
||||
OPTION 输入.manufacturer <> ""
|
||||
equipmentfile.manufacturer like 输入.manufacturer
|
||||
ENDOPTION
|
||||
OPTION 输入.begin_time <> ""
|
||||
equipmentfile.beginuse_date >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
equipmentfile.beginuse_date <= 输入.end_time
|
||||
ENDOPTION
|
||||
order by equipmentfile.devicerecord_code
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
|
||||
@@ -1443,6 +1443,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
//纯粉重量
|
||||
double net_qty = workorder_qty;
|
||||
//1.需添加软废
|
||||
if(waste_limit_down==100 || waste_limit_up== 100){
|
||||
throw new BadRequestException("软废含量上限或下限不能等于100%!");
|
||||
}
|
||||
//R下
|
||||
double waste_limit_down_weight = workorder_qty * waste_limit_down/100.0;
|
||||
//R上
|
||||
@@ -3213,7 +3216,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
}
|
||||
//BOM中碳化钨需含总碳
|
||||
double CT2 = new_qty*(sum_Cr3C2/100.0)*(c_balance/100.0);
|
||||
if(CT1==CT2){//配粉结束
|
||||
//配粉结束
|
||||
if(CT1==CT2){
|
||||
double W = net_qty;//钨Wp=桶重量 - (R1p*R1纯粉系数+ R2p*R2纯粉系数…) - (Y1p+X1p+X2p…)
|
||||
//软废总碳
|
||||
for(int i=0;i<rf_list.size();i++){
|
||||
@@ -3247,7 +3251,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
W_weight.put("quality_scode","01");
|
||||
cw_list.add(W_weight);
|
||||
}
|
||||
}else if(CT1<CT2){//需配碳粉
|
||||
}else
|
||||
//需配碳粉
|
||||
if(CT1<CT2){
|
||||
//B、若有软废,先加钨Wp=桶重量 - (R1p*R1纯粉系数+ R2p*R2纯粉系数…) - (Y1p+X1p+X2p…)
|
||||
if(rf_list.size()!=0){//只配库存明细时
|
||||
double W = net_qty;
|
||||
@@ -3256,37 +3262,60 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
JSONObject ivt_new = rf_list.getJSONObject(i);
|
||||
//R1p*R1纯粉系数
|
||||
double net_rate_qty = ivt_new.getDouble("formula_qty")*ivt_new.getDouble("net_rate")/100.0;
|
||||
W = NumberUtil.round(W - net_rate_qty,3).doubleValue();
|
||||
W = NumberUtil.round(W - net_rate_qty,6).doubleValue();
|
||||
}
|
||||
//桶重量 - (R1p*R1纯粉系数+ R2p*R2纯粉系数…) - (Y1p+X1p+X2p…)
|
||||
for(int i=0;i<xl_list.size();i++){
|
||||
JSONObject bomdlt = xl_list.getJSONObject(i);
|
||||
//Y1p+X1p+X2p
|
||||
double need_qty = bomdlt.getDouble("formula_qty");
|
||||
W = NumberUtil.round(W - need_qty,3).doubleValue();
|
||||
W = NumberUtil.round(W - need_qty,6).doubleValue();
|
||||
}
|
||||
if(W<0){
|
||||
throw new BadRequestException("补钨粉重量为负数,请检查bom及其他参数!");
|
||||
//throw new BadRequestException("补钨粉重量为负数,请检查bom及其他参数!");
|
||||
W = 0;
|
||||
}
|
||||
//补碳Cp=CT2-CT1,比较Cp、Wp:若Cp<=Wp,更新Wp=Wp-Cp,结束
|
||||
double Cp = NumberUtil.round(CT2-CT1,3).doubleValue();
|
||||
double Cp = NumberUtil.round(CT2-CT1,6).doubleValue();
|
||||
//若Cp<=Wp,更新Wp=Wp-Cp,结束
|
||||
if(Cp<=W){
|
||||
JSONObject W_weight = new JSONObject();
|
||||
W_weight.put("formula_qty",NumberUtil.round(W-Cp,3).doubleValue());
|
||||
//钨分类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{//若Cp>Wp
|
||||
double Wp = NumberUtil.round(W-Cp,6).doubleValue();
|
||||
if(Wp>0){
|
||||
JSONObject W_weight = new JSONObject();
|
||||
W_weight.put("formula_qty",NumberUtil.round(Wp,6).doubleValue());
|
||||
//钨分类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);
|
||||
}
|
||||
|
||||
if(Cp>0){
|
||||
JSONObject C_weight = new JSONObject();
|
||||
C_weight.put("formula_qty",Cp);
|
||||
//钨分类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);
|
||||
}
|
||||
}else{
|
||||
//若Cp>Wp
|
||||
//解方程组
|
||||
//获取最后一个配粉软废R3p
|
||||
JSONObject R3p = rf_list.getJSONObject(rf_list.size()-1);
|
||||
@@ -3391,15 +3420,13 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
}
|
||||
}
|
||||
});
|
||||
//R3p减=C缺/[1-(R3的bom碳化钨含量*R3碳平衡+R3的bom碳化钨含量+Y1含量+Z1含量+Z2含量)]
|
||||
double R3p_jian = C_que/(1.0-(rf3_Cr3C2*is_tan3+rf3_Cr3C2+sum_YZ.get()));
|
||||
// R3p减=C缺/[1-(R3的bom碳化钨含量*R3碳平衡+Y1含量+Z1含量+Z2含量)]
|
||||
double R3p_jian = C_que/(1.0-(rf3_Cr3C2*is_tan3+sum_YZ.get()));
|
||||
|
||||
R3p_jian = NumberUtil.round(R3p_jian,3).doubleValue();
|
||||
R3p_jian = NumberUtil.round(R3p_jian,6).doubleValue();
|
||||
|
||||
//C补=R3p减*R3的bom碳化钨含量*R3碳平衡+C缺
|
||||
double C_bu = R3p_jian*rf3_Cr3C2*is_tan3+C_que;
|
||||
//W补= R3p减*R3的bom碳化钨含量
|
||||
double W_bu = R3p_jian*rf3_Cr3C2;
|
||||
if(C_bu<=0) {
|
||||
if (rf_list.size() == 1) {
|
||||
throw new BadRequestException("无解!");
|
||||
@@ -3434,29 +3461,12 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
});
|
||||
// R3p=R3p-R3p减/ R3纯粉系数
|
||||
double r3_formula_qty = R3p.getDouble("formula_qty");
|
||||
r3_formula_qty = NumberUtil.round(r3_formula_qty - R3p_jian/(R3p.getDouble("net_rate")/100.0),3).doubleValue();
|
||||
r3_formula_qty = NumberUtil.round(r3_formula_qty - R3p_jian/(R3p.getDouble("net_rate")/100.0),6).doubleValue();
|
||||
R3p.put("formula_qty",r3_formula_qty);
|
||||
rf_map.put(R3p.getString("stockrecord_id"),R3p);
|
||||
if(r3_formula_qty<=0){
|
||||
rf_map.remove(R3p.getString("stockrecord_id"));
|
||||
}
|
||||
if(W_bu>0){
|
||||
//Wp=W补
|
||||
JSONObject W_weight = new JSONObject();
|
||||
W_weight.put("formula_qty",W_bu);
|
||||
//钨分类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);
|
||||
}
|
||||
if(C_bu>0){
|
||||
//Wp=Wp+W补
|
||||
Cp = Cp + C_bu;
|
||||
@@ -3507,13 +3517,13 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
}
|
||||
});
|
||||
//除数
|
||||
double sub1 = R3p_jian*rf3_Cr3C2*is_tan3+C_que+R3p_jian*rf3_Cr3C2+ sum_he_R3p.get();
|
||||
double sub1 = R3p_jian*rf3_Cr3C2*is_tan3+C_que+ sum_he_R3p.get();
|
||||
//被除数
|
||||
double sub2 = 1.0 - (sum_he.get() + rf2_Cr3C2 + rf2_Cr3C2*is_tan2);
|
||||
double sub2 = 1.0 - (sum_he.get() + rf2_Cr3C2*is_tan2);
|
||||
/**
|
||||
* R2p减 = (R3p*R3的bom碳化钨含量*R3碳平衡 + C缺 + R3p*R3的bom碳化钨含量
|
||||
* + R3p*Y1含量 + R3p*Z1含量 + R3p*Z2含量 - R3p)/(1-(Z2含量+Y1含量+Z1含量
|
||||
* +R2的bom碳化钨含量+R2的bom碳化钨含量*R2碳平衡))
|
||||
* R2p减 =
|
||||
* (R3p*R3的bom碳化钨含量*R3碳平衡 + C缺+ R3p*Y1含量 + R3p*Z1含量 + R3p*Z2含量 - R3p)/
|
||||
* (1-(Z2含量+Y1含量+Z1含量+R2的bom碳化钨含量*R2碳平衡))
|
||||
*/
|
||||
double R2p_jian = sub1/sub2;
|
||||
//计算非碳化钨需补重量
|
||||
@@ -3553,7 +3563,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
});
|
||||
// R3p=R3p-R3p减/ R3纯粉系数
|
||||
double r3_formula_qty = R3p.getDouble("formula_qty");
|
||||
r3_formula_qty = NumberUtil.round(r3_formula_qty - r3_formula_qty/(R3p.getDouble("net_rate")/100.0),3).doubleValue();
|
||||
r3_formula_qty = NumberUtil.round(r3_formula_qty - r3_formula_qty/(R3p.getDouble("net_rate")/100.0),6).doubleValue();
|
||||
R3p.put("formula_qty",r3_formula_qty);
|
||||
rf_map.put(R3p.getString("stockrecord_id"),R3p);
|
||||
if(r3_formula_qty<=0){
|
||||
@@ -3561,37 +3571,18 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
}
|
||||
// R2p=R2p-R2p减/ R2纯粉系数
|
||||
double r2_formula_qty = R2p.getDouble("formula_qty");
|
||||
r2_formula_qty = NumberUtil.round(r2_formula_qty - R2p_jian/(R2p.getDouble("net_rate")/100.0),3).doubleValue();
|
||||
r2_formula_qty = NumberUtil.round(r2_formula_qty - R2p_jian/(R2p.getDouble("net_rate")/100.0),6).doubleValue();
|
||||
R2p.put("formula_qty",r2_formula_qty);
|
||||
rf_map.put(R2p.getString("stockrecord_id"),R2p);
|
||||
if(r2_formula_qty<=0){
|
||||
rf_map.remove(R2p.getString("stockrecord_id"));
|
||||
}
|
||||
//W补= R3p减*R3的bom碳化钨含量+ R2p减*R2的bom碳化钨含量
|
||||
double W_bu = R3p_jian*rf3_Cr3C2 + R2p_jian*rf2_Cr3C2;
|
||||
//C补=R3p减*R3的bom碳化钨含量*R3碳平衡+ R2p减*R2的bom碳化钨含量*R2碳平衡+C缺
|
||||
double C_bu = R3p_jian*rf3_Cr3C2*is_tan3 + R2p_jian*rf2_Cr3C2*is_tan2 + C_que;
|
||||
//W补= R3p减*R3的bom碳化钨含量
|
||||
if(C_bu<=0) {
|
||||
throw new BadRequestException("无解!");
|
||||
}else{
|
||||
if(W_bu>0){
|
||||
//Wp=W补
|
||||
JSONObject W_weight = new JSONObject();
|
||||
W_weight.put("formula_qty",W_bu);
|
||||
//钨分类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);
|
||||
}
|
||||
if(C_bu>0){
|
||||
//Wp=Wp+W补
|
||||
Cp = Cp + C_bu;
|
||||
@@ -3617,7 +3608,10 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
}else{
|
||||
throw new BadRequestException("满足条件的软废为0,请按新料模式配粉!");
|
||||
}
|
||||
}else if(CT1>CT2){//需配钨粉
|
||||
|
||||
}else
|
||||
//需配钨粉
|
||||
if(CT1>CT2){
|
||||
//B、若有软废,先加钨Wp=桶重量 - (R1p*R1纯粉系数+ R2p*R2纯粉系数…) - (Y1p+X1p+X2p…)
|
||||
if(rf_list.size()!=0){
|
||||
double W = net_qty;
|
||||
@@ -3635,7 +3629,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
double need_qty = bomdlt.getDouble("formula_qty");
|
||||
W = NumberUtil.round(W - need_qty,3).doubleValue();
|
||||
}
|
||||
|
||||
if(W<=0){
|
||||
W = 0;
|
||||
}
|
||||
//解方程组
|
||||
//获取最后一个配粉软废R3p
|
||||
JSONObject R3p = rf_list.getJSONObject(rf_list.size()-1);
|
||||
|
||||
Reference in New Issue
Block a user