Browse Source

制品报废增加单价和金额

master_hella_20240701
zhaoxuebing 6 months ago
parent
commit
9a4900624b
  1. 6
      src/api/wms/stdcostprice/index.ts
  2. 22
      src/components/BasicForm/src/BasicForm.vue
  3. 131
      src/views/wms/productionManage/productscrap/productscrapRequestMain/index.vue
  4. 52
      src/views/wms/productionManage/productscrap/productscrapRequestMain/productscrapRequestMain.data.ts

6
src/api/wms/stdcostprice/index.ts

@ -56,3 +56,9 @@ export const exportStdcostprice = async (params) => {
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/wms/stdcostprice/get-import-template' }) return request.download({ url: '/wms/stdcostprice/get-import-template' })
} }
// 查询标准成本价格单列表
export const queryStdcostpriceByItemCode = async (data: StdcostpriceVO) => {
return await request.post({ url: `/wms/stdcostprice/queryStdcostpriceByItemCode`, data })
}

22
src/components/BasicForm/src/BasicForm.vue

@ -242,7 +242,7 @@ const props = defineProps({
required: false, required: false,
default: null default: null
}, },
// // or
isShowFooterButtton: { isShowFooterButtton: {
type: Boolean, type: Boolean,
required: false, required: false,
@ -253,6 +253,12 @@ const props = defineProps({
type: Boolean, type: Boolean,
required: false, required: false,
default: true default: true
},
//
footButttondata: {
type: Array,
required: false,
default: null
} }
}) })
@ -412,11 +418,18 @@ if (props.isShowFooterButtton) {
defaultButtons.formCloseBtn(null) // defaultButtons.formCloseBtn(null) //
] ]
} }
if (props.footButttondata) {
Butttondata = props.footButttondata
}
/** 按钮事件 */ /** 按钮事件 */
const buttonBaseClick = (val) => { const buttonBaseClick = (val) => {
// //
if (val == 'save') { if (props.footButttondata) {
emit('footButtonClick',val)
}
//
else if (val == 'save') {
submitForm() submitForm()
} }
// //
@ -505,7 +518,8 @@ const emit = defineEmits([
'onChange', 'onChange',
'onBlur', 'onBlur',
'inputNumberChange', 'inputNumberChange',
'formFormDateChange' 'formFormDateChange',
'footButtonClick'
]) ])
// //
const formSelectChange = (field, val, row) => { const formSelectChange = (field, val, row) => {

131
src/views/wms/productionManage/productscrap/productscrapRequestMain/index.vue

@ -53,6 +53,7 @@
@handleAddTable="handleAddTable" @handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable" @handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
@inputNumberChange="inputNumberChange"
@submitForm="submitForm" @submitForm="submitForm"
@buttonOperationClick="buttonOperationClick" @buttonOperationClick="buttonOperationClick"
/> />
@ -70,32 +71,28 @@
:apiDelete="ProductscrapRequestDetailApi.deleteProductscrapRequestDetail" :apiDelete="ProductscrapRequestDetailApi.deleteProductscrapRequestDetail"
:Echo="Echo" :Echo="Echo"
@searchTableSuccessDetail="searchTableSuccessDetail" @searchTableSuccessDetail="searchTableSuccessDetail"
@detailBasicFormOnChange="qtyOnChange"
:buttondataTable="buttondataTable" :buttondataTable="buttondataTable"
@tableFormButton="tableFormButton" @tableFormButton="tableFormButton"
:detailValidate="detailValidate" :detailValidate="detailValidate"
/> />
<!-- bom列表 --> <!-- BOM弹窗列表 -->
<Dialog <BasicForm
:title="DialogTitle" ref="detailBomRef"
v-model="bomModelVisible" @success="getList"
width="80%" :tableAllSchemas="ProdcutscrapBomScrap.allSchemas"
:scroll="true" :tableFormRules="ProdcutscrapBomScrapRules"
max-height="450px" :tableData="detatableDataBom.tableList"
> :isBusiness="true"
<TableForm :isShowButton="false"
ref="tableFormRef" :isShowReduceButton="false"
class="w-[100%]" :isShowFooterButtton="true"
:tableFields="ProdcutscrapBomDismantle.allSchemas.tableColumns" :Butttondata="ButttondataBom"
:tableData="detatableDataBom.tableList" @searchTableSuccess="searchTableBomSuccess"
:isShowButton="false" :footButttondata="footButttondata"
:isShowReduceButton="false" @footButtonClick="buttonBaseClickBom"
/> />
<template #footer>
<ButtonBase :Butttondata="ButttondataBom" @button-base-click="buttonBaseClickBom" />
</template>
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" />
</Dialog>
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/productscrap-request-main/import" :importTemplateData="importTemplateData" <ImportForm ref="importFormRef" url="/wms/productscrap-request-main/import" :importTemplateData="importTemplateData"
@ -109,9 +106,11 @@ import { ProductscrapRequestMain,
ProductscrapRequestMainRules, ProductscrapRequestMainRules,
ProductscrapRequestDetail, ProductscrapRequestDetail,
ProductscrapRequestDetailRules, ProductscrapRequestDetailRules,
ProdcutscrapBomDismantle } from './productscrapRequestMain.data' ProdcutscrapBomScrap,
ProdcutscrapBomScrapRules } from './productscrapRequestMain.data'
import * as ProductscrapRequestMainApi from '@/api/wms/productscrapRequestMain' import * as ProductscrapRequestMainApi from '@/api/wms/productscrapRequestMain'
import * as ProductscrapRequestDetailApi from '@/api/wms/productscrapRequestDetail' import * as ProductscrapRequestDetailApi from '@/api/wms/productscrapRequestDetail'
import * as StdcostpriceApi from '@/api/wms/stdcostprice'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import * as BomDismantleApi from "@/api/wms/bomDismantle" import * as BomDismantleApi from "@/api/wms/bomDismantle"
@ -139,12 +138,18 @@ const buttondataTable = ref([{
}]) }])
// Bom // Bom
const DialogTitle = ref('Bom信息')
const bomModelVisible = ref(false) const bomModelVisible = ref(false)
const tableListBom = ref() const tableListBom = ref()
const lsBomSave = ref() const lsBomSave = ref()
const rowId = ref() const rowId = ref()
const detailQty = ref() const detailQty = ref()
const footButttondata = ref([
defaultButtons.formSaveBtn(null), // BOM
defaultButtons.formCloseBtn(null) // BOM
])
//
const detailBomRef = ref()
const { tableObject: detatableDataBom, tableMethods: detatableMethodsBom } =useTable({ const { tableObject: detatableDataBom, tableMethods: detatableMethodsBom } =useTable({
getListApi: BomDismantleApi.getProductscrapBomDismantlePage getListApi: BomDismantleApi.getProductscrapBomDismantlePage
}) })
@ -176,6 +181,7 @@ const buttonBaseClickBom = (val) => {
console.log("tableListBom",tableListBom.value) console.log("tableListBom",tableListBom.value)
console.log("lsBomSave",lsBomSave.value) console.log("lsBomSave",lsBomSave.value)
if (lsBomSave.value) { if (lsBomSave.value) {
tableData.value.forEach((item, index) => { tableData.value.forEach((item, index) => {
if(tableListBom.value[0].rowId == index) { if(tableListBom.value[0].rowId == index) {
item.childList = tableListBom.value item.childList = tableListBom.value
@ -192,11 +198,11 @@ const buttonBaseClickBom = (val) => {
return return
} }
} }
bomModelVisible.value = false detailBomRef.value.dialogVisible = false
} }
// //
else if (val == 'close') { else if (val == 'close') {
bomModelVisible.value = false detailBomRef.value.dialogVisible = false
} }
} }
// tableform // tableform
@ -205,24 +211,35 @@ const buttonOperationClick = async (row, label, index)=> {
message.warning('请选择物料代码!') message.warning('请选择物料代码!')
return return
} }
if(row.qty <= 0){
message.warning('数量需要大于0!')
return
}
detatableDataBom.params.itemCode = row.itemCode detatableDataBom.params.itemCode = row.itemCode
detatableDataBom.params.bomVersion = row.bomVersion detatableDataBom.params.bomVersion = row.bomVersion
DialogTitle.value = '物料代码:【' + row.itemCode + '】 Bom 信息'
detailQty.value = row.qty detailQty.value = row.qty
bomModelVisible.value = true bomModelVisible.value = true
await getDetailListBom() await getDetailListBom()
console.log(row.fromLocationCode);
detatableDataBom.tableList.forEach(item => { detatableDataBom.tableList.forEach(item => {
// ProdcutscrapBomDismantle.allSchemas.tableFormColumns.forEach((bomItem) => { ProdcutscrapBomScrap.allSchemas.tableFormColumns.map((bomItem) => {
// if (bomItem.field == 'batch') { if (bomItem.field == 'batch') {
// let condition = { let condition = [{
// 'key':'locationCode', key:'location_code',
// 'value': row.fromLocationCode, action: '==',
// 'isMainValue':'false' value: row.fromLocationCode,
// } isSearch: true,
// bomItem.searchCondition.push(condition) isMainValue:false
// } },{
// }) key:'item_code',
action: '==',
value:item.itemCode,
isSearch: true,
isMainValue: false
}]
bomItem.tableForm.searchCondition = condition
}
})
item.rowId = index item.rowId = index
if(tableData.value[index].childList.length > 0) { if(tableData.value[index].childList.length > 0) {
tableData.value[index].childList.forEach(itemChild => { tableData.value[index].childList.forEach(itemChild => {
@ -234,13 +251,26 @@ const buttonOperationClick = async (row, label, index)=> {
item.qty = item.bomQty * row.qty item.qty = item.bomQty * row.qty
} }
}) })
detailBomRef.value.open('create', row, null,'viewDetail')//
}
//
const searchTableBomSuccess = (formField, searchField, val, formRef, type, row ) => {
nextTick(() => {
if (type == 'tableForm') {
//
if (formField == 'batch') {
row['batch'] = val[0]['batch']
row['packingNumber'] = val[0]['packingNumber']
}
}
})
} }
// Bom // Bom
const tableFormButton = async (val , row) => { const tableFormButton = async (val , row) => {
if (val == 'bom') { // bom if (val == 'bom') { // bom
bomModelVisible.value = true bomModelVisible.value = true
DialogTitle.value = '物料代码【' + row.itemCode + '】——Bom信息'
detatableDataBom.params = { detatableDataBom.params = {
itemCode: row.itemCode, itemCode: row.itemCode,
bomVersion: row.bomVersion, bomVersion: row.bomVersion,
@ -249,6 +279,7 @@ const tableFormButton = async (val , row) => {
rowId.value = row.id rowId.value = row.id
detailQty.value = row.qty detailQty.value = row.qty
await getDetailListBom() await getDetailListBom()
detailBomRef.value.open('create', row, null,'viewDetail')//
} }
} }
@ -273,6 +304,12 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
row['itemCode'] = val[0]['itemCode'] row['itemCode'] = val[0]['itemCode']
row['bomVersion'] = '' row['bomVersion'] = ''
row['childList'] = [] row['childList'] = []
let param = {'itemCode':val[0]['itemCode'] as string}
StdcostpriceApi.queryStdcostpriceByItemCode(param).then(res => {
console.log(res)
row['uom'] = res.uom
row['singlePrice'] = res.price
})
}else if(formField == 'bomVersion'){ }else if(formField == 'bomVersion'){
row['bomVersion'] = val[0]['version'] row['bomVersion'] = val[0]['version']
} }
@ -300,6 +337,12 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
setV['itemCode'] = val[0]['itemCode'] setV['itemCode'] = val[0]['itemCode']
setV['bomVersion'] = '' setV['bomVersion'] = ''
setV['childList'] = [] setV['childList'] = []
//
let param = {'itemCode':val[0]['itemCode'] as string}
StdcostpriceApi.queryStdcostpriceByItemCode(param).then(res => {
console.log(res)
})
}else if(formField == 'bomVersion'){ }else if(formField == 'bomVersion'){
setV['bomVersion'] = val[0]['version'] setV['bomVersion'] = val[0]['version']
} }
@ -650,6 +693,18 @@ const detailValidate = (data) => {
} }
} }
const inputNumberChange = (field, index, row, val) => {
if(field == 'qty' || field == 'singlePrice'){
row.amount = row.qty * row.singlePrice
}
}
const qtyOnChange = (field,val) =>{
if(field == 'qty' || field == 'singlePrice'){
detailRef.value.formRef.formRef.formModel.amount = detailRef.value.formRef.formRef.formModel.qty * detailRef.value.formRef.formRef.formModel.singlePrice
}
}
/** 导入 */ /** 导入 */
const importFormRef = ref() const importFormRef = ref()
const handleImport = () => { const handleImport = () => {

52
src/views/wms/productionManage/productscrap/productscrapRequestMain/productscrapRequestMain.data.ts

@ -810,6 +810,50 @@ export const ProductscrapRequestDetail = useCrudSchemas(reactive<CrudSchema[]>([
precision: 6 precision: 6
} }
}, },
{
label: '单价',
field: 'singlePrice',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
disabled: true,
min: 0,
precision: 6
},
},
tableForm: {
disabled: true,
type: 'InputNumber',
min: 0,
precision: 6
}
},
{
label: '金额',
field: 'amount',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
disabled:true,
min: 0,
precision: 6,
}
},
tableForm: {
type: 'InputNumber',
disabled:true,
min: 0,
precision: 6,
},
},
{ {
label: '项目代码', label: '项目代码',
field: 'projectCode', field: 'projectCode',
@ -954,7 +998,6 @@ export const ProductscrapRequestDetail = useCrudSchemas(reactive<CrudSchema[]>([
}] }]
}, },
form: { form: {
// labelMessage: '信息提示说明!!!',
componentProps: { componentProps: {
isSearchList: true, // 开启查询弹窗 isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择Bom版本', // 输入框占位文本 searchListPlaceholder: '请选择Bom版本', // 输入框占位文本
@ -1017,7 +1060,7 @@ export const ProductscrapRequestDetailRules = reactive({
/** /**
* @returns {Array} bom * @returns {Array} bom
*/ */
export const ProdcutscrapBomDismantle = useCrudSchemas(reactive<CrudSchema[]>([ export const ProdcutscrapBomScrap = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '行标记', label: '行标记',
field: 'rowId', field: 'rowId',
@ -1183,3 +1226,8 @@ export const ProdcutscrapBomDismantle = useCrudSchemas(reactive<CrudSchema[]>([
} }
} }
])) ]))
//表单校验
export const ProdcutscrapBomScrapRules = reactive({
})

Loading…
Cancel
Save