生产工单,批次编辑

master
shaoyong 4 months ago
parent 4e3ca9309f
commit 13ebb71b7a

@ -135,4 +135,42 @@ export function getUnReadComment(data){
method:'post',
data:data
})
}
}
export function getWorkOrderBatch(workOrderId) {
return request({
url: '/plan/pro/workorder/getWorkOrderBatch/' + workOrderId,
method: 'get'
});
}
export function getWorkOrderBatchInfo(query) {
return request({
url: '/plan/pro/workorder/getWorkOrderBatchInfo',
method: 'get',
params: query
});
}
export function insertWorkOrderBatch(data){
return request({
url:'/plan/pro/workorder/insertWorkOrderBatch',
method:'post',
data:data
})
}
export function updateWorkOrderBatch(data){
return request({
url:'/plan/pro/workorder/updateWorkOrderBatch',
method:'put',
data:data
})
}
export function removeWorkOrderBatch(batchCode,workorderCode) {
return request({
url: '/plan/pro/workorder/removeWorkOrderBatch/' +batchCode+ '/' +workorderCode,
method: 'delete',
});
}

@ -173,6 +173,18 @@
>切线调拨
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="editBatch"
v-hasPermi="['mes:pro:workorder:edit']"
>批次编辑
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -622,6 +634,84 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 批次编辑 -->
<el-dialog :title="batchTitle" :visible.sync="batchOpen" width="1000px" append-to-body>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-add"
size="mini"
@click="handleAddBatch"
v-hasPermi="['mes:pro:workorder:edit']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-edit"
size="mini"
:disabled="batchSingle"
@click="handleUpdateBatch"
v-hasPermi="['mes:pro:workorder:edit']"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-remove"
size="mini"
:disabled="batchSingle"
@click="handleRemoveBatch"
v-hasPermi="['mes:pro:workorder:edit']"
>删除
</el-button>
</el-col>
</el-row>
<el-table border v-loading="batchLoading" :data="batchData" @selection-change="batchSelectionChange"
ref="batchTable" row-key="orderCode"
>
<el-table-column type="selection" align="center" />
<el-table-column label="工单编号" align="center" prop="workorderCode" width="150"/>
<el-table-column label="当前批次号" align="center" prop="batchCode"/>
<el-table-column label="当前批次数量" align="center" prop="batchQuantity"/>
<el-table-column label="新批次号" align="center" prop="newBatchCode"/>
<el-table-column label="新批次数量" align="center" prop="newBatchQuantity"/>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="hangleCloseEditBatch"> </el-button>
</div>
</el-dialog>
<!-- 批次编辑新增/修改页面 -->
<el-dialog :title="bEditTitle" :visible.sync="bEditOpen" width="600px" append-to-body>
<el-form :model="batchForm" ref="batchForm" :rules="batchRules" label-width="120px">
<el-form-item label="工单编号" prop="workorderCode">
<el-input v-model="batchForm.workorderCode" placeholder="" disabled></el-input>
</el-form-item>
<el-form-item v-if="editBatchFlag" label="当前批次号" prop="batchCode">
<el-input v-model="batchForm.batchCode" placeholder="请输入当前批次号" disabled></el-input>
</el-form-item>
<el-form-item v-if="editBatchFlag" label="当前批次数量" prop="batchQuantity">
<el-input type="number" v-model.number="batchForm.batchQuantity" placeholder="请输入当前批次数量" disabled></el-input>
</el-form-item>
<el-form-item label="新批次号" prop="newBatchCode">
<el-input v-model="batchForm.newBatchCode" placeholder="请输入新批次号"></el-input>
</el-form-item>
<el-form-item label="新批次数量" prop="newBatchQuantity">
<el-input type="number" v-model.number="batchForm.newBatchQuantity" placeholder="请输入新批次数量"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="batchSubmitForm"> </el-button>
<el-button @click="batchCancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
@ -634,7 +724,12 @@ import {
getOrderAndWork,getProSortNo,
getWorkBatchList,
subChangeWorkOrderPro,subChangeWorkOrderM,
checkWorkOrder
checkWorkOrder,
getWorkOrderBatch,
getWorkOrderBatchInfo,
insertWorkOrderBatch,
updateWorkOrderBatch,
removeWorkOrderBatch
} from '@/api/plan/workorder'
import moment from 'moment';
import { getProEquipment, getProRoutes, getProShifts,selectMaterielList} from '@/api/plan/order'
@ -714,13 +809,18 @@ export default {
},
//
loading: true,
batchLoading: true,
//
ids: [],
cods: [],
//
batchData: [],
//
single: true,
batchSingle: true,
//
multiple: true,
batchMultiple: true,
//
statuses: [],
//
@ -732,9 +832,15 @@ export default {
//
title: "",
titleM:"",
batchTitle: "",
bEditTitle: "",
//
open: false,
openM:false,
batchOpen: false,
bEditOpen: false,
//
editBatchFlag: false,
//
queryParams: {
productDateArray: [new Date(), new Date()],
@ -768,6 +874,7 @@ export default {
},
//
form: {},
batchForm: {},
//
rules: {
workorderCode: [
@ -789,6 +896,23 @@ export default {
{required: true, message: "单位不能为空", trigger: "blur"}
],
},
batchRules: {
workorderCode: [
{required: true, message: "工单编码不能为空", trigger: "blur"}
],
batchCode: [
{required: true, message: "当前批次编码不能为空", trigger: "blur"}
],
batchQuantity: [
{required: true, message: "当前批次数量不能为空", trigger: "blur"}
],
newBatchCode: [
{required: true, message: "新批次编码不能为空", trigger: "blur"}
],
newBatchQuantity: [
{required: true, message: "新批次数量不能为空", trigger: "blur"}
],
},
/**********************************/
eRouteProps: {multiple: true},
eRouteOptions: [],
@ -1626,6 +1750,17 @@ export default {
};
this.resetForm("form");
},
resetBatchForm() {
this.batchForm = {
workorderCode: null,
batchCode: null,
batchQuantity: null,
newBatchCode: null,
newBatchQuantity: null,
attr1: null,
}
this.resetForm("batchForm");
},
// -
handleQuery() {
this.queryParams.pageNum = 1;
@ -1647,6 +1782,13 @@ export default {
this.multiple = !selection.length
this.statuses = selection.map(item => item.status)
},
batchSelectionChange(selection) {
this.batchids = selection.map(item => item.workorderId)
this.bWorkCodes = selection.map(item => item.workorderCode)
this.batchCodes = selection.map(item => item.batchCode)
this.batchSingle = selection.length !== 1
this.batchMultiple = !selection.length
},
// -
handleAdd() {
alert("待建设")
@ -1664,6 +1806,91 @@ export default {
})
return value;
},
editBatch() {
this.batchLoading = true;
const workOrdercode = this.codes[0];
getWorkOrderBatch(workOrdercode).then(response => {
if(response.code == 200) {
this.batchData = response.rows;
this.batchOpen = true;
this.batchLoading = false;
this.batchTitle = "批次编辑";
}
})
},
hangleCloseEditBatch() {
this.batchOpen = false;
this.getList();
},
//
handleAddBatch() {
this.resetBatchForm();
this.batchForm.workorderCode = this.codes[0];
this.bEditOpen = true;
this.bEditTitle = "批次新增";
this.editBatchFlag = false;
},
//
handleUpdateBatch() {
this.editBatchFlag = true;
this.resetBatchForm();
const params = {
workorderCode: this.bWorkCodes[0],
batchCode: this.batchCodes[0]
}
getWorkOrderBatchInfo(params).then(response => {
this.batchForm = response.data;
this.bEditOpen = true;
this.bEditTitle = "批次修改";
});
},
//
batchCancel() {
this.bEditOpen = false;
this.editBatch();
},
//
batchSubmitForm() {
this.$refs["batchForm"].validate(valid => {
if (valid) {
if (this.batchForm.batchCode != null) {
updateWorkOrderBatch(this.batchForm).then(response => {
if(response.code === 200) {
this.$modal.msgSuccess("修改成功");
}else{
this.$modal.msgError(response.msg);
}
this.bEditOpen = false;
this.editBatch();
});
} else {
insertWorkOrderBatch(this.batchForm).then(response => {
if(response.code === 200) {
this.$modal.msgSuccess("新增成功");
}else{
this.$modal.msgError(response.msg);
}
this.bEditOpen = false;
this.editBatch();
});
}
}
});
},
//
handleRemoveBatch() {
const workorderCode = this.bWorkCodes[0];
const batchCode = this.batchCodes[0];
this.$modal.confirm('是否确认删除批次编号为"' + batchCode + '"的数据项?').then(function() {
return removeWorkOrderBatch(batchCode,workorderCode);
}).then(() => {
this.editBatch();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
//-
selectBPMateriel() {
//

Loading…
Cancel
Save