| | |
| | | <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="工单数" |
| | |
| | | /> |
| | | <!-- 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" |
| | |
| | | <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" |
| | |
| | | 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> |
| | |
| | | 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: { |
| | |
| | | deliverydate: '', // 交付时间 |
| | | data_sources: '', // 数据来源 |
| | | |
| | | mesmaxqty: 0// 工单的最大值 |
| | | routecode: '', // 工艺路线 |
| | | |
| | | mesmaxqty: 0, // 工单的最大值 |
| | | mesqtyinit: 0// 工单数量初始值 |
| | | }, |
| | | ordertypeArr: [// 工单类型 |
| | | { code: 'PO', name: '标准工单' }, |
| | |
| | | { code: 'PE', name: '预计完工日期' }, |
| | | { code: 'ED', name: '预计交付日期' }, |
| | | { code: 'CT', name: '工单创建日期' } |
| | | ] |
| | | ], |
| | | |
| | | routecodeArr: [], // |
| | | |
| | | sourceType: false, // 工序的数据来源 |
| | | |
| | | mesSetting: JSON.parse(localStorage.getItem('mesSetting')) |
| | | |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | // }) |
| | | }, |
| | | 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 |
| | | }, |
| | |
| | | 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, |
| | |
| | | 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() { |
| | |
| | | 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 |
| | | } |
| | |
| | | deliverydate: '', // 交付时间 |
| | | data_sources: '' // 数据来源 |
| | | } |
| | | |
| | | this.sourceType = false |
| | | |
| | | this.stepSelectedValue = [] |
| | | this.stepTableData = [] |
| | | this.$refs.dialogForm.clearValidate() |
| | |
| | | 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) { |
| | |
| | | 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 |
| | | } |
| | | |
| | |
| | | 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' ? '添加失败!' : '保存失败!') |
| | | } |
| | | }) |
| | | } |
| | |
| | | background: #f8f8fa; |
| | | } |
| | | </style> |
| | | <style> |
| | | .sortable-ghost{ |
| | | opacity: .8; |
| | | color: #fff!important; |
| | | background: #42b983!important; |
| | | } |