Commit 051b62205f21d7356cb70aa1ae90b96380b7dc68

Authored by 肖超群
1 parent 3e216c00

增加库存、库存明细、库存交易、下发任务等

Showing 72 changed files with 6283 additions and 47 deletions

Too many changes to show.

To preserve performance only 40 of 72 files are displayed.

jeecg-boot-master/ant-design-vue-jeecg/src/api/api.js
... ... @@ -107,6 +107,7 @@ export const getShipmentTypeList = (params)=>getAction('/config/shipmentType/get
107 107 export const searchMaterialByCode = (params)=>postAction('/config/material/searchMaterialByCode', params);
108 108 export const listReceiveByReceiptId = (params)=>postAction('/receipt/receiveHeader/listReceiveByReceiptId', params);
109 109 export const createTask = (params)=>postAction('/receipt/receiptContainerHeader/createTask', params);
  110 +export const completeTaskByWMS = (params)=>postAction('/task/taskHeader/completeTaskByWMS', params);
110 111  
111 112  
112 113 // 中转HTTP请求
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue 0 → 100644
  1 +<template>
  2 + <a-card :bordered="false" :class="'cust-erp-sub-tab'">
  3 + <!-- 操作按钮区域 -->
  4 + <div class="table-operator" v-if="mainId">
  5 + <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  6 + <a-button type="primary" icon="download" @click="handleExportXls('库存详情')">导出</a-button>
  7 + <a-upload
  8 + name="file"
  9 + :showUploadList="false"
  10 + :multiple="false"
  11 + :headers="tokenHeader"
  12 + :action="importExcelUrl"
  13 + @change="handleImportExcel">
  14 + <a-button type="primary" icon="import">导入</a-button>
  15 + </a-upload>
  16 + <a-dropdown v-if="selectedRowKeys.length > 0">
  17 + <a-menu slot="overlay">
  18 + <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
  19 + </a-menu>
  20 + <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  21 + </a-dropdown>
  22 + </div>
  23 +
  24 + <!-- table区域-begin -->
  25 + <div>
  26 + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  27 + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  28 + <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  29 + </div>
  30 +
  31 + <a-table
  32 + ref="table"
  33 + size="middle"
  34 + bordered
  35 + rowKey="id"
  36 + :scroll="{x:true}"
  37 + :columns="columns"
  38 + :dataSource="dataSource"
  39 + :pagination="ipagination"
  40 + :loading="loading"
  41 + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  42 + @change="handleTableChange">
  43 +
  44 + <template slot="htmlSlot" slot-scope="text">
  45 + <div v-html="text"></div>
  46 + </template>
  47 + <template slot="imgSlot" slot-scope="text">
  48 + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
  49 + <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  50 + </template>
  51 + <template slot="fileSlot" slot-scope="text">
  52 + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
  53 + <a-button
  54 + v-else
  55 + :ghost="true"
  56 + type="primary"
  57 + icon="download"
  58 + size="small"
  59 + @click="downloadFile(text)">
  60 + 下载
  61 + </a-button>
  62 + </template>
  63 +
  64 + <span slot="action" slot-scope="text, record">
  65 + <a @click="handleEdit(record)">编辑</a>
  66 + <a-divider type="vertical" />
  67 + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  68 + <a>删除</a>
  69 + </a-popconfirm>
  70 + </span>
  71 +
  72 + </a-table>
  73 + </div>
  74 +
  75 + <inventoryDetail-modal ref="modalForm" @ok="modalFormOk" :mainId="mainId"></inventoryDetail-modal>
  76 + </a-card>
  77 +</template>
  78 +
  79 +<script>
  80 +
  81 + import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  82 + import InventoryDetailModal from './modules/InventoryDetailModal'
  83 +
  84 + export default {
  85 + name: "InventoryDetailList",
  86 + mixins:[JeecgListMixin],
  87 + components: { InventoryDetailModal },
  88 + props:{
  89 + mainId:{
  90 + type:String,
  91 + default:'',
  92 + required:false
  93 + }
  94 + },
  95 + watch:{
  96 + mainId:{
  97 + immediate: true,
  98 + handler(val) {
  99 + if(!this.mainId){
  100 + this.clearList()
  101 + }else{
  102 + this.queryParam['inventoryHeaderId'] = val
  103 + this.loadData(1);
  104 + }
  105 + }
  106 + }
  107 + },
  108 + data () {
  109 + return {
  110 + description: '库存表管理页面',
  111 + disableMixinCreated:true,
  112 + // 表头
  113 + columns: [
  114 + {
  115 + title:'库存详情ID',
  116 + align:"center",
  117 + dataIndex: 'id'
  118 + },
  119 + {
  120 + title:'货主',
  121 + align:"center",
  122 + dataIndex: 'companyCode'
  123 + },
  124 + {
  125 + title:'库区',
  126 + align:"center",
  127 + dataIndex: 'zoneCode'
  128 + },
  129 + {
  130 + title:'容器编码',
  131 + align:"center",
  132 + dataIndex: 'containerCode'
  133 + },
  134 + {
  135 + title:'库位编码',
  136 + align:"center",
  137 + dataIndex: 'locationCode'
  138 + },
  139 + {
  140 + title:'物料编码',
  141 + align:"center",
  142 + dataIndex: 'materialCode'
  143 + },
  144 + {
  145 + title:'物料名称',
  146 + align:"center",
  147 + dataIndex: 'materialName'
  148 + },
  149 + {
  150 + title:'物料规格',
  151 + align:"center",
  152 + dataIndex: 'materialSpec'
  153 + },
  154 + {
  155 + title:'物料单位',
  156 + align:"center",
  157 + dataIndex: 'materialUnit'
  158 + },
  159 + {
  160 + title:'数量',
  161 + align:"center",
  162 + dataIndex: 'qty'
  163 + },
  164 + {
  165 + title:'任务锁定数量',
  166 + align:"center",
  167 + dataIndex: 'taskQty'
  168 + },
  169 + {
  170 + title:'库存状态',
  171 + align:"center",
  172 + dataIndex: 'inventoryStatus_dictText',
  173 + },
  174 + {
  175 + title:'批次',
  176 + align:"center",
  177 + dataIndex: 'batch'
  178 + },
  179 + {
  180 + title:'唯一号',
  181 + align:"center",
  182 + dataIndex: 'uniqueCode'
  183 + },
  184 + {
  185 + title:'入库日期',
  186 + align:"center",
  187 + dataIndex: 'receiptDate'
  188 + },
  189 + {
  190 + title:'库龄(天)',
  191 + align:"center",
  192 + dataIndex: 'inventoryAge'
  193 + },
  194 + {
  195 + title:'创建人',
  196 + align:"center",
  197 + dataIndex: 'createBy'
  198 + },
  199 + {
  200 + title:'创建日期',
  201 + align:"center",
  202 + dataIndex: 'createTime'
  203 + },
  204 + {
  205 + title:'更新人',
  206 + align:"center",
  207 + dataIndex: 'updateBy'
  208 + },
  209 + {
  210 + title:'更新日期',
  211 + align:"center",
  212 + dataIndex: 'updateTime'
  213 + },
  214 + {
  215 + title: '操作',
  216 + dataIndex: 'action',
  217 + align:"center",
  218 + fixed:"right",
  219 + width:147,
  220 + scopedSlots: { customRender: 'action' },
  221 + }
  222 + ],
  223 + url: {
  224 + list: "/inventory/inventoryHeader/listInventoryDetailByMainId",
  225 + delete: "/inventory/inventoryHeader/deleteInventoryDetail",
  226 + deleteBatch: "/inventory/inventoryHeader/deleteBatchInventoryDetail",
  227 + exportXlsUrl: "/inventory/inventoryHeader/exportInventoryDetail",
  228 + importUrl: "/inventory/inventoryHeader/importInventoryDetail",
  229 + },
  230 + dictOptions:{
  231 + containerStatus:[],
  232 + }
  233 + }
  234 + },
  235 + created() {
  236 + },
  237 + computed: {
  238 + importExcelUrl(){
  239 + return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}`;
  240 + }
  241 + },
  242 + methods: {
  243 + clearList(){
  244 + this.dataSource=[]
  245 + this.selectedRowKeys=[]
  246 + this.ipagination.current = 1
  247 + }
  248 +
  249 + }
  250 + }
  251 +</script>
  252 +<style scoped>
  253 + @import '~@assets/less/common.less'
  254 +</style>
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryHeaderList.vue 0 → 100644
  1 +<template>
  2 + <a-card :bordered="false">
  3 + <!-- 查询区域 -->
  4 + <div class="table-page-search-wrapper">
  5 + <a-form layout="inline" @keyup.enter.native="searchQuery">
  6 + <a-row :gutter="24">
  7 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  8 + <a-form-item label="货主">
  9 + <a-input placeholder="请输入货主" v-model="queryParam.companyCode"></a-input>
  10 + </a-form-item>
  11 + </a-col>
  12 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  13 + <a-form-item label="库区">
  14 + <a-input placeholder="请输入库区" v-model="queryParam.zoneCode"></a-input>
  15 + </a-form-item>
  16 + </a-col>
  17 + <template v-if="toggleSearchStatus">
  18 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  19 + <a-form-item label="容器号">
  20 + <a-input placeholder="请输入容器号" v-model="queryParam.containerCode"></a-input>
  21 + </a-form-item>
  22 + </a-col>
  23 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  24 + <a-form-item label="容器状态">
  25 + <j-dict-select-tag placeholder="请选择容器状态" v-model="queryParam.containerStatus" dictCode="container_status"/>
  26 + </a-form-item>
  27 + </a-col>
  28 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  29 + <a-form-item label="库位号">
  30 + <a-input placeholder="请输入库位号" v-model="queryParam.locationCode"></a-input>
  31 + </a-form-item>
  32 + </a-col>
  33 + <a-col :xl="10" :lg="11" :md="12" :sm="24">
  34 + <a-form-item label="创建日期">
  35 + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.createTime_begin"></j-date>
  36 + <span class="query-group-split-cust"></span>
  37 + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.createTime_end"></j-date>
  38 + </a-form-item>
  39 + </a-col>
  40 + </template>
  41 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  42 + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  43 + <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  44 + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  45 + <a @click="handleToggleSearch" style="margin-left: 8px">
  46 + {{ toggleSearchStatus ? '收起' : '展开' }}
  47 + <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  48 + </a>
  49 + </span>
  50 + </a-col>
  51 + </a-row>
  52 + </a-form>
  53 + </div>
  54 + <!-- 查询区域-END -->
  55 +
  56 + <!-- 操作按钮区域 -->
  57 + <div class="table-operator">
  58 + <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  59 + <a-button type="primary" icon="download" @click="handleExportXls('库存表')">导出</a-button>
  60 + <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  61 + <a-button type="primary" icon="import">导入</a-button>
  62 + </a-upload>
  63 + <!-- 高级查询区域 -->
  64 + <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
  65 + </div>
  66 +
  67 + <!-- table区域-begin -->
  68 + <div>
  69 + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  70 + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  71 + <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  72 + </div>
  73 +
  74 + <a-table
  75 + ref="table"
  76 + size="middle"
  77 + bordered
  78 + rowKey="id"
  79 + class="j-table-force-nowrap"
  80 + :scroll="{x:true}"
  81 + :columns="columns"
  82 + :dataSource="dataSource"
  83 + :pagination="ipagination"
  84 + :loading="loading"
  85 + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}"
  86 + :customRow="clickThenSelect"
  87 + @change="handleTableChange">
  88 +
  89 + <template slot="htmlSlot" slot-scope="text">
  90 + <div v-html="text"></div>
  91 + </template>
  92 + <template slot="imgSlot" slot-scope="text">
  93 + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
  94 + <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  95 + </template>
  96 + <template slot="fileSlot" slot-scope="text">
  97 + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
  98 + <a-button
  99 + v-else
  100 + :ghost="true"
  101 + type="primary"
  102 + icon="download"
  103 + size="small"
  104 + @click="downloadFile(text)">
  105 + 下载
  106 + </a-button>
  107 + </template>
  108 +
  109 + <span slot="action" slot-scope="text, record">
  110 + <a @click="handleEdit(record)">编辑</a>
  111 +
  112 + <a-divider type="vertical" />
  113 + <a-dropdown>
  114 + <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  115 + <a-menu slot="overlay">
  116 + <a-menu-item>
  117 + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  118 + <a>删除</a>
  119 + </a-popconfirm>
  120 + </a-menu-item>
  121 + </a-menu>
  122 + </a-dropdown>
  123 + </span>
  124 +
  125 + </a-table>
  126 + </div>
  127 +
  128 + <a-tabs defaultActiveKey="1">
  129 + <a-tab-pane tab="库存详情" key="1" >
  130 + <InventoryDetailList :mainId="selectedMainId" />
  131 + </a-tab-pane>
  132 + </a-tabs>
  133 +
  134 + <inventoryHeader-modal ref="modalForm" @ok="modalFormOk"></inventoryHeader-modal>
  135 + </a-card>
  136 +</template>
  137 +
  138 +<script>
  139 +
  140 + import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  141 + import InventoryHeaderModal from './modules/InventoryHeaderModal'
  142 + import { getAction } from '@/api/manage'
  143 + import InventoryDetailList from './InventoryDetailList'
  144 + import {initDictOptions,filterMultiDictText} from '@/components/dict/JDictSelectUtil'
  145 + import '@/assets/less/TableExpand.less'
  146 +
  147 + export default {
  148 + name: "InventoryHeaderList",
  149 + mixins:[JeecgListMixin],
  150 + components: {
  151 + InventoryDetailList,
  152 + InventoryHeaderModal
  153 + },
  154 + data () {
  155 + return {
  156 + description: '库存表管理页面',
  157 + // 表头
  158 + columns: [
  159 + {
  160 + title:'库存ID',
  161 + align:"center",
  162 + dataIndex: 'id'
  163 + },
  164 + {
  165 + title:'库区',
  166 + align:"center",
  167 + dataIndex: 'zoneCode'
  168 + },
  169 + {
  170 + title:'容器号',
  171 + align:"center",
  172 + dataIndex: 'containerCode'
  173 + },
  174 + {
  175 + title:'容器状态',
  176 + align:"center",
  177 + dataIndex: 'containerStatus_dictText',
  178 + },
  179 + {
  180 + title:'库位号',
  181 + align:"center",
  182 + dataIndex: 'locationCode'
  183 + },
  184 + {
  185 + title:'总数量',
  186 + align:"center",
  187 + dataIndex: 'totalQty'
  188 + },
  189 + {
  190 + title:'总行量',
  191 + align:"center",
  192 + dataIndex: 'totalLines'
  193 + },
  194 + {
  195 + title:'创建人',
  196 + align:"center",
  197 + dataIndex: 'createBy'
  198 + },
  199 + {
  200 + title:'创建日期',
  201 + align:"center",
  202 + dataIndex: 'createTime'
  203 + },
  204 + {
  205 + title:'更新人',
  206 + align:"center",
  207 + dataIndex: 'updateBy'
  208 + },
  209 + {
  210 + title:'更新日期',
  211 + align:"center",
  212 + dataIndex: 'updateTime'
  213 + },
  214 + {
  215 + title: '操作',
  216 + dataIndex: 'action',
  217 + align:"center",
  218 + fixed:"right",
  219 + width:147,
  220 + scopedSlots: { customRender: 'action' },
  221 + }
  222 + ],
  223 + url: {
  224 + list: "/inventory/inventoryHeader/list",
  225 + delete: "/inventory/inventoryHeader/delete",
  226 + deleteBatch: "/inventory/inventoryHeader/deleteBatch",
  227 + exportXlsUrl: "/inventory/inventoryHeader/exportXls",
  228 + importExcelUrl: "inventory/inventoryHeader/importExcel",
  229 + },
  230 + dictOptions:{
  231 + containerStatus:[],
  232 + },
  233 + /* 分页参数 */
  234 + ipagination:{
  235 + current: 1,
  236 + pageSize: 5,
  237 + pageSizeOptions: ['5', '10', '50'],
  238 + showTotal: (total, range) => {
  239 + return range[0] + "-" + range[1] + " 共" + total + "条"
  240 + },
  241 + showQuickJumper: true,
  242 + showSizeChanger: true,
  243 + total: 0
  244 + },
  245 + selectedMainId:'',
  246 + superFieldList:[],
  247 + }
  248 + },
  249 + created() {
  250 + this.getSuperFieldList();
  251 + },
  252 + computed: {
  253 + importExcelUrl: function(){
  254 + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  255 + }
  256 + },
  257 + methods: {
  258 + initDictConfig(){
  259 + },
  260 + clickThenSelect(record) {
  261 + return {
  262 + on: {
  263 + click: () => {
  264 + this.onSelectChange(record.id.split(","), [record]);
  265 + }
  266 + }
  267 + }
  268 + },
  269 + onClearSelected() {
  270 + this.selectedRowKeys = [];
  271 + this.selectionRows = [];
  272 + this.selectedMainId=''
  273 + },
  274 + onSelectChange(selectedRowKeys, selectionRows) {
  275 + this.selectedMainId=selectedRowKeys[0]
  276 + this.selectedRowKeys = selectedRowKeys;
  277 + this.selectionRows = selectionRows;
  278 + },
  279 + loadData(arg) {
  280 + if(!this.url.list){
  281 + this.$message.error("请设置url.list属性!")
  282 + return
  283 + }
  284 + //加载数据 若传入参数1则加载第一页的内容
  285 + if (arg === 1) {
  286 + this.ipagination.current = 1;
  287 + }
  288 + this.onClearSelected()
  289 + var params = this.getQueryParams();//查询条件
  290 + this.loading = true;
  291 + getAction(this.url.list, params).then((res) => {
  292 + if (res.success) {
  293 + this.dataSource = res.result.records;
  294 + this.ipagination.total = res.result.total;
  295 + }
  296 + if(res.code===510){
  297 + this.$message.warning(res.message)
  298 + }
  299 + this.loading = false;
  300 + })
  301 + },
  302 + getSuperFieldList(){
  303 + let fieldList=[];
  304 + fieldList.push({type:'string',value:'companyCode',text:'货主',dictCode:''})
  305 + fieldList.push({type:'string',value:'zoneCode',text:'库区',dictCode:''})
  306 + fieldList.push({type:'string',value:'containerCode',text:'容器号',dictCode:''})
  307 + fieldList.push({type:'string',value:'containerStatus',text:'容器状态',dictCode:'container_status'})
  308 + fieldList.push({type:'string',value:'locationCode',text:'库位号',dictCode:''})
  309 + fieldList.push({type:'BigDecimal',value:'totalQty',text:'总数量',dictCode:''})
  310 + fieldList.push({type:'int',value:'totalLines',text:'总行量',dictCode:''})
  311 + fieldList.push({type:'string',value:'createBy',text:'创建人',dictCode:''})
  312 + fieldList.push({type:'datetime',value:'createTime',text:'创建日期'})
  313 + fieldList.push({type:'string',value:'updateBy',text:'更新人',dictCode:''})
  314 + fieldList.push({type:'datetime',value:'updateTime',text:'更新日期'})
  315 + this.superFieldList = fieldList
  316 + }
  317 + }
  318 + }
  319 +</script>
  320 +<style scoped>
  321 + @import '~@assets/less/common.less'
  322 +</style>
0 323 \ No newline at end of file
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryTransactionList.vue 0 → 100644
  1 +<template>
  2 + <a-card :bordered="false">
  3 + <!-- 查询区域 -->
  4 + <div class="table-page-search-wrapper">
  5 + <a-form layout="inline" @keyup.enter.native="searchQuery">
  6 + <a-row :gutter="24">
  7 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  8 + <a-form-item label="货主">
  9 + <a-input placeholder="请输入货主" v-model="queryParam.companyCode"></a-input>
  10 + </a-form-item>
  11 + </a-col>
  12 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  13 + <a-form-item label="容器编码">
  14 + <a-input placeholder="请输入容器编码" v-model="queryParam.containerCode"></a-input>
  15 + </a-form-item>
  16 + </a-col>
  17 + <template v-if="toggleSearchStatus">
  18 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  19 + <a-form-item label="库位编码">
  20 + <a-input placeholder="请输入库位编码" v-model="queryParam.locationCode"></a-input>
  21 + </a-form-item>
  22 + </a-col>
  23 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  24 + <a-form-item label="交易类型">
  25 + <j-dict-select-tag placeholder="请选择交易类型" v-model="queryParam.type" dictCode="inventory_transaction_type"/>
  26 + </a-form-item>
  27 + </a-col>
  28 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  29 + <a-form-item label="物料编码">
  30 + <a-input placeholder="请输入物料编码" v-model="queryParam.materialCode"></a-input>
  31 + </a-form-item>
  32 + </a-col>
  33 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  34 + <a-form-item label="物料名称">
  35 + <a-input placeholder="请输入物料名称" v-model="queryParam.materialName"></a-input>
  36 + </a-form-item>
  37 + </a-col>
  38 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  39 + <a-form-item label="物料规格">
  40 + <a-input placeholder="请输入物料规格" v-model="queryParam.materialSpec"></a-input>
  41 + </a-form-item>
  42 + </a-col>
  43 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  44 + <a-form-item label="物料单位">
  45 + <a-input placeholder="请输入物料单位" v-model="queryParam.materialUnit"></a-input>
  46 + </a-form-item>
  47 + </a-col>
  48 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  49 + <a-form-item label="库存状态">
  50 + <a-input placeholder="请输入库存状态" v-model="queryParam.inventoryStatus"></a-input>
  51 + </a-form-item>
  52 + </a-col>
  53 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  54 + <a-form-item label="批次">
  55 + <a-input placeholder="请输入批次" v-model="queryParam.batch"></a-input>
  56 + </a-form-item>
  57 + </a-col>
  58 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  59 + <a-form-item label="创建人">
  60 + <a-input placeholder="请输入创建人" v-model="queryParam.createBy"></a-input>
  61 + </a-form-item>
  62 + </a-col>
  63 + <a-col :xl="10" :lg="11" :md="12" :sm="24">
  64 + <a-form-item label="创建日期">
  65 + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.createTime_begin"></j-date>
  66 + <span class="query-group-split-cust"></span>
  67 + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.createTime_end"></j-date>
  68 + </a-form-item>
  69 + </a-col>
  70 + </template>
  71 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  72 + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  73 + <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  74 + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  75 + <a @click="handleToggleSearch" style="margin-left: 8px">
  76 + {{ toggleSearchStatus ? '收起' : '展开' }}
  77 + <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  78 + </a>
  79 + </span>
  80 + </a-col>
  81 + </a-row>
  82 + </a-form>
  83 + </div>
  84 + <!-- 查询区域-END -->
  85 +
  86 + <!-- 操作按钮区域 -->
  87 + <div class="table-operator">
  88 + <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  89 + <a-button type="primary" icon="download" @click="handleExportXls('库存交易记录')">导出</a-button>
  90 + <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  91 + <a-button type="primary" icon="import">导入</a-button>
  92 + </a-upload>
  93 + <!-- 高级查询区域 -->
  94 + <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
  95 + <a-dropdown v-if="selectedRowKeys.length > 0">
  96 + <a-menu slot="overlay">
  97 + <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
  98 + </a-menu>
  99 + <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  100 + </a-dropdown>
  101 + </div>
  102 +
  103 + <!-- table区域-begin -->
  104 + <div>
  105 + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  106 + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  107 + <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  108 + </div>
  109 +
  110 + <a-table
  111 + ref="table"
  112 + size="middle"
  113 + :scroll="{x:true}"
  114 + bordered
  115 + rowKey="id"
  116 + :columns="columns"
  117 + :dataSource="dataSource"
  118 + :pagination="ipagination"
  119 + :loading="loading"
  120 + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  121 + class="j-table-force-nowrap"
  122 + @change="handleTableChange">
  123 +
  124 + <template slot="htmlSlot" slot-scope="text">
  125 + <div v-html="text"></div>
  126 + </template>
  127 + <template slot="imgSlot" slot-scope="text">
  128 + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
  129 + <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  130 + </template>
  131 + <template slot="fileSlot" slot-scope="text">
  132 + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
  133 + <a-button
  134 + v-else
  135 + :ghost="true"
  136 + type="primary"
  137 + icon="download"
  138 + size="small"
  139 + @click="downloadFile(text)">
  140 + 下载
  141 + </a-button>
  142 + </template>
  143 +
  144 + <span slot="action" slot-scope="text, record">
  145 + <a @click="handleEdit(record)">编辑</a>
  146 +
  147 + <a-divider type="vertical" />
  148 + <a-dropdown>
  149 + <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  150 + <a-menu slot="overlay">
  151 + <a-menu-item>
  152 + <a @click="handleDetail(record)">详情</a>
  153 + </a-menu-item>
  154 + <a-menu-item>
  155 + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  156 + <a>删除</a>
  157 + </a-popconfirm>
  158 + </a-menu-item>
  159 + </a-menu>
  160 + </a-dropdown>
  161 + </span>
  162 +
  163 + </a-table>
  164 + </div>
  165 +
  166 + <inventory-transaction-modal ref="modalForm" @ok="modalFormOk"></inventory-transaction-modal>
  167 + </a-card>
  168 +</template>
  169 +
  170 +<script>
  171 +
  172 + import '@/assets/less/TableExpand.less'
  173 + import { mixinDevice } from '@/utils/mixin'
  174 + import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  175 + import InventoryTransactionModal from './modules/InventoryTransactionModal'
  176 + import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
  177 +
  178 + export default {
  179 + name: 'InventoryTransactionList',
  180 + mixins:[JeecgListMixin, mixinDevice],
  181 + components: {
  182 + InventoryTransactionModal
  183 + },
  184 + data () {
  185 + return {
  186 + description: '库存交易记录管理页面',
  187 + // 表头
  188 + columns: [
  189 + {
  190 + title:'库存交易ID',
  191 + align:"center",
  192 + dataIndex: 'id'
  193 + },
  194 + {
  195 + title:'货主',
  196 + align:"center",
  197 + dataIndex: 'companyCode'
  198 + },
  199 + {
  200 + title:'容器编码',
  201 + align:"center",
  202 + dataIndex: 'containerCode'
  203 + },
  204 + {
  205 + title:'库位编码',
  206 + align:"center",
  207 + dataIndex: 'locationCode'
  208 + },
  209 + {
  210 + title:'交易类型',
  211 + align:"center",
  212 + dataIndex: 'type_dictText'
  213 + },
  214 + {
  215 + title:'物料编码',
  216 + align:"center",
  217 + dataIndex: 'materialCode'
  218 + },
  219 + {
  220 + title:'物料名称',
  221 + align:"center",
  222 + dataIndex: 'materialName'
  223 + },
  224 + {
  225 + title:'物料规格',
  226 + align:"center",
  227 + dataIndex: 'materialSpec'
  228 + },
  229 + {
  230 + title:'物料单位',
  231 + align:"center",
  232 + dataIndex: 'materialUnit'
  233 + },
  234 + {
  235 + title:'库存状态',
  236 + align:"center",
  237 + dataIndex: 'inventoryStatus'
  238 + },
  239 + {
  240 + title:'数量',
  241 + align:"center",
  242 + dataIndex: 'qty'
  243 + },
  244 + {
  245 + title:'批次',
  246 + align:"center",
  247 + dataIndex: 'batch'
  248 + },
  249 + {
  250 + title:'创建人',
  251 + align:"center",
  252 + dataIndex: 'createBy'
  253 + },
  254 + {
  255 + title:'创建日期',
  256 + align:"center",
  257 + dataIndex: 'createTime'
  258 + },
  259 + {
  260 + title:'更新人',
  261 + align:"center",
  262 + dataIndex: 'updateBy'
  263 + },
  264 + {
  265 + title:'更新日期',
  266 + align:"center",
  267 + dataIndex: 'updateTime'
  268 + },
  269 + {
  270 + title: '操作',
  271 + dataIndex: 'action',
  272 + align:"center",
  273 + fixed:"right",
  274 + width:147,
  275 + scopedSlots: { customRender: 'action' }
  276 + }
  277 + ],
  278 + url: {
  279 + list: "/inventory/inventoryTransaction/list",
  280 + delete: "/inventory/inventoryTransaction/delete",
  281 + deleteBatch: "/inventory/inventoryTransaction/deleteBatch",
  282 + exportXlsUrl: "/inventory/inventoryTransaction/exportXls",
  283 + importExcelUrl: "inventory/inventoryTransaction/importExcel",
  284 +
  285 + },
  286 + dictOptions:{},
  287 + superFieldList:[],
  288 + }
  289 + },
  290 + created() {
  291 + this.getSuperFieldList();
  292 + },
  293 + computed: {
  294 + importExcelUrl: function(){
  295 + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  296 + },
  297 + },
  298 + methods: {
  299 + initDictConfig(){
  300 + },
  301 + getSuperFieldList(){
  302 + let fieldList=[];
  303 + fieldList.push({type:'string',value:'companyCode',text:'货主',dictCode:''})
  304 + fieldList.push({type:'string',value:'containerCode',text:'容器编码',dictCode:''})
  305 + fieldList.push({type:'string',value:'locationCode',text:'库位编码',dictCode:''})
  306 + fieldList.push({type:'int',value:'type',text:'交易类型',dictCode:'inventory_transaction_type'})
  307 + fieldList.push({type:'string',value:'materialCode',text:'物料编码',dictCode:''})
  308 + fieldList.push({type:'string',value:'materialName',text:'物料名称',dictCode:''})
  309 + fieldList.push({type:'string',value:'materialSpec',text:'物料规格',dictCode:''})
  310 + fieldList.push({type:'string',value:'materialUnit',text:'物料单位',dictCode:''})
  311 + fieldList.push({type:'string',value:'inventoryStatus',text:'库存状态',dictCode:''})
  312 + fieldList.push({type:'BigDecimal',value:'qty',text:'数量',dictCode:''})
  313 + fieldList.push({type:'string',value:'batch',text:'批次',dictCode:''})
  314 + fieldList.push({type:'string',value:'createBy',text:'创建人',dictCode:''})
  315 + fieldList.push({type:'datetime',value:'createTime',text:'创建日期'})
  316 + fieldList.push({type:'string',value:'updateBy',text:'更新人',dictCode:''})
  317 + fieldList.push({type:'datetime',value:'updateTime',text:'更新日期'})
  318 + this.superFieldList = fieldList
  319 + }
  320 + }
  321 + }
  322 +</script>
  323 +<style scoped>
  324 + @import '~@assets/less/common.less';
  325 +</style>
0 326 \ No newline at end of file
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryDetailModal.vue 0 → 100644
  1 +<template>
  2 + <j-modal
  3 + :title="title"
  4 + :width="width"
  5 + :visible="visible"
  6 + :confirmLoading="confirmLoading"
  7 + switchFullscreen
  8 + @ok="handleOk"
  9 + @cancel="handleCancel"
  10 + cancelText="关闭">
  11 + <a-spin :spinning="confirmLoading">
  12 + <a-form-model ref="form" :model="model" :rules="validatorRules">
  13 + <a-row>
  14 + <a-col :span="24">
  15 + <a-form-model-item label="货主" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="companyCode">
  16 + <a-input v-model="model.companyCode"placeholder="请输入货主" ></a-input>
  17 + </a-form-model-item>
  18 + </a-col>
  19 + <a-col :span="24">
  20 + <a-form-model-item label="库区" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zoneCode">
  21 + <a-input v-model="model.zoneCode"placeholder="请输入库区" ></a-input>
  22 + </a-form-model-item>
  23 + </a-col>
  24 + <a-col :span="24">
  25 + <a-form-model-item label="容器编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerCode">
  26 + <a-input v-model="model.containerCode"placeholder="请输入容器编码" ></a-input>
  27 + </a-form-model-item>
  28 + </a-col>
  29 + <a-col :span="24">
  30 + <a-form-model-item label="库位编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="locationCode">
  31 + <a-input v-model="model.locationCode"placeholder="请输入库位编码" ></a-input>
  32 + </a-form-model-item>
  33 + </a-col>
  34 + <a-col :span="24">
  35 + <a-form-model-item label="物料编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialCode">
  36 + <a-input v-model="model.materialCode"placeholder="请输入物料编码" ></a-input>
  37 + </a-form-model-item>
  38 + </a-col>
  39 + <a-col :span="24">
  40 + <a-form-model-item label="物料名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialName">
  41 + <a-input v-model="model.materialName"placeholder="请输入物料名称" ></a-input>
  42 + </a-form-model-item>
  43 + </a-col>
  44 + <a-col :span="24">
  45 + <a-form-model-item label="物料规格" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialSpec">
  46 + <a-input v-model="model.materialSpec"placeholder="请输入物料规格" ></a-input>
  47 + </a-form-model-item>
  48 + </a-col>
  49 + <a-col :span="24">
  50 + <a-form-model-item label="物料单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialUnit">
  51 + <a-input v-model="model.materialUnit"placeholder="请输入物料单位" ></a-input>
  52 + </a-form-model-item>
  53 + </a-col>
  54 + <a-col :span="24">
  55 + <a-form-model-item label="数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qty">
  56 + <a-input-number v-model="model.qty"placeholder="请输入数量" style="width: 100%" />
  57 + </a-form-model-item>
  58 + </a-col>
  59 + <a-col :span="24">
  60 + <a-form-model-item label="任务锁定数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="taskQty">
  61 + <a-input-number v-model="model.taskQty"placeholder="请输入任务锁定数量" style="width: 100%" />
  62 + </a-form-model-item>
  63 + </a-col>
  64 + <a-col :span="24">
  65 + <a-form-model-item label="库存状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inventoryStatus">
  66 + <j-dict-select-tag type="list" v-model="model.inventoryStatus" dictCode="inventory_status" placeholder="请选择库存状态" />
  67 + </a-form-model-item>
  68 + </a-col>
  69 + <a-col :span="24">
  70 + <a-form-model-item label="批次" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="batch">
  71 + <a-input v-model="model.batch"placeholder="请输入批次" ></a-input>
  72 + </a-form-model-item>
  73 + </a-col>
  74 + </a-row>
  75 + </a-form-model>
  76 + </a-spin>
  77 + </j-modal>
  78 +</template>
  79 +
  80 +<script>
  81 +
  82 + import { httpAction } from '@/api/manage'
  83 + import { validateDuplicateValue } from '@/utils/util'
  84 +
  85 + export default {
  86 + name: "InventoryDetailModal",
  87 + components: {
  88 + },
  89 + props:{
  90 + mainId:{
  91 + type:String,
  92 + required:false,
  93 + default:''
  94 + }
  95 + },
  96 + data () {
  97 + return {
  98 + title:"操作",
  99 + width:800,
  100 + visible: false,
  101 + model:{
  102 + },
  103 + labelCol: {
  104 + xs: { span: 24 },
  105 + sm: { span: 5 },
  106 + },
  107 + wrapperCol: {
  108 + xs: { span: 24 },
  109 + sm: { span: 16 },
  110 + },
  111 +
  112 + confirmLoading: false,
  113 + validatorRules: {
  114 + containerCode: [
  115 + { required: true, message: '请输入容器编码!'},
  116 + ],
  117 + materialCode: [
  118 + { required: true, message: '请输入物料编码!'},
  119 + ],
  120 + },
  121 + url: {
  122 + add: "/inventory/inventoryHeader/addInventoryDetail",
  123 + edit: "/inventory/inventoryHeader/editInventoryDetail",
  124 + }
  125 +
  126 + }
  127 + },
  128 + created () {
  129 + //备份model原始值
  130 + this.modelDefault = JSON.parse(JSON.stringify(this.model));
  131 + },
  132 + methods: {
  133 + add () {
  134 + this.edit(this.modelDefault);
  135 + },
  136 + edit (record) {
  137 + this.model = Object.assign({}, record);
  138 + this.visible = true;
  139 + },
  140 + close () {
  141 + this.$emit('close');
  142 + this.visible = false;
  143 + this.$refs.form.clearValidate();
  144 + },
  145 + handleOk () {
  146 + const that = this;
  147 + // 触发表单验证
  148 + this.$refs.form.validate(valid => {
  149 + if (valid) {
  150 + that.confirmLoading = true;
  151 + let httpurl = '';
  152 + let method = '';
  153 + if(!this.model.id){
  154 + httpurl+=this.url.add;
  155 + method = 'post';
  156 + }else{
  157 + httpurl+=this.url.edit;
  158 + method = 'put';
  159 + }
  160 + this.model['inventoryHeaderId'] = this.mainId
  161 + httpAction(httpurl,this.model,method).then((res)=>{
  162 + if(res.success){
  163 + that.$message.success(res.message);
  164 + that.$emit('ok');
  165 + }else{
  166 + that.$message.warning(res.message);
  167 + }
  168 + }).finally(() => {
  169 + that.confirmLoading = false;
  170 + that.close();
  171 + })
  172 + }else{
  173 + return false
  174 + }
  175 + })
  176 + },
  177 + handleCancel () {
  178 + this.close()
  179 + },
  180 +
  181 +
  182 + }
  183 + }
  184 +</script>
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryHeaderModal.vue 0 → 100644
  1 +<template>
  2 + <j-modal
  3 + :title="title"
  4 + :width="width"
  5 + :visible="visible"
  6 + :confirmLoading="confirmLoading"
  7 + switchFullscreen
  8 + @ok="handleOk"
  9 + @cancel="handleCancel"
  10 + cancelText="关闭">
  11 + <a-spin :spinning="confirmLoading">
  12 + <a-form-model ref="form" :model="model" :rules="validatorRules">
  13 + <a-row>
  14 + <a-col :span="24">
  15 + <a-form-model-item label="货主" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="companyCode">
  16 + <a-input v-model="model.companyCode" placeholder="请输入货主" ></a-input>
  17 + </a-form-model-item>
  18 + </a-col>
  19 + <a-col :span="24">
  20 + <a-form-model-item label="库区" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zoneCode">
  21 + <a-input v-model="model.zoneCode" placeholder="请输入库区" ></a-input>
  22 + </a-form-model-item>
  23 + </a-col>
  24 + <a-col :span="24">
  25 + <a-form-model-item label="容器号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerCode">
  26 + <a-input v-model="model.containerCode" placeholder="请输入容器号" ></a-input>
  27 + </a-form-model-item>
  28 + </a-col>
  29 + <a-col :span="24">
  30 + <a-form-model-item label="容器状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerStatus">
  31 + <j-dict-select-tag type="list" v-model="model.containerStatus" dictCode="container_status" placeholder="请选择容器状态" />
  32 + </a-form-model-item>
  33 + </a-col>
  34 + <a-col :span="24">
  35 + <a-form-model-item label="库位号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="locationCode">
  36 + <a-input v-model="model.locationCode" placeholder="请输入库位号" ></a-input>
  37 + </a-form-model-item>
  38 + </a-col>
  39 + <a-col :span="24">
  40 + <a-form-model-item label="总数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="totalQty">
  41 + <a-input-number v-model="model.totalQty" placeholder="请输入总数量" style="width: 100%" />
  42 + </a-form-model-item>
  43 + </a-col>
  44 + <a-col :span="24">
  45 + <a-form-model-item label="总行量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="totalLines">
  46 + <a-input-number v-model="model.totalLines" placeholder="请输入总行量" style="width: 100%" />
  47 + </a-form-model-item>
  48 + </a-col>
  49 + </a-row>
  50 + </a-form-model>
  51 + </a-spin>
  52 + </j-modal>
  53 +</template>
  54 +
  55 +<script>
  56 +
  57 + import { httpAction } from '@/api/manage'
  58 + import { validateDuplicateValue } from '@/utils/util'
  59 +
  60 + export default {
  61 + name: "InventoryHeaderModal",
  62 + components: {
  63 + },
  64 + data () {
  65 + return {
  66 + title:"操作",
  67 + width:800,
  68 + visible: false,
  69 + model:{
  70 + },
  71 + labelCol: {
  72 + xs: { span: 24 },
  73 + sm: { span: 5 },
  74 + },
  75 + wrapperCol: {
  76 + xs: { span: 24 },
  77 + sm: { span: 16 },
  78 + },
  79 +
  80 + confirmLoading: false,
  81 + validatorRules: {
  82 + },
  83 + url: {
  84 + add: "/inventory/inventoryHeader/add",
  85 + edit: "/inventory/inventoryHeader/edit",
  86 + }
  87 +
  88 + }
  89 + },
  90 + created () {
  91 + //备份model原始值
  92 + this.modelDefault = JSON.parse(JSON.stringify(this.model));
  93 + },
  94 + methods: {
  95 + add () {
  96 + this.edit(this.modelDefault);
  97 + },
  98 + edit (record) {
  99 + this.model = Object.assign({}, record);
  100 + this.visible = true;
  101 + },
  102 + close () {
  103 + this.$emit('close');
  104 + this.visible = false;
  105 + this.$refs.form.clearValidate();
  106 + },
  107 + handleOk () {
  108 + const that = this;
  109 + // 触发表单验证
  110 + this.$refs.form.validate(valid => {
  111 + if (valid) {
  112 + that.confirmLoading = true;
  113 + let httpurl = '';
  114 + let method = '';
  115 + if(!this.model.id){
  116 + httpurl+=this.url.add;
  117 + method = 'post';
  118 + }else{
  119 + httpurl+=this.url.edit;
  120 + method = 'put';
  121 + }
  122 + httpAction(httpurl,this.model,method).then((res)=>{
  123 + if(res.success){
  124 + that.$message.success(res.message);
  125 + that.$emit('ok');
  126 + }else{
  127 + that.$message.warning(res.message);
  128 + }
  129 + }).finally(() => {
  130 + that.confirmLoading = false;
  131 + that.close();
  132 + })
  133 + }else{
  134 + return false
  135 + }
  136 + })
  137 + },
  138 + handleCancel () {
  139 + this.close()
  140 + },
  141 +
  142 +
  143 + }
  144 + }
  145 +</script>
0 146 \ No newline at end of file
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionForm.vue 0 → 100644
  1 +<template>
  2 + <a-spin :spinning="confirmLoading">
  3 + <j-form-container :disabled="formDisabled">
  4 + <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
  5 + <a-row>
  6 + <a-col :span="24">
  7 + <a-form-model-item label="货主" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="companyCode">
  8 + <a-input v-model="model.companyCode" placeholder="请输入货主" ></a-input>
  9 + </a-form-model-item>
  10 + </a-col>
  11 + <a-col :span="24">
  12 + <a-form-model-item label="容器编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerCode">
  13 + <a-input v-model="model.containerCode" placeholder="请输入容器编码" ></a-input>
  14 + </a-form-model-item>
  15 + </a-col>
  16 + <a-col :span="24">
  17 + <a-form-model-item label="库位编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="locationCode">
  18 + <a-input v-model="model.locationCode" placeholder="请输入库位编码" ></a-input>
  19 + </a-form-model-item>
  20 + </a-col>
  21 + <a-col :span="24">
  22 + <a-form-model-item label="交易类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type">
  23 + <j-dict-select-tag type="list" v-model="model.type" dictCode="inventory_transaction_type" placeholder="请选择交易类型" />
  24 + </a-form-model-item>
  25 + </a-col>
  26 + <a-col :span="24">
  27 + <a-form-model-item label="物料编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialCode">
  28 + <a-input v-model="model.materialCode" placeholder="请输入物料编码" ></a-input>
  29 + </a-form-model-item>
  30 + </a-col>
  31 + <a-col :span="24">
  32 + <a-form-model-item label="物料名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialName">
  33 + <a-input v-model="model.materialName" placeholder="请输入物料名称" ></a-input>
  34 + </a-form-model-item>
  35 + </a-col>
  36 + <a-col :span="24">
  37 + <a-form-model-item label="物料规格" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialSpec">
  38 + <a-input v-model="model.materialSpec" placeholder="请输入物料规格" ></a-input>
  39 + </a-form-model-item>
  40 + </a-col>
  41 + <a-col :span="24">
  42 + <a-form-model-item label="物料单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialUnit">
  43 + <a-input v-model="model.materialUnit" placeholder="请输入物料单位" ></a-input>
  44 + </a-form-model-item>
  45 + </a-col>
  46 + <a-col :span="24">
  47 + <a-form-model-item label="库存状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inventoryStatus">
  48 + <a-input v-model="model.inventoryStatus" placeholder="请输入库存状态" ></a-input>
  49 + </a-form-model-item>
  50 + </a-col>
  51 + <a-col :span="24">
  52 + <a-form-model-item label="数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qty">
  53 + <a-input-number v-model="model.qty" placeholder="请输入数量" style="width: 100%" />
  54 + </a-form-model-item>
  55 + </a-col>
  56 + <a-col :span="24">
  57 + <a-form-model-item label="批次" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="batch">
  58 + <a-input v-model="model.batch" placeholder="请输入批次" ></a-input>
  59 + </a-form-model-item>
  60 + </a-col>
  61 + </a-row>
  62 + </a-form-model>
  63 + </j-form-container>
  64 + </a-spin>
  65 +</template>
  66 +
  67 +<script>
  68 +
  69 + import { httpAction, getAction } from '@/api/manage'
  70 + import { validateDuplicateValue } from '@/utils/util'
  71 +
  72 + export default {
  73 + name: 'InventoryTransactionForm',
  74 + components: {
  75 + },
  76 + props: {
  77 + //表单禁用
  78 + disabled: {
  79 + type: Boolean,
  80 + default: false,
  81 + required: false
  82 + }
  83 + },
  84 + data () {
  85 + return {
  86 + model:{
  87 + },
  88 + labelCol: {
  89 + xs: { span: 24 },
  90 + sm: { span: 5 },
  91 + },
  92 + wrapperCol: {
  93 + xs: { span: 24 },
  94 + sm: { span: 16 },
  95 + },
  96 + confirmLoading: false,
  97 + validatorRules: {
  98 + },
  99 + url: {
  100 + add: "/inventory/inventoryTransaction/add",
  101 + edit: "/inventory/inventoryTransaction/edit",
  102 + queryById: "/inventory/inventoryTransaction/queryById"
  103 + }
  104 + }
  105 + },
  106 + computed: {
  107 + formDisabled(){
  108 + return this.disabled
  109 + },
  110 + },
  111 + created () {
  112 + //备份model原始值
  113 + this.modelDefault = JSON.parse(JSON.stringify(this.model));
  114 + },
  115 + methods: {
  116 + add () {
  117 + this.edit(this.modelDefault);
  118 + },
  119 + edit (record) {
  120 + this.model = Object.assign({}, record);
  121 + this.visible = true;
  122 + },
  123 + submitForm () {
  124 + const that = this;
  125 + // 触发表单验证
  126 + this.$refs.form.validate(valid => {
  127 + if (valid) {
  128 + that.confirmLoading = true;
  129 + let httpurl = '';
  130 + let method = '';
  131 + if(!this.model.id){
  132 + httpurl+=this.url.add;
  133 + method = 'post';
  134 + }else{
  135 + httpurl+=this.url.edit;
  136 + method = 'put';
  137 + }
  138 + httpAction(httpurl,this.model,method).then((res)=>{
  139 + if(res.success){
  140 + that.$message.success(res.message);
  141 + that.$emit('ok');
  142 + }else{
  143 + that.$message.warning(res.message);
  144 + }
  145 + }).finally(() => {
  146 + that.confirmLoading = false;
  147 + })
  148 + }
  149 +
  150 + })
  151 + },
  152 + }
  153 + }
  154 +</script>
0 155 \ No newline at end of file
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionModal.Style#Drawer.vue 0 → 100644
  1 +<template>
  2 + <a-drawer
  3 + :title="title"
  4 + :width="width"
  5 + placement="right"
  6 + :closable="false"
  7 + @close="close"
  8 + destroyOnClose
  9 + :visible="visible">
  10 + <inventory-transaction-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></inventory-transaction-form>
  11 + <div class="drawer-footer">
  12 + <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
  13 + <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
  14 + </div>
  15 + </a-drawer>
  16 +</template>
  17 +
  18 +<script>
  19 +
  20 + import InventoryTransactionForm from './InventoryTransactionForm'
  21 +
  22 + export default {
  23 + name: 'InventoryTransactionModal',
  24 + components: {
  25 + InventoryTransactionForm
  26 + },
  27 + data () {
  28 + return {
  29 + title:"操作",
  30 + width:800,
  31 + visible: false,
  32 + disableSubmit: false
  33 + }
  34 + },
  35 + methods: {
  36 + add () {
  37 + this.visible=true
  38 + this.$nextTick(()=>{
  39 + this.$refs.realForm.add();
  40 + })
  41 + },
  42 + edit (record) {
  43 + this.visible=true
  44 + this.$nextTick(()=>{
  45 + this.$refs.realForm.edit(record);
  46 + });
  47 + },
  48 + close () {
  49 + this.$emit('close');
  50 + this.visible = false;
  51 + },
  52 + submitCallback(){
  53 + this.$emit('ok');
  54 + this.visible = false;
  55 + },
  56 + handleOk () {
  57 + this.$refs.realForm.submitForm();
  58 + },
  59 + handleCancel () {
  60 + this.close()
  61 + }
  62 + }
  63 + }
  64 +</script>
  65 +
  66 +<style lang="less" scoped>
  67 +/** Button按钮间距 */
  68 + .ant-btn {
  69 + margin-left: 30px;
  70 + margin-bottom: 30px;
  71 + float: right;
  72 + }
  73 + .drawer-footer{
  74 + position: absolute;
  75 + bottom: -8px;
  76 + width: 100%;
  77 + border-top: 1px solid #e8e8e8;
  78 + padding: 10px 16px;
  79 + text-align: right;
  80 + left: 0;
  81 + background: #fff;
  82 + border-radius: 0 0 2px 2px;
  83 + }
  84 +</style>
0 85 \ No newline at end of file
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionModal.vue 0 → 100644
  1 +<template>
  2 + <j-modal
  3 + :title="title"
  4 + :width="width"
  5 + :visible="visible"
  6 + switchFullscreen
  7 + @ok="handleOk"
  8 + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
  9 + @cancel="handleCancel"
  10 + cancelText="关闭">
  11 + <inventory-transaction-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></inventory-transaction-form>
  12 + </j-modal>
  13 +</template>
  14 +
  15 +<script>
  16 +
  17 + import InventoryTransactionForm from './InventoryTransactionForm'
  18 + export default {
  19 + name: 'InventoryTransactionModal',
  20 + components: {
  21 + InventoryTransactionForm
  22 + },
  23 + data () {
  24 + return {
  25 + title:'',
  26 + width:800,
  27 + visible: false,
  28 + disableSubmit: false
  29 + }
  30 + },
  31 + methods: {
  32 + add () {
  33 + this.visible=true
  34 + this.$nextTick(()=>{
  35 + this.$refs.realForm.add();
  36 + })
  37 + },
  38 + edit (record) {
  39 + this.visible=true
  40 + this.$nextTick(()=>{
  41 + this.$refs.realForm.edit(record);
  42 + })
  43 + },
  44 + close () {
  45 + this.$emit('close');
  46 + this.visible = false;
  47 + },
  48 + handleOk () {
  49 + this.$refs.realForm.submitForm();
  50 + },
  51 + submitCallback(){
  52 + this.$emit('ok');
  53 + this.visible = false;
  54 + },
  55 + handleCancel () {
  56 + this.close()
  57 + }
  58 + }
  59 + }
  60 +</script>
0 61 \ No newline at end of file
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/ApiLogList.vue 0 → 100644
  1 +<template>
  2 + <a-card :bordered="false">
  3 + <!-- 查询区域 -->
  4 + <div class="table-page-search-wrapper">
  5 + <a-form layout="inline" @keyup.enter.native="searchQuery">
  6 + <a-row :gutter="24">
  7 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  8 + <a-form-item label="接口名称">
  9 + <a-input placeholder="请输入接口名称" v-model="queryParam.apiName"></a-input>
  10 + </a-form-item>
  11 + </a-col>
  12 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  13 + <a-form-item label="请求类型">
  14 + <a-input placeholder="请输入请求类型" v-model="queryParam.apiMethod"></a-input>
  15 + </a-form-item>
  16 + </a-col>
  17 + <template v-if="toggleSearchStatus">
  18 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  19 + <a-form-item label="请求方地址">
  20 + <a-input placeholder="请输入请求方地址" v-model="queryParam.ip"></a-input>
  21 + </a-form-item>
  22 + </a-col>
  23 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  24 + <a-form-item label="请求方名称">
  25 + <a-input placeholder="请输入请求方名称" v-model="queryParam.responseFrom"></a-input>
  26 + </a-form-item>
  27 + </a-col>
  28 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  29 + <a-form-item label="响应方名称">
  30 + <a-input placeholder="请输入响应方名称" v-model="queryParam.responseBy"></a-input>
  31 + </a-form-item>
  32 + </a-col>
  33 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  34 + <a-form-item label="请求地址">
  35 + <a-input placeholder="请输入请求地址" v-model="queryParam.url"></a-input>
  36 + </a-form-item>
  37 + </a-col>
  38 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  39 + <a-form-item label="响应耗时(毫秒)">
  40 + <a-input placeholder="请输入响应耗时(毫秒)" v-model="queryParam.duration"></a-input>
  41 + </a-form-item>
  42 + </a-col>
  43 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  44 + <a-form-item label="业务响应码">
  45 + <a-input placeholder="请输入业务响应码" v-model="queryParam.retCode"></a-input>
  46 + </a-form-item>
  47 + </a-col>
  48 + <a-col :xl="10" :lg="11" :md="12" :sm="24">
  49 + <a-form-item label="创建日期">
  50 + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.createTime_begin"></j-date>
  51 + <span class="query-group-split-cust"></span>
  52 + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.createTime_end"></j-date>
  53 + </a-form-item>
  54 + </a-col>
  55 + </template>
  56 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  57 + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  58 + <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  59 + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  60 + <a @click="handleToggleSearch" style="margin-left: 8px">
  61 + {{ toggleSearchStatus ? '收起' : '展开' }}
  62 + <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  63 + </a>
  64 + </span>
  65 + </a-col>
  66 + </a-row>
  67 + </a-form>
  68 + </div>
  69 + <!-- 查询区域-END -->
  70 +
  71 + <!-- 操作按钮区域 -->
  72 + <div class="table-operator">
  73 + <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  74 + <a-button type="primary" icon="download" @click="handleExportXls('接口日志')">导出</a-button>
  75 + <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  76 + <a-button type="primary" icon="import">导入</a-button>
  77 + </a-upload>
  78 + <!-- 高级查询区域 -->
  79 + <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
  80 + <a-dropdown v-if="selectedRowKeys.length > 0">
  81 + <a-menu slot="overlay">
  82 + <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
  83 + </a-menu>
  84 + <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  85 + </a-dropdown>
  86 + </div>
  87 +
  88 + <!-- table区域-begin -->
  89 + <div>
  90 + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  91 + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  92 + <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  93 + </div>
  94 +
  95 + <a-table
  96 + ref="table"
  97 + size="middle"
  98 + :scroll="{x:true}"
  99 + bordered
  100 + rowKey="id"
  101 + :columns="columns"
  102 + :dataSource="dataSource"
  103 + :pagination="ipagination"
  104 + :loading="loading"
  105 + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  106 + class="j-table-force-nowrap"
  107 + @change="handleTableChange">
  108 +
  109 + <template slot="htmlSlot" slot-scope="text">
  110 + <div v-html="text"></div>
  111 + </template>
  112 + <template slot="imgSlot" slot-scope="text">
  113 + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
  114 + <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  115 + </template>
  116 + <template slot="fileSlot" slot-scope="text">
  117 + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
  118 + <a-button
  119 + v-else
  120 + :ghost="true"
  121 + type="primary"
  122 + icon="download"
  123 + size="small"
  124 + @click="downloadFile(text)">
  125 + 下载
  126 + </a-button>
  127 + </template>
  128 +
  129 + <span slot="action" slot-scope="text, record">
  130 + <a @click="handleEdit(record)">编辑</a>
  131 +
  132 + <a-divider type="vertical" />
  133 + <a-dropdown>
  134 + <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  135 + <a-menu slot="overlay">
  136 + <a-menu-item>
  137 + <a @click="handleDetail(record)">详情</a>
  138 + </a-menu-item>
  139 + <a-menu-item>
  140 + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  141 + <a>删除</a>
  142 + </a-popconfirm>
  143 + </a-menu-item>
  144 + </a-menu>
  145 + </a-dropdown>
  146 + </span>
  147 +
  148 + </a-table>
  149 + </div>
  150 +
  151 + <api-log-modal ref="modalForm" @ok="modalFormOk"></api-log-modal>
  152 + </a-card>
  153 +</template>
  154 +
  155 +<script>
  156 +
  157 + import '@/assets/less/TableExpand.less'
  158 + import { mixinDevice } from '@/utils/mixin'
  159 + import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  160 + import ApiLogModal from './modules/ApiLogModal'
  161 +
  162 + export default {
  163 + name: 'ApiLogList',
  164 + mixins:[JeecgListMixin, mixinDevice],
  165 + components: {
  166 + ApiLogModal
  167 + },
  168 + data () {
  169 + return {
  170 + description: '接口日志管理页面',
  171 + // 表头
  172 + columns: [
  173 + {
  174 + title:'接口ID',
  175 + align:"center",
  176 + dataIndex: 'id'
  177 + },
  178 + {
  179 + title:'接口名称',
  180 + align:"center",
  181 + dataIndex: 'apiName'
  182 + },
  183 + {
  184 + title:'请求类型',
  185 + align:"center",
  186 + dataIndex: 'apiMethod'
  187 + },
  188 + {
  189 + title:'请求方地址',
  190 + align:"center",
  191 + dataIndex: 'ip'
  192 + },
  193 + {
  194 + title:'响应耗时(毫秒)',
  195 + align:"center",
  196 + dataIndex: 'duration'
  197 + },
  198 + {
  199 + title:'请求方名称',
  200 + align:"center",
  201 + dataIndex: 'responseFrom'
  202 + },
  203 + {
  204 + title:'响应方名称',
  205 + align:"center",
  206 + dataIndex: 'responseBy'
  207 + },
  208 + {
  209 + title:'请求地址',
  210 + align:"center",
  211 + dataIndex: 'url'
  212 + },
  213 + {
  214 + title:'请求时间',
  215 + align:"center",
  216 + dataIndex: 'requestTime'
  217 + },
  218 + {
  219 + title:'响应时间',
  220 + align:"center",
  221 + dataIndex: 'responseTime'
  222 + },
  223 + {
  224 + title:'请求头',
  225 + align:"center",
  226 + dataIndex: 'requestHeader'
  227 + },
  228 + {
  229 + title:'请求内容',
  230 + align:"center",
  231 + dataIndex: 'requestBody'
  232 + },
  233 + {
  234 + title:'响应头',
  235 + align:"center",
  236 + dataIndex: 'responseHeader'
  237 + },
  238 + {
  239 + title:'响应内容',
  240 + align:"center",
  241 + dataIndex: 'responseBody'
  242 + },
  243 + {
  244 + title:'httpCode',
  245 + align:"center",
  246 + dataIndex: 'httpCode'
  247 + },
  248 + {
  249 + title:'业务响应码',
  250 + align:"center",
  251 + dataIndex: 'retCode'
  252 + },
  253 + {
  254 + title:'异常堆栈信息',
  255 + align:"center",
  256 + dataIndex: 'exception'
  257 + },
  258 + {
  259 + title: '操作',
  260 + dataIndex: 'action',
  261 + align:"center",
  262 + fixed:"right",
  263 + width:147,
  264 + scopedSlots: { customRender: 'action' }
  265 + }
  266 + ],
  267 + url: {
  268 + list: "/monitor/apiLog/list",
  269 + delete: "/monitor/apiLog/delete",
  270 + deleteBatch: "/monitor/apiLog/deleteBatch",
  271 + exportXlsUrl: "/monitor/apiLog/exportXls",
  272 + importExcelUrl: "monitor/apiLog/importExcel",
  273 +
  274 + },
  275 + dictOptions:{},
  276 + superFieldList:[],
  277 + }
  278 + },
  279 + created() {
  280 + this.getSuperFieldList();
  281 + },
  282 + computed: {
  283 + importExcelUrl: function(){
  284 + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  285 + },
  286 + },
  287 + methods: {
  288 + initDictConfig(){
  289 + },
  290 + getSuperFieldList(){
  291 + let fieldList=[];
  292 + fieldList.push({type:'string',value:'apiName',text:'接口名称',dictCode:''})
  293 + fieldList.push({type:'string',value:'apiMethod',text:'请求类型',dictCode:''})
  294 + fieldList.push({type:'string',value:'ip',text:'请求方地址',dictCode:''})
  295 + fieldList.push({type:'string',value:'responseFrom',text:'请求方名称',dictCode:''})
  296 + fieldList.push({type:'string',value:'responseBy',text:'响应方名称',dictCode:''})
  297 + fieldList.push({type:'string',value:'url',text:'请求地址',dictCode:''})
  298 + fieldList.push({type:'datetime',value:'requestTime',text:'请求时间'})
  299 + fieldList.push({type:'datetime',value:'responseTime',text:'响应时间'})
  300 + fieldList.push({type:'Text',value:'requestHeader',text:'请求头',dictCode:''})
  301 + fieldList.push({type:'Text',value:'requestBody',text:'请求内容',dictCode:''})
  302 + fieldList.push({type:'Text',value:'responseHeader',text:'响应头',dictCode:''})
  303 + fieldList.push({type:'Text',value:'responseBody',text:'响应内容',dictCode:''})
  304 + fieldList.push({type:'string',value:'duration',text:'响应耗时(毫秒)',dictCode:''})
  305 + fieldList.push({type:'int',value:'httpCode',text:'httpCode',dictCode:''})
  306 + fieldList.push({type:'int',value:'retCode',text:'业务响应码',dictCode:''})
  307 + fieldList.push({type:'Text',value:'exception',text:'异常堆栈信息',dictCode:''})
  308 + fieldList.push({type:'datetime',value:'createTime',text:'创建日期'})
  309 + this.superFieldList = fieldList
  310 + }
  311 + }
  312 + }
  313 +</script>
  314 +<style scoped>
  315 + @import '~@assets/less/common.less';
  316 +</style>
0 317 \ No newline at end of file
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogForm.vue 0 → 100644
  1 +<template>
  2 + <a-spin :spinning="confirmLoading">
  3 + <j-form-container :disabled="formDisabled">
  4 + <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
  5 + <a-row>
  6 + <a-col :span="24">
  7 + <a-form-model-item label="接口名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="apiName">
  8 + <a-input v-model="model.apiName" placeholder="请输入接口名称" ></a-input>
  9 + </a-form-model-item>
  10 + </a-col>
  11 + <a-col :span="24">
  12 + <a-form-model-item label="请求类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="apiMethod">
  13 + <a-input v-model="model.apiMethod" placeholder="请输入请求类型" ></a-input>
  14 + </a-form-model-item>
  15 + </a-col>
  16 + <a-col :span="24">
  17 + <a-form-model-item label="请求方地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ip">
  18 + <a-input v-model="model.ip" placeholder="请输入请求方地址" ></a-input>
  19 + </a-form-model-item>
  20 + </a-col>
  21 + <a-col :span="24">
  22 + <a-form-model-item label="请求方名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responseFrom">
  23 + <a-input v-model="model.responseFrom" placeholder="请输入请求方名称" ></a-input>
  24 + </a-form-model-item>
  25 + </a-col>
  26 + <a-col :span="24">
  27 + <a-form-model-item label="响应方名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responseBy">
  28 + <a-input v-model="model.responseBy" placeholder="请输入响应方名称" ></a-input>
  29 + </a-form-model-item>
  30 + </a-col>
  31 + <a-col :span="24">
  32 + <a-form-model-item label="请求地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="url">
  33 + <a-input v-model="model.url" placeholder="请输入请求地址" ></a-input>
  34 + </a-form-model-item>
  35 + </a-col>
  36 + <a-col :span="24">
  37 + <a-form-model-item label="请求时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="requestTime">
  38 + <j-date placeholder="请选择请求时间" v-model="model.requestTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
  39 + </a-form-model-item>
  40 + </a-col>
  41 + <a-col :span="24">
  42 + <a-form-model-item label="响应时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responseTime">
  43 + <j-date placeholder="请选择响应时间" v-model="model.responseTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
  44 + </a-form-model-item>
  45 + </a-col>
  46 + <a-col :span="24">
  47 + <a-form-model-item label="请求头" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="requestHeader">
  48 + <a-input v-model="model.requestHeader" placeholder="请输入请求头" ></a-input>
  49 + </a-form-model-item>
  50 + </a-col>
  51 + <a-col :span="24">
  52 + <a-form-model-item label="请求内容" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="requestBody">
  53 + <a-input v-model="model.requestBody" placeholder="请输入请求内容" ></a-input>
  54 + </a-form-model-item>
  55 + </a-col>
  56 + <a-col :span="24">
  57 + <a-form-model-item label="响应头" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responseHeader">
  58 + <a-input v-model="model.responseHeader" placeholder="请输入响应头" ></a-input>
  59 + </a-form-model-item>
  60 + </a-col>
  61 + <a-col :span="24">
  62 + <a-form-model-item label="响应内容" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responseBody">
  63 + <a-input v-model="model.responseBody" placeholder="请输入响应内容" ></a-input>
  64 + </a-form-model-item>
  65 + </a-col>
  66 + <a-col :span="24">
  67 + <a-form-model-item label="响应耗时(毫秒)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="duration">
  68 + <a-input v-model="model.duration" placeholder="请输入响应耗时(毫秒)" ></a-input>
  69 + </a-form-model-item>
  70 + </a-col>
  71 + <a-col :span="24">
  72 + <a-form-model-item label="httpCode" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="httpCode">
  73 + <a-input-number v-model="model.httpCode" placeholder="请输入httpCode" style="width: 100%" />
  74 + </a-form-model-item>
  75 + </a-col>
  76 + <a-col :span="24">
  77 + <a-form-model-item label="业务响应码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="retCode">
  78 + <a-input-number v-model="model.retCode" placeholder="请输入业务响应码" style="width: 100%" />
  79 + </a-form-model-item>
  80 + </a-col>
  81 + <a-col :span="24">
  82 + <a-form-model-item label="异常堆栈信息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="exception">
  83 + <a-input v-model="model.exception" placeholder="请输入异常堆栈信息" ></a-input>
  84 + </a-form-model-item>
  85 + </a-col>
  86 + </a-row>
  87 + </a-form-model>
  88 + </j-form-container>
  89 + </a-spin>
  90 +</template>
  91 +
  92 +<script>
  93 +
  94 + import { httpAction, getAction } from '@/api/manage'
  95 + import { validateDuplicateValue } from '@/utils/util'
  96 +
  97 + export default {
  98 + name: 'ApiLogForm',
  99 + components: {
  100 + },
  101 + props: {
  102 + //表单禁用
  103 + disabled: {
  104 + type: Boolean,
  105 + default: false,
  106 + required: false
  107 + }
  108 + },
  109 + data () {
  110 + return {
  111 + model:{
  112 + },
  113 + labelCol: {
  114 + xs: { span: 24 },
  115 + sm: { span: 5 },
  116 + },
  117 + wrapperCol: {
  118 + xs: { span: 24 },
  119 + sm: { span: 16 },
  120 + },
  121 + confirmLoading: false,
  122 + validatorRules: {
  123 + },
  124 + url: {
  125 + add: "/monitor/apiLog/add",
  126 + edit: "/monitor/apiLog/edit",
  127 + queryById: "/monitor/apiLog/queryById"
  128 + }
  129 + }
  130 + },
  131 + computed: {
  132 + formDisabled(){
  133 + return this.disabled
  134 + },
  135 + },
  136 + created () {
  137 + //备份model原始值
  138 + this.modelDefault = JSON.parse(JSON.stringify(this.model));
  139 + },
  140 + methods: {
  141 + add () {
  142 + this.edit(this.modelDefault);
  143 + },
  144 + edit (record) {
  145 + this.model = Object.assign({}, record);
  146 + this.visible = true;
  147 + },
  148 + submitForm () {
  149 + const that = this;
  150 + // 触发表单验证
  151 + this.$refs.form.validate(valid => {
  152 + if (valid) {
  153 + that.confirmLoading = true;
  154 + let httpurl = '';
  155 + let method = '';
  156 + if(!this.model.id){
  157 + httpurl+=this.url.add;
  158 + method = 'post';
  159 + }else{
  160 + httpurl+=this.url.edit;
  161 + method = 'put';
  162 + }
  163 + httpAction(httpurl,this.model,method).then((res)=>{
  164 + if(res.success){
  165 + that.$message.success(res.message);
  166 + that.$emit('ok');
  167 + }else{
  168 + that.$message.warning(res.message);
  169 + }
  170 + }).finally(() => {
  171 + that.confirmLoading = false;
  172 + })
  173 + }
  174 +
  175 + })
  176 + },
  177 + }
  178 + }
  179 +</script>
0 180 \ No newline at end of file
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogModal.Style#Drawer.vue 0 → 100644
  1 +<template>
  2 + <a-drawer
  3 + :title="title"
  4 + :width="width"
  5 + placement="right"
  6 + :closable="false"
  7 + @close="close"
  8 + destroyOnClose
  9 + :visible="visible">
  10 + <api-log-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></api-log-form>
  11 + <div class="drawer-footer">
  12 + <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
  13 + <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
  14 + </div>
  15 + </a-drawer>
  16 +</template>
  17 +
  18 +<script>
  19 +
  20 + import ApiLogForm from './ApiLogForm'
  21 +
  22 + export default {
  23 + name: 'ApiLogModal',
  24 + components: {
  25 + ApiLogForm
  26 + },
  27 + data () {
  28 + return {
  29 + title:"操作",
  30 + width:800,
  31 + visible: false,
  32 + disableSubmit: false
  33 + }
  34 + },
  35 + methods: {
  36 + add () {
  37 + this.visible=true
  38 + this.$nextTick(()=>{
  39 + this.$refs.realForm.add();
  40 + })
  41 + },
  42 + edit (record) {
  43 + this.visible=true
  44 + this.$nextTick(()=>{
  45 + this.$refs.realForm.edit(record);
  46 + });
  47 + },
  48 + close () {
  49 + this.$emit('close');
  50 + this.visible = false;
  51 + },
  52 + submitCallback(){
  53 + this.$emit('ok');
  54 + this.visible = false;
  55 + },
  56 + handleOk () {
  57 + this.$refs.realForm.submitForm();
  58 + },
  59 + handleCancel () {
  60 + this.close()
  61 + }
  62 + }
  63 + }
  64 +</script>
  65 +
  66 +<style lang="less" scoped>
  67 +/** Button按钮间距 */
  68 + .ant-btn {
  69 + margin-left: 30px;
  70 + margin-bottom: 30px;
  71 + float: right;
  72 + }
  73 + .drawer-footer{
  74 + position: absolute;
  75 + bottom: -8px;
  76 + width: 100%;
  77 + border-top: 1px solid #e8e8e8;
  78 + padding: 10px 16px;
  79 + text-align: right;
  80 + left: 0;
  81 + background: #fff;
  82 + border-radius: 0 0 2px 2px;
  83 + }
  84 +</style>
0 85 \ No newline at end of file
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogModal.vue 0 → 100644
  1 +<template>
  2 + <j-modal
  3 + :title="title"
  4 + :width="width"
  5 + :visible="visible"
  6 + switchFullscreen
  7 + @ok="handleOk"
  8 + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
  9 + @cancel="handleCancel"
  10 + cancelText="关闭">
  11 + <api-log-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></api-log-form>
  12 + </j-modal>
  13 +</template>
  14 +
  15 +<script>
  16 +
  17 + import ApiLogForm from './ApiLogForm'
  18 + export default {
  19 + name: 'ApiLogModal',
  20 + components: {
  21 + ApiLogForm
  22 + },
  23 + data () {
  24 + return {
  25 + title:'',
  26 + width:800,
  27 + visible: false,
  28 + disableSubmit: false
  29 + }
  30 + },
  31 + methods: {
  32 + add () {
  33 + this.visible=true
  34 + this.$nextTick(()=>{
  35 + this.$refs.realForm.add();
  36 + })
  37 + },
  38 + edit (record) {
  39 + this.visible=true
  40 + this.$nextTick(()=>{
  41 + this.$refs.realForm.edit(record);
  42 + })
  43 + },
  44 + close () {
  45 + this.$emit('close');
  46 + this.visible = false;
  47 + },
  48 + handleOk () {
  49 + this.$refs.realForm.submitForm();
  50 + },
  51 + submitCallback(){
  52 + this.$emit('ok');
  53 + this.visible = false;
  54 + },
  55 + handleCancel () {
  56 + this.close()
  57 + }
  58 + }
  59 + }
  60 +</script>
0 61 \ No newline at end of file
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerDetailList.vue
... ... @@ -159,14 +159,9 @@
159 159 // 表头
160 160 columns: [
161 161 {
162   - title: '#',
163   - dataIndex: '',
164   - key:'rowIndex',
165   - width:60,
  162 + title:'组盘详情ID',
166 163 align:"center",
167   - customRender:function (t,r,index) {
168   - return parseInt(index)+1;
169   - }
  164 + dataIndex: 'id'
170 165 },
171 166 {
172 167 title:'货主编码',
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue
... ... @@ -165,6 +165,11 @@
165 165 // 表头
166 166 columns: [
167 167 {
  168 + title:'组盘ID',
  169 + align:"center",
  170 + dataIndex: 'id'
  171 + },
  172 + {
168 173 title:'容器号',
169 174 align:"center",
170 175 dataIndex: 'containerCode'
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptDetailList.vue
... ... @@ -112,14 +112,9 @@
112 112 // 表头
113 113 columns: [
114 114 {
115   - title: '#',
116   - dataIndex: '',
117   - key:'rowIndex',
118   - width:60,
  115 + title:'单据详情ID',
119 116 align:"center",
120   - customRender:function (t,r,index) {
121   - return parseInt(index)+1;
122   - }
  117 + dataIndex: 'id'
123 118 },
124 119 {
125 120 title:'物料编码',
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptHeaderList.vue
... ... @@ -222,6 +222,11 @@
222 222 // 表头
223 223 columns: [
224 224 {
  225 + title:'单据ID',
  226 + align:"center",
  227 + dataIndex: 'id'
  228 + },
  229 + {
225 230 title:'编码',
226 231 align:"center",
227 232 dataIndex: 'code'
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptDetailModal.vue
... ... @@ -88,8 +88,8 @@
88 88 ],
89 89 },
90 90 url: {
91   - add: "/config/receiptHeader/addReceiptDetail",
92   - edit: "/config/receiptHeader/editReceiptDetail",
  91 + add: "/receipt/receiptHeader/addReceiptDetail",
  92 + edit: "/receipt/receiptHeader/editReceiptDetail",
93 93 }
94 94  
95 95 }
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/TaskDetailList.vue
... ... @@ -112,14 +112,9 @@
112 112 // 表头
113 113 columns: [
114 114 {
115   - title: '#',
116   - dataIndex: '',
117   - key:'rowIndex',
118   - width:60,
  115 + title:'任务详情ID',
119 116 align:"center",
120   - customRender:function (t,r,index) {
121   - return parseInt(index)+1;
122   - }
  117 + dataIndex: 'id'
123 118 },
124 119 {
125 120 title:'货主',
... ...
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/TaskHeaderList.vue
... ... @@ -132,12 +132,15 @@
132 132 </template>
133 133  
134 134 <span slot="action" slot-scope="text, record">
135   - <a @click="handleEdit(record)">编辑</a>
  135 + <a v-if="record.status < 100" @click="completeTask(record)">完成任务</a>
136 136  
137 137 <a-divider type="vertical" />
138 138 <a-dropdown>
139 139 <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
140 140 <a-menu slot="overlay">
  141 + <a-menu-item>
  142 + <a @click="handleEdit(record)">编辑</a>
  143 + </a-menu-item>
141 144 <a-menu-item>
142 145 <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
143 146 <a>删除</a>
... ... @@ -168,6 +171,7 @@
168 171 import TaskDetailList from './TaskDetailList'
169 172 import {initDictOptions,filterMultiDictText} from '@/components/dict/JDictSelectUtil'
170 173 import '@/assets/less/TableExpand.less'
  174 + import {completeTaskByWMS} from '@/api/api'
171 175  
172 176 export default {
173 177 name: "TaskHeaderList",
... ... @@ -347,6 +351,21 @@
347 351 this.loading = false;
348 352 })
349 353 },
  354 + completeTask(record) {
  355 + this.loading = true;
  356 + const that = this;
  357 + this.model = Object.assign({}, record);
  358 + completeTaskByWMS(this.model).then((res) => {
  359 + this.loading = false;
  360 + if (res.success) {
  361 + this.$message.success(res.message);
  362 + }
  363 + else {
  364 + this.$message.error(res.message);
  365 + }
  366 + this.searchQuery();
  367 + });
  368 + },
350 369 getSuperFieldList(){
351 370 let fieldList=[];
352 371 fieldList.push({type:'int',value:'taskType',text:'任务类型',dictCode:'task_type'})
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/base/controller/JeecgController.java
... ... @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6 import com.baomidou.mybatisplus.extension.service.IService;
7 7 import lombok.extern.slf4j.Slf4j;
8 8 import org.apache.commons.beanutils.PropertyUtils;
  9 +import org.apache.commons.collections.MapUtils;
9 10 import org.apache.shiro.SecurityUtils;
10 11 import org.jeecg.common.api.vo.Result;
11 12 import org.jeecg.common.system.query.QueryGenerator;
... ... @@ -27,6 +28,7 @@ import javax.servlet.http.HttpServletRequest;
27 28 import javax.servlet.http.HttpServletResponse;
28 29 import java.io.IOException;
29 30 import java.util.*;
  31 +import java.util.concurrent.Semaphore;
30 32 import java.util.stream.Collectors;
31 33  
32 34 /**
... ... @@ -199,4 +201,68 @@ public class JeecgController&lt;T, S extends IService&lt;T&gt;&gt; {
199 201 }
200 202 return Result.error("文件导入失败!");
201 203 }
  204 +
  205 +
  206 + //下发任务并发控制
  207 + Map<String, Boolean> runningTaskMap = new HashMap<>();
  208 +
  209 + //并发控制,一次只允许一个请求
  210 + public Result handleQuest(String taskKey, MultiProcessListener multiProcessListener) {
  211 + Result result = null;
  212 + if(MapUtils.getBoolean(runningTaskMap, taskKey, false)) {
  213 + return Result.error("重复请求,清稍后重试");
  214 + }
  215 + runningTaskMap.put(taskKey, true);
  216 + try {
  217 + result = multiProcessListener.doProcess();
  218 + } catch (Exception e) {
  219 + e.printStackTrace();
  220 + throw new RuntimeException(e);
  221 + } finally {
  222 + runningTaskMap.put(taskKey, false);
  223 + }
  224 + return result;
  225 + }
  226 +
  227 + Semaphore semaphore=new Semaphore(1);
  228 + //下发任务并发控制
  229 + Map<String, Boolean> multiProcessMap = new HashMap<>();
  230 +
  231 + public Result handleMultiProcess(String taskKey, MultiProcessListener multiProcessListener) {
  232 + Result result = null;
  233 + int max_time = 30 * 1000;
  234 + int now = 0;
  235 + boolean avail = true;
  236 + while(avail) {
  237 + boolean availablePermits = MapUtils.getBoolean(multiProcessMap, taskKey, false);
  238 + if(!availablePermits) {
  239 + avail = false;
  240 + try {
  241 + multiProcessMap.put(taskKey, true);
  242 + result = multiProcessListener.doProcess();
  243 + } catch (Exception e) {
  244 + e.printStackTrace();
  245 + throw new RuntimeException(e);
  246 + } finally {
  247 + multiProcessMap.put(taskKey, false);
  248 + }
  249 + } else {
  250 + result = Result.error("多线程处理异常, 待处理现场太多,等待时间超出30秒");
  251 + try {
  252 + now = now + 200;
  253 + Thread.sleep(200);
  254 + } catch (InterruptedException e) {
  255 + e.printStackTrace();
  256 + }
  257 + if(now >= max_time) {
  258 + avail = false;
  259 + }
  260 + }
  261 + }
  262 + return result;
  263 + }
  264 +
  265 + public interface MultiProcessListener {
  266 + Result doProcess();
  267 + }
202 268 }
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/controller/WcsController.java
... ... @@ -6,6 +6,7 @@ import org.jeecg.common.api.vo.Result;
6 6 import org.jeecg.common.aspect.annotation.AutoLog;
7 7 import org.jeecg.modules.wms.api.wcs.entity.WarecellDomain;
8 8 import org.jeecg.modules.wms.api.wcs.service.WcsService;
  9 +import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger;
9 10 import org.jeecg.modules.wms.framework.controller.BaseController;
10 11 import org.jeecg.utils.StringUtils;
11 12 import org.springframework.web.bind.annotation.*;
... ... @@ -26,7 +27,7 @@ public class WcsController extends BaseController {
26 27 @PostMapping("/warecellAllocation")
27 28 @ApiOperation(value="wcs仓位分配", notes="wcs仓位分配", httpMethod = "POST")
28 29 @ResponseBody
29   -// @ApiLogger(apiName = "仓位分配", from="WCS")
  30 + @ApiLogger(apiName = "仓位分配", from="WCS")
30 31 public Result warecellAllocation(@RequestBody WarecellDomain warecellDomain) {
31 32 if (StringUtils.isEmpty(warecellDomain.getTaskNo())) {
32 33 return Result.error("任务号为空");
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsService.java
... ... @@ -2,6 +2,7 @@ package org.jeecg.modules.wms.api.wcs.service;
2 2  
3 3 import org.jeecg.common.api.vo.Result;
4 4 import org.jeecg.modules.wms.api.wcs.entity.WarecellDomain;
  5 +import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader;
5 6  
6 7 /**
7 8 * @author 游杰
... ... @@ -11,4 +12,5 @@ public interface WcsService {
11 12 /**仓位分配*/
12 13 Result warecellAllocation(WarecellDomain warecellDomain);
13 14  
  15 + Result wcsTaskAssign(TaskHeader taskHeader);
14 16 }
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java
... ... @@ -20,6 +20,7 @@ import org.jeecg.modules.wms.config.material.service.IMaterialService;
20 20 import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService;
21 21 import org.jeecg.modules.wms.config.zone.entity.Zone;
22 22 import org.jeecg.modules.wms.config.zone.service.IZoneService;
  23 +import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger;
23 24 import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerDetail;
24 25 import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader;
25 26 import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerDetailService;
... ... @@ -131,6 +132,16 @@ public class WcsServiceImpl implements WcsService {
131 132 taskDetailLambdaQueryWrapper.eq(TaskDetail::getTaskHeaderId, taskNo);
132 133 List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLambdaQueryWrapper);
133 134  
  135 + if(taskDetailList.size() > 0) {
  136 + String materialCode = taskDetailList.get(0).getMaterialCode();
  137 + if(StringUtils.isNotEmpty(materialCode)) {
  138 + Material material = materialService.getMaterialByCode(materialCode);
  139 + if(material != null) {
  140 + materialAreaCode = material.getMaterialareaCode();
  141 + }
  142 + }
  143 + }
  144 +
134 145 locationCode = locationAllocationService.allocation(allocationRule,
135 146 locationTypeCodeList, high, zoneCode, roadWays, warehouseCode, containerCode, materialAreaCode);
136 147 if (StringUtils.isEmpty(locationCode)) {
... ... @@ -155,12 +166,9 @@ public class WcsServiceImpl implements WcsService {
155 166 receiptContainerDetailList.add(receiptContainerDetail);
156 167 }
157 168 }
158   - receiptContainerDetailList = receiptContainerDetailList.stream().distinct().collect(Collectors.toList());
159   - if (receiptContainerDetailList != null && receiptContainerDetailList.size() > 0) {
160   - String materialCode = receiptContainerDetailList.get(0).getMaterialCode();
161   - Material material = materialService.getMaterialByCode(materialCode);
162   - materialAreaCode = material.getMaterialareaCode();
163   - }
  169 + //去重
  170 + receiptContainerDetailList = receiptContainerDetailList.stream().
  171 + distinct().collect(Collectors.toList());
164 172  
165 173 if (receiptContainerDetailList.size() > 0) {
166 174 //更新库位编码到组盘头表
... ... @@ -198,12 +206,14 @@ public class WcsServiceImpl implements WcsService {
198 206 } else {
199 207 Location outSideLocation = locationService.getOutSideNear(location);
200 208 if(outSideLocation != null) {
201   - TaskHeader outSideTaskHeader = taskHeaderService.getTaskHeaderByLocationCode(outSideLocation.getCode());
  209 + TaskHeader outSideTaskHeader = taskHeaderService.
  210 + getUnCompleteTaskByLocationCode(outSideLocation.getCode(), warehouseCode);
202 211 if (outSideTaskHeader != null) {
203 212 preTaskNo = outSideTaskHeader.getId();
204 213 }
205 214 }
206 215 }
  216 +
207 217 taskHeader.setZoneCode(location.getZoneCode());
208 218 taskHeader.setPreTaskNo(preTaskNo);
209 219 taskHeader.setWeight(Integer.parseInt(warecellDomain.getWeight()));
... ... @@ -217,4 +227,139 @@ public class WcsServiceImpl implements WcsService {
217 227 wcsTask.setPreTaskNo(String.valueOf(preTaskNo));
218 228 return Result.OK(wcsTask);
219 229 }
  230 +
  231 + @Override
  232 + @Transactional(rollbackFor = Exception.class)
  233 + @ApiLogger(apiName = "任务下发", from="WCS")
  234 + public Result wcsTaskAssign(TaskHeader taskHeader) {
  235 + if(taskHeader == null){
  236 + return Result.error("wms任务为空");
  237 + }
  238 + if(taskHeader.getId() == null){
  239 + return Result.error("wms任务号Id为空");
  240 + }
  241 + if(taskHeader.getTaskType() == null){
  242 + return Result.error("wms任务类型为空");
  243 + }
  244 + String containerCode = taskHeader.getContainerCode();
  245 + if(StringUtils.isEmpty(containerCode)){
  246 + return Result.error("wms任务中容器为空");
  247 + }
  248 + int taskType = taskHeader.getTaskType();
  249 + int preTaskNo = 0;
  250 + String warehouseCode = taskHeader.getWarehouseCode();
  251 + if(StringUtils.isEmpty(warehouseCode)){
  252 + return Result.error("wms任务中仓库编码为空");
  253 + }
  254 + String fromLocationCode = taskHeader.getFromLocationCode();
  255 + String toLocationCode = taskHeader.getToLocationCode();
  256 + Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode);
  257 + Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode);
  258 + boolean direction = true; // true 执行时是入库动作, false 执行时是出库动作
  259 + switch(taskType) {
  260 + case QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT:
  261 + case QuantityConstant.TASK_TYPE_WHOLESHIPMENT:
  262 + case QuantityConstant.TASK_TYPE_SORTINGSHIPMENT:
  263 + case QuantityConstant.TASK_TYPE_EMPTYSHIPMENT:
  264 + case QuantityConstant.TASK_TYPE_CYCLECOUNT:
  265 + case QuantityConstant.TASK_TYPE_TRANSFER:
  266 + case QuantityConstant.TASK_TYPE_VIEW:
  267 + case QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT:
  268 + if(fromLocation == null) {
  269 + return Result.error("起始库位为空");
  270 + }
  271 + direction = false;
  272 + break;
  273 + case QuantityConstant.TASK_TYPE_WHOLERECEIPT:
  274 + case QuantityConstant.TASK_TYPE_EMPTYRECEIPT:
  275 + case QuantityConstant.TASK_TYPE_MANY_EMPTYRECEIPT:
  276 + if(toLocation == null) {
  277 + return Result.error("终点库位为空");
  278 + }
  279 + direction = true;
  280 + break;
  281 + default:
  282 + break;
  283 + }
  284 +
  285 + // 出库动作
  286 + if (!direction) {
  287 + // 出库性质的任务圆库位不能为空
  288 + if (StringUtils.isEmpty(fromLocationCode)) {
  289 + return Result.error("源库位为空");
  290 + }
  291 + int rowFlag = fromLocation.getRowFlag();
  292 + if(rowFlag == QuantityConstant.ROW_OUT) {
  293 + //找到对应内侧库位
  294 + Location insideLocation = locationService.getInsideNear(fromLocation);
  295 + String insideLocationCode = insideLocation.getCode();
  296 + //如果对应内侧库位有托盘
  297 + if(StringUtils.isNotEmpty(insideLocation.getContainerCode())) {
  298 + //如果对应内侧库位有托盘数据,那么不可能会有入库类型的任务,因为正在执行的入库类型的任务 库位是不会有托盘数据的。
  299 + TaskHeader taskHeader1 = taskHeaderService.
  300 + getUnCompleteTaskByFromLocationCode(insideLocationCode, warehouseCode);
  301 + if(taskHeader1 != null) {
  302 + preTaskNo = taskHeader1.getId();
  303 + } else {
  304 + //找空闲库位,优先找外侧空闲库位,作为移库目的地
  305 + Location destinationLocation = locationService.getEmptyLocation(insideLocation);
  306 + if (destinationLocation == null) {
  307 + return Result.error("移库没有剩余库位");
  308 + }
  309 + Result result = taskHeaderService.createTransferTask(
  310 + insideLocation.getCode(), destinationLocation.getCode(), warehouseCode);
  311 + preTaskNo = (Integer) result.getResult();
  312 + if (!result.isSuccess()) {
  313 + return Result.error("创建移库任务失败");
  314 + }
  315 + //移库任务
  316 + taskHeader.setPreTaskNo(preTaskNo);
  317 + taskHeaderService.updateById(taskHeader);
  318 + return Result.error("先执行移库任务");
  319 + }
  320 + } else {
  321 + //如果是有任务,从这个库位入托盘,那么不能生成新的出库任务。必须等这个任务完成以后,重新生成新的移库后,这个任务才能执行。
  322 + TaskHeader taskHeader1 = taskHeaderService.
  323 + getUnCompleteTaskByToLocationCode(insideLocationCode, warehouseCode);
  324 + if(taskHeader1 != null) {
  325 + return Result.error("执行外侧库位出库时,相应的内侧库位有入库类型任务,请先执行完内侧库位任务");
  326 + }
  327 + //如果是有任务,从这个库位出托盘,那么等这个任务作为前置任务。
  328 + taskHeader1 = taskHeaderService.
  329 + getUnCompleteTaskByFromLocationCode(insideLocationCode, warehouseCode);
  330 + if(taskHeader1 != null) {
  331 + preTaskNo = taskHeader1.getId();
  332 + }
  333 + }
  334 + taskHeader.setPreTaskNo(preTaskNo);
  335 + taskHeaderService.updateById(taskHeader);
  336 + }
  337 + }
  338 +
  339 + WcsTask wcsTask = new WcsTask();
  340 + wcsTask.setTaskNo(taskHeader.getId().toString());
  341 + wcsTask.setWarehouseCode(warehouseCode);
  342 + wcsTask.setTaskType(taskType);
  343 + wcsTask.setFromPort(taskHeader.getFromPort());
  344 + wcsTask.setToPort(taskHeader.getToPort());
  345 + wcsTask.setContainerCode(taskHeader.getContainerCode());
  346 + if (preTaskNo != 0) {
  347 + wcsTask.setPreTaskNo(String.valueOf(preTaskNo));
  348 + }
  349 + if (StringUtils.isEmpty(fromLocationCode)) {
  350 + wcsTask.setFromLocationCode(QuantityConstant.EMPTY_STRING);
  351 + } else {
  352 + wcsTask.setFromLocationCode(fromLocationCode);
  353 + }
  354 + if (StringUtils.isEmpty(toLocationCode)) {
  355 + wcsTask.setToLocationCode(QuantityConstant.EMPTY_STRING);
  356 + } else {
  357 + wcsTask.setToLocationCode(toLocationCode);
  358 + }
  359 + wcsTask.setPriority(10);
  360 + wcsTask.setPlatform(QuantityConstant.PLATFORM_WMS);
  361 +
  362 +
  363 + return null;
  364 + }
220 365 }
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/address/service/IAddressService.java
... ... @@ -11,4 +11,5 @@ import org.jeecg.modules.wms.config.address.entity.Address;
11 11 */
12 12 public interface IAddressService extends IService<Address> {
13 13  
  14 + Address getAddressByUrl(String url, String warehouseCode);
14 15 }
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/address/service/impl/AddressServiceImpl.java
1 1 package org.jeecg.modules.wms.config.address.service.impl;
2 2  
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
3 5 import org.jeecg.modules.wms.config.address.entity.Address;
4 6 import org.jeecg.modules.wms.config.address.mapper.AddressMapper;
5 7 import org.jeecg.modules.wms.config.address.service.IAddressService;
... ... @@ -16,4 +18,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
16 18 @Service
17 19 public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressService {
18 20  
  21 + @Override
  22 + public Address getAddressByUrl(String url, String warehouseCode) {
  23 + LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery();
  24 + addressLambdaQueryWrapper.eq(Address::getUrl, url)
  25 + .eq(Address::getWarehouseCode, warehouseCode);
  26 + Address address = getOne(addressLambdaQueryWrapper);
  27 + return address;
  28 + }
19 29 }
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java
... ... @@ -13,11 +13,14 @@ import java.util.List;
13 13 */
14 14 public interface ILocationService extends IService<Location> {
15 15  
16   - Location getLocationByCode(String locationCode, String wareohuseCode);
  16 + Location getLocationByCode(String locationCode, String warehouseCode);
17 17  
18   - List<Location> getLocationListByZoneCode(String zoneCode, String wareohuseCode);
  18 + List<Location> getLocationListByZoneCode(String zoneCode, String warehouseCode);
19 19  
20   - boolean updateStatus(String locationCode, String status, String wareohuseCode);
  20 + boolean updateStatus(String locationCode, String status, String warehouseCode);
  21 +
  22 + boolean updateContainerCodeAndStatus(String locationCode
  23 + , String containerCode, String status, String warehouseCode);
21 24  
22 25 Location getNear(Location location);
23 26  
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java
... ... @@ -30,32 +30,44 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
30 30 private ITaskHeaderService taskHeaderService;
31 31  
32 32 @Override
33   - public Location getLocationByCode(String locationCode, String wareohuseCode) {
  33 + public Location getLocationByCode(String locationCode, String warehouseCode) {
34 34 LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
35 35 locationLambdaQueryWrapper.eq(Location::getCode, locationCode)
36 36 .eq(Location::getEnable, QuantityConstant.STATUS_ENABLE)
37   - .eq(Location::getWarehouseCode, wareohuseCode);
  37 + .eq(Location::getWarehouseCode, warehouseCode);
38 38 Location location = this.getOne(locationLambdaQueryWrapper);
39 39 return location;
40 40 }
41 41  
42 42 @Override
43   - public List<Location> getLocationListByZoneCode(String zoneCode, String wareohuseCode) {
  43 + public List<Location> getLocationListByZoneCode(String zoneCode, String warehouseCode) {
44 44 LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
45 45 locationLambdaQueryWrapper.eq(Location::getZoneCode, zoneCode)
46 46 .eq(Location::getEnable, QuantityConstant.STATUS_ENABLE)
47   - .eq(Location::getWarehouseCode, wareohuseCode);
  47 + .eq(Location::getWarehouseCode, warehouseCode);
48 48 List<Location> locationList = this.list(locationLambdaQueryWrapper);
49 49 return locationList;
50 50 }
51 51  
52 52 @Override
53   - public boolean updateStatus(String locationCode, String status, String wareohuseCode) {
54   - Location location = getLocationByCode(locationCode, wareohuseCode);
  53 + public boolean updateStatus(String locationCode, String status, String warehouseCode) {
  54 + Location location = getLocationByCode(locationCode, warehouseCode);
55 55 if(location == null) {
56 56 return false;
57 57 }
58   - location.setStatus(QuantityConstant.STATUS_LOCATION_LOCK);
  58 + location.setStatus(status);
  59 + boolean result = updateById(location);
  60 + return result;
  61 + }
  62 +
  63 + @Override
  64 + public boolean updateContainerCodeAndStatus(String locationCode, String containerCode, String status, String warehouseCode) {
  65 + Location location = getLocationByCode(locationCode, warehouseCode);
  66 + if(location == null) {
  67 + return false;
  68 + }
  69 + location.setContainerCode(containerCode);
  70 + location.setStatus(status);
59 71 boolean result = updateById(location);
60 72 return result;
61 73 }
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/Convert.java 0 → 100644
  1 +package org.jeecg.modules.wms.framework;
  2 +
  3 +
  4 +import org.jeecg.utils.StringUtils;
  5 +import org.jeecg.utils.support.CharsetKit;
  6 +
  7 +import java.math.BigDecimal;
  8 +import java.math.BigInteger;
  9 +import java.nio.ByteBuffer;
  10 +import java.nio.charset.Charset;
  11 +import java.text.NumberFormat;
  12 +import java.util.Set;
  13 +
  14 +/**
  15 + * 类型转换器
  16 + *
  17 + * @author huaheng
  18 + *
  19 + */
  20 +public class Convert
  21 +{
  22 + /**
  23 + * 转换为字符串<br>
  24 + * 如果给定的值为null,或者转换失败,返回默认值<br>
  25 + * 转换失败不会报错
  26 + *
  27 + * @param value 被转换的值
  28 + * @param defaultValue 转换错误时的默认值
  29 + * @return 结果
  30 + */
  31 + public static String toStr(Object value, String defaultValue)
  32 + {
  33 + if (null == value)
  34 + {
  35 + return defaultValue;
  36 + }
  37 + if (value instanceof String)
  38 + {
  39 + return (String) value;
  40 + }
  41 + return value.toString();
  42 + }
  43 +
  44 + /**
  45 + * 转换为字符串<br>
  46 + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
  47 + * 转换失败不会报错
  48 + *
  49 + * @param value 被转换的值
  50 + * @return 结果
  51 + */
  52 + public static String toStr(Object value)
  53 + {
  54 + return toStr(value, null);
  55 + }
  56 +
  57 + /**
  58 + * 转换为字符<br>
  59 + * 如果给定的值为null,或者转换失败,返回默认值<br>
  60 + * 转换失败不会报错
  61 + *
  62 + * @param value 被转换的值
  63 + * @param defaultValue 转换错误时的默认值
  64 + * @return 结果
  65 + */
  66 + public static Character toChar(Object value, Character defaultValue)
  67 + {
  68 + if (null == value)
  69 + {
  70 + return defaultValue;
  71 + }
  72 + if (value instanceof Character)
  73 + {
  74 + return (Character) value;
  75 + }
  76 +
  77 + final String valueStr = toStr(value, null);
  78 + return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0);
  79 + }
  80 +
  81 + /**
  82 + * 转换为字符<br>
  83 + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
  84 + * 转换失败不会报错
  85 + *
  86 + * @param value 被转换的值
  87 + * @return 结果
  88 + */
  89 + public static Character toChar(Object value)
  90 + {
  91 + return toChar(value, null);
  92 + }
  93 +
  94 + /**
  95 + * 转换为byte<br>
  96 + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
  97 + * 转换失败不会报错
  98 + *
  99 + * @param value 被转换的值
  100 + * @param defaultValue 转换错误时的默认值
  101 + * @return 结果
  102 + */
  103 + public static Byte toByte(Object value, Byte defaultValue)
  104 + {
  105 + if (value == null)
  106 + {
  107 + return defaultValue;
  108 + }
  109 + if (value instanceof Byte)
  110 + {
  111 + return (Byte) value;
  112 + }
  113 + if (value instanceof Number)
  114 + {
  115 + return ((Number) value).byteValue();
  116 + }
  117 + final String valueStr = toStr(value, null);
  118 + if (StringUtils.isEmpty(valueStr))
  119 + {
  120 + return defaultValue;
  121 + }
  122 + try
  123 + {
  124 + return Byte.parseByte(valueStr);
  125 + }
  126 + catch (Exception e)
  127 + {
  128 + return defaultValue;
  129 + }
  130 + }
  131 +
  132 + /**
  133 + * 转换为byte<br>
  134 + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
  135 + * 转换失败不会报错
  136 + *
  137 + * @param value 被转换的值
  138 + * @return 结果
  139 + */
  140 + public static Byte toByte(Object value)
  141 + {
  142 + return toByte(value, null);
  143 + }
  144 +
  145 + /**
  146 + * 转换为Short<br>
  147 + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
  148 + * 转换失败不会报错
  149 + *
  150 + * @param value 被转换的值
  151 + * @param defaultValue 转换错误时的默认值
  152 + * @return 结果
  153 + */
  154 + public static Short toShort(Object value, Short defaultValue)
  155 + {
  156 + if (value == null)
  157 + {
  158 + return defaultValue;
  159 + }
  160 + if (value instanceof Short)
  161 + {
  162 + return (Short) value;
  163 + }
  164 + if (value instanceof Number)
  165 + {
  166 + return ((Number) value).shortValue();
  167 + }
  168 + final String valueStr = toStr(value, null);
  169 + if (StringUtils.isEmpty(valueStr))
  170 + {
  171 + return defaultValue;
  172 + }
  173 + try
  174 + {
  175 + return Short.parseShort(valueStr.trim());
  176 + }
  177 + catch (Exception e)
  178 + {
  179 + return defaultValue;
  180 + }
  181 + }
  182 +
  183 + /**
  184 + * 转换为Short<br>
  185 + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
  186 + * 转换失败不会报错
  187 + *
  188 + * @param value 被转换的值
  189 + * @return 结果
  190 + */
  191 + public static Short toShort(Object value)
  192 + {
  193 + return toShort(value, null);
  194 + }
  195 +
  196 + /**
  197 + * 转换为Number<br>
  198 + * 如果给定的值为空,或者转换失败,返回默认值<br>
  199 + * 转换失败不会报错
  200 + *
  201 + * @param value 被转换的值
  202 + * @param defaultValue 转换错误时的默认值
  203 + * @return 结果
  204 + */
  205 + public static Number toNumber(Object value, Number defaultValue)
  206 + {
  207 + if (value == null)
  208 + {
  209 + return defaultValue;
  210 + }
  211 + if (value instanceof Number)
  212 + {
  213 + return (Number) value;
  214 + }
  215 + final String valueStr = toStr(value, null);
  216 + if (StringUtils.isEmpty(valueStr))
  217 + {
  218 + return defaultValue;
  219 + }
  220 + try
  221 + {
  222 + return NumberFormat.getInstance().parse(valueStr);
  223 + }
  224 + catch (Exception e)
  225 + {
  226 + return defaultValue;
  227 + }
  228 + }
  229 +
  230 + /**
  231 + * 转换为Number<br>
  232 + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
  233 + * 转换失败不会报错
  234 + *
  235 + * @param value 被转换的值
  236 + * @return 结果
  237 + */
  238 + public static Number toNumber(Object value)
  239 + {
  240 + return toNumber(value, null);
  241 + }
  242 +
  243 + /**
  244 + * 转换为int<br>
  245 + * 如果给定的值为空,或者转换失败,返回默认值<br>
  246 + * 转换失败不会报错
  247 + *
  248 + * @param value 被转换的值
  249 + * @param defaultValue 转换错误时的默认值
  250 + * @return 结果
  251 + */
  252 + public static Integer toInt(Object value, Integer defaultValue)
  253 + {
  254 + if (value == null)
  255 + {
  256 + return defaultValue;
  257 + }
  258 + if (value instanceof Integer)
  259 + {
  260 + return (Integer) value;
  261 + }
  262 + if (value instanceof Number)
  263 + {
  264 + return ((Number) value).intValue();
  265 + }
  266 + final String valueStr = toStr(value, null);
  267 + if (StringUtils.isEmpty(valueStr))
  268 + {
  269 + return defaultValue;
  270 + }
  271 + try
  272 + {
  273 + return Integer.parseInt(valueStr.trim());
  274 + }
  275 + catch (Exception e)
  276 + {
  277 + return defaultValue;
  278 + }
  279 + }
  280 +
  281 + /**
  282 + * 转换为int<br>
  283 + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
  284 + * 转换失败不会报错
  285 + *
  286 + * @param value 被转换的值
  287 + * @return 结果
  288 + */
  289 + public static Integer toInt(Object value)
  290 + {
  291 + return toInt(value, null);
  292 + }
  293 +
  294 + /**
  295 + * 转换为Integer数组<br>
  296 + *
  297 + * @param str 被转换的值
  298 + * @return 结果
  299 + */
  300 + public static Integer[] toIntArray(String str)
  301 + {
  302 + return toIntArray(",", str);
  303 + }
  304 +
  305 + /**
  306 + * 转换为Long数组<br>
  307 + *
  308 + * @param str 被转换的值
  309 + * @return 结果
  310 + */
  311 + public static Long[] toLongArray(String str)
  312 + {
  313 + return toLongArray(",", str);
  314 + }
  315 +
  316 + /**
  317 + * 转换为Integer数组<br>
  318 + *
  319 + * @param split 分隔符
  320 + * @param split 被转换的值
  321 + * @return 结果
  322 + */
  323 + public static Integer[] toIntArray(String split, String str)
  324 + {
  325 + if (StringUtils.isEmpty(str))
  326 + {
  327 + return new Integer[] {};
  328 + }
  329 + String[] arr = str.split(split);
  330 + final Integer[] ints = new Integer[arr.length];
  331 + for (int i = 0; i < arr.length; i++)
  332 + {
  333 + final Integer v = toInt(arr[i], 0);
  334 + ints[i] = v;
  335 + }
  336 + return ints;
  337 + }
  338 +
  339 + /**
  340 + * 转换为Long数组<br>
  341 + *
  342 + * @param split 分隔符
  343 + * @param str 被转换的值
  344 + * @return 结果
  345 + */
  346 + public static Long[] toLongArray(String split, String str)
  347 + {
  348 + if (StringUtils.isEmpty(str))
  349 + {
  350 + return new Long[] {};
  351 + }
  352 + String[] arr = str.split(split);
  353 + final Long[] longs = new Long[arr.length];
  354 + for (int i = 0; i < arr.length; i++)
  355 + {
  356 + final Long v = toLong(arr[i], null);
  357 + longs[i] = v;
  358 + }
  359 + return longs;
  360 + }
  361 +
  362 + /**
  363 + * 转换为String数组<br>
  364 + *
  365 + * @param str 被转换的值
  366 + * @return 结果
  367 + */
  368 + public static String[] toStrArray(String str)
  369 + {
  370 + return toStrArray(",", str);
  371 + }
  372 +
  373 + /**
  374 + * 转换为String数组<br>
  375 + *
  376 + * @param split 分隔符
  377 + * @param split 被转换的值
  378 + * @return 结果
  379 + */
  380 + public static String[] toStrArray(String split, String str)
  381 + {
  382 + return str.split(split);
  383 + }
  384 +
  385 + /**
  386 + * 转换为long<br>
  387 + * 如果给定的值为空,或者转换失败,返回默认值<br>
  388 + * 转换失败不会报错
  389 + *
  390 + * @param value 被转换的值
  391 + * @param defaultValue 转换错误时的默认值
  392 + * @return 结果
  393 + */
  394 + public static long toLong(Object value, Integer defaultValue)
  395 + {
  396 + if (value == null)
  397 + {
  398 + return defaultValue;
  399 + }
  400 + if (value instanceof Integer)
  401 + {
  402 + return (Integer) value;
  403 + }
  404 + if (value instanceof Number)
  405 + {
  406 + return ((Number) value).longValue();
  407 + }
  408 + final String valueStr = toStr(value, null);
  409 + if (StringUtils.isEmpty(valueStr))
  410 + {
  411 + return defaultValue;
  412 + }
  413 + try
  414 + {
  415 + // 支持科学计数法
  416 + return new BigDecimal(valueStr.trim()).longValue();
  417 + }
  418 + catch (Exception e)
  419 + {
  420 + return defaultValue;
  421 + }
  422 + }
  423 +
  424 + /**
  425 + * 转换为long<br>
  426 + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
  427 + * 转换失败不会报错
  428 + *
  429 + * @param value 被转换的值
  430 + * @return 结果
  431 + */
  432 + public static Long toLong(Object value)
  433 + {
  434 + return toLong(value, null);
  435 + }
  436 +
  437 + /**
  438 + * 转换为double<br>
  439 + * 如果给定的值为空,或者转换失败,返回默认值<br>
  440 + * 转换失败不会报错
  441 + *
  442 + * @param value 被转换的值
  443 + * @param defaultValue 转换错误时的默认值
  444 + * @return 结果
  445 + */
  446 + public static Double toDouble(Object value, Double defaultValue)
  447 + {
  448 + if (value == null)
  449 + {
  450 + return defaultValue;
  451 + }
  452 + if (value instanceof Double)
  453 + {
  454 + return (Double) value;
  455 + }
  456 + if (value instanceof Number)
  457 + {
  458 + return ((Number) value).doubleValue();
  459 + }
  460 + final String valueStr = toStr(value, null);
  461 + if (StringUtils.isEmpty(valueStr))
  462 + {
  463 + return defaultValue;
  464 + }
  465 + try
  466 + {
  467 + // 支持科学计数法
  468 + return new BigDecimal(valueStr.trim()).doubleValue();
  469 + }
  470 + catch (Exception e)
  471 + {
  472 + return defaultValue;
  473 + }
  474 + }
  475 +
  476 + /**
  477 + * 转换为double<br>
  478 + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
  479 + * 转换失败不会报错
  480 + *
  481 + * @param value 被转换的值
  482 + * @return 结果
  483 + */
  484 + public static Double toDouble(Object value)
  485 + {
  486 + return toDouble(value, null);
  487 + }
  488 +
  489 + /**
  490 + * 转换为Float<br>
  491 + * 如果给定的值为空,或者转换失败,返回默认值<br>
  492 + * 转换失败不会报错
  493 + *
  494 + * @param value 被转换的值
  495 + * @param defaultValue 转换错误时的默认值
  496 + * @return 结果
  497 + */
  498 + public static Float toFloat(Object value, Float defaultValue)
  499 + {
  500 + if (value == null)
  501 + {
  502 + return defaultValue;
  503 + }
  504 + if (value instanceof Float)
  505 + {
  506 + return (Float) value;
  507 + }
  508 + if (value instanceof Number)
  509 + {
  510 + return ((Number) value).floatValue();
  511 + }
  512 + final String valueStr = toStr(value, null);
  513 + if (StringUtils.isEmpty(valueStr))
  514 + {
  515 + return defaultValue;
  516 + }
  517 + try
  518 + {
  519 + return Float.parseFloat(valueStr.trim());
  520 + }
  521 + catch (Exception e)
  522 + {
  523 + return defaultValue;
  524 + }
  525 + }
  526 +
  527 + /**
  528 + * 转换为Float<br>
  529 + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
  530 + * 转换失败不会报错
  531 + *
  532 + * @param value 被转换的值
  533 + * @return 结果
  534 + */
  535 + public static Float toFloat(Object value)
  536 + {
  537 + return toFloat(value, null);
  538 + }
  539 +
  540 + /**
  541 + * 转换为boolean<br>
  542 + * String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值<br>
  543 + * 转换失败不会报错
  544 + *
  545 + * @param value 被转换的值
  546 + * @param defaultValue 转换错误时的默认值
  547 + * @return 结果
  548 + */
  549 + public static Boolean toBool(Object value, Boolean defaultValue)
  550 + {
  551 + if (value == null)
  552 + {
  553 + return defaultValue;
  554 + }
  555 + if (value instanceof Boolean)
  556 + {
  557 + return (Boolean) value;
  558 + }
  559 + String valueStr = toStr(value, null);
  560 + if (StringUtils.isEmpty(valueStr))
  561 + {
  562 + return defaultValue;
  563 + }
  564 + valueStr = valueStr.trim().toLowerCase();
  565 + switch (valueStr)
  566 + {
  567 + case "true":
  568 + return true;
  569 + case "false":
  570 + return false;
  571 + case "yes":
  572 + return true;
  573 + case "ok":
  574 + return true;
  575 + case "no":
  576 + return false;
  577 + case "1":
  578 + return true;
  579 + case "0":
  580 + return false;
  581 + default:
  582 + return defaultValue;
  583 + }
  584 + }
  585 +
  586 + /**
  587 + * 转换为boolean<br>
  588 + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
  589 + * 转换失败不会报错
  590 + *
  591 + * @param value 被转换的值
  592 + * @return 结果
  593 + */
  594 + public static Boolean toBool(Object value)
  595 + {
  596 + return toBool(value, null);
  597 + }
  598 +
  599 + /**
  600 + * 转换为Enum对象<br>
  601 + * 如果给定的值为空,或者转换失败,返回默认值<br>
  602 + *
  603 + * @param clazz Enum的Class
  604 + * @param value 值
  605 + * @param defaultValue 默认值
  606 + * @return Enum
  607 + */
  608 + public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value, E defaultValue)
  609 + {
  610 + if (value == null)
  611 + {
  612 + return defaultValue;
  613 + }
  614 + if (clazz.isAssignableFrom(value.getClass()))
  615 + {
  616 + @SuppressWarnings("unchecked")
  617 + E myE = (E) value;
  618 + return myE;
  619 + }
  620 + final String valueStr = toStr(value, null);
  621 + if (StringUtils.isEmpty(valueStr))
  622 + {
  623 + return defaultValue;
  624 + }
  625 + try
  626 + {
  627 + return Enum.valueOf(clazz, valueStr);
  628 + }
  629 + catch (Exception e)
  630 + {
  631 + return defaultValue;
  632 + }
  633 + }
  634 +
  635 + /**
  636 + * 转换为Enum对象<br>
  637 + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
  638 + *
  639 + * @param clazz Enum的Class
  640 + * @param value 值
  641 + * @return Enum
  642 + */
  643 + public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value)
  644 + {
  645 + return toEnum(clazz, value, null);
  646 + }
  647 +
  648 + /**
  649 + * 转换为BigInteger<br>
  650 + * 如果给定的值为空,或者转换失败,返回默认值<br>
  651 + * 转换失败不会报错
  652 + *
  653 + * @param value 被转换的值
  654 + * @param defaultValue 转换错误时的默认值
  655 + * @return 结果
  656 + */
  657 + public static BigInteger toBigInteger(Object value, BigInteger defaultValue)
  658 + {
  659 + if (value == null)
  660 + {
  661 + return defaultValue;
  662 + }
  663 + if (value instanceof BigInteger)
  664 + {
  665 + return (BigInteger) value;
  666 + }
  667 + if (value instanceof Integer)
  668 + {
  669 + return BigInteger.valueOf((Integer) value);
  670 + }
  671 + final String valueStr = toStr(value, null);
  672 + if (StringUtils.isEmpty(valueStr))
  673 + {
  674 + return defaultValue;
  675 + }
  676 + try
  677 + {
  678 + return new BigInteger(valueStr);
  679 + }
  680 + catch (Exception e)
  681 + {
  682 + return defaultValue;
  683 + }
  684 + }
  685 +
  686 + /**
  687 + * 转换为BigInteger<br>
  688 + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br>
  689 + * 转换失败不会报错
  690 + *
  691 + * @param value 被转换的值
  692 + * @return 结果
  693 + */
  694 + public static BigInteger toBigInteger(Object value)
  695 + {
  696 + return toBigInteger(value, null);
  697 + }
  698 +
  699 + /**
  700 + * 转换为BigDecimal<br>
  701 + * 如果给定的值为空,或者转换失败,返回默认值<br>
  702 + * 转换失败不会报错
  703 + *
  704 + * @param value 被转换的值
  705 + * @param defaultValue 转换错误时的默认值
  706 + * @return 结果
  707 + */
  708 + public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue)
  709 + {
  710 + if (value == null)
  711 + {
  712 + return defaultValue;
  713 + }
  714 + if (value instanceof BigDecimal)
  715 + {
  716 + return (BigDecimal) value;
  717 + }
  718 + if (value instanceof Integer)
  719 + {
  720 + return new BigDecimal((Integer) value);
  721 + }
  722 + if (value instanceof Double)
  723 + {
  724 + return new BigDecimal((Double) value);
  725 + }
  726 + if (value instanceof Integer)
  727 + {
  728 + return new BigDecimal((Integer) value);
  729 + }
  730 + final String valueStr = toStr(value, null);
  731 + if (StringUtils.isEmpty(valueStr))
  732 + {
  733 + return defaultValue;
  734 + }
  735 + try
  736 + {
  737 + return new BigDecimal(valueStr);
  738 + }
  739 + catch (Exception e)
  740 + {
  741 + return defaultValue;
  742 + }
  743 + }
  744 +
  745 + /**
  746 + * 转换为BigDecimal<br>
  747 + * 如果给定的值为空,或者转换失败,返回默认值<br>
  748 + * 转换失败不会报错
  749 + *
  750 + * @param value 被转换的值
  751 + * @return 结果
  752 + */
  753 + public static BigDecimal toBigDecimal(Object value)
  754 + {
  755 + return toBigDecimal(value, null);
  756 + }
  757 +
  758 + /**
  759 + * 将对象转为字符串<br>
  760 + * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
  761 + *
  762 + * @param obj 对象
  763 + * @return 字符串
  764 + */
  765 + public static String utf8Str(Object obj)
  766 + {
  767 + return str(obj, CharsetKit.CHARSET_UTF_8);
  768 + }
  769 +
  770 + /**
  771 + * 将对象转为字符串<br>
  772 + * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
  773 + *
  774 + * @param obj 对象
  775 + * @param charsetName 字符集
  776 + * @return 字符串
  777 + */
  778 + public static String str(Object obj, String charsetName)
  779 + {
  780 + return str(obj, Charset.forName(charsetName));
  781 + }
  782 +
  783 + /**
  784 + * 将对象转为字符串<br>
  785 + * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
  786 + *
  787 + * @param obj 对象
  788 + * @param charset 字符集
  789 + * @return 字符串
  790 + */
  791 + public static String str(Object obj, Charset charset)
  792 + {
  793 + if (null == obj)
  794 + {
  795 + return null;
  796 + }
  797 +
  798 + if (obj instanceof String)
  799 + {
  800 + return (String) obj;
  801 + }
  802 + else if (obj instanceof byte[] || obj instanceof Byte[])
  803 + {
  804 + return str((Byte[]) obj, charset);
  805 + }
  806 + else if (obj instanceof ByteBuffer)
  807 + {
  808 + return str((ByteBuffer) obj, charset);
  809 + }
  810 + return obj.toString();
  811 + }
  812 +
  813 + /**
  814 + * 将byte数组转为字符串
  815 + *
  816 + * @param bytes byte数组
  817 + * @param charset 字符集
  818 + * @return 字符串
  819 + */
  820 + public static String str(byte[] bytes, String charset)
  821 + {
  822 + return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset));
  823 + }
  824 +
  825 + /**
  826 + * 解码字节码
  827 + *
  828 + * @param data 字符串
  829 + * @param charset 字符集,如果此字段为空,则解码的结果取决于平台
  830 + * @return 解码后的字符串
  831 + */
  832 + public static String str(byte[] data, Charset charset)
  833 + {
  834 + if (data == null)
  835 + {
  836 + return null;
  837 + }
  838 +
  839 + if (null == charset)
  840 + {
  841 + return new String(data);
  842 + }
  843 + return new String(data, charset);
  844 + }
  845 +
  846 + /**
  847 + * 将编码的byteBuffer数据转换为字符串
  848 + *
  849 + * @param data 数据
  850 + * @param charset 字符集,如果为空使用当前系统字符集
  851 + * @return 字符串
  852 + */
  853 + public static String str(ByteBuffer data, String charset)
  854 + {
  855 + if (data == null)
  856 + {
  857 + return null;
  858 + }
  859 +
  860 + return str(data, Charset.forName(charset));
  861 + }
  862 +
  863 + /**
  864 + * 将编码的byteBuffer数据转换为字符串
  865 + *
  866 + * @param data 数据
  867 + * @param charset 字符集,如果为空使用当前系统字符集
  868 + * @return 字符串
  869 + */
  870 + public static String str(ByteBuffer data, Charset charset)
  871 + {
  872 + if (null == charset)
  873 + {
  874 + charset = Charset.defaultCharset();
  875 + }
  876 + return charset.decode(data).toString();
  877 + }
  878 +
  879 + // ----------------------------------------------------------------------- 全角半角转换
  880 + /**
  881 + * 半角转全角
  882 + *
  883 + * @param input String.
  884 + * @return 全角字符串.
  885 + */
  886 + public static String toSBC(String input)
  887 + {
  888 + return toSBC(input, null);
  889 + }
  890 +
  891 + /**
  892 + * 半角转全角
  893 + *
  894 + * @param input String
  895 + * @param notConvertSet 不替换的字符集合
  896 + * @return 全角字符串.
  897 + */
  898 + public static String toSBC(String input, Set<Character> notConvertSet)
  899 + {
  900 + char c[] = input.toCharArray();
  901 + for (int i = 0; i < c.length; i++)
  902 + {
  903 + if (null != notConvertSet && notConvertSet.contains(c[i]))
  904 + {
  905 + // 跳过不替换的字符
  906 + continue;
  907 + }
  908 +
  909 + if (c[i] == ' ')
  910 + {
  911 + c[i] = '\u3000';
  912 + }
  913 + else if (c[i] < '\177')
  914 + {
  915 + c[i] = (char) (c[i] + 65248);
  916 +
  917 + }
  918 + }
  919 + return new String(c);
  920 + }
  921 +
  922 + /**
  923 + * 全角转半角
  924 + *
  925 + * @param input String.
  926 + * @return 半角字符串
  927 + */
  928 + public static String toDBC(String input)
  929 + {
  930 + return toDBC(input, null);
  931 + }
  932 +
  933 + /**
  934 + * 替换全角为半角
  935 + *
  936 + * @param text 文本
  937 + * @param notConvertSet 不替换的字符集合
  938 + * @return 替换后的字符
  939 + */
  940 + public static String toDBC(String text, Set<Character> notConvertSet)
  941 + {
  942 + char c[] = text.toCharArray();
  943 + for (int i = 0; i < c.length; i++)
  944 + {
  945 + if (null != notConvertSet && notConvertSet.contains(c[i]))
  946 + {
  947 + // 跳过不替换的字符
  948 + continue;
  949 + }
  950 +
  951 + if (c[i] == '\u3000')
  952 + {
  953 + c[i] = ' ';
  954 + }
  955 + else if (c[i] > '\uFF00' && c[i] < '\uFF5F')
  956 + {
  957 + c[i] = (char) (c[i] - 65248);
  958 + }
  959 + }
  960 + String returnString = new String(c);
  961 +
  962 + return returnString;
  963 + }
  964 +
  965 + /**
  966 + * 数字金额大写转换 先写个完整的然后将如零拾替换成零
  967 + *
  968 + * @param n 数字
  969 + * @return 中文大写数字
  970 + */
  971 + public static String digitUppercase(double n)
  972 + {
  973 + String[] fraction = { "角", "分" };
  974 + String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
  975 + String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } };
  976 +
  977 + String head = n < 0 ? "负" : "";
  978 + n = Math.abs(n);
  979 +
  980 + String s = "";
  981 + for (int i = 0; i < fraction.length; i++)
  982 + {
  983 + s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", "");
  984 + }
  985 + if (s.length() < 1)
  986 + {
  987 + s = "整";
  988 + }
  989 + int integerPart = (int) Math.floor(n);
  990 +
  991 + for (int i = 0; i < unit[0].length && integerPart > 0; i++)
  992 + {
  993 + String p = "";
  994 + for (int j = 0; j < unit[1].length && n > 0; j++)
  995 + {
  996 + p = digit[integerPart % 10] + unit[1][j] + p;
  997 + integerPart = integerPart / 10;
  998 + }
  999 + s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s;
  1000 + }
  1001 + return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$",
  1002 + "零元整");
  1003 + }
  1004 +
  1005 +}
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/ServletUtils.java 0 → 100644
  1 +package org.jeecg.modules.wms.framework;
  2 +
  3 +import org.jeecg.utils.StringUtils;
  4 +import org.springframework.web.context.request.RequestAttributes;
  5 +import org.springframework.web.context.request.RequestContextHolder;
  6 +import org.springframework.web.context.request.ServletRequestAttributes;
  7 +
  8 +import javax.servlet.http.HttpServletRequest;
  9 +import javax.servlet.http.HttpServletResponse;
  10 +import javax.servlet.http.HttpSession;
  11 +import java.io.IOException;
  12 +
  13 +/**
  14 + * 客户端工具类
  15 + *
  16 + * @author huaheng
  17 + */
  18 +public class ServletUtils
  19 +{
  20 + /**
  21 + * 获取String参数
  22 + */
  23 + public static String getParameter(String name)
  24 + {
  25 + return getRequest().getParameter(name);
  26 + }
  27 +
  28 + /**
  29 + * 获取String参数
  30 + */
  31 + public static String getParameter(String name, String defaultValue)
  32 + {
  33 + return Convert.toStr(getRequest().getParameter(name), defaultValue);
  34 + }
  35 +
  36 + /**
  37 + * 获取Integer参数
  38 + */
  39 + public static Integer getParameterToInt(String name)
  40 + {
  41 + return Convert.toInt(getRequest().getParameter(name));
  42 + }
  43 +
  44 + /**
  45 + * 获取Integer参数
  46 + */
  47 + public static Integer getParameterToInt(String name, Integer defaultValue)
  48 + {
  49 + return Convert.toInt(getRequest().getParameter(name), defaultValue);
  50 + }
  51 +
  52 + /**
  53 + * 获取request
  54 + */
  55 + public static HttpServletRequest getRequest()
  56 + {
  57 + return getRequestAttributes().getRequest();
  58 + }
  59 +
  60 + /**
  61 + * 获取response
  62 + */
  63 + public static HttpServletResponse getResponse()
  64 + {
  65 + return getRequestAttributes().getResponse();
  66 + }
  67 +
  68 + /**
  69 + * 获取session
  70 + */
  71 + public static HttpSession getSession()
  72 + {
  73 + return getRequest().getSession();
  74 + }
  75 +
  76 + public static ServletRequestAttributes getRequestAttributes()
  77 + {
  78 + RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
  79 + return (ServletRequestAttributes) attributes;
  80 + }
  81 +
  82 + /**
  83 + * 将字符串渲染到客户端
  84 + *
  85 + * @param response 渲染对象
  86 + * @param string 待渲染的字符串
  87 + * @return null
  88 + */
  89 + public static String renderString(HttpServletResponse response, String string)
  90 + {
  91 + try
  92 + {
  93 + response.setContentType("application/json");
  94 + response.setCharacterEncoding("utf-8");
  95 + response.getWriter().print(string);
  96 + }
  97 + catch (IOException e)
  98 + {
  99 + e.printStackTrace();
  100 + }
  101 + return null;
  102 + }
  103 +
  104 + /**
  105 + * 是否是Ajax异步请求
  106 + *
  107 + * @param request
  108 + */
  109 + public static boolean isAjaxRequest(HttpServletRequest request)
  110 + {
  111 +
  112 + String accept = request.getHeader("accept");
  113 + if (accept != null && accept.indexOf("application/json") != -1)
  114 + {
  115 + return true;
  116 + }
  117 +
  118 + String contentType = request.getHeader("Content-Type");
  119 + if (contentType != null && contentType.indexOf("application/json") != -1)
  120 + {
  121 + return true;
  122 + }
  123 +
  124 + String xRequestedWith = request.getHeader("X-Requested-With");
  125 + if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1)
  126 + {
  127 + return true;
  128 + }
  129 +
  130 + String uri = request.getRequestURI();
  131 + if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml"))
  132 + {
  133 + return true;
  134 + }
  135 +
  136 + String ajax = request.getParameter("__ajax");
  137 + if (StringUtils.inStringIgnoreCase(ajax, "json", "xml"))
  138 + {
  139 + return true;
  140 + }
  141 +
  142 + return false;
  143 + }
  144 +}
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/ApiLogAspect.java 0 → 100644
  1 +package org.jeecg.modules.wms.framework.aspectj;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.JSONObject;
  5 +import okhttp3.Request;
  6 +import okhttp3.Response;
  7 +import org.apache.commons.lang.exception.ExceptionUtils;
  8 +import org.aspectj.lang.ProceedingJoinPoint;
  9 +import org.aspectj.lang.annotation.Around;
  10 +import org.aspectj.lang.annotation.Aspect;
  11 +import org.aspectj.lang.annotation.Pointcut;
  12 +import org.aspectj.lang.reflect.MethodSignature;
  13 +import org.jeecg.common.api.vo.Result;
  14 +import org.jeecg.modules.wms.config.address.entity.Address;
  15 +import org.jeecg.modules.wms.config.address.service.IAddressService;
  16 +import org.jeecg.modules.wms.framework.ServletUtils;
  17 +import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger;
  18 +import org.jeecg.modules.wms.framework.spring.SpringUtils;
  19 +import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog;
  20 +import org.jeecg.modules.wms.monitor.apiLog.service.IApiLogService;
  21 +import org.jeecg.utils.StringUtils;
  22 +import org.jeecg.utils.constant.QuantityConstant;
  23 +import org.slf4j.Logger;
  24 +import org.slf4j.LoggerFactory;
  25 +import org.springframework.beans.factory.annotation.Autowired;
  26 +import org.springframework.http.HttpHeaders;
  27 +import org.springframework.scheduling.annotation.Async;
  28 +import org.springframework.scheduling.annotation.EnableAsync;
  29 +import org.springframework.stereotype.Component;
  30 +import org.springframework.web.context.request.RequestContextHolder;
  31 +import org.springframework.web.context.request.ServletRequestAttributes;
  32 +
  33 +import javax.servlet.http.HttpServletRequest;
  34 +import javax.servlet.http.HttpServletResponse;
  35 +import java.net.HttpURLConnection;
  36 +import java.net.URL;
  37 +import java.util.*;
  38 +
  39 +/**
  40 + * Api调用日志记录处理
  41 + *
  42 + * @author huaheng
  43 + */
  44 +@Aspect
  45 +@Component
  46 +@EnableAsync
  47 +public class ApiLogAspect
  48 +{
  49 + private static final Logger log = LoggerFactory.getLogger(ApiLogAspect.class);
  50 +
  51 + private static IApiLogService apiLogService;
  52 +
  53 + private static IAddressService addressService;
  54 +
  55 +
  56 + @Autowired
  57 + public void setApiLogService(IApiLogService apiLogService){
  58 + ApiLogAspect.apiLogService = apiLogService;
  59 + }
  60 +
  61 + @Autowired
  62 + public void setAddressService(IAddressService addressService){
  63 + ApiLogAspect.addressService = addressService;
  64 + }
  65 +
  66 + // 配置织入点
  67 + @Pointcut("@annotation(org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger)")
  68 + public void logPointCut()
  69 + {
  70 + }
  71 +
  72 + @Around("logPointCut() && @annotation(apiLogger)")
  73 + public Object around(ProceedingJoinPoint point, ApiLogger apiLogger) throws Throwable
  74 + {
  75 + if("WMS".equalsIgnoreCase(apiLogger.from()))
  76 + //实际上静态方法上的Aop注解无法拦截到
  77 + {
  78 + return aroundWms2XXX(point, apiLogger);
  79 + } else {
  80 + return aroundXXX2Wms(point, apiLogger);
  81 + }
  82 + }
  83 +
  84 + /**处理xxx调用wms接口的日志**/
  85 + private Object aroundXXX2Wms(ProceedingJoinPoint point, ApiLogger apiLogger){
  86 + Object ret = null;
  87 + ApiLog log = initApiLog(apiLogger, point);
  88 + try{
  89 + ret = point.proceed();
  90 + }catch (Exception e){
  91 + setApiLogException(log, e);
  92 + ret = Result.error(e.getMessage());
  93 + }finally{
  94 + finishApiLog(log, ret);
  95 + return ret;
  96 + }
  97 + }
  98 +
  99 + /**处理WMS调用xxx接口的日志**/
  100 + private Object aroundWms2XXX(ProceedingJoinPoint point, ApiLogger apiLogger){
  101 + Object ret = null;
  102 + ApiLog log = new ApiLog();
  103 +
  104 + HttpURLConnection connection = null;
  105 + String body = null;
  106 +
  107 + try {
  108 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
  109 + connection = (HttpURLConnection) point.getArgs()[0];
  110 + body = (String) point.getArgs()[1];
  111 + initApiLog(connection, body);
  112 + }catch (Exception e){
  113 +
  114 + }
  115 +
  116 + try{
  117 + ret = point.proceed();
  118 + }catch (Exception e){
  119 + setApiLogException(log, e);
  120 + throw e;
  121 + }finally{
  122 + if(ret != null) {
  123 + finishApiLog(log, connection, ret.toString());
  124 + }
  125 + return ret;
  126 + }
  127 + }
  128 +
  129 + /**
  130 + * 记录响应头信息
  131 + **/
  132 + public static void finishApiLog(ApiLog log, HttpURLConnection connection, String body) {
  133 + try {
  134 + log.setResponseBody(body);
  135 + log.setResponseTime(new Date());
  136 + Long duration = log.getResponseTime().getTime() - log.getRequestTime().getTime();
  137 + log.setDuration(duration.intValue());
  138 + log.setHttpCode(connection.getResponseCode());
  139 +
  140 + //响应头
  141 + Set<String> keyset = connection.getHeaderFields().keySet();
  142 + ArrayList<String> headerList = new ArrayList<>();
  143 + Iterator<String> it = keyset.iterator();
  144 + while (it.hasNext()) {
  145 + String name = it.next();
  146 + String header = connection.getHeaderField(name);
  147 + if (name == null || "".equals(name)) {
  148 + //第一行没有name
  149 + //HTTP/1.1 200 OK
  150 + headerList.add(header);
  151 + }
  152 + else {
  153 + headerList.add(name + ": " + header);
  154 + }
  155 + }
  156 + log.setResponseHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n"));
  157 + Result json = JSON.parseObject(body, Result.class);
  158 + log.setRetCode(json.getCode());
  159 + } catch (Exception e) {
  160 + e.printStackTrace();
  161 + } finally {
  162 + SpringUtils.getBean(ApiLogAspect.class).saveApiLog(log);
  163 + }
  164 + }
  165 +
  166 + /**
  167 + * 根据url,从address表中判断调用的去向
  168 + **/
  169 + public static void parseUrl(ApiLog log, URL url, String warehouseCode) {
  170 + try {
  171 + String[] spList = url.toString().split("/");
  172 + String apiName = spList[spList.length - 1];
  173 + int index = url.toString().lastIndexOf(apiName);
  174 + String addUrl = url.toString().substring(0, index);
  175 +
  176 + Address address = addressService.getAddressByUrl(url.toString(), warehouseCode);
  177 + log.setApiName(apiName);
  178 + log.setRequestFrom("WMS");
  179 + log.setResponseBy(address.getCode().toUpperCase());
  180 + } catch (Exception e) {
  181 + e.printStackTrace();
  182 + }
  183 + }
  184 +
  185 +
  186 + /**
  187 + * 记录WMS调用外接口的请求信息
  188 + * 在HttpUtils.bodypost方法中直接调用本类static方法
  189 + **/
  190 + public static ApiLog initApiLog(String Method, String url, String body, HttpHeaders headers, String warehouseCode) {
  191 + ApiLog log = new ApiLog();
  192 + try {
  193 + URL url1 = new URL(url);
  194 + log.setApiMethod(Method);
  195 + log.setUrl(url);
  196 + log.setRequestTime(new Date());
  197 + parseUrl(log, url1, warehouseCode);
  198 +
  199 + //请求头
  200 + Set<String> keySet = headers.keySet();
  201 + ArrayList<String> headerList = new ArrayList<>();
  202 + Iterator<String> it = keySet.iterator();
  203 + while (it.hasNext()) {
  204 + String name = it.next();
  205 + String header = String.valueOf(headers.getContentType());
  206 + headerList.add(name + ": " + header);
  207 + }
  208 +
  209 + log.setRequestHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n"));
  210 + log.setRequestBody(body);
  211 + } catch (Exception e) {
  212 + e.printStackTrace();
  213 + }
  214 +
  215 + return log;
  216 + }
  217 +
  218 + /**记录WMS调用外接口的请求信息
  219 + * 在HttpUtils.bodypost方法中直接调用本类static方法**/
  220 + public static ApiLog initApiLog(HttpURLConnection connection, String body){
  221 + ApiLog log = new ApiLog();
  222 + try {
  223 + log.setApiMethod(connection.getRequestMethod());
  224 + log.setUrl(connection.getURL().toString());
  225 + log.setRequestTime(new Date());
  226 + parseUrl(log, connection.getURL());
  227 +
  228 + //请求头
  229 + Set<String> keySet = connection.getRequestProperties().keySet();
  230 + ArrayList<String> headerList = new ArrayList<>();
  231 + Iterator<String> it = keySet.iterator();
  232 + while (it.hasNext()) {
  233 + String name = it.next();
  234 + String header = connection.getRequestProperty(name);
  235 + headerList.add(name + ": " + header);
  236 + }
  237 +
  238 + log.setRequestHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n"));
  239 + log.setRequestBody(body);
  240 + }catch (Exception e){
  241 + e.printStackTrace();
  242 + }
  243 +
  244 + return log;
  245 + }
  246 +
  247 + /**记录WMS调用外接口的请求信息
  248 + * 在HttpUtils.bodypost方法中直接调用本类static方法**/
  249 + public static ApiLog initApiLog(Request request, String body){
  250 + ApiLog log = new ApiLog();
  251 + try {
  252 + log.setApiMethod(request.method());
  253 + log.setUrl(request.url().toString());
  254 + log.setRequestTime(new Date());
  255 + parseUrl(log, request.url().url());
  256 + log.setRequestHeader(request.headers().toString());
  257 + log.setRequestBody(body);
  258 + }catch (Exception e){
  259 + e.printStackTrace();
  260 + }
  261 + return log;
  262 + }
  263 +
  264 + /**记录响应头信息**/
  265 + public static void finishApiLog(ApiLog log, Response response, String body){
  266 + try {
  267 + log.setResponseBody(body);
  268 + log.setResponseTime(new Date());
  269 + Long duration = log.getResponseTime().getTime() - log.getRequestTime().getTime();
  270 + log.setDuration(duration.intValue());
  271 + log.setHttpCode(response.code());
  272 +
  273 + //响应头
  274 + log.setResponseHeader(response.headers().toString());
  275 + Result ajaxResult = null;
  276 + try{
  277 + ajaxResult = JSON.parseObject(body, Result.class);
  278 + }catch(Exception ex){
  279 + body = JSON.parse(body).toString();
  280 + ajaxResult = JSON.parseObject(body, Result.class);
  281 + }
  282 + log.setRetCode(ajaxResult.getCode());
  283 + }catch (Exception e){
  284 + e.printStackTrace();
  285 + }finally {
  286 + try {
  287 + if (StringUtils.isNotEmpty(log.getResponseBody()) && log.getResponseBody().length() > 2001) {
  288 + log.setResponseBody(log.getResponseBody().substring(0, 2000) + "\n太长了...后面省略。\n" + log.getResponseBody().length());
  289 + }
  290 + }catch (Exception e){
  291 +
  292 + }
  293 + SpringUtils.getBean(ApiLogAspect.class).saveApiLog(log);
  294 + }
  295 + }
  296 +
  297 +
  298 +
  299 + /**根据url,从address表中判断调用的去向**/
  300 + public static void parseUrl(ApiLog log, URL url){
  301 + try {
  302 + String[] spList = url.toString().split("/");
  303 + String apiName = spList[spList.length - 1];
  304 + int index = url.toString().lastIndexOf(apiName);
  305 + String addUrl = url.toString().substring(0, index);
  306 +
  307 + Address address = addressService.getAddressByUrl(url.toString(), QuantityConstant.DEFAULT_WAREHOUSE);
  308 + log.setApiName(apiName);
  309 + log.setRequestFrom("WMS");
  310 + log.setResponseBy(address.getCode().toUpperCase());
  311 + }catch (Exception e){
  312 + e.printStackTrace();
  313 + }
  314 + }
  315 + /**
  316 + * 记录响应头信息
  317 + **/
  318 + public static void finishApiLog(ApiLog log, HttpHeaders headers, String body) {
  319 + try {
  320 + log.setResponseBody(body);
  321 + log.setResponseTime(new Date());
  322 + Long duration = log.getResponseTime().getTime() - log.getRequestTime().getTime();
  323 + log.setDuration(duration.intValue());
  324 + log.setHttpCode(200);
  325 +
  326 + //响应头
  327 + Set<String> keyset = headers.keySet();
  328 + ArrayList<String> headerList = new ArrayList<>();
  329 + Iterator<String> it = keyset.iterator();
  330 + while (it.hasNext()) {
  331 + String name = it.next();
  332 + String header = String.valueOf(headers.getContentType());
  333 + if (name == null || "".equals(name))
  334 + //第一行没有name
  335 + //HTTP/1.1 200 OK
  336 + headerList.add(header);
  337 + else
  338 + headerList.add(name + ": " + header);
  339 + }
  340 + log.setResponseHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n"));
  341 + Result json = JSON.parseObject(body, Result.class);
  342 + log.setRetCode(json.getCode());
  343 + } catch (Exception e) {
  344 + e.printStackTrace();
  345 + } finally {
  346 + SpringUtils.getBean(ApiLogAspect.class).saveApiLog(log);
  347 + }
  348 + }
  349 +
  350 +
  351 + private ApiLog initApiLog(ApiLogger apiLogger, ProceedingJoinPoint point){
  352 + ApiLog log = new ApiLog();
  353 + try{
  354 + log.setRequestTime(new Date());
  355 + log.setRequestFrom(apiLogger.from());
  356 + log.setResponseBy(apiLogger.to());
  357 + log.setApiName(apiLogger.apiName());
  358 +
  359 + HttpServletRequest request = ServletUtils.getRequest();
  360 +
  361 + String qryStr = request.getQueryString();
  362 + String url = request.getRequestURL().toString();
  363 + if(StringUtils.isNotEmpty(qryStr)) {
  364 + url = url + "?" + qryStr;
  365 + }
  366 + log.setUrl(url);
  367 +
  368 + log.setApiMethod(request.getMethod());
  369 + log.setIp(request.getRemoteAddr());
  370 +
  371 + rebuildRequestHeader(log);
  372 +
  373 + rebuildRequestBody(log, request);
  374 +
  375 + //如果reqeust中取不到post参数,就从接口方法参数中取json对象
  376 + if(StringUtils.isEmpty(log.getRequestBody())) {
  377 + rebuildRequestBody(log, point);
  378 + }
  379 +
  380 + }catch (Exception e){
  381 + e.printStackTrace();
  382 + }
  383 +
  384 + return log;
  385 + }
  386 +
  387 + private void finishApiLog(ApiLog log, Object ret){
  388 + try {
  389 + rebuildResponseHeader(log);
  390 + rebuildResponseBody(log, ret);
  391 +
  392 + log.setResponseTime(new Date());
  393 + Long duration = log.getResponseTime().getTime() - log.getRequestTime().getTime();
  394 + log.setDuration(duration.intValue());
  395 +
  396 + HttpServletResponse resp = ServletUtils.getResponse();
  397 + log.setHttpCode(resp.getStatus());
  398 +
  399 + if (ret instanceof Result) {
  400 + int retCode = ((Result) ret).getCode();
  401 + log.setRetCode(retCode);
  402 + }
  403 + }catch (Exception e){
  404 + e.printStackTrace();
  405 + }finally {
  406 + saveApiLog(log);
  407 + }
  408 + }
  409 +
  410 + public static void setApiLogException(ApiLog log, Exception e){
  411 + try {
  412 + String exception = ExceptionUtils.getFullStackTrace(e);
  413 + String shortExpInfo = e.getMessage() + "\n" + org.apache.commons.lang3.StringUtils.left(exception, 1000);
  414 + log.setException(shortExpInfo);
  415 + }catch (Exception ex){
  416 + ex.printStackTrace();
  417 + }
  418 + }
  419 +
  420 + private void rebuildRequestHeader(ApiLog log){
  421 + try {
  422 + HttpServletRequest req = ServletUtils.getRequest();
  423 + Enumeration names = req.getHeaderNames();
  424 + ArrayList<String> headerList = new ArrayList<>();
  425 + while(names.hasMoreElements()){
  426 + String name = (String)names.nextElement();
  427 + String header = req.getHeader(name);
  428 + headerList.add(name + ": " + header);
  429 + }
  430 + String headers = org.apache.commons.lang3.StringUtils.join(headerList, "\n");
  431 + log.setRequestHeader(headers);
  432 + }catch (Exception e){
  433 + e.printStackTrace();
  434 + }
  435 + }
  436 +
  437 + /**先从post参数中构造request body*/
  438 + private void rebuildRequestBody(ApiLog log, HttpServletRequest request){
  439 + try{
  440 + Set<String> keySet = request.getParameterMap().keySet();
  441 + Iterator<String> it = keySet.iterator();
  442 + StringBuffer sbf = new StringBuffer();
  443 + while(it.hasNext()){
  444 + String key = it.next();
  445 + String value = request.getParameter(key);
  446 + sbf.append(key).append("=").append(value);
  447 + if(it.hasNext()) {
  448 + sbf.append("&");
  449 + }
  450 + }
  451 + log.setRequestBody(sbf.toString());
  452 + }catch (Exception e){
  453 + e.printStackTrace();
  454 + }
  455 + }
  456 +
  457 + /**
  458 + * 根据接口中的参数构造request body
  459 + */
  460 + private void rebuildRequestBody(ApiLog log, ProceedingJoinPoint point)
  461 + {
  462 + try {
  463 + if (point.getArgs().length == 1) {
  464 + log.setRequestBody(JSONObject.toJSONString(point.getArgs()[0]));
  465 + return;
  466 + }
  467 +
  468 + MethodSignature m = (MethodSignature) point.getSignature();
  469 + HashMap<String, Object> map = new HashMap<>();
  470 + Object[] args = point.getArgs();
  471 + for (int i = 0; i < m.getParameterNames().length; i++) {
  472 + String name = m.getParameterNames()[i];
  473 +// Class type = m.getParameterTypes()[i];
  474 + map.put(name, args[i]);
  475 + }
  476 +
  477 + if(!map.isEmpty()) {
  478 + log.setRequestBody(JSONObject.toJSONString(map));
  479 + }
  480 + }catch (Exception e){
  481 + e.printStackTrace();
  482 + }
  483 + }
  484 +
  485 + private void rebuildResponseHeader(ApiLog log){
  486 + try {
  487 + HttpServletResponse resp = ServletUtils.getResponse();
  488 + Collection names = resp.getHeaderNames();
  489 + ArrayList<String> headerList = new ArrayList<>();
  490 + Iterator<String> it = names.iterator();
  491 + while(it.hasNext()){
  492 + String name = it.next();
  493 + String header = resp.getHeader(name);
  494 + headerList.add(name + ": " + header);
  495 + }
  496 + String headers = org.apache.commons.lang3.StringUtils.join(headerList, "\n");
  497 + log.setResponseHeader(headers);
  498 + }catch (Exception e){
  499 + e.printStackTrace();
  500 + }
  501 + }
  502 +
  503 + private void rebuildResponseBody(ApiLog log, Object ret){
  504 + try {
  505 + log.setResponseBody(JSONObject.toJSON(ret).toString());
  506 + }catch (Exception e){
  507 + e.printStackTrace();
  508 + }
  509 + }
  510 +
  511 + @Async
  512 + public void saveApiLog(ApiLog log){
  513 + try{
  514 + apiLogService.saveOrUpdate(log);
  515 + }catch (Exception e){
  516 + e.printStackTrace();
  517 + }
  518 + }
  519 +}
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/annotation/ApiLogger.java 0 → 100644
  1 +package org.jeecg.modules.wms.framework.aspectj.lang.annotation;
  2 +
  3 +import java.lang.annotation.*;
  4 +
  5 +/**
  6 + * 第三方系统API请求调用日志注解
  7 + *
  8 + * @author huaheng
  9 + *
  10 + */
  11 +@Target({ ElementType.METHOD })
  12 +@Retention(RetentionPolicy.RUNTIME)
  13 +@Documented
  14 +public @interface ApiLogger
  15 +{
  16 + /** 接口名称 */
  17 + String apiName() default "";
  18 +
  19 + /** 接口调用方 */
  20 + String from() default "";
  21 +
  22 + /** 接口提供方 */
  23 + String to() default "WMS";
  24 +
  25 +}
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/BusinessStatus.java 0 → 100644
  1 +package org.jeecg.modules.wms.framework.aspectj.lang.constant;
  2 +
  3 +/**
  4 + * 操作状态
  5 + *
  6 + * @author huaheng
  7 + *
  8 + */
  9 +public class BusinessStatus
  10 +{
  11 + /** 其它 */
  12 + public static final String OTHER = "-1";
  13 +
  14 + /** 成功 */
  15 + public static final String SUCCESS = "0";
  16 +
  17 + /** 失败 */
  18 + public static final String FAIL = "1";
  19 +}
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/BusinessType.java 0 → 100644
  1 +package org.jeecg.modules.wms.framework.aspectj.lang.constant;
  2 +
  3 +/**
  4 + * 业务操作类型
  5 + *
  6 + * @author huaheng
  7 + *
  8 + */
  9 +public class BusinessType
  10 +{
  11 + /** 其它 */
  12 + public static final String OTHER = "0";
  13 + /** 新增 */
  14 + public static final String INSERT = "1";
  15 + /** 修改 */
  16 + public static final String UPDATE = "2";
  17 + /** 删除 */
  18 + public static final String DELETE = "3";
  19 + /** 授权 */
  20 + public static final String GRANT = "4";
  21 + /** 导出 */
  22 + public static final String EXPORT = "5";
  23 + /** 导入 */
  24 + public static final String IMPORT = "6";
  25 + /** 强退 */
  26 + public static final String FORCE = "7";
  27 + /** 生成代码 */
  28 + public static final String GENCODE = "8";
  29 +}
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/DataSourceName.java 0 → 100644
  1 +package org.jeecg.modules.wms.framework.aspectj.lang.constant;
  2 +
  3 +/**
  4 + * 多数据源别名
  5 + *
  6 + * @author huaheng
  7 + *
  8 + */
  9 +public class DataSourceName
  10 +{
  11 + /** 主库 */
  12 + public static final String MASTER = "master";
  13 +
  14 + /** 从库 */
  15 + public static final String SLAVE = "slave";
  16 +
  17 + /** wcs库*/
  18 + public static final String WCS = "wcs";
  19 +}
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/OperatorType.java 0 → 100644
  1 +package org.jeecg.modules.wms.framework.aspectj.lang.constant;
  2 +
  3 +/**
  4 + * 操作人类别
  5 + *
  6 + * @author huaheng
  7 + *
  8 + */
  9 +public class OperatorType
  10 +{
  11 + /** 其它 */
  12 + public static final String OTHER = "0";
  13 +
  14 + /** 后台用户 */
  15 + public static final String MANAGE = "1";
  16 +
  17 + /** 渠道用户 */
  18 + public static final String CHANNEL = "2";
  19 +
  20 + /** 手机端用户 */
  21 + public static final String MOBILE = "3";
  22 +}
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/ProcessCode.java 0 → 100644
  1 +package org.jeecg.modules.wms.framework.aspectj.lang.constant;
  2 +
  3 +/**
  4 + * 任务流程编码
  5 + *
  6 + * @author xcq
  7 + */
  8 +public class ProcessCode {
  9 + /** 入库任务 */
  10 + public static final String RECEIPT_TASK_CODE = "receipt_task";
  11 + /** 出库任务 */
  12 + public static final String SHIPMENT_TASK_CODE = "shipment_task";
  13 + /** 入库单据 */
  14 + public static final String RECEIPT_BILL_CODE = "receipt_bill";
  15 + /** 出库单据 */
  16 + public static final String SHIPMENT_BILL_CODE = "shipment_bill";
  17 + /** 其他任务 */
  18 + public static final String OTHER_TASK_CODE = "other_task";
  19 +
  20 + /** 从头部取值 */
  21 + public static final String METHOD_HEAD = "head";
  22 + /** 从返回结果取值 */
  23 + public static final String METHOD_RESULT = "result";
  24 + /** 通过表查询取值 */
  25 + public static final String METHOD_SELECT = "SELECT";
  26 +
  27 + /** 出库单据预约 */
  28 + public static final String MODIFICATION_EDIT = "modificationEdit";
  29 +
  30 + /** 出库单据审核 */
  31 + public static final String REVIEW = "review";
  32 + /** 出库单据销售单回传 */
  33 + public static final String PUSH_SALES_DELIVERY = "pushSalesDelivery";
  34 +
  35 + /** 入库单据创建 */
  36 + public static final String CREATE_RECEIPT_TASK = "createReceiptTask";
  37 + /** 入库单据回传 */
  38 + public static final String RECEIPT_METHOD = "receiptMethod";
  39 +}
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/datasource/DynamicDataSource.java 0 → 100644
  1 +package org.jeecg.modules.wms.framework.datasource;
  2 +
  3 +import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
  4 +
  5 +import javax.sql.DataSource;
  6 +import java.util.Map;
  7 +
  8 +/**
  9 + * 动态数据源
  10 + *
  11 + * @author huaheng
  12 + */
  13 +public class DynamicDataSource extends AbstractRoutingDataSource
  14 +{
  15 + public DynamicDataSource(DataSource defaultTargetDataSource, Map<Object, Object> targetDataSources)
  16 + {
  17 + super.setDefaultTargetDataSource(defaultTargetDataSource);
  18 + super.setTargetDataSources(targetDataSources);
  19 + super.afterPropertiesSet();
  20 + }
  21 +
  22 + @Override
  23 + protected Object determineCurrentLookupKey()
  24 + {
  25 + return DynamicDataSourceContextHolder.getDB();
  26 + }
  27 +
  28 +}
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/datasource/DynamicDataSourceContextHolder.java 0 → 100644
  1 +package org.jeecg.modules.wms.framework.datasource;
  2 +
  3 +import org.slf4j.Logger;
  4 +import org.slf4j.LoggerFactory;
  5 +
  6 +/**
  7 + * 当前线程数据源
  8 + *
  9 + * @author huaheng
  10 + */
  11 +public class DynamicDataSourceContextHolder
  12 +{
  13 + public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class);
  14 +
  15 + /**
  16 + * 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本,
  17 + * 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。
  18 + */
  19 + private static final ThreadLocal<String> CONTEXT_HOLDER = new ThreadLocal<>();
  20 +
  21 + /**
  22 + * 设置数据源名
  23 + */
  24 + public static void setDB(String dbType)
  25 + {
  26 + log.info("切换到{}数据源", dbType);
  27 + CONTEXT_HOLDER.set(dbType);
  28 + }
  29 +
  30 + /**
  31 + * 获取数据源名
  32 + */
  33 + public static String getDB()
  34 + {
  35 + return CONTEXT_HOLDER.get();
  36 + }
  37 +
  38 + /**
  39 + * 清理数据源名
  40 + */
  41 + public static void clearDB()
  42 + {
  43 + CONTEXT_HOLDER.remove();
  44 + }
  45 +
  46 +}
... ...
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/spring/SpringUtils.java 0 → 100644
  1 +package org.jeecg.modules.wms.framework.spring;
  2 +
  3 +import org.springframework.beans.BeansException;
  4 +import org.springframework.beans.factory.NoSuchBeanDefinitionException;
  5 +import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
  6 +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
  7 +import org.springframework.stereotype.Component;
  8 +
  9 +/**
  10 + * spring工具类 方便在非spring管理环境中获取bean
  11 + *
  12 + * @author huaheng
  13 + */
  14 +@Component
  15 +public final class SpringUtils implements BeanFactoryPostProcessor
  16 +{
  17 + /** Spring应用上下文环境 */
  18 + private static ConfigurableListableBeanFactory beanFactory;
  19 +
  20 + @Override
  21 + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
  22 + {
  23 + SpringUtils.beanFactory = beanFactory;
  24 + }
  25 +
  26 + /**
  27 + * 获取对象
  28 + *
  29 + * @param name
  30 + * @return Object 一个以所给名字注册的bean的实例
  31 + * @throws BeansException
  32 + *
  33 + */
  34 + @SuppressWarnings("unchecked")
  35 + public static <T> T getBean(String name) throws BeansException
  36 + {
  37 + return (T) beanFactory.getBean(name);
  38 + }
  39 +
  40 + /**
  41 + * 获取类型为requiredType的对象
  42 + *
  43 + * @param clz
  44 + * @return
  45 + * @throws BeansException
  46 + *
  47 + */
  48 + public static <T> T getBean(Class<T> clz) throws BeansException
  49 + {
  50 + T result = (T) beanFactory.getBean(clz);
  51 + return result;
  52 + }
  53 +
  54 + /**
  55 + * 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true
  56 + *
  57 + * @param name
  58 + * @return boolean
  59 + */
  60 + public static boolean containsBean(String name)
  61 + {
  62 + return beanFactory.containsBean(name);
  63 + }
  64 +
  65 + /**
  66 + * 判断以给定名字注册的bean定义是一个singleton还是一个prototype。 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException)
  67 + *
  68 + * @param name
  69 + * @return boolean
  70 + * @throws NoSuchBeanDefinitionException
  71 + *
  72 + */
  73 + public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException
  74 + {
  75 + return beanFactory.isSingleton(name);
  76 + }
  77 +
  78 + /**
  79 + * @param name
  80 + * @return Class 注册对象的类型
  81 + * @throws NoSuchBeanDefinitionException
  82 + *
  83 + */
  84 + public static Class<?> getType(String name) throws NoSuchBeanDefinitionException
  85 + {
  86 + return beanFactory.getType(name);
  87 + }
  88 +
  89 + /**
  90 + * 如果给定的bean名字在bean定义中有别名,则返回这些别名
  91 + *
  92 + * @param name
  93 + * @return
  94 + * @throws NoSuchBeanDefinitionException
  95 + *
  96 + */
  97 + public static String[] getAliases(String name) throws NoSuchBeanDefinitionException
  98 + {
  99 + return beanFactory.getAliases(name);
  100 + }
  101 +
  102 +}
... ...