优化
This commit is contained in:
@@ -22,6 +22,8 @@ import org.springframework.http.ResponseEntity;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -39,6 +41,12 @@ public class EquipmentfileController {
|
|||||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||||
return new ResponseEntity<>(equipmentfileService.queryAll(whereJson,page),HttpStatus.OK);
|
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
|
@PostMapping
|
||||||
@Log("新增工令")
|
@Log("新增工令")
|
||||||
|
|||||||
@@ -3,8 +3,12 @@ package org.nl.wms.basedata.em.service;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.nl.wms.pcs.service.dto.ProductplanprocDto;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@@ -18,6 +22,21 @@ public interface EquipmentfileService {
|
|||||||
*/
|
*/
|
||||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
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 /
|
* @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.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUnit;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
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.security.service.dto.JwtUserDto;
|
||||||
import org.nl.modules.system.service.DeptService;
|
import org.nl.modules.system.service.DeptService;
|
||||||
import org.nl.modules.system.util.CodeUtil;
|
import org.nl.modules.system.util.CodeUtil;
|
||||||
|
import org.nl.utils.FileUtil;
|
||||||
import org.nl.utils.SecurityUtils;
|
import org.nl.utils.SecurityUtils;
|
||||||
import org.nl.utils.SpringContextHolder;
|
import org.nl.utils.SpringContextHolder;
|
||||||
import org.nl.wms.basedata.em.service.EquipmentfileService;
|
import org.nl.wms.basedata.em.service.EquipmentfileService;
|
||||||
import org.nl.wms.basedata.master.constant.MaterOptTypeEnum;
|
import org.nl.wms.basedata.master.constant.MaterOptTypeEnum;
|
||||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
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.wms.pdm.service.WorkOrdereService;
|
||||||
import org.nl.wql.WQL;
|
import org.nl.wql.WQL;
|
||||||
import org.nl.wql.core.bean.WQLObject;
|
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.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Service
|
@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");
|
JSONObject json = WQL.getWO("QEM_EQUIPMENTFILE01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "equipmentfile.devicerecord_code");
|
||||||
return json;
|
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
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void create(JSONObject json) {
|
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);
|
JSONArray ja = EM_BI_DeviceBOM.query("is_delete='0' and is_used='1' and material_type_id='"+material_type_id+"'").getResultJSONArray(0);
|
||||||
return ja;
|
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
|
ENDPAGEQUERY
|
||||||
ENDIF
|
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"
|
IF 输入.flag = "2"
|
||||||
QUERY
|
QUERY
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@@ -1443,6 +1443,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
//纯粉重量
|
//纯粉重量
|
||||||
double net_qty = workorder_qty;
|
double net_qty = workorder_qty;
|
||||||
//1.需添加软废
|
//1.需添加软废
|
||||||
|
if(waste_limit_down==100 || waste_limit_up== 100){
|
||||||
|
throw new BadRequestException("软废含量上限或下限不能等于100%!");
|
||||||
|
}
|
||||||
//R下
|
//R下
|
||||||
double waste_limit_down_weight = workorder_qty * waste_limit_down/100.0;
|
double waste_limit_down_weight = workorder_qty * waste_limit_down/100.0;
|
||||||
//R上
|
//R上
|
||||||
@@ -3213,7 +3216,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
}
|
}
|
||||||
//BOM中碳化钨需含总碳
|
//BOM中碳化钨需含总碳
|
||||||
double CT2 = new_qty*(sum_Cr3C2/100.0)*(c_balance/100.0);
|
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…)
|
double W = net_qty;//钨Wp=桶重量 - (R1p*R1纯粉系数+ R2p*R2纯粉系数…) - (Y1p+X1p+X2p…)
|
||||||
//软废总碳
|
//软废总碳
|
||||||
for(int i=0;i<rf_list.size();i++){
|
for(int i=0;i<rf_list.size();i++){
|
||||||
@@ -3247,7 +3251,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
W_weight.put("quality_scode","01");
|
W_weight.put("quality_scode","01");
|
||||||
cw_list.add(W_weight);
|
cw_list.add(W_weight);
|
||||||
}
|
}
|
||||||
}else if(CT1<CT2){//需配碳粉
|
}else
|
||||||
|
//需配碳粉
|
||||||
|
if(CT1<CT2){
|
||||||
//B、若有软废,先加钨Wp=桶重量 - (R1p*R1纯粉系数+ R2p*R2纯粉系数…) - (Y1p+X1p+X2p…)
|
//B、若有软废,先加钨Wp=桶重量 - (R1p*R1纯粉系数+ R2p*R2纯粉系数…) - (Y1p+X1p+X2p…)
|
||||||
if(rf_list.size()!=0){//只配库存明细时
|
if(rf_list.size()!=0){//只配库存明细时
|
||||||
double W = net_qty;
|
double W = net_qty;
|
||||||
@@ -3256,37 +3262,60 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
JSONObject ivt_new = rf_list.getJSONObject(i);
|
JSONObject ivt_new = rf_list.getJSONObject(i);
|
||||||
//R1p*R1纯粉系数
|
//R1p*R1纯粉系数
|
||||||
double net_rate_qty = ivt_new.getDouble("formula_qty")*ivt_new.getDouble("net_rate")/100.0;
|
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…)
|
//桶重量 - (R1p*R1纯粉系数+ R2p*R2纯粉系数…) - (Y1p+X1p+X2p…)
|
||||||
for(int i=0;i<xl_list.size();i++){
|
for(int i=0;i<xl_list.size();i++){
|
||||||
JSONObject bomdlt = xl_list.getJSONObject(i);
|
JSONObject bomdlt = xl_list.getJSONObject(i);
|
||||||
//Y1p+X1p+X2p
|
//Y1p+X1p+X2p
|
||||||
double need_qty = bomdlt.getDouble("formula_qty");
|
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){
|
if(W<0){
|
||||||
throw new BadRequestException("补钨粉重量为负数,请检查bom及其他参数!");
|
//throw new BadRequestException("补钨粉重量为负数,请检查bom及其他参数!");
|
||||||
|
W = 0;
|
||||||
}
|
}
|
||||||
//补碳Cp=CT2-CT1,比较Cp、Wp:若Cp<=Wp,更新Wp=Wp-Cp,结束
|
//补碳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,结束
|
//若Cp<=Wp,更新Wp=Wp-Cp,结束
|
||||||
if(Cp<=W){
|
if(Cp<=W){
|
||||||
JSONObject W_weight = new JSONObject();
|
double Wp = NumberUtil.round(W-Cp,6).doubleValue();
|
||||||
W_weight.put("formula_qty",NumberUtil.round(W-Cp,3).doubleValue());
|
if(Wp>0){
|
||||||
//钨分类id
|
JSONObject W_weight = new JSONObject();
|
||||||
W_weight.put("material_id","1503644362234531840");
|
W_weight.put("formula_qty",NumberUtil.round(Wp,6).doubleValue());
|
||||||
W_weight.put("material_name","钨粉");
|
//钨分类id
|
||||||
W_weight.put("material_code","09030103");
|
W_weight.put("material_id","1503644362234531840");
|
||||||
W_weight.put("material_type","02");
|
W_weight.put("material_name","钨粉");
|
||||||
W_weight.put("is_need_move","0");
|
W_weight.put("material_code","09030103");
|
||||||
W_weight.put("is_need_manage","1");
|
W_weight.put("material_type","02");
|
||||||
W_weight.put("is_rf_xl","0");
|
W_weight.put("is_need_move","0");
|
||||||
W_weight.put("ivt_level","01");
|
W_weight.put("is_need_manage","1");
|
||||||
W_weight.put("is_active","1");
|
W_weight.put("is_rf_xl","0");
|
||||||
W_weight.put("quality_scode","01");
|
W_weight.put("ivt_level","01");
|
||||||
cw_list.add(W_weight);
|
W_weight.put("is_active","1");
|
||||||
}else{//若Cp>Wp
|
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
|
//获取最后一个配粉软废R3p
|
||||||
JSONObject R3p = rf_list.getJSONObject(rf_list.size()-1);
|
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含量)]
|
// R3p减=C缺/[1-(R3的bom碳化钨含量*R3碳平衡+Y1含量+Z1含量+Z2含量)]
|
||||||
double R3p_jian = C_que/(1.0-(rf3_Cr3C2*is_tan3+rf3_Cr3C2+sum_YZ.get()));
|
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缺
|
//C补=R3p减*R3的bom碳化钨含量*R3碳平衡+C缺
|
||||||
double C_bu = R3p_jian*rf3_Cr3C2*is_tan3+C_que;
|
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(C_bu<=0) {
|
||||||
if (rf_list.size() == 1) {
|
if (rf_list.size() == 1) {
|
||||||
throw new BadRequestException("无解!");
|
throw new BadRequestException("无解!");
|
||||||
@@ -3434,29 +3461,12 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
});
|
});
|
||||||
// R3p=R3p-R3p减/ R3纯粉系数
|
// R3p=R3p-R3p减/ R3纯粉系数
|
||||||
double r3_formula_qty = R3p.getDouble("formula_qty");
|
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);
|
R3p.put("formula_qty",r3_formula_qty);
|
||||||
rf_map.put(R3p.getString("stockrecord_id"),R3p);
|
rf_map.put(R3p.getString("stockrecord_id"),R3p);
|
||||||
if(r3_formula_qty<=0){
|
if(r3_formula_qty<=0){
|
||||||
rf_map.remove(R3p.getString("stockrecord_id"));
|
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){
|
if(C_bu>0){
|
||||||
//Wp=Wp+W补
|
//Wp=Wp+W补
|
||||||
Cp = Cp + C_bu;
|
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碳化钨含量
|
* R2p减 =
|
||||||
* + R3p*Y1含量 + R3p*Z1含量 + R3p*Z2含量 - R3p)/(1-(Z2含量+Y1含量+Z1含量
|
* (R3p*R3的bom碳化钨含量*R3碳平衡 + C缺+ R3p*Y1含量 + R3p*Z1含量 + R3p*Z2含量 - R3p)/
|
||||||
* +R2的bom碳化钨含量+R2的bom碳化钨含量*R2碳平衡))
|
* (1-(Z2含量+Y1含量+Z1含量+R2的bom碳化钨含量*R2碳平衡))
|
||||||
*/
|
*/
|
||||||
double R2p_jian = sub1/sub2;
|
double R2p_jian = sub1/sub2;
|
||||||
//计算非碳化钨需补重量
|
//计算非碳化钨需补重量
|
||||||
@@ -3553,7 +3563,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
});
|
});
|
||||||
// R3p=R3p-R3p减/ R3纯粉系数
|
// R3p=R3p-R3p减/ R3纯粉系数
|
||||||
double r3_formula_qty = R3p.getDouble("formula_qty");
|
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);
|
R3p.put("formula_qty",r3_formula_qty);
|
||||||
rf_map.put(R3p.getString("stockrecord_id"),R3p);
|
rf_map.put(R3p.getString("stockrecord_id"),R3p);
|
||||||
if(r3_formula_qty<=0){
|
if(r3_formula_qty<=0){
|
||||||
@@ -3561,37 +3571,18 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
}
|
}
|
||||||
// R2p=R2p-R2p减/ R2纯粉系数
|
// R2p=R2p-R2p减/ R2纯粉系数
|
||||||
double r2_formula_qty = R2p.getDouble("formula_qty");
|
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);
|
R2p.put("formula_qty",r2_formula_qty);
|
||||||
rf_map.put(R2p.getString("stockrecord_id"),R2p);
|
rf_map.put(R2p.getString("stockrecord_id"),R2p);
|
||||||
if(r2_formula_qty<=0){
|
if(r2_formula_qty<=0){
|
||||||
rf_map.remove(R2p.getString("stockrecord_id"));
|
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缺
|
//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;
|
double C_bu = R3p_jian*rf3_Cr3C2*is_tan3 + R2p_jian*rf2_Cr3C2*is_tan2 + C_que;
|
||||||
//W补= R3p减*R3的bom碳化钨含量
|
//W补= R3p减*R3的bom碳化钨含量
|
||||||
if(C_bu<=0) {
|
if(C_bu<=0) {
|
||||||
throw new BadRequestException("无解!");
|
throw new BadRequestException("无解!");
|
||||||
}else{
|
}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){
|
if(C_bu>0){
|
||||||
//Wp=Wp+W补
|
//Wp=Wp+W补
|
||||||
Cp = Cp + C_bu;
|
Cp = Cp + C_bu;
|
||||||
@@ -3617,7 +3608,10 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
}else{
|
}else{
|
||||||
throw new BadRequestException("满足条件的软废为0,请按新料模式配粉!");
|
throw new BadRequestException("满足条件的软废为0,请按新料模式配粉!");
|
||||||
}
|
}
|
||||||
}else if(CT1>CT2){//需配钨粉
|
|
||||||
|
}else
|
||||||
|
//需配钨粉
|
||||||
|
if(CT1>CT2){
|
||||||
//B、若有软废,先加钨Wp=桶重量 - (R1p*R1纯粉系数+ R2p*R2纯粉系数…) - (Y1p+X1p+X2p…)
|
//B、若有软废,先加钨Wp=桶重量 - (R1p*R1纯粉系数+ R2p*R2纯粉系数…) - (Y1p+X1p+X2p…)
|
||||||
if(rf_list.size()!=0){
|
if(rf_list.size()!=0){
|
||||||
double W = net_qty;
|
double W = net_qty;
|
||||||
@@ -3635,7 +3629,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
double need_qty = bomdlt.getDouble("formula_qty");
|
double need_qty = bomdlt.getDouble("formula_qty");
|
||||||
W = NumberUtil.round(W - need_qty,3).doubleValue();
|
W = NumberUtil.round(W - need_qty,3).doubleValue();
|
||||||
}
|
}
|
||||||
|
if(W<=0){
|
||||||
|
W = 0;
|
||||||
|
}
|
||||||
//解方程组
|
//解方程组
|
||||||
//获取最后一个配粉软废R3p
|
//获取最后一个配粉软废R3p
|
||||||
JSONObject R3p = rf_list.getJSONObject(rf_list.size()-1);
|
JSONObject R3p = rf_list.getJSONObject(rf_list.size()-1);
|
||||||
|
|||||||
@@ -177,6 +177,16 @@
|
|||||||
>
|
>
|
||||||
打印
|
打印
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
slot="right"
|
||||||
|
class="filter-item"
|
||||||
|
type="warning"
|
||||||
|
icon="el-icon-position"
|
||||||
|
size="mini"
|
||||||
|
@click="downdtl()"
|
||||||
|
>
|
||||||
|
导出excel
|
||||||
|
</el-button>
|
||||||
</crudOperation>
|
</crudOperation>
|
||||||
<!--表格渲染-->
|
<!--表格渲染-->
|
||||||
<el-table
|
<el-table
|
||||||
@@ -204,35 +214,35 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :selectable="checkboxT" type="selection" width="55" />
|
<el-table-column :selectable="checkboxT" type="selection" width="55" />
|
||||||
<el-table-column prop="设备代码" width="130" label="设备代码">
|
<el-table-column prop="设备代码" width="100" label="设备代码">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-link type="warning" @click="toView(scope.$index, scope.row)">{{ scope.row.device_code }}</el-link>
|
<el-link type="warning" @click="toView(scope.$index, scope.row)">{{ scope.row.device_code }}</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="device_name" min-width="130" label="设备名称"/>
|
<el-table-column prop="device_name" min-width="150" label="设备名称"/>
|
||||||
<el-table-column prop="extend_code" min-width="130" label="内部自编号"/>
|
<el-table-column prop="extend_code" min-width="100" label="内部自编号"/>
|
||||||
<el-table-column prop="device_model" min-width="130" label="设备型号"/>
|
<el-table-column prop="device_model" min-width="130" label="设备型号"/>
|
||||||
<el-table-column prop="device_spec" min-width="130" label="设备规格"/>
|
<el-table-column prop="device_spec" min-width="130" label="设备规格"/>
|
||||||
<el-table-column prop="material_type_name" min-width="80" label="设备类别" />
|
<el-table-column prop="material_type_name" min-width="150" label="设备类别" />
|
||||||
<el-table-column :formatter="is_produceuseFormat" min-width="100" prop="is_produceuse" label="生产用途" />
|
<el-table-column :formatter="is_produceuseFormat" min-width="70" prop="is_produceuse" label="生产用途" />
|
||||||
<el-table-column :formatter="stateFormat" min-width="100" prop="status" label="设备状态" />
|
<el-table-column :formatter="stateFormat" min-width="70" prop="status" label="设备状态" />
|
||||||
<el-table-column prop="beginuse_date" min-width="130" label="启用日期"/>
|
<el-table-column prop="beginuse_date" min-width="90" label="启用日期"/>
|
||||||
<el-table-column prop="use_deptname" min-width="130" label="使用部门"/>
|
<el-table-column prop="use_deptname" min-width="130" label="使用部门"/>
|
||||||
<el-table-column prop="use_groupname" min-width="130" label="使用班组"/>
|
<el-table-column prop="use_groupname" min-width="130" label="使用班组"/>
|
||||||
<el-table-column prop="supplier_name" min-width="130" label="供应商"/>
|
<el-table-column prop="supplier_name" min-width="180" label="供应商"/>
|
||||||
<el-table-column prop="manufacturer" min-width="130" label="制造商"/>
|
<el-table-column prop="manufacturer" min-width="180" label="制造商"/>
|
||||||
<el-table-column prop="country_manufactur" min-width="130" label="制造国别"/>
|
<el-table-column prop="country_manufactur" min-width="90" label="制造国别"/>
|
||||||
<el-table-column prop="leavefactory_date" min-width="130" label="出厂日期"/>
|
<el-table-column prop="leavefactory_date" min-width="80" label="出厂日期"/>
|
||||||
<el-table-column prop="leavefactory_number" min-width="130" label="出厂编号"/>
|
<el-table-column prop="leavefactory_number" min-width="130" label="出厂编号"/>
|
||||||
<el-table-column prop="drawing_number" min-width="130" label="图号"/>
|
<el-table-column prop="drawing_number" min-width="130" label="图号"/>
|
||||||
<el-table-column prop="device_type" min-width="130" label="设备属性" :formatter="device_typeFormat"/>
|
<el-table-column prop="device_type" min-width="70" label="设备属性" :formatter="device_typeFormat"/>
|
||||||
<el-table-column prop="workprocedure_id" min-width="130" label="工序" :formatter="seriesFormat2" />
|
<el-table-column prop="workprocedure_id" min-width="70" label="工序" :formatter="seriesFormat2" />
|
||||||
<el-table-column prop="assets_code" min-width="130" label="资产编码"/>
|
<el-table-column prop="assets_code" min-width="100" label="资产编码"/>
|
||||||
<el-table-column prop="assets_name" min-width="130" label="资产名称"/>
|
<el-table-column prop="assets_name" min-width="150" label="资产名称"/>
|
||||||
<el-table-column prop="create_name" min-width="130" label="生成人"/>
|
<el-table-column prop="create_name" min-width="90" label="生成人"/>
|
||||||
<el-table-column prop="create_time" min-width="150" label="生成时间"/>
|
<el-table-column prop="create_time" min-width="140" label="生成时间"/>
|
||||||
<el-table-column prop="update_optname" min-width="130" label="修改人"/>
|
<el-table-column prop="update_optname" min-width="90" label="修改人"/>
|
||||||
<el-table-column prop="update_time" min-width="150" label="修改时间"/>
|
<el-table-column prop="update_time" min-width="140" label="修改时间"/>
|
||||||
</el-table>
|
</el-table>
|
||||||
<!--分页组件-->
|
<!--分页组件-->
|
||||||
<pagination />
|
<pagination />
|
||||||
@@ -261,6 +271,8 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
|||||||
import { getDepts } from '@/api/system/dept'
|
import { getDepts } from '@/api/system/dept'
|
||||||
import crudClassstandard from '@/api/wms/basedata/master/classstandard'
|
import crudClassstandard from '@/api/wms/basedata/master/classstandard'
|
||||||
import crudMaterialbase from '@/api/wms/basedata/master/materialbase'
|
import crudMaterialbase from '@/api/wms/basedata/master/materialbase'
|
||||||
|
import { download } from '@/api/data'
|
||||||
|
import { downloadFile } from '@/utils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'equipmentfile',
|
name: 'equipmentfile',
|
||||||
@@ -459,6 +471,15 @@ export default {
|
|||||||
this.crud.toQuery()
|
this.crud.toQuery()
|
||||||
this.handleCurrentChange()
|
this.handleCurrentChange()
|
||||||
},
|
},
|
||||||
|
downdtl() {
|
||||||
|
crud.downloadLoading = true
|
||||||
|
download('/api/equipmentfile/download', this.crud.query).then(result => {
|
||||||
|
downloadFile(result, '设备档案', 'xlsx')
|
||||||
|
crud.downloadLoading = false
|
||||||
|
}).catch(() => {
|
||||||
|
crud.downloadLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
printCard() {
|
printCard() {
|
||||||
const _selectData = this.$refs.table.selection
|
const _selectData = this.$refs.table.selection
|
||||||
if (_selectData.length > 1 || _selectData.length === 0) {
|
if (_selectData.length > 1 || _selectData.length === 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user