代码更新

This commit is contained in:
2022-10-20 21:17:12 +08:00
13 changed files with 244 additions and 68 deletions

View File

@@ -52,6 +52,12 @@ public class PerformancemstController {
return new ResponseEntity<>(performancemstService.workLoadStatQuery(whereJson,page),HttpStatus.OK); return new ResponseEntity<>(performancemstService.workLoadStatQuery(whereJson,page),HttpStatus.OK);
} }
@ApiOperation("导出数据")
@GetMapping(value = "/workloadstat/download")
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
performancemstService.download(whereJson, response);
}
@PostMapping @PostMapping
@Log("新增工作量汇报") @Log("新增工作量汇报")
@ApiOperation("新增工作量汇报") @ApiOperation("新增工作量汇报")

View File

@@ -457,11 +457,8 @@ public class DailyplanServiceImpl implements DailyplanService {
if (StrUtil.isNotEmpty(query.getString("nowstart_date"))) { if (StrUtil.isNotEmpty(query.getString("nowstart_date"))) {
String nowstart_date2 = query.getString("nowstart_date").substring(0,10); String nowstart_date2 = query.getString("nowstart_date").substring(0,10);
Date date2 = DateUtil.parse(nowstart_date2); Date date2 = DateUtil.parse(nowstart_date2);
//指定日期小于最晚的日计划日期 nowstart_date = nowstart_date2;
if(date2.getTime() >= date.getTime()){ date = date2;
nowstart_date = nowstart_date2;
date = date2;
}
} }
} }

View File

@@ -20,6 +20,7 @@ import org.nl.wql.core.bean.WQLObject;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
@@ -81,6 +82,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
double new_qty = workorder_qty; double new_qty = workorder_qty;
//纯粉重量 //纯粉重量
double net_qty = workorder_qty; double net_qty = workorder_qty;
//rf最高开单重量
HashMap<String,JSONObject> rf_plan_map = new HashMap<String,JSONObject>();
if(waste_limit_down==0 && waste_limit_up==0){//不添加软废 if(waste_limit_down==0 && waste_limit_up==0){//不添加软废
//新料配粉环节 //新料配粉环节
JSONObject ret = this.autoCalculationBy01_xinliao(json); JSONObject ret = this.autoCalculationBy01_xinliao(json);
@@ -129,6 +133,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
for(int i=0;i<MaterialSets.size();i++){ for(int i=0;i<MaterialSets.size();i++){
JSONObject MaterialSet = MaterialSets.getJSONObject(i); JSONObject MaterialSet = MaterialSets.getJSONObject(i);
String set_material_id = MaterialSet.getString("set_material_id"); String set_material_id = MaterialSet.getString("set_material_id");
double add_rate = MaterialSet.getDouble("add_rate");
JSONArray now_ivts = WQL.getWO("QPF_AUTOFORMULA01") JSONArray now_ivts = WQL.getWO("QPF_AUTOFORMULA01")
.addParam("material_id",set_material_id) .addParam("material_id",set_material_id)
.addParam("is_active",value_is_active) .addParam("is_active",value_is_active)
@@ -136,7 +141,21 @@ public class AutoformulaServiceImpl implements AutoformulaService {
.addParam("workorder_id",workorder_id) .addParam("workorder_id",workorder_id)
.addParam("flag","22") .addParam("flag","22")
.process().getResultJSONArray(0); .process().getResultJSONArray(0);
ivts.addAll(now_ivts); for(int j=0;j<now_ivts.size();j++){
JSONObject jo = now_ivts.getJSONObject(j);
double can_qty = net_qty*add_rate/100.0;
JSONObject jo2 = new JSONObject();
jo2.put("can_qty",can_qty);
jo2.put("can_left_qty",can_qty);
rf_plan_map.put(set_material_id,jo2);
double sum_ivt_qty = jo.getDouble("sum_ivt_qty");
if(can_qty >= sum_ivt_qty){
jo.put("can_qty",sum_ivt_qty);
}else{
jo.put("can_qty",can_qty);
}
ivts.add(jo);
}
} }
if(ivts.size()!=0){ if(ivts.size()!=0){
//软废纯粉库存总量 //软废纯粉库存总量
@@ -145,7 +164,13 @@ public class AutoformulaServiceImpl implements AutoformulaService {
for(int i=0;i<ivts.size();i++){ for(int i=0;i<ivts.size();i++){
JSONObject ivt = ivts.getJSONObject(i); JSONObject ivt = ivts.getJSONObject(i);
String ivt_material_id = ivt.getString("material_id"); String ivt_material_id = ivt.getString("material_id");
if(ivt.getDouble("sum_ivt_qty")<=0 || ivt.getDouble("sum_ivt_qty")<0.01){ double can_qty = ivt.getDouble("can_qty");
if(can_qty<=0 || can_qty<0.01){
continue;
}
JSONObject can_jo = rf_plan_map.get(ivt_material_id);
double can_left_qty = can_jo.getDouble("can_left_qty");
if(can_left_qty <=0){
continue; continue;
} }
JSONObject ProductMaterialExt = MD_ME_ProductMaterialExt.query("material_id='"+ivt_material_id+"'").uniqueResult(0); JSONObject ProductMaterialExt = MD_ME_ProductMaterialExt.query("material_id='"+ivt_material_id+"'").uniqueResult(0);
@@ -156,7 +181,15 @@ public class AutoformulaServiceImpl implements AutoformulaService {
if(net_rate==0){ if(net_rate==0){
throw new BadRequestException("软废"+ivt.getString("material_code")+" "+ivt.getString("material_name")+"未配置纯粉系数!"); throw new BadRequestException("软废"+ivt.getString("material_code")+" "+ivt.getString("material_name")+"未配置纯粉系数!");
} }
double ivt_qty = ivt.getDouble("sum_ivt_qty")*net_rate/100.0; if(can_qty <= can_left_qty){
can_qty = can_qty;
can_jo.put("can_left_qty",can_left_qty-can_qty);
}else{
can_qty = can_left_qty;
can_jo.put("can_left_qty",can_left_qty-can_qty);
}
rf_plan_map.put(ivt_material_id,can_jo);
double ivt_qty = can_qty*net_rate/100.0;
//Rp*纯粉系数 //Rp*纯粉系数
ivt.put("net_rate_qty",ivt_qty); ivt.put("net_rate_qty",ivt_qty);
//纯粉系数 //纯粉系数
@@ -1580,6 +1613,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
double new_qty = workorder_qty; double new_qty = workorder_qty;
//纯粉重量 //纯粉重量
double net_qty = workorder_qty; double net_qty = workorder_qty;
//rf最高开单重量
HashMap<String,JSONObject> rf_plan_map = new HashMap<String,JSONObject>();
//1.需添加软废 //1.需添加软废
if(waste_limit_down==100 || waste_limit_up== 100){ if(waste_limit_down==100 || waste_limit_up== 100){
throw new BadRequestException("软废含量上限或下限不能等于100%"); throw new BadRequestException("软废含量上限或下限不能等于100%");
@@ -1620,7 +1655,22 @@ public class AutoformulaServiceImpl implements AutoformulaService {
.addParam("quality_scode","02") .addParam("quality_scode","02")
.addParam("flag","22") .addParam("flag","22")
.process().getResultJSONArray(0); .process().getResultJSONArray(0);
ivts.addAll(now_ivts); double add_rate = MaterialSet.getDouble("add_rate");
for(int j=0;j<now_ivts.size();j++){
JSONObject jo = now_ivts.getJSONObject(j);
double can_qty = net_qty*add_rate/100.0;
JSONObject jo2 = new JSONObject();
jo2.put("can_qty",can_qty);
jo2.put("can_left_qty",can_qty);
rf_plan_map.put(set_material_id,jo2);
double sum_ivt_qty = jo.getDouble("sum_ivt_qty");
if(can_qty >= sum_ivt_qty){
jo.put("can_qty",sum_ivt_qty);
}else{
jo.put("can_qty",can_qty);
}
ivts.add(jo);
}
} }
if(ivts.size()!=0){ if(ivts.size()!=0){
//软废纯粉库存总量 //软废纯粉库存总量
@@ -1628,7 +1678,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
JSONArray ivts_new = new JSONArray(); JSONArray ivts_new = new JSONArray();
for(int i=0;i<ivts.size();i++){ for(int i=0;i<ivts.size();i++){
JSONObject ivt = ivts.getJSONObject(i); JSONObject ivt = ivts.getJSONObject(i);
if(ivt.getDouble("sum_ivt_qty")<=0 || ivt.getDouble("sum_ivt_qty")<0.01){ if(ivt.getDouble("can_qty")<=0 || ivt.getDouble("can_qty")<0.01){
continue; continue;
} }
String ivt_material_id = ivt.getString("material_id"); String ivt_material_id = ivt.getString("material_id");
@@ -1640,7 +1690,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
if(net_rate==0){ if(net_rate==0){
throw new BadRequestException("软废"+ivt.getString("material_code")+" "+ivt.getString("material_name")+"未配置纯粉系数!"); throw new BadRequestException("软废"+ivt.getString("material_code")+" "+ivt.getString("material_name")+"未配置纯粉系数!");
} }
double ivt_qty = ivt.getDouble("sum_ivt_qty")*net_rate/100.0; double ivt_qty = ivt.getDouble("can_qty")*net_rate/100.0;
//Rp*纯粉系数 //Rp*纯粉系数
ivt.put("net_rate_qty",ivt_qty); ivt.put("net_rate_qty",ivt_qty);
//纯粉系数 //纯粉系数
@@ -1651,7 +1701,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
rf_ivts = rf_ivts + ivt_qty; rf_ivts = rf_ivts + ivt_qty;
} }
if(rf_ivts>=waste_limit_down_weight){ if(rf_ivts>=waste_limit_down_weight){
Number rf_left_weight = waste_limit_up_weight;; Number rf_left_weight = waste_limit_up_weight;
//需配软废总重 //需配软废总重
double rf_total_weight = 0; double rf_total_weight = 0;
//需配软废纯粉总重 //需配软废纯粉总重
@@ -1659,7 +1709,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
for(int i=0;i<ivts_new.size();i++){ for(int i=0;i<ivts_new.size();i++){
JSONObject ivt_new = ivts_new.getJSONObject(i); JSONObject ivt_new = ivts_new.getJSONObject(i);
//可分配库存重量 //可分配库存重量
double ivt_qty = ivt_new.getDouble("sum_ivt_qty"); double ivt_qty = ivt_new.getDouble("can_qty");
//纯粉系数 //纯粉系数
double net_rate = ivt_new.getDouble("net_rate"); double net_rate = ivt_new.getDouble("net_rate");
ivt_qty = NumberUtil.roundDown(ivt_qty,3).doubleValue(); ivt_qty = NumberUtil.roundDown(ivt_qty,3).doubleValue();
@@ -1670,6 +1721,19 @@ public class AutoformulaServiceImpl implements AutoformulaService {
}else{ }else{
formula_qty = rf_up; formula_qty = rf_up;
} }
String rf_material_id = ivt_new.getString("material_id");
JSONObject can_jo = rf_plan_map.get(rf_material_id);
double can_left_qty = can_jo.getDouble("can_left_qty");
if(can_left_qty <=0){
continue;
}
if(can_left_qty<= formula_qty){
formula_qty = can_left_qty;
}else{
formula_qty = formula_qty;
}
double now_ivt_qty = formula_qty * net_rate / 100.0; double now_ivt_qty = formula_qty * net_rate / 100.0;
//已分配软废总量 //已分配软废总量
@@ -1678,6 +1742,10 @@ public class AutoformulaServiceImpl implements AutoformulaService {
rf_left_weight = NumberUtil.round(NumberUtil.sub(rf_left_weight,now_ivt_qty),3); rf_left_weight = NumberUtil.round(NumberUtil.sub(rf_left_weight,now_ivt_qty),3);
//累加软废纯粉重量 //累加软废纯粉重量
rf_net_total_weight = rf_net_total_weight + now_ivt_qty; rf_net_total_weight = rf_net_total_weight + now_ivt_qty;
BigDecimal formula_qty_now = NumberUtil.round(formula_qty,3);
can_jo.put("can_left_qty",can_left_qty-formula_qty_now.doubleValue());
rf_plan_map.put(rf_material_id,can_jo);
//分配软废重量 //分配软废重量
ivt_new.put("formula_qty",NumberUtil.round(formula_qty,3)); ivt_new.put("formula_qty",NumberUtil.round(formula_qty,3));
//纯粉重量 //纯粉重量
@@ -1686,9 +1754,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
ivt_new.put("is_need_move","1"); ivt_new.put("is_need_move","1");
ivt_new.put("is_need_manage","1"); ivt_new.put("is_need_manage","1");
ivt_new.put("is_rf_xl","1"); ivt_new.put("is_rf_xl","1");
//获取软废Bom统计软废总含碳化钨 //获取软废Bom统计软废总含碳化钨
String rf_material_id = ivt_new.getString("material_id");
JSONArray rf_bomdlts = WQL.getWO("QPF_AUTOFORMULA01") JSONArray rf_bomdlts = WQL.getWO("QPF_AUTOFORMULA01")
.addParam("material_id",rf_material_id) .addParam("material_id",rf_material_id)
.addParam("is_need_manage","1") .addParam("is_need_manage","1")
@@ -2826,6 +2892,10 @@ public class AutoformulaServiceImpl implements AutoformulaService {
double new_qty = workorder_qty; double new_qty = workorder_qty;
//纯粉重量 //纯粉重量
double net_qty = workorder_qty; double net_qty = workorder_qty;
//rf最高开单重量
HashMap<String,JSONObject> rf_plan_map = new HashMap<String,JSONObject>();
if(waste_limit_up!=0){//添加软废 if(waste_limit_up!=0){//添加软废
//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;
@@ -2869,7 +2939,23 @@ public class AutoformulaServiceImpl implements AutoformulaService {
.addParam("workorder_id",workorder_id) .addParam("workorder_id",workorder_id)
.addParam("flag","22") .addParam("flag","22")
.process().getResultJSONArray(0); .process().getResultJSONArray(0);
ivts.addAll(now_ivts); double add_rate = MaterialSet.getDouble("add_rate");
for(int j=0;j<now_ivts.size();j++){
JSONObject jo = now_ivts.getJSONObject(j);
double can_qty = net_qty*add_rate/100.0;
JSONObject jo2 = new JSONObject();
jo2.put("can_qty",can_qty);
jo2.put("can_left_qty",can_qty);
rf_plan_map.put(set_material_id,jo2);
double sum_ivt_qty = jo.getDouble("sum_ivt_qty");
if(can_qty >= sum_ivt_qty){
jo.put("can_qty",sum_ivt_qty);
}else{
jo.put("can_qty",can_qty);
}
ivts.add(jo);
}
} }
if(ivts.size()!=0){ if(ivts.size()!=0){
//软废纯粉库存总量 //软废纯粉库存总量
@@ -2877,10 +2963,17 @@ public class AutoformulaServiceImpl implements AutoformulaService {
JSONArray ivts_new = new JSONArray(); JSONArray ivts_new = new JSONArray();
for(int i=0;i<ivts.size();i++){ for(int i=0;i<ivts.size();i++){
JSONObject ivt = ivts.getJSONObject(i); JSONObject ivt = ivts.getJSONObject(i);
if(ivt.getDouble("sum_ivt_qty") <=0 || ivt.getDouble("sum_ivt_qty") <0.01){ double can_qty = ivt.getDouble("can_qty");
if(ivt.getDouble("can_qty") <=0 || ivt.getDouble("can_qty") <0.01){
continue; continue;
} }
String ivt_material_id = ivt.getString("material_id"); String ivt_material_id = ivt.getString("material_id");
JSONObject can_jo = rf_plan_map.get(ivt_material_id);
double can_left_qty = can_jo.getDouble("can_left_qty");
if(can_left_qty <=0){
continue;
}
JSONObject ProductMaterialExt = MD_ME_ProductMaterialExt.query("material_id='"+ivt_material_id+"'").uniqueResult(0); JSONObject ProductMaterialExt = MD_ME_ProductMaterialExt.query("material_id='"+ivt_material_id+"'").uniqueResult(0);
if(ProductMaterialExt ==null){ if(ProductMaterialExt ==null){
throw new BadRequestException("软废"+ivt.getString("material_code")+" "+ivt.getString("material_name")+"未配置成品物料扩展信息!"); throw new BadRequestException("软废"+ivt.getString("material_code")+" "+ivt.getString("material_name")+"未配置成品物料扩展信息!");
@@ -2889,7 +2982,15 @@ public class AutoformulaServiceImpl implements AutoformulaService {
if(net_rate==0){ if(net_rate==0){
throw new BadRequestException("软废"+ivt.getString("material_code")+" "+ivt.getString("material_name")+"未配置纯粉系数!"); throw new BadRequestException("软废"+ivt.getString("material_code")+" "+ivt.getString("material_name")+"未配置纯粉系数!");
} }
double ivt_qty = ivt.getDouble("sum_ivt_qty")*net_rate/100.0; if(can_qty <= can_left_qty){
can_qty = can_qty;
can_jo.put("can_left_qty",can_left_qty-can_qty);
}else{
can_qty = can_left_qty;
can_jo.put("can_left_qty",can_left_qty-can_qty);
}
rf_plan_map.put(ivt_material_id,can_jo);
double ivt_qty = can_qty*net_rate/100.0;
//Rp*纯粉系数 //Rp*纯粉系数
ivt.put("net_rate_qty",ivt_qty); ivt.put("net_rate_qty",ivt_qty);
//纯粉系数 //纯粉系数
@@ -3140,6 +3241,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
//1.需添加软废 //1.需添加软废
//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;
//rf最高开单重量
HashMap<String,JSONObject> rf_plan_map = new HashMap<String,JSONObject>();
//获取可分配的软废集合 //获取可分配的软废集合
JSONArray MaterialSets = WQL.getWO("QPF_AUTOFORMULA01") JSONArray MaterialSets = WQL.getWO("QPF_AUTOFORMULA01")
.addParam("material_id",material_id) .addParam("material_id",material_id)
@@ -3171,7 +3275,23 @@ public class AutoformulaServiceImpl implements AutoformulaService {
.addParam("workorder_id",workorder_id) .addParam("workorder_id",workorder_id)
.addParam("flag","22") .addParam("flag","22")
.process().getResultJSONArray(0); .process().getResultJSONArray(0);
ivts.addAll(now_ivts); double add_rate = MaterialSet.getDouble("add_rate");
for(int j=0;j<now_ivts.size();j++){
JSONObject jo = now_ivts.getJSONObject(j);
double can_qty = net_qty*add_rate/100.0;
JSONObject jo2 = new JSONObject();
jo2.put("can_qty",can_qty);
jo2.put("can_left_qty",can_qty);
rf_plan_map.put(set_material_id,jo2);
double sum_ivt_qty = jo.getDouble("sum_ivt_qty");
if(can_qty >= sum_ivt_qty){
jo.put("can_qty",sum_ivt_qty);
}else{
jo.put("can_qty",can_qty);
}
ivts.add(jo);
}
} }
if(ivts.size()!=0){ if(ivts.size()!=0){
//1.计算配粉所需重量环节 //1.计算配粉所需重量环节
@@ -3211,10 +3331,11 @@ public class AutoformulaServiceImpl implements AutoformulaService {
JSONArray ivts_new = new JSONArray(); JSONArray ivts_new = new JSONArray();
for(int i=0;i<ivts.size();i++){ for(int i=0;i<ivts.size();i++){
JSONObject ivt = ivts.getJSONObject(i); JSONObject ivt = ivts.getJSONObject(i);
if(ivt.getDouble("sum_ivt_qty") <=0 || ivt.getDouble("sum_ivt_qty") <0.01){ if(ivt.getDouble("can_qty") <=0 || ivt.getDouble("can_qty") <0.01){
continue; continue;
} }
String ivt_material_id = ivt.getString("material_id"); String ivt_material_id = ivt.getString("material_id");
JSONObject ProductMaterialExt = MD_ME_ProductMaterialExt.query("material_id='"+ivt_material_id+"'").uniqueResult(0); JSONObject ProductMaterialExt = MD_ME_ProductMaterialExt.query("material_id='"+ivt_material_id+"'").uniqueResult(0);
if(ProductMaterialExt ==null){ if(ProductMaterialExt ==null){
throw new BadRequestException("软废"+ivt.getString("material_code")+" "+ivt.getString("material_name")+"未配置成品物料扩展信息!"); throw new BadRequestException("软废"+ivt.getString("material_code")+" "+ivt.getString("material_name")+"未配置成品物料扩展信息!");
@@ -3223,7 +3344,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
if(net_rate==0){ if(net_rate==0){
throw new BadRequestException("软废"+ivt.getString("material_code")+" "+ivt.getString("material_name")+"未配置纯粉系数!"); throw new BadRequestException("软废"+ivt.getString("material_code")+" "+ivt.getString("material_name")+"未配置纯粉系数!");
} }
double net_rate_qty = ivt.getDouble("sum_ivt_qty")*net_rate/100.0;
double net_rate_qty = ivt.getDouble("can_qty")*net_rate/100.0;
//Rp*纯粉系数 //Rp*纯粉系数
ivt.put("net_rate_qty",net_rate_qty); ivt.put("net_rate_qty",net_rate_qty);
//纯粉系数 //纯粉系数
@@ -3241,18 +3363,26 @@ public class AutoformulaServiceImpl implements AutoformulaService {
outer: outer:
for(int i=0;i<ivts_new.size();i++){ for(int i=0;i<ivts_new.size();i++){
JSONObject ivt_new = ivts_new.getJSONObject(i); JSONObject ivt_new = ivts_new.getJSONObject(i);
double ivt_qty = ivt_new.getDouble("sum_ivt_qty"); double ivt_qty = ivt_new.getDouble("can_qty");
ivt_qty = NumberUtil.roundDown(ivt_qty,3).doubleValue(); ivt_qty = NumberUtil.roundDown(ivt_qty,3).doubleValue();
if(ivt_qty <=0){ if(ivt_qty <=0){
continue; continue;
} }
String rf_material_id = ivt_new.getString("material_id");
JSONObject can_jo = rf_plan_map.get(rf_material_id);
double can_left_qty = can_jo.getDouble("can_left_qty");
if(can_left_qty <=0){
continue;
}
//软废纯粉系数 //软废纯粉系数
double net_rate = ivt_new.getDouble("net_rate"); double net_rate = ivt_new.getDouble("net_rate");
String rf_material_id = ivt_new.getString("material_id");
//计算R1p=min(Y1/h1/纯粉系数X1/h2/纯粉系数X2/h3/纯粉系数...) //计算R1p=min(Y1/h1/纯粉系数X1/h2/纯粉系数X2/h3/纯粉系数...)
//c、更新R1p=min(R1,R1p) //c、更新R1p=min(R1,R1p)
List<Double> doubles = new ArrayList<Double>(); List<Double> doubles = new ArrayList<Double>();
doubles.add(ivt_qty); doubles.add(ivt_qty);
doubles.add(can_left_qty);
//doubles集合 //doubles集合
HashMap<String,JSONObject> doubles_map = new HashMap<String,JSONObject>(); HashMap<String,JSONObject> doubles_map = new HashMap<String,JSONObject>();
//获取软废Bom //获取软废Bom
@@ -3294,6 +3424,10 @@ public class AutoformulaServiceImpl implements AutoformulaService {
//进行集合排序 //进行集合排序
Collections.sort(doubles); Collections.sort(doubles);
double rf_up_formula_qty = doubles.get(0); double rf_up_formula_qty = doubles.get(0);
can_jo.put("can_left_qty",can_left_qty-rf_up_formula_qty);
rf_plan_map.put(rf_material_id,can_jo);
//计算不需要移库的添加剂 //计算不需要移库的添加剂
doubles_map.forEach((key,fi_bomdtl)->{ doubles_map.forEach((key,fi_bomdtl)->{
String fi_bomdtl_material_id = fi_bomdtl.getString("material_id"); String fi_bomdtl_material_id = fi_bomdtl.getString("material_id");

View File

@@ -339,6 +339,7 @@
WHERE WHERE
1 = 1 1 = 1
and producmaterialext.net_rate>0 and producmaterialext.net_rate>0
and ProductMaterialSet.add_rate>0
OPTION 输入.material_id <> "" OPTION 输入.material_id <> ""
ProductMaterialSet.material_id = 输入.material_id ProductMaterialSet.material_id = 输入.material_id
ENDOPTION ENDOPTION

View File

@@ -115,7 +115,7 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
//1、库存现存量现有库存 - 开单领料重量 //1、库存现存量现有库存 - 开单领料重量
JSONObject mater_ivt = WQL.getWO("statistical_report_query_01").addParam("flag", "4").addParam("material_id", material_id).process().uniqueResult(0); JSONObject mater_ivt = WQL.getWO("statistical_report_query_01").addParam("flag", "4").addParam("material_id", material_id).process().uniqueResult(0);
//查询开单领料重量 //查询开单领料重量
JSONObject form_qty = WQL.getWO("statistical_report_query_01").addParam("flag", "5").addParam("material_id", material_id).addParam("begin_time",begin_time).addParam("end_time",end_time).process().uniqueResult(0); JSONObject form_qty = WQL.getWO("statistical_report_query_01").addParam("flag", "5").addParam("material_id", material_id).process().uniqueResult(0);
double now_ivt = 0; double now_ivt = 0;
double need_qty = 0; double need_qty = 0;
@@ -126,15 +126,15 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
need_qty = form_qty.getDoubleValue("qty"); need_qty = form_qty.getDoubleValue("qty");
} }
BigDecimal canuse_num = NumberUtil.sub(now_ivt - need_qty); BigDecimal canuse_num = NumberUtil.sub(now_ivt - need_qty);
jo1.put(material_id, String.format("%.3f",canuse_num)); jo1.put(material_id, String.format("%.3f", canuse_num));
//2、排产需求量(未开单的工令重量+排产未生成工令日计划重量)根据bom计算需要多少原料库存重量 //2、排产需求量(未开单的工令重量+排产未生成工令日计划重量)根据bom计算需要多少原料库存重量
JSONObject nedd_mater = WQL.getWO("statistical_report_query_01").addParam("flag", "6").addParam("material_id", material_id).addParam("begin_time",begin_time).addParam("end_time",end_time).process().uniqueResult(0); JSONObject nedd_mater = WQL.getWO("statistical_report_query_01").addParam("flag", "6").addParam("material_id", material_id).addParam("begin_time", begin_time).addParam("end_time", end_time).process().uniqueResult(0);
double bom_qty = 0; double bom_qty = 0;
if (ObjectUtil.isNotEmpty(nedd_mater)) { if (ObjectUtil.isNotEmpty(nedd_mater)) {
bom_qty = nedd_mater.getDoubleValue("qty"); bom_qty = nedd_mater.getDoubleValue("qty");
} }
jo2.put(material_id, String.format("%.3f",bom_qty)); jo2.put(material_id, String.format("%.3f", bom_qty));
//3、待检入库量sum(此物料未确认的到货单的单据数-入库数) //3、待检入库量sum(此物料未确认的到货单的单据数-入库数)
JSONObject num_jo = WQL.getWO("statistical_report_query_01").addParam("flag", "7").addParam("material_id", material_id).process().uniqueResult(0); JSONObject num_jo = WQL.getWO("statistical_report_query_01").addParam("flag", "7").addParam("material_id", material_id).process().uniqueResult(0);
@@ -158,13 +158,13 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
notqty = 0; notqty = 0;
} }
} }
jo4.put(material_id, String.format("%.3f",noin_qty)); jo4.put(material_id, String.format("%.3f", noin_qty));
//4、合同在途订单量-到货量 //4、合同在途订单量-到货量
jo6.put(material_id, String.format("%.3f",notqty)); jo6.put(material_id, String.format("%.3f", notqty));
//5、库/需差额量 :库存现存量-排产需求量 //5、库/需差额量 :库存现存量-排产需求量
jo3.put(material_id, String.format("%.3f",(Double.parseDouble(canuse_num + "") - bom_qty))); jo3.put(material_id, String.format("%.3f", (Double.parseDouble(canuse_num + "") - bom_qty)));
//7、最低储备定额物料的安全库存量下限 //7、最低储备定额物料的安全库存量下限
JSONObject safe_jo = WQLObject.getWQLObject("ST_IVT_MaterialSafeIvt").query("material_id = '" + material_id + "'").uniqueResult(0); JSONObject safe_jo = WQLObject.getWQLObject("ST_IVT_MaterialSafeIvt").query("material_id = '" + material_id + "'").uniqueResult(0);
@@ -172,29 +172,29 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
if (ObjectUtil.isNotEmpty(safe_jo)) { if (ObjectUtil.isNotEmpty(safe_jo)) {
safe_qty = safe_jo.getDoubleValue("safe_ivt_down"); safe_qty = safe_jo.getDoubleValue("safe_ivt_down");
} }
jo7.put(material_id, String.format("%.3f",safe_qty)); jo7.put(material_id, String.format("%.3f", safe_qty));
//8、采购缺口库存+待检+在途+最低储备-排产量 //8、采购缺口库存+待检+在途+最低储备-排产量
double buy_qty = bom_qty - (now_ivt + noqty + notqty + safe_qty); double buy_qty = bom_qty + safe_qty - (canuse_num.doubleValue() + noin_qty + notqty);
jo8.put(material_id, String.format("%.3f",buy_qty)); jo8.put(material_id, String.format("%.3f", buy_qty));
//6、覆盖日期物料库存可坚持到哪一天库存现存量减每天需求量哪天<0,取前一天 //6、覆盖日期物料库存可坚持到哪一天库存现存量减每天需求量哪天<0,取前一天
for (int j = 1; j <= betweenDay; j++) { for (int j = 1; j <= betweenDay; j++) {
DateTime newDate = DateUtil.offsetDay(date1, j); DateTime newDate = DateUtil.offsetDay(date1, j);
//查询该物料当天的需求量 //查询该物料当天的需求量
JSONObject today_qty = WQL.getWO("statistical_report_query_01").addParam("flag", "8").addParam("material_id", material_id).addParam("begin_time",newDate).process().uniqueResult(0); JSONObject today_qty = WQL.getWO("statistical_report_query_01").addParam("flag", "8").addParam("material_id", material_id).addParam("begin_time", newDate.toString().substring(0, 10) + "%").process().uniqueResult(0);
double need_weight = 0; double need_weight = 0;
if (ObjectUtil.isNotEmpty(today_qty)){ if (ObjectUtil.isNotEmpty(today_qty)) {
need_weight = today_qty.getDoubleValue("qty"); need_weight = today_qty.getDoubleValue("qty");
} }
if (now_ivt<need_weight){ if (now_ivt < need_weight) {
jo5.put(material_id,DateUtil.offsetDay(newDate, -1).toString().substring(0,10)); jo5.put(material_id, DateUtil.offsetDay(newDate, -1).toString().substring(0, 10));
break; break;
}else { } else {
now_ivt -= need_weight; now_ivt -= need_weight;
} }
if (j==betweenDay){ if (j == betweenDay) {
jo5.put(material_id,end_time.substring(0,10)); jo5.put(material_id, end_time.substring(0, 10));
} }
} }
} }
@@ -207,26 +207,27 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
public Map<String, Object> materPlanDtlQuery(Map whereJson) { public Map<String, Object> materPlanDtlQuery(Map whereJson) {
String begin_time = MapUtil.getStr(whereJson, "begin_time"); String begin_time = MapUtil.getStr(whereJson, "begin_time");
String end_time = MapUtil.getStr(whereJson, "end_time"); String end_time = MapUtil.getStr(whereJson, "end_time");
String org_id = MapUtil.getStr(whereJson, "org_id");
//查询日期内的排产日计划物料信息 //查询日期内的排产日计划物料信息
JSONArray jsonArr = WQL.getWO("statistical_report_query_01").addParam("flag", "9").addParam("begin_time",begin_time).addParam("end_time",end_time).process().getResultJSONArray(0); JSONArray jsonArr = WQL.getWO("statistical_report_query_01").addParam("flag", "9").addParam("begin_time", begin_time).addParam("end_time", end_time).addParam("org_id", org_id).process().getResultJSONArray(0);
JSONArray rows = new JSONArray(); JSONArray rows = new JSONArray();
for (int i = 0; i < jsonArr.size(); i++) { for (int i = 0; i < jsonArr.size(); i++) {
JSONObject row = jsonArr.getJSONObject(i); JSONObject row = jsonArr.getJSONObject(i);
String material_code = row.getString("material_code"); String material_code = row.getString("material_code");
JSONObject bom = WQLObject.getWQLObject("md_pd_productbom").query("material_id = '"+row.get("material_id")+"'").uniqueResult(0); JSONObject bom = WQLObject.getWQLObject("md_pd_productbom").query("material_id = '" + row.get("material_id") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(bom)){ if (ObjectUtil.isEmpty(bom)) {
throw new BadRequestException("未查询到该产品 "+material_code+" 对应BOM信息"); throw new BadRequestException("未查询到该产品 " + material_code + " 对应BOM信息");
} }
row.put("1",row.getString("planstart_date")); row.put("1", row.getString("planstart_date"));
row.put("2",row.getString("old_mark")); row.put("2", row.getString("old_mark"));
row.put("3",row.getString("product_num")); row.put("3", row.getString("product_num"));
//查询该物料对应的bom明细 //查询该物料对应的bom明细
JSONArray bom_dtl = WQLObject.getWQLObject("md_pd_productbomdtl").query("bom_id = '"+bom.getString("bom_id")+"'").getResultJSONArray(0); JSONArray bom_dtl = WQLObject.getWQLObject("md_pd_productbomdtl").query("bom_id = '" + bom.getString("bom_id") + "'").getResultJSONArray(0);
for (int j = 0; j < bom_dtl.size(); j++) { for (int j = 0; j < bom_dtl.size(); j++) {
JSONObject dtl = bom_dtl.getJSONObject(j); JSONObject dtl = bom_dtl.getJSONObject(j);
double standard_rate = dtl.getDoubleValue("standard_rate"); double standard_rate = dtl.getDoubleValue("standard_rate");
double qty = standard_rate * row.getDoubleValue("product_weight") * 0.01; double qty = standard_rate * row.getDoubleValue("product_weight") * 0.01;
row.put(dtl.getString("material_id"),String.format("%.3f",qty)); row.put(dtl.getString("material_id"), String.format("%.3f", qty));
} }
rows.add(row); rows.add(row);
} }

View File

@@ -27,6 +27,7 @@
输入.create_mode TYPEAS s_string 输入.create_mode TYPEAS s_string
输入.bill_status TYPEAS s_string 输入.bill_status TYPEAS s_string
输入.material_id TYPEAS s_string 输入.material_id TYPEAS s_string
输入.org_id TYPEAS s_string
[临时表] [临时表]
@@ -474,6 +475,7 @@
mps_bd_productdailyplan plan mps_bd_productdailyplan plan
LEFT JOIN md_me_producmaterialext ext ON ext.material_id = plan.material_id LEFT JOIN md_me_producmaterialext ext ON ext.material_id = plan.material_id
LEFT JOIN md_me_materialbase materialbase ON materialbase.material_id = plan.material_id LEFT JOIN md_me_materialbase materialbase ON materialbase.material_id = plan.material_id
LEFT JOIN sys_dept dept ON dept.`code` = plan.plan_org_code
WHERE WHERE
plan.status = '01' plan.status = '01'
OPTION 输入.begin_time <> "" OPTION 输入.begin_time <> ""
@@ -482,11 +484,14 @@
OPTION 输入.end_time <> "" OPTION 输入.end_time <> ""
plan.planstart_date <= 输入.end_time plan.planstart_date <= 输入.end_time
ENDOPTION ENDOPTION
OPTION 输入.org_id <> ""
dept.dept_id = 输入.org_id
ENDOPTION
UNION ALL UNION ALL
SELECT SELECT
wo.planstart_time AS planstart_date, LEFT(wo.planstart_time,10) AS planstart_date,
COUNT(wo.workorder_id) AS product_num, COUNT(wo.workorder_id) AS product_num,
MAX(ext.old_mark) AS old_mark, MAX(ext.old_mark) AS old_mark,
SUM(wo.workorder_qty) AS product_weight, SUM(wo.workorder_qty) AS product_weight,
@@ -505,6 +510,9 @@
ENDOPTION ENDOPTION
OPTION 输入.end_time <> "" OPTION 输入.end_time <> ""
wo.planstart_time <= 输入.end_time wo.planstart_time <= 输入.end_time
ENDOPTION
OPTION 输入.org_id <> ""
wo.org_id = 输入.org_id
ENDOPTION ENDOPTION
GROUP BY GROUP BY
planstart_time,wo.material_id planstart_time,wo.material_id

View File

@@ -97,7 +97,7 @@ export default {
add: false, add: false,
edit: false, edit: false,
del: false, del: false,
download: false, download: true,
reset: true reset: true
} }
}) })

View File

@@ -160,7 +160,7 @@
<el-table-column prop="plan_org_name" label="申报单位" width="100" /> <el-table-column prop="plan_org_name" label="申报单位" width="100" />
<el-table-column prop="device_name" label="关键设备" width="100" /> <el-table-column prop="device_name" label="关键设备" width="100" />
<el-table-column prop="plan_finish_date" label="交货日期" width="90" /> <el-table-column prop="plan_finish_date" label="交货日期" width="90" />
<el-table-column prop="old_mark" label="牌号" /> <el-table-column prop="old_mark" min-width="100" label="牌号" />
<el-table-column prop="material_code" label="物料编码" min-width="150"/> <el-table-column prop="material_code" label="物料编码" min-width="150"/>
<el-table-column :formatter="seriesFormat" min-width="80" prop="product_series" label="系列" /> <el-table-column :formatter="seriesFormat" min-width="80" prop="product_series" label="系列" />
<el-table-column prop="product_type_name" label="生产方式" /> <el-table-column prop="product_type_name" label="生产方式" />

View File

@@ -174,7 +174,7 @@
<el-table-column prop="plan_month" label="计划月份" /> <el-table-column prop="plan_month" label="计划月份" />
<el-table-column prop="plan_finish_date" label="交货日期" width="90" /> <el-table-column prop="plan_finish_date" label="交货日期" width="90" />
<el-table-column prop="material_code" label="物料编码" min-width="150"/> <el-table-column prop="material_code" label="物料编码" min-width="150"/>
<el-table-column prop="old_mark" label="牌号" /> <el-table-column prop="old_mark" min-width="100" label="牌号" />
<el-table-column prop="product_type_name" label="生产方式" /> <el-table-column prop="product_type_name" label="生产方式" />
<el-table-column prop="product_weight" label="需求重量" :formatter="crud.formatNum3"/> <el-table-column prop="product_weight" label="需求重量" :formatter="crud.formatNum3"/>
<el-table-column prop="fact_weight" label="生产重量" :formatter="crud.formatNum3" width="150" align="center"> <el-table-column prop="fact_weight" label="生产重量" :formatter="crud.formatNum3" width="150" align="center">

View File

@@ -226,6 +226,7 @@
size="mini" size="mini"
:data="crud.data" :data="crud.data"
style="width: 100%;" style="width: 100%;"
:max-height="590"
:highlight-current-row="true" :highlight-current-row="true"
@selection-change="mySelectionChange" @selection-change="mySelectionChange"
> >
@@ -308,7 +309,12 @@ export default {
name: 'workorder', name: 'workorder',
components: { ChangeDialog, ViewDialog, AddDialog, crudOperation, rrOperation, udOperation, pagination }, components: { ChangeDialog, ViewDialog, AddDialog, crudOperation, rrOperation, udOperation, pagination },
cruds() { cruds() {
return CRUD({ title: '工令', idField: 'workorder_id', url: 'api/workorder', crudMethod: { ...workorder }, return CRUD({ title: '工令',
props: {
// 每页数据条数
size: 20
},
idField: 'workorder_id', url: 'api/workorder', crudMethod: { ...workorder },
optShow: { optShow: {
add: true, add: true,
edit: false, edit: false,

View File

@@ -147,7 +147,7 @@
@selection-change="crud.selectionChangeHandler" @selection-change="crud.selectionChangeHandler"
> >
<el-table-column type="selection" width="50" /> <el-table-column type="selection" width="50" />
<el-table-column v-if="false" prop="taskdtl_id" label="任务标识" /> <el-table-column v-if="false" prop="task_id" label="任务标识" />
<el-table-column prop="task_code" label="任务编码" /> <el-table-column prop="task_code" label="任务编码" />
<el-table-column v-if="false" prop="task_type" label="任务类型" /> <el-table-column v-if="false" prop="task_type" label="任务类型" />
<el-table-column prop="task_type_name" label="任务类型" /> <el-table-column prop="task_type_name" label="任务类型" />
@@ -205,7 +205,7 @@
<!-- 组件--> <!-- 组件-->
<component <component
:is="currentComponent" :is="currentComponent"
:task-uuid="taskdtl_id" :task-uuid="task_id"
:dialog-visible="viewDialogVisible" :dialog-visible="viewDialogVisible"
/> />
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@@ -234,8 +234,8 @@ export default {
return CRUD({ return CRUD({
title: '任务', title: '任务',
url: 'api/task', url: 'api/task',
idField: 'taskdtl_id', idField: 'task_id',
sort: 'taskdtl_id,desc', sort: 'task_id,desc',
crudMethod: { ...crudTask }, crudMethod: { ...crudTask },
query: { query: {
task_code:'',vehicle_code:'',start_point_code:'',next_point_code:'',task_type:'',taskdtl_type:'',finished_type:'',task_status:"" task_code:'',vehicle_code:'',start_point_code:'',next_point_code:'',task_type:'',taskdtl_type:'',finished_type:'',task_status:""
@@ -253,7 +253,7 @@ export default {
return { return {
viewDialogVisible: false, viewDialogVisible: false,
fullscreen: false, fullscreen: false,
taskdtl_id: '', task_id: '',
currentComponent: '', currentComponent: '',
openParam: {}, openParam: {},
create_time: [], create_time: [],
@@ -336,7 +336,7 @@ export default {
return return
} }
const data = { const data = {
taskdtl_id: command.row.taskdtl_id, task_id: command.row.task_id,
method_name: method_name method_name: method_name
} }
crudTask.operation(data).then(res => { crudTask.operation(data).then(res => {
@@ -347,7 +347,7 @@ export default {
}) })
}, },
view(row) { view(row) {
this.taskdtl_id = row.taskdtl_id this.task_id = row.task_id
switch (row.task_type) { switch (row.task_type) {
case '01':// 入库 case '01':// 入库
this.fullscreen = true this.fullscreen = true

View File

@@ -11,9 +11,26 @@
label-width="80px" label-width="80px"
label-suffix=":" label-suffix=":"
> >
<el-form-item label="到货日期"> <el-form-item label="统计日期">
<date-range-picker v-model="query.createTime" class="date-item"/> <date-range-picker v-model="query.createTime" class="date-item"/>
</el-form-item> </el-form-item>
<el-form-item label="所属组织">
<el-select
v-model="query.org_id"
clearable
size="mini"
placeholder="所属组织"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in Depts"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<rrOperation/> <rrOperation/>
</el-form> </el-form>
</div> </div>
@@ -30,9 +47,10 @@
style="width: 100%;" style="width: 100%;"
@selection-change="crud.selectionChangeHandler" @selection-change="crud.selectionChangeHandler"
> >
<el-table-column type="index" label="序号" width="100" align="center"/> <el-table-column type="index" label="序号" width="100" align="center" fixed/>
<template v-for="(col,index) in cols"> <template v-for="(col,index) in cols">
<el-table-column v-if="col" :prop="col.prop" :label="col.label" width="120px" show-overflow-tooltip/> <el-table-column v-if="col.prop !== '1'" :prop="col.prop" :label="col.label" width="120px" show-overflow-tooltip/>
<el-table-column v-if="col.prop === '1'" :prop="col.prop" :label="col.label" width="120px" show-overflow-tooltip fixed/>
</template> </template>
</el-table> </el-table>
@@ -45,9 +63,10 @@
style="width: 100%;" style="width: 100%;"
@selection-change="crud.selectionChangeHandler" @selection-change="crud.selectionChangeHandler"
> >
<el-table-column type="index" label="序号" width="100" align="center"/> <el-table-column type="index" label="序号" width="100" align="center" fixed/>
<template v-for="(col,index) in cols2"> <template v-for="(col,index) in cols2">
<el-table-column v-if="col" :prop="col.prop" :label="col.label" width="120px" show-overflow-tooltip/> <el-table-column v-if="!col.option" :prop="col.prop" :label="col.label" width="120px" show-overflow-tooltip/>
<el-table-column v-if="col.option" :prop="col.prop" :label="col.label" width="120px" show-overflow-tooltip fixed/>
</template> </template>
</el-table> </el-table>
<!--分页组件--> <!--分页组件-->
@@ -67,6 +86,7 @@ import crudInspectionsheetmst from '@/api/wms/ql/inspectionsheetmst'
import { download } from '@/api/data' import { download } from '@/api/data'
import { downloadFile } from '@/utils' import { downloadFile } from '@/utils'
import Date from '@/utils/datetime' import Date from '@/utils/datetime'
import workorder from '@/api/wms/pdm/workorder'
const start = new Date() const start = new Date()
export default { export default {
@@ -96,6 +116,7 @@ export default {
cols: [], cols: [],
cols2: [], cols2: [],
dtlList: [], dtlList: [],
Depts: [],
statusList: [], statusList: [],
permission: {}, permission: {},
rules: {} rules: {}
@@ -104,7 +125,9 @@ export default {
beforeCreate() { beforeCreate() {
}, },
created() { created() {
workorder.getDepts().then(res => {
this.Depts = res
})
}, },
methods: { methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据 // 钩子在获取表格数据之前执行false 则代表不获取数据

View File

@@ -131,7 +131,7 @@ export default {
add: false, add: false,
edit: false, edit: false,
del: false, del: false,
download: false, download: true,
reset: true reset: true
} }
}) })