init project

This commit is contained in:
2022-06-27 09:50:26 +08:00
parent b3fcd339ea
commit b5da790c94
644 changed files with 94073 additions and 0 deletions

View File

@@ -0,0 +1,897 @@
<template>
<el-dialog
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
:show-close="false"
fullscreen
@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">
<!--左侧插槽-->
<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-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" size="mini" label-width="115px" label-suffix=":">
<el-form-item label="配方号" prop="formula_code">
<label slot="label">&nbsp;&nbsp;&nbsp;:</label>
<el-input v-model="form.formula_code" disabled style="width: 210px" />
</el-form-item>
<el-form-item label="产品" prop="material_code">
<label slot="label">产品:</label>
<el-input v-model="form.material_code" disabled style="width: 210px" />
</el-form-item>
<el-form-item label="批次" prop="pcsn">
<label slot="label">批次:</label>
<el-input v-model="form.pcsn" style="width: 210px" disabled />
</el-form-item>
<el-form-item label="工令号" prop="workorder_code">
<label slot="label">&nbsp;&nbsp;&nbsp;:</label>
<el-input v-model="form.workorder_code" disabled style="width: 210px" />
</el-form-item>
<el-form-item label="工令类型" prop="workorder_type">
<el-select
v-model="form.workorder_type"
placeholder="工令类型"
style="width: 210px"
disabled
class="filter-item"
>
<el-option
v-for="item in dict.workorder_type"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="桶类型" prop="bucket_type">
<el-select
v-model="form.bucket_type"
placeholder="桶类型"
disabled
style="width: 210px"
class="filter-item"
>
<el-option
v-for="item in dict.bucket_type"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="碳平衡" prop="c_balance">
<label slot="label">碳平衡:</label>
<el-input-number
v-model="form.c_balance"
:controls="false"
:precision="3"
:min="1"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="软废含量%" prop="total_qty">
<label slot="label">软废含量%:</label>
<el-input-number
v-model="form.waste_limit_down"
:controls="false"
:precision="0"
:min="0"
:max="100"
disabled
style="width: 90px"
/>
----
<el-input-number
v-model="form.waste_limit_up"
:controls="false"
:precision="0"
:min="0"
:max="100"
disabled
style="width: 90px"
/>
</el-form-item>
<el-form-item label="是否二次投料" prop="is_again_put">
<el-select
v-model="form.is_again_put"
style="width: 210px"
placeholder="是否二次投料"
class="filter-item"
disabled
>
<el-option
v-for="item in dict.is_again_put"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="配粉槽" prop="storagevehicle_code">
<label slot="label">&nbsp;&nbsp;&nbsp;:</label>
<el-input v-model="form.storagevehicle_code" disabled style="width: 210px" />
</el-form-item>
<el-form-item label="配粉模式" prop="formula_type">
<el-select
v-model="form.formula_type"
placeholder="配粉模式"
style="width: 210px"
class="filter-item"
disabled
>
<el-option
v-for="item in dict.formula_type"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<label slot="label">备注:</label>
<el-input v-model="form.remark" disabled style="width: 210px" />
</el-form-item>
</el-form>
<div class="crud-opts2">
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
:disabled="button1"
@click="allCancel()"
>
添加新料
</el-button>
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
:disabled="button2"
@click="allCancel2()"
>
添加软废
</el-button>
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
:disabled="button1"
@click="openYzj"
>
添加抑制剂
</el-button>
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
:disabled="button1"
@click="openStructIvt"
>
添加分类
</el-button>
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
:disabled="button1"
@click="openCxj"
>
添加成型剂
</el-button>
</span>
</div>
<div class="crud-opts2">
<span class="role-span">物料明细</span>
<div class="crud-opts-form">
<el-form ref="form" :inline="true" :model="form2" size="mini">
<el-form-item label="重量" prop="workorder_qty">
<el-input-number
v-model="form2.workorder_qty"
:controls="false"
:precision="3"
:min="0"
disabled
/>
</el-form-item>
<el-form-item label="已开单重量" prop="bill_qty">
<el-input-number
v-model="form2.bill_qty"
:controls="false"
:precision="3"
:min="0"
disabled
/>
</el-form-item>
<el-form-item label="配粉重量" prop="total_qty1">
<el-input-number
v-model="form2.total_qty1"
:controls="false"
:precision="3"
:min="0"
disabled
/>
</el-form-item>
<el-form-item label="添加物料重量" prop="add_qty1">
<el-input-number
v-model="form2.add_qty1"
:controls="false"
:precision="3"
:min="0"
disabled
/>
</el-form-item>
</el-form>
</div>
</div>
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}">
<!--表格渲染-->
<el-table
ref="table"
:data="tableDtl"
style="width: 100%;"
max-height="400"
border
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column prop="status" label="状态" align="center" width="60px" :formatter="statusFormat" />
<el-table-column prop="bucket_type" label="桶类型" align="center" width="60px" :formatter="bucket_typeFormat" />
<el-table-column prop="material_code" label="物料编码" align="center" width="150px" />
<el-table-column prop="material_name" label="物料名称" align="center" width="150px" />
<el-table-column prop="material_type" label="物料类别" align="center" :formatter="material_typeFormat" />
<el-table-column prop="pcsn" label="批次号" align="center" width="70px" />
<el-table-column prop="quality_scode" label="品质类型" align="center" width="70px" :formatter="quality_scodeFormat" />
<el-table-column prop="ivt_level" label="库存等级" align="center" width="70px" :formatter="ivt_levelFormat" />
<el-table-column prop="is_active" label="是否可用" align="center" width="70px" :formatter="is_activeFormat" />
<el-table-column prop="seq_no" label="配粉顺序号" align="center" width="85px" />
<el-table-column prop="formula_qty" label="重量(KG)" :formatter="crud.formatNum3" width="150" align="center">
<template scope="scope">
<el-input-number v-model="scope.row.formula_qty" :disabled="scope.row.edit" :precision="3" :controls="false" :min="0" :max="is_rf_xl(scope.row)" style="width: 120px" />
</template>
</el-table-column>
<el-table-column prop="need_sum_qty" label="需配重量(KG)" :formatter="crud.formatNum3" align="center" />
<el-table-column prop="sum_ivt_qty" label="库存重量(KG)" :formatter="crud.formatNum3" align="center" />
<el-table-column prop="is_need_manage" label="是否配粉" align="center" width="70px" :formatter="is_need_manageFormat" />
<el-table-column prop="is_need_move" label="是否移库" align="center" width="70px" :formatter="is_need_moveFormat" />
<el-table-column prop="is_add" label="是否补料" align="center" width="70px" :formatter="is_addFormat" />
<el-table-column prop="is_tan" label="碳%" align="center" width="80px" :formatter="crud.formatQlNum4" />
<el-table-column prop="is_09030102" label="钴%" align="center" width="80px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ001" label="石蜡" align="center" width="80px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ002" label="G3蜡" align="center" width="80px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ003" label="PEG2000" align="center" width="80px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ004" label="PVAC" align="center" width="80px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ005" label="SBP" align="center" width="80px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ006" label="白油" align="center" width="80px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ007" label="油酸" align="center" width="80px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ008" label="8号分散剂" align="center" width="80px" :formatter="crud.formatQlNum4"/>
<el-table-column align="center" label="操作" width="270" fixed="right">
<template scope="scope">
<el-button :disabled="scope.row.edit || scope.row.status!='10'" type="danger" class="filter-item" size="mini" icon="el-icon-delete" @click.native.prevent="deleteRow(scope.$index,tableDtl)" />
<el-button v-show="!scope.row.edit" :disabled="scope.row.status!='10'" type="primary" class="filter-item" size="mini" icon="el-icon-edit" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
<el-button v-show="scope.row.edit" :disabled="scope.row.status!='10'" type="success" class="filter-item" size="mini" icon="el-icon-check" @click="handleEdit(scope.$index, scope.row)">完成</el-button>
<el-button
type="primary" class="filter-item"
size="mini"
icon="el-icon-top"
@click="moveUp(scope.$index, scope.row)"
>
</el-button>
<el-button
type="primary" class="filter-item"
size="mini"
icon="el-icon-bottom"
@click="moveDown(scope.$index, scope.row)"
>
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<StructIvt :dialog-show.sync="structshow" :rowmst="form" @StructIvtClosed="queryTableDtl" />
<StructIvt2 :dialog-show.sync="structshow2" :rowmst="form" @StructIvtClosed="queryTableDtl2" />
<StructIvt3 :dialog-show.sync="structshow4" :rowmst="form" @StructIvtClosed="queryTableDtl4" />
<StructIvt4 :dialog-show.sync="structshow5" :rowmst="form" @StructIvtClosed="queryTableDtl5" />
<materTypeDialog :dialog-show.sync="structshow3" @StructIvtClosed="queryTableDtl3" />
</el-dialog>
</template>
<script>
import CRUD, { crud } from '@crud/crud'
import StructIvt from '@/views/wms/pf/initformula/StructIvt'
import StructIvt2 from '@/views/wms/pf/initformula/StructIvt2'
import StructIvt3 from '@/views/wms/pf/initformula/StructIvt3'
import StructIvt4 from '@/views/wms/pf/initformula/StructIvt4'
import materTypeDialog from '@/views/wms/pf/initformula/materTypeDialog'
import formula from '@/api/wms/pf/formula'
export default {
name: 'DivDialog',
components: { StructIvt, StructIvt2,StructIvt3, StructIvt4, materTypeDialog },
mixins: [crud()],
dicts: ['material_type', 'workorder_type', 'formula_type', 'ST_QUALITY_SCODE', 'ST_IVT_LEVEL', 'is_used', 'is_again_put', 'is_usable', 'bucket_type','formuladtl_status'],
props: {
dialogShow: {
type: Boolean,
default: false
},
rowmst: {
type: Object
}
},
data() {
return {
dialogVisible: false,
structshow: false,
structshow2: false,
structshow3: false,
structshow4: false,
structshow5: false,
button1: true,
button2: true,
tableDtl: [],
mstrow: {},
form: {},
form2: {
workorder_qty: '0',
bill_qty: '0',
total_qty1: '0',
add_qty1: '0'
}
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
},
rowmst: {
handler(newValue, oldValue) {
this.mstrow = newValue
}
}
},
methods: {
open() {
formula.getform({ 'formula_id': this.mstrow.formula_id }).then(res => {
this.form = res.material
this.form2.workorder_qty = this.form.workorder_qty
this.form2.bill_qty = this.form.bill_qty
if (this.form.bucket_type === '01') {
this.button1 = false
this.button2 = false
} else {
this.button1 = true
this.button2 = false
}
this.tableDtl = res.tableDtl
this.form2.total_qty1 = 0
this.form2.add_qty1 = 0
for (let i = 0; i < this.tableDtl.length; i++) {
const row = this.tableDtl[i]
row.edit = true
row.is_new = '0'
if (row.is_need_manage === '1') {
this.form2.total_qty1 = this.form2.total_qty1 + parseFloat(row.formula_qty)
} else {
this.form2.add_qty1 = this.form2.add_qty1 + parseFloat(row.formula_qty)
}
this.tableDtl.splice(i, 1, row)
}
})
},
close() {
this.tableDtl = []
this.$emit('DivChanged')
this.$emit('update:dialogShow', false)
},
bucket_typeFormat(row, column) {
return this.dict.label.bucket_type[row.bucket_type]
},
quality_scodeFormat(row, column) {
return this.dict.label.ST_QUALITY_SCODE[row.quality_scode]
},
statusFormat(row, column) {
return this.dict.label.formuladtl_status[row.status]
},
ivt_levelFormat(row, column) {
return this.dict.label.ST_IVT_LEVEL[row.ivt_level]
},
is_activeFormat(row, column) {
return this.dict.label.is_usable[row.is_active]
},
material_typeFormat(row, column) {
return this.dict.label.material_type[row.material_type]
},
is_need_moveFormat(row, column) {
if (row.is_need_move === '') {
return '否'
} else {
return this.dict.label.is_again_put[row.is_need_move]
}
},
is_need_manageFormat(row, column) {
return this.dict.label.is_again_put[row.is_need_manage]
},
is_addFormat(row, column) {
return this.dict.label.is_again_put[row.is_add]
},
openStructIvt() {
this.structshow3 = true
},
moveUp(index, item) {
if (index > 0) {
const upDate = this.tableDtl[index - 1]
this.tableDtl.splice(index - 1, 1)
this.tableDtl.splice(index, 0, upDate)
} else {
this.$message.error('已经是第一条,不可上移')
}
},
moveDown(index, item) {
if ((index + 1) === this.tableDtl.length) {
this.$message.error('已经是最后一条,不可下移')
} else {
console.log(index)
const downDate = this.tableDtl[index + 1]
this.tableDtl.splice(index + 1, 1)
this.tableDtl.splice(index, 0, downDate)
}
},
deleteRow(index, rows) {
this.$confirm('是否删除?')
.then(_ => {
rows.splice(index, 1)
this.form2.total_qty1 = 0
this.form2.add_qty1 = 0
this.tableDtl.forEach((item) => {
if (item.is_need_manage === '1') {
this.form2.total_qty1 = this.form2.total_qty1 + item.formula_qty
} else {
this.form2.add_qty1 = this.form2.add_qty1 + item.formula_qty
}
})
})
.catch(_ => {
})
},
allCancel() {
this.structshow = true
},
allCancel2() {
this.structshow2 = true
},
openCxj() {
this.structshow4 = true
},
openYzj() {
this.structshow5 = true
},
handleEdit(index, row) {
if (row.formula_qty === 0) {
this.crud.notify('重量不能为0')
return false
}
row.edit = !row.edit
this.tableDtl.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
if (row.edit) {
this.form2.total_qty1 = 0
this.form2.add_qty1 = 0
this.tableDtl.forEach((item) => {
if (item.is_need_manage === '1') {
this.form2.total_qty1 = this.form2.total_qty1 + item.formula_qty
} else {
this.form2.add_qty1 = this.form2.add_qty1 + item.formula_qty
}
})
}
},
queryTableDtl5(rows) {
const tablemap = new Map()
rows.forEach((item) => {
if (this.tableDtl.length !== 0) {
this.flagnow = false
for (let i = 0; i < this.tableDtl.length; i++) {
// ----就物料、批次、品质类型、等级、是否可用
if (this.tableDtl[i].material_id === item.material_id && this.tableDtl[i].status === '10') {
this.crud.notify('该物料明细'+item.material_code+'已存在,请修改重量!')
this.flagnow = true
}
}
if (!this.flagnow) {
const row = { edit: false, status:'10', is_rf_xl: '0',bucket_type: '01', material_type: '01', material_id: '', material_code: '',
material_name: '', pcsn: '', is_add: '1',need_sum_qty:'0',quality_scode: '01', ivt_level: '01', is_active: '1', formula_qty: '0', sum_ivt_qty: '', is_need_move: '0', is_need_manage: '1', is_tan: '', is_09030102: '', is_CXJ001: '', is_CXJ003: '',is_CXJ004: '',is_CXJ005: '',is_CXJ006: '',is_CXJ007: '',is_CXJ008: '',is_CXJ002: '',
qty_unit_id: '', qty_unit_name: '' }
row.material_id = item.material_id
row.is_need_move = item.is_need_move
row.is_need_manage = item.is_need_manage
row.material_name = item.material_name
row.material_code = item.material_code
row.qty_unit_id = item.qty_unit_id
row.qty_unit_name = item.qty_unit_name
row.sum_ivt_qty = item.sum_ivt_qty
row.need_sum_qty = item.need_sum_qty
row.formula_qty = item.need_sum_qty
row.is_CXJ001 = item.is_CXJ001
row.is_CXJ003 = item.is_CXJ003
row.is_CXJ004 = item.is_CXJ004
row.is_CXJ005 = item.is_CXJ005
row.is_CXJ006 = item.is_CXJ006
row.is_CXJ007 = item.is_CXJ007
row.is_CXJ008 = item.is_CXJ008
row.is_CXJ002 = item.is_CXJ002
tablemap.set(item.material_id, row)
}
} else {
const row = { edit: false, status:'10', is_rf_xl: '0',bucket_type: '01', material_type: '01', material_id: '', material_code: '',
material_name: '', pcsn: '', is_add: '1', need_sum_qty:'0',quality_scode: '01', ivt_level: '01', is_active: '1', formula_qty: '0', sum_ivt_qty: '', is_need_move: '0', is_need_manage: '1', is_tan: '', is_09030102: '',is_CXJ001: '', is_CXJ003: '',is_CXJ004: '',is_CXJ005: '',is_CXJ006: '',is_CXJ007: '',is_CXJ008: '',is_CXJ002: '',
qty_unit_id: '', qty_unit_name: '' }
row.material_id = item.material_id
row.is_need_move = item.is_need_move
row.is_need_manage = item.is_need_manage
row.material_name = item.material_name
row.material_code = item.material_code
row.qty_unit_id = item.qty_unit_id
row.qty_unit_name = item.qty_unit_name
row.sum_ivt_qty = item.sum_ivt_qty
row.need_sum_qty = item.need_sum_qty
row.formula_qty = item.need_sum_qty
row.is_CXJ001 = item.is_CXJ001
row.is_CXJ003 = item.is_CXJ003
row.is_CXJ004 = item.is_CXJ004
row.is_CXJ005 = item.is_CXJ005
row.is_CXJ006 = item.is_CXJ006
row.is_CXJ007 = item.is_CXJ007
row.is_CXJ008 = item.is_CXJ008
row.is_CXJ002 = item.is_CXJ002
tablemap.set(item.material_id, row)
}
})
for (const value of tablemap.values()) {
this.tableDtl.push(value)
}
},
queryTableDtl4(rows) {
const tablemap = new Map()
rows.forEach((item) => {
if (this.tableDtl.length !== 0) {
this.flagnow = false
for (let i = 0; i < this.tableDtl.length; i++) {
// ----就物料、批次、品质类型、等级、是否可用
if (this.tableDtl[i].material_id === item.material_id && this.tableDtl[i].status === '10') {
this.crud.notify('该物料明细'+item.material_code+'已存在,请修改重量!')
this.flagnow = true
}
}
if (!this.flagnow) {
const row = { edit: false, status:'10', is_rf_xl: '0',bucket_type: '01', material_type: '01', material_id: '', material_code: '',
material_name: '', pcsn: '', is_add: '1',need_sum_qty:'0', quality_scode: '01', ivt_level: '01', is_active: '1', formula_qty: '0', sum_ivt_qty: '', is_need_move: '0', is_need_manage: '0', is_tan: '', is_09030102: '', is_CXJ001: '', is_CXJ003: '',is_CXJ004: '',is_CXJ005: '',is_CXJ006: '',is_CXJ007: '',is_CXJ008: '',is_CXJ002: '',
qty_unit_id: '', qty_unit_name: '' }
row.material_id = item.material_id
row.is_need_move = item.is_need_move
row.material_name = item.material_name
row.material_code = item.material_code
row.qty_unit_id = item.qty_unit_id
row.qty_unit_name = item.qty_unit_name
row.sum_ivt_qty = item.sum_ivt_qty
row.need_sum_qty = item.need_sum_qty
row.formula_qty = item.need_sum_qty
row.is_CXJ001 = item.is_CXJ001
row.is_CXJ003 = item.is_CXJ003
row.is_CXJ004 = item.is_CXJ004
row.is_CXJ005 = item.is_CXJ005
row.is_CXJ006 = item.is_CXJ006
row.is_CXJ007 = item.is_CXJ007
row.is_CXJ008 = item.is_CXJ008
row.is_CXJ002 = item.is_CXJ002
tablemap.set(item.material_id, row)
}
} else {
const row = { edit: false, status:'10', is_rf_xl: '0',bucket_type: '01', material_type: '01', material_id: '', material_code: '',
material_name: '', pcsn: '', is_add: '1', need_sum_qty:'0',quality_scode: '01', ivt_level: '01', is_active: '1', formula_qty: '0', sum_ivt_qty: '', is_need_move: '0', is_need_manage: '0', is_tan: '', is_09030102: '',is_CXJ001: '', is_CXJ003: '',is_CXJ004: '',is_CXJ005: '',is_CXJ006: '',is_CXJ007: '',is_CXJ008: '',is_CXJ002: '',
qty_unit_id: '', qty_unit_name: '' }
row.material_id = item.material_id
row.is_need_move = item.is_need_move
row.material_name = item.material_name
row.material_code = item.material_code
row.qty_unit_id = item.qty_unit_id
row.qty_unit_name = item.qty_unit_name
row.sum_ivt_qty = item.sum_ivt_qty
row.need_sum_qty = item.need_sum_qty
row.formula_qty = item.need_sum_qty
row.is_CXJ001 = item.is_CXJ001
row.is_CXJ003 = item.is_CXJ003
row.is_CXJ004 = item.is_CXJ004
row.is_CXJ005 = item.is_CXJ005
row.is_CXJ006 = item.is_CXJ006
row.is_CXJ007 = item.is_CXJ007
row.is_CXJ008 = item.is_CXJ008
row.is_CXJ002 = item.is_CXJ002
tablemap.set(item.material_id, row)
}
})
for (const value of tablemap.values()) {
this.tableDtl.push(value)
}
},
queryTableDtl3(rows) {
const tablemap = new Map()
rows.forEach((item) => {
if (this.tableDtl.length !== 0) {
this.flagnow = false
for (let i = 0; i < this.tableDtl.length; i++) {
// ----就物料、批次、品质类型、等级、是否可用
if (this.tableDtl[i].material_id === item.class_id && this.tableDtl[i].status === '10') {
this.crud.notify('该物料明细'+item.material_code+'已存在,请修改重量!')
this.flagnow = true
}
}
if (!this.flagnow) {
const row = { edit: false, status:'10', is_rf_xl: '0', bucket_type: '01', material_type: '02', material_id: '', material_code: '',
material_name: '', pcsn: '', quality_scode: '01', ivt_level: '01', is_active: '1', formula_qty: '0', sum_ivt_qty: '0', is_need_move: '0', is_need_manage: '1', is_tan: '', is_add: '1', is_09030102: '', qty_unit_id: '', qty_unit_name: '' }
row.material_id = item.class_id
row.material_code = item.class_code
row.material_name = item.class_name
if(row.material_id==='1503644362788179968'){
row.is_tan = '100.0'
}else if(row.material_id==='1503644362192588800'){
row.is_09030102 = '100.0'
}
tablemap.set(item.class_id, row)
}
} else {
const row = { edit: false,status:'10', is_rf_xl: '0', bucket_type: '01', material_type: '02', material_id: '', material_code: '',
material_name: '', pcsn: '',quality_scode: '01', ivt_level: '01', is_active: '1', formula_qty: '0', sum_ivt_qty: '0', is_need_move: '0', is_need_manage: '1', is_tan: '', is_add: '1', is_09030102: '', qty_unit_id: '', qty_unit_name: '' }
row.material_id = item.class_id
row.material_code = item.class_code
row.material_name = item.class_name
if(row.material_id==='1503644362788179968'){
row.is_tan = '100.0'
}else if(row.material_id==='1503644362192588800'){
row.is_09030102 = '100.0'
}
tablemap.set(item.class_id, row)
}
})
for (const value of tablemap.values()) {
this.tableDtl.push(value)
}
},
queryTableDtl2(rows) {
if (this.form.bucket_type === '01') {
this.queryTableDtl(rows)
} else {
const tablemap = new Map()
rows.forEach((item) => {
if (this.tableDtl.length !== 0) {
this.flagnow = false
for (let i = 0; i < this.tableDtl.length; i++) {
// ----就物料、批次、品质类型、等级、是否可用
if (this.tableDtl[i].material_id === item.material_id
&& this.tableDtl[i].pcsn === item.pcsn
&& this.tableDtl[i].is_active === item.is_active
&& this.tableDtl[i].ivt_level === item.ivt_level
&& this.tableDtl[i].status === '10'
&& this.tableDtl[i].quality_scode === item.quality_scode ) {
this.crud.notify('该物料明细'+item.material_code+'已存在,请修改重量!')
this.flagnow = true
}
}
if (!this.flagnow) {
const row = { edit: false, status:'10', is_rf_xl: '1', bucket_type: '02', material_type: '01', material_id: '', material_code: '',
material_name: '', pcsn: '', quality_scode: '', ivt_level: '', is_active: '', formula_qty: '0', sum_ivt_qty: '', is_need_move: '', is_need_manage: '1', is_add: '1',is_tan: '', is_09030102: '', is_CXJ001: '',
is_CXJ003: '',is_CXJ004: '',is_CXJ005: '',is_CXJ006: '',is_CXJ007: '',is_CXJ008: '',is_CXJ002: '',
qty_unit_id: '', qty_unit_name: '' }
row.material_id = item.material_id
row.quality_scode = item.quality_scode
row.pcsn = item.pcsn
row.material_name = item.material_name
row.material_code = item.material_code
row.ivt_level = item.ivt_level
row.is_active = item.is_active
row.sum_ivt_qty = item.sum_ivt_qty
row.is_need_move = item.is_need_move
row.qty_unit_id = item.qty_unit_id
row.qty_unit_name = item.qty_unit_name
row.is_tan = item.is_tan
row.is_09030102 = item.is_09030102
row.is_CXJ001 = item.is_CXJ001
row.is_CXJ003 = item.is_CXJ003
row.is_CXJ004 = item.is_CXJ004
row.is_CXJ005 = item.is_CXJ005
row.is_CXJ006 = item.is_CXJ006
row.is_CXJ007 = item.is_CXJ007
row.is_CXJ008 = item.is_CXJ008
row.is_CXJ002 = item.is_CXJ002
tablemap.set(item.material_id+"--"+item.quality_scode+"--"+item.pcsn+"--"+item.is_active+"--"+item.ivt_level, row)
}
} else {
const row = { edit: false, status:'10', is_rf_xl: '1', bucket_type: '02', material_type: '01', material_id: '', material_code: '',
material_name: '', pcsn: '', quality_scode: '', ivt_level: '', is_active: '', formula_qty: '0', sum_ivt_qty: '', is_need_move: '', is_need_manage: '1', is_add: '1', is_tan: '', is_09030102: '', is_CXJ001: '',
is_CXJ003: '',is_CXJ004: '',is_CXJ005: '',is_CXJ006: '',is_CXJ007: '',is_CXJ008: '',is_CXJ002: '',
qty_unit_id: '', qty_unit_name: '' }
row.material_id = item.material_id
row.quality_scode = item.quality_scode
row.pcsn = item.pcsn
row.material_name = item.material_name
row.material_code = item.material_code
row.ivt_level = item.ivt_level
row.is_active = item.is_active
row.sum_ivt_qty = item.sum_ivt_qty
row.is_need_move = item.is_need_move
row.qty_unit_id = item.qty_unit_id
row.qty_unit_name = item.qty_unit_name
row.is_tan = item.is_tan
row.is_09030102 = item.is_09030102
row.is_CXJ001 = item.is_CXJ001
row.is_CXJ003 = item.is_CXJ003
row.is_CXJ004 = item.is_CXJ004
row.is_CXJ005 = item.is_CXJ005
row.is_CXJ006 = item.is_CXJ006
row.is_CXJ007 = item.is_CXJ007
row.is_CXJ008 = item.is_CXJ008
row.is_CXJ002 = item.is_CXJ002
tablemap.set(item.material_id+"--"+item.quality_scode+"--"+item.pcsn+"--"+item.is_active+"--"+item.ivt_level, row)
}
})
for (const value of tablemap.values()) {
this.tableDtl.push(value)
}
}
},
queryTableDtl(rows) {
const tablemap = new Map()
rows.forEach((item) => {
if (this.tableDtl.length !== 0) {
this.flagnow = false
for (let i = 0; i < this.tableDtl.length; i++) {
// ----就物料、批次、品质类型、等级、是否可用
if (this.tableDtl[i].material_id === item.material_id
&& this.tableDtl[i].pcsn === item.pcsn
&& this.tableDtl[i].is_active === item.is_active
&& this.tableDtl[i].ivt_level === item.ivt_level
&& this.tableDtl[i].status === '10'
&& this.tableDtl[i].quality_scode === item.quality_scode ) {
this.crud.notify('该物料明细'+item.material_code+'已存在,请修改重量!')
this.flagnow = true
}
}
if (!this.flagnow) {
const row = { edit: false, status:'10', is_rf_xl: '1', bucket_type: '01', material_type: '01', material_id: '', material_code: '',
material_name: '', pcsn: '', quality_scode: '',need_sum_qty:'0', ivt_level: '', is_active: '', formula_qty: '0', sum_ivt_qty: '', is_need_move: '', is_need_manage: '1', is_add: '1', is_tan: '', is_09030102: '', qty_unit_id: '', qty_unit_name: '' }
row.material_id = item.material_id
row.quality_scode = item.quality_scode
row.pcsn = item.pcsn
row.material_name = item.material_name
row.material_code = item.material_code
row.sum_ivt_qty = item.sum_ivt_qty
row.need_sum_qty = item.need_sum_qty
row.formula_qty = item.need_sum_qty
row.ivt_level = item.ivt_level
row.is_active = item.is_active
row.is_tan = item.is_tan
row.is_09030102 = item.is_09030102
row.is_CXJ001 = item.is_CXJ001
row.is_CXJ003 = item.is_CXJ003
row.is_CXJ004 = item.is_CXJ004
row.is_CXJ005 = item.is_CXJ005
row.is_CXJ006 = item.is_CXJ006
row.is_CXJ007 = item.is_CXJ007
row.is_CXJ008 = item.is_CXJ008
row.is_CXJ002 = item.is_CXJ002
row.sum_ivt_qty = item.sum_ivt_qty
row.is_need_move = item.is_need_move
row.qty_unit_id = item.qty_unit_id
row.qty_unit_name = item.qty_unit_name
tablemap.set(item.material_id+"--"+item.quality_scode+"--"+item.pcsn+"--"+item.is_active+"--"+item.ivt_level, row)
}
} else {
const row = { edit: false, status:'10', is_rf_xl: '1', bucket_type: '01', material_type: '01', material_id: '', material_code: '',
material_name: '', pcsn: '', quality_scode: '',need_sum_qty:'0', ivt_level: '', is_active: '', formula_qty: '0', sum_ivt_qty: '', is_need_move: '', is_need_manage: '1', is_add: '1', is_tan: '', is_09030102: '', qty_unit_id: '', qty_unit_name: '' }
row.material_id = item.material_id
row.quality_scode = item.quality_scode
row.pcsn = item.pcsn
row.sum_ivt_qty = item.sum_ivt_qty
row.need_sum_qty = item.need_sum_qty
row.formula_qty = item.need_sum_qty
row.material_name = item.material_name
row.material_code = item.material_code
row.ivt_level = item.ivt_level
row.is_tan = item.is_tan
row.is_09030102 = item.is_09030102
row.is_CXJ001 = item.is_CXJ001
row.is_CXJ003 = item.is_CXJ003
row.is_CXJ004 = item.is_CXJ004
row.is_CXJ005 = item.is_CXJ005
row.is_CXJ006 = item.is_CXJ006
row.is_CXJ007 = item.is_CXJ007
row.is_CXJ008 = item.is_CXJ008
row.is_CXJ002 = item.is_CXJ002
row.is_active = item.is_active
row.sum_ivt_qty = item.sum_ivt_qty
row.is_need_move = item.is_need_move
row.qty_unit_id = item.qty_unit_id
row.qty_unit_name = item.qty_unit_name
tablemap.set(item.material_id+"--"+item.quality_scode+"--"+item.pcsn+"--"+item.is_active+"--"+item.ivt_level, row)
}
})
for (const value of tablemap.values()) {
this.tableDtl.push(value)
}
},
is_rf_xl(row){
let maxNum = 9999999999.0
if(row.is_rf_xl === '1'){
return parseFloat(row.sum_ivt_qty).toFixed(3)
}else{
return parseFloat(maxNum).toFixed(3)
}
},
submit() {
if (this.tableDtl.length === 0) {
this.crud.notify('明细不能为空!')
return false
}
for (let i = 0; i < this.tableDtl.length; i++) {
if (!this.tableDtl[i].edit) {
this.crud.notify('尚有未完成编辑的副桶物料,明细序号为' + (i + 1) + '请检查!')
return false
}
}
this.form.tableDtl = this.tableDtl
formula.submit(this.form).then(res => {
this.crud.notify('操作成功!')
this.$emit('DivChanged')
this.$emit('update:dialogShow', false)
})
}
}
}
</script>
<style>
.crud-opts2 {
padding: 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .el-dialog__title2 {
line-height: 24px;
font-size:20px;
color:#303133;
}
.crud-opts2 .role-span {
padding: 10px 0px 10px 0px;
}
.crud-opts2 .crud-opts-form {
padding: 10px 0px 0px 20px;
}
</style>

View File

@@ -0,0 +1,196 @@
<template>
<el-dialog
title="记录卡查看"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
:show-close="true"
fullscreen
@close="close"
@open="open"
>
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<!-- <el-input v-model="query.formula_id" clearable size="mini" placeholder="物料id" disabled style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />-->
</div>
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="warning"
icon="el-icon-check"
size="mini"
:loading="fla"
:disabled="crud.selections.length !== 1"
@click="printCard"
>
打印
</el-button>
</crudOperation>
</div>
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="55" />
<el-table-column prop="name" label="文件名(点击可下载)" width="280">
<template slot-scope="scope">
<el-popover
:content="'file/' + scope.row.type + '/' + scope.row.real_name"
placement="top-start"
title="路径"
width="200"
trigger="hover"
>
<a
slot="reference"
:href="baseApi + '/file/' + scope.row.type + '/' + scope.row.real_name"
class="el-link--primary"
style="word-break:keep-all;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color: #1890ff;font-size: 13px;"
target="_blank"
>
{{ scope.row.name }}
</a>
</el-popover>
</template>
</el-table-column>
<el-table-column prop="path" label="预览图">
<template slot-scope="scope">
<el-image
:src=" baseApi + '/file/' + scope.row.type + '/' + scope.row.real_name"
:preview-src-list="[baseApi + '/file/' + scope.row.type + '/' + scope.row.real_name]"
fit="contain"
lazy
class="el-avatar"
>
<div slot="error">
<i class="el-icon-document" />
</div>
</el-image>
</template>
</el-table-column>
<el-table-column prop="suffix" label="文件类型" />
<el-table-column prop="type" label="类别" />
<el-table-column prop="size" label="大小" />
<el-table-column prop="source_bill_code" label="单据编码" />
<el-table-column prop="create_name" label="创建人" />
<el-table-column prop="create_time" label="创建日期" width="180"/>
</el-table>
<!--分页组件-->
<pagination />
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex'
import crudFile from '@/api/tools/localStorage'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
import formula from '@/api/wms/pf/formula'
export default {
components: { pagination, crudOperation, rrOperation },
cruds() {
return CRUD({ title: '文件',idField: 'storage_id', url: '/api/formula/localStorage', crudMethod: { ...crudFile },
optShow: {
add: false,
edit: false,
del: true,
download: false,
reset: true
},
query:{formula_id:''}
})
},
mixins: [presenter(), header(), crud()],
props: {
dialogShow: {
type: Boolean,
default: false
}
},
data() {
return {
fla: false,
dialogVisible: false,
loading: false,
permission: {
edit: ['admin', 'storage:edit'],
del: ['admin', 'storage:del']
},
formula_id: ''
}
},
computed: {
...mapGetters([
'baseApi',
'fileUploadApi'
])
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
}
},
methods: {
open() {
this.crud.query.formula_id = this.formula_id
this.crud.toQuery()
},
/**
* 接受父组件传值
* @param msg
*/
setForm(msg) {
this.formula_id = msg
},
close() {
debugger
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
},
printCard() {
const _selectData = this.$refs.table.selection
const data = {
'id': _selectData[0].storage_id
}
this.fla = true
formula.print(data).then(res => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.fla = false
}).catch(() => {
this.fla = false
})
}
}
}
</script>
<style>
.crud-opts2 {
padding: 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .el-dialog__title2 {
line-height: 24px;
font-size:20px;
color:#303133;
}
.crud-opts2 .role-span {
padding: 10px 0px 10px 0px;
}
.crud-opts2 .crud-opts-form {
padding: 10px 0px 0px 20px;
}
.input-with-select {
background-color: #fff;
}
</style>

View File

@@ -0,0 +1,377 @@
<template>
<el-dialog
title="配方详情"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
fullscreen
@close="close"
@open="open"
>
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" size="mini" label-width="115px" label-suffix=":">
<el-form-item label="配方号" prop="formula_code">
<label slot="label">&nbsp;&nbsp;&nbsp;:</label>
<el-input v-model="form.formula_code" disabled style="width: 210px" />
</el-form-item>
<el-form-item label="产品" prop="material_code">
<label slot="label">产品:</label>
<el-input v-model="form.material_code" disabled style="width: 210px" />
</el-form-item>
<el-form-item label="批次" prop="pcsn">
<label slot="label">批次:</label>
<el-input v-model="form.pcsn" style="width: 210px" disabled />
</el-form-item>
<el-form-item label="工令号" prop="workorder_code">
<label slot="label">&nbsp;&nbsp;&nbsp;:</label>
<el-input v-model="form.workorder_code" disabled style="width: 210px" />
</el-form-item>
<el-form-item label="工令类型" prop="workorder_type">
<el-select
v-model="form.workorder_type"
placeholder="工令类型"
style="width: 210px"
disabled
class="filter-item"
>
<el-option
v-for="item in dict.workorder_type"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="碳平衡" prop="c_balance">
<label slot="label">碳平衡:</label>
<el-input-number
v-model="form.c_balance"
:controls="false"
:precision="3"
:min="1"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="软废含量%" prop="total_qty">
<label slot="label">软废含量%:</label>
<el-input-number
v-model="form.waste_limit_down"
:controls="false"
:precision="0"
:min="0"
:max="100"
disabled
style="width: 90px"
/>
----
<el-input-number
v-model="form.waste_limit_up"
:controls="false"
:precision="0"
:min="0"
:max="100"
disabled
style="width: 90px"
/>
</el-form-item>
<el-form-item label="是否二次投料" prop="is_again_put">
<el-select
v-model="form.is_again_put"
style="width: 210px"
placeholder="是否二次投料"
class="filter-item"
disabled
>
<el-option
v-for="item in dict.is_again_put"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="配粉槽" prop="storagevehicle_code">
<label slot="label">&nbsp;&nbsp;&nbsp;:</label>
<el-input v-model="form.storagevehicle_code" disabled style="width: 210px" />
</el-form-item>
<el-form-item label="配粉模式" prop="formula_type">
<el-select
v-model="form.formula_type"
placeholder="配粉模式"
style="width: 210px"
class="filter-item"
disabled
>
<el-option
v-for="item in dict.formula_type"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<label slot="label">备注:</label>
<el-input v-model="form.remark" disabled style="width: 210px" />
</el-form-item>
</el-form>
<div class="crud-opts2" v-if="form.bucket_type==='01'">
<span class="role-span">主桶</span>
<div class="crud-opts-form">
<el-form ref="form" :inline="true" :model="form2" size="mini">
<el-form-item label="主桶重量" prop="total_qty1">
<el-input-number
v-model="form2.total_qty1"
:controls="false"
:precision="3"
:min="0"
disabled
/>
</el-form-item>
<el-form-item label="添加辅料重量" prop="add_qty1">
<el-input-number
v-model="form2.add_qty1"
:controls="false"
:precision="3"
:min="0"
disabled
/>
</el-form-item>
</el-form>
</div>
</div>
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}" v-if="form.bucket_type==='01'">
<!--表格渲染-->
<el-table
ref="table"
:data="tableDtl"
style="width: 100%;"
max-height="400"
size="mini"
border
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column prop="bucket_type" label="桶类型" align="center" width="110px" :formatter="bucket_typeFormat" />
<el-table-column min-width="130" show-overflow-tooltip prop="material_code" label="物料编码" align="center"/>
<el-table-column prop="material_name" label="物料名称" align="center" width="150px" />
<el-table-column prop="material_type" label="物料类别" align="center" :formatter="material_typeFormat" />
<el-table-column min-width="120" show-overflow-tooltip prop="pcsn" label="批次号" align="center" />
<el-table-column prop="quality_scode" label="品质类型" align="center" width="110px" :formatter="quality_scodeFormat" />
<el-table-column prop="ivt_level" label="库存等级" align="center" width="100px" :formatter="ivt_levelFormat" />
<el-table-column prop="is_active" label="是否可用" align="center" width="110px" :formatter="is_activeFormat" />
<el-table-column prop="formula_qty" label="重量(KG)" :formatter="crud.formatNum3" width="150" align="center" />
<el-table-column prop="is_need_manage" label="是否配粉" align="center" width="100px" :formatter="is_need_manageFormat" />
<el-table-column prop="is_need_move" label="是否需移库" align="center" width="100px" :formatter="is_need_moveFormat" />
<el-table-column prop="is_tan" label="碳%" align="center" width="100px" :formatter="crud.formatQlNum4" />
<el-table-column prop="is_09030102" label="钴%" align="center" width="100px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ001" label="石蜡" align="center" width="100px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ002" label="G3蜡" align="center" width="100px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ003" label="PEG2000" align="center" width="100px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ004" label="PVAC" align="center" width="100px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ005" label="SBP" align="center" width="100px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ006" label="白油" align="center" width="100px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ007" label="油酸" align="center" width="100px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ008" label="8号分散剂" align="center" width="100px" :formatter="crud.formatQlNum4"/>
</el-table>
</el-card>
<div class="crud-opts2" v-if="form.bucket_type==='02'">
<span class="role-span">副桶</span>
<div class="crud-opts-form">
<el-form ref="form2" :inline="true" :model="form2" size="mini">
<el-form-item label="副桶重量" prop="total_qty2">
<el-input-number
v-model="form2.total_qty2"
:controls="false"
:precision="3"
:min="0"
disabled
/>
</el-form-item>
<el-form-item label="添加辅料重量" prop="add_qty2">
<el-input-number
v-model="form2.add_qty2"
:controls="false"
:precision="3"
:min="0"
disabled
/>
</el-form-item>
</el-form>
</div>
</div>
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}" v-if="form.bucket_type==='02'">
<!--表格渲染-->
<el-table
ref="table2"
:data="tabledis"
style="width: 100%;"
max-height="400"
size="mini"
border
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column prop="bucket_type" label="桶类型" align="center" width="110px" :formatter="bucket_typeFormat" />
<el-table-column min-width="130" show-overflow-tooltip prop="material_code" label="物料编码" align="center" />
<el-table-column prop="material_name" label="物料名称" align="center" />
<el-table-column prop="material_type" label="物料类别" align="center" :formatter="material_typeFormat" />
<el-table-column min-width="120" prop="pcsn" label="批次号" align="center" />
<el-table-column prop="quality_scode" label="品质类型" align="center" width="110px" :formatter="quality_scodeFormat" />
<el-table-column prop="ivt_level" label="库存等级" align="center" width="100px" :formatter="ivt_levelFormat" />
<el-table-column prop="is_active" label="是否可用" align="center" width="110px" :formatter="is_activeFormat" />
<el-table-column prop="formula_qty" label="重量(KG)" :formatter="crud.formatNum3" width="150" align="center" />
<el-table-column prop="is_need_manage" label="是否配粉" align="center" width="100px" :formatter="is_need_manageFormat" />
<el-table-column prop="is_need_move" label="是否需移库" align="center" width="100px" :formatter="is_need_moveFormat" />
<el-table-column prop="is_tan" label="碳%" align="center" width="100px" :formatter="crud.formatQlNum4" />
<el-table-column prop="is_09030102" label="钴%" align="center" width="100px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ001" label="石蜡" align="center" width="100px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ002" label="G3蜡" align="center" width="100px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ003" label="PEG2000" align="center" width="100px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ004" label="PVAC" align="center" width="100px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ005" label="SBP" align="center" width="100px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ006" label="白油" align="center" width="100px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ007" label="油酸" align="center" width="100px" :formatter="crud.formatQlNum4"/>
<el-table-column prop="is_CXJ008" label="8号分散剂" align="center" width="100px" :formatter="crud.formatQlNum4"/>
</el-table>
</el-card>
</el-dialog>
</template>
<script>
import CRUD, { crud } from '@crud/crud'
import formula from '@/api/wms/pf/formula'
import autoformula from "@/api/wms/pf/autoformula";
export default {
name: 'ViewDialog',
mixins: [crud()],
dicts: ['material_type', 'workorder_type', 'formula_type', 'ST_QUALITY_SCODE', 'ST_IVT_LEVEL', 'is_used', 'is_again_put', 'is_usable', 'bucket_type'],
props: {
dialogShow: {
type: Boolean,
default: false
},
rowmst: {
type: Object
}
},
data() {
return {
dialogVisible: false,
tableDtl: [],
mstrow: {},
tabledis: [],
form :{},
form2: {
total_qty1: '0',
add_qty1: '0',
total_qty2: '0',
add_qty2: '0'
}
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
},
rowmst: {
handler(newValue, oldValue) {
this.mstrow = newValue
}
}
},
methods: {
open() {
formula.getView({ 'formula_id':this.mstrow.formula_id,'material_id': this.mstrow.material_id ,'workorder_id':this.mstrow.workorder_id}).then(res => {
this.form = res.material
this.form.material_code = this.mstrow.material_code
this.form.workorder_qty = this.mstrow.workorder_qty
this.tableDtl = res.tableDtl
this.form2.total_qty1 = 0
this.form2.add_qty1 = 0
for (let i = 0; i < this.tableDtl.length; i++) {
const row = this.tableDtl[i]
row.edit = true
if(row.is_need_manage==='1'){
this.form2.total_qty1 = this.form2.total_qty1 + parseFloat(row.formula_qty)
}else{
this.form2.add_qty1 = this.form2.add_qty1 + parseFloat(row.formula_qty)
}
this.tableDtl.splice(i, 1, row)
}
this.tabledis = res.tabledis
this.form2.total_qty2 = 0
this.form2.add_qty2 = 0
for (let i = 0; i < this.tabledis.length; i++) {
const row = this.tabledis[i]
row.edit = true
if(row.is_need_manage==='1'){
this.form2.total_qty2 = this.form2.total_qty2 + parseFloat(row.formula_qty)
}else{
this.form2.add_qty2 = this.form2.add_qty2 + parseFloat(row.formula_qty)
}
this.tabledis.splice(i, 1, row)
}
})
},
close() {
this.tableDtl = []
this.tabledis = []
this.$emit('AddChanged')
this.$emit('update:dialogShow', false)
},
bucket_typeFormat(row, column) {
return this.dict.label.bucket_type[row.bucket_type]
},
quality_scodeFormat(row, column) {
return this.dict.label.ST_QUALITY_SCODE[row.quality_scode]
},
ivt_levelFormat(row, column) {
return this.dict.label.ST_IVT_LEVEL[row.ivt_level]
},
is_activeFormat(row, column) {
return this.dict.label.is_usable[row.is_active]
},
material_typeFormat(row, column) {
return this.dict.label.material_type[row.material_type]
},
is_need_moveFormat(row, column) {
if(row.is_need_move===''){
return '否'
}else{
return this.dict.label.is_again_put[row.is_need_move]
}
},
is_need_manageFormat(row, column) {
return this.dict.label.is_again_put[row.is_need_manage]
}
}
}
</script>
<style>
.crud-opts2 {
padding: 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 {
line-height: 24px;
font-size:20px;
color:#303133;
}
.crud-opts2 .role-span {
padding: 10px 0px 10px 0px;
}
.crud-opts2 .crud-opts-form {
padding: 10px 0px 0px 20px;
}
</style>

View File

@@ -0,0 +1,454 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="80px"
label-suffix=":"
>
<el-form-item label="工令号">
<el-input
v-model="query.workorder_code"
size="mini"
clearable
placeholder="工令号"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="产品">
<el-input
v-model="query.material_id"
size="mini"
clearable
placeholder="物料编码或物料编码"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="开单日期">
<el-date-picker
v-model="query.createTime"
type="daterange"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
@change="crud.toQuery"
/>
</el-form-item>
<el-form-item label="配方状态">
<el-select
v-model="query.status"
clearable
size="mini"
placeholder="配方状态"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.formula_status"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<rrOperation />
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="success"
:disabled="dissub_flag"
icon="el-icon-position"
size="mini"
@click="cancel"
>
作废
</el-button>
<el-button
slot="right"
class="filter-item"
type="warning"
:disabled="change_flag"
icon="el-icon-check"
size="mini"
@click="typeChange"
>
配粉补料
</el-button>
<!-- <el-button
slot="right"
class="filter-item"
type="warning"
icon="el-icon-check"
size="mini"
@click="pointCard"
>
打印工艺指令控制卡
</el-button>-->
<el-button
slot="right"
class="filter-item"
type="warning"
icon="el-icon-check"
size="mini"
:disabled="Export_flag"
@click="Export"
>
生成记录卡
</el-button>
<el-button
slot="right"
class="filter-item"
type="warning"
icon="el-icon-check"
size="mini"
:disabled="Export_flag"
@click="save"
>
保存记录卡
</el-button>
<el-button
slot="right"
class="filter-item"
type="warning"
icon="el-icon-check"
size="mini"
:disabled="show_flag"
@click="showCard"
>
查看记录卡
</el-button>
</crudOperation>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
size="mini"
:data="crud.data"
style="width: 100%;"
:highlight-current-row="true"
@selection-change="mySelectionChange"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="formula_code" width="130" label="配方编号">
<template slot-scope="scope">
<el-link type="warning" @click="toView(scope.$index, scope.row)">{{ scope.row.formula_code }}</el-link>
</template>
</el-table-column>
<el-table-column prop="workorder_code" width="130" label="工令号" />
<el-table-column prop="bucket_type" :formatter="bucket_typeFormat" min-width="80" label="桶类型" />
<el-table-column prop="material_code" min-width="130" label="物料编码"/>
<el-table-column :formatter="seriesFormat" min-width="130" prop="product_series_id" label="系列" />
<el-table-column prop="pcsn" min-width="130" label="批次"/>
<el-table-column prop="detail_count" min-width="100" label="明细数"/>
<el-table-column prop="masterbucket_qty" min-width="100" label="重量" :formatter="crud.formatNum3"/>
<el-table-column prop="status" :formatter="stateFormat" min-width="80" label="状态" />
<el-table-column prop="create_time" min-width="150" label="开单时间"/>
<el-table-column prop="create_name" min-width="150" label="开单人"/>
<el-table-column prop="update_time" min-width="150" label="修改时间"/>
<el-table-column prop="update_optname" min-width="150" label="修改人"/>
<el-table-column prop="start_time" min-width="150" label="开始时间"/>
<el-table-column prop="start_name" min-width="150" label="开始人"/>
<el-table-column prop="end_time" min-width="150" label="结束时间"/>
<el-table-column prop="end_name" min-width="150" label="结束人"/>
<el-table-column prop="add_time" min-width="150" label="补料时间"/>
<el-table-column prop="add_name" min-width="150" label="补料人"/>
</el-table>
<!--分页组件-->
<pagination />
</div>
<ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable" />
<DivDialog :dialog-show.sync="changeShow" :rowmst="mstrow" @DivChanged="querytable" />
<!-- Excel模板上传弹出框-->
<el-dialog
title="提示"
:visible.sync="dialogUpload"
append-to-body
width="30%"
@close="handleClose"
>
<el-upload
ref="upload"
:limit="1"
:headers="headers"
class="upload-demo"
:auto-upload="false"
drag
:action="baseApi +'/api/formula/pictures/'+formula_id"
multiple
:before-upload="beforeUpload"
:on-exceed="handleExceed"
:on-error="handleError"
:on-success="handleSuccess"
>
<i class="el-icon-upload" />
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div slot="tip" class="el-upload__tip">只能上传不超过50MB的文件</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="info" @click="dialogUpload = false">取消</el-button>
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
</div>
</el-dialog>
<PicDialog ref="child" :dialog-show.sync="PicDialog" />
</div>
</template>
<script>
import formula from '@/api/wms/pf/formula'
import CRUD, { crud, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import DivDialog from '@/views/wms/pf/formula/DivDialog'
import ViewDialog from '@/views/wms/pf/formula/ViewDialog'
import crudseriesProcessRoute from "@/api/wms/pdm/seriesProcessRoute";
import {download} from "@/api/data";
import {downloadFile} from "@/utils";
import {getToken} from "@/utils/auth";
import {mapGetters} from "vuex";
import PicDialog from '@/views/wms/pf/formula/PicDialog'
export default {
name: 'formula',
components: { ViewDialog, DivDialog, crudOperation, rrOperation, udOperation, pagination, PicDialog },
cruds() {
return CRUD({ title: '工令', idField: 'formula_id', url: 'api/formula', crudMethod: { ...formula },
optShow: {
add: false,
edit: false,
del: false,
reset: true,
download: false
}})
},
mixins: [presenter(), header(), crud()],
// 数据字典
dicts: ['formula_status', 'workorder_type', 'product_series', 'bucket_type'],
data() {
return {
dialogUpload: false,
PicDialog: false,
formula_id: null,
headers: { 'Authorization': getToken() },
height: document.documentElement.clientHeight - 180 + 'px;',
permission: {
},
divShow: false,
dissub_flag: true,
change_flag: true,
Export_flag: true,
show_flag: true,
mstrow: {},
viewShow: false,
changeShow: false,
currentRow: null,
checkrows: [],
XLList:[]
}
},
computed: {
...mapGetters([
'baseApi',
'fileUploadApi'
])
},
mounted: function() {
const that = this
window.onresize = function temp() {
that.height = document.documentElement.clientHeight - 180 + 'px;'
}
},
created() {
crudseriesProcessRoute.getXLlist2().then(res => {
this.XLList = res
})
},
methods: {
canUd(row) {
return row.status !== '10'
},
[CRUD.HOOK.beforeRefresh]() {
this.handleCurrentChange()
},
toView(index, row) {
this.mstrow = row
this.viewShow = true
},
mySelectionChange(rows) {
this.buttonChange(rows)
},
buttonChange(rows) {
if (rows.length !== 0) {
this.dissub_flag = false
this.change_flag = false
this.Export_flag = false
this.show_flag = false
for (let i = 0; i < rows.length; i++) {
if (rows[i].status !== '20') {
this.dissub_flag = true
}
if (rows[i].status === '99') {
this.Export_flag = true
}
if (!'30,20'.includes(rows[i].status) || rows.length !== 1) {//后台校验首道工序
this.change_flag = true
}
}
}else{
this.handleCurrentChange()
}
},
stateFormat(row) {
return this.dict.label.formula_status[row.status]
},
bill_typeFormat(row) {
return this.dict.label.workorder_type[row.workorder_type]
},
seriesFormat(row) {
for (const item of this.XLList) {
if (item.id === row.product_series_id) {
return item.name
}
}
},
bucket_typeFormat(row) {
return this.dict.label.bucket_type[row.bucket_type]
},
handleCurrentChange() {
this.checkrows = []
this.mstrow = {}
this.dissub_flag = true
this.change_flag = true
this.Export_flag = true
this.show_flag = true
},
checkboxT(row) {
return row.status !== '99'
},
typeChange() {
this.checkrows = this.$refs.table.selection
if(this.checkrows.length !== 1 ){
this.crud.notify('只能勾选一条记录开单!')
return false
}
this.mstrow = this.checkrows.pop()
this.changeShow = true
},
cancel(){
this.checkrows = this.$refs.table.selection
if(this.checkrows.length === 0){
this.crud.notify('请先选择需要作废的配方记录!')
return false
}
formula.cancel({'rows':this.checkrows}).then(res => {
this.crud.notify('作废配方成功!')
this.querytable()
})
},
querytable() {
this.crud.toQuery()
this.handleCurrentChange()
},
pointCard() {
const _selectData = this.$refs.table.selection
if (_selectData.length === 0 || _selectData.length > 1) {
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
const data = _selectData[0]
formula.pointCard(data).then(res => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
})
},
Export() {
const _selectData = this.$refs.table.selection
if (_selectData.length === 0 || _selectData.length > 1) {
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
const data = _selectData[0]
download('/api/formula/preview', { 'formula_id': data.formula_id }).then(result => {
debugger
const name = data.material_code + data.pcsn
downloadFile(result, name, 'xlsx')
crud.downloadLoading = false
}).catch(() => {
crud.downloadLoading = false
})
},
save() {
const _selectData = this.$refs.table.selection
if (_selectData.length === 0 || _selectData.length > 1) {
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
const data = _selectData[0]
this.formula_id = data.formula_id
this.dialogUpload = true
},
beforeUpload(file) {
let isLt2M = true
isLt2M = file.size / 1024 / 1024 < 50
if (!isLt2M) {
this.loading = false
this.$message.error('上传文件大小不能超过 50MB!')
}
return isLt2M
},
handleExceed(files, fileList) {
this.crud.notify('当前限制最多能选择 1 个文件', CRUD.NOTIFICATION_TYPE.WARNING)
},
handleError(e, file, fileList) {
const msg = JSON.parse(e.message)
this.$notify({
title: msg.message,
type: 'error',
duration: 2500
})
this.loading = false
},
handleSuccess(files, fileList) {
this.file_name = files.name
this.crud.notify('上传成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.$refs.upload.clearFiles()
this.dialogUpload = false
this.crud.toQuery()
},
submitUpload() {
const flag = this.$refs.upload.submit()
},
handleClose() {
this.dialogUpload = false
},
showCard() {
const _selectData = this.$refs.table.selection
if (_selectData.length === 0 || _selectData.length > 1) {
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
const data = _selectData[0]
// 给子组件传值
this.$refs.child.setForm(data.formula_id)
this.PicDialog = true
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 10px;
}
</style>