This commit is contained in:
zds
2022-08-03 16:43:17 +08:00
parent 8a6ea02743
commit dc4a8b95df
6 changed files with 231 additions and 57 deletions

View File

@@ -152,7 +152,7 @@ public class DailyplanServiceImpl implements DailyplanService {
if(standard_weight ==0){
throw new BadRequestException("配粉桶标准重量不能为0");
}
json.put("product_num", NumberUtil.round(json.getDouble("product_weight")/standard_weight,0));
json.put("product_num", Math.ceil(json.getDouble("product_weight")/standard_weight));
JSONObject product = pdm_bi_productdeptpcsn.query("org_code='"+json.getString("plan_org_code")+"'").uniqueResult(0);
@@ -187,7 +187,7 @@ public class DailyplanServiceImpl implements DailyplanService {
if(standard_weight ==0){
throw new BadRequestException("配粉桶标准重量不能为0");
}
whereJson.put("product_num", NumberUtil.round(whereJson.getDouble("product_weight")/standard_weight,0));
whereJson.put("product_num", Math.ceil(whereJson.getDouble("product_weight")/standard_weight));
JSONObject product = pdm_bi_productdeptpcsn.query("org_code='"+whereJson.getString("plan_org_code")+"'").uniqueResult(0);

View File

@@ -57,7 +57,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
map.put("material_code", "%" + material_code + "%");
}
map.put("flag", "1");
JSONObject json = WQL.getWO("QPDM_PRODUCTPLANPROC").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "pp.input_time desc");
JSONObject json = WQL.getWO("QPDM_PRODUCTPLANPROC").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "pp.plan_finish_date,pp.material_code,pp.plan_org_code");
return json;
}
@@ -313,9 +313,12 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
if (StrUtil.isEmpty(checked)) {
checked = "false";
}
//已经生成日计划的月计划列表
HashMap<String,String> used_map = new HashMap<String,String>();
String nowstart_date2 = json.getString("nowstart_date");
if(checked.equals("true")){
if (StrUtil.isEmpty(nowstart_date2)) {
throw new BadRequestException("初始日期不能为空!");
}
}
//分组
HashMap<String,JSONArray> device_map = new HashMap<String,JSONArray>();
for (int i = 0; i < ja.size(); i++) {
@@ -378,13 +381,20 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
String finalChecked = checked;
device_map2.forEach((key, rows)->{
String nowstart_date = json.getString("nowstart_date");
Date date = DateUtil.parse(nowstart_date);
Date date = null;
if(!finalChecked.equals("true")){
nowstart_date = null;
}else{
date = DateUtil.parse(nowstart_date);
}
//当天产能是否有剩余
double pcsn_num_day = 0;
for(int i=0;i<rows.size();i++){
JSONObject jo = rows.getJSONObject(i);
double fact_weight = jo.getDouble("fact_weight");
double standard_weight = jo.getDouble("standard_weight");
//批次数NumberUtil.ceil(fact_weight/standard_weight)
double pcsn_num = Math.ceil(fact_weight/standard_weight);
JSONObject series = MPS_BD_CapacityTemplateSeries.query("captemplate_id='"+captemplate_id+"' and product_series_id='"+jo.getString("product_series")+"'").uniqueResult(0);
@@ -394,7 +404,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
//最大产能批次
int totalproducecapacity_qty = series.getInteger("totalproducecapacity_qty");
//若初始日期不为空,取此初始日期
if(finalChecked.equals("true") && StrUtil.isNotEmpty(nowstart_date)){
if(finalChecked.equals("true")){
while(pcsn_num > 0){
JSONObject ProcessRoute = WQL.getWO("QPDM_PRODUCTPLANPROC").addParam("flag","5")
.addParam("material_code",jo.getString("material_id")).process().uniqueResult(0);
@@ -403,7 +413,44 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
}
int total_plan_time = ProcessRoute.getInteger("total_plan_time");
BigDecimal days = NumberUtil.round(total_plan_time/24,0);
if(pcsn_num_day > 0){
if(pcsn_num > pcsn_num_day){
jo.put("workorder_type","01");
jo.put("product_weight",pcsn_num_day*standard_weight);
jo.put("product_num",pcsn_num_day);
jo.put("product_series_id",jo.getString("product_series"));
jo.put("planstart_date",DateUtil.formatDate(date));
Date planend_date = DateUtil.offsetDay(date,days.intValue()-1);
jo.put("planend_date",DateUtil.formatDate(planend_date));
this.createDay(jo);
date = DateUtil.offsetDay(date,1);
pcsn_num = pcsn_num - pcsn_num_day;
fact_weight = fact_weight - pcsn_num_day*standard_weight;
pcsn_num_day = 0;
}else{
jo.put("workorder_type","01");
jo.put("product_weight",fact_weight);
jo.put("product_num",pcsn_num);
jo.put("product_series_id",jo.getString("product_series"));
jo.put("planstart_date",DateUtil.formatDate(date));
Date planend_date = DateUtil.offsetDay(date,days.intValue()-1);
jo.put("planend_date",DateUtil.formatDate(planend_date));
this.createDay(jo);
pcsn_num_day = pcsn_num_day - pcsn_num;
if(pcsn_num_day <= 0){
date = DateUtil.offsetDay(date,1);
}
pcsn_num = 0;
fact_weight = 0;
if(pcsn_num == 0){
break;
}
}
}
if(pcsn_num > totalproducecapacity_qty){
jo.put("workorder_type","01");
jo.put("product_weight",totalproducecapacity_qty*standard_weight);
@@ -411,40 +458,64 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
jo.put("product_series_id",jo.getString("product_series"));
jo.put("planstart_date",DateUtil.formatDate(date));
Date planstart_date = DateUtil.offsetDay(date,days.intValue()-1);
jo.put("planstart_date",DateUtil.formatDate(planstart_date));
Date planend_date = DateUtil.offsetDay(date,days.intValue()-1);
jo.put("planend_date",DateUtil.formatDate(planend_date));
this.createDay(jo);
date = DateUtil.offsetDay(date,1);
pcsn_num = pcsn_num - totalproducecapacity_qty;
fact_weight = fact_weight - totalproducecapacity_qty*standard_weight;
pcsn_num_day = 0;
}else{
jo.put("workorder_type","01");
jo.put("product_weight",pcsn_num*standard_weight);
jo.put("product_weight",fact_weight);
jo.put("product_num",pcsn_num);
jo.put("product_series_id",jo.getString("product_series"));
jo.put("planstart_date",DateUtil.formatDate(date));
Date planstart_date = DateUtil.offsetDay(date,days.intValue()-1);
jo.put("planend_date",DateUtil.formatDate(planstart_date));
Date planend_date = DateUtil.offsetDay(date,days.intValue()-1);
jo.put("planend_date",DateUtil.formatDate(planend_date));
this.createDay(jo);
date = DateUtil.offsetDay(date,1);
pcsn_num_day = totalproducecapacity_qty - pcsn_num;
if(pcsn_num_day <= 0){
date = DateUtil.offsetDay(date,1);
}
pcsn_num = 0;
fact_weight = 0;
}
}
}else{//若初始日期为空,获取日计划表设备标识=此分组设备的最后一个计划
JSONObject last = MPS_BD_ProductDailyPlan.query("device_id='"+jo.getString("device_id")+"'","planstart_date desc").uniqueResult(0);
if(last ==null ){
throw new BadRequestException("日计划表此分组设备的最后一个计划为空!");
}
JSONObject mater = MD_ME_ProducMaterialExt.query("material_id='"+jo.getString("material_id")+"'").uniqueResult(0);
String old_mark = mater.getString("old_mark");
if(jo.getString("old_mark").equals(old_mark)){
nowstart_date = last.getString("planstart_date");
date = DateUtil.parse(nowstart_date);
date = DateUtil.offsetDay(date,1);
//第一条查数据库
if(StrUtil.isEmpty(nowstart_date)){
JSONObject last = MPS_BD_ProductDailyPlan.query("device_id='"+jo.getString("device_id")+"'","planstart_date desc,create_time desc").uniqueResult(0);
if(last ==null ){
throw new BadRequestException("日计划表此分组设备的最后一个计划为空!");
}
JSONObject mater = MD_ME_ProducMaterialExt.query("material_id='"+jo.getString("material_id")+"'").uniqueResult(0);
String old_mark = mater.getString("old_mark");
if(jo.getString("old_mark").equals(old_mark)) {
JSONObject total_last = WQL.getWO("QPDM_PRODUCTPLANPROC")
.addParam("flag", "6")
.addParam("device_id", jo.getString("device_id"))
.addParam("planstart_date", last.getString("planstart_date"))
.process()
.uniqueResult(0);
pcsn_num_day = totalproducecapacity_qty - total_last.getInteger("total_product_num");
nowstart_date = last.getString("planstart_date");
date = DateUtil.parse(nowstart_date);
if (pcsn_num_day <= 0) {
date = DateUtil.offsetDay(date, 1);
}
}else{
nowstart_date = last.getString("planstart_date");
date = DateUtil.parse(nowstart_date);
date = DateUtil.offsetDay(date,1);
pcsn_num_day = 0;
}
while(pcsn_num > 0){
JSONObject ProcessRoute = WQL.getWO("QPDM_PRODUCTPLANPROC").addParam("flag","5")
.addParam("material_code",jo.getString("material_id")).process().uniqueResult(0);
@@ -454,6 +525,45 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
int total_plan_time = ProcessRoute.getInteger("total_plan_time");
BigDecimal days = NumberUtil.round(total_plan_time/24,0);
if(pcsn_num_day > 0){
if(pcsn_num > pcsn_num_day){
jo.put("workorder_type","01");
jo.put("product_weight",pcsn_num_day*standard_weight);
jo.put("product_num",pcsn_num_day);
jo.put("product_series_id",jo.getString("product_series"));
jo.put("planstart_date",DateUtil.formatDate(date));
Date planend_date = DateUtil.offsetDay(date,days.intValue()-1);
jo.put("planend_date",DateUtil.formatDate(planend_date));
this.createDay(jo);
date = DateUtil.offsetDay(date,1);
pcsn_num = pcsn_num - pcsn_num_day;
fact_weight = fact_weight - pcsn_num_day*standard_weight;
pcsn_num_day =0;
}else{
jo.put("workorder_type","01");
jo.put("product_weight",fact_weight);
jo.put("product_num",pcsn_num);
jo.put("product_series_id",jo.getString("product_series"));
jo.put("planstart_date",DateUtil.formatDate(date));
Date planend_date = DateUtil.offsetDay(date,days.intValue()-1);
jo.put("planend_date",DateUtil.formatDate(planend_date));
this.createDay(jo);
pcsn_num_day = pcsn_num_day - pcsn_num;
if(pcsn_num_day <= 0){
date = DateUtil.offsetDay(date,1);
}
pcsn_num = 0;
fact_weight = 0;
if(pcsn_num == 0){
break;
}
}
}
if(pcsn_num > totalproducecapacity_qty){
jo.put("workorder_type","01");
jo.put("product_weight",totalproducecapacity_qty*standard_weight);
@@ -461,32 +571,34 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
jo.put("product_series_id",jo.getString("product_series"));
jo.put("planstart_date",DateUtil.formatDate(date));
Date planstart_date = DateUtil.offsetDay(date,days.intValue()-1);
jo.put("planstart_date",DateUtil.formatDate(planstart_date));
Date planend_date = DateUtil.offsetDay(date,days.intValue()-1);
jo.put("planend_date",DateUtil.formatDate(planend_date));
this.createDay(jo);
date = DateUtil.offsetDay(date,1);
pcsn_num =pcsn_num - totalproducecapacity_qty;
fact_weight = fact_weight - totalproducecapacity_qty*standard_weight;
pcsn_num_day = 0;
}else{
jo.put("workorder_type","01");
jo.put("product_weight",pcsn_num*standard_weight);
jo.put("product_weight",fact_weight);
jo.put("product_num",pcsn_num);
jo.put("product_series_id",jo.getString("product_series"));
jo.put("planstart_date",DateUtil.formatDate(date));
Date planstart_date = DateUtil.offsetDay(date,days.intValue()-1);
jo.put("planend_date",DateUtil.formatDate(planstart_date));
Date planend_date = DateUtil.offsetDay(date,days.intValue()-1);
jo.put("planend_date",DateUtil.formatDate(planend_date));
this.createDay(jo);
date = DateUtil.offsetDay(date,1);
pcsn_num_day = totalproducecapacity_qty - pcsn_num;
if(pcsn_num_day <= 0){
date = DateUtil.offsetDay(date,1);
}
pcsn_num = 0;
fact_weight = 0;
}
}
}else{
nowstart_date = last.getString("planstart_date");
date = DateUtil.parse(nowstart_date);
date = DateUtil.offsetDay(date,1);
while(pcsn_num > 0){
JSONObject ProcessRoute = WQL.getWO("QPDM_PRODUCTPLANPROC").addParam("flag","5")
.addParam("material_code",jo.getString("material_id")).process().uniqueResult(0);
@@ -496,6 +608,44 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
int total_plan_time = ProcessRoute.getInteger("total_plan_time");
BigDecimal days = NumberUtil.round(total_plan_time/24,0);
if(pcsn_num_day > 0){
if(pcsn_num > pcsn_num_day){
jo.put("workorder_type","01");
jo.put("product_weight",pcsn_num_day*standard_weight);
jo.put("product_num",pcsn_num_day);
jo.put("product_series_id",jo.getString("product_series"));
jo.put("planstart_date",DateUtil.formatDate(date));
Date planend_date = DateUtil.offsetDay(date,days.intValue()-1);
jo.put("planend_date",DateUtil.formatDate(planend_date));
this.createDay(jo);
date = DateUtil.offsetDay(date,1);
pcsn_num = pcsn_num - pcsn_num_day;
fact_weight = fact_weight - pcsn_num_day*standard_weight;
pcsn_num_day =0;
}else{
jo.put("workorder_type","01");
jo.put("product_weight",fact_weight);
jo.put("product_num",pcsn_num);
jo.put("product_series_id",jo.getString("product_series"));
jo.put("planstart_date",DateUtil.formatDate(date));
Date planend_date = DateUtil.offsetDay(date,days.intValue()-1);
jo.put("planend_date",DateUtil.formatDate(planend_date));
this.createDay(jo);
pcsn_num_day = pcsn_num_day - pcsn_num;
if(pcsn_num_day <= 0){
date = DateUtil.offsetDay(date,1);
}
pcsn_num = 0;
fact_weight = 0;
if(pcsn_num == 0){
break;
}
}
}
if(pcsn_num > totalproducecapacity_qty){
jo.put("workorder_type","01");
jo.put("product_weight",totalproducecapacity_qty*standard_weight);
@@ -503,12 +653,14 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
jo.put("product_series_id",jo.getString("product_series"));
jo.put("planstart_date",DateUtil.formatDate(date));
Date planstart_date = DateUtil.offsetDay(date,days.intValue()-1);
jo.put("planstart_date",DateUtil.formatDate(planstart_date));
Date planend_date = DateUtil.offsetDay(date,days.intValue()-1);
jo.put("planend_date",DateUtil.formatDate(planend_date));
this.createDay(jo);
date = DateUtil.offsetDay(date,1);
pcsn_num = pcsn_num - totalproducecapacity_qty;
fact_weight = fact_weight - totalproducecapacity_qty*standard_weight;
pcsn_num_day = 0;
}else{
jo.put("workorder_type","01");
jo.put("product_weight",pcsn_num*standard_weight);
@@ -516,12 +668,16 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
jo.put("product_series_id",jo.getString("product_series"));
jo.put("planstart_date",DateUtil.formatDate(date));
Date planstart_date = DateUtil.offsetDay(date,days.intValue()-1);
jo.put("planend_date",DateUtil.formatDate(planstart_date));
Date planend_date = DateUtil.offsetDay(date,days.intValue()-1);
jo.put("planend_date",DateUtil.formatDate(planend_date));
this.createDay(jo);
date = DateUtil.offsetDay(date,1);
pcsn_num_day = totalproducecapacity_qty - pcsn_num;
if(pcsn_num_day <= 0){
date = DateUtil.offsetDay(date,1);
}
pcsn_num = 0;
fact_weight = 0;
}
}
}
@@ -582,20 +738,12 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
json.put("create_name", nickName);
json.put("create_time", now);
JSONObject mater = MD_ME_ProducMaterialExt.query("material_id='"+json.getString("material_id")+"'").uniqueResult(0);
double standard_weight = mater.getDouble("standard_weight_pft");
if(standard_weight ==0){
throw new BadRequestException("配粉桶标准重量不能为0");
}
json.put("product_num", NumberUtil.round(json.getDouble("product_weight")/standard_weight,0));
JSONObject product = pdm_bi_productdeptpcsn.query("org_code='"+json.getString("plan_org_code")+"'").uniqueResult(0);
json.put("plan_org_name", product.getString("org_name"));
json.put("product_series", json.getString("product_series_id"));
json.put("planend_date", now.substring(0,10));
MPS_BD_ProductDailyPlan.insert(json);
}
}

View File

@@ -58,6 +58,7 @@
materialbase.material_code,
deviceinfo.device_code,
deviceinfo.device_name,
ProductPlanProc.task_code,
productdeptpcsn.org_id
FROM
MPS_BD_ProductDailyPlan pp
@@ -65,6 +66,7 @@
LEFT JOIN MD_ME_ProducMaterialExt ext ON pp.material_id = ext.material_id
LEFT JOIN md_me_materialbase materialbase ON pp.material_id = materialbase.material_id
LEFT JOIN em_bi_deviceinfo deviceinfo ON deviceinfo.device_id = pp.device_id
LEFT JOIN PCS_IF_ProductPlanProc ProductPlanProc ON ProductPlanProc.plan_id = pp.plan_id
WHERE
1=1
OPTION 输入.status <> ""

View File

@@ -23,7 +23,8 @@
输入.begin_time TYPEAS s_string
输入.end_time TYPEAS s_string
输入.device_id TYPEAS s_string
输入.product_series TYPEAS s_string
输入.product_series TYPEAS s_string
输入.planstart_date TYPEAS s_string
[临时表]
@@ -133,16 +134,17 @@
IF 输入.flag = "3"
QUERY
SELECT
deviceinfo.device_id AS id,
deviceinfo.device_code AS CODE,
deviceinfo.device_name AS NAME
deviceinfo.device_id AS id,
deviceinfo.device_code AS CODE,
deviceinfo.device_name AS NAME
FROM
em_bi_deviceinfo deviceinfo
em_bi_deviceinfo deviceinfo
WHERE
1 = 1
AND deviceinfo.is_active = '1'
AND deviceinfo.is_delete = '0'
AND deviceinfo.workprocedure_code = 'GX003'
1 = 1
AND deviceinfo.is_active = '1'
AND deviceinfo.is_delete = '0'
AND deviceinfo.is_produceuse = '1'
AND deviceinfo.workprocedure_code = 'GX003'
ENDSELECT
ENDQUERY
ENDIF
@@ -181,5 +183,23 @@
ENDQUERY
ENDIF
IF 输入.flag = "6"
QUERY
SELECT
sum( ProductDailyPlan.product_num ) AS total_product_num
FROM
MPS_BD_ProductDailyPlan ProductDailyPlan
WHERE
1 = 1
OPTION 输入.device_id <> ""
ProductDailyPlan.device_id = 输入.device_id
ENDOPTION
OPTION 输入.planstart_date <> ""
ProductDailyPlan.planstart_date = 输入.planstart_date
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -172,6 +172,7 @@
<el-table-column prop="plan_finish_date" label="交货日期" width="100" />
<el-table-column prop="day_num" label="提前天数" width="90" :formatter="crud.formatNum0" />
<el-table-column :formatter="stateFormat" min-width="80" prop="status" label="状态" />
<el-table-column prop="task_code" label="生产任务号" width="120" />
<el-table-column prop="create_time" label="创建时间" width="140px" />
<el-table-column prop="create_name" label="创建人" width="100" />
<el-table-column prop="remark" label="备注" />

View File

@@ -298,10 +298,13 @@ export default {
this.crud.notify('请勾选需要提交的记录!')
return false
}
this.crud.loading = true
producetask.submit2({ query: this.crud.query, rows: this.checkrows}).then(res => {
this.crud.notify('操作成功!')
this.crud.loading = false
this.querytable()
})
this.crud.loading = false
},
querytable() {
this.crud.toQuery()