diff --git a/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue b/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue index d1cad40..e26d09b 100644 --- a/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue +++ b/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue @@ -3,7 +3,9 @@ <!-- 操作按钮区域 --> <div class="table-operator" v-if="mainId"> <a-button v-has="'inventoryDetail:add'" @click="handleAdd" type="primary" icon="plus">新增</a-button> - <a-button v-has="'inventoryDetail:export'" type="primary" icon="download" @click="handleExportXls('库存详情')">导出</a-button> + <a-button v-has="'inventoryDetail:export'" type="primary" icon="download" @click="handleExportXls('库存详情')" + >导出</a-button + > <a-upload v-has="'inventoryDetail:import'" name="file" @@ -11,18 +13,20 @@ :multiple="false" :headers="tokenHeader" :action="importExcelUrl" - @change="handleImportExcel"> + @change="handleImportExcel" + > <a-button type="primary" icon="import">导入</a-button> </a-upload> <a-dropdown v-if="selectedRowKeys.length > 0"> <a-menu slot="overlay" v-has="'inventoryDetail:deleteBatch'"> <a-menu-item key="1" @click="batchDel"> - <a-icon type="delete"/> + <a-icon type="delete" /> 删除 </a-menu-item> </a-menu> - <a-button style="margin-left: 8px"> 批量操作 - <a-icon type="down"/> + <a-button style="margin-left: 8px"> + 批量操作 + <a-icon type="down" /> </a-button> </a-dropdown> </div> @@ -30,8 +34,8 @@ <!-- 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> 项 + <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> @@ -40,16 +44,16 @@ size="middle" bordered rowKey="id" - :scroll="{x:true}" + :scroll="{ x: true }" :columns="columns" :dataSource="dataSource" :pagination="ipagination" :loading="loading" - :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" - @change="handleTableChange"> - + :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" + @change="handleTableChange" + > <span slot="companyCode" slot-scope="companyCode"> - <a-tag :key="companyCode" color=blue> + <a-tag :key="companyCode" color="blue"> {{ solutionCompany(companyCode) }} </a-tag> </span> @@ -59,31 +63,27 @@ </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;"/> + <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 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-has="'inventoryDetail:edit'" @click="handleEdit(record)">编辑</a> - <a-divider type="vertical"/> - + <a v-has="'inventoryDetail:edit'" @click="handleEdit(record)">编辑<a-divider type="vertical"/></a> <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> <a v-has="'inventoryDetail:delete'">删除</a> </a-popconfirm> </span> - </a-table> </div> @@ -92,15 +92,14 @@ </template> <script> - -import {JeecgListMixin} from '@/mixins/JeecgListMixin' +import { JeecgListMixin } from '@/mixins/JeecgListMixin' import InventoryDetailModal from './modules/InventoryDetailModal' -import {getCompanyList} from '@/api/api' +import { getCompanyList } from '@/api/api' export default { - name: "InventoryDetailList", + name: 'InventoryDetailList', mixins: [JeecgListMixin], - components: {InventoryDetailModal}, + components: { InventoryDetailModal }, props: { mainId: { type: String, @@ -116,7 +115,7 @@ export default { this.clearList() } else { this.queryParam['inventoryHeaderId'] = val - this.loadData(1); + this.loadData(1) } } } @@ -130,15 +129,15 @@ export default { columns: [ { title: '库存详情ID', - align: "center", + align: 'center', dataIndex: 'id' }, { title: '货主', - align: "center", + align: 'center', dataIndex: 'companyCode', key: 'companyCode', - scopedSlots: {customRender: 'companyCode'} + scopedSlots: { customRender: 'companyCode' } }, // { // title: '库区', @@ -147,52 +146,60 @@ export default { // }, { title: '容器编码', - align: "center", + align: 'center', dataIndex: 'containerCode' }, { title: '库位编码', - align: "center", + align: 'center', dataIndex: 'locationCode' }, { title: '物料编码', - align: "center", + align: 'center', dataIndex: 'materialCode' }, { title: '物料名称', - align: "center", + align: 'center', dataIndex: 'materialName' }, { title: '物料规格', - align: "center", + align: 'center', dataIndex: 'materialSpec' }, { title: '物料单位', - align: "center", + align: 'center', dataIndex: 'materialUnit' }, { title: '数量', - align: "center", + align: 'center', dataIndex: 'qty' }, { title: '任务锁定数量', - align: "center", + align: 'center', dataIndex: 'taskQty' }, { + title: '托盘填充度', + align: 'center', + dataIndex: 'fillDensity', + customRender: text => { + return text == null ? '' : text + '%' + } + }, + { title: '库存状态', - align: "center", - dataIndex: 'inventoryStatus_dictText', + align: 'center', + dataIndex: 'inventoryStatus_dictText' }, { title: '批次', - align: "center", + align: 'center', dataIndex: 'batch' }, // { @@ -202,75 +209,75 @@ export default { // }, { title: '入库日期', - align: "center", + align: 'center', dataIndex: 'receiptDate' }, { title: '库龄(天)', - align: "center", + align: 'center', dataIndex: 'inventoryAge' }, { title: '创建人', - align: "center", + align: 'center', dataIndex: 'createBy' }, { title: '创建日期', - align: "center", + align: 'center', dataIndex: 'createTime' }, { title: '更新人', - align: "center", + align: 'center', dataIndex: 'updateBy' }, { title: '更新日期', - align: "center", + align: 'center', dataIndex: 'updateTime' }, { title: '操作', dataIndex: 'action', - align: "center", - fixed: "right", + align: 'center', + fixed: 'right', width: 147, - scopedSlots: {customRender: 'action'}, + scopedSlots: { customRender: 'action' } } ], url: { - list: "/inventory/inventoryHeader/listInventoryDetailByMainId", - delete: "/inventory/inventoryHeader/deleteInventoryDetail", - deleteBatch: "/inventory/inventoryHeader/deleteBatchInventoryDetail", - exportXlsUrl: "/inventory/inventoryHeader/exportInventoryDetail", - importUrl: "/inventory/inventoryHeader/importInventoryDetail", + list: '/inventory/inventoryHeader/listInventoryDetailByMainId', + delete: '/inventory/inventoryHeader/deleteInventoryDetail', + deleteBatch: '/inventory/inventoryHeader/deleteBatchInventoryDetail', + exportXlsUrl: '/inventory/inventoryHeader/exportInventoryDetail', + importUrl: '/inventory/inventoryHeader/importInventoryDetail' }, dictOptions: { - containerStatus: [], + containerStatus: [] } } }, created() { - this.loadFrom(); + this.loadFrom() }, computed: { importExcelUrl() { - return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}`; + return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}` } }, methods: { loadFrom() { - getCompanyList().then((res) => { + 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)) { + Object.keys(this.companyList).some(key => { + if (this.companyList[key].code == '' + value) { actions.push(this.companyList[key].name) return true } @@ -282,10 +289,9 @@ export default { this.selectedRowKeys = [] this.ipagination.current = 1 } - } } </script> <style scoped> -@import '~@assets/less/common.less' +@import '~@assets/less/common.less'; </style> diff --git a/ant-design-vue-jeecg/src/views/system/inventory/SimpleInventoryDetailList.vue b/ant-design-vue-jeecg/src/views/system/inventory/SimpleInventoryDetailList.vue index 34a10d6..6b5894b 100644 --- a/ant-design-vue-jeecg/src/views/system/inventory/SimpleInventoryDetailList.vue +++ b/ant-design-vue-jeecg/src/views/system/inventory/SimpleInventoryDetailList.vue @@ -47,7 +47,11 @@ </a-col> <a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-form-item label="库存状态"> - <j-dict-select-tag placeholder="请选择库存状态" v-model="queryParam.inventoryStatus" dictCode="inventory_status"/> + <j-dict-select-tag + placeholder="请选择库存状态" + v-model="queryParam.inventoryStatus" + dictCode="inventory_status" + /> </a-form-item> </a-col> <a-col :xl="6" :lg="7" :md="8" :sm="24"> @@ -62,7 +66,12 @@ </a-col> --> <a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-form-item label="入库日期"> - <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择入库日期" v-model="queryParam.receiptDate"></j-date> + <j-date + :show-time="true" + date-format="YYYY-MM-DD HH:mm:ss" + placeholder="请选择入库日期" + v-model="queryParam.receiptDate" + ></j-date> </a-form-item> </a-col> <a-col :xl="6" :lg="7" :md="8" :sm="24"> @@ -77,7 +86,7 @@ <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-icon :type="toggleSearchStatus ? 'up' : 'down'" /> </a> </span> </a-col> @@ -89,67 +98,81 @@ <!-- 操作按钮区域 --> <div class="table-operator"> <a-button v-has="'inventoryDetail:add'" @click="handleAdd" type="primary" icon="plus">新增</a-button> - <a-button v-has="'inventoryDetail:export'" type="primary" icon="download" @click="handleExportXls('库存详情')">导出</a-button> - <a-upload v-has="'inventoryDetail:import'" name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> + <a-button v-has="'inventoryDetail:export'" type="primary" icon="download" @click="handleExportXls('库存详情')" + >导出</a-button + > + <a-upload + v-has="'inventoryDetail:import'" + 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" v-has="'inventoryDetail:superSearch'" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> -<!-- <a-dropdown v-if="selectedRowKeys.length > 0">--> -<!-- <a-menu slot="overlay">--> -<!-- <a-menu-item v-has="'inventoryDetail:delete'" key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>--> -<!-- </a-menu>--> -<!-- <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>--> -<!-- </a-dropdown>--> + <j-super-query + :fieldList="superFieldList" + v-has="'inventoryDetail:superSearch'" + ref="superQueryModal" + @handleSuperQuery="handleSuperQuery" + ></j-super-query> + <!-- <a-dropdown v-if="selectedRowKeys.length > 0">--> + <!-- <a-menu slot="overlay">--> + <!-- <a-menu-item v-has="'inventoryDetail:delete'" key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>--> + <!-- </a-menu>--> + <!-- <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>--> + <!-- </a-dropdown>--> </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>--> + <!-- <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" - :scroll="{x:true}" + :scroll="{ x: true }" bordered rowKey="id" :columns="columns" :dataSource="dataSource" :pagination="ipagination" :loading="loading" - :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" class="j-table-force-nowrap" - @change="handleTableChange"> - + @change="handleTableChange" + > <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;"/> + <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 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-has="'inventoryDetail:edit'" @click="handleEdit(record)">编辑<a-divider type="vertical" /></a> + <a v-has="'inventoryDetail:edit'" @click="handleEdit(record)">编辑<a-divider type="vertical"/></a> <a-popconfirm v-has="'inventoryDetail:delete'" title="确定删除吗?" @confirm="() => handleDelete(record.id)"> <a>删除</a> </a-popconfirm> </span> - </a-table> </div> @@ -158,187 +181,192 @@ </template> <script> +import '@/assets/less/TableExpand.less' +import { mixinDevice } from '@/utils/mixin' +import { JeecgListMixin } from '@/mixins/JeecgListMixin' +import SimpleInventoryDetailModal from './modules/SimpleInventoryDetailModal' +import { filterMultiDictText } from '@/components/dict/JDictSelectUtil' - import '@/assets/less/TableExpand.less' - import { mixinDevice } from '@/utils/mixin' - import { JeecgListMixin } from '@/mixins/JeecgListMixin' - import SimpleInventoryDetailModal from './modules/SimpleInventoryDetailModal' - import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' - - export default { - name: 'InventoryDetailList', - mixins:[JeecgListMixin, mixinDevice], - components: { - SimpleInventoryDetailModal - }, - data () { - return { - description: '库存详情管理页面', - // 表头 - columns: [ - { - title: '#', - dataIndex: '', - key:'rowIndex', - width:60, - align:"center", - customRender:function (t,r,index) { - return parseInt(index)+1; - } - }, - { - title:'货主', - align:"center", - dataIndex: 'companyCode' - }, - { - title:'库区', - align:"center", - dataIndex: 'zoneCode' - }, - { - title:'容器编码', - align:"center", - dataIndex: 'containerCode' - }, - { - title:'库位编码', - align:"center", - dataIndex: 'locationCode' - }, - { - title:'物料编码', - align:"center", - dataIndex: 'materialCode' - }, - { - title:'物料名称', - align:"center", - dataIndex: 'materialName' - }, - { - title:'物料规格', - align:"center", - dataIndex: 'materialSpec' - }, - { - title:'物料单位', - align:"center", - dataIndex: 'materialUnit' - }, - { - title:'数量', - align:"center", - dataIndex: 'qty' - }, - { - title:'任务锁定数量', - align:"center", - dataIndex: 'taskQty' - }, - { - title:'库存状态', - align:"center", - dataIndex: 'inventoryStatus_dictText' - }, - { - title:'批次', - align:"center", - dataIndex: 'batch' - }, - // { - // title:'唯一号', - // align:"center", - // dataIndex: 'uniqueCode' - // }, - { - title:'入库日期', - align:"center", - dataIndex: 'receiptDate' - }, - { - title:'库龄(天)', - align:"center", - dataIndex: 'inventoryAge' - }, - { - 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' } +export default { + name: 'InventoryDetailList', + mixins: [JeecgListMixin, mixinDevice], + components: { + SimpleInventoryDetailModal + }, + data() { + return { + description: '库存详情管理页面', + // 表头 + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + width: 60, + align: 'center', + customRender: function(t, r, index) { + return parseInt(index) + 1 } - ], - url: { - list: "/inventory/inventoryDetail/list", - delete: "/inventory/inventoryDetail/delete", - deleteBatch: "/inventory/inventoryDetail/deleteBatch", - exportXlsUrl: "/inventory/inventoryDetail/exportXls", - importExcelUrl: "inventory/inventoryDetail/importExcel", - }, - dictOptions:{}, - superFieldList:[], - } - }, - created() { - this.getSuperFieldList(); - }, - computed: { - importExcelUrl: function(){ - return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; - }, - }, - methods: { - initDictConfig(){ + { + title: '货主', + align: 'center', + dataIndex: 'companyCode' + }, + { + title: '库区', + align: 'center', + dataIndex: 'zoneCode' + }, + { + title: '容器编码', + align: 'center', + dataIndex: 'containerCode' + }, + { + title: '库位编码', + align: 'center', + dataIndex: 'locationCode' + }, + { + title: '物料编码', + align: 'center', + dataIndex: 'materialCode' + }, + { + title: '物料名称', + align: 'center', + dataIndex: 'materialName' + }, + { + title: '物料规格', + align: 'center', + dataIndex: 'materialSpec' + }, + { + title: '物料单位', + align: 'center', + dataIndex: 'materialUnit' + }, + { + title: '数量', + align: 'center', + dataIndex: 'qty' + }, + { + title: '任务锁定数量', + align: 'center', + dataIndex: 'taskQty' + }, + { + title: '托盘填充度', + align: 'center', + dataIndex: 'fillDensity', + customRender: text => { + return text == null ? '' : text + '%' + } + }, + { + title: '库存状态', + align: 'center', + dataIndex: 'inventoryStatus_dictText' + }, + { + title: '批次', + align: 'center', + dataIndex: 'batch' + }, + // { + // title:'唯一号', + // align:"center", + // dataIndex: 'uniqueCode' + // }, + { + title: '入库日期', + align: 'center', + dataIndex: 'receiptDate' + }, + { + title: '库龄(天)', + align: 'center', + dataIndex: 'inventoryAge' + }, + { + 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: '/inventory/inventoryDetail/list', + delete: '/inventory/inventoryDetail/delete', + deleteBatch: '/inventory/inventoryDetail/deleteBatch', + exportXlsUrl: '/inventory/inventoryDetail/exportXls', + importExcelUrl: 'inventory/inventoryDetail/importExcel' }, - getSuperFieldList(){ - let fieldList=[]; - fieldList.push({type:'string',value:'companyCode',text:'货主',dictCode:''}) - fieldList.push({type:'string',value:'zoneCode',text:'库区',dictCode:''}) - fieldList.push({type:'string',value:'containerCode',text:'容器编码',dictCode:''}) - fieldList.push({type:'string',value:'locationCode',text:'库位编码',dictCode:''}) - fieldList.push({type:'string',value:'materialCode',text:'物料编码',dictCode:''}) - fieldList.push({type:'string',value:'materialName',text:'物料名称',dictCode:''}) - fieldList.push({type:'string',value:'materialSpec',text:'物料规格',dictCode:''}) - fieldList.push({type:'string',value:'materialUnit',text:'物料单位',dictCode:''}) - fieldList.push({type:'BigDecimal',value:'qty',text:'数量',dictCode:''}) - fieldList.push({type:'BigDecimal',value:'taskQty',text:'任务锁定数量',dictCode:''}) - fieldList.push({type:'string',value:'inventoryStatus',text:'库存状态',dictCode:'inventory_status'}) - fieldList.push({type:'string',value:'batch',text:'批次',dictCode:''}) - // fieldList.push({type:'string',value:'uniqueCode',text:'唯一号',dictCode:''}) - fieldList.push({type:'datetime',value:'receiptDate',text:'入库日期'}) - fieldList.push({type:'int',value:'inventoryAge',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 - } + dictOptions: {}, + superFieldList: [] + } + }, + created() { + this.getSuperFieldList() + }, + computed: { + importExcelUrl: function() { + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}` + } + }, + methods: { + initDictConfig() {}, + getSuperFieldList() { + let fieldList = [] + fieldList.push({ type: 'string', value: 'companyCode', text: '货主', dictCode: '' }) + fieldList.push({ type: 'string', value: 'zoneCode', text: '库区', dictCode: '' }) + fieldList.push({ type: 'string', value: 'containerCode', text: '容器编码', dictCode: '' }) + fieldList.push({ type: 'string', value: 'locationCode', text: '库位编码', dictCode: '' }) + fieldList.push({ type: 'string', value: 'materialCode', text: '物料编码', dictCode: '' }) + fieldList.push({ type: 'string', value: 'materialName', text: '物料名称', dictCode: '' }) + fieldList.push({ type: 'string', value: 'materialSpec', text: '物料规格', dictCode: '' }) + fieldList.push({ type: 'string', value: 'materialUnit', text: '物料单位', dictCode: '' }) + fieldList.push({ type: 'BigDecimal', value: 'qty', text: '数量', dictCode: '' }) + fieldList.push({ type: 'BigDecimal', value: 'taskQty', text: '任务锁定数量', dictCode: '' }) + fieldList.push({ type: 'string', value: 'inventoryStatus', text: '库存状态', dictCode: 'inventory_status' }) + fieldList.push({ type: 'string', value: 'batch', text: '批次', dictCode: '' }) + // fieldList.push({type:'string',value:'uniqueCode',text:'唯一号',dictCode:''}) + fieldList.push({ type: 'datetime', value: 'receiptDate', text: '入库日期' }) + fieldList.push({ type: 'int', value: 'inventoryAge', 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'; +@import '~@assets/less/common.less'; </style> \ No newline at end of file diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/IContainerService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/IContainerService.java index 571e139..b0dd8c7 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/IContainerService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/IContainerService.java @@ -45,5 +45,5 @@ public interface IContainerService extends IService<Container> { */ boolean havaLocationCodeByContainer(String locationCode, String containerCode, String warehouseCode); - List<Container> getContainerListByCodeList(List<String> containCodeList, String warehouseCode); + List<Container> getContainerListByCodeList(List<String> containerCodeList, String warehouseCode); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java index 0c40a69..d07f537 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java @@ -159,9 +159,9 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container } @Override - public List<Container> getContainerListByCodeList(List<String> containCodeList, String warehouseCode) { + public List<Container> getContainerListByCodeList(List<String> containerCodeList, String warehouseCode) { LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); - containerLambdaQueryWrapper.in(Container::getCode, containCodeList).eq(Container::getWarehouseCode, warehouseCode); + containerLambdaQueryWrapper.in(Container::getCode, containerCodeList).eq(Container::getWarehouseCode, warehouseCode); List<Container> containerList = list(containerLambdaQueryWrapper); return containerList; } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryDetail/controller/InventoryDetailController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryDetail/controller/InventoryDetailController.java index 20d0424..1b6845c 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryDetail/controller/InventoryDetailController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryDetail/controller/InventoryDetailController.java @@ -11,6 +11,7 @@ import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; +import org.jeecg.utils.HuahengJwtUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; @@ -50,10 +51,10 @@ public class InventoryDetailController extends JeecgController<InventoryDetail, @GetMapping(value = "/list") public Result<IPage<InventoryDetail>> queryPageList(InventoryDetail inventoryDetail, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { + HuahengJwtUtil.setWarehouseCode(req, inventoryDetail); QueryWrapper<InventoryDetail> queryWrapper = QueryGenerator.initQueryWrapper(inventoryDetail, req.getParameterMap()); Page<InventoryDetail> page = new Page<InventoryDetail>(pageNo, pageSize); - IPage<InventoryDetail> pageList = inventoryDetailService.page(page, queryWrapper); - return Result.OK(pageList); + return Result.OK(inventoryDetailService.queryInventoryDetailPage(page, queryWrapper)); } /** diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java index 4ea1919..2cd4b91 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java @@ -22,7 +22,6 @@ 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.utils.HuahengJwtUtil; -import org.jeecg.utils.StringUtils; import org.jeecg.utils.constant.QuantityConstant; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; @@ -30,7 +29,15 @@ import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.servlet.ModelAndView; @@ -167,11 +174,11 @@ public class InventoryHeaderController extends JeecgController<InventoryHeader, @GetMapping(value = "/listInventoryDetailByMainId") public Result<IPage<InventoryDetail>> listInventoryDetailByMainId(InventoryDetail inventoryDetail, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, - HttpServletRequest req) { - QueryWrapper<InventoryDetail> queryWrapper = QueryGenerator.initQueryWrapper(inventoryDetail, req.getParameterMap()); + HttpServletRequest request) { + HuahengJwtUtil.setWarehouseCode(request, inventoryDetail); + QueryWrapper<InventoryDetail> queryWrapper = QueryGenerator.initQueryWrapper(inventoryDetail, request.getParameterMap()); Page<InventoryDetail> page = new Page<InventoryDetail>(pageNo, pageSize); - IPage<InventoryDetail> pageList = inventoryDetailService.page(page, queryWrapper); - return Result.OK(pageList); + return Result.OK(inventoryDetailService.queryInventoryDetailPage(page, queryWrapper)); } /** diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java index 745c4e1..3c1dad5 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java @@ -7,6 +7,7 @@ import org.jeecg.common.aspect.annotation.Dict; import org.jeecgframework.poi.excel.annotation.Excel; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -82,6 +83,10 @@ public class InventoryDetail implements Serializable { @Excel(name = "任务锁定数量", width = 15) @ApiModelProperty(value = "任务锁定数量") private java.math.BigDecimal taskQty; + /** 托盘填充度 */ + @ApiModelProperty(value = "托盘填充度") + @TableField(exist = false) + private java.math.BigDecimal fillDensity; /** 库存状态 */ @Excel(name = "库存状态", width = 15) @Dict(dicCode = "inventory_status") diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java index f8c59b3..f3e7ecc 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java @@ -3,8 +3,13 @@ package org.jeecg.modules.wms.inventory.inventoryHeader.service; import java.math.BigDecimal; import java.util.List; +import javax.servlet.http.HttpServletRequest; + import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; /** @@ -26,4 +31,14 @@ public interface IInventoryDetailService extends IService<InventoryDetail> { // 求一种物料的可出库存之和 BigDecimal getAvailSumQty(InventoryDetail inventoryDetail); + + /** + * 分页查询库存明细,组装容器填充度 + * @author TanYibin + * @createDate 2023年4月7日 + * @param page + * @param queryWrapper + * @return + */ + IPage<InventoryDetail> queryInventoryDetailPage(Page<InventoryDetail> page, QueryWrapper<InventoryDetail> queryWrapper); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java index 28b58d6..ae254d4 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java @@ -1,17 +1,36 @@ package org.jeecg.modules.wms.inventory.inventoryHeader.service.impl; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; +import javax.servlet.http.HttpServletRequest; + +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.modules.wms.config.container.entity.Container; +import org.jeecg.modules.wms.config.container.service.IContainerService; +import org.jeecg.modules.wms.config.containerCapacity.entity.ContainerCapacity; +import org.jeecg.modules.wms.config.containerCapacity.service.IContainerCapacityService; +import org.jeecg.modules.wms.config.location.entity.Location; +import org.jeecg.modules.wms.config.material.entity.Material; import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; import org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryDetailMapper; import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; import org.jeecg.utils.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.RequestParam; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; /** @@ -26,6 +45,12 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe @Autowired private InventoryDetailMapper inventoryDetailMapper; + @Autowired + private IContainerService containerService; + + @Autowired + private IContainerCapacityService containerCapacityService; + @Override public List<InventoryDetail> selectByMainId(String mainId) { return inventoryDetailMapper.selectByMainId(mainId); @@ -82,4 +107,47 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe BigDecimal totalQty = inventoryDetailList.stream().map(InventoryDetail::getQty).reduce(BigDecimal.ZERO, BigDecimal::add); return totalQty; } + + @Override + public IPage<InventoryDetail> queryInventoryDetailPage(Page<InventoryDetail> page, QueryWrapper<InventoryDetail> queryWrapper) { + IPage<InventoryDetail> pageResult = this.page(page, queryWrapper); + List<InventoryDetail> inventoryDetailList = pageResult.getRecords(); + if (!CollectionUtils.isEmpty(inventoryDetailList)) { + this.calculateFillDensity(inventoryDetailList); + } + return pageResult; + } + + /** + * 计算库存明细托盘填充度 + * @author TanYibin + * @createDate 2023年4月7日 + * @param inventoryDetailList + */ + private void calculateFillDensity(List<InventoryDetail> inventoryDetailList) { + // 根据仓库编码分组库存明细 + Map<String, List<InventoryDetail>> warehouseInventoryDetailMap = + inventoryDetailList.stream().collect(Collectors.groupingBy(InventoryDetail::getWarehouseCode)); + for (String warehouseCode : warehouseInventoryDetailMap.keySet()) { + List<InventoryDetail> warehouseInventoryDetailList = warehouseInventoryDetailMap.get(warehouseCode); + List<String> containerCodeList = warehouseInventoryDetailList.stream().filter(t -> StringUtils.isNotEmpty(t.getContainerCode())) + .map(t -> t.getContainerCode()).collect(Collectors.toList()); + // 获取 容器信息 + List<Container> containerList = containerService.getContainerListByCodeList(containerCodeList, warehouseCode); + Map<String, Container> containerMap = containerList.stream().collect(Collectors.toMap(Container::getCode, Function.identity(), (key1, key2) -> key2)); + for (InventoryDetail inventoryDetail : warehouseInventoryDetailList) { + Container container = containerMap.get(inventoryDetail.getContainerCode()); + LambdaQueryWrapper<ContainerCapacity> containerCapacityWrapper = Wrappers.lambdaQuery(); + containerCapacityWrapper.eq(ContainerCapacity::getWarehouseCode, warehouseCode) + .eq(StringUtils.isNotEmpty(container.getContainerTypeCode()), ContainerCapacity::getContainerTypeCode, container.getContainerTypeCode()) + .eq(StringUtils.isNotEmpty(inventoryDetail.getMaterialCode()), ContainerCapacity::getMaterialCode, inventoryDetail.getMaterialCode()); + ContainerCapacity containerCapacity = containerCapacityService.getOne(containerCapacityWrapper); + if (containerCapacity != null && containerCapacity.getQty() != null && containerCapacity.getQty().compareTo(BigDecimal.ZERO) > 0) { + // 进行填充度计算 保留2位小数 + BigDecimal fillDensity = inventoryDetail.getQty().divide(containerCapacity.getQty(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); + inventoryDetail.setFillDensity(fillDensity); + } + } + } + } }