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

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

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

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

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

Loading…
Cancel
Save