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