最新版本

This commit is contained in:
杨学谦 2025-08-19 09:37:01 +08:00
parent c59adc90e7
commit 992f316bae
24 changed files with 932 additions and 445 deletions

View File

@ -105,6 +105,11 @@
type: 'success',
});
this.bindOrderInList = responseData['returnData'];
this.resetInput();
this.$emit('update:modelValue', false);
this.$emit('refresh');
} else {
//
ElMessageBox.alert(`服务器返回失败:${responseData.message}`, '执行失败', {

View File

@ -1,8 +1,12 @@
<!-- -->
<template>
<div style="margin-left: 10px">
<el-dialog :model-value="modelValue" :show-close="false" title="手动入库"
@close="() => $emit('update:modelValue', false)">
<el-dialog
:model-value="modelValue"
:show-close="false"
title="手动入库"
@close="() => $emit('update:modelValue', false)"
@opened="handleDialogOpened">
<div>
<el-form
label-width="150px"
@ -10,19 +14,12 @@
require-asterisk-position="right"
inline
>
<!-- <el-form-item label="源库别:" required>
<el-input class="form-input" v-model="bindingData.wareHouse" clearable/>
</el-form-item> -->
<!-- <el-form-item label="源库别:" prop="wareHouse" required style="width: 72%;">
<el-select v-model="bindingData.wareHouse" placeholder="请选择" style="width: 120%;">
<el-option label="立体库" value="100001"></el-option>
<el-option label="四向车库" value="300002"></el-option>
</el-select>
</el-form-item> -->
<el-form-item label="输入子码:" required>
<el-input class="form-input" v-model="bindingData.codeMessage" clearable/>
<el-input
ref="codeMessageInput"
class="form-input"
v-model="bindingData.codeMessage"
clearable/>
</el-form-item>
<div style="margin-top: 50px">
<el-button type="primary" @click="addOrder()">
@ -66,16 +63,36 @@ export default {
},
bindOrderInList: []
}
},
watch: {
},
// data
computed: {},
// data
watch: {},
//
methods: {
formatCellValueTime,
formatterOrderInEnum,
handleDialogOpened() {
this.$nextTick(() => {
if (this.$refs.codeMessageInput) {
const inputRef = this.$refs.codeMessageInput;
//
if (inputRef.focus) {
inputRef.focus();
} else if (inputRef.$el) {
const nativeInput = inputRef.$el.querySelector('input');
if (nativeInput) {
nativeInput.focus();
}
} else if (inputRef.$refs && inputRef.$refs.input) {
inputRef.$refs.input.focus();
}
}
});
},
// downOrderIn.vue methods
addOrder() {
if(this.bindingData.codeMessage.length !== 22) {
ElMessage({
@ -97,6 +114,9 @@ export default {
});
this.bindOrderInList = responseData['returnData'];
this.bindingData.codeMessage = '';
//
this.$emit('update:modelValue', false);
this.$emit('refresh');
} else {
//
ElMessageBox.alert(`服务器返回失败:${responseData.message}`, '执行失败', {

View File

@ -21,10 +21,10 @@
</el-select>
</el-form-item>
<el-form-item label="零件号:" required>
<el-form-item label="零件号:" required style="width: 72%;">
<el-input class="form-input" v-model="bindingData.goodsId" clearable/>
</el-form-item>
<el-form-item label="数量:" required>
<el-form-item label="数量:" required style="width: 72%;">
<el-input class="form-input" v-model="bindingData.goodsNum" clearable/>
</el-form-item>
<!-- <el-form-item label="日期:">
@ -120,6 +120,16 @@ export default {
type: 'success',
});
this.bindOrderInList = responseData['returnData'];
//
this.bindingData.wareHouse = '';
this.bindingData.goodsId = '';
this.bindingData.goodsNum = '';
this.bindingData.batchsNoByShow = '';
this.bindingData.batchsNo = '';
this.$emit('update:modelValue', false);
//
this.$emit('refresh');
} else {
//
ElMessageBox.alert(`服务器返回失败:${responseData.message}`, '执行失败', {

View File

@ -1,7 +1,7 @@
import axios from 'axios'
//172.21.80.150
const request = axios.create({
baseURL: 'http://localhost:19990/wms',
baseURL: 'http://172.21.80.150:19990/wms',
timeout: 5000
})

View File

@ -23,41 +23,42 @@
<div> <!-- 表格-->
<el-row style="width: calc(100vw - 300px)">
<h5>入库单</h5>
<el-table :data="goodsOrderInList" border stripe max-height="calc(100vh - 550px)">
<el-table-column fixed prop="rowId" label="识别号" width="90px" align="center" show-overflow-tooltip/>
<el-table :data="goodsOrderInList" border stripe max-height="calc(100vh - 450px)">
<!-- <el-table-column fixed prop="rowId" label="识别号" width="90px" align="center" show-overflow-tooltip/> -->
<!-- <el-table-column fixed prop="guid" label="GUID" width="200px" align="center" show-overflow-tooltip/> -->
<el-table-column prop="inType" label="入库类型" width="100px" align="center" show-overflow-tooltip/>
<el-table-column prop="batchNo" label="批次" width="120px" align="center" show-overflow-tooltip/>
<el-table-column prop="vehicleNo" label="载具号" width="100px" align="center" show-overflow-tooltip/>
<!-- <el-table-column prop="inType" label="入库类型" width="100px" align="center" show-overflow-tooltip/> -->
<el-table-column prop="batchNo" label="批次" width="200px" align="center" show-overflow-tooltip/>
<el-table-column prop="vehicleNo" label="载具号" width="200px" align="center" show-overflow-tooltip/>
<el-table-column prop="goodsId" label="物料号" width="120px" align="center" show-overflow-tooltip/>
<el-table-column prop="goodsNum" label="物料数量" width="120px" align="center" show-overflow-tooltip/>
<el-table-column prop="wareHouse" label="库别" width="100px" align="center" show-overflow-tooltip/>
<el-table-column prop="createPerson" label="创建人" width="100px" align="center" show-overflow-tooltip/>
<el-table-column prop="createTime" label="创建时间" :formatter="formatCellValueTime" width="180px"
align="center" show-overflow-tooltip/>
<el-table-column prop="orderStatus" label="入库单状态" width="95px" align="center">
<template #default="scope">
<el-tag class="ml-2" :type=formatterOrderInEnum(scope.row.orderStatus).type>
{{formatterOrderInEnum(scope.row.orderStatus).label }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="createPerson" label="创建人" width="100px" align="center" show-overflow-tooltip/>
<el-table-column prop="createTime" label="创建时间" :formatter="formatCellValueTime" width="180px"
align="center" show-overflow-tooltip/>
<el-table-column prop="updateTime" label="更新时间" :formatter="formatCellValueTime" width="180px" align="center" show-overflow-tooltip/>
<el-table-column prop="remark" label="备注" show-overflow-tooltip min-width="120px"/>
<el-table-column fixed="right" label="操作" align="center" width="190">
<!-- <el-table-column prop="updateTime" label="更新时间" :formatter="formatCellValueTime" width="180px" align="center" show-overflow-tooltip/> -->
<el-table-column prop="remark" label="备注" align="center" show-overflow-tooltip min-width="100px"/>
<el-table-column fixed="right" label="操作" align="center" width="170">
<template #default="scope">
<el-button-group class="ml-4">
<el-tooltip content="解绑" placement="top" effect="light">
<el-button type="warning" size="small" @click="unBindingOrder(scope.row)">
<el-button type="warning" size="normal" @click="unBindingOrder(scope.row)">
<el-icon><Close /></el-icon>
</el-button>
</el-tooltip>
<el-tooltip content="更新数量" placement="top" effect="light">
<el-button type="success" size="small" @click="updateGoodsNum(scope.row)">
<el-button type="success" size="normal" @click="updateGoodsNum(scope.row)">
<el-icon><Edit/></el-icon>
</el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top" effect="light">
<el-button type="danger" size="small" @click="deleteOrder(scope.row)">
<el-button type="danger" size="normal" @click="deleteOrder(scope.row)">
<el-icon><Delete/></el-icon>
</el-button>
</el-tooltip>
@ -68,9 +69,9 @@
<!-- 对话框部分 -->
<el-dialog v-model="dialogVisible" title="更新数量" width="40%" @close="resetForm">
<el-form ref="updateFormRef" :model="updateFormEntity" :rules="rules" status-icon>
<el-form-item label="识别号" prop="rowId">
<!-- <el-form-item label="识别号" prop="rowId">
<el-input v-model="updateFormEntity.rowId" readonly />
</el-form-item>
</el-form-item> -->
<el-form-item label="实际数量" prop="realNum">
<el-input-number v-model.number="updateFormEntity.realNum" controls-position="right" :min="0" clearable />
</el-form-item>
@ -86,7 +87,8 @@
</div>
<!-- 绑定物料框-->
<BindingGoods v-model="showBindingGoods"></BindingGoods>
<downOrderIn v-model="downOrderIn"></downOrderIn>
<!-- goodsIn.vue 模板部分 -->
<downOrderIn v-model="downOrderIn" @refresh="queryGoodsOrderIn"></downOrderIn>
</el-config-provider>
</template>
@ -140,7 +142,10 @@ export default {
}
},
mounted() {},
mounted() {
//
this.queryGoodsOrderIn();
},
methods: {
formatCellValueTime,
formatterOrderInEnum,
@ -238,6 +243,10 @@ export default {
message: '更新成功',
type: 'success',
});
this.updateFormEntity = {
realNum: ""
};
this.dialogVisible = false;
this.queryGoodsOrderIn();
}else {
//

View File

@ -3,95 +3,28 @@
<el-container class="content">
<fieldset class="input-area">
<legend style="font-size: xxx-large;">入库界面</legend>
<!-- 添加子码输入区域 -->
<el-row>
<el-col :span="22" :offset="1">
<el-form-item label="输入子码">
<el-input
v-model="subCode"
placeholder="请输入22位子码"
clearable
style="height: 50px;"
@keyup.enter="handleSubCodeInput">
<template #append>
<el-button @click="handleSubCodeInput">下发任务</el-button>
</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-form ref="taskInRequestRef" :model="taskInRequestEntity" :label-position="labelPosition"
label-width="100px" style="max-width: 100%" :rules="rules" status-icon size="large">
<el-row>
<el-col :span="22" :offset="1">
<el-form-item label="是否入空托" prop="isEmpty">
<el-select-v2 v-model="taskInRequestEntity.isEmpty" placeholder="请选择入库类型"
:options="stockTypeOptions"
@change="autoCompleteEmptyInfo(taskInRequestEntity)"></el-select-v2>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="22" :offset="1">
<el-form-item label="箱号" prop="vehicleNo">
<el-input v-model="taskInRequestEntity.vehicleNo" ref="vehicleNo" clearable
style="height: 50px;" v-on:keyup.tab="detectEndInputVehicleNo(taskInRequestEntity)" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="22" :offset="1">
<el-form-item label="零件号" prop="goodsId">
<el-input v-model="taskInRequestEntity.goodsId" ref="goodsId" clearable
:disabled="disabledEmpty" @blur="queryAndAutoComplete(taskInRequestEntity)"
style="height: 50px;" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="22" :offset="1">
<el-form-item label="零件名称" prop="goodsName">
<el-input v-model="taskInRequestEntity.goodsName" clearable readonly
style="height: 50px;" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="22" :offset="1">
<el-form-item label="零件数量" prop="goodsNum">
<el-input-number v-model.number="taskInRequestEntity.goodsNum" ref="goodsNum" clearable
:disabled="disabledEmpty" controls-position="right" :min="1"
@blur="detectEndInputNum(taskInRequestEntity)" style="height: 50px;"></el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="22" :offset="1">
<el-form-item label="零件重量(千克)" prop="weight">
<el-input v-model="taskInRequestEntity.weight" clearable readonly style="height: 50px;" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="22" :offset="1" v-show="disPlayDateFlag">
<el-form-item label="有效期(年)" prop="shelfLife">
<!-- // TODO -->
<el-input v-model="taskInRequestEntity.shelfLife" clearable readonly
style="height: 50px;" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="22" :offset="1" v-show="disPlayDateFlag">
<el-form-item label="生产日期" prop="productionDate">
<el-date-picker v-model="taskInRequestEntity.productionDate" ref="productionDate"
:disabled="disabledEmpty" style="width: 100%;height: 75px;" type="date"
placeholder="请选择生产日期" :editable="false" size="large" clearable />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="4" class="btn-area">
<el-col :span="8" :offset="0">
<el-form-item>
<el-button type="primary" round
@click="addTempTasks(taskInRequestRef, taskInRequestEntity)">绑定信息</el-button>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item>
<el-button type="success" round
@click="submitGoodsInTask(taskInRequestRef)">下发任务</el-button>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item>
<el-button type="warning" round @click="callEmptyVehicles(taskInRequestEntity)">请求空箱</el-button>
</el-form-item>
</el-col>
</el-row>
<!-- ... 其他原有代码保持不变 ... -->
</el-form>
</fieldset>
<div ref="btnArea"></div>
@ -100,11 +33,13 @@
</template>
<script setup>
// API
import apiOrderOut from '@/api/order.out'
import { ElMessage, ElMessageBox } from 'element-plus'
import store from '@/store'
import { sendGoodsInTask, callEmptyVehicle } from '@/api/task'
import { queryPartInfoByPartNo } from '@/api/goods'
import { reactive, ref } from 'vue'
import { ElMessage } from 'element-plus'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import UploadExcelPart from '@/excel/UploadExcelPart.vue'
const taskInRequestRef = ref()
@ -142,6 +77,7 @@ export default {
},
data() {
return {
subCode: '', //
tempTasks: [],
tempVehicleNo: '',
disPlayDateFlag: false,
@ -165,6 +101,56 @@ export default {
this.$refs.vehicleNo.focus()
},
methods: {
//
handleSubCodeInput() {
if (!this.subCode) {
ElMessage({
message: '请输入子码',
type: 'error',
});
return;
}
if (this.subCode.length !== 22) {
ElMessage({
message: '子码长度不正确!',
type: 'error',
});
return;
}
ElMessageBox.confirm(`是否下发入库单?`, '提示')
.then(() => {
//
apiOrderOut.addOrderIn(this.subCode).then(res => {
const responseData = res.data;
if (responseData.code === 100) {
//
ElMessage({
message: '执行成功',
type: 'success',
});
//
this.subCode = '';
} else {
//
ElMessageBox.alert(`服务器返回失败:${responseData.message}`, '执行失败', {
type: 'warning',
confirmButtonText: '确定',
showClose: false
})
}
}).catch(err => {
//
ElMessageBox.alert(`请求服务器失败:${err}`, '任务添加失败', {
type: 'warning',
confirmButtonText: '确定'
})
})
})
.catch(() => {
})
},
//
queryAndAutoComplete(taskInRequestEntity) {
this.loading = true

View File

@ -22,16 +22,16 @@
<div> <!-- 表格-->
<el-row style="width: calc(100vw - 300px)">
<h5>出库单</h5>
<el-table :data="goodsOrderOutList" border stripe max-height="calc(100vh - 550px)">
<el-table-column fixed prop="rowId" label="行号" width="130px" align="center" show-overflow-tooltip/>
<el-table-column fixed prop="recordId" label="识别号" width="130px" align="center" show-overflow-tooltip/>
<el-table :data="goodsOrderOutList" border stripe max-height="calc(100vh - 450px)">
<!-- <el-table-column fixed prop="rowId" label="行号" width="130px" align="center" show-overflow-tooltip/>
<el-table-column fixed prop="recordId" label="识别号" width="130px" align="center" show-overflow-tooltip/> -->
<!-- <el-table-column fixed prop="orderId" label="订单号" width="200px" align="center" show-overflow-tooltip/> -->
<el-table-column prop="warehouseOrigin" label="源库别" width="100px" align="center" show-overflow-tooltip/>
<!-- <el-table-column prop="warehouseDestination" label="目的库别" width="120px" align="center" show-overflow-tooltip/> -->
<el-table-column prop="orderType" label="订单类型" width="100px" align="center" show-overflow-tooltip/>
<el-table-column prop="goodsId" label="物料号" width="120px" align="center" show-overflow-tooltip/>
<el-table-column prop="date" label="需求时间" width="120px" align="center" show-overflow-tooltip/>
<el-table-column prop="rowNo" label="行号" width="100px" align="center" show-overflow-tooltip/>
<el-table-column prop="date" label="需求时间" width="200px" align="center" show-overflow-tooltip :formatter="formatDateToMinute"/>
<!-- <el-table-column prop="rowNo" label="行号" width="100px" align="center" show-overflow-tooltip/> -->
<el-table-column prop="goodsId" label="物料编号" width="100px" align="center" show-overflow-tooltip/>
<el-table-column prop="goodsNum" label="物料数量" width="100px" align="center" show-overflow-tooltip/>
<el-table-column prop="unit" label="单位" width="100px" align="center" show-overflow-tooltip/>
@ -41,19 +41,19 @@
{{formatterOrderOutEnum(scope.row.status).label }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" :formatter="formatCellValueTime" width="130px"
<el-table-column prop="createTime" label="创建时间" :formatter="formatCellValueTime" width="200px"
align="center" show-overflow-tooltip/>
<el-table-column prop="remark" label="备注" show-overflow-tooltip min-width="120px" />
<el-table-column prop="remark" label="备注" align="center" show-overflow-tooltip min-width="120px" />
<el-table-column fixed="right" label="操作" align="center" width="140">
<template #default="scope">
<el-button-group class="ml-4">
<el-tooltip content="执行出库" placement="top" effect="light">
<el-button type="success" size="small" @click="executeOut(scope.row)">
<el-button type="success" size="normal" @click="executeOut(scope.row)">
<el-icon><Check /></el-icon>
</el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top" effect="light">
<el-button type="danger" size="small" @click="deleteOrder(scope.row)">
<el-button type="danger" size="normal" @click="deleteOrder(scope.row)">
<el-icon><Delete/></el-icon>
</el-button>
</el-tooltip>
@ -65,8 +65,7 @@
</div>
</div>
<HandOut v-model="showhandOut"/>
</el-config-provider>
<HandOut v-model="showhandOut" @refresh="queryGoodsOrderOut"/> </el-config-provider>
</template>
<script>
@ -98,10 +97,23 @@ export default {
}
},
mounted() {
//
this.queryGoodsOrderOut();
},
beforeUnmount() {
},
methods: {
// YYYY-MM-DD HH:mm
formatDateToMinute(row, column, cellValue) {
if (!cellValue) return '';
const date = new Date(cellValue);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}`;
},
formatCellValueTime,
formatterOrderOutEnum,
//

View File

@ -12,13 +12,13 @@
<el-row style="width: calc(100vw - 300px)">
<h5>盘点单</h5>
<el-table :data="goodsInventoryList" border stripe max-height="calc(100vh - 550px)">
<el-table-column fixed prop="recordId" label="记录号" width="210px" align="center" show-overflow-tooltip/>
<!-- <el-table-column fixed prop="recordId" label="记录号" width="210px" align="center" show-overflow-tooltip/> -->
<el-table-column fixed prop="checkId" label="盘点单号" width="210px" align="center" show-overflow-tooltip/>
<el-table-column fixed prop="warehouse" label="盘点库别" width="210px" align="center" show-overflow-tooltip/>
<el-table-column fixed prop="warehouse" label="盘点库别" width="130px" align="center" show-overflow-tooltip/>
<el-table-column prop="status" label="盘点单状态" width="210px" align="center" show-overflow-tooltip/>
<el-table-column prop="createTime" label="创建时间" width="210px" align="center" show-overflow-tooltip/>
<el-table-column prop="createTime" label="创建时间" width="210px" align="center" show-overflow-tooltip :formatter="formatDateTime"/>
<el-table-column prop="completeTime" label="完成时间" width="210px" align="center" show-overflow-tooltip/>
<el-table-column prop="remark" label="备注" show-overflow-tooltip min-width="120px" fixed="right"/>
<el-table-column prop="remark" label="信息" align="center" show-overflow-tooltip min-width="120px" fixed="right"/>
<el-table-column fixed="right" label="操作" align="center" width="180">
<template #default="scope">
<el-button-group class="ml-4">
@ -39,7 +39,7 @@
</el-row>
</div>
</div>
<addCheckOrder v-model="addCheckTaskForSimple"></addCheckOrder>
<addCheckOrder v-model="addCheckTaskForSimple" @refresh="queryGoodsOrderCheck"/>
</el-config-provider>
</template>
@ -73,7 +73,23 @@ export default {
goodsInventoryList: []
}
},
mounted() {
//
this.queryGoodsOrderCheck();
},
methods: {
//
formatDateTime(row, column, cellValue) {
if (!cellValue) return '';
const date = new Date(cellValue);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
queryGoodsOrderCheck(){
OrderCheck.getOrderCheckList(this.searchParams).then(res => {
const responseData = res.data;

View File

@ -22,16 +22,16 @@
<el-radio :label="scope.row.stockId" v-model="stockId">&nbsp;</el-radio>
</template>
</el-table-column>
<el-table-column prop="stockId" label="库存ID" min-width="120px" show-overflow-tooltip />
<!-- <el-table-column prop="stockId" label="库存ID" min-width="120px" show-overflow-tooltip /> -->
<el-table-column prop="goodsId" label="物料号" min-width="120px" />
<el-table-column prop="batchNo" v-if="dataType == 1" label="批次号" min-width="120px" />
<el-table-column prop="availableNum" v-if="dataType == 1" label="可用数量" min-width="120px" />
<el-table-column prop="realNum" label="实际数量" min-width="120px" />
<el-table-column prop="availableNum" v-if="dataType == 1" label="可用数量" min-width="100px" />
<el-table-column prop="realNum" label="实际数量" min-width="100px" />
<el-table-column prop="vehicleId" v-if="dataType == 1" label="料箱号" fixed="left" min-width="120px" />
<el-table-column prop="productionDate" v-if="dataType == 1" label="生产日期" :formatter="dateFormat" min-width="140px" />
<el-table-column prop="locationId" v-if="dataType == 1" label="库位" :formatter="locationFormat" min-width="160px" />
<el-table-column prop="createTime" v-if="dataType == 1" label="上架时间" :formatter="timeFormat" min-width="140px" />
<el-table-column prop="goodsStatus" v-if="dataType == 1" label="物料状态" :formatter="goodsStatusFormat" min-width="120px" />
<!-- <el-table-column prop="goodsStatus" v-if="dataType == 1" label="物料状态" :formatter="goodsStatusFormat" min-width="120px" /> -->
<el-table-column prop="stockStatus" v-if="dataType == 1" label="库存状态" :formatter="stockStatusFormat" fixed="right"
min-width="120px" />
<el-table-column fixed="right" label="操作" width="135px" v-if="selStock == null">
@ -55,8 +55,8 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="零件描述" prop="goodsName">
<el-input v-model="stockFormEntity.goodsName" readonly />
<el-form-item label="货箱号" prop="vehicleId">
<el-input v-model="stockFormEntity.vehicleId" clearable readonly />
</el-form-item>
</el-col>
</el-row>
@ -67,25 +67,16 @@
controls-position="right" :min="0" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="剩余数量" prop="remainNum">
<el-input-number v-model.number="stockFormEntity.remainNum" clearable
controls-position="right" :min="0" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="12" :offset="0">
<el-form-item label="实际数量为0时删除库存" prop="realNum">
<el-input-number v-model.number="stockFormEntity.realNum" controls-position="right"
:min="0" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="货箱号" prop="vehicleId">
<el-input v-model="stockFormEntity.vehicleId" clearable readonly />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
</el-row>
<el-row :gutter="16">
<el-col :span="12" :offset="0">
@ -108,6 +99,9 @@
<el-button type="primary" @click="submitStockInfo(stockFormEntity)">
确定
</el-button>
<el-button type="success" @click="submitStockInfo(stockFormEntity)">
确定
</el-button>
</span>
</template>
</el-dialog>

View File

@ -13,29 +13,29 @@
<el-table :data="tasks" stripe border v-loading="loading" style="width: 100%" max-height="684px"
class="table-class" :header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }"
@row-click="getCurrentRow">
<el-table-column width="65px" fixed="left">
<el-table-column width="45px" fixed="left">
<template v-slot="scope">
<el-radio :label="scope.row.taskId" v-model="taskId">&nbsp;</el-radio>
</template>
</el-table-column>
<el-table-column prop="goodsId" label="零件号" fixed="left" min-width="120px" />
<el-table-column prop="vehicleNo" label="箱号" fixed="left" min-width="120px" />
<el-table-column prop="goodsName" label="零件名称" min-width="120px" />
<!-- <el-table-column prop="goodsName" label="零件名称" min-width="120px" /> -->
<el-table-column prop="taskType" label="任务类型" :formatter="taskTypeFormat" min-width="120px" />
<el-table-column prop="taskGroup" label="任务组" min-width="120px" />
<!-- <el-table-column prop="taskGroup" label="任务组" min-width="120px" /> -->
<el-table-column prop="origin" label="起点" min-width="120px" />
<el-table-column prop="destination" label="终点" min-width="120px" />
<el-table-column prop="pickStand" label="拣选站台" min-width="120px" />
<el-table-column prop="weight" label="重量" min-width="120px" />
<el-table-column prop="productionDate" label="生产日期" :formatter="dateFormat" min-width="120px" />
<el-table-column prop="expirationDate" label="有效日期" :formatter="dateFormat" min-width="120px" />
<!-- <el-table-column prop="pickStand" label="拣选站台" min-width="120px" /> -->
<!-- <el-table-column prop="weight" label="重量" min-width="120px" /> -->
<!-- <el-table-column prop="productionDate" label="生产日期" :formatter="dateFormat" min-width="120px" />
<el-table-column prop="expirationDate" label="有效日期" :formatter="dateFormat" min-width="120px" /> -->
<el-table-column prop="operateNum" label="操作数量" min-width="120px" />
<el-table-column prop="totalNum" label="库存数量" min-width="120px" />
<el-table-column prop="taskPriority" label="任务优先级" min-width="120px" />
<el-table-column prop="kateTaskId" label="配件任务号" min-width="140px" />
<!-- <el-table-column prop="kateTaskId" label="配件任务号" min-width="140px" /> -->
<el-table-column prop="createTime" label="创建时间" :formatter="timeFormat" min-width="120px" />
<el-table-column prop="createTime" label="运行时长" :formatter="dueFormat" min-width="120px" />
<el-table-column prop="userName" label="操作人员姓名" min-width="120px" />
<!-- <el-table-column prop="userName" label="操作人员姓名" min-width="120px" /> -->
<el-table-column prop="taskStatus" label="任务状态" fixed="right" :formatter="taskStatusFormat"
min-width="120px" />
<el-table-column fixed="right" label="操作" width="120px">
@ -70,7 +70,12 @@
<el-input v-model="taskFormEntity.origin" disabled />
</el-form-item>
</el-col>
<el-col :span="12" v-if="taskFormEntity.taskType == 1">
<el-col :span="12" :offset="0">
<el-form-item label="仓库" prop="pickStand">
<el-input v-model="taskFormEntity.pickStand" disabled />
</el-form-item>
</el-col>
<!-- <el-col :span="12" v-if="taskFormEntity.taskType == 1">
<el-form-item label="终点" prop="destination">
<el-select-v2 v-model="taskFormEntity.destination"
:options="availableLocationOptions"></el-select-v2>
@ -80,7 +85,7 @@
<el-form-item label="终点" prop="destination">
<el-input v-model="taskFormEntity.destination" disabled />
</el-form-item>
</el-col>
</el-col> -->
</el-row>
<el-row :gutter="16">
<el-col :span="12" :offset="0">
@ -192,6 +197,7 @@ export default {
}
case 2: return '出库'
case 3: return '盘点'
case 9: return '移库'
default: return '未知'
}
},
@ -259,6 +265,7 @@ export default {
this.taskFormEntity.origin = row.origin
this.taskFormEntity.destination = row.destination
this.taskFormEntity.taskType = row.taskType
this.taskFormEntity.pickStand = row.pickStand
this.taskFormEntity.taskStatus = null
this.dialogVisible = true
},

View File

@ -3,7 +3,7 @@ import HomeView from '@/views/HomeView.vue'
import stock from '@/layout/stock.vue'
import login from '@/views/login.vue'
import systemCenter from'@/views/SystemCenter.vue'
import goodsInPda from '@/layout/goodsInForPDA.vue'
import pdaIn from '@/layout/pdaIn.vue'
const routes = [
{
@ -38,9 +38,9 @@ const routes = [
component: systemCenter
},
{
path: '/goodsInPda',
name: 'goodsInPda',
component: goodsInPda
path: '/pdaIn',
name: 'pdaIn',
component: pdaIn
},
]

View File

@ -5,10 +5,10 @@
<el-form-item style="width: 100%">
<el-button color="#87CEFA" style="width: 100%; border: none" @click="loginToWms">WMS系统</el-button>
</el-form-item>
<!-- <el-form-item style="width: 100%">
<el-button color="#87CEEB" style="width: 100%; border: none" @click="loginToPda">手持入库系统</el-button>
</el-form-item>
<el-form-item style="width: 100%">
<el-button color="#87CEEB" style="width: 100%; border: none" @click="pdaIn">手持入库系统</el-button>
</el-form-item>
<!-- <el-form-item style="width: 100%">
<el-button color="#AFEEEE" style="width: 100%; border: none" @click="loginToSideScan">线边扫码系统</el-button>
</el-form-item>
<el-form-item style="width: 100%">
@ -33,8 +33,8 @@ const token = store.getters.getToken// 密码
const loginToWms = () => {
router.replace({ path: '/home' })
}
const loginToPda = () => {
router.replace({ path: '/goodsInPda' })
const pdaIn = () => {
router.replace({ path: '/pdaIn' })
}
const loginToSideScan = () => {
router.replace({ path: '/sideScan' })

View File

@ -204,6 +204,14 @@ public class JobComponent extends BaseController {
taskService.executeTask(taskForUpdate);
return;
}
if(Objects.equals(task.getDestination(), "211")){
Task serviceTask = new Task();
serviceTask.setTaskType(1);
serviceTask.setOrigin(task.getDestination());
if(!taskMapper.selTasks(serviceTask).isEmpty()){
return;
}
}
Location thisLocation = thisLocations.get(0); // 找出当前库位详细信息
int depth = thisLocation.getDepth();
while (depth > 1) {
@ -229,6 +237,12 @@ public class JobComponent extends BaseController {
return;
}
if(!notCompleteTasks.isEmpty()) {
logger.info("此库位前面一深度有任务");
//将任务优先级更新为2
Task taskForUpdate = new Task();
taskForUpdate.setOrigin(beforLocation.getLocationId());
taskForUpdate.setTaskPriority(task.getTaskPriority() + 1);
taskMapper.updateTaskPriorityByVehicleNo(taskForUpdate);
return; // 存在未完成的任务退出函数
}
// 检查是否有库存
@ -273,7 +287,10 @@ public class JobComponent extends BaseController {
moveTask.setTaskGroup(task.getTaskGroup());
moveTask.setTaskType(TaskType.MOVE.getCode());
moveTask.setOrigin(beforLocation.getLocationId());
moveTask.setGoodsId(stocks.get(0).getGoodsId());
moveTask.setGoodsName(stocks.get(0).getBatchNo());
moveTask.setDestination(emptyLocationItem.getLocationId());
moveTask.setCreateTime(new java.util.Date());
moveTask.setVehicleNo(stocks.get(0).getVehicleId());
moveTask.setVehicleSize(0);
moveTask.setWeight(0.0);

View File

@ -870,11 +870,13 @@ public class TaskOperation {
//将入库单的状态恢复
AppOrderIn appOrderIn = new AppOrderIn();
appOrderIn.setRowId(task.getKateTaskId());
if (task.getVehicleNo() == null){
if (task.getVehicleNo().length() == 19){
//说明为整箱
appOrderIn.setOrderStatus(OrderInStatusEnum.BINDING.getCode());
}else if(task.getVehicleNo().length() == 22){
appOrderIn.setOrderStatus(OrderInStatusEnum.CREATE.getCode());
}else{
appOrderIn.setOrderStatus(OrderInStatusEnum.BINDING.getCode());
log.info("入库取消更新任务状态失败");
}
if(appOrderInMapper.update(appOrderIn) > 0){
log.info("入库单状态恢复成功");

View File

@ -89,6 +89,11 @@ public class WcsController {
private final com.wms.mapper.AppOrderInMapper appOrderInMapper;
/**
* 立库申请入库
* @param request 请求信息
* @return 返回信息
*/
/**
* 立库申请入库
* @param request 请求信息
@ -98,89 +103,281 @@ public class WcsController {
public ResponseEntity requestIn(@RequestBody @Validated RequireInRequest request) {
try {
log.info(String.format("%s 点位请求入库:%s", request.getPoint(), request.getVehicleNo()));
/* 校验库存是否存在对应箱号的入库单 */
AppOrderIn queryVehicleNoOrder = new AppOrderIn();
queryVehicleNoOrder.setVehicleNo(request.getVehicleNo());
queryVehicleNoOrder.setOrderStatus(OrderInStatusEnum.BINDING.getCode());
List<AppOrderIn> queryVehicleNoOrderListResult = appOrderInMapper.select(queryVehicleNoOrder);
if(queryVehicleNoOrderListResult == null) {
return new ResponseEntity(-1, String.format("该条码数据异常,请重试,条码号:%s", request.getVehicleNo()));
}
String code = request.getVehicleNo();
if(code.length() == 22) { // 没有绑定的载具查找直接单包的数据
//String code = request.getVehicleNo();
// if(code.length() != 22) {
// return new ResponseEntity(999, "条码长度错误" + code.length(), null);
// }
// 前八位是零件号后面六位是批次后面一位是班次最后五位是数量
String goodsId = code.substring(0, 10); // 物料编码
String batchNo = code.substring(0, 16); // 批次 ---- 这个批次应该是料号加中间六位
//String shift = code.substring(16, 17); // 班次
String productionDate = code.substring(10, 16); //生产日期
SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMdd");
Date date;
try {
// 将字符串解析成Date对象
date = dateFormat.parse(productionDate);
} catch (ParseException e) {
throw new RuntimeException(e);
if (code.length() == 22) {
return handleUnboundVehicle(request, code);
} else if (code.length() == 19) {
return handleBoundVehicle(request, code);
}
return new ResponseEntity(999, "条码长度错误" + code.length(), null);
} catch (Exception e) {
log.error("入库申请失败,出现异常,请稍后再试", e);
return new ResponseEntity(-1, "入库申请失败,网络连接异常,请稍后再试");
}
}
/**
* 处理未绑定载具的数据入库
* @param request 请求信息
* @param code 条码
* @return 响应结果
*/
private ResponseEntity handleUnboundVehicle(RequireInRequest request, String code) {
try {
// 解析条码信息
String goodsId = code.substring(0, 10); // 物料编码
String batchNo = code.substring(0, 16); // 批次
String productionDateStr = code.substring(10, 16); // 生产日期
String goodsNumStr = code.substring(17, 22); // 数量字符串
// 校验数量格式
if (!goodsNumStr.matches("[0-9]+")) {
return new ResponseEntity(999, "数量格式错误", null);
}
BigDecimal goodsNum = new BigDecimal(goodsNumStr); // 数量
// 解析生产日期
Date productionDate = parseProductionDate(productionDateStr);
if (productionDate == null) {
return new ResponseEntity(999, "生产日期格式错误", null);
}
BigDecimal goodsNum = new BigDecimal(goodsNumStr);
// 查找入库单
AppOrderIn appOrderIn = findOrderInByBatch(batchNo, goodsNum);
if (appOrderIn == null) {
return new ResponseEntity(999, String.format("条码找不到入库单,无法绑定,条码:%s, 批次: %s, 数量: %s",
code, batchNo, goodsNum), null);
}
// 查找可用库位
Location emptyLocation = findAvailableLocation();
if (emptyLocation == null) {
return new ResponseEntity(-1, "没有可用库位或者库位存在干涉,请稍后再试");
}
// 执行入库操作
return executeInboundTask(request, appOrderIn, emptyLocation, goodsId, productionDate);
} catch (Exception e) {
log.error("处理未绑定载具数据入库异常", e);
return new ResponseEntity(-1, "处理未绑定载具数据入库失败,请稍后再试");
}
}
/**
* 处理已绑定载具的数据入库
* @param request 请求信息
* @param code 条码
* @return 响应结果
*/
private ResponseEntity handleBoundVehicle(RequireInRequest request, String code) {
try {
// 根据母码查找入库单
AppOrderIn appOrderIn = findOrderInByVehicleNo(request.getVehicleNo());
if (appOrderIn == null) {
return new ResponseEntity(999, String.format("条码找不到入库单,无法绑定,条码:%s", code), null);
}
// 查找可用库位
Location emptyLocation = findAvailableLocation();
if (emptyLocation == null) {
return new ResponseEntity(-1, "没有可用库位或者库位存在干涉,请稍后再试");
}
// 执行入库操作
return executeBoundInboundTask(request, appOrderIn, emptyLocation);
} catch (Exception e) {
log.error("处理已绑定载具数据入库异常", e);
return new ResponseEntity(-1, "处理已绑定载具数据入库失败,请稍后再试");
}
}
/**
* 解析生产日期
* @param productionDateStr 生产日期字符串
* @return Date对象
*/
private Date parseProductionDate(String productionDateStr) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMdd");
try {
return dateFormat.parse(productionDateStr);
} catch (ParseException e) {
log.error("生产日期解析失败: " + productionDateStr, e);
return null;
}
}
/**
* 根据批次号和数量查找入库单
* @param batchNo 批次号
* @param goodsNum 数量
* @return 入库单
*/
private AppOrderIn findOrderInByBatch(String batchNo, BigDecimal goodsNum) {
AppOrderIn appOrderIn = new AppOrderIn();
appOrderIn.setBatchNo(batchNo);
appOrderIn.setGoodsNum(goodsNum);
appOrderIn.setOrderStatus(OrderInStatusEnum.CREATE.getCode());
List<AppOrderIn> selectRows = appOrderInMapper.select(appOrderIn);
if(selectRows == null || selectRows.isEmpty()) {
return new ResponseEntity(999, String.format("条码找不到入库单,无法绑定,条码:%s, 批次: %s, 数量: %s", code, batchNo, goodsNum), null);
return (selectRows != null && !selectRows.isEmpty()) ? selectRows.get(0) : null;
}
AppOrderIn orderIn = selectRows.get(0); // 这条数据
/* 查找一个空库位 */
/**
* 根据载具号查找入库单
* @param vehicleNo 载具号
* @return 入库单
*/
private AppOrderIn findOrderInByVehicleNo(String vehicleNo) {
AppOrderIn appOrderIn = new AppOrderIn();
appOrderIn.setVehicleNo(vehicleNo);
appOrderIn.setOrderStatus(OrderInStatusEnum.BINDING.getCode());
List<AppOrderIn> selectRows = appOrderInMapper.select(appOrderIn);
return (selectRows != null && !selectRows.isEmpty()) ? selectRows.get(0) : null;
}
/**
* 查找可用库位
* @return 可用库位
*/
private Location findAvailableLocation() {
Location emptyLocation = new Location();
emptyLocation.setLocationStatus(LocationStatus.EMPTY.getCode());
emptyLocation.setAreaId(1);
List<Location> emptyLocations = locationMapper.selLocations(emptyLocation);
if(emptyLocations == null) {
return new ResponseEntity(-1, "库位查找失败,网络连接异常,请稍后再试");
if (emptyLocations == null || emptyLocations.isEmpty()) {
return null;
}
if(emptyLocations.isEmpty()){
return new ResponseEntity(-1, "没有可用库位");
return locationUtils.checkCanUse(emptyLocations);
}
Location emptyLocationItem = locationUtils.checkCanUse(emptyLocations);
if(emptyLocationItem == null) {
return new ResponseEntity(-1, "没有可用库位或者库位存在干涉,请稍后再试");
/**
* 执行未绑定载具的入库任务
* @param request 请求信息
* @param orderIn 入库单
* @param location 库位
* @param goodsId 物料编码
* @param productionDate 生产日期
* @return 响应结果
*/
private ResponseEntity executeInboundTask(RequireInRequest request, AppOrderIn orderIn,
Location location, String goodsId, Date productionDate) {
try {
// 占用库位
if (!occupyLocation(location, request.getVehicleNo())) {
return new ResponseEntity(-1, "库位占用失败,请稍后再试");
}
// 该空库位可用生成一个入库任务并将库存表更新库位
// 更新库位表占掉库位
Location updateLocation = new Location();
updateLocation.setLocationId(emptyLocationItem.getLocationId());
updateLocation.setLocationStatus(LocationStatus.OCCUPY.getCode());
updateLocation.setVehicleId(request.getVehicleNo());
locationMapper.modifyLocation(updateLocation); // 占掉库位
// ---- 更新库存中库位
stockMapper.updateLocationIdWithBetchNo(request.getVehicleNo(), emptyLocationItem.getLocationId()); // 绑定载具和库位
// 更新库存中库位
int updateStockResult = stockMapper.updateLocationIdWithBetchNo(
request.getVehicleNo(), location.getLocationId());
if (updateStockResult <= 0) {
log.warn("更新库存库位信息失败,载具号: {}", request.getVehicleNo());
}
// 更新入库单
AppOrderIn orderInUpdate = new AppOrderIn();
orderInUpdate.setRowId(orderIn.getRowId());
orderInUpdate.setOrderStatus(OrderInStatusEnum.IN.getCode());
orderInUpdate.setUpdateTime(LocalDateTime.now());
orderInUpdate.setProductionDate(date);
appOrderInMapper.update(orderInUpdate); // 更新入库单为入库中
orderInUpdate.setProductionDate(productionDate);
appOrderInMapper.update(orderInUpdate);
// 添加入库任务
Task task = buildInboundTask(request, location, goodsId, orderIn, productionDate);
int addTask = taskMapper.addTask(task);
if (addTask > 0) {
return new ResponseEntity(0, "存在入库任务,申请成功");
}
return new ResponseEntity(-1, "添加入库任务失败,网络连接异常,请稍后再试");
} catch (Exception e) {
log.error("执行未绑定载具入库任务异常", e);
return new ResponseEntity(-1, "执行入库任务失败,请稍后再试");
}
}
/**
* 执行已绑定载具的入库任务
* @param request 请求信息
* @param orderIn 入库单
* @param location 库位
* @return 响应结果
*/
private ResponseEntity executeBoundInboundTask(RequireInRequest request,
AppOrderIn orderIn, Location location) {
try {
// 占用库位
if (!occupyLocation(location, request.getVehicleNo())) {
return new ResponseEntity(-1, "库位占用失败,请稍后再试");
}
// 更新库存中库位
int updateStockResult = stockMapper.updateLocationIdWithBetchNo(
request.getVehicleNo(), location.getLocationId());
if (updateStockResult <= 0) {
log.warn("更新库存库位信息失败,载具号: {}", request.getVehicleNo());
}
// 更新入库单状态
appOrderInMapper.updateStatusWithVehicleNo(
request.getVehicleNo(), OrderInStatusEnum.IN.getCode());
// 添加入库任务
Task task = buildBoundInboundTask(request, location, orderIn);
int addTask = taskMapper.addTask(task);
if (addTask > 0) {
return new ResponseEntity(0, "存在入库任务,申请成功");
}
return new ResponseEntity(-1, "添加入库任务失败,网络连接异常,请稍后再试");
} catch (Exception e) {
log.error("执行已绑定载具入库任务异常", e);
return new ResponseEntity(-1, "执行入库任务失败,请稍后再试");
}
}
/**
* 占用库位
* @param location 库位
* @param vehicleNo 载具号
* @return 是否成功
*/
private boolean occupyLocation(Location location, String vehicleNo) {
Location updateLocation = new Location();
updateLocation.setLocationId(location.getLocationId());
updateLocation.setLocationStatus(LocationStatus.OCCUPY.getCode());
updateLocation.setVehicleId(vehicleNo);
int result = locationMapper.modifyLocation(updateLocation);
return result > 0;
}
/**
* 构建未绑定载具的入库任务
* @param request 请求信息
* @param location 目标库位
* @param goodsId 物料编码
* @param orderIn 入库单
* @param productionDate 生产日期
* @return 入库任务
*/
private Task buildInboundTask(RequireInRequest request, Location location,
String goodsId, AppOrderIn orderIn, Date productionDate) {
Task task = new Task();
task.setTaskId(UUID.randomUUID().toString());
task.setTaskType(TaskType.IN.getCode());
task.setTaskStatus(WmsTaskStatus.NEW.getCode());
task.setTaskGroup(UUID.randomUUID().toString());
task.setOrigin(request.getPoint());
task.setDestination(emptyLocationItem.getLocationId());
task.setDestination(location.getLocationId());
task.setPickStand("立库");
task.setWeight(0.0);
task.setKateTaskId(orderIn.getRowId());//标记入库单的rowid
task.setKateTaskId(orderIn.getRowId());
task.setVehicleNo(request.getVehicleNo());
task.setCreateTime(new Date());
task.setUserName("wcs");
@ -189,88 +386,218 @@ public class WcsController {
task.setOperateNum(0);
task.setTotalNum(0);
task.setTaskPriority(1);
task.setProductionDate(date);
task.setRemark1(appOrderIn.getRemark());
//appOrderInMapper.insert(orderIn);
int addTask = taskMapper.addTask(task);
if(addTask > 0) {
//stockMapper.insert(task);
return new ResponseEntity(0, "存在入库任务,申请成功");
task.setProductionDate(productionDate);
task.setRemark1(orderIn.getRemark());
return task;
}
return new ResponseEntity(-1, "添加入库任务失败,网络连接异常,请稍后再试");
} else if (code.length() == 19) {
// 绑定完载具的数据入库
//根据母码去找入库单
AppOrderIn appOrderIn = new AppOrderIn();
appOrderIn.setVehicleNo(request.getVehicleNo());
appOrderIn.setOrderStatus(OrderInStatusEnum.BINDING.getCode());
List<AppOrderIn> selectRows = appOrderInMapper.select(appOrderIn);
if(selectRows == null || selectRows.isEmpty()) {
return new ResponseEntity(999, String.format("条码找不到入库单,无法绑定,条码:%s", code), null);
}
String vehicleNo = request.getVehicleNo(); // 载具号
/* 查找一个空库位 */
Location emptyLocation = new Location();
emptyLocation.setLocationStatus(LocationStatus.EMPTY.getCode());
emptyLocation.setAreaId(1);
List<Location> emptyLocations = locationMapper.selLocations(emptyLocation);
if(emptyLocations == null) {
return new ResponseEntity(-1, "库位查找失败,网络连接异常,请稍后再试");
}
if(emptyLocations.isEmpty()){
return new ResponseEntity(-1, "没有可用库位");
}
Location emptyLocationItem = locationUtils.checkCanUse(emptyLocations);
if(emptyLocationItem == null) {
return new ResponseEntity(-1, "没有可用库位或者库位存在干涉,请稍后再试");
}
// 该空库位可用生成一个入库任务并将库存表更新库位
// 更新库位表占掉库位
Location updateLocation = new Location();
updateLocation.setLocationId(emptyLocationItem.getLocationId());
updateLocation.setLocationStatus(LocationStatus.OCCUPY.getCode());
updateLocation.setVehicleId(request.getVehicleNo());
locationMapper.modifyLocation(updateLocation); // 占掉库位
// ---- 更新库存中库位
stockMapper.updateLocationIdWithBetchNo(request.getVehicleNo(), emptyLocationItem.getLocationId()); // 绑定载具和库位
// 更新入库单
appOrderInMapper.updateStatusWithVehicleNo(vehicleNo, OrderInStatusEnum.IN.getCode()); // 更新入库单为入库中
// List<AppOrderIn> selectRows = appOrderInMapper.selectWithVehicle(request.getVehicleNo());
// Date productionDate = new Date();
//添加入库任务
/**
* 构建已绑定载具的入库任务
* @param request 请求信息
* @param location 目标库位
* @param orderIn 入库单
* @return 入库任务
*/
private Task buildBoundInboundTask(RequireInRequest request, Location location,
AppOrderIn orderIn) {
Task task = new Task();
task.setTaskId(UUID.randomUUID().toString());
task.setTaskType(TaskType.IN.getCode());
task.setTaskStatus(WmsTaskStatus.NEW.getCode());
task.setTaskGroup(UUID.randomUUID().toString());
task.setOrigin(request.getPoint());
task.setDestination(emptyLocationItem.getLocationId());
task.setDestination(location.getLocationId());
task.setPickStand("立库");
task.setWeight(0.0);
task.setVehicleNo(request.getVehicleNo());
task.setCreateTime(new Date());
task.setUserName("wcs");
task.setGoodsId(vehicleNo);
task.setGoodsId(request.getVehicleNo());
task.setGoodsName("");
task.setOperateNum(0);
task.setTotalNum(0);
task.setKateTaskId(selectRows.get(0).getRowId());//标记入库单的rowid
task.setKateTaskId(orderIn.getRowId());
task.setTaskPriority(1);
//task.setProductionDate();
//appOrderInMapper.insertList(emptyLocations);
int addTask = taskMapper.addTask(task);
if(addTask > 0) {
return new ResponseEntity(0, "存在入库任务,申请成功");
}
return new ResponseEntity(-1, "添加入库任务失败,网络连接异常,请稍后再试");
}
return new ResponseEntity(999, "条码长度错误" + code.length(), null);
}catch (Exception e){
log.info("入库申请失败,出现异常,请稍后再试");
return new ResponseEntity(-1, "入库申请失败,网络连接异常,请稍后再试");
}
return task;
}
// @PostMapping("/requestIn")
// public ResponseEntity requestIn(@RequestBody @Validated RequireInRequest request) {
// try {
// log.info(String.format("%s 点位请求入库:%s",request.getPoint(), request.getVehicleNo()));
//// /* 校验库存是否存在对应箱号的入库单 */
//// AppOrderIn queryVehicleNoOrder = new AppOrderIn();
//// queryVehicleNoOrder.setVehicleNo(request.getVehicleNo());
//// queryVehicleNoOrder.setOrderStatus(OrderInStatusEnum.BINDING.getCode());
//// List<AppOrderIn> queryVehicleNoOrderListResult = appOrderInMapper.select(queryVehicleNoOrder);
//// if(queryVehicleNoOrderListResult == null) {
//// return new ResponseEntity(-1, String.format("该条码数据异常,请重试,条码号:%s", request.getVehicleNo()));
//// }
// String code = request.getVehicleNo();
// if(code.length() == 22) { // 没有绑定的载具查找直接单包的数据
// //String code = request.getVehicleNo();
//// if(code.length() != 22) {
//// return new ResponseEntity(999, "条码长度错误" + code.length(), null);
//// }
// // 前八位是零件号后面六位是批次后面一位是班次最后五位是数量
// String goodsId = code.substring(0, 10); // 物料编码
// String batchNo = code.substring(0, 16); // 批次 ---- 这个批次应该是料号加中间六位
// //String shift = code.substring(16, 17); // 班次
// String productionDate = code.substring(10, 16); //生产日期
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMdd");
// Date date;
// try {
// // 将字符串解析成Date对象
// date = dateFormat.parse(productionDate);
// } catch (ParseException e) {
// throw new RuntimeException(e);
// }
// String goodsNumStr = code.substring(17, 22); // 数量字符串
// if(!goodsNumStr.matches("[0-9]+")) {
// return new ResponseEntity(999, "数量格式错误", null);
// }
// BigDecimal goodsNum = new BigDecimal(goodsNumStr); // 数量
// AppOrderIn appOrderIn = new AppOrderIn();
// appOrderIn.setBatchNo(batchNo);
// appOrderIn.setGoodsNum(goodsNum);
// appOrderIn.setOrderStatus(OrderInStatusEnum.CREATE.getCode());
// List<AppOrderIn> selectRows = appOrderInMapper.select(appOrderIn);
// if(selectRows == null || selectRows.isEmpty()) {
// return new ResponseEntity(999, String.format("条码找不到入库单,无法绑定,条码:%s, 批次: %s, 数量: %s", code, batchNo, goodsNum), null);
// }
// AppOrderIn orderIn = selectRows.get(0); // 这条数据
// /* 查找一个空库位 */
// Location emptyLocation = new Location();
// emptyLocation.setLocationStatus(LocationStatus.EMPTY.getCode());
// emptyLocation.setAreaId(1);
// List<Location> emptyLocations = locationMapper.selLocations(emptyLocation);
// if(emptyLocations == null) {
// return new ResponseEntity(-1, "库位查找失败,网络连接异常,请稍后再试");
// }
// if(emptyLocations.isEmpty()){
// return new ResponseEntity(-1, "没有可用库位");
// }
// Location emptyLocationItem = locationUtils.checkCanUse(emptyLocations);
// if(emptyLocationItem == null) {
// return new ResponseEntity(-1, "没有可用库位或者库位存在干涉,请稍后再试");
// }
// // 该空库位可用生成一个入库任务并将库存表更新库位
// // 更新库位表占掉库位
// Location updateLocation = new Location();
// updateLocation.setLocationId(emptyLocationItem.getLocationId());
// updateLocation.setLocationStatus(LocationStatus.OCCUPY.getCode());
// updateLocation.setVehicleId(request.getVehicleNo());
// locationMapper.modifyLocation(updateLocation); // 占掉库位
// // ---- 更新库存中库位
// stockMapper.updateLocationIdWithBetchNo(request.getVehicleNo(), emptyLocationItem.getLocationId()); // 绑定载具和库位
// // 更新入库单
// AppOrderIn orderInUpdate = new AppOrderIn();
// orderInUpdate.setRowId(orderIn.getRowId());
// orderInUpdate.setOrderStatus(OrderInStatusEnum.IN.getCode());
// orderInUpdate.setUpdateTime(LocalDateTime.now());
// orderInUpdate.setProductionDate(date);
// appOrderInMapper.update(orderInUpdate); // 更新入库单为入库中
// // 添加入库任务
// Task task = new Task();
// task.setTaskId(UUID.randomUUID().toString());
// task.setTaskType(TaskType.IN.getCode());
// task.setTaskStatus(WmsTaskStatus.NEW.getCode());
// task.setTaskGroup(UUID.randomUUID().toString());
// task.setOrigin(request.getPoint());
// task.setDestination(emptyLocationItem.getLocationId());
// task.setPickStand("立库");
// task.setWeight(0.0);
// task.setKateTaskId(orderIn.getRowId());//标记入库单的rowid
// task.setVehicleNo(request.getVehicleNo());
// task.setCreateTime(new Date());
// task.setUserName("wcs");
// task.setGoodsId(goodsId);
// task.setGoodsName("");
// task.setOperateNum(0);
// task.setTotalNum(0);
// task.setTaskPriority(1);
// task.setProductionDate(date);
// task.setRemark1(appOrderIn.getRemark());
// //appOrderInMapper.insert(orderIn);
// int addTask = taskMapper.addTask(task);
// if(addTask > 0) {
// //stockMapper.insert(task);
// return new ResponseEntity(0, "存在入库任务,申请成功");
// }
// return new ResponseEntity(-1, "添加入库任务失败,网络连接异常,请稍后再试");
// } else if (code.length() == 19) {
// // 绑定完载具的数据入库
// //根据母码去找入库单
// AppOrderIn appOrderIn = new AppOrderIn();
// appOrderIn.setVehicleNo(request.getVehicleNo());
// appOrderIn.setOrderStatus(OrderInStatusEnum.BINDING.getCode());
// List<AppOrderIn> selectRows = appOrderInMapper.select(appOrderIn);
// if(selectRows == null || selectRows.isEmpty()) {
// return new ResponseEntity(999, String.format("条码找不到入库单,无法绑定,条码:%s", code), null);
// }
// String vehicleNo = request.getVehicleNo(); // 载具号
// /* 查找一个空库位 */
// Location emptyLocation = new Location();
// emptyLocation.setLocationStatus(LocationStatus.EMPTY.getCode());
// emptyLocation.setAreaId(1);
// List<Location> emptyLocations = locationMapper.selLocations(emptyLocation);
// if(emptyLocations == null) {
// return new ResponseEntity(-1, "库位查找失败,网络连接异常,请稍后再试");
// }
// if(emptyLocations.isEmpty()){
// return new ResponseEntity(-1, "没有可用库位");
// }
// Location emptyLocationItem = locationUtils.checkCanUse(emptyLocations);
// if(emptyLocationItem == null) {
// return new ResponseEntity(-1, "没有可用库位或者库位存在干涉,请稍后再试");
// }
// // 该空库位可用生成一个入库任务并将库存表更新库位
// // 更新库位表占掉库位
// Location updateLocation = new Location();
// updateLocation.setLocationId(emptyLocationItem.getLocationId());
// updateLocation.setLocationStatus(LocationStatus.OCCUPY.getCode());
// updateLocation.setVehicleId(request.getVehicleNo());
// locationMapper.modifyLocation(updateLocation); // 占掉库位
// // ---- 更新库存中库位
// stockMapper.updateLocationIdWithBetchNo(request.getVehicleNo(), emptyLocationItem.getLocationId()); // 绑定载具和库位
// // 更新入库单
// appOrderInMapper.updateStatusWithVehicleNo(vehicleNo, OrderInStatusEnum.IN.getCode()); // 更新入库单为入库中
//// List<AppOrderIn> selectRows = appOrderInMapper.selectWithVehicle(request.getVehicleNo());
//// Date productionDate = new Date();
// //添加入库任务
// Task task = new Task();
// task.setTaskId(UUID.randomUUID().toString());
// task.setTaskType(TaskType.IN.getCode());
// task.setTaskStatus(WmsTaskStatus.NEW.getCode());
// task.setTaskGroup(UUID.randomUUID().toString());
// task.setOrigin(request.getPoint());
// task.setDestination(emptyLocationItem.getLocationId());
// task.setPickStand("立库");
// task.setWeight(0.0);
// task.setVehicleNo(request.getVehicleNo());
// task.setCreateTime(new Date());
// task.setUserName("wcs");
// task.setGoodsId(vehicleNo);
// task.setGoodsName("");
// task.setOperateNum(0);
// task.setTotalNum(0);
// task.setKateTaskId(selectRows.get(0).getRowId());//标记入库单的rowid
// task.setTaskPriority(1);
// //task.setProductionDate();
// //appOrderInMapper.insertList(emptyLocations);
// int addTask = taskMapper.addTask(task);
// if(addTask > 0) {
// return new ResponseEntity(0, "存在入库任务,申请成功");
// }
// return new ResponseEntity(-1, "添加入库任务失败,网络连接异常,请稍后再试");
// }
// return new ResponseEntity(999, "条码长度错误" + code.length(), null);
// }catch (Exception e){
// log.info("入库申请失败,出现异常,请稍后再试");
// return new ResponseEntity(-1, "入库申请失败,网络连接异常,请稍后再试");
// }
// }
/**
* 收到 wcs 返回的任务状态
* @param wmsReceiveTaskResultEntity wcs请求值

View File

@ -48,6 +48,7 @@ public interface TaskMapper {
*/
int deleteTask(String taskId);
int updateTaskPriorityByVehicleNo(Task task);
List<Task> haveNotCompleteTask(String location);
}

View File

@ -2,6 +2,7 @@ package com.wms.service.serviceImplements;
import com.wms.constants.enums.OrderCheckStatusEnum;
import com.wms.constants.enums.OrderOutStatusEnum;
import com.wms.constants.enums.StockStatus;
import com.wms.constants.enums.TaskType;
import com.wms.entity.app.mes.MesApiLocalResponse;
import com.wms.entity.common.WmsApiResponse;
@ -14,6 +15,7 @@ import com.wms.mapper.OrderCheckMapper;
import com.wms.mapper.StockMapper;
import com.wms.service.IOrderCheckService;
import com.wms.utils.WmsUtils;
import io.micrometer.common.util.StringUtils;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -62,6 +64,10 @@ public class OrderCheckImplements implements IOrderCheckService {
// }
// }
//根据recordId去盘点单中找对应的盘点任务
// 校验recordId
if (StringUtils.isBlank(recordId)) {
return new WmsApiResponse<>(0, "记录ID不能为空", null);
}
List<OrderCheck> orderCheckTask = orderCheckMapper.queryByRecordId(recordId);
if(orderCheckTask == null || orderCheckTask.isEmpty()) {
return new WmsApiResponse<>(0, "该条记录不存在", null);
@ -128,6 +134,8 @@ public class OrderCheckImplements implements IOrderCheckService {
task.setRemark1("盘点出库");
checkTasks.add(task);
locationId = stock.getLocationId();
// 更新库存为出库中
stockMapper.updateStockStatusWithLocationId(stock.getLocationId(), StockStatus.OUT.getCode());
}
int addTasks = taskMapper.addTasks(checkTasks);
if(addTasks == checkTasks.size()) {

View File

@ -82,19 +82,19 @@ public class ContainerImplement implements ContainerService {
}
//先查找也没有出库终点为211的任务有的话不准211点位入库
//要求终点为211且有起点为211的任务
if(Objects.equals(request.getFromCellNo(), "211")){
//找出所有终点为211的task遍历的时候对状态进行判断如果是100直接跳过
Task task = new Task();
task.setDestination("211");
List<Task> tasks = taskMapper.selTasks(task);
for (Task task2 : tasks){
if (task2.getTaskStatus() == 100 || task2.getTaskStatus() == 998 || task2.getTaskStatus() == 999){
continue;
}else {
return new CreateInstoreTaskResponse("400", "存在目的地为211站台且未执行完成的任务暂时不允许入库");
}
}
}
// if(Objects.equals(request.getFromCellNo(), "211")){
// //找出所有终点为211的task遍历的时候对状态进行判断如果是100直接跳过
// Task task = new Task();
// task.setDestination("211");
// List<Task> tasks = taskMapper.selTasks(task);
// for (Task task2 : tasks){
// if (task2.getTaskStatus() == 100 || task2.getTaskStatus() == 998 || task2.getTaskStatus() == 999){
// continue;
// }else {
// return new CreateInstoreTaskResponse("400", "存在目的地为211站台且未执行完成的任务暂时不允许入库");
// }
// }
// }
if (request.getPalletNo().length() == 27){
String code = request.getPalletNo();
String productionDate = code.substring(15, 21); //生产日期

View File

@ -134,6 +134,7 @@ public class MesServiceImplement implements MesService {
orderOut.setUnit(row.getUnit());
orderOut.setStatus(OrderOutStatusEnum.CREATED.getCode());
orderOut.setCreateTime(new Timestamp(System.currentTimeMillis()));
orderOut.setRemark("MES出库");
if (request.getType() == 5){
// 假设 losnr 是一个字符串
String losnr = row.getLosnr();

View File

@ -8,6 +8,8 @@ import com.wms.mapper.LocationMapper;
import com.wms.mapper.StockMapper;
import com.wms.mapper.TaskMapper;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -20,6 +22,7 @@ import java.util.List;
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class LocationUtils {
private static final Logger log = LoggerFactory.getLogger(LocationUtils.class);
/**
* 库存 Mapper
*/
@ -57,8 +60,8 @@ public class LocationUtils {
return null;
}
for (Location location : canUseLocations) {
if(location.getDepth() == 1) {
return location; // 1 深度的不需要检验
if(location.getIsLock() == 1){
continue; // 该库位锁定跳过
}
/* 校验此位置是否有遮挡 */ /* 如果这位置有库存(可能出现记错导致有库存),或者这位置其他深度(不论深度大小)有任务则不采用此位置 */
/* 1 判断库存 */
@ -68,11 +71,41 @@ public class LocationUtils {
if(!checkResult.isEmpty()) {
continue; // 库存不为空跳过
}
// 判断低深度是否有库存
boolean lowDepthHasStock = false;
for (int i = 1; i < location.getDepth(); i++) {
Location queryLowDepthLocation = new Location();
queryLowDepthLocation.setLayer(location.getLayer());
queryLowDepthLocation.setQueue(location.getQueue());
queryLowDepthLocation.setLine(location.getLine());
queryLowDepthLocation.setDepth(i);
queryLowDepthLocation.setAreaId(location.getAreaId());
List<Location> locations = locationMapper.selLocations(queryLowDepthLocation);
if (!locations.isEmpty() && locations.get(0).getLocationStatus() == 1) {
log.info("入库时低深度库位{}存在占用", locations.get(0).getLocationId());
lowDepthHasStock = true;
break;
}
if (!locations.isEmpty()) {
// 查询是否有库存
Stock queryStock = new Stock();
queryStock.setLocationId(locations.get(0).getLocationId());
List<Stock> stockList = stockMapper.selStocks(queryStock);
if (!stockList.isEmpty()) {
log.info("入库时低深度库位{}存在库存", locations.get(0).getLocationId());
lowDepthHasStock = true;
break;
}
}
}
if(lowDepthHasStock){
continue;
}
/* 2 判断同位置不同深度是否有任务 */
// 找出此位置不同深度的库位
Location queryDifferentDepthLocation = new Location();
queryDifferentDepthLocation.setAreaId(location.getAreaId());
queryDifferentDepthLocation.setEquipmentId(location.getEquipmentId());
queryDifferentDepthLocation.setQueue(location.getQueue());
queryDifferentDepthLocation.setLine(location.getLine());
queryDifferentDepthLocation.setLayer(location.getLayer());
@ -122,6 +155,37 @@ public class LocationUtils {
if(!checkResult.isEmpty()) {
continue; // 库存不为空跳过
}
// 判断低深度是否有库存
boolean lowDepthHasStock = false;
for (int i = 1; i < location.getDepth(); i++) {
Location queryLowDepthLocation = new Location();
queryLowDepthLocation.setLayer(location.getLayer());
queryLowDepthLocation.setQueue(location.getQueue());
queryLowDepthLocation.setLine(location.getLine());
queryLowDepthLocation.setDepth(i);
queryLowDepthLocation.setAreaId(location.getAreaId());
List<Location> locations = locationMapper.selLocations(queryLowDepthLocation);
if (!locations.isEmpty() && locations.get(0).getLocationStatus() == 1) {
log.info("移库时低深度库位{}存在占用", locations.get(0).getLocationId());
lowDepthHasStock = true;
break;
}
if (!locations.isEmpty()) {
// 查询是否有库存
Stock queryStock = new Stock();
queryStock.setLocationId(locations.get(0).getLocationId());
List<Stock> stockList = stockMapper.selStocks(queryStock);
if (!stockList.isEmpty()) {
log.info("移库库时低深度库位{}存在库存", locations.get(0).getLocationId());
lowDepthHasStock = true;
break;
}
}
}
if(lowDepthHasStock){
continue;
}
/* 2 判断同位置不同深度是否有任务 */
// 找出此位置不同深度的库位
Location queryDifferentDepthLocation = new Location();
@ -145,6 +209,7 @@ public class LocationUtils {
continue; // 数据库查询失败
}
if(!locationTasks.isEmpty()) {
canUse = false;
break; // 有任务这个库位不行
}
canUse = true;

View File

@ -1,5 +1,5 @@
spring:
# # 本地测试环境
# 本地测试环境
# datasource:
# url: jdbc:mysql://localhost:3306/wms_yaxinke_yangzhou?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
# username: root

View File

@ -38,7 +38,7 @@
<if test="locationStatus != null"> and location_status = #{locationStatus}</if>
<if test="vehicleId != null and vehicleId != ''"> and vehicle_id = #{vehicleId}</if>
</where>
order by location_type asc , depth desc, line asc, layer asc
order by location_type asc , line asc, depth desc, layer asc
</select>
<select id="selLocationsByOled" parameterType="Location" resultMap="LocationMap">

View File

@ -39,6 +39,7 @@
<select id="queryAll" parameterType="orderCheck" resultMap="OrderCheckMap">
select record_id, check_id, warehouse, status, create_time, complete_time, remark
from tbl_app_order_check
order by create_time desc
</select>

View File

@ -231,6 +231,12 @@
</delete>
<update id="updateTaskPriorityByVehicleNo" parameterType="map">
update tbl_app_task
set task_priority = #{taskPriority}
where origin = #{origin}
</update>
<select id="haveNotCompleteTask" resultMap="TaskMap" parameterType="string">
select task_id, task_type, task_status, task_group, origin, destination, pick_stand, weight, vehicle_no, vehicle_size, create_time,
user_name, goods_id, goods_name, operate_num, total_num, etag_location, task_priority, production_date, expiration_date, kate_task_id, remark1