|
|
@ -94,6 +94,7 @@ import * as ProductionreturnRequestDetailApi from '@/api/wms/productionreturnReq |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import * as ItembasicApi from '@/api/wms/itembasic' |
|
|
|
import * as PackageApi from '@/api/wms/package' |
|
|
|
import { getAccessToken } from '@/utils/auth' |
|
|
|
|
|
|
|
// 生产退料申请 |
|
|
|
defineOptions({ name: 'ProductionreturnRequestMain' }) |
|
|
@ -110,6 +111,7 @@ const tableColumns = ref(ProductionreturnRequestMain.allSchemas.tableColumns) |
|
|
|
const detailListTableColumns = ProductionreturnRequestDetailLabel.allSchemas |
|
|
|
const isCreateLabel = ref(false) |
|
|
|
const formLabelRef = ref() |
|
|
|
const labelType = ref('') // 标签类别 采购还是制造等 |
|
|
|
const { tableObject: detatableData, tableMethods: detatableMethods } =useTable({ |
|
|
|
getListApi: ProductionreturnRequestDetailApi.getProductionreturnRequestDetailPage |
|
|
|
}) |
|
|
@ -120,25 +122,57 @@ const updataTableColumns = (val) => { |
|
|
|
tableColumns.value = val |
|
|
|
} |
|
|
|
|
|
|
|
// 判断 物品类型是否与其他物品类型一致 |
|
|
|
const isItemType = async (itemCode, labelTypeParams) => { |
|
|
|
let isType = false |
|
|
|
await ItembasicApi.getItembasicPage({ |
|
|
|
pageSize: 10, |
|
|
|
pageNo: 1, |
|
|
|
code: itemCode, |
|
|
|
sort: '', |
|
|
|
by: 'ASC', |
|
|
|
}).then(res => { |
|
|
|
if (res.list.length > 0) { |
|
|
|
// 判断物品类型 是否 原料 |
|
|
|
if (res.list[0].type == "RAW") { |
|
|
|
labelType.value = 'cg' |
|
|
|
if (labelTypeParams == 'cg') { |
|
|
|
isType = true |
|
|
|
} |
|
|
|
} else { |
|
|
|
labelType.value = 'zz' |
|
|
|
if (labelTypeParams == 'zz') { |
|
|
|
isType = true |
|
|
|
} |
|
|
|
} |
|
|
|
if(labelTypeParams == '') isType = true |
|
|
|
} |
|
|
|
}) |
|
|
|
return isType |
|
|
|
} |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|
|
|
nextTick(() => { |
|
|
|
nextTick(async () => { |
|
|
|
if (type == 'tableForm') { |
|
|
|
// 明细查询页赋值 |
|
|
|
if(formField == 'itemCode') { |
|
|
|
// row['packingNumber'] = val[0]['packingNumber'] |
|
|
|
// row['containerNumber'] = val[0]['containerNumber'] |
|
|
|
// row['batch'] = val[0]['batch'] |
|
|
|
row['itemCode'] = val[0]['itemCode'] |
|
|
|
row['uom'] = val[0]['uom'] |
|
|
|
row['inventoryStatus'] = val[0]['inventoryStatus'] |
|
|
|
row['qty'] = val[0]['qty'] |
|
|
|
// 修改 tableform 属性 数量最大值设置为库存余额中数量 |
|
|
|
ProductionreturnRequestDetail.allSchemas.tableFormColumns.map(item => { |
|
|
|
if(item.field == 'qty' && val[0]['qty'] > 0) { |
|
|
|
item.tableForm.max = val[0]['qty'] |
|
|
|
} |
|
|
|
}) |
|
|
|
const isType = await isItemType(val[0]['itemCode'], labelType.value) |
|
|
|
if(!isType){ |
|
|
|
message.warning('当前物品类型与其他数据不一致,请重新选择!') |
|
|
|
} else { |
|
|
|
row['itemCode'] = val[0]['itemCode'] |
|
|
|
row['uom'] = val[0]['uom'] |
|
|
|
row['inventoryStatus'] = val[0]['inventoryStatus'] |
|
|
|
row['qty'] = val[0]['qty'] |
|
|
|
// 修改 tableform 属性 数量最大值设置为库存余额中数量 |
|
|
|
// TODO: tableFormColumns 修改属性目前只限于整个列 并不满足行要求 例如: 第一条数据最大10 第二条数据最大20 那么第一条数据会变成最大20限制 |
|
|
|
ProductionreturnRequestDetail.allSchemas.tableFormColumns.map(item => { |
|
|
|
if(item.field == 'qty' && val[0]['qty'] > 0) { |
|
|
|
item.tableForm.max = val[0]['qty'] |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} else if(formField == 'workStationCode') { |
|
|
|
row['workStationCode'] = val[0]['code'] |
|
|
|
row['fromLocationCode'] = val[0]['rawLocationCode'] |
|
|
@ -155,20 +189,24 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => |
|
|
|
} |
|
|
|
// 查询页面返回——详情 |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|
|
|
nextTick(() => { |
|
|
|
nextTick(async () => { |
|
|
|
const setV = {} |
|
|
|
if(formField == 'itemCode') { |
|
|
|
setV['batch'] = val[0]['batch'] |
|
|
|
setV['itemCode'] = val[0]['itemCode'] |
|
|
|
setV['uom'] = val[0]['uom'] |
|
|
|
setV['inventoryStatus'] = val[0]['inventoryStatus'] |
|
|
|
setV['qty'] = val[0]['qty'] |
|
|
|
// 修改 tableform 属性 数量最大值设置为库存余额中数量 |
|
|
|
ProductionreturnRequestDetail.allSchemas.tableFormColumns.map(item => { |
|
|
|
if(item.field == 'qty' && val[0]['qty'] > 0) { |
|
|
|
item.tableForm.max = val[0]['qty'] |
|
|
|
} |
|
|
|
}) |
|
|
|
const isType = await isItemType(val[0]['itemCode'], labelType.value) |
|
|
|
if(!isType){ |
|
|
|
message.warning('当前物品类型与其他数据不一致,请重新选择!') |
|
|
|
} else { |
|
|
|
setV['itemCode'] = val[0]['itemCode'] |
|
|
|
setV['uom'] = val[0]['uom'] |
|
|
|
setV['inventoryStatus'] = val[0]['inventoryStatus'] |
|
|
|
setV['qty'] = val[0]['qty'] |
|
|
|
// 修改 tableform 属性 数量最大值设置为库存余额中数量 |
|
|
|
ProductionreturnRequestDetail.allSchemas.tableFormColumns.map(item => { |
|
|
|
if(item.field == 'qty' && val[0]['qty'] > 0) { |
|
|
|
item.tableForm.max = val[0]['qty'] |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} else if(formField == 'workStationCode') { |
|
|
|
setV['workStationCode'] = val[0]['code'] |
|
|
|
setV['fromLocationCode'] = val[0]['rawLocationCode'] |
|
|
@ -241,6 +279,7 @@ const butttondata = (row) => { |
|
|
|
hasPermi: '', |
|
|
|
link: true, // 文本展现按钮 |
|
|
|
}, |
|
|
|
defaultButtons.mainListPointBtn({hide:isShowMainButton(row,['3','6','8'])}), // 标签打印 |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
@ -380,6 +419,8 @@ const buttonTableClick = async (val, row) => { |
|
|
|
openForm('update', row) |
|
|
|
} else if (val == 'delete') { // 删除 |
|
|
|
handleDelete(row.id) |
|
|
|
} else if (val == 'point') { // 标签打印 |
|
|
|
handlePoint(row) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -470,11 +511,7 @@ const submitForm = async (formType, data) => { |
|
|
|
const submitFormLabel = async (formType, data) => { |
|
|
|
try { |
|
|
|
detatableData.tableList.forEach(async (item) => { |
|
|
|
await PackageApi.createPackageLabel(item).then(res => { |
|
|
|
if (res) { |
|
|
|
// 更新申请子表数据包装号 |
|
|
|
ProductionreturnRequestDetailApi.updateDetailPackingNumber(res.id,res.number) |
|
|
|
} |
|
|
|
await PackageApi.createPackageLabel(item).then(() => { |
|
|
|
isCreateLabel.value = true |
|
|
|
message.success('创建标签成功') |
|
|
|
}).catch(err => { |
|
|
@ -489,6 +526,41 @@ const submitFormLabel = async (formType, data) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const BASE_URL = import.meta.env.VITE_JMREPORT_BASE_URL |
|
|
|
// 标签打印 |
|
|
|
const handlePoint = async (row) => { |
|
|
|
// 查询是否已创建过标签 |
|
|
|
await PackageApi.getPackagePage({ |
|
|
|
requestNumber: row.number |
|
|
|
}).then((res) => { |
|
|
|
if(res.list.length > 0) { |
|
|
|
isCreateLabel.value = true |
|
|
|
if (res.list[0].productionLineCode != null) { |
|
|
|
labelType.value = 'zz' |
|
|
|
} else { |
|
|
|
labelType.value = 'cg' |
|
|
|
} |
|
|
|
} else { |
|
|
|
isCreateLabel.value = false |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
isCreateLabel.value = false |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
// 判断是采购还是制造 |
|
|
|
if (isCreateLabel.value) { |
|
|
|
if (labelType.value == 'cg') { |
|
|
|
const src = ref(BASE_URL + '/jmreport/view/904910575183290368?token=' + getAccessToken()) |
|
|
|
window.open(src.value+'&request_number='+row.number) |
|
|
|
} else { |
|
|
|
const src = ref(BASE_URL + '/jmreport/view/904911200226861056?token=' + getAccessToken()) |
|
|
|
window.open(src.value+'&request_number='+row.number) |
|
|
|
} |
|
|
|
} else { |
|
|
|
message.warning('请先创建标签') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 筛选提交 |
|
|
|
const searchFormClick = (searchData) => { |
|
|
|
tableObject.params = { |
|
|
|