|
|
|
|
@ -19,11 +19,11 @@
|
|
|
|
|
<el-button type="primary" plain icon="Plus" @click="parentTableAdd">新增</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button type="success" plain icon="Edit" :disabled="ids.length !== 1" @click="parentTableUpdate()">修改
|
|
|
|
|
<el-button type="success" plain icon="Edit" :disabled="ids.length !== 1" @click="parentTableUpdate(null)">修改
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button type="danger" plain icon="Delete" :disabled="ids.length < 1" @click="parentTableDelete()">删除
|
|
|
|
|
<el-button type="danger" plain icon="Delete" :disabled="ids.length < 1" @click="parentTableDelete(null)">删除
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<!-- <el-col :span="1.5">-->
|
|
|
|
|
@ -39,8 +39,8 @@
|
|
|
|
|
<el-table-column type="selection" width="55"/>
|
|
|
|
|
<el-table-column label="表主键" align="center" prop="aoId" v-if="false"/>
|
|
|
|
|
<el-table-column label="调拨单号" align="center" prop="allocateOrderCode"/>
|
|
|
|
|
<el-table-column label="物料大类" align="center" prop="materialCategoryName">
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<!-- <el-table-column label="物料大类" align="center" prop="materialCategoryName">
|
|
|
|
|
</el-table-column>-->
|
|
|
|
|
<el-table-column label="出库仓库" align="center" prop="planWarehouseCode"/>
|
|
|
|
|
<el-table-column label="工单状态" align="center" prop="orderStatus">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
@ -111,11 +111,27 @@
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="erp同步数量" align="center" prop="erpSynchronousQty"/>
|
|
|
|
|
<el-table-column label="操作" fixed="right" width="200">
|
|
|
|
|
<el-table-column label="已分包数量" align="center" prop="printedQty" />
|
|
|
|
|
<el-table-column label="操作" fixed="right" width="400">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<!-- <el-button size="small" @click="childrenTableUpdate( scope.row)">-->
|
|
|
|
|
<!-- 修改-->
|
|
|
|
|
<!-- </el-button>-->
|
|
|
|
|
<el-button size="small" @click="childrenTablePrint(scope.row)"
|
|
|
|
|
v-if="partntTableSelectCell && partntTableSelectCell.auditStatus == '1' && !hasExistingTasks(scope.row)"
|
|
|
|
|
type="primary">
|
|
|
|
|
创建任务
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button size="small" @click="recreateTasks(scope.row)"
|
|
|
|
|
v-if="hasExistingTasks(scope.row)"
|
|
|
|
|
type="warning">
|
|
|
|
|
重新创建
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button size="small" @click="deleteAllTasks(scope.row)"
|
|
|
|
|
v-if="hasExistingTasks(scope.row)"
|
|
|
|
|
type="danger">
|
|
|
|
|
删除任务
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button size="small" @click="viewPrintTasks(scope.row)">
|
|
|
|
|
查看任务
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
size="small"
|
|
|
|
|
type="danger"
|
|
|
|
|
@ -131,21 +147,21 @@
|
|
|
|
|
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="80%">
|
|
|
|
|
<el-card shadow="never">
|
|
|
|
|
<el-form :model="dialogForm" :inline="true" label-width="120px" :disabled="isView">
|
|
|
|
|
<el-form-item label="物料大类" prop="materialCategoryId">
|
|
|
|
|
<!-- <el-form-item label="物料大类" prop="materialCategoryId">-->
|
|
|
|
|
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="dialogForm.materialCategoryId"
|
|
|
|
|
placeholder="选择物料大类"
|
|
|
|
|
@change="setMaterialList"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in mategoryOptions"
|
|
|
|
|
:label="item.materialCategoryName"
|
|
|
|
|
:value="item.materialCategoryId"
|
|
|
|
|
:key="item.materialCategoryId"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<!-- <el-select-->
|
|
|
|
|
<!-- v-model="dialogForm.materialCategoryId"-->
|
|
|
|
|
<!-- placeholder="选择物料大类"-->
|
|
|
|
|
<!-- @change="setMaterialList"-->
|
|
|
|
|
<!-- >-->
|
|
|
|
|
<!-- <el-option-->
|
|
|
|
|
<!-- v-for="item in mategoryOptions"-->
|
|
|
|
|
<!-- :label="item.materialCategoryName"-->
|
|
|
|
|
<!-- :value="item.materialCategoryId"-->
|
|
|
|
|
<!-- :key="item.materialCategoryId"-->
|
|
|
|
|
<!-- />-->
|
|
|
|
|
<!-- </el-select>
|
|
|
|
|
</el-form-item>-->
|
|
|
|
|
<el-form-item label="出库仓库" prop="planWarehouseId">
|
|
|
|
|
<el-select v-model="dialogForm.planWarehouseId" placeholder="请选择所属仓库" @change="setMaterialList">
|
|
|
|
|
<el-option
|
|
|
|
|
@ -166,7 +182,7 @@
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="审核人" prop="auditBy">
|
|
|
|
|
<!-- <el-form-item label="审核人" prop="auditBy">
|
|
|
|
|
<el-select v-model="dialogForm.auditBy" placeholder="请选择审核人">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in userList"
|
|
|
|
|
@ -175,7 +191,7 @@
|
|
|
|
|
:value="item.userName"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form-item>-->
|
|
|
|
|
<el-form-item label="入库方式" prop="inMethod">
|
|
|
|
|
<el-select v-model="dialogForm.inMethod" placeholder="请选择入库方式">
|
|
|
|
|
<el-option
|
|
|
|
|
@ -213,25 +229,11 @@
|
|
|
|
|
</el-select>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="物料编码" prop="materialId">
|
|
|
|
|
<!-- <template #default="scope">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="scope.row.materialId"
|
|
|
|
|
placeholder="选择物料"
|
|
|
|
|
style="width: 240px"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="i in materialList"
|
|
|
|
|
:label="i.materialCode+'('+i.materialName+')'"
|
|
|
|
|
:value="i.materialId"
|
|
|
|
|
:key="i.materialId"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</template>-->
|
|
|
|
|
<el-table-column label="物料编码" prop="materialCode">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="scope.row.materialCode"
|
|
|
|
|
placeholder="请点击检索物料"
|
|
|
|
|
placeholder="请点击检索库存"
|
|
|
|
|
@click="handleMaterialAdd('material', scope.$index)" >
|
|
|
|
|
<template #append>
|
|
|
|
|
<el-icon class="el-input__icon"><search/></el-icon>
|
|
|
|
|
@ -239,26 +241,55 @@
|
|
|
|
|
</el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="物料名称">
|
|
|
|
|
<el-table-column label="物料名称" prop="materialName">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="scope.row.materialId"
|
|
|
|
|
placeholder="选择物料"
|
|
|
|
|
style="width: 240px"
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="scope.row.materialName"
|
|
|
|
|
placeholder="物料名称"
|
|
|
|
|
:disabled="true"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="i in materialList"
|
|
|
|
|
:label="i.materialName"
|
|
|
|
|
:value="i.materialId"
|
|
|
|
|
:key="i.materialId"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="批次码" prop="batchCode">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="scope.row.batchCode"
|
|
|
|
|
placeholder="批次码"
|
|
|
|
|
:disabled="true"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="库位编码" prop="locationCode">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="scope.row.locationCode"
|
|
|
|
|
placeholder="库位编码"
|
|
|
|
|
:disabled="true"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="库存数量" prop="inventoryQty">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="scope.row.inventoryQty"
|
|
|
|
|
placeholder="库存数量"
|
|
|
|
|
:disabled="true"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="调拨数量" prop="allocateOrderQty">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-input v-model="scope.row.allocateOrderQty" style="width: 240px" placeholder="输入调拨数量"/>
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="scope.row.allocateOrderQty"
|
|
|
|
|
style="width: 240px"
|
|
|
|
|
placeholder="输入调拨数量"
|
|
|
|
|
type="number"
|
|
|
|
|
@blur="validateRowAllocateQty(scope.row)"
|
|
|
|
|
:class="{ 'error-input': Number(scope.row.allocateOrderQty) > Number(scope.row.inventoryQty) }"
|
|
|
|
|
/>
|
|
|
|
|
<span v-if="Number(scope.row.allocateOrderQty) > Number(scope.row.inventoryQty)" style="color: red; font-size: 12px;">
|
|
|
|
|
超出库存数量
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="操作" fixed="right" width="200">
|
|
|
|
|
@ -304,23 +335,23 @@
|
|
|
|
|
<el-dialog v-model="parentTableInfoVisible" title="修改父表格" width="40%">
|
|
|
|
|
<el-form :model="parentTableInfoForm" label-width="120px">
|
|
|
|
|
<el-form-item label="id" prop="planWarehouseId"v-if="false">
|
|
|
|
|
<el-input v-model="parentTableInfoForm.aoid"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="物料大类" prop="materialCategoryId">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="parentTableInfoForm.materialCategoryId"
|
|
|
|
|
placeholder="选择物料大类"
|
|
|
|
|
:disabled="updateDialog"
|
|
|
|
|
@change="setMaterialList"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="i in material_mategoryId"
|
|
|
|
|
:label="i.label"
|
|
|
|
|
:value="i.value"
|
|
|
|
|
:key="i.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-input v-model="parentTableInfoForm.aoId"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<!-- <el-form-item label="物料大类" prop="materialCategoryId">-->
|
|
|
|
|
<!-- <el-select-->
|
|
|
|
|
<!-- v-model="parentTableInfoForm.materialCategoryId"-->
|
|
|
|
|
<!-- placeholder="选择物料大类"-->
|
|
|
|
|
<!-- :disabled="updateDialog"-->
|
|
|
|
|
<!-- @change="setMaterialList"-->
|
|
|
|
|
<!-- >-->
|
|
|
|
|
<!-- <el-option-->
|
|
|
|
|
<!-- v-for="i in material_mategoryId"-->
|
|
|
|
|
<!-- :label="i.label"-->
|
|
|
|
|
<!-- :value="i.value"-->
|
|
|
|
|
<!-- :key="i.value"-->
|
|
|
|
|
<!-- />-->
|
|
|
|
|
<!-- </el-select>-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<el-form-item label="出库仓库" prop="planWarehouseId">
|
|
|
|
|
<el-select v-model="parentTableInfoForm.planWarehouseId" placeholder="请选择所属仓库" :disabled="updateDialog">
|
|
|
|
|
<el-option
|
|
|
|
|
@ -341,7 +372,7 @@
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="审核人" prop="auditBy">
|
|
|
|
|
<!-- <el-form-item label="审核人" prop="auditBy">
|
|
|
|
|
<el-select v-model="parentTableInfoForm.auditBy" placeholder="请选择审核人">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in userList"
|
|
|
|
|
@ -350,7 +381,7 @@
|
|
|
|
|
:value="item.userName"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form-item>-->
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<div class="dialog-footer">
|
|
|
|
|
@ -364,7 +395,7 @@
|
|
|
|
|
|
|
|
|
|
<el-dialog v-model="childrenTableInfoVisible" title="修改子表格" width="40%">
|
|
|
|
|
<el-form :model="childrenTableInfoForm" label-width="120px">
|
|
|
|
|
<el-form-item label="物料大类" prop="materialCategoryId">
|
|
|
|
|
<!-- <el-form-item label="物料大类" prop="materialCategoryId">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="childrenTableInfoForm.materialCategoryId"
|
|
|
|
|
placeholder="选择物料大类"
|
|
|
|
|
@ -377,7 +408,7 @@
|
|
|
|
|
:key="i.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form-item>-->
|
|
|
|
|
<el-form-item label="出库仓库" prop="planWarehouseId">
|
|
|
|
|
<el-select v-model="childrenTableInfoForm.planWarehouseId" placeholder="请选择所属仓库">
|
|
|
|
|
<el-option
|
|
|
|
|
@ -398,7 +429,7 @@
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="审核人" prop="auditBy">
|
|
|
|
|
<!-- <el-form-item label="审核人" prop="auditBy">
|
|
|
|
|
<el-select v-model="childrenTableInfoForm.auditBy" placeholder="请选择审核人">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in userList"
|
|
|
|
|
@ -407,7 +438,7 @@
|
|
|
|
|
:value="item.userName"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form-item>-->
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<div class="dialog-footer">
|
|
|
|
|
@ -419,20 +450,119 @@
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<!-- 添加物料信息对话框 -->
|
|
|
|
|
<el-dialog title="选择物料信息" v-model="materialOpen" width='1200px' append-to-body>
|
|
|
|
|
<MaterialSelectInWMS
|
|
|
|
|
@selection="handleSelection"
|
|
|
|
|
ref="materialSelectRef"
|
|
|
|
|
<!-- 添加库存信息对话框 -->
|
|
|
|
|
<el-dialog title="选择库存信息" v-model="materialOpen" width='1200px' append-to-body>
|
|
|
|
|
<SelectInventoryInWMS
|
|
|
|
|
@selection="handleInventorySelection"
|
|
|
|
|
ref="inventorySelectRef"
|
|
|
|
|
v-if="materialOpen"
|
|
|
|
|
:materialCategories="dialogForm.materialCategories"
|
|
|
|
|
></MaterialSelectInWMS>
|
|
|
|
|
:materialCategoryId="dialogForm.materialCategoryId"
|
|
|
|
|
:warehouseId="dialogForm.planWarehouseId"
|
|
|
|
|
></SelectInventoryInWMS>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button type="primary" @click="submitMaterialForm">确 定</el-button>
|
|
|
|
|
<el-button type="primary" @click="submitInventoryForm">确 定</el-button>
|
|
|
|
|
<el-button @click="materialOpen = false">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<!-- 分包打印对话框 -->
|
|
|
|
|
<el-dialog title="调拨分包打印" v-model="printDialogVisible" width="600px" append-to-body>
|
|
|
|
|
<el-form :model="printForm" label-width="120px">
|
|
|
|
|
<el-form-item label="物料编码">
|
|
|
|
|
<el-input v-model="printForm.materialCode" readonly />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="物料名称">
|
|
|
|
|
<el-input v-model="printForm.materialName" readonly />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="调拨数量">
|
|
|
|
|
<el-input v-model="printForm.allocateOrderQty" readonly />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="打印模式" required>
|
|
|
|
|
<el-radio-group v-model="printForm.printMode" @change="onPrintModeChange">
|
|
|
|
|
<el-radio value="single">单包打印</el-radio>
|
|
|
|
|
<el-radio value="package">分包打印</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="分包数量" v-if="printForm.printMode === 'package'">
|
|
|
|
|
<el-input-number v-model="printForm.splitPackageCount" :min="2" :max="100" @change="onSplitCountChange" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="打印份数" v-if="printForm.printMode === 'single'">
|
|
|
|
|
<el-input-number v-model="printForm.printCopies" :min="1" :max="10" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="每包数量" v-if="printForm.printMode === 'package' && printForm.splitPackageCount > 1">
|
|
|
|
|
<div v-for="(qty, index) in printForm.packageQtyList" :key="index" style="margin-bottom: 10px">
|
|
|
|
|
<span style="width: 80px; display: inline-block">第{{index + 1}}包:</span>
|
|
|
|
|
<el-input-number v-model="printForm.packageQtyList[index]" :min="1" :max="printForm.allocateOrderQty" @change="validatePackageTotal" style="width: 150px" />
|
|
|
|
|
</div>
|
|
|
|
|
<div style="margin-top: 10px; color: #909399">
|
|
|
|
|
总计:{{ packageTotal }} / {{ printForm.allocateOrderQty }}
|
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<div class="dialog-footer">
|
|
|
|
|
<el-button @click="printDialogVisible = false">取消</el-button>
|
|
|
|
|
<el-button type="primary" @click="handlePrintSubmit" :disabled="!isValidPackage">确定打印</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<!-- 任务查看对话框 -->
|
|
|
|
|
<el-dialog title="调拨任务列表" v-model="taskDialogVisible" width="1000px" append-to-body>
|
|
|
|
|
<el-table :data="taskList" style="width: 100%">
|
|
|
|
|
<el-table-column label="批次码" align="center" prop="batchCode" />
|
|
|
|
|
<el-table-column label="每包数量" align="center" prop="materialQty" />
|
|
|
|
|
<el-table-column label="条码数量" align="center" prop="apportionQty" />
|
|
|
|
|
<el-table-column label="入库状态" align="center" prop="inboundStatus">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-tag :type="scope.row.inboundStatus === '0' ? 'warning' : scope.row.inboundStatus === '1' ? 'success' : 'info'">
|
|
|
|
|
{{ scope.row.inboundStatus === '0' ? '待入库' : scope.row.inboundStatus === '1' ? '已入库' : '入库中' }}
|
|
|
|
|
</el-tag>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="操作" align="center" width="200">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-button size="small" type="primary" @click="handleTaskPrint(scope.row)"
|
|
|
|
|
:disabled="scope.row.inboundStatus !== '0'">
|
|
|
|
|
打印
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button size="small" type="warning" @click="handleTaskEdit(scope.row)"
|
|
|
|
|
:disabled="scope.row.inboundStatus !== '0'">
|
|
|
|
|
编辑
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<div class="dialog-footer">
|
|
|
|
|
<el-button @click="taskDialogVisible = false">关闭</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<!-- 编辑任务对话框 -->
|
|
|
|
|
<el-dialog title="编辑调拨任务" v-model="editTaskDialogVisible" width="500px" append-to-body>
|
|
|
|
|
<el-form :model="editTaskForm" label-width="120px">
|
|
|
|
|
<el-form-item label="批次码" required>
|
|
|
|
|
<el-input v-model="editTaskForm.batchCode" placeholder="请输入批次码" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="每包数量" required>
|
|
|
|
|
<el-input-number v-model="editTaskForm.materialQty" :min="1" :max="10000" style="width: 100%" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<div class="dialog-footer">
|
|
|
|
|
<el-button @click="editTaskDialogVisible = false">取消</el-button>
|
|
|
|
|
<el-button type="primary" @click="handleTaskUpdate">确定</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
@ -444,10 +574,23 @@ import {
|
|
|
|
|
viewAllocateOrder,
|
|
|
|
|
addAllocateOrder,
|
|
|
|
|
addAllocateOrderDetail,
|
|
|
|
|
getMaterialList, viewAllocateOrderDetail, delAllocateOrderDetail, allocateOrderUpdate
|
|
|
|
|
getMaterialList,
|
|
|
|
|
viewAllocateOrderDetail,
|
|
|
|
|
delAllocateOrderDetail,
|
|
|
|
|
allocateOrderUpdate,
|
|
|
|
|
allocatePackagePrint,
|
|
|
|
|
queryTasksByDetailId,
|
|
|
|
|
validatePrintable,
|
|
|
|
|
triggerPrint,
|
|
|
|
|
recreateAllocateTasks,
|
|
|
|
|
updateTaskBarcode,
|
|
|
|
|
deleteTasksByDetailId
|
|
|
|
|
} from '@/api/wms/linkage'
|
|
|
|
|
|
|
|
|
|
import MaterialSelectInWMS from "@/views/wms/baseMaterialInfo/addMaterialInWMS.vue";
|
|
|
|
|
import SelectInventoryInWMS from "@/views/wms/inventory/selectInventoryInWMS.vue";
|
|
|
|
|
import {AllocateOrderForm} from '@/api/wms/allocateOrder/types';
|
|
|
|
|
import {AllocateOrderDetailForm} from '@/api/wms/allocateOrderDetail/types';
|
|
|
|
|
|
|
|
|
|
import {reactive} from 'vue'
|
|
|
|
|
import {ElMessage, ElMessageBox} from 'element-plus'
|
|
|
|
|
@ -481,15 +624,17 @@ interface User {
|
|
|
|
|
const parentTableTotal = ref(0)
|
|
|
|
|
const dialogVisible = ref(false)
|
|
|
|
|
const parentTableInfoVisible = ref(false)
|
|
|
|
|
const childrenTableInfoSubmit = ref(false)
|
|
|
|
|
const childrenTableInfoVisible = ref(false)
|
|
|
|
|
const showSearch = ref(true)
|
|
|
|
|
const columns = ref([])
|
|
|
|
|
const updateDialog = ref(false)
|
|
|
|
|
const dialogTitle = ref('添加')
|
|
|
|
|
const dialogForm = ref({})
|
|
|
|
|
const parentTableInfoForm = ref({})
|
|
|
|
|
const childrenTableInfoForm = ref({})
|
|
|
|
|
const dialogForm = ref<AllocateOrderForm>({})
|
|
|
|
|
const parentTableInfoForm = ref<AllocateOrderForm>({})
|
|
|
|
|
const childrenTableInfoForm = ref<AllocateOrderForm>({})
|
|
|
|
|
|
|
|
|
|
const queryForm = ref({
|
|
|
|
|
allocateCode: '',
|
|
|
|
|
allocateOrderCode: '',
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
pageSize: 10
|
|
|
|
|
})
|
|
|
|
|
@ -497,28 +642,60 @@ const parentTableRef = ref()
|
|
|
|
|
const parentTableData = ref([])
|
|
|
|
|
const ids = ref([])
|
|
|
|
|
const childrenTableData = ref([])
|
|
|
|
|
const dialogtable = ref([])
|
|
|
|
|
const baseStoreList = ref([]);
|
|
|
|
|
const dialogtable = ref<AllocateOrderDetailForm[]>([])
|
|
|
|
|
|
|
|
|
|
const userList = ref([]);
|
|
|
|
|
const materialList = ref([]);
|
|
|
|
|
const parentTableLoad = ref(false)
|
|
|
|
|
const childrenTableLoad = ref(false)
|
|
|
|
|
const isView = ref(false)
|
|
|
|
|
const partntTableSelectCell = ref({})
|
|
|
|
|
const partntTableSelectCell = ref<any>({})
|
|
|
|
|
|
|
|
|
|
// 打印相关变量
|
|
|
|
|
const printDialogVisible = ref(false)
|
|
|
|
|
const taskDialogVisible = ref(false)
|
|
|
|
|
const editTaskDialogVisible = ref(false)
|
|
|
|
|
const taskList = ref([])
|
|
|
|
|
const currentTasksMap = ref(new Map()) // 存储各个调拨明细的任务列表
|
|
|
|
|
const printForm = ref({
|
|
|
|
|
aoDId: null,
|
|
|
|
|
allocateCode: '',
|
|
|
|
|
materialCode: '',
|
|
|
|
|
materialName: '',
|
|
|
|
|
allocateOrderQty: 0,
|
|
|
|
|
printMode: 'single', // single: 单包打印, package: 分包打印
|
|
|
|
|
splitPackageCount: 2,
|
|
|
|
|
printCopies: 1,
|
|
|
|
|
packageQtyList: []
|
|
|
|
|
})
|
|
|
|
|
const editTaskForm = ref({
|
|
|
|
|
allocateTaskId: null,
|
|
|
|
|
batchCode: '',
|
|
|
|
|
materialQty: 1
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 获取仓库
|
|
|
|
|
getBaseWarehouseList().then(e => {
|
|
|
|
|
let baseStoreList = ref([]);
|
|
|
|
|
getBaseWarehouseList(null).then(e => {
|
|
|
|
|
baseStoreList.value = e.data
|
|
|
|
|
})
|
|
|
|
|
listUser().then(e => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
listUser({pageNum: 1, pageSize: 100}).then(e => {
|
|
|
|
|
userList.value = e.rows;
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
//获取物料大类下拉框
|
|
|
|
|
let mategoryOptions = ref([]);
|
|
|
|
|
let material_mategoryId = ref([]); // 兼容原有的物料大类下拉框
|
|
|
|
|
const getMaterialCategorySelect = async () => {
|
|
|
|
|
const res = await getBaseMaterialCategoryListInWMS(null);
|
|
|
|
|
mategoryOptions.value = res.data;
|
|
|
|
|
// 转换为兼容格式
|
|
|
|
|
material_mategoryId.value = res.data.map(item => ({
|
|
|
|
|
label: item.materialCategoryName,
|
|
|
|
|
value: item.materialCategoryId
|
|
|
|
|
}));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 获取父表格数据
|
|
|
|
|
@ -543,10 +720,11 @@ const getParentTable = async () => {
|
|
|
|
|
// 获取子表格数据
|
|
|
|
|
const getChildrenTable = async (form) => {
|
|
|
|
|
childrenTableLoad.value = true
|
|
|
|
|
await allocateOrderDetailList(form).then(e => {
|
|
|
|
|
await allocateOrderDetailList(form).then(async e => {
|
|
|
|
|
childrenTableLoad.value = false
|
|
|
|
|
childrenTableData.value = e.rows
|
|
|
|
|
// parentTableTotal.value = e.total
|
|
|
|
|
// 加载所有调拨明细的任务列表
|
|
|
|
|
await loadAllTasks()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -560,7 +738,9 @@ const query = async () => {
|
|
|
|
|
}
|
|
|
|
|
const reset = () => {
|
|
|
|
|
queryForm.value = {
|
|
|
|
|
allocateOrderCode: ''
|
|
|
|
|
allocateOrderCode: '',
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
pageSize: 10
|
|
|
|
|
}
|
|
|
|
|
getParentTable();
|
|
|
|
|
}
|
|
|
|
|
@ -652,6 +832,38 @@ const addDialogTableCell = () => {
|
|
|
|
|
|
|
|
|
|
// 新增提交
|
|
|
|
|
const dialogSubmit = () => {
|
|
|
|
|
// 验证所有调拨数量
|
|
|
|
|
let hasError = false;
|
|
|
|
|
for (let i = 0; i < dialogtable.value.length; i++) {
|
|
|
|
|
const row = dialogtable.value[i];
|
|
|
|
|
if (!row.materialId) {
|
|
|
|
|
ElMessage({
|
|
|
|
|
type: 'error',
|
|
|
|
|
message: `第${i + 1}行请选择库存信息`
|
|
|
|
|
});
|
|
|
|
|
hasError = true;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (!row.allocateOrderQty || row.allocateOrderQty <= 0) {
|
|
|
|
|
ElMessage({
|
|
|
|
|
type: 'error',
|
|
|
|
|
message: `第${i + 1}行调拨数量必须大于0`
|
|
|
|
|
});
|
|
|
|
|
hasError = true;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (Number(row.allocateOrderQty) > Number(row.inventoryQty)) {
|
|
|
|
|
ElMessage({
|
|
|
|
|
type: 'error',
|
|
|
|
|
message: `第${i + 1}行调拨数量(${row.allocateOrderQty})不能超过库存数量(${row.inventoryQty})`
|
|
|
|
|
});
|
|
|
|
|
hasError = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (hasError) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addAllocateOrder(dialogForm.value).then(e => {
|
|
|
|
|
addAllocateOrderDetail(dialogtable.value.map(item => {
|
|
|
|
|
@ -677,6 +889,15 @@ const parentTableInfoSubmit = () =>{
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const childrenTableInfoSubmit = () =>{
|
|
|
|
|
// TODO: 实现子表格修改提交逻辑
|
|
|
|
|
ElMessage({
|
|
|
|
|
type: 'success',
|
|
|
|
|
message: '修改完成',
|
|
|
|
|
})
|
|
|
|
|
childrenTableInfoVisible.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 子表格修改
|
|
|
|
|
const childrenTableUpdate = async (e) => {
|
|
|
|
|
childrenTableInfoForm.value = (await viewAllocateOrderDetail(e.aoDId)).data
|
|
|
|
|
@ -732,11 +953,13 @@ const childrenTableUDelete = (e) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 以下为添加物料信息对话框相关方法 */
|
|
|
|
|
let materialSelectRef = ref();//物料选择对话框绑定
|
|
|
|
|
const materialOpen = ref(false);//物料选择对话框显示
|
|
|
|
|
/* 以下为添加库存信息对话框相关方法 */
|
|
|
|
|
let inventorySelectRef = ref();//库存选择对话框绑定
|
|
|
|
|
let materialSelectRef = ref();//物料选择对话框绑定(兼容原有功能)
|
|
|
|
|
const materialOpen = ref(false);//库存选择对话框显示
|
|
|
|
|
const selectType = ref(''); // 用于标识当前选择的是哪个字段
|
|
|
|
|
const selectedMaterial = ref(null); // 存储选中的物料完整信息
|
|
|
|
|
const selectedInventory = ref(null); // 存储选中的库存完整信息
|
|
|
|
|
const selectedMaterial = ref(null); // 存储选中的物料完整信息(兼容原有的物料选择)
|
|
|
|
|
const currentRowIndex = ref(-1); // 存储当前正在编辑的行索引
|
|
|
|
|
|
|
|
|
|
/** 处理从MaterialSelect组件接收到的选择 */
|
|
|
|
|
@ -744,6 +967,87 @@ const handleSelection = (row) => {
|
|
|
|
|
selectedMaterial.value = row;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 处理从库存选择组件接收到的选择 */
|
|
|
|
|
const handleInventorySelection = (row) => {
|
|
|
|
|
console.log('库存选择数据:', row);
|
|
|
|
|
console.log('库存数量类型:', typeof row?.inventoryQty, '值:', row?.inventoryQty);
|
|
|
|
|
selectedInventory.value = row;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 验证调拨数量是否超过库存数量 */
|
|
|
|
|
const validateAllocateQty = (allocateQty, inventoryQty) => {
|
|
|
|
|
if (allocateQty > inventoryQty) {
|
|
|
|
|
ElMessage({
|
|
|
|
|
type: 'error',
|
|
|
|
|
message: `调拨数量(${allocateQty})不能超过库存数量(${inventoryQty})`
|
|
|
|
|
});
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 行级数量验证 */
|
|
|
|
|
const validateRowAllocateQty = (row) => {
|
|
|
|
|
if (row.allocateOrderQty && row.inventoryQty) {
|
|
|
|
|
const allocateQty = Number(row.allocateOrderQty);
|
|
|
|
|
const inventoryQty = Number(row.inventoryQty);
|
|
|
|
|
|
|
|
|
|
console.log(`验证数量: 调拨数量=${allocateQty}, 库存数量=${inventoryQty}`);
|
|
|
|
|
|
|
|
|
|
if (allocateQty > inventoryQty) {
|
|
|
|
|
ElMessage({
|
|
|
|
|
type: 'warning',
|
|
|
|
|
message: `第${dialogtable.value.indexOf(row) + 1}行调拨数量(${allocateQty})不能超过库存数量(${inventoryQty})`
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 提交库存信息按钮 */
|
|
|
|
|
const submitInventoryForm = () => {
|
|
|
|
|
if (!selectedInventory.value) {
|
|
|
|
|
// 如果没有选中行,则尝试从表格中获取
|
|
|
|
|
selectedInventory.value = inventorySelectRef.value?.tableRef?.store?.states?.currentRow?.value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!selectedInventory.value) {
|
|
|
|
|
ElMessage({
|
|
|
|
|
type: 'warning',
|
|
|
|
|
message: '请选择库存信息'
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log('提交库存信息:', selectedInventory.value);
|
|
|
|
|
console.log('库存数量:', selectedInventory.value.inventoryQty, '类型:', typeof selectedInventory.value.inventoryQty);
|
|
|
|
|
|
|
|
|
|
if (selectType.value === 'material') {
|
|
|
|
|
// 只更新当前正在编辑的行
|
|
|
|
|
if (currentRowIndex.value >= 0 && dialogtable.value[currentRowIndex.value]) {
|
|
|
|
|
dialogtable.value[currentRowIndex.value].materialId = Number(selectedInventory.value.materialId);
|
|
|
|
|
dialogtable.value[currentRowIndex.value].materialName = selectedInventory.value.materialName;
|
|
|
|
|
dialogtable.value[currentRowIndex.value].materialCode = selectedInventory.value.materialCode;
|
|
|
|
|
dialogtable.value[currentRowIndex.value].batchCode = selectedInventory.value.batchCode;
|
|
|
|
|
dialogtable.value[currentRowIndex.value].locationCode = selectedInventory.value.locationCode;
|
|
|
|
|
dialogtable.value[currentRowIndex.value].storeId = selectedInventory.value.storeId;
|
|
|
|
|
// 确保库存数量为数字类型
|
|
|
|
|
dialogtable.value[currentRowIndex.value].inventoryQty = Number(selectedInventory.value.inventoryQty);
|
|
|
|
|
|
|
|
|
|
console.log('赋值后的行数据:', dialogtable.value[currentRowIndex.value]);
|
|
|
|
|
console.log('赋值后的库存数量:', dialogtable.value[currentRowIndex.value].inventoryQty, '类型:', typeof dialogtable.value[currentRowIndex.value].inventoryQty);
|
|
|
|
|
|
|
|
|
|
// 初始化调拨数量为0,由用户手动输入
|
|
|
|
|
if (!dialogtable.value[currentRowIndex.value].allocateOrderQty) {
|
|
|
|
|
dialogtable.value[currentRowIndex.value].allocateOrderQty = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 重置选中的库存信息和关闭对话框
|
|
|
|
|
selectedInventory.value = null;
|
|
|
|
|
materialOpen.value = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 提交物料BOM信息按钮 */
|
|
|
|
|
const submitMaterialForm = () => {
|
|
|
|
|
if (!selectedMaterial.value) {
|
|
|
|
|
@ -758,8 +1062,6 @@ const submitMaterialForm = () => {
|
|
|
|
|
dialogtable.value[currentRowIndex.value].materialId = Number(selectedMaterial.value.materialId);
|
|
|
|
|
dialogtable.value[currentRowIndex.value].materialName = selectedMaterial.value.materialName;
|
|
|
|
|
dialogtable.value[currentRowIndex.value].materialCode = selectedMaterial.value.materialCode;
|
|
|
|
|
dialogtable.value[currentRowIndex.value].unitName = selectedMaterial.value.materialUnit;
|
|
|
|
|
dialogtable.value[currentRowIndex.value].materialSpe = selectedMaterial.value.materialSpec;
|
|
|
|
|
// 可以根据需要添加更多字段
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -777,6 +1079,264 @@ const handleMaterialAdd = (type, index) => {
|
|
|
|
|
materialOpen.value = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 判断调拨明细是否可以打印 */
|
|
|
|
|
const isPrintable = (row) => {
|
|
|
|
|
// 可以根据业务规则添加更多条件
|
|
|
|
|
return row.allocateOrderQty && row.allocateOrderQty > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 判断是否存在任务 */
|
|
|
|
|
const hasExistingTasks = (row) => {
|
|
|
|
|
const tasks = currentTasksMap.value.get(row.aoDId);
|
|
|
|
|
return tasks && tasks.length > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 加载调拨明细的任务列表 */
|
|
|
|
|
const loadTasksForDetail = async (aoDId) => {
|
|
|
|
|
try {
|
|
|
|
|
const result = await queryTasksByDetailId(aoDId);
|
|
|
|
|
currentTasksMap.value.set(aoDId, result.data || []);
|
|
|
|
|
return result.data || [];
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('查询任务错误:', error);
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 初始化加载所有调拨明细的任务 */
|
|
|
|
|
const loadAllTasks = async () => {
|
|
|
|
|
for (const detail of childrenTableData.value) {
|
|
|
|
|
await loadTasksForDetail(detail.aoDId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 打印按钮点击事件 */
|
|
|
|
|
const childrenTablePrint = async (row) => {
|
|
|
|
|
try {
|
|
|
|
|
// 检查是否已经打印过
|
|
|
|
|
const result = await validatePrintable(row.aoDId);
|
|
|
|
|
if (!result.data) {
|
|
|
|
|
ElMessage.warning('该调拨明细已经打印过,不允许重复打印');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 初始化打印表单
|
|
|
|
|
printForm.value = {
|
|
|
|
|
aoDId: row.aoDId,
|
|
|
|
|
allocateCode: row.allocateCode,
|
|
|
|
|
materialCode: row.materialCode,
|
|
|
|
|
materialName: row.materialName || '',
|
|
|
|
|
allocateOrderQty: Number(row.allocateOrderQty),
|
|
|
|
|
printMode: 'single',
|
|
|
|
|
splitPackageCount: 2,
|
|
|
|
|
printCopies: 1,
|
|
|
|
|
packageQtyList: []
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
printDialogVisible.value = true;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('打印验证错误:', error);
|
|
|
|
|
ElMessage.error('打印验证失败');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 查看任务按钮点击事件 */
|
|
|
|
|
const viewPrintTasks = async (row) => {
|
|
|
|
|
try {
|
|
|
|
|
const result = await queryTasksByDetailId(row.aoDId);
|
|
|
|
|
taskList.value = result.data || [];
|
|
|
|
|
taskDialogVisible.value = true;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('查询任务错误:', error);
|
|
|
|
|
ElMessage.error('查询任务失败');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 打印模式变化事件 */
|
|
|
|
|
const onPrintModeChange = () => {
|
|
|
|
|
if (printForm.value.printMode === 'package') {
|
|
|
|
|
onSplitCountChange();
|
|
|
|
|
} else {
|
|
|
|
|
printForm.value.packageQtyList = [];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 分包数量变化事件 */
|
|
|
|
|
const onSplitCountChange = () => {
|
|
|
|
|
const count = printForm.value.splitPackageCount;
|
|
|
|
|
const avgQty = Math.floor(printForm.value.allocateOrderQty / count);
|
|
|
|
|
const remainder = printForm.value.allocateOrderQty % count;
|
|
|
|
|
|
|
|
|
|
printForm.value.packageQtyList = [];
|
|
|
|
|
for (let i = 0; i < count; i++) {
|
|
|
|
|
// 将余数分配给前几包
|
|
|
|
|
const qty = i < remainder ? avgQty + 1 : avgQty;
|
|
|
|
|
printForm.value.packageQtyList.push(qty);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 验证分包总数 */
|
|
|
|
|
const validatePackageTotal = () => {
|
|
|
|
|
// 将触发计算属性重新计算
|
|
|
|
|
console.log('当前分包总计:', packageTotal.value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 计算属性:分包总数 */
|
|
|
|
|
const packageTotal = computed(() => {
|
|
|
|
|
return printForm.value.packageQtyList.reduce((sum, qty) => sum + (Number(qty) || 0), 0);
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
/** 计算属性:验证分包是否有效 */
|
|
|
|
|
const isValidPackage = computed(() => {
|
|
|
|
|
if (printForm.value.printMode === 'single') {
|
|
|
|
|
return printForm.value.printCopies > 0;
|
|
|
|
|
} else {
|
|
|
|
|
return packageTotal.value === printForm.value.allocateOrderQty &&
|
|
|
|
|
printForm.value.packageQtyList.every(qty => Number(qty) > 0);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
/** 重新创建任务 */
|
|
|
|
|
const recreateTasks = async (row) => {
|
|
|
|
|
try {
|
|
|
|
|
// 初始化打印表单
|
|
|
|
|
printForm.value = {
|
|
|
|
|
aoDId: row.aoDId,
|
|
|
|
|
allocateCode: row.allocateCode,
|
|
|
|
|
materialCode: row.materialCode,
|
|
|
|
|
materialName: row.materialName || '',
|
|
|
|
|
allocateOrderQty: Number(row.allocateOrderQty),
|
|
|
|
|
printMode: 'single',
|
|
|
|
|
splitPackageCount: 2,
|
|
|
|
|
printCopies: 1,
|
|
|
|
|
packageQtyList: []
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
printDialogVisible.value = true;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('重新创建错误:', error);
|
|
|
|
|
ElMessage.error('重新创建失败');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 删除所有任务 */
|
|
|
|
|
const deleteAllTasks = async (row) => {
|
|
|
|
|
try {
|
|
|
|
|
await ElMessageBox.confirm('确定要删除该调拨明细的所有任务吗?', '警告', {
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await deleteTasksByDetailId(row.aoDId);
|
|
|
|
|
ElMessage.success('删除成功');
|
|
|
|
|
|
|
|
|
|
// 更新任务列表
|
|
|
|
|
await loadTasksForDetail(row.aoDId);
|
|
|
|
|
// 刷新子表数据
|
|
|
|
|
if (partntTableSelectCell.value.allocateOrderCode) {
|
|
|
|
|
await getChildrenTable({allocateCode: partntTableSelectCell.value.allocateOrderCode});
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
if (error !== 'cancel') {
|
|
|
|
|
console.error('删除任务错误:', error);
|
|
|
|
|
ElMessage.error('删除任务失败:' + ((error as any).response?.data?.msg || (error as any).message || '未知错误'));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 任务打印按钮点击 */
|
|
|
|
|
const handleTaskPrint = async (task) => {
|
|
|
|
|
try {
|
|
|
|
|
await triggerPrint(task.allocateTaskId);
|
|
|
|
|
ElMessage.success('打印成功');
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('打印错误:', error);
|
|
|
|
|
ElMessage.error('打印失败:' + ((error as any).response?.data?.msg || (error as any).message || '未知错误'));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 任务编辑按钮点击 */
|
|
|
|
|
const handleTaskEdit = (task) => {
|
|
|
|
|
editTaskForm.value = {
|
|
|
|
|
allocateTaskId: task.allocateTaskId,
|
|
|
|
|
batchCode: task.batchCode,
|
|
|
|
|
materialQty: task.materialQty
|
|
|
|
|
};
|
|
|
|
|
editTaskDialogVisible.value = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 任务更新 */
|
|
|
|
|
const handleTaskUpdate = async () => {
|
|
|
|
|
try {
|
|
|
|
|
if (!editTaskForm.value.batchCode) {
|
|
|
|
|
ElMessage.error('请输入批次码');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!editTaskForm.value.materialQty || editTaskForm.value.materialQty <= 0) {
|
|
|
|
|
ElMessage.error('请输入正确的数量');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await updateTaskBarcode(editTaskForm.value);
|
|
|
|
|
ElMessage.success('修改成功');
|
|
|
|
|
editTaskDialogVisible.value = false;
|
|
|
|
|
|
|
|
|
|
// 刷新任务列表
|
|
|
|
|
const currentDetailId = taskList.value[0]?.aoDId;
|
|
|
|
|
if (currentDetailId) {
|
|
|
|
|
const result = await queryTasksByDetailId(currentDetailId);
|
|
|
|
|
taskList.value = result.data || [];
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('修改任务错误:', error);
|
|
|
|
|
ElMessage.error('修改失败:' + ((error as any).response?.data?.msg || (error as any).message || '未知错误'));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const handlePrintSubmit = async () => {
|
|
|
|
|
try {
|
|
|
|
|
if (!isValidPackage.value) {
|
|
|
|
|
ElMessage.error('请正确设置打印参数');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 判断是创建新任务还是重新创建
|
|
|
|
|
const hasExisting = hasExistingTasks({ aoDId: printForm.value.aoDId });
|
|
|
|
|
|
|
|
|
|
const params = {
|
|
|
|
|
aoDId: printForm.value.aoDId,
|
|
|
|
|
splitPackageCount: printForm.value.printMode === 'package' ? printForm.value.splitPackageCount : 1,
|
|
|
|
|
packageQtyList: printForm.value.printMode === 'package' ? printForm.value.packageQtyList : null
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (hasExisting) {
|
|
|
|
|
// 重新创建任务
|
|
|
|
|
await recreateAllocateTasks(params);
|
|
|
|
|
ElMessage.success('重新创建任务成功');
|
|
|
|
|
} else {
|
|
|
|
|
// 创建新任务
|
|
|
|
|
const createParams = {
|
|
|
|
|
...params,
|
|
|
|
|
allocateCode: printForm.value.allocateCode,
|
|
|
|
|
printCopies: printForm.value.printMode === 'single' ? printForm.value.printCopies : 1
|
|
|
|
|
};
|
|
|
|
|
await allocatePackagePrint(createParams);
|
|
|
|
|
ElMessage.success('创建任务成功');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printDialogVisible.value = false;
|
|
|
|
|
|
|
|
|
|
// 刷新任务列表和子表数据
|
|
|
|
|
await loadTasksForDetail(printForm.value.aoDId);
|
|
|
|
|
if (partntTableSelectCell.value.allocateOrderCode) {
|
|
|
|
|
await getChildrenTable({allocateCode: partntTableSelectCell.value.allocateOrderCode});
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('操作错误:', error);
|
|
|
|
|
ElMessage.error('操作失败:' + ((error as any).response?.data?.msg || (error as any).message || '未知错误'));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
<style>
|
|
|
|
|
.demo-form-inline .el-input {
|
|
|
|
|
@ -786,4 +1346,9 @@ const handleMaterialAdd = (type, index) => {
|
|
|
|
|
.demo-form-inline .el-select {
|
|
|
|
|
--el-select-width: 220px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.error-input .el-input__wrapper {
|
|
|
|
|
border-color: #f56c6c !important;
|
|
|
|
|
box-shadow: 0 0 0 1px #f56c6c inset !important;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|