Parcourir la source

Merge remote-tracking branch 'refs/remotes/origin/master' into master_liushuang

ms-blue il y a 1 mois
Parent
commit
20d7ac8ed2
52 fichiers modifiés avec 2133 ajouts et 1091 suppressions
  1. 1 1
      jshERP-web/package.json
  2. 4 1
      jshERP-web/src/api/api.js
  3. 66 34
      jshERP-web/src/components/jeecg/JEditableTable.vue
  4. 1 1
      jshERP-web/src/views/bill/OtherInList.vue
  5. 228 123
      jshERP-web/src/views/bill/dialog/BillDetail.vue
  6. 30 4
      jshERP-web/src/views/bill/mixins/BillModalMixin.js
  7. 33 14
      jshERP-web/src/views/bill/modules/AllocationOutModal.vue
  8. 34 2
      jshERP-web/src/views/bill/modules/OtherInModal.vue
  9. 34 2
      jshERP-web/src/views/bill/modules/OtherOutModal.vue
  10. 35 3
      jshERP-web/src/views/bill/modules/PurchaseInModal.vue
  11. 64 3
      jshERP-web/src/views/bill/modules/PurchaseOrderModal.vue
  12. 70 6
      jshERP-web/src/views/bill/modules/SaleOrderModal.vue
  13. 34 12
      jshERP-web/src/views/bill/modules/SaleOutModal.vue
  14. 31 2
      jshERP-web/src/views/dashboard/Analysis.vue
  15. 13 6
      jshERP-web/src/views/dashboard/dialog/SysTipModal.vue
  16. 0 1
      jshERP-web/src/views/material/mixins/MaterialModalMixins.js
  17. 2 2
      jshERP-web/src/views/material/modules/MaterialCategoryModal.vue
  18. 85 72
      jshERP-web/src/views/material/modules/MaterialModal.vue
  19. 13 0
      pom.xml
  20. 1 1
      src/main/java/com/jsh/erp/base/AjaxResult.java
  21. 86 0
      src/main/java/com/jsh/erp/controller/pda/PdaController.java
  22. 16 0
      src/main/java/com/jsh/erp/datasource/entities/DepotHead.java
  23. 2 0
      src/main/java/com/jsh/erp/datasource/entities/DepotItem.java
  24. 5 0
      src/main/java/com/jsh/erp/datasource/entities/Log.java
  25. 2 0
      src/main/java/com/jsh/erp/datasource/entities/Material.java
  26. 4 16
      src/main/java/com/jsh/erp/datasource/entities/MaterialWithInitStock.java
  27. 8 5
      src/main/java/com/jsh/erp/datasource/entities/Supplier.java
  28. 9 0
      src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapper.java
  29. 10 0
      src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapper.java
  30. 0 1
      src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java
  31. 1 1
      src/main/java/com/jsh/erp/datasource/mappers/SupplierMapper.java
  32. 23 0
      src/main/java/com/jsh/erp/datasource/pda/dto/PDADepotHeadDTO.java
  33. 32 0
      src/main/java/com/jsh/erp/datasource/pda/vo/PDADepotHeadVO.java
  34. 43 0
      src/main/java/com/jsh/erp/datasource/pda/vo/PDADepotItemVO.java
  35. 0 22
      src/main/java/com/jsh/erp/datasource/vo/MaterialVo.java
  36. 2 0
      src/main/java/com/jsh/erp/filter/LogCostFilter.java
  37. 12 1
      src/main/java/com/jsh/erp/service/DepotHeadService.java
  38. 10 1
      src/main/java/com/jsh/erp/service/DepotItemService.java
  39. 2 1
      src/main/java/com/jsh/erp/service/LogService.java
  40. 1 0
      src/main/java/com/jsh/erp/service/MaterialService.java
  41. 59 684
      src/main/java/com/jsh/erp/service/SupplierService.java
  42. 43 0
      src/main/java/com/jsh/erp/service/impl/DepotHeadServiceImpl.java
  43. 10 0
      src/main/java/com/jsh/erp/service/impl/DepotItemServiceImpl.java
  44. 0 2
      src/main/java/com/jsh/erp/service/impl/MaterialServiceImpl.java
  45. 751 0
      src/main/java/com/jsh/erp/service/impl/SupplierServiceImpl.java
  46. 60 0
      src/main/java/com/jsh/erp/util/QRCodeGenerator.java
  47. 31 0
      src/main/java/com/jsh/erp/utils/OssUtils.java
  48. 55 0
      src/main/resources/mapper_xml/DepotHeadMapper.xml
  49. 28 28
      src/main/resources/mapper_xml/DepotHeadMapperEx.xml
  50. 21 0
      src/main/resources/mapper_xml/DepotItemMapper.xml
  51. 19 19
      src/main/resources/mapper_xml/DepotItemMapperEx.xml
  52. 9 20
      src/main/resources/mapper_xml/MaterialMapperEx.xml

+ 1 - 1
jshERP-web/package.json

@@ -36,6 +36,7 @@
     "vue-ls": "^3.2.0",
     "vue-photo-preview": "^1.1.3",
     "vue-print-nb-jeecg": "^1.0.9",
+    "vue-qr": "^4.0.9",
     "vue-router": "^3.0.1",
     "vue-splitpane": "^1.0.4",
     "vuedraggable": "^2.20.0",
@@ -114,4 +115,3 @@
     "not ie <= 10"
   ]
 }
-

+ 4 - 1
jshERP-web/src/api/api.js

@@ -3,6 +3,8 @@ import { getAction, deleteAction, putAction, postAction, httpAction } from '@/ap
 //首页统计
 const getBuyAndSaleStatistics = (params) => getAction('/depotHead/getBuyAndSaleStatistics', params)
 const buyOrSalePrice = (params) => getAction('/depotItem/buyOrSalePrice', params)
+const getMaterialWarn = (params) => getAction('/material/getMaterialWarn', params)
+
 //租户管理
 const checkTenant = (params) => getAction('/tenant/checkIsNameExist', params)
 const addTenant = (params) => postAction('/tenant/add', params)
@@ -100,7 +102,7 @@ const addUnit = (params) => postAction('/unit/add', params)
 const editUnit = (params) => putAction('/unit/update', params)
 const checkUnit = (params) => getAction('/unit/checkIsNameExist', params)
 // 根据id获取信息
-const getUnitInfo = (params) => getAction('/unit/info', params)
+const getUnitInfo = (params) => getAction('/unit/getUnitListByID', params)
 
 //供应商|客户|会员
 const addSupplier = (params) => postAction('/supplier/add', params)
@@ -121,6 +123,7 @@ const findFinancialDetailByNumber = (params) => getAction('/accountHead/getDetai
 export {
   getBuyAndSaleStatistics,
   buyOrSalePrice,
+  getMaterialWarn,
   checkTenant,
   addTenant,
   editTenant,

+ 66 - 34
jshERP-web/src/components/jeecg/JEditableTable.vue

@@ -253,16 +253,15 @@
                             @search="(v) => handleSearchSelect(v, id, row, col)"
                             @blur="(v) => handleBlurSearch(v, id, row, col)"
                             @focus="(v) => handleFocusSearch(v, id, row, col)"
-                            allowClear
                           >
                             <div slot="dropdownRender" slot-scope="menu">
                               <v-nodes :vnodes="menu" />
                               <slot name="depotAdd" v-if="col.key === 'depotId'" :target="getVM()" />
                               <slot name="inOutItemAdd" v-if="col.key === 'inOutItemId'" :target="getVM()" />
                             </div>
-                            <!--<template v-for="(opt,optKey) in col.options">-->
-                            <!--<a-select-option :value="opt.value" :key="optKey">{{ opt.title }}</a-select-option>-->
-                            <!--</template>-->
+                            <!-- <template v-for="(opt, optKey) in col.options">
+                              <a-select-option :value="opt.value" :key="optKey">{{ opt.title }}</a-select-option>
+                            </template> -->
                           </a-select>
                         </span>
                       </a-tooltip>
@@ -482,36 +481,37 @@
 
                     <!-- update-begin-author:jsh date:20210308 for:popupJsh -->
                     <template v-else-if="col.type === formTypes.popupJsh">
-                      <a-tooltip
-                        :key="i"
-                        :id="id"
-                        placement="top"
-                        :title="(tooltips[id] || {}).title"
-                        :visible="(tooltips[id] || {}).visible || false"
-                        :autoAdjustOverflow="true"
-                        :getPopupContainer="getParentContainer"
-                      >
-                        <span
-                          @mouseover="
-                            () => {
-                              handleMouseoverCommono(row, col)
-                            }
-                          "
-                          @mouseout="
-                            () => {
-                              handleMouseoutCommono(row, col)
-                            }
-                          "
+                      <div style="max-width: 200px" :key="i">
+                        <a-tooltip
+                          :id="id"
+                          placement="top"
+                          :title="(tooltips[id] || {}).title"
+                          :visible="(tooltips[id] || {}).visible || false"
+                          :autoAdjustOverflow="true"
+                          :getPopupContainer="getParentContainer"
                         >
-                          <j-select-list
-                            :rows="getPopupJshRows(row)"
-                            :kind="col.kind"
-                            :multi="col.multi"
-                            :value="getPopupJshValue(id)"
-                            @change="(v) => handleChangePopupJshCommon(v, id, row, col, rowIndex)"
-                          />
-                        </span>
-                      </a-tooltip>
+                          <span
+                            @mouseover="
+                              () => {
+                                handleMouseoverCommono(row, col)
+                              }
+                            "
+                            @mouseout="
+                              () => {
+                                handleMouseoutCommono(row, col)
+                              }
+                            "
+                          >
+                            <j-select-list
+                              :rows="getPopupJshRows(row)"
+                              :kind="col.kind"
+                              :multi="col.multi"
+                              :value="getPopupJshValue(id)"
+                              @change="(v) => handleChangePopupJshCommon(v, id, row, col, rowIndex)"
+                            />
+                          </span>
+                        </a-tooltip>
+                      </div>
                     </template>
                     <!-- update-end-author:jsh date:20210308 for:popupJsh -->
 
@@ -878,6 +878,7 @@
                             :allValues="_getAllValuesForSlot()"
                             :target="getVM()"
                             :handleChange="(v) => handleChangeSlotCommon(v, id, row, col)"
+                            :handleFocus="(v) => handleFocusSlotCommon(v, id, row, col)"
                             :isNotPass="notPassedIds.includes(col.key + row.id)"
                           />
                         </span>
@@ -945,11 +946,13 @@ import { getFileAccessHttpUrl } from '@/api/manage'
 import JInputPop from '@/components/jeecg/minipop/JInputPop'
 import JFilePop from '@/components/jeecg/minipop/JFilePop'
 import JSelectList from '@/components/jeecgbiz/JSelectList'
+import { BillModalMixin } from '../../../src/views/bill/mixins/BillModalMixin'
 
 // 行高,需要在实例加载完成前用到
 let rowHeight = 42
 
 export default {
+  mixins: [BillModalMixin],
   name: 'JEditableTable',
   components: {
     JDate,
@@ -1403,7 +1406,7 @@ export default {
         let disabled = false
         this.columns.forEach((column) => {
           let inputId = column.key + value.id
-          let sourceValue = (data[column.key] == null ? '' : data[column.key]).toString()
+          let sourceValue = data[column.key] == null ? '' : data[column.key]
 
           let defaultValue = null
           if (setDefaultValue) {
@@ -2509,6 +2512,35 @@ export default {
       // 触发valueChange 事件
       this.elemValueChange(FormTypes.slot, row, column, value)
     },
+    handleFocusSlotCommon(value, id, row, column) {
+      // this.slotValues = this.bindValuesChange(value, id, 'slotValues')
+      // // 做单个表单验证
+      this.validateOneInput(value, row, column, this.notPassedIds, true, 'focus')
+      // // 触发valueChange 事件
+      this.elemFocusChange(FormTypes.slot, row, column, value)
+    },
+    //获取焦点时触发
+    elemFocusChange(type, rowSource, columnSource, value) {
+      let unitList = []
+      let column = Object.assign({}, columnSource)
+      // 将caseId去除
+      let row = Object.assign({}, rowSource)
+      row.id = this.getCleanId(row.id)
+      // 获取整行的数据
+      let { values } = this.getValuesSync({ validate: false, rowIds: [row.id] })
+      if (values.length > 0) {
+        Object.assign(row, values[0])
+      }
+      if (!row.unitId) {
+        unitList = []
+      }
+      let arr = row.unitList
+      if (arr && !Array.isArray(arr)) {
+        unitList = JSON.parse(arr)
+      }
+      column.options = unitList
+      this.$emit('focusChange', unitList)
+    },
     handleBlurCommono(target, index, row, column) {
       let { value, dataset } = target
       if (dataset && `${dataset.inputNumber}` === 'true') {

+ 1 - 1
jshERP-web/src/views/bill/OtherInList.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">
           <!-- 搜索区域 -->

+ 228 - 123
jshERP-web/src/views/bill/dialog/BillDetail.vue

@@ -434,7 +434,11 @@
                 {{ model.changeAmount }}
               </a-form-item>
             </a-col>
-            <a-col :span="6"></a-col>
+            <a-col :lg="6" :md="12" :sm="24">
+              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="二维码">
+                <vue-qr :text="model.number" :size="200" />
+              </a-form-item>
+            </a-col>
             <a-col :span="6"></a-col>
           </a-row>
         </section>
@@ -788,7 +792,11 @@
                 {{ model.changeAmount }}
               </a-form-item>
             </a-col>
-            <a-col :span="6"></a-col>
+            <a-col :lg="6" :md="12" :sm="24">
+              <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="二维码">
+                <vue-qr :text="model.number" :size="200" />
+              </a-form-item>
+            </a-col>
             <a-col :span="6"></a-col>
           </a-row>
         </section>
@@ -1474,7 +1482,8 @@ import FinancialDetail from '../../financial/dialog/FinancialDetail'
 import JUpload from '@/components/jeecg/JUpload'
 import Vue from 'vue'
 import { JeecgListMixin } from '@/mixins/JeecgListMixin'
-
+// import QrcodeVue from 'qrcode.vue'
+import VueQr from 'vue-qr'
 export default {
   name: 'BillDetail',
   mixins: [JeecgListMixin],
@@ -1482,6 +1491,8 @@ export default {
     BillPrintIframe,
     FinancialDetail,
     JUpload,
+    // QrcodeVue,
+    VueQr,
   },
   data() {
     return {
@@ -1588,29 +1599,48 @@ export default {
         { title: '备注', dataIndex: 'remark' },
       ],
       purchaseOrderColumns: [
-        { title: '条码', dataIndex: 'barCode' },
-        { title: '名称', dataIndex: 'name' },
-        { title: '规格', dataIndex: 'standard' },
-        { title: '型号', dataIndex: 'model' },
-        { title: '颜色', dataIndex: 'color' },
-        { title: '品牌', dataIndex: 'brand' },
-        { title: '制造商', dataIndex: 'mfrs' },
-        { title: '扩展信息', dataIndex: 'materialOther' },
-        { title: '库存', dataIndex: 'stock' },
-        { title: '单位', dataIndex: 'unit' },
-        { title: '多属性', dataIndex: 'sku' },
-        { title: '数量', dataIndex: 'operNumber' },
-        { title: '已采购', dataIndex: 'finishNumber' },
-        { title: '单价', dataIndex: 'unitPrice' },
-        { title: '金额', dataIndex: 'allPrice' },
-        { title: '税率(%)', dataIndex: 'taxRate' },
-        { title: '税额', dataIndex: 'taxMoney' },
-        { title: '价税合计', dataIndex: 'taxLastMoney' },
-        { title: '备注', dataIndex: 'remark' },
+        { title: '批次号', dataIndex: 'batchNumber', width: 90 },
+        { title: '名称', dataIndex: 'name', width: 115 },
+        { title: '规格', dataIndex: 'standard', width: 90 },
+
+        { title: '生产日期', dataIndex: 'productionDate', width: 100 },
+        { title: '保质期', dataIndex: 'expiryNum', width: 60 },
+        { title: '商品条码', dataIndex: 'barCode', width: 90 },
+        { title: '仓库名称', dataIndex: 'depotName', width: 90 },
+        { title: '仓库货架', dataIndex: 'position', width: 90 },
+        { title: '包装规格', dataIndex: 'unitName', width: 90 },
+
+        { title: '型号', dataIndex: 'model', width: 60 },
+        { title: '颜色', dataIndex: 'color', width: 60 },
+        { title: '品牌', dataIndex: 'brand', width: 90 },
+        { title: '制造商', dataIndex: 'mfrs', width: 90 },
+        { title: '扩展信息', dataIndex: 'materialOther', width: 90 },
+        { title: '库存', dataIndex: 'stock', width: 90 },
+        { title: '单位', dataIndex: 'unit', width: 90 },
+        { title: '序列号', dataIndex: 'snList', width: 300 },
+        { title: '有效期', dataIndex: 'expirationDate', width: 90 },
+        { title: '多属性', dataIndex: 'sku', width: 90 },
+        { title: '数量', dataIndex: 'operNumber', width: 90 },
+        { title: '已入库', dataIndex: 'finishNumber', width: 90 },
+        { title: '单价', dataIndex: 'unitPrice', width: 90 },
+        { title: '金额', dataIndex: 'allPrice', width: 90 },
+        { title: '税率(%)', dataIndex: 'taxRate', width: 90 },
+        { title: '税额', dataIndex: 'taxMoney', width: 90 },
+        { title: '价税合计', dataIndex: 'taxLastMoney', width: 90 },
+
+        { title: '实际入库数量', dataIndex: 'actualQuantityInStorage', width: 115 },
+        { title: '入库差异', dataIndex: 'warehousingVariance', width: 90 },
+        { title: '入库差异原因', dataIndex: 'reasonOfDifference', width: 115 },
+        { title: '入库人', dataIndex: 'warehousingUser', width: 90 },
+        { title: '入库时间', dataIndex: 'warehousingTime', width: 90 },
+
+        { title: '重量', dataIndex: 'weight', width: 90 },
+        { title: '仓位货架', dataIndex: 'position', width: 90 },
+        { title: '备注', dataIndex: 'remark', width: 90 },
       ],
       purchaseInColumns: [
         { title: '批次号', dataIndex: 'batchNumber', width: 90 },
-        { title: '名称', dataIndex: 'name', width: 90 },
+        { title: '名称', dataIndex: 'name', width: 115 },
         { title: '规格', dataIndex: 'standard', width: 90 },
 
         { title: '生产日期', dataIndex: 'productionDate', width: 100 },
@@ -1676,52 +1706,86 @@ export default {
         { title: '备注', dataIndex: 'remark' },
       ],
       saleOrderColumns: [
-        { title: '条码', dataIndex: 'barCode' },
-        { title: '名称', dataIndex: 'name' },
-        { title: '规格', dataIndex: 'standard' },
-        { title: '型号', dataIndex: 'model' },
-        { title: '颜色', dataIndex: 'color' },
-        { title: '品牌', dataIndex: 'brand' },
-        { title: '制造商', dataIndex: 'mfrs' },
-        { title: '扩展信息', dataIndex: 'materialOther' },
-        { title: '库存', dataIndex: 'stock' },
-        { title: '单位', dataIndex: 'unit' },
-        { title: '多属性', dataIndex: 'sku' },
-        { title: '数量', dataIndex: 'operNumber' },
-        { title: '已销售', dataIndex: 'finishNumber' },
-        { title: '单价', dataIndex: 'unitPrice' },
-        { title: '金额', dataIndex: 'allPrice' },
-        { title: '税率(%)', dataIndex: 'taxRate' },
-        { title: '税额', dataIndex: 'taxMoney' },
-        { title: '价税合计', dataIndex: 'taxLastMoney' },
-        { title: '备注', dataIndex: 'remark' },
+        { title: '批次号', dataIndex: 'batchNumber', width: 90 },
+        { title: '名称', dataIndex: 'name', width: 115 },
+        { title: '规格', dataIndex: 'standard', width: 90 },
+
+        { title: '生产日期', dataIndex: 'productionDate', width: 100 },
+        { title: '保质期', dataIndex: 'expiryNum', width: 60 },
+        { title: '商品条码', dataIndex: 'barCode', width: 90 },
+        { title: '仓库名称', dataIndex: 'depotName', width: 90 },
+        { title: '仓库货架', dataIndex: 'position', width: 90 },
+        { title: '包装规格', dataIndex: 'unitName', width: 90 },
+
+        { title: '规格', dataIndex: 'standard', width: 60 },
+        { title: '型号', dataIndex: 'model', width: 60 },
+        { title: '颜色', dataIndex: 'color', width: 60 },
+        { title: '品牌', dataIndex: 'brand', width: 90 },
+        { title: '制造商', dataIndex: 'mfrs', width: 90 },
+        { title: '扩展信息', dataIndex: 'materialOther', width: 90 },
+        { title: '库存', dataIndex: 'stock', width: 90 },
+        { title: '单位', dataIndex: 'unit', width: 90 },
+        { title: '序列号', dataIndex: 'snList', width: 300 },
+        { title: '有效期', dataIndex: 'expirationDate', width: 90 },
+        { title: '多属性', dataIndex: 'sku', width: 90 },
+        { title: '数量', dataIndex: 'operNumber', width: 90 },
+        { title: '已出库', dataIndex: 'finishNumber', width: 90 },
+        { title: '单价', dataIndex: 'unitPrice', width: 90 },
+        { title: '金额', dataIndex: 'allPrice', width: 90 },
+        { title: '税率(%)', dataIndex: 'taxRate', width: 90 },
+        { title: '税额', dataIndex: 'taxMoney', width: 90 },
+        { title: '价税合计', dataIndex: 'taxLastMoney', width: 90 },
+
+        { title: '实际出库数量', dataIndex: 'actualQuantityInStorage', width: 115 },
+        { title: '出库差异', dataIndex: 'warehousingVariance', width: 90 },
+        { title: '出库差异原因', dataIndex: 'reasonOfDifference', width: 115 },
+        { title: '出库人', dataIndex: 'warehousingUser', width: 90 },
+        { title: '出库时间', dataIndex: 'warehousingTime', width: 90 },
+
+        { title: '重量', dataIndex: 'weight', width: 90 },
+        { title: '仓位货架', dataIndex: 'position', width: 90 },
+        { title: '备注', dataIndex: 'remark', width: 90 },
       ],
       saleOutColumns: [
-        { title: '仓库名称', dataIndex: 'depotName' },
-        { title: '条码', dataIndex: 'barCode' },
-        { title: '名称', dataIndex: 'name' },
-        { title: '规格', dataIndex: 'standard' },
-        { title: '型号', dataIndex: 'model' },
-        { title: '颜色', dataIndex: 'color' },
-        { title: '品牌', dataIndex: 'brand' },
-        { title: '制造商', dataIndex: 'mfrs' },
-        { title: '扩展信息', dataIndex: 'materialOther' },
-        { title: '库存', dataIndex: 'stock' },
-        { title: '单位', dataIndex: 'unit' },
+        { title: '批次号', dataIndex: 'batchNumber', width: 90 },
+        { title: '名称', dataIndex: 'name', width: 115 },
+        { title: '规格', dataIndex: 'standard', width: 90 },
+
+        { title: '生产日期', dataIndex: 'productionDate', width: 100 },
+        { title: '保质期', dataIndex: 'expiryNum', width: 60 },
+        { title: '商品条码', dataIndex: 'barCode', width: 90 },
+        { title: '仓库名称', dataIndex: 'depotName', width: 90 },
+        { title: '仓库货架', dataIndex: 'position', width: 90 },
+        { title: '包装规格', dataIndex: 'unitName', width: 90 },
+
+        { title: '规格', dataIndex: 'standard', width: 60 },
+        { title: '型号', dataIndex: 'model', width: 60 },
+        { title: '颜色', dataIndex: 'color', width: 60 },
+        { title: '品牌', dataIndex: 'brand', width: 90 },
+        { title: '制造商', dataIndex: 'mfrs', width: 90 },
+        { title: '扩展信息', dataIndex: 'materialOther', width: 90 },
+        { title: '库存', dataIndex: 'stock', width: 90 },
+        { title: '单位', dataIndex: 'unit', width: 90 },
         { title: '序列号', dataIndex: 'snList', width: 300 },
-        { title: '批号', dataIndex: 'batchNumber' },
-        { title: '有效期', dataIndex: 'expirationDate' },
-        { title: '多属性', dataIndex: 'sku' },
-        { title: '数量', dataIndex: 'operNumber' },
-        { title: '已出库', dataIndex: 'finishNumber' },
-        { title: '单价', dataIndex: 'unitPrice' },
-        { title: '金额', dataIndex: 'allPrice' },
-        { title: '税率(%)', dataIndex: 'taxRate' },
-        { title: '税额', dataIndex: 'taxMoney' },
-        { title: '价税合计', dataIndex: 'taxLastMoney' },
-        { title: '重量', dataIndex: 'weight' },
-        { title: '仓位货架', dataIndex: 'position' },
-        { title: '备注', dataIndex: 'remark' },
+        { title: '有效期', dataIndex: 'expirationDate', width: 90 },
+        { title: '多属性', dataIndex: 'sku', width: 90 },
+        { title: '数量', dataIndex: 'operNumber', width: 90 },
+        { title: '已出库', dataIndex: 'finishNumber', width: 90 },
+        { title: '单价', dataIndex: 'unitPrice', width: 90 },
+        { title: '金额', dataIndex: 'allPrice', width: 90 },
+        { title: '税率(%)', dataIndex: 'taxRate', width: 90 },
+        { title: '税额', dataIndex: 'taxMoney', width: 90 },
+        { title: '价税合计', dataIndex: 'taxLastMoney', width: 90 },
+
+        { title: '实际出库数量', dataIndex: 'actualQuantityInStorage', width: 115 },
+        { title: '出库差异', dataIndex: 'warehousingVariance', width: 90 },
+        { title: '出库差异原因', dataIndex: 'reasonOfDifference', width: 115 },
+        { title: '出库人', dataIndex: 'warehousingUser', width: 90 },
+        { title: '出库时间', dataIndex: 'warehousingTime', width: 90 },
+
+        { title: '重量', dataIndex: 'weight', width: 90 },
+        { title: '仓位货架', dataIndex: 'position', width: 90 },
+        { title: '备注', dataIndex: 'remark', width: 90 },
       ],
       saleBackColumns: [
         { title: '仓库名称', dataIndex: 'depotName' },
@@ -1751,71 +1815,112 @@ export default {
         { title: '备注', dataIndex: 'remark' },
       ],
       otherInColumns: [
-        { title: '仓库名称', dataIndex: 'depotName' },
-        { title: '条码', dataIndex: 'barCode' },
-        { title: '名称', dataIndex: 'name' },
-        { title: '规格', dataIndex: 'standard' },
-        { title: '型号', dataIndex: 'model' },
-        { title: '颜色', dataIndex: 'color' },
-        { title: '品牌', dataIndex: 'brand' },
-        { title: '制造商', dataIndex: 'mfrs' },
-        { title: '扩展信息', dataIndex: 'materialOther' },
-        { title: '库存', dataIndex: 'stock' },
-        { title: '单位', dataIndex: 'unit' },
+        { title: '批次号', dataIndex: 'batchNumber', width: 90 },
+        { title: '名称', dataIndex: 'name', width: 115 },
+        { title: '规格', dataIndex: 'standard', width: 90 },
+
+        { title: '生产日期', dataIndex: 'productionDate', width: 100 },
+        { title: '保质期', dataIndex: 'expiryNum', width: 60 },
+        { title: '商品条码', dataIndex: 'barCode', width: 90 },
+        { title: '仓库名称', dataIndex: 'depotName', width: 90 },
+        { title: '仓库货架', dataIndex: 'position', width: 90 },
+        { title: '包装规格', dataIndex: 'unitName', width: 90 },
+
+        { title: '型号', dataIndex: 'model', width: 60 },
+        { title: '颜色', dataIndex: 'color', width: 60 },
+        { title: '品牌', dataIndex: 'brand', width: 90 },
+        { title: '制造商', dataIndex: 'mfrs', width: 90 },
+        { title: '扩展信息', dataIndex: 'materialOther', width: 90 },
+        { title: '库存', dataIndex: 'stock', width: 90 },
+        { title: '单位', dataIndex: 'unit', width: 90 },
         { title: '序列号', dataIndex: 'snList', width: 300 },
-        { title: '批号', dataIndex: 'batchNumber' },
-        { title: '有效期', dataIndex: 'expirationDate' },
-        { title: '多属性', dataIndex: 'sku' },
-        { title: '数量', dataIndex: 'operNumber' },
-        { title: '单价', dataIndex: 'unitPrice' },
-        { title: '金额', dataIndex: 'allPrice' },
-        { title: '重量', dataIndex: 'weight' },
-        { title: '仓位货架', dataIndex: 'position' },
-        { title: '备注', dataIndex: 'remark' },
+        { title: '有效期', dataIndex: 'expirationDate', width: 90 },
+        { title: '多属性', dataIndex: 'sku', width: 90 },
+        { title: '数量', dataIndex: 'operNumber', width: 90 },
+        { title: '单价', dataIndex: 'unitPrice', width: 90 },
+        { title: '金额', dataIndex: 'allPrice', width: 90 },
+
+        { title: '实际入库数量', dataIndex: 'actualQuantityInStorage', width: 115 },
+        { title: '入库差异', dataIndex: 'warehousingVariance', width: 90 },
+        { title: '入库差异原因', dataIndex: 'reasonOfDifference', width: 115 },
+        { title: '入库人', dataIndex: 'warehousingUser', width: 90 },
+        { title: '入库时间', dataIndex: 'warehousingTime', width: 90 },
+
+        { title: '重量', dataIndex: 'weight', width: 90 },
+        { title: '仓位货架', dataIndex: 'position', width: 90 },
       ],
       otherOutColumns: [
-        { title: '仓库名称', dataIndex: 'depotName' },
-        { title: '条码', dataIndex: 'barCode' },
-        { title: '名称', dataIndex: 'name' },
-        { title: '规格', dataIndex: 'standard' },
-        { title: '型号', dataIndex: 'model' },
-        { title: '颜色', dataIndex: 'color' },
-        { title: '品牌', dataIndex: 'brand' },
-        { title: '制造商', dataIndex: 'mfrs' },
-        { title: '扩展信息', dataIndex: 'materialOther' },
-        { title: '库存', dataIndex: 'stock' },
-        { title: '单位', dataIndex: 'unit' },
+        { title: '批次号', dataIndex: 'batchNumber', width: 90 },
+        { title: '名称', dataIndex: 'name', width: 115 },
+        { title: '规格', dataIndex: 'standard', width: 90 },
+
+        { title: '生产日期', dataIndex: 'productionDate', width: 100 },
+        { title: '保质期', dataIndex: 'expiryNum', width: 60 },
+        { title: '商品条码', dataIndex: 'barCode', width: 90 },
+        { title: '仓库名称', dataIndex: 'depotName', width: 90 },
+        { title: '仓库货架', dataIndex: 'position', width: 90 },
+        { title: '包装规格', dataIndex: 'unitName', width: 90 },
+
+        { title: '规格', dataIndex: 'standard', width: 60 },
+        { title: '型号', dataIndex: 'model', width: 60 },
+        { title: '颜色', dataIndex: 'color', width: 60 },
+        { title: '品牌', dataIndex: 'brand', width: 90 },
+        { title: '制造商', dataIndex: 'mfrs', width: 90 },
+        { title: '扩展信息', dataIndex: 'materialOther', width: 90 },
+        { title: '库存', dataIndex: 'stock', width: 90 },
+        { title: '单位', dataIndex: 'unit', width: 90 },
         { title: '序列号', dataIndex: 'snList', width: 300 },
-        { title: '批号', dataIndex: 'batchNumber' },
-        { title: '有效期', dataIndex: 'expirationDate' },
-        { title: '多属性', dataIndex: 'sku' },
-        { title: '数量', dataIndex: 'operNumber' },
-        { title: '单价', dataIndex: 'unitPrice' },
-        { title: '金额', dataIndex: 'allPrice' },
-        { title: '重量', dataIndex: 'weight' },
-        { title: '仓位货架', dataIndex: 'position' },
-        { title: '备注', dataIndex: 'remark' },
+        { title: '有效期', dataIndex: 'expirationDate', width: 90 },
+        { title: '多属性', dataIndex: 'sku', width: 90 },
+        { title: '数量', dataIndex: 'operNumber', width: 90 },
+        { title: '单价', dataIndex: 'unitPrice', width: 90 },
+        { title: '金额', dataIndex: 'allPrice', width: 90 },
+
+        { title: '实际出库数量', dataIndex: 'actualQuantityInStorage', width: 115 },
+        { title: '出库差异', dataIndex: 'warehousingVariance', width: 90 },
+        { title: '出库差异原因', dataIndex: 'reasonOfDifference', width: 115 },
+        { title: '出库人', dataIndex: 'warehousingUser', width: 90 },
+        { title: '出库时间', dataIndex: 'warehousingTime', width: 90 },
+
+        { title: '重量', dataIndex: 'weight', width: 90 },
+        { title: '仓位货架', dataIndex: 'position', width: 90 },
+        { title: '备注', dataIndex: 'remark', width: 90 },
       ],
       allocationOutColumns: [
-        { title: '仓库名称', dataIndex: 'depotName' },
-        { title: '条码', dataIndex: 'barCode' },
-        { title: '名称', dataIndex: 'name' },
-        { title: '规格', dataIndex: 'standard' },
-        { title: '型号', dataIndex: 'model' },
-        { title: '颜色', dataIndex: 'color' },
-        { title: '品牌', dataIndex: 'brand' },
-        { title: '制造商', dataIndex: 'mfrs' },
-        { title: '扩展信息', dataIndex: 'materialOther' },
-        { title: '库存', dataIndex: 'stock' },
+        { title: '批次号', dataIndex: 'batchNumber', width: 90 },
+        { title: '名称', dataIndex: 'name', width: 115 },
+        { title: '规格', dataIndex: 'standard', width: 90 },
+
+        { title: '生产日期', dataIndex: 'productionDate', width: 100 },
+        { title: '保质期', dataIndex: 'expiryNum', width: 60 },
+        { title: '商品条码', dataIndex: 'barCode', width: 90 },
+        { title: '仓库名称', dataIndex: 'depotName', width: 90 },
+        { title: '仓库货架', dataIndex: 'position', width: 90 },
+        { title: '包装规格', dataIndex: 'unitName', width: 90 },
+
+        { title: '规格', dataIndex: 'standard', width: 60 },
+        { title: '型号', dataIndex: 'model', width: 60 },
+        { title: '颜色', dataIndex: 'color', width: 60 },
+        { title: '品牌', dataIndex: 'brand', width: 90 },
+        { title: '制造商', dataIndex: 'mfrs', width: 90 },
+        { title: '扩展信息', dataIndex: 'materialOther', width: 90 },
+        { title: '库存', dataIndex: 'stock', width: 90 },
         { title: '调入仓库', dataIndex: 'anotherDepotName' },
-        { title: '单位', dataIndex: 'unit' },
+        { title: '单位', dataIndex: 'unit', width: 90 },
         { title: '多属性', dataIndex: 'sku' },
-        { title: '数量', dataIndex: 'operNumber' },
-        { title: '单价', dataIndex: 'unitPrice' },
-        { title: '金额', dataIndex: 'allPrice' },
-        { title: '重量', dataIndex: 'weight' },
-        { title: '仓位货架', dataIndex: 'position' },
-        { title: '备注', dataIndex: 'remark' },
+        { title: '数量', dataIndex: 'operNumber', width: 90 },
+        { title: '单价', dataIndex: 'unitPrice', width: 90 },
+        { title: '金额', dataIndex: 'allPrice', width: 90 },
+
+        { title: '实际出库数量', dataIndex: 'actualQuantityInStorage', width: 115 },
+        { title: '出库差异', dataIndex: 'warehousingVariance', width: 90 },
+        { title: '出库差异原因', dataIndex: 'reasonOfDifference', width: 115 },
+        { title: '出库人', dataIndex: 'warehousingUser', width: 90 },
+        { title: '出库时间', dataIndex: 'warehousingTime', width: 90 },
+
+        { title: '重量', dataIndex: 'weight', width: 90 },
+        { title: '仓位货架', dataIndex: 'position', width: 90 },
+        { title: '备注', dataIndex: 'remark', width: 90 },
       ],
       assembleColumns: [
         { title: '商品类型', dataIndex: 'mType' },

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

@@ -25,6 +25,7 @@ export const BillModalMixin = {
       supList: [],
       cusList: [],
       retailList: [],
+      // unitList: [],
       personList: {
         options: [],
         value: '',
@@ -151,6 +152,10 @@ export const BillModalMixin = {
             for (let i = 0; i < tab.dataSource.length; i++) {
               let info = tab.dataSource[i]
               info.isEdit = this.model.id ? 1 : 0
+              if (info.unitId) {
+                info.unitList = JSON.stringify(info.unitList)
+              }
+
               this.changeColumnShow(info)
             }
             typeof success === 'function' ? success(res) : ''
@@ -160,6 +165,7 @@ export const BillModalMixin = {
           tab.loading = false
         })
     },
+
     //改变字段的状态,1-显示 0-隐藏
     changeFormTypes(columns, key, type) {
       for (let i = 0; i < columns.length; i++) {
@@ -485,6 +491,9 @@ export const BillModalMixin = {
                   let mArr = values
                   for (let i = 0; i < mList.length; i++) {
                     let mInfo = mList[i]
+                    if (mInfo.unitId) {
+                      mInfo.unitList = JSON.stringify(mInfo.unitList)
+                    }
                     this.changeColumnShow(mInfo)
                     let mObj = this.parseInfoToObj(mInfo)
                     mObj.depotId = mInfo.depotId
@@ -521,6 +530,9 @@ export const BillModalMixin = {
                   if (res && res.code === 200) {
                     let mArr = []
                     let mInfo = mList[0]
+                    if (mInfo.unitId) {
+                      mInfo.unitList = JSON.stringify(mInfo.unitList)
+                    }
                     this.changeColumnShow(mInfo)
                     let mInfoEx = this.parseInfoToObj(mInfo)
                     mInfoEx.stock = res.data.stock
@@ -678,10 +690,20 @@ export const BillModalMixin = {
           that.autoChangePrice(target)
           break
         case 'unit':
-          if (!row.unitId) return
-          getUnitInfo({ id: row.unitId }).then((res) => {
-            console.log('----------------sdsafds', res)
-          })
+          // row.actualQuantityInStorage=
+          if (row.unitId) {
+            let arr = row.unitList
+            if (!Array.isArray(arr)) {
+              arr = JSON.parse(arr)
+            }
+            for (let i of arr) {
+              if (i.name === value) {
+                target.setValues([{ rowKey: row.id, values: { actualQuantityInStorage: i.ratio, unitName: i.name } }])
+              }
+            }
+          }
+
+          target.$forceUpdate()
       }
     },
     //转为商品对象
@@ -714,6 +736,7 @@ export const BillModalMixin = {
         warehousingUser: mInfo.warehousingUser,
         warehousingTime: mInfo.warehousingTime,
         unitId: mInfo.unitId,
+        unitList: mInfo.unitList,
       }
     },
     //使得型号、颜色、扩展信息、sku等为隐藏
@@ -727,6 +750,9 @@ export const BillModalMixin = {
     },
     //使得sku、序列号、批号、到期日等为显示
     changeColumnShow(info) {
+      // if (info.util) {
+      //   this.changeUnitType(this.materialTable.columns, info, 'unit')
+      // }
       if (info.model) {
         this.changeFormTypes(this.materialTable.columns, 'model', 1)
       }

+ 33 - 14
jshERP-web/src/views/bill/modules/AllocationOutModal.vue

@@ -52,6 +52,7 @@
           @valueChange="onValueChange"
           @added="onAdded"
           @deleted="onDeleted"
+          @focusChange="getUnitInfo"
         >
           <template #buttonAfter>
             <a-row
@@ -86,6 +87,23 @@
               <a-icon type="plus" /> 新增仓库
             </div>
           </template>
+          <template #unit="{ handleChange, handleFocus, value }">
+            <a-select
+              placeholder="请选择"
+              v-decorator="['unit']"
+              :dropdownMatchSelectWidth="false"
+              showSearch
+              :allowClear="false"
+              optionFilterProp="children"
+              :value="value"
+              @change="($event) => handleChange($event)"
+              @focus="($event) => handleFocus($event)"
+            >
+              <a-select-option v-for="(item, index) in unitList" :key="index" :value="item.name">
+                {{ item.name }}
+              </a-select-option>
+            </a-select>
+          </template>
         </j-editable-table>
         <a-row class="form-row" :gutter="24">
           <a-col :lg="24" :md="24" :sm="24">
@@ -178,18 +196,8 @@ export default {
         dataSource: [],
         columns: [
           {
-            title: '仓库名称',
-            key: 'depotId',
-            width: '8%',
-            type: FormTypes.select,
-            placeholder: '请选择${title}',
-            options: [],
-            allowSearch: true,
-            validateRules: [{ required: true, message: '${title}不能为空' }],
-          },
-          {
-            title: '条码',
-            key: 'barCode',
+            title: '批次号',
+            key: 'batchNumber',
             width: '12%',
             type: FormTypes.popupJsh,
             kind: 'material',
@@ -204,7 +212,7 @@ export default {
           { title: '商品条码', key: 'barCode', width: '6%', type: FormTypes.normal },
           { title: '仓库名', key: 'depotName', width: '6%', type: FormTypes.normal },
           { title: '仓库货架', key: 'position', width: '6%', type: FormTypes.normal },
-          { title: '包装规格', key: 'unitName', width: '6%', type: FormTypes.input },
+          { title: '包装规格', key: 'unitName', width: '6%', type: FormTypes.normal },
 
           { title: '型号', key: 'model', width: '9%', type: FormTypes.normal },
           { title: '颜色', key: 'color', width: '5%', type: FormTypes.normal },
@@ -221,7 +229,17 @@ export default {
             options: [],
             allowSearch: true,
           },
-          { title: '单位', key: 'unit', width: '4%', type: FormTypes.normal },
+          {
+            title: '单位',
+            key: 'unit',
+            width: '6%',
+            type: FormTypes.slot,
+            options: [],
+            allowClear: false,
+            slotName: 'unit',
+          },
+          { title: '单位id', key: 'unitId', width: '4%', type: FormTypes.hidden },
+          { title: '单位列表', key: 'unitList', width: '5%', type: FormTypes.hidden },
           { title: '多属性', key: 'sku', width: '9%', type: FormTypes.normal },
           {
             title: '数量',
@@ -267,6 +285,7 @@ export default {
         edit: '/depotHead/updateDepotHeadAndDetail',
         detailList: '/depotItem/getDetailList',
       },
+      unitList: [],
     }
   },
   created() {},

+ 34 - 2
jshERP-web/src/views/bill/modules/OtherInModal.vue

@@ -93,6 +93,7 @@
           @valueChange="onValueChange"
           @added="onAdded"
           @deleted="onDeleted"
+          @focusChange="getUnitInfo"
         >
           <template #buttonAfter>
             <a-row
@@ -131,6 +132,23 @@
               <a-icon type="plus" /> 新增仓库
             </div>
           </template>
+          <template #unit="{ handleChange, handleFocus, value }">
+            <a-select
+              placeholder="请选择"
+              v-decorator="['unit']"
+              :dropdownMatchSelectWidth="false"
+              showSearch
+              :allowClear="false"
+              optionFilterProp="children"
+              :value="value"
+              @change="($event) => handleChange($event)"
+              @focus="($event) => handleFocus($event)"
+            >
+              <a-select-option v-for="(item, index) in unitList" :key="index" :value="item.name">
+                {{ item.name }}
+              </a-select-option>
+            </a-select>
+          </template>
         </j-editable-table>
         <a-row class="form-row" :gutter="24">
           <a-col :lg="24" :md="24" :sm="24">
@@ -267,7 +285,7 @@ export default {
           { 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.input },
+          { title: '包装规格', key: 'unitName', width: '9%', type: FormTypes.normal },
 
           { title: '型号', key: 'model', width: '9%', type: FormTypes.normal },
           { title: '颜色', key: 'color', width: '5%', type: FormTypes.normal },
@@ -275,7 +293,17 @@ export default {
           { 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%', type: FormTypes.select },
+          {
+            title: '单位',
+            key: 'unit',
+            width: '4%',
+            type: FormTypes.slot,
+            options: [],
+            allowClear: false,
+            slotName: 'unit',
+          },
+          { title: '单位id', key: 'unitId', width: '4%', type: FormTypes.hidden },
+          { title: '单位列表', key: 'unitList', width: '5%', type: FormTypes.hidden },
           { title: '序列号', key: 'snList', width: '12%', type: FormTypes.popupJsh, kind: 'snAdd', multi: true },
           { title: '有效期', key: 'expirationDate', width: '7%', type: FormTypes.date },
           { title: '多属性', key: 'sku', width: '9%', type: FormTypes.normal },
@@ -326,6 +354,7 @@ export default {
         edit: '/depotHead/updateDepotHeadAndDetail',
         detailList: '/depotItem/getDetailList',
       },
+      unitList: [],
     }
   },
   created() {},
@@ -455,6 +484,9 @@ export default {
         })
       }
     },
+    getUnitInfo(val) {
+      this.unitList = val
+    },
   },
 }
 </script>

+ 34 - 2
jshERP-web/src/views/bill/modules/OtherOutModal.vue

@@ -94,6 +94,7 @@
           @valueChange="onValueChange"
           @added="onAdded"
           @deleted="onDeleted"
+          @focusChange="getUnitInfo"
         >
           <template #buttonAfter>
             <a-row
@@ -132,6 +133,23 @@
               <a-icon type="plus" /> 新增仓库
             </div>
           </template>
+          <template #unit="{ handleChange, handleFocus, value }">
+            <a-select
+              placeholder="请选择"
+              v-decorator="['unit']"
+              :dropdownMatchSelectWidth="false"
+              showSearch
+              :allowClear="false"
+              optionFilterProp="children"
+              :value="value"
+              @change="($event) => handleChange($event)"
+              @focus="($event) => handleFocus($event)"
+            >
+              <a-select-option v-for="(item, index) in unitList" :key="index" :value="item.name">
+                {{ item.name }}
+              </a-select-option>
+            </a-select>
+          </template>
         </j-editable-table>
         <a-row class="form-row" :gutter="24">
           <a-col :lg="24" :md="24" :sm="24">
@@ -266,7 +284,7 @@ export default {
           { title: '商品条码', key: 'barCode', width: '6%', type: FormTypes.normal },
           { title: '仓库名', key: 'depotName', width: '6%', type: FormTypes.normal },
           { title: '仓库货架', key: 'position', width: '6%', type: FormTypes.normal },
-          { title: '包装规格', key: 'unitName', width: '6%', type: FormTypes.input },
+          { title: '包装规格', key: 'unitName', width: '6%', type: FormTypes.normal },
 
           { title: '型号', key: 'model', width: '9%', type: FormTypes.normal },
           { title: '颜色', key: 'color', width: '5%', type: FormTypes.normal },
@@ -274,7 +292,17 @@ export default {
           { 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%', type: FormTypes.normal },
+          {
+            title: '单位',
+            key: 'unit',
+            width: '6%',
+            type: FormTypes.slot,
+            options: [],
+            allowClear: false,
+            slotName: 'unit',
+          },
+          { title: '单位id', key: 'unitId', width: '4%', type: FormTypes.hidden },
+          { title: '单位列表', key: 'unitList', width: '5%', type: FormTypes.hidden },
           { title: '序列号', key: 'snList', width: '12%', type: FormTypes.popupJsh, kind: 'sn', multi: true },
           { title: '批号', key: 'batchNumber', width: '7%', type: FormTypes.popupJsh, kind: 'batch', multi: false },
           { title: '有效期', key: 'expirationDate', width: '7%', type: FormTypes.input, readonly: true },
@@ -326,6 +354,7 @@ export default {
         edit: '/depotHead/updateDepotHeadAndDetail',
         detailList: '/depotItem/getDetailList',
       },
+      unitList: [],
     }
   },
   created() {},
@@ -454,6 +483,9 @@ export default {
         })
       }
     },
+    getUnitInfo(val) {
+      this.unitList = val
+    },
   },
 }
 </script>

+ 35 - 3
jshERP-web/src/views/bill/modules/PurchaseInModal.vue

@@ -111,6 +111,7 @@
           @valueChange="onValueChange"
           @added="onAdded"
           @deleted="onDeleted"
+          @focusChange="getUnitInfo"
         >
           <template #buttonAfter>
             <a-row
@@ -156,6 +157,23 @@
               <a-icon type="plus" /> 新增仓库
             </div>
           </template>
+          <template #unit="{ handleChange, handleFocus, value }">
+            <a-select
+              placeholder="请选择"
+              v-decorator="['unit']"
+              :dropdownMatchSelectWidth="false"
+              showSearch
+              :allowClear="false"
+              optionFilterProp="children"
+              :value="value"
+              @change="($event) => handleChange($event)"
+              @focus="($event) => handleFocus($event)"
+            >
+              <a-select-option v-for="(item, index) in unitList" :key="index" :value="item.name">
+                {{ item.name }}
+              </a-select-option>
+            </a-select>
+          </template>
         </j-editable-table>
         <a-row class="form-row" :gutter="24">
           <a-col :lg="24" :md="24" :sm="24">
@@ -446,7 +464,7 @@ export default {
           { title: '商品条码', key: 'barCode', width: '6%', type: FormTypes.normal },
           { title: '仓库名', key: 'depotId', width: '6%', type: FormTypes.select, disabled: true },
           { title: '仓库货架', key: 'position', width: '6%', type: FormTypes.normal },
-          { title: '包装规格', key: 'unitName', width: '6%', type: FormTypes.input },
+          { title: '包装规格', key: 'unitName', width: '6%', type: FormTypes.normal },
 
           { title: '型号', key: 'model', width: '9%', type: FormTypes.normal },
           { title: '颜色', key: 'color', width: '5%', type: FormTypes.normal },
@@ -454,8 +472,17 @@ export default {
           { 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%', type: FormTypes.select, options: [] },
+          {
+            title: '单位',
+            key: 'unit',
+            width: '6%',
+            type: FormTypes.slot,
+            options: [],
+            allowClear: false,
+            slotName: 'unit',
+          },
           { title: '单位id', key: 'unitId', width: '4%', type: FormTypes.hidden },
+          { title: '单位列表', key: 'unitList', width: '5%', type: FormTypes.hidden },
           { title: '序列号', key: 'snList', width: '12%', type: FormTypes.popupJsh, kind: 'snAdd', multi: true },
           { title: '有效期', key: 'expirationDate', width: '7%', type: FormTypes.date },
           { title: '多属性', key: 'sku', width: '9%', type: FormTypes.normal },
@@ -527,8 +554,10 @@ export default {
         edit: '/depotHead/updateDepotHeadAndDetail',
         detailList: '/depotItem/getDetailList',
       },
+      unitList: [],
     }
   },
+
   created() {},
   methods: {
     //调用完edit()方法之后会自动调用此方法
@@ -631,6 +660,7 @@ export default {
       billMain.subType = '采购'
       for (let item of detailArr) {
         totalPrice += item.allPrice - 0
+        // delete item.unitList
       }
       billMain.totalPrice = 0 - totalPrice
       billMain.changeAmount = 0 - billMain.changeAmount
@@ -654,7 +684,6 @@ export default {
         billMain.id = this.model.id
       }
       billMain.status = this.billStatus
-
       return {
         info: JSON.stringify(billMain),
         rows: JSON.stringify(detailArr),
@@ -727,6 +756,9 @@ export default {
         }
       }
     },
+    getUnitInfo(val) {
+      this.unitList = val
+    },
   },
 }
 </script>

+ 64 - 3
jshERP-web/src/views/bill/modules/PurchaseOrderModal.vue

@@ -129,6 +129,7 @@
           @valueChange="onValueChange"
           @added="onAdded"
           @deleted="onDeleted"
+          @focusChange="getUnitInfo"
         >
           <template #buttonAfter>
             <a-row
@@ -165,6 +166,23 @@
               <a-button icon="import" @click="onImport(prefixNo)">导入明细</a-button>
             </a-row>
           </template>
+          <template #unit="{ handleChange, handleFocus, value }">
+            <a-select
+              placeholder="请选择"
+              v-decorator="['unit']"
+              :dropdownMatchSelectWidth="false"
+              showSearch
+              :allowClear="false"
+              optionFilterProp="children"
+              :value="value"
+              @change="($event) => handleChange($event)"
+              @focus="($event) => handleFocus($event)"
+            >
+              <a-select-option v-for="(item, index) in unitList" :key="index" :value="item.name">
+                {{ item.name }}
+              </a-select-option>
+            </a-select>
+          </template>
         </j-editable-table>
         <a-row class="form-row" :gutter="24">
           <a-col :lg="24" :md="24" :sm="24">
@@ -331,6 +349,7 @@ import { getMpListShort, changeListFmtMinus, handleIntroJs } from '@/utils/util'
 import JUpload from '@/components/jeecg/JUpload'
 import JDate from '@/components/jeecg/JDate'
 import Vue from 'vue'
+// import QrcodeVue from 'qrcode.vue'
 export default {
   name: 'PurchaseOrderModal',
   mixins: [JEditableTableMixin, BillModalMixin],
@@ -345,6 +364,7 @@ export default {
     BillPrintIframe,
     JUpload,
     JDate,
+    // QrcodeVue,
     VNodes: {
       functional: true,
       render: (h, ctx) => ctx.props.vnodes,
@@ -384,8 +404,8 @@ export default {
         columns: [
           { title: '', key: 'hiddenKey', width: '1%', type: FormTypes.hidden },
           {
-            title: '条码',
-            key: 'barCode',
+            title: '批次号',
+            key: 'batchNumber',
             width: '12%',
             type: FormTypes.popupJsh,
             kind: 'material',
@@ -394,13 +414,31 @@ export default {
           },
           { title: '名称', key: 'name', width: '10%', 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: '6%', type: FormTypes.normal },
+          { title: '仓库名', key: 'depotName', width: '6%', type: FormTypes.normal },
+          { title: '仓库货架', key: 'position', width: '6%', type: FormTypes.normal },
+          { title: '包装规格', key: 'unitName', width: '6%', type: FormTypes.input },
+
           { 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: '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%', type: FormTypes.normal },
+          {
+            title: '单位',
+            key: 'unit',
+            width: '6%',
+            type: FormTypes.slot,
+            options: [],
+            allowClear: false,
+            slotName: 'unit',
+          },
+          { title: '单位id', key: 'unitId', width: '4%', type: FormTypes.hidden },
+          { title: '单位列表', key: 'unitList', width: '5%', type: FormTypes.hidden },
           { title: '多属性', key: 'sku', width: '9%', type: FormTypes.normal },
           { title: '原数量', key: 'preNumber', width: '4%', type: FormTypes.normal },
           { title: '已采购', key: 'finishNumber', width: '4%', type: FormTypes.normal },
@@ -414,6 +452,25 @@ export default {
           },
           { title: '单价', key: 'unitPrice', width: '5%', type: FormTypes.inputNumber },
           { title: '金额', key: 'allPrice', width: '5%', type: FormTypes.inputNumber, statistics: true },
+
+          {
+            title: '实际入库数量',
+            key: 'actualQuantityInStorage',
+            width: '9%',
+            type: FormTypes.inputNumber,
+            validateRules: [{ required: true, message: '实际入库数量不能为空' }],
+          },
+          { title: '入库差异', key: 'warehousingVariance', width: '9%', type: FormTypes.input },
+          { title: '入库差异原因', key: 'reasonOfDifference', width: '9%', type: FormTypes.input },
+          {
+            title: '入库人',
+            key: 'warehousingUser',
+            width: '9%',
+            type: FormTypes.input,
+            validateRules: [{ required: true, message: '入库人不能为空' }],
+          },
+          { title: '入库时间', key: 'warehousingTime', width: '9%', type: FormTypes.date },
+
           { title: '税率', key: 'taxRate', width: '4%', type: FormTypes.inputNumber, placeholder: '%' },
           {
             title: '税额',
@@ -443,6 +500,7 @@ export default {
         detailList: '/depotItem/getDetailList',
         importExcelUrl: '/depotItem/importItemExcel',
       },
+      unitList: [],
     }
   },
   created() {},
@@ -613,6 +671,9 @@ export default {
         this.materialTable.dataSource = selectBillDetailRows
       }
     },
+    getUnitInfo(val) {
+      this.unitList = val
+    },
   },
 }
 </script>

+ 70 - 6
jshERP-web/src/views/bill/modules/SaleOrderModal.vue

@@ -110,6 +110,7 @@
           @valueChange="onValueChange"
           @added="onAdded"
           @deleted="onDeleted"
+          @focusChange="getUnitInfo"
         >
           <template #buttonAfter>
             <a-row
@@ -145,6 +146,23 @@
               <a-button icon="import" @click="onImport(prefixNo)">导入明细</a-button>
             </a-row>
           </template>
+          <template #unit="{ handleChange, handleFocus, value }">
+            <a-select
+              placeholder="请选择"
+              v-decorator="['unit']"
+              :dropdownMatchSelectWidth="false"
+              showSearch
+              :allowClear="false"
+              optionFilterProp="children"
+              :value="value"
+              @change="($event) => handleChange($event)"
+              @focus="($event) => handleFocus($event)"
+            >
+              <a-select-option v-for="(item, index) in unitList" :key="index" :value="item.name">
+                {{ item.name }}
+              </a-select-option>
+            </a-select>
+          </template>
         </j-editable-table>
         <a-row class="form-row" :gutter="24">
           <a-col :lg="24" :md="24" :sm="24">
@@ -356,8 +374,8 @@ export default {
         columns: [
           { title: '', key: 'hiddenKey', width: '1%', type: FormTypes.hidden },
           {
-            title: '条码',
-            key: 'barCode',
+            title: '批次号',
+            key: 'batchNumber',
             width: '12%',
             type: FormTypes.popupJsh,
             kind: 'material',
@@ -366,23 +384,45 @@ export default {
           },
           { title: '名称', key: 'name', width: '10%', 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: '6%', type: FormTypes.normal },
+          { title: '仓库名', key: 'depotName', width: '6%', type: FormTypes.normal },
+          { title: '仓库货架', key: 'position', width: '6%', type: FormTypes.normal },
+          { title: '包装规格', key: 'unitName', width: '6%', 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: '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%', type: FormTypes.normal },
-          { title: '多属性', key: 'sku', width: '4%', type: FormTypes.normal },
           {
-            title: '数量',
+            title: '单位',
+            key: 'unit',
+            width: '6%',
+            type: FormTypes.slot,
+            options: [],
+            allowClear: false,
+            slotName: 'unit',
+          },
+          { title: '单位id', key: 'unitId', width: '4%', type: FormTypes.hidden },
+          { title: '单位列表', key: 'unitList', width: '5%', type: FormTypes.hidden },
+          { title: '序列号', key: 'snList', width: '12%', type: FormTypes.popupJsh, kind: 'sn', multi: true },
+          { title: '有效期', key: 'expirationDate', width: '7%', type: FormTypes.input, readonly: true },
+          { title: '多属性', key: 'sku', width: '9%', type: FormTypes.normal },
+          { title: '原数量', key: 'preNumber', width: '4%', type: FormTypes.normal },
+          { title: '已出库', key: 'finishNumber', width: '4%', type: FormTypes.normal },
+          {
+            title: '出库数量',
             key: 'operNumber',
             width: '5%',
             type: FormTypes.inputNumber,
             statistics: true,
             validateRules: [{ required: true, message: '${title}不能为空' }],
           },
-          { title: '单价', key: 'unitPrice', width: '5%', type: FormTypes.inputNumber },
+          { title: '单价', key: 'unitPrice', width: '4%', type: FormTypes.inputNumber },
           { title: '金额', key: 'allPrice', width: '5%', type: FormTypes.inputNumber, statistics: true },
           { title: '税率', key: 'taxRate', width: '4%', type: FormTypes.inputNumber, placeholder: '%' },
           {
@@ -394,7 +434,27 @@ export default {
             statistics: true,
           },
           { title: '价税合计', key: 'taxLastMoney', width: '7%', type: FormTypes.inputNumber, statistics: true },
+
+          {
+            title: '实际出库数量',
+            key: 'actualQuantityInStorage',
+            width: '9%',
+            type: FormTypes.inputNumber,
+            validateRules: [{ required: true, message: '实际入库数量不能为空' }],
+          },
+          { title: '出库差异', key: 'warehousingVariance', width: '9%', type: FormTypes.input },
+          { title: '出库差异原因', key: 'reasonOfDifference', width: '9%', type: FormTypes.input },
+          {
+            title: '出库人',
+            key: 'warehousingUser',
+            width: '9%',
+            type: FormTypes.input,
+            validateRules: [{ required: true, message: '出库人不能为空' }],
+          },
+          { title: '出库时间', key: 'warehousingTime', width: '9%', type: FormTypes.date },
+
           { title: '备注', key: 'remark', width: '6%', type: FormTypes.input },
+          { title: '关联id', key: 'linkId', width: '5%', type: FormTypes.hidden },
         ],
       },
       confirmLoading: false,
@@ -411,6 +471,7 @@ export default {
         edit: '/depotHead/updateDepotHeadAndDetail',
         detailList: '/depotItem/getDetailList',
       },
+      unitList: [],
     }
   },
   created() {},
@@ -515,6 +576,9 @@ export default {
       this.$refs.historyBillListModalForm.show('其它', '销售订单', '客户', organId)
       this.$refs.historyBillListModalForm.disableSubmit = false
     },
+    getUnitInfo(val) {
+      this.unitList = val
+    },
   },
 }
 </script>

+ 34 - 12
jshERP-web/src/views/bill/modules/SaleOutModal.vue

@@ -113,6 +113,7 @@
           @valueChange="onValueChange"
           @added="onAdded"
           @deleted="onDeleted"
+          @focusChange="getUnitInfo"
         >
           <template #buttonAfter>
             <a-row
@@ -158,6 +159,23 @@
               <a-icon type="plus" /> 新增仓库
             </div>
           </template>
+          <template #unit="{ handleChange, handleFocus, value }">
+            <a-select
+              placeholder="请选择"
+              v-decorator="['unit']"
+              :dropdownMatchSelectWidth="false"
+              showSearch
+              :allowClear="false"
+              optionFilterProp="children"
+              :value="value"
+              @change="($event) => handleChange($event)"
+              @focus="($event) => handleFocus($event)"
+            >
+              <a-select-option v-for="(item, index) in unitList" :key="index" :value="item.name">
+                {{ item.name }}
+              </a-select-option>
+            </a-select>
+          </template>
         </j-editable-table>
         <a-row class="form-row" :gutter="24">
           <a-col :lg="24" :md="24" :sm="24">
@@ -441,16 +459,6 @@ export default {
         loading: false,
         dataSource: [],
         columns: [
-          // {
-          //   title: '仓库名称',
-          //   key: 'depotId',
-          //   width: '8%',
-          //   type: FormTypes.select,
-          //   placeholder: '请选择${title}',
-          //   options: [],
-          //   allowSearch: true,
-          //   validateRules: [{ required: true, message: '${title}不能为空' }],
-          // },
           {
             title: '批次号',
             key: 'batchNumber',
@@ -468,7 +476,7 @@ export default {
           { title: '商品条码', key: 'barCode', width: '6%', type: FormTypes.normal },
           { title: '仓库名', key: 'depotName', width: '6%', type: FormTypes.normal },
           { title: '仓库货架', key: 'position', width: '6%', type: FormTypes.normal },
-          { title: '包装规格', key: 'unitName', width: '6%', type: FormTypes.input },
+          { title: '包装规格', key: 'unitName', width: '6%', type: FormTypes.normal },
 
           { title: '型号', key: 'model', width: '9%', type: FormTypes.normal },
           { title: '颜色', key: 'color', width: '5%', type: FormTypes.normal },
@@ -476,7 +484,17 @@ export default {
           { 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%', type: FormTypes.normal },
+          {
+            title: '单位',
+            key: 'unit',
+            width: '6%',
+            type: FormTypes.slot,
+            options: [],
+            allowClear: false,
+            slotName: 'unit',
+          },
+          { title: '单位id', key: 'unitId', width: '4%', type: FormTypes.hidden },
+          { title: '单位列表', key: 'unitList', width: '5%', type: FormTypes.hidden },
           { title: '序列号', key: 'snList', width: '12%', type: FormTypes.popupJsh, kind: 'sn', multi: true },
           { title: '有效期', key: 'expirationDate', width: '7%', type: FormTypes.input, readonly: true },
           { title: '多属性', key: 'sku', width: '9%', type: FormTypes.normal },
@@ -548,6 +566,7 @@ export default {
         edit: '/depotHead/updateDepotHeadAndDetail',
         detailList: '/depotItem/getDetailList',
       },
+      unitList: [],
     }
   },
   created() {},
@@ -761,6 +780,9 @@ export default {
         }
       }
     },
+    getUnitInfo(val) {
+      this.unitList = val
+    },
   },
 }
 </script>

+ 31 - 2
jshERP-web/src/views/dashboard/Analysis.vue

@@ -8,6 +8,9 @@
 <script>
 import IndexChart from './IndexChart'
 import SysTipModal from './dialog/SysTipModal.vue'
+import { getMaterialWarn } from '@/api/api.js'
+
+let isFirst = true
 export default {
   name: 'Analysis',
   components: {
@@ -15,10 +18,36 @@ export default {
     SysTipModal,
   },
   data() {
-    return {}
+    return {
+      warnData: {}
+    }
+  },
+  created() {
+    if(isFirst){
+      this.getWarnData()
+    }
   },
-  created() {},
   methods: {
+    getWarnData(){
+      isFirst = false
+      const hasArrayData = (val) => {
+        return Array.isArray(val) && val.length > 0
+      }
+      getMaterialWarn().then(res => {
+        const {expirationReminder = [],inventoryReminder = [],noMovingPinReminder = []} = res.data
+        if(hasArrayData(expirationReminder)||hasArrayData(inventoryReminder)||hasArrayData(noMovingPinReminder)){
+          this.$nextTick(() => {
+            this.$refs.sysTipModal.open(
+              {
+                expirationReminder,
+                inventoryReminder,
+                noMovingPinReminder
+              }
+            )
+          })
+        }
+      })
+    },
     openSysTipModal() {
       this.$refs.sysTipModal.open({})
     },

+ 13 - 6
jshERP-web/src/views/dashboard/dialog/SysTipModal.vue

@@ -18,12 +18,14 @@
       <div class="tip-body">
         <div class="tip-content">
           <div class="text-title">无动销提醒</div>
-          <p class="text-val">1.商品名称xxx,在【无动销提醒周期】内,无动销,请及时处理</p>
-          <p class="text-val">1.商品名称xxx,在【无动销提醒周期】内,无动销,请及时处理</p>
+          <p class="text-val" v-for="(item,index) in dataInfo.noMovingPinReminder" :key="index">{{ `${index+1}.${item}` }}</p>
+          <p class="text-val" v-show="dataInfo.noMovingPinReminder.length===0">暂无</p>
           <div class="text-title">过期提醒</div>
-          <p class="text-val">3.商品名称xxx,条码xxx,生产日期xxx,保质期xxx,库存xxx,即将要过期,请及时处理</p>
+          <p class="text-val" v-for="(item,index) in dataInfo.expirationReminder" :key="index">{{ `${index+1}.${item}` }}</p>
+          <p class="text-val" v-show="dataInfo.expirationReminder.length===0">暂无</p>
           <div class="text-title">库存提醒</div>
-          <p class="text-val">4.商品名称xxx,库存告警,请及时处理</p>
+          <p class="text-val" v-for="(item,index) in dataInfo.inventoryReminder" :key="index">{{ `${index+1}.${item}` }}</p>
+          <p class="text-val" v-show="dataInfo.inventoryReminder.length===0">暂无</p>
         </div>
         <div class="btn-wrap">
           <a-button type="primary" @click="handleOk" class="confirm-btn">好的</a-button>
@@ -39,7 +41,11 @@ export default {
     return {
       visible: false,
       confirmLoading: false,
-      dataInfo: {},
+      dataInfo: {
+        expirationReminder: [],
+        inventoryReminder: [],
+        noMovingPinReminder: []
+      },
     }
   },
   methods: {
@@ -103,7 +109,8 @@ export default {
     background-color: rgba(255, 255, 255, 0.8);
   }
   .tip-content {
-    height: 210px;
+    max-height: 300px;
+    overflow: hidden scroll;
   }
   .btn-wrap {
     margin-top: 16px;

+ 0 - 1
jshERP-web/src/views/material/mixins/MaterialModalMixins.js

@@ -16,7 +16,6 @@ export const MaterialModalMixins = {
     addVendor() {
       this.$refs.vendorModalForm.add()
       this.$refs.vendorModalForm.title = '新增供应商'
-      console.log('this.$refs.vendorModalForm------------', this.$refs.vendorModalForm)
       this.$refs.vendorModalForm.disableSubmit = false
     },
     addDepot() {

+ 2 - 2
jshERP-web/src/views/material/modules/MaterialCategoryModal.vue

@@ -24,7 +24,7 @@
             <a-input placeholder="请输入名称" v-decorator="['name', validatorRules.name]" />
           </a-form-item>
           <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="编号">
-            <a-input placeholder="请输入编号" v-decorator="['serialNo', validatorRules.serialNo]" />
+            <a-input disabled placeholder="请输入编号" v-decorator="['serialNo', validatorRules.serialNo]" />
           </a-form-item>
           <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="上级目录">
             <a-tree-select
@@ -87,7 +87,7 @@ export default {
         name: {
           rules: [{ required: true, message: '请输入名称!' }, { validator: this.validateName }],
         },
-        serialNo: { rules: [{ required: true, message: '请输入编号!' }] },
+        // serialNo: { rules: [{ required: true, message: '请输入编号!' }] },
       },
       url: {
         add: '/materialCategory/add',

+ 85 - 72
jshERP-web/src/views/material/modules/MaterialModal.vue

@@ -223,10 +223,10 @@
                 >
                   <a-tooltip title="无动销提醒周期">
                     <a-select placeholder="无动销提醒周期" v-decorator="['movingPinReminderCycle']">
-                      <a-select-option value="一周">一周</a-select-option>
-                      <a-select-option value="两周">两周</a-select-option>
-                      <a-select-option value="一个月">一个月</a-select-option>
-                      <a-select-option value="一季度">一季度</a-select-option>
+                      <a-select-option value="7">一周</a-select-option>
+                      <a-select-option value="14">两周</a-select-option>
+                      <a-select-option value="30">一个月</a-select-option>
+                      <a-select-option value="90">一季度</a-select-option>
                     </a-select>
                   </a-tooltip>
                 </a-form-item>
@@ -407,7 +407,7 @@
                     :dropdownMatchSelectWidth="false"
                     showSearch
                     optionFilterProp="children"
-                    :value="typeof value === 'string' ? Number(value) : ''"
+                    :value="value"
                     @change="($event) => handleChange($event)"
                   >
                     <div slot="dropdownRender" slot-scope="menu">
@@ -660,9 +660,10 @@ export default {
             key: 'commodityUnit',
             width: '8%',
             type: FormTypes.input,
+            disabled: true,
             defaultValue: '',
             placeholder: '请输入${title}',
-            validateRules: [{ required: true, message: '${title}不能为空' }],
+            // validateRules: [{ required: true, message: '${title}不能为空' }],
           },
           {
             title: '多属性',
@@ -969,6 +970,7 @@ export default {
       getAction(url, params)
         .then((res) => {
           tab.dataSource = res.data || []
+          console.log('====================', res.data)
         })
         .finally(() => {
           tab.loading = false
@@ -1085,69 +1087,69 @@ export default {
                 }
               }
             }
-            if (!formData.unit) {
-              //此时为多单位
-              if (formData.meList.length < 2) {
-                this.$message.warning('多单位的商品条码行数至少要有两行,请再新增一行条码信息!')
-                return
-              }
-              if (formData.meList[0].commodityUnit != basicUnit) {
-                this.$message.warning(
-                  '条码之后的单位填写有误,单位【' +
-                    formData.meList[0].commodityUnit +
-                    '】请修改为【' +
-                    basicUnit +
-                    '】!'
-                )
-                return
-              }
-              if (formData.meList[1].commodityUnit != otherUnit) {
-                this.$message.warning(
-                  '条码之后的单位填写有误,单位【' +
-                    formData.meList[1].commodityUnit +
-                    '】请修改为【' +
-                    otherUnit +
-                    '】!'
-                )
-                return
-              }
-            }
+            // if (!formData.unit) {
+            //   // 此时为多单位
+            //   if (formData.meList.length < 2) {
+            //     this.$message.warning('多单位的商品条码行数至少要有两行,请再新增一行条码信息!')
+            //     return
+            //   }
+            //   if (formData.meList[0].commodityUnit != basicUnit) {
+            //     this.$message.warning(
+            //       '条码之后的单位填写有误,单位【' +
+            //         formData.meList[0].commodityUnit +
+            //         '】请修改为【' +
+            //         basicUnit +
+            //         '】!'
+            //     )
+            //     return
+            //   }
+            //   if (formData.meList[1].commodityUnit != otherUnit) {
+            //     this.$message.warning(
+            //       '条码之后的单位填写有误,单位【' +
+            //         formData.meList[1].commodityUnit +
+            //         '】请修改为【' +
+            //         otherUnit +
+            //         '】!'
+            //     )
+            //     return
+            //   }
+            // }
             let skuCount = 0
             for (let i = 0; i < formData.meList.length; i++) {
-              let commodityUnit = formData.meList[i].commodityUnit
-              if (formData.unit) {
-                if (commodityUnit != formData.unit) {
-                  this.$message.warning(
-                    '条码之后的单位填写有误,单位【' + commodityUnit + '】请修改为【' + formData.unit + '】!'
-                  )
-                  return
-                }
-              } else if (formData.unitId) {
-                if (
-                  commodityUnit != basicUnit &&
-                  commodityUnit != otherUnit &&
-                  commodityUnit != otherUnitTwo &&
-                  commodityUnit != otherUnitThree
-                ) {
-                  let warnInfo =
-                    '条码之后的单位填写有误,单位【' +
-                    commodityUnit +
-                    '】请修改为【' +
-                    basicUnit +
-                    '】或【' +
-                    otherUnit +
-                    '】'
-                  if (otherUnitTwo) {
-                    warnInfo += '或【' + otherUnitTwo + '】'
-                  }
-                  if (otherUnitThree) {
-                    warnInfo += '或【' + otherUnitThree + '】'
-                  }
-                  warnInfo += '!'
-                  this.$message.warning(warnInfo)
-                  return
-                }
-              }
+              // let commodityUnit = formData.meList[i].commodityUnit
+              // if (formData.unit) {
+              //   if (commodityUnit != formData.unit) {
+              //     this.$message.warning(
+              //       '条码之后的单位填写有误,单位【' + commodityUnit + '】请修改为【' + formData.unit + '】!'
+              //     )
+              //     return
+              //   }
+              // } else if (formData.unitId) {
+              //   if (
+              //     commodityUnit != basicUnit &&
+              //     commodityUnit != otherUnit &&
+              //     commodityUnit != otherUnitTwo &&
+              //     commodityUnit != otherUnitThree
+              //   ) {
+              //     let warnInfo =
+              //       '条码之后的单位填写有误,单位【' +
+              //       commodityUnit +
+              //       '】请修改为【' +
+              //       basicUnit +
+              //       '】或【' +
+              //       otherUnit +
+              //       '】'
+              //     if (otherUnitTwo) {
+              //       warnInfo += '或【' + otherUnitTwo + '】'
+              //     }
+              //     if (otherUnitThree) {
+              //       warnInfo += '或【' + otherUnitThree + '】'
+              //     }
+              //     warnInfo += '!'
+              //     this.$message.warning(warnInfo)
+              //     return
+              //   }
+              // }
               if (formData.sku) {
                 skuCount++
               }
@@ -1409,7 +1411,17 @@ export default {
     },
     onAdded(event) {
       const { row, target } = event
-      target.setValues([{ rowKey: row.id, values: { barCode: '', commodityUnit: '' } }])
+      let formUnit = ''
+      // 勾选多单位
+      if(this.unitChecked){
+        const obj = this.unitList.find(item => item.id === this.form.getFieldValue('unitId'))
+        if(obj){
+          formUnit = obj.basicUnit
+        }
+      }else{
+        formUnit = this.form.getFieldValue('unit')
+      }
+      target.setValues([{ rowKey: row.id, values: { barCode: '', commodityUnit: formUnit } }])
     },
     onDeleted(value) {
       this.meDeleteIdList = value
@@ -1678,15 +1690,16 @@ export default {
           basicLowDecimal = ''
         for (let i = 0; i < mArr.length; i++) {
           let mInfo = mArr[i]
+          mInfo.commodityUnit = basicUnit
           if (i === 0) {
-            mInfo.commodityUnit = basicUnit
+            // mInfo.commodityUnit = basicUnit
             basicPurchaseDecimal = mInfo.purchaseDecimal
             basicCommodityDecimal = mInfo.commodityDecimal
             basicWholesaleDecimal = mInfo.wholesaleDecimal
             basicLowDecimal = mInfo.lowDecimal
           } else {
             //副单位进行换算
-            mInfo.commodityUnit = otherUnit
+            // mInfo.commodityUnit = otherUnit
             if (basicPurchaseDecimal) {
               mInfo.purchaseDecimal = (basicPurchaseDecimal * ratio).toFixed(2)
             }
@@ -1700,7 +1713,7 @@ export default {
               mInfo.lowDecimal = (basicLowDecimal * ratio).toFixed(2)
             }
             if (otherUnitTwo && i === 2) {
-              mInfo.commodityUnit = otherUnitTwo
+              // mInfo.commodityUnit = otherUnitTwo
               if (basicPurchaseDecimal) {
                 mInfo.purchaseDecimal = (basicPurchaseDecimal * ratioTwo).toFixed(2)
               }
@@ -1715,7 +1728,7 @@ export default {
               }
             }
             if (otherUnitThree && i === 3) {
-              mInfo.commodityUnit = otherUnitThree
+              // mInfo.commodityUnit = otherUnitThree
               if (basicPurchaseDecimal) {
                 mInfo.purchaseDecimal = (basicPurchaseDecimal * ratioThree).toFixed(2)
               }

+ 13 - 0
pom.xml

@@ -147,6 +147,19 @@
 			<artifactId>hutool-all</artifactId>
 			<version>5.8.25</version>
 		</dependency>
+
+		<!-- 二维码 -->
+		<dependency>
+			<groupId>com.google.zxing</groupId>
+			<artifactId>core</artifactId>
+			<version>3.4.1</version>
+		</dependency>
+		<dependency>
+			<groupId>com.google.zxing</groupId>
+			<artifactId>javase</artifactId>
+			<version>3.4.1</version>
+		</dependency>
+
 	</dependencies>
 
 	<build>

+ 1 - 1
src/main/java/com/jsh/erp/base/AjaxResult.java

@@ -29,7 +29,7 @@ public class AjaxResult extends HashMap<String, Object>
     public enum Type
     {
         /** 成功 */
-        SUCCESS(0),
+        SUCCESS(200),
         /** 警告 */
         WARN(301),
         /** 错误 */

+ 86 - 0
src/main/java/com/jsh/erp/controller/pda/PdaController.java

@@ -0,0 +1,86 @@
+package com.jsh.erp.controller.pda;
+
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.jsh.erp.base.AjaxResult;
+import com.jsh.erp.base.BaseController;
+import com.jsh.erp.base.TableDataInfo;
+import com.jsh.erp.datasource.entities.DepotHead;
+import com.jsh.erp.datasource.entities.DepotItem;
+import com.jsh.erp.datasource.entities.Supplier;
+import com.jsh.erp.datasource.pda.dto.PDADepotHeadDTO;
+import com.jsh.erp.datasource.pda.vo.PDADepotHeadVO;
+import com.jsh.erp.datasource.pda.vo.PDADepotItemVO;
+import com.jsh.erp.query.LambdaQueryWrapperX;
+import com.jsh.erp.service.DepotHeadService;
+import com.jsh.erp.service.DepotItemService;
+import com.jsh.erp.service.SupplierService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@RestController
+@RequestMapping(value = "/pda")
+@Api(tags = {"PDA接口"})
+public class PdaController extends BaseController {
+
+    @Resource
+    private DepotHeadService depotHeadService;
+
+    @Resource
+    private DepotItemService depotItemService;
+
+    @Resource
+    private SupplierService supplierService;
+
+    /**
+     * 采购入库
+     * @return
+     */
+    @PostMapping ("/purchaseInventory")
+    @ApiOperation(value = "采购入库")
+    public TableDataInfo purchaseInventory(@RequestBody PDADepotHeadDTO pdaDepotHeadDTO) {
+        pdaDepotHeadDTO.setSubType("采购订单");
+        startPage();
+        List<PDADepotHeadVO> pdaDepotHeadVOList = depotHeadService.pdaList(pdaDepotHeadDTO);
+        return getDataTable(pdaDepotHeadVOList);
+    }
+
+    @PostMapping("/saleOrder")
+    @ApiOperation(value = "检货任务")
+    public TableDataInfo saleOrder(@RequestBody PDADepotHeadDTO pdaDepotHeadDTO) {
+        pdaDepotHeadDTO.setSubType("销售订单");
+        startPage();
+        List<PDADepotHeadVO> pdaDepotHeadVOList = depotHeadService.pdaList(pdaDepotHeadDTO);
+        return getDataTable(pdaDepotHeadVOList);
+    }
+
+    @ApiModelProperty(value = "订单详情")
+    @GetMapping("/orderInfo/{id}")
+    public AjaxResult orderInfo(@PathVariable("id") Long id){
+        DepotHead depotHead = depotHeadService.getOne(new LambdaQueryWrapperX<DepotHead>().eq(DepotHead::getId, id));
+        depotHead.setSupplierName(supplierService.getOne(new LambdaQueryWrapperX<Supplier>().eq(Supplier::getId, depotHead.getOrganId())).getSupplier());
+        return AjaxResult.success(depotHead);
+    }
+
+    @GetMapping("/orderDetail/{id}")
+    @ApiOperation("订单明细")
+    public TableDataInfo orderDetail(@PathVariable("id") Long id) {
+        startPage();
+        List<PDADepotItemVO> list = depotItemService.pdaList(id);
+        return getDataTable(list);
+    }
+
+    @ApiModelProperty("订单开始处理")
+    @GetMapping("/orderStartHandle/{id}")
+    public AjaxResult orderStartHandle(@PathVariable("id") Long id) {
+        depotHeadService.update(new UpdateWrapper<DepotHead>().set("status", "4").eq("id", id));
+        return AjaxResult.success();
+    }
+
+
+
+}

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

@@ -1,5 +1,7 @@
 package com.jsh.erp.datasource.entities;
 
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -10,6 +12,7 @@ import java.util.Date;
  * 单据主表实体类
  */
 @Data
+@TableName("jsh_depot_head")
 public class DepotHead {
 
     @ApiModelProperty("主键id")
@@ -111,6 +114,19 @@ public class DepotHead {
     @ApiModelProperty("凭证图片")
     private String voucherPicture;
 
+    @ApiModelProperty("二维码图片地址")
+    private String qrcodeUrl;
+
+    @ApiModelProperty("商品数量")
+    private int goodsQuantity;
+
+    @ApiModelProperty("商品总类数量")
+    private int goodsTypeCount;
+
+    @TableField(exist = false)
+    @ApiModelProperty("供应商名称")
+    private String supplierName;
+
     public Long getId() {
         return id;
     }

+ 2 - 0
src/main/java/com/jsh/erp/datasource/entities/DepotItem.java

@@ -1,5 +1,6 @@
 package com.jsh.erp.datasource.entities;
 
+import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -10,6 +11,7 @@ import java.util.Date;
  * 单据子表实体类
  */
 @Data
+@TableName("jsh_depot_item")
 public class DepotItem {
 
     @ApiModelProperty("主键id")

+ 5 - 0
src/main/java/com/jsh/erp/datasource/entities/Log.java

@@ -1,7 +1,12 @@
 package com.jsh.erp.datasource.entities;
 
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
 import java.util.Date;
 
+@Data
+@TableName("jsh_log")
 public class Log {
     private Long id;
 

+ 2 - 0
src/main/java/com/jsh/erp/datasource/entities/Material.java

@@ -2,6 +2,7 @@ package com.jsh.erp.datasource.entities;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import lombok.experimental.Accessors;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -10,6 +11,7 @@ import java.util.List;
  * 产品表实体类(商品信息)
  */
 @Data
+@Accessors(chain = true)
 public class Material {
 
     @ApiModelProperty("主键id")

+ 4 - 16
src/main/java/com/jsh/erp/datasource/entities/MaterialWithInitStock.java

@@ -1,29 +1,17 @@
 package com.jsh.erp.datasource.entities;
 
 import com.alibaba.fastjson.JSONObject;
+import lombok.Data;
+import lombok.experimental.Accessors;
 
 import java.math.BigDecimal;
 import java.util.Map;
 
+@Data
+@Accessors(chain = true)
 public class MaterialWithInitStock extends Material {
 
     private Map<Long, BigDecimal> stockMap;
 
     private JSONObject materialExObj;
-
-    public Map<Long, BigDecimal> getStockMap() {
-        return stockMap;
-    }
-
-    public void setStockMap(Map<Long, BigDecimal> stockMap) {
-        this.stockMap = stockMap;
-    }
-
-    public JSONObject getMaterialExObj() {
-        return materialExObj;
-    }
-
-    public void setMaterialExObj(JSONObject materialExObj) {
-        this.materialExObj = materialExObj;
-    }
 }

+ 8 - 5
src/main/java/com/jsh/erp/datasource/entities/Supplier.java

@@ -1,11 +1,14 @@
 package com.jsh.erp.datasource.entities;
 
+import com.baomidou.mybatisplus.annotation.TableName;
+
 import java.math.BigDecimal;
 
 /**
  * 供应商/客户信息表实体类
  *
  */
+@TableName("jsh_supplier")
 public class Supplier {
 
     /** 主键 */
@@ -96,7 +99,7 @@ public class Supplier {
     private String procurementContact;
 
     /** 到货天数(单位:天) */
-    private Integer deliverydays;
+    private Integer deliveryDays;
 
     /** 发票类型:0-普通发票, 1-增值税专用发票 */
     private String invoiceType;
@@ -337,12 +340,12 @@ public class Supplier {
         this.procurementContact = procurementContact == null ? null : procurementContact.trim();;
     }
 
-    public Integer getDeliverydays() {
-        return deliverydays;
+    public Integer getDeliveryDays() {
+        return deliveryDays;
     }
 
-    public void setDeliverydays(Integer deliverydays) {
-        this.deliverydays = deliverydays;
+    public void setDeliveryDays(Integer deliveryDays) {
+        this.deliveryDays = deliveryDays;
     }
 
     public String getInvoiceType() {

+ 9 - 0
src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapper.java

@@ -4,10 +4,19 @@ import com.jsh.erp.datasource.entities.DepotHead;
 import com.jsh.erp.datasource.entities.DepotHeadExample;
 import java.util.List;
 
+import com.jsh.erp.datasource.pda.dto.PDADepotHeadDTO;
+import com.jsh.erp.datasource.pda.vo.PDADepotHeadVO;
 import org.apache.ibatis.annotations.Param;
 
 public interface DepotHeadMapper extends BaseMapperX<DepotHead> {
 
+    /**
+     * PDA查询订单
+     * @param pdaDepotHeadDTO 筛选条件
+     * @return
+     */
+    List<PDADepotHeadVO> pdaList(PDADepotHeadDTO pdaDepotHeadDTO);
+
     long countByExample(DepotHeadExample example);
 
     int deleteByExample(DepotHeadExample example);

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

@@ -4,9 +4,19 @@ import com.jsh.erp.datasource.entities.DepotHead;
 import com.jsh.erp.datasource.entities.DepotItem;
 import com.jsh.erp.datasource.entities.DepotItemExample;
 import java.util.List;
+
+import com.jsh.erp.datasource.pda.vo.PDADepotItemVO;
 import org.apache.ibatis.annotations.Param;
 
 public interface DepotItemMapper  extends BaseMapperX<DepotItem>{
+
+    /**
+     * 根据单据ID获取单据详情
+     * @param id
+     * @return
+     */
+    List<PDADepotItemVO> pdaList(@Param("id") Long id);
+
     long countByExample(DepotItemExample example);
 
     int deleteByExample(DepotItemExample example);

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

@@ -2,7 +2,6 @@ package com.jsh.erp.datasource.mappers;
 
 import com.jsh.erp.datasource.entities.*;
 import com.jsh.erp.datasource.vo.MaterialVoSearch;
-import com.jsh.erp.datasource.vo.MaterialVo;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;

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

@@ -5,7 +5,7 @@ import com.jsh.erp.datasource.entities.SupplierExample;
 import java.util.List;
 import org.apache.ibatis.annotations.Param;
 
-public interface SupplierMapper {
+public interface SupplierMapper extends BaseMapperX<Supplier> {
     long countByExample(SupplierExample example);
 
     int deleteByExample(SupplierExample example);

+ 23 - 0
src/main/java/com/jsh/erp/datasource/pda/dto/PDADepotHeadDTO.java

@@ -0,0 +1,23 @@
+package com.jsh.erp.datasource.pda.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class PDADepotHeadDTO {
+
+    @ApiModelProperty("开始时间")
+    private String beginTime;
+
+    @ApiModelProperty("结束时间")
+    private String endTime;
+
+    @ApiModelProperty("单据编号")
+    private String number;
+
+    @ApiModelProperty("状态 0.未审核,1.已审核,2.已完成,3.部分完成,4.进行中,9.审核中")
+    private String status;
+
+    @ApiModelProperty("单据类型")
+    private String subType;
+}

+ 32 - 0
src/main/java/com/jsh/erp/datasource/pda/vo/PDADepotHeadVO.java

@@ -0,0 +1,32 @@
+package com.jsh.erp.datasource.pda.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class PDADepotHeadVO {
+
+    @ApiModelProperty("主键ID")
+    private Long id;
+
+    @ApiModelProperty("单据编号")
+    private String number;
+
+    @ApiModelProperty("供应商名称")
+    private String supplierName;
+
+    @ApiModelProperty("订单创建时间")
+    private Date createTime;
+
+    @ApiModelProperty("商品总数量")
+    private int goodsQuantity;
+
+    @ApiModelProperty("商品总类")
+    private String goodsTypeCount;
+
+    @ApiModelProperty("订单状态")
+    private String status;
+
+}

+ 43 - 0
src/main/java/com/jsh/erp/datasource/pda/vo/PDADepotItemVO.java

@@ -0,0 +1,43 @@
+package com.jsh.erp.datasource.pda.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@Accessors
+public class PDADepotItemVO{
+
+    @ApiModelProperty("商品名称")
+    private String materialName;
+
+    @ApiModelProperty("商品规格")
+    private String materialStandard;
+
+    @ApiModelProperty("批次号")
+    private String batchNumber;
+
+    @ApiModelProperty("生产日期")
+    private Date productionDate;
+
+    @ApiModelProperty("商品库位")
+    private String position;
+
+    @ApiModelProperty("商品库存")
+    private String inventory;
+
+    @ApiModelProperty("商品条码")
+    private String barCode;
+
+    @ApiModelProperty("订单数量")
+    private BigDecimal operNumber;
+
+    @ApiModelProperty("库存单位")
+    private String commodityUnit;
+
+    @ApiModelProperty("商品单位")
+    private String materialUnit;
+}

+ 0 - 22
src/main/java/com/jsh/erp/datasource/vo/MaterialVo.java

@@ -1,22 +0,0 @@
-package com.jsh.erp.datasource.vo;
-
-import com.jsh.erp.datasource.entities.Material;
-import com.jsh.erp.datasource.entities.MaterialExtend;
-
-import java.util.List;
-
-/**
- * 商品信息表加子表集合信息
- */
-public class MaterialVo extends Material{
-
-    private List<MaterialExtend> list;
-
-    public List<MaterialExtend> getList() {
-        return list;
-    }
-
-    public void setList(List<MaterialExtend> list) {
-        this.list = list;
-    }
-}

+ 2 - 0
src/main/java/com/jsh/erp/filter/LogCostFilter.java

@@ -14,6 +14,7 @@ import java.io.IOException;
 @WebFilter(filterName = "LogCostFilter", urlPatterns = {"/*"},
         initParams = {@WebInitParam(name = "filterPath",
                       value = "/user/login#" +
+                              "user/pdaLogin#" +
                               "/user/weixinLogin#" +
                               "/user/weixinBind#" +
                               "/user/registerUser#" +
@@ -54,6 +55,7 @@ public class LogCostFilter implements Filter {
             return;
         }
         if (requestUrl != null && (requestUrl.contains("/doc.html") ||
+            requestUrl.contains("/user/pdaLogin") ||
             requestUrl.contains("/user/login") || requestUrl.contains("/user/register") || requestUrl.contains("/user/randomImage"))) {
             chain.doFilter(request, response);
             return;

+ 12 - 1
src/main/java/com/jsh/erp/service/DepotHeadService.java

@@ -1,7 +1,10 @@
 package com.jsh.erp.service;
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.jsh.erp.datasource.entities.DepotHead;
+import com.jsh.erp.datasource.pda.dto.PDADepotHeadDTO;
+import com.jsh.erp.datasource.pda.vo.PDADepotHeadVO;
 import com.jsh.erp.datasource.vo.DepotHeadVo4InDetail;
 import com.jsh.erp.datasource.vo.DepotHeadVo4InOutMCount;
 import com.jsh.erp.datasource.vo.DepotHeadVo4List;
@@ -14,7 +17,15 @@ import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
-public interface DepotHeadService {
+public interface DepotHeadService extends IService<DepotHead> {
+
+    /**
+     * PDA查询订单
+     * @param pdaDepotHeadDTO 筛选条件
+     * @return
+     */
+    List<PDADepotHeadVO> pdaList(PDADepotHeadDTO pdaDepotHeadDTO);
+
     DepotHead getDepotHead(long id)throws Exception;
 
     List<DepotHead> getDepotHead()throws Exception;

+ 10 - 1
src/main/java/com/jsh/erp/service/DepotItemService.java

@@ -2,7 +2,9 @@ package com.jsh.erp.service;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.jsh.erp.datasource.entities.*;
+import com.jsh.erp.datasource.pda.vo.PDADepotItemVO;
 import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
 import com.jsh.erp.datasource.vo.DepotItemVoBatchNumberList;
 import com.jsh.erp.datasource.vo.InOutPriceVo;
@@ -13,7 +15,14 @@ import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
-public interface DepotItemService {
+public interface DepotItemService extends IService<DepotItem> {
+
+    /**
+     * pda根据订单信息查询商品列表
+     * @return
+     */
+    List<PDADepotItemVO> pdaList(Long id);
+
     DepotItem getDepotItem(long id)throws Exception;
 
     List<DepotItem> getDepotItem()throws Exception;

+ 2 - 1
src/main/java/com/jsh/erp/service/LogService.java

@@ -1,6 +1,7 @@
 package com.jsh.erp.service;
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.jsh.erp.datasource.entities.Log;
 import com.jsh.erp.datasource.vo.LogVo4List;
 import org.springframework.transaction.annotation.Transactional;
@@ -8,7 +9,7 @@ import org.springframework.transaction.annotation.Transactional;
 import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 
-public interface LogService {
+public interface LogService extends IService<Log> {
 
     Log getLog(long id)throws Exception;
 

+ 1 - 0
src/main/java/com/jsh/erp/service/MaterialService.java

@@ -162,4 +162,5 @@ public interface MaterialService {
     List<MaterialVo4Unit> getMaterialByBatchNumber(String batchNumber);
 
     Material getMaterialById(Long id);
+
 }

+ 59 - 684
src/main/java/com/jsh/erp/service/SupplierService.java

@@ -1,717 +1,92 @@
 package com.jsh.erp.service;
 
 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.datasource.vo.DepotHeadVo4StatementAccount;
-import com.jsh.erp.exception.BusinessRunTimeException;
-import com.jsh.erp.exception.JshException;
-import com.jsh.erp.utils.*;
-import jxl.Sheet;
-import jxl.Workbook;
-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.Supplier;
+import com.jsh.erp.utils.BaseResponseInfo;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
 import org.springframework.web.multipart.MultipartFile;
 
-import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.io.File;
 import java.math.BigDecimal;
-import java.util.*;
-
-
-@Service
-public class SupplierService {
-    private Logger logger = LoggerFactory.getLogger(SupplierService.class);
-
-    @Resource
-    private SupplierMapper supplierMapper;
-
-    @Resource
-    private SupplierMapperEx supplierMapperEx;
-    @Resource
-    private LogService logService;
-    @Resource
-    private UserService userService;
-    @Resource
-    private AccountHeadMapperEx accountHeadMapperEx;
-    @Resource
-    private DepotHeadMapperEx depotHeadMapperEx;
-    @Resource
-    private AccountItemMapperEx accountItemMapperEx;
-    @Resource
-    private DepotHeadService depotHeadService;
-    @Resource
-    private UserBusinessService userBusinessService;
-    @Resource
-    private UserBusinessMapper userBusinessMapper;
-
-    public Supplier getSupplier(long id)throws Exception {
-        Supplier result=null;
-        try{
-            result=supplierMapper.selectByPrimaryKey(id);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        return result;
-    }
-
-    public List<Supplier> getSupplierListByIds(String ids)throws Exception {
-        List<Long> idList = StringUtil.strToLongList(ids);
-        List<Supplier> list = new ArrayList<>();
-        try{
-            SupplierExample example = new SupplierExample();
-            example.createCriteria().andIdIn(idList);
-            list = supplierMapper.selectByExample(example);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        return list;
-    }
-
-    public List<Supplier> getSupplier()throws Exception {
-        SupplierExample example = new SupplierExample();
-        example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
-        List<Supplier> list=null;
-        try{
-            list=supplierMapper.selectByExample(example);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        return list;
-    }
-
-    public List<Supplier> select(String supplier, String type, String phonenum, String telephone) throws Exception{
-        List<Supplier> list = new ArrayList<>();
-        try{
-            String [] creatorArray = depotHeadService.getCreatorArray();
-            PageUtils.startPage();
-            list = supplierMapperEx.selectByConditionSupplier(supplier, type, phonenum, telephone, creatorArray);
-            for(Supplier s : list) {
-                Integer supplierId = s.getId().intValue();
-                String beginTime = Tools.getYearBegin();
-                String endTime = Tools.getCenternTime(new Date());
-                BigDecimal sum = BigDecimal.ZERO;
-                String supplierType = type;
-                String inOutType = "";
-                String subType = "";
-                String typeBack = "";
-                String subTypeBack = "";
-                String billType = "";
-                if (("供应商").equals(supplierType)) {
-                    inOutType = "入库";
-                    subType = "采购";
-                    typeBack = "出库";
-                    subTypeBack = "采购退货";
-                    billType = "付款";
-                } else if (("客户").equals(supplierType)) {
-                    inOutType = "出库";
-                    subType = "销售";
-                    typeBack = "入库";
-                    subTypeBack = "销售退货";
-                    billType = "收款";
-                }
-                List<DepotHeadVo4StatementAccount> saList = depotHeadService.getStatementAccount(beginTime, endTime, supplierId, null,
-                        1, supplierType, inOutType, subType, typeBack, subTypeBack, billType, null, null);
-                if(saList.size()>0) {
-                    DepotHeadVo4StatementAccount item = saList.get(0);
-                    //期初 = 起始期初金额+上期欠款金额-上期退货的欠款金额-上期收付款
-                    BigDecimal preNeed = item.getBeginNeed().add(item.getPreDebtMoney()).subtract(item.getPreReturnDebtMoney()).subtract(item.getPreBackMoney());
-                    item.setPreNeed(preNeed);
-                    //实际欠款 = 本期欠款-本期退货的欠款金额
-                    BigDecimal realDebtMoney = item.getDebtMoney().subtract(item.getReturnDebtMoney());
-                    item.setDebtMoney(realDebtMoney);
-                    //期末 = 期初+实际欠款-本期收款
-                    BigDecimal allNeedGet = preNeed.add(realDebtMoney).subtract(item.getBackMoney());
-                    sum = sum.add(allNeedGet);
-                }
-                if(("客户").equals(s.getType())) {
-                    s.setAllNeedGet(sum);
-                } else if(("供应商").equals(s.getType())) {
-                    s.setAllNeedPay(sum);
-                }
-            }
-        } catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        return list;
-    }
+import java.util.List;
+import java.util.Map;
+
+public interface SupplierService extends IService<Supplier> {
+    Supplier getSupplier(long id)throws Exception;
+
+    List<Supplier> getSupplierListByIds(String ids)throws Exception;
+
+    List<Supplier> getSupplier()throws Exception;
+
+    List<Supplier> select(String supplier, String type, String phonenum, String telephone) throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int insertSupplier(JSONObject obj, HttpServletRequest request)throws Exception {
-        Supplier supplier = JSONObject.parseObject(obj.toJSONString(), Supplier.class);
-        int result=0;
-        try{
-            supplier.setEnabled(true);
-            User userInfo=userService.getCurrentUser();
-            supplier.setCreator(userInfo==null?null:userInfo.getId());
-            result=supplierMapper.insertSelective(supplier);
-            //新增客户时给当前用户自动授权
-            setUserCustomerPermission(request, supplier);
-            logService.insertLog("商家",
-                    new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(supplier.getSupplier()).toString(),request);
-        }catch(Exception e){
-            JshException.writeFail(logger, e);
-        }
-        return result;
-    }
+    int insertSupplier(JSONObject obj, HttpServletRequest request)throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int updateSupplier(JSONObject obj, HttpServletRequest request)throws Exception {
-        Supplier supplier = JSONObject.parseObject(obj.toJSONString(), Supplier.class);
-        if(supplier.getBeginNeedPay() == null) {
-            supplier.setBeginNeedPay(BigDecimal.ZERO);
-        }
-        if(supplier.getBeginNeedGet() == null) {
-            supplier.setBeginNeedGet(BigDecimal.ZERO);
-        }
-        int result=0;
-        try{
-            result=supplierMapper.updateByPrimaryKeySelective(supplier);
-            logService.insertLog("商家",
-                    new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(supplier.getSupplier()).toString(), request);
-        }catch(Exception e){
-            JshException.writeFail(logger, e);
-        }
-        return result;
-    }
+    int updateSupplier(JSONObject obj, HttpServletRequest request)throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int deleteSupplier(Long id, HttpServletRequest request)throws Exception {
-        return batchDeleteSupplierByIds(id.toString());
-    }
+    int deleteSupplier(Long id, HttpServletRequest request)throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int batchDeleteSupplier(String ids, HttpServletRequest request) throws Exception{
-        return batchDeleteSupplierByIds(ids);
-    }
+    int batchDeleteSupplier(String ids, HttpServletRequest request) throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int batchDeleteSupplierByIds(String ids)throws Exception {
-        int result=0;
-        String [] idArray=ids.split(",");
-        //校验财务主表	jsh_accounthead
-        List<AccountHead> accountHeadList=null;
-        try{
-            accountHeadList = accountHeadMapperEx.getAccountHeadListByOrganIds(idArray);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        if(accountHeadList!=null&&accountHeadList.size()>0){
-            logger.error("异常码[{}],异常提示[{}],参数,OrganIds[{}]",
-                    ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
-            throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
-                    ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
-        }
-        //校验单据主表	jsh_depot_head
-        List<DepotHead> depotHeadList=null;
-        try{
-            depotHeadList = depotHeadMapperEx.getDepotHeadListByOrganIds(idArray);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        if(depotHeadList!=null&&depotHeadList.size()>0){
-            logger.error("异常码[{}],异常提示[{}],参数,OrganIds[{}]",
-                    ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
-            throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
-                    ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
-        }
-        //记录日志
-        StringBuffer sb = new StringBuffer();
-        sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
-        List<Supplier> list = getSupplierListByIds(ids);
-        for(Supplier supplier: list){
-            sb.append("[").append(supplier.getSupplier()).append("]");
-        }
-        logService.insertLog("商家", sb.toString(),
-                ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
-        User userInfo=userService.getCurrentUser();
-        //校验通过执行删除操作
-        try{
-            result = supplierMapperEx.batchDeleteSupplierByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
-        }catch(Exception e){
-            JshException.writeFail(logger, e);
-        }
-        return result;
-    }
-
-    public int checkIsNameExist(Long id, String name)throws Exception {
-        SupplierExample example = new SupplierExample();
-        example.createCriteria().andIdNotEqualTo(id).andSupplierEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
-        List<Supplier> list=null;
-        try{
-            list= supplierMapper.selectByExample(example);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        return list==null?0:list.size();
-    }
-
-    public int checkIsNameAndTypeExist(Long id, String name, String type)throws Exception {
-        name = name == null? "": name;
-        SupplierExample example = new SupplierExample();
-        example.createCriteria().andIdNotEqualTo(id).andSupplierEqualTo(name).andTypeEqualTo(type)
-                .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
-        List<Supplier> list=null;
-        try{
-            list= supplierMapper.selectByExample(example);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        return list==null?0:list.size();
-    }
-
-    /**
-     * 更新会员的预付款
-     * @param supplierId
-     */
+    int batchDeleteSupplierByIds(String ids)throws Exception;
+
+    int checkIsNameExist(Long id, String name)throws Exception;
+
+    int checkIsNameAndTypeExist(Long id, String name, String type)throws Exception;
+
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public void updateAdvanceIn(Long supplierId) {
-        try{
-            //查询会员在收预付款单据的总金额
-            BigDecimal financialAllPrice = accountHeadMapperEx.getFinancialAllPriceByOrganId(supplierId);
-            //查询会员在零售出库单据的总金额
-            BigDecimal billAllPrice = depotHeadMapperEx.getBillAllPriceByOrganId(supplierId);
-            Supplier supplier = new Supplier();
-            supplier.setId(supplierId);
-            supplier.setAdvanceIn(financialAllPrice.subtract(billAllPrice));
-            supplierMapper.updateByPrimaryKeySelective(supplier);
-        } catch (Exception e){
-            JshException.writeFail(logger, e);
-        }
-    }
-
-    public List<Supplier> findBySelectCus()throws Exception {
-        SupplierExample example = new SupplierExample();
-        example.createCriteria().andTypeLike("客户").andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
-        example.setOrderByClause("sort asc, id desc");
-        List<Supplier> list=null;
-        try{
-            list = supplierMapper.selectByExample(example);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        return list;
-    }
-
-    public List<Supplier> findBySelectSup()throws Exception {
-        SupplierExample example = new SupplierExample();
-        example.createCriteria().andTypeLike("供应商").andEnabledEqualTo(true)
-                .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
-        example.setOrderByClause("sort asc, id desc");
-        List<Supplier> list=null;
-        try{
-            list = supplierMapper.selectByExample(example);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        return list;
-    }
-
-    public List<Supplier> findBySelectRetail()throws Exception {
-        SupplierExample example = new SupplierExample();
-        example.createCriteria().andTypeLike("会员").andEnabledEqualTo(true)
-                .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
-        example.setOrderByClause("sort asc, id desc");
-        List<Supplier> list=null;
-        try{
-            list = supplierMapper.selectByExample(example);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        return list;
-    }
-
-    public List<Supplier> findById(Long supplierId)throws Exception {
-        SupplierExample example = new SupplierExample();
-        example.createCriteria().andIdEqualTo(supplierId)
-                .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
-        example.setOrderByClause("sort asc, id desc");
-        List<Supplier> list=null;
-        try{
-            list = supplierMapper.selectByExample(example);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        return list;
-    }
+    void updateAdvanceIn(Long supplierId);
+
+    List<Supplier> findBySelectCus()throws Exception;
+
+    List<Supplier> findBySelectSup()throws Exception;
+
+    List<Supplier> findBySelectRetail()throws Exception;
+
+    List<Supplier> findById(Long supplierId)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> supplierIds = StringUtil.strToLongList(ids);
-        Supplier supplier = new Supplier();
-        supplier.setEnabled(status);
-        SupplierExample example = new SupplierExample();
-        example.createCriteria().andIdIn(supplierIds);
-        int result=0;
-        try{
-            result = supplierMapper.updateByExampleSelective(supplier, example);
-        }catch(Exception e){
-            JshException.writeFail(logger, e);
-        }
-        return result;
-    }
-
-    public List<Supplier> findUserCustomer()throws Exception{
-        SupplierExample example = new SupplierExample();
-        example.createCriteria().andTypeEqualTo("客户")
-                .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
-        example.setOrderByClause("sort asc, id desc");
-        List<Supplier> list=null;
-        try{
-            list = supplierMapper.selectByExample(example);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        return list;
-    }
-
-    public List<Supplier> findByAll(String supplier, String type, String phonenum, String telephone) throws Exception{
-        List<Supplier> list=null;
-        try{
-            list = supplierMapperEx.findByAll(supplier, type, phonenum, telephone);
-        }catch(Exception e){
-            JshException.readFail(logger, e);
-        }
-        return list;
-    }
-
-    public Map<String, Object> getBeginNeedByOrganId(Long organId) throws Exception {
-        Supplier supplier = getSupplier(organId);
-        Map<String, Object> map = new HashMap<>();
-        BigDecimal needDebt = BigDecimal.ZERO;
-        if("供应商".equals(supplier.getType())) {
-            needDebt = supplier.getBeginNeedPay();
-        } else if("客户".equals(supplier.getType())) {
-            needDebt = supplier.getBeginNeedGet();
-        }
-        BigDecimal finishDebt = accountItemMapperEx.getFinishDebtByOrganId(organId).abs();
-        BigDecimal eachAmount = BigDecimal.ZERO;
-        if(needDebt != null) {
-            eachAmount = needDebt.subtract(finishDebt);
-        }
-        //应收欠款
-        map.put("needDebt", needDebt);
-        //已收欠款
-        map.put("finishDebt", finishDebt);
-        //本次收款
-        map.put("eachAmount", eachAmount);
-        return map;
-    }
+    int batchSetStatus(Boolean status, String ids)throws Exception;
+
+    List<Supplier> findUserCustomer()throws Exception;
+
+    List<Supplier> findByAll(String supplier, String type, String phonenum, String telephone) throws Exception;
+
+    Map<String, Object> getBeginNeedByOrganId(Long organId) throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public void importVendor(MultipartFile file, HttpServletRequest request) throws Exception{
-        String type = "供应商";
-        User userInfo = userService.getCurrentUser();
-        Workbook workbook = Workbook.getWorkbook(file.getInputStream());
-        Sheet src = workbook.getSheet(0);
-        //'名称', '联系人', '手机号码', '联系电话', '电子邮箱', '纳税人识别号', '开具发票情况','税率(%)', '开户行', '账号', '地址', '供应商分级', '结算方式',	'账单周期', '采购对接人', '到货天数', '备注', '排序', '状态'
-        List<Supplier> sList = new ArrayList<>();
-        for (int i = 2; i < src.getRows(); i++) {
-            String supplierName = ExcelUtils.getContent(src, i, 0);
-            String enabled = ExcelUtils.getContent(src, i, 18);
-            if(StringUtil.isNotEmpty(supplierName) && StringUtil.isNotEmpty(enabled)) {
-                Supplier s = new Supplier();
-                s.setType(type);
-                s.setSupplier(supplierName);
-                s.setContacts(ExcelUtils.getContent(src, i, 1));
-                s.setTelephone(ExcelUtils.getContent(src, i, 2));
-                s.setPhoneNum(ExcelUtils.getContent(src, i, 3));
-                s.setEmail(ExcelUtils.getContent(src, i, 4));
-                s.setTaxNum(ExcelUtils.getContent(src, i, 5));
-                s.setInvoiceType(ExcelUtils.getContent(src, i, 6));
-                s.setTaxRate(parseBigDecimalEx(ExcelUtils.getContent(src, i, 7)));
-                s.setBankName(ExcelUtils.getContent(src, i, 8));
-                s.setAccountNumber(ExcelUtils.getContent(src, i, 9));
-                s.setAddress(ExcelUtils.getContent(src, i, 10));
-                s.setSupplierLevel(ExcelUtils.getContent(src, i, 11));
-                s.setSettlementMethod(ExcelUtils.getContent(src, i, 12));
-                s.setBillingCycleDays(parseIntegerFromExcel(ExcelUtils.getContent(src, i, 13)));
-                s.setProcurementContact(ExcelUtils.getContent(src, i, 14));
-                s.setDeliverydays(parseIntegerFromExcel(ExcelUtils.getContent(src, i, 15)));
-                s.setDescription(ExcelUtils.getContent(src, i, 16));
-                s.setSort(ExcelUtils.getContent(src, i, 17));
-                s.setCreator(userInfo==null?null:userInfo.getId());
-                s.setEnabled("1".equals(enabled));
-                sList.add(s);
-            }
-        }
-        importExcel(sList, type, request);
-    }
-
-    private Integer parseIntegerFromExcel(String content) {
-        if (content != null && !content.isEmpty()) {
-            try {
-                return Integer.valueOf(content);
-            } catch (NumberFormatException e) {
-                logger.error("无法解析整数值: {}", content, e);
-                return null;
-            }
-        }
-        return null;
-    }
+    void importVendor(MultipartFile file, HttpServletRequest request) throws Exception;
+
+    Integer parseIntegerFromExcel(String content);
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public void importCustomer(MultipartFile file, HttpServletRequest request) throws Exception{
-        String type = "客户";
-        User userInfo = userService.getCurrentUser();
-        Workbook workbook = Workbook.getWorkbook(file.getInputStream());
-        Sheet src = workbook.getSheet(0);
-        //'名称', '联系人', '手机号码', '联系电话', '电子邮箱', '传真', '期初应收', '纳税人识别号', '税率(%)', '开户行', '账号', '地址', '备注', '排序', '状态'
-        List<Supplier> sList = new ArrayList<>();
-        for (int i = 2; i < src.getRows(); i++) {
-            String supplierName = ExcelUtils.getContent(src, i, 0);
-            String enabled = ExcelUtils.getContent(src, i, 14);
-            if(StringUtil.isNotEmpty(supplierName) && StringUtil.isNotEmpty(enabled)) {
-                Supplier s = new Supplier();
-                s.setType(type);
-                s.setSupplier(supplierName);
-                s.setContacts(ExcelUtils.getContent(src, i, 1));
-                s.setTelephone(ExcelUtils.getContent(src, i, 2));
-                s.setPhoneNum(ExcelUtils.getContent(src, i, 3));
-                s.setEmail(ExcelUtils.getContent(src, i, 4));
-                s.setFax(ExcelUtils.getContent(src, i, 5));
-                s.setBeginNeedGet(parseBigDecimalEx(ExcelUtils.getContent(src, i, 6)));
-                s.setTaxNum(ExcelUtils.getContent(src, i, 7));
-                s.setTaxRate(parseBigDecimalEx(ExcelUtils.getContent(src, i, 8)));
-                s.setBankName(ExcelUtils.getContent(src, i, 9));
-                s.setAccountNumber(ExcelUtils.getContent(src, i, 10));
-                s.setAddress(ExcelUtils.getContent(src, i, 11));
-                s.setDescription(ExcelUtils.getContent(src, i, 12));
-                s.setSort(ExcelUtils.getContent(src, i, 13));
-                s.setCreator(userInfo==null?null:userInfo.getId());
-                s.setEnabled("1".equals(enabled));
-                sList.add(s);
-            }
-        }
-        importExcel(sList, type, request);
-    }
+    void importCustomer(MultipartFile file, HttpServletRequest request) throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public void importMember(MultipartFile file, HttpServletRequest request) throws Exception{
-        String type = "会员";
-        User userInfo = userService.getCurrentUser();
-        Workbook workbook = Workbook.getWorkbook(file.getInputStream());
-        Sheet src = workbook.getSheet(0);
-        //'名称', '联系人', '手机号码', '联系电话', '电子邮箱', '备注', '排序', '状态'
-        List<Supplier> sList = new ArrayList<>();
-        for (int i = 2; i < src.getRows(); i++) {
-            String supplierName = ExcelUtils.getContent(src, i, 0);
-            String enabled = ExcelUtils.getContent(src, i, 7);
-            if(StringUtil.isNotEmpty(supplierName) && StringUtil.isNotEmpty(enabled)) {
-                Supplier s = new Supplier();
-                s.setType(type);
-                s.setSupplier(supplierName);
-                s.setContacts(ExcelUtils.getContent(src, i, 1));
-                s.setTelephone(ExcelUtils.getContent(src, i, 2));
-                s.setPhoneNum(ExcelUtils.getContent(src, i, 3));
-                s.setEmail(ExcelUtils.getContent(src, i, 4));
-                s.setDescription(ExcelUtils.getContent(src, i, 5));
-                s.setSort(ExcelUtils.getContent(src, i, 6));
-                s.setCreator(userInfo==null?null:userInfo.getId());
-                s.setEnabled("1".equals(enabled));
-                sList.add(s);
-            }
-        }
-        importExcel(sList, type, request);
-    }
+    void importMember(MultipartFile file, HttpServletRequest request) throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public BaseResponseInfo importExcel(List<Supplier> mList, String type, HttpServletRequest request) throws Exception {
-        logService.insertLog(type,
-                new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_IMPORT).append(mList.size()).append(BusinessConstants.LOG_DATA_UNIT).toString(),
-                ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
-        BaseResponseInfo info = new BaseResponseInfo();
-        Map<String, Object> data = new HashMap<>();
-        try {
-            for(Supplier supplier: mList) {
-                SupplierExample example = new SupplierExample();
-                example.createCriteria().andSupplierEqualTo(supplier.getSupplier()).andTypeEqualTo(type).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
-                List<Supplier> list= supplierMapper.selectByExample(example);
-                if(list.size() <= 0) {
-                    supplierMapper.insertSelective(supplier);
-                    //新增客户时给当前用户自动授权
-                    setUserCustomerPermission(request, supplier);
-                } else {
-                    Long id = list.get(0).getId();
-                    supplier.setId(id);
-                    supplierMapper.updateByPrimaryKeySelective(supplier);
-                }
-            }
-            info.code = 200;
-            data.put("message", "成功");
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            info.code = 500;
-            data.put("message", e.getMessage());
-        }
-        info.data = data;
-        return info;
-    }
-
-    public BigDecimal parseBigDecimalEx(String str)throws Exception{
-        if(!StringUtil.isEmpty(str)) {
-            return new BigDecimal(str);
-        } else {
-            return null;
-        }
-    }
-
-    public File exportExcel(List<Supplier> dataList, String type) throws Exception {
-        if("供应商".equals(type)) {
-            return exportExcelVendorOrCustomer(dataList, type);
-        } else if("客户".equals(type)) {
-            return exportExcelVendorOrCustomer(dataList, type);
-        } else {
-            //会员
-            String[] names = {"会员卡号*", "联系人", "手机号码", "联系电话", "电子邮箱", "备注", "排序", "状态*"};
-            String title = "信息内容";
-            List<String[]> objects = new ArrayList<String[]>();
-            if (null != dataList) {
-                for (Supplier s : dataList) {
-                    String[] objs = new String[names.length];
-                    objs[0] = s.getSupplier();
-                    objs[1] = s.getContacts();
-                    objs[2] = s.getTelephone();
-                    objs[3] = s.getPhoneNum();
-                    objs[4] = s.getEmail();
-                    objs[5] = s.getDescription();
-                    objs[6] = s.getSort();
-                    objs[7] = s.getEnabled() ? "1" : "0";
-                    objects.add(objs);
-                }
-            }
-            return ExcelUtils.exportObjectsOneSheet(title, "*导入时本行内容请勿删除,切记!", names, title, objects);
-        }
-    }
-
-    private File exportExcelVendorOrCustomer(List<Supplier> dataList, String type) throws Exception {
-        /*String beginNeedStr = "";
-        if("供应商".equals(type)) {
-            beginNeedStr = "期初应付";
-        } else if("客户".equals(type)) {
-            beginNeedStr = "期初应收";
-        }*/
-        String[] names = {"名称*", "联系人", "手机号码", "联系电话", "电子邮箱",
-                "纳税人识别号", "发票类型","税率(%)", "开户行", "账号", "地址","供应商分级",
-                "结算方式", "账单周期", "采购对接人", "到货天数", "备注", "排序", "状态*"};
-        String title = "信息内容";
-        List<String[]> objects = new ArrayList<String[]>();
-        if (null != dataList) {
-            for (Supplier s : dataList) {
-                String[] objs = new String[names.length];
-                objs[0] = s.getSupplier();
-                objs[1] = s.getContacts();
-                objs[2] = s.getTelephone();
-                objs[3] = s.getPhoneNum();
-                objs[4] = s.getEmail();
-                /*if(("客户").equals(s.getType())) {
-                    objs[6] = s.getBeginNeedGet() == null? "" : s.getBeginNeedGet().setScale(2,BigDecimal.ROUND_HALF_UP).toString();
-                } else if(("供应商").equals(s.getType())) {
-                    objs[6] = s.getBeginNeedPay() == null? "" : s.getBeginNeedPay().setScale(2,BigDecimal.ROUND_HALF_UP).toString();
-                }*/
-                objs[5] = s.getTaxNum();
-                // 发票类型
-                objs[6] = mapInvoiceType(s.getInvoiceType());
-                // 税率
-                objs[7] = s.getTaxRate() == null? "" : s.getTaxRate().setScale(2,BigDecimal.ROUND_HALF_UP).toString();
-
-                // 银行信息
-                objs[8] = s.getBankName();
-                objs[9] = s.getAccountNumber();
-                objs[10] = s.getAddress();
-
-                // 供应商分级
-                objs[11] = s.getSupplierLevel();
-
-                // 结算方式
-                objs[12] = mapSettlementMethod(s.getSettlementMethod());
-                // 账单周期
-                objs[13] = s.getBillingCycleDays() == null? "" : s.getBillingCycleDays().toString();
-                // 采购对接人
-                objs[14] = s.getProcurementContact();
-                // 到货天数
-                objs[15] = s.getDeliverydays() == null? "" : s.getDeliverydays().toString();
-                objs[16] = s.getDescription();
-                objs[17] = s.getSort();
-                objs[18] = s.getEnabled() ? "1" : "0";
-                objects.add(objs);
-            }
-        }
-        return ExcelUtils.exportObjectsOneSheet(title, "*导入时本行内容请勿删除,切记!", names, title, objects);
-    }
-
-    private String mapInvoiceType(String invoiceType) {
-        if ("0".equals(invoiceType)) {
-            return "普通发票";
-        } else if ("1".equals(invoiceType)) {
-            return "增值税专用发票";
-        }
-        return "";
-    }
-
-    private String mapSettlementMethod(String settlementMethod) {
-        if ("0".equals(settlementMethod)) {
-            return "周结";
-        } else if ("1".equals(settlementMethod)) {
-            return "现结/按单";
-        } else if ("2".equals(settlementMethod)) {
-            return "预付款";
-        } else if ("3".equals(settlementMethod)) {
-            return "月结";
-        }
-        return "";
-    }
-
-    /**
-     * 新增客户时给当前用户自动授权
-     * @param request
-     * @param supplier
-     * @throws Exception
-     */
-    private void setUserCustomerPermission(HttpServletRequest request, Supplier supplier) throws Exception {
-        if("客户".equals(supplier.getType())) {
-            Long userId = userService.getUserId(request);
-            Supplier sInfo = supplierMapperEx.getSupplierByNameAndType(supplier.getSupplier(), supplier.getType());
-            String ubKey = "[" + sInfo.getId() + "]";
-            List<UserBusiness> ubList = userBusinessService.getBasicData(userId.toString(), "UserCustomer");
-            if(ubList ==null || ubList.size() == 0) {
-                JSONObject ubObj = new JSONObject();
-                ubObj.put("type", "UserCustomer");
-                ubObj.put("keyId", userId);
-                ubObj.put("value", ubKey);
-                UserBusiness userBusiness = JSONObject.parseObject(ubObj.toJSONString(), UserBusiness.class);
-                userBusinessMapper.insertSelective(userBusiness);
-            } 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);
-                UserBusiness userBusiness = JSONObject.parseObject(ubObj.toJSONString(), UserBusiness.class);
-                userBusinessMapper.updateByPrimaryKeySelective(userBusiness);
-            }
-        }
-    }
+    BaseResponseInfo importExcel(List<Supplier> mList, String type, HttpServletRequest request) throws Exception;
+
+    BigDecimal parseBigDecimalEx(String str)throws Exception;
+
+    File exportExcel(List<Supplier> dataList, String type) throws Exception;
+
+    File exportExcelVendorOrCustomer(List<Supplier> dataList, String type) throws Exception;
+
+    String mapInvoiceType(String invoiceType);
+
+    String mapSettlementMethod(String settlementMethod);
+
+    void setUserCustomerPermission(HttpServletRequest request, Supplier supplier) throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int batchSetAdvanceIn(String ids) throws Exception {
-        int res = 0;
-        List<Long> idList = StringUtil.strToLongList(ids);
-        for(Long sId: idList) {
-            updateAdvanceIn(sId);
-            res = 1;
-        }
-        return res;
-    }
+    int batchSetAdvanceIn(String ids) throws Exception;
 }

+ 43 - 0
src/main/java/com/jsh/erp/service/impl/DepotHeadServiceImpl.java

@@ -9,10 +9,13 @@ import com.jsh.erp.datasource.entities.*;
 import com.jsh.erp.datasource.mappers.DepotHeadMapper;
 import com.jsh.erp.datasource.mappers.DepotHeadMapperEx;
 import com.jsh.erp.datasource.mappers.DepotItemMapperEx;
+import com.jsh.erp.datasource.pda.dto.PDADepotHeadDTO;
+import com.jsh.erp.datasource.pda.vo.PDADepotHeadVO;
 import com.jsh.erp.datasource.vo.*;
 import com.jsh.erp.exception.BusinessRunTimeException;
 import com.jsh.erp.exception.JshException;
 import com.jsh.erp.service.*;
+import com.jsh.erp.util.QRCodeGenerator;
 import com.jsh.erp.utils.ExcelUtils;
 import com.jsh.erp.utils.PageUtils;
 import com.jsh.erp.utils.StringUtil;
@@ -78,6 +81,18 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
     DepotItemMapperEx depotItemMapperEx;
     @Resource
     private LogService logService;
+    @Resource
+    private QRCodeGenerator qrCodeGenerator;
+
+    /**
+     * PDA查询订单
+     * @param pdaDepotHeadDTO 筛选条件
+     * @return
+     */
+    @Override
+    public List<PDADepotHeadVO> pdaList(PDADepotHeadDTO pdaDepotHeadDTO) {
+        return depotHeadMapper.pdaList(pdaDepotHeadDTO);
+    }
 
     @Override
     public DepotHead getDepotHead(long id)throws Exception {
@@ -1115,6 +1130,20 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
                         String.format(ExceptionConstants.DEPOT_HEAD_FILE_NUM_LIMIT_MSG, 4));
             }
         }
+        //生成订单二维码
+        String qrCodeUrl = qrCodeGenerator.generateQRCodeImage(depotHead.getNumber());
+        depotHead.setQrcodeUrl(qrCodeUrl);
+        //
+        JSONArray rowArr = JSONArray.parseArray(rows);
+        //商品数量
+        int operNumber = 0;
+        for (int i = 0; i < rowArr.size(); i++) {
+            JSONObject rowObj = JSONObject.parseObject(rowArr.getString(i));
+            operNumber = operNumber + rowObj.getInteger("operNumber");
+        }
+        depotHead.setGoodsQuantity(operNumber);
+        //商品总类
+        depotHead.setGoodsTypeCount(rowArr.size());
         //添加主表
         depotHeadMapper.insertSelective(depotHead);
         /**入库和出库处理预付款信息*/
@@ -1216,6 +1245,20 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
                         String.format(ExceptionConstants.DEPOT_HEAD_FILE_NUM_LIMIT_MSG, 4));
             }
         }
+        //生成订单二维码
+        String qrCodeUrl = qrCodeGenerator.generateQRCodeImage(depotHead.getNumber());
+        depotHead.setQrcodeUrl(qrCodeUrl);
+        //
+        JSONArray rowArr = JSONArray.parseArray(rows);
+        //商品数量
+        int operNumber = 0;
+        for (int i = 0; i < rowArr.size(); i++) {
+            JSONObject rowObj = JSONObject.parseObject(rowArr.getString(i));
+            operNumber = operNumber + rowObj.getInteger("operNumber");
+        }
+        depotHead.setGoodsQuantity(operNumber);
+        //商品总类
+        depotHead.setGoodsTypeCount(rowArr.size());
         //修改单据主表
         depotHeadMapper.updateByPrimaryKeySelective(depotHead);
         //如果存在多账户结算需要将原账户的id置空

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

@@ -7,6 +7,7 @@ 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.pda.vo.PDADepotItemVO;
 import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
 import com.jsh.erp.datasource.vo.DepotItemVo4Stock;
 import com.jsh.erp.datasource.vo.DepotItemVoBatchNumberList;
@@ -66,6 +67,15 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
     @Resource
     private LogService logService;
 
+    /**
+     * pda根据订单信息查询商品列表
+     * @return
+     */
+    @Override
+    public List<PDADepotItemVO> pdaList(Long id) {
+        return depotItemMapper.pdaList(id);
+    }
+
     @Override
     public DepotItem getDepotItem(long id)throws Exception {
         DepotItem result=null;

+ 0 - 2
src/main/java/com/jsh/erp/service/impl/MaterialServiceImpl.java

@@ -620,8 +620,6 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
      * 导入商品信息
      * @param file
      * @param request
-     * @return
-     * @throws Exception
      */
     @Override
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)

+ 751 - 0
src/main/java/com/jsh/erp/service/impl/SupplierServiceImpl.java

@@ -0,0 +1,751 @@
+package com.jsh.erp.service.impl;
+
+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.DepotHeadVo4StatementAccount;
+import com.jsh.erp.exception.BusinessRunTimeException;
+import com.jsh.erp.exception.JshException;
+import com.jsh.erp.service.*;
+import com.jsh.erp.utils.*;
+import jxl.Sheet;
+import jxl.Workbook;
+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 org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.io.File;
+import java.math.BigDecimal;
+import java.util.*;
+
+
+@Service
+public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> implements SupplierService {
+    private Logger logger = LoggerFactory.getLogger(SupplierService.class);
+
+    @Resource
+    private SupplierMapper supplierMapper;
+
+    @Resource
+    private SupplierMapperEx supplierMapperEx;
+    @Resource
+    private LogService logService;
+    @Resource
+    private UserService userService;
+    @Resource
+    private AccountHeadMapperEx accountHeadMapperEx;
+    @Resource
+    private DepotHeadMapperEx depotHeadMapperEx;
+    @Resource
+    private AccountItemMapperEx accountItemMapperEx;
+    @Resource
+    private DepotHeadService depotHeadService;
+    @Resource
+    private UserBusinessService userBusinessService;
+    @Resource
+    private UserBusinessMapper userBusinessMapper;
+
+    @Override
+    public Supplier getSupplier(long id)throws Exception {
+        Supplier result=null;
+        try{
+            result=supplierMapper.selectByPrimaryKey(id);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        return result;
+    }
+
+    @Override
+    public List<Supplier> getSupplierListByIds(String ids)throws Exception {
+        List<Long> idList = StringUtil.strToLongList(ids);
+        List<Supplier> list = new ArrayList<>();
+        try{
+            SupplierExample example = new SupplierExample();
+            example.createCriteria().andIdIn(idList);
+            list = supplierMapper.selectByExample(example);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        return list;
+    }
+
+    @Override
+    public List<Supplier> getSupplier()throws Exception {
+        SupplierExample example = new SupplierExample();
+        example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+        List<Supplier> list=null;
+        try{
+            list=supplierMapper.selectByExample(example);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        return list;
+    }
+
+    @Override
+    public List<Supplier> select(String supplier, String type, String phonenum, String telephone) throws Exception{
+        List<Supplier> list = new ArrayList<>();
+        try{
+            String [] creatorArray = depotHeadService.getCreatorArray();
+            PageUtils.startPage();
+            list = supplierMapperEx.selectByConditionSupplier(supplier, type, phonenum, telephone, creatorArray);
+            for(Supplier s : list) {
+                Integer supplierId = s.getId().intValue();
+                String beginTime = Tools.getYearBegin();
+                String endTime = Tools.getCenternTime(new Date());
+                BigDecimal sum = BigDecimal.ZERO;
+                String supplierType = type;
+                String inOutType = "";
+                String subType = "";
+                String typeBack = "";
+                String subTypeBack = "";
+                String billType = "";
+                if (("供应商").equals(supplierType)) {
+                    inOutType = "入库";
+                    subType = "采购";
+                    typeBack = "出库";
+                    subTypeBack = "采购退货";
+                    billType = "付款";
+                } else if (("客户").equals(supplierType)) {
+                    inOutType = "出库";
+                    subType = "销售";
+                    typeBack = "入库";
+                    subTypeBack = "销售退货";
+                    billType = "收款";
+                }
+                List<DepotHeadVo4StatementAccount> saList = depotHeadService.getStatementAccount(beginTime, endTime, supplierId, null,
+                        1, supplierType, inOutType, subType, typeBack, subTypeBack, billType, null, null);
+                if(saList.size()>0) {
+                    DepotHeadVo4StatementAccount item = saList.get(0);
+                    //期初 = 起始期初金额+上期欠款金额-上期退货的欠款金额-上期收付款
+                    BigDecimal preNeed = item.getBeginNeed().add(item.getPreDebtMoney()).subtract(item.getPreReturnDebtMoney()).subtract(item.getPreBackMoney());
+                    item.setPreNeed(preNeed);
+                    //实际欠款 = 本期欠款-本期退货的欠款金额
+                    BigDecimal realDebtMoney = item.getDebtMoney().subtract(item.getReturnDebtMoney());
+                    item.setDebtMoney(realDebtMoney);
+                    //期末 = 期初+实际欠款-本期收款
+                    BigDecimal allNeedGet = preNeed.add(realDebtMoney).subtract(item.getBackMoney());
+                    sum = sum.add(allNeedGet);
+                }
+                if(("客户").equals(s.getType())) {
+                    s.setAllNeedGet(sum);
+                } else if(("供应商").equals(s.getType())) {
+                    s.setAllNeedPay(sum);
+                }
+            }
+        } catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        return list;
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public int insertSupplier(JSONObject obj, HttpServletRequest request)throws Exception {
+        Supplier supplier = JSONObject.parseObject(obj.toJSONString(), Supplier.class);
+        int result=0;
+        try{
+            supplier.setEnabled(true);
+            User userInfo=userService.getCurrentUser();
+            supplier.setCreator(userInfo==null?null:userInfo.getId());
+            result=supplierMapper.insertSelective(supplier);
+            //新增客户时给当前用户自动授权
+            setUserCustomerPermission(request, supplier);
+            logService.insertLog("商家",
+                    new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(supplier.getSupplier()).toString(),request);
+        }catch(Exception e){
+            JshException.writeFail(logger, e);
+        }
+        return result;
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public int updateSupplier(JSONObject obj, HttpServletRequest request)throws Exception {
+        Supplier supplier = JSONObject.parseObject(obj.toJSONString(), Supplier.class);
+        if(supplier.getBeginNeedPay() == null) {
+            supplier.setBeginNeedPay(BigDecimal.ZERO);
+        }
+        if(supplier.getBeginNeedGet() == null) {
+            supplier.setBeginNeedGet(BigDecimal.ZERO);
+        }
+        int result=0;
+        try{
+            result=supplierMapper.updateByPrimaryKeySelective(supplier);
+            logService.insertLog("商家",
+                    new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(supplier.getSupplier()).toString(), request);
+        }catch(Exception e){
+            JshException.writeFail(logger, e);
+        }
+        return result;
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public int deleteSupplier(Long id, HttpServletRequest request)throws Exception {
+        return batchDeleteSupplierByIds(id.toString());
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public int batchDeleteSupplier(String ids, HttpServletRequest request) throws Exception{
+        return batchDeleteSupplierByIds(ids);
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public int batchDeleteSupplierByIds(String ids)throws Exception {
+        int result=0;
+        String [] idArray=ids.split(",");
+        //校验财务主表	jsh_accounthead
+        List<AccountHead> accountHeadList=null;
+        try{
+            accountHeadList = accountHeadMapperEx.getAccountHeadListByOrganIds(idArray);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        if(accountHeadList!=null&&accountHeadList.size()>0){
+            logger.error("异常码[{}],异常提示[{}],参数,OrganIds[{}]",
+                    ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
+            throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
+                    ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
+        }
+        //校验单据主表	jsh_depot_head
+        List<DepotHead> depotHeadList=null;
+        try{
+            depotHeadList = depotHeadMapperEx.getDepotHeadListByOrganIds(idArray);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        if(depotHeadList!=null&&depotHeadList.size()>0){
+            logger.error("异常码[{}],异常提示[{}],参数,OrganIds[{}]",
+                    ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
+            throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
+                    ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
+        }
+        //记录日志
+        StringBuffer sb = new StringBuffer();
+        sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
+        List<Supplier> list = getSupplierListByIds(ids);
+        for(Supplier supplier: list){
+            sb.append("[").append(supplier.getSupplier()).append("]");
+        }
+        logService.insertLog("商家", sb.toString(),
+                ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
+        User userInfo=userService.getCurrentUser();
+        //校验通过执行删除操作
+        try{
+            result = supplierMapperEx.batchDeleteSupplierByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
+        }catch(Exception e){
+            JshException.writeFail(logger, e);
+        }
+        return result;
+    }
+
+    @Override
+    public int checkIsNameExist(Long id, String name)throws Exception {
+        SupplierExample example = new SupplierExample();
+        example.createCriteria().andIdNotEqualTo(id).andSupplierEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+        List<Supplier> list=null;
+        try{
+            list= supplierMapper.selectByExample(example);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        return list==null?0:list.size();
+    }
+
+    @Override
+    public int checkIsNameAndTypeExist(Long id, String name, String type)throws Exception {
+        name = name == null? "": name;
+        SupplierExample example = new SupplierExample();
+        example.createCriteria().andIdNotEqualTo(id).andSupplierEqualTo(name).andTypeEqualTo(type)
+                .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+        List<Supplier> list=null;
+        try{
+            list= supplierMapper.selectByExample(example);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        return list==null?0:list.size();
+    }
+
+    /**
+     * 更新会员的预付款
+     * @param supplierId
+     */
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public void updateAdvanceIn(Long supplierId) {
+        try{
+            //查询会员在收预付款单据的总金额
+            BigDecimal financialAllPrice = accountHeadMapperEx.getFinancialAllPriceByOrganId(supplierId);
+            //查询会员在零售出库单据的总金额
+            BigDecimal billAllPrice = depotHeadMapperEx.getBillAllPriceByOrganId(supplierId);
+            Supplier supplier = new Supplier();
+            supplier.setId(supplierId);
+            supplier.setAdvanceIn(financialAllPrice.subtract(billAllPrice));
+            supplierMapper.updateByPrimaryKeySelective(supplier);
+        } catch (Exception e){
+            JshException.writeFail(logger, e);
+        }
+    }
+
+    @Override
+    public List<Supplier> findBySelectCus()throws Exception {
+        SupplierExample example = new SupplierExample();
+        example.createCriteria().andTypeLike("客户").andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+        example.setOrderByClause("sort asc, id desc");
+        List<Supplier> list=null;
+        try{
+            list = supplierMapper.selectByExample(example);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        return list;
+    }
+
+    @Override
+    public List<Supplier> findBySelectSup()throws Exception {
+        SupplierExample example = new SupplierExample();
+        example.createCriteria().andTypeLike("供应商").andEnabledEqualTo(true)
+                .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+        example.setOrderByClause("sort asc, id desc");
+        List<Supplier> list=null;
+        try{
+            list = supplierMapper.selectByExample(example);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        return list;
+    }
+
+    @Override
+    public List<Supplier> findBySelectRetail()throws Exception {
+        SupplierExample example = new SupplierExample();
+        example.createCriteria().andTypeLike("会员").andEnabledEqualTo(true)
+                .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+        example.setOrderByClause("sort asc, id desc");
+        List<Supplier> list=null;
+        try{
+            list = supplierMapper.selectByExample(example);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        return list;
+    }
+
+    @Override
+    public List<Supplier> findById(Long supplierId)throws Exception {
+        SupplierExample example = new SupplierExample();
+        example.createCriteria().andIdEqualTo(supplierId)
+                .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+        example.setOrderByClause("sort asc, id desc");
+        List<Supplier> list=null;
+        try{
+            list = supplierMapper.selectByExample(example);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        return list;
+    }
+
+    @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> supplierIds = StringUtil.strToLongList(ids);
+        Supplier supplier = new Supplier();
+        supplier.setEnabled(status);
+        SupplierExample example = new SupplierExample();
+        example.createCriteria().andIdIn(supplierIds);
+        int result=0;
+        try{
+            result = supplierMapper.updateByExampleSelective(supplier, example);
+        }catch(Exception e){
+            JshException.writeFail(logger, e);
+        }
+        return result;
+    }
+
+    @Override
+    public List<Supplier> findUserCustomer()throws Exception{
+        SupplierExample example = new SupplierExample();
+        example.createCriteria().andTypeEqualTo("客户")
+                .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+        example.setOrderByClause("sort asc, id desc");
+        List<Supplier> list=null;
+        try{
+            list = supplierMapper.selectByExample(example);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        return list;
+    }
+
+    @Override
+    public List<Supplier> findByAll(String supplier, String type, String phonenum, String telephone) throws Exception{
+        List<Supplier> list=null;
+        try{
+            list = supplierMapperEx.findByAll(supplier, type, phonenum, telephone);
+        }catch(Exception e){
+            JshException.readFail(logger, e);
+        }
+        return list;
+    }
+
+    @Override
+    public Map<String, Object> getBeginNeedByOrganId(Long organId) throws Exception {
+        Supplier supplier = getSupplier(organId);
+        Map<String, Object> map = new HashMap<>();
+        BigDecimal needDebt = BigDecimal.ZERO;
+        if("供应商".equals(supplier.getType())) {
+            needDebt = supplier.getBeginNeedPay();
+        } else if("客户".equals(supplier.getType())) {
+            needDebt = supplier.getBeginNeedGet();
+        }
+        BigDecimal finishDebt = accountItemMapperEx.getFinishDebtByOrganId(organId).abs();
+        BigDecimal eachAmount = BigDecimal.ZERO;
+        if(needDebt != null) {
+            eachAmount = needDebt.subtract(finishDebt);
+        }
+        //应收欠款
+        map.put("needDebt", needDebt);
+        //已收欠款
+        map.put("finishDebt", finishDebt);
+        //本次收款
+        map.put("eachAmount", eachAmount);
+        return map;
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public void importVendor(MultipartFile file, HttpServletRequest request) throws Exception{
+        String type = "供应商";
+        User userInfo = userService.getCurrentUser();
+        Workbook workbook = Workbook.getWorkbook(file.getInputStream());
+        Sheet src = workbook.getSheet(0);
+        //'名称', '联系人', '手机号码', '联系电话', '电子邮箱', '纳税人识别号', '开具发票情况','税率(%)', '开户行', '账号', '地址', '供应商分级', '结算方式',	'账单周期', '采购对接人', '到货天数', '备注', '排序', '状态'
+        List<Supplier> sList = new ArrayList<>();
+        for (int i = 2; i < src.getRows(); i++) {
+            String supplierName = ExcelUtils.getContent(src, i, 0);
+            String enabled = ExcelUtils.getContent(src, i, 18);
+            if(StringUtil.isNotEmpty(supplierName) && StringUtil.isNotEmpty(enabled)) {
+                Supplier s = new Supplier();
+                s.setType(type);
+                s.setSupplier(supplierName);
+                s.setContacts(ExcelUtils.getContent(src, i, 1));
+                s.setTelephone(ExcelUtils.getContent(src, i, 2));
+                s.setPhoneNum(ExcelUtils.getContent(src, i, 3));
+                s.setEmail(ExcelUtils.getContent(src, i, 4));
+                s.setTaxNum(ExcelUtils.getContent(src, i, 5));
+                s.setInvoiceType(ExcelUtils.getContent(src, i, 6));
+                s.setTaxRate(parseBigDecimalEx(ExcelUtils.getContent(src, i, 7)));
+                s.setBankName(ExcelUtils.getContent(src, i, 8));
+                s.setAccountNumber(ExcelUtils.getContent(src, i, 9));
+                s.setAddress(ExcelUtils.getContent(src, i, 10));
+                s.setSupplierLevel(ExcelUtils.getContent(src, i, 11));
+                s.setSettlementMethod(ExcelUtils.getContent(src, i, 12));
+                s.setBillingCycleDays(parseIntegerFromExcel(ExcelUtils.getContent(src, i, 13)));
+                s.setProcurementContact(ExcelUtils.getContent(src, i, 14));
+                s.setDeliveryDays(parseIntegerFromExcel(ExcelUtils.getContent(src, i, 15)));
+                s.setDescription(ExcelUtils.getContent(src, i, 16));
+                s.setSort(ExcelUtils.getContent(src, i, 17));
+                s.setCreator(userInfo==null?null:userInfo.getId());
+                s.setEnabled("1".equals(enabled));
+                sList.add(s);
+            }
+        }
+        importExcel(sList, type, request);
+    }
+
+    @Override
+    public Integer parseIntegerFromExcel(String content) {
+        if (content != null && !content.isEmpty()) {
+            try {
+                return Integer.valueOf(content);
+            } catch (NumberFormatException e) {
+                logger.error("无法解析整数值: {}", content, e);
+                return null;
+            }
+        }
+        return null;
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public void importCustomer(MultipartFile file, HttpServletRequest request) throws Exception{
+        String type = "客户";
+        User userInfo = userService.getCurrentUser();
+        Workbook workbook = Workbook.getWorkbook(file.getInputStream());
+        Sheet src = workbook.getSheet(0);
+        //'名称', '联系人', '手机号码', '联系电话', '电子邮箱', '传真', '期初应收', '纳税人识别号', '税率(%)', '开户行', '账号', '地址', '备注', '排序', '状态'
+        List<Supplier> sList = new ArrayList<>();
+        for (int i = 2; i < src.getRows(); i++) {
+            String supplierName = ExcelUtils.getContent(src, i, 0);
+            String enabled = ExcelUtils.getContent(src, i, 14);
+            if(StringUtil.isNotEmpty(supplierName) && StringUtil.isNotEmpty(enabled)) {
+                Supplier s = new Supplier();
+                s.setType(type);
+                s.setSupplier(supplierName);
+                s.setContacts(ExcelUtils.getContent(src, i, 1));
+                s.setTelephone(ExcelUtils.getContent(src, i, 2));
+                s.setPhoneNum(ExcelUtils.getContent(src, i, 3));
+                s.setEmail(ExcelUtils.getContent(src, i, 4));
+                s.setFax(ExcelUtils.getContent(src, i, 5));
+                s.setBeginNeedGet(parseBigDecimalEx(ExcelUtils.getContent(src, i, 6)));
+                s.setTaxNum(ExcelUtils.getContent(src, i, 7));
+                s.setTaxRate(parseBigDecimalEx(ExcelUtils.getContent(src, i, 8)));
+                s.setBankName(ExcelUtils.getContent(src, i, 9));
+                s.setAccountNumber(ExcelUtils.getContent(src, i, 10));
+                s.setAddress(ExcelUtils.getContent(src, i, 11));
+                s.setDescription(ExcelUtils.getContent(src, i, 12));
+                s.setSort(ExcelUtils.getContent(src, i, 13));
+                s.setCreator(userInfo==null?null:userInfo.getId());
+                s.setEnabled("1".equals(enabled));
+                sList.add(s);
+            }
+        }
+        importExcel(sList, type, request);
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public void importMember(MultipartFile file, HttpServletRequest request) throws Exception{
+        String type = "会员";
+        User userInfo = userService.getCurrentUser();
+        Workbook workbook = Workbook.getWorkbook(file.getInputStream());
+        Sheet src = workbook.getSheet(0);
+        //'名称', '联系人', '手机号码', '联系电话', '电子邮箱', '备注', '排序', '状态'
+        List<Supplier> sList = new ArrayList<>();
+        for (int i = 2; i < src.getRows(); i++) {
+            String supplierName = ExcelUtils.getContent(src, i, 0);
+            String enabled = ExcelUtils.getContent(src, i, 7);
+            if(StringUtil.isNotEmpty(supplierName) && StringUtil.isNotEmpty(enabled)) {
+                Supplier s = new Supplier();
+                s.setType(type);
+                s.setSupplier(supplierName);
+                s.setContacts(ExcelUtils.getContent(src, i, 1));
+                s.setTelephone(ExcelUtils.getContent(src, i, 2));
+                s.setPhoneNum(ExcelUtils.getContent(src, i, 3));
+                s.setEmail(ExcelUtils.getContent(src, i, 4));
+                s.setDescription(ExcelUtils.getContent(src, i, 5));
+                s.setSort(ExcelUtils.getContent(src, i, 6));
+                s.setCreator(userInfo==null?null:userInfo.getId());
+                s.setEnabled("1".equals(enabled));
+                sList.add(s);
+            }
+        }
+        importExcel(sList, type, request);
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public BaseResponseInfo importExcel(List<Supplier> mList, String type, HttpServletRequest request) throws Exception {
+        logService.insertLog(type,
+                new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_IMPORT).append(mList.size()).append(BusinessConstants.LOG_DATA_UNIT).toString(),
+                ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
+        BaseResponseInfo info = new BaseResponseInfo();
+        Map<String, Object> data = new HashMap<>();
+        try {
+            for(Supplier supplier: mList) {
+                SupplierExample example = new SupplierExample();
+                example.createCriteria().andSupplierEqualTo(supplier.getSupplier()).andTypeEqualTo(type).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+                List<Supplier> list= supplierMapper.selectByExample(example);
+                if(list.size() <= 0) {
+                    supplierMapper.insertSelective(supplier);
+                    //新增客户时给当前用户自动授权
+                    setUserCustomerPermission(request, supplier);
+                } else {
+                    Long id = list.get(0).getId();
+                    supplier.setId(id);
+                    supplierMapper.updateByPrimaryKeySelective(supplier);
+                }
+            }
+            info.code = 200;
+            data.put("message", "成功");
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            info.code = 500;
+            data.put("message", e.getMessage());
+        }
+        info.data = data;
+        return info;
+    }
+
+    @Override
+    public BigDecimal parseBigDecimalEx(String str)throws Exception{
+        if(!StringUtil.isEmpty(str)) {
+            return new BigDecimal(str);
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public File exportExcel(List<Supplier> dataList, String type) throws Exception {
+        if("供应商".equals(type)) {
+            return exportExcelVendorOrCustomer(dataList, type);
+        } else if("客户".equals(type)) {
+            return exportExcelVendorOrCustomer(dataList, type);
+        } else {
+            //会员
+            String[] names = {"会员卡号*", "联系人", "手机号码", "联系电话", "电子邮箱", "备注", "排序", "状态*"};
+            String title = "信息内容";
+            List<String[]> objects = new ArrayList<String[]>();
+            if (null != dataList) {
+                for (Supplier s : dataList) {
+                    String[] objs = new String[names.length];
+                    objs[0] = s.getSupplier();
+                    objs[1] = s.getContacts();
+                    objs[2] = s.getTelephone();
+                    objs[3] = s.getPhoneNum();
+                    objs[4] = s.getEmail();
+                    objs[5] = s.getDescription();
+                    objs[6] = s.getSort();
+                    objs[7] = s.getEnabled() ? "1" : "0";
+                    objects.add(objs);
+                }
+            }
+            return ExcelUtils.exportObjectsOneSheet(title, "*导入时本行内容请勿删除,切记!", names, title, objects);
+        }
+    }
+
+    @Override
+    public File exportExcelVendorOrCustomer(List<Supplier> dataList, String type) throws Exception {
+        /*String beginNeedStr = "";
+        if("供应商".equals(type)) {
+            beginNeedStr = "期初应付";
+        } else if("客户".equals(type)) {
+            beginNeedStr = "期初应收";
+        }*/
+        String[] names = {"名称*", "联系人", "手机号码", "联系电话", "电子邮箱",
+                "纳税人识别号", "发票类型","税率(%)", "开户行", "账号", "地址","供应商分级",
+                "结算方式", "账单周期", "采购对接人", "到货天数", "备注", "排序", "状态*"};
+        String title = "信息内容";
+        List<String[]> objects = new ArrayList<String[]>();
+        if (null != dataList) {
+            for (Supplier s : dataList) {
+                String[] objs = new String[names.length];
+                objs[0] = s.getSupplier();
+                objs[1] = s.getContacts();
+                objs[2] = s.getTelephone();
+                objs[3] = s.getPhoneNum();
+                objs[4] = s.getEmail();
+                /*if(("客户").equals(s.getType())) {
+                    objs[6] = s.getBeginNeedGet() == null? "" : s.getBeginNeedGet().setScale(2,BigDecimal.ROUND_HALF_UP).toString();
+                } else if(("供应商").equals(s.getType())) {
+                    objs[6] = s.getBeginNeedPay() == null? "" : s.getBeginNeedPay().setScale(2,BigDecimal.ROUND_HALF_UP).toString();
+                }*/
+                objs[5] = s.getTaxNum();
+                // 发票类型
+                objs[6] = mapInvoiceType(s.getInvoiceType());
+                // 税率
+                objs[7] = s.getTaxRate() == null? "" : s.getTaxRate().setScale(2,BigDecimal.ROUND_HALF_UP).toString();
+
+                // 银行信息
+                objs[8] = s.getBankName();
+                objs[9] = s.getAccountNumber();
+                objs[10] = s.getAddress();
+
+                // 供应商分级
+                objs[11] = s.getSupplierLevel();
+
+                // 结算方式
+                objs[12] = mapSettlementMethod(s.getSettlementMethod());
+                // 账单周期
+                objs[13] = s.getBillingCycleDays() == null? "" : s.getBillingCycleDays().toString();
+                // 采购对接人
+                objs[14] = s.getProcurementContact();
+                // 到货天数
+                objs[15] = s.getDeliveryDays() == null? "" : s.getDeliveryDays().toString();
+                objs[16] = s.getDescription();
+                objs[17] = s.getSort();
+                objs[18] = s.getEnabled() ? "1" : "0";
+                objects.add(objs);
+            }
+        }
+        return ExcelUtils.exportObjectsOneSheet(title, "*导入时本行内容请勿删除,切记!", names, title, objects);
+    }
+
+    @Override
+    public String mapInvoiceType(String invoiceType) {
+        if ("0".equals(invoiceType)) {
+            return "普通发票";
+        } else if ("1".equals(invoiceType)) {
+            return "增值税专用发票";
+        }
+        return "";
+    }
+
+    @Override
+    public String mapSettlementMethod(String settlementMethod) {
+        if ("0".equals(settlementMethod)) {
+            return "周结";
+        } else if ("1".equals(settlementMethod)) {
+            return "现结/按单";
+        } else if ("2".equals(settlementMethod)) {
+            return "预付款";
+        } else if ("3".equals(settlementMethod)) {
+            return "月结";
+        }
+        return "";
+    }
+
+    /**
+     * 新增客户时给当前用户自动授权
+     * @param request
+     * @param supplier
+     * @throws Exception
+     */
+    @Override
+    public void setUserCustomerPermission(HttpServletRequest request, Supplier supplier) throws Exception {
+        if("客户".equals(supplier.getType())) {
+            Long userId = userService.getUserId(request);
+            Supplier sInfo = supplierMapperEx.getSupplierByNameAndType(supplier.getSupplier(), supplier.getType());
+            String ubKey = "[" + sInfo.getId() + "]";
+            List<UserBusiness> ubList = userBusinessService.getBasicData(userId.toString(), "UserCustomer");
+            if(ubList ==null || ubList.size() == 0) {
+                JSONObject ubObj = new JSONObject();
+                ubObj.put("type", "UserCustomer");
+                ubObj.put("keyId", userId);
+                ubObj.put("value", ubKey);
+                UserBusiness userBusiness = JSONObject.parseObject(ubObj.toJSONString(), UserBusiness.class);
+                userBusinessMapper.insertSelective(userBusiness);
+            } 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);
+                UserBusiness userBusiness = JSONObject.parseObject(ubObj.toJSONString(), UserBusiness.class);
+                userBusinessMapper.updateByPrimaryKeySelective(userBusiness);
+            }
+        }
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public int batchSetAdvanceIn(String ids) throws Exception {
+        int res = 0;
+        List<Long> idList = StringUtil.strToLongList(ids);
+        for(Long sId: idList) {
+            updateAdvanceIn(sId);
+            res = 1;
+        }
+        return res;
+    }
+}

+ 60 - 0
src/main/java/com/jsh/erp/util/QRCodeGenerator.java

@@ -0,0 +1,60 @@
+package com.jsh.erp.util;
+
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.EncodeHintType;
+import com.google.zxing.client.j2se.MatrixToImageWriter;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.qrcode.QRCodeWriter;
+import com.jsh.erp.utils.OssUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 二维码生成器
+ */
+@Component
+public class QRCodeGenerator {
+
+    @Value(value="${file.path}")
+    private String filePath;
+
+    OssUtils ossUtils;
+
+    /**
+     * 生成二维码图片
+     * @param text 二维码内容
+     * @param width 二维码宽度
+     * @param height 二维码高度
+     * @param filePath 二维码数据文件路径
+     * @throws Exception
+     */
+    public static void generateQRCodeImage(String text, int width, int height, String filePath) throws Exception {
+        QRCodeWriter qrCodeWriter = new QRCodeWriter();
+        Map<EncodeHintType, Object> hints = new HashMap<>();
+        hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); // 设置编码格式为UTF-8
+        BitMatrix bitMatrix = qrCodeWriter.encode(text, BarcodeFormat.QR_CODE, width, height, hints);
+        Path path = FileSystems.getDefault().getPath(filePath);
+        MatrixToImageWriter.writeToPath(bitMatrix, "PNG", path); // 输出图片格式为PNG
+    }
+
+    /**
+     * 生成二维码图片
+     * @param text 图片内容
+     * @return
+     */
+    public String generateQRCodeImage(String text) throws Exception {
+        int width = 300;
+        int height = 300;
+        String filePathContent = filePath + "/"+text+".png";
+        generateQRCodeImage(text, width, height, filePathContent);
+        File file = new File(filePathContent);
+        return ossUtils.uploadFile(file);
+    }
+
+}

+ 31 - 0
src/main/java/com/jsh/erp/utils/OssUtils.java

@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -51,6 +52,36 @@ public class OssUtils {
         }
     }
 
+    /**
+     * 上传File类型文件
+     * @param file
+     * @return
+     */
+    public String uploadFile(File file) {
+
+        // 创建OSSClient实例。
+        OSS ossClient = new OSSClientBuilder().build(endPoint, accessKeyId, secretAccessKey);
+        //设置文件名
+        String fileName = new DateTime().toString("yyyy/MM/dd")
+                + UUID.randomUUID().toString().replace("-", "")
+                + file.getName();
+
+        try {
+            // 创建PutObject请求。
+            ossClient.putObject(bucketName, fileName, file);
+
+            String url = "https://" + bucketName + "." + endPoint + "/" + fileName;
+            return url;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        } finally {
+            if (ossClient != null) {
+                ossClient.shutdown();
+            }
+        }
+    }
+
     public List<String> uploadArrayFile(MultipartFile[] files) {
         // 创建OSSClient实例。
         OSS ossClient = new OSSClientBuilder().build(endPoint, accessKeyId, secretAccessKey);

+ 55 - 0
src/main/resources/mapper_xml/DepotHeadMapper.xml

@@ -259,6 +259,15 @@
       <if test="voucherPicture != null">
         voucher_picture,
       </if>
+      <if test="qrcodeUrl != null">
+        qrcode_url,
+      </if>
+      <if test="goodsQuantity != null">
+        goods_quantity,
+      </if>
+      <if test="goodsTypeCount != null">
+        goods_type_count,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="id != null">
@@ -360,6 +369,15 @@
       <if test="voucherPicture != null">
         #{voucherPicture,jdbcType=VARCHAR},
       </if>
+      <if test="qrcodeUrl != null">
+        #{qrcodeUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsQuantity != null">
+        #{goodsQuantity,jdbcType=INT},
+      </if>
+      <if test="goodsTypeCount != null">
+        #{goodsTypeCount,jdbcType=INT},
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultType="java.lang.Long">
@@ -609,6 +627,15 @@
       <if test="voucherPicture != null">
         voucher_picture = #{voucherPicture,jdbcType=VARCHAR},
       </if>
+      <if test="qrcodeUrl != null">
+        qrcode_url = #{qrcodeUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsQuantity != null">
+        goods_quantity = #{goodsQuantity,jdbcType=INT},
+      </if>
+      <if test="goodsTypeCount != null">
+        goods_type_count = #{goodsTypeCount,jdbcType=INT},
+      </if>
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
@@ -647,4 +674,32 @@
       delete_flag = #{deleteFlag,jdbcType=VARCHAR}
     where id = #{id,jdbcType=BIGINT}
   </update>
+
+  <select id="pdaList" parameterType="com.jsh.erp.datasource.pda.dto.PDADepotHeadDTO" resultType="com.jsh.erp.datasource.pda.vo.PDADepotHeadVO">
+    SELECT
+      dh.id,
+      dh.number,
+      dh.create_time,
+      dh.goods_quantity,
+      dh.goods_type_count,
+      s.supplier AS supplier_name,
+      dh.status
+    FROM
+      jsh_depot_head dh
+        LEFT JOIN jsh_supplier s ON dh.organ_id = s.id
+    <where>
+      dh.sub_type = #{subType}
+      AND dh.delete_flag = '0'
+      <if test="number != null and number != ''">
+        AND dh.number = #{number}
+      </if>
+      <if test="status != null and status != ''">
+        AND dh.status = #{status}
+      </if>
+      <if test="beginTime != null and beginTime != ''">
+        AND dh.create_time between #{beginTime} and #{endTime}
+      </if>
+    </where>
+      GROUP BY dh.id
+  </select>
 </mapper>

+ 28 - 28
src/main/resources/mapper_xml/DepotHeadMapperEx.xml

@@ -107,8 +107,8 @@
         </if>
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
         </if>
         <if test="organId != null">
@@ -197,7 +197,7 @@
     </select>
 
     <select id="findInOutDetail" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultWithInfoExMap">
-        select dh.number,me.bar_code barCode, m.name mname,m.model,m.standard,m.color,m.brand,m.mfrs,di.unit_price unitPrice,di.material_unit as mUnit, di.sku,
+        select dh.number,me.bar_code barCode, m.name mname,m.model,m.standard,m.color,m.brand,di.unit_price unitPrice,di.material_unit as mUnit, di.sku,
         di.oper_number operNumber,di.all_price allPrice, ifnull(di.tax_rate,0) taxRate, ifnull(di.tax_money,0) taxMoney, ifnull(di.tax_last_money,0) taxLastMoney,
         s.supplier sname,d.dname dname, date_format(dh.oper_time, '%Y-%m-%d') operTime, concat(dh.sub_type,dh.type) as newType,
         concat_ws('  ',dh.remark,di.remark) as newRemark
@@ -252,8 +252,8 @@
         </if>
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
         </if>
         <if test="creator != null">
@@ -329,8 +329,8 @@
         </if>
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
         </if>
         <if test="creator != null">
@@ -397,8 +397,8 @@
         </if>
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
         </if>
         <if test="creator != null">
@@ -413,7 +413,7 @@
     </select>
 
     <select id="findInOutMaterialCount" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultInOutMaterialCount">
-        select di.material_id materialId, me.bar_code barCode, m.name mName,m.model,m.standard,m.color,m.brand,m.mfrs,
+        select di.material_id materialId, me.bar_code barCode, m.name mName,m.model,m.standard,m.color,m.brand,
                mc.name categoryName,concat_ws('', m.unit, u.basic_unit) materialUnit,
         sum(di.basic_number) numSum,
         sum(di.all_price) priceSum
@@ -465,8 +465,8 @@
         </if>
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
         </if>
         <if test="categoryList.size()>0">
@@ -482,7 +482,7 @@
             and (dh.sub_type!='采购' and dh.sub_type!='采购退货' and dh.sub_type!='销售' and dh.sub_type!='销售退货')
         </if>
         and ifnull(dh.delete_flag,'0') !='1'
-        group by di.material_id, me.bar_code, m.name,m.model,m.standard,m.color,m.brand,m.mfrs,
+        group by di.material_id, me.bar_code, m.name,m.model,m.standard,m.color,m.brand,
         mc.name, m.unit, u.basic_unit
         <if test="column == 'createTime'">
             order by materialId desc
@@ -543,8 +543,8 @@
         </if>
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
         </if>
         <if test="categoryList.size()>0">
@@ -613,8 +613,8 @@
         </if>
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
         </if>
         <if test="categoryList.size()>0">
@@ -633,7 +633,7 @@
     </select>
 
     <select id="findAllocationDetail" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultWithInfoExMap">
-        select dh.number,me.bar_code barCode, m.name mname,m.model,m.standard,m.color,m.brand,m.mfrs,di.unit_price unitPrice,di.material_unit as mUnit,
+        select dh.number,me.bar_code barCode, m.name mname,m.model,m.standard,m.color,m.brand,di.unit_price unitPrice,di.material_unit as mUnit,
                di.oper_number operNumber,di.all_price allPrice,sname, d.dName dname,date_format(dh.oper_time, '%Y-%m-%d') operTime,
                concat(dh.sub_type,dh.type) as newType, concat_ws('  ',dh.remark,di.remark) as newRemark
         from jsh_depot_head dh
@@ -681,8 +681,8 @@
         </if>
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey} or dh.remark like #{bindKey})
         </if>
         <if test="remark != null and remark !=''">
@@ -746,8 +746,8 @@
         </if>
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey} or dh.remark like #{bindKey})
         </if>
         <if test="remark != null and remark !=''">
@@ -804,8 +804,8 @@
         </if>
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey} or dh.remark like #{bindKey})
         </if>
         <if test="remark != null and remark !=''">
@@ -1321,9 +1321,9 @@
         </if>
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like
             #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.other_field1 like #{bindKey}
+            or m.color like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
         </if>
         <if test="depotArray != null and depotArray !=''">
@@ -1389,8 +1389,8 @@
         </if>
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
         </if>
         <if test="depotArray != null and depotArray !=''">

+ 21 - 0
src/main/resources/mapper_xml/DepotItemMapper.xml

@@ -563,4 +563,25 @@
       delete_flag = #{deleteFlag,jdbcType=VARCHAR}
     where id = #{id,jdbcType=BIGINT}
   </update>
+
+  <select id="pdaList" resultType="com.jsh.erp.datasource.pda.vo.PDADepotItemVO">
+    SELECT
+      m.`name` AS material_name,
+      m.standard AS material_standard,
+      me.batch_number AS batch_number,
+      me.production_date AS production_date,
+      me.position AS position,
+	  me.inventory AS inventory,
+	  me.bar_code AS bar_code,
+	  di.oper_number AS oper_number,
+      me.commodity_unit AS commodity_unit,
+      di.material_unit AS material_unit
+    FROM
+      jsh_depot_item di
+    LEFT JOIN jsh_material m ON di.material_id = m.id
+    LEFT JOIN jsh_material_extend me ON di.material_extend_id = me.id
+    WHERE
+      di.delete_flag = '0'
+      AND di.header_id = #{id}
+  </select>
 </mapper>

+ 19 - 19
src/main/resources/mapper_xml/DepotItemMapperEx.xml

@@ -319,7 +319,7 @@
     </select>
 
     <select id="getDetailList" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultType="com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx">
-        select di.*,m.name MName,m.model MModel,m.unit MaterialUnit,m.color MColor,m.unit_id,m.standard MStandard,m.weight, m.img_name,
+        select di.*,m.name MName,m.model MModel,m.color MColor,m.unit_id,m.standard MStandard,m.weight, m.img_name,
         m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,m.enable_serial_number, m.enable_batch_number,
         m.brand, dp1.name DepotName,dp2.name AnotherDepotName, me.purchase_decimal,
         me.production_date, me.expiry_num, me.supplier_id, me.bar_code, me.batch_number, me.position,s.supplier supplierName
@@ -335,7 +335,7 @@
     </select>
 
     <select id="getBillDetailListByIds" resultType="com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx">
-        select di.*,m.name MName,m.model MModel,m.unit MaterialUnit,m.color MColor,m.unit_id,m.standard MStandard,m.weight, m.img_name,
+        select di.*,m.name MName,m.model MModel,m.color MColor,m.unit_id,m.standard MStandard,m.weight, m.img_name,
         m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,m.enable_serial_number, m.enable_batch_number,
         m.brand, dp1.name DepotName,dp2.name AnotherDepotName, me.purchase_decimal,
         me.production_date, me.expiry_num, me.supplier_id, me.bar_code, me.batch_number, me.position,s.supplier supplierName
@@ -354,7 +354,7 @@
     </select>
 
     <select id="getInOutStock" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultByMaterial">
-        select m.id MId, me.bar_code, m.name MName, m.mfrs MMfrs, m.model MModel, m.standard MStandard, m.brand,
+        select m.id MId, me.bar_code, m.name MName, m.model MModel, m.standard MStandard, m.brand,
         m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,
         concat_ws('', m.unit, u.basic_unit) MaterialUnit, m.color MColor, m.unit_id, u.name unit_name,
         ifnull(me.purchase_decimal,0) purchase_decimal, ifnull(mcs.current_unit_price,0) currentUnitPrice
@@ -367,8 +367,8 @@
         where 1=1 and me.default_flag=1
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
         </if>
         <if test="categoryIdList.size()>0">
@@ -381,7 +381,7 @@
             and dh.oper_time &lt;= #{endTime}
         </if>
         and ifnull(m.delete_flag,'0') !='1'
-        group by m.id, me.bar_code, m.name, m.mfrs, m.model, m.standard, m.brand,
+        group by m.id, me.bar_code, m.name, m.model, m.standard, m.brand,
         m.other_field1,m.other_field2,m.other_field3,m.unit, u.basic_unit, m.color, m.unit_id, u.name,
         me.purchase_decimal, mcs.current_unit_price
         order by m.id desc
@@ -399,8 +399,8 @@
         where 1=1 and me.default_flag=1
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
         </if>
         <if test="categoryIdList.size()>0">
@@ -417,7 +417,7 @@
     </select>
 
     <select id="getListWithBuyOrSale" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultByMaterial">
-        select m.id MId, me.bar_code, m.name MName, m.mfrs MMfrs, m.model MModel, m.standard MStandard,
+        select m.id MId, me.bar_code, m.name MName, m.model MModel, m.standard MStandard,
         m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,
         concat_ws('', m.unit, u.basic_unit) MaterialUnit, m.color MColor, m.brand, u.name unit_name
         from jsh_material m
@@ -434,8 +434,8 @@
         </if>
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
         </if>
         <if test="billType =='buy'">
@@ -480,7 +480,7 @@
             and (dh.status = '1' or dh.status = '2' or dh.status = '3')
         </if>
         and ifnull(m.delete_flag,'0') !='1'
-        group by m.id, me.bar_code, m.name, m.mfrs, m.model, m.standard,
+        group by m.id, me.bar_code, m.name, m.model, m.standard,
         m.other_field1,m.other_field2,m.other_field3, m.unit, u.basic_unit, m.color, m.brand, u.name
         order by m.id desc
         <if test="offset != null and rows != null">
@@ -503,8 +503,8 @@
         </if>
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
         </if>
         <if test="billType =='buy'">
@@ -893,7 +893,7 @@
     </select>
 
     <select id="findStockWarningCount" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultStockWarningCount">
-        select m.id MId, m.name MName, me.bar_code, m.mfrs MMfrs, m.model MModel, m.standard MStandard,m.color MColor, m.brand,
+        select m.id MId, m.name MName, me.bar_code, m.model MModel, m.standard MStandard,m.color MColor, m.brand,
         m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,d.name depotName,
         m.unit MaterialUnit, u.basic_unit unit_name,mcs.current_number,
         mis.low_safe_stock, mis.high_safe_stock
@@ -911,8 +911,8 @@
             or (ifnull(mis.high_safe_stock,0)!=0 and mcs.current_number > ifnull(mis.high_safe_stock,0)))
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
         </if>
         <if test="depotList.size()>0">
@@ -950,8 +950,8 @@
             or (ifnull(mis.high_safe_stock,0)!=0 and mcs.current_number > ifnull(mis.high_safe_stock,0)))
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
         </if>
         <if test="depotList.size()>0">

+ 9 - 20
src/main/resources/mapper_xml/MaterialMapperEx.xml

@@ -330,10 +330,6 @@
             <bind name="bindBrand" value="'%'+brand+'%'"/>
             and m.brand like #{bindBrand}
         </if>
-        <if test="mfrs != null and mfrs !=''">
-            <bind name="bindMfrs" value="'%'+mfrs+'%'"/>
-            and m.mfrs like #{bindMfrs}
-        </if>
         <if test="idList.size()>0">
             and m.category_id in
             <foreach collection="idList" item="item" index="index" separator="," open="(" close=")">
@@ -378,10 +374,6 @@
             <bind name="bindBrand" value="'%'+brand+'%'"/>
             and m.brand like #{bindBrand}
         </if>
-        <if test="mfrs != null and mfrs !=''">
-            <bind name="bindMfrs" value="'%'+mfrs+'%'"/>
-            and m.mfrs like #{bindMfrs}
-        </if>
         <if test="idList.size()>0">
             and m.category_id in
             <foreach collection="idList" item="item" index="index" separator="," open="(" close=")">
@@ -419,7 +411,7 @@
         </if>
         <if test="materialOther != null and materialOther !=''">
             <bind name="bindOther" value="'%'+materialOther+'%'"/>
-            and (m.mfrs like #{bindOther} or m.other_field1 like #{bindOther}
+            and (m.other_field1 like #{bindOther}
             or m.other_field2 like #{bindOther} or m.other_field3 like #{bindOther})
         </if>
         <if test="weight != null and weight !=''">
@@ -622,7 +614,7 @@
     </select>
 
     <select id="getListWithStock" resultMap="ResultMapListWithStock">
-        select m.id, m.name, m.standard, m.model, m.color, m.brand, m.mfrs, m.position,
+        select m.id, m.name, m.standard, m.model, m.color, m.brand, m.position,
                me.commodity_unit unitName, mc.name categoryName, me.bar_code mBarCode,
         ifnull(me.purchase_decimal,0) purchaseDecimal,
         ifnull(mcs.current_unit_price,0) currentUnitPrice,
@@ -655,12 +647,12 @@
         </if>
         <if test="materialParam != null">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
         </if>
         and ifnull(m.delete_flag,'0') !='1'
-        group by m.id, m.name, m.standard, m.model, m.color, m.brand, m.mfrs, m.position,
+        group by m.id, m.name, m.standard, m.model, m.color, m.brand,
         me.commodity_unit, mc.name, me.bar_code, me.purchase_decimal, mcs.current_unit_price
         <if test="zeroStock == 0">
             having ifnull(sum(mcs.current_number),0)!=0
@@ -703,8 +695,8 @@
         </if>
         <if test="materialParam != null">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
         </if>
         and ifnull(m.delete_flag,'0') !='1'
@@ -746,8 +738,8 @@
         </if>
         <if test="materialParam != null">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
-            or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
+            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
+            or m.color like #{bindKey} or m.brand like #{bindKey} or m.other_field1 like #{bindKey}
             or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
         </if>
         and ifnull(m.delete_flag,'0') !='1'
@@ -768,9 +760,6 @@
         <if test="standard != null">
             and m.standard = #{standard}
         </if>
-        <if test="mfrs != null">
-            and m.mfrs = #{mfrs}
-        </if>
         <if test="otherField1 != null">
             and m.other_field1 = #{otherField1}
         </if>