优化
This commit is contained in:
@@ -606,6 +606,7 @@ public class PdmWorkTaskServiceImpl implements PdmWorkTaskService {
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
throw new PdaRequestException("传入参数不能为空!");
|
||||
}
|
||||
|
||||
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
|
||||
|
||||
String device_code = jo.getString("device_code");
|
||||
@@ -628,7 +629,11 @@ public class PdmWorkTaskServiceImpl implements PdmWorkTaskService {
|
||||
if (StrUtil.isEmpty(button_name)) {
|
||||
throw new PdaRequestException("缺少必要参数!");
|
||||
}
|
||||
|
||||
WQLObject md_pb_storagevehicleinfo = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
||||
JSONObject storagevehicle = md_pb_storagevehicleinfo.query("is_delete='0' and is_used='1' and storagevehicle_code='"+storagevehicle_code+"'").uniqueResult(0);
|
||||
if(storagevehicle == null){
|
||||
throw new PdaRequestException("该载具不存在或者未启用:"+storagevehicle_code);
|
||||
}
|
||||
//判断该设备是否属于球磨设备
|
||||
JSONObject device = WQLObject.getWQLObject("em_bi_deviceinfo").query("device_code = '" + device_code + "' AND workprocedure_code = 'GX002'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
@@ -834,7 +839,11 @@ public class PdmWorkTaskServiceImpl implements PdmWorkTaskService {
|
||||
if (StrUtil.isEmpty(storagevehicle_code)) {
|
||||
throw new PdaRequestException("料浆大桶不能为空!");
|
||||
}
|
||||
|
||||
WQLObject md_pb_storagevehicleinfo = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
||||
JSONObject storagevehicle = md_pb_storagevehicleinfo.query("is_delete='0' and is_used='1' and storagevehicle_code='"+storagevehicle_code+"'").uniqueResult(0);
|
||||
if(storagevehicle == null){
|
||||
throw new PdaRequestException("该载具不存在或者未启用:"+storagevehicle_code);
|
||||
}
|
||||
JSONObject work_task = WQLObject.getWQLObject("PDM_BI_WorkTask").query("worktask_id = '" + worktask_id + "'").uniqueResult(0);
|
||||
|
||||
//判断该设备是否属于球磨设备
|
||||
@@ -959,7 +968,11 @@ public class PdmWorkTaskServiceImpl implements PdmWorkTaskService {
|
||||
if (StrUtil.isEmpty(button_name)) {
|
||||
throw new PdaRequestException("缺少必要参数!");
|
||||
}
|
||||
|
||||
WQLObject md_pb_storagevehicleinfo = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
||||
JSONObject storagevehicle = md_pb_storagevehicleinfo.query("is_delete='0' and is_used='1' and storagevehicle_code='"+storagevehicle_code+"'").uniqueResult(0);
|
||||
if(storagevehicle == null){
|
||||
throw new PdaRequestException("该载具不存在或者未启用:"+storagevehicle_code);
|
||||
}
|
||||
//判断该设备是否属于喷雾设备
|
||||
JSONObject device = WQLObject.getWQLObject("em_bi_deviceinfo").query("device_code = '" + device_code + "' AND workprocedure_code = 'GX003'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
|
||||
@@ -143,17 +143,31 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
.process().getResultJSONArray(0);
|
||||
for(int j=0;j<now_ivts.size();j++){
|
||||
JSONObject jo = now_ivts.getJSONObject(j);
|
||||
double can_qty = net_qty*add_rate/100.0;
|
||||
String ivt_material_id = jo.getString("material_id");
|
||||
JSONObject ProductMaterialExt = MD_ME_ProductMaterialExt.query("material_id='"+ivt_material_id+"'").uniqueResult(0);
|
||||
if(ProductMaterialExt ==null){
|
||||
throw new BadRequestException("软废"+jo.getString("material_code")+" "+jo.getString("material_name")+"未配置成品物料扩展信息!");
|
||||
}
|
||||
double net_rate = ProductMaterialExt.getDouble("net_rate");
|
||||
if(net_rate==0){
|
||||
throw new BadRequestException("软废"+jo.getString("material_code")+" "+jo.getString("material_name")+"未配置纯粉系数!");
|
||||
}
|
||||
//最大可配纯粉重量/纯粉系数 == 最大可分配库存重量
|
||||
double can_qty = net_qty*add_rate/100.0/(net_rate/100.0);
|
||||
can_qty = NumberUtil.round(can_qty,3).doubleValue();
|
||||
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");
|
||||
sum_ivt_qty = NumberUtil.roundDown(sum_ivt_qty,3).doubleValue();
|
||||
if(can_qty >= sum_ivt_qty){
|
||||
jo.put("can_qty",sum_ivt_qty);
|
||||
}else{
|
||||
jo.put("can_qty",can_qty);
|
||||
}
|
||||
//纯粉系数
|
||||
jo.put("net_rate",net_rate);
|
||||
ivts.add(jo);
|
||||
}
|
||||
}
|
||||
@@ -164,6 +178,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
for(int i=0;i<ivts.size();i++){
|
||||
JSONObject ivt = ivts.getJSONObject(i);
|
||||
String ivt_material_id = ivt.getString("material_id");
|
||||
//当前明细可分配最大库存
|
||||
double can_qty = ivt.getDouble("can_qty");
|
||||
if(can_qty<=0 || can_qty<0.01){
|
||||
continue;
|
||||
@@ -173,14 +188,6 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
if(can_left_qty <=0){
|
||||
continue;
|
||||
}
|
||||
JSONObject ProductMaterialExt = MD_ME_ProductMaterialExt.query("material_id='"+ivt_material_id+"'").uniqueResult(0);
|
||||
if(ProductMaterialExt ==null){
|
||||
throw new BadRequestException("软废"+ivt.getString("material_code")+" "+ivt.getString("material_name")+"未配置成品物料扩展信息!");
|
||||
}
|
||||
double net_rate = ProductMaterialExt.getDouble("net_rate");
|
||||
if(net_rate==0){
|
||||
throw new BadRequestException("软废"+ivt.getString("material_code")+" "+ivt.getString("material_name")+"未配置纯粉系数!");
|
||||
}
|
||||
if(can_qty <= can_left_qty){
|
||||
can_qty = can_qty;
|
||||
can_jo.put("can_left_qty",can_left_qty-can_qty);
|
||||
@@ -189,13 +196,11 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
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;
|
||||
double net_rate = ivt.getDouble("net_rate");
|
||||
//Rp*纯粉系数
|
||||
ivt.put("net_rate_qty",ivt_qty);
|
||||
//纯粉系数
|
||||
ivt.put("net_rate",net_rate);
|
||||
ivt.put("net_rate_qty",can_qty*net_rate/100.0);
|
||||
ivts_new.add(ivt);
|
||||
rf_ivts = rf_ivts + ivt_qty;
|
||||
rf_ivts = rf_ivts + can_qty*net_rate/100.0;
|
||||
}
|
||||
if(rf_ivts>=waste_limit_down_weight){//软废库存足够
|
||||
JSONObject ret = this.autoCalculationBy01_ruanfei(json);
|
||||
@@ -1660,17 +1665,33 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
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;
|
||||
String ivt_material_id = jo.getString("material_id");
|
||||
JSONObject ProductMaterialExt = MD_ME_ProductMaterialExt.query("material_id='"+ivt_material_id+"'").uniqueResult(0);
|
||||
if(ProductMaterialExt ==null){
|
||||
throw new BadRequestException("软废"+jo.getString("material_code")+" "+jo.getString("material_name")+"未配置成品物料扩展信息!");
|
||||
}
|
||||
double net_rate = ProductMaterialExt.getDouble("net_rate");
|
||||
if(net_rate==0){
|
||||
throw new BadRequestException("软废"+jo.getString("material_code")+" "+jo.getString("material_name")+"未配置纯粉系数!");
|
||||
}
|
||||
//最大可配纯粉重量/纯粉系数 == 最大可分配库存重量
|
||||
double can_qty = net_qty*add_rate/100.0/(net_rate/100.0);
|
||||
can_qty = NumberUtil.round(can_qty,3).doubleValue();
|
||||
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");
|
||||
sum_ivt_qty = NumberUtil.roundDown(sum_ivt_qty,3).doubleValue();
|
||||
if(can_qty >= sum_ivt_qty){
|
||||
jo.put("can_qty",sum_ivt_qty);
|
||||
}else{
|
||||
jo.put("can_qty",can_qty);
|
||||
}
|
||||
//纯粉系数
|
||||
jo.put("net_rate",net_rate);
|
||||
//含碳比
|
||||
jo.put("is_tan",ProductMaterialExt.getString("c_balance"));
|
||||
ivts.add(jo);
|
||||
}
|
||||
}
|
||||
@@ -1683,22 +1704,11 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
if(ivt.getDouble("can_qty")<=0 || ivt.getDouble("can_qty")<0.01){
|
||||
continue;
|
||||
}
|
||||
String ivt_material_id = ivt.getString("material_id");
|
||||
JSONObject ProductMaterialExt = MD_ME_ProductMaterialExt.query("material_id='"+ivt_material_id+"'").uniqueResult(0);
|
||||
if(ProductMaterialExt ==null){
|
||||
throw new BadRequestException("软废"+ivt.getString("material_code")+" "+ivt.getString("material_name")+"未配置成品物料扩展信息!");
|
||||
}
|
||||
double net_rate = ProductMaterialExt.getDouble("net_rate");
|
||||
if(net_rate==0){
|
||||
throw new BadRequestException("软废"+ivt.getString("material_code")+" "+ivt.getString("material_name")+"未配置纯粉系数!");
|
||||
}
|
||||
double ivt_qty = ivt.getDouble("can_qty")*net_rate/100.0;
|
||||
double net_rate = ivt.getDouble("net_rate");
|
||||
double ivt_qty = ivt.getDouble("can_qty")*(net_rate/100.0);
|
||||
ivt_qty = NumberUtil.round(ivt_qty,3).doubleValue();
|
||||
//Rp*纯粉系数
|
||||
ivt.put("net_rate_qty",ivt_qty);
|
||||
//纯粉系数
|
||||
ivt.put("net_rate",net_rate);
|
||||
//含碳比
|
||||
ivt.put("is_tan",ProductMaterialExt.getString("c_balance"));
|
||||
ivts_new.add(ivt);
|
||||
rf_ivts = rf_ivts + ivt_qty;
|
||||
}
|
||||
@@ -1710,9 +1720,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
double rf_net_total_weight = 0;
|
||||
for(int i=0;i<ivts_new.size();i++){
|
||||
JSONObject ivt_new = ivts_new.getJSONObject(i);
|
||||
//可分配库存重量
|
||||
//可分配最大库存重量
|
||||
double ivt_qty = ivt_new.getDouble("can_qty");
|
||||
|
||||
//纯粉系数
|
||||
double net_rate = ivt_new.getDouble("net_rate");
|
||||
ivt_qty = NumberUtil.roundDown(ivt_qty,3).doubleValue();
|
||||
|
||||
@@ -465,6 +465,7 @@ public class DeviceBigScreenServiceImpl implements DeviceBigScreenService {
|
||||
// 4.计算MTBF:运行时间/故障次数
|
||||
try {
|
||||
String device_mtbf = NumberUtil.div(run_time_all, error_num_all).toString();
|
||||
device_mtbf = NumberUtil.div(device_mtbf, "60").toString();
|
||||
json.put("device_mtbf", NumberUtil.round(device_mtbf, 2).toString());
|
||||
} catch (Exception e){
|
||||
json.put("device_mtbf", "0");
|
||||
@@ -473,6 +474,10 @@ public class DeviceBigScreenServiceImpl implements DeviceBigScreenService {
|
||||
// 5.计算MTTR:故障时间/故障次数
|
||||
try {
|
||||
String device_mttr = NumberUtil.div(error_time_all, error_num_all).toString();
|
||||
device_mttr = NumberUtil.div(device_mttr, "60").toString();
|
||||
if(deviceArr.size()!=0){
|
||||
device_mttr = NumberUtil.div(device_mttr, deviceArr.size()+"").toString();
|
||||
}
|
||||
json.put("device_mttr", NumberUtil.round(device_mttr, 2).toString());
|
||||
} catch (Exception e){
|
||||
json.put("device_mttr", "0");
|
||||
@@ -480,12 +485,15 @@ public class DeviceBigScreenServiceImpl implements DeviceBigScreenService {
|
||||
|
||||
// 6.计算平均OEE: 所有设备OEE / 设备台数
|
||||
try {
|
||||
String oee = NumberUtil.div(oee_all, String.valueOf(deviceArr.size())).toString();
|
||||
String oee = "0";
|
||||
if(deviceArr.size()!=0){
|
||||
oee = NumberUtil.div(oee_all, String.valueOf(deviceArr.size())).toString();
|
||||
}
|
||||
json.put("device_oee", NumberUtil.round(oee, 2).toString());
|
||||
} catch (Exception e){
|
||||
json.put("device_oee", "0");
|
||||
}
|
||||
|
||||
device_all_time = NumberUtil.div(device_all_time, "60").toString();
|
||||
// 7.维修时间
|
||||
json.put("device_time", device_all_time);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wql.core.bean.ResultBean;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -174,7 +175,14 @@ public class ProductTask extends AbstractAcsTask {
|
||||
task.put("acs_task_type", "2");
|
||||
}
|
||||
WQLObject.getWQLObject("SCH_BASE_Task").insert(task);
|
||||
|
||||
JSONObject start_point = point_table.query("lock_type='00' and is_delete='0' and is_used='1' and point_code = '" + start_point_code + "'").uniqueResult(0);
|
||||
if(start_point == null ){
|
||||
throw new BadRequestException("改点位未启用或已锁定,请稍后再试:"+start_point_code);
|
||||
}
|
||||
JSONObject next_point = point_table.query("lock_type='00' and is_delete='0' and is_used='1' and point_code = '" + next_point_code + "'").uniqueResult(0);
|
||||
if(next_point == null ){
|
||||
throw new BadRequestException("改点位未启用或已锁定,请稍后再试:"+next_point_code);
|
||||
}
|
||||
//生产搬运:起点锁定;终点(输送线:不锁;其他:锁定);球磨上料:起点、终点锁定
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("lock_type", "09");
|
||||
|
||||
@@ -199,7 +199,7 @@
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="55" align="center" />
|
||||
<el-table-column prop="bucket_type" label="桶类型" align="center" width="110px" :formatter="bucket_typeFormat" />
|
||||
<el-table-column min-width="130" show-overflow-tooltip prop="material_code" label="物料编码" align="center"/>
|
||||
<el-table-column min-width="150" prop="material_code" label="物料编码" align="center"/>
|
||||
<el-table-column prop="material_name" label="物料名称" align="center" width="150px" />
|
||||
<el-table-column prop="material_type" label="物料类别" align="center" :formatter="material_typeFormat" />
|
||||
<el-table-column min-width="120" show-overflow-tooltip prop="pcsn" label="批次号" align="center" />
|
||||
@@ -264,7 +264,7 @@
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="55" align="center" />
|
||||
<el-table-column prop="bucket_type" label="桶类型" align="center" width="110px" :formatter="bucket_typeFormat" />
|
||||
<el-table-column min-width="130" show-overflow-tooltip prop="material_code" label="物料编码" align="center" />
|
||||
<el-table-column min-width="200" prop="material_code" label="物料编码" align="center" />
|
||||
<el-table-column prop="material_name" label="物料名称" align="center" />
|
||||
<el-table-column prop="material_type" label="物料类别" align="center" :formatter="material_typeFormat" />
|
||||
<el-table-column min-width="120" prop="pcsn" label="批次号" align="center" />
|
||||
|
||||
Reference in New Issue
Block a user