forked from BaoKaiWms/202501-Wms-Kate-Wuxi
1. 修复一些bug
2. 增加盘点功能
This commit is contained in:
parent
89099c5fcb
commit
f60c8c6295
|
|
@ -38,4 +38,28 @@ export const confirmCurrentTask = (params) => {
|
|||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
// 请求盘点
|
||||
export const requestInventory = (params) => {
|
||||
return request({
|
||||
url: '/task/requestInventory',
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
// 获取盘点信息
|
||||
export const getInventoryConfirm = (params) => {
|
||||
return request({
|
||||
url: '/task/getInventoryConfirm',
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
// 确认盘点信息
|
||||
export const confirmInventory = (params) => {
|
||||
return request({
|
||||
url: '/task/confirmInventory',
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
|
@ -1,150 +1,158 @@
|
|||
<template>
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-container class="content">
|
||||
<div class="work-area">
|
||||
<fieldset class="main-area">
|
||||
<el-form ref="inTaskRef" :model="inTaskEntity" :label-position="labelPosition" label-width="158px"
|
||||
style="max-width: 100%" :rules="rules" status-icon>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="入库类型" prop="emptyTask">
|
||||
<el-select-v2 v-model="inTaskEntity.emptyTask" placeholder="请选择入库类型"
|
||||
:options="inTypeOptions"
|
||||
:disabled="taskRequestEntity.vehicleId != ''"></el-select-v2>
|
||||
</el-form-item>
|
||||
<el-form-item label="箱号" prop="vehicleId">
|
||||
<el-input v-model="inTaskEntity.vehicleId" ref="vehicleId"
|
||||
:disabled="taskRequestEntity.vehicleId != ''" clearable
|
||||
@keyup.enter="handleEnter()" />
|
||||
</el-form-item>
|
||||
<el-form-item label="料号">
|
||||
<el-input v-model="inTaskEntity.goodsId" ref="goodsId"
|
||||
:disabled="inTaskEntity.emptyTask" clearable @keyup.enter="handleEnter()" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数量">
|
||||
<el-input-number v-model.number="inTaskEntity.opNum" ref="opNum"
|
||||
:disabled="inTaskEntity.emptyTask" controls-position="right" :min="1" clearable
|
||||
@keyup.enter="handleEnter()" />
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button type="success"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="confirmBinding()">绑定物料</el-button>
|
||||
<el-button type="warning"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="clearInput()">清除输入</el-button>
|
||||
<el-button type="primary"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="openOutForInDialog()">入库料扫码</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<fieldset class="confirm-area" v-if="taskRequestEntity.vehicleId != ''">
|
||||
<el-form ref="taskRequestRef" :model="taskRequestEntity" :label-position="labelPosition"
|
||||
label-width="158px" style="max-width: 100%" :rules="rules" status-icon>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="入库类型">
|
||||
<el-select-v2 v-model="taskRequestEntity.emptyTask" placeholder="请选择入库类型"
|
||||
:options="inTypeOptions" disabled></el-select-v2>
|
||||
</el-form-item>
|
||||
<el-form-item label="箱号">
|
||||
<el-input v-model="taskRequestEntity.vehicleId" disabled />
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button type="success" ref="sendTaskRef"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="confirmTasks()">下发任务</el-button>
|
||||
<el-button type="danger"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="cancelBinding()">取消绑定</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-form>
|
||||
<el-table :data="taskRequestEntity.goodsInfo" stripe border class="table-class" max-height="450px"
|
||||
:header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }"
|
||||
v-if="taskRequestEntity.goodsInfo.length != 0">
|
||||
<el-table-column prop="goodsId" label="零件号" fixed="left" />
|
||||
<el-table-column prop="opNum" label="数量" />
|
||||
<el-table-column fixed="right" label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button plain type="warning" @click="removeThisRow(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</fieldset>
|
||||
<el-dialog v-model="showInOutDialog" title="入库清单扫码" width="70%" draggable>
|
||||
<fieldset class="main-area">
|
||||
<el-form ref="outForInRef" :model="outForInEntity" :label-position="labelPosition"
|
||||
label-width="158px" style="max-width: 100%" :rules="outForInRules" status-icon
|
||||
@submit.native.prevent>
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="料号">
|
||||
<el-input v-model="outForInEntity.goodsId" ref="forInGoodsId" clearable
|
||||
@keyup.enter="addForInGoods()" />
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button type="success"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="addForInGoods()">添加物料</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<fieldset class="confirm-area" v-if="outForInRequestEntity.goodsIds.length != 0">
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
<el-button type="success"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto auto; font-size: large; color: black;"
|
||||
@click="confirmCallVehicles()">确认需求</el-button>
|
||||
</div>
|
||||
<el-table ref="outForInTableRef" :data="outForInRequestEntity.goodsIds" stripe border
|
||||
class="table-class" max-height="200px" :header-cell-style="{ 'text-align': 'center' }"
|
||||
:cell-style="{ 'text-align': 'center' }">
|
||||
<el-table-column prop="goodsId" label="料号" fixed="left" />
|
||||
<el-table-column fixed="right" label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button plain type="warning" @click="popThisGoodsId(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</fieldset>
|
||||
</el-dialog>
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-container class="content">
|
||||
<div class="work-area">
|
||||
<fieldset class="main-area">
|
||||
<el-form ref="inTaskRef" :model="inTaskEntity" :label-position="labelPosition" label-width="158px"
|
||||
style="max-width: 100%" :rules="rules" status-icon>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="入库类型" prop="emptyTask">
|
||||
<el-select-v2 v-model="inTaskEntity.emptyTask" placeholder="请选择入库类型"
|
||||
:options="inTypeOptions"
|
||||
:disabled="taskRequestEntity.vehicleId != ''"></el-select-v2>
|
||||
</el-form-item>
|
||||
<el-form-item label="箱号" prop="vehicleId">
|
||||
<el-input v-model="inTaskEntity.vehicleId" ref="vehicleId"
|
||||
:disabled="taskRequestEntity.vehicleId != ''" clearable
|
||||
@keyup.enter="handleEnter()"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="料号">
|
||||
<el-input v-model="inTaskEntity.goodsId" ref="goodsId"
|
||||
:disabled="inTaskEntity.emptyTask" clearable @keyup.enter="handleEnter()"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量">
|
||||
<el-input-number v-model.number="inTaskEntity.opNum" ref="opNum"
|
||||
:disabled="inTaskEntity.emptyTask" controls-position="right" :min="1" clearable
|
||||
@keyup.enter="handleEnter()"/>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button type="success"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="confirmBinding()">绑定物料
|
||||
</el-button>
|
||||
<el-button type="warning"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="clearInput()">清除输入
|
||||
</el-button>
|
||||
<el-button type="primary"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="openOutForInDialog()">入库料扫码
|
||||
</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-container>
|
||||
</el-config-provider>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<fieldset class="confirm-area" v-if="taskRequestEntity.vehicleId != ''">
|
||||
<el-form ref="taskRequestRef" :model="taskRequestEntity" :label-position="labelPosition"
|
||||
label-width="158px" style="max-width: 100%" :rules="rules" status-icon>
|
||||
<div style="display: flex;justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="入库类型">
|
||||
<el-select-v2 v-model="taskRequestEntity.emptyTask" placeholder="请选择入库类型"
|
||||
:options="inTypeOptions" disabled></el-select-v2>
|
||||
</el-form-item>
|
||||
<el-form-item label="箱号">
|
||||
<el-input v-model="taskRequestEntity.vehicleId" disabled/>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button type="success" ref="sendTaskRef"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="confirmTasks()">下发任务
|
||||
</el-button>
|
||||
<el-button type="danger"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="cancelBinding()">取消绑定
|
||||
</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-form>
|
||||
<el-table :data="taskRequestEntity.goodsInfo" stripe border class="table-class" max-height="450px"
|
||||
:header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }"
|
||||
v-if="taskRequestEntity.goodsInfo.length != 0">
|
||||
<el-table-column prop="goodsId" label="零件号" fixed="left"/>
|
||||
<el-table-column prop="opNum" label="数量"/>
|
||||
<el-table-column fixed="right" label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button plain type="warning" @click="removeThisRow(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</fieldset>
|
||||
<el-dialog v-model="showInOutDialog" title="入库清单扫码" width="70%" draggable>
|
||||
<fieldset class="main-area">
|
||||
<el-form ref="outForInRef" :model="outForInEntity" :label-position="labelPosition"
|
||||
label-width="158px" style="max-width: 100%" :rules="outForInRules" status-icon
|
||||
@submit.native.prevent>
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="料号">
|
||||
<el-input v-model="outForInEntity.goodsId" ref="forInGoodsId" clearable
|
||||
@keyup.enter="addForInGoods()"/>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button type="success"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="addForInGoods()">添加物料
|
||||
</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<fieldset class="confirm-area" v-if="outForInRequestEntity.goodsIds.length != 0">
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
<el-button type="success"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto auto; font-size: large; color: black;"
|
||||
@click="confirmCallVehicles()">确认需求
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table ref="outForInTableRef" :data="outForInRequestEntity.goodsIds" stripe border
|
||||
class="table-class" max-height="200px" :header-cell-style="{ 'text-align': 'center' }"
|
||||
:cell-style="{ 'text-align': 'center' }">
|
||||
<el-table-column prop="goodsId" label="料号" fixed="left"/>
|
||||
<el-table-column fixed="right" label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button plain type="warning" @click="popThisGoodsId(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</fieldset>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</el-container>
|
||||
</el-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import store from '@/store'
|
||||
import { requireStockIn, requireVehiclesForIn } from '@/api/task.js'
|
||||
import { errorBox, successBox } from '@/utils/myMessageBox.js'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { nextTick, onMounted, reactive, ref } from 'vue'
|
||||
import { loading } from '@/utils/loading.js'
|
||||
import {requireStockIn, requireVehiclesForIn} from '@/api/task.js'
|
||||
import {errorBox, successBox} from '@/utils/myMessageBox.js'
|
||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||
import {nextTick, onMounted, reactive, ref} from 'vue'
|
||||
import {loading} from '@/utils/loading.js'
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
import { labelPosition } from '@/constant/form'
|
||||
import {labelPosition} from '@/constant/form'
|
||||
|
||||
const inTypeOptions = [
|
||||
{
|
||||
label: '空箱入库',
|
||||
value: true
|
||||
},
|
||||
{
|
||||
label: '非空箱入库',
|
||||
value: false
|
||||
}
|
||||
{
|
||||
label: '空箱入库',
|
||||
value: true
|
||||
},
|
||||
{
|
||||
label: '非空箱入库',
|
||||
value: false
|
||||
}
|
||||
]
|
||||
const rules = reactive({
|
||||
emptyTask: [
|
||||
{ required: true, message: '请选择入库类型。' }
|
||||
],
|
||||
vehicleId: [
|
||||
{ required: true, message: '请输入箱号。' }
|
||||
]
|
||||
emptyTask: [
|
||||
{required: true, message: '请选择入库类型。'}
|
||||
],
|
||||
vehicleId: [
|
||||
{required: true, message: '请输入箱号。'}
|
||||
]
|
||||
})
|
||||
const vehicleId = ref()
|
||||
const goodsId = ref()
|
||||
|
|
@ -152,383 +160,409 @@ const opNum = ref()
|
|||
const sendTaskRef = ref()
|
||||
let inTaskRef = ref()
|
||||
let inTaskEntity = reactive({
|
||||
emptyTask: false,
|
||||
vehicleId: '',
|
||||
goodsId: '',
|
||||
opNum: null
|
||||
emptyTask: false,
|
||||
vehicleId: '',
|
||||
goodsId: '',
|
||||
opNum: null
|
||||
})
|
||||
let taskRequestRef = ref()
|
||||
let taskRequestEntity = reactive({
|
||||
emptyTask: false,
|
||||
vehicleId: '',
|
||||
origin: store.getters.getStandId,
|
||||
goodsInfo: [],
|
||||
standId: store.getters.getStandId,
|
||||
userName: store.getters.getUserName
|
||||
emptyTask: false,
|
||||
vehicleId: '',
|
||||
origin: store.getters.getStandId,
|
||||
goodsInfo: [],
|
||||
standId: store.getters.getStandId,
|
||||
userName: store.getters.getUserName
|
||||
})
|
||||
let showInOutDialog = ref(false)
|
||||
let outForInRef = ref()
|
||||
let outForInEntity = reactive({
|
||||
goodsId: '',
|
||||
goodsId: '',
|
||||
})
|
||||
const outForInRules = reactive({
|
||||
goodsId: [
|
||||
{ required: true, message: '请输入料号。' }
|
||||
]
|
||||
goodsId: [
|
||||
{required: true, message: '请输入料号。'}
|
||||
]
|
||||
})
|
||||
const forInGoodsId = ref()
|
||||
let outForInRequestEntity = reactive({
|
||||
goodsIds: [],
|
||||
origin: store.getters.getStandId,
|
||||
standId: store.getters.getStandId,
|
||||
userName: store.getters.getUserName
|
||||
goodsIds: [],
|
||||
origin: store.getters.getStandId,
|
||||
standId: store.getters.getStandId,
|
||||
userName: store.getters.getUserName
|
||||
})
|
||||
const outForInTableRef = ref()
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
vehicleId.value.focus()
|
||||
})
|
||||
nextTick(() => {
|
||||
vehicleId.value.focus()
|
||||
})
|
||||
})
|
||||
// 处理回车事件
|
||||
const handleEnter = () => {
|
||||
changeFocus()
|
||||
changeFocus()
|
||||
}
|
||||
// 改变输入焦点
|
||||
const changeFocus = () => {
|
||||
// 进行大写格式化
|
||||
inTaskEntity.vehicleId = inTaskEntity.vehicleId.toUpperCase()
|
||||
inTaskEntity.goodsId = inTaskEntity.goodsId.toUpperCase()
|
||||
if (inTaskEntity.vehicleId == '') {
|
||||
// 进行大写格式化
|
||||
inTaskEntity.vehicleId = inTaskEntity.vehicleId.toUpperCase().trim()
|
||||
inTaskEntity.goodsId = inTaskEntity.goodsId.toUpperCase().trim()
|
||||
if (inTaskEntity.vehicleId == '') {
|
||||
vehicleId.value.focus()
|
||||
return
|
||||
}
|
||||
// 进行格式判断
|
||||
if (inTaskEntity.vehicleId != '') {
|
||||
const vehicleArray = inTaskEntity.vehicleId.split('-')
|
||||
if (vehicleArray.length != 2) {
|
||||
errorBox('箱号格式不正确,正确格式为“ASRS-XXXX”。')
|
||||
vehicleId.value.focus()
|
||||
return
|
||||
} else {
|
||||
if (vehicleArray[0] != 'ASRS' || !numberCheck(vehicleArray[1]) || vehicleArray[1].length != 4) {
|
||||
errorBox('箱号格式不正确,正确格式为“ASRS-XXXX”。')
|
||||
vehicleId.value.focus()
|
||||
return
|
||||
}
|
||||
// 进行格式判断
|
||||
if (inTaskEntity.vehicleId != '') {
|
||||
const vehicleArray = inTaskEntity.vehicleId.split('-')
|
||||
if (vehicleArray.length != 2) {
|
||||
errorBox('箱号格式不正确,正确格式为“ASRS-XXXX”。')
|
||||
vehicleId.value.focus()
|
||||
return
|
||||
} else {
|
||||
if (vehicleArray[0] != 'ASRS' || !numberCheck(vehicleArray[1]) || vehicleArray[1].length != 4) {
|
||||
errorBox('箱号格式不正确,正确格式为“ASRS-XXXX”。')
|
||||
vehicleId.value.focus()
|
||||
return
|
||||
} else if (parseInt(vehicleArray[1]) < 1 || parseInt(vehicleArray[1]) > 2200) {
|
||||
errorBox('箱号范围是0001~2200。')
|
||||
vehicleId.value.focus()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if (inTaskEntity.opNum != null) {
|
||||
if (inTaskEntity.opNum < 0 || inTaskEntity.opNum > 99999) {
|
||||
errorBox('数量不正确,应该为1-99999之间的整数值。')
|
||||
opNum.value.focus()
|
||||
return
|
||||
}
|
||||
}
|
||||
// 非空箱入库
|
||||
if (!inTaskEntity.emptyTask) {
|
||||
if (inTaskEntity.goodsId == '') {
|
||||
goodsId.value.focus()
|
||||
return
|
||||
}
|
||||
if (inTaskEntity.opNum == null || inTaskEntity.opNum == '') {
|
||||
opNum.value.focus()
|
||||
return
|
||||
}
|
||||
}
|
||||
if (inTaskEntity.goodsId == inTaskEntity.vehicleId || inTaskEntity.goodsId == inTaskEntity.opNum || inTaskEntity.vehicleId == inTaskEntity.opNum) {
|
||||
errorBox('箱号、料号、数量必须为互不相同。')
|
||||
goodsId.value.focus()
|
||||
} else if (parseInt(vehicleArray[1]) < 1 || parseInt(vehicleArray[1]) > 2200) {
|
||||
errorBox('箱号范围是0001~2200。')
|
||||
vehicleId.value.focus()
|
||||
return
|
||||
}
|
||||
}
|
||||
addBinding()
|
||||
}
|
||||
if (inTaskEntity.opNum != null) {
|
||||
if (inTaskEntity.opNum < 0 || inTaskEntity.opNum > 99999) {
|
||||
errorBox('数量不正确,应该为1-99999之间的整数值。')
|
||||
opNum.value.focus()
|
||||
return
|
||||
}
|
||||
}
|
||||
// 非空箱入库
|
||||
if (!inTaskEntity.emptyTask) {
|
||||
if (inTaskEntity.goodsId == '') {
|
||||
goodsId.value.focus()
|
||||
return
|
||||
}
|
||||
if (inTaskEntity.opNum == null || inTaskEntity.opNum == '') {
|
||||
opNum.value.focus()
|
||||
return
|
||||
}
|
||||
}
|
||||
if (inTaskEntity.goodsId == inTaskEntity.vehicleId || inTaskEntity.goodsId == inTaskEntity.opNum || inTaskEntity.vehicleId == inTaskEntity.opNum) {
|
||||
errorBox('箱号、料号、数量必须为互不相同。')
|
||||
goodsId.value.focus()
|
||||
return
|
||||
}
|
||||
addBinding()
|
||||
}
|
||||
// 判断一个字符串是否是数字
|
||||
const numberCheck = (numberStr) => {
|
||||
if (numberStr == null || numberStr == '') {
|
||||
return false
|
||||
}
|
||||
try {
|
||||
return !isNaN(parseInt(numberStr))
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
if (numberStr == null || numberStr == '') {
|
||||
return false
|
||||
}
|
||||
try {
|
||||
return !isNaN(parseInt(numberStr))
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
// 清除输入
|
||||
const clearInput = () => {
|
||||
if (taskRequestEntity.vehicleId != '') {
|
||||
if (!taskRequestEntity.emptyTask) {
|
||||
inTaskEntity.goodsId = ''
|
||||
inTaskEntity.opNum = null
|
||||
}
|
||||
} else {
|
||||
inTaskEntity.vehicleId = ''
|
||||
if (!inTaskEntity.emptyTask) {
|
||||
inTaskEntity.goodsId = ''
|
||||
inTaskEntity.opNum = null
|
||||
}
|
||||
if (taskRequestEntity.vehicleId != '') {
|
||||
if (!taskRequestEntity.emptyTask) {
|
||||
inTaskEntity.goodsId = ''
|
||||
inTaskEntity.opNum = null
|
||||
}
|
||||
} else {
|
||||
inTaskEntity.vehicleId = ''
|
||||
if (!inTaskEntity.emptyTask) {
|
||||
inTaskEntity.goodsId = ''
|
||||
inTaskEntity.opNum = null
|
||||
}
|
||||
}
|
||||
}
|
||||
// 绑定前确认
|
||||
const confirmBinding = () => {
|
||||
// 判断是否是非空箱入库时,未输入料号和数量
|
||||
if (!inTaskEntity.emptyTask && inTaskEntity.goodsId == '') {
|
||||
ElMessageBox.confirm(
|
||||
'非空箱入库未输入料号。\n是否继续绑定',
|
||||
'警告',
|
||||
{
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
).then(() => {
|
||||
addBinding()
|
||||
}).catch(() => {
|
||||
ElMessage.info('操作取消')
|
||||
})
|
||||
} else {
|
||||
handleEnter()
|
||||
// 进行大写格式化
|
||||
inTaskEntity.vehicleId = inTaskEntity.vehicleId.toUpperCase().trim()
|
||||
inTaskEntity.goodsId = inTaskEntity.goodsId.toUpperCase().trim()
|
||||
// 判断是否是非空箱入库时,未输入料号和数量
|
||||
if (!inTaskEntity.emptyTask && inTaskEntity.goodsId == '' && inTaskEntity.vehicleId != '') {
|
||||
if (inTaskEntity.vehicleId == '') {
|
||||
ElMessage.error("请输入箱号。")
|
||||
vehicleId.value.focus()
|
||||
return
|
||||
}
|
||||
// 进行格式判断
|
||||
if (inTaskEntity.vehicleId != '') {
|
||||
const vehicleArray = inTaskEntity.vehicleId.split('-')
|
||||
if (vehicleArray.length != 2) {
|
||||
errorBox('箱号格式不正确,正确格式为“ASRS-XXXX”。')
|
||||
vehicleId.value.focus()
|
||||
return
|
||||
} else {
|
||||
if (vehicleArray[0] != 'ASRS' || !numberCheck(vehicleArray[1]) || vehicleArray[1].length != 4) {
|
||||
errorBox('箱号格式不正确,正确格式为“ASRS-XXXX”。')
|
||||
vehicleId.value.focus()
|
||||
return
|
||||
} else if (parseInt(vehicleArray[1]) < 1 || parseInt(vehicleArray[1]) > 2200) {
|
||||
errorBox('箱号范围是0001~2200。')
|
||||
vehicleId.value.focus()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
ElMessageBox.confirm(
|
||||
'非空箱入库未输入料号。\n是否继续绑定',
|
||||
'警告',
|
||||
{
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
).then(() => {
|
||||
addBinding()
|
||||
}).catch(() => {
|
||||
ElMessage.info('操作取消')
|
||||
})
|
||||
} else {
|
||||
handleEnter()
|
||||
}
|
||||
}
|
||||
// 添加绑定关系
|
||||
const addBinding = () => {
|
||||
if (taskRequestEntity.vehicleId != '' && taskRequestEntity.vehicleId != inTaskEntity.vehicleId) {
|
||||
errorBox('请下发已绑定的任务或取消绑定后重试。')
|
||||
if (taskRequestEntity.vehicleId != '' && taskRequestEntity.vehicleId != inTaskEntity.vehicleId) {
|
||||
errorBox('请下发已绑定的任务或取消绑定后重试。')
|
||||
return
|
||||
}
|
||||
if (taskRequestEntity.vehicleId == '') {
|
||||
if (inTaskEntity.vehicleId == '') {
|
||||
errorBox('请输入箱号。')
|
||||
vehicleId.value.focus()
|
||||
return
|
||||
}
|
||||
if (!inTaskEntity.emptyTask) {
|
||||
if (inTaskEntity.goodsId != '' && inTaskEntity.opNum != null && inTaskEntity.opNum > 0) {
|
||||
// 非空入库
|
||||
taskRequestEntity.goodsInfo.push({
|
||||
goodsId: inTaskEntity.goodsId.trim().toUpperCase(),
|
||||
opNum: inTaskEntity.opNum
|
||||
})
|
||||
inTaskEntity.goodsId = ''
|
||||
inTaskEntity.opNum = null
|
||||
}
|
||||
}
|
||||
// 添加任务
|
||||
taskRequestEntity.emptyTask = inTaskEntity.emptyTask
|
||||
taskRequestEntity.vehicleId = inTaskEntity.vehicleId.trim().toUpperCase()
|
||||
} else {
|
||||
if (!taskRequestEntity.emptyTask) {
|
||||
if (inTaskEntity.goodsId == '') {
|
||||
errorBox('请输入料号。')
|
||||
goodsId.value.focus()
|
||||
return
|
||||
}
|
||||
if (taskRequestEntity.vehicleId == '') {
|
||||
if (inTaskEntity.vehicleId == '') {
|
||||
errorBox('请输入箱号。')
|
||||
vehicleId.value.focus()
|
||||
return
|
||||
}
|
||||
if (!inTaskEntity.emptyTask) {
|
||||
if (inTaskEntity.goodsId != '' && inTaskEntity.opNum != null && inTaskEntity.opNum > 0) {
|
||||
// 非空入库
|
||||
taskRequestEntity.goodsInfo.push({
|
||||
goodsId: inTaskEntity.goodsId,
|
||||
opNum: inTaskEntity.opNum
|
||||
})
|
||||
inTaskEntity.goodsId = ''
|
||||
inTaskEntity.opNum = null
|
||||
}
|
||||
}
|
||||
// 添加任务
|
||||
taskRequestEntity.emptyTask = inTaskEntity.emptyTask
|
||||
taskRequestEntity.vehicleId = inTaskEntity.vehicleId
|
||||
}
|
||||
if (inTaskEntity.opNum == null || inTaskEntity.opNum == 0) {
|
||||
errorBox('请输入正确的数量。')
|
||||
opNum.value.focus()
|
||||
return
|
||||
}
|
||||
// 非空入库
|
||||
taskRequestEntity.goodsInfo.push({
|
||||
goodsId: inTaskEntity.goodsId.trim().toUpperCase(),
|
||||
opNum: inTaskEntity.opNum
|
||||
})
|
||||
inTaskEntity.goodsId = ''
|
||||
inTaskEntity.opNum = null
|
||||
} else {
|
||||
if (!taskRequestEntity.emptyTask) {
|
||||
if (inTaskEntity.goodsId == '') {
|
||||
errorBox('请输入料号。')
|
||||
goodsId.value.focus()
|
||||
return
|
||||
}
|
||||
if (inTaskEntity.opNum == null || inTaskEntity.opNum == 0) {
|
||||
errorBox('请输入正确的数量。')
|
||||
opNum.value.focus()
|
||||
return
|
||||
}
|
||||
// 非空入库
|
||||
taskRequestEntity.goodsInfo.push({
|
||||
goodsId: inTaskEntity.goodsId,
|
||||
opNum: inTaskEntity.opNum
|
||||
})
|
||||
inTaskEntity.goodsId = ''
|
||||
inTaskEntity.opNum = null
|
||||
} else {
|
||||
// 空入库不允许多次下发
|
||||
errorBox('空入库不允许多次下发。')
|
||||
return
|
||||
}
|
||||
// 空入库不允许多次下发
|
||||
errorBox('空入库不允许多次下发。')
|
||||
return
|
||||
}
|
||||
goodsId.value.focus()
|
||||
}
|
||||
goodsId.value.focus()
|
||||
}
|
||||
// 确认下发任务
|
||||
const confirmTasks = () => {
|
||||
// 判断是否是非空箱入库时,未输入料号和数量
|
||||
if (!taskRequestEntity.emptyTask && taskRequestEntity.goodsInfo.length == 0) {
|
||||
ElMessageBox.confirm(
|
||||
'非空箱入库未绑定物料,默认生成回库任务。\n是否继续',
|
||||
'警告',
|
||||
{
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
).then(() => {
|
||||
confirmSend()
|
||||
}).catch(() => {
|
||||
ElMessage.info('操作取消')
|
||||
})
|
||||
} else {
|
||||
confirmSend()
|
||||
}
|
||||
// 判断是否是非空箱入库时,未输入料号和数量
|
||||
if (!taskRequestEntity.emptyTask && taskRequestEntity.goodsInfo.length == 0) {
|
||||
ElMessageBox.confirm(
|
||||
'非空箱入库未绑定物料,默认生成回库任务。\n是否继续',
|
||||
'警告',
|
||||
{
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
).then(() => {
|
||||
confirmSend()
|
||||
}).catch(() => {
|
||||
ElMessage.info('操作取消')
|
||||
})
|
||||
} else {
|
||||
confirmSend()
|
||||
}
|
||||
}
|
||||
// 确认发送请求
|
||||
const confirmSend = () => {
|
||||
let request = taskRequestEntity
|
||||
loading.open()
|
||||
requireStockIn(request).then(res => {
|
||||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
ElMessage.success(response.message)
|
||||
cancelBinding()
|
||||
} else {
|
||||
errorBox(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
errorBox('请求错误。')
|
||||
}).finally(() => {
|
||||
loading.close()
|
||||
})
|
||||
let request = taskRequestEntity
|
||||
loading.open()
|
||||
requireStockIn(request).then(res => {
|
||||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
ElMessage.success(response.message)
|
||||
cancelBinding()
|
||||
} else {
|
||||
errorBox(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
errorBox('请求错误。')
|
||||
}).finally(() => {
|
||||
loading.close()
|
||||
})
|
||||
}
|
||||
// 取消绑定
|
||||
const cancelBinding = () => {
|
||||
resetTaskEntity()
|
||||
inTaskEntity.vehicleId = ''
|
||||
vehicleId.value.focus()
|
||||
resetTaskEntity()
|
||||
inTaskEntity.vehicleId = ''
|
||||
vehicleId.value.focus()
|
||||
}
|
||||
// 移除当前行
|
||||
const removeThisRow = (row) => {
|
||||
taskRequestEntity.goodsInfo.splice(taskRequestEntity.goodsInfo.indexOf(row), 1)
|
||||
if (taskRequestEntity.goodsInfo.length == 0 && taskRequestEntity.vehicleId != '' && !taskRequestEntity.emptyTask) {
|
||||
// 非空箱且没有料号列表的情况下,解绑当前任务
|
||||
resetTaskEntity()
|
||||
}
|
||||
goodsId.value.focus()
|
||||
taskRequestEntity.goodsInfo.splice(taskRequestEntity.goodsInfo.indexOf(row), 1)
|
||||
if (taskRequestEntity.goodsInfo.length == 0 && taskRequestEntity.vehicleId != '' && !taskRequestEntity.emptyTask) {
|
||||
// 非空箱且没有料号列表的情况下,解绑当前任务
|
||||
resetTaskEntity()
|
||||
}
|
||||
goodsId.value.focus()
|
||||
}
|
||||
// 重置任务
|
||||
const resetTaskEntity = () => {
|
||||
taskRequestEntity.emptyTask = false
|
||||
taskRequestEntity.vehicleId = ''
|
||||
taskRequestEntity.goodsInfo = []
|
||||
taskRequestEntity.emptyTask = false
|
||||
taskRequestEntity.vehicleId = ''
|
||||
taskRequestEntity.goodsInfo = []
|
||||
}
|
||||
// 打开入库料扫码
|
||||
const openOutForInDialog = () => {
|
||||
// 打开出库任务弹窗
|
||||
showInOutDialog.value = true
|
||||
nextTick(() => {
|
||||
// 聚焦
|
||||
forInGoodsId.value.focus()
|
||||
})
|
||||
// 打开出库任务弹窗
|
||||
showInOutDialog.value = true
|
||||
nextTick(() => {
|
||||
// 聚焦
|
||||
forInGoodsId.value.focus()
|
||||
})
|
||||
}
|
||||
// 添加入库料
|
||||
const addForInGoods = () => {
|
||||
if (outForInEntity.goodsId == '') {
|
||||
errorBox('请输入料号。')
|
||||
} else {
|
||||
outForInEntity.goodsId = outForInEntity.goodsId.toUpperCase()
|
||||
outForInRequestEntity.goodsIds.push({
|
||||
goodsId: outForInEntity.goodsId
|
||||
})
|
||||
outForInEntity.goodsId = ''
|
||||
}
|
||||
// 聚焦
|
||||
forInGoodsId.value.focus()
|
||||
outForInEntity.goodsId = outForInEntity.goodsId.trim()
|
||||
if (outForInEntity.goodsId == '') {
|
||||
errorBox('请输入料号。')
|
||||
} else {
|
||||
outForInEntity.goodsId = outForInEntity.goodsId.toUpperCase()
|
||||
outForInRequestEntity.goodsIds.push({
|
||||
goodsId: outForInEntity.goodsId
|
||||
})
|
||||
outForInEntity.goodsId = ''
|
||||
}
|
||||
// 聚焦
|
||||
forInGoodsId.value.focus()
|
||||
}
|
||||
const popThisGoodsId = (row) => {
|
||||
outForInRequestEntity.goodsIds.splice(outForInRequestEntity.goodsIds.indexOf(row), 1)
|
||||
forInGoodsId.value.focus()
|
||||
outForInRequestEntity.goodsIds.splice(outForInRequestEntity.goodsIds.indexOf(row), 1)
|
||||
forInGoodsId.value.focus()
|
||||
}
|
||||
// 确认呼叫料箱
|
||||
const confirmCallVehicles = () => {
|
||||
const goodsIds = outForInRequestEntity.goodsIds.flatMap(item => {
|
||||
return item.goodsId
|
||||
})
|
||||
if (goodsIds.length == 0) {
|
||||
errorBox('请输入料号。')
|
||||
return
|
||||
const goodsIds = outForInRequestEntity.goodsIds.flatMap(item => {
|
||||
return item.goodsId
|
||||
})
|
||||
if (goodsIds.length == 0) {
|
||||
errorBox('请输入料号。')
|
||||
return
|
||||
}
|
||||
const request = {
|
||||
goodsIds: goodsIds,
|
||||
userName: outForInRequestEntity.userName,
|
||||
standId: outForInRequestEntity.standId
|
||||
}
|
||||
loading.open()
|
||||
requireVehiclesForIn(request).then(res => {
|
||||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
successBox(response.message)
|
||||
} else {
|
||||
errorBox(response.message)
|
||||
}
|
||||
const request = {
|
||||
goodsIds: goodsIds,
|
||||
userName: outForInRequestEntity.userName,
|
||||
standId: outForInRequestEntity.standId
|
||||
}
|
||||
loading.open()
|
||||
requireVehiclesForIn(request).then(res => {
|
||||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
successBox(response.message)
|
||||
} else {
|
||||
errorBox(response.message)
|
||||
}
|
||||
outForInRequestEntity.goodsIds = []
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
errorBox('请求错误。')
|
||||
}).finally(() => {
|
||||
loading.close()
|
||||
})
|
||||
outForInRequestEntity.goodsIds = []
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
errorBox('请求错误。')
|
||||
}).finally(() => {
|
||||
loading.close()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.content {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.work-area {
|
||||
width: 100%;
|
||||
/* padding: 5px; */
|
||||
width: 100%;
|
||||
/* padding: 5px; */
|
||||
}
|
||||
|
||||
.main-area {
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 90%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
min-height: fit-content;
|
||||
max-height: 90%;
|
||||
margin: auto auto 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.confirm-area {
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 90%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
min-height: fit-content;
|
||||
max-height: 90%;
|
||||
margin: auto auto 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.title-area {
|
||||
display: flex;
|
||||
/* min-height: 10%; */
|
||||
max-height: max-content;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
display: flex;
|
||||
/* min-height: 10%; */
|
||||
max-height: max-content;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.el-form-item {
|
||||
margin: 10px 5px 10px 5px;
|
||||
margin: 10px 5px 10px 5px;
|
||||
}
|
||||
|
||||
.el-form-item .el-input {
|
||||
width: 196px;
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
.el-form-item .el-input-number {
|
||||
width: 185px;
|
||||
width: 185px;
|
||||
}
|
||||
|
||||
.table-class {
|
||||
margin: 5px 5px 5px 5px;
|
||||
width: inherit;
|
||||
margin: 5px 5px 5px 5px;
|
||||
width: inherit;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,401 +1,278 @@
|
|||
<template>
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-container class="content">
|
||||
<div class="work-area">
|
||||
<fieldset class="title-area">
|
||||
<legend>
|
||||
工作台
|
||||
</legend>
|
||||
<div class="title-div">
|
||||
<span class="title-text">物料盘点</span>
|
||||
</div>
|
||||
<div class="station-div">
|
||||
<span class="station-text">工作站:</span>
|
||||
</div>
|
||||
<div class="station-no-div">
|
||||
<span class="station-no-text">{{ standId }}</span>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="main-area">
|
||||
<legend>
|
||||
物料盘点
|
||||
</legend>
|
||||
<el-form ref="workFormRef" :model="workFormEntity" :label-position="labelPosition"
|
||||
label-width="150px" style="max-width: 100%" :rules="rules" status-icon>
|
||||
<div style="display: flex;">
|
||||
<div style="display: block; margin: 5px;">
|
||||
<!-- <div
|
||||
style="display: inline-flex; justify-content: center; height: 60px; width: 655px; margin: 5px; padding: 5px;">
|
||||
<UploadExcelPart></UploadExcelPart>
|
||||
</div> -->
|
||||
<div style="height: 50px; margin-bottom: 20px"><UploadExcelInventoryList></UploadExcelInventoryList></div>
|
||||
<div
|
||||
style="display: inline-flex; justify-content: center; height: 40px; width: 655px; margin: 5px; padding: 5px; background-color: #00AAE8;">
|
||||
<span style="align-self: center; font-weight: bold;font-size: 25px;">
|
||||
{{ workFormEntity.tip }}
|
||||
</span>
|
||||
</div>
|
||||
<div style="display: flex;">
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<div class="display-title-div">
|
||||
<span class="display-title-text">料号</span>
|
||||
</div>
|
||||
<div class="display-form-div">
|
||||
<el-input v-model="workFormEntity.goodsId" size="default" ref="goodsId"
|
||||
v-on:keyup.enter="getCurrentWorkInfo()" clearable></el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<div class="display-title-div">
|
||||
<span class="display-title-text">箱号</span>
|
||||
</div>
|
||||
<div class="display-form-div">
|
||||
<el-input v-model="workFormEntity.vehicleId" size="default" ref="vehicleId"
|
||||
v-on:keyup.enter="getCurrentWorkInfo()" clearable></el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<div class="display-title-div">
|
||||
<span class="display-title-text">实物数量</span>
|
||||
</div>
|
||||
<div style="display: flex; margin-top: 20px;">
|
||||
<div class="display-form-div-left">
|
||||
<el-input-number v-model.number="workFormEntity.realNum" ref="realNum"
|
||||
controls-position="right" :min="0" />
|
||||
</div>
|
||||
<div class="display-form-div-right">
|
||||
<span class="display-form-text-right">PC</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin: 10px;">
|
||||
<div class="arrow" @click="confirmTask()">
|
||||
<span
|
||||
style="margin-left: 25px; align-self: center; font-weight: bold;font-size: 45px; writing-mode: vertical-lr;">完成确认</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-container class="content">
|
||||
<div class="work-area">
|
||||
<fieldset class="search-area">
|
||||
<el-form ref="inventoryRequestFormRef" :model="inventoryRequestFormEntity" :label-position="labelPosition"
|
||||
label-width="158px"
|
||||
style="max-width: 100%" :rules="requestRules" status-icon>
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="料号" prop="goodsId">
|
||||
<el-input v-model="inventoryRequestFormEntity.goodsId" ref="goodsId" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="箱号" prop="vehicleId">
|
||||
<el-input v-model="inventoryRequestFormEntity.vehicleId" ref="vehicleId" clearable/>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button type="primary"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="sendInventoryRequest()">下发盘点
|
||||
</el-button>
|
||||
<el-button type="warning"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="clearInput()">清除输入
|
||||
</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-container>
|
||||
</el-config-provider>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
<fieldset class="confirm-area">
|
||||
<el-form ref="confirmRef" :model="confirmEntity" :label-position="labelPosition" label-width="158px"
|
||||
style="max-width: 100%" :rules="confirmRules" status-icon>
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
<el-row>
|
||||
<el-form-item label="盘点任务号" prop="inventoryId">
|
||||
<el-input v-model="confirmEntity.inventoryId" disabled/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料号" prop="goodsId">
|
||||
<el-input v-model="confirmEntity.goodsId" disabled/>
|
||||
</el-form-item>
|
||||
<el-form-item label="箱号" prop="vehicleId">
|
||||
<el-input v-model="confirmEntity.vehicleId" disabled/>
|
||||
</el-form-item>
|
||||
<el-form-item label="系统数量" prop="stockNum">
|
||||
<el-input v-model="confirmEntity.stockNum" disabled/>
|
||||
</el-form-item>
|
||||
<el-form-item label="确认数量" prop="confirmNum">
|
||||
<el-input-number v-model.number="confirmEntity.confirmNum"
|
||||
controls-position="right" :min="0" clearable/>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button type="success"
|
||||
style="height: 50px; width: 100px; margin: auto 5px auto 5px; font-size: large; color: black;"
|
||||
@click="confirmOrRelease()">确认/放行
|
||||
</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-form>
|
||||
</fieldset>
|
||||
</div>
|
||||
</el-container>
|
||||
</el-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import store from '@/store'
|
||||
import { getWorkByStandAndGoods, confirmFinishWork, queryFinishByStandAndGoods } from '@/api/task'
|
||||
import { reactive, ref } from 'vue'
|
||||
import { errorBox } from '@/utils/myMessageBox.js'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import UploadExcelInventoryList from '@/excel/UploadExcelProduct.vue'
|
||||
import {nextTick, onBeforeUnmount, onMounted, reactive, ref, watch} from 'vue'
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
</script>
|
||||
import {useRoute} from "vue-router";
|
||||
import {errorBox, warningBox} from "@/utils/myMessageBox";
|
||||
import {ElMessage} from "element-plus";
|
||||
import {confirmInventory, getInventoryConfirm, requestInventory} from "@/api/task";
|
||||
import {labelPosition} from "@/constant/form";
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'inventory',
|
||||
data() {
|
||||
return {
|
||||
standId: store.getters.getStandId,
|
||||
timer: '',
|
||||
labelPosition: 'top',
|
||||
workFormRef: ref(),
|
||||
workFormEntity: reactive({
|
||||
goodsId: '',
|
||||
planPickNum: 0,
|
||||
remainNumOrigin: null,
|
||||
remainNumReal: null,
|
||||
remark: '',
|
||||
finishedRows: 0,
|
||||
totalRows: 0,
|
||||
finishedCounts: 0,
|
||||
totalCounts: 0,
|
||||
tip: ''
|
||||
}),
|
||||
rules: reactive({
|
||||
goodsId: [
|
||||
{ required: true, message: '请输入料号' }
|
||||
]
|
||||
}),
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.goodsId.focus()
|
||||
this.timer = setInterval(() => {
|
||||
this.queryFinish()
|
||||
}, 2000)
|
||||
},
|
||||
beforeUnmount() {
|
||||
clearInterval(this.timer)
|
||||
},
|
||||
methods: {
|
||||
// 获取当前工作信息
|
||||
getCurrentWorkInfo() {
|
||||
const request = {
|
||||
standId: this.standId,
|
||||
goodsId: this.workFormEntity.goodsId
|
||||
}
|
||||
getWorkByStandAndGoods(request).then(res => {
|
||||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
this.workFormEntity.goodsId = response.returnData.goodsId
|
||||
this.workFormEntity.planPickNum = response.returnData.planPickNum
|
||||
this.workFormEntity.remainNumOrigin = response.returnData.remainNumOrigin
|
||||
this.workFormEntity.remainNumReal = response.returnData.remainNumReal
|
||||
this.workFormEntity.remark = response.returnData.remark
|
||||
this.workFormEntity.finishedRows = response.returnData.finishedRows
|
||||
this.workFormEntity.totalRows = response.returnData.totalRows
|
||||
this.workFormEntity.finishedCounts = response.returnData.finishedCounts
|
||||
this.workFormEntity.totalCounts = response.returnData.totalCounts
|
||||
this.workFormEntity.tip = response.returnData.tip
|
||||
} else {
|
||||
this.resetForms()
|
||||
errorBox(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
this.resetForms()
|
||||
errorBox('查询工作信息错误')
|
||||
})
|
||||
},
|
||||
// 查询是否完成
|
||||
queryFinish() {
|
||||
if (this.workFormEntity.goodsId == '') {
|
||||
return
|
||||
}
|
||||
const request = {
|
||||
standId: this.standId,
|
||||
goodsId: this.workFormEntity.goodsId
|
||||
}
|
||||
queryFinishByStandAndGoods(request).then(res => {
|
||||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
if (response.returnData != null) {
|
||||
this.workFormEntity.tip = response.returnData.tip
|
||||
}
|
||||
this.resetForms()
|
||||
ElMessage.success(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
// 重置参数
|
||||
resetForms() {
|
||||
this.workFormEntity = reactive({
|
||||
goodsId: '',
|
||||
planPickNum: 0,
|
||||
remainNumOrigin: null,
|
||||
remainNumReal: null,
|
||||
remark: '',
|
||||
finishedRows: 0,
|
||||
totalRows: 0,
|
||||
finishedCounts: 0,
|
||||
totalCounts: 0,
|
||||
tip: ''
|
||||
})
|
||||
this.$refs.goodsId.focus()
|
||||
},
|
||||
// 确认完成工作
|
||||
confirmTask() {
|
||||
if (this.standId == '' || this.workFormEntity.goodsId == '') {
|
||||
errorBox('站台号和料号不可缺少')
|
||||
return
|
||||
}
|
||||
const confirmParams = {
|
||||
standId: this.standId,
|
||||
goodsId: this.workFormEntity.goodsId,
|
||||
remainNumOrigin: this.workFormEntity.remainNumOrigin,
|
||||
remainNumReal: this.workFormEntity.remainNumReal
|
||||
}
|
||||
confirmFinishWork(confirmParams).then(res => {
|
||||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
if (response.returnData != null) {
|
||||
this.workFormEntity.tip = response.returnData.tip
|
||||
}
|
||||
this.resetForms()
|
||||
ElMessage.success(response.message)
|
||||
} else {
|
||||
errorBox(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
errorBox('确认时发生异常')
|
||||
})
|
||||
}
|
||||
const STAND_ID = store.getters.getStandId
|
||||
const USER_NAME = store.getters.getUserName
|
||||
let timer = ref()
|
||||
const route = useRoute()// 路由
|
||||
let inventoryRequestFormRef = ref()
|
||||
let inventoryRequestFormEntity = reactive({
|
||||
goodsId: '',
|
||||
vehicleId: ''
|
||||
})
|
||||
const requestRules = reactive({})
|
||||
let confirmRef = ref()
|
||||
let confirmEntity = reactive({
|
||||
inventoryId: '',
|
||||
vehicleId: '',
|
||||
goodsId: '',
|
||||
stockNum: null,
|
||||
confirmNum: null
|
||||
})
|
||||
const confirmRules = reactive({})
|
||||
let pauseGetPickFlag = ref(false)
|
||||
// 系统
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
timer.value = setInterval(() => {
|
||||
timerTask_1()
|
||||
}, 1000)
|
||||
})
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
clearInterval(timer.value)
|
||||
})
|
||||
// 监视路由
|
||||
watch(() => route.path, (newVal, oldVal) => {
|
||||
if (newVal === '/inventory') {
|
||||
timer.value = setInterval(() => {
|
||||
timerTask_1()
|
||||
}, 1000)
|
||||
} else {
|
||||
clearInterval(timer.value)
|
||||
}
|
||||
})
|
||||
// 定时器任务1
|
||||
const timerTask_1 = () => {
|
||||
// 查询盘点列表
|
||||
getInventory()
|
||||
}
|
||||
// 查询盘点信息
|
||||
const getInventory = () => {
|
||||
if (pauseGetPickFlag.value) {
|
||||
return
|
||||
}
|
||||
const request = {
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
}
|
||||
// 获取当前拣选信息
|
||||
getInventoryConfirm(request).then(res => {
|
||||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
const confirmVo = response.data
|
||||
// 设置form
|
||||
confirmEntity.inventoryId = confirmVo.inventoryId
|
||||
confirmEntity.goodsId = confirmVo.goodsId
|
||||
confirmEntity.vehicleId = confirmVo.vehicleId
|
||||
confirmEntity.stockNum = confirmVo.stockNum
|
||||
confirmEntity.confirmNum = confirmVo.confirmNum
|
||||
pauseGetPickFlag.value= true
|
||||
} else if (response.code == 400) {
|
||||
// 警告,弹框
|
||||
pauseGetPickFlag.value = true
|
||||
warningBox(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
pauseGetPickFlag.value = true
|
||||
errorBox('请求错误,请检查完原因后刷新界面。')
|
||||
})
|
||||
}
|
||||
// 下发盘点任务
|
||||
const sendInventoryRequest = () => {
|
||||
inventoryRequestFormEntity.goodsId = inventoryRequestFormEntity.goodsId.trim().toUpperCase()
|
||||
inventoryRequestFormEntity.vehicleId = inventoryRequestFormEntity.vehicleId.trim().toUpperCase()
|
||||
if (inventoryRequestFormEntity.goodsId == '') {
|
||||
ElMessage.error("料号为必须项。")
|
||||
return
|
||||
}
|
||||
const request = {
|
||||
goodsId: inventoryRequestFormEntity.goodsId,
|
||||
vehicleId: inventoryRequestFormEntity.vehicleId,
|
||||
standId: STAND_ID,
|
||||
userName: USER_NAME
|
||||
}
|
||||
requestInventory(request).then(res => {
|
||||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
ElMessage.success(response.message)
|
||||
pauseGetPickFlag.value = false
|
||||
} else {
|
||||
errorBox(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error("发生异常。")
|
||||
})
|
||||
}
|
||||
// 确认/放行
|
||||
const confirmOrRelease = () => {
|
||||
// 确认放行---与配料工作区分开来
|
||||
const request = {
|
||||
inventoryId: confirmEntity.inventoryId,
|
||||
goodsId: confirmEntity.goodsId,
|
||||
vehicleId: confirmEntity.vehicleId,
|
||||
confirmNum: confirmEntity.confirmNum,
|
||||
standId:STAND_ID,
|
||||
userName: USER_NAME
|
||||
}
|
||||
confirmInventory(request).then(res => {
|
||||
const response = res.data
|
||||
if (response.code == 0) {
|
||||
// 设置form
|
||||
resetConfirmEntity()
|
||||
ElMessage.success(response.message)
|
||||
pauseGetPickFlag.value = false
|
||||
} else if (response.code == 400) {
|
||||
// 设置form
|
||||
resetConfirmEntity()
|
||||
warningBox(response.message)
|
||||
pauseGetPickFlag.value = false
|
||||
} else {
|
||||
// 错误,弹框
|
||||
errorBox(response.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
errorBox('请求错误,请检查完原因后刷新界面。')
|
||||
})
|
||||
}
|
||||
// 重置确认信息
|
||||
const resetConfirmEntity = () => {
|
||||
confirmEntity.inventoryId = ''
|
||||
confirmEntity.goodsId = ''
|
||||
confirmEntity.vehicleId = ''
|
||||
confirmEntity.stockNum = null
|
||||
confirmEntity.confirmNum = null
|
||||
}
|
||||
// 清空下发信息
|
||||
const clearInput = () => {
|
||||
inventoryRequestFormEntity.goodsId = ''
|
||||
inventoryRequestFormEntity.vehicleId = ''
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.content {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.work-area {
|
||||
width: 100%;
|
||||
/* padding: 5px; */
|
||||
width: 100%;
|
||||
/* padding: 5px; */
|
||||
}
|
||||
|
||||
.main-area {
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 90%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
.search-area {
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 90%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.title-area {
|
||||
display: flex;
|
||||
/* min-height: 10%; */
|
||||
max-height: max-content;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
.confirm-area {
|
||||
margin: auto;
|
||||
min-height: fit-content;
|
||||
max-height: 90%;
|
||||
margin-bottom: 10px;
|
||||
min-width: inherit;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 15px 10px -15px #000;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
background: linear-gradient(-105deg,
|
||||
transparent 50%,
|
||||
#309330 50%,
|
||||
#309330 100%) top right,
|
||||
linear-gradient(-75deg,
|
||||
transparent 50%,
|
||||
#309330 50%,
|
||||
#309330 100%) bottom right;
|
||||
background-size: 100% 50%;
|
||||
height: 400px;
|
||||
width: 250px;
|
||||
background-repeat: no-repeat;
|
||||
display: inline-flex;
|
||||
cursor: pointer;
|
||||
.el-form-item {
|
||||
margin: 10px 5px 10px 5px;
|
||||
}
|
||||
|
||||
:deep(.el-input) {
|
||||
width: 195px;
|
||||
height: 130px;
|
||||
font-size: 25px;
|
||||
.el-form-item .el-input {
|
||||
width: 196px;
|
||||
}
|
||||
|
||||
:deep(.el-input-number) {
|
||||
width: 125px;
|
||||
height: 130px;
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
/* :deep(.el-input .el-input__inner) {
|
||||
font-size: 60px;
|
||||
height: 130px;
|
||||
}
|
||||
|
||||
:deep(.el-input-number .el-input__inner) {
|
||||
font-size: 60px;
|
||||
height: 130px;
|
||||
} */
|
||||
|
||||
.title-div {
|
||||
display: inline-flex;
|
||||
width: -webkit-fill-available;
|
||||
margin-right: 5px;
|
||||
padding: 5px;
|
||||
background-color: #CCCCCC;
|
||||
}
|
||||
|
||||
.title-text {
|
||||
align-self: center;
|
||||
font-weight: bold;
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
.station-div {
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
width: 150px;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
padding: 5px;
|
||||
background-color: #FFFAAA;
|
||||
}
|
||||
|
||||
.station-text {
|
||||
align-self: center;
|
||||
font-weight: bold;
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
.station-no-div {
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
width: 200px;
|
||||
padding: 5px;
|
||||
border: 5px double #000000;
|
||||
}
|
||||
|
||||
.station-no-text {
|
||||
align-self: center;
|
||||
font-weight: bold;
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
.display-title-div {
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
width: 205px;
|
||||
height: 80px;
|
||||
margin: 5px;
|
||||
padding: 5px;
|
||||
background-color: #FFFAAA;
|
||||
}
|
||||
|
||||
.display-title-text {
|
||||
align-self: center;
|
||||
font-weight: bold;
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
.display-form-div {
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
width: 195px;
|
||||
margin: 5px;
|
||||
padding: 5px;
|
||||
border: 5px double #000000;
|
||||
margin-top: 25px;
|
||||
}
|
||||
|
||||
.display-form-div-left {
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
width: 125px;
|
||||
margin: 5px;
|
||||
padding: 5px;
|
||||
border: 5px double #000000;
|
||||
}
|
||||
|
||||
.display-form-div-right {
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
width: 50px;
|
||||
margin: 5px;
|
||||
padding: 5px;
|
||||
background-color: #CCCCCC;
|
||||
}
|
||||
|
||||
.display-form-text-right {
|
||||
align-self: center;
|
||||
font-weight: bold;
|
||||
font-size: 25px;
|
||||
.table-class {
|
||||
margin: 5px 5px 5px 5px;
|
||||
width: inherit;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -306,7 +306,6 @@ const route = useRoute()// 路由
|
|||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
initWorkOptions()
|
||||
searchKittingGoods()
|
||||
timer.value = setInterval(() => {
|
||||
timerTask_1()
|
||||
}, 1000)
|
||||
|
|
@ -364,6 +363,8 @@ const timerTask_1 = () => {
|
|||
getWork()
|
||||
// 判断是否需要显示料盒信息
|
||||
ifNeedShowBoxSummary()
|
||||
// 查询当前配料的物料信息
|
||||
searchKittingGoods()
|
||||
}
|
||||
// 自定义方法
|
||||
const solveEnterKey = (e) => {
|
||||
|
|
@ -446,7 +447,6 @@ const confirmStart = () => {
|
|||
errorBox('请求错误。')
|
||||
}).finally(() => {
|
||||
loading.close()
|
||||
searchKittingGoods()
|
||||
})
|
||||
}
|
||||
// 显示料盒总览
|
||||
|
|
@ -562,7 +562,6 @@ const ifNeedShowBoxSummary = () => {
|
|||
storeKittingWork.productId = confirmEntity.productId
|
||||
storeKittingWork.singleProductId = confirmEntity.singleProductId
|
||||
storeKittingWork.boxNo = confirmEntity.boxNo
|
||||
searchKittingGoods()
|
||||
}
|
||||
} else {
|
||||
// 替换store
|
||||
|
|
@ -603,25 +602,20 @@ const confirmOrRelease = () => {
|
|||
if (response.code == 0) {
|
||||
// 设置form
|
||||
resetConfirmEntity()
|
||||
// 继续刷新
|
||||
pauseGetWorkFlag.value = false
|
||||
ElMessage.success(response.message)
|
||||
} else if (response.code == 400) {
|
||||
// 设置form
|
||||
resetConfirmEntity()
|
||||
// 警告
|
||||
pauseGetWorkFlag.value = false
|
||||
warningBox(response.message)
|
||||
} else {
|
||||
// 错误
|
||||
errorBox(response.message)
|
||||
}
|
||||
pauseGetWorkFlag.value = false
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
errorBox('请求错误,请检查完原因后刷新界面。')
|
||||
}).finally(() => {
|
||||
// 刷新一下物料显示
|
||||
searchKittingGoods()
|
||||
})
|
||||
}
|
||||
const resetConfirmEntity = () => {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wms_main.constant.enums.wms;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 盘点结果枚举
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum WmsInvResultEnums {
|
||||
NONE(-99, "未盘点"),
|
||||
MINUS(-1, "盘亏"),
|
||||
EQUAL(0, "正常"),
|
||||
PLUS(1, "盘盈");
|
||||
private final Integer code;
|
||||
private final String desc;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.wms_main.constant.enums.wms;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 盘点状态枚举
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum WmsInvStatusEnums {
|
||||
INIT(0, "初始化"),
|
||||
EXECUTED(1, "已解析"),
|
||||
CONFIRMED(2, "已确认");
|
||||
|
||||
private final Integer code;
|
||||
private final String desc;
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.wms_main.constant.enums.wms;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 盘点类型枚举
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum WmsInvTypeEnums {
|
||||
INV_TYPE_1(1, "明盘"),
|
||||
INV_TYPE_2(2, "盲盘");
|
||||
private final Integer code;
|
||||
private final String desc;
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@ import com.wms_main.model.dto.response.wcs.BaseWcsApiResponse;
|
|||
import com.wms_main.model.dto.response.wcs.WcsApiResponse;
|
||||
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
||||
import com.wms_main.model.dto.response.wms.WmsApiResponse;
|
||||
import com.wms_main.model.vo.wms.InventoryConfirmVo;
|
||||
import com.wms_main.model.vo.wms.TaskConfirmVo;
|
||||
import com.wms_main.service.controller.ITaskControllerService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
@ -114,4 +115,34 @@ public class TaskController {
|
|||
public BaseWmsApiResponse confirmCurrentTask(@RequestBody ConfirmTaskRequest confirmTaskRequest) {
|
||||
return taskControllerService.confirmCurrentTask(confirmTaskRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发盘点请求
|
||||
* @param inventoryRequest 盘点请求
|
||||
* @return 请求结果
|
||||
*/
|
||||
@PostMapping("/requestInventory")
|
||||
public BaseWmsApiResponse requestInventory(@RequestBody InventoryRequest inventoryRequest) {
|
||||
return taskControllerService.requestInventory(inventoryRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询盘点任务确认信息
|
||||
* @param inventoryConfirmRequest 请求
|
||||
* @return 请求结果
|
||||
*/
|
||||
@PostMapping("/getInventoryConfirm")
|
||||
WmsApiResponse<InventoryConfirmVo> getInventoryConfirm(@RequestBody InventoryConfirmRequest inventoryConfirmRequest) {
|
||||
return taskControllerService.getInventoryConfirm(inventoryConfirmRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认盘点信息
|
||||
* @param inventoryConfirmRequest 确认请求
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PostMapping("/confirmInventory")
|
||||
BaseWmsApiResponse confirmInventory(@RequestBody InventoryConfirmRequest inventoryConfirmRequest) {
|
||||
return taskControllerService.confirmInventory(inventoryConfirmRequest);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
package com.wms_main.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.wms_main.model.po.TAppInventoryRecord;
|
||||
|
||||
/**
|
||||
* 盘点任务记录服务接口
|
||||
*/
|
||||
public interface ITAppInventoryRecordService extends IService<TAppInventoryRecord> {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.wms_main.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.wms_main.model.po.TAppInventory;
|
||||
|
||||
/**
|
||||
* 盘点任务服务接口
|
||||
*/
|
||||
public interface ITAppInventoryService extends IService<TAppInventory> {
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.wms_main.dao.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wms_main.dao.ITAppInventoryRecordService;
|
||||
import com.wms_main.mapper.AppInventoryRecordMapper;
|
||||
import com.wms_main.model.po.TAppInventoryRecord;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 盘点记录表服务实现
|
||||
*/
|
||||
@Service
|
||||
public class TAppInventoryRecordServiceImpl extends ServiceImpl<AppInventoryRecordMapper, TAppInventoryRecord> implements ITAppInventoryRecordService {
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.wms_main.dao.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wms_main.dao.ITAppInventoryService;
|
||||
import com.wms_main.mapper.AppInventoryMapper;
|
||||
import com.wms_main.model.po.TAppInventory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 盘点任务表服务实现
|
||||
*/
|
||||
@Service
|
||||
public class TAppInventoryServiceImpl extends ServiceImpl<AppInventoryMapper, TAppInventory> implements ITAppInventoryService {
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.wms_main.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.wms_main.model.po.TAppConfig;
|
||||
import com.wms_main.model.po.TAppInventory;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 盘点任务表mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface AppInventoryMapper extends BaseMapper<TAppInventory> {
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.wms_main.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.wms_main.model.po.TAppInventory;
|
||||
import com.wms_main.model.po.TAppInventoryRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 盘点记录表mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface AppInventoryRecordMapper extends BaseMapper<TAppInventoryRecord> {
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.wms_main.model.dto.request.wms;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 盘点确认请求
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class InventoryConfirmRequest extends BaseWmsRequest {
|
||||
/**
|
||||
* 盘点任务号
|
||||
*/
|
||||
@JsonProperty("inventoryId")
|
||||
private String inventoryId;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@JsonProperty("goodsId")
|
||||
private String goodsId;
|
||||
/**
|
||||
* 箱号
|
||||
*/
|
||||
@JsonProperty("vehicleId")
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 确认数量
|
||||
*/
|
||||
@JsonProperty("confirmNum")
|
||||
private Integer confirmNum;
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.wms_main.model.dto.request.wms;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 盘点下发请求
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class InventoryRequest extends BaseWmsRequest {
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@JsonProperty("goodsId")
|
||||
private String goodsId;
|
||||
/**
|
||||
* 箱号
|
||||
*/
|
||||
@JsonProperty("vehicleId")
|
||||
private String vehicleId;
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
package com.wms_main.model.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 盘点任务
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "t_app_inventory", autoResultMap = true)
|
||||
public class TAppInventory {
|
||||
/**
|
||||
* 盘点id
|
||||
*/
|
||||
@TableId(value = "inventory_id")
|
||||
private String inventoryId;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@TableField(value = "goods_id")
|
||||
private String goodsId;
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
@TableField(value = "vehicle_id")
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 库存数量
|
||||
* 只记录盘点确认时间点
|
||||
*/
|
||||
@TableField(value = "stock_num")
|
||||
private Integer stockNum;
|
||||
/**
|
||||
* 确认数量
|
||||
*/
|
||||
@TableField(value = "confirm_num")
|
||||
private Integer confirmNum;
|
||||
/**
|
||||
* 盘点站台
|
||||
*/
|
||||
@TableField(value = "inv_stand")
|
||||
private String invStand;
|
||||
/**
|
||||
* 盘点人
|
||||
*/
|
||||
@TableField(value = "inv_user")
|
||||
private String invUser;
|
||||
/**
|
||||
* 盘点类型:1:明盘;2:盲盘
|
||||
*/
|
||||
@TableField(value = "inv_type")
|
||||
private Integer invType;
|
||||
/**
|
||||
* 盘点状态
|
||||
* 0. 初始化
|
||||
* 1. 已解析
|
||||
* 2. 已确认
|
||||
*/
|
||||
@TableField(value = "inv_status")
|
||||
private Integer invStatus;
|
||||
/**
|
||||
* 盘点结果
|
||||
* -99:未盘
|
||||
* -1: 盘亏
|
||||
* 0: 正常
|
||||
* 1: 盘盈
|
||||
*/
|
||||
@TableField(value = "inv_result")
|
||||
private Integer invResult;
|
||||
/**
|
||||
* 盘点任务创建时间
|
||||
*/
|
||||
@TableField(value = "inv_create_time")
|
||||
private LocalDateTime invCreateTime;
|
||||
/**
|
||||
* 盘点确认时间
|
||||
*/
|
||||
@TableField(value = "inv_confirm_time")
|
||||
private LocalDateTime invConfirmTime;
|
||||
/**
|
||||
* 这个字段用于合并哪些任务是同一时间下发的
|
||||
*/
|
||||
@TableField(value = "inv_order_id")
|
||||
private String invOrderId;
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
package com.wms_main.model.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 盘点记录
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "t_app_inventory_record", autoResultMap = true)
|
||||
public class TAppInventoryRecord {
|
||||
/**
|
||||
* 盘点id
|
||||
*/
|
||||
@TableId(value = "inventory_id")
|
||||
private String inventoryId;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@TableField(value = "goods_id")
|
||||
private String goodsId;
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
@TableField(value = "vehicle_id")
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 库存数量
|
||||
* 只记录盘点确认时间点
|
||||
*/
|
||||
@TableField(value = "stock_num")
|
||||
private Integer stockNum;
|
||||
/**
|
||||
* 确认数量
|
||||
*/
|
||||
@TableField(value = "confirm_num")
|
||||
private Integer confirmNum;
|
||||
/**
|
||||
* 盘点站台
|
||||
*/
|
||||
@TableField(value = "inv_stand")
|
||||
private String invStand;
|
||||
/**
|
||||
* 盘点人
|
||||
*/
|
||||
@TableField(value = "inv_user")
|
||||
private String invUser;
|
||||
/**
|
||||
* 盘点类型:1:明盘;2:盲盘
|
||||
*/
|
||||
@TableField(value = "inv_type")
|
||||
private Integer invType;
|
||||
/**
|
||||
* 盘点状态
|
||||
* 1. 初始化
|
||||
* 2. 已解析
|
||||
* 3. 数量确认
|
||||
* 4. 盘点关闭
|
||||
*/
|
||||
@TableField(value = "inv_status")
|
||||
private Integer invStatus;
|
||||
/**
|
||||
* 盘点结果
|
||||
* -1: 盘亏
|
||||
* 0: 正常
|
||||
* 1: 盘盈
|
||||
*/
|
||||
@TableField(value = "inv_result")
|
||||
private Integer invResult;
|
||||
/**
|
||||
* 盘点任务创建时间
|
||||
*/
|
||||
@TableField(value = "inv_create_time")
|
||||
private LocalDateTime invCreateTime;
|
||||
/**
|
||||
* 盘点确认时间
|
||||
*/
|
||||
@TableField(value = "inv_confirm_time")
|
||||
private LocalDateTime invConfirmTime;
|
||||
/**
|
||||
* 这个字段用于合并哪些任务是同一时间下发的
|
||||
*/
|
||||
@TableField(value = "inv_order_id")
|
||||
private String invOrderId;
|
||||
}
|
||||
|
|
@ -7,7 +7,6 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
|
@ -99,4 +98,14 @@ public class TAppStock {
|
|||
*/
|
||||
@TableField(value = "sled")
|
||||
private Integer sled;
|
||||
/**
|
||||
* 上次盘点任务号
|
||||
*/
|
||||
@TableField(value = "last_inventory_id")
|
||||
private String lastInventoryId;
|
||||
/**
|
||||
* 上次盘点时间
|
||||
*/
|
||||
@TableField(value = "last_inventory_time")
|
||||
private LocalDateTime lastInventoryTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
package com.wms_main.model.vo.wms;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 盘点确认界面显示Vo
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class InventoryConfirmVo {
|
||||
/**
|
||||
* 盘点任务号
|
||||
*/
|
||||
@JsonProperty("inventoryId")
|
||||
private String inventoryId;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@JsonProperty("goodsId")
|
||||
private String goodsId;
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
@JsonProperty("vehicleId")
|
||||
private String vehicleId;
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
@JsonProperty("stockNum")
|
||||
private Integer stockNum;
|
||||
/**
|
||||
* 确认数量
|
||||
*/
|
||||
@JsonProperty("confirmNum")
|
||||
private Integer confirmNum;
|
||||
}
|
||||
|
|
@ -2,11 +2,10 @@ package com.wms_main.service.business;
|
|||
|
||||
import com.wms_main.model.bo.wms.WmsPickTask;
|
||||
import com.wms_main.model.po.TAppPickTask;
|
||||
import com.wms_main.model.po.TAppStock;
|
||||
import com.wms_main.model.vo.wms.InventoryConfirmVo;
|
||||
import com.wms_main.model.vo.wms.TaskConfirmVo;
|
||||
import com.wms_main.model.vo.wms.WorkConfirmVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -49,4 +48,11 @@ public interface IConveyTaskService {
|
|||
* @return 结果
|
||||
*/
|
||||
TaskConfirmVo getCurrentStandTask(TAppPickTask thisPickTask);
|
||||
|
||||
/**
|
||||
* 获取这个载具的盘点确认信息
|
||||
* @param vehicleId 载具号
|
||||
* @return 盘点确认信息
|
||||
*/
|
||||
InventoryConfirmVo getInventoryConfirm(String vehicleId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,9 @@ public interface IStockDataService {
|
|||
* @param stockConfirm 库存确认信息
|
||||
* @param standId 站台号
|
||||
* @param userName 用户名
|
||||
* @param inventoryId 盘点任务号
|
||||
*/
|
||||
void updateStockInfo(StockConfirmEntity stockConfirm, String standId, String userName, String reason);
|
||||
void updateStockInfo(StockConfirmEntity stockConfirm, String standId, String userName, String reason, String inventoryId);
|
||||
|
||||
/**
|
||||
* 查询库存预警值
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import com.wms_main.model.dto.request.wcs.WcsReleaseBoxRequest;
|
|||
import com.wms_main.model.dto.response.wcs.BaseWcsApiResponse;
|
||||
import com.wms_main.model.dto.response.wcs.WcsApiResponse;
|
||||
import com.wms_main.model.po.*;
|
||||
import com.wms_main.model.vo.wms.InventoryConfirmVo;
|
||||
import com.wms_main.model.vo.wms.TaskConfirmVo;
|
||||
import com.wms_main.model.vo.wms.WorkConfirmVo;
|
||||
import com.wms_main.repository.utils.StringUtils;
|
||||
|
|
@ -51,6 +52,7 @@ public class ConveyTaskServiceImpl implements IConveyTaskService {
|
|||
private final ITAppStockService appStockService;// 库存服务
|
||||
private final AppCommon appCommon;
|
||||
private final ITAppVehicleService appVehicleService;// 载具服务
|
||||
private final ITAppInventoryService appInventoryService;// 盘点服务
|
||||
|
||||
/**
|
||||
* 取消拣选任务实现
|
||||
|
|
@ -457,4 +459,50 @@ public class ConveyTaskServiceImpl implements IConveyTaskService {
|
|||
|
||||
return resultVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取这个载具的盘点确认信息
|
||||
* @param vehicleId 载具号
|
||||
* @return 盘点确认信息
|
||||
*/
|
||||
@Override
|
||||
public InventoryConfirmVo getInventoryConfirm(String vehicleId) {
|
||||
// 获取这个箱子的盘点任务
|
||||
List<TAppInventory> inventoryList = appInventoryService.list(new LambdaQueryWrapper<TAppInventory>()
|
||||
.eq(TAppInventory::getVehicleId, vehicleId));
|
||||
if (inventoryList == null || inventoryList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
List<String> goodsIds = inventoryList.stream().map(TAppInventory::getGoodsId).distinct().toList();
|
||||
// 查询这个箱子的库存信息
|
||||
List<TAppStock> stockList = appStockService.list(new LambdaQueryWrapper<TAppStock>()
|
||||
.eq(TAppStock::getVehicleId, vehicleId)
|
||||
.in(TAppStock::getGoodsId, goodsIds));
|
||||
if (stockList == null || stockList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
// 将这些库存根据料号Map一下, 并汇总库存数量
|
||||
Map<String, Integer> sumNumByGoodsMap = new HashMap<>();
|
||||
for (TAppStock stock : stockList) {
|
||||
if (sumNumByGoodsMap.containsKey(stock.getGoodsId())) {
|
||||
sumNumByGoodsMap.replace(stock.getGoodsId(), sumNumByGoodsMap.get(stock.getGoodsId()) + stock.getRealNum());
|
||||
} else {
|
||||
sumNumByGoodsMap.put(stock.getGoodsId(), stock.getRealNum());
|
||||
}
|
||||
}
|
||||
for (TAppInventory inventory : inventoryList) {
|
||||
if (sumNumByGoodsMap.containsKey(inventory.getGoodsId())) {
|
||||
// 返回盘点确认信息
|
||||
InventoryConfirmVo inventoryConfirmVo = new InventoryConfirmVo();
|
||||
inventoryConfirmVo.setInventoryId(inventory.getInventoryId());
|
||||
inventoryConfirmVo.setGoodsId(inventory.getGoodsId());
|
||||
inventoryConfirmVo.setVehicleId(inventory.getVehicleId());
|
||||
inventoryConfirmVo.setStockNum(sumNumByGoodsMap.get(inventory.getGoodsId()));
|
||||
inventoryConfirmVo.setConfirmNum(sumNumByGoodsMap.get(inventory.getGoodsId()));
|
||||
// 返回结果
|
||||
return inventoryConfirmVo;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -368,7 +368,9 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
|||
thisVehicleInTask.getOpNum(),
|
||||
thisVehicleInTask.getGoodsDesc(),
|
||||
expireDate,
|
||||
sledDays
|
||||
sledDays,
|
||||
null,
|
||||
null
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
@ -522,7 +524,9 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
|||
thisVehicleInTask.getOpNum(),
|
||||
thisVehicleInTask.getGoodsDesc(),
|
||||
expireDate,
|
||||
sledDays
|
||||
sledDays,
|
||||
null,
|
||||
null
|
||||
));
|
||||
} else {
|
||||
// 更新已有库存信息
|
||||
|
|
@ -551,7 +555,9 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
|||
originSum + thisVehicleInTask.getOpNum(),
|
||||
thisVehicleInTask.getGoodsDesc(),
|
||||
expireDate,
|
||||
sledDays
|
||||
sledDays,
|
||||
null,
|
||||
null
|
||||
));
|
||||
needDeleteStockIds.addAll(oldStockList.stream()
|
||||
.map(TAppStock::getStockId)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class StockDataServiceImpl implements IStockDataService {
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateStockInfo(StockConfirmEntity stockConfirm, String standId, String userName, String reason) {
|
||||
public void updateStockInfo(StockConfirmEntity stockConfirm, String standId, String userName, String reason, String inventoryId) {
|
||||
if (stockConfirm == null || StringUtils.isEmpty(stockConfirm.getVehicleId()) || StringUtils.isEmpty(stockConfirm.getGoodsId())
|
||||
|| stockConfirm.getRealRemainQty() == null) {
|
||||
return;
|
||||
|
|
@ -59,7 +59,12 @@ public class StockDataServiceImpl implements IStockDataService {
|
|||
List<TAppStockUpdate> stockUpdateList = new ArrayList<>();
|
||||
// 剩余数量
|
||||
int remainQty = stockConfirm.getRealRemainQty();
|
||||
for (TAppStock stock : stockList) {
|
||||
for (int i = 0; i < stockList.size(); i++) {
|
||||
TAppStock stock = stockList.get(i);
|
||||
if (StringUtils.isNotEmpty(inventoryId)) {
|
||||
stock.setLastInventoryId(inventoryId);
|
||||
stock.setLastInventoryTime(LocalDateTime.now());
|
||||
}
|
||||
if (remainQty <= 0) {
|
||||
// 需要移除的库存
|
||||
removeStocks.add(stock);
|
||||
|
|
@ -78,11 +83,8 @@ public class StockDataServiceImpl implements IStockDataService {
|
|||
stockUpdateList.add(stockUpdate);
|
||||
continue;
|
||||
}
|
||||
if (stock.getRealNum() <= remainQty) {
|
||||
// 库存不变
|
||||
remainQty -= stock.getRealNum();
|
||||
} else {
|
||||
// 增加库存更新记录
|
||||
if ((i == stockList.size() - 1) || stock.getRealNum() > remainQty) {
|
||||
// 最先进的库存,剩余数量全部分配给他
|
||||
TAppStockUpdate stockUpdate = new TAppStockUpdate(
|
||||
UUIDUtils.getNewUUID(),
|
||||
stock.getVehicleId(),
|
||||
|
|
@ -93,13 +95,16 @@ public class StockDataServiceImpl implements IStockDataService {
|
|||
standId + ":" + reason,
|
||||
LocalDateTime.now(),
|
||||
userName
|
||||
);
|
||||
);
|
||||
stockUpdateList.add(stockUpdate);
|
||||
stock.setRealNum(remainQty);
|
||||
stock.setLastUpdateTime(LocalDateTime.now());
|
||||
remainQty = 0;
|
||||
// 添加更新库存列表
|
||||
updateStocks.add(stock);
|
||||
} else {
|
||||
// 库存不变
|
||||
remainQty -= stock.getRealNum();
|
||||
}
|
||||
}
|
||||
// 删除库存
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.wms_main.model.dto.response.wcs.BaseWcsApiResponse;
|
|||
import com.wms_main.model.dto.response.wcs.WcsApiResponse;
|
||||
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
||||
import com.wms_main.model.dto.response.wms.WmsApiResponse;
|
||||
import com.wms_main.model.vo.wms.InventoryConfirmVo;
|
||||
import com.wms_main.model.vo.wms.TaskConfirmVo;
|
||||
|
||||
/**
|
||||
|
|
@ -77,4 +78,25 @@ public interface ITaskControllerService {
|
|||
* @return 处理结果
|
||||
*/
|
||||
BaseWmsApiResponse confirmCurrentTask(ConfirmTaskRequest confirmTaskRequest);
|
||||
|
||||
/**
|
||||
* 下发盘点请求
|
||||
* @param inventoryRequest 盘点请求
|
||||
* @return 请求结果
|
||||
*/
|
||||
BaseWmsApiResponse requestInventory(InventoryRequest inventoryRequest);
|
||||
|
||||
/**
|
||||
* 查询盘点任务确认信息
|
||||
* @param inventoryConfirmRequest 请求
|
||||
* @return 请求结果
|
||||
*/
|
||||
WmsApiResponse<InventoryConfirmVo> getInventoryConfirm(InventoryConfirmRequest inventoryConfirmRequest);
|
||||
|
||||
/**
|
||||
* 确认盘点信息
|
||||
* @param inventoryConfirmRequest 确认请求
|
||||
* @return 处理结果
|
||||
*/
|
||||
BaseWmsApiResponse confirmInventory(InventoryConfirmRequest inventoryConfirmRequest);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -402,7 +402,7 @@ public class KateWorkControllerServiceImpl implements IKateWorkControllerService
|
|||
}
|
||||
}
|
||||
// 更新库存信息
|
||||
stockDataService.updateStockInfo(confirmWorkRequest.getStockConfirm(), confirmWorkRequest.getStandId(), confirmWorkRequest.getUserName(), "配料拣选");
|
||||
stockDataService.updateStockInfo(confirmWorkRequest.getStockConfirm(), confirmWorkRequest.getStandId(), confirmWorkRequest.getUserName(), "配料拣选", null);
|
||||
// 查询库存获得当前载具中存储的库存列表
|
||||
LambdaQueryWrapper<TAppStock> stockQueryWrapper = new LambdaQueryWrapper<TAppStock>()
|
||||
.eq(TAppStock::getVehicleId, thisPickTask.getVehicleId())
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.wms_main.constant.enums.wms.*;
|
|||
import com.wms_main.dao.*;
|
||||
import com.wms_main.model.bo.wcs.WcsStackerTask;
|
||||
import com.wms_main.model.bo.wms.GoodsInfoForTask;
|
||||
import com.wms_main.model.bo.wms.StockConfirmEntity;
|
||||
import com.wms_main.model.bo.wms.TaskConfirmEntity;
|
||||
import com.wms_main.model.bo.wms.WmsPickTask;
|
||||
import com.wms_main.model.dto.request.wcs.WcsBoxArriveRequest;
|
||||
|
|
@ -21,6 +22,7 @@ import com.wms_main.model.dto.response.wcs.WcsApiResponse;
|
|||
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
||||
import com.wms_main.model.dto.response.wms.WmsApiResponse;
|
||||
import com.wms_main.model.po.*;
|
||||
import com.wms_main.model.vo.wms.InventoryConfirmVo;
|
||||
import com.wms_main.model.vo.wms.TaskConfirmVo;
|
||||
import com.wms_main.model.vo.wms.WorkConfirmVo;
|
||||
import com.wms_main.repository.utils.ConvertUtils;
|
||||
|
|
@ -60,6 +62,8 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
private final IStockDataService stockDataService;// 库存数据服务
|
||||
private final ITAppOutsRecordService appOutsRecordService;// 出库单记录服务
|
||||
private final ITAppPickPlanService appPickPlanService;// 拣选计划服务
|
||||
private final ITAppInventoryService appInventoryService;// 盘点任务服务
|
||||
private final ITAppInventoryRecordService appInventoryRecordService;// 盘点记录服务
|
||||
private final AppCommon appCommon;
|
||||
|
||||
/**
|
||||
|
|
@ -267,6 +271,10 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
}
|
||||
}
|
||||
} else if (stockOutRequest.getOutType().equals(WmsOutTypeEnums.EMERGE.getCode())) {
|
||||
if (!appStandService.exists(new LambdaQueryWrapper<TAppStand>().eq(TAppStand::getStandId, stockOutRequest.getDestination())
|
||||
.eq(TAppStand::getStandType, 1))) {
|
||||
return BaseWmsApiResponse.error("非拣选站台不允许紧急出库。");
|
||||
}
|
||||
// 判断理由是否输入
|
||||
if (StringUtils.isEmpty(stockOutRequest.getReason())) {
|
||||
return BaseWmsApiResponse.error("请求错误:紧急出库必须输入原因。");
|
||||
|
|
@ -712,7 +720,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
}
|
||||
}
|
||||
// 更新库存信息
|
||||
stockDataService.updateStockInfo(confirmTaskRequest.getStockConfirm(), confirmTaskRequest.getStandId(), confirmTaskRequest.getUserName(), "出库拣选");
|
||||
stockDataService.updateStockInfo(confirmTaskRequest.getStockConfirm(), confirmTaskRequest.getStandId(), confirmTaskRequest.getUserName(), "出库拣选", null);
|
||||
// 查询库存获得当前载具中存储的库存列表
|
||||
LambdaQueryWrapper<TAppStock> stockQueryWrapper = new LambdaQueryWrapper<TAppStock>()
|
||||
.eq(TAppStock::getVehicleId, thisPickTask.getVehicleId())
|
||||
|
|
@ -743,6 +751,227 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求盘点---实现
|
||||
* @param inventoryRequest 盘点请求
|
||||
* @return 请求结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseWmsApiResponse requestInventory(InventoryRequest inventoryRequest) {
|
||||
if (inventoryRequest == null) {
|
||||
return BaseWmsApiResponse.error("请求为NULL。");
|
||||
}
|
||||
if (StringUtils.isEmpty(inventoryRequest.getStandId())) {
|
||||
return BaseWmsApiResponse.error("请求缺少信息,请输入站台号。");
|
||||
}
|
||||
if (!appStandService.exists(new LambdaQueryWrapper<TAppStand>().eq(TAppStand::getStandId, inventoryRequest.getStandId())
|
||||
.eq(TAppStand::getStandType, 1))) {
|
||||
return BaseWmsApiResponse.error("非拣选站台不允许盘点。");
|
||||
}
|
||||
if (StringUtils.isEmpty(inventoryRequest.getGoodsId())) {
|
||||
return BaseWmsApiResponse.error("请求缺少信息,请输入料号。");
|
||||
}
|
||||
// 判断这个料有没有还没盘点完的任务
|
||||
List<TAppInventory> inventoryList = appInventoryService.list(new LambdaQueryWrapper<TAppInventory>()
|
||||
.eq(TAppInventory::getGoodsId, inventoryRequest.getGoodsId())
|
||||
.eq(StringUtils.isNotEmpty(inventoryRequest.getVehicleId()), TAppInventory::getVehicleId, inventoryRequest.getVehicleId()));
|
||||
if (inventoryList != null && !inventoryList.isEmpty()) {
|
||||
String errMsg = StringUtils.isNotEmpty(inventoryRequest.getVehicleId()) ? "载具:" + inventoryRequest.getVehicleId() : "";
|
||||
return BaseWmsApiResponse.error(errMsg + "料号:" + inventoryRequest.getGoodsId() + "还有盘点任务未完成。");
|
||||
}
|
||||
// 查询库存,创建盘点任务
|
||||
List<TAppStock> stockList = appStockService.list(new LambdaQueryWrapper<TAppStock>()
|
||||
.eq(TAppStock::getGoodsId, inventoryRequest.getGoodsId())
|
||||
.eq(StringUtils.isNotEmpty(inventoryRequest.getVehicleId()), TAppStock::getVehicleId, inventoryRequest.getVehicleId()));
|
||||
if (stockList == null || stockList.isEmpty()) {
|
||||
return BaseWmsApiResponse.error("物料" + inventoryRequest.getGoodsId() + "没有库存。");
|
||||
}
|
||||
// 根据载具号map一下
|
||||
Map<String, TAppInventory> inventoryByVehicleMap = new HashMap<>();
|
||||
// 盘点单号
|
||||
String orderId = UUIDUtils.getNewUUID();
|
||||
for (TAppStock stock : stockList) {
|
||||
if (!inventoryByVehicleMap.containsKey(stock.getVehicleId())) {
|
||||
// 添加盘点任务
|
||||
TAppInventory inventoryTask = new TAppInventory(
|
||||
UUIDUtils.getNewUUID(),
|
||||
inventoryRequest.getGoodsId(),
|
||||
stock.getVehicleId(),
|
||||
null,
|
||||
null,
|
||||
inventoryRequest.getStandId(),
|
||||
inventoryRequest.getUserName(),
|
||||
WmsInvTypeEnums.INV_TYPE_1.getCode(),
|
||||
WmsInvStatusEnums.INIT.getCode(),
|
||||
WmsInvResultEnums.NONE.getCode(),
|
||||
LocalDateTime.now(),
|
||||
null,
|
||||
orderId
|
||||
);
|
||||
inventoryByVehicleMap.put(stock.getVehicleId(), inventoryTask);
|
||||
}
|
||||
}
|
||||
if (!inventoryByVehicleMap.isEmpty()) {
|
||||
appInventoryService.saveBatch(inventoryByVehicleMap.values());
|
||||
}
|
||||
// 保存盘点任务
|
||||
return BaseWmsApiResponse.success("创建盘点任务成功。");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询盘点确认信息
|
||||
* @param inventoryConfirmRequest 请求
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public WmsApiResponse<InventoryConfirmVo> getInventoryConfirm(InventoryConfirmRequest inventoryConfirmRequest) {
|
||||
// 判断请求是否参数完备
|
||||
if (inventoryConfirmRequest == null) {
|
||||
return WmsApiResponse.error("请求参数为空。", null);
|
||||
}
|
||||
if (StringUtils.isEmpty(inventoryConfirmRequest.getStandId())) {
|
||||
return WmsApiResponse.error("请求参数缺少站台号。", null);
|
||||
}
|
||||
// 查询当前站台的拣选任务
|
||||
List<TAppPickTask> pickTaskList = appPickTaskService.list(new LambdaQueryWrapper<TAppPickTask>()
|
||||
.eq(TAppPickTask::getPickStand, inventoryConfirmRequest.getStandId())
|
||||
.eq(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.ARRIVE.getCode()));
|
||||
if (pickTaskList == null || pickTaskList.isEmpty()) {
|
||||
return WmsApiResponse.error("当前站台没有箱子到达, 请检查。", null);
|
||||
}
|
||||
if (pickTaskList.size() > 1) {
|
||||
return WmsApiResponse.error("当前站台有多个箱子到达,请检查。", null);
|
||||
}
|
||||
// 获取当前拣选任务
|
||||
TAppPickTask thisPickTask = pickTaskList.getFirst();
|
||||
InventoryConfirmVo inventoryConfirmVo = conveyTaskService.getInventoryConfirm(thisPickTask.getVehicleId());
|
||||
if (inventoryConfirmVo != null) {
|
||||
// 返回结果
|
||||
return WmsApiResponse.success("查询盘点确认信息成功。", inventoryConfirmVo);
|
||||
}
|
||||
return WmsApiResponse.instanceOf(WmsApiResponseCodeEnums.WARNING.getCode(),"当前箱子没有要盘点的任务,请放行。", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认盘点信息
|
||||
* @param inventoryConfirmRequest 确认请求
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseWmsApiResponse confirmInventory(InventoryConfirmRequest inventoryConfirmRequest) {
|
||||
if (inventoryConfirmRequest == null) {
|
||||
return BaseWmsApiResponse.error("请求信息为空。");
|
||||
}
|
||||
if (StringUtils.isEmpty(inventoryConfirmRequest.getStandId())) {
|
||||
return BaseWmsApiResponse.error("请求信息缺少站台号。");
|
||||
}
|
||||
// 查询当前站台上的已到达的拣选任务
|
||||
List<TAppPickTask> pickTaskList = appPickTaskService.list(new LambdaQueryWrapper<TAppPickTask>()
|
||||
.eq(TAppPickTask::getPickStand, inventoryConfirmRequest.getStandId())
|
||||
.eq(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.ARRIVE.getCode()));
|
||||
if (pickTaskList == null || pickTaskList.isEmpty()) {
|
||||
return BaseWmsApiResponse.error("当前站台没有箱子到达, 请检查。");
|
||||
}
|
||||
if (pickTaskList.size() > 1) {
|
||||
return BaseWmsApiResponse.error("当前站台有多个箱子到达,请检查。");
|
||||
}
|
||||
// 当前站台到达的拣选任务
|
||||
TAppPickTask thisPickTask = pickTaskList.getFirst();
|
||||
if (StringUtils.isNotEmpty(inventoryConfirmRequest.getInventoryId())) {
|
||||
TAppInventory targetInventory = appInventoryService.getById(inventoryConfirmRequest.getInventoryId());
|
||||
if (targetInventory != null) {
|
||||
if (!Objects.equals(targetInventory.getVehicleId(), thisPickTask.getVehicleId())) {
|
||||
// 盘点的载具号与当前站台到达的拣选任务载具号不一致,请检查。
|
||||
return BaseWmsApiResponse.error("盘点的载具号与当前站台到达的载具号不一致,请检查。");
|
||||
}
|
||||
if (inventoryConfirmRequest.getConfirmNum() == null || inventoryConfirmRequest.getConfirmNum() < 0) {
|
||||
return BaseWmsApiResponse.error("请求信息中的盘点确认数量不正确。");
|
||||
}
|
||||
// 添加盘点记录
|
||||
TAppInventoryRecord inventoryRecord = new TAppInventoryRecord();
|
||||
inventoryRecord.setInventoryId(inventoryConfirmRequest.getInventoryId());
|
||||
inventoryRecord.setGoodsId(targetInventory.getGoodsId());
|
||||
inventoryRecord.setVehicleId(targetInventory.getVehicleId());
|
||||
// 查询这个载具-料号对应的库存数量
|
||||
List<TAppStock> thisVehicleAndGoodsStock = appStockService.list(new LambdaQueryWrapper<TAppStock>()
|
||||
.eq(TAppStock::getVehicleId, targetInventory.getVehicleId())
|
||||
.eq(TAppStock::getGoodsId, targetInventory.getGoodsId()));
|
||||
int stockNum = 0;
|
||||
if (thisVehicleAndGoodsStock != null && !thisVehicleAndGoodsStock.isEmpty()) {
|
||||
// 获取realNum总和
|
||||
stockNum = thisVehicleAndGoodsStock.stream().mapToInt(TAppStock::getRealNum).sum();
|
||||
}
|
||||
inventoryRecord.setStockNum(stockNum);
|
||||
inventoryRecord.setConfirmNum(inventoryConfirmRequest.getConfirmNum());
|
||||
inventoryRecord.setInvStand(inventoryConfirmRequest.getStandId());
|
||||
inventoryRecord.setInvUser(inventoryConfirmRequest.getUserName());
|
||||
inventoryRecord.setInvType(WmsInvTypeEnums.INV_TYPE_1.getCode());
|
||||
inventoryRecord.setInvStatus(WmsInvStatusEnums.CONFIRMED.getCode());
|
||||
if (stockNum < inventoryConfirmRequest.getConfirmNum()) {
|
||||
// 盘盈
|
||||
inventoryRecord.setInvResult(WmsInvResultEnums.PLUS.getCode());
|
||||
} else if (stockNum == inventoryConfirmRequest.getConfirmNum()) {
|
||||
// 正常
|
||||
inventoryRecord.setInvResult(WmsInvResultEnums.EQUAL.getCode());
|
||||
} else {
|
||||
// 盘亏
|
||||
inventoryRecord.setInvResult(WmsInvResultEnums.MINUS.getCode());
|
||||
}
|
||||
inventoryRecord.setInvCreateTime(targetInventory.getInvCreateTime());
|
||||
inventoryRecord.setInvConfirmTime(LocalDateTime.now());
|
||||
inventoryRecord.setInvOrderId(targetInventory.getInventoryId());
|
||||
appInventoryRecordService.save(inventoryRecord);
|
||||
// 移除任务表
|
||||
appInventoryService.removeById(inventoryConfirmRequest.getInventoryId());
|
||||
// 根据盘点确认信息更新库存
|
||||
StockConfirmEntity stockConfirm = new StockConfirmEntity();
|
||||
stockConfirm.setVehicleId(targetInventory.getVehicleId());
|
||||
stockConfirm.setGoodsId(targetInventory.getGoodsId());
|
||||
stockConfirm.setRealRemainQty(inventoryConfirmRequest.getConfirmNum());
|
||||
// 更新库存信息
|
||||
stockDataService.updateStockInfo(stockConfirm, inventoryConfirmRequest.getStandId(), inventoryConfirmRequest.getUserName(), "盘点确认", targetInventory.getInventoryId());
|
||||
} else {
|
||||
return BaseWmsApiResponse.error("请求的盘点任务号未查到对应的盘点任务。");
|
||||
}
|
||||
}
|
||||
// 查询库存获得当前载具中存储的库存列表
|
||||
LambdaQueryWrapper<TAppStock> stockQueryWrapper = new LambdaQueryWrapper<TAppStock>()
|
||||
.eq(TAppStock::getVehicleId, thisPickTask.getVehicleId());
|
||||
List<TAppStock> stockList = appStockService.list(stockQueryWrapper);
|
||||
// 界面直接点击确认/放行
|
||||
if (!stockList.isEmpty()) {
|
||||
// 判断是否还有其他盘点任务
|
||||
List<TAppInventory> otherInventoryList = appInventoryService.list(new LambdaQueryWrapper<TAppInventory>()
|
||||
.eq(TAppInventory::getVehicleId, thisPickTask.getVehicleId())
|
||||
.ne(TAppInventory::getInventoryId, inventoryConfirmRequest.getInventoryId()));
|
||||
if (otherInventoryList != null && !otherInventoryList.isEmpty()) {
|
||||
return BaseWmsApiResponse.error("当前载具还有其他的盘点任务,请继续盘点。");
|
||||
}
|
||||
// 判断还有没有当前站台的其他拣选任务
|
||||
TaskConfirmVo taskConfirmVo = conveyTaskService.getCurrentStandTask(thisPickTask);
|
||||
if (taskConfirmVo != null) {
|
||||
return BaseWmsApiResponse.warn("当前载具还有紧急出库任务,请切换到出库界面信息进行拣配。");
|
||||
}
|
||||
WorkConfirmVo resultVo = conveyTaskService.getCurrentStandWork(thisPickTask);
|
||||
if (resultVo != null) {
|
||||
return BaseWmsApiResponse.warn("当前载具还有工作,请切换到拣配界面进行拣配。");
|
||||
}
|
||||
} else {
|
||||
// 取消后续拣选任务
|
||||
conveyTaskService.cancelOtherStandPickTasks(thisPickTask.getVehicleId(), thisPickTask.getPickStand());
|
||||
}
|
||||
// 放行
|
||||
if (conveyTaskService.releaseStandVehicle(thisPickTask)) {
|
||||
return BaseWmsApiResponse.success("确认成功。");
|
||||
} else {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return BaseWmsApiResponse.error("释放箱子失败。");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新出库单信息
|
||||
* @param confirmTaskRequest 确认信息
|
||||
|
|
|
|||
|
|
@ -25,4 +25,9 @@ public interface IOutsExecutorService {
|
|||
* 修复出库单
|
||||
*/
|
||||
void repairOuts();
|
||||
|
||||
/**
|
||||
* 执行盘点
|
||||
*/
|
||||
void executeInventory();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,5 +39,11 @@ public class OutsExecutor implements Job {
|
|||
} catch (Exception e) {
|
||||
log.error("处理出库单失败{}", StringUtils.objectToString(e));
|
||||
}
|
||||
// 处理盘点单
|
||||
try {
|
||||
outsExecutorService.executeInventory();
|
||||
} catch (Exception e) {
|
||||
log.error("处理盘点单失败{}", StringUtils.objectToString(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
private final ITAppPickPlanService appPickPlanService;// 拣选计划服务
|
||||
private final IStockDataService stockDataService;// 库存数据服务
|
||||
private final ITAppOutsRecordService appOutsRecordService;// 出库单记录服务
|
||||
private final ITAppInventoryService appInventoryService;// 盘点任务服务
|
||||
private final AppCommon appCommon;// 应用共通数据
|
||||
|
||||
/**
|
||||
|
|
@ -197,12 +198,13 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
|
||||
/**
|
||||
* 处理出库(入库用)请求
|
||||
* @param equipVehicleMap 载具与载具编号的映射
|
||||
* @param appOuts 出库单
|
||||
* @param allStocks 所有库存
|
||||
* @param pickTasks 拣选任务
|
||||
* @param newOutWmsTasks 新的出库任务
|
||||
* @param newPickTasks 新的拣选任务
|
||||
*
|
||||
* @param equipVehicleMap 载具与载具编号的映射
|
||||
* @param appOuts 出库单
|
||||
* @param allStocks 所有库存
|
||||
* @param pickTasks 拣选任务
|
||||
* @param newOutWmsTasks 新的出库任务
|
||||
* @param newPickTasks 新的拣选任务
|
||||
* @param thisTimeOutVehicleIds 本次出库的载具列表
|
||||
*/
|
||||
private void solveOutForIn(Map<Integer, String> equipVehicleMap, TAppOuts appOuts, List<TAppStock> allStocks, List<TAppPickTask> pickTasks, List<TAppTask> newOutWmsTasks, List<TAppPickTask> newPickTasks, List<String> thisTimeOutVehicleIds) {
|
||||
|
|
@ -326,10 +328,6 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
// 不是这个料
|
||||
continue;
|
||||
}
|
||||
// if (StringUtils.isNotEmpty(appOuts.getVehicleId()) && !Objects.equals(stock.getVehicleId(), appOuts.getVehicleId())) {
|
||||
// // 紧急出库选择了箱号
|
||||
// continue;
|
||||
// }
|
||||
String stockId = stockDataService.getFirstInStock(stock.getGoodsId(), allStocks);
|
||||
if (StringUtils.isNotEmpty(stockId) && !Objects.equals(stockId, stock.getStockId())) {
|
||||
// 不是当前物料最先进的库存
|
||||
|
|
@ -409,12 +407,12 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
oldPickTasks = pickTasks.stream().filter(pickTask ->
|
||||
Objects.equals(pickTask.getPickStand(), appOuts.getDestination())
|
||||
&& pickTask.getVehicleId().equals(stock.getVehicleId())
|
||||
&& !Objects.equals(pickTask.getPickStatus(), WmsPickTaskStatusEnum.FOR_IN.getCode())).toList();
|
||||
&& !Objects.equals(pickTask.getPickStatus(), WmsPickTaskStatusEnum.FOR_IN.getCode())).toList();
|
||||
}
|
||||
// 新生成的拣选任务
|
||||
List<TAppPickTask> newOldPickTasks = newPickTasks.stream().filter(pickTask -> pickTask.getVehicleId().equals(stock.getVehicleId())
|
||||
&& Objects.equals(pickTask.getPickStand(), appOuts.getDestination())
|
||||
&& !Objects.equals(pickTask.getPickStatus(), WmsPickTaskStatusEnum.FOR_IN.getCode())).toList();
|
||||
&& !Objects.equals(pickTask.getPickStatus(), WmsPickTaskStatusEnum.FOR_IN.getCode())).toList();
|
||||
// 生成拣选任务
|
||||
if (oldPickTasks.isEmpty() && newOldPickTasks.isEmpty()) {
|
||||
newPickTasks.add(new TAppPickTask(
|
||||
|
|
@ -742,8 +740,8 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
continue;
|
||||
}
|
||||
if (work.getWorkStatus() == 2 && work.getLackStatus() == 1) {
|
||||
// 缺料,添加记录
|
||||
workRecords.add(RecordOfWork(work));
|
||||
// 缺料,不算完成
|
||||
ifAllFinished = false;
|
||||
continue;
|
||||
}
|
||||
// 判断库内料分配的数量是否需要修正
|
||||
|
|
@ -835,7 +833,7 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void repairStandWorks() {
|
||||
public void repairStandWorks() {
|
||||
// 查找到所有的可用的拣选站台
|
||||
List<TAppStand> standList = appStandService.list(new LambdaQueryWrapper<TAppStand>()
|
||||
.eq(TAppStand::getStandType, 1)
|
||||
|
|
@ -943,6 +941,143 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理盘点任务
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void executeInventory() {
|
||||
// 查询对应的盘点任务
|
||||
List<TAppInventory> waitExecuteInventoryList = appInventoryService.list(new LambdaQueryWrapper<TAppInventory>()
|
||||
.eq(TAppInventory::getInvStatus, WmsInvStatusEnums.INIT.getCode()));
|
||||
if (waitExecuteInventoryList == null || waitExecuteInventoryList.isEmpty()) {
|
||||
// 没有需要解析的盘点任务
|
||||
return;
|
||||
}
|
||||
// 筛选出对应载具号
|
||||
List<String> vehicleIds = waitExecuteInventoryList.stream().map(TAppInventory::getVehicleId).distinct().toList();
|
||||
if (vehicleIds.isEmpty()) {
|
||||
// 没有对应载具号
|
||||
return;
|
||||
}
|
||||
// 查询对应的库存信息
|
||||
List<TAppStock> targetStocks = appStockService.list(new LambdaQueryWrapper<TAppStock>()
|
||||
.in(TAppStock::getVehicleId, vehicleIds)
|
||||
.le(TAppStock::getStockStatus, WmsStockStatusEnums.OUTED.getCode())
|
||||
.orderByAsc(TAppStock::getFirstInTime));
|
||||
// 拣选任务
|
||||
List<TAppPickTask> pickTasks = appPickTaskService.list(new LambdaQueryWrapper<TAppPickTask>()
|
||||
.in(TAppPickTask::getVehicleId, vehicleIds));
|
||||
// 需要保存的信息
|
||||
List<TAppTask> newOutWmsTasks = new ArrayList<>();// 新的出库任务
|
||||
List<TAppPickTask> newPickTasks = new ArrayList<>();// 新的拣选任务
|
||||
List<String> thisTimeOutVehicleIds = new ArrayList<>();// 本次出库载具
|
||||
// 获取可用堆垛机
|
||||
List<TAppEquipment> usableStackers = appEquipmentService.list(new LambdaQueryWrapper<TAppEquipment>()
|
||||
.eq(TAppEquipment::getEquipmentType, 1)
|
||||
.eq(TAppEquipment::getEquipmentStatus, WmsUsableStatusEnums.USABLE.getCode()));
|
||||
Map<Integer, String> equipVehicleMap = new HashMap<>();
|
||||
getVehicleEquipMap("", true, equipVehicleMap, usableStackers);
|
||||
for (TAppInventory inventory : waitExecuteInventoryList) {
|
||||
// 查找
|
||||
for (TAppStock stock : targetStocks) {
|
||||
if (thisTimeOutVehicleIds.contains(stock.getVehicleId())) {
|
||||
// 设置这个箱子的库存都为出库中
|
||||
stock.setStockStatus(WmsStockStatusEnums.OUTING.getCode());
|
||||
}
|
||||
if (!Objects.equals(inventory.getGoodsId(), stock.getGoodsId())) {
|
||||
// 不是这个料
|
||||
continue;
|
||||
}
|
||||
if (!Objects.equals(stock.getVehicleId(), inventory.getVehicleId())) {
|
||||
// 不是这个箱子
|
||||
continue;
|
||||
}
|
||||
if (Objects.equals(stock.getStockStatus(), WmsStockStatusEnums.OK.getCode()) && ifThisLocationCantOut(stock.getLocationId(), equipVehicleMap)) {
|
||||
// 当前堆垛机已经无法生成新的出库任务了
|
||||
continue;
|
||||
}
|
||||
// 拣选任务状态
|
||||
int pickTaskStatus = WmsPickTaskStatusEnum.TEMP.getCode();
|
||||
// 库存正常
|
||||
if (Objects.equals(stock.getStockStatus(), WmsStockStatusEnums.OK.getCode())) {
|
||||
// 需要生成出库任务
|
||||
newOutWmsTasks.add(new TAppTask(
|
||||
UUIDUtils.getNewUUID(),
|
||||
WmsTaskTypeEnums.OUT.getCode(),
|
||||
0,
|
||||
2,
|
||||
stock.getVehicleId(),
|
||||
stock.getLocationId(),
|
||||
null,
|
||||
null,
|
||||
LocalDateTime.now(),
|
||||
null,
|
||||
AppConstant.EMPTY_GOODS_ID,
|
||||
0,
|
||||
0,
|
||||
inventory.getInvUser(),
|
||||
"",
|
||||
inventory.getInvStand(),
|
||||
""
|
||||
));
|
||||
stock.setStockStatus(WmsStockStatusEnums.OUTING.getCode());
|
||||
thisTimeOutVehicleIds.add(stock.getVehicleId());
|
||||
updateVehicleEquipMapByLocation(equipVehicleMap, stock.getVehicleId(), stock.getLocationId());
|
||||
}
|
||||
// 如果是已经出库的库存
|
||||
if (Objects.equals(stock.getStockStatus(), WmsStockStatusEnums.OUTED.getCode())) {
|
||||
pickTaskStatus = WmsPickTaskStatusEnum.WAIT.getCode();
|
||||
}
|
||||
// 已有的拣选任务
|
||||
List<TAppPickTask> oldPickTasks = new ArrayList<>();
|
||||
if (pickTasks != null) {
|
||||
oldPickTasks = pickTasks.stream().filter(pickTask ->
|
||||
Objects.equals(pickTask.getPickStand(), inventory.getInvStand())
|
||||
&& pickTask.getVehicleId().equals(stock.getVehicleId())
|
||||
&& !Objects.equals(pickTask.getPickStatus(), WmsPickTaskStatusEnum.FOR_IN.getCode())).toList();
|
||||
}
|
||||
// 新生成的拣选任务
|
||||
List<TAppPickTask> newOldPickTasks = newPickTasks.stream().filter(pickTask -> pickTask.getVehicleId().equals(stock.getVehicleId())
|
||||
&& Objects.equals(pickTask.getPickStand(), inventory.getInvStand())
|
||||
&& !Objects.equals(pickTask.getPickStatus(), WmsPickTaskStatusEnum.FOR_IN.getCode())).toList();
|
||||
// 生成拣选任务
|
||||
if (oldPickTasks.isEmpty() && newOldPickTasks.isEmpty()) {
|
||||
newPickTasks.add(new TAppPickTask(
|
||||
UUIDUtils.getNewUUID(),
|
||||
inventory.getInvStand(),
|
||||
stock.getVehicleId(),
|
||||
pickTaskStatus,
|
||||
LocalDateTime.now(),
|
||||
null, null, null
|
||||
));
|
||||
}
|
||||
// 设置盘点状态
|
||||
inventory.setInvStatus(WmsInvStatusEnums.EXECUTED.getCode());
|
||||
}
|
||||
}
|
||||
// 更新盘点信息
|
||||
appInventoryService.updateBatchById(waitExecuteInventoryList);
|
||||
// 保存出库任务
|
||||
if (!newOutWmsTasks.isEmpty()) {
|
||||
appTaskService.saveBatch(newOutWmsTasks);
|
||||
}
|
||||
// 保存拣选任务
|
||||
if (!newPickTasks.isEmpty()) {
|
||||
appPickTaskService.saveBatch(newPickTasks);
|
||||
}
|
||||
// 更新载具信息
|
||||
if (!thisTimeOutVehicleIds.isEmpty()) {
|
||||
appVehicleService.update(new LambdaUpdateWrapper<TAppVehicle>()
|
||||
.set(TAppVehicle::getVehicleStatus, WmsVehicleStatusEnums.OUT.getCode())
|
||||
.in(TAppVehicle::getVehicleId, thisTimeOutVehicleIds));
|
||||
// 更新库存状态
|
||||
appStockService.update(new LambdaUpdateWrapper<TAppStock>()
|
||||
.set(TAppStock::getStockStatus, WmsStockStatusEnums.OUTING.getCode())
|
||||
.in(TAppStock::getVehicleId, thisTimeOutVehicleIds));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转化记录
|
||||
*
|
||||
|
|
@ -1191,8 +1326,9 @@ public class OutsExecutorServiceImpl implements IOutsExecutorService {
|
|||
|
||||
/**
|
||||
* 添加待删除序号以及记录
|
||||
* @param outIds 待删除id列表
|
||||
* @param thisOuts 待删除outs
|
||||
*
|
||||
* @param outIds 待删除id列表
|
||||
* @param thisOuts 待删除outs
|
||||
* @param addRecords 待添加的记录
|
||||
*/
|
||||
private void addRemovingOutsAndRecord(List<String> outIds, TAppOuts thisOuts, List<TAppOutsRecord> addRecords) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.wms_main.mapper.AppInventoryMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.wms_main.mapper.AppInventoryRecordMapper">
|
||||
|
||||
</mapper>
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user