|
|
|
@ -43,15 +43,6 @@
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<!-- <el-form-item label-width="100px" label="计划生产日期" prop="planProDate">-->
|
|
|
|
|
<!-- <el-date-picker clearable-->
|
|
|
|
|
<!-- v-model="queryParams.planProDate"-->
|
|
|
|
|
<!-- type="date"-->
|
|
|
|
|
<!-- value-format="yyyy-MM-dd"-->
|
|
|
|
|
<!-- placeholder="选择计划生产日期"-->
|
|
|
|
|
<!-- >-->
|
|
|
|
|
<!-- </el-date-picker>-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<el-form-item label-width="100px" label="计划生产日期" prop="productDateArray">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="queryParams.planDateArray"
|
|
|
|
@ -111,7 +102,8 @@
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="handleImport"
|
|
|
|
|
v-hasPermi="['mes:pro:order:import']"
|
|
|
|
|
>导入</el-button>
|
|
|
|
|
>导入
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
@ -124,16 +116,6 @@
|
|
|
|
|
>导出
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<!-- <el-col :span="1.5">-->
|
|
|
|
|
<!-- <el-button-->
|
|
|
|
|
<!-- type="info"-->
|
|
|
|
|
<!-- plain-->
|
|
|
|
|
<!-- icon="el-icon-sort"-->
|
|
|
|
|
<!-- size="mini"-->
|
|
|
|
|
<!-- @click="toggleExpandAll"-->
|
|
|
|
|
<!-- >展开/折叠-->
|
|
|
|
|
<!-- </el-button>-->
|
|
|
|
|
<!-- </el-col>-->
|
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
@ -217,11 +199,13 @@
|
|
|
|
|
<i class="el-icon-upload"></i>
|
|
|
|
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
|
|
<div class="el-upload__tip text-center" slot="tip">
|
|
|
|
|
<!-- <div class="el-upload__tip" slot="tip">-->
|
|
|
|
|
<!-- <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的订单数据-->
|
|
|
|
|
<!-- </div>-->
|
|
|
|
|
<!-- <div class="el-upload__tip" slot="tip">-->
|
|
|
|
|
<!-- <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的订单数据-->
|
|
|
|
|
<!-- </div>-->
|
|
|
|
|
<span>仅允许导入xls、xlsx格式文件。</span>
|
|
|
|
|
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
|
|
|
|
|
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
|
|
|
|
|
@click="importTemplate">下载模板
|
|
|
|
|
</el-link>
|
|
|
|
|
</div>
|
|
|
|
|
</el-upload>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
@ -239,7 +223,8 @@
|
|
|
|
|
:visible.sync="innerVisible"
|
|
|
|
|
append-to-body>
|
|
|
|
|
|
|
|
|
|
<el-form :model="materielQueryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
|
|
<el-form :model="materielQueryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
|
|
|
|
|
label-width="68px">
|
|
|
|
|
<el-form-item label="物料编码" prop="productCode">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="materielQueryParams.productCode"
|
|
|
|
@ -264,10 +249,10 @@
|
|
|
|
|
|
|
|
|
|
<!-- 物料列表展示 -->
|
|
|
|
|
<el-table v-loading="loading" :data="materielList" @selection-change="handleSelectionChange">
|
|
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
|
|
<el-table-column type="selection" width="55" align="center"/>
|
|
|
|
|
<el-table-column width="60" align="center" label="序号" type="index"></el-table-column>
|
|
|
|
|
<el-table-column label="物料编码" align="center" prop="productCode" />
|
|
|
|
|
<el-table-column label="物料名称" align="center" prop="productDescZh" />
|
|
|
|
|
<el-table-column label="物料编码" align="center" prop="productCode"/>
|
|
|
|
|
<el-table-column label="物料名称" align="center" prop="productDescZh"/>
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<pagination
|
|
|
|
@ -404,10 +389,11 @@
|
|
|
|
|
<el-col :offset="1" :span="7">
|
|
|
|
|
<el-form-item label="选择设备:">
|
|
|
|
|
<el-cascader
|
|
|
|
|
:options="eRouteOptions"
|
|
|
|
|
:props="eRouteProps"
|
|
|
|
|
v-model="splitForm.prodLineCodeArray"
|
|
|
|
|
clearable></el-cascader>
|
|
|
|
|
@focus="changeEquipment"
|
|
|
|
|
:options="eRouteOptions"
|
|
|
|
|
:props="eRouteProps"
|
|
|
|
|
v-model="splitForm.prodLineCodeArray"
|
|
|
|
|
clearable></el-cascader>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
@ -499,12 +485,8 @@ import {
|
|
|
|
|
getProRoutes,
|
|
|
|
|
getProShifts,
|
|
|
|
|
getWorkOrderList,
|
|
|
|
|
getOrderList,
|
|
|
|
|
subSplitOrder,
|
|
|
|
|
getprodLineShift,
|
|
|
|
|
listOrder,
|
|
|
|
|
getOrder,
|
|
|
|
|
delOrder,
|
|
|
|
|
addOrder,
|
|
|
|
|
updateOrder,
|
|
|
|
|
syncSAP, selectMaterielList
|
|
|
|
@ -512,8 +494,7 @@ import {
|
|
|
|
|
import Treeselect from '@riophae/vue-treeselect'
|
|
|
|
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
|
|
|
|
import moment from 'moment'
|
|
|
|
|
import { getToken } from "@/utils/auth"
|
|
|
|
|
import {listUser} from "@/api/system/user";
|
|
|
|
|
import {getToken} from "@/utils/auth"
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'Order',
|
|
|
|
@ -523,8 +504,9 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
// 新增-物料list
|
|
|
|
|
materiel: [],
|
|
|
|
|
materielList:[],
|
|
|
|
|
materielList: [],
|
|
|
|
|
total: 0,
|
|
|
|
|
// 物料查询数据实体
|
|
|
|
|
materielQueryParams: {
|
|
|
|
@ -546,7 +528,7 @@ export default {
|
|
|
|
|
// 是否更新已经存在的用户数据
|
|
|
|
|
updateSupport: 0,
|
|
|
|
|
// 设置上传的请求头部
|
|
|
|
|
headers: {poolName: localStorage.getItem("USER_POOL_NAME_CURRENT"), Authorization: "Bearer " + getToken() },
|
|
|
|
|
headers: {poolName: localStorage.getItem("USER_POOL_NAME_CURRENT"), Authorization: "Bearer " + getToken()},
|
|
|
|
|
// 上传的地址
|
|
|
|
|
url: process.env.VUE_APP_BASE_API + "/plan/order/importData"
|
|
|
|
|
},
|
|
|
|
@ -597,25 +579,14 @@ export default {
|
|
|
|
|
isExpandAll: true,
|
|
|
|
|
// 重新渲染表格状态
|
|
|
|
|
refreshTable: true,
|
|
|
|
|
// 查询参数
|
|
|
|
|
// 首-查询参数
|
|
|
|
|
queryParams: {
|
|
|
|
|
planDateArray: [],
|
|
|
|
|
planFactoryCode: null,
|
|
|
|
|
orderType: null,
|
|
|
|
|
orderCode: null,
|
|
|
|
|
prodCode: null,
|
|
|
|
|
prodDesc: null,
|
|
|
|
|
quantity: null,
|
|
|
|
|
unit: null,
|
|
|
|
|
workerOrder: null,
|
|
|
|
|
planProDate: null,
|
|
|
|
|
planComplete: null,
|
|
|
|
|
atrr1: null,
|
|
|
|
|
atrr2: null,
|
|
|
|
|
atrr3: null,
|
|
|
|
|
status: null,
|
|
|
|
|
parentOrder: null,
|
|
|
|
|
prodType: null
|
|
|
|
|
},
|
|
|
|
|
// 拆分表单参数
|
|
|
|
|
splitForm: {
|
|
|
|
@ -631,7 +602,7 @@ export default {
|
|
|
|
|
rules: {},
|
|
|
|
|
addrules: {},
|
|
|
|
|
/**********************************/
|
|
|
|
|
eRouteProps: { multiple: true },
|
|
|
|
|
eRouteProps: {multiple: true},
|
|
|
|
|
eRouteOptions: []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
@ -648,23 +619,23 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 校验车数
|
|
|
|
|
// 新增-校验车数
|
|
|
|
|
changeCarNum(num) {
|
|
|
|
|
if (num<=0){
|
|
|
|
|
if (num <= 0) {
|
|
|
|
|
this.form.carNum = 1;
|
|
|
|
|
this.$message({
|
|
|
|
|
message:"车数不能小于1",
|
|
|
|
|
type:"warning"
|
|
|
|
|
message: "车数不能小于1",
|
|
|
|
|
type: "warning"
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 新增按钮操作
|
|
|
|
|
// 新增-新增按钮操作
|
|
|
|
|
setUp() {
|
|
|
|
|
this.dialogVisible = true;
|
|
|
|
|
// 清空缓存
|
|
|
|
|
this.form = {}
|
|
|
|
|
},
|
|
|
|
|
// 确认选择物料
|
|
|
|
|
// 新增-确认选择物料
|
|
|
|
|
subMateriel() {
|
|
|
|
|
if (this.materiel.length == 0) {
|
|
|
|
|
this.$message({
|
|
|
|
@ -684,11 +655,11 @@ export default {
|
|
|
|
|
this.form.prodDesc = this.materiel[0].productDescZh;
|
|
|
|
|
this.innerVisible = false;
|
|
|
|
|
},
|
|
|
|
|
// 选中物料信息
|
|
|
|
|
// 新增-选中物料信息
|
|
|
|
|
handleSelectionChange(e) {
|
|
|
|
|
this.materiel = e;
|
|
|
|
|
},
|
|
|
|
|
// 查询物料列表
|
|
|
|
|
// 新增-查询物料列表
|
|
|
|
|
getMaterielList() {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
selectMaterielList(this.materielQueryParams).then(response => {
|
|
|
|
@ -698,85 +669,168 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
// 选择物料
|
|
|
|
|
// 新增-打开选择物料窗口
|
|
|
|
|
selectMateriel() {
|
|
|
|
|
this.innerVisible = true;
|
|
|
|
|
this.getMaterielList();
|
|
|
|
|
},
|
|
|
|
|
// 选择工艺
|
|
|
|
|
changeRoute(routeCode) {
|
|
|
|
|
getProEquipment(routeCode).then(response => {
|
|
|
|
|
this.eRouteOptions = response.data
|
|
|
|
|
//默认全选
|
|
|
|
|
let selectAll = [];
|
|
|
|
|
this.eRouteOptions.forEach(it => {
|
|
|
|
|
var children = it.children;
|
|
|
|
|
if(children != null){
|
|
|
|
|
children.forEach(it2=>{
|
|
|
|
|
let arr = []
|
|
|
|
|
arr.push(it.value)
|
|
|
|
|
arr.push(it2.value)
|
|
|
|
|
selectAll.push(arr)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 新增-订单数量改变
|
|
|
|
|
addQuantity(num) {
|
|
|
|
|
if (num <= 0) {
|
|
|
|
|
this.form.quantity = 1;
|
|
|
|
|
this.$message({
|
|
|
|
|
message: "数量不能小于1",
|
|
|
|
|
type: "warning"
|
|
|
|
|
})
|
|
|
|
|
this.splitForm.prodLineCodeArray = selectAll
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 选择线体改变
|
|
|
|
|
changeEquipment(){
|
|
|
|
|
if (this.splitForm.routeCode == null) {
|
|
|
|
|
// 新增-新增提交按钮操作
|
|
|
|
|
submitForm() {
|
|
|
|
|
// 表单校验
|
|
|
|
|
if (this.checkNull(this.form.prodCode) == 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '请先选择工艺!',
|
|
|
|
|
message: '物料号不能为空!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 新增-订单数量改变
|
|
|
|
|
addQuantity(num){
|
|
|
|
|
if (num<=0){
|
|
|
|
|
this.form.quantity = 1;
|
|
|
|
|
if (this.checkNull(this.form.planProDate) == 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '请选择计划生产日期!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (this.checkNull(this.form.planComplete) == 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message:"数量不能小于1",
|
|
|
|
|
type:"warning"
|
|
|
|
|
message: '请选择计划完成日期!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (this.checkNull(this.form.prodDesc) == 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '物料名称不能为空!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (this.checkNull(this.form.quantity) == 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '请填写订单数量!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (this.checkNull(this.form.unit) == 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '请填写单位!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (this.checkNull(this.form.prodType) == 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '请选择产品类型!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.$refs['form'].validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
if (this.form.id != null) {
|
|
|
|
|
updateOrder(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess('修改成功')
|
|
|
|
|
this.dialogVisible = false
|
|
|
|
|
this.reset()
|
|
|
|
|
this.getList()
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
addOrder(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess('新增成功')
|
|
|
|
|
this.dialogVisible = false
|
|
|
|
|
this.reset()
|
|
|
|
|
this.getList()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
/** 导入按钮操作 */
|
|
|
|
|
// 新增-物料搜索
|
|
|
|
|
handleMaterielQuery() {
|
|
|
|
|
this.materielQueryParams.pageNum = 1;
|
|
|
|
|
this.getMaterielList();
|
|
|
|
|
},
|
|
|
|
|
// 新增-物料重置
|
|
|
|
|
resetMaterielQuery() {
|
|
|
|
|
// TODO 待优化
|
|
|
|
|
console.log("进行了物料重置")
|
|
|
|
|
},
|
|
|
|
|
// 导入-导入窗口打开
|
|
|
|
|
handleImport() {
|
|
|
|
|
this.upload.title = "订单信息导入";
|
|
|
|
|
this.upload.open = true;
|
|
|
|
|
},
|
|
|
|
|
// 文件上传中处理
|
|
|
|
|
// 导入-文件上传中处理
|
|
|
|
|
handleFileUploadProgress(event, file, fileList) {
|
|
|
|
|
this.upload.isUploading = true;
|
|
|
|
|
},
|
|
|
|
|
// 文件上传成功处理
|
|
|
|
|
// 导入-文件上传成功处理
|
|
|
|
|
handleFileSuccess(response, file, fileList) {
|
|
|
|
|
this.upload.open = false;
|
|
|
|
|
this.upload.isUploading = false;
|
|
|
|
|
this.$refs.upload.clearFiles();
|
|
|
|
|
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
|
|
|
|
|
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", {dangerouslyUseHTMLString: true});
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
// 提交上传文件
|
|
|
|
|
// 导入-提交上传文件
|
|
|
|
|
submitFileForm() {
|
|
|
|
|
this.$refs.upload.submit();
|
|
|
|
|
},
|
|
|
|
|
/** 下载模板操作 */
|
|
|
|
|
// 导入-下载模板
|
|
|
|
|
importTemplate() {
|
|
|
|
|
this.download('/plan/order/importTemplate', {
|
|
|
|
|
}, `order_example_template_${new Date().getTime()}.xlsx`)
|
|
|
|
|
this.download('/plan/order/importTemplate', {}, `order_example_template_${new Date().getTime()}.xlsx`)
|
|
|
|
|
},
|
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
|
// 导出-导出按钮
|
|
|
|
|
handleExport() {
|
|
|
|
|
this.download('/plan/order/export', {
|
|
|
|
|
...this.queryParams
|
|
|
|
|
}, `order_${new Date().getTime()}.xlsx`)
|
|
|
|
|
},
|
|
|
|
|
/** 拆分按钮操作 */
|
|
|
|
|
// 拆分-选择工艺
|
|
|
|
|
changeRoute(routeCode) {
|
|
|
|
|
console.log("点击了拆分-选择工艺")
|
|
|
|
|
getProEquipment(routeCode).then(response => {
|
|
|
|
|
this.eRouteOptions = response.data
|
|
|
|
|
//默认全选
|
|
|
|
|
let selectAll = [];
|
|
|
|
|
this.eRouteOptions.forEach(it => {
|
|
|
|
|
var children = it.children;
|
|
|
|
|
if (children != null) {
|
|
|
|
|
children.forEach(it2 => {
|
|
|
|
|
let arr = []
|
|
|
|
|
arr.push(it.value)
|
|
|
|
|
arr.push(it2.value)
|
|
|
|
|
selectAll.push(arr)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.splitForm.prodLineCodeArray = selectAll
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 拆分-选择线体改变
|
|
|
|
|
changeEquipment() {
|
|
|
|
|
if (this.splitForm.routeCode == null) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '请先选择工艺!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 拆分-点击拆分按钮
|
|
|
|
|
splitBtn(e) {
|
|
|
|
|
// 获取级联订单信息
|
|
|
|
|
var row;
|
|
|
|
|
getCascadeProOrder(e.orderCode).then(response => {
|
|
|
|
|
row = response.data
|
|
|
|
@ -821,7 +875,7 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.workerLoading = true // 设置加载状态为true,表示正在加载
|
|
|
|
|
// 获取工单
|
|
|
|
|
// 获取历史拆分工单信息
|
|
|
|
|
getWorkOrderList(row.id).then(response => {
|
|
|
|
|
var data = response.data
|
|
|
|
|
this.splitData = data
|
|
|
|
@ -841,10 +895,14 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
/** 拆分数量方法 */
|
|
|
|
|
// 拆分-拆分数量变化校验
|
|
|
|
|
splitNumChange(e) {
|
|
|
|
|
//不能为负数
|
|
|
|
|
if (e <= 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '拆分数量不能为负数!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
e = 1
|
|
|
|
|
this.splitForm.splitNum = 1
|
|
|
|
|
} else {
|
|
|
|
@ -863,6 +921,7 @@ export default {
|
|
|
|
|
this.proLoading = true // 设置加载状态为true,表示正在加载
|
|
|
|
|
|
|
|
|
|
var num = this.productData[0].quantity;
|
|
|
|
|
|
|
|
|
|
// 递归操作动态显示拆分数量
|
|
|
|
|
function setAtrr1(data, splitNum) {
|
|
|
|
|
if (data.children !== undefined) {
|
|
|
|
@ -885,96 +944,7 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
this.product = this.productData[0]
|
|
|
|
|
},
|
|
|
|
|
// 判空、空串
|
|
|
|
|
checkNull(entity) {
|
|
|
|
|
if (entity !== undefined && entity !== '' && entity !== null) {
|
|
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
|
return 0
|
|
|
|
|
},
|
|
|
|
|
/** 确认关闭 */
|
|
|
|
|
handleClose(done) {
|
|
|
|
|
this.$confirm('确认关闭?')
|
|
|
|
|
.then(_ => {
|
|
|
|
|
this.reset()
|
|
|
|
|
done()
|
|
|
|
|
})
|
|
|
|
|
.catch(_ => {
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
/** 新增-提交按钮 */
|
|
|
|
|
submitForm() {
|
|
|
|
|
// 表单校验
|
|
|
|
|
if (this.checkNull(this.form.prodCode) == 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '物料号不能为空!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (this.checkNull(this.form.planProDate) == 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '请选择计划生产日期!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (this.checkNull(this.form.planComplete) == 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '请选择计划完成日期!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (this.checkNull(this.form.prodDesc) == 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '物料名称不能为空!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (this.checkNull(this.form.quantity) == 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '请填写订单数量!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (this.checkNull(this.form.unit) == 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '请填写单位!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (this.checkNull(this.form.prodType) == 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '请选择产品类型!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.$refs['form'].validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
if (this.form.id != null) {
|
|
|
|
|
updateOrder(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess('修改成功')
|
|
|
|
|
this.dialogVisible = false
|
|
|
|
|
this.reset()
|
|
|
|
|
this.getList()
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
addOrder(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess('新增成功')
|
|
|
|
|
this.dialogVisible = false
|
|
|
|
|
this.reset()
|
|
|
|
|
this.getList()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
/** 检验批次编码是否重复 */
|
|
|
|
|
// 拆分-校验拆分批次号是否重复
|
|
|
|
|
batchCodeChange(e) {
|
|
|
|
|
if (this.formFields.length > 1) {
|
|
|
|
|
for (let i = 0; i < this.formFields.length - 1; i++) {
|
|
|
|
@ -992,19 +962,19 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/** 校验日期 */
|
|
|
|
|
// 拆分-校验工单日期
|
|
|
|
|
checkDate(e) {
|
|
|
|
|
var now = new Date()
|
|
|
|
|
if (e < now) {
|
|
|
|
|
e = now
|
|
|
|
|
this.splitForm.productDate = now
|
|
|
|
|
this.$message({
|
|
|
|
|
message:"工单日期不能早于今天",
|
|
|
|
|
type:"warning"
|
|
|
|
|
message: "工单日期不能早于今天",
|
|
|
|
|
type: "warning"
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/** 拆分提交按钮 */
|
|
|
|
|
// 拆分-拆分提交按钮操作
|
|
|
|
|
batchBtn() {
|
|
|
|
|
// 判断数据不能为空
|
|
|
|
|
if (this.splitForm.splitNum == null) {
|
|
|
|
@ -1021,7 +991,7 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (this.splitForm.prodLineCodeArray.length ==0) {
|
|
|
|
|
if (this.splitForm.prodLineCodeArray.length == 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '请选择各流程节点的设备!',
|
|
|
|
|
type: 'warning'
|
|
|
|
@ -1127,7 +1097,7 @@ export default {
|
|
|
|
|
}, 500)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/** 动态添加表单 */
|
|
|
|
|
// 拆分-动态添加表单
|
|
|
|
|
addField() {
|
|
|
|
|
//如果批次数量大于等于拆分数量则不允许拆分
|
|
|
|
|
let sum = 0
|
|
|
|
@ -1143,21 +1113,83 @@ export default {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.formFields.push({ batchCode: '', batchQuantity: '' })
|
|
|
|
|
this.formFields.push({batchCode: '', batchQuantity: ''})
|
|
|
|
|
//自动填充
|
|
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = Number(this.productData[0].atrr1) - Number(sum)
|
|
|
|
|
},
|
|
|
|
|
/** 动态删除表单 */
|
|
|
|
|
// 拆分-动态删除表单
|
|
|
|
|
removeField(index) {
|
|
|
|
|
this.formFields.splice(index, 1)
|
|
|
|
|
},
|
|
|
|
|
/** 查询订单列表 */
|
|
|
|
|
// 拆分-表单重置
|
|
|
|
|
resetBatch() {
|
|
|
|
|
this.eRouteOptions = [],
|
|
|
|
|
this.splitForm = {
|
|
|
|
|
prodLineCodeArray: [],
|
|
|
|
|
id: null,
|
|
|
|
|
prodLineCode: [],
|
|
|
|
|
splitNum: null,
|
|
|
|
|
productDate: null,
|
|
|
|
|
shiftId: null,
|
|
|
|
|
formFields: []
|
|
|
|
|
}
|
|
|
|
|
this.splitData = []
|
|
|
|
|
this.productData = []
|
|
|
|
|
this.proline = []
|
|
|
|
|
this.splitnum = null
|
|
|
|
|
this.workShift = []
|
|
|
|
|
this.formFields = [{
|
|
|
|
|
batchCode: '',
|
|
|
|
|
batchQuantity: ''
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
// 拆分-填写批次数量方法
|
|
|
|
|
inBatch(e) {
|
|
|
|
|
//不能为负数
|
|
|
|
|
if (e <= 0) {
|
|
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = 1
|
|
|
|
|
}
|
|
|
|
|
//逻辑判断
|
|
|
|
|
let sum = 0
|
|
|
|
|
for (let i = 0; i < this.formFields.length; i++) {
|
|
|
|
|
sum += Number(this.formFields[i].batchQuantity)
|
|
|
|
|
}
|
|
|
|
|
//如果超过拆分数量,提示并清空当前输入
|
|
|
|
|
if (sum > this.productData[0].atrr1) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '你的批次数量总和不能超过拆分数量!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = Number(this.productData[0].atrr1) - Number(Number(sum) - Number(e))
|
|
|
|
|
if (this.formFields[this.formFields.length - 1].batchQuantity <= 0) {
|
|
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = 1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//如果拆分数量为空
|
|
|
|
|
if (this.productData[0].atrr1 == '' || this.productData[0].atrr1 == null) {
|
|
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = ''
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 拆分-新增-取消按钮
|
|
|
|
|
cancel() {
|
|
|
|
|
this.dialogVisible = false;
|
|
|
|
|
this.splitOpen = false;
|
|
|
|
|
this.reset();
|
|
|
|
|
},
|
|
|
|
|
// 判空、空串
|
|
|
|
|
checkNull(entity) {
|
|
|
|
|
if (entity !== undefined && entity !== '' && entity !== null) {
|
|
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
|
return 0
|
|
|
|
|
},
|
|
|
|
|
// 首-查询订单列表
|
|
|
|
|
getList() {
|
|
|
|
|
this.loading = true
|
|
|
|
|
if (this.queryParams.planDateArray != null) {
|
|
|
|
|
this.queryParams.planDateStart = moment(this.queryParams.planDateArray[0]).format('YYYY-MM-DD')
|
|
|
|
|
this.queryParams.planDateEnd = moment(this.queryParams.planDateArray[1]).format('YYYY-MM-DD')
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
this.queryParams.planDateStart = null
|
|
|
|
|
this.queryParams.planDateEnd = null
|
|
|
|
|
}
|
|
|
|
@ -1166,7 +1198,7 @@ export default {
|
|
|
|
|
this.loading = false
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
/** 转换订单数据结构 */
|
|
|
|
|
// 首-转换订单数据结构
|
|
|
|
|
normalizer(node) {
|
|
|
|
|
if (node.children && !node.children.length) {
|
|
|
|
|
delete node.children
|
|
|
|
@ -1177,21 +1209,6 @@ export default {
|
|
|
|
|
children: node.children
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 取消按钮
|
|
|
|
|
cancel() {
|
|
|
|
|
this.dialogVisible = false;
|
|
|
|
|
this.splitOpen = false;
|
|
|
|
|
this.reset();
|
|
|
|
|
},
|
|
|
|
|
/** 查询订单下拉树结构 */
|
|
|
|
|
getTreeselect() {
|
|
|
|
|
listOrder().then(response => {
|
|
|
|
|
this.orderOptions = []
|
|
|
|
|
const data = { orderCode: 0, orderCode: '顶级节点', children: [] }
|
|
|
|
|
data.children = this.handleTree(response.data, 'orderCode', 'parentOrder')
|
|
|
|
|
this.orderOptions.push(data)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 表单重置
|
|
|
|
|
reset() {
|
|
|
|
|
this.form = {
|
|
|
|
@ -1219,129 +1236,25 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
this.resetForm('form')
|
|
|
|
|
},
|
|
|
|
|
/** 拆分表单重置 */
|
|
|
|
|
resetBatch() {
|
|
|
|
|
this.eRouteOptions= [],
|
|
|
|
|
this.splitForm = {
|
|
|
|
|
prodLineCodeArray: [],
|
|
|
|
|
id: null,
|
|
|
|
|
prodLineCode: [],
|
|
|
|
|
splitNum: null,
|
|
|
|
|
productDate: null,
|
|
|
|
|
shiftId: null,
|
|
|
|
|
formFields: []
|
|
|
|
|
}
|
|
|
|
|
this.splitData = []
|
|
|
|
|
this.productData = []
|
|
|
|
|
this.proline = []
|
|
|
|
|
this.splitnum = null
|
|
|
|
|
this.workShift = []
|
|
|
|
|
this.formFields = [{
|
|
|
|
|
batchCode: '',
|
|
|
|
|
batchQuantity: ''
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
// 物料搜索
|
|
|
|
|
handleMaterielQuery() {
|
|
|
|
|
this.materielQueryParams.pageNum = 1;
|
|
|
|
|
this.getMaterielList();
|
|
|
|
|
},
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
handleQuery() {
|
|
|
|
|
this.getList()
|
|
|
|
|
},
|
|
|
|
|
// 物料重置
|
|
|
|
|
resetMaterielQuery() {
|
|
|
|
|
// TODO 待优化
|
|
|
|
|
console.log("进行了物料重置")
|
|
|
|
|
},
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
|
// 首-查询重置
|
|
|
|
|
resetQuery() {
|
|
|
|
|
this.queryParams = {
|
|
|
|
|
planDateArray: [new Date(), new Date()],
|
|
|
|
|
planFactoryCode: null,
|
|
|
|
|
orderType: null,
|
|
|
|
|
orderCode: null,
|
|
|
|
|
prodCode: null,
|
|
|
|
|
prodDesc: null,
|
|
|
|
|
quantity: null,
|
|
|
|
|
unit: null,
|
|
|
|
|
workerOrder: null,
|
|
|
|
|
planProDate: null,
|
|
|
|
|
planComplete: null,
|
|
|
|
|
atrr1: null,
|
|
|
|
|
atrr2: null,
|
|
|
|
|
atrr3: null,
|
|
|
|
|
status: null,
|
|
|
|
|
parentOrder: null,
|
|
|
|
|
prodType: null
|
|
|
|
|
planDateArray: [new Date(), new Date()],
|
|
|
|
|
planFactoryCode: null,
|
|
|
|
|
orderCode: null,
|
|
|
|
|
prodCode: null,
|
|
|
|
|
prodDesc: null,
|
|
|
|
|
status: null,
|
|
|
|
|
}
|
|
|
|
|
this.handleQuery()
|
|
|
|
|
},
|
|
|
|
|
/** 拆分按钮操作 */
|
|
|
|
|
handleAdd(row) {
|
|
|
|
|
this.reset()
|
|
|
|
|
this.getTreeselect()
|
|
|
|
|
if (row != null && row.orderCode) {
|
|
|
|
|
this.splitForm.parentOrder = row.orderCode
|
|
|
|
|
} else {
|
|
|
|
|
this.splitForm.parentOrder = 0
|
|
|
|
|
}
|
|
|
|
|
this.splitOpen = true
|
|
|
|
|
this.title = '拆分'
|
|
|
|
|
},
|
|
|
|
|
/** 展开/折叠操作 */
|
|
|
|
|
toggleExpandAll() {
|
|
|
|
|
this.refreshTable = false
|
|
|
|
|
this.isExpandAll = !this.isExpandAll
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.refreshTable = true
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
/** 修改按钮操作 */
|
|
|
|
|
handleUpdate(row) {
|
|
|
|
|
this.reset()
|
|
|
|
|
this.getTreeselect()
|
|
|
|
|
if (row != null) {
|
|
|
|
|
this.splitForm.parentOrder = row.orderCode
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getOrder(row.id).then(response => {
|
|
|
|
|
this.splitForm = response.data
|
|
|
|
|
this.splitOpen = true
|
|
|
|
|
this.title = '修改订单'
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
/** 填写批次数量 */
|
|
|
|
|
inBatch(e) {
|
|
|
|
|
//不能为负数
|
|
|
|
|
if (e <= 0) {
|
|
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = 1
|
|
|
|
|
}
|
|
|
|
|
//逻辑判断
|
|
|
|
|
let sum = 0
|
|
|
|
|
for (let i = 0; i < this.formFields.length; i++) {
|
|
|
|
|
sum += Number(this.formFields[i].batchQuantity)
|
|
|
|
|
}
|
|
|
|
|
//如果超过拆分数量,提示并清空当前输入
|
|
|
|
|
if (sum > this.productData[0].atrr1) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '你的批次数量总和不能超过拆分数量!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = Number(this.productData[0].atrr1) - Number(Number(sum) - Number(e))
|
|
|
|
|
if (this.formFields[this.formFields.length - 1].batchQuantity <= 0) {
|
|
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = 1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//如果拆分数量为空
|
|
|
|
|
if (this.productData[0].atrr1 == '' || this.productData[0].atrr1 == null) {
|
|
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = ''
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/** SAP同步按钮操作 */
|
|
|
|
|
// 首-SAP同步按钮操作
|
|
|
|
|
handleSyncSAP() {
|
|
|
|
|
this.$modal.confirm('是否确认SAP同步操作步骤?').then(function() {
|
|
|
|
|
this.$modal.confirm('是否确认SAP同步操作步骤?').then(function () {
|
|
|
|
|
return syncSAP()
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.getList()
|
|
|
|
@ -1389,7 +1302,8 @@ export default {
|
|
|
|
|
margin-top: 40px;
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
}
|
|
|
|
|
.my-materiel-btn{
|
|
|
|
|
|
|
|
|
|
.my-materiel-btn {
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
margin-left: 650px;
|
|
|
|
|
}
|
|
|
|
|