Browse Source

FWHL-61备件收货自动推荐库位

hella_online_20241212_pandian
王宇飞 2 months ago
parent
commit
110277e0d2
  1. 8
      src/api/wms/spareitemLocation/index.ts
  2. 12
      src/views/wms/inventoryjobManage/sparepartReturn/sparepartReturnRequestMain/index.vue
  3. 2
      src/views/wms/inventoryjobManage/sparepartReturn/sparepartReturnRequestMain/sparepartReturnRequestMain.data.ts
  4. 16
      src/views/wms/purchasereceiptManage/sparereceipt/sparereceiptRequestMain/index.vue

8
src/api/wms/spareitemLocation/index.ts

@ -50,4 +50,10 @@ export const exportSpareitemLocation = async (params) => {
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/wms/spareitem-location/get-import-template' })
}
}
// 自动推荐库位
export const queryItemLocation = async (data) => {
return await request.post({ url: `/wms/spareitem-location/queryItemLocation`, data })
}

12
src/views/wms/inventoryjobManage/sparepartReturn/sparepartReturnRequestMain/index.vue

@ -108,6 +108,7 @@ import {
} from './sparepartReturnRequestMain.data'
import * as UnplannedreceiptRequestMainApi from '@/api/wms/unplannedreceiptRequestMain'
import * as UnplannedreceiptRequestDetailApi from '@/api/wms/unplannedreceiptRequestDetail'
import * as SpareitemLocationApi from '@/api/wms/spareitemLocation'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import * as ItembasicApi from "@/api/wms/itembasic";
import { formatTime } from '@/utils/index'
@ -170,6 +171,13 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
message.warning('不能同时选择可制造和可采购的物料')
}
newVal = newVal.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['code']))
let locationList = await SpareitemLocationApi.queryItemLocation({
"itemCodeList":newVal.map(item=>(item['code']))
})
console.log('locationList',locationList)
newVal.forEach(item=>{
let tfk = JSON.parse(JSON.stringify(tableFormKeys))
tfk.batch = formatTime(new Date(), 'yyyyMMdd')
@ -179,6 +187,10 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
tfk['itemCode'] = item['code']
tfk['uom'] = item['uom']
tfk['validityDays'] = item['validityDays']
let locationItem = locationList.find(location=>location['itemCode'] == item['code'])
if(locationItem){
tfk['toLocationCode'] = locationItem['locationCode']
}
tableData.value.push(tfk)
})
} else if(formField === 'costcentreCode'){

2
src/views/wms/inventoryjobManage/sparepartReturn/sparepartReturnRequestMain/sparepartReturnRequestMain.data.ts

@ -639,7 +639,7 @@ export const UnplannedreceiptRequestMainRules = reactive({
{ required: false, message: '请输入项目代码', trigger: 'blur' }
],
toWarehouseCode: [
{ required: true, message: '请输入到库代码', trigger: 'blur' }
{ required: true, message: '请输入到库代码', trigger: 'blur' }
],
departmentCode: [
{ required: true, message: '请输入部门', trigger: 'blur' }

16
src/views/wms/purchasereceiptManage/sparereceipt/sparereceiptRequestMain/index.vue

@ -126,6 +126,7 @@ import {
} from './sparereceiptRequestMain.data'
import * as PurchasereceiptRequestMainApi from '@/api/wms/purchasereceiptRequestMain'
import * as PurchasereceiptRequestDetailApi from '@/api/wms/purchasereceiptRequestDetail'
import * as SpareitemLocationApi from '@/api/wms/spareitemLocation'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { formatDate } from '@/utils/formatTime'
import * as SupplieritemApi from '@/api/wms/supplieritem'
@ -223,7 +224,7 @@ const onEnter = async (field,value)=>{
formRef.value.setDefaultBlurValue(field,value)
// getSearchTableData(value,true)
}
const updateTableData = (tableList)=>{
const updateTableData = async (tableList)=>{
console.log('tableList',tableList)
let itemCodes = tableList.filter(item=>tableData.value.find(item1=>item1['poNumber']==item['number']&&item1['supplierCode']==item['supplierCode']&&item1['poLine']==item['lineNumber']&&item1['itemCode']==item['itemCode']))
console.log('itemCodes',itemCodes)
@ -234,6 +235,10 @@ const updateTableData = (tableList)=>{
}
tableList = tableList.filter(item=>!tableData.value.find(item1=>item1['poNumber']==item['number']&&item1['supplierCode']==item['supplierCode']&&item1['poLine']==item['lineNumber']&&item1['itemCode']==item['itemCode']))
if(tableList.length==0) return
let locationList = await SpareitemLocationApi.queryItemLocation({
"itemCodeList":tableList.map(item=>(item.itemCode))
})
console.log('locationList',locationList)
tableList.forEach(row=>{
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...row}))
newRow['poLine'] = row['lineNumber']
@ -249,7 +254,10 @@ const updateTableData = (tableList)=>{
newRow['arriveDate'] = dayjs().valueOf()
//
newRow['batch'] = formatDate(newRow['produceDate'],'YYYYMMDD');
newRow['defaultToLocationCode'] =row['defaultLocation']
let locationItem = locationList.find(location=>location['itemCode'] == row['itemCode'])
if(locationItem){
newRow['defaultToLocationCode'] = locationItem['locationCode']
}
if(!tableData.value.find((item:object)=>item.poNumber == newRow.poNumber&&item.itemCode == newRow.itemCode&&item.poLine == newRow.poLine&&item.batch == newRow.batch)){
tableData.value.push(newRow)
}
@ -288,7 +296,9 @@ const getSearchTableData = async (number,isEnter=false)=>{
}).then((res)=>{
res.list.forEach((item,index)=>{
const findItem = tableData.value.find(item1=>item1['itemCode']==item['code'])
findItem['expireTime'] = item['expireTime']
if(findItem){
findItem['expireTime'] = item['expireTime']
}
})
})
}

Loading…
Cancel
Save