diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/api/api.js b/jeecg-boot-master/ant-design-vue-jeecg/src/api/api.js index 6a5894e..1f78402 100644 --- a/jeecg-boot-master/ant-design-vue-jeecg/src/api/api.js +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/api/api.js @@ -125,6 +125,8 @@ export const createReceiptTask = (params)=>postAction('/receipt/receiptContainer export const completeTaskByWMS = (params)=>postAction('/task/taskHeader/completeTaskByWMS', params); //下发任务给WCS export const execute = (params)=>postAction('/task/taskHeader/execute', params); +//取消任务 +export const cancelTask = (params)=>postAction('/task/taskHeader/cancelTask?1', params); //自动配盘 export const autoCombination = (params)=>postAction('/shipment/shipmentCombination/autoCombination', params); //创建出库任务 @@ -133,6 +135,26 @@ export const createShipmentTask = (params)=>postAction('/shipment/shipmentCombin export const selectSortingPort = (params)=>postAction('/shipment/shipmentCombination/selectSortingPort', params); //选择入库分拣口 export const selectSupplePort = (params)=>postAction('/receipt/receiptContainerHeader/selectSupplePort', params); +//创建空托盘入库任务 +export const createEmptyIn = (params)=>postAction('/task/taskHeader/createEmptyIn', params); +//创建空托盘出库任务 +export const createEmptyOut = (params)=>postAction('/task/taskHeader/createEmptyOut', params); +//选择出库整出口 +export const selectOutPort = (params)=>postAction('/task/taskHeader/selectOutPort', params); +//选择出库分拣口 +export const selectPickPort = (params)=>postAction('/task/taskHeader/selectPickPort', params); +//创建移库任务 +export const createTransferTask = (params)=>postAction('/task/taskHeader/createTransferTask', params); +//创建出库查看任务 +export const createCheckOutTask = (params)=>postAction('/task/taskHeader/createCheckOutTask', params); +//选择站台 +export const selectPort = (params)=>postAction('/task/taskHeader/selectPort', params); +//创建跨站任务 +export const createOverStationTask = (params)=>postAction('/task/taskHeader/createOverStationTask', params); +//创建空托盘组入库任务 +export const createManyEmptyIn = (params)=>postAction('/task/taskHeader/createManyEmptyIn', params); +//创建空托盘组出库任务 +export const createManyEmptyOut = (params)=>postAction('/task/taskHeader/createManyEmptyOut', params); // 中转HTTP请求 export const transitRESTful = { diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/LocationList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/LocationList.vue index b3fa140..47f38a7 100644 --- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/LocationList.vue +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/LocationList.vue @@ -37,7 +37,7 @@ <a-form-item label="库区编码"> <a-select show-search - placeholder="请输入库区编码" + placeholder="请选择库区编码" option-filter-prop="children" :filter-option="filterOption" v-model="queryParam.zoneCode" diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue index b5eda43..ceda37d 100644 --- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue @@ -41,6 +41,12 @@ :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" @change="handleTableChange"> + <span slot="companyCode" slot-scope="companyCode"> + <a-tag :key="companyCode" color=blue> + {{ solutionCompany(companyCode) }} + </a-tag> + </span> + <template slot="htmlSlot" slot-scope="text"> <div v-html="text"></div> </template> @@ -80,6 +86,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin' import InventoryDetailModal from './modules/InventoryDetailModal' + import {getCompanyList} from '@/api/api' export default { name: "InventoryDetailList", @@ -109,6 +116,7 @@ return { description: '库存表管理页面', disableMixinCreated:true, + companyList:[], // 表头 columns: [ { @@ -119,7 +127,9 @@ { title:'货主', align:"center", - dataIndex: 'companyCode' + dataIndex: 'companyCode', + key: 'companyCode', + scopedSlots: { customRender: 'companyCode' } }, { title:'库区', @@ -233,6 +243,7 @@ } }, created() { + this.loadFrom(); }, computed: { importExcelUrl(){ @@ -240,6 +251,23 @@ } }, methods: { + loadFrom() { + getCompanyList().then((res) => { + if (res.success) { + this.companyList = res.result + } + }); + }, + solutionCompany(value) { + var actions = [] + Object.keys(this.companyList).some((key) => { + if (this.companyList[key].code == ('' + value)) { + actions.push(this.companyList[key].name) + return true + } + }) + return actions.join('') + }, clearList(){ this.dataSource=[] this.selectedRowKeys=[] diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryTransactionList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryTransactionList.vue index ed2a8e7..801a4ef 100644 --- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryTransactionList.vue +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryTransactionList.vue @@ -6,7 +6,14 @@ <a-row :gutter="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-form-item label="货主"> - <a-input placeholder="请输入货主" v-model="queryParam.companyCode"></a-input> + <a-select + show-search + placeholder="请选择货主" + option-filter-prop="children" + :filter-option="filterOption" + v-model="queryParam.companyCode"> + <a-select-option v-for="item in companyList" :key="item.name" :value="item.code">{{ item.name }}</a-select-option> + </a-select> </a-form-item> </a-col> <a-col :xl="6" :lg="7" :md="8" :sm="24"> @@ -121,6 +128,12 @@ class="j-table-force-nowrap" @change="handleTableChange"> + <span slot="companyCode" slot-scope="companyCode"> + <a-tag :key="companyCode" color=blue> + {{ solutionCompany(companyCode) }} + </a-tag> + </span> + <template slot="htmlSlot" slot-scope="text"> <div v-html="text"></div> </template> @@ -174,6 +187,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin' import InventoryTransactionModal from './modules/InventoryTransactionModal' import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' + import {getCompanyList} from '@/api/api' export default { name: 'InventoryTransactionList', @@ -184,6 +198,7 @@ data () { return { description: '库存交易记录管理页面', + companyList:[], // 表头 columns: [ { @@ -194,7 +209,9 @@ { title:'货主', align:"center", - dataIndex: 'companyCode' + dataIndex: 'companyCode', + key: 'companyCode', + scopedSlots: { customRender: 'companyCode' } }, { title:'容器编码', @@ -202,9 +219,14 @@ dataIndex: 'containerCode' }, { - title:'库位编码', + title:'起始库位编码', + align:"center", + dataIndex: 'fromLocationCode' + }, + { + title:'目标库位编码', align:"center", - dataIndex: 'locationCode' + dataIndex: 'toLocationCode' }, { title:'交易类型', @@ -234,7 +256,7 @@ { title:'库存状态', align:"center", - dataIndex: 'inventoryStatus' + dataIndex: 'inventoryStatus_dictText' }, { title:'数量', @@ -288,7 +310,8 @@ } }, created() { - this.getSuperFieldList(); + this.getSuperFieldList(); + this.loadFrom(); }, computed: { importExcelUrl: function(){ @@ -298,6 +321,24 @@ methods: { initDictConfig(){ }, + loadFrom() { + console.log("loadFrom 11"); + getCompanyList().then((res) => { + if (res.success) { + this.companyList = res.result + } + }); + }, + solutionCompany(value) { + var actions = [] + Object.keys(this.companyList).some((key) => { + if (this.companyList[key].code == ('' + value)) { + actions.push(this.companyList[key].name) + return true + } + }) + return actions.join('') + }, getSuperFieldList(){ let fieldList=[]; fieldList.push({type:'string',value:'companyCode',text:'货主',dictCode:''}) diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue index 291aaf1..88be23c 100644 --- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue @@ -114,7 +114,8 @@ <span slot="action" slot-scope="text, record"> <a @click="handleEdit(record)">编辑</a> <a-divider type="vertical" /> - <a v-if="record.status == 0 && record.taskType == 200" @click="selectPort(record)">生成任务</a> + <a v-if="record.status == 0 && record.taskType == 200" @click="selectPort(record)" >生成任务</a> + <a v-else-if="record.status == 0" @click="createTask(record)">生成任务</a> <a-divider type="vertical" /> <a-dropdown> <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> @@ -290,10 +291,8 @@ }, createTask(record) { this.loading = true; - const that = this; this.model = Object.assign({}, record); - that.querySource.id = record.id; - createReceiptTask(that.querySource).then((res) => { + createReceiptTask(this.model).then((res) => { this.loading = false; if (res.success) { this.$message.success(res.message); diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptContainerSelectModal.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptContainerSelectModal.vue index 17bdfc3..5deceda 100644 --- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptContainerSelectModal.vue +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptContainerSelectModal.vue @@ -33,7 +33,7 @@ import { httpAction } from '@/api/manage' import { validateDuplicateValue } from '@/utils/util' - import {createShipmentTask} from '@/api/api' + import {createReceiptTask} from '@/api/api' import {selectSupplePort} from '@/api/api' export default { @@ -51,7 +51,7 @@ data () { return { title:"操作", - width:800, + width:500, visible: false, model:{ }, @@ -96,7 +96,7 @@ this.$refs.form.validate(valid => { if (valid) { that.confirmLoading = true; - createShipmentTask(this.model).then((res) => { + createReceiptTask(this.model).then((res) => { if(res.success){ that.$message.success(res.message); that.$emit('ok'); diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue index 2d30760..01bf2d7 100644 --- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue @@ -166,7 +166,8 @@ </template> <span slot="action" slot-scope="text, record"> - <a @click="autoShipmentCombine(record)">自动配盘</a> + <a-divider type="vertical" /> + <a v-if="record.lastStatus < 800" @click="autoShipmentCombine(record)">自动配盘</a> <a-divider type="vertical" /> <a @click="handleEdit(record)">编辑</a> diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/shipment/modules/ShipmentContainerSelectModal.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/shipment/modules/ShipmentContainerSelectModal.vue index a277fd6..5127cf8 100644 --- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/shipment/modules/ShipmentContainerSelectModal.vue +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/shipment/modules/ShipmentContainerSelectModal.vue @@ -51,7 +51,7 @@ data () { return { title:"操作", - width:800, + width:500, visible: false, model:{ }, diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/CircleTaskHeaderList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/CircleTaskHeaderList.vue new file mode 100644 index 0000000..adaf200 --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/CircleTaskHeaderList.vue @@ -0,0 +1,453 @@ +<template> + <a-card :bordered="false"> + <!-- 查询区域 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="任务类型"> + <j-dict-select-tag placeholder="请选择任务类型" v-model="queryParam.taskType" dictCode="task_type"/> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="容器号"> + <a-input placeholder="请输入容器号" v-model="queryParam.containerCode"></a-input> + </a-form-item> + </a-col> + <template v-if="toggleSearchStatus"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="库区"> + <a-select + show-search + placeholder="请选择库区" + option-filter-prop="children" + :filter-option="filterOption" + v-model="queryParam.zoneCode" + style="width: 200px"> + <a-select-option v-for="item in zoneList" :key="item.name" :value="item.code">{{ item.name }}</a-select-option> + </a-select> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="起始库位"> + <a-input placeholder="请输入起始库位" v-model="queryParam.fromLocationCode"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="目标库位"> + <a-input placeholder="请输入目标库位" v-model="queryParam.toLocationCode"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="是否空出"> + <j-dict-select-tag placeholder="请选择是否空出" v-model="queryParam.isEmptyOut" dictCode="is_or_not"/> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="起始出入口"> + <a-input placeholder="请输入起始出入口" v-model="queryParam.fromPortCode"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="目标出入口"> + <a-input placeholder="请输入目标出入口" v-model="queryParam.toPortCode"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="任务状态"> + <j-dict-select-tag placeholder="请选择任务状态" v-model="queryParam.status" dictCode="task_header_status"/> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="是否重入"> + <j-dict-select-tag placeholder="请选择是否重入" v-model="queryParam.isDoubleIn" dictCode="is_or_not"/> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="重入库位号"> + <a-input placeholder="请输入重入库位号" v-model="queryParam.originLocationCode"></a-input> + </a-form-item> + </a-col> + <a-col :xl="10" :lg="11" :md="12" :sm="24"> + <a-form-item label="创建日期"> + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.createTime_begin"></j-date> + <span class="query-group-split-cust"></span> + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.createTime_end"></j-date> + </a-form-item> + </a-col> + </template> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> + <a-button type="primary" @click="searchQuery" icon="search">查询</a-button> + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> + <a @click="handleToggleSearch" style="margin-left: 8px"> + {{ toggleSearchStatus ? '收起' : '展开' }} + <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> + </a> + </span> + </a-col> + </a-row> + </a-form> + </div> + <!-- 查询区域-END --> + + <!-- 操作按钮区域 --> + <div class="table-operator"> + <a-button @click="createCheckOut()" type="primary">出库查看</a-button> +<!-- <a-button type="primary" icon="download" @click="handleExportXls('任务表')">导出</a-button>--> +<!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">--> +<!-- <a-button type="primary" icon="import">导入</a-button>--> +<!-- </a-upload>--> +<!-- <!– 高级查询区域 –>--> +<!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>--> + </div> + + <!-- table区域-begin --> + <div> + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 + <a style="margin-left: 24px" @click="onClearSelected">清空</a> + </div> + + <a-table + ref="table" + size="middle" + bordered + rowKey="id" + class="j-table-force-nowrap" + :scroll="{x:true}" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}" + :customRow="clickThenSelect" + @change="handleTableChange"> + + <span slot="zoneCode" slot-scope="zoneCode"> + <a-tag :key="zoneCode" color=blue> + {{ solutionZoneCode(zoneCode) }} + </a-tag> + </span> + + <template slot="htmlSlot" slot-scope="text"> + <div v-html="text"></div> + </template> + <template slot="imgSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> + <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> + </template> + <template slot="fileSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> + <a-button + v-else + :ghost="true" + type="primary" + icon="download" + size="small" + @click="downloadFile(text)"> + 下载 + </a-button> + </template> + + <span slot="action" slot-scope="text, record"> + <a v-if="record.status == 1" @click="executeTask(record)">执行</a> + <a-divider type="vertical" /> + <a v-if="record.status < 100" @click="completeTask(record)">完成</a> + <a-divider type="vertical" /> + <a-dropdown> + <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> + <a-menu slot="overlay"> + <a-menu-item> + <a @click="handleEdit(record)">编辑</a> + </a-menu-item> + <a-menu-item> + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> + <a>删除</a> + </a-popconfirm> + </a-menu-item> + </a-menu> + </a-dropdown> + </span> + + </a-table> + </div> + + <a-tabs defaultActiveKey="1"> + <a-tab-pane tab="任务详情" key="1" > + <TaskDetailList :mainId="selectedMainId" /> + </a-tab-pane> + </a-tabs> + + <taskHeader-modal ref="modalForm" @ok="modalFormOk"></taskHeader-modal> + <check-out-task-modal ref="checkOutModal" @ok="modalFormOk"></check-out-task-modal> + </a-card> +</template> + +<script> + + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import TaskHeaderModal from './modules/TaskHeaderModal' + import { getAction } from '@/api/manage' + import TaskDetailList from './TaskDetailList' + import {initDictOptions,filterMultiDictText} from '@/components/dict/JDictSelectUtil' + import '@/assets/less/TableExpand.less' + import {completeTaskByWMS} from '@/api/api' + import {execute} from '@/api/api' + import {getZoneList} from '@/api/api' + import EmptyInTaskModal from './modules/EmptyInTaskModal' + import CheckOutTaskModal from "./modules/CheckOutTaskModal"; + + export default { + name: "TaskHeaderList", + mixins:[JeecgListMixin], + components: { + CheckOutTaskModal, + EmptyInTaskModal, + TaskDetailList, + TaskHeaderModal + }, + data () { + return { + description: '任务表管理页面', + zoneList:[], + // 表头 + columns: [ + { + title:'任务ID', + align:"center", + dataIndex: 'id', + }, + { + title:'任务类型', + align:"center", + dataIndex: 'taskType_dictText', + }, + { + title:'容器号', + align:"center", + dataIndex: 'containerCode' + }, + { + title:'库区', + align:"center", + dataIndex: 'zoneCode', + key: 'zoneCode', + scopedSlots: { customRender: 'zoneCode' } + }, + { + title:'起始库位', + align:"center", + dataIndex: 'fromLocationCode' + }, + { + title:'目标库位', + align:"center", + dataIndex: 'toLocationCode' + }, + { + title:'目标出入口', + align:"center", + dataIndex: 'toPortCode' + }, + { + title:'任务状态', + align:"center", + dataIndex: 'status_dictText', + }, + { + title:'是否重入', + align:"center", + dataIndex: 'isDoubleIn_dictText', + }, + { + title:'重入库位号', + align:"center", + dataIndex: 'originLocationCode' + }, + { + title:'创建人', + align:"center", + dataIndex: 'createBy' + }, + { + title:'创建日期', + align:"center", + dataIndex: 'createTime' + }, + { + title:'更新人', + align:"center", + dataIndex: 'updateBy' + }, + { + title:'更新日期', + align:"center", + dataIndex: 'updateTime' + }, + { + title: '操作', + dataIndex: 'action', + align:"center", + fixed:"right", + width:147, + scopedSlots: { customRender: 'action' }, + } + ], + url: { + list: "/task/taskHeader/list", + delete: "/task/taskHeader/delete", + deleteBatch: "/task/taskHeader/deleteBatch", + exportXlsUrl: "/task/taskHeader/exportXls", + importExcelUrl: "task/taskHeader/importExcel", + }, + dictOptions:{ + taskType:[], + isEmptyOut:[], + isDoubleIn:[], + status:[], + }, + /* 分页参数 */ + ipagination:{ + current: 1, + pageSize: 5, + pageSizeOptions: ['5', '10', '50'], + showTotal: (total, range) => { + return range[0] + "-" + range[1] + " 共" + total + "条" + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0 + }, + selectedMainId:'', + superFieldList:[], + } + }, + created() { + this.getSuperFieldList(); + this.loadFrom(); + }, + computed: { + importExcelUrl: function(){ + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; + } + }, + methods: { + initDictConfig(){ + }, + clickThenSelect(record) { + return { + on: { + click: () => { + this.onSelectChange(record.id.split(","), [record]); + } + } + } + }, + onClearSelected() { + this.selectedRowKeys = []; + this.selectionRows = []; + this.selectedMainId='' + }, + onSelectChange(selectedRowKeys, selectionRows) { + this.selectedMainId=selectedRowKeys[0] + this.selectedRowKeys = selectedRowKeys; + this.selectionRows = selectionRows; + }, + loadData(arg) { + if(!this.url.list){ + this.$message.error("请设置url.list属性!") + return + } + //加载数据 若传入参数1则加载第一页的内容 + if (arg === 1) { + this.ipagination.current = 1; + } + this.onClearSelected() + var params = this.getQueryParams();//查询条件 + params.innernalTaskType = 400; + this.loading = true; + getAction(this.url.list, params).then((res) => { + if (res.success) { + this.dataSource = res.result.records; + this.ipagination.total = res.result.total; + } + if(res.code===510){ + this.$message.warning(res.message) + } + this.loading = false; + }) + }, + loadFrom() { + getZoneList().then((res) => { + if (res.success) { + this.zoneList = res.result + } + }); + }, + createCheckOut() { + this.$refs.checkOutModal.edit(); + this.$refs.checkOutModal.title = "创建出库查看任务"; + }, + solutionZoneCode(value) { + var actions = [] + Object.keys(this.zoneList).some((key) => { + if (this.zoneList[key].code == ('' + value)) { + actions.push(this.zoneList[key].name) + return true + } + }) + return actions.join('') + }, + completeTask(record) { + this.loading = true; + this.model = Object.assign({}, record); + completeTaskByWMS(this.model).then((res) => { + this.loading = false; + if (res.success) { + this.$message.success(res.message); + } + else { + this.$message.error(res.message); + } + this.searchQuery(); + }); + }, + executeTask(record) { + this.loading = true; + this.model = Object.assign({}, record); + execute(this.model).then((res) => { + this.loading = false; + if (res.success) { + this.$message.success(res.message); + } + else { + this.$message.error(res.message); + } + this.searchQuery(); + }); + }, + getSuperFieldList(){ + let fieldList=[]; + fieldList.push({type:'int',value:'taskType',text:'任务类型',dictCode:'task_type'}) + fieldList.push({type:'string',value:'containerCode',text:'容器号',dictCode:''}) + fieldList.push({type:'string',value:'fromLocationCode',text:'起始库位',dictCode:''}) + fieldList.push({type:'string',value:'toLocationCode',text:'目标库位',dictCode:''}) + fieldList.push({type:'string',value:'isEmptyOut',text:'是否空出',dictCode:'is_or_not'}) + fieldList.push({type:'int',value:'isDoubleIn',text:'是否重入',dictCode:'is_or_not'}) + fieldList.push({type:'string',value:'originLocationCode',text:'重入库位号',dictCode:''}) + fieldList.push({type:'int',value:'status',text:'任务状态',dictCode:'task_header_status'}) + fieldList.push({type:'string',value:'fromPortCode',text:'起始出入口',dictCode:''}) + fieldList.push({type:'string',value:'toPortCode',text:'目标出入口',dictCode:''}) + fieldList.push({type:'string',value:'createBy',text:'创建人',dictCode:''}) + fieldList.push({type:'datetime',value:'createTime',text:'创建日期'}) + fieldList.push({type:'string',value:'updateBy',text:'更新人',dictCode:''}) + fieldList.push({type:'datetime',value:'updateTime',text:'更新日期'}) + this.superFieldList = fieldList + } + } + } +</script> +<style scoped> + @import '~@assets/less/common.less' +</style> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/ReceiptTaskHeaderList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/ReceiptTaskHeaderList.vue index 010cb5f..830eb45 100644 --- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/ReceiptTaskHeaderList.vue +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/ReceiptTaskHeaderList.vue @@ -15,6 +15,19 @@ </a-form-item> </a-col> <template v-if="toggleSearchStatus"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="库区"> + <a-select + show-search + placeholder="请选择库区" + option-filter-prop="children" + :filter-option="filterOption" + v-model="queryParam.zoneCode" + style="width: 200px"> + <a-select-option v-for="item in zoneList" :key="item.name" :value="item.code">{{ item.name }}</a-select-option> + </a-select> + </a-form-item> + </a-col> <a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-form-item label="起始库位"> <a-input placeholder="请输入起始库位" v-model="queryParam.fromLocationCode"></a-input> @@ -32,12 +45,12 @@ </a-col> <a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-form-item label="起始出入口"> - <a-input placeholder="请输入起始出入口" v-model="queryParam.fromPort"></a-input> + <a-input placeholder="请输入起始出入口" v-model="queryParam.fromPortCode"></a-input> </a-form-item> </a-col> <a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-form-item label="目标出入口"> - <a-input placeholder="请输入目标出入口" v-model="queryParam.toPort"></a-input> + <a-input placeholder="请输入目标出入口" v-model="queryParam.toPortCode"></a-input> </a-form-item> </a-col> <a-col :xl="6" :lg="7" :md="8" :sm="24"> @@ -79,15 +92,10 @@ <!-- 查询区域-END --> <!-- 操作按钮区域 --> -<!-- <div class="table-operator">--> -<!-- <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>--> -<!-- <a-button type="primary" icon="download" @click="handleExportXls('任务表')">导出</a-button>--> -<!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">--> -<!-- <a-button type="primary" icon="import">导入</a-button>--> -<!-- </a-upload>--> -<!-- <!– 高级查询区域 –>--> -<!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>--> -<!-- </div>--> + <div class="table-operator"> + <a-button @click="createEmptyIn()" type="primary">空托入库</a-button> + <a-button @click="createManyEmptyIn()" type="primary">空托组入库</a-button> + </div> <!-- table区域-begin --> <div> @@ -111,6 +119,12 @@ :customRow="clickThenSelect" @change="handleTableChange"> + <span slot="zoneCode" slot-scope="zoneCode"> + <a-tag :key="zoneCode" color=blue> + {{ solutionZoneCode(zoneCode) }} + </a-tag> + </span> + <template slot="htmlSlot" slot-scope="text"> <div v-html="text"></div> </template> @@ -134,6 +148,8 @@ <span slot="action" slot-scope="text, record"> <a v-if="record.status == 1" @click="executeTask(record)">执行</a> <a-divider type="vertical" /> + <a v-if="record.status < 100" @click="cancelTask(record)">取消</a> + <a-divider type="vertical" /> <a v-if="record.status < 100" @click="completeTask(record)">完成</a> <a-divider type="vertical" /> <a-dropdown> @@ -161,6 +177,8 @@ </a-tabs> <taskHeader-modal ref="modalForm" @ok="modalFormOk"></taskHeader-modal> + <empty-in-task-modal ref="emptyInModal" @ok="modalFormOk"></empty-in-task-modal> + <many-empty-in-task-modal ref="manyEmptyInModal" @ok="modalFormOk"></many-empty-in-task-modal> </a-card> </template> @@ -172,19 +190,25 @@ import TaskDetailList from './TaskDetailList' import {initDictOptions,filterMultiDictText} from '@/components/dict/JDictSelectUtil' import '@/assets/less/TableExpand.less' - import {completeTaskByWMS} from '@/api/api' + import {completeTaskByWMS, cancelTask} from '@/api/api' import {execute} from '@/api/api' + import {getZoneList} from '@/api/api' + import EmptyInTaskModal from './modules/EmptyInTaskModal' + import ManyEmptyInTaskModal from "./modules/ManyEmptyInTaskModal"; export default { name: "TaskHeaderList", mixins:[JeecgListMixin], components: { + ManyEmptyInTaskModal, + EmptyInTaskModal, TaskDetailList, TaskHeaderModal }, data () { return { description: '任务表管理页面', + zoneList:[], // 表头 columns: [ { @@ -203,6 +227,13 @@ dataIndex: 'containerCode' }, { + title:'库区', + align:"center", + dataIndex: 'zoneCode', + key: 'zoneCode', + scopedSlots: { customRender: 'zoneCode' } + }, + { title:'起始库位', align:"center", dataIndex: 'fromLocationCode' @@ -215,7 +246,7 @@ { title:'目标出入口', align:"center", - dataIndex: 'toPort' + dataIndex: 'toPortCode' }, { title:'任务状态', @@ -292,6 +323,7 @@ }, created() { this.getSuperFieldList(); + this.loadFrom(); }, computed: { importExcelUrl: function(){ @@ -344,6 +376,45 @@ this.loading = false; }) }, + loadFrom() { + getZoneList().then((res) => { + if (res.success) { + this.zoneList = res.result + } + }); + }, + createEmptyIn() { + this.$refs.emptyInModal.edit(); + this.$refs.emptyInModal.title = "创建空托盘入库"; + }, + createManyEmptyIn() { + this.$refs.manyEmptyInModal.edit(); + this.$refs.manyEmptyInModal.title = "创建空托盘组入库"; + }, + solutionZoneCode(value) { + var actions = [] + Object.keys(this.zoneList).some((key) => { + if (this.zoneList[key].code == ('' + value)) { + actions.push(this.zoneList[key].name) + return true + } + }) + return actions.join('') + }, + cancelTask(record) { + this.loading = true; + this.model = Object.assign({}, record); + cancelTask(this.model.id).then((res) => { + this.loading = false; + if (res.success) { + this.$message.success(res.message); + } + else { + this.$message.error(res.message); + } + this.searchQuery(); + }); + }, completeTask(record) { this.loading = true; this.model = Object.assign({}, record); @@ -382,8 +453,8 @@ fieldList.push({type:'int',value:'isDoubleIn',text:'是否重入',dictCode:'is_or_not'}) fieldList.push({type:'string',value:'originLocationCode',text:'重入库位号',dictCode:''}) fieldList.push({type:'int',value:'status',text:'任务状态',dictCode:'task_header_status'}) - fieldList.push({type:'string',value:'fromPort',text:'起始出入口',dictCode:''}) - fieldList.push({type:'string',value:'toPort',text:'目标出入口',dictCode:''}) + fieldList.push({type:'string',value:'fromPortCode',text:'起始出入口',dictCode:''}) + fieldList.push({type:'string',value:'toPortCode',text:'目标出入口',dictCode:''}) fieldList.push({type:'string',value:'createBy',text:'创建人',dictCode:''}) fieldList.push({type:'datetime',value:'createTime',text:'创建日期'}) fieldList.push({type:'string',value:'updateBy',text:'更新人',dictCode:''}) diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/ShipmentTaskHeaderList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/ShipmentTaskHeaderList.vue index b29f494..a0dcfb5 100644 --- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/ShipmentTaskHeaderList.vue +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/ShipmentTaskHeaderList.vue @@ -16,6 +16,19 @@ </a-col> <template v-if="toggleSearchStatus"> <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="库区"> + <a-select + show-search + placeholder="请选择库区" + option-filter-prop="children" + :filter-option="filterOption" + v-model="queryParam.zoneCode" + style="width: 200px"> + <a-select-option v-for="item in zoneList" :key="item.name" :value="item.code">{{ item.name }}</a-select-option> + </a-select> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-form-item label="起始库位"> <a-input placeholder="请输入起始库位" v-model="queryParam.fromLocationCode"></a-input> </a-form-item> @@ -47,12 +60,12 @@ </a-col> <a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-form-item label="起始出入口"> - <a-input placeholder="请输入起始出入口" v-model="queryParam.fromPort"></a-input> + <a-input placeholder="请输入起始出入口" v-model="queryParam.fromPortCode"></a-input> </a-form-item> </a-col> <a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-form-item label="目标出入口"> - <a-input placeholder="请输入目标出入口" v-model="queryParam.toPort"></a-input> + <a-input placeholder="请输入目标出入口" v-model="queryParam.toPortCode"></a-input> </a-form-item> </a-col> <a-col :xl="10" :lg="11" :md="12" :sm="24"> @@ -79,15 +92,10 @@ <!-- 查询区域-END --> <!-- 操作按钮区域 --> -<!-- <div class="table-operator">--> -<!-- <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>--> -<!-- <a-button type="primary" icon="download" @click="handleExportXls('任务表')">导出</a-button>--> -<!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">--> -<!-- <a-button type="primary" icon="import">导入</a-button>--> -<!-- </a-upload>--> -<!-- <!– 高级查询区域 –>--> -<!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>--> -<!-- </div>--> + <div class="table-operator"> + <a-button @click="createEmptyOut()" type="primary" >空托出库</a-button> + <a-button @click="createManyEmptyOut()" type="primary" >空托组出库</a-button> + </div> <!-- table区域-begin --> <div> @@ -111,6 +119,12 @@ :customRow="clickThenSelect" @change="handleTableChange"> + <span slot="zoneCode" slot-scope="zoneCode"> + <a-tag :key="zoneCode" color=blue> + {{ solutionZoneCode(zoneCode) }} + </a-tag> + </span> + <template slot="htmlSlot" slot-scope="text"> <div v-html="text"></div> </template> @@ -161,6 +175,9 @@ </a-tabs> <taskHeader-modal ref="modalForm" @ok="modalFormOk"></taskHeader-modal> + <empty-out-task-modal ref="emptyOutModal" @ok="modalFormOk"></empty-out-task-modal> + <many-empty-out-task-modal ref="manyEmptyOutModal" @ok="modalFormOk"></many-empty-out-task-modal> + </a-card> </template> @@ -174,11 +191,16 @@ import '@/assets/less/TableExpand.less' import {completeTaskByWMS} from '@/api/api' import {execute} from '@/api/api' + import {getZoneList} from '@/api/api' + import EmptyOutTaskModal from './modules/EmptyOutTaskModal' + import ManyEmptyOutTaskModal from "./modules/ManyEmptyOutTaskModal"; export default { name: "TaskHeaderList", mixins:[JeecgListMixin], components: { + ManyEmptyOutTaskModal, + EmptyOutTaskModal, TaskDetailList, TaskHeaderModal }, @@ -203,6 +225,13 @@ dataIndex: 'containerCode' }, { + title:'库区', + align:"center", + dataIndex: 'zoneCode', + key: 'zoneCode', + scopedSlots: { customRender: 'zoneCode' } + }, + { title:'起始库位', align:"center", dataIndex: 'fromLocationCode' @@ -215,7 +244,7 @@ { title:'目标出入口', align:"center", - dataIndex: 'toPort' + dataIndex: 'toPortCode' }, { title:'任务状态', @@ -287,6 +316,7 @@ }, created() { this.getSuperFieldList(); + this.loadFrom(); }, computed: { importExcelUrl: function(){ @@ -315,6 +345,31 @@ this.selectedRowKeys = selectedRowKeys; this.selectionRows = selectionRows; }, + loadFrom() { + getZoneList().then((res) => { + if (res.success) { + this.zoneList = res.result + } + }); + }, + createEmptyOut() { + this.$refs.emptyOutModal.edit(); + this.$refs.emptyOutModal.title = "创建空托盘出库"; + }, + createManyEmptyOut() { + this.$refs.manyEmptyOutModal.edit(); + this.$refs.manyEmptyOutModal.title = "创建空托盘组出库"; + }, + solutionZoneCode(value) { + var actions = [] + Object.keys(this.zoneList).some((key) => { + if (this.zoneList[key].code == ('' + value)) { + actions.push(this.zoneList[key].name) + return true + } + }) + return actions.join('') + }, loadData(arg) { if(!this.url.list){ this.$message.error("请设置url.list属性!") diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/TransferTaskHeaderList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/TransferTaskHeaderList.vue new file mode 100644 index 0000000..09bd2da --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/TransferTaskHeaderList.vue @@ -0,0 +1,466 @@ +<template> + <a-card :bordered="false"> + <!-- 查询区域 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="任务类型"> + <j-dict-select-tag placeholder="请选择任务类型" v-model="queryParam.taskType" dictCode="task_type"/> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="容器号"> + <a-input placeholder="请输入容器号" v-model="queryParam.containerCode"></a-input> + </a-form-item> + </a-col> + <template v-if="toggleSearchStatus"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="库区"> + <a-select + show-search + placeholder="请选择库区" + option-filter-prop="children" + :filter-option="filterOption" + v-model="queryParam.zoneCode" + style="width: 200px"> + <a-select-option v-for="item in zoneList" :key="item.name" :value="item.code">{{ item.name }}</a-select-option> + </a-select> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="起始库位"> + <a-input placeholder="请输入起始库位" v-model="queryParam.fromLocationCode"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="目标库位"> + <a-input placeholder="请输入目标库位" v-model="queryParam.toLocationCode"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="是否空出"> + <j-dict-select-tag placeholder="请选择是否空出" v-model="queryParam.isEmptyOut" dictCode="is_or_not"/> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="起始出入口"> + <a-input placeholder="请输入起始出入口" v-model="queryParam.fromPortCode"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="目标出入口"> + <a-input placeholder="请输入目标出入口" v-model="queryParam.toPortCode"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="任务状态"> + <j-dict-select-tag placeholder="请选择任务状态" v-model="queryParam.status" dictCode="task_header_status"/> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="是否重入"> + <j-dict-select-tag placeholder="请选择是否重入" v-model="queryParam.isDoubleIn" dictCode="is_or_not"/> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="重入库位号"> + <a-input placeholder="请输入重入库位号" v-model="queryParam.originLocationCode"></a-input> + </a-form-item> + </a-col> + <a-col :xl="10" :lg="11" :md="12" :sm="24"> + <a-form-item label="创建日期"> + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.createTime_begin"></j-date> + <span class="query-group-split-cust"></span> + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.createTime_end"></j-date> + </a-form-item> + </a-col> + </template> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> + <a-button type="primary" @click="searchQuery" icon="search">查询</a-button> + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> + <a @click="handleToggleSearch" style="margin-left: 8px"> + {{ toggleSearchStatus ? '收起' : '展开' }} + <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> + </a> + </span> + </a-col> + </a-row> + </a-form> + </div> + <!-- 查询区域-END --> + + <!-- 操作按钮区域 --> + <div class="table-operator"> + <a-button @click="createTransfer()" type="primary">移库任务</a-button> + <a-button @click="createOverStation()" type="primary">跨站任务</a-button> +<!-- <a-button type="primary" icon="download" @click="handleExportXls('任务表')">导出</a-button>--> +<!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">--> +<!-- <a-button type="primary" icon="import">导入</a-button>--> +<!-- </a-upload>--> +<!-- <!– 高级查询区域 –>--> +<!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>--> + </div> + + <!-- table区域-begin --> + <div> + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 + <a style="margin-left: 24px" @click="onClearSelected">清空</a> + </div> + + <a-table + ref="table" + size="middle" + bordered + rowKey="id" + class="j-table-force-nowrap" + :scroll="{x:true}" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}" + :customRow="clickThenSelect" + @change="handleTableChange"> + + <span slot="zoneCode" slot-scope="zoneCode"> + <a-tag :key="zoneCode" color=blue> + {{ solutionZoneCode(zoneCode) }} + </a-tag> + </span> + + <template slot="htmlSlot" slot-scope="text"> + <div v-html="text"></div> + </template> + <template slot="imgSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> + <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> + </template> + <template slot="fileSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> + <a-button + v-else + :ghost="true" + type="primary" + icon="download" + size="small" + @click="downloadFile(text)"> + 下载 + </a-button> + </template> + + <span slot="action" slot-scope="text, record"> + <a v-if="record.status == 1" @click="executeTask(record)">执行</a> + <a-divider type="vertical" /> + <a v-if="record.status < 100" @click="completeTask(record)">完成</a> + <a-divider type="vertical" /> + <a-dropdown> + <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> + <a-menu slot="overlay"> + <a-menu-item> + <a @click="handleEdit(record)">编辑</a> + </a-menu-item> + <a-menu-item> + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> + <a>删除</a> + </a-popconfirm> + </a-menu-item> + </a-menu> + </a-dropdown> + </span> + + </a-table> + </div> + + <a-tabs defaultActiveKey="1"> + <a-tab-pane tab="任务详情" key="1" > + <TaskDetailList :mainId="selectedMainId" /> + </a-tab-pane> + </a-tabs> + + <taskHeader-modal ref="modalForm" @ok="modalFormOk"></taskHeader-modal> + <transfer-task-modal ref="transferModal" @ok="modalFormOk"></transfer-task-modal> + <over-station-task-modal ref="overStationModal" @ok="modalFormOk"></over-station-task-modal> + </a-card> +</template> + +<script> + + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import TaskHeaderModal from './modules/TaskHeaderModal' + import { getAction } from '@/api/manage' + import TaskDetailList from './TaskDetailList' + import {initDictOptions,filterMultiDictText} from '@/components/dict/JDictSelectUtil' + import '@/assets/less/TableExpand.less' + import {completeTaskByWMS} from '@/api/api' + import {execute} from '@/api/api' + import {getZoneList} from '@/api/api' + import EmptyInTaskModal from './modules/EmptyInTaskModal' + import TransferTaskModal from "./modules/TransferTaskModal"; + import OverStationTaskModal from "./modules/OverStationTaskModal"; + + export default { + name: "TaskHeaderList", + mixins:[JeecgListMixin], + components: { + OverStationTaskModal, + TransferTaskModal, + EmptyInTaskModal, + TaskDetailList, + TaskHeaderModal + }, + data () { + return { + description: '任务表管理页面', + zoneList:[], + // 表头 + columns: [ + { + title:'任务ID', + align:"center", + dataIndex: 'id', + }, + { + title:'任务类型', + align:"center", + dataIndex: 'taskType_dictText', + }, + { + title:'容器号', + align:"center", + dataIndex: 'containerCode' + }, + { + title:'库区', + align:"center", + dataIndex: 'zoneCode', + key: 'zoneCode', + scopedSlots: { customRender: 'zoneCode' } + }, + { + title:'起始库位', + align:"center", + dataIndex: 'fromLocationCode' + }, + { + title:'目标库位', + align:"center", + dataIndex: 'toLocationCode' + }, + { + title:'起始出入口', + align:"center", + dataIndex: 'fromPortCode' + }, + { + title:'目标出入口', + align:"center", + dataIndex: 'toPortCode' + }, + { + title:'任务状态', + align:"center", + dataIndex: 'status_dictText', + }, + { + title:'是否重入', + align:"center", + dataIndex: 'isDoubleIn_dictText', + }, + { + title:'重入库位号', + align:"center", + dataIndex: 'originLocationCode' + }, + { + title:'创建人', + align:"center", + dataIndex: 'createBy' + }, + { + title:'创建日期', + align:"center", + dataIndex: 'createTime' + }, + { + title:'更新人', + align:"center", + dataIndex: 'updateBy' + }, + { + title:'更新日期', + align:"center", + dataIndex: 'updateTime' + }, + { + title: '操作', + dataIndex: 'action', + align:"center", + fixed:"right", + width:147, + scopedSlots: { customRender: 'action' }, + } + ], + url: { + list: "/task/taskHeader/list", + delete: "/task/taskHeader/delete", + deleteBatch: "/task/taskHeader/deleteBatch", + exportXlsUrl: "/task/taskHeader/exportXls", + importExcelUrl: "task/taskHeader/importExcel", + }, + dictOptions:{ + taskType:[], + isEmptyOut:[], + isDoubleIn:[], + status:[], + }, + /* 分页参数 */ + ipagination:{ + current: 1, + pageSize: 5, + pageSizeOptions: ['5', '10', '50'], + showTotal: (total, range) => { + return range[0] + "-" + range[1] + " 共" + total + "条" + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0 + }, + selectedMainId:'', + superFieldList:[], + } + }, + created() { + this.getSuperFieldList(); + this.loadFrom(); + }, + computed: { + importExcelUrl: function(){ + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; + } + }, + methods: { + initDictConfig(){ + }, + clickThenSelect(record) { + return { + on: { + click: () => { + this.onSelectChange(record.id.split(","), [record]); + } + } + } + }, + onClearSelected() { + this.selectedRowKeys = []; + this.selectionRows = []; + this.selectedMainId='' + }, + onSelectChange(selectedRowKeys, selectionRows) { + this.selectedMainId=selectedRowKeys[0] + this.selectedRowKeys = selectedRowKeys; + this.selectionRows = selectionRows; + }, + loadData(arg) { + if(!this.url.list){ + this.$message.error("请设置url.list属性!") + return + } + //加载数据 若传入参数1则加载第一页的内容 + if (arg === 1) { + this.ipagination.current = 1; + } + this.onClearSelected() + var params = this.getQueryParams();//查询条件 + params.innernalTaskType = 300; + this.loading = true; + getAction(this.url.list, params).then((res) => { + if (res.success) { + this.dataSource = res.result.records; + this.ipagination.total = res.result.total; + } + if(res.code===510){ + this.$message.warning(res.message) + } + this.loading = false; + }) + }, + loadFrom() { + getZoneList().then((res) => { + if (res.success) { + this.zoneList = res.result + } + }); + }, + createTransfer() { + this.$refs.transferModal.edit(); + this.$refs.transferModal.title = "创建移库任务"; + }, + createOverStation() { + this.$refs.overStationModal.edit(); + this.$refs.overStationModal.title = "创建跨站任务"; + }, + solutionZoneCode(value) { + var actions = [] + Object.keys(this.zoneList).some((key) => { + if (this.zoneList[key].code == ('' + value)) { + actions.push(this.zoneList[key].name) + return true + } + }) + return actions.join('') + }, + completeTask(record) { + this.loading = true; + this.model = Object.assign({}, record); + completeTaskByWMS(this.model).then((res) => { + this.loading = false; + if (res.success) { + this.$message.success(res.message); + } + else { + this.$message.error(res.message); + } + this.searchQuery(); + }); + }, + executeTask(record) { + this.loading = true; + this.model = Object.assign({}, record); + execute(this.model).then((res) => { + this.loading = false; + if (res.success) { + this.$message.success(res.message); + } + else { + this.$message.error(res.message); + } + this.searchQuery(); + }); + }, + getSuperFieldList(){ + let fieldList=[]; + fieldList.push({type:'int',value:'taskType',text:'任务类型',dictCode:'task_type'}) + fieldList.push({type:'string',value:'containerCode',text:'容器号',dictCode:''}) + fieldList.push({type:'string',value:'fromLocationCode',text:'起始库位',dictCode:''}) + fieldList.push({type:'string',value:'toLocationCode',text:'目标库位',dictCode:''}) + fieldList.push({type:'string',value:'isEmptyOut',text:'是否空出',dictCode:'is_or_not'}) + fieldList.push({type:'int',value:'isDoubleIn',text:'是否重入',dictCode:'is_or_not'}) + fieldList.push({type:'string',value:'originLocationCode',text:'重入库位号',dictCode:''}) + fieldList.push({type:'int',value:'status',text:'任务状态',dictCode:'task_header_status'}) + fieldList.push({type:'string',value:'fromPortCode',text:'起始出入口',dictCode:''}) + fieldList.push({type:'string',value:'toPortCode',text:'目标出入口',dictCode:''}) + fieldList.push({type:'string',value:'createBy',text:'创建人',dictCode:''}) + fieldList.push({type:'datetime',value:'createTime',text:'创建日期'}) + fieldList.push({type:'string',value:'updateBy',text:'更新人',dictCode:''}) + fieldList.push({type:'datetime',value:'updateTime',text:'更新日期'}) + this.superFieldList = fieldList + } + } + } +</script> +<style scoped> + @import '~@assets/less/common.less' +</style> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/CheckOutTaskModal.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/CheckOutTaskModal.vue new file mode 100644 index 0000000..82ad094 --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/CheckOutTaskModal.vue @@ -0,0 +1,139 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + :confirmLoading="confirmLoading" + switchFullscreen + @ok="handleOk" + @cancel="handleCancel" + cancelText="关闭"> + <a-spin :spinning="confirmLoading"> + <a-form-model ref="form" :model="model" :rules="validatorRules"> + <a-row> + <a-col :span="24"> + <a-form-model-item label="容器编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerCode"> + <a-input v-model="model.containerCode" placeholder="请输入容器编码" @keyup="getPortList"></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="出库口" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="toPortCode"> + <a-select + show-search + placeholder="请选择出库口" + option-filter-prop="children" + :filter-option="filterOption" + v-model="model.toPortCode"> + <a-select-option v-for="item in portList" :key="item.name" :value="item.code">{{ item.name }}</a-select-option> + </a-select> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </a-spin> + </j-modal> +</template> + +<script> + + import { httpAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + import {createCheckOutTask} from '@/api/api' + import {selectPickPort} from '@/api/api' + + export default { + name: "CheckOutTaskModal", + components: { + }, + data () { + return { + title:"操作", + width:500, + portList:[], + querySource:{}, + visible: false, + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + + confirmLoading: false, + validatorRules: { + containerCode: [ + { required: true, message: '请输入容器编码!'}, + ], + toPortCode: [ + { required: true, message: '请选择出库口!'}, + ], + }, + url: { + add: "/task/taskHeader/createEmptyOut", + } + + } + }, + created () { + //备份model原始值 + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + add () { + this.edit(this.modelDefault); + }, + edit () { + // this.getPortList(); + // this.model = Object.assign({}, record); + this.visible = true; + }, + close () { + this.$emit('close'); + this.visible = false; + this.$refs.form.clearValidate(); + }, + getPortList() { + this.querySource.containerCode = this.model.containerCode; + selectPickPort(this.querySource).then((res) => { + if (res.success) { + this.portList = res.result; + this.visible = true; + } + }); + }, + handleOk () { + const that = this; + // 触发表单验证 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + createCheckOutTask(this.model).then((res)=>{ + if(res.success){ + that.$message.success(res.message); + that.$emit('ok'); + that.model.containerCode = ''; + that.model.toPortCode = ''; + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + that.close(); + }) + }else{ + return false + } + }) + }, + handleCancel () { + this.close() + }, + + + } + } +</script> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/EmptyInTaskModal.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/EmptyInTaskModal.vue new file mode 100644 index 0000000..9a67d05 --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/EmptyInTaskModal.vue @@ -0,0 +1,115 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + :confirmLoading="confirmLoading" + switchFullscreen + @ok="handleOk" + @cancel="handleCancel" + cancelText="关闭"> + <a-spin :spinning="confirmLoading"> + <a-form-model ref="form" :model="model" :rules="validatorRules"> + <a-row> + <a-col :span="24"> + <a-form-model-item label="容器号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerCode"> + <a-input v-model="model.containerCode" placeholder="请输入容器号" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="目标库位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="toLocationCode"> + <a-input v-model="model.toLocationCode" placeholder="请输入目标库位" ></a-input> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </a-spin> + </j-modal> +</template> + +<script> + + import { httpAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + import {createEmptyIn} from '@/api/api' + + export default { + name: "EmptyInTaskModal", + components: { + }, + data () { + return { + title:"操作", + width:500, + visible: false, + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + + confirmLoading: false, + validatorRules: { + containerCode: [ + { required: true, message: '请输入容器编码!'}, + ], + }, + url: { + add: "/task/taskHeader/createEmptyIn", + } + + } + }, + created () { + //备份model原始值 + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + add () { + this.edit(this.modelDefault); + }, + edit () { + this.visible = true; + }, + close () { + this.$emit('close'); + this.visible = false; + this.$refs.form.clearValidate(); + }, + handleOk () { + const that = this; + // 触发表单验证 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + createEmptyIn(this.model).then((res)=>{ + if(res.success){ + that.$message.success(res.message); + that.$emit('ok'); + that.model.containerCode = ''; + that.model.toLocationCode = ''; + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + that.close(); + }) + }else{ + return false + } + }) + }, + handleCancel () { + this.close() + }, + + + } + } +</script> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/EmptyOutTaskModal.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/EmptyOutTaskModal.vue new file mode 100644 index 0000000..2037e80 --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/EmptyOutTaskModal.vue @@ -0,0 +1,139 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + :confirmLoading="confirmLoading" + switchFullscreen + @ok="handleOk" + @cancel="handleCancel" + cancelText="关闭"> + <a-spin :spinning="confirmLoading"> + <a-form-model ref="form" :model="model" :rules="validatorRules"> + <a-row> + <a-col :span="24"> + <a-form-model-item label="容器编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerCode"> + <a-input v-model="model.containerCode" placeholder="请输入容器编码" @keyup="getPortList"></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="出库口" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="toPortCode"> + <a-select + show-search + placeholder="请选择出库口" + option-filter-prop="children" + :filter-option="filterOption" + v-model="model.toPortCode"> + <a-select-option v-for="item in portList" :key="item.name" :value="item.code">{{ item.name }}</a-select-option> + </a-select> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </a-spin> + </j-modal> +</template> + +<script> + + import { httpAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + import {createEmptyOut} from '@/api/api' + import {selectOutPort} from '@/api/api' + + export default { + name: "EmptyOutTaskModal", + components: { + }, + data () { + return { + title:"操作", + width:500, + portList:[], + querySource:{}, + visible: false, + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + + confirmLoading: false, + validatorRules: { + containerCode: [ + { required: true, message: '请输入容器编码!'}, + ], + toPortCode: [ + { required: true, message: '请选择出库口!'}, + ], + }, + url: { + add: "/task/taskHeader/createEmptyOut", + } + + } + }, + created () { + //备份model原始值 + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + add () { + this.edit(this.modelDefault); + }, + edit () { + // this.getPortList(); + // this.model = Object.assign({}, record); + this.visible = true; + }, + close () { + this.$emit('close'); + this.visible = false; + this.$refs.form.clearValidate(); + }, + getPortList() { + this.querySource.containerCode = this.model.containerCode; + selectOutPort(this.querySource).then((res) => { + if (res.success) { + this.portList = res.result; + this.visible = true; + } + }); + }, + handleOk () { + const that = this; + // 触发表单验证 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + createEmptyOut(this.model).then((res)=>{ + if(res.success){ + that.$message.success(res.message); + that.$emit('ok'); + that.model.containerCode = ''; + that.model.toPortCode = ''; + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + that.close(); + }) + }else{ + return false + } + }) + }, + handleCancel () { + this.close() + }, + + + } + } +</script> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/ManyEmptyInTaskModal.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/ManyEmptyInTaskModal.vue new file mode 100644 index 0000000..f65b71d --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/ManyEmptyInTaskModal.vue @@ -0,0 +1,115 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + :confirmLoading="confirmLoading" + switchFullscreen + @ok="handleOk" + @cancel="handleCancel" + cancelText="关闭"> + <a-spin :spinning="confirmLoading"> + <a-form-model ref="form" :model="model" :rules="validatorRules"> + <a-row> + <a-col :span="24"> + <a-form-model-item label="容器号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerCode"> + <a-input v-model="model.containerCode" placeholder="请输入容器号" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="目标库位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="toLocationCode"> + <a-input v-model="model.toLocationCode" placeholder="请输入目标库位" ></a-input> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </a-spin> + </j-modal> +</template> + +<script> + + import { httpAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + import {createManyEmptyIn} from '@/api/api' + + export default { + name: "ManyEmptyInTaskModal", + components: { + }, + data () { + return { + title:"操作", + width:500, + visible: false, + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + + confirmLoading: false, + validatorRules: { + containerCode: [ + { required: true, message: '请输入容器编码!'}, + ], + }, + url: { + add: "/task/taskHeader/createManyEmptyIn", + } + + } + }, + created () { + //备份model原始值 + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + add () { + this.edit(this.modelDefault); + }, + edit () { + this.visible = true; + }, + close () { + this.$emit('close'); + this.visible = false; + this.$refs.form.clearValidate(); + }, + handleOk () { + const that = this; + // 触发表单验证 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + createManyEmptyIn(this.model).then((res)=>{ + if(res.success){ + that.$message.success(res.message); + that.$emit('ok'); + that.model.containerCode = ''; + that.model.toLocationCode = ''; + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + that.close(); + }) + }else{ + return false + } + }) + }, + handleCancel () { + this.close() + }, + + + } + } +</script> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/ManyEmptyOutTaskModal.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/ManyEmptyOutTaskModal.vue new file mode 100644 index 0000000..0d15ecf --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/ManyEmptyOutTaskModal.vue @@ -0,0 +1,137 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + :confirmLoading="confirmLoading" + switchFullscreen + @ok="handleOk" + @cancel="handleCancel" + cancelText="关闭"> + <a-spin :spinning="confirmLoading"> + <a-form-model ref="form" :model="model" :rules="validatorRules"> + <a-row> + <a-col :span="24"> + <a-form-model-item label="容器编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerCode"> + <a-input v-model="model.containerCode" placeholder="请输入容器编码" @keyup="getPortList"></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="出库口" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="toPortCode"> + <a-select + show-search + placeholder="请选择出库口" + option-filter-prop="children" + :filter-option="filterOption" + v-model="model.toPortCode"> + <a-select-option v-for="item in portList" :key="item.name" :value="item.code">{{ item.name }}</a-select-option> + </a-select> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </a-spin> + </j-modal> +</template> + +<script> + + import { httpAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + import {createManyEmptyOut} from '@/api/api' + import {selectOutPort} from '@/api/api' + + export default { + name: "ManyEmptyOutTaskModal", + components: { + }, + data () { + return { + title:"操作", + width:500, + portList:[], + querySource:{}, + visible: false, + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + + confirmLoading: false, + validatorRules: { + containerCode: [ + { required: true, message: '请输入容器编码!'}, + ], + toPortCode: [ + { required: true, message: '请选择出库口!'}, + ], + }, + url: { + add: "/task/taskHeader/createManyEmptyOut", + } + + } + }, + created () { + //备份model原始值 + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + add () { + this.edit(this.modelDefault); + }, + edit () { + this.visible = true; + }, + close () { + this.$emit('close'); + this.visible = false; + this.$refs.form.clearValidate(); + }, + getPortList() { + this.querySource.containerCode = this.model.containerCode; + selectOutPort(this.querySource).then((res) => { + if (res.success) { + this.portList = res.result; + this.visible = true; + } + }); + }, + handleOk () { + const that = this; + // 触发表单验证 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + createManyEmptyOut(this.model).then((res)=>{ + if(res.success){ + that.$message.success(res.message); + that.$emit('ok'); + that.model.containerCode = ''; + that.model.toPortCode = ''; + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + that.close(); + }) + }else{ + return false + } + }) + }, + handleCancel () { + this.close() + }, + + + } + } +</script> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/OverStationTaskModal.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/OverStationTaskModal.vue new file mode 100644 index 0000000..561f997 --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/OverStationTaskModal.vue @@ -0,0 +1,154 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + :confirmLoading="confirmLoading" + switchFullscreen + @ok="handleOk" + @cancel="handleCancel" + cancelText="关闭"> + <a-spin :spinning="confirmLoading"> + <a-form-model ref="form" :model="model" :rules="validatorRules"> + <a-row> + <a-col :span="24"> + <a-form-model-item label="容器编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerCode"> + <a-input v-model="model.containerCode" placeholder="请输入容器编码" @keyup="getPortList"></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="起始站台" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fromPortCode"> + <a-select + show-search + placeholder="请选择起始站台" + option-filter-prop="children" + :filter-option="filterOption" + v-model="model.fromPortCode"> + <a-select-option v-for="item in portList" :key="item.name" :value="item.code">{{ item.name }}</a-select-option> + </a-select> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="目标站台" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="toPortCode"> + <a-select + show-search + placeholder="请选择目标站台" + option-filter-prop="children" + :filter-option="filterOption" + v-model="model.toPortCode"> + <a-select-option v-for="item in portList" :key="item.name" :value="item.code">{{ item.name }}</a-select-option> + </a-select> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </a-spin> + </j-modal> +</template> + +<script> + + import { httpAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + import {createOverStationTask} from '@/api/api' + import {selectPort} from '@/api/api' + + export default { + name: "OverStationTaskModal", + components: { + }, + data () { + return { + title:"操作", + width:500, + portList:[], + querySource:{}, + visible: false, + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + + confirmLoading: false, + validatorRules: { + containerCode: [ + { required: true, message: '请输入容器编码!'}, + ], + fromPortCode: [ + { required: true, message: '请选择起始入口!'}, + ], + toPortCode: [ + { required: true, message: '请选择目标出口!'}, + ], + }, + url: { + add: "/task/taskHeader/createEmptyOut", + } + + } + }, + created () { + //备份model原始值 + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + add () { + this.edit(this.modelDefault); + }, + edit () { + // this.getPortList(); + // this.model = Object.assign({}, record); + this.visible = true; + }, + close () { + this.$emit('close'); + this.visible = false; + this.$refs.form.clearValidate(); + }, + getPortList() { + this.querySource.containerCode = this.model.containerCode; + selectPort(this.querySource).then((res) => { + if (res.success) { + this.portList = res.result; + this.visible = true; + } + }); + }, + handleOk () { + const that = this; + // 触发表单验证 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + createOverStationTask(this.model).then((res)=>{ + if(res.success){ + that.$message.success(res.message); + that.$emit('ok'); + that.model.containerCode = ''; + that.model.toPortCode = ''; + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + that.close(); + }) + }else{ + return false + } + }) + }, + handleCancel () { + this.close() + }, + + + } + } +</script> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/TransferTaskModal.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/TransferTaskModal.vue new file mode 100644 index 0000000..f510040 --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/modules/TransferTaskModal.vue @@ -0,0 +1,122 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + :confirmLoading="confirmLoading" + switchFullscreen + @ok="handleOk" + @cancel="handleCancel" + cancelText="关闭"> + <a-spin :spinning="confirmLoading"> + <a-form-model ref="form" :model="model" :rules="validatorRules"> + <a-row> + <a-col :span="24"> + <a-form-model-item label="起始库位号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fromLocationCode"> + <a-input v-model="model.fromLocationCode" placeholder="请输入起始库位号" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="目标库位号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="toLocationCode"> + <a-input v-model="model.toLocationCode" placeholder="请输入目标库位号" ></a-input> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </a-spin> + </j-modal> +</template> + +<script> + + import { httpAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + import {createTransferTask} from '@/api/api' + + export default { + name: "TransferTaskModal", + components: { + }, + data () { + return { + title:"操作", + width:500, + portList:[], + querySource:{}, + visible: false, + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + + confirmLoading: false, + validatorRules: { + fromLocationCode: [ + { required: true, message: '请输入起始库位号!'}, + ], + toLocationCode: [ + { required: true, message: '请输入目标库位号!'}, + ], + }, + url: { + add: "/task/taskHeader/createTransferTask", + } + + } + }, + created () { + //备份model原始值 + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + add () { + this.edit(this.modelDefault); + }, + edit () { + // this.getPortList(); + // this.model = Object.assign({}, record); + this.visible = true; + }, + close () { + this.$emit('close'); + this.visible = false; + this.$refs.form.clearValidate(); + }, + handleOk () { + const that = this; + // 触发表单验证 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + createTransferTask(this.model).then((res)=>{ + if(res.success){ + that.$message.success(res.message); + that.$emit('ok'); + that.model.fromLocationCode = ''; + that.model.toLocationCode = ''; + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + that.close(); + }) + }else{ + return false + } + }) + }, + handleCancel () { + this.close() + }, + + + } + } +</script> \ No newline at end of file diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/controller/WcsController.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/controller/WcsController.java index 889aa4a..f6b603e 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/controller/WcsController.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/controller/WcsController.java @@ -4,14 +4,20 @@ package org.jeecg.modules.wms.api.wcs.controller; import io.swagger.annotations.ApiOperation; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.util.JwtUtil; +import org.jeecg.modules.wms.api.wcs.entity.ManyEmptyDomain; import org.jeecg.modules.wms.api.wcs.entity.WarecellDomain; import org.jeecg.modules.wms.api.wcs.service.WcsService; import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; import org.jeecg.modules.wms.framework.controller.BaseController; +import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; import org.jeecg.utils.StringUtils; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; @RestController @RequestMapping("/API/WMS/v2") @@ -19,6 +25,8 @@ public class WcsController extends BaseController { @Resource private WcsService wcsService; + @Resource + private ITaskHeaderService taskHeaderService; /* WCS给的长,宽,高,重在有不同规格库位才有用,destination是区域, locationType库位类型 @@ -28,17 +36,22 @@ public class WcsController extends BaseController { @ApiOperation(value="wcs仓位分配", notes="wcs仓位分配", httpMethod = "POST") @ResponseBody @ApiLogger(apiName = "仓位分配", from="WCS") - public Result warecellAllocation(@RequestBody WarecellDomain warecellDomain) { + public Result warecellAllocation(@RequestBody WarecellDomain warecellDomain, HttpServletRequest req) { + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); + if (StringUtils.isEmpty(warehouseCode)) { + return Result.error("仓位分配, 仓库号为空"); + } if (StringUtils.isEmpty(warecellDomain.getTaskNo())) { - return Result.error("任务号为空"); + return Result.error("仓位分配, 任务号为空"); } if (StringUtils.isEmpty(warecellDomain.getZoneCode())) { - return Result.error("目的区域为空"); + return Result.error("仓位分配, 目的区域为空"); } if (StringUtils.isEmpty(warecellDomain.getHeight())) { - return Result.error("高度为空"); + return Result.error("仓位分配, 高度为空"); } - Result result = handleMultiProcess(new MultiProcessListener() { + warecellDomain.setWarehouseCode(warehouseCode); + Result result = handleMultiProcess("warecellAllocation", new JeecgController.MultiProcessListener() { @Override public Result doProcess() { Result result = wcsService.warecellAllocation(warecellDomain); @@ -47,4 +60,53 @@ public class WcsController extends BaseController { }); return result; } + + /** + * WCS申请空托盘组入库 + * @return + */ + @AutoLog(value = "WCS申请空托盘组入库") + @PostMapping("/manyEmptyIn") + @ApiOperation(value="WCS申请空托盘组入库", notes="WCS申请空托盘组入库", httpMethod = "POST") + @ResponseBody + @ApiLogger(apiName = "manyEmptyIn", from="WCS") + public Result manyEmptyIn(@RequestBody ManyEmptyDomain manyEmptyDomain, HttpServletRequest req) { + String containerCode = manyEmptyDomain.getContainerCode(); + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); + String zoneCode = manyEmptyDomain.getZoneCode(); + String height = manyEmptyDomain.getHeight(); + String roadWay = manyEmptyDomain.getRoadWay(); + + Result result = handleMultiProcess("manyEmptyIn", new JeecgController.MultiProcessListener() { + @Override + public Result doProcess() { + Result result = taskHeaderService.createManyEmptyInTask(containerCode, zoneCode, roadWay, height, warehouseCode); + return result; + } + }); + return result; + } + + /** + * WCS申请空托盘组出库 + * @return + */ + @AutoLog(value = "WCS申请空托盘组出库") + @PostMapping("/manyEmptyOut") + @ApiOperation(value="WCS申请空托盘组出库", notes="WCS申请空托盘组出库", httpMethod = "POST") + @ResponseBody + @ApiLogger(apiName = "manyEmptyOut", from="WCS") + public Result manyEmptyOut(@RequestBody ManyEmptyDomain manyEmptyDomain, HttpServletRequest req) { + String containerCode = manyEmptyDomain.getContainerCode(); + String toPortCode = manyEmptyDomain.getPort(); + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); + Result result = handleMultiProcess("manyEmptyOut", new JeecgController.MultiProcessListener() { + @Override + public Result doProcess() { + Result result = taskHeaderService.createManyEmptyOutTask(containerCode, toPortCode, warehouseCode); + return result; + } + }); + return result; + } } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/entity/ManyEmptyDomain.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/entity/ManyEmptyDomain.java new file mode 100644 index 0000000..3418374 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/entity/ManyEmptyDomain.java @@ -0,0 +1,18 @@ +package org.jeecg.modules.wms.api.wcs.entity; + +import lombok.Data; + +@Data +public class ManyEmptyDomain { + + private String containerCode; + private String length; + private String width; + private String height; + private String weight; + //可用巷道 + private String roadWay; + private String zoneCode; + private String port; + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java index 2081917..90bff61 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java @@ -270,7 +270,7 @@ public class WcsServiceImpl implements WcsService { case QuantityConstant.TASK_TYPE_EMPTYSHIPMENT: case QuantityConstant.TASK_TYPE_CYCLECOUNT: case QuantityConstant.TASK_TYPE_TRANSFER: - case QuantityConstant.TASK_TYPE_VIEW: + case QuantityConstant.TASK_TYPE_CHECK_OUT: case QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT: if(fromLocation == null) { return Result.error("起始库位为空"); @@ -280,9 +280,6 @@ public class WcsServiceImpl implements WcsService { case QuantityConstant.TASK_TYPE_WHOLERECEIPT: case QuantityConstant.TASK_TYPE_EMPTYRECEIPT: case QuantityConstant.TASK_TYPE_MANY_EMPTYRECEIPT: - if(toLocation == null) { - return Result.error("终点库位为空"); - } direction = true; break; default: @@ -347,8 +344,8 @@ public class WcsServiceImpl implements WcsService { wcsTask.setTaskNo(taskHeader.getId().toString()); wcsTask.setWarehouseCode(warehouseCode); wcsTask.setTaskType(taskType); - wcsTask.setFromPort(taskHeader.getFromPort()); - wcsTask.setToPort(taskHeader.getToPort()); + wcsTask.setFromPort(taskHeader.getFromPortCode()); + wcsTask.setToPort(taskHeader.getToPortCode()); wcsTask.setContainerCode(taskHeader.getContainerCode()); if (preTaskNo != 0) { wcsTask.setPreTaskNo(String.valueOf(preTaskNo)); @@ -418,7 +415,7 @@ public class WcsServiceImpl implements WcsService { case QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT: case QuantityConstant.TASK_TYPE_SORTINGSHIPMENT: case QuantityConstant.TASK_TYPE_CYCLECOUNT: - case QuantityConstant.TASK_TYPE_VIEW: + case QuantityConstant.TASK_TYPE_CHECK_OUT: wcsTask.setTaskType(400); break; case QuantityConstant.TASK_TYPE_TRANSFER: diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/container/entity/Container.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/container/entity/Container.java index 7556a23..5e7534c 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/container/entity/Container.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/container/entity/Container.java @@ -5,6 +5,7 @@ import java.io.UnsupportedEncodingException; import java.util.Date; import java.math.BigDecimal; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/container/service/IContainerService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/container/service/IContainerService.java index 054f64f..234f212 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/container/service/IContainerService.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/container/service/IContainerService.java @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.wms.config.container.entity.Container; +import java.util.List; + /** * @Description: 容器管理 * @Author: jeecg-boot @@ -22,4 +24,6 @@ public interface IContainerService extends IService<Container> { String status, String warehouseCode); //创建零时容器 Container createLSContainer(String warehouseCode); + + List<Container> getContainerListByStatus(String status, String warehouseCode); } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java index 7f7cfe8..cf380cc 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java @@ -103,6 +103,15 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container return container; } + @Override + public List<Container> getContainerListByStatus(String status, String warehouseCode) { + LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); + containerLambdaQueryWrapper.eq(Container::getStatus, status) + .eq(Container::getWarehouseCode, warehouseCode); + List<Container> containerList = list(containerLambdaQueryWrapper); + return containerList; + } + private int getStartNumber(String containerTypeCode, String warehouseCode) { LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/locationHigh/service/ILocationHighService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/locationHigh/service/ILocationHighService.java index bed9d52..4c45e28 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/locationHigh/service/ILocationHighService.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/locationHigh/service/ILocationHighService.java @@ -3,6 +3,8 @@ package org.jeecg.modules.wms.config.locationHigh.service; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.wms.config.locationHigh.entity.LocationHigh; +import java.util.List; + /** * @Description: 库位高度管理 * @Author: jeecg-boot @@ -11,4 +13,6 @@ import org.jeecg.modules.wms.config.locationHigh.entity.LocationHigh; */ public interface ILocationHighService extends IService<LocationHigh> { + LocationHigh getLocationHighByHighLevel(int highHeight, + List<String> locationTypeCodeList, String warehouseCode); } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/locationHigh/service/impl/LocationHighServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/locationHigh/service/impl/LocationHighServiceImpl.java index b14ff9c..56dc325 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/locationHigh/service/impl/LocationHighServiceImpl.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/locationHigh/service/impl/LocationHighServiceImpl.java @@ -1,5 +1,7 @@ package org.jeecg.modules.wms.config.locationHigh.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import org.jeecg.modules.wms.config.locationHigh.entity.LocationHigh; import org.jeecg.modules.wms.config.locationHigh.mapper.LocationHighMapper; import org.jeecg.modules.wms.config.locationHigh.service.ILocationHighService; @@ -7,6 +9,8 @@ import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import java.util.List; + /** * @Description: 库位高度管理 * @Author: jeecg-boot @@ -16,4 +20,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @Service public class LocationHighServiceImpl extends ServiceImpl<LocationHighMapper, LocationHigh> implements ILocationHighService { + @Override + public LocationHigh getLocationHighByHighLevel(int highHeight, + List<String> locationTypeCodeList, String warehouseCode) { + LambdaQueryWrapper<LocationHigh> locationHighLambdaQueryWrapper = Wrappers.lambdaQuery(); + locationHighLambdaQueryWrapper.eq(LocationHigh::getHighLevel, highHeight) + .eq(LocationHigh::getWarehouseCode, warehouseCode) + .in(LocationHigh::getLocationTypeCode, locationTypeCodeList); + LocationHigh locationHigh = getOne(locationHighLambdaQueryWrapper); + return locationHigh; + } } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/locationType/service/ILocationTypeService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/locationType/service/ILocationTypeService.java index d6f3a4e..9f3029b 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/locationType/service/ILocationTypeService.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/locationType/service/ILocationTypeService.java @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.wms.config.locationType.entity.LocationType; import org.jeecg.modules.wms.config.zone.entity.Zone; +import java.util.List; + /** * @Description: 库位类型 * @Author: jeecg-boot @@ -13,4 +15,6 @@ import org.jeecg.modules.wms.config.zone.entity.Zone; public interface ILocationTypeService extends IService<LocationType> { LocationType getLocationTypeByCode(String locationTypeCode, String wareohuseCode); + + List<LocationType> getLocationTypeListByZoneCode(String zoneCode, String warehouseCode); } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/locationType/service/impl/LocationTypeServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/locationType/service/impl/LocationTypeServiceImpl.java index 1c5cb4b..21dc1a3 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/locationType/service/impl/LocationTypeServiceImpl.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/locationType/service/impl/LocationTypeServiceImpl.java @@ -9,6 +9,8 @@ import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import java.util.List; + /** * @Description: 库位类型 * @Author: jeecg-boot @@ -26,4 +28,13 @@ public class LocationTypeServiceImpl extends ServiceImpl<LocationTypeMapper, Loc LocationType locationType = getOne(locationTypeMapperLambdaQueryWrapper); return locationType; } + + @Override + public List<LocationType> getLocationTypeListByZoneCode(String zoneCode, String warehouseCode) { + LambdaQueryWrapper<LocationType> locationTypeLambdaQueryWrapper = Wrappers.lambdaQuery(); + locationTypeLambdaQueryWrapper.eq(LocationType::getZoneCode, zoneCode) + .eq(LocationType::getWarehouseCode, warehouseCode); + List<LocationType> locationTypeList = list(locationTypeLambdaQueryWrapper); + return locationTypeList; + } } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/port/service/IPortService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/port/service/IPortService.java index a8264ab..cc54ac0 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/port/service/IPortService.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/port/service/IPortService.java @@ -15,4 +15,8 @@ import java.util.List; public interface IPortService extends IService<Port> { List<Port> getPortListByType(int type, String zoneCode, String warehouseCode); + + Port getPortByCode(String code, String zoneCode, String warehouseCode); + + Port getPortByCode(String code, String warehouseCode); } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/port/service/impl/PortServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/port/service/impl/PortServiceImpl.java index 226b9b2..265a825 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/port/service/impl/PortServiceImpl.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/port/service/impl/PortServiceImpl.java @@ -31,4 +31,23 @@ public class PortServiceImpl extends ServiceImpl<PortMapper, Port> implements IP List<Port> portList = list(portLambdaQueryWrapper); return portList; } + + @Override + public Port getPortByCode(String code, String zoneCode, String warehouseCode) { + LambdaQueryWrapper<Port> portLambdaQueryWrapper = Wrappers.lambdaQuery(); + portLambdaQueryWrapper.eq(Port::getCode, code) + .eq(Port::getZoneCode, zoneCode) + .eq(Port::getWarehouseCode, warehouseCode); + Port port = getOne(portLambdaQueryWrapper); + return port; + } + + @Override + public Port getPortByCode(String code, String warehouseCode) { + LambdaQueryWrapper<Port> portLambdaQueryWrapper = Wrappers.lambdaQuery(); + portLambdaQueryWrapper.eq(Port::getCode, code) + .eq(Port::getWarehouseCode, warehouseCode); + Port port = getOne(portLambdaQueryWrapper); + return port; + } } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/controller/BaseController.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/controller/BaseController.java index 5127a4d..75f71f5 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/controller/BaseController.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/controller/BaseController.java @@ -1,7 +1,11 @@ package org.jeecg.modules.wms.framework.controller; +import org.apache.commons.collections.MapUtils; import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.base.controller.JeecgController; +import java.util.HashMap; +import java.util.Map; import java.util.concurrent.Semaphore; /** @@ -9,28 +13,51 @@ import java.util.concurrent.Semaphore; */ public class BaseController { + //下发任务并发控制 + Map<String, Boolean> runningTaskMap = new HashMap<>(); + + //并发控制,一次只允许一个请求 + public Result handleQuest(String taskKey, JeecgController.MultiProcessListener multiProcessListener) { + Result result = null; + if(MapUtils.getBoolean(runningTaskMap, taskKey, false)) { + return Result.error("重复请求,清稍后重试"); + } + runningTaskMap.put(taskKey, true); + try { + result = multiProcessListener.doProcess(); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } finally { + runningTaskMap.put(taskKey, false); + } + return result; + } + Semaphore semaphore=new Semaphore(1); + //下发任务并发控制 + Map<String, Boolean> multiProcessMap = new HashMap<>(); - public Result handleMultiProcess(MultiProcessListener multiProcessListener) { + public Result handleMultiProcess(String taskKey, JeecgController.MultiProcessListener multiProcessListener) { Result result = null; int max_time = 30 * 1000; int now = 0; boolean avail = true; while(avail) { - int availablePermits = semaphore.availablePermits(); - if(availablePermits >0) { + boolean availablePermits = MapUtils.getBoolean(multiProcessMap, taskKey, false); + if(!availablePermits) { avail = false; try { - semaphore.acquire(1); + multiProcessMap.put(taskKey, true); result = multiProcessListener.doProcess(); } catch (Exception e) { e.printStackTrace(); - result = Result.error(e.getMessage()); + throw new RuntimeException(e); } finally { - semaphore.release(1); + multiProcessMap.put(taskKey, false); } } else { - result = Result.error("多线程处理异常"); + result = Result.error("多线程处理异常, 待处理现场太多,等待时间超出30秒"); try { now = now + 200; Thread.sleep(200); @@ -45,7 +72,4 @@ public class BaseController { return result; } - public interface MultiProcessListener { - Result doProcess(); - } } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/entity/InventoryTransaction.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/entity/InventoryTransaction.java index aabfa90..c62e886 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/entity/InventoryTransaction.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/entity/InventoryTransaction.java @@ -47,10 +47,14 @@ public class InventoryTransaction implements Serializable { @Excel(name = "容器编码", width = 15) @ApiModelProperty(value = "容器编码") private String containerCode; - /**库位编码*/ - @Excel(name = "库位编码", width = 15) - @ApiModelProperty(value = "库位编码") - private String locationCode; + /**起始库位编码*/ + @Excel(name = "起始库位编码", width = 15) + @ApiModelProperty(value = "起始库位编码") + private String fromLocationCode; + /**目标库位编码*/ + @Excel(name = "目标库位编码", width = 15) + @ApiModelProperty(value = "目标库位编码") + private String toLocationCode; /**交易类型*/ @Excel(name = "交易类型", width = 15, dicCode = "inventory_transaction_type") @Dict(dicCode = "inventory_transaction_type") @@ -99,6 +103,7 @@ public class InventoryTransaction implements Serializable { /**库存状态*/ @Excel(name = "库存状态", width = 15) @ApiModelProperty(value = "库存状态") + @Dict(dicCode = "inventory_status") private String inventoryStatus; /**数量*/ @Excel(name = "数量", width = 15) diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/IReceiptContainerHeaderService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/IReceiptContainerHeaderService.java index 02a84d0..857ae67 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/IReceiptContainerHeaderService.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/IReceiptContainerHeaderService.java @@ -37,5 +37,17 @@ public interface IReceiptContainerHeaderService extends IService<ReceiptContaine // 获取没有完成的入库组盘 List<ReceiptContainerHeader> getUnCompleteCombineList(); - boolean havaUnCompleteCombine(String containerCode, String warehouseCode); + boolean havaUnCompleteCombineByContainerCode(String containerCode, String warehouseCode); + + boolean havaUnCompleteCombineByLocationCode(String locationCode, String warehouseCode); + + boolean havaUnCompleteCombineByFromLocationCode(String fromLocationCode, String warehouseCode); + + boolean havaUnCompleteCombineByToLocationCode(String toLocationCode, String warehouseCode); + + /** + * 取消入库任务 + * @return + */ + boolean cancelReceiptTask(Integer receiptContainerHeaderId); } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java index a229f8c..229b23a 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java @@ -92,15 +92,10 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai } @Override - @Transactional + @Transactional(rollbackFor = ServiceException.class) public Result createReceiptTask(ReceiptContainerHeader receiptContainerHeader, String warehouseCode) { - int id = receiptContainerHeader.getId(); - receiptContainerHeader = this.getById(id); - if (receiptContainerHeader == null) { - return Result.error("id:" + id + "的入库组盘不存在!"); - } if (!receiptContainerHeader.getWarehouseCode().equals(warehouseCode)) { - return Result.error("id:" + id + "的入库组盘不能在" + warehouseCode + "仓库操作"); + return Result.error("id:" + receiptContainerHeader.getId() + "的入库组盘不能在" + warehouseCode + "仓库操作"); } String containerCode = receiptContainerHeader.getContainerCode(); Container container = containerService.getContainerByCode(containerCode, warehouseCode); @@ -110,27 +105,27 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai List<ReceiptContainerDetail> receiptContainerDetailList = receiptContainerDetailService.getReceiptContainerDetailListByHeaderId(receiptContainerHeader.getId()); if(receiptContainerDetailList.size() == 0) { - return Result.error("id:" + id + "的入库组盘,没有组盘明细,请先组盘!"); + return Result.error("id:" + receiptContainerHeader.getId() + "的入库组盘,没有组盘明细,请先组盘!"); } - boolean result = containerService.updateStatus(containerCode, + boolean success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_LOCK, warehouseCode); - if(!result) { + if(!success) { throw new ServiceException("更新容器状态失败"); } String fromLocationCode = receiptContainerHeader.getFromLocationCode(); String toLocaitonCode = receiptContainerHeader.getToLocationCode(); if(StringUtils.isNotEmpty(fromLocationCode)) { - result = locationService.updateStatus(fromLocationCode, + success = locationService.updateStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); - if(!result) { + if(!success) { throw new ServiceException("更新起始库位状态失败"); } } String zoneCode = null; if(StringUtils.isNotEmpty(toLocaitonCode)) { - result = locationService.updateStatus(toLocaitonCode, + success = locationService.updateStatus(toLocaitonCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); - if(!result) { + if(!success) { throw new ServiceException("更新目标库位状态失败"); } Location toLocation = locationService.getLocationByCode(toLocaitonCode, warehouseCode); @@ -148,8 +143,8 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai throw new ServiceException("入库组盘状态不是创建状态"); } receiptContainerHeader.setStatus(QuantityConstant.RECEIPT_CONTAINER_TASK); - result = receiptContainerHeaderService.updateById(receiptContainerHeader); - if(!result) { + success = receiptContainerHeaderService.updateById(receiptContainerHeader); + if(!success) { throw new ServiceException("更新入库组盘头状态失败"); } TaskHeader taskHeader = new TaskHeader(); @@ -163,9 +158,9 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai taskHeader.setReceiptContainerHeaderId(receiptContainerHeader.getId()); taskHeader.setWarehouseCode(warehouseCode); taskHeader.setZoneCode(zoneCode); - taskHeader.setToPort(receiptContainerHeader.getToPort()); - result = taskHeaderService.save(taskHeader); - if(!result) { + taskHeader.setToPortCode(receiptContainerHeader.getToPort()); + success = taskHeaderService.save(taskHeader); + if(!success) { throw new ServiceException("任务生成失败"); } List<TaskDetail> taskDetailList = new ArrayList<>(); @@ -196,24 +191,24 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_WAIT_SHELF); receiptDetailList.add(receiptDetail); } - result = taskDetailService.saveBatch(taskDetailList); - if(!result) { + success = taskDetailService.saveBatch(taskDetailList); + if(!success) { throw new ServiceException("任务详情生成失败"); } receiptContainerHeader.setStatus(QuantityConstant.RECEIPT_CONTAINER_TASK); - result = this.updateById(receiptContainerHeader); - if(!result) { + success = this.updateById(receiptContainerHeader); + if(!success) { throw new ServiceException("生成任务时,更新入库组盘头失败"); } - result = receiptDetailService.updateBatchById(receiptDetailList); - if(!result) { + success = receiptDetailService.updateBatchById(receiptDetailList); + if(!success) { throw new ServiceException("更新入库单明细失败"); } List<Integer> receiptIdList =receiptDetailList.stream() .map(ReceiptDetail::getReceiptId).distinct().collect(Collectors.toList()); for(Integer receiptId : receiptIdList) { - result = receiptHeaderService.updateReceiptHeaderStatus(receiptId); - if (!result) { + success = receiptHeaderService.updateReceiptHeaderStatus(receiptId); + if (!success) { throw new ServiceException("更新入库单明细失败"); } } @@ -241,7 +236,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai } @Override - public boolean havaUnCompleteCombine(String containerCode, String warehouseCode) { + public boolean havaUnCompleteCombineByContainerCode(String containerCode, String warehouseCode) { LambdaQueryWrapper<ReceiptContainerHeader> receiptContainerHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); receiptContainerHeaderLambdaQueryWrapper.eq(ReceiptContainerHeader::getContainerCode, containerCode) .eq(ReceiptContainerHeader::getWarehouseCode, warehouseCode) @@ -253,4 +248,87 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai return false; } + @Override + public boolean havaUnCompleteCombineByLocationCode(String locationCode, String warehouseCode) { + boolean success = havaUnCompleteCombineByFromLocationCode(locationCode, warehouseCode); + if(!success) { + success = havaUnCompleteCombineByToLocationCode(locationCode, warehouseCode); + } + return success; + } + + @Override + public boolean havaUnCompleteCombineByFromLocationCode(String fromLocationCode, String warehouseCode) { + LambdaQueryWrapper<ReceiptContainerHeader> receiptContainerHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); + receiptContainerHeaderLambdaQueryWrapper.eq(ReceiptContainerHeader::getFromLocationCode, fromLocationCode) + .eq(ReceiptContainerHeader::getWarehouseCode, warehouseCode) + .lt(ReceiptContainerHeader::getStatus, QuantityConstant.RECEIPT_CONTAINER_FINISHED); + ReceiptContainerHeader receiptContainerHeader = getOne(receiptContainerHeaderLambdaQueryWrapper); + if(receiptContainerHeader != null) { + return true; + } + return false; + } + + @Override + public boolean havaUnCompleteCombineByToLocationCode(String toLocationCode, String warehouseCode) { + LambdaQueryWrapper<ReceiptContainerHeader> receiptContainerHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); + receiptContainerHeaderLambdaQueryWrapper.eq(ReceiptContainerHeader::getToLocationCode, toLocationCode) + .eq(ReceiptContainerHeader::getWarehouseCode, warehouseCode) + .lt(ReceiptContainerHeader::getStatus, QuantityConstant.RECEIPT_CONTAINER_FINISHED); + ReceiptContainerHeader receiptContainerHeader = getOne(receiptContainerHeaderLambdaQueryWrapper); + if(receiptContainerHeader != null) { + return true; + } + return false; + } + + + @Override + @Transactional(rollbackFor = ServiceException.class) + public boolean cancelReceiptTask(Integer receiptContainerHeaderId) { + ReceiptContainerHeader receiptContainerHeader = getById(receiptContainerHeaderId); + if(receiptContainerHeader == null) { + return false; + } + int receiptContainerStatus = receiptContainerHeader.getStatus(); + if(receiptContainerStatus == QuantityConstant.RECEIPT_CONTAINER_TASK) { + throw new ServiceException("取消入库任务时, "); + } + receiptContainerHeader.setStatus(QuantityConstant.RECEIPT_CONTAINER_BUILD); + boolean success = receiptContainerHeaderService.updateById(receiptContainerHeader); + if(!success) { + throw new ServiceException("取消入库任务时, 更新入库组盘头失败"); + } + + List<ReceiptContainerDetail> receiptContainerDetailList = receiptContainerDetailService. + getReceiptContainerDetailListByHeaderId(receiptContainerHeader.getId()); + List<ReceiptDetail> receiptDetailList = new ArrayList<>(); + for(ReceiptContainerDetail receiptContainerDetail : receiptContainerDetailList) { + ReceiptDetail receiptDetail = receiptDetailService.getById(receiptContainerDetail.getReceiptDetailId()); + if(receiptDetail == null) { + throw new ServiceException("取消入库任务时, 没有找到入库单详情" + receiptContainerDetail.getReceiptDetailId()); + } + receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_RECEIVING); + receiptDetailList.add(receiptDetail); + } + if(receiptDetailList.size() != 0) { + success = receiptDetailService.updateBatchById(receiptDetailList); + if(!success) { + throw new ServiceException("取消入库任务时, 更新入库单详情头失败"); + } + + List<Integer> receiptIdList = receiptDetailList.stream() + .map(ReceiptDetail::getReceiptId).distinct().collect(Collectors.toList()); + for(Integer receiptId : receiptIdList) { + success = receiptHeaderService.updateReceiptHeaderStatus(receiptId); + if (!success) { + throw new ServiceException("更新入库单明细失败"); + } + } + } + + return true; + } + } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/controller/shipmentCombinationController.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/controller/shipmentCombinationController.java index 7de81ea..a317b3f 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/controller/shipmentCombinationController.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/controller/shipmentCombinationController.java @@ -122,6 +122,10 @@ public class shipmentCombinationController { return Result.error("选择分拣口时, 库区为空"); } int type = QuantityConstant.PORT_TYPE_PICK; + int tasktType = shipmentContainerHeader.getTaskType(); + if(tasktType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT || tasktType == QuantityConstant.TASK_TYPE_EMPTYSHIPMENT) { + type = QuantityConstant.PORT_TYPE_OUT; + } List<Port> portList = portService.getPortListByType(type, zoneCode, warehouseCode); if(portList.size() == 0) { return Result.error("选择分拣口时, 没有找到合适的分拣口"); diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java index 4f69058..dcba590 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java @@ -234,7 +234,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi if(!warehouseCode.equals(shipmentDetail.getWarehouseCode())) { return Result.error("配盘时,库存仓库编码和出库单仓库编码不一致"); } - boolean success = receiptContainerHeaderService.havaUnCompleteCombine(containerCode, warehouseCode); + boolean success = receiptContainerHeaderService.havaUnCompleteCombineByContainerCode(containerCode, warehouseCode); if(success) { return Result.error("配盘时, 容器:" + containerCode + " 已经用于入库组盘"); } @@ -500,7 +500,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi taskHeader.setWarehouseCode(warehouseCode); taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); taskHeader.setContainerCode(containerCode); - taskHeader.setToPort(shipmentContainerHeader.getToPort()); + taskHeader.setToPortCode(shipmentContainerHeader.getToPort()); taskHeader.setFromLocationCode(fromLocationCode); if(taskType == QuantityConstant.TASK_TYPE_SORTINGSHIPMENT) { taskHeader.setToLocationCode(toLocationCode); diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/IShipmentContainerHeaderService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/IShipmentContainerHeaderService.java index acff6a2..6fa938d 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/IShipmentContainerHeaderService.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/IShipmentContainerHeaderService.java @@ -28,6 +28,11 @@ public interface IShipmentContainerHeaderService extends IService<ShipmentContai public List<ShipmentContainerHeader> getUnCompleteCombineList(); - boolean havaUnCompleteCombine(String containerCode, String warehouseCode); + boolean havaUnCompleteCombineByContainerCode(String containerCode, String warehouseCode); + boolean havaUnCompleteCombineByLocationCode(String locationCode, String warehouseCode); + + boolean havaUnCompleteCombineByFromLocationCode(String fromLocationCode, String warehouseCode); + + boolean havaUnCompleteCombineByToLocationCode(String toLocationCode, String warehouseCode); } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/impl/ShipmentContainerHeaderServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/impl/ShipmentContainerHeaderServiceImpl.java index f2c1287..ddacf40 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/impl/ShipmentContainerHeaderServiceImpl.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/impl/ShipmentContainerHeaderServiceImpl.java @@ -68,10 +68,31 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont } @Override - public boolean havaUnCompleteCombine(String containerCode, String warehouseCode) { + public boolean havaUnCompleteCombineByContainerCode(String containerCode, String warehouseCode) { LambdaQueryWrapper<ShipmentContainerHeader> shipmentContainerHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); - shipmentContainerHeaderLambdaQueryWrapper - .eq(ShipmentContainerHeader::getContainerCode, containerCode) + shipmentContainerHeaderLambdaQueryWrapper.eq(ShipmentContainerHeader::getContainerCode, containerCode) + .eq(ShipmentContainerHeader::getWarehouseCode, warehouseCode) + .lt(ShipmentContainerHeader::getStatus, QuantityConstant.SHIPMENT_CONTAINER_FINISHED); + ShipmentContainerHeader shipmentContainerHeader = getOne(shipmentContainerHeaderLambdaQueryWrapper); + if(shipmentContainerHeader != null) { + return true; + } + return false; + } + + @Override + public boolean havaUnCompleteCombineByLocationCode(String locationCode, String warehouseCode) { + boolean success = havaUnCompleteCombineByFromLocationCode(locationCode, warehouseCode); + if(!success) { + success = havaUnCompleteCombineByToLocationCode(locationCode, warehouseCode); + } + return success; + } + + @Override + public boolean havaUnCompleteCombineByFromLocationCode(String fromLocationCode, String warehouseCode) { + LambdaQueryWrapper<ShipmentContainerHeader> shipmentContainerHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); + shipmentContainerHeaderLambdaQueryWrapper.eq(ShipmentContainerHeader::getFromLocationCode, fromLocationCode) .eq(ShipmentContainerHeader::getWarehouseCode, warehouseCode) .lt(ShipmentContainerHeader::getStatus, QuantityConstant.SHIPMENT_CONTAINER_FINISHED); ShipmentContainerHeader shipmentContainerHeader = getOne(shipmentContainerHeaderLambdaQueryWrapper); @@ -81,6 +102,18 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont return false; } + @Override + public boolean havaUnCompleteCombineByToLocationCode(String toLocationCode, String warehouseCode) { + LambdaQueryWrapper<ShipmentContainerHeader> shipmentContainerHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); + shipmentContainerHeaderLambdaQueryWrapper.eq(ShipmentContainerHeader::getToLocationCode, toLocationCode) + .eq(ShipmentContainerHeader::getWarehouseCode, warehouseCode) + .lt(ShipmentContainerHeader::getStatus, QuantityConstant.SHIPMENT_CONTAINER_FINISHED); + ShipmentContainerHeader shipmentContainerHeader = getOne(shipmentContainerHeaderLambdaQueryWrapper); + if(shipmentContainerHeader != null) { + return true; + } + return false; + } } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java index b33fba8..82468fa 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java @@ -1,5 +1,7 @@ package org.jeecg.modules.wms.task.taskHeader.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.jeecg.common.system.query.QueryGenerator; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -8,14 +10,28 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.util.JwtUtil; +import org.jeecg.modules.wms.config.container.entity.Container; +import org.jeecg.modules.wms.config.container.service.IContainerService; +import org.jeecg.modules.wms.config.location.entity.Location; +import org.jeecg.modules.wms.config.location.service.ILocationService; +import org.jeecg.modules.wms.config.port.entity.Port; +import org.jeecg.modules.wms.config.port.service.IPortService; +import org.jeecg.modules.wms.config.zone.entity.Zone; +import org.jeecg.modules.wms.config.zone.service.IZoneService; +import org.jeecg.modules.wms.framework.Convert; import org.jeecg.modules.wms.framework.controller.BaseController; +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; import org.jeecg.modules.wms.task.taskHeader.entity.TaskDetail; import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; import org.jeecg.modules.wms.task.taskHeader.service.ITaskDetailService; import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; import org.jeecg.utils.StringUtils; +import org.jeecg.utils.constant.QuantityConstant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.ModelAndView; @@ -55,6 +71,14 @@ public class TaskHeaderController extends JeecgController<TaskHeader, ITaskHeade @Autowired private ITaskDetailService taskDetailService; + @Resource + private ILocationService locationService; + @Resource + private IContainerService containerService; + @Resource + private IPortService portService; + @Resource + private IZoneService zoneService; /*---------------------------------主表处理-begin-------------------------------------*/ @@ -316,6 +340,31 @@ public class TaskHeaderController extends JeecgController<TaskHeader, ITaskHeade } /** + * 取消任务 + */ + @AutoLog(value = "任务表-取消任务") + @ApiOperation(value="任务表-取消任务", notes="任务表-取消任务") + @PostMapping( "/cancelTask") + @ResponseBody + public Result cancelTask(String ids) { + if (StringUtils.isEmpty(ids)) { + return Result.error("taskId不能为空"); + } + Result result = null; + Integer[] idList = Convert.toIntArray(ids); + for (int taskId : idList) { + result = handleMultiProcess("cancelTask", new MultiProcessListener() { + @Override + public Result doProcess() { + Result result = taskHeaderService.cancelTask(taskId); + return result; + } + }); + } + return result; + } + + /** * 执行任务 */ @AutoLog(value = "任务表-执行任务") @@ -337,4 +386,258 @@ public class TaskHeaderController extends JeecgController<TaskHeader, ITaskHeade return result; } } + + /** + * 创建空托入库任务 + */ + @AutoLog(value = "任务表-创建空托入库任务") + @ApiOperation(value="任务表-创建空托入库任务", notes="任务表-创建空托入库任务") + @PostMapping( "/createEmptyIn") + public Result createEmptyIn(@RequestBody TaskHeader taskHeader, HttpServletRequest req) { + String contaienrCode = taskHeader.getContainerCode(); + String toLocationCode = taskHeader.getToLocationCode(); + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); + Result result = handleMultiProcess("createEmptyIn", new MultiProcessListener() { + @Override + public Result doProcess() { + Result result = taskHeaderService.createEmptyIn(contaienrCode, + toLocationCode, warehouseCode); + return result; + } + }); + return result; + } + + /** + * 创建空托出库任务 + */ + @AutoLog(value = "任务表-创建空托出库任务") + @ApiOperation(value="任务表-创建空托出库任务", notes="任务表-创建空托出库任务") + @PostMapping( "/createEmptyOut") + public Result createEmptyOut(@RequestBody TaskHeader taskHeader, HttpServletRequest req) { + String contaienrCode = taskHeader.getContainerCode(); + String toPortCode = taskHeader.getToPortCode(); + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); + Result result = handleMultiProcess("createEmptyOut", new MultiProcessListener() { + @Override + public Result doProcess() { + Result result = taskHeaderService.createEmptyOut(contaienrCode, + toPortCode, warehouseCode); + return result; + } + }); + return result; + } + + /** + * 创建移库任务 + */ + @AutoLog(value = "任务表-创建移库任务") + @ApiOperation(value="任务表-创建移库任务", notes="任务表-创建移库任务") + @PostMapping( "/createTransferTask") + public Result createTransferTask(@RequestBody TaskHeader taskHeader, HttpServletRequest req) { + String fromLocationCode = taskHeader.getFromLocationCode(); + String toLocationCode = taskHeader.getToLocationCode(); + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); + Result result = handleMultiProcess("createTransferTask", new MultiProcessListener() { + @Override + public Result doProcess() { + Result result = taskHeaderService.createTransferTask(fromLocationCode, + toLocationCode, warehouseCode); + return result; + } + }); + return result; + } + + /** + * 创建出库查看任务 + */ + @AutoLog(value = "任务表-创建出库查看任务") + @ApiOperation(value="任务表-创建出库查看任务", notes="任务表-创建出库查看任务") + @PostMapping( "/createCheckOutTask") + public Result createCheckOutTask(@RequestBody TaskHeader taskHeader, HttpServletRequest req) { + String containerCode = taskHeader.getContainerCode(); + String toPortCode = taskHeader.getToPortCode(); + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); + Result result = handleMultiProcess("createCheckOutTask", new MultiProcessListener() { + @Override + public Result doProcess() { + Result result = taskHeaderService.createCheckOutTask(containerCode, + toPortCode, warehouseCode); + return result; + } + }); + return result; + } + + /** + * 创建跨站任务 + */ + @AutoLog(value = "任务表-创建跨站任务") + @ApiOperation(value="任务表-创建跨站任务", notes="任务表-创建跨站任务") + @PostMapping( "/createOverStationTask") + public Result createOverStationTask(@RequestBody TaskHeader taskHeader, HttpServletRequest req) { + String containerCode = taskHeader.getContainerCode(); + String fromPortCode = taskHeader.getFromPortCode(); + String toPortCode = taskHeader.getToPortCode(); + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); + Result result = handleMultiProcess("createOverStationTask", new MultiProcessListener() { + @Override + public Result doProcess() { + Result result = taskHeaderService.createOverStationTask(containerCode, + fromPortCode, toPortCode, warehouseCode); + return result; + } + }); + return result; + } + + /** + * 创建空托盘组入库 + */ + @AutoLog(value = "任务表-创建空托盘组入库") + @ApiOperation(value="任务表-创建空托盘组入库", notes="任务表-创建空托盘组入库") + @PostMapping( "/createManyEmptyIn") + public Result createManyEmptyIn(@RequestBody TaskHeader taskHeader, HttpServletRequest req) { + String containerCode = taskHeader.getContainerCode(); + String toLocationCode = taskHeader.getToLocationCode(); + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); + Result result = handleMultiProcess("createManyEmptyIn", new MultiProcessListener() { + @Override + public Result doProcess() { + Result result = taskHeaderService.createManyEmptyIn(containerCode, toLocationCode, warehouseCode); + return result; + } + }); + return result; + } + + /** + * 创建空托盘组出库 + */ + @AutoLog(value = "任务表-创建空托盘组出库") + @ApiOperation(value="任务表-创建空托盘组出库", notes="任务表-创建空托盘组出库") + @PostMapping( "/createManyEmptyOut") + public Result createManyEmptyOut(@RequestBody TaskHeader taskHeader, HttpServletRequest req) { + String containerCode = taskHeader.getContainerCode(); + String toPortCode = taskHeader.getToPortCode(); + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); + Result result = handleMultiProcess("createManyEmptyOut", new MultiProcessListener() { + @Override + public Result doProcess() { + Result result = taskHeaderService.createManyEmptyOut(containerCode, toPortCode, warehouseCode); + return result; + } + }); + return result; + } + + /** + * 选择整出口 + * @return + */ + @ApiOperation(value="任务表-选择整出口", notes="任务表-选择整出口") + @PostMapping("/selectOutPort") + @ResponseBody + public Result selectOutPort(@RequestBody TaskHeader taskHeader, HttpServletRequest req) { + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); + String containerCode = taskHeader.getContainerCode(); + if(StringUtils.isEmpty(containerCode)) { + return Result.error("选择整出口, 托盘号为空"); + } + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if(container == null) { + return Result.error("选择整出口, 没有找到托盘" + containerCode); + } + String fromLocationCode = container.getLocationCode(); + if(StringUtils.isEmpty(fromLocationCode)) { + return Result.error("选择整出口, 起始库位号为空"); + } + Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode); + if(fromLocation == null) { + return Result.error("选择整出口, 根据库位号" + fromLocationCode + " 没有找到库位"); + } + String zoneCode = fromLocation.getZoneCode(); + if(StringUtils.isEmpty(zoneCode)) { + return Result.error("选择整出口, 库区编码为空"); + } + Zone zone = zoneService.getZoneByCode(zoneCode, warehouseCode); + if(zone == null) { + return Result.error("选择整出口, 库区为空"); + } + int type = QuantityConstant.PORT_TYPE_OUT; + List<Port> portList = portService.getPortListByType(type, zoneCode, warehouseCode); + if(portList.size() == 0) { + return Result.error("选择整出口, 没有找到合适的整出口"); + } + return Result.OK(portList); + } + + /** + * 选择分拣口 + * @return + */ + @ApiOperation(value="任务表-选择分拣口", notes="任务表-选择分拣口") + @PostMapping("/selectPickPort") + @ResponseBody + public Result selectPickPort(@RequestBody TaskHeader taskHeader, HttpServletRequest req) { + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); + String containerCode = taskHeader.getContainerCode(); + if(StringUtils.isEmpty(containerCode)) { + return Result.error("选择分拣口, 托盘号为空"); + } + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if(container == null) { + return Result.error("选择分拣口, 没有找到托盘" + containerCode); + } + String fromLocationCode = container.getLocationCode(); + if(StringUtils.isEmpty(fromLocationCode)) { + return Result.error("选择整出口, 起始库位号为空"); + } + Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode); + if(fromLocation == null) { + return Result.error("选择分拣口, 根据库位号" + fromLocationCode + " 没有找到库位"); + } + String zoneCode = fromLocation.getZoneCode(); + if(StringUtils.isEmpty(zoneCode)) { + return Result.error("选择分拣口, 库区编码为空"); + } + Zone zone = zoneService.getZoneByCode(zoneCode, warehouseCode); + if(zone == null) { + return Result.error("选择分拣口, 库区为空"); + } + int type = QuantityConstant.PORT_TYPE_PICK; + List<Port> portList = portService.getPortListByType(type, zoneCode, warehouseCode); + if(portList.size() == 0) { + return Result.error("选择分拣口, 没有找到合适的分拣口"); + } + return Result.OK(portList); + } + + /** + * 选择站台 + * @return + */ + @ApiOperation(value="任务表-选择站台", notes="任务表-选择站台") + @PostMapping("/selectPort") + @ResponseBody + public Result selectPort(@RequestBody TaskHeader taskHeader, HttpServletRequest req) { + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); + String containerCode = taskHeader.getContainerCode(); + if(StringUtils.isEmpty(containerCode)) { + return Result.error("选择站台, 托盘号为空"); + } + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if(container == null) { + return Result.error("选择站台, 没有找到托盘" + containerCode); + } + LambdaQueryWrapper<Port> portLambdaQueryWrapper = Wrappers.lambdaQuery(); + portLambdaQueryWrapper.eq(Port::getWarehouseCode, warehouseCode); + List<Port> portList = portService.list(portLambdaQueryWrapper); + if(portList.size() == 0) { + return Result.error("选择站台, 没有找到合适的选择站台"); + } + return Result.OK(portList); + } } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/entity/TaskHeader.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/entity/TaskHeader.java index 3593dcd..0464bed 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/entity/TaskHeader.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/entity/TaskHeader.java @@ -97,11 +97,11 @@ public class TaskHeader implements Serializable { /**起始出入口*/ @Excel(name = "起始出入口", width = 15) @ApiModelProperty(value = "起始出入口") - private String fromPort; + private String fromPortCode; /**目标出入口*/ @Excel(name = "目标出入口", width = 15) @ApiModelProperty(value = "目标出入口") - private String toPort; + private String toPortCode; @Excel(name = "重量", width = 15) @ApiModelProperty(value = "重量") private Integer weight; diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java index 9a929d7..d99508e 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java @@ -27,18 +27,156 @@ public interface ITaskHeaderService extends IService<TaskHeader> { */ void delBatchMain (Collection<? extends Serializable> idList); + /** + * 判断旁边库位是否有未完成的任务,如果有 + * @param location + * @return + */ boolean haveUncompleteTaskInNear(Location location); - Result createTransferTask(String fromLocationCode, String toLocationCode, String warehouseCode); - - + /** + * 通过起始库位号,获取任务信息 + * @param fromLocationCode + * @param warehouseCode + * @return + */ TaskHeader getUnCompleteTaskByFromLocationCode(String fromLocationCode, String warehouseCode); + /** + * 通过目标库位号,获取任务信息 + * @param toLocationCode + * @param warehouseCode + * @return + */ TaskHeader getUnCompleteTaskByToLocationCode(String toLocationCode, String warehouseCode); + /** + * 通过库位号,获取任务信息 + * @param locationCode + * @param warehouseCode + * @return + */ TaskHeader getUnCompleteTaskByLocationCode(String locationCode, String warehouseCode); + /** + * 通过托盘号,获取未完成任务信息 + * @param containerCode + * @param warehouseCode + * @return + */ + TaskHeader getUnCompleteTaskByContainerCode(String containerCode, String warehouseCode); + + /** + * 通过前置任务号,获取未完成任务信息 + * @param preTaskNo + * @param warehouseCode + * @return + */ + TaskHeader getUnCompleteTaskByPreTaskNo(int preTaskNo, String warehouseCode); + + /** + * 完成WMS任务 + * @param taskId + * @return + */ Result completeTaskByWMS(Integer taskId); + /** + * 取消WMS任务 + * @param taskId + * @return + */ + Result cancelTask(Integer taskId); + + /** + * 下发任务给WCS + * @param taskId + * @return + */ Result sendTaskToWcs(Integer taskId); + + /** + * 创建空托盘入库任务 + * @param containerCode + * @param toLocationCode + * @param warehouseCode + * @return + */ + Result createEmptyIn(String containerCode, String toLocationCode, String warehouseCode); + + /** + * 创建空托盘出库任务 + * @param containerCode + * @param toPortCode + * @param warehouseCode + * @return + */ + Result createEmptyOut(String containerCode, String toPortCode, String warehouseCode); + + /** + * 创建移库任务 + * @param fromLocationCode + * @param toLocationCode + * @param warehouseCode + * @return + */ + Result createTransferTask(String fromLocationCode, String toLocationCode, String warehouseCode); + + /** + * 创建出库查看任务 + * @param containerCode + * @param toPortCode + * @param warehouseCode + * @return + */ + Result createCheckOutTask(String containerCode, String toPortCode, String warehouseCode); + + /** + * 创建跨站任务任务 + * @param containerCode + * @param fromPortCode + * @param toPortCode + * @param warehouseCode + * @return + */ + Result createOverStationTask(String containerCode, String fromPortCode, String toPortCode, String warehouseCode); + + /** + * WCS申请空托盘组入库 + * @param containerCode + * @param zoneCode + * @param roadWay + * @parap height + * @param warehouseCode + * @return + */ + Result createManyEmptyInTask(String containerCode, String zoneCode, String roadWay, String height, String warehouseCode); + + /** + * 创建空托盘组入库 + * @param containerCode + * @param toLocationCode + * @param warehouseCode + * @return + */ + Result createManyEmptyIn(String containerCode, String toLocationCode, String warehouseCode); + + /** + * WCS申请空托盘组出库 + * @param zoneCode + * @param toPortCode + * @param warehouseCode + * @return + */ + Result createManyEmptyOutTask(String zoneCode, String toPortCode, String warehouseCode); + + /** + * 创建空托盘组出库 + * @param containerCode + * @param toPortCode + * @param warehouseCode + * @return + */ + Result createManyEmptyOut(String containerCode, String toPortCode, String warehouseCode); + } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java index 5c0fdef..bb71d34 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java @@ -5,19 +5,30 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.wms.api.wcs.service.LocationAllocationService; import org.jeecg.modules.wms.api.wcs.service.WcsService; import org.jeecg.modules.wms.config.container.entity.Container; import org.jeecg.modules.wms.config.container.service.IContainerService; import org.jeecg.modules.wms.config.location.entity.Location; import org.jeecg.modules.wms.config.location.service.ILocationService; +import org.jeecg.modules.wms.config.locationHigh.entity.LocationHigh; +import org.jeecg.modules.wms.config.locationHigh.service.ILocationHighService; +import org.jeecg.modules.wms.config.locationType.entity.LocationType; +import org.jeecg.modules.wms.config.locationType.service.ILocationTypeService; import org.jeecg.modules.wms.config.material.entity.Material; import org.jeecg.modules.wms.config.material.service.IMaterialService; +import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; +import org.jeecg.modules.wms.config.port.entity.Port; +import org.jeecg.modules.wms.config.port.service.IPortService; +import org.jeecg.modules.wms.config.zone.entity.Zone; +import org.jeecg.modules.wms.config.zone.service.IZoneService; import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; import org.jeecg.modules.wms.inventory.inventoryTransaction.service.IInventoryTransactionService; +import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerHeaderService; import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService; @@ -45,10 +56,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.io.Serializable; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Collection; +import java.util.*; import java.util.stream.Collectors; /** @@ -96,6 +104,18 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea private IMaterialService materialService; @Resource private WcsService wcsService; + @Resource + private IPortService portService; + @Resource + private IParameterConfigurationService parameterConfigurationService; + @Resource + private IZoneService zoneService; + @Resource + private ILocationTypeService locationTypeService; + @Resource + private ILocationHighService locationHighService; + @Resource + private LocationAllocationService allocationService; @Override @Transactional @@ -134,55 +154,76 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea @Override @Transactional(rollbackFor = Exception.class) public Result createTransferTask(String fromLocationCode, String toLocationCode, String warehouseCode) { + if(StringUtils.isEmpty(fromLocationCode)) { + return Result.error("创建移库任务时,起始库位为空"); + } + if(StringUtils.isEmpty(toLocationCode)) { + return Result.error("创建移库任务时,目标库位为空"); + } Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode); Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); Integer preTaskNo = 0; // 1. 判断起点库位和终点库位是否满足移库条件 if(fromLocation == null) { - return Result.error("源库位:" + fromLocationCode + "未找到"); + return Result.error("创建移库任务时,起始库位:" + fromLocationCode + "未找到"); } if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(fromLocation.getStatus())) { - return Result.error("源库位:" + fromLocationCode + "状态非空闲"); + return Result.error("创建移库任务时,起始库位:" + fromLocationCode + "状态非空闲"); } if (StringUtils.isEmpty(fromLocation.getContainerCode())) { - return Result.error("源库位:" + fromLocationCode + "不存在托盘"); + return Result.error("创建移库任务时,起始库位:" + fromLocationCode + "不存在托盘"); } //这里增加组盘校验,如果此托盘存在未完成的组盘数据,则不能移库 //校验入库组盘 -// if (inventoryHeaderService.getUncompleteReceiptContainer(fromLocationCode, warehouseCode) > 0) { -// return Result.error("源库位:" + fromLocationCode + "存在入库组盘,不能移库"); -// } -// if (inventoryHeaderService.getUncompleteShipmentContainer(toLocationCode, warehouseCode) > 0) { -// return Result.error("源库位:" + toLocationCode + "存在出库组盘,不能移库"); -// } + if (receiptContainerHeaderService.havaUnCompleteCombineByLocationCode(fromLocationCode, warehouseCode)) { + return Result.error("创建移库任务时,起始库位:" + fromLocationCode + "存在入库组盘,不能移库"); + } + //校验出库组盘 + if (shipmentContainerHeaderService.havaUnCompleteCombineByLocationCode(fromLocationCode, warehouseCode)) { + return Result.error("创建移库任务时,起始库位:" + fromLocationCode + "存在出库组盘,不能移库"); + } + if (toLocation == null) { - return Result.error("目标库位:" + toLocationCode + "未找到"); + return Result.error("创建移库任务时,目标库位:" + toLocationCode + "未找到"); } if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(toLocation.getStatus())) { - return Result.error("目标库位:" + toLocationCode + "状态非空闲"); + return Result.error("创建移库任务时,目标库位:" + toLocationCode + "状态非空闲"); } if (StringUtils.isNotEmpty(toLocation.getContainerCode())) { - return Result.error("目标库位:" + toLocationCode + "存在托盘"); + return Result.error("创建移库任务时,目标库位:" + toLocationCode + "存在托盘"); + } + //校验入库组盘 + if (receiptContainerHeaderService.havaUnCompleteCombineByLocationCode(toLocationCode, warehouseCode)) { + return Result.error("创建移库任务时,目标库位:" + toLocationCode + "存在入库组盘,不能移库"); + } + //校验出库组盘 + if (shipmentContainerHeaderService.havaUnCompleteCombineByLocationCode(toLocationCode, warehouseCode)) { + return Result.error("创建移库任务时, 目标库位:" + toLocationCode + "存在出库组盘,不能移库"); } if (taskHeaderService.haveUncompleteTaskInNear(toLocation)) { - return Result.error("目标库位:" + toLocationCode + "旁边存在任务,请完成任务以后再分配"); + return Result.error("创建移库任务时,目标库位:" + toLocationCode + "旁边存在任务,请完成任务以后再分配"); } + if(!fromLocation.getRoadWay().equals(toLocation.getRoadWay())) { - return Result.error("目标库位和源库位不在同一个巷道"); + return Result.error("创建移库任务时,目标库位和源库位不在同一个巷道"); } if(!fromLocation.getHigh().equals(toLocation.getHigh())) { - return Result.error("目标库位和源库位高度不一样"); + return Result.error("创建移库任务时,目标库位和源库位高度不一样"); } if(!fromLocation.getLocationTypeCode().equals(toLocation.getLocationTypeCode())) { - return Result.error("目标库位和源库位库位类型不一样"); + return Result.error("创建移库任务时,目标库位和源库位库位类型不一样"); } if(!fromLocation.getZoneCode().equals(toLocation.getZoneCode())) { - return Result.error("目标库位和源库位不在同一个区域"); + return Result.error("创建移库任务时,目标库位和源库位不在同一个区域"); } + // 2. 记住移库前的容器类型,因为空托盘组无法区分 Container container = containerService.getContainerByCode(fromLocation.getContainerCode(), warehouseCode); container.setLastStatus(container.getStatus()); - containerService.updateById(container); + boolean success = containerService.updateById(container); + if(!success) { + throw new ServiceException("创建移库任务时,更新容器状态失败,容器号" + fromLocation.getContainerCode()); + } // 3. 判断源库位旁边有托盘但是没有任务,那么不允许移库 if(fromLocation.getRowFlag() == QuantityConstant.ROW_OUT) { @@ -194,12 +235,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea if(taskHeader != null) { preTaskNo = taskHeader.getId(); } else { - return Result.error("源库位:" + fromLocationCode + "旁边库位有托盘无法移库"); + return Result.error("创建移库任务时,起始库位:" + fromLocationCode + "旁边库位有托盘无法移库"); } } else { TaskHeader taskHeader = getUnCompleteTaskByToLocationCode(locationCode, warehouseCode); if(taskHeader != null) { - return Result.error("源库位:" + fromLocationCode + "旁边库位有任务无法移库"); + return Result.error("创建移库任务时,起始库位:" + fromLocationCode + "旁边库位有任务无法移库"); } } } @@ -208,73 +249,384 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea TaskHeader taskHeader = new TaskHeader(); taskHeader.setWarehouseCode(warehouseCode); taskHeader.setTaskType(QuantityConstant.TASK_TYPE_TRANSFER); - taskHeader.setInnernalTaskType(QuantityConstant.TASK_INTENERTYPE_WORK); + taskHeader.setInnernalTaskType(QuantityConstant.TASK_INTENERTYPE_TRANSFER_POSITION); taskHeader.setZoneCode(fromLocation.getZoneCode()); taskHeader.setContainerCode(fromLocation.getContainerCode()); taskHeader.setFromLocationCode(fromLocationCode); taskHeader.setToLocationCode(toLocationCode); taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); taskHeader.setPreTaskNo(preTaskNo); - boolean result = taskHeaderService.save(taskHeader); - if(!result) { - throw new ServiceException("创建任务失败"); + success = taskHeaderService.save(taskHeader); + if(!success) { + throw new ServiceException("创建移库任务时,创建任务失败"); } - result = locationService.updateStatus(fromLocationCode, + success = locationService.updateStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); - if(!result) { - throw new ServiceException("库位“ + fromLocationCode + “更新失败"); + if(!success) { + throw new ServiceException("创建移库任务时, 库位" + fromLocationCode + "更新失败"); } - result = locationService.updateStatus(toLocationCode, + success = locationService.updateStatus(toLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); - if(!result) { - throw new ServiceException("库位“ + toLocationCode + “更新失败"); + if(!success) { + throw new ServiceException("创建移库任务时, 库位" + toLocationCode + "更新失败"); } - result = containerService.updateLocationCodeAndStatus(fromLocation.getContainerCode(), + success = containerService.updateLocationCodeAndStatus(fromLocation.getContainerCode(), fromLocationCode, QuantityConstant.STATUS_CONTAINER_LOCK, warehouseCode); - if(!result) { - throw new ServiceException("容器“ + fromLocation.getContainerCode() + “更新失败"); - } - -// LambdaUpdateWrapper<InventoryDetail> detailLambdaUpdateWrapper = Wrappers.lambdaUpdate(); -// detailLambdaUpdateWrapper.eq(InventoryDetail::getWarehouseCode, warehouseCode); -// detailLambdaUpdateWrapper.eq(InventoryDetail::getLocationCode, sourceLocationCode); -// List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(detailLambdaUpdateWrapper); -// for (InventoryDetail inventoryDetail : inventoryDetailList) { -// TaskDetail taskDetail = new TaskDetail(); -// taskDetail.setTaskId(taskHeader.getId()); -// taskDetail.setTaskType(taskHeader.getTaskType()); -// taskDetail.setInternalTaskType(taskHeader.getInternalTaskType()); -// taskDetail.setWarehouseCode(taskHeader.getWarehouseCode());; -// taskDetail.setCompanyCode(inventoryDetail.getCompanyCode()); -// taskDetail.setMaterialCode(inventoryDetail.getMaterialCode()); -// taskDetail.setMaterialName(inventoryDetail.getMaterialName()); -// taskDetail.setMaterialSpec(inventoryDetail.getMaterialSpec()); -// taskDetail.setMaterialUnit(inventoryDetail.getMaterialUnit()); -// taskDetail.setQty(inventoryDetail.getQty()); -// taskDetail.setFromLocation(inventoryDetail.getLocationCode()); -// taskDetail.setToLocation(desLocationCode); -// taskDetail.setContainerCode(inventoryDetail.getContainerCode()); -// taskDetail.setStatus(QuantityConstant.TASK_STATUS_BUILD); -// taskDetail.setReferenceCode(inventoryDetail.getReferCode()); -// taskDetail.setAttribute1(inventoryDetail.getAttribute1()); -// taskDetail.setAttribute2(inventoryDetail.getAttribute2()); -// taskDetail.setAttribute3(inventoryDetail.getAttribute3()); -// taskDetail.setBatch(inventoryDetail.getBatch()); -// taskDetail.setLot(inventoryDetail.getLot()); -// taskDetail.setProjectNo(inventoryDetail.getProjectNo()); -// taskDetail.setManufactureDate(inventoryDetail.getManufactureDate()); -// taskDetail.setExpirationDate(inventoryDetail.getExpirationDate()); -// taskDetail.setAgingDate(inventoryDetail.getAgingDate()); -// taskDetail.setInventorySts(inventoryDetail.getInventorySts()); -// taskDetail.setFromInventoryId(inventoryDetail.getId()); -// taskDetail.setToInventoryId(inventoryDetail.getId()); -// if (!taskDetailService.save(taskDetail) || !inventoryDetailService.updateById(inventoryDetail)) { -// throw new ServiceException("创建任务失败"); -// } -// } - - return Result.OK(taskHeader.getId()); + if(!success) { + throw new ServiceException("创建移库任务时,容器" + fromLocation.getContainerCode() + "更新失败"); + } + return Result.OK("创建移库任务成功"); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result createCheckOutTask(String containerCode, String toPortCode, String warehouseCode) { + if(StringUtils.isEmpty(containerCode)) { + return Result.error("创建出库查看任务时,容器编码为空"); + } + if(StringUtils.isEmpty(toPortCode)) { + return Result.error("创建出库查看任务时,目标站台号为空"); + } + if(StringUtils.isEmpty(warehouseCode)) { + return Result.error("创建出库查看任务时,仓库编码为空"); + } + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if(container == null) { + return Result.error("创建出库查看任务时,容器为空"); + } + String fromLocationCode = container.getLocationCode(); + if(StringUtils.isEmpty(fromLocationCode)) { + return Result.error("创建出库查看任务时,容器不在库位上"); + } + Location location = locationService.getLocationByCode(fromLocationCode, warehouseCode); + if(location == null) { + return Result.error("创建出库查看任务时,没有找到库位:" + fromLocationCode); + } + String zoneCode = location.getZoneCode(); + Port port = portService.getPortByCode(toPortCode, zoneCode, warehouseCode); + if(port == null) { + return Result.error("创建出库查看任务时,没有找到出库口:" + toPortCode); + } + boolean success = false; + LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); + inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getContainerCode, containerCode) + .eq(InventoryDetail::getWarehouseCode, warehouseCode) + .eq(InventoryDetail::getLocationCode, fromLocationCode); + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); + if(inventoryDetailList.size() != 0) { + for (InventoryDetail inventoryDetail : inventoryDetailList) { + inventoryDetail.setTaskQty(inventoryDetail.getQty()); + } + success = inventoryDetailService.updateBatchById(inventoryDetailList); + if (!success) { + throw new ServiceException("创建出库查看任务时,更新库存详情失败"); + } + } + success = locationService.updateStatus(fromLocationCode, + QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); + if(!success) { + throw new ServiceException("创建出库查看任务时,更新库位状态失败"); + } + success = containerService.updateStatus(containerCode, + QuantityConstant.STATUS_CONTAINER_LOCK, warehouseCode); + if(!success) { + throw new ServiceException("创建出库查看任务时,更新容器状态失败"); + } + TaskHeader taskHeader = new TaskHeader(); + taskHeader.setWarehouseCode(warehouseCode); + taskHeader.setTaskType(QuantityConstant.TASK_TYPE_CHECK_OUT); + taskHeader.setInnernalTaskType(QuantityConstant.TASK_INTENERTYPE_CYCLECOUNT); + taskHeader.setContainerCode(containerCode); + taskHeader.setZoneCode(zoneCode); + taskHeader.setFromLocationCode(fromLocationCode); + taskHeader.setToPortCode(toPortCode); + String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_TASK_LOCATION); + int taskLocationRule = Integer.parseInt(value); + if (taskLocationRule == QuantityConstant.RULE_TASK_SET_LOCATION) { + taskHeader.setToLocationCode(fromLocationCode); + } + taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); + success = taskHeaderService.save(taskHeader); + if(!success) { + throw new ServiceException("创建出库查看任务时, 创建任务失败"); + } + return Result.OK("创建出库查看任务成功"); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result createOverStationTask(String containerCode, String fromPortCode, + String toPortCode, String warehouseCode) { + if(StringUtils.isEmpty(containerCode)) { + return Result.error("创建跨站任务时,容器号为空"); + } + if(StringUtils.isEmpty(fromPortCode)) { + return Result.error("创建跨站任务时,起始站台号为空"); + } + if(StringUtils.isEmpty(toPortCode)) { + return Result.error("创建跨站任务时,目标站台号为空"); + } + if(StringUtils.isEmpty(warehouseCode)) { + return Result.error("创建跨站任务时,仓库编码为空"); + } + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if(container == null) { + return Result.error("创建跨站任务时,容器为空"); + } + if(!container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_EMPTY)) { + return Result.error("创建跨站任务时,容器状态不为空托盘"); + } + Port fromPort = portService.getPortByCode(fromPortCode, warehouseCode); + if(fromPort == null) { + return Result.error("创建跨站任务时,起始站台为空"); + } + Port toPort = portService.getPortByCode(toPortCode, warehouseCode); + if(toPort == null) { + return Result.error("创建跨站任务时,目标站台为空"); + } + + TaskHeader taskHeader = new TaskHeader(); + taskHeader.setWarehouseCode(warehouseCode); + taskHeader.setContainerCode(containerCode); + taskHeader.setTaskType(QuantityConstant.TASK_TYPE_OVER_STATION); + taskHeader.setInnernalTaskType(QuantityConstant.TASK_INTENERTYPE_TRANSFER_POSITION); + taskHeader.setFromPortCode(fromPortCode); + taskHeader.setToPortCode(toPortCode); + taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); + boolean success = taskHeaderService.save(taskHeader); + if(!success) { + return Result.error("创建跨站任务时, 创建任务失败"); + } + success = containerService.updateStatus(containerCode, + QuantityConstant.STATUS_CONTAINER_LOCK, warehouseCode); + if(!success) { + return Result.error("创建跨站任务时, 更新容器状态失败"); + } + return Result.ok("创建跨站任务成功"); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result createManyEmptyInTask(String containerCode, String zoneCode, + String roadWay, String height, String warehouseCode) { + if(StringUtils.isEmpty(containerCode)) { + return Result.error("创建空托盘组入库任务时,容器号为空"); + } + if(StringUtils.isEmpty(zoneCode)) { + return Result.error("创建空托盘组入库任务时,库区编码为空"); + } + if(StringUtils.isEmpty(roadWay)) { + return Result.error("创建空托盘组入库任务时,巷道为空"); + } + if(StringUtils.isEmpty(height)) { + return Result.error("创建空托盘组入库任务时,高度值为空"); + } + if(StringUtils.isEmpty(height)) { + return Result.error("创建空托盘组入库任务时,仓库编码为空"); + } + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if(container == null) { + return Result.error("创建空托盘组入库任务时,没有找到容器"); + } + if (StringUtils.isNotEmpty(container.getLocationCode())) { + return Result.error("容器已在库位" + container.getLocationCode() + "上"); + } + List<Integer> roadWays = new ArrayList<>(); + String[] strList = roadWay.split(","); + for(String str : strList) { + roadWays.add(Integer.parseInt(str)); + } + String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_ALLOCATION); + if (StringUtils.isEmpty(value)) { + return Result.error("未绑定定位规则"); + } + int allocationRule = Integer.parseInt(value); + Zone zone = zoneService.getZoneByCode(zoneCode, warehouseCode); + if(zone == null) { + return Result.error("创建空托盘组入库任务时,没有找到库区"); + } + TaskHeader taskHeader = taskHeaderService.getUnCompleteTaskByContainerCode(containerCode, warehouseCode); + if(taskHeader != null) { + return Result.ok("创建空托盘组入库任务时, 已经生成空托盘组任务"); + } + List<LocationType> locationTypeList = locationTypeService. + getLocationTypeListByZoneCode(zoneCode, warehouseCode); + if(locationTypeList.size() == 0) { + return Result.error("创建空托盘组入库任务时,没有找到库位类型"); + } + List<String> locationTypeCodeList = locationTypeList.stream(). + map(t -> t.getCode()).collect(Collectors.toList()); + int highHeight = Float.valueOf(height).intValue(); + LocationHigh locationHigh = locationHighService. + getLocationHighByHighLevel(highHeight, locationTypeCodeList, warehouseCode); + if(locationHigh == null) { + return Result.error("创建空托盘组入库任务时,没有获取到库位高度"); + } + int high = locationHigh.getHigh(); + String toLocationCode = allocationService.allocation(allocationRule, locationTypeCodeList, high, zoneCode, + roadWays, warehouseCode, containerCode, null); + if(StringUtils.isEmpty(toLocationCode)) { + throw new ServiceException("创建空托盘组入库任务时,目标库位为空"); + } + Result result = createManyEmptyIn(containerCode, toLocationCode, warehouseCode); + if(!result.isSuccess()) { + throw new ServiceException(result.getMessage()); + } + return Result.ok("创建空托盘组入库任务成功"); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result createManyEmptyIn(String containerCode, String toLocationCode, String warehouseCode) { + if(StringUtils.isEmpty(containerCode)) { + return Result.error("创建空托盘组入库任务时,容器号为空"); + } + if(StringUtils.isEmpty(warehouseCode)) { + return Result.error("创建空托盘组入库任务时,仓库编码为空"); + } + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if(container == null) { + return Result.error("创建空托盘组入库任务时,没有找到容器"); + } + if (StringUtils.isNotEmpty(container.getLocationCode())) { + return Result.error("创建空托盘组入库任务时, 容器已在库位" + container.getLocationCode() + "上"); + } + if (!container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_EMPTY)) { + return Result.error("创建空托盘组入库任务时,容器状态不为空容器"); + } + boolean success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_LOCK, warehouseCode); + if(!success) { + throw new ServiceException("创建空托盘组入库任务时, 更新容器状态失败"); + } + if(StringUtils.isNotEmpty(toLocationCode)) { + Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); + if (toLocation == null) { + return Result.error("创建空托盘组入库任务时,没有找到目标库位"); + } + if (toLocation.getStatus() != QuantityConstant.STATUS_LOCATION_EMPTY) { + return Result.error("创建空托盘组入库任务时,目标库位状态不是空闲"); + } + success = locationService.updateStatus(toLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); + if (!success) { + throw new ServiceException("创建空托盘组入库任务时, 更新库位状态失败"); + } + } + TaskHeader taskHeader = new TaskHeader(); + taskHeader.setWarehouseCode(warehouseCode); + taskHeader.setContainerCode(containerCode); + taskHeader.setTaskType(QuantityConstant.TASK_TYPE_MANY_EMPTYRECEIPT); + taskHeader.setInnernalTaskType(QuantityConstant.TASK_INTENERTYPE_RECEIPT); + taskHeader.setToLocationCode(toLocationCode); + taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); + success =taskHeaderService.save(taskHeader); + if(!success) { + throw new ServiceException("创建空托盘组入库任务时, 创建任务失败"); + } + return Result.ok("创建空托盘组入库任务成功"); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result createManyEmptyOutTask(String zoneCode, String toPortCode, String warehouseCode) { + if(StringUtils.isEmpty(toPortCode)) { + return Result.error("创建空托盘组出库任务时,目标出入口为空"); + } + if(StringUtils.isEmpty(zoneCode)) { + return Result.error("创建空托盘组出库任务时,库区编码为空"); + } + if(StringUtils.isEmpty(warehouseCode)) { + return Result.error("创建空托盘组出库任务时,仓库编码为空"); + } + List<Container> containerList = containerService.getContainerListByStatus( + QuantityConstant.STATUS_CONTAINER_MANY, warehouseCode); + if(containerList.size() == 0) { + return Result.error("创建空托盘组出库任务时,没有找到空托盘组"); + } + List<Container> removeContainerList = new ArrayList<>(); + if(containerList.size() > 0) { + for(Container container : containerList) { + String locationCode = container.getLocationCode(); + Location location = locationService.getLocationByCode(locationCode, warehouseCode); + if(!location.getZoneCode().equals(zoneCode)) { + removeContainerList.add(container); + } + } + } + boolean success = containerList.removeAll(removeContainerList); + if(!success) { + throw new ServiceException("创建空托盘组出库任务时,删除不符合的空托盘组失败"); + } + if(containerList.size() <= 0) { + throw new ServiceException("没有找到合适的空托盘组!"); + } + String containerCode = containerList.get(0).getCode(); + TaskHeader taskHeader = taskHeaderService.getUnCompleteTaskByContainerCode(containerCode, warehouseCode); + if(taskHeader != null) { + return Result.ok("创建空托盘组出库任务时, 已经生成空托盘组出库任务"); + } + Result result = createManyEmptyOut(containerCode, toPortCode, warehouseCode); + if(!result.isSuccess()) { + throw new ServiceException(result.getMessage()); + } + return Result.ok("创建空托盘组出库任务成功"); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result createManyEmptyOut(String containerCode, String toPortCode, String warehouseCode) { + if(StringUtils.isEmpty(containerCode)) { + return Result.error("创建空托盘组出库任务时,托盘号为空"); + } + if(StringUtils.isEmpty(toPortCode)) { + return Result.error("创建空托盘组出库任务时,目标出入口为空"); + } + if(StringUtils.isEmpty(warehouseCode)) { + return Result.error("创建空托盘组出库任务时,仓库编码为空"); + } + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if(container == null) { + return Result.error("创建空托盘组出库任务时, 没有找到容器:" + containerCode); + } + if(!QuantityConstant.STATUS_CONTAINER_MANY.equals(container.getStatus())) { + return Result.error("创建空托盘组出库任务时, 容器状态不为空托盘组状态"); + } + String fromLocationCode = container.getLocationCode(); + if(StringUtils.isEmpty(fromLocationCode)) { + return Result.error("创建空托盘组出库任务时, 该容器不在库位上"); + } + Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode); + if(fromLocation == null) { + return Result.error("创建空托盘组出库任务时, 没有找到库位:" + fromLocationCode); + } + String zoneCode = fromLocation.getZoneCode(); + if(StringUtils.isEmpty(zoneCode)) { + return Result.error("创建空托盘组出库任务时, 库区为空"); + } + boolean success = containerService.updateStatus(containerCode, + QuantityConstant.STATUS_CONTAINER_LOCK, warehouseCode); + if (!success) { + throw new ServiceException("创建空托盘组出库任务时, 更新容器状态失败"); + } + success = locationService.updateStatus(fromLocationCode, + QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); + if (!success) { + throw new ServiceException("创建空托盘组出库任务时, 更新库位状态失败"); + } + TaskHeader taskHeader = new TaskHeader(); + taskHeader.setWarehouseCode(warehouseCode); + taskHeader.setZoneCode(zoneCode); + taskHeader.setContainerCode(containerCode); + taskHeader.setTaskType(QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT); + taskHeader.setInnernalTaskType(QuantityConstant.TASK_INTENERTYPE_SHIPMENT); + taskHeader.setFromLocationCode(fromLocationCode); + taskHeader.setToPortCode(toPortCode); + taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); + success = taskHeaderService.save(taskHeader); + if(!success) { + throw new ServiceException("创建空托盘组出库任务时,生成任务失败"); + } + return Result.ok("创建空托盘组出库任务成功"); } @Override @@ -306,6 +658,26 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea return taskHeader; } + @Override + public TaskHeader getUnCompleteTaskByContainerCode(String containerCode, String warehouseCode) { + LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); + taskHeaderLambdaQueryWrapper.eq(TaskHeader::getContainerCode, containerCode) + .eq(TaskHeader::getWarehouseCode, warehouseCode) + .lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED); + TaskHeader taskHeader = taskHeaderService.getOne(taskHeaderLambdaQueryWrapper); + return taskHeader; + } + + @Override + public TaskHeader getUnCompleteTaskByPreTaskNo(int preTaskNo, String warehouseCode) { + LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); + taskHeaderLambdaQueryWrapper.eq(TaskHeader::getPreTaskNo, preTaskNo) + .eq(TaskHeader::getWarehouseCode, warehouseCode) + .lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED); + TaskHeader taskHeader = taskHeaderService.getOne(taskHeaderLambdaQueryWrapper); + return taskHeader; + } + /** * WMS完成任务 */ @@ -319,12 +691,14 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea if (taskHeader.getStatus().equals(QuantityConstant.TASK_STATUS_COMPLETED)) { return Result.ok("任务(" +taskId + ")任务已经是完成的!"); } - if (StringUtils.isEmpty(taskHeader.getFromLocationCode()) - && StringUtils.isEmpty(taskHeader.getToLocationCode())) { - return Result.error("任务" + taskId + "没有库位,执行中止"); + int taskType = taskHeader.getTaskType().intValue(); + if(taskType != QuantityConstant.TASK_TYPE_OVER_STATION) { + if (StringUtils.isEmpty(taskHeader.getFromLocationCode()) + && StringUtils.isEmpty(taskHeader.getToLocationCode())) { + return Result.error("任务" + taskId + "没有库位,执行中止"); + } } Result result = null; - int taskType = taskHeader.getTaskType().intValue(); switch (taskType) { //整盘入库、补充入库 case QuantityConstant.TASK_TYPE_WHOLERECEIPT: @@ -335,6 +709,65 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea case QuantityConstant.TASK_TYPE_SORTINGSHIPMENT: result = completeShipmentTask(taskHeader); break; + case QuantityConstant.TASK_TYPE_EMPTYRECEIPT: + result = completeEmptyInTask(taskHeader); + break; + case QuantityConstant.TASK_TYPE_EMPTYSHIPMENT: + result = completeEmptyOutTask(taskHeader); + break; + case QuantityConstant.TASK_TYPE_TRANSFER: + result = completeTransferTask(taskHeader); + break; + case QuantityConstant.TASK_TYPE_CHECK_OUT: + result = completeCheckOutTask(taskHeader); + break; + case QuantityConstant.TASK_TYPE_OVER_STATION: + result = completeOverStationTask(taskHeader); + break; + case QuantityConstant.TASK_TYPE_MANY_EMPTYRECEIPT: + result = completeManyEmptyInTask(taskHeader); + break; + case QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT: + result = completeManyEmptyOutTask(taskHeader); + break; + default: + throw new ServiceException("不支持的任务类型" + taskType); + } + return result; + } + + @Override + public Result cancelTask(Integer taskId) { + TaskHeader taskHeader = getById(taskId); + if(taskHeader == null) { + return Result.error("任务" + taskId + "未找到,执行中止"); + } + if (taskHeader.getStatus().equals(QuantityConstant.TASK_STATUS_COMPLETED)) { + return Result.ok("任务(" +taskId + ")任务已经是完成的!"); + } + int taskType = taskHeader.getTaskType().intValue(); + int preTaskNo = taskId; + String warehouseCode = taskHeader.getWarehouseCode(); + TaskHeader preTaskHeader = getUnCompleteTaskByPreTaskNo(preTaskNo, warehouseCode); + if (preTaskHeader != null) { + return Result.error("取消任务失败,有前置任务" + preTaskHeader.getId()); + } + boolean success = taskHeaderService.removeById(taskId); + if(!success) { + return Result.error("取消任务失败, 删除任务失败"); + } + Result result = null; + switch (taskType) { + case QuantityConstant.TASK_TYPE_WHOLERECEIPT: + case QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT: + cancelLocationAndContainerStatus(taskHeader); + result = cancelReceiptTask(taskHeader); + break; + case QuantityConstant.TASK_TYPE_WHOLESHIPMENT: + case QuantityConstant.TASK_TYPE_SORTINGSHIPMENT: + cancelLocationAndContainerStatus(taskHeader); + result = cancelShipmentTask(taskHeader); + break; default: throw new ServiceException("不支持的任务类型" + taskType); } @@ -342,6 +775,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea } @Override + @Transactional(rollbackFor = Exception.class) public Result sendTaskToWcs(Integer taskId) { TaskHeader taskHeader = taskHeaderService.getById(taskId); if(taskHeader == null) { @@ -363,64 +797,141 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea return Result.ok("执行下发任务成功"); } + /** + * 创建空托盘入库 + * 1. 判断托盘号、库位号是否满足要求 + * 2. 创建任务,锁定容器、库位 + * @param containerCode + * @param toLocationCode + * @param warehouseCode + * @return + */ + @Override @Transactional(rollbackFor = Exception.class) - public boolean combineInventoryDetail(TaskHeader taskHeader) { - boolean success = false; - String warehouseCode = taskHeader.getWarehouseCode(); - String containerCode = taskHeader.getContainerCode(); - - InventoryHeader inventoryHeader = inventoryHeaderService. - getInventoryHeaderByContainerCode(containerCode, warehouseCode); - if(inventoryHeader == null) { - throw new ServiceException("合并库存时, 没有找到库存头"); - } - List<InventoryDetail> inventoryDetailList = inventoryDetailService. - getInventoryDetailListByInventoryHeaderId(inventoryHeader.getId()); - if(inventoryDetailList.size() == 0) { - throw new ServiceException("合并库存时, 没有找到库存详情"); - } -// if(inventoryDetailList.size() == 1) { -// return true; -// } - for (int i = 0; i < inventoryDetailList.size() - 1; i++) { - for (int j = inventoryDetailList.size() - 1; j > i; j--) { - InventoryDetail inventoryDetail1 = inventoryDetailList.get(i); - InventoryDetail inventoryDetail2 = inventoryDetailList.get(j); - if (inventoryDetail1.getMaterialCode().equals(inventoryDetail2.getMaterialCode()) - && inventoryDetail1.getBatch().equals(inventoryDetail2.getBatch()) - && inventoryDetail1.getLot().equals(inventoryDetail2.getLot()) - && inventoryDetail1.getProject().equals(inventoryDetail2.getProject())) { - BigDecimal totalQty = inventoryDetail1.getQty().add(inventoryDetail2.getQty()); - inventoryDetail1.setQty(totalQty); - success = inventoryDetailService.updateById(inventoryDetail1); - if(!success) { - throw new ServiceException("合并库存时, 更新库存详情失败:" + inventoryDetail1.getId()); - } - success = inventoryDetailService.removeById(inventoryDetail2.getId()); - if(!success) { - throw new ServiceException("合并库存时, 删除库存详情失败:" + inventoryDetail2.getId()); - } - inventoryDetailList.remove(j); - } - } + public Result createEmptyIn(String containerCode, String toLocationCode, String warehouseCode) { + if(StringUtils.isEmpty(containerCode)) { + return Result.error("创建空托盘入库时, 托盘号为空"); } - BigDecimal totalQty = new BigDecimal(0); - int totalLines = 0; - for (InventoryDetail inventoryDetail : inventoryDetailList) { - totalQty = totalQty.add(inventoryDetail.getQty()); - totalLines++; + if(StringUtils.isEmpty(warehouseCode)) { + return Result.error("创建空托盘入库时, 仓库编码为空"); } Container container = containerService.getContainerByCode(containerCode, warehouseCode); if(container == null) { - throw new ServiceException("合并库存时, 没有找到容器, 容器号为" + containerCode); + return Result.error("创建空托盘入库时, 没有找到托盘" + containerCode); } - inventoryHeader.setTotalQty(totalQty); - inventoryHeader.setTotalLines(totalLines); - inventoryHeader.setContainerStatus(container.getStatus()); - success = inventoryHeaderService.updateById(inventoryHeader); - return success; - } - /** + if(!container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_EMPTY)) { + return Result.error("创建空托盘入库时, 托盘状态并非空托盘状态"); + } + if (StringUtils.isNotEmpty(container.getLocationCode())) { + return Result.error("创建空托盘入库时, 容器已在库位" + container.getLocationCode() + "上"); + } + + if (StringUtils.isNotEmpty(toLocationCode)) { + Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); + if (toLocation == null) { + return Result.error("创建空托盘入库时," + toLocationCode + "目标库位不存在" ); + } + if (StringUtils.isNotEmpty(toLocation.getContainerCode())) { + return Result.error("创建空托盘入库时," + toLocationCode+"上已存在容器" + toLocation.getContainerCode()); + } + if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(toLocation.getStatus())) { + return Result.error("创建空托盘入库时, 目标库位非空闲"); + } + boolean success = locationService.updateStatus(toLocationCode, + QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); + if(!success) { + throw new ServiceException("创建空托盘入库时,更新库位状态失败"); + } + } + + boolean success = containerService.updateStatus(containerCode, + QuantityConstant.STATUS_CONTAINER_LOCK, warehouseCode); + if(!success) { + throw new ServiceException("创建空托盘入库时,更新容器状态失败"); + } + TaskHeader taskHeader = new TaskHeader(); + taskHeader.setWarehouseCode(warehouseCode); + taskHeader.setContainerCode(containerCode); + taskHeader.setTaskType(QuantityConstant.TASK_TYPE_EMPTYRECEIPT); + taskHeader.setInnernalTaskType(QuantityConstant.TASK_INTENERTYPE_RECEIPT); + taskHeader.setToLocationCode(toLocationCode); + taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); + success = taskHeaderService.save(taskHeader); + if(!success) { + throw new ServiceException("创建空托盘入库时,保存任务失败"); + } + return Result.OK("创建空托盘入库任务成功"); + } + + /** + * 创建空托盘出库 + * @param containerCode + * @param toPortCode + * @param warehouseCode + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result createEmptyOut(String containerCode, String toPortCode, String warehouseCode) { + if(StringUtils.isEmpty(containerCode)) { + return Result.error("创建空托盘出库时, 托盘号为空"); + } + if(StringUtils.isEmpty(toPortCode)) { + return Result.error("创建空托盘出库时, 出库口为空"); + } + if(StringUtils.isEmpty(warehouseCode)) { + return Result.error("创建空托盘出库时, 仓库编码为空"); + } + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if(container == null) { + return Result.error("创建空托盘出库时, 没有找到托盘" + containerCode); + } + if(!container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_EMPTY)) { + return Result.error("创建空托盘出库时, 托盘状态并非空托盘状态"); + } + String fromLocationCode = container.getLocationCode(); + if (StringUtils.isEmpty(fromLocationCode)) { + return Result.error("创建空托盘出库时, 容器不在库位上"); + } + Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode); + if(fromLocation == null) { + return Result.error("创建空托盘出库时, 起始库位为空"); + } + String zoneCode = fromLocation.getZoneCode(); + if (StringUtils.isEmpty(zoneCode)) { + return Result.error("创建空托盘出库时, 起始库位的库区为空"); + } + Port port = portService.getPortByCode(toPortCode, zoneCode, warehouseCode); + if(port == null) { + return Result.error("创建空托盘出库时, 没有找到出库口" + toPortCode); + } + boolean success = locationService.updateStatus(fromLocationCode, + QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); + if(!success) { + throw new ServiceException("创建空托盘出库时,更新库位状态失败"); + } + success = containerService.updateStatus(containerCode, + QuantityConstant.STATUS_CONTAINER_LOCK, warehouseCode); + if(!success) { + throw new ServiceException("创建空托盘出库时,更新容器状态失败"); + } + TaskHeader taskHeader = new TaskHeader(); + taskHeader.setWarehouseCode(warehouseCode); + taskHeader.setZoneCode(zoneCode); + taskHeader.setContainerCode(containerCode); + taskHeader.setTaskType(QuantityConstant.TASK_TYPE_EMPTYSHIPMENT); + taskHeader.setInnernalTaskType(QuantityConstant.TASK_INTENERTYPE_SHIPMENT); + taskHeader.setFromLocationCode(fromLocationCode); + taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); + taskHeader.setToPortCode(toPortCode); + success = taskHeaderService.save(taskHeader); + if(!success) { + throw new ServiceException("创建空托盘出库时,保存任务失败"); + } + return Result.OK("创建空托盘出库任务成功"); + } + + /** * 完成入库任务 * @param taskHeader 任务 * @return AjaxResult 完成入库任务结果 @@ -520,7 +1031,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea inventoryTransaction.setWarehouseCode(taskDetail.getWarehouseCode()); inventoryTransaction.setCompanyCode(taskDetail.getCompanyCode()); inventoryTransaction.setContainerCode(containerCode); - inventoryTransaction.setLocationCode(toLocationCode); + inventoryTransaction.setToLocationCode(toLocationCode); inventoryTransaction.setMaterialCode(taskDetail.getMaterialCode()); inventoryTransaction.setMaterialName(taskDetail.getMaterialName()); inventoryTransaction.setMaterialSpec(taskDetail.getMaterialSpec()); @@ -673,7 +1184,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea inventoryTransaction.setWarehouseCode(warehouseCode); inventoryTransaction.setCompanyCode(inventoryDetail.getCompanyCode()); inventoryTransaction.setContainerCode(containerCode); - inventoryTransaction.setLocationCode(fromLocationCode); + inventoryTransaction.setFromLocationCode(fromLocationCode); inventoryTransaction.setMaterialCode(inventoryDetail.getMaterialCode()); inventoryTransaction.setMaterialName(inventoryDetail.getMaterialName()); inventoryTransaction.setMaterialSpec(inventoryDetail.getMaterialSpec()); @@ -766,4 +1277,585 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea } return Result.ok("完成出库任务"); } + + @Transactional(rollbackFor = Exception.class) + public boolean combineInventoryDetail(TaskHeader taskHeader) { + boolean success = false; + String warehouseCode = taskHeader.getWarehouseCode(); + String containerCode = taskHeader.getContainerCode(); + + InventoryHeader inventoryHeader = inventoryHeaderService. + getInventoryHeaderByContainerCode(containerCode, warehouseCode); + if(inventoryHeader == null) { + throw new ServiceException("合并库存时, 没有找到库存头"); + } + List<InventoryDetail> inventoryDetailList = inventoryDetailService. + getInventoryDetailListByInventoryHeaderId(inventoryHeader.getId()); + if(inventoryDetailList.size() == 0) { + throw new ServiceException("合并库存时, 没有找到库存详情"); + } + for (int i = 0; i < inventoryDetailList.size() - 1; i++) { + for (int j = inventoryDetailList.size() - 1; j > i; j--) { + InventoryDetail inventoryDetail1 = inventoryDetailList.get(i); + InventoryDetail inventoryDetail2 = inventoryDetailList.get(j); + if (inventoryDetail1.getMaterialCode().equals(inventoryDetail2.getMaterialCode()) + && inventoryDetail1.getBatch().equals(inventoryDetail2.getBatch()) + && inventoryDetail1.getLot().equals(inventoryDetail2.getLot()) + && inventoryDetail1.getProject().equals(inventoryDetail2.getProject())) { + BigDecimal totalQty = inventoryDetail1.getQty().add(inventoryDetail2.getQty()); + inventoryDetail1.setQty(totalQty); + success = inventoryDetailService.updateById(inventoryDetail1); + if(!success) { + throw new ServiceException("合并库存时, 更新库存详情失败:" + inventoryDetail1.getId()); + } + success = inventoryDetailService.removeById(inventoryDetail2.getId()); + if(!success) { + throw new ServiceException("合并库存时, 删除库存详情失败:" + inventoryDetail2.getId()); + } + inventoryDetailList.remove(j); + } + } + } + BigDecimal totalQty = new BigDecimal(0); + int totalLines = 0; + for (InventoryDetail inventoryDetail : inventoryDetailList) { + totalQty = totalQty.add(inventoryDetail.getQty()); + totalLines++; + } + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if(container == null) { + throw new ServiceException("合并库存时, 没有找到容器, 容器号为" + containerCode); + } + inventoryHeader.setTotalQty(totalQty); + inventoryHeader.setTotalLines(totalLines); + inventoryHeader.setContainerStatus(container.getStatus()); + success = inventoryHeaderService.updateById(inventoryHeader); + return success; + } + + /** + * 完成空托盘入库任务 + * @param taskHeader 任务 + * @return Result 完成入库任务结果 + */ + @Transactional(rollbackFor = Exception.class) + public Result completeEmptyInTask(TaskHeader taskHeader) { + String warehouseCode = taskHeader.getWarehouseCode(); + String toLocationCode = taskHeader.getToLocationCode(); + String containerCode = taskHeader.getContainerCode(); + if(StringUtils.isEmpty(containerCode)) { + return Result.error("完成空托盘入库任务时, 托盘号为空"); + } + if(StringUtils.isEmpty(warehouseCode)) { + return Result.error("完成空托盘入库任务时, 仓库编码为空"); + } + if(StringUtils.isEmpty(toLocationCode)) { + return Result.error("完成空托盘入库任务时, 目标库位号为空"); + } + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if(container == null) { + return Result.error("完成空托盘入库任务时, 没有找到托盘" + containerCode); + } + Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); + if (toLocation == null) { + return Result.error("完成空托盘入库任务时," + toLocationCode + "目标库位不存在" ); + } + boolean success = containerService.updateLocationCodeAndStatus(containerCode, + toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); + if(!success) { + throw new ServiceException("完成空托盘入库任务时, 更新容器的库位号和状态失败"); + } + success = locationService.updateContainerCodeAndStatus(toLocationCode, + containerCode, QuantityConstant.STATUS_LOCATION_EMPTY,warehouseCode); + if(!success) { + throw new ServiceException("完成空托盘入库任务时, 更新库位的容器号和状态失败"); + } + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); + success = taskHeaderService.updateById(taskHeader); + if(!success) { + throw new ServiceException("完成空托盘入库任务时, 更新任务失败"); + } + return Result.OK("完成空托盘入库成功"); + } + + /** + * 完成空托盘出库任务 + * @param taskHeader 任务 + * @return Result 完成出库任务结果 + */ + @Transactional(rollbackFor = Exception.class) + public Result completeEmptyOutTask(TaskHeader taskHeader) { + String warehouseCode = taskHeader.getWarehouseCode(); + String fromLocationCode = taskHeader.getFromLocationCode(); + String containerCode = taskHeader.getContainerCode(); + String toPortCode = taskHeader.getToPortCode(); + String zoneCode = taskHeader.getZoneCode(); + if(StringUtils.isEmpty(containerCode)) { + return Result.error("完成空托盘出库任务时, 托盘号为空"); + } + if(StringUtils.isEmpty(warehouseCode)) { + return Result.error("完成空托盘出库任务时, 仓库编码为空"); + } + if(StringUtils.isEmpty(fromLocationCode)) { + return Result.error("完成空托盘出库任务时, 起始库位号为空"); + } + if(StringUtils.isEmpty(toPortCode)) { + return Result.error("完成空托盘出库任务时, 目标出入口号为空"); + } + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if(container == null) { + return Result.error("完成空托盘出库任务时, 没有找到托盘" + containerCode); + } + Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode); + if (fromLocation == null) { + return Result.error("完成空托盘出库任务时," + fromLocationCode + "目标库位不存在" ); + } + Port port = portService.getPortByCode(toPortCode, zoneCode, warehouseCode); + if(port == null) { + return Result.error("完成空托盘出库任务时," + toPortCode + "目标出库口不存在" ); + } + boolean success = containerService.updateLocationCodeAndStatus(containerCode, + QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); + if(!success) { + throw new ServiceException("完成空托盘出库任务时, 更新容器的库位号和状态失败"); + } + success = locationService.updateContainerCodeAndStatus(fromLocationCode, + QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); + if(!success) { + throw new ServiceException("完成空托盘出库任务时, 更新库位的容器号和状态失败"); + } + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); + success = taskHeaderService.updateById(taskHeader); + if(!success) { + throw new ServiceException("完成空托盘出库任务时, 更新任务失败"); + } + return Result.OK("完成空托盘出库成功"); + } + + /** + * 完成移库任务 + * @param taskHeader 任务 + * @return Result 完成移库任务结果 + */ + @Transactional(rollbackFor = Exception.class) + public Result completeTransferTask(TaskHeader taskHeader) { + String warehouseCode = taskHeader.getWarehouseCode(); + String containerCode = taskHeader.getContainerCode(); + String fromLocationCode = taskHeader.getFromLocationCode(); + String toLocationCode = taskHeader.getToLocationCode(); + + if(StringUtils.isEmpty(containerCode)) { + return Result.error("完成移库任务时, 托盘号为空"); + } + if(StringUtils.isEmpty(warehouseCode)) { + return Result.error("完成移库任务时, 仓库编码为空"); + } + if(StringUtils.isEmpty(fromLocationCode)) { + return Result.error("完成移库任务时, 起始库位号为空"); + } + if(StringUtils.isEmpty(toLocationCode)) { + return Result.error("完成移库任务时, 目标库位号为空"); + } + + List<InventoryTransaction> inventoryTransactionList = new ArrayList<>(); + LambdaUpdateWrapper<InventoryDetail> inventoryDetailLambdaUpdateWrapper = Wrappers.lambdaUpdate(); + inventoryDetailLambdaUpdateWrapper.eq(InventoryDetail::getWarehouseCode, warehouseCode) + .eq(InventoryDetail::getContainerCode, containerCode) + .eq(InventoryDetail::getLocationCode, fromLocationCode); + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaUpdateWrapper); + for(InventoryDetail inventoryDetail : inventoryDetailList) { + inventoryDetail.setLocationCode(toLocationCode); + InventoryTransaction inventoryTransaction = new InventoryTransaction(); + inventoryTransaction.setWarehouseCode(inventoryDetail.getWarehouseCode()); + inventoryTransaction.setContainerCode(inventoryDetail.getContainerCode()); + inventoryTransaction.setCompanyCode(inventoryDetail.getCompanyCode()); + inventoryTransaction.setType(QuantityConstant.INVENTORY_TRANSACTION_TRANSFER); + inventoryTransaction.setFromLocationCode(fromLocationCode); + inventoryTransaction.setToLocationCode(toLocationCode); + inventoryTransaction.setMaterialCode(inventoryDetail.getMaterialCode()); + inventoryTransaction.setMaterialName(inventoryDetail.getMaterialName()); + inventoryTransaction.setMaterialSpec(inventoryDetail.getMaterialSpec()); + inventoryTransaction.setMaterialUnit(inventoryDetail.getMaterialUnit()); + inventoryTransaction.setQty(inventoryDetail.getQty()); + inventoryTransaction.setInventoryStatus(inventoryDetail.getInventoryStatus()); + inventoryTransaction.setBatch(inventoryDetail.getBatch()); + inventoryTransaction.setProject(inventoryDetail.getProject()); + inventoryTransaction.setLot(inventoryDetail.getLot()); + inventoryTransactionList.add(inventoryTransaction); + } + boolean success = false; + if(inventoryTransactionList.size() > 0) { + success = inventoryTransactionService.saveBatch(inventoryTransactionList); + if (!success) { + throw new ServiceException("完成移库任务时,保存库存交易失败"); + } + } + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); + success = taskHeaderService.updateById(taskHeader); + if(!success) { + throw new ServiceException("完成移库任务时, 更新任务失败"); + } + if(inventoryDetailList.size() > 0) { + success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, + QuantityConstant.STATUS_CONTAINER_SOME, warehouseCode); + if(!success) { + throw new ServiceException("完成移库任务时, 更新容器状态失败"); + } + } else { + success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, + QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); + if(!success) { + throw new ServiceException("完成移库任务时, 更新容器状态失败"); + } + } + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + container.setLastStatus(QuantityConstant.EMPTY_STRING); + success = containerService.updateById(container); + if(!success) { + throw new ServiceException("完成移库任务时, 更新容器状态失败"); + } + success = locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, + QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); + if(!success) { + throw new ServiceException("完成移库任务时, 更新起始库位状态失败"); + } + success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, + QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); + if(!success) { + throw new ServiceException("完成移库任务时, 更新目标库位状态失败"); + } + LambdaUpdateWrapper<InventoryHeader> inventoryHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); + inventoryHeaderLambdaUpdateWrapper.eq(InventoryHeader::getWarehouseCode, warehouseCode) + .eq(InventoryHeader::getContainerCode, containerCode) + .eq(InventoryHeader::getLocationCode, fromLocationCode); + InventoryHeader inventoryHeader = inventoryHeaderService.getOne(inventoryHeaderLambdaUpdateWrapper); + if(inventoryHeader != null) { + inventoryHeader.setLocationCode(toLocationCode); + success = inventoryHeaderService.updateById(inventoryHeader); + if(!success) { + throw new ServiceException("完成移库任务时, 更新库存头失败"); + } + } + if(inventoryDetailList.size() != 0) { + success = inventoryDetailService.updateBatchById(inventoryDetailList); + if(!success) { + throw new ServiceException("完成移库任务时, 更新库存详情失败"); + } + } + return Result.OK("完成移库任务成功"); + } + + /** + * 完成出库查看任务 + * @param taskHeader 任务 + * @return Result 完成出库查看任务结果 + */ + @Transactional(rollbackFor = Exception.class) + public Result completeCheckOutTask(TaskHeader taskHeader) { + String warehouseCode = taskHeader.getWarehouseCode(); + String containerCode = taskHeader.getContainerCode(); + String fromLocationCode = taskHeader.getFromLocationCode(); + String toLocationCode = taskHeader.getToLocationCode(); + String toPortCode = taskHeader.getToPortCode(); + + if(StringUtils.isEmpty(containerCode)) { + return Result.error("完成出库查看任务时, 托盘号为空"); + } + if(StringUtils.isEmpty(warehouseCode)) { + return Result.error("完成出库查看任务时, 仓库编码为空"); + } + if(StringUtils.isEmpty(fromLocationCode)) { + return Result.error("完成出库查看任务时, 起始库位号为空"); + } + if(StringUtils.isEmpty(toPortCode)) { + return Result.error("完成出库查看任务时, 目标出入口号为空"); + } + if(StringUtils.isEmpty(toLocationCode)) { + return Result.error("完成出库查看任务时, 目标库位号为空"); + } + + boolean success = false; + LambdaUpdateWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaUpdate(); + inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getWarehouseCode, warehouseCode) + .eq(InventoryDetail::getContainerCode, containerCode) + .eq(InventoryDetail::getLocationCode, fromLocationCode); + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); + if(inventoryDetailList.size() != 0) { + for (InventoryDetail inventoryDetail : inventoryDetailList) { + inventoryDetail.setTaskQty(BigDecimal.ZERO); + } + success = inventoryDetailService.updateBatchById(inventoryDetailList); + if (!success) { + throw new ServiceException("完成出库查看任务时,更新库存详情失败"); + } + success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_SOME, warehouseCode); + if (!success) { + throw new ServiceException("完成出库查看任务时,更新容器状态失败"); + } + } else { + success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); + if (!success) { + throw new ServiceException("完成出库查看任务时,更新容器状态失败"); + } + } + success = locationService.updateContainerCodeAndStatus(fromLocationCode, + QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); + if (!success) { + throw new ServiceException("完成出库查看任务时,更新起始库位状态失败"); + } + success = locationService.updateContainerCodeAndStatus(toLocationCode, + containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); + if (!success) { + throw new ServiceException("完成出库查看任务时,更新目标库位状态失败"); + } + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); + success = taskHeaderService.updateById(taskHeader); + if (!success) { + throw new ServiceException("完成出库查看任务时,保存任务失败"); + } + return Result.ok("完成出库查看任务"); + } + + /** + * 完成跨站任务 + * @param taskHeader 任务 + * @return Result 完成跨站任务结果 + */ + @Transactional(rollbackFor = Exception.class) + public Result completeOverStationTask(TaskHeader taskHeader) { + String warehouseCode = taskHeader.getWarehouseCode(); + String containerCode = taskHeader.getContainerCode(); + String fromPortCode = taskHeader.getFromPortCode(); + String toPortCode = taskHeader.getToPortCode(); + if(StringUtils.isEmpty(containerCode)) { + return Result.error("完成跨站任务时, 托盘号为空"); + } + if(StringUtils.isEmpty(warehouseCode)) { + return Result.error("完成跨站任务时, 仓库编码为空"); + } + if(StringUtils.isEmpty(fromPortCode)) { + return Result.error("完成跨站任务时, 起始出入口号为空"); + } + if(StringUtils.isEmpty(toPortCode)) { + return Result.error("完成跨站任务时, 目标出入口号为空"); + } + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if(container == null) { + return Result.error("创建跨站任务时,容器为空"); + } + Port fromPort = portService.getPortByCode(fromPortCode, warehouseCode); + if(fromPort == null) { + return Result.error("创建跨站任务时,起始站台为空"); + } + Port toPort = portService.getPortByCode(toPortCode, warehouseCode); + if(toPort == null) { + return Result.error("创建跨站任务时,目标站台为空"); + } + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); + boolean success = taskHeaderService.updateById(taskHeader); + if(!success) { + throw new ServiceException("创建跨站任务时, 更新任务失败"); + } + success = containerService.updateStatus(containerCode, + QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); + if(!success) { + throw new ServiceException("创建跨站任务时, 更新容器状态失败"); + } + return Result.OK("完成跨站任务成功"); + } + + /** + * 完成空托盘组入库任务 + * @param taskHeader 任务 + * @return Result 完成空托盘组入库任务结果 + */ + @Transactional(rollbackFor = Exception.class) + public Result completeManyEmptyInTask(TaskHeader taskHeader) { + String warehouseCode = taskHeader.getWarehouseCode(); + String containerCode = taskHeader.getContainerCode(); + String toLocationCode = taskHeader.getToLocationCode(); + if(StringUtils.isEmpty(containerCode)) { + return Result.error("完成空托盘组入库任务时, 托盘号为空"); + } + if(StringUtils.isEmpty(warehouseCode)) { + return Result.error("完成空托盘组入库任务时, 仓库编码为空"); + } + if(StringUtils.isEmpty(toLocationCode)) { + return Result.error("完成空托盘组入库任务时, 目标库位号为空"); + } + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if(container == null) { + return Result.error("完成空托盘组入库任务时,没有找到容器" + containerCode); + } + Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); + if(toLocation == null) { + return Result.error("完成空托盘组入库任务时,没有找到库位" + toLocationCode); + } + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); + boolean success = taskHeaderService.updateById(taskHeader); + if(!success) { + throw new ServiceException("完成空托盘组入库任务时, 更新任务失败"); + } + success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, + QuantityConstant.STATUS_CONTAINER_MANY, warehouseCode); + if(!success) { + throw new ServiceException("完成空托盘组入库任务时, 更新容器失败"); + } + success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, + QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); + if(!success) { + throw new ServiceException("完成空托盘组入库任务时, 更新库位失败"); + } + return Result.ok("完成空托盘组入库任务成功"); + } + + /** + * 完成空托盘组出库任务 + * @param taskHeader 任务 + * @return Result 完成空托盘组出库任务结果 + */ + @Transactional(rollbackFor = Exception.class) + public Result completeManyEmptyOutTask(TaskHeader taskHeader) { + String warehouseCode = taskHeader.getWarehouseCode(); + String containerCode = taskHeader.getContainerCode(); + String toPortCode = taskHeader.getToPortCode(); + if(StringUtils.isEmpty(containerCode)) { + return Result.error("完成空托盘组出库任务时, 托盘号为空"); + } + if(StringUtils.isEmpty(warehouseCode)) { + return Result.error("完成空托盘组出库任务时, 仓库编码为空"); + } + if(StringUtils.isEmpty(toPortCode)) { + return Result.error("完成空托盘组出库任务时, 目标出入口为空"); + } + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if(container == null) { + return Result.error("完成空托盘组出库任务时,没有找到容器" + containerCode); + } + String toLocationCode = container.getLocationCode(); + if(StringUtils.isEmpty(toLocationCode)) { + return Result.error("完成空托盘组出库任务时, 容器不在库位上"); + } + Port port = portService.getPortByCode(toPortCode, warehouseCode); + if(port == null) { + return Result.error("完成空托盘组出库任务时,没有找到出入口" + toPortCode); + } + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); + boolean success = taskHeaderService.updateById(taskHeader); + if(!success) { + throw new ServiceException("完成空托盘组出库任务时, 更新任务失败"); + } + success = containerService.updateLocationCodeAndStatus(containerCode, QuantityConstant.EMPTY_STRING, + QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); + if(!success) { + throw new ServiceException("完成空托盘组出库任务时, 更新容器失败"); + } + success = locationService.updateContainerCodeAndStatus(toLocationCode, QuantityConstant.EMPTY_STRING, + QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); + if(!success) { + throw new ServiceException("完成空托盘组出库任务时, 更新库位失败"); + } + return Result.ok("完成空托盘组出库任务成功"); + } + + /** + * 取消入库任务 + * @param taskHeader 任务 + * @return Result 取消入库任务结果 + */ + @Transactional(rollbackFor = Exception.class) + public Result cancelReceiptTask(TaskHeader taskHeader) { + int receiptContainerHeaderId = taskHeader.getReceiptContainerHeaderId(); + boolean success = receiptContainerHeaderService.cancelReceiptTask(receiptContainerHeaderId); + if(!success) { + throw new ServiceException("取消入库任务时, 更新组盘头状态失败"); + } + String containerCode = taskHeader.getContainerCode(); + String warehouseCode = taskHeader.getWarehouseCode(); + ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService. + getUnCompleteReceiptContainerByCode(containerCode, warehouseCode); + String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_TASK_LOCATION); + if(StringUtils.isEmpty(value)) { + throw new ServiceException("取消入库任务时, 没有获取到配置属性"); + } + int taskLocationRule = Integer.parseInt(value); + if (taskLocationRule == QuantityConstant.RULE_TASK_NOT_LOCATION) { + receiptContainerHeader.setToLocationCode(QuantityConstant.EMPTY_STRING); + success = receiptContainerHeaderService.updateById(receiptContainerHeader); + if(!success) { + throw new ServiceException("取消入库任务时, 更新组盘头状态失败!!"); + } + } + return Result.ok("取消入库任务成功"); + } + + /** + * 取消出库任务 + * @param taskHeader 任务 + * @return Result 取消出库任务结果 + */ + @Transactional(rollbackFor = Exception.class) + public Result cancelShipmentTask(TaskHeader taskHeader) { + + return Result.ok("取消出库任务成功"); + } + + /** + * 取消任务,恢复容器和库位状态 + * @param taskHeader + * @return + */ + @Transactional(rollbackFor = Exception.class) + public Result cancelLocationAndContainerStatus(TaskHeader taskHeader) { + String containerCode = taskHeader.getContainerCode(); + String fromLocationCode = taskHeader.getFromLocationCode(); + String toLocationCode = taskHeader.getToLocationCode(); + String warehouseCode = taskHeader.getWarehouseCode(); + + boolean success = false; + if(StringUtils.isEmpty(fromLocationCode)) { + success = locationService.updateStatus(fromLocationCode, + QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); + if(!success) { + throw new ServiceException("取消任务时, 更新起始库位状态失败"); + } + } + if(StringUtils.isEmpty(toLocationCode)) { + success = locationService.updateStatus(toLocationCode, + QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); + if(!success) { + throw new ServiceException("取消任务时, 更新目标库位状态失败"); + } + } + InventoryHeader inventoryHeader = inventoryHeaderService. + getInventoryHeaderByContainerCode(containerCode, warehouseCode); + + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if(container == null) { + throw new ServiceException("取消任务时, 没有找到容器"); + } + if (inventoryHeader != null) { + if (QuantityConstant.STATUS_CONTAINER_SOME.equals(inventoryHeader.getContainerStatus())) { + container.setStatus(QuantityConstant.STATUS_CONTAINER_SOME); + } + inventoryHeader.setContainerStatus(QuantityConstant.STATUS_CONTAINER_SOME); + success = inventoryHeaderService.updateById(inventoryHeader); + if(!success) { + throw new ServiceException("取消任务时, 更新库存成功"); + } + } else { + container.setStatus(QuantityConstant.STATUS_CONTAINER_EMPTY); + } + String lastStatus = container.getLastStatus(); + if (StringUtils.isNotEmpty(lastStatus)) { + container.setStatus(lastStatus); //解决空托盘组移库问题 + } + container.setLastStatus(QuantityConstant.EMPTY_STRING); + container.setLocationCode(fromLocationCode); + success = containerService.updateById(container); + if(!success) { + throw new ServiceException("取消任务时, 更新容器失败"); + } + return Result.ok("取消任务成功"); + } } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/utils/constant/QuantityConstant.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/utils/constant/QuantityConstant.java index 9febff4..f03cd0f 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/utils/constant/QuantityConstant.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/utils/constant/QuantityConstant.java @@ -183,7 +183,7 @@ public class QuantityConstant { public static final int TASK_TYPE_TRANSFER = 800; /** 出库查看 */ - public static final int TASK_TYPE_VIEW = 900; + public static final int TASK_TYPE_CHECK_OUT = 900; /** 换站 */ public static final int TASK_TYPE_OVER_STATION = 1000; @@ -307,24 +307,13 @@ public class QuantityConstant { public static final Integer INVENTORY_TRANSACTION_SHIPMENT = 20; /** 调整入 */ - public static final Integer INVENTORY_TRANSACTION_ADJUSTINTO = 30; + public static final Integer INVENTORY_TRANSACTION_CYCLEINTO = 30; /** 调整出 */ - public static final Integer INVENTORY_TRANSACTION_ADJUSTOUT = 40; + public static final Integer INVENTORY_TRANSACTION_CYCLEOUT = 40; - /** 调整属性 */ - public static final Integer INVENTORY_TRANSACTION_ADJUSTPROPERTIES = 50; - - /** 盘点 */ - public static final Integer INVENTORY_TRANSACTION_CYCLECOUNT = 60; - - /** 移库入 */ - public static final Integer INVENTORY_TRANSACTION_TRANSFERINTO = 70; - - /** 移库出 */ - public static final Integer INVENTORY_TRANSACTION_TRANSFEROUT = 80; - /**空出*/ - public static final Integer INVENTORY_TRANSACTION_EMPTYOUT = 90; + /** 移库 */ + public static final Integer INVENTORY_TRANSACTION_TRANSFER = 50; @@ -351,10 +340,10 @@ public class QuantityConstant { /** 拣货任务*/ public static final Integer TASK_INTENERTYPE_SHIPMENT = 200; - /** 工作任务*/ - public static final Integer TASK_INTENERTYPE_WORK = 300; + /** 移位任务*/ + public static final Integer TASK_INTENERTYPE_TRANSFER_POSITION = 300; - //盘点任务 + /** 盘点任务*/ public static final Integer TASK_INTENERTYPE_CYCLECOUNT = 400;