11 Komitmen 578a7b0608 ... 6b684e2332

Pembuat SHA1 Pesan Tanggal
  13660505945 6b684e2332 Merge remote-tracking branch 'origin/master_liushuang' 1 bulan lalu
  13660505945 c4f99f6cfd Merge remote-tracking branch 'origin/master_liaozeyong' 1 bulan lalu
  huang d990d4829a Merge branch 'master' of http://121.40.253.172:3000/pengyue/jsh_erp into master_huangjunjie 1 bulan lalu
  huang 1a3cdde780 商品编辑子商品空白bug修改 1 bulan lalu
  ms-blue a009f8cefc Merge remote-tracking branch 'origin/xq' into master_liushuang 1 bulan lalu
  廖泽勇 3d62371e84 字段调整 1 bulan lalu
  廖泽勇 79c1cc83ae Merge branch 'master' of http://121.40.253.172:3000/pengyue/jsh_erp into master_liaozeyong 1 bulan lalu
  廖泽勇 74040c50f0 Merge branch 'master_huangjunjie' of http://121.40.253.172:3000/pengyue/jsh_erp into master_liaozeyong 1 bulan lalu
  廖泽勇 d06cb17b76 仓库下拉框调整 1 bulan lalu
  15102826049 bac73148bb bug修改 1 bulan lalu
  15102826049 a807df6bbc bug修改 1 bulan lalu
30 mengubah file dengan 565 tambahan dan 432 penghapusan
  1. 4 0
      docs/new_sql.sql
  2. 10 7
      jshERP-web/src/components/jeecg/JEditableTable.vue
  3. 5 4
      jshERP-web/src/components/jeecgbiz/modal/JSelectMaterialModal.vue
  4. 1 1
      jshERP-web/src/views/bill/PurchaseOrderList.vue
  5. 1 1
      jshERP-web/src/views/bill/SaleOrderList.vue
  6. 5 5
      jshERP-web/src/views/bill/mixins/BillModalMixin.js
  7. 7 8
      jshERP-web/src/views/bill/modules/AllocationOutModal.vue
  8. 7 8
      jshERP-web/src/views/bill/modules/OtherInModal.vue
  9. 9 8
      jshERP-web/src/views/bill/modules/OtherOutModal.vue
  10. 7 8
      jshERP-web/src/views/bill/modules/PurchaseInModal.vue
  11. 9 8
      jshERP-web/src/views/bill/modules/SaleOutModal.vue
  12. 4 5
      jshERP-web/src/views/stock/components/checkModal.vue
  13. 4 0
      jshERP-web/src/views/stock/components/stockModal.vue
  14. 6 6
      jshERP-web/src/views/stock/utils/table.js
  15. 1 1
      jshERP-web/src/views/system/VendorList.vue
  16. 2 2
      jshERP-web/src/views/system/modules/VendorModal.vue
  17. 1 0
      jshERP-web/src/views/system/modules/userSupplierModal.vue
  18. 1 1
      src/main/java/com/jsh/erp/controller/MaterialExtendController.java
  19. 9 13
      src/main/java/com/jsh/erp/controller/pda/PdaController.java
  20. 0 3
      src/main/java/com/jsh/erp/datasource/entities/DepotHead.java
  21. 2 1
      src/main/java/com/jsh/erp/datasource/entities/DepotItemVo4WithInfoEx.java
  22. 1 1
      src/main/java/com/jsh/erp/datasource/entities/TaskStocktaking.java
  23. 1 1
      src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapper.java
  24. 10 1
      src/main/java/com/jsh/erp/datasource/mappers/DepotMapper.java
  25. 29 334
      src/main/java/com/jsh/erp/service/DepotService.java
  26. 1 1
      src/main/java/com/jsh/erp/service/impl/DepotItemServiceImpl.java
  27. 396 0
      src/main/java/com/jsh/erp/service/impl/DepotServiceImpl.java
  28. 20 2
      src/main/resources/mapper_xml/DepotHeadMapper.xml
  29. 10 0
      src/main/resources/mapper_xml/DepotMapper.xml
  30. 2 2
      src/main/resources/mapper_xml/MaterialMapperEx.xml

+ 4 - 0
docs/new_sql.sql

@@ -112,3 +112,7 @@ CREATE TABLE `apk_version` (
     `delete_flag` tinyint DEFAULT NULL COMMENT '是否删除',
     PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
+
+ALTER TABLE jsh_depot_head
+ADD COLUMN depot_id bigint DEFAULT NULL COMMENT '仓库id',
+ADD COLUMN oper_id bigint DEFAULT NULL COMMENT '操作人';

+ 10 - 7
jshERP-web/src/components/jeecg/JEditableTable.vue

@@ -53,9 +53,9 @@
               @change="handleChangeCheckedAll"
             />
           </div>
-          <!-- 右侧动态生成td -->
-          <template v-for="col in columns">
-            <div v-show="col.type !== formTypes.hidden" class="td" :key="col.key" :style="buildTdStyle(col)">
+          <!-- 右侧动态生成td 这里是title -->
+          <template v-for="col in columns" v-if="col.type !== formTypes.hidden">
+            <div class="td" :key="col.key" :style="buildTdStyle(col)">
               <span style="padding: 0 5px">
                 {{ col.title }}
                 <slot name="depotBatchSet" v-if="col.key === 'depotId'" :target="getVM()" />
@@ -156,7 +156,7 @@
                   </template>
                 </div>
 
-                <!-- 右侧动态生成td -->
+                <!-- 右侧动态生成td 这里是内容区 -->
                 <div
                   class="td"
                   v-for="col in columns"
@@ -481,7 +481,7 @@
 
                     <!-- update-begin-author:jsh date:20210308 for:popupJsh -->
                     <template v-else-if="col.type === formTypes.popupJsh">
-                      <div style="max-width: 200px" :key="i">
+                      <div style="width: 190px" :key="i">
                         <a-tooltip
                           :id="id"
                           placement="top"
@@ -2827,6 +2827,8 @@ export default {
         style['padding-left'] = '0'
         style['padding-right'] = '0'
       }
+      style['box-sizing'] = 'border-box'
+
       return style
     },
     /** view辅助方法:构造props */
@@ -3304,9 +3306,10 @@ export default {
         transition: all 0.3s;
         outline: none;
         overflow: hidden;
-        white-space: nowrap;
+        // white-space: nowrap;
         text-overflow: ellipsis;
-        max-width: 150px;
+        // flex-shrink: 0;
+        // max-width: 150px;
       }
     }
   }

+ 5 - 4
jshERP-web/src/components/jeecgbiz/modal/JSelectMaterialModal.vue

@@ -95,7 +95,7 @@
                 </a-col>
                 <a-col :md="6" :sm="24">
                   <a-form-item label="仓库货架" :labelCol="labelCol" :wrapperCol="wrapperCol">
-                    <a-input placeholder="请输入制造商" v-model="queryParam.position"></a-input>
+                    <a-input placeholder="请输入仓库货架" v-model="queryParam.position"></a-input>
                   </a-form-item>
                 </a-col>
                 <!-- <a-col :md="6" :sm="24">
@@ -109,7 +109,7 @@
               </template>
             </a-row>
           </a-form>
-          <a-button type="primary" @click="findAllSelect">一键全选</a-button>
+          <a-button v-if="isStock" type="primary" @click="findAllSelect">一键全选</a-button>
           <a-table
             ref="table"
             :scroll="scrollTrigger"
@@ -169,7 +169,7 @@ export default {
   components: {
     MaterialModal: () => import('@/views/material/modules/MaterialModal'),
   },
-  props: ['rows', 'multi', 'barCode'],
+  props: ['rows', 'multi', 'barCode', 'isStock'],
   data() {
     return {
       modalWidth: 1450,
@@ -430,7 +430,8 @@ export default {
     initDepotSelect() {
       if (this.rows) {
         if (JSON.parse(this.rows).depotId) {
-          this.queryParam.depotId = JSON.parse(this.rows).depotId - 0
+          const id = JSON.parse(this.rows).depotId - 0
+          this.queryParam.depotId = id + ''
         }
       }
     },

+ 1 - 1
jshERP-web/src/views/bill/PurchaseOrderList.vue

@@ -1,7 +1,7 @@
 <template>
   <a-row :gutter="24">
     <a-col :md="24">
-      <a-card :style="cardStyle" :bordered="false">
+      <a-card :bordered="false">
         <!-- 查询区域 -->
         <div class="table-page-search-wrapper">
           <!-- 搜索区域 -->

+ 1 - 1
jshERP-web/src/views/bill/SaleOrderList.vue

@@ -2,7 +2,7 @@
 <template>
   <a-row :gutter="24">
     <a-col :md="24">
-      <a-card :style="cardStyle" :bordered="false">
+      <a-card :bordered="false">
         <!-- 查询区域 -->
         <div class="table-page-search-wrapper">
           <!-- 搜索区域 -->

+ 5 - 5
jshERP-web/src/views/bill/mixins/BillModalMixin.js

@@ -701,11 +701,11 @@ export const BillModalMixin = {
             if (!Array.isArray(arr)) {
               arr = JSON.parse(arr)
             }
-            for (let i of arr) {
-              if (i.name === value) {
-                target.setValues([{ rowKey: row.id, values: { unitName: i.name } }])
-              }
-            }
+            // for (let i of arr) {
+            //   if (i.name === value) {
+            //     target.setValues([{ rowKey: row.id, values: { unitName: i.name } }])
+            //   }
+            // }
           }
 
           target.$forceUpdate()

+ 7 - 8
jshERP-web/src/views/bill/modules/AllocationOutModal.vue

@@ -115,7 +115,6 @@
               :value="value"
               :options="currentUserList"
               @change="($event) => handleChange($event)"
-              @focus="($event) => handleFocus($event)"
             >
             </a-select>
           </template>
@@ -219,19 +218,19 @@ export default {
             multi: true,
             validateRules: [{ required: true, message: '${title}不能为空' }],
           },
-          { title: '名称', key: 'name', width: '10%', type: FormTypes.normal },
+          { title: '名称', key: 'name', width: '9%', type: FormTypes.normal },
           { title: '规格', key: 'standard', width: '9%', type: FormTypes.normal },
 
-          { title: '生产日期', key: 'productionDate', width: '9%', type: FormTypes.normal },
+          { title: '生产日期', key: 'productionDate', width: '9%', type: FormTypes.normal, disabled: true },
           { title: '保质期', key: 'expiryNum', width: '6%', type: FormTypes.normal },
-          { title: '商品条码', key: 'barCode', width: '6%', type: FormTypes.normal },
-          { title: '仓库名', key: 'depotName', width: '6%', type: FormTypes.normal },
+          { title: '商品条码', key: 'barCode', width: '9%', type: FormTypes.normal },
+          { title: '仓库名', key: 'depotId', width: '9%', type: FormTypes.select, disabled: true },
           { title: '仓库货架', key: 'position', width: '6%', type: FormTypes.normal },
-          { title: '包装规格', key: 'unitName', width: '6%', type: FormTypes.normal },
+          { title: '包装规格', key: 'unitName', width: '7%', type: FormTypes.normal },
 
           { title: '型号', key: 'model', width: '9%', type: FormTypes.normal },
-          { title: '颜色', key: 'color', width: '5%', type: FormTypes.normal },
-          { title: '品牌', key: 'brand', width: '6%', type: FormTypes.normal },
+          { title: '颜色', key: 'color', width: '9%', type: FormTypes.normal },
+          { title: '品牌', key: 'brand', width: '9%', type: FormTypes.normal },
           { title: '制造商', key: 'mfrs', width: '6%', type: FormTypes.normal },
           { title: '扩展信息', key: 'materialOther', width: '5%', type: FormTypes.normal },
           { title: '库存', key: 'stock', width: '5%', type: FormTypes.normal },

+ 7 - 8
jshERP-web/src/views/bill/modules/OtherInModal.vue

@@ -160,7 +160,6 @@
               :value="value"
               :options="currentUserList"
               @change="($event) => handleChange($event)"
-              @focus="($event) => handleFocus($event)"
             >
             </a-select>
           </template>
@@ -292,26 +291,26 @@ export default {
             multi: true,
             validateRules: [{ required: true, message: '${title}不能为空' }],
           },
-          { title: '名称', key: 'name', width: '10%', type: FormTypes.normal },
+          { title: '名称', key: 'name', width: '9%', type: FormTypes.normal },
           { title: '规格', key: 'standard', width: '9%', type: FormTypes.normal },
 
           { title: '生产日期', key: 'productionDate', width: '9%', type: FormTypes.normal },
           { title: '保质期', key: 'expiryNum', width: '6%', type: FormTypes.normal },
           { title: '商品条码', key: 'barCode', width: '9%', type: FormTypes.normal },
           { title: '仓库名', key: 'depotId', width: '9%', type: FormTypes.normal },
-          { title: '仓库货架', key: 'position', width: '9%', type: FormTypes.normal },
-          { title: '包装规格', key: 'unitName', width: '9%', type: FormTypes.normal },
+          { title: '仓库货架', key: 'position', width: '6%', type: FormTypes.normal },
+          { title: '包装规格', key: 'unitName', width: '7%', type: FormTypes.normal },
 
           { title: '型号', key: 'model', width: '9%', type: FormTypes.normal },
-          { title: '颜色', key: 'color', width: '5%', type: FormTypes.normal },
-          { title: '品牌', key: 'brand', width: '6%', type: FormTypes.normal },
+          { title: '颜色', key: 'color', width: '9%', type: FormTypes.normal },
+          { title: '品牌', key: 'brand', width: '9%', type: FormTypes.normal },
           { title: '制造商', key: 'mfrs', width: '6%', type: FormTypes.normal },
           { title: '扩展信息', key: 'materialOther', width: '5%', type: FormTypes.normal },
           { title: '库存', key: 'stock', width: '5%', type: FormTypes.normal },
           {
             title: '单位',
             key: 'unit',
-            width: '4%',
+            width: '6%',
             type: FormTypes.slot,
             options: [],
             allowClear: false,
@@ -325,7 +324,7 @@ export default {
           { title: '原数量', key: 'preNumber', width: '4%', type: FormTypes.normal },
           { title: '已入库', key: 'finishNumber', width: '4%', type: FormTypes.normal },
           {
-            title: '数量',
+            title: '入库数量',
             key: 'operNumber',
             width: '5%',
             type: FormTypes.inputNumber,

+ 9 - 8
jshERP-web/src/views/bill/modules/OtherOutModal.vue

@@ -161,7 +161,6 @@
               :value="value"
               :options="currentUserList"
               @change="($event) => handleChange($event)"
-              @focus="($event) => handleFocus($event)"
             >
             </a-select>
           </template>
@@ -289,21 +288,23 @@ export default {
             type: FormTypes.popupJsh,
             kind: 'material',
             multi: true,
+            newBatch: true,
+
             validateRules: [{ required: true, message: '${title}不能为空' }],
           },
-          { title: '名称', key: 'name', width: '10%', type: FormTypes.normal },
+          { title: '名称', key: 'name', width: '9%', type: FormTypes.normal },
           { title: '规格', key: 'standard', width: '9%', type: FormTypes.normal },
 
-          { title: '生产日期', key: 'productionDate', width: '9%', type: FormTypes.normal },
+          { title: '生产日期', key: 'productionDate', width: '9%', type: FormTypes.normal, disabled: true },
           { title: '保质期', key: 'expiryNum', width: '6%', type: FormTypes.normal },
-          { title: '商品条码', key: 'barCode', width: '6%', type: FormTypes.normal },
-          { title: '仓库名', key: 'depotId', width: '6%', type: FormTypes.select, disabled: true },
+          { title: '商品条码', key: 'barCode', width: '9%', type: FormTypes.normal },
+          { title: '仓库名', key: 'depotId', width: '9%', type: FormTypes.select, disabled: true },
           { title: '仓库货架', key: 'position', width: '6%', type: FormTypes.normal },
-          { title: '包装规格', key: 'unitName', width: '6%', type: FormTypes.normal },
+          { title: '包装规格', key: 'unitName', width: '7%', type: FormTypes.normal },
 
           { title: '型号', key: 'model', width: '9%', type: FormTypes.normal },
-          { title: '颜色', key: 'color', width: '5%', type: FormTypes.normal },
-          { title: '品牌', key: 'brand', width: '6%', type: FormTypes.normal },
+          { title: '颜色', key: 'color', width: '9%', type: FormTypes.normal },
+          { title: '品牌', key: 'brand', width: '9%', type: FormTypes.normal },
           { title: '制造商', key: 'mfrs', width: '6%', type: FormTypes.normal },
           { title: '扩展信息', key: 'materialOther', width: '5%', type: FormTypes.normal },
           { title: '库存', key: 'stock', width: '5%', type: FormTypes.normal },

+ 7 - 8
jshERP-web/src/views/bill/modules/PurchaseInModal.vue

@@ -185,7 +185,6 @@
               :value="value"
               :options="currentUserList"
               @change="($event) => handleChange($event)"
-              @focus="($event) => handleFocus($event)"
             >
             </a-select>
           </template>
@@ -472,19 +471,19 @@ export default {
 
             validateRules: [{ required: true, message: '${title}不能为空' }],
           },
-          { title: '名称', key: 'name', width: '7%', type: FormTypes.normal },
-          { title: '规格', key: 'standard', width: '6%', type: FormTypes.normal },
+          { title: '名称', key: 'name', width: '9%', type: FormTypes.normal },
+          { title: '规格', key: 'standard', width: '9%', type: FormTypes.normal },
 
           { title: '生产日期', key: 'productionDate', width: '9%', type: FormTypes.normal, disabled: true },
           { title: '保质期', key: 'expiryNum', width: '6%', type: FormTypes.normal },
-          { title: '商品条码', key: 'barCode', width: '6%', type: FormTypes.normal },
-          { title: '仓库名', key: 'depotId', width: '6%', type: FormTypes.select, disabled: true },
+          { title: '商品条码', key: 'barCode', width: '9%', type: FormTypes.normal },
+          { title: '仓库名', key: 'depotId', width: '9%', type: FormTypes.select, disabled: true },
           { title: '仓库货架', key: 'position', width: '6%', type: FormTypes.normal },
-          { title: '包装规格', key: 'unitName', width: '6%', type: FormTypes.normal },
+          { title: '包装规格', key: 'unitName', width: '7%', type: FormTypes.normal },
 
           { title: '型号', key: 'model', width: '9%', type: FormTypes.normal },
-          { title: '颜色', key: 'color', width: '5%', type: FormTypes.normal },
-          { title: '品牌', key: 'brand', width: '6%', type: FormTypes.normal },
+          { title: '颜色', key: 'color', width: '9%', type: FormTypes.normal },
+          { title: '品牌', key: 'brand', width: '9%', type: FormTypes.normal },
           { title: '制造商', key: 'mfrs', width: '6%', type: FormTypes.normal },
           { title: '扩展信息', key: 'materialOther', width: '5%', type: FormTypes.normal },
           { title: '库存', key: 'stock', width: '5%', type: FormTypes.normal },

+ 9 - 8
jshERP-web/src/views/bill/modules/SaleOutModal.vue

@@ -187,7 +187,6 @@
               :value="value"
               :options="currentUserList"
               @change="($event) => handleChange($event)"
-              @focus="($event) => handleFocus($event)"
             >
             </a-select>
           </template>
@@ -493,21 +492,23 @@ export default {
             type: FormTypes.popupJsh,
             kind: 'material',
             multi: true,
+            newBatch: true,
+
             validateRules: [{ required: true, message: '${title}不能为空' }],
           },
-          { title: '名称', key: 'name', width: '10%', type: FormTypes.normal },
+          { title: '名称', key: 'name', width: '9%', type: FormTypes.normal },
           { title: '规格', key: 'standard', width: '9%', type: FormTypes.normal },
 
-          { title: '生产日期', key: 'productionDate', width: '9%', type: FormTypes.normal },
+          { title: '生产日期', key: 'productionDate', width: '9%', type: FormTypes.normal, disabled: true },
           { title: '保质期', key: 'expiryNum', width: '6%', type: FormTypes.normal },
-          { title: '商品条码', key: 'barCode', width: '6%', type: FormTypes.normal },
-          { title: '仓库名', key: 'depotId', width: '6%', type: FormTypes.select, disabled: true },
+          { title: '商品条码', key: 'barCode', width: '9%', type: FormTypes.normal },
+          { title: '仓库名', key: 'depotId', width: '9%', type: FormTypes.select, disabled: true },
           { title: '仓库货架', key: 'position', width: '6%', type: FormTypes.normal },
-          { title: '包装规格', key: 'unitName', width: '6%', type: FormTypes.normal },
+          { title: '包装规格', key: 'unitName', width: '7%', type: FormTypes.normal },
 
           { title: '型号', key: 'model', width: '9%', type: FormTypes.normal },
-          { title: '颜色', key: 'color', width: '5%', type: FormTypes.normal },
-          { title: '品牌', key: 'brand', width: '6%', type: FormTypes.normal },
+          { title: '颜色', key: 'color', width: '9%', type: FormTypes.normal },
+          { title: '品牌', key: 'brand', width: '9%', type: FormTypes.normal },
           { title: '制造商', key: 'mfrs', width: '6%', type: FormTypes.normal },
           { title: '扩展信息', key: 'materialOther', width: '5%', type: FormTypes.normal },
           { title: '库存', key: 'stock', width: '5%', type: FormTypes.normal },

+ 4 - 5
jshERP-web/src/views/stock/components/checkModal.vue

@@ -85,11 +85,9 @@
             <span slot="action" v-if="openType !== 'detail'" slot-scope="text, record">
               <a type="text" @click="handleEdit(record)">编辑</a>
             </span>
-            <!-- <template slot="customName" slot-scope="text, record">
-          {{ record.name }}
-          <a-tag v-if="record.enableSerialNumber == 1" color="orange">序</a-tag>
-          <a-tag v-if="record.enableBatchNumber == 1" color="orange">批</a-tag>
-        </template> -->
+            <template slot="inventory" slot-scope="value, record">
+              {{ parseInt(value) }}
+            </template>
           </a-table>
         </div>
       </a-spin>
@@ -104,6 +102,7 @@
       @all="findAllSelect"
       ref="selectModal"
       :multi="true"
+      :isStock="true"
     ></j-select-material-modal>
     <a-modal @cancel="editVisible = false" @ok="onSubmitGoods" :visible="editVisible" title="编辑" width="50%">
       <a-form :form="editForm">

+ 4 - 0
jshERP-web/src/views/stock/components/stockModal.vue

@@ -38,6 +38,9 @@
                 <a>删除</a>
               </a-popconfirm>
             </span>
+            <template slot="inventory" slot-scope="value, record">
+              {{ parseInt(value) }}
+            </template>
             <!-- <template slot="customName" slot-scope="text, record">
           {{ record.name }}
           <a-tag v-if="record.enableSerialNumber == 1" color="orange">序</a-tag>
@@ -56,6 +59,7 @@
       @all="findAllSelect"
       ref="selectModal"
       :multi="true"
+      :isStock="true"
     ></j-select-material-modal>
   </div>
 </template>

+ 6 - 6
jshERP-web/src/views/stock/utils/table.js

@@ -65,20 +65,20 @@ const table = {
 
     // { dataIndex: 'mBarCode', title: '条码', scopedSlots: { customRender: 'customBarCode' } },
     { dataIndex: 'batchNumber', title: '批次号' },
-    { dataIndex: 'name', title: '名称', scopedSlots: { customRender: 'customName' } },
+    { dataIndex: 'materialName', title: '商品名称', scopedSlots: { customRender: 'customName' } },
     { dataIndex: 'categoryName', title: '类别' },
     { dataIndex: 'standard', title: '规格' },
     { dataIndex: 'model', title: '型号' },
     { dataIndex: 'color', title: '颜色' },
     { dataIndex: 'brand', title: '品牌' },
     { dataIndex: 'supplierName', title: '供应商' },
-    { dataIndex: 'unit', title: '单位' },
+    { dataIndex: 'commodityUnit', title: '单位' },
     { dataIndex: 'sku', title: '多属性' },
-    { dataIndex: 'stock', title: '库存' },
+    { dataIndex: 'inventory', title: '库存', scopedSlots: { customRender: 'inventory' } },
     { dataIndex: 'productionDate', title: '生产日期' },
     { dataIndex: 'expiryNum', title: '保质期' },
     { dataIndex: 'barCode', title: '商品条码' },
-    { dataIndex: 'depotId', title: '仓库名称' },
+    { dataIndex: 'depotName', title: '仓库名称' },
     { dataIndex: 'position', title: '仓库货架' },
   ],
   checkGoodsColumns: [
@@ -90,8 +90,8 @@ const table = {
     { dataIndex: 'productionDate', title: '生产日期' },
     { dataIndex: 'supplierName', title: '供应商' },
     { dataIndex: 'barCode', title: '商品条码' },
-    { dataIndex: 'stock', title: '库存(最小单位)' },
-    { dataIndex: 'depotId', title: '仓库名称' },
+    { dataIndex: 'inventory', title: '库存(最小单位)', scopedSlots: { customRender: 'inventory' } },
+    { dataIndex: 'depotName', title: '仓库名称' },
     { dataIndex: 'position', title: '仓库货架' },
     { dataIndex: 'newInventory', title: '实际库存' },
     { dataIndex: 'newPosition', title: '实际仓位货架' },

+ 1 - 1
jshERP-web/src/views/system/VendorList.vue

@@ -162,7 +162,7 @@ export default {
         },
         { title: '账单周期', dataIndex: 'billingCycleDays', width: 80, align: 'left' },
         { title: '采购对接人', dataIndex: 'procurementContact', width: 100, align: 'left' },
-        { title: '到货天数', dataIndex: 'deliverydays', width: 80, align: 'left' },
+        { title: '到货天数', dataIndex: 'deliveryDays', width: 80, align: 'left' },
         {
           title: '发票类型',
           dataIndex: 'invoiceType',

+ 2 - 2
jshERP-web/src/views/system/modules/VendorModal.vue

@@ -116,7 +116,7 @@
             </a-col>
             <a-col :span="24 / 2">
               <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="到货天数">
-                <a-input placeholder="请输入到货天数" v-decorator.trim="['deliverydays']" />
+                <a-input placeholder="请输入到货天数" v-decorator.trim="['deliveryDays']" />
               </a-form-item>
             </a-col>
             <a-col :span="24 / 2">
@@ -248,7 +248,7 @@ export default {
             'settlementMethod',
             'billingCycleDays',
             'procurementContact',
-            'deliverydays',
+            'deliveryDays',
             'invoiceType',
             'contractUpload'
           )

+ 1 - 0
jshERP-web/src/views/system/modules/userSupplierModal.vue

@@ -109,6 +109,7 @@ export default {
           formData.type = 'UserSupplier'
           formData.keyId = this.roleId
           formData.value = this.checkedKeys.map((item) => Number(item))
+
           let obj
           checkUserBusiness({ type: 'UserSupplier', keyId: this.roleId }).then((res) => {
             if (res.data && res.data.id) {

+ 1 - 1
src/main/java/com/jsh/erp/controller/MaterialExtendController.java

@@ -109,7 +109,7 @@ public class MaterialExtendController {
                     item.put("commodityDecimal", md.getCommodityDecimal());
                     item.put("wholesaleDecimal", md.getWholesaleDecimal());
                     item.put("lowDecimal", md.getLowDecimal());
-                    item.put("productionDate", DateUtils.dateTime(md.getProductionDate()));
+                    item.put("productionDate", md.getProductionDate() == null ? "": DateUtils.dateTime(md.getProductionDate()));
                     item.put("expiryNum",md.getExpiryNum());
                     item.put("supplierId",md.getSupplierId());
                     item.put("barCode",md.getBarCode());

+ 9 - 13
src/main/java/com/jsh/erp/controller/pda/PdaController.java

@@ -74,6 +74,9 @@ public class PdaController extends BaseController {
     @Resource
     private ApkVersionService apkVersionService;
 
+    @Resource
+    private DepotService depotService;
+
     /**
      * 采购入库
      * @return
@@ -135,7 +138,7 @@ public class PdaController extends BaseController {
         } else {
             type = "出库";
         }
-        List<PDADepotItemVO> list = depotItemService.materialDepotDetail(type , materialId);
+        List<PDADepotItemVO> list = depotItemService.materialDepotDetail(type, materialId);
         return getDataTable(list);
     }
 
@@ -247,18 +250,6 @@ public class PdaController extends BaseController {
         return AjaxResult.success(spinnerVOList);
     }
 
-    @ApiOperation("订单-用于返回字段说明")
-    @GetMapping("test")
-    public AjaxResult test(PDADepotItemVO pdaDepotItemVO) {
-        return AjaxResult.success();
-    }
-
-    @ApiOperation("盘点-用于字段返回说明")
-    @GetMapping("taskTest")
-    public AjaxResult taskTest(PDATaskStocktakingVO pdaTaskStocktakingVO){
-        return AjaxResult.success();
-    }
-
     /**
      * PDA订单提交
      */
@@ -294,6 +285,11 @@ public class PdaController extends BaseController {
         return AjaxResult.success(materialCategoryService.getMaterialCategoryTree(null));
     }
 
+    @ApiOperation("仓库下拉框")
+    @GetMapping("/depotSpinnerList")
+    public AjaxResult depotSpinnerList() {
+        return AjaxResult.success(depotService.depotSpinnerList());
+    }
 
     @ApiOperation("下载安装包")
     @PostMapping("/downloadApk")

+ 0 - 3
src/main/java/com/jsh/erp/datasource/entities/DepotHead.java

@@ -139,9 +139,6 @@ public class DepotHead {
     @ApiModelProperty("收货人地址")
     private String receiverAddress;
 
-    @ApiModelProperty("仓库id")
-    private Long depotId;
-
     @ApiModelProperty("操作人")
     private Long operId;
 

+ 2 - 1
src/main/java/com/jsh/erp/datasource/entities/DepotItemVo4WithInfoEx.java

@@ -61,7 +61,6 @@ public class DepotItemVo4WithInfoEx extends DepotItem{
     private String brand;
 
     @ApiModelProperty("生产日期")
-    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private String productionDate;
 
     @ApiModelProperty("保质期天数")
@@ -300,4 +299,6 @@ public class DepotItemVo4WithInfoEx extends DepotItem{
     public void setBrand(String brand) {
         this.brand = brand;
     }
+
+
 }

+ 1 - 1
src/main/java/com/jsh/erp/datasource/entities/TaskStocktaking.java

@@ -43,7 +43,7 @@ public class TaskStocktaking {
     private Integer categoryCount;
 
     @ApiModelProperty("商品数")
-    private int materialCount;
+    private Integer materialCount;
 
     @ApiModelProperty("任务状态 1.未开始,2.进行中,3.已完成,4.已取消,5.已更新")
     private Integer taskStatus;

+ 1 - 1
src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapper.java

@@ -29,7 +29,7 @@ public interface DepotItemMapper  extends BaseMapperX<DepotItem>{
      * @param materialId 商品ID
      * @return
      */
-    List<PDADepotItemVO> materialDepotDetail(@Param("type")String type , @Param("materialId") Long materialId);
+    List<PDADepotItemVO> materialDepotDetail(@Param("type")String type, @Param("materialId") Long materialId);
 
     long countByExample(DepotItemExample example);
 

+ 10 - 1
src/main/java/com/jsh/erp/datasource/mappers/DepotMapper.java

@@ -3,9 +3,18 @@ package com.jsh.erp.datasource.mappers;
 import com.jsh.erp.datasource.entities.Depot;
 import com.jsh.erp.datasource.entities.DepotExample;
 import java.util.List;
+
+import com.jsh.erp.datasource.vo.SpinnerVO;
 import org.apache.ibatis.annotations.Param;
 
-public interface DepotMapper {
+public interface DepotMapper extends BaseMapperX<Depot> {
+
+    /**
+     * 仓库下拉框
+     * @return
+     */
+    List<SpinnerVO> depotSpinnerList();
+
     long countByExample(DepotExample example);
 
     int deleteByExample(DepotExample example);

+ 29 - 334
src/main/java/com/jsh/erp/service/DepotService.java

@@ -1,370 +1,65 @@
 package com.jsh.erp.service;
 
+
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.jsh.erp.constants.BusinessConstants;
-import com.jsh.erp.constants.ExceptionConstants;
-import com.jsh.erp.datasource.entities.*;
-import com.jsh.erp.datasource.mappers.*;
-import com.jsh.erp.exception.BusinessRunTimeException;
-import com.jsh.erp.exception.JshException;
-import com.jsh.erp.utils.PageUtils;
-import com.jsh.erp.utils.StringUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.jsh.erp.datasource.entities.Depot;
+import com.jsh.erp.datasource.entities.DepotEx;
+import com.jsh.erp.datasource.vo.SpinnerVO;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
 
-import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 
-@Service
-public class DepotService {
-    private Logger logger = LoggerFactory.getLogger(DepotService.class);
+public interface DepotService extends IService<Depot> {
 
-    @Resource
-    private DepotMapper depotMapper;
-    @Resource
-    private DepotMapperEx depotMapperEx;
-    @Resource
-    private UserService userService;
-    @Resource
-    private SystemConfigService systemConfigService;
-    @Resource
-    private UserBusinessService userBusinessService;
-    @Resource
-    private LogService logService;
-    @Resource
-    private DepotItemMapperEx depotItemMapperEx;
-    @Resource
-    private MaterialInitialStockMapperEx materialInitialStockMapperEx;
-    @Resource
-    private MaterialCurrentStockMapperEx materialCurrentStockMapperEx;
+    /**
+     * 获取下拉框
+     * @return
+     */
+    List<SpinnerVO> depotSpinnerList();
 
-    public Depot getDepot(long id)throws Exception {
-        Depot result=null;
-        try{
-            result=depotMapper.selectByPrimaryKey(id);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        return result;
-    }
+    Depot getDepot(long id)throws Exception;
 
-    public List<Depot> getDepotListByIds(String ids)throws Exception {
-        List<Long> idList = StringUtil.strToLongList(ids);
-        DepotExample example = new DepotExample();
-        example.createCriteria().andIdIn(idList);
-        return depotMapper.selectByExample(example);
-    }
+    List<Depot> getDepotListByIds(String ids)throws Exception;
 
-    public List<Depot> getDepot()throws Exception {
-        DepotExample example = new DepotExample();
-        example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
-        List<Depot> list=null;
-        try{
-            list=depotMapper.selectByExample(example);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        return list;
-    }
+    List<Depot> getDepot()throws Exception;
 
-    public List<Depot> getAllList()throws Exception {
-        DepotExample example = new DepotExample();
-        example.createCriteria().andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
-        example.setOrderByClause("sort asc, id desc");
-        List<Depot> list=null;
-        try{
-            list=depotMapper.selectByExample(example);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        return list;
-    }
+    List<Depot> getAllList()throws Exception;
 
-    public List<DepotEx> select(String name, Integer type, String remark)throws Exception {
-        List<DepotEx> list=null;
-        try{
-            PageUtils.startPage();
-            list=depotMapperEx.selectByConditionDepot(name, type, remark);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        return list;
-    }
+    List<DepotEx> select(String name, Integer type, String remark)throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int insertDepot(JSONObject obj, HttpServletRequest request)throws Exception {
-        Depot depot = JSONObject.parseObject(obj.toJSONString(), Depot.class);
-        int result=0;
-        try{
-            depot.setType(0);
-            List<Depot> depotList = getDepot();
-            if(depotList.size() == 0) {
-                depot.setIsDefault(true);
-            } else {
-                depot.setIsDefault(false);
-            }
-            depot.setEnabled(true);
-            result=depotMapper.insertSelective(depot);
-            //新增仓库时给当前用户自动授权
-            Long userId = userService.getUserId(request);
-            Long depotId = getIdByName(depot.getName());
-            String ubKey = "[" + depotId + "]";
-            List<UserBusiness> ubList = userBusinessService.getBasicData(userId.toString(), "UserDepot");
-            if(ubList ==null || ubList.size() == 0) {
-                JSONObject ubObj = new JSONObject();
-                ubObj.put("type", "UserDepot");
-                ubObj.put("keyId", userId);
-                ubObj.put("value", ubKey);
-                userBusinessService.insertUserBusiness(ubObj, request);
-            } else {
-                UserBusiness ubInfo = ubList.get(0);
-                JSONObject ubObj = new JSONObject();
-                ubObj.put("id", ubInfo.getId());
-                ubObj.put("type", ubInfo.getType());
-                ubObj.put("keyId", ubInfo.getKeyId());
-                ubObj.put("value", ubInfo.getValue() + ubKey);
-                userBusinessService.updateUserBusiness(ubObj, request);
-            }
-            logService.insertLog("仓库",
-                    new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(depot.getName()).toString(), request);
-        }catch(Exception e){
-            JshException.writeFail(logger, e);
-        }
-        return result;
-    }
+    int insertDepot(JSONObject obj, HttpServletRequest request)throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int updateDepot(JSONObject obj, HttpServletRequest request) throws Exception{
-        Depot depot = JSONObject.parseObject(obj.toJSONString(), Depot.class);
-        int result=0;
-        try{
-            result= depotMapper.updateByPrimaryKeySelective(depot);
-            logService.insertLog("仓库",
-                    new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(depot.getName()).toString(), request);
-        }catch(Exception e){
-            JshException.writeFail(logger, e);
-        }
-        return result;
-    }
+    int updateDepot(JSONObject obj, HttpServletRequest request) throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int deleteDepot(Long id, HttpServletRequest request)throws Exception {
-        return batchDeleteDepotByIds(id.toString());
-    }
+    int deleteDepot(Long id, HttpServletRequest request)throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int batchDeleteDepot(String ids, HttpServletRequest request) throws Exception{
-        return batchDeleteDepotByIds(ids);
-    }
+    int batchDeleteDepot(String ids, HttpServletRequest request) throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int batchDeleteDepotByIds(String ids)throws Exception {
-        int result=0;
-        String [] idArray=ids.split(",");
-        //校验单据子表	jsh_depot_item
-        List<DepotItem> depotItemList = depotItemMapperEx.getDepotItemListListByDepotIds(idArray);
-        if(depotItemList!=null&&depotItemList.size()>0){
-            logger.error("异常码[{}],异常提示[{}],参数,DepotIds[{}]",
-                    ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
-            throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
-                    ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
-        }
-        try{
-            //记录日志
-            StringBuffer sb = new StringBuffer();
-            sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
-            List<Depot> list = getDepotListByIds(ids);
-            for(Depot depot: list){
-                sb.append("[").append(depot.getName()).append("]");
-            }
-            User userInfo=userService.getCurrentUser();
-            //校验通过执行删除操作
-            //删除仓库关联的商品的初始库存
-            materialInitialStockMapperEx.batchDeleteByDepots(idArray);
-            //删除仓库关联的商品的当前库存
-            materialCurrentStockMapperEx.batchDeleteByDepots(idArray);
-            //删除仓库
-            result = depotMapperEx.batchDeleteDepotByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
-            //记录日志
-            logService.insertLog("仓库", sb.toString(),
-                    ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
-        } catch (Exception e) {
-            JshException.writeFail(logger, e);
-        }
-        return result;
-    }
+    int batchDeleteDepotByIds(String ids)throws Exception;
 
-    public int checkIsNameExist(Long id, String name)throws Exception {
-        DepotExample example = new DepotExample();
-        example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
-        List<Depot> list=null;
-        try{
-            list= depotMapper.selectByExample(example);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        return list==null?0:list.size();
-    }
+    int checkIsNameExist(Long id, String name)throws Exception;
 
-    public List<Depot> findUserDepot()throws Exception{
-        DepotExample example = new DepotExample();
-        example.createCriteria().andTypeEqualTo(0).andEnabledEqualTo(true)
-                .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
-        example.setOrderByClause("sort asc, id desc");
-        List<Depot> list=null;
-        try{
-            list= depotMapper.selectByExample(example);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        return list;
-    }
+    List<Depot> findUserDepot()throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int updateIsDefault(Long depotId) throws Exception{
-        int result=0;
-        try{
-            //全部取消默认
-            Depot allDepot = new Depot();
-            allDepot.setIsDefault(false);
-            DepotExample allExample = new DepotExample();
-            allExample.createCriteria();
-            depotMapper.updateByExampleSelective(allDepot, allExample);
-            //给指定仓库设为默认
-            Depot depot = new Depot();
-            depot.setIsDefault(true);
-            DepotExample example = new DepotExample();
-            example.createCriteria().andIdEqualTo(depotId);
-            depotMapper.updateByExampleSelective(depot, example);
-            logService.insertLog("仓库",BusinessConstants.LOG_OPERATION_TYPE_EDIT+depotId,
-                    ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
-            result = 1;
-        }catch(Exception e){
-            JshException.writeFail(logger, e);
-        }
-        return result;
-    }
-
-    /**
-     * 根据名称获取id
-     * @param name
-     */
-    public Long getIdByName(String name){
-        Long id = 0L;
-        DepotExample example = new DepotExample();
-        example.createCriteria().andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
-        List<Depot> list = depotMapper.selectByExample(example);
-        if(list!=null && list.size()>0) {
-            id = list.get(0).getId();
-        }
-        return id;
-    }
+    int updateIsDefault(Long depotId) throws Exception;
 
+    Long getIdByName(String name);
 
-    /**
-     * 解析仓库列表
-     * @param depotId 仓库id
-     * @return 仓库id为空,返回当前用户有权限的仓库,不为空返回仓库id的集合
-     */
-    public List<Long> parseDepotList(Long depotId) throws Exception {
-        List<Long> depotList = new ArrayList<>();
-        if(depotId !=null) {
-            depotList.add(depotId);
-        } else {
-            //未选择仓库时默认为当前用户有权限的仓库
-            JSONArray depotArr = findDepotByCurrentUser();
-            for(Object obj: depotArr) {
-                JSONObject object = JSONObject.parseObject(obj.toString());
-                depotList.add(object.getLong("id"));
-            }
-        }
-        return depotList;
-    }
+    List<Long> parseDepotList(Long depotId) throws Exception;
 
-    public JSONArray findDepotByCurrentUser() throws Exception {
-        JSONArray arr = new JSONArray();
-        String type = "UserDepot";
-        Long userId = userService.getCurrentUser().getId();
-        List<Depot> dataList = findUserDepot();
-        //开始拼接json数据
-        if (null != dataList) {
-            boolean depotFlag = systemConfigService.getDepotFlag();
-            if(depotFlag) {
-                List<UserBusiness> list = userBusinessService.getBasicData(userId.toString(), type);
-                if(list!=null && list.size()>0) {
-                    String depotStr = list.get(0).getValue();
-                    if(StringUtil.isNotEmpty(depotStr)){
-                        depotStr = depotStr.replaceAll("\\[", "").replaceAll("]", ",");
-                        String[] depotArr = depotStr.split(",");
-                        for (Depot depot : dataList) {
-                            for(String depotId: depotArr) {
-                                if(depot.getId() == Long.parseLong(depotId)){
-                                    JSONObject item = new JSONObject();
-                                    item.put("id", depot.getId());
-                                    item.put("depotName", depot.getName());
-                                    item.put("isDefault", depot.getIsDefault());
-                                    arr.add(item);
-                                }
-                            }
-                        }
-                    }
-                }
-            } else {
-                for (Depot depot : dataList) {
-                    JSONObject item = new JSONObject();
-                    item.put("id", depot.getId());
-                    item.put("depotName", depot.getName());
-                    item.put("isDefault", depot.getIsDefault());
-                    arr.add(item);
-                }
-            }
-        }
-        return arr;
-    }
+    JSONArray findDepotByCurrentUser() throws Exception;
 
-    /**
-     * 当前用户有权限使用的仓库列表的id,用逗号隔开
-     * @return
-     * @throws Exception
-     */
-    public String findDepotStrByCurrentUser() throws Exception {
-        JSONArray arr =  findDepotByCurrentUser();
-        StringBuffer sb = new StringBuffer();
-        for(Object object: arr) {
-            JSONObject obj = (JSONObject)object;
-            sb.append(obj.getLong("id")).append(",");
-        }
-        String depotStr = sb.toString();
-        if(StringUtil.isNotEmpty(depotStr)){
-            depotStr = depotStr.substring(0, depotStr.length()-1);
-        }
-        return depotStr;
-    }
+    String findDepotStrByCurrentUser() throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int batchSetStatus(Boolean status, String ids)throws Exception {
-        logService.insertLog("仓库",
-                new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ENABLED).toString(),
-                ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
-        List<Long> depotIds = StringUtil.strToLongList(ids);
-        Depot depot = new Depot();
-        depot.setEnabled(status);
-        DepotExample example = new DepotExample();
-        example.createCriteria().andIdIn(depotIds);
-        int result=0;
-        try{
-            result = depotMapper.updateByExampleSelective(depot, example);
-        }catch(Exception e){
-            JshException.writeFail(logger, e);
-        }
-        return result;
-    }
+    int batchSetStatus(Boolean status, String ids)throws Exception;
 }

+ 1 - 1
src/main/java/com/jsh/erp/service/impl/DepotItemServiceImpl.java

@@ -101,7 +101,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
      */
     @Override
     public List<PDADepotItemVO> materialDepotDetail(String type , Long materialId) {
-        return depotItemMapper.materialDepotDetail(type , materialId);
+        return depotItemMapper.materialDepotDetail(type, materialId);
     }
 
     @Override

+ 396 - 0
src/main/java/com/jsh/erp/service/impl/DepotServiceImpl.java

@@ -0,0 +1,396 @@
+package com.jsh.erp.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jsh.erp.constants.BusinessConstants;
+import com.jsh.erp.constants.ExceptionConstants;
+import com.jsh.erp.datasource.entities.*;
+import com.jsh.erp.datasource.mappers.*;
+import com.jsh.erp.datasource.vo.SpinnerVO;
+import com.jsh.erp.exception.BusinessRunTimeException;
+import com.jsh.erp.exception.JshException;
+import com.jsh.erp.service.*;
+import com.jsh.erp.utils.PageUtils;
+import com.jsh.erp.utils.StringUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@Service
+public class DepotServiceImpl extends ServiceImpl<DepotMapper, Depot> implements DepotService {
+    private Logger logger = LoggerFactory.getLogger(DepotService.class);
+
+    @Resource
+    private DepotMapper depotMapper;
+    @Resource
+    private DepotMapperEx depotMapperEx;
+    @Resource
+    private UserService userService;
+    @Resource
+    private SystemConfigService systemConfigService;
+    @Resource
+    private UserBusinessService userBusinessService;
+    @Resource
+    private LogService logService;
+    @Resource
+    private DepotItemMapperEx depotItemMapperEx;
+    @Resource
+    private MaterialInitialStockMapperEx materialInitialStockMapperEx;
+    @Resource
+    private MaterialCurrentStockMapperEx materialCurrentStockMapperEx;
+
+    @Override
+    public List<SpinnerVO> depotSpinnerList() {
+        return depotMapper.depotSpinnerList();
+    }
+
+    @Override
+    public Depot getDepot(long id)throws Exception {
+        Depot result=null;
+        try{
+            result=depotMapper.selectByPrimaryKey(id);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        return result;
+    }
+
+    @Override
+    public List<Depot> getDepotListByIds(String ids)throws Exception {
+        List<Long> idList = StringUtil.strToLongList(ids);
+        DepotExample example = new DepotExample();
+        example.createCriteria().andIdIn(idList);
+        return depotMapper.selectByExample(example);
+    }
+
+    @Override
+    public List<Depot> getDepot()throws Exception {
+        DepotExample example = new DepotExample();
+        example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+        List<Depot> list=null;
+        try{
+            list=depotMapper.selectByExample(example);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        return list;
+    }
+
+    @Override
+    public List<Depot> getAllList()throws Exception {
+        DepotExample example = new DepotExample();
+        example.createCriteria().andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+        example.setOrderByClause("sort asc, id desc");
+        List<Depot> list=null;
+        try{
+            list=depotMapper.selectByExample(example);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        return list;
+    }
+
+    @Override
+    public List<DepotEx> select(String name, Integer type, String remark)throws Exception {
+        List<DepotEx> list=null;
+        try{
+            PageUtils.startPage();
+            list=depotMapperEx.selectByConditionDepot(name, type, remark);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        return list;
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public int insertDepot(JSONObject obj, HttpServletRequest request)throws Exception {
+        Depot depot = JSONObject.parseObject(obj.toJSONString(), Depot.class);
+        int result=0;
+        try{
+            depot.setType(0);
+            List<Depot> depotList = getDepot();
+            if(depotList.size() == 0) {
+                depot.setIsDefault(true);
+            } else {
+                depot.setIsDefault(false);
+            }
+            depot.setEnabled(true);
+            result=depotMapper.insertSelective(depot);
+            //新增仓库时给当前用户自动授权
+            Long userId = userService.getUserId(request);
+            Long depotId = getIdByName(depot.getName());
+            String ubKey = "[" + depotId + "]";
+            List<UserBusiness> ubList = userBusinessService.getBasicData(userId.toString(), "UserDepot");
+            if(ubList ==null || ubList.size() == 0) {
+                JSONObject ubObj = new JSONObject();
+                ubObj.put("type", "UserDepot");
+                ubObj.put("keyId", userId);
+                ubObj.put("value", ubKey);
+                userBusinessService.insertUserBusiness(ubObj, request);
+            } else {
+                UserBusiness ubInfo = ubList.get(0);
+                JSONObject ubObj = new JSONObject();
+                ubObj.put("id", ubInfo.getId());
+                ubObj.put("type", ubInfo.getType());
+                ubObj.put("keyId", ubInfo.getKeyId());
+                ubObj.put("value", ubInfo.getValue() + ubKey);
+                userBusinessService.updateUserBusiness(ubObj, request);
+            }
+            logService.insertLog("仓库",
+                    new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(depot.getName()).toString(), request);
+        }catch(Exception e){
+            JshException.writeFail(logger, e);
+        }
+        return result;
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public int updateDepot(JSONObject obj, HttpServletRequest request) throws Exception{
+        Depot depot = JSONObject.parseObject(obj.toJSONString(), Depot.class);
+        int result=0;
+        try{
+            result= depotMapper.updateByPrimaryKeySelective(depot);
+            logService.insertLog("仓库",
+                    new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(depot.getName()).toString(), request);
+        }catch(Exception e){
+            JshException.writeFail(logger, e);
+        }
+        return result;
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public int deleteDepot(Long id, HttpServletRequest request)throws Exception {
+        return batchDeleteDepotByIds(id.toString());
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public int batchDeleteDepot(String ids, HttpServletRequest request) throws Exception{
+        return batchDeleteDepotByIds(ids);
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public int batchDeleteDepotByIds(String ids)throws Exception {
+        int result=0;
+        String [] idArray=ids.split(",");
+        //校验单据子表	jsh_depot_item
+        List<DepotItem> depotItemList = depotItemMapperEx.getDepotItemListListByDepotIds(idArray);
+        if(depotItemList!=null&&depotItemList.size()>0){
+            logger.error("异常码[{}],异常提示[{}],参数,DepotIds[{}]",
+                    ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
+            throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
+                    ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
+        }
+        try{
+            //记录日志
+            StringBuffer sb = new StringBuffer();
+            sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
+            List<Depot> list = getDepotListByIds(ids);
+            for(Depot depot: list){
+                sb.append("[").append(depot.getName()).append("]");
+            }
+            User userInfo=userService.getCurrentUser();
+            //校验通过执行删除操作
+            //删除仓库关联的商品的初始库存
+            materialInitialStockMapperEx.batchDeleteByDepots(idArray);
+            //删除仓库关联的商品的当前库存
+            materialCurrentStockMapperEx.batchDeleteByDepots(idArray);
+            //删除仓库
+            result = depotMapperEx.batchDeleteDepotByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
+            //记录日志
+            logService.insertLog("仓库", sb.toString(),
+                    ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
+        } catch (Exception e) {
+            JshException.writeFail(logger, e);
+        }
+        return result;
+    }
+
+    @Override
+    public int checkIsNameExist(Long id, String name)throws Exception {
+        DepotExample example = new DepotExample();
+        example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+        List<Depot> list=null;
+        try{
+            list= depotMapper.selectByExample(example);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        return list==null?0:list.size();
+    }
+
+    @Override
+    public List<Depot> findUserDepot()throws Exception{
+        DepotExample example = new DepotExample();
+        example.createCriteria().andTypeEqualTo(0).andEnabledEqualTo(true)
+                .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+        example.setOrderByClause("sort asc, id desc");
+        List<Depot> list=null;
+        try{
+            list= depotMapper.selectByExample(example);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        return list;
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public int updateIsDefault(Long depotId) throws Exception{
+        int result=0;
+        try{
+            //全部取消默认
+            Depot allDepot = new Depot();
+            allDepot.setIsDefault(false);
+            DepotExample allExample = new DepotExample();
+            allExample.createCriteria();
+            depotMapper.updateByExampleSelective(allDepot, allExample);
+            //给指定仓库设为默认
+            Depot depot = new Depot();
+            depot.setIsDefault(true);
+            DepotExample example = new DepotExample();
+            example.createCriteria().andIdEqualTo(depotId);
+            depotMapper.updateByExampleSelective(depot, example);
+            logService.insertLog("仓库",BusinessConstants.LOG_OPERATION_TYPE_EDIT+depotId,
+                    ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
+            result = 1;
+        }catch(Exception e){
+            JshException.writeFail(logger, e);
+        }
+        return result;
+    }
+
+    /**
+     * 根据名称获取id
+     * @param name
+     */
+    @Override
+    public Long getIdByName(String name){
+        Long id = 0L;
+        DepotExample example = new DepotExample();
+        example.createCriteria().andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+        List<Depot> list = depotMapper.selectByExample(example);
+        if(list!=null && list.size()>0) {
+            id = list.get(0).getId();
+        }
+        return id;
+    }
+
+
+    /**
+     * 解析仓库列表
+     * @param depotId 仓库id
+     * @return 仓库id为空,返回当前用户有权限的仓库,不为空返回仓库id的集合
+     */
+    @Override
+    public List<Long> parseDepotList(Long depotId) throws Exception {
+        List<Long> depotList = new ArrayList<>();
+        if(depotId !=null) {
+            depotList.add(depotId);
+        } else {
+            //未选择仓库时默认为当前用户有权限的仓库
+            JSONArray depotArr = findDepotByCurrentUser();
+            for(Object obj: depotArr) {
+                JSONObject object = JSONObject.parseObject(obj.toString());
+                depotList.add(object.getLong("id"));
+            }
+        }
+        return depotList;
+    }
+
+    @Override
+    public JSONArray findDepotByCurrentUser() throws Exception {
+        JSONArray arr = new JSONArray();
+        String type = "UserDepot";
+        Long userId = userService.getCurrentUser().getId();
+        List<Depot> dataList = findUserDepot();
+        //开始拼接json数据
+        if (null != dataList) {
+            boolean depotFlag = systemConfigService.getDepotFlag();
+            if(depotFlag) {
+                List<UserBusiness> list = userBusinessService.getBasicData(userId.toString(), type);
+                if(list!=null && list.size()>0) {
+                    String depotStr = list.get(0).getValue();
+                    if(StringUtil.isNotEmpty(depotStr)){
+                        depotStr = depotStr.replaceAll("\\[", "").replaceAll("]", ",");
+                        String[] depotArr = depotStr.split(",");
+                        for (Depot depot : dataList) {
+                            for(String depotId: depotArr) {
+                                if(depot.getId() == Long.parseLong(depotId)){
+                                    JSONObject item = new JSONObject();
+                                    item.put("id", depot.getId());
+                                    item.put("depotName", depot.getName());
+                                    item.put("isDefault", depot.getIsDefault());
+                                    arr.add(item);
+                                }
+                            }
+                        }
+                    }
+                }
+            } else {
+                for (Depot depot : dataList) {
+                    JSONObject item = new JSONObject();
+                    item.put("id", depot.getId());
+                    item.put("depotName", depot.getName());
+                    item.put("isDefault", depot.getIsDefault());
+                    arr.add(item);
+                }
+            }
+        }
+        return arr;
+    }
+
+    /**
+     * 当前用户有权限使用的仓库列表的id,用逗号隔开
+     * @return
+     * @throws Exception
+     */
+    @Override
+    public String findDepotStrByCurrentUser() throws Exception {
+        JSONArray arr =  findDepotByCurrentUser();
+        StringBuffer sb = new StringBuffer();
+        for(Object object: arr) {
+            JSONObject obj = (JSONObject)object;
+            sb.append(obj.getLong("id")).append(",");
+        }
+        String depotStr = sb.toString();
+        if(StringUtil.isNotEmpty(depotStr)){
+            depotStr = depotStr.substring(0, depotStr.length()-1);
+        }
+        return depotStr;
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public int batchSetStatus(Boolean status, String ids)throws Exception {
+        logService.insertLog("仓库",
+                new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ENABLED).toString(),
+                ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
+        List<Long> depotIds = StringUtil.strToLongList(ids);
+        Depot depot = new Depot();
+        depot.setEnabled(status);
+        DepotExample example = new DepotExample();
+        example.createCriteria().andIdIn(depotIds);
+        int result=0;
+        try{
+            result = depotMapper.updateByExampleSelective(depot, example);
+        }catch(Exception e){
+            JshException.writeFail(logger, e);
+        }
+        return result;
+    }
+}

+ 20 - 2
src/main/resources/mapper_xml/DepotHeadMapper.xml

@@ -277,7 +277,13 @@
         receiver_phone,
       </if>
       <if test="receiverAddress != null">
-        receiver_address
+        receiver_address,
+      </if>
+      <if test="depotId != null">
+        depot_id,
+      </if>
+      <if test="operId != null">
+        oper_id
       </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -398,6 +404,12 @@
       <if test="receiverAddress != null">
         #{receiverAddress,jdbcType=VARCHAR},
       </if>
+      <if test="depotId != null">
+        #{depotId,jdbcType=INTEGER},
+      </if>
+      <if test="operId != null">
+        #{operId,jdbcType=INTEGER}
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultType="java.lang.Long">
@@ -693,6 +705,12 @@
       <if test="receiverAddress != null">
         receiver_address = #{receiverAddress,jdbcType=VARCHAR},
       </if>
+      <if test="depotId != null">
+        depot_id = #{receiverAddress,jdbcType=VARCHAR},
+      </if>
+      <if test="operId != null">
+        oper_id = #{receiverAddress,jdbcType=VARCHAR}
+      </if>
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
@@ -783,7 +801,7 @@
     FROM
       jsh_depot_head dh
       LEFT JOIN jsh_supplier s ON dh.organ_id = s.id
-      LEFT JOIN jsh
+      LEFT JOIN jsh_
     WHERE
       dh.id = #{id}
   </select>

+ 10 - 0
src/main/resources/mapper_xml/DepotMapper.xml

@@ -335,4 +335,14 @@
       is_default = #{isDefault,jdbcType=BIT}
     where id = #{id,jdbcType=BIGINT}
   </update>
+
+  <select id="depotSpinnerList" resultType="com.jsh.erp.datasource.vo.SpinnerVO">
+    SELECT
+      id AS value,
+      bane AS label
+    FROM
+      jsh_depot
+    WHERE
+      delete_Flag = '0'
+  </select>
 </mapper>

+ 2 - 2
src/main/resources/mapper_xml/MaterialMapperEx.xml

@@ -792,7 +792,7 @@
     </select>
 
     <select id="getMaterialByBatchNumber" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultType="com.jsh.erp.datasource.entities.MaterialVo4Unit">
-        select m.*,u.name unit_name, me.id meId, me.commodity_unit, me.purchase_decimal, me.commodity_decimal,
+        select m.*,u.name unit_name, me.id meId, me.commodity_unit, me.purchase_decimal, me.commodity_decimal,me.inventory,
         me.wholesale_decimal, me.low_decimal, me.sku,me.production_date, me.expiry_num, me.supplier_id, me.bar_code, me.batch_number, me.depot_id, me.position,d.`name` depotName,s.supplier supplierName
         from jsh_material m
         left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
@@ -851,7 +851,7 @@
 
     <select id="inventoryInquiry" parameterType="com.jsh.erp.datasource.pda.dto.PDAInventoryDTO" resultType="com.jsh.erp.datasource.pda.vo.PDADepotItemVO">
         select m.id materialId,m.name materialName,m.standard materialStandard,u.name unit_name,mc.name categoryName,me.bar_code,me.id meId,me.commodity_unit,me.sku,
-        me.production_date,me.expiry_num,me.supplier_id,me.batch_number,me.depot_id,me.position,d.`name` depotName,s.supplier supplierName
+        me.production_date,me.expiry_num,me.supplier_id,me.batch_number,me.depot_id,me.position,d.`name` depotName,s.supplier supplierName,m.img_name
         from jsh_material m
         left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
         left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'