From 6eb682239c2138900e74c9e8792bec001380a843 Mon Sep 17 00:00:00 2001
From: yufei_wang <2267742828@qq.com>
Date: Sat, 12 Oct 2024 10:00:46 +0800
Subject: [PATCH] =?UTF-8?q?HL-6157WMS=E7=BB=B4=E4=BF=AE=E5=A4=87=E4=BB=B6?=
=?UTF-8?q?=E9=80=80=E8=B4=A7=EF=BC=8C=E6=8C=89=E7=85=A7=E7=BB=B4=E4=BF=AE?=
=?UTF-8?q?=E5=A4=87=E4=BB=B6=E6=94=B6=E8=B4=A7=E7=9A=84=E6=A0=B7=E5=BC=8F?=
=?UTF-8?q?=E5=81=9A=E9=80=80=E8=B4=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../wms/purchasereturnRequestDetail/index.ts | 17 +
.../purchasereturnRequestSpareMain/index.vue | 390 +++++++++---------
.../sparereceiptRequestMain/index.vue | 1 +
3 files changed, 202 insertions(+), 206 deletions(-)
diff --git a/src/api/wms/purchasereturnRequestDetail/index.ts b/src/api/wms/purchasereturnRequestDetail/index.ts
index 18e6f6dde..8489337bc 100644
--- a/src/api/wms/purchasereturnRequestDetail/index.ts
+++ b/src/api/wms/purchasereturnRequestDetail/index.ts
@@ -112,4 +112,21 @@ export const exportPurchasereturnRequestDetail = async (params) => {
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/wms/purchasereturn-request-detail/get-import-template' })
+}
+
+// 选择收货单明细
+// 查询采购退货申请子列表
+export const queryPurchasereceiptSpareRecordBySupplier = async (params) => {
+ if (params.isSearch) {
+ delete params.isSearch
+ const data = {...params}
+ return await request.post({ url: '/wms/purchasereceipt-record-detail/queryPurchasereceiptSpareRecordBySupplier', data })
+ } else {
+ return await request.get({ url: `/wms/purchasereceipt-record-detail/queryPurchasereceiptSpareRecordBySupplier`, params })
+ }
+}
+
+// 维修退货申请子表数据
+export const queryBalancePurchaseReceiptSpareReturn = async (params) => {
+ return await request.get({ url: `/wms/purchasereturn-request-main/queryBalancePurchaseReceiptSpareReturn`, params })
}
\ No newline at end of file
diff --git a/src/views/wms/purchasereceiptManage/purchasereturnspare/purchasereturnRequestSpareMain/index.vue b/src/views/wms/purchasereceiptManage/purchasereturnspare/purchasereturnRequestSpareMain/index.vue
index da30f3178..2b596b97a 100644
--- a/src/views/wms/purchasereceiptManage/purchasereturnspare/purchasereturnRequestSpareMain/index.vue
+++ b/src/views/wms/purchasereceiptManage/purchasereturnspare/purchasereturnRequestSpareMain/index.vue
@@ -51,7 +51,7 @@
-
+ /> -->
+
+
+
+
+ 选择收货单明细
+
+
+ 直接选择采购订单
+
+
@@ -131,6 +162,15 @@ import {
PurchasereReturnRequestDetailLabel,
PurchasereceiptRecordMain1
} from './purchasereturnRequestSpareMain.data'
+import {
+ PurchasereturnRequestMainNew,
+ PurchasereturnRequestMainRulesNew,
+ PurchasereturnRequestDetailNew,
+ PurchasereturnRequestDetailRulesNew,
+ PurchasereturnPurchasereceiptRecordNew
+} from './purchasereturnRequestSpareMainNew.data'
+import * as PurchaseDetailApi from '@/api/wms/purchaseDetail'
+
import * as PurchasereturnRequestMainApi from '@/api/wms/purchasereturnRequestMain'
import * as PurchasereturnRequestDetailApi from '@/api/wms/purchasereturnRequestDetail'
import * as PurchasereceiptRecordDetailApi from '@/api/wms/purchasereceiptRecordDetail'
@@ -143,8 +183,10 @@ import { async } from '@antv/x6/lib/registry/marker/async'
import { getJmreportBaseUrl } from '@/utils/systemParam'
import { formatDate } from '@/utils/formatTime'
import { usePageLoading } from '@/hooks/web/usePageLoading'
+import { PurchaseMain, PurchaseDetail } from '@/views/wms/purchasereceiptManage/supplierdeliver/purchaseMainWms/purchaseMain.data'
+
const { loadStart, loadDone } = usePageLoading()
-// 采购退货申请
+// 维修备件退货申请
defineOptions({ name: 'PurchasereturnRequestSpareMain' })
const message = useMessage() // 消息弹窗
@@ -229,7 +271,118 @@ const searchTableSuccessLabel = (formField, searchField, val, formRef, type, row
}
})
}
+const onChangeForm = async (field, cur, formRef)=>{
+ console.log('onChangeForm',field, cur, formRef)
+ if(field=='supplierCode'){
+ //供应商
+ PurchasereturnRequestMainNew.allSchemas.formSchema.forEach(item=>{
+ // 物料名称赋值
+ if(item.field=='supplierCode'){
+ let setV = {}
+ setV['supplierName'] = item.componentProps.options?.find(el=>el.supplierCode==cur+'')['supplierName']
+ formRef.value.setValues(setV)
+ }
+ })
+ getPurchanseList()
+ }
+}
+const getPurchanseList = async ()=>{
+ let res = await PurchaseDetailApi.getPurchaseDetailPageWMS({
+ supplierCode: formRef.value.formRef.formModel.supplierCode,
+ itemCode: formRef.value.formRef.formModel.itemCode,
+ pageSize: 20,
+ pageNo: 1,
+ sort: '',
+ by: 'ASC'
+ })
+ if(res&&res.list&&res.list.length==1){
+ const setV = {}
+ setV['hahaha'] = ''
+ setV['hehehe'] = res.list[0]['number']
+ setV['poNumber'] = res.list[0]['number']
+ setV['poLine'] = res.list[0]['lineNumber']
+ setV['receiptNumber'] = ''
+ setV['asnNumber'] = ''
+ formRef.value.formRef.setValues(setV)
+ }
+ console.log('采购订单',res)
+}
+// 直接选择采购订单
+const choosePurchanseList = ()=>{
+
+ if(!formRef.value.formRef.formModel.supplierCode){
+ message.error('请选择供应商')
+ return
+ }
+ searchTableRef.value.open(
+ "直接选择采购订单",
+ PurchaseMain.allSchemas,
+ PurchaseDetailApi.getPurchaseDetailPageWMS,
+ "hehehe",
+ "hehehe",
+ false,
+ 'tableForm',
+ null,
+ {
+ supplierCode:formRef.value.formRef.formModel.supplierCode,
+ },
+ undefined,
+ true,
+ PurchaseDetail.allSchemas
+ )
+}
+// 选择收货单明细
+const chooseReceiptList = ()=>{
+
+ if(!formRef.value.formRef.formModel.supplierCode){
+ message.error('请选择供应商')
+ return
+ }
+ searchTableRef.value.open(
+ "收货单明细",
+ PurchasereturnPurchasereceiptRecordNew.allSchemas,
+ PurchasereturnRequestDetailApi.queryPurchasereceiptSpareRecordBySupplier,
+ "hahaha",
+ "hahaha",
+ false,
+ 'tableForm',
+ null,
+ {
+ supplierCode:formRef.value.formRef.formModel.supplierCode,
+ },
+ undefined,
+ false,
+ null
+ )
+}
+const searchTableRef = ref()
+// 选择收货单明细、直接选择采购订单
+const searchTableSuccess1 = (formField, searchField, val, type, row) => {
+ console.log('searchTableSuccess1',formField, searchField, val, type, row)
+
+ if(formField=='hahaha'){
+ // 选择收货单明细
+ const setV = {}
+ setV['hehehe'] = ''
+ setV['hahaha'] = val[0]['receiptNumber']
+ setV['poNumber'] = val[0]['poNumber']
+ setV['poLine'] = val[0]['poLine']
+ setV['receiptNumber'] = val[0]['receiptNumber']
+ setV['asnNumber'] = val[0]['asnNumber']
+ formRef.value.formRef.setValues(setV)
+ }else if(formField=='hehehe'){
+ // 直接选择采购订单
+ const setV = {}
+ setV['hahaha'] = ''
+ setV['hehehe'] = val[0]['number']
+ setV['poNumber'] = val[0]['number']
+ setV['poLine'] = val[0]['lineNumber']
+ setV['receiptNumber'] = ''
+ setV['asnNumber'] = ''
+ formRef.value.formRef.setValues(setV)
+ }
+}
// 查询页面返回
const searchTableSuccess = async (formField, searchField, val, formRef, type, row) => {
console.log('searchTableSuccess', formField, searchField, val, formRef, type, row)
@@ -237,115 +390,36 @@ const searchTableSuccess = async (formField, searchField, val, formRef, type, ro
nextTick(async () => {
if (type == 'tableForm') {
// 明细查询页赋值
- if (formField == 'itemCode') {
- val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']&&item1['batch']==item['batch']&&item1['packingNumber']==item['packingNumber']&&item1['fromLocationCode']==item['locationCode']&&item1['inventoryStatus']==item['inventoryStatus']))
-
- val.forEach(item=>{
- let newRow = {...item}
- newRow[formField] = item[searchField]
- newRow['batch'] =item['batch']
- newRow['itemCode'] =item['itemCode']
- newRow['uom'] = item['uom']
- newRow['itemName'] = item['itemName']
- newRow['inventoryBalance'] = item['qty']
- newRow['fromLocationCode'] = item['locationCode']
- newRow['packingNumber'] = item['packingNumber']
- newRow['inventoryStatus'] = item['inventoryStatus']
- tableData.value.push(newRow)
- })
-
- } else if (formField == 'fromLocationCode') {
- row[formField] = val[0][searchField]
- // let params = {
- // itemCode: row.itemCode,
- // batch: row.batch,
- // locationCode:val[0]['code']
- // }
- // let aa = await BalanceApi.getSumByConditions(params);
- // console.log('23423423',aa);
- // row['inventoryBalance'] = aa//库存余额
- } else if (formField == 'packingNumber') {
- // row[formField] = val[0][searchField]
- val.forEach((item,index)=>{
- if(index==0){
- row[formField] = item[searchField]
- row['inventoryBalance'] = item['qty'] //库存余额
- }else{
- let newRow = {...row}
- newRow[formField] = item[searchField]
- row['inventoryBalance'] = item['qty'] //库存余额
- tableData.value.push(newRow)
- }
- })
- // row['inventoryBalance'] = val[0]['qty'] //库存余额
- }else{
- row[formField] = val[0][searchField]
- }
+ row[formField] = val[0][searchField]
} else {
const setV = {}
- if (formField == 'purchaseReceiptRecordNumber') {
- // isShowButton.value = false
- setV[formField] = val[0][searchField]
- setV['purchaseReceiptRecordNumber'] = val[0]['number']
- setV['supplierCode'] = val[0]['supplierCode']
- setV['asnNumber'] = val[0]['asnNumber']
- setV['ppNumber'] = val[0]['ppNumber']
- // 获取子表数据 getBomDisassemble
- // PurchasereceiptRecordDetailApi.getPurchasereceiptRecordDetailList({
- PurchasereceiptRecordDetailApi.getPurchasereceiptRecordDetailListToRepeat({
- masterId: val[0]['masterId']
- })
- .then((res) => {
- if (res) tableData.value = res
- tableData.value.forEach((item) => {
- item.batch = item.toBatch
- item.packingNumber = item.fromPackingNumber
- item.containerNumber = item.toContainerNumber
- item.receiptQty = item.qty
- item.packUnit = item.packUnit
- item.packQty = item.packQty
- item.toLocationGroupCode = null
- item.toWarehouseCode = null
- item.fromLocationCode = null
- item.toAreaTypes = null
- item.toLocationCode = null
- // item.fromLocationCode = item.fromLocationCode
- // item.fromLocationGroupCode = item.fromLocationGroupCode
- })
- originTableData.value = JSON.parse(JSON.stringify(tableData.value))
-
- PurchasereturnRequestMain.allSchemas.formSchema.forEach((item) => {
- if (item.field == 'supplierCode') {
- item.componentProps.disabled = true
- }
- })
- PurchasereturnRequestDetail.allSchemas.tableFormColumns.map((item) => {
- item.tableForm.disabled = true
- if (item.field == 'remark') {
- item.tableForm.disabled = false
- }
- if (item.field == 'qty') {
- item.tableForm.disabled = false
- }
- // if (item.field == 'returnedQty') {
- // item.tableForm.disabled = false
- // }
- if (item.field == 'reason') {
- item.tableForm.disabled = false
- }
- })
- })
- .catch((err) => {
- console.log(err)
+ setV[formField] = val[0][searchField]
+ if(formField=='supplierCode'){
+ setV['supplierName'] = val[0]['shortName']
+ tableData.value = []
+ }else if(formField == 'locationCode' ){
+ // 退货库位 获取明细列表
+ let subList = await PurchasereturnRequestDetailApi.queryBalancePurchaseReceiptSpareReturn({
+ supplierCode:formRef.formModel.supplierCode,//供应商代码
+ poNumber:formRef.formModel.poNumber,//
+ receiptNumber:formRef.formModel.receiptNumber,//采购收货记录单号
+ fromLocationCode:val[0][searchField]//库位代码
})
+
+ console.log('subList',subList)
+ if(subList&&subList.length>0){
+ tableData.value = subList
+ tableData.value.forEach((item,index)=>({
+ 'id':index
+ }))
+ }else{
+ tableData.value = []
+ }
}
- if (formField == 'supplierCode') {
- // isShowButton.value = true
- setV['supplierCode'] = val[0]['code']
- // setV['purchaseReceiptRecordNumber'] = ''
- // tableData.value = []
- }
+
+
formRef.setValues(setV)
+
}
})
}
@@ -728,108 +802,9 @@ PurchasereturnRequestDetail.allSchemas.tableFormColumns.forEach((item) => {
const tableData = ref([])
const originTableData = ref([])
-const searchTableRef = ref()
-// 添加明细
-const handleAddTable = () => {
- const subTableDFata = originTableData.value.filter(
- (item) => !tableData.value.find((item1) => item1.id == item.id)
- )
- if (subTableDFata.length == 0) {
- message.warning('暂无可选择数据!')
- return
- }
- const tableObject = {
- // 当前页
- currentPage: 1,
- // 导出加载中
- exportLoading: false,
- // 加载中
- loading: false,
- // 页数
- pageSize: subTableDFata.length,
- params: null,
- // 排序
- sort: {
- order: '', // 排序规则
- prop: '' // 排序字段
- },
- // 总条数
- total: subTableDFata.length,
- // 表格数据
- tableList: subTableDFata,
- currentRow: null
- }
-
- const tableColumns = PurchasereturnRequestDetail.allSchemas.tableFormColumns
- tableColumns.forEach((item) => {
- item.width = item.table?.width || 150
- })
- searchTableRef.value.openData('采购收货记录单号', tableObject, { tableColumns }, true)
- // searchTableRef.value.open(
- // ('供应商信息',
- // // _searchTableAllSchemas,
- // // _searchTablePage, // 接口
- // // formField,
- // // searchField,
- // true,//是否多选
- // // type,
- // // row,
- // _searchCondition
- // )
- // )
- // console.log(subTableDFata)
- // const {tableObject, tableMethods } = useTable({
- // getListApi: getPage.value // 分页接口
- // })
- // searchTableRef.value.open(
- // ('供应商信息',
- // // _searchTableAllSchemas,
- // // _searchTablePage, // 接口
- // // formField,
- // // searchField,
- // true,//是否多选
- // // type,
- // // row,
- // _searchCondition
- // )
- // )
- // tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
- // let purchaseReceiptRecordNumber = formRef.value.formRef.formModel.purchaseReceiptRecordNumber
- // PurchasereturnRequestDetail.allSchemas.tableFormColumns.map((item) => {
- // item.tableForm.disabled = true
- // if (item.field == 'remark') {
- // item.tableForm.disabled = false
- // }
- // if (item.field == 'reason') {
- // item.tableForm.disabled = false
- // }
- // if (item.field == 'qty') {
- // item.tableForm.disabled = false
- // }
- // if(purchaseReceiptRecordNumber == ''){
- // if (item.field == 'itemCode') {
- // item.tableForm.isInpuFocusShow = true
- // }
- // if(item.field == 'poLine'){
- // item.tableForm.isInpuFocusShow = false
- // }
- // }else{
- // if (item.field == 'itemCode') {
- // item.tableForm.isInpuFocusShow = false
- // }
- // if(item.field == 'poLine'){
- // item.tableForm.isInpuFocusShow = true
- // }
- // }
- // })
-}
-const searchTableSuccess1 = (formField, searchField, val, formRef, type, row) => {
- console.log(val)
- tableData.value = [...tableData.value, ...val]
-}
// 删除明细
const handleDeleteTable = (item, index, formRef) => {
let itemIndex = tableData.value.indexOf(item)
@@ -869,6 +844,9 @@ const submitForm = async (formType, submitData) => {
if (data.masterId) {
data.id = data.masterId
}
+ tableData.value.forEach(item=>{
+ item['fromLocationCode'] = data['locationCode']
+ })
console.log('submitForm', tableData.value)
// if(tableData.value.find(item=>Number(item.returnedQty)>Number(item.receiptQty))){
// message.warning("退货数量不能大于收获数量")
diff --git a/src/views/wms/purchasereceiptManage/sparereceipt/sparereceiptRequestMain/index.vue b/src/views/wms/purchasereceiptManage/sparereceipt/sparereceiptRequestMain/index.vue
index 559eade55..e70bcc3b3 100644
--- a/src/views/wms/purchasereceiptManage/sparereceipt/sparereceiptRequestMain/index.vue
+++ b/src/views/wms/purchasereceiptManage/sparereceipt/sparereceiptRequestMain/index.vue
@@ -137,6 +137,7 @@ import { getJmreportBaseUrl } from '@/utils/systemParam'
import { usePageLoading } from '@/hooks/web/usePageLoading'
const { loadStart, loadDone } = usePageLoading()
// 备件收货申请
+// 维修备件收货申请
defineOptions({ name: 'PurchasereceiptRequestMain' })
const message = useMessage() // 消息弹窗