优化
This commit is contained in:
@@ -91,6 +91,13 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
map.put("flag", "2");
|
||||
JSONArray jret = WQL.getWO("QPDM_PRODUCTDAILYPLAN")
|
||||
.addParamMap(map).process().getResultJSONArray(0);
|
||||
if(jret.size()>0){
|
||||
JSONObject form = new JSONObject();
|
||||
form.put("rows",jret);
|
||||
this.submit2(form);
|
||||
}
|
||||
jret = WQL.getWO("QPDM_PRODUCTDAILYPLAN")
|
||||
.addParamMap(map).process().getResultJSONArray(0);
|
||||
|
||||
JSONArray ja = new JSONArray();
|
||||
for(int i=0;i<jret.size();i++){
|
||||
@@ -282,158 +289,197 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
WQLObject PCS_IF_ProductPlanProc = WQLObject.getWQLObject("PCS_IF_ProductPlanProc");
|
||||
WQLObject MPS_BD_ProductDailyPlan = WQLObject.getWQLObject("MPS_BD_ProductDailyPlan");
|
||||
WQLObject MD_ME_ProducMaterialExt = WQLObject.getWQLObject("MD_ME_ProducMaterialExt");
|
||||
WQLObject MPS_BD_CapacityTemplateSeries = WQLObject.getWQLObject("MPS_BD_CapacityTemplateSeries");
|
||||
JSONArray ja = form.getJSONArray("rows");
|
||||
JSONObject json = form.getJSONObject("query");
|
||||
String captemplate_id = json.getString("captemplate_id");
|
||||
if (StrUtil.isEmpty(captemplate_id)) {
|
||||
JSONObject captemplate = WQL.getWO("QPDM_PRODUCTPLANPROC")
|
||||
.addParam("flag","4").process().uniqueResult(0);
|
||||
if (captemplate == null) {
|
||||
throw new BadRequestException("排产模板不能为空!");
|
||||
}
|
||||
String checked = json.getString("checked");
|
||||
if (StrUtil.isEmpty(checked)) {
|
||||
checked = "false";
|
||||
}
|
||||
//已经生成日计划的月计划列表
|
||||
HashMap<String,String> used_map = new HashMap<String,String>();
|
||||
String captemplate_id = captemplate.getString("id");
|
||||
JSONArray ja = form.getJSONArray("rows");
|
||||
|
||||
//分组
|
||||
HashMap<String,JSONArray> device_map = new HashMap<String,JSONArray>();
|
||||
JSONObject last = MPS_BD_ProductDailyPlan.query("device_id='"+ja.getJSONObject(0).getString("device_id")+"' and status='01'","planstart_date").uniqueResult(0);
|
||||
if(last ==null ){
|
||||
throw new BadRequestException("日计划表此分组设备的最早一个日计划为空,没有可重排数据!");
|
||||
}
|
||||
|
||||
JSONArray ja_new = new JSONArray();
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
String device_id = jo.getString("device_id");
|
||||
if (StrUtil.isEmpty(device_id)) {
|
||||
throw new BadRequestException("关键设备不能为空!");
|
||||
}
|
||||
if(device_map.containsKey(device_id)){
|
||||
JSONArray rows = device_map.get(device_id);
|
||||
rows.add(jo);
|
||||
device_map.put(device_id,rows);
|
||||
}else{
|
||||
JSONArray rows = new JSONArray();
|
||||
rows.add(jo);
|
||||
device_map.put(device_id,rows);
|
||||
JSONObject jo_new = MPS_BD_ProductDailyPlan.query("dailyplan_id='"+jo.getString("dailyplan_id")+"' and status='01'").uniqueResult(0);
|
||||
if (jo_new!=null) {
|
||||
ja_new.add(jo);
|
||||
MPS_BD_ProductDailyPlan.delete(jo);
|
||||
}
|
||||
}
|
||||
//排序
|
||||
HashMap<String,JSONArray> device_map2 = new HashMap<String,JSONArray>();
|
||||
device_map.forEach((key,rows)->{
|
||||
List<JSONObject> list = JSONObject.parseArray(rows.toJSONString(), JSONObject.class);
|
||||
Collections.sort(list, (JSONObject o1, JSONObject o2) -> {
|
||||
String s1 = o1.getString("plan_finish_date");
|
||||
//转成JSON对象中保存的值类型
|
||||
double a = Double.parseDouble(s1.replace("-",""));
|
||||
double b = Double.parseDouble(o2.getString("plan_finish_date").replace("-",""));
|
||||
String nowstart_date = last.getString("planstart_date");
|
||||
Date date = DateUtil.parse(nowstart_date);
|
||||
//当天产能是否有剩余
|
||||
double pcsn_num_day = 0;
|
||||
|
||||
String s1_old_mark = o1.getString("old_mark");
|
||||
String s2_old_mark = o2.getString("old_mark");
|
||||
JSONArray ja_day = new JSONArray();
|
||||
for(int i=0;i<ja_new.size();i++){
|
||||
JSONObject jo = ja_new.getJSONObject(i);
|
||||
|
||||
String s1_material_code = o1.getString("material_code");
|
||||
String s2_material_code = o2.getString("material_code");
|
||||
// 如果a, b数据类型为int,可直接 return a - b ;(升序,降序为 return b - a;)
|
||||
if (a > b) { //降序排列,升序改成a>b
|
||||
return 1;
|
||||
} else if(a == b) {
|
||||
if (s1_old_mark.compareTo(s2_old_mark)>0) { //降序排列,升序改成a>b
|
||||
return 1;
|
||||
} else if(s1_old_mark.compareTo(s2_old_mark) == 0) {
|
||||
double fact_weight = jo.getDouble("product_weight");
|
||||
double standard_weight = jo.getDouble("standard_weight");
|
||||
|
||||
if (s1_material_code.compareTo(s2_material_code)>0) { //降序排列,升序改成a>b
|
||||
return 1;
|
||||
} else if(s1_material_code.compareTo(s2_material_code) == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
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);
|
||||
if(series ==null){
|
||||
throw new BadRequestException("系列模板产能未配置!");
|
||||
}
|
||||
//最大产能批次
|
||||
int totalproducecapacity_qty = series.getInteger("totalproducecapacity_qty");
|
||||
//第一条查数据库
|
||||
if(StrUtil.isNotEmpty(nowstart_date)){
|
||||
JSONObject last2 = MPS_BD_ProductDailyPlan.query("device_id='"+jo.getString("device_id")+"'","planstart_date desc,create_time desc").uniqueResult(0);
|
||||
String old_mark = jo.getString("old_mark");
|
||||
if(last2 != null ){
|
||||
nowstart_date = last2.getString("planstart_date");
|
||||
date = DateUtil.parse(nowstart_date);
|
||||
JSONObject mater = MD_ME_ProducMaterialExt.query("material_id='"+last2.getString("material_id")+"'").uniqueResult(0);
|
||||
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", DateUtil.formatDate(date))
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
String total_product_num = total_last.getString("total_product_num");
|
||||
if (StrUtil.isEmpty(total_product_num)) {
|
||||
pcsn_num_day = totalproducecapacity_qty;
|
||||
}else{
|
||||
pcsn_num_day = totalproducecapacity_qty - Integer.parseInt(total_product_num);
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
|
||||
if (pcsn_num_day <= 0) {
|
||||
date = DateUtil.offsetDay(date, 1);
|
||||
}
|
||||
}else{
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
pcsn_num_day = 0;
|
||||
}
|
||||
});
|
||||
rows = JSONArray.parseArray(JSON.toJSONString(list));
|
||||
device_map2.put(key,rows);
|
||||
});
|
||||
while(pcsn_num > 0){
|
||||
JSONObject ProcessRoute = WQL.getWO("QPDM_PRODUCTPLANPROC").addParam("flag","5")
|
||||
.addParam("material_code",jo.getString("material_id")).process().uniqueResult(0);
|
||||
if(ProcessRoute==null){
|
||||
throw new BadRequestException("产品工艺路线未设置不允许预排!");
|
||||
}
|
||||
int total_plan_time = ProcessRoute.getInteger("total_plan_time");
|
||||
BigDecimal days = NumberUtil.round(total_plan_time/24,0);
|
||||
|
||||
String finalChecked = checked;
|
||||
device_map2.forEach((key, rows)->{
|
||||
String nowstart_date = json.getString("nowstart_date");
|
||||
Date date = DateUtil.parse(nowstart_date);
|
||||
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");
|
||||
//批次数
|
||||
BigDecimal pcsn_num = NumberUtil.round(fact_weight/standard_weight,0);
|
||||
|
||||
JSONObject series = MPS_BD_CapacityTemplateSeries.query("captemplate_id='"+captemplate_id+"' and product_series_id='"+jo.getString("product_series")+"'").uniqueResult(0);
|
||||
if(series ==null){
|
||||
throw new BadRequestException("系列模板产能未配置!");
|
||||
}
|
||||
//最大产能批次
|
||||
int totalproducecapacity_qty = series.getInteger("totalproducecapacity_qty");
|
||||
//若初始日期不为空,取此初始日期
|
||||
if(finalChecked.equals("true") && StrUtil.isNotEmpty(nowstart_date)){
|
||||
while(pcsn_num.intValue() > 0){
|
||||
JSONObject ProcessRoute = WQL.getWO("QPDM_PRODUCTPLANPROC").addParam("flag","5")
|
||||
.addParam("material_code",jo.getString("material_id")).process().uniqueResult(0);
|
||||
if(ProcessRoute==null){
|
||||
throw new BadRequestException("产品工艺路线未设置不允许预排!");
|
||||
}
|
||||
int total_plan_time = ProcessRoute.getInteger("total_plan_time");
|
||||
BigDecimal days = NumberUtil.round(total_plan_time/24,0);
|
||||
|
||||
if(pcsn_num.intValue() > totalproducecapacity_qty){
|
||||
if(pcsn_num_day > 0){
|
||||
if(pcsn_num > pcsn_num_day){
|
||||
jo.put("workorder_type","01");
|
||||
jo.put("product_weight",totalproducecapacity_qty*standard_weight);
|
||||
jo.put("product_num",totalproducecapacity_qty);
|
||||
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 planstart_date = DateUtil.offsetDay(date,days.intValue()-1);
|
||||
jo.put("planstart_date",DateUtil.formatDate(planstart_date));
|
||||
//this.createDay(jo);
|
||||
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 = BigDecimal.valueOf(pcsn_num.intValue() - totalproducecapacity_qty);
|
||||
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",pcsn_num.intValue()*standard_weight);
|
||||
jo.put("product_num",pcsn_num.intValue());
|
||||
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));
|
||||
//this.createDay(jo);
|
||||
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 = BigDecimal.valueOf(0);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else{//若初始日期为空,获取日计划表设备标识=此分组设备的最后一个计划
|
||||
if(pcsn_num > totalproducecapacity_qty){
|
||||
jo.put("workorder_type","01");
|
||||
jo.put("product_weight",totalproducecapacity_qty*standard_weight);
|
||||
jo.put("product_num",totalproducecapacity_qty);
|
||||
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 - totalproducecapacity_qty;
|
||||
fact_weight = fact_weight - totalproducecapacity_qty*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 = totalproducecapacity_qty - pcsn_num;
|
||||
if(pcsn_num_day <= 0){
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
}
|
||||
pcsn_num = 0;
|
||||
fact_weight = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
JSONObject jsonMst = PCS_IF_ProductPlanProc.query("plan_id ='" + jo.getString("plan_id") + "' and is_proc = '1'").uniqueResult(0);
|
||||
if (jsonMst == null) {
|
||||
throw new BadRequestException(jo.getString("task_code")+"当前记录状态异常,操作失败!");
|
||||
}
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("is_proc", "2");
|
||||
map.put("update_optid", currentUserId + "");
|
||||
map.put("update_optname", nickName);
|
||||
map.put("update_time", now);
|
||||
PCS_IF_ProductPlanProc.update(map, "plan_id ='" + jo.getString("plan_id") + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createDay(JSONObject json) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
|
||||
Long deptId = currentUser.getDeptId();
|
||||
WQLObject pdm_bi_productdeptpcsn = WQLObject.getWQLObject("pdm_bi_productdeptpcsn");
|
||||
WQLObject MPS_BD_ProductDailyPlan = WQLObject.getWQLObject("MPS_BD_ProductDailyPlan");
|
||||
WQLObject MD_ME_ProducMaterialExt = WQLObject.getWQLObject("MD_ME_ProducMaterialExt"); // 工艺路线主表
|
||||
// 插入主表
|
||||
json.put("dailyplan_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
String workorder_code = CodeUtil.getNewCode("R_CODE");
|
||||
json.put("plan_code", workorder_code);
|
||||
json.put("weight_unit_id", "1");
|
||||
json.put("weight_unit_name", "千克\\公斤");
|
||||
json.put("status", "01");
|
||||
json.put("create_id", currentUserId);
|
||||
json.put("create_name", nickName);
|
||||
json.put("create_time", now);
|
||||
|
||||
|
||||
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"));
|
||||
MPS_BD_ProductDailyPlan.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(Map whereJson, HttpServletResponse response) throws IOException {
|
||||
|
||||
@@ -493,7 +493,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
|
||||
if(last ==null ){
|
||||
throw new BadRequestException("日计划表此分组设备的最后一个计划为空!");
|
||||
}
|
||||
JSONObject mater = MD_ME_ProducMaterialExt.query("material_id='"+jo.getString("material_id")+"'").uniqueResult(0);
|
||||
JSONObject mater = MD_ME_ProducMaterialExt.query("material_id='"+last.getString("material_id")+"'").uniqueResult(0);
|
||||
String old_mark = mater.getString("old_mark");
|
||||
|
||||
if(jo.getString("old_mark").equals(old_mark)) {
|
||||
|
||||
@@ -106,6 +106,7 @@
|
||||
deviceinfo.device_name,
|
||||
classstandard.class_name AS product_series_name,
|
||||
classstandard2.class_name AS mater_product_series_name,
|
||||
ProductPlanProc.task_code,
|
||||
productdeptpcsn.org_id
|
||||
FROM
|
||||
MPS_BD_ProductDailyPlan pp
|
||||
@@ -115,6 +116,7 @@
|
||||
LEFT JOIN em_bi_deviceinfo deviceinfo ON deviceinfo.device_id = pp.device_id
|
||||
LEFT JOIN md_pb_classstandard classstandard ON classstandard.class_id = pp.product_series_id
|
||||
LEFT JOIN md_pb_classstandard classstandard2 ON classstandard2.class_id = ext.product_series
|
||||
LEFT JOIN PCS_IF_ProductPlanProc ProductPlanProc ON ProductPlanProc.plan_id = pp.plan_id
|
||||
WHERE
|
||||
|
||||
1=1
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
append-to-body
|
||||
title="日计划重排"
|
||||
:visible.sync="dialogVisible"
|
||||
destroy-on-close
|
||||
:show-close="false"
|
||||
@@ -8,23 +9,22 @@
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<span slot="title" class="dialog-footer">
|
||||
<div class="crud-opts2">
|
||||
<span class="el-dialog__title2">日计划重排</span>
|
||||
<span class="crud-opts-right2">
|
||||
<!--左侧插槽-->
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="20" style="border: 1px solid white">
|
||||
<span />
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<span>
|
||||
<!--左侧插槽-->
|
||||
<slot name="left" />
|
||||
<el-button slot="left" type="info" @click="dialogVisible = false">关闭</el-button>
|
||||
<el-button slot="left" type="primary" @click="submit">保存</el-button>
|
||||
</span>
|
||||
</div>
|
||||
</span>
|
||||
<!-- 搜索 -->
|
||||
<el-row>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
ref="dragTable"
|
||||
:data="tableDtl"
|
||||
style="width: 100%;"
|
||||
border
|
||||
@@ -34,18 +34,20 @@
|
||||
<el-table-column type="index" label="序号" width="55" align="center" />
|
||||
<el-table-column prop="plan_code" label="日计划编码" width="120" />
|
||||
<el-table-column :formatter="seriesFormat" min-width="80" prop="product_series_id" label="系列产线" />
|
||||
<el-table-column prop="device_code" label="关键设备" width="100" />
|
||||
<el-table-column prop="device_name" label="关键设备" width="100" />
|
||||
<el-table-column prop="planstart_date" label="计划开始日期" width="100" />
|
||||
<el-table-column prop="plan_org_name" label="申报单位" width="100" />
|
||||
<el-table-column prop="workorder_type" label="计划类型" :formatter="workorder_typeFormat" min-width="120" />
|
||||
<el-table-column prop="material_code" label="物料编码" min-width="120"/>
|
||||
<el-table-column prop="material_code" label="物料编码" min-width="150"/>
|
||||
<el-table-column prop="old_mark" label="牌号" />
|
||||
<el-table-column :formatter="seriesFormat" min-width="80" prop="mater_product_series" label="产品系列" />
|
||||
<el-table-column prop="product_weight" label="生产重量(kg)" :formatter="crud.formatNum3" min-width="120" />
|
||||
<el-table-column prop="product_num" label="批数" width="80" />
|
||||
<el-table-column prop="planend_date" label="计划结束日期" width="100" />
|
||||
<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="备注" />
|
||||
@@ -58,6 +60,7 @@
|
||||
import { header } from '@crud/crud'
|
||||
import dailyplan from '@/api/wms/pdm/dailyplan'
|
||||
import crudseriesProcessRoute from '@/api/wms/pdm/seriesProcessRoute'
|
||||
import Sortable from 'sortablejs'
|
||||
|
||||
export default {
|
||||
name: 'StructIvt4',
|
||||
@@ -78,7 +81,8 @@ export default {
|
||||
tableDtl: [],
|
||||
cxjList: [],
|
||||
XLList: [],
|
||||
queryrow: { },
|
||||
queryrow: { device_id:'' },
|
||||
sortable: null,
|
||||
rows: []
|
||||
}
|
||||
},
|
||||
@@ -101,9 +105,34 @@ export default {
|
||||
})
|
||||
this.queryStruct()
|
||||
},
|
||||
/**
|
||||
* 接受父组件传值
|
||||
* @param msg
|
||||
*/
|
||||
getMsg(msg) {
|
||||
this.queryrow.device_id = msg
|
||||
},
|
||||
queryStruct() {
|
||||
dailyplan.query2(this.queryrow).then(res => {
|
||||
this.tableDtl = res
|
||||
this.$nextTick(() => {
|
||||
this.setSort()
|
||||
})
|
||||
})
|
||||
},
|
||||
setSort() {
|
||||
const el = this.$refs.dragTable.$el.querySelectorAll('.el-table__body-wrapper > table > tbody')[0]
|
||||
this.sortable = Sortable.create(el, {
|
||||
ghostClass: 'sortable-ghost', // Class name for the drop placeholder,
|
||||
setData: function(dataTransfer) {
|
||||
// to avoid Firefox bug
|
||||
// Detail see : https://github.com/RubaXa/Sortable/issues/1012
|
||||
dataTransfer.setData('Text', '')
|
||||
},
|
||||
onEnd: evt => {
|
||||
const targetRow = this.tableDtl.splice(evt.oldIndex, 1)[0]
|
||||
this.tableDtl.splice(evt.newIndex, 0, targetRow)
|
||||
}
|
||||
})
|
||||
},
|
||||
stateFormat(row) {
|
||||
@@ -120,12 +149,22 @@ export default {
|
||||
}
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
submit() {
|
||||
this.rows = this.$refs.table.data
|
||||
this.tableDtl = []
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('StructIvtClosed', this.rows)
|
||||
},
|
||||
submit() {
|
||||
this.rows = this.$refs.dragTable.data
|
||||
if (this.rows.length === 0) {
|
||||
this.crud.notify('无可提交的记录!')
|
||||
return false
|
||||
}
|
||||
dailyplan.submit2({ query: this.queryrow, rows: this.rows}).then(res => {
|
||||
this.crud.notify('操作成功!')
|
||||
this.tableDtl = []
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('StructIvtClosed', this.rows)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@
|
||||
<pagination />
|
||||
</div>
|
||||
<AddDialog @AddChanged="querytable" />
|
||||
<StructIvt4 :dialog-show.sync="structshow" :rowmst="crud.query" @StructIvtClosed="querytable" />
|
||||
<StructIvt4 ref="child" :dialog-show.sync="structshow" :rowmst="form" @StructIvtClosed="querytable" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -241,6 +241,7 @@ export default {
|
||||
XLList: [],
|
||||
fileList: [],
|
||||
checkrows: [],
|
||||
form: {},
|
||||
rules: {
|
||||
}}
|
||||
},
|
||||
@@ -307,10 +308,8 @@ export default {
|
||||
this.crud.notify('请先选择关键设备!')
|
||||
return false
|
||||
}
|
||||
if (this.crud.query.status !== '01' || this.crud.query.status === undefined) {
|
||||
this.crud.notify('重排只能选择生成状态记录!')
|
||||
return false
|
||||
}
|
||||
this.form.device_id = this.crud.query.device_id
|
||||
this.$refs.child.getMsg(this.crud.query.device_id)
|
||||
this.structshow = true
|
||||
},
|
||||
downdtl() {
|
||||
|
||||
Reference in New Issue
Block a user