|
|
@ -70,14 +70,30 @@ |
|
|
|
@searchTableSuccessDetail="searchTableSuccessDetail" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 创建标签 --> |
|
|
|
<BasicForm |
|
|
|
ref="formLabelRef" |
|
|
|
@success="getList" |
|
|
|
:tableAllSchemas="detailListTableColumns" |
|
|
|
:tableFormRules="ProductionreturnRequestDetailLabelRules" |
|
|
|
:tableData="detatableData.tableList" |
|
|
|
:isBusiness="true" |
|
|
|
:isShowButton="false" |
|
|
|
@handleAddTable="handleAddTable" |
|
|
|
@handleDeleteTable="handleDeleteTable" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
@submitForm="submitFormLabel" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { ProductionreturnRequestMain,ProductionreturnRequestMainRules,ProductionreturnRequestDetail,ProductionreturnRequestDetailRules } from './productionreturnRequestMain.data' |
|
|
|
import { ProductionreturnRequestMain,ProductionreturnRequestMainRules,ProductionreturnRequestDetail,ProductionreturnRequestDetailRules,ProductionreturnRequestDetailLabel,ProductionreturnRequestDetailLabelRules } from './productionreturnRequestMain.data' |
|
|
|
import * as ProductionreturnRequestMainApi from '@/api/wms/productionreturnRequestMain' |
|
|
|
import * as ProductionreturnRequestDetailApi from '@/api/wms/productionreturnRequestDetail' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import * as ItembasicApi from '@/api/wms/itembasic' |
|
|
|
import * as PackageApi from '@/api/wms/package' |
|
|
|
|
|
|
|
// 生产退料申请 |
|
|
|
defineOptions({ name: 'ProductionreturnRequestMain' }) |
|
|
@ -90,6 +106,24 @@ const routeName = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref(ProductionreturnRequestMain.allSchemas.tableColumns) |
|
|
|
|
|
|
|
//创建标签 |
|
|
|
const dialogVisible = ref(false) |
|
|
|
const dialogTitle = ref('创建标签') |
|
|
|
const detailListTableColumns = ProductionreturnRequestDetailLabel.allSchemas |
|
|
|
const isCreateLabel = ref(false) |
|
|
|
const formLabelRef = ref() |
|
|
|
//创建标签 |
|
|
|
const { tableObject: detatableData, tableMethods: detatableMethods } =useTable({ |
|
|
|
getListApi: ProductionreturnRequestDetailApi.getProductionreturnRequestDetailPage |
|
|
|
}) |
|
|
|
const { getList:getDetailList } = detatableMethods |
|
|
|
|
|
|
|
//创建标签保存 |
|
|
|
const saveLabel = () => { |
|
|
|
|
|
|
|
isCreateLabel.value = true |
|
|
|
} |
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
const updataTableColumns = (val) => { |
|
|
|
tableColumns.value = val |
|
|
@ -132,12 +166,21 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|
|
|
nextTick(() => { |
|
|
|
const setV = {} |
|
|
|
if(formField == 'packingNumber') { |
|
|
|
setV['packingNumber'] = val[0]['packingNumber'] |
|
|
|
setV['containerNumber'] = val[0]['containerNumber'] |
|
|
|
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') { |
|
|
|
item.tableForm.max = val[0]['qty'] |
|
|
|
} |
|
|
|
}) |
|
|
|
} else if(formField == 'workStationCode') { |
|
|
|
setV['workStationCode'] = val[0]['code'] |
|
|
|
setV['fromLocationCode'] = val[0]['rawLocationCode'] |
|
|
|
} else { |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
} |
|
|
@ -192,10 +235,21 @@ const butttondata = (row) => { |
|
|
|
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['4','5']), hasPermi:'wms:productionreturn-request-main:reAdd'}), // 重新添加 |
|
|
|
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']), hasPermi:'wms:productionreturn-request-main:submit'}), // 提交审批 |
|
|
|
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']), hasPermi:'wms:productionreturn-request-main:refused'}), // 驳回 |
|
|
|
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']), hasPermi:'wms:productionreturn-request-main:handle'}), // 审批通过 |
|
|
|
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']), hasPermi:'wms:productionreturn-request-main:update'}), // 处理 |
|
|
|
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']), hasPermi:'wms:productionreturn-request-main:agree'}), // 审批通过 |
|
|
|
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']), hasPermi:'wms:productionreturn-request-main:handle'}), // 处理 |
|
|
|
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']), hasPermi:'wms:productionreturn-request-main:update'}), // 编辑 |
|
|
|
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:productionreturn-request-main:delete'}), // 删除 |
|
|
|
// 创建标签 |
|
|
|
{ |
|
|
|
label: '创建标签', |
|
|
|
name: 'cjbq', |
|
|
|
hide: isShowMainButton(row,['3']), |
|
|
|
type: 'primary', |
|
|
|
icon: '', |
|
|
|
color: '', |
|
|
|
hasPermi: '', |
|
|
|
link: true, // 文本展现按钮 |
|
|
|
}, |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
@ -234,13 +288,79 @@ const buttonTableClick = async (val, row) => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
} else if (val == 'mainApprove') { // 审批通过 |
|
|
|
await message.confirm('确认要审批通过吗?') |
|
|
|
ProductionreturnRequestMainApi.agree(row.id).then(() => { |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
getList() |
|
|
|
}).catch(err => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
} else if (val == 'cjbq') { // 创建标签 |
|
|
|
detatableData.params = { |
|
|
|
masterId:row.id |
|
|
|
} |
|
|
|
await getDetailList() |
|
|
|
// 判断 是否已创建标签 |
|
|
|
if (detatableData.tableList[0].packingNumber) { |
|
|
|
message.warning('已创建过标签!!!') |
|
|
|
return |
|
|
|
} |
|
|
|
// 打开创建标签页面 |
|
|
|
// dialogVisible.value = true |
|
|
|
formLabelRef.value.open('create', row) |
|
|
|
detatableData.tableList.map((item) => { |
|
|
|
item.batch = '000000' |
|
|
|
// 查询物品类型 原料 只能选择 供应商代码 半成品成品其他 只能选择 生产线 |
|
|
|
ItembasicApi.getItembasicPage({ |
|
|
|
pageSize: 10, |
|
|
|
pageNo: 1, |
|
|
|
code: item.itemCode, |
|
|
|
sort: '', |
|
|
|
by: 'ASC', |
|
|
|
}).then(res => { |
|
|
|
if (res.list.length > 0) { |
|
|
|
// 判断物品类型 是否 原料 |
|
|
|
if (res.list[0].type == "RAW") { |
|
|
|
// 修改 tableform 属性 |
|
|
|
detailListTableColumns.tableFormColumns.map(item => { |
|
|
|
if(item.field == 'productionLineCodePackage') { |
|
|
|
item.tableForm.isInpuFocusShow = false |
|
|
|
item.tableForm.disabled = true |
|
|
|
ProductionreturnRequestDetailLabelRules.productionLineCodePackage[0].required = false |
|
|
|
} |
|
|
|
if(item.field == 'supplierItemCode') { |
|
|
|
item.tableForm.isInpuFocusShow = true |
|
|
|
item.tableForm.disabled = false |
|
|
|
ProductionreturnRequestDetailLabelRules.supplierItemCode[0].required = true |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
// 修改 tableform 属性 |
|
|
|
detailListTableColumns.tableFormColumns.map(item => { |
|
|
|
if(item.field == 'supplierItemCode') { |
|
|
|
item.tableForm.isInpuFocusShow = false |
|
|
|
item.tableForm.disabled = true |
|
|
|
ProductionreturnRequestDetailLabelRules.supplierItemCode[0].required = false |
|
|
|
} |
|
|
|
if(item.field == 'productionLineCodePackage') { |
|
|
|
item.tableForm.isInpuFocusShow = true |
|
|
|
item.tableForm.disabled = false |
|
|
|
ProductionreturnRequestDetailLabelRules.productionLineCodePackage[0].required = true |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} else { |
|
|
|
message.warning('没有查询到物品代码:【' + item.itemCode + '】') |
|
|
|
return |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
} else if (val == 'mainHandle') { // 处理 |
|
|
|
if (!isCreateLabel.value) { |
|
|
|
message.warning('请先创建标签') |
|
|
|
return |
|
|
|
} |
|
|
|
ProductionreturnRequestMainApi.handle(row.id).then(() => { |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
getList() |
|
|
@ -335,6 +455,25 @@ const submitForm = async (formType, data) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 创建标签 |
|
|
|
const submitFormLabel = async (formType, data) => { |
|
|
|
try { |
|
|
|
detatableData.tableList.forEach(async (item) => { |
|
|
|
await PackageApi.createPackageLabel(item).then(res => { |
|
|
|
isCreateLabel.value = true |
|
|
|
message.success('创建标签成功') |
|
|
|
}).catch(err => { |
|
|
|
isCreateLabel.value = false |
|
|
|
console.log(err) |
|
|
|
message.error('创建标签失败') |
|
|
|
}) |
|
|
|
}) |
|
|
|
} finally { |
|
|
|
formLabelRef.value.formLoading = false |
|
|
|
formLabelRef.value.dialogVisible = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 筛选提交 |
|
|
|
const searchFormClick = (searchData) => { |
|
|
|
tableObject.params = { |
|
|
|