29 Commit-ok a009f8cefc ... 3baa0de39a

Szerző SHA1 Üzenet Dátum
  13660505945 3baa0de39a Merge remote-tracking branch 'origin/xq' 1 hónapja
  15102826049 950100bd14 多余图标删除 1 hónapja
  15102826049 e2eacc21ab 浏览器图标修改 1 hónapja
  13660505945 a8554487c3 Merge remote-tracking branch 'origin/xq' 1 hónapja
  15102826049 c96a19185e 批次号样式问题修改 1 hónapja
  13660505945 fe17ec51b5 Merge remote-tracking branch 'origin/master_huangjunjie' 1 hónapja
  huang e6f6b2c3d9 订单查看图片问题修复 1 hónapja
  13660505945 91b7130776 Merge remote-tracking branch 'origin/xq' 1 hónapja
  15102826049 5544d5dbb5 bug修改 1 hónapja
  13660505945 73435c0f4e Merge remote-tracking branch 'origin/master_huangjunjie' 1 hónapja
  huang db7155e1bd Merge branch 'master_liaozeyong' of http://121.40.253.172:3000/pengyue/jsh_erp into master_huangjunjie 1 hónapja
  13660505945 cd8f2b5bec Merge remote-tracking branch 'origin/master_huangjunjie' 1 hónapja
  huang 9cbb6e29b5 Merge branch 'xq' of http://121.40.253.172:3000/pengyue/jsh_erp into master_huangjunjie 1 hónapja
  huang 8e0b34b315 入口时间bug修改 1 hónapja
  廖泽勇 25ed97aa10 bug调整 1 hónapja
  廖泽勇 effe59ae30 新增订单bug调整 1 hónapja
  13660505945 6b684e2332 Merge remote-tracking branch 'origin/master_liushuang' 1 hónapja
  13660505945 c4f99f6cfd Merge remote-tracking branch 'origin/master_liaozeyong' 1 hónapja
  huang d990d4829a Merge branch 'master' of http://121.40.253.172:3000/pengyue/jsh_erp into master_huangjunjie 1 hónapja
  huang 1a3cdde780 商品编辑子商品空白bug修改 1 hónapja
  廖泽勇 3d62371e84 字段调整 1 hónapja
  廖泽勇 79c1cc83ae Merge branch 'master' of http://121.40.253.172:3000/pengyue/jsh_erp into master_liaozeyong 1 hónapja
  liushuang 578a7b0608 Merge branch 'master_liushuang' of pengyue/jsh_erp into master 1 hónapja
  廖泽勇 74040c50f0 Merge branch 'master_huangjunjie' of http://121.40.253.172:3000/pengyue/jsh_erp into master_liaozeyong 1 hónapja
  廖泽勇 d06cb17b76 仓库下拉框调整 1 hónapja
  13660505945 998708ea29 Merge remote-tracking branch 'origin/master_liushuang' 1 hónapja
  13660505945 ec12e87232 Merge remote-tracking branch 'origin/master_huangjunjie' 1 hónapja
  huang dda459c901 修改订单入库时间问题 1 hónapja
  liushuang 009be5c861 Merge branch 'master_liushuang' of pengyue/jsh_erp into master 1 hónapja
31 módosított fájl, 553 hozzáadás és 379 törlés
  1. 4 0
      docs/new_sql.sql
  2. BIN
      jshERP-web/public/static/favicon.ico
  3. 1 1
      jshERP-web/src/components/jeecg/JEditableTable.vue
  4. 3 2
      jshERP-web/src/components/jeecgbiz/JSelectList.vue
  5. 1 1
      jshERP-web/src/components/jeecgbiz/modal/JSelectMaterialModal.vue
  6. 1 0
      jshERP-web/src/views/bill/SaleOrderList.vue
  7. 4 2
      jshERP-web/src/views/bill/mixins/BillModalMixin.js
  8. 0 1
      jshERP-web/src/views/bill/modules/OtherOutModal.vue
  9. 4 2
      jshERP-web/src/views/bill/modules/PurchaseOrderModal.vue
  10. 3 2
      jshERP-web/src/views/bill/modules/SaleOrderModal.vue
  11. 1 1
      src/main/java/com/jsh/erp/controller/MaterialExtendController.java
  12. 4 2
      src/main/java/com/jsh/erp/controller/SystemConfigController.java
  13. 9 13
      src/main/java/com/jsh/erp/controller/pda/PdaController.java
  14. 1 1
      src/main/java/com/jsh/erp/datasource/dto/TaskStocktakingItemQueryDTO.java
  15. 3 0
      src/main/java/com/jsh/erp/datasource/entities/DepotHead.java
  16. 2 1
      src/main/java/com/jsh/erp/datasource/entities/DepotItem.java
  17. 4 0
      src/main/java/com/jsh/erp/datasource/entities/DepotItemVo4WithInfoEx.java
  18. 1 1
      src/main/java/com/jsh/erp/datasource/entities/TaskStocktaking.java
  19. 1 1
      src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapper.java
  20. 10 1
      src/main/java/com/jsh/erp/datasource/mappers/DepotMapper.java
  21. 3 0
      src/main/java/com/jsh/erp/datasource/pda/vo/PDADepotItemVO.java
  22. 18 0
      src/main/java/com/jsh/erp/datasource/vo/TaskStocktakingItemVO.java
  23. 29 334
      src/main/java/com/jsh/erp/service/DepotService.java
  24. 10 2
      src/main/java/com/jsh/erp/service/impl/DepotHeadServiceImpl.java
  25. 2 2
      src/main/java/com/jsh/erp/service/impl/DepotItemServiceImpl.java
  26. 396 0
      src/main/java/com/jsh/erp/service/impl/DepotServiceImpl.java
  27. 11 2
      src/main/resources/mapper_xml/DepotHeadMapper.xml
  28. 2 2
      src/main/resources/mapper_xml/DepotItemMapper.xml
  29. 10 0
      src/main/resources/mapper_xml/DepotMapper.xml
  30. 2 2
      src/main/resources/mapper_xml/MaterialMapperEx.xml
  31. 13 3
      src/main/resources/mapper_xml/TaskStocktakingItemMapper.xml

+ 4 - 0
docs/new_sql.sql

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

BIN
jshERP-web/public/static/favicon.ico


+ 1 - 1
jshERP-web/src/components/jeecg/JEditableTable.vue

@@ -481,7 +481,7 @@
 
                     <!-- update-begin-author:jsh date:20210308 for:popupJsh -->
                     <template v-else-if="col.type === formTypes.popupJsh">
-                      <div style="width: 190px" :key="i">
+                      <div :key="i">
                         <a-tooltip
                           :id="id"
                           placement="top"

+ 3 - 2
jshERP-web/src/components/jeecgbiz/JSelectList.vue

@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div style="width: 100%">
     <a-input-group v-if="kind === 'material'" compact style="width: 100%; top: 0px">
       <a-select
         placeholder="输入批次号或名称"
@@ -12,6 +12,7 @@
         notFoundContent="需在商品管理先新增才能使用"
         @search="handleSearch"
         @change="handleChange"
+        style="width: 100%"
       >
         <div slot="dropdownRender" slot-scope="menu">
           <v-nodes :vnodes="menu" />
@@ -25,7 +26,7 @@
           </div>
         </div>
         <a-select-option v-for="item in materialData" :key="item.batchNumber">
-          {{ item.materialStr }}
+          {{ item.batchNumber }}
         </a-select-option>
       </a-select>
       <a-button icon="search" @click="onSearch" />

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

@@ -217,7 +217,7 @@ export default {
         { dataIndex: 'productionDate', title: '生产日期' },
         { dataIndex: 'expiryNum', title: '保质期' },
         { dataIndex: 'barCode', title: '商品条码' },
-        { dataIndex: 'depotId', title: '仓库名称' },
+        { dataIndex: 'depotName', title: '仓库名称' },
         { dataIndex: 'position', title: '仓库货架' },
 
         // { dataIndex: 'expand', title: '扩展信息' },

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

@@ -175,6 +175,7 @@
               <a-tag v-if="status == '1'" color="green">已审核</a-tag>
               <a-tag v-if="status == '2'" color="cyan">完成销售</a-tag>
               <a-tag v-if="status == '3'" color="blue">部分销售</a-tag>
+              <a-tag v-if="status == '4'" color="blue">进行中</a-tag>
               <a-tag v-if="status == '9'" color="orange">审核中</a-tag>
             </template>
             <template slot="customRenderPurchaseStatus" slot-scope="purchaseStatus">

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

@@ -378,6 +378,8 @@ export const BillModalMixin = {
       this.initRetail(1)
     },
     batchSetDepotModalFormOk(depotId) {
+      console.log('22222222222222222211')
+
       this.getAllTable()
         .then((tables) => {
           return getListData(this.form, tables)
@@ -529,7 +531,7 @@ export const BillModalMixin = {
                 })
               } else {
                 //单个条码
-                let depotIdSelected = this.prefixNo !== 'CGDD' && this.prefixNo !== 'XSDD' ? row.depotId : ''
+                let depotIdSelected = row.depotId || ''
                 findStockByDepotAndBarCode({ depotId: depotIdSelected, barCode: row.batchNumber }).then((res) => {
                   if (res && res.code === 200) {
                     let mArr = []
@@ -545,7 +547,6 @@ export const BillModalMixin = {
                       values: mInfoEx,
                     }
                     mArr.push(mObj)
-
                     target.setValues(mArr)
                     target.recalcAllStatisticsColumns()
                     that.autoChangePrice(target)
@@ -742,6 +743,7 @@ export const BillModalMixin = {
         warehousingTime: mInfo.warehousingTime,
         unitId: mInfo.unitId,
         unitList: mInfo.unitList,
+        depotId: mInfo.depotId,
       }
     },
     //使得型号、颜色、扩展信息、sku等为隐藏

+ 0 - 1
jshERP-web/src/views/bill/modules/OtherOutModal.vue

@@ -320,7 +320,6 @@ export default {
           { 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 },
           { title: '多属性', key: 'sku', width: '9%', type: FormTypes.normal },
           { title: '原数量', key: 'preNumber', width: '4%', type: FormTypes.normal },

+ 4 - 2
jshERP-web/src/views/bill/modules/PurchaseOrderModal.vue

@@ -435,7 +435,7 @@ export default {
           { 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: 'depotId', width: '9%', type: FormTypes.select, disabled: true },
           { title: '仓库货架', key: 'position', width: '6%', type: FormTypes.normal },
           { title: '包装规格', key: 'unitName', width: '6%', type: FormTypes.normal },
 
@@ -593,6 +593,7 @@ export default {
       this.initAccount(0)
       this.initPlatform()
       this.initQuickBtn()
+      this.initDepot()
     },
     /** 整理成formData */
     classifyIntoFormData(allValues) {
@@ -602,7 +603,7 @@ export default {
       billMain.type = '其它'
       billMain.subType = '采购订单'
       for (let item of detailArr) {
-        item.depotId = '' //订单不需要仓库
+        // item.depotId = '' //订单不需要仓库
         totalPrice += item.allPrice - 0
       }
       billMain.totalPrice = 0 - totalPrice
@@ -627,6 +628,7 @@ export default {
         billMain.id = this.model.id
       }
       billMain.status = this.billStatus
+
       return {
         info: JSON.stringify(billMain),
         rows: JSON.stringify(detailArr),

+ 3 - 2
jshERP-web/src/views/bill/modules/SaleOrderModal.vue

@@ -401,7 +401,7 @@ export default {
           { title: '生产日期', key: 'productionDate', width: '6%', 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: 'depotId', width: '9%', type: FormTypes.select, disabled: true },
           { title: '仓库货架', key: 'position', width: '6%', type: FormTypes.normal },
           { title: '包装规格', key: 'unitName', width: '6%', type: FormTypes.normal },
 
@@ -554,6 +554,7 @@ export default {
       this.initAccount(0)
       this.initPlatform()
       this.initQuickBtn()
+      this.initDepot()
     },
     //提交单据时整理成formData
     classifyIntoFormData(allValues) {
@@ -563,7 +564,7 @@ export default {
       billMain.type = '其它'
       billMain.subType = '销售订单'
       for (let item of detailArr) {
-        item.depotId = '' //订单不需要仓库
+        // item.depotId = '' //订单不需要仓库
         totalPrice += item.allPrice - 0
       }
       billMain.totalPrice = totalPrice

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

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

+ 4 - 2
src/main/java/com/jsh/erp/controller/SystemConfigController.java

@@ -230,6 +230,7 @@ public class SystemConfigController extends BaseController {
     public void view(HttpServletRequest request, HttpServletResponse response) {
         // ISO-8859-1 ==> UTF-8 进行编码转换
         String imgPath = extractPathFromPattern(request);
+        imgPath = imgPath.replace("https:/","https://");
         if(StringUtil.isEmpty(imgPath) || imgPath=="null"){
             return;
         }
@@ -246,7 +247,8 @@ public class SystemConfigController extends BaseController {
                 fileUrl = systemConfigService.getFileUrlLocal(imgPath);
                 inputStream = new BufferedInputStream(new FileInputStream(fileUrl));
             } else if(fileUploadType == 2) {
-                fileUrl = systemConfigService.getFileUrlAliOss(imgPath);
+                //fileUrl = systemConfigService.getFileUrlAliOss(imgPath);
+                fileUrl = imgPath;
                 URL url = new URL(fileUrl);
                 HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                 conn.setRequestMethod("GET");
@@ -365,6 +367,6 @@ public class SystemConfigController extends BaseController {
     private static String extractPathFromPattern(final HttpServletRequest request) {
         String path = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
         String bestMatchPattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
-        return new AntPathMatcher().extractPathWithinPattern(bestMatchPattern, path);
+        return new AntPathMatcher().extractPathWithinPattern(bestMatchPattern, path).substring(6);
     }
 }

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

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

+ 1 - 1
src/main/java/com/jsh/erp/datasource/dto/TaskStocktakingItemQueryDTO.java

@@ -21,7 +21,7 @@ public class TaskStocktakingItemQueryDTO {
     private String batchNumber;
 
     @ApiModelProperty("仓库货架")
-    private Long position;
+    private String position;
 
     @ApiModelProperty("是否存在差异 1:是,2:否,其他是全部")
     private String isDifference;

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

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

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

@@ -1,6 +1,7 @@
 package com.jsh.erp.datasource.entities;
 
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -102,7 +103,7 @@ public class DepotItem {
     private Long warehousingUser;
 
     @ApiModelProperty("出入库时间")
-    private Date warehousingTime;
+    private String warehousingTime;
 
     public Long getId() {
         return id;

+ 4 - 0
src/main/java/com/jsh/erp/datasource/entities/DepotItemVo4WithInfoEx.java

@@ -1,7 +1,9 @@
 package com.jsh.erp.datasource.entities;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.math.BigDecimal;
 
@@ -297,4 +299,6 @@ public class DepotItemVo4WithInfoEx extends DepotItem{
     public void setBrand(String brand) {
         this.brand = brand;
     }
+
+
 }

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

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

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

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

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

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

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

@@ -65,5 +65,8 @@ public class PDADepotItemVO{
     @ApiModelProperty("图片名称")
     private String imgName;
 
+    @ApiModelProperty("出入库时间")
+    private Date warehousingTime;
+
 
 }

+ 18 - 0
src/main/java/com/jsh/erp/datasource/vo/TaskStocktakingItemVO.java

@@ -80,4 +80,22 @@ public class TaskStocktakingItemVO {
     @ApiModelProperty("删除标记,0.未删除,1.已删除")
     private boolean deleteFlag;
 
+    @ApiModelProperty("商品规格")
+    private String standard;
+
+    @ApiModelProperty("商品型号")
+    private String model;
+
+    @ApiModelProperty("商品颜色")
+    private String color;
+
+    @ApiModelProperty("商品品牌")
+    private String brand;
+
+    @ApiModelProperty("商品多属性")
+    private String sku;
+
+    @ApiModelProperty("商品保质期天数")
+    private String expiryNum;
+
 }

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

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

+ 10 - 2
src/main/java/com/jsh/erp/service/impl/DepotHeadServiceImpl.java

@@ -1165,7 +1165,6 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
                         String.format(ExceptionConstants.DEPOT_HEAD_FILE_NUM_LIMIT_MSG, 4));
             }
         }
-        //生成订单二维码
         JSONArray rowArr = JSONArray.parseArray(rows);
         //商品数量
         int operNumber = 0;
@@ -1287,6 +1286,10 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         depotHead.setGoodsQuantity(operNumber);
         //商品总类
         depotHead.setGoodsTypeCount(rowArr.size());
+        //修改时间
+        depotHead.setOperTime(new Date());
+        //修改操作人
+        depotHead.setOperId(userService.getCurrentUser().getId());
         //修改单据主表
         depotHeadMapper.updateByPrimaryKeySelective(depotHead);
         //如果存在多账户结算需要将原账户的id置空
@@ -1892,6 +1895,8 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         List<DepotItem> depotItems = depotItemService.getListByHeaderId(depotHead.getId());
         //设置单据主表信息
         depotHead.setId(null);
+        //设置关联订单
+        depotHead.setLinkNumber(depotHead.getNumber());
         String number = sequenceService.buildOnlyNumber();
         //设置单号
         if ("采购订单".equals(depotHead.getSubType())){
@@ -1924,9 +1929,11 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
             }
         }
         //判断用户是否已经登录过,登录过不再处理
-        User userInfo=userService.getCurrentUser();
+        User userInfo = userService.getCurrentUser();
         depotHead.setCreator(userInfo==null?null:userInfo.getId());
         depotHead.setCreateTime(new Timestamp(System.currentTimeMillis()));
+        depotHead.setOperId(userInfo==null?null:userInfo.getId());
+        depotHead.setOperTime(new Timestamp(System.currentTimeMillis()));
         if(StringUtil.isEmpty(depotHead.getStatus())) {
             depotHead.setStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
         }
@@ -1971,6 +1978,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         User user = userService.getCurrentUser();
         depotHead.setTenantId(user.getId());
         depotHead.setCreateTime(new Timestamp(System.currentTimeMillis()));
+        depotHead.setStatus("2");
         //添加主表
         depotHeadMapper.insertSelective(depotHead);
         //根据单据编号查询单据id

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

@@ -101,7 +101,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
      */
     @Override
     public List<PDADepotItemVO> materialDepotDetail(String type , Long materialId) {
-        return depotItemMapper.materialDepotDetail(type , materialId);
+        return depotItemMapper.materialDepotDetail(type, materialId);
     }
 
     @Override
@@ -499,7 +499,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                 depotItem.setWarehousingVariance(rowObj.getBigDecimal("warehousingVariance"));
                 depotItem.setReasonOfDifference(rowObj.getString("reasonOfDifference"));
                 depotItem.setWarehousingUser(rowObj.getLong("warehousingUser"));
-                depotItem.setWarehousingTime(rowObj.getDate("warehousingTime"));
+                depotItem.setWarehousingTime(rowObj.getString("warehousingTime"));
                 Material material= materialService.getMaterial(depotItem.getMaterialId());
                 if (BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber()) ||
                         BusinessConstants.ENABLE_BATCH_NUMBER_ENABLED.equals(material.getEnableBatchNumber())) {

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

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

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

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

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

@@ -240,7 +240,7 @@
       <if test="warehousingUser != null">
         warehousing_user,
       </if>
-      <if test="warehousingTime != null">
+      <if test="warehousingTime != null and warehousingTime != ''">
         warehousing_time,
       </if>
     </trim>
@@ -332,7 +332,7 @@
       <if test="warehousingUser != null">
         #{warehousingUser,jdbcType=BIGINT},
       </if>
-      <if test="warehousingTime != null">
+      <if test="warehousingTime != null and warehousingTime != ''">
         #{warehousingTime,jdbcType=DATE},
       </if>
     </trim>

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

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

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

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

+ 13 - 3
src/main/resources/mapper_xml/TaskStocktakingItemMapper.xml

@@ -28,9 +28,10 @@
             tsi.delete_flag = 0
             AND tsi.task_stocktaking_id = #{taskId}
             <if test="number != null and number != ''">
-                m.name LIKE CONCAT('%',#{number},'%')
+                AND (m.name LIKE CONCAT('%',#{number},'%')
                 OR me.batch_number LIKE CONCAT('%',#{number},'%')
-                OR m.system_sku LIKE CONCAT('%',#{number},'%')
+                OR me.position LIKE CONCAT('%',#{number},'%')
+                OR m.system_sku LIKE CONCAT('%',#{number},'%'))
             </if>
             <if test="userIdList != null and userIdList.size > 0">
                 AND tsi.creator IN
@@ -50,6 +51,9 @@
                      me.position LIKE CONCAT('%',#{item},'%')
                 </foreach>
             </if>
+            <if test="position != null and position != ''">
+                AND me.position LIKE CONCAT('%',#{position},'%')
+            </if>
             <if test="statusList != null and statusList.size > 0">
                 AND tsi.status IN
                 <foreach collection="statusList" item="item" open="(" separator="," close=")">
@@ -67,14 +71,20 @@
             tsi.id AS id,
             mc.`name` AS category_name,
             m.`name` AS material_name,
+            m.standard AS standard,
+            m.model AS model,
+            m.color AS color,
+            m.brand AS brand,
             me.position AS position,
             me.batch_number AS batch_number,
             m.system_sku AS system_sku,
+            me.sku AS sku,
             me.commodity_unit AS commodity_unit,
             me.production_date AS production_date,
             s.supplier AS supplier_name,
             me.bar_code AS bar_code,
             me.inventory AS inventory,
+            me.expiry_num AS expiry_num,
             d.`name` AS depot_name,
             tsi.new_position AS new_position,
             tsi.new_inventory AS new_inventory,
@@ -100,7 +110,7 @@
                 AND me.batch_number = #{batchNumber}
             </if>
             <if test="position != null and position != ''">
-                AND me.position = #{position}
+                AND me.position LIKE  CONCAT('%',#{position},'%')
             </if>
             <if test="isDifference != null and isDifference == '1'">
                 AND tsi.new_inventory = me.inventory