Commit 7d9b5f75 authored by xioln's avatar xioln

入库明细新增

parent 5b343c7b
/**
* @Description: 入库明细新增
* @author xioln
* @date 2023-06-21
* @FilePath: applications/dee-mes/src/privateComponents/components/StorageDetailsCreate/index.cue
*/
<template>
<div class="storageDetails-create">
<dee-form
ref="form"
:form="form"
:form-data="formFileds"
:rules="rules"
label-width="200px"
form-btn-position="center"
>
<section>
<el-button :disabled="disabled" type="primary" size="medium" @click="save">确定</el-button>
<el-button :disabled="disabled" size="medium" @click="handleClose">取消</el-button>
</section>
</dee-form>
</div>
</template>
<script>
import { post } from '@/utils/http'
export default {
componentName: '入库明细新增',
name: 'StorageDetailsCreate', // name写在组件的最前方,自定义组件为必填
components: {},
props: {
basicData: {
type: Object,
default: () => { }
}
},
data() {
return {
disabled: false,
header: {},
billType: '',
form: {},
formFileds: [
{
split: 3,
data: [
{
title: '物料关键词',
key: 'resCode',
component: {
clearable: true,
name: 'el-select',
placeholder: '请输入物料关键词',
remote: true,
filterable: true,
'remote-method': this.resetMaterial,
options: []
},
handler: {
change: (v) => this.changeMaterial(v)
}
},
{
title: '物料编码',
key: 'resCode',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入物料名称'
}
},
{
title: '物料名称',
key: 'resName',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入物料编码'
}
},
{
title: '计量单位',
key: 'reqUnit',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入计量单位'
}
},
{
title: '牌号/型号/件号',
key: 'modelNo',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入牌号/型号/件号'
}
},
{
title: '炉/批号',
key: 'lotNo',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入炉/批号'
}
},
{
title: '机型',
key: 'airModel',
component: {
clearable: true,
name: 'el-select',
placeholder: '请输入机型',
options: []
},
handler: {
change: () => this.changeSorties()
}
},
{
title: '架次',
key: 'sorties',
component: {
clearable: true,
name: 'el-select',
placeholder: '请输入架次',
options: []
}
},
// { title: '采购数量/重量', key: 'purchaseAmount', component: { name: 'el-input-number', placeholder: '请输入采购数量/重量' }},
// { title: '采购单位', key: 'purchaseUnit', component: { name: 'el-select', placeholder: '请输入采购单位' }},
{
title: '入库数量',
key: 'reqAmount',
component: {
clearable: true,
name: 'el-input-number',
min: 0,
placeholder: '请输入入库数量'
},
handler: {
change: () => this.changeComputed()
}
},
{
title: '供应商',
key: 'supplier',
component: {
clearable: true,
name: 'el-select',
disabled: true,
placeholder: '请输入供应商',
remote: true,
filterable: true,
'remote-method': this.resetSupplier,
options: []
}
},
{
title: '是否合格供应商',
key: 'isSupplierY',
component: {
clearable: true,
name: 'el-select',
disabled: true,
placeholder: '请选择是否合格供应商',
options: [
{ label: '是', value: true },
{ label: '否', value: false }
]
}
},
{
title: '制造商',
key: 'manufacturer',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入制造商'
}
},
{
title: '到货日期',
key: 'arrivalDate',
component: {
clearable: true,
name: 'el-date-picker',
disabled: true,
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd',
placeholder: '请选择到货日期'
}
},
{
title: '生产日期',
key: 'producedTime',
component: {
clearable: true,
name: 'el-date-picker',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd',
placeholder: '请选择生产日期'
}
},
{
title: '贮存条件',
key: 'storageCondition',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入贮存条件'
}
},
{
title: '随产品资料',
key: 'withProductMaterial',
component: {
clearable: true,
name: 'el-select',
multiple: true,
placeholder: '请选择随产品资料',
options: [
{ label: '装箱单/发货清单', value: '装箱单/发货清单' },
{ label: '合格证', value: '合格证' },
{
label: '适航批准标签/批准放行证书',
value: '适航批准标签/批准放行证书'
},
{ label: '器材合格证', value: '器材合格证' },
{ label: '测量报告/尺寸数据报告', value: '测量报告/尺寸数据报告' },
{ label: '试验报告', value: '试验报告' },
{ label: '器材代用单清单', value: '器材代用单清单' },
{ label: '不合格品审理单清单', value: '不合格品审理单清单' },
{ label: '多余物声明', value: '多余物声明' },
{ label: '光盘', value: '光盘' },
{ label: '其他资料', value: '其他资料' }
]
}
},
{
title: '紧急程度',
key: 'urgency',
component: {
clearable: true,
name: 'el-select',
placeholder: '请选择紧急程度',
options: [
{ label: '紧急', value: true },
{ label: '正常', value: false }
]
}
},
{
title: '到货标准',
key: 'arrivedDrawNo',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入到货标准'
}
},
{
title: '到货版次',
key: 'arrivalVer',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入到货版次'
}
},
{
title: '入库单价',
key: 'stockUnitPrice',
component: {
clearable: true,
disabled: true,
name: 'el-input',
placeholder: '请输入入库单价'
}
},
{
title: '税率',
key: 'taxRate',
component: {
clearable: true,
name: 'el-input-number',
min: 0,
placeholder: '请输入税率'
},
handler: {
change: () => this.changeComputed()
}
},
{
title: '入库金额',
key: 'stockPrice',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入入库金额'
}
},
{
title: '含税单价',
key: 'taxUnitPrice',
component: {
clearable: true,
name: 'el-input-number',
placeholder: '请输入含税单价'
},
handler: {
change: () => this.changeComputed()
}
},
{
title: '含税金额',
key: 'taxPrice',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入含税金额'
}
},
// { title: '报检人', key: 'userName', component: { name: 'el-input', disabled: true, placeholder: '请输入报检人' }},
{
title: '接收仓库',
key: 'storageZone',
component: {
clearable: true,
name: 'el-select',
placeholder: '请输入接收仓库',
options: []
}
},
{
title: '合同号/框架协议号',
key: 'contractNo',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入合同号'
}
},
// { title: '订货单号', key: 'purchaseOrderNo', component: { name: 'el-input', placeholder: '请输入订货单号' }},
{
title: '备注',
key: 'remark',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入备注'
}
}
]
}
],
material: [],
suppliers: [],
// 表单校验
rules: {
resCode: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
resName: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
airModel: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
reqUnit: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
reqAmount: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
supplier: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
arrivalDate: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
withProductMaterial: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
urgency: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
isSupplierY: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
lotNo: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
storageCondition: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
arrivalVer: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
producedTime: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
modelNo: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
serialNo: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
arrivedDrawNo: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
contractNo: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
taxRate: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
taxUnitPrice: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
]
// purchaseAmount: [{ required: true, message: '请填写表单信息', trigger: ['blur', 'change'] }],
},
extMaterialId: ''
}
},
computed: {},
created() {
// 初始化数据
this.defaultStorage()
this.defaultAirModel()
},
mounted() {
console.log('12231231312', this.basicData)
this.form.supplier = this.basicData.rows.extDxSipplier.supplierFullName || ''
this.form.isSupplierY = this.basicData.rows.extDxSipplier.isValid ? this.basicData.rows.extDxSipplier.isValid === 'Y' : ''
this.form.arrivalDate = this.basicData.rows.arrivalDate || ''
},
methods: {
// 设置物料类型下拉
resetMaterial(query) {
if (query && query.length > 1) {
post(
`/ExtDxProcessMaterial/search`,
{
'pageFrom': 1,
'pageSize': 9999,
'searchItems': {
'children': [
{
'items': [
{
'fieldName': 'resType2.id',
'operator': 'EQ',
'value': this.basicData.rows.materialTypeId || ''
}
],
'operator': 'AND'
},
{
'items': [
{
'fieldName': 'resCode',
'operator': 'LIKE',
'value': query
},
{
'fieldName': 'resName',
'operator': 'LIKE',
'value': query
},
{
'fieldName': 'modelNo',
'operator': 'LIKE',
'value': query
},
{
'fieldName': 'spec',
'operator': 'LIKE',
'value': query
},
{
'fieldName': 'techSpec',
'operator': 'LIKE',
'value': query
}
],
'operator': 'OR'
}
],
'items': []
},
'openProps': [
{
'name': 'extUnit'
}
],
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
]
},
'post'
)
.then((res) => {
this.material = res.items.content
this.formFileds[0].data[0].component.options = res.items.content.map(
(item) => {
return {
label: `${item.resName ? item.resName + '/' : ''}${item.modelNo ? item.modelNo + '/' : ''
}${item.techSpec ? item.techSpec + '/' : ''}${item.spec ? item.spec + '/' : ''
}${item.supplyStatus ? item.supplyStatus + '/' : ''}${item.supplierName ? item.supplierName + '/' : ''
}`,
value: item.resCode
}
}
)
})
.catch((err) => {
console.log(err)
})
}
},
// 默认带出机型
defaultAirModel() {
const params = {
searchItems: {
'operator': 'AND',
'items': [
// {
// 'fieldName': 'name',
// 'operator': 'EQ',
// 'value': ''
// }
]
}
}
this.$api.searchApi('AircraftType', params).then(res => {
const AIRMODEL = this.formFileds[0].data.find(
(item) => item.key === 'airModel'
)
AIRMODEL.component.options = res.items.content.map((item) => {
return {
label: item.defName,
value: item.defCode
}
})
})
},
// 根据机型带出架次
changeSorties() {
const params = {
searchItems: {
'operator': 'AND',
'items': [
{
'fieldName': 'aircraftType.defCode',
'operator': 'EQ',
'value': this.form.airModel
}
]
}
}
this.$api.searchApi('AircraftSorties', params).then(res => {
const SORTIES = this.formFileds[0].data.find(
(item) => item.key === 'sorties'
)
SORTIES.component.options = res.items.content.map((item) => {
return {
label: item.defName,
value: item.defCode
}
})
})
},
// 默认带出接收仓库
defaultStorage() {
post(
`/ExtDxProductWorkCenter/search`,
{
'pageFrom': 1,
'pageSize': 9999,
'searchItems': {
'children': [
{
'items': [
{
'fieldName': 'extDxProductArea.id',
'operator': 'EQ',
'value': this.basicData.rows.extDxProductAreaId || ''
}
],
'operator': 'AND'
}
],
'items': []
},
'openProps': [],
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
]
},
)
.then((res) => {
this.form.storageZone =
res.items && res.items.content.length ? res.items.content[0].id : ''
const STORAGE = this.formFileds[0].data.find(
(item) => item.key === 'storageZone'
)
STORAGE.component.options = res.items.content.map((item) => {
return {
label: item.extname,
value: item.id
}
})
// this.form.storageZone = row.storageZoneId
})
.catch((err) => {
console.log(err)
})
},
// 切换物料下拉
changeMaterial(v) {
// 带出物料相关默认值
const SELECT_MATERIAL = this.material.find((item) => item.resCode === v)
if (SELECT_MATERIAL) {
console.log('SELECT_MATERIAL', SELECT_MATERIAL)
this.form.modelNo = SELECT_MATERIAL.modelNo || ''
this.form.techSpec = SELECT_MATERIAL.techSpec || ''
this.form.spec = SELECT_MATERIAL.spec || ''
this.form.supplyStatus = SELECT_MATERIAL.supplyStatus || ''
this.form.reqUnit = SELECT_MATERIAL.extUnit.unitName || ''
this.form.resName = SELECT_MATERIAL.resName || ''
this.extMaterialId = SELECT_MATERIAL.id || ''
this.extUnitId = SELECT_MATERIAL.extUnitId || ''
}
},
// 计算金额
changeComputed() {
// 含税金额=含税单价 * 入库数量
if (this.form.taxUnitPrice && this.form.reqAmount) {
this.form = Object.assign({}, this.form, {
taxPrice: (this.form.taxUnitPrice * this.form.reqAmount).toFixed(2)
})
} else {
this.form = Object.assign({}, this.form, { taxPrice: '' })
}
// 入库单价=含税单价/(1+税率/100)
if (
this.form.taxUnitPrice &&
(this.form.taxRate || this.form.taxRate === 0)
) {
this.form = Object.assign({}, this.form, {
stockUnitPrice: (
this.form.taxUnitPrice /
(1 + this.form.taxRate / 100)
).toFixed(8)
})
} else {
this.form = Object.assign({}, this.form, { stockUnitPrice: '' })
}
// 入库金额=含税单价/(1+税率/100)* 入库数量
if (
this.form.taxUnitPrice &&
(this.form.taxRate || this.form.taxRate === 0) &&
this.form.reqAmount
) {
this.form = Object.assign({}, this.form, {
stockPrice: (
(this.form.taxUnitPrice / (1 + this.form.taxRate / 100)) *
this.form.reqAmount
).toFixed(2)
})
} else {
this.form = Object.assign({}, this.form, { stockPrice: '' })
}
},
save() {
post(
'/InStorageRequestItem/recursion',
{
'operator': 'ADD',
'subTypeName': 'InStoragePurchaseItem',
'extMaterialId': this.extMaterialId,
'extMaterialIdType': 'ExtDxProcessMaterial',
'purchaseUnitId': this.extUnitId,
'purchaseUnitIdType': 'ExtUnit',
'lotNo': this.form.lotNo,
'airModel': this.form.airModel,
'sorties': this.form.sorties,
'reqAmount': this.form.reqAmount,
'extDxSipplierId': this.basicData.rows.extDxSipplierId,
'extDxSipplierIdType': 'ExtDxSipplier',
'manufacturer': this.form.manufacturer,
'isSupplierY': this.form.isSupplierY,
'arrivalDate': this.form.arrivalDate ? this.form.arrivalDate : null,
'producedTime': this.form.producedTime ? this.form.producedTime + ' 00:00:00' : null,
'storageCondition': this.form.storageCondition,
'withProductMaterial': this.form.withProductMaterial ? this.form.withProductMaterial.join(';') : '',
'urgency': this.form.urgency,
'arrivedDrawNo': this.form.arrivedDrawNo,
'arrivalVer': this.form.arrivalVer,
'stockUnitPrice': this.form.stockUnitPrice,
'taxRate': this.form.taxRate,
'stockPrice': this.form.stockPrice,
'taxUnitPrice': this.form.taxUnitPrice,
'taxPrice': this.form.taxPrice,
'storageZoneId': this.form.storageZone,
'storageZoneIdType': 'ExtDxProductWorkCenter',
'inventoryReqId': this.basicData.rows.id,
'inventoryReqIdType': 'InventoryRequest',
'contractNo': this.form.contractNo
}
).then((res) => {
console.log('123123', res)
})
.catch((err) => {
console.log(err)
})
},
handleClose() {
}
}
}
</script>
<style lang='scss'></style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment