From 56e5c4574c47189adb81aa9cb0d162b55d0ddbef Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期五, 07 六月 2024 13:58:01 +0800
Subject: [PATCH] 1.工艺SOP开发完成
---
src/views/workOrder/workOrderList.vue | 332 +++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 273 insertions(+), 59 deletions(-)
diff --git a/src/views/workOrder/workOrderList.vue b/src/views/workOrder/workOrderList.vue
index af688a1..4bde2c9 100644
--- a/src/views/workOrder/workOrderList.vue
+++ b/src/views/workOrder/workOrderList.vue
@@ -90,26 +90,14 @@
<el-form-item v-show="isExpandForm" label="鍒涘缓浜哄憳" style=" display: flex;">
<el-input v-model="form.creatuser" style="width: 200px" placeholder="璇疯緭鍏�" />
</el-form-item>
- <el-form-item v-show="isExpandForm" label="鍒涘缓鏃堕棿" style=" display: flex;">
- <!-- <el-date-picker-->
- <!-- v-model="form.createdate"-->
- <!-- type="daterange"-->
- <!-- :clearable="false"-->
- <!-- range-separator="~"-->
- <!-- start-placeholder="寮�濮嬫棩鏈�"-->
- <!-- end-placeholder="缁撴潫鏃ユ湡"-->
- <!-- size="mini"-->
- <!-- />-->
- <el-date-picker
- v-model="form.createdate"
- type="date"
- size="mini"
- :clearable="false"
- class="dateMini"
- format="yyyy-MM-dd"
- placeholder="閫夋嫨鏃ユ湡"
- />
- </el-form-item>
+ <DateType
+ ref="DateTypeRef"
+ :is-expand-form="isExpandForm"
+ style="display:flex;justify-content: center;align-items: center;position: relative"
+ :datatype-list="datatypeList"
+ @DateTypeChange="DateTypeChange"
+ @cycleTimeChange="cycleTimeChange"
+ />
</div>
<div
@@ -255,6 +243,21 @@
<div v-else>/</div>
</template>
</el-table-column>
+
+ <el-table-column
+ v-if="mesSetting.route"
+ prop="route_name"
+ label="宸ヨ壓璺嚎"
+ sortable="custom"
+ show-tooltip-when-overflow
+ width="120"
+ >
+ <template slot-scope="{row}">
+ <div v-if="row.route_name">{{ row.route_name }}</div>
+ <div v-else>/</div>
+ </template>
+ </el-table-column>
+
<el-table-column
prop="plan_qty"
label="宸ュ崟鏁�"
@@ -283,6 +286,28 @@
>
<template slot-scope="{row}">
<div v-if="row.wkshp_name">{{ row.wkshp_name }}</div>
+ <div v-else>/</div>
+ </template>
+ </el-table-column>
+ <el-table-column
+ prop="plan_startdate"
+ label="棰勮寮�宸ユ棩鏈�"
+ sortable="custom"
+ width="130"
+ >
+ <template slot-scope="{row}">
+ <div v-if="row.plan_startdate">{{ row.plan_startdate.substring(0, 11) }}</div>
+ <div v-else>/</div>
+ </template>
+ </el-table-column>
+ <el-table-column
+ prop="plan_enddate"
+ label="棰勮瀹屽伐鏃ユ湡"
+ sortable="custom"
+ width="130"
+ >
+ <template slot-scope="{row}">
+ <div v-if="row.plan_enddate">{{ row.plan_enddate.substring(0, 11) }}</div>
<div v-else>/</div>
</template>
</el-table-column>
@@ -594,6 +619,26 @@
/>
<!-- oninput="value=value.replace(/[^0-9*.{1}0-9*]/g,'')"-->
</el-form-item>
+
+ <el-form-item label="鎵�灞炶溅闂�" prop="wkshopcode">
+ <el-select
+ v-model="dialogForm.wkshopcode"
+ filterable
+ :popper-append-to-body="false"
+ style="width: 200px;"
+ placeholder="璇烽�夋嫨杞﹂棿"
+ @change="getMesOrderNewStepContent"
+ >
+ <!-- @change="sourceType? getMesOrderNewStepContent():routecodeChange()"-->
+ <el-option
+ v-for="item in wkshopArr"
+ :key="item.torg_code"
+ :label="item.torg_name"
+ :value="item.torg_code"
+ />
+ </el-select>
+ </el-form-item>
+
<el-form-item
label="浜у搧鍚嶇О/缂栫爜"
prop="partcode"
@@ -625,23 +670,25 @@
<el-input v-model="dialogForm.partspec" disabled style="width: 200px" />
</el-form-item>
<!-- :disabled="dialogForm.partcode===''"-->
- <el-form-item label="鎵�灞炶溅闂�" prop="wkshopcode">
+
+ <el-form-item v-if="mesSetting.route" label="宸ヨ壓璺嚎" prop="wkshopcode">
<el-select
- v-model="dialogForm.wkshopcode"
+ v-model="dialogForm.routecode"
filterable
:popper-append-to-body="false"
style="width: 200px;"
- placeholder="璇烽�夋嫨杞﹂棿"
- @change="getMesOrderNewStepContent"
+ placeholder="璇烽�夋嫨宸ヨ壓璺嚎"
+ @change="sourceType? getMesOrderNewStepContent():routecodeChange()"
>
<el-option
- v-for="item in wkshopArr"
- :key="item.torg_code"
- :label="item.torg_name"
- :value="item.torg_code"
+ v-for="item in routecodeArr"
+ :key="item.route_code"
+ :label="item.route_name"
+ :value="item.route_code"
/>
</el-select>
</el-form-item>
+
<el-form-item label="棰勮浜や粯鏃ユ湡" prop="deliverydate">
<el-date-picker
v-model="dialogForm.deliverydate"
@@ -655,6 +702,16 @@
placeholder="閫夋嫨鏃ユ湡"
/>
<!-- :disabled="dialogForm.deliverydate"-->
+ </el-form-item>
+ <el-form-item label="宸ュ簭鏉ユ簮" required>
+ <el-switch
+ v-model="sourceType"
+ style="width: 200px;"
+ inactive-text="鍩虹璁剧疆"
+ active-text="鍘嗗彶鏈�鏂�"
+ :disabled="!dialogForm.wkshopcode"
+ @change="sourceTypeChange"
+ />
</el-form-item>
<el-divider content-position="left">宸ュ簭淇℃伅</el-divider>
@@ -1990,11 +2047,12 @@
import Sortable from 'sortablejs'
import ElDragSelect from '@/components/DragSelect'
import { MesOrderPrintSearch } from '@/api/GridReport' // base on element-ui
-
+import DateType from '@/components/DateType'
+import { PartSelectRpute, RouteSelectStep } from '@/api/basicSettings'
export default {
name: 'WorkOrderList',
components: {
- Pagination, ElDragSelect
+ Pagination, ElDragSelect, DateType
},
directives: { elDragDialog, waves },
data() {
@@ -2017,7 +2075,9 @@
partname: '', // 浜у搧鍚嶇О
partspec: '', // 浜у搧瑙勬牸
creatuser: '', // 鍒涘缓浜哄憳
- createdate: '', // 鍒涘缓鏃堕棿
+ // createdate: '', // 鍒涘缓鏃堕棿
+ datatype: 'ED', // 鏃ユ湡绫诲瀷(璁″垝寮�宸�(PS)銆佽鍒掑畬宸�(PE)銆侀璁′氦浠�(ED)銆佸垱寤烘棩鏈�(CT))
+ timeValue: [], // 鏌ヨ鏃ユ湡
prop: 'lm_date', // 鎺掑簭瀛楁
order: 'desc', // 鎺掑簭瀛楁
page: 1, // 绗嚑椤�
@@ -2055,7 +2115,10 @@
deliverydate: '', // 浜や粯鏃堕棿
data_sources: '', // 鏁版嵁鏉ユ簮
- mesmaxqty: 0// 宸ュ崟鐨勬渶澶у��
+ routecode: '', // 宸ヨ壓璺嚎
+
+ mesmaxqty: 0, // 宸ュ崟鐨勬渶澶у��
+ mesqtyinit: 0// 宸ュ崟鏁伴噺鍒濆鍊�
},
ordertypeArr: [// 宸ュ崟绫诲瀷
{ code: 'PO', name: '鏍囧噯宸ュ崟' },
@@ -2240,7 +2303,21 @@
stepSelectArr: [], // 宸ュ簭涓嬫媺鏁版嵁
stepSelectedValue: [], // 涓嬫媺閫変腑鍊�
- multipleSelection: []
+ multipleSelection: [],
+
+ datatypeList: [
+ { code: 'PS', name: '棰勮寮�宸ユ棩鏈�' },
+ { code: 'PE', name: '棰勮瀹屽伐鏃ユ湡' },
+ { code: 'ED', name: '棰勮浜や粯鏃ユ湡' },
+ { code: 'CT', name: '宸ュ崟鍒涘缓鏃ユ湡' }
+ ],
+
+ routecodeArr: [], //
+
+ sourceType: false, // 宸ュ簭鐨勬暟鎹潵婧�
+
+ mesSetting: JSON.parse(localStorage.getItem('mesSetting'))
+
}
},
watch: {
@@ -2276,6 +2353,26 @@
// })
},
methods: {
+ // 宸ュ簭鏉ユ簮鍒囨崲
+ sourceTypeChange(val) {
+ this.stepTableData = []
+ if (val) {
+ this.getMesOrderNewStepContent()
+ } else {
+ if (this.mesSetting.route) {
+ this.routecodeChange()
+ } else {
+ this.getBasicProcessData()
+ }
+ }
+ },
+
+ DateTypeChange(value) {
+ this.form.datatype = value
+ },
+ cycleTimeChange(val) {
+ this.form.timeValue = val
+ },
setSort() {
const el = this.$refs.stepTableDataRef.$el.querySelectorAll('.el-table__body-wrapper > table > tbody')[0]
this.sortable = Sortable.create(el, {
@@ -2328,7 +2425,9 @@
sourceorder: this.form.sourceorder, // 婧愬崟鍗曞彿
saleordercode: this.form.saleordercode, // 閿�鍞鍗�
ordertype: this.form.ordertype, // 鍗曟嵁绫诲瀷
- createdate: this.form.createdate.toString().length > 0 ? handleDatetime(this.form.createdate) : '', // 鍒涘缓鏃堕棿
+ datatype: this.form.datatype,
+ searchdate: this.form.timeValue.join('~'),
+ // createdate: this.form.createdate.toString().length > 0 ? handleDatetime(this.form.createdate) : '', // 鍒涘缓鏃堕棿
prop: this.form.prop, // 鎺掑簭瀛楁
order: this.form.order, // 鎺掑簭瀛楁
page: this.form.page, // 绗嚑椤�
@@ -2400,7 +2499,12 @@
this.form.creatuser = ''
this.form.sourceorder = ''
this.form.ordertype = ''
- this.form.createdate = ''
+ // this.form.createdate = ''
+
+ this.form.timeValue = []
+ this.cycleTime = null
+ this.$refs.DateTypeRef.clearValue()
+
this.getMesOrderSearch()
},
// 鏂板鎸夐挳
@@ -2501,8 +2605,11 @@
this.dialogForm.partname = row.partname
this.dialogForm.partspec = row.partspec
this.dialogForm.wkshopcode = row.wkshp_code
+ this.dialogForm.routecode = row.route_code
this.dialogForm.deliverydate = row.saleOrderDeliveryDate.substring(0, 11)
this.dialogForm.mesqty = row.plan_qty
+
+ this.dialogForm.mesqtyinit = row.plan_qty
const data = {
sourceid: this.dialogForm.sourceorderid,
@@ -2513,38 +2620,78 @@
const { data: res } = await UpdateMesOrderStepSearch(data)
this.dialogForm.mesmaxqty = res.canupdate_qty
- if (res.stepdata.length > 0) {
- res.stepdata.forEach(i => {
- this.stepTableData.push(
- {
- stepcode: i.step_code,
- stepname: i.stepname,
- stepprice: i.stepprice
- }
- )
- })
- this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
- } else {
- const data2 = {
- wkshopcode: this.dialogForm.wkshopcode,
- partcode: this.dialogForm.partcode
+ if (this.mesSetting.route) { // 鎸夊伐鑹鸿矾绾胯蛋妯″紡
+ if (!this.dialogForm.routecode) {
+ await this.getPartcodeChangeDialog()
}
- const { data: res2 } = await MesOrderNewStepContent(data2)
- if (res2.length > 0) {
- res2.forEach(i => {
+
+ if (res.stepdata.length > 0) {
+ res.stepdata.forEach(i => {
this.stepTableData.push(
{
stepcode: i.step_code,
- // stepname: i.stepname,
+ stepname: i.stepname,
stepprice: i.stepprice
}
)
})
this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+ } else {
+ const data2 = {
+ wkshopcode: this.dialogForm.wkshopcode,
+ partcode: this.dialogForm.partcode
+ }
+ const { data: res2 } = await MesOrderNewStepContent(data2)
+ if (res2.length > 0) {
+ res2.forEach(i => {
+ this.stepTableData.push(
+ {
+ stepcode: i.step_code,
+ // stepname: i.stepname,
+ stepprice: i.stepprice
+ }
+ )
+ })
+ this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+ }
+ }
+ } else {
+ if (res.stepdata.length > 0) {
+ res.stepdata.forEach(i => {
+ this.stepTableData.push(
+ {
+ stepcode: i.step_code,
+ stepname: i.stepname,
+ stepprice: i.stepprice
+ }
+ )
+ })
+ this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+ } else {
+ await this.getBasicProcessData()
}
}
this.dialogVisible = true
+ this.$nextTick(() => {
+ this.setSort()
+ })
+ },
+ // 鎸夊伐搴忔ā寮忚蛋鐨勬椂鍊� 寮曠敤鍩虹璧勬枡 宸ヨ壓
+ async getBasicProcessData() {
+ const { data: res } = await PartSelectRpute({ partcode: this.dialogForm.partcode })
+ res.sort((a, b) => a.step_seq - b.step_seq)
+ this.stepTableData = []
+ res.forEach(i => {
+ this.stepTableData.push(
+ {
+ stepcode: i.step_code,
+ stepname: i.step_name,
+ stepprice: i.unprice
+ }
+ )
+ })
+ this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
},
// 宸ュ崟鍏抽棴浜嬩欢
orderClose() {
@@ -2556,12 +2703,64 @@
this.dialogForm.partname = this.partArr.find(item => item.partcode === val).partname
this.dialogForm.partcode = this.partArr.find(item => item.partcode === val).partcode
this.dialogForm.partspec = this.partArr.find(item => item.partcode === val).partspec
- if (this.dialogForm.wkshopcode) {
- this.getMesOrderNewStepContent()
+
+ this.dialogForm.routecode = ''
+
+ if (this.mesSetting.route) {
+ this.getPartcodeChangeDialog()
+ } else {
+ this.getBasicProcessData()
}
},
- async getMesOrderNewStepContent() {
+
+ async getPartcodeChangeDialog() {
+ const { data: res } = await PartSelectRpute({ partcode: this.dialogForm.partcode })
+ this.routecodeArr = res
+
+ // if (this.mesSetting.route) { // 鎸夊伐鑹鸿矾绾胯蛋妯″紡
+ this.dialogForm.routecode = this.partArr.find(item => item.partcode === this.dialogForm.partcode).default_route
+ if (this.dialogForm.routecode && !this.sourceType) {
+ await this.routecodeChange()
+ } else {
+ await this.getMesOrderNewStepContent()
+ }
+ // }
+ // else { // 鎸夊伐搴忚蛋妯″紡
+ // await this.getMesOrderNewStepContent()
+ // }
+ },
+ // 宸ヨ壓璺嚎鍊兼敼鍙�
+ async routecodeChange() {
const data = {
+ partcode: this.dialogForm.partcode,
+ routecode: this.dialogForm.routecode
+ }
+ const { data: res } = await RouteSelectStep(data)
+
+ this.stepSelectedValue = []
+ this.stepTableData = []
+ if (res.length > 0) {
+ res.sort((a, b) => a.step_seq - b.step_seq)
+ res.forEach(i => {
+ this.stepTableData.push(
+ {
+ stepcode: i.step_code,
+ // stepname: i.stepname,
+ stepprice: i.unprice
+ }
+ )
+ })
+ this.stepSelectedValue = this.stepTableData.map(i => i.stepcode)
+ }
+ },
+
+ async getMesOrderNewStepContent() {
+ // if (!this.mesSetting.route && this.operation === 'edit') {
+ // return
+ // }
+
+ const data = {
+ routecode: this.dialogForm.routecode,
wkshopcode: this.dialogForm.wkshopcode,
partcode: this.dialogForm.partcode
}
@@ -2603,6 +2802,9 @@
deliverydate: '', // 浜や粯鏃堕棿
data_sources: '' // 鏁版嵁鏉ユ簮
}
+
+ this.sourceType = false
+
this.stepSelectedValue = []
this.stepTableData = []
this.$refs.dialogForm.clearValidate()
@@ -2617,6 +2819,10 @@
if (valid) {
if (this.dialogForm.ordertype === 'FO' && this.dialogForm.sourceorder.toString().trim().length <= 0) {
return this.$message.info('婧愬崟鍗曞彿涓嶈兘涓虹┖锛�')
+ }
+
+ if (this.dialogForm.mesqty <= 0) {
+ return this.$message.info('宸ュ崟鏁伴噺涓嶈兘绛変簬闆讹紒')
}
if (this.dialogForm.data_sources === 'ERP' && this.dialogForm.mesmaxqty < this.dialogForm.mesqty) {
@@ -2652,6 +2858,8 @@
deliverydate: this.dialogForm.deliverydate, // 浜や粯鏃堕棿
data_sources: this.dialogForm.data_sources, // 鏁版嵁鏉ユ簮
isstep: workListSub.length > 0 ? 'Y' : 'N', //
+ difference: this.dialogForm.mesqty - this.dialogForm.mesqtyinit, // 鏁版嵁宸��
+ routecode: this.dialogForm.routecode,
workListSub
}
@@ -2660,11 +2868,11 @@
if (res.code === '200') {
this.dialogVisible = false
// this.handlePrint()
- this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '娲惧彂鎴愬姛锛�')
+ this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇濆瓨鎴愬姛锛�')
this.getMesOrderSearch()
this.$store.state.app.buttonIsDisabled = false
} else {
- this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '娲惧彂澶辫触锛�')
+ this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇濆瓨澶辫触锛�')
}
})
}
@@ -3484,3 +3692,9 @@
background: #f8f8fa;
}
</style>
+<style>
+.sortable-ghost{
+ opacity: .8;
+ color: #fff!important;
+ background: #42b983!important;
+}
--
Gitblit v1.9.3