diff --git a/ant-design-vue-jeecg/src/api/api.js b/ant-design-vue-jeecg/src/api/api.js index 3a7a5b2..6846c59 100644 --- a/ant-design-vue-jeecg/src/api/api.js +++ b/ant-design-vue-jeecg/src/api/api.js @@ -107,6 +107,8 @@ export const getLocationTypeList = (params) => getAction('/config/locationType/g export const getLocationHighList = (params) => postAction('/config/locationHigh/getLocationHighList', params); //获取货主列表 export const getCompanyList = (params) => getAction('/config/company/getCompanyList', params); +//获取盘点类型列表 +export const getCountTypeList = (params) => getAction('/config/cycleCountPreference/getCountTypeList', params); //获取承运商列表 export const getCarrierList = (params) => getAction('/config/carrier/getCarrierList', params); //获取客户列表 diff --git a/ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountDetailList.vue b/ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountDetailList.vue new file mode 100644 index 0000000..88da66d --- /dev/null +++ b/ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountDetailList.vue @@ -0,0 +1,305 @@ +<template> + <a-card class="j-inner-table-wrapper" :bordered="false"> + + <!-- 查询区域 begin --> + <div class="table-page-search-wrapper"> + <a-form layout="inline"> + <a-row :gutter="24"> + </a-row> + </a-form> + </div> + <!-- 查询区域 end --> + + <!-- 操作按钮区域 begin --> + <div class="table-operator"> + <a-button type="primary" icon="plus" @click="handleAdd">新增</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> + <a-dropdown v-if="selectedRowKeys.length > 0"> + <a-menu slot="overlay"> + <a-menu-item key="1" @click="batchDel"> + <a-icon type="delete"/> + <span>删除</span> + </a-menu-item> + </a-menu> + <a-button> + <span>批量操作</span> + <a-icon type="down"/> + </a-button> + </a-dropdown> + </div> + <!-- 操作按钮区域 end --> + + <!-- table区域 begin --> + <div> + + <a-alert type="info" showIcon style="margin-bottom: 16px;"> + <template slot="message"> + <span>已选择</span> + <a style="font-weight: 600;padding: 0 4px;">{{ selectedRowKeys.length }}</a> + <span>项</span> + <a style="margin-left: 24px" @click="onClearSelected">清空</a> + </template> + </a-alert> + + <a-table + ref="table" + size="middle" + bordered + rowKey="id" + class="j-table-force-nowrap" + :scroll="{x:true}" + :loading="loading" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :expandedRowKeys="expandedRowKeys" + :rowSelection="{selectedRowKeys, onChange: onSelectChange}" + @expand="handleExpand" + @change="handleTableChange" + > + + <!-- 内嵌table区域 begin --> + <template slot="expandedRowRender" slot-scope="record"> + <a-tabs tabPosition="top"> + <a-tab-pane tab="盘点容器明细表" key="cycleCountDetailChild" forceRender> + <cycle-count-detail-child-sub-table :record="record"/> + </a-tab-pane> + </a-tabs> + </template> + <!-- 内嵌table区域 end --> + + <template slot="htmlSlot" slot-scope="text"> + <div v-html="text"></div> + </template> + + <template slot="imgSlot" slot-scope="text"> + <div style="font-size: 12px;font-style: italic;"> + <span v-if="!text">无图片</span> + <img v-else :src="getImgView(text)" alt="" style="max-width:80px;height:25px;"/> + </div> + </template> + + + <template slot="fileSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> + <a-button + v-else + ghost + type="primary" + icon="download" + size="small" + @click="downloadFile(text)" + > + <span>下载</span> + </a-button> + </template> + + <template slot="action" slot-scope="text, record"> + <a @click="handleEdit(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-popconfirm title="确定删除吗?" @confirm="handleDelete(record.id)"> + <a>删除</a> + </a-popconfirm> + </a-menu-item> + </a-menu> + </a-dropdown> + + </template> + + </a-table> + </div> + <!-- table区域 end --> + + <!-- 表单区域 --> + <cycle-count-detail-modal ref="modalForm" @ok="modalFormOk"/> + + </a-card> +</template> + +<script> + + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import CycleCountDetailModal from './modules/CycleCountDetailModal' + import CycleCountDetailChildSubTable from './subTables/CycleCountDetailChildSubTable' + import '@/assets/less/TableExpand.less' + + export default { + name: 'CycleCountDetailList', + mixins: [JeecgListMixin], + components: { + CycleCountDetailModal, + CycleCountDetailChildSubTable, + }, + data() { + return { + description: '盘点明细表列表管理页面', + // 表头 + columns: [ + { + title: '#', + key: 'rowIndex', + width: 60, + align: 'center', + customRender: (t, r, index) => parseInt(index) + 1 + }, + { + title: '盘点主单id', + align: 'center', + dataIndex: 'cycleCountHeadId', + }, + { + title: '盘点主单code', + align: 'center', + dataIndex: 'cycleCountHeadCode', + }, + { + title: '任务表头', + align: 'center', + dataIndex: 'taskHeaderId', + }, + { + title: '任务明细头', + align: 'center', + dataIndex: 'taskDetailId', + }, + { + title: '仓库', + align: 'center', + dataIndex: 'warehouseCode', + }, + { + title: '货主', + align: 'center', + dataIndex: 'companyCode', + }, + { + title: '库存明细头', + align: 'center', + dataIndex: 'inventoryDetailId', + }, + { + title: '库位', + align: 'center', + dataIndex: 'locationCode', + }, + { + title: '容器', + align: 'center', + dataIndex: 'containerCode', + }, + { + title: '库存状态', + align: 'center', + dataIndex: 'inventorySts', + }, + { + title: '系统数量', + align: 'center', + dataIndex: 'systemQty', + }, + { + title: '实盘数量', + align: 'center', + dataIndex: 'countedQty', + }, + { + title: '差异数量', + align: 'center', + dataIndex: 'gapQty', + }, + { + title: '失败原因', + align: 'center', + dataIndex: 'rejectionNote', + }, + { + title: '完成用户', + align: 'center', + dataIndex: 'completedBy', + }, + { + title: '完成时间', + align: 'center', + dataIndex: 'completedAt', + }, + { + title: '盘点明细状态', + align: 'center', + dataIndex: 'enableStatus', + }, + { + title: '操作', + dataIndex: 'action', + align: 'center', + width:147, + scopedSlots: { customRender: 'action' }, + }, + ], + // 字典选项 + dictOptions: {}, + // 展开的行test + expandedRowKeys: [], + url: { + list: '/cycleCountDetail/cycleCountDetail/list', + delete: '/cycleCountDetail/cycleCountDetail/delete', + deleteBatch: '/cycleCountDetail/cycleCountDetail/deleteBatch', + exportXlsUrl: '/cycleCountDetail/cycleCountDetail/exportXls', + importExcelUrl: '/cycleCountDetail/cycleCountDetail/importExcel', + }, + superFieldList:[], + } + }, + created() { + this.getSuperFieldList(); + }, + computed: { + importExcelUrl() { + return window._CONFIG['domianURL'] + this.url.importExcelUrl + } + }, + methods: { + initDictConfig() { + }, + + handleExpand(expanded, record) { + this.expandedRowKeys = [] + if (expanded === true) { + this.expandedRowKeys.push(record.id) + } + }, + getSuperFieldList(){ + let fieldList=[]; + fieldList.push({type:'string',value:'cycleCountHeadId',text:'盘点主单id',dictCode:''}) + fieldList.push({type:'string',value:'cycleCountHeadCode',text:'盘点主单code',dictCode:''}) + fieldList.push({type:'string',value:'taskHeaderId',text:'任务表头',dictCode:''}) + fieldList.push({type:'string',value:'taskDetailId',text:'任务明细头',dictCode:''}) + fieldList.push({type:'string',value:'warehouseCode',text:'仓库',dictCode:''}) + fieldList.push({type:'string',value:'companyCode',text:'货主',dictCode:''}) + fieldList.push({type:'string',value:'inventoryDetailId',text:'库存明细头',dictCode:''}) + fieldList.push({type:'string',value:'locationCode',text:'库位',dictCode:''}) + fieldList.push({type:'string',value:'containerCode',text:'容器',dictCode:''}) + fieldList.push({type:'string',value:'inventorySts',text:'库存状态',dictCode:''}) + fieldList.push({type:'string',value:'systemQty',text:'系统数量',dictCode:''}) + fieldList.push({type:'string',value:'countedQty',text:'实盘数量',dictCode:''}) + fieldList.push({type:'string',value:'gapQty',text:'差异数量',dictCode:''}) + fieldList.push({type:'string',value:'rejectionNote',text:'失败原因',dictCode:''}) + fieldList.push({type:'string',value:'completedBy',text:'完成用户',dictCode:''}) + fieldList.push({type:'string',value:'completedAt',text:'完成时间',dictCode:''}) + fieldList.push({type:'string',value:'enableStatus',text:'盘点明细状态',dictCode:''}) + this.superFieldList = fieldList + } + } + } +</script> +<style lang="less" scoped> + @import '~@assets/less/common.less'; +</style> \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountHeaderList.vue b/ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountHeaderList.vue new file mode 100644 index 0000000..17672d2 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountHeaderList.vue @@ -0,0 +1,301 @@ +<template> + <a-card :bordered="false"> + <!-- 查询区域 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + </a-row> + </a-form> + </div> + <!-- 查询区域-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> + <a-dropdown v-if="selectedRowKeys.length > 0"> + <a-menu slot="overlay"> + <a-menu-item 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> + + <a-table + ref="table" + size="middle" + :scroll="{x:true}" + bordered + rowKey="id" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + class="j-table-force-nowrap" + @change="handleTableChange"> + + <span slot="companyCode" slot-scope="companyCode"> + <a-tag :key="companyCode" color=blue> + {{ solutionCompany(companyCode) }} + </a-tag> + </span> + + + <span slot="countType" slot-scope="countType"> + <a-tag :key="countType" color=pink> + {{ solutionCountType(countType) }} + </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 @click="handleEdit(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="handleDetail(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> + + <cycle-count-header-modal ref="modalForm" @ok="modalFormOk"></cycle-count-header-modal> + </a-card> +</template> + +<script> + + import '@/assets/less/TableExpand.less' + import { mixinDevice } from '@/utils/mixin' + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import {getCompanyList} from '@/api/api' + import {getCountTypeList} from '@/api/api' + import CycleCountHeaderModal from './modules/CycleCountHeaderModal' + + export default { + name: 'CycleCountHeaderList', + mixins:[JeecgListMixin, mixinDevice], + components: { + CycleCountHeaderModal + }, + data () { + return { + description: '盘点主表管理页面', + companyList: [], + CountTypeList:[], + // 表头 + columns: [ + { + title: 'ID', + dataIndex: '', + key:'rowIndex', + width:60, + align:"center", + customRender:function (t,r,index) { + return parseInt(index)+1; + } + }, + { + title:'盘点单编码', + align:"center", + dataIndex: 'code' + }, + { + title:'货主编码', + align: "center", + dataIndex: 'companyCode', + key: 'companyCode', + scopedSlots: {customRender: 'companyCode'} + }, + { + title:'总货位数', + align:"center", + dataIndex: 'totalLocs' + }, + { + title:'总物料数', + align:"center", + dataIndex: 'totalItems' + }, + { + title:'盘点类型', + align:"center", + dataIndex: 'countType', + key: 'countType', + scopedSlots: {customRender: 'countType'} + }, + { + title:'盘点主单状态', + align:"center", + dataIndex: 'statusCyc_dictText' + }, + { + title:'指定盘点人员', + align:"center", + dataIndex: 'stocktakingAs' + }, + { + title:'实际盘点人员', + align:"center", + dataIndex: 'stocktakingAc' + }, + { + title:'是否有效', + align:"center", + dataIndex: 'enable_dictText' + }, + // { + // title:'回传时间', + // align:"center", + // dataIndex: 'uploadTime' + // }, + // { + // title:'回传状态', + // align:"center", + // dataIndex: 'uploadStatusString' + // }, + // { + // title:'关闭人', + // align:"center", + // dataIndex: 'closedBy' + // }, + { + title:'备注', + align:"center", + dataIndex: 'remark' + }, + { + title: '操作', + dataIndex: 'action', + align:"center", + fixed:"right", + width:147, + scopedSlots: { customRender: 'action' } + } + ], + url: { + list: "/cycleCountHeader/cycleCountHeader/list", + delete: "/cycleCountHeader/cycleCountHeader/delete", + deleteBatch: "/cycleCountHeader/cycleCountHeader/deleteBatch", + exportXlsUrl: "/cycleCountHeader/cycleCountHeader/exportXls", + importExcelUrl: "cycleCountHeader/cycleCountHeader/importExcel", + + }, + dictOptions:{ + status: [], + }, + superFieldList:[], + } + }, + created() { + this.getSuperFieldList(); + this.loadFrom(); + }, + computed: { + importExcelUrl: function(){ + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; + }, + }, + methods: { + initDictConfig(){ + }, + getSuperFieldList(){ + let fieldList=[]; + fieldList.push({type:'string',value:'code',text:'盘点主表编号',dictCode:''}) + fieldList.push({type:'string',value:'companyCode',text:'货主编码',dictCode:''}) + fieldList.push({type:'string',value:'countType',text:'盘点类型',dictCode:''}) + fieldList.push({type:'int',value:'statusCyc',text:'盘点状态',dictCode:'cyclecount_status'}) + fieldList.push({type:'string',value:'remark',text:'备注',dictCode:''}) + fieldList.push({type:'int',value:'totalLocs',text:'总货位数',dictCode:''}) + fieldList.push({type:'int',value:'totalItems',text:'总物料数',dictCode:''}) + fieldList.push({type:'string',value:'stocktakingAs',text:'指定盘点人员',dictCode:''}) + fieldList.push({type:'string',value:'stocktakingAc',text:'实际盘点人员',dictCode:''}) + fieldList.push({type:'int',value:'enable',text:'是否有效',dictCode:'valid_status'}) + fieldList.push({type:'datetime',value:'uploadTime',text:'回传时间'}) + fieldList.push({type:'int',value:'uploadStatus',text:'回传状态',dictCode:'valid_status'}) + fieldList.push({type:'string',value:'closedBy',text:'关闭人',dictCode:''}) + this.superFieldList = fieldList + }, + loadFrom() { + getCompanyList().then((res) => { + if (res.success) { + this.companyList = res.result + } + }); + getCountTypeList().then((res) => { + if (res.success) { + this.CountTypeList = 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('') + }, + + solutionCountType(value) { + var actions = [] + Object.keys(this.CountTypeList).some((key) => { + if (this.CountTypeList[key].code == ('' + value)) { + actions.push(this.CountTypeList[key].name) + return true + } + }) + return actions.join('') + }, + + } + } +</script> +<style scoped> + @import '~@assets/less/common.less'; +</style> \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountDetailChildForm.vue b/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountDetailChildForm.vue new file mode 100644 index 0000000..c7987e3 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountDetailChildForm.vue @@ -0,0 +1,169 @@ +<template> + <j-form-container :disabled="disabled"> + <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> + <a-row> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="盘点主单code" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="cyclecountheadcode"> + <a-input v-model="model.cyclecountheadcode" placeholder="请输入盘点主单code"></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="盘点明细ID主id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="cycleCountDetailid"> + <a-input v-model="model.cycleCountDetailid" placeholder="请输入盘点明细ID主id"></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="盘点明细子单状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="childStatus"> + <a-input v-model="model.childStatus" placeholder="请输入盘点明细子单状态"></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="库位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="locationCode"> + <a-input v-model="model.locationCode" placeholder="请输入库位"></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <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 :xs="24" :sm="12"> + <a-form-model-item label="物料编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialCode"> + <a-input v-model="model.materialCode" placeholder="请输入物料编码"></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="物料名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialName"> + <a-input v-model="model.materialName" placeholder="请输入物料名称"></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="物料规格" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialSpec"> + <a-input v-model="model.materialSpec" placeholder="请输入物料规格"></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="物料单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialUnit"> + <a-input v-model="model.materialUnit" placeholder="请输入物料单位"></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="系统数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="systemQty"> + <a-input v-model="model.systemQty" placeholder="请输入系统数量"></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="实盘数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="countedQty"> + <a-input v-model="model.countedQty" placeholder="请输入实盘数量"></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="差异数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="gapQty"> + <a-input v-model="model.gapQty" placeholder="请输入差异数量"></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="库存明细id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inventoryDetaiId"> + <a-input v-model="model.inventoryDetaiId" placeholder="请输入库存明细id"></a-input> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </j-form-container> +</template> +<script> + import { getAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + import { VALIDATE_NO_PASSED } from '@/utils/JEditableTableUtil' + + export default { + name: 'CycleCountDetailChildForm', + components: { + }, + props:{ + disabled: { + type: Boolean, + default: false, + required: false + } + }, + data () { + return { + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, +validatorRules: { +}, + confirmLoading: false, + } + }, + created () { + //备份model原始值 + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods:{ + initFormData(url,id){ + this.clearFormData() + if(!id){ + this.edit(this.modelDefault); + }else{ + getAction(url,{id:id}).then(res=>{ + if(res.success){ + let records = res.result.records + if(records && records.length>0){ + this.edit(records[0]) + } + } + }) + } + }, + edit(record){ + this.model = Object.assign({}, record) + }, + getFormData(){ + let formdata_arr = [] + this.$refs.form.validate(valid => { + if (valid) { + let isNullObj = true + Object.keys(this.model).forEach(key=>{ + if(this.model[key]){ + isNullObj = false + } + }) + if(!isNullObj){ + formdata_arr.push(this.model) + } + }else{ + this.$emit("validateError","盘点容器明细表表单校验未通过"); + return false + } + }) + return formdata_arr; + }, + validate(index){ + return new Promise((resolve, reject) => { + // 验证主表表单 + this.$refs.form.validate(valid => { + !valid ? reject({ error: VALIDATE_NO_PASSED ,index}) : resolve() + }) + }).then(values => { + return Promise.resolve() + }).catch(error => { + return Promise.reject(error) + }) + + }, + clearFormData(){ + this.$refs.form.clearValidate() + } + + } + } +</script> diff --git a/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountDetailForm.vue b/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountDetailForm.vue new file mode 100644 index 0000000..b39fbaf --- /dev/null +++ b/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountDetailForm.vue @@ -0,0 +1,226 @@ +<template> + <a-spin :spinning="confirmLoading"> + <j-form-container :disabled="formDisabled"> + <!-- 主表单区域 --> + <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> + <a-row> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="盘点主单id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="cycleCountHeadId"> + <a-input v-model="model.cycleCountHeadId" placeholder="请输入盘点主单id" ></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="盘点主单code" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="cycleCountHeadCode"> + <a-input v-model="model.cycleCountHeadCode" placeholder="请输入盘点主单code" ></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="任务表头" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="taskHeaderId"> + <a-input v-model="model.taskHeaderId" placeholder="请输入任务表头" ></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="任务明细头" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="taskDetailId"> + <a-input v-model="model.taskDetailId" placeholder="请输入任务明细头" ></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="仓库" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="warehouseCode"> + <a-input v-model="model.warehouseCode" placeholder="请输入仓库" ></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="货主" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="companyCode"> + <a-input v-model="model.companyCode" placeholder="请输入货主" ></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="库存明细头" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inventoryDetailId"> + <a-input v-model="model.inventoryDetailId" placeholder="请输入库存明细头" ></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="库位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="locationCode"> + <a-input v-model="model.locationCode" placeholder="请输入库位" ></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <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 :xs="24" :sm="12"> + <a-form-model-item label="库存状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inventorySts"> + <a-input v-model="model.inventorySts" placeholder="请输入库存状态" ></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="系统数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="systemQty"> + <a-input v-model="model.systemQty" placeholder="请输入系统数量" ></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="实盘数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="countedQty"> + <a-input v-model="model.countedQty" placeholder="请输入实盘数量" ></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="差异数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="gapQty"> + <a-input v-model="model.gapQty" placeholder="请输入差异数量" ></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="失败原因" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="rejectionNote"> + <a-input v-model="model.rejectionNote" placeholder="请输入失败原因" ></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="完成用户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="completedBy"> + <a-input v-model="model.completedBy" placeholder="请输入完成用户" ></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="完成时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="completedAt"> + <a-input v-model="model.completedAt" placeholder="请输入完成时间" ></a-input> + </a-form-model-item> + </a-col> + <a-col :xs="24" :sm="12"> + <a-form-model-item label="盘点明细状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="enableStatus"> + <a-input v-model="model.enableStatus" placeholder="请输入盘点明细状态" ></a-input> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </j-form-container> + <!-- 子表单区域 --> + <a-tabs v-model="activeKey" @change="handleChangeTabs"> + <a-tab-pane tab="盘点容器明细表" :key="refKeys[0]" :forceRender="true"> + <cycle-count-detail-child-form ref="cycleCountDetailChildForm" @validateError="validateError" :disabled="formDisabled"></cycle-count-detail-child-form> + </a-tab-pane> + + </a-tabs> + </a-spin> +</template> + +<script> + + import { FormTypes,getRefPromise,VALIDATE_NO_PASSED } from '@/utils/JEditableTableUtil' + import { JEditableTableModelMixin } from '@/mixins/JEditableTableModelMixin' + import { validateDuplicateValue } from '@/utils/util' + import CycleCountDetailChildForm from './CycleCountDetailChildForm.vue' + + export default { + name: 'CycleCountDetailForm', + mixins: [JEditableTableModelMixin], + components: { + CycleCountDetailChildForm, + }, + data() { + return { + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + model:{ + }, +validatorRules: { +}, + // 新增时子表默认添加几行空数据 + addDefaultRowNum: 1, + refKeys: ['cycleCountDetailChild', ], + tableKeys:[], + activeKey: 'cycleCountDetailChild', + // 盘点容器明细表 + cycleCountDetailChildTable: { + loading: false, + dataSource: [], + columns: [ + ] + }, + url: { + add: "/cycleCountDetail/cycleCountDetail/add", + edit: "/cycleCountDetail/cycleCountDetail/edit", + cycleCountDetailChild: { + list: '/cycleCountDetail/cycleCountDetail/queryCycleCountDetailChildByMainId' + }, + } + } + }, + props: { + //表单禁用 + disabled: { + type: Boolean, + default: false, + required: false + } + }, + computed: { + formDisabled(){ + return this.disabled + }, + }, + created () { + }, + methods: { + addBefore(){ + this.$refs.cycleCountDetailChildForm.clearFormData() + }, + getAllTable() { + let values = this.tableKeys.map(key => getRefPromise(this, key)) + return Promise.all(values) + }, + /** 调用完edit()方法之后会自动调用此方法 */ + editAfter() { + this.$nextTick(() => { + this.$refs.cycleCountDetailChildForm.initFormData(this.url.cycleCountDetailChild.list,this.model.id) + }) + // 加载子表数据 + if (this.model.id) { + let params = { id: this.model.id } + } + }, + //校验所有一对一子表表单 + validateSubForm(allValues){ + return new Promise((resolve,reject)=>{ + Promise.all([ + this.$refs.cycleCountDetailChildForm.validate(0), + ]).then(() => { + resolve(allValues) + }).catch(e => { + if (e.error === VALIDATE_NO_PASSED) { + // 如果有未通过表单验证的子表,就自动跳转到它所在的tab + this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index] + } else { + console.error(e) + } + }) + }) + }, + /** 整理成formData */ + classifyIntoFormData(allValues) { + let main = Object.assign(this.model, allValues.formValue) + + return { + ...main, // 展开 + cycleCountDetailChildList: this.$refs.cycleCountDetailChildForm.getFormData(), + } + }, + validateError(msg){ + this.$message.error(msg) + }, + close() { + this.visible = false + this.$emit('close') + this.$refs.form.clearValidate(); + }, + + } + } +</script> + +<style scoped> +</style> \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountDetailModal.vue b/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountDetailModal.vue new file mode 100644 index 0000000..d09f65b --- /dev/null +++ b/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountDetailModal.vue @@ -0,0 +1,61 @@ +<template> + <j-modal + :title="title" + :width="1200" + :visible="visible" + :maskClosable="false" + switchFullscreen + @ok="handleOk" + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" + @cancel="handleCancel"> + <cycle-count-detail-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"/> + </j-modal> +</template> + +<script> + import CycleCountDetailForm from './CycleCountDetailForm' + export default { + name: 'CycleCountDetailModal', + components: { + CycleCountDetailForm + }, + data() { + return { + title:'', + visible: false, + disableSubmit: false + } + }, + methods:{ + add () { + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.add(); + }) + }, + edit (record) { + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.edit(record); + }) + }, + close () { + this.$emit('close'); + this.visible = false; + }, + handleOk () { + this.$refs.realForm.handleOk(); + }, + submitCallback(){ + this.$emit('ok'); + this.visible = false; + }, + handleCancel () { + this.close() + } + } + } +</script> + +<style scoped> +</style> \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountHeaderForm.vue b/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountHeaderForm.vue new file mode 100644 index 0000000..d2ebc0b --- /dev/null +++ b/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountHeaderForm.vue @@ -0,0 +1,166 @@ +<template> + <a-spin :spinning="confirmLoading"> + <j-form-container :disabled="formDisabled"> + <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> + <a-row> + <a-col :span="24"> + <a-form-model-item label="货主" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="companyCode"> + <a-select + show-search + placeholder="请选择货主" + option-filter-prop="children" + :filter-option="filterOption" + v-model="model.companyCode"> + <a-select-option v-for="item in companyList" :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="countType"> + <a-select + show-search + placeholder="请输入盘点类型" + option-filter-prop="children" + :filter-option="filterOption" + v-model="model.countType"> + <a-select-option v-for="item in CountTypeList" :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="stocktakingAs"> + <j-select-multi-user v-model="model.stocktakingAs" :query-config="selectUserQueryConfig"/> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark"> + <a-input v-model="model.remark" placeholder="请输入备注" ></a-input> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </j-form-container> + </a-spin> +</template> + +<script> + + import { httpAction, getAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + import {getCompanyList} from '@/api/api' + import {getCountTypeList} from '@/api/api' + + export default { + name: 'CycleCountHeaderForm', + components: { + }, + props: { + //表单禁用 + disabled: { + type: Boolean, + default: false, + required: false + } + }, + data () { + return { + // 选择用户查询条件配置 + selectUserQueryConfig: [ + {key: 'phone', label: '电话'}, + ], + companyList: [], + CountTypeList:[], + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + confirmLoading: false, + validatorRules: { + }, + url: { + add: "/cycleCountHeader/cycleCountHeader/add", + edit: "/cycleCountHeader/cycleCountHeader/edit", + queryById: "/cycleCountHeader/cycleCountHeader/queryById" + } + } + }, + computed: { + formDisabled(){ + return this.disabled + }, + }, + created () { + //备份model原始值 + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + this.loadFrom(); + }, + methods: { + add () { + this.edit(this.modelDefault); + }, + edit (record) { + this.model = Object.assign({}, record); + this.visible = true; + }, + loadFrom() { + getCompanyList().then((res) => { + if (res.success) { + this.companyList = res.result + this.model.companyCode = this.companyList[0].code; + } + }); + + getCountTypeList().then((res) => { + if (res.success) { + this.CountTypeList = res.result + this.model.countType = this.CountTypeList[0].code; + } + }); + }, + submitForm () { + const that = this; + // 触发表单验证 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + let httpurl = ''; + let method = ''; + if(!this.model.id){ + httpurl+=this.url.add; + method = 'post'; + }else{ + httpurl+=this.url.edit; + method = 'put'; + } + httpAction(httpurl,this.model,method).then((res)=>{ + if(res.success){ + that.$message.success(res.message); + that.$emit('ok'); + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + }) + } + + }) + }, + } + } +</script> \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountHeaderModal.vue b/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountHeaderModal.vue new file mode 100644 index 0000000..0e8b912 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountHeaderModal.vue @@ -0,0 +1,60 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + switchFullscreen + @ok="handleOk" + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" + @cancel="handleCancel" + cancelText="关闭"> + <cycle-count-header-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></cycle-count-header-form> + </j-modal> +</template> + +<script> + + import CycleCountHeaderForm from './CycleCountHeaderForm' + export default { + name: 'CycleCountHeaderModal', + components: { + CycleCountHeaderForm + }, + data () { + return { + title:'', + width:800, + visible: false, + disableSubmit: false + } + }, + methods: { + add () { + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.add(); + }) + }, + edit (record) { + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.edit(record); + }) + }, + close () { + this.$emit('close'); + this.visible = false; + }, + handleOk () { + this.$refs.realForm.submitForm(); + }, + submitCallback(){ + this.$emit('ok'); + this.visible = false; + }, + handleCancel () { + this.close() + } + } + } +</script> \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/system/stocktaking/subTables/CycleCountDetailChildSubTable.vue b/ant-design-vue-jeecg/src/views/system/stocktaking/subTables/CycleCountDetailChildSubTable.vue new file mode 100644 index 0000000..ddbf509 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/system/stocktaking/subTables/CycleCountDetailChildSubTable.vue @@ -0,0 +1,163 @@ +<template> + <a-table + rowKey="id" + size="middle" + bordered + :loading="loading" + :columns="columns" + :dataSource="dataSource" + :pagination="false" + > + + <template slot="htmlSlot" slot-scope="text"> + <div v-html="text"></div> + </template> + + <template slot="imgSlot" slot-scope="text"> + <div style="font-size: 12px;font-style: italic;"> + <span v-if="!text">无图片</span> + <img v-else :src="getImgView(text)" alt="" style="max-width:80px;height:25px;"/> + </div> + </template> + + <template slot="fileSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> + <a-button + v-else + ghost + type="primary" + icon="download" + size="small" + @click="downloadFile(text)" + > + <span>下载</span> + </a-button> + </template> + + </a-table> +</template> + +<script> + import { getAction } from '@api/manage' + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + + export default { + name: 'CycleCountDetailChildSubTable', + mixins: [JeecgListMixin], + props: { + record: { + type: Object, + default: null, + } + }, + data() { + return { + description: '盘点容器明细表内嵌列表', + disableMixinCreated: true, + loading: false, + dataSource: [], + columns: [ + { + title: '盘点主单code', + align: 'center', + dataIndex: 'cyclecountheadcode', + }, + { + title: '盘点明细ID主id', + align: 'center', + dataIndex: 'cycleCountDetailid', + }, + { + title: '盘点明细子单状态', + align: 'center', + dataIndex: 'childStatus', + }, + { + title: '库位', + align: 'center', + dataIndex: 'locationCode', + }, + { + title: '容器', + align: 'center', + dataIndex: 'containerCode', + }, + { + title: '物料编码', + align: 'center', + dataIndex: 'materialCode', + }, + { + title: '物料名称', + align: 'center', + dataIndex: 'materialName', + }, + { + title: '物料规格', + align: 'center', + dataIndex: 'materialSpec', + }, + { + title: '物料单位', + align: 'center', + dataIndex: 'materialUnit', + }, + { + title: '系统数量', + align: 'center', + dataIndex: 'systemQty', + }, + { + title: '实盘数量', + align: 'center', + dataIndex: 'countedQty', + }, + { + title: '差异数量', + align: 'center', + dataIndex: 'gapQty', + }, + { + title: '库存明细id', + align: 'center', + dataIndex: 'inventoryDetaiId', + }, + ], + url: { + listByMainId: '/cycleCountDetail/cycleCountDetail/queryCycleCountDetailChildByMainId', + }, + } + }, + watch: { + record: { + immediate: true, + handler() { + if (this.record != null) { + this.loadData(this.record) + } + } + } + }, + methods: { + + loadData(record) { + this.loading = true + this.dataSource = [] + getAction(this.url.listByMainId, { + id: record.id + }).then((res) => { + if (res.success) { + this.dataSource = res.result.records + } + }).finally(() => { + this.loading = false + }) + }, + + }, + } +</script> + +<style scoped> + +</style> diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/cycleCountPreference/controller/CycleCountPreferenceController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/cycleCountPreference/controller/CycleCountPreferenceController.java index 920a371..4fdcfe1 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/cycleCountPreference/controller/CycleCountPreferenceController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/cycleCountPreference/controller/CycleCountPreferenceController.java @@ -10,9 +10,12 @@ import java.net.URLDecoder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +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.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.modules.wms.config.company.entity.Company; import org.jeecg.utils.HuahengJwtUtil; import org.jeecg.common.util.oConvertUtils; @@ -134,6 +137,23 @@ public class CycleCountPreferenceController extends JeecgController<CycleCountPr return Result.OK("批量删除成功!"); } + + + /** + * 获得盘点类型信息 + * @param req + */ + @RequestMapping(value = "/getCountTypeList") + public Result<?> getCountTypeList(HttpServletRequest req) { + String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); + LambdaQueryWrapper<CycleCountPreference> companyLambdaQueryWrapper = Wrappers.lambdaQuery(); + companyLambdaQueryWrapper.eq(CycleCountPreference::getWarehouseCode, warehouseCode); + List<CycleCountPreference> cycleCountPreferenceList = cycleCountPreferenceService.list(companyLambdaQueryWrapper); + return Result.OK(cycleCountPreferenceList); + } + + + /** * 通过id查询 * @param id diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/controller/CycleCountDetailController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/controller/CycleCountDetailController.java new file mode 100644 index 0000000..bb332ab --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/controller/CycleCountDetailController.java @@ -0,0 +1,270 @@ +package org.jeecg.modules.wms.stocktaking.cycleCountDetail.controller; + +import java.io.UnsupportedEncodingException; +import java.io.IOException; +import java.net.URLDecoder; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.vo.LoginUser; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetailChild; +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetail; +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.vo.CycleCountDetailPage; +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.ICycleCountDetailService; +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.ICycleCountDetailChildService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 盘点明细表 + * @Author: jeecg-boot + * @Date: 2023-01-30 + * @Version: V1.0 + */ +@Api(tags="盘点明细表") +@RestController +@RequestMapping("/cycleCountDetail/cycleCountDetail") +@Slf4j +public class CycleCountDetailController { + @Autowired + private ICycleCountDetailService cycleCountDetailService; + @Autowired + private ICycleCountDetailChildService cycleCountDetailChildService; + + /** + * 分页列表查询 + * + * @param cycleCountDetail + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "盘点明细表-分页列表查询") + @ApiOperation(value="盘点明细表-分页列表查询", notes="盘点明细表-分页列表查询") + @GetMapping(value = "/list") + public Result<IPage<CycleCountDetail>> queryPageList(CycleCountDetail cycleCountDetail, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper<CycleCountDetail> queryWrapper = QueryGenerator.initQueryWrapper(cycleCountDetail, req.getParameterMap()); + Page<CycleCountDetail> page = new Page<CycleCountDetail>(pageNo, pageSize); + IPage<CycleCountDetail> pageList = cycleCountDetailService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param cycleCountDetailPage + * @return + */ + @AutoLog(value = "盘点明细表-添加") + @ApiOperation(value="盘点明细表-添加", notes="盘点明细表-添加") + @PostMapping(value = "/add") + public Result<String> add(@RequestBody CycleCountDetailPage cycleCountDetailPage) { + CycleCountDetail cycleCountDetail = new CycleCountDetail(); + BeanUtils.copyProperties(cycleCountDetailPage, cycleCountDetail); + cycleCountDetailService.saveMain(cycleCountDetail, cycleCountDetailPage.getCycleCountDetailChildList()); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param cycleCountDetailPage + * @return + */ + @AutoLog(value = "盘点明细表-编辑") + @ApiOperation(value="盘点明细表-编辑", notes="盘点明细表-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result<String> edit(@RequestBody CycleCountDetailPage cycleCountDetailPage) { + CycleCountDetail cycleCountDetail = new CycleCountDetail(); + BeanUtils.copyProperties(cycleCountDetailPage, cycleCountDetail); + CycleCountDetail cycleCountDetailEntity = cycleCountDetailService.getById(cycleCountDetail.getId()); + if(cycleCountDetailEntity==null) { + return Result.error("未找到对应数据"); + } + cycleCountDetailService.updateMain(cycleCountDetail, cycleCountDetailPage.getCycleCountDetailChildList()); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "盘点明细表-通过id删除") + @ApiOperation(value="盘点明细表-通过id删除", notes="盘点明细表-通过id删除") + @DeleteMapping(value = "/delete") + public Result<String> delete(@RequestParam(name="id",required=true) String id) { + cycleCountDetailService.delMain(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "盘点明细表-批量删除") + @ApiOperation(value="盘点明细表-批量删除", notes="盘点明细表-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.cycleCountDetailService.delBatchMain(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "盘点明细表-通过id查询") + @ApiOperation(value="盘点明细表-通过id查询", notes="盘点明细表-通过id查询") + @GetMapping(value = "/queryById") + public Result<CycleCountDetail> queryById(@RequestParam(name="id",required=true) String id) { + CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(id); + if(cycleCountDetail==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(cycleCountDetail); + + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "盘点容器明细表-通过主表ID查询") + @ApiOperation(value="盘点容器明细表-通过主表ID查询", notes="盘点容器明细表-通过主表ID查询") + @GetMapping(value = "/queryCycleCountDetailChildByMainId") + public Result<IPage<CycleCountDetailChild>> queryCycleCountDetailChildListByMainId(@RequestParam(name="id",required=true) int id) { + LambdaQueryWrapper<CycleCountDetailChild> cycleCountDetailChildLambdaQueryWrapper = Wrappers.lambdaQuery(); + cycleCountDetailChildLambdaQueryWrapper.eq(CycleCountDetailChild::getCycleCountDetailid, id); + List<CycleCountDetailChild> cycleCountDetailChildList = cycleCountDetailChildService.list(cycleCountDetailChildLambdaQueryWrapper); + IPage <CycleCountDetailChild> page = new Page<>(); + page.setRecords(cycleCountDetailChildList); + page.setTotal(cycleCountDetailChildList.size()); + return Result.OK(page); + } + + /** + * 导出excel + * + * @param request + * @param cycleCountDetail + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, CycleCountDetail cycleCountDetail) { + // Step.1 组装查询条件查询数据 + QueryWrapper<CycleCountDetail> queryWrapper = QueryGenerator.initQueryWrapper(cycleCountDetail, request.getParameterMap()); + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + //Step.2 获取导出数据 + List<CycleCountDetail> queryList = cycleCountDetailService.list(queryWrapper); + // 过滤选中数据 + String selections = request.getParameter("selections"); + List<CycleCountDetail> cycleCountDetailList = new ArrayList<CycleCountDetail>(); + if(oConvertUtils.isEmpty(selections)) { + cycleCountDetailList = queryList; + }else { + List<String> selectionList = Arrays.asList(selections.split(",")); + cycleCountDetailList = queryList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList()); + } + + // Step.3 组装pageList + List<CycleCountDetailPage> pageList = new ArrayList<CycleCountDetailPage>(); + for (CycleCountDetail main : cycleCountDetailList) { + CycleCountDetailPage vo = new CycleCountDetailPage(); + BeanUtils.copyProperties(main, vo); + LambdaQueryWrapper<CycleCountDetailChild> cycleCountDetailChildLambdaQueryWrapper = Wrappers.lambdaQuery(); + cycleCountDetailChildLambdaQueryWrapper.eq(CycleCountDetailChild::getCycleCountDetailid, main.getId()); + List<CycleCountDetailChild> cycleCountDetailChildList = cycleCountDetailChildService.list(cycleCountDetailChildLambdaQueryWrapper); + vo.setCycleCountDetailChildList(cycleCountDetailChildList); + pageList.add(vo); + } + + // Step.4 AutoPoi 导出Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + mv.addObject(NormalExcelConstants.FILE_NAME, "盘点明细表列表"); + mv.addObject(NormalExcelConstants.CLASS, CycleCountDetailPage.class); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("盘点明细表数据", "导出人:"+sysUser.getRealname(), "盘点明细表")); + mv.addObject(NormalExcelConstants.DATA_LIST, pageList); + return mv; + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); + for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { + MultipartFile file = entity.getValue();// 获取上传文件对象 + ImportParams params = new ImportParams(); + params.setTitleRows(2); + params.setHeadRows(1); + params.setNeedSave(true); + try { + List<CycleCountDetailPage> list = ExcelImportUtil.importExcel(file.getInputStream(), CycleCountDetailPage.class, params); + for (CycleCountDetailPage page : list) { + CycleCountDetail po = new CycleCountDetail(); + BeanUtils.copyProperties(page, po); + cycleCountDetailService.saveMain(po, page.getCycleCountDetailChildList()); + } + return Result.OK("文件导入成功!数据行数:" + list.size()); + } catch (Exception e) { + log.error(e.getMessage(),e); + return Result.error("文件导入失败:"+e.getMessage()); + } finally { + try { + file.getInputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return Result.OK("文件导入失败!"); + } + +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetail.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetail.java new file mode 100644 index 0000000..f36541a --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetail.java @@ -0,0 +1,116 @@ +package org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @Description: 盘点明细表 + * @Author: jeecg-boot + * @Date: 2023-01-30 + * @Version: V1.0 + */ +@ApiModel(value="cycle_count_detail对象", description="盘点明细表") +@Data +@TableName("cycle_count_detail") +public class CycleCountDetail implements Serializable { + private static final long serialVersionUID = 1L; + + /** 主键 */ + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + /**盘点主单id*/ + @Excel(name = "盘点主单id", width = 15) + @ApiModelProperty(value = "盘点主单id") + private String cycleCountHeadId; + /**盘点主单code*/ + @Excel(name = "盘点主单code", width = 15) + @ApiModelProperty(value = "盘点主单code") + private String cycleCountHeadCode; + /**任务表头*/ + @Excel(name = "任务表头", width = 15) + @ApiModelProperty(value = "任务表头") + private String taskHeaderId; + /**任务明细头*/ + @Excel(name = "任务明细头", width = 15) + @ApiModelProperty(value = "任务明细头") + private Integer taskDetailId; + /**仓库*/ + @Excel(name = "仓库", width = 15) + @ApiModelProperty(value = "仓库") + private String warehouseCode; + /**货主*/ + @Excel(name = "货主", width = 15) + @ApiModelProperty(value = "货主") + private String companyCode; + /**库存明细头*/ + @Excel(name = "库存明细头", width = 15) + @ApiModelProperty(value = "库存明细头") + private Integer inventoryDetailId; + /**库位*/ + @Excel(name = "库位", width = 15) + @ApiModelProperty(value = "库位") + private String locationCode; + /**容器*/ + @Excel(name = "容器", width = 15) + @ApiModelProperty(value = "容器") + private String containerCode; + /**库存状态*/ + @Excel(name = "库存状态", width = 15) + @ApiModelProperty(value = "库存状态") + private String inventorySts; + /**系统数量*/ + @Excel(name = "系统数量", width = 15) + @ApiModelProperty(value = "系统数量") + private String systemQty; + /**实盘数量*/ + @Excel(name = "实盘数量", width = 15) + @ApiModelProperty(value = "实盘数量") + private String countedQty; + /**差异数量*/ + @Excel(name = "差异数量", width = 15) + @ApiModelProperty(value = "差异数量") + private String gapQty; + /**失败原因*/ + @Excel(name = "失败原因", width = 15) + @ApiModelProperty(value = "失败原因") + private String rejectionNote; + /**完成用户*/ + @Excel(name = "完成用户", width = 15) + @ApiModelProperty(value = "完成用户") + private String completedBy; + /**完成时间*/ + @Excel(name = "完成时间", width = 15) + @ApiModelProperty(value = "完成时间") + private String completedAt; + /**盘点明细状态*/ + @Excel(name = "盘点明细状态", width = 15) + @ApiModelProperty(value = "盘点明细状态") + private Integer enableStatus; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + /**创建日期*/ + @ApiModelProperty(value = "创建日期") + private Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private String updateBy; + /**更新日期*/ + @ApiModelProperty(value = "更新日期") + private Date updateTime; + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private String sysOrgCode; +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetailChild.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetailChild.java new file mode 100644 index 0000000..cc7c1fe --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetailChild.java @@ -0,0 +1,99 @@ +package org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity; + +import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import java.util.Date; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.UnsupportedEncodingException; + +/** + * @Description: 盘点容器明细表 + * @Author: jeecg-boot + * @Date: 2023-01-30 + * @Version: V1.0 + */ +@ApiModel(value="cycle_count_detail_child对象", description="盘点容器明细表") +@Data +@TableName("cycle_count_detail_child") +public class CycleCountDetailChild implements Serializable { + private static final long serialVersionUID = 1L; + + /** 主键 */ + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + /**盘点主单code*/ + @Excel(name = "盘点主单code", width = 15) + @ApiModelProperty(value = "盘点主单code") + private String cyclecountheadcode; + /**盘点明细ID主id*/ + @ApiModelProperty(value = "盘点明细ID主id") + private Integer cycleCountDetailid; + /**盘点明细子单状态*/ + @Excel(name = "盘点明细子单状态", width = 15) + @ApiModelProperty(value = "盘点明细子单状态") + private String childStatus; + /**库位*/ + @Excel(name = "库位", width = 15) + @ApiModelProperty(value = "库位") + private String locationCode; + /**容器*/ + @Excel(name = "容器", width = 15) + @ApiModelProperty(value = "容器") + private String containerCode; + /**物料编码*/ + @Excel(name = "物料编码", width = 15) + @ApiModelProperty(value = "物料编码") + private String materialCode; + /**物料名称*/ + @Excel(name = "物料名称", width = 15) + @ApiModelProperty(value = "物料名称") + private String materialName; + /**物料规格*/ + @Excel(name = "物料规格", width = 15) + @ApiModelProperty(value = "物料规格") + private String materialSpec; + /**物料单位*/ + @Excel(name = "物料单位", width = 15) + @ApiModelProperty(value = "物料单位") + private String materialUnit; + /**系统数量*/ + @Excel(name = "系统数量", width = 15) + @ApiModelProperty(value = "系统数量") + private String systemQty; + /**实盘数量*/ + @Excel(name = "实盘数量", width = 15) + @ApiModelProperty(value = "实盘数量") + private String countedQty; + /**差异数量*/ + @Excel(name = "差异数量", width = 15) + @ApiModelProperty(value = "差异数量") + private String gapQty; + /**库存明细id*/ + @Excel(name = "库存明细id", width = 15) + @ApiModelProperty(value = "库存明细id") + private Integer inventoryDetaiId; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + /**创建日期*/ + @ApiModelProperty(value = "创建日期") + private Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private String updateBy; + /**更新日期*/ + @ApiModelProperty(value = "更新日期") + private Date updateTime; + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private String sysOrgCode; +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/CycleCountDetailChildMapper.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/CycleCountDetailChildMapper.java new file mode 100644 index 0000000..5df7a8f --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/CycleCountDetailChildMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.wms.stocktaking.cycleCountDetail.mapper; + +import java.util.List; +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetailChild; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +/** + * @Description: 盘点容器明细表 + * @Author: jeecg-boot + * @Date: 2023-01-30 + * @Version: V1.0 + */ +public interface CycleCountDetailChildMapper extends BaseMapper<CycleCountDetailChild> { + + +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/CycleCountDetailMapper.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/CycleCountDetailMapper.java new file mode 100644 index 0000000..e391e4f --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/CycleCountDetailMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.wms.stocktaking.cycleCountDetail.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetail; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 盘点明细表 + * @Author: jeecg-boot + * @Date: 2023-01-30 + * @Version: V1.0 + */ +public interface CycleCountDetailMapper extends BaseMapper<CycleCountDetail> { + +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/xml/CycleCountDetailMapper.xml b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/xml/CycleCountDetailMapper.xml new file mode 100644 index 0000000..60bcf14 --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/mapper/xml/CycleCountDetailMapper.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="org.jeecg.modules.wms.stocktaking.cycleCountDetail.mapper.CycleCountDetailMapper"> + +</mapper> \ No newline at end of file diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailChildService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailChildService.java new file mode 100644 index 0000000..534792b --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailChildService.java @@ -0,0 +1,16 @@ +package org.jeecg.modules.wms.stocktaking.cycleCountDetail.service; + +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetailChild; +import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + +/** + * @Description: 盘点容器明细表 + * @Author: jeecg-boot + * @Date: 2023-01-30 + * @Version: V1.0 + */ +public interface ICycleCountDetailChildService extends IService<CycleCountDetailChild> { + + +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailService.java new file mode 100644 index 0000000..d5b49c4 --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailService.java @@ -0,0 +1,40 @@ +package org.jeecg.modules.wms.stocktaking.cycleCountDetail.service; + +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetailChild; +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetail; +import com.baomidou.mybatisplus.extension.service.IService; +import java.io.Serializable; +import java.util.Collection; +import java.util.List; + +/** + * @Description: 盘点明细表 + * @Author: jeecg-boot + * @Date: 2023-01-30 + * @Version: V1.0 + */ +public interface ICycleCountDetailService extends IService<CycleCountDetail> { + + /** + * 添加一对多 + * + */ + public void saveMain(CycleCountDetail cycleCountDetail,List<CycleCountDetailChild> cycleCountDetailChildList) ; + + /** + * 修改一对多 + * + */ + public void updateMain(CycleCountDetail cycleCountDetail,List<CycleCountDetailChild> cycleCountDetailChildList); + + /** + * 删除一对多 + */ + public void delMain (String id); + + /** + * 批量删除一对多 + */ + public void delBatchMain (Collection<? extends Serializable> idList); + +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java new file mode 100644 index 0000000..23bad15 --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java @@ -0,0 +1,23 @@ +package org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.impl; + +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetailChild; +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.mapper.CycleCountDetailChildMapper; +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.ICycleCountDetailChildService; +import org.springframework.stereotype.Service; +import java.util.List; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @Description: 盘点容器明细表 + * @Author: jeecg-boot + * @Date: 2023-01-30 + * @Version: V1.0 + */ +@Service +public class CycleCountDetailChildServiceImpl extends ServiceImpl<CycleCountDetailChildMapper, CycleCountDetailChild> implements ICycleCountDetailChildService { + + @Autowired + private CycleCountDetailChildMapper cycleCountDetailChildMapper; + +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java new file mode 100644 index 0000000..b733381 --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java @@ -0,0 +1,85 @@ +package org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetail; +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetailChild; +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.mapper.CycleCountDetailChildMapper; +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.mapper.CycleCountDetailMapper; +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.ICycleCountDetailService; +import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import java.io.Serializable; +import java.util.List; +import java.util.Collection; + +/** + * @Description: 盘点明细表 + * @Author: jeecg-boot + * @Date: 2023-01-30 + * @Version: V1.0 + */ +@Service +public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMapper, CycleCountDetail> implements ICycleCountDetailService { + + @Autowired + private CycleCountDetailMapper cycleCountDetailMapper; + @Autowired + private CycleCountDetailChildMapper cycleCountDetailChildMapper; + + @Override + @Transactional + public void saveMain(CycleCountDetail cycleCountDetail, List<CycleCountDetailChild> cycleCountDetailChildList) { + cycleCountDetailMapper.insert(cycleCountDetail); + if(cycleCountDetailChildList!=null && cycleCountDetailChildList.size()>0) { + for(CycleCountDetailChild entity:cycleCountDetailChildList) { + //外键设置 + entity.setCycleCountDetailid(cycleCountDetail.getId()); + cycleCountDetailChildMapper.insert(entity); + } + } + } + + @Override + @Transactional + public void updateMain(CycleCountDetail cycleCountDetail,List<CycleCountDetailChild> cycleCountDetailChildList) { + cycleCountDetailMapper.updateById(cycleCountDetail); + + //1.先删除子表数据 + LambdaQueryWrapper<CycleCountDetailChild> cycleCountDetailChildLambdaQueryWrapper = Wrappers.lambdaQuery(); + cycleCountDetailChildLambdaQueryWrapper.eq(CycleCountDetailChild::getCycleCountDetailid,cycleCountDetail.getId()); + cycleCountDetailChildMapper.delete(cycleCountDetailChildLambdaQueryWrapper); + + //2.子表数据重新插入 + if(cycleCountDetailChildList!=null && cycleCountDetailChildList.size()>0) { + for(CycleCountDetailChild entity:cycleCountDetailChildList) { + //外键设置 + entity.setCycleCountDetailid(cycleCountDetail.getId()); + cycleCountDetailChildMapper.insert(entity); + } + } + } + + @Override + @Transactional + public void delMain(String id) { + LambdaQueryWrapper<CycleCountDetailChild> cycleCountDetailChildLambdaQueryWrapper = Wrappers.lambdaQuery(); + cycleCountDetailChildLambdaQueryWrapper.eq(CycleCountDetailChild::getCycleCountDetailid,id); + cycleCountDetailChildMapper.delete(cycleCountDetailChildLambdaQueryWrapper); + cycleCountDetailMapper.deleteById(id); + } + + @Override + @Transactional + public void delBatchMain(Collection<? extends Serializable> idList) { + for(Serializable id:idList) { + LambdaQueryWrapper<CycleCountDetailChild> cycleCountDetailChildLambdaQueryWrapper = Wrappers.lambdaQuery(); + cycleCountDetailChildLambdaQueryWrapper.eq(CycleCountDetailChild::getCycleCountDetailid,id.toString()); + cycleCountDetailChildMapper.delete(cycleCountDetailChildLambdaQueryWrapper); + cycleCountDetailMapper.deleteById(id); + } + } + +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/vo/CycleCountDetailPage.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/vo/CycleCountDetailPage.java new file mode 100644 index 0000000..987d4ce --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/vo/CycleCountDetailPage.java @@ -0,0 +1,118 @@ +package org.jeecg.modules.wms.stocktaking.cycleCountDetail.vo; + +import java.util.List; +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetail; +import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetailChild; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecgframework.poi.excel.annotation.ExcelEntity; +import org.jeecgframework.poi.excel.annotation.ExcelCollection; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import java.util.Date; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @Description: 盘点明细表 + * @Author: jeecg-boot + * @Date: 2023-01-30 + * @Version: V1.0 + */ +@Data +@ApiModel(value="cycle_count_detailPage对象", description="盘点明细表") +public class CycleCountDetailPage { + + /**主键*/ + @ApiModelProperty(value = "主键") + private String id; + /**盘点主单id*/ + @Excel(name = "盘点主单id", width = 15) + @ApiModelProperty(value = "盘点主单id") + private String cycleCountHeadId; + /**盘点主单code*/ + @Excel(name = "盘点主单code", width = 15) + @ApiModelProperty(value = "盘点主单code") + private String cycleCountHeadCode; + /**任务表头*/ + @Excel(name = "任务表头", width = 15) + @ApiModelProperty(value = "任务表头") + private String taskHeaderId; + /**任务明细头*/ + @Excel(name = "任务明细头", width = 15) + @ApiModelProperty(value = "任务明细头") + private String taskDetailId; + /**仓库*/ + @Excel(name = "仓库", width = 15) + @ApiModelProperty(value = "仓库") + private String warehouseCode; + /**货主*/ + @Excel(name = "货主", width = 15) + @ApiModelProperty(value = "货主") + private String companyCode; + /**库存明细头*/ + @Excel(name = "库存明细头", width = 15) + @ApiModelProperty(value = "库存明细头") + private String inventoryDetailId; + /**库位*/ + @Excel(name = "库位", width = 15) + @ApiModelProperty(value = "库位") + private String locationCode; + /**容器*/ + @Excel(name = "容器", width = 15) + @ApiModelProperty(value = "容器") + private String containerCode; + /**库存状态*/ + @Excel(name = "库存状态", width = 15) + @ApiModelProperty(value = "库存状态") + private String inventorySts; + /**系统数量*/ + @Excel(name = "系统数量", width = 15) + @ApiModelProperty(value = "系统数量") + private String systemQty; + /**实盘数量*/ + @Excel(name = "实盘数量", width = 15) + @ApiModelProperty(value = "实盘数量") + private String countedQty; + /**差异数量*/ + @Excel(name = "差异数量", width = 15) + @ApiModelProperty(value = "差异数量") + private String gapQty; + /**失败原因*/ + @Excel(name = "失败原因", width = 15) + @ApiModelProperty(value = "失败原因") + private String rejectionNote; + /**完成用户*/ + @Excel(name = "完成用户", width = 15) + @ApiModelProperty(value = "完成用户") + private String completedBy; + /**完成时间*/ + @Excel(name = "完成时间", width = 15) + @ApiModelProperty(value = "完成时间") + private String completedAt; + /**盘点明细状态*/ + @Excel(name = "盘点明细状态", width = 15) + @ApiModelProperty(value = "盘点明细状态") + private String enableStatus; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + /**创建日期*/ + @ApiModelProperty(value = "创建日期") + private Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private String updateBy; + /**更新日期*/ + @ApiModelProperty(value = "更新日期") + private Date updateTime; + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private String sysOrgCode; + + @ExcelCollection(name="盘点容器明细表") + @ApiModelProperty(value = "盘点容器明细表") + private List<CycleCountDetailChild> cycleCountDetailChildList; + +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/controller/CycleCountHeaderController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/controller/CycleCountHeaderController.java new file mode 100644 index 0000000..64e4d11 --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/controller/CycleCountHeaderController.java @@ -0,0 +1,177 @@ +package org.jeecg.modules.wms.stocktaking.cycleCountHeader.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.wms.stocktaking.cycleCountHeader.entity.CycleCountHeader; +import org.jeecg.modules.wms.stocktaking.cycleCountHeader.service.ICycleCountHeaderService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecg.utils.HuahengJwtUtil; +import org.jeecg.utils.StringUtils; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 盘点主表 + * @Author: jeecg-boot + * @Date: 2023-01-30 + * @Version: V1.0 + */ +@Api(tags="盘点主表") +@RestController +@RequestMapping("/cycleCountHeader/cycleCountHeader") +@Slf4j +public class CycleCountHeaderController extends JeecgController<CycleCountHeader, ICycleCountHeaderService> { + @Autowired + private ICycleCountHeaderService cycleCountHeaderService; + + /** + * 分页列表查询 + * + * @param cycleCountHeader + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "盘点主表-分页列表查询") + @ApiOperation(value="盘点主表-分页列表查询", notes="盘点主表-分页列表查询") + @GetMapping(value = "/list") + public Result<IPage<CycleCountHeader>> queryPageList(CycleCountHeader cycleCountHeader, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper<CycleCountHeader> queryWrapper = QueryGenerator.initQueryWrapper(cycleCountHeader, req.getParameterMap()); + Page<CycleCountHeader> page = new Page<CycleCountHeader>(pageNo, pageSize); + IPage<CycleCountHeader> pageList = cycleCountHeaderService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param cycleCountHeader + * @return + */ + @AutoLog(value = "盘点主表-添加") + @ApiOperation(value="盘点主表-添加", notes="盘点主表-添加") + @PostMapping(value = "/add") + public Result<String> add(@RequestBody CycleCountHeader cycleCountHeader, HttpServletRequest req) { + String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); + if (StringUtils.isNotEmpty(warehouseCode)) { + cycleCountHeader.setWarehouseCode(warehouseCode); + } + Result result = cycleCountHeaderService.saveCycleCountHeader(cycleCountHeader); + return result; + } + + /** + * 编辑 + * + * @param cycleCountHeader + * @return + */ + @AutoLog(value = "盘点主表-编辑") + @ApiOperation(value="盘点主表-编辑", notes="盘点主表-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result<String> edit(@RequestBody CycleCountHeader cycleCountHeader) { + cycleCountHeaderService.updateById(cycleCountHeader); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "盘点主表-通过id删除") + @ApiOperation(value="盘点主表-通过id删除", notes="盘点主表-通过id删除") + @DeleteMapping(value = "/delete") + public Result<String> delete(@RequestParam(name="id",required=true) String id) { + cycleCountHeaderService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "盘点主表-批量删除") + @ApiOperation(value="盘点主表-批量删除", notes="盘点主表-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.cycleCountHeaderService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "盘点主表-通过id查询") + @ApiOperation(value="盘点主表-通过id查询", notes="盘点主表-通过id查询") + @GetMapping(value = "/queryById") + public Result<CycleCountHeader> queryById(@RequestParam(name="id",required=true) String id) { + CycleCountHeader cycleCountHeader = cycleCountHeaderService.getById(id); + if(cycleCountHeader==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(cycleCountHeader); + } + + /** + * 导出excel + * + * @param request + * @param cycleCountHeader + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, CycleCountHeader cycleCountHeader) { + return super.exportXls(request, cycleCountHeader, CycleCountHeader.class, "盘点主表"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, CycleCountHeader.class); + } + +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/entity/CycleCountHeader.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/entity/CycleCountHeader.java new file mode 100644 index 0000000..b70ce3b --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/entity/CycleCountHeader.java @@ -0,0 +1,117 @@ +package org.jeecg.modules.wms.stocktaking.cycleCountHeader.entity; + +import java.io.Serializable; +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; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 盘点主表 + * @Author: jeecg-boot + * @Date: 2023-01-30 + * @Version: V1.0 + */ +@Data +@TableName("cycle_count_header") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="cycle_count_header对象", description="盘点主表") +public class CycleCountHeader implements Serializable { + private static final long serialVersionUID = 1L; + + /** 主键 */ + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + /**盘点主表编号*/ + @Excel(name = "盘点主表编号", width = 15) + @ApiModelProperty(value = "盘点主表编号") + private String code; + /**仓库编码*/ + @Excel(name = "仓库编码", width = 15) + @ApiModelProperty(value = "仓库编码") + private String warehouseCode; + /**货主编码*/ + @Excel(name = "货主编码", width = 15) + @ApiModelProperty(value = "货主编码") + private String companyCode; + /**盘点类型*/ + @Excel(name = "盘点类型", width = 15) + @ApiModelProperty(value = "盘点类型") + private String countType; + /**盘点状态*/ + @Excel(name = "盘点状态", width = 15,dicCode = "cyclecount_status") + @Dict(dicCode = "cyclecount_status") + @ApiModelProperty(value = "盘点状态") + private Integer statusCyc; + + /**是否有效*/ + @Excel(name = "是否有效", width = 15,dicCode = "valid_status") + @Dict(dicCode = "valid_status") + @ApiModelProperty(value="是否有效") + private Integer enable; + + /**备注*/ + @Excel(name = "备注", width = 15) + @ApiModelProperty(value = "备注") + private String remark; + /**总货位数*/ + @Excel(name = "总货位数", width = 15) + @ApiModelProperty(value = "总货位数") + private Integer totalLocs; + /**总物料数*/ + @Excel(name = "总物料数", width = 15) + @ApiModelProperty(value = "总物料数") + private Integer totalItems; + /**审核人*/ + @Excel(name = "审核人", width = 15) + @ApiModelProperty(value = "审核人") + private String verifyBy; + /**指定盘点人员*/ + @Excel(name = "指定盘点人员", width = 15) + @ApiModelProperty(value = "指定盘点人员") + private String stocktakingAs; + /**实际盘点人员*/ + @Excel(name = "实际盘点人员", width = 15) + @ApiModelProperty(value = "实际盘点人员") + private String stocktakingAc; + /**回传时间*/ + @Excel(name = "回传时间", width = 15) + @ApiModelProperty(value = "回传时间") + private Date uploadTime; + /**回传状态*/ + @Excel(name = "回传状态", width = 15) + private Boolean uploadStatus; + /**关闭人*/ + @Excel(name = "关闭人", width = 15) + @ApiModelProperty(value = "关闭人") + private String closedBy; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + /**创建日期*/ + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private String updateBy; + /**更新日期*/ + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private String sysOrgCode; +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/mapper/CycleCountHeaderMapper.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/mapper/CycleCountHeaderMapper.java new file mode 100644 index 0000000..ab47968 --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/mapper/CycleCountHeaderMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.wms.stocktaking.cycleCountHeader.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.wms.stocktaking.cycleCountHeader.entity.CycleCountHeader; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 盘点主表 + * @Author: jeecg-boot + * @Date: 2023-01-30 + * @Version: V1.0 + */ +public interface CycleCountHeaderMapper extends BaseMapper<CycleCountHeader> { + +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/mapper/xml/CycleCountHeaderMapper.xml b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/mapper/xml/CycleCountHeaderMapper.xml new file mode 100644 index 0000000..f55ad7f --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/mapper/xml/CycleCountHeaderMapper.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="org.jeecg.modules.wms.stocktaking.cycleCountHeader.mapper.CycleCountHeaderMapper"> + +</mapper> \ No newline at end of file diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/service/ICycleCountHeaderService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/service/ICycleCountHeaderService.java new file mode 100644 index 0000000..e05e91e --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/service/ICycleCountHeaderService.java @@ -0,0 +1,16 @@ +package org.jeecg.modules.wms.stocktaking.cycleCountHeader.service; + +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.wms.stocktaking.cycleCountHeader.entity.CycleCountHeader; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 盘点主表 + * @Author: jeecg-boot + * @Date: 2023-01-30 + * @Version: V1.0 + */ +public interface ICycleCountHeaderService extends IService<CycleCountHeader> { + + public Result<CycleCountHeader> saveCycleCountHeader(CycleCountHeader cycleCountHeader); +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/service/impl/CycleCountHeaderServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/service/impl/CycleCountHeaderServiceImpl.java new file mode 100644 index 0000000..9b4c62d --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/service/impl/CycleCountHeaderServiceImpl.java @@ -0,0 +1,73 @@ +package org.jeecg.modules.wms.stocktaking.cycleCountHeader.service.impl; + +import com.aliyun.oss.ServiceException; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.wms.config.receiptType.entity.ReceiptType; +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; +import org.jeecg.modules.wms.stocktaking.cycleCountHeader.entity.CycleCountHeader; +import org.jeecg.modules.wms.stocktaking.cycleCountHeader.mapper.CycleCountHeaderMapper; +import org.jeecg.modules.wms.stocktaking.cycleCountHeader.service.ICycleCountHeaderService; +import org.jeecg.utils.StringUtils; +import org.jeecg.utils.constant.QuantityConstant; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.transaction.annotation.Transactional; + +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * @Description: 盘点主表 + * @Author: jeecg-boot + * @Date: 2023-01-30 + * @Version: V1.0 + */ +@Service +public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMapper, CycleCountHeader> implements ICycleCountHeaderService { + + @Override + public Result<CycleCountHeader> saveCycleCountHeader(CycleCountHeader cycleCountHeader) { + String code = createCode(QuantityConstant.SHIPMENT_BILL_TYPE_PD); + if (StringUtils.isEmpty(code)) { + throw new ServiceException("根据单据类型,生成单号失败"); + } + cycleCountHeader.setCode(code); + cycleCountHeader.setStocktakingAc("-"); + boolean success = save(cycleCountHeader); + if (!success) { + return Result.OK("添加失败!"); + } + return Result.OK("添加成功!", cycleCountHeader); + } + + + @Transactional + public String createCode(String receiptType) { + int i = 0; + String code = null; + Date now = new Date(); + SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd"); + LambdaQueryWrapper<CycleCountHeader> cycleCountHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); + cycleCountHeaderLambdaQueryWrapper.select(CycleCountHeader::getCode).orderByDesc(CycleCountHeader::getId).last("Limit 1"); + String maxCode = null; + CycleCountHeader cycleCountHeader = this.getOne(cycleCountHeaderLambdaQueryWrapper); + if (cycleCountHeader != null) { + maxCode = cycleCountHeader.getCode(); + } + if (maxCode != null) { + String day = maxCode.substring(maxCode.length() - 13, maxCode.length() - 5); + if (day.equals(df.format(now))) { + Integer Count = Integer.valueOf(maxCode.substring(maxCode.length() - 5, maxCode.length())); + code = receiptType + df.format(now) + String.format("%05d", Count + 1); + } else { + code = receiptType + df.format(now) + String.format("%05d", 0000 + 1); + } + } else { + code = receiptType + df.format(now) + String.format("%05d", 0000 + 1); + } + return code; + } +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java b/huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java index 839f640..744c91b 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java @@ -530,6 +530,9 @@ public class QuantityConstant { public static final String SHIPMENT_BILL_TYPE_DN = "DN";// 发货通知单 public static final String SHIPMENT_BILL_TYPE_JS = "JS";// 直接调拨单 + /* 盘点单据类型 */ + public static final String SHIPMENT_BILL_TYPE_PD = "PD";// 盘点单 + /* ERP单据名称 */ public static final String BILL_TYPE_NAME_DN = "发货通知单"; public static final String BILL_TYPE_NAME_RN = "退货通知单";