Browse Source

Merge remote-tracking branch 'origin/demo_' into demo_

408249787 3 years ago
parent
commit
afdf2aa375
20 changed files with 231 additions and 122 deletions
  1. 2 0
      platform-dao/src/main/java/com/platform/dao/dto/store/PurchaseStoreFormDTO.java
  2. 5 1
      platform-dao/src/main/java/com/platform/dao/enums/InStoreTypeEnum.java
  3. 5 1
      platform-dao/src/main/java/com/platform/dao/enums/OutStoreTypeEnum.java
  4. 2 1
      platform-dao/src/main/java/com/platform/dao/mapper/sqarepartmanage/SparePartInfoMapper.java
  5. 1 1
      platform-dao/src/main/java/com/platform/dao/mapper/store/InStoreFormMapper.java
  6. 1 1
      platform-dao/src/main/java/com/platform/dao/mapper/store/OutStoreFormMapper.java
  7. 2 0
      platform-dao/src/main/java/com/platform/dao/mapper/store/PurchaseStoreFormMapper.java
  8. 1 2
      platform-dao/src/main/resources/mapper/repair/RepairApplicationFormMapper.xml
  9. 12 2
      platform-dao/src/main/resources/mapper/sqarepartmanage/SparePartInfoMapper.xml
  10. 6 1
      platform-dao/src/main/resources/mapper/store/InStoreDetailMapper.xml
  11. 13 3
      platform-dao/src/main/resources/mapper/store/InStoreFormMapper.xml
  12. 6 0
      platform-dao/src/main/resources/mapper/store/OutStoreDetailMapper.xml
  13. 15 4
      platform-dao/src/main/resources/mapper/store/OutStoreFormMapper.xml
  14. 15 0
      platform-dao/src/main/resources/mapper/store/PurchaseStoreFormMapper.xml
  15. 4 1
      platform-rest/src/main/java/com/platform/rest/controller/store/StoreController.java
  16. 0 11
      platform-service/src/main/java/com/platform/service/repair/impl/RepairApplicationFormServiceImpl.java
  17. 4 1
      platform-service/src/main/java/com/platform/service/sqarepartmanage/impl/SparePartInfoServiceImpl.java
  18. 90 83
      platform-service/src/main/java/com/platform/service/store/impl/InStoreFormServiceImpl.java
  19. 46 9
      platform-service/src/main/java/com/platform/service/store/impl/PurchaseStoreFormServiceImpl.java
  20. 1 0
      platform-service/src/main/java/com/platform/service/store/impl/StoreServiceImpl.java

+ 2 - 0
platform-dao/src/main/java/com/platform/dao/dto/store/PurchaseStoreFormDTO.java

@@ -111,4 +111,6 @@ public class PurchaseStoreFormDTO extends BaseDTO implements Serializable {
 
     private BigDecimal price;
 
+    private List<Integer> statusList;
+
 }

+ 5 - 1
platform-dao/src/main/java/com/platform/dao/enums/InStoreTypeEnum.java

@@ -32,7 +32,11 @@ public enum InStoreTypeEnum {
     /**
      * 盘点校准
      */
-    STORE_CHECK(5);
+    STORE_CHECK(5),
+    /**
+     * 包含发运入库和盘点校准
+     */
+    OTHER_RUKU(6);
 
     private Integer value;
 

+ 5 - 1
platform-dao/src/main/java/com/platform/dao/enums/OutStoreTypeEnum.java

@@ -32,7 +32,11 @@ public enum OutStoreTypeEnum {
     /**
      * 盘点校准
      */
-    STORE_CHECK(5);
+    STORE_CHECK(5),
+    /**
+     * 其他出库,包含4和5
+     */
+    CHUKU_OTHER(6);
 
     private Integer value;
 

+ 2 - 1
platform-dao/src/main/java/com/platform/dao/mapper/sqarepartmanage/SparePartInfoMapper.java

@@ -3,6 +3,7 @@ package com.platform.dao.mapper.sqarepartmanage;
 import com.platform.dao.config.MyMapper;
 import com.platform.dao.dto.repair.RepairFeeDTO;
 import com.platform.dao.dto.sqarepartmanage.SparePartInfoDTO;
+import com.platform.dao.dto.store.StoreDTO;
 import com.platform.dao.entity.sqarepartmanage.SparePartInfo;
 import com.platform.dao.vo.query.repair.RepairFeeVO;
 import com.platform.dao.vo.query.sparepartmanage.SparePartInfoVO;
@@ -65,5 +66,5 @@ public interface SparePartInfoMapper extends MyMapper<SparePartInfo> {
      * @param model
      * @return
      */
-    List<SparePartInfoVO> listForWorkplace();
+    List<SparePartInfoVO> listForWorkplace(StoreDTO storeDTO);
 }

+ 1 - 1
platform-dao/src/main/java/com/platform/dao/mapper/store/InStoreFormMapper.java

@@ -26,7 +26,7 @@ public interface InStoreFormMapper extends MyMapper<InStoreForm> {
      */
     List<InStoreFormVO> selectList(InStoreFormDTO dto);
 
-    List<InStoreFormVO> getInStoreDetailVOs();
+    List<InStoreFormVO> getInStoreDetailVOs(InStoreFormDTO inStoreFormDTO);
 
     /**
      * 查看入库详情

+ 1 - 1
platform-dao/src/main/java/com/platform/dao/mapper/store/OutStoreFormMapper.java

@@ -28,7 +28,7 @@ public interface OutStoreFormMapper extends MyMapper<OutStoreForm> {
      */
     List<OutStoreFormVO> selectList(OutStoreFormDTO dto);
 
-    List<OutStoreFormVO> selectOutStoreList();
+    List<OutStoreFormVO> selectOutStoreList(OutStoreFormDTO outStoreFormDTO);
 
     /**
      * 查询详情列表

+ 2 - 0
platform-dao/src/main/java/com/platform/dao/mapper/store/PurchaseStoreFormMapper.java

@@ -23,4 +23,6 @@ public interface PurchaseStoreFormMapper extends MyMapper<PurchaseStoreForm> {
      */
     List<PurchaseStoreFormVO> selectList(PurchaseStoreFormDTO dto);
 
+    List<PurchaseStoreForm> selectListByUser(PurchaseStoreFormDTO dto);
+
 }

+ 1 - 2
platform-dao/src/main/resources/mapper/repair/RepairApplicationFormMapper.xml

@@ -134,8 +134,7 @@
     <!-- 维修统计数据 -->
     <select id="getWorkplaceRepairData" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
             resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
-        select count(1) as tempTotalNum,sum(fee.fee) as tempTotalFee,rf.status from t_repair_application_form rf
-        join t_repair_fee fee on fee.repair_id = rf.id
+        select count(1) as tempTotalNum,rf.status from t_repair_application_form rf
         <where>
             <if test="repairUserId != null">
                 and rf.repair_user_id = #{repairUserId}

+ 12 - 2
platform-dao/src/main/resources/mapper/sqarepartmanage/SparePartInfoMapper.xml

@@ -340,9 +340,19 @@ warn_status,forecast_status,
         </where>
     </select>
 
-    <select id="listForWorkplace" resultType="com.platform.dao.vo.query.sparepartmanage.SparePartInfoVO">
+    <select id="listForWorkplace" parameterType="com.platform.dao.dto.store.StoreDTO"
+            resultType="com.platform.dao.vo.query.sparepartmanage.SparePartInfoVO">
 select t.currentStock as currentStock,spareType.name from
 (select SUM(spareStore.num) as currentStock,partInfo.type_id from t_spare_part_info partInfo join t_spare_store spareStore
-on partInfo.id = spareStore.spare_id GROUP BY partInfo.type_id) t join t_spare_type spareType on t.type_id = spareType.id
+on partInfo.id = spareStore.spare_id
+JOIN t_store store
+ON store.id=spareStore.store_id
+<where>
+    <if test="userId!=null">
+        user_id=#{userId}
+    </if>
+</where>
+
+GROUP BY partInfo.type_id) t join t_spare_type spareType on t.type_id = spareType.id
     </select>
 </mapper>

+ 6 - 1
platform-dao/src/main/resources/mapper/store/InStoreDetailMapper.xml

@@ -160,8 +160,13 @@
         select * from t_in_store_detail left join
         t_in_store_form
         on t_in_store_form.id = t_in_store_detail.in_id
+        left join
+        t_store
+        on t_in_store_form.store_id=t_store.id
         <where>
-
+            <if test="userId!=null">
+                and user_id=#{userId}
+            </if>
             <if test="searchStartTime != null">
                 and t_in_store_detail.created_time <![CDATA[ > ]]> #{searchStartTime}
             </if>

+ 13 - 3
platform-dao/src/main/resources/mapper/store/InStoreFormMapper.xml

@@ -70,9 +70,12 @@
         <if test="inNo != null and inNo != ''">
             and instoreform.in_no = #{inNo}
         </if>
-        <if test="type != null">
+        <if test="type != null and type!=6">
             and instoreform.type = #{type}
         </if>
+        <if test="type==6">
+            and (instoreform.type=4 or instoreform.type=5)
+        </if>
         <if test="remark != null and remark != ''">
             and instoreform.remark = #{remark}
         </if>
@@ -164,8 +167,15 @@
             resultType="com.platform.dao.vo.query.store.InStoreFormVO">
         SELECT detail.type, COUNT(*) instorenum FROM `t_in_store_form` form JOIN `t_in_store_detail` detail
 ON form.id=detail.`in_id`
-WHERE
-STATUS=1
+        join t_store store on store.id=form.store_id
+        <where>
+            <if test="status!=null">
+                and status=1
+            </if>
+            <if test="userId!=null">
+                and user_id=#{userId}
+            </if>
+        </where>
 GROUP BY
 detail.type
 

+ 6 - 0
platform-dao/src/main/resources/mapper/store/OutStoreDetailMapper.xml

@@ -164,7 +164,13 @@
         t_out_store_form
         on
         t_out_store_form.id = t_out_store_detail.out_id
+        left join
+        t_store
+        on t_out_store_form.store_id=t_store.id
         <where>
+            <if test="userId!=null">
+                and user_id=#{userId}
+            </if>
 
             <if test="searchStartTime != null">
                 and t_out_store_detail.created_time <![CDATA[ > ]]> #{searchStartTime}

+ 15 - 4
platform-dao/src/main/resources/mapper/store/OutStoreFormMapper.xml

@@ -53,8 +53,11 @@
         <if test="outNo != null and outNo != ''">
             and outstoreform.out_no = #{outNo}
         </if>
-        <if test="type != null">
-            and outstoreform.type = #{type}
+        <if test="type != null and type!=6">
+            and instoreform.type = #{type}
+        </if>
+        <if test="type==6">
+            and (instoreform.type=4 or instoreform.type=5)
         </if>
         <if test="remark != null and remark != ''">
             and outstoreform.remark = #{remark}
@@ -143,8 +146,16 @@
             resultType="com.platform.dao.vo.query.store.OutStoreFormVO">
  SELECT form.type, COUNT(*) outstorenum FROM `t_out_store_form` form JOIN `t_out_store_detail` detail
     ON form.id=detail.`out_id`
-    WHERE
-    STATUS=1
+    join t_store store on store.id=form.store_id
+    <where>
+        <if test="status!=null">
+            and status=1
+        </if>
+        <if test="userId!=null">
+            and user_id=#{userId}
+        </if>
+    </where>
+
     GROUP BY
     form.type
     </select>

+ 15 - 0
platform-dao/src/main/resources/mapper/store/PurchaseStoreFormMapper.xml

@@ -86,4 +86,19 @@
             <include refid="List_Condition"/>
         </where>
     </select>
+
+    <select id="selectListByUser" parameterType="com.platform.dao.dto.store.PurchaseStoreFormDTO" resultType="com.platform.dao.entity.store.PurchaseStoreForm">
+        select * from t_purchase_store_form
+        <where>
+            <if test="statusList != null and statusList.size > 0">
+                AND status in
+                <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="createdUserId != null">
+                and created_user_id = #{createdUserId}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 4 - 1
platform-rest/src/main/java/com/platform/rest/controller/store/StoreController.java

@@ -1,6 +1,8 @@
 package com.platform.rest.controller.store;
 
+import com.platform.common.model.UserInfo;
 import com.platform.common.util.R;
+import com.platform.common.util.SecurityUtils;
 import com.platform.dao.dto.sb.SbTypeDTO;
 import com.platform.dao.dto.store.StoreDTO;
 import com.platform.dao.entity.store.Store;
@@ -212,7 +214,8 @@ public class StoreController {
      */
     @GetMapping("tableTree")
     public R queryTableTree(StoreDTO storeDTO) {
-
+        String userId= SecurityUtils.getUserInfo().getUserId();
+        storeDTO.setUserId(userId);
         List<Store> typeList= storeService.getModelListByDTO(storeDTO);
         List<Store> parentList = new ArrayList<Store>();
         for(Store type: typeList){

+ 0 - 11
platform-service/src/main/java/com/platform/service/repair/impl/RepairApplicationFormServiceImpl.java

@@ -10,7 +10,6 @@ import com.platform.common.cache.ConfigCache;
 import com.platform.common.cache.DictCache;
 import com.platform.common.constant.CommonConstants;
 import com.platform.common.constant.RedisKeyConstants;
-import com.platform.common.enums.DataFilterTypeEnum;
 import com.platform.common.exception.BusinessException;
 import com.platform.common.exception.DeniedException;
 import com.platform.common.model.UserInfo;
@@ -48,7 +47,6 @@ import com.platform.service.upms.SysUserService;
 import com.platform.service.util.SysFileUtils;
 import com.platform.service.wechat.util.WeChatMessageUtil;
 import lombok.AllArgsConstructor;
-import org.bouncycastle.pqc.math.linearalgebra.BigEndianConversions;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import tk.mybatis.mapper.weekend.Weekend;
@@ -981,29 +979,24 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
      */
     private void packageInfo(Integer type,RepairApplicationFormVO result,WorkplaceRepairVO vo){
         BigDecimal tempNum = result.getTempTotalNum();
-        BigDecimal tempFee = result.getTempTotalNum();
         if(RepairApplicationFormTypeEnum.IN.getValue() == type){
             // 内部维修
             switch (result.getStatus().intValue()){
                 case CommonConstants.NOT_ALLOCATED:
                     vo.setCompletedRepairNum(vo.getCompletedRepairNum().add(tempNum));
-                    vo.setRepairFee(vo.getRepairFee().add(tempFee));
                     vo.setRepairTotalNum(vo.getRepairTotalNum().add(tempNum));
                     break;
                 case CommonConstants.PROCESSING:
                     vo.setWaitForRepairNum(vo.getWaitForRepairNum().add(tempNum));
-                    vo.setRepairFee(vo.getRepairFee().add(tempFee));
                     vo.setRepairTotalNum(vo.getRepairTotalNum().add(tempNum));
                     break;
                 case CommonConstants.WAIT_SUBMIT:
                 case CommonConstants.NOT_ACCEPTANCE:
                     vo.setVerifyRepairNum(vo.getVerifyRepairNum().add(tempNum));
-                    vo.setRepairFee(vo.getRepairFee().add(tempFee));
                     vo.setRepairTotalNum(vo.getRepairTotalNum().add(tempNum));
                     break;
                 case CommonConstants.REBACK:
                     vo.setRefusedRepairNum(vo.getRefusedRepairNum().add(tempNum));
-                    vo.setRepairFee(vo.getRepairFee().add(tempFee));
                     vo.setRepairTotalNum(vo.getRepairTotalNum().add(tempNum));
                     break;
             }
@@ -1012,23 +1005,19 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
             switch (result.getStatus()){
                 case CommonConstants.NOT_ALLOCATED:
                     vo.setOutCompletedRepairNum(vo.getOutCompletedRepairNum().add(tempNum));
-                    vo.setOutRepairFee(vo.getOutRepairFee().add(tempFee));
                     vo.setOutRepairTotalNum(vo.getOutRepairTotalNum().add(tempNum));
                     break;
                 case CommonConstants.PROCESSING:
                     vo.setOutWaitForRepairNum(vo.getOutWaitForRepairNum().add(tempNum));
-                    vo.setOutRepairFee(vo.getOutRepairFee().add(tempFee));
                     vo.setOutRepairTotalNum(vo.getOutRepairTotalNum().add(tempNum));
                     break;
                 case CommonConstants.WAIT_SUBMIT:
                 case CommonConstants.NOT_ACCEPTANCE:
                     vo.setOutVerifyRepairNum(vo.getOutVerifyRepairNum().add(tempNum));
-                    vo.setOutRepairFee(vo.getOutRepairFee().add(tempFee));
                     vo.setOutRepairTotalNum(vo.getOutRepairTotalNum().add(tempNum));
                     break;
                 case CommonConstants.REBACK:
                     vo.setOutRefusedRepairNum(vo.getOutRefusedRepairNum().add(tempNum));
-                    vo.setOutRepairFee(vo.getOutRepairFee().add(tempFee));
                     vo.setOutRepairTotalNum(vo.getOutRepairTotalNum().add(tempNum));
                     break;
             }

+ 4 - 1
platform-service/src/main/java/com/platform/service/sqarepartmanage/impl/SparePartInfoServiceImpl.java

@@ -16,6 +16,7 @@ import com.platform.dao.dto.repair.RepairFeeDTO;
 import com.platform.dao.dto.sb.SbModelSpareBomDTO;
 import com.platform.dao.dto.sqarepartmanage.SparePartInfoDTO;
 import com.platform.dao.dto.sqarepartmanage.SparePartUsedDTO;
+import com.platform.dao.dto.store.StoreDTO;
 import com.platform.dao.entity.check.CheckJob;
 import com.platform.dao.entity.sb.SbModel;
 import com.platform.dao.entity.sb.SbModelSpareBom;
@@ -1239,7 +1240,9 @@ public class SparePartInfoServiceImpl extends BaseServiceImpl<SparePartInfoMappe
 
     @Override
     public List<SparePartInfo1VO> listForWorkplacePie(String userId, String searchTime) {
-        List<SparePartInfoVO> sparePartInfoVOS = mapper.listForWorkplace() == null ? new ArrayList<>() : mapper.listForWorkplace();
+        StoreDTO storeDTO=new StoreDTO();
+        storeDTO.setUserId(userId);
+        List<SparePartInfoVO> sparePartInfoVOS = mapper.listForWorkplace(storeDTO) == null ? new ArrayList<>() : mapper.listForWorkplace(storeDTO);
         List<SparePartInfo1VO> sparePartInfo1VOS=new ArrayList<>();
         for(SparePartInfoVO vo:sparePartInfoVOS){
             SparePartInfo1VO sparePartInfo1VO=new SparePartInfo1VO();

+ 90 - 83
platform-service/src/main/java/com/platform/service/store/impl/InStoreFormServiceImpl.java

@@ -77,7 +77,7 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
 
     @Override
     public StoreWorkBenchVO getCurrentlyList(String userId) {
-        StoreWorkBenchVO storeWorkBenchVO=new StoreWorkBenchVO();
+        StoreWorkBenchVO storeWorkBenchVO = new StoreWorkBenchVO();
         LocalDateTime now = LocalDateTime.now();
 
         List<LocalDateTime> currentWeekStartAndEndList = DateUtils.currentWeek();
@@ -85,7 +85,7 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
         LocalDateTime searchEndTime = now.withHour(23).withMinute(59).withSecond(59);
         // 总数
         InStoreFormDTO queryDTO = new InStoreFormDTO();
-        OutStoreFormDTO queryDTO2=new OutStoreFormDTO();
+        OutStoreFormDTO queryDTO2 = new OutStoreFormDTO();
         queryDTO2.setSearchStartTime(searchStartTime);
         queryDTO2.setStatus(InStoreStatusEnum.EXECUTING.getValue());
         queryDTO.setStatus(OutStoreStatusEnum.EXECUTING.getValue());
@@ -95,25 +95,25 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
         queryDTO.setUserId(userId);
         queryDTO2.setUserId(userId);
         List<InStoreDetailVO> list = inStoreDetailMapper.getCurrentlyList(queryDTO) == null ? new ArrayList<>() : inStoreDetailMapper.getCurrentlyList(queryDTO);
-        List<OutStoreDetailVO> list2=outStoreDetailMapper.getCurrentlyList(queryDTO2) == null ? new ArrayList<>() : outStoreDetailMapper.getCurrentlyList(queryDTO2);
+        List<OutStoreDetailVO> list2 = outStoreDetailMapper.getCurrentlyList(queryDTO2) == null ? new ArrayList<>() : outStoreDetailMapper.getCurrentlyList(queryDTO2);
         List<InStoreDetailVO> result = new ArrayList<>();
-        List<OutStoreDetailVO> result2=new ArrayList<>();
-        for(LocalDateTime tempDate: currentWeekStartAndEndList){
+        List<OutStoreDetailVO> result2 = new ArrayList<>();
+        for (LocalDateTime tempDate : currentWeekStartAndEndList) {
             InStoreDetailVO vo = new InStoreDetailVO();
-            OutStoreDetailVO vo1=new OutStoreDetailVO();
+            OutStoreDetailVO vo1 = new OutStoreDetailVO();
             int tempTotalNum = 0;
             vo.setWeekDayName(tempDate.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.CHINA));
             vo1.setWeekDayName(tempDate.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.CHINA));
-            for(InStoreDetailVO useVO: list){
-                if(useVO.getCreatedTime().toLocalDate().isEqual(tempDate.toLocalDate())){
-                    tempTotalNum+=1;
+            for (InStoreDetailVO useVO : list) {
+                if (useVO.getCreatedTime().toLocalDate().isEqual(tempDate.toLocalDate())) {
+                    tempTotalNum += 1;
                 }
             }
             vo.setNum(new BigDecimal(tempTotalNum));
-            int tempTotalNum2=0;
-            for(OutStoreDetailVO useVO: list2){
-                if(useVO.getCreatedTime().toLocalDate().isEqual(tempDate.toLocalDate())){
-                    tempTotalNum2+=1;
+            int tempTotalNum2 = 0;
+            for (OutStoreDetailVO useVO : list2) {
+                if (useVO.getCreatedTime().toLocalDate().isEqual(tempDate.toLocalDate())) {
+                    tempTotalNum2 += 1;
                 }
             }
             vo1.setNum(new BigDecimal(tempTotalNum2));
@@ -127,76 +127,81 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
 
     @Override
     public StoreWorkBenchVO getStoreWorkBenchVO(String userId) {
-        StoreDTO query=new StoreDTO();
+        StoreDTO query = new StoreDTO();
         query.setUserId(userId);
-        Integer count=storeMapper.getStoreNums(query);
+        Integer count = storeMapper.getStoreNums(query);
 
-        SpareStoreDTO spareStoreDTO=new SpareStoreDTO();
+        SpareStoreDTO spareStoreDTO = new SpareStoreDTO();
         spareStoreDTO.setUserId(userId);
-        List<SpareStoreVO> spareStoreVOS=spareStoreMapper.selectList(spareStoreDTO);
-        Double totalPrice=0.0;
-        for(SpareStoreVO vo:spareStoreVOS){
-            totalPrice+=(vo.getNum().intValue())*(vo.getPrice().doubleValue());
+        List<SpareStoreVO> spareStoreVOS = spareStoreMapper.selectList(spareStoreDTO);
+        Double totalPrice = 0.0;
+        for (SpareStoreVO vo : spareStoreVOS) {
+            totalPrice += (vo.getNum().intValue()) * (vo.getPrice().doubleValue());
         }
-        DecimalFormat df=new DecimalFormat("0.00");
-        Double s=new Double(df.format(totalPrice));
-        InStoreFormDTO queryDTO=new InStoreFormDTO();
+        DecimalFormat df = new DecimalFormat("0.00");
+        Double s = new Double(df.format(totalPrice));
+        InStoreFormDTO queryDTO = new InStoreFormDTO();
         queryDTO.setUserId(userId);
-        OutStoreFormDTO queryDTO2=new OutStoreFormDTO();
+        OutStoreFormDTO queryDTO2 = new OutStoreFormDTO();
         queryDTO2.setUserId(userId);
-        List<OutStoreFormVO> outStoreFormVOS=outStoreFormMapper.selectOutStoreList();
-        List<InStoreFormVO> inStoreFormVOS=inStoreFormMapper.getInStoreDetailVOs();
-        StoreWorkBenchVO storeWorkBenchVO=new StoreWorkBenchVO();
-        BigDecimal num=new BigDecimal(0);
-        BigDecimal purchaseNum=new BigDecimal(0);
-        BigDecimal xzNum=new BigDecimal(0);
-        BigDecimal dbNum=new BigDecimal(0);
-        BigDecimal otherNum=new BigDecimal(0);
-        BigDecimal num1=new BigDecimal(0);
-        BigDecimal lyNum=new BigDecimal(0);
-        BigDecimal dbNum2=new BigDecimal(0);
-        BigDecimal bfNum=new BigDecimal(0);
-        BigDecimal otherNum2=new BigDecimal(0);
-        BigDecimal pdNum=new BigDecimal(0);
-        for(OutStoreFormVO vo:outStoreFormVOS){
-            //领用出库
-            if(vo.getType().equals(OutStoreTypeEnum.CHUKU_LINGYONG.getValue())){
-                lyNum=new BigDecimal(lyNum.intValue()+vo.getOutStoreNum().intValue());
-            }
-            //调拨出库
-            if(vo.getType().equals(OutStoreTypeEnum.CHUKU_DIAOBO.getValue())){
-                dbNum2=new BigDecimal(dbNum2.intValue()+vo.getOutStoreNum().intValue());
-            }
-            //报废出库
-            if(vo.getType().equals(OutStoreTypeEnum.CHUKU_BAOFEI.getValue())){
-                bfNum=new BigDecimal(bfNum.intValue()+vo.getOutStoreNum().intValue());
-            }
-            if(vo.getType().equals(OutStoreTypeEnum.CHUKU_QITA.getValue()) ||vo.getType().equals(OutStoreTypeEnum.STORE_CHECK.getValue())){
-                otherNum2=new BigDecimal(otherNum2.intValue()+vo.getOutStoreNum().intValue());
-            }
+        List<OutStoreFormVO> outStoreFormVOS = outStoreFormMapper.selectOutStoreList(queryDTO2);
+        List<InStoreFormVO> inStoreFormVOS = inStoreFormMapper.getInStoreDetailVOs(queryDTO);
+        StoreWorkBenchVO storeWorkBenchVO = new StoreWorkBenchVO();
+        BigDecimal num = new BigDecimal(0);
+        BigDecimal purchaseNum = new BigDecimal(0);
+        BigDecimal xzNum = new BigDecimal(0);
+        BigDecimal dbNum = new BigDecimal(0);
+        BigDecimal otherNum = new BigDecimal(0);
+        BigDecimal num1 = new BigDecimal(0);
+        BigDecimal lyNum = new BigDecimal(0);
+        BigDecimal dbNum2 = new BigDecimal(0);
+        BigDecimal bfNum = new BigDecimal(0);
+        BigDecimal otherNum2 = new BigDecimal(0);
+        BigDecimal pdNum = new BigDecimal(0);
+        for (OutStoreFormVO vo : outStoreFormVOS) {
+            if (vo != null) {
+                //领用出库
+                if ((OutStoreTypeEnum.CHUKU_LINGYONG.getValue()).equals(vo.getType())) {
+                    lyNum = new BigDecimal(lyNum.intValue() + vo.getOutStoreNum().intValue());
+                }
+                //调拨出库
+                if ((OutStoreTypeEnum.CHUKU_DIAOBO.getValue()).equals(vo.getType())) {
+                    dbNum2 = new BigDecimal(dbNum2.intValue() + vo.getOutStoreNum().intValue());
+                }
+                //报废出库
+                if ((OutStoreTypeEnum.CHUKU_BAOFEI.getValue()).equals(vo.getType())) {
+                    bfNum = new BigDecimal(bfNum.intValue() + vo.getOutStoreNum().intValue());
+                }
+                if ((OutStoreTypeEnum.CHUKU_QITA.getValue()).equals(vo.getType()) || (OutStoreTypeEnum.STORE_CHECK.getValue()).equals(vo.getType())) {
+                    otherNum2 = new BigDecimal(otherNum2.intValue() + vo.getOutStoreNum().intValue());
+                }
 
 
-        }
-        num1=new BigDecimal(lyNum.intValue()+dbNum2.intValue()+bfNum.intValue()+otherNum2.intValue());
-        for(InStoreFormVO vo:inStoreFormVOS){
-            //采购入库
-            if(vo.getType().equals(InStoreTypeEnum.CAIGOU_RUKU.getValue())){
-                purchaseNum=new BigDecimal(lyNum.intValue()+vo.getInStoreNum().intValue());
-            }
-            //闲置入库
-            if(vo.getType().equals(InStoreTypeEnum.XIANZHI_RUKU.getValue())){
-                xzNum=new BigDecimal(xzNum.intValue()+vo.getInStoreNum().intValue());
             }
-            //调拨入库
-            if(vo.getType().equals(InStoreTypeEnum.DIAOBO_RUKU.getValue())){
-                dbNum=new BigDecimal(bfNum.intValue()+vo.getInStoreNum().intValue());
-            }
-            if(vo.getType().equals(InStoreTypeEnum.FAYUN_RUKU.getValue()) || vo.getType().equals(InStoreTypeEnum.STORE_CHECK.getValue())){
-                otherNum=new BigDecimal(otherNum.intValue()+vo.getInStoreNum().intValue());
+        }
+        num1 = new BigDecimal(lyNum.intValue() + dbNum2.intValue() + bfNum.intValue() + otherNum2.intValue());
+        for (InStoreFormVO vo : inStoreFormVOS) {
+            if (vo != null) {
+                System.out.println(vo.getType());
+                //采购入库
+                if (InStoreTypeEnum.CAIGOU_RUKU.getValue().equals(vo.getType())) {
+                    purchaseNum = new BigDecimal(lyNum.intValue() + vo.getInStoreNum().intValue());
+                }
+                //闲置入库
+                if ((InStoreTypeEnum.XIANZHI_RUKU.getValue().equals(vo.getType()))) {
+                    xzNum = new BigDecimal(xzNum.intValue() + vo.getInStoreNum().intValue());
+                }
+                //调拨入库
+                if ((InStoreTypeEnum.DIAOBO_RUKU.getValue()).equals(vo.getType())) {
+                    dbNum = new BigDecimal(bfNum.intValue() + vo.getInStoreNum().intValue());
+                }
+                if ((InStoreTypeEnum.FAYUN_RUKU.getValue()).equals(vo.getType()) || (InStoreTypeEnum.STORE_CHECK.getValue()).equals(vo.getType())) {
+                    otherNum = new BigDecimal(otherNum.intValue() + vo.getInStoreNum().intValue());
+                }
             }
 
         }
-        num=new BigDecimal(purchaseNum.intValue()+xzNum.intValue()+dbNum.intValue()+otherNum.intValue());
+        num = new BigDecimal(purchaseNum.intValue() + xzNum.intValue() + dbNum.intValue() + otherNum.intValue());
 
         storeWorkBenchVO.setInTotalNum(num);
         storeWorkBenchVO.setPurchaseApplyNum(purchaseNum);
@@ -313,6 +318,7 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
 
     /**
      * 入库,只记录不更新
+     *
      * @param model
      * @return
      */
@@ -320,9 +326,9 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
     public InStoreForm saveModelByDTO(InStoreFormDTO model) {
         Store store = storeService.getModelById(model.getStoreId());
         if (store == null) {
-            throw new BusinessException("仓库不存在, storeId:" + model.getStoreId() );
+            throw new BusinessException("仓库不存在, storeId:" + model.getStoreId());
         }
-        if (store.getLevel().equals(StoreLevelEnum.ZONGCANG)){
+        if (store.getLevel().equals(StoreLevelEnum.ZONGCANG)) {
             throw new BusinessException("请选择库位");
         }
         UserInfo userInfo = SecurityUtils.getUserInfo();
@@ -404,7 +410,7 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
     public void updateModelByDTO(InStoreFormDTO model) {
         Store store = storeService.getModelById(model.getStoreId());
         if (store == null) {
-            throw new BusinessException("仓库不存在, storeId:" + model.getStoreId() );
+            throw new BusinessException("仓库不存在, storeId:" + model.getStoreId());
         }
         if (store.getLevel().equals(StoreLevelEnum.ZONGCANG)) {
             throw new BusinessException("请选择库位");
@@ -547,8 +553,8 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
         UserInfo userInfo = SecurityUtils.getUserInfo();
         InStoreForm model = this.getModelById(id);
         // 采购单入库的路由至新流程
-        if(InStoreTypeEnum.CAIGOU_RUKU.getValue() == model.getType()){
-            handlePurchaseInForm(model,userInfo);
+        if (InStoreTypeEnum.CAIGOU_RUKU.getValue() == model.getType()) {
+            handlePurchaseInForm(model, userInfo);
             return;
         }
 
@@ -610,20 +616,21 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
 
     /**
      * 处理采购入库单的入库操作
+     *
      * @param form
      */
     @Transactional(rollbackFor = Exception.class)
-    void handlePurchaseInForm(InStoreForm form,UserInfo userInfo){
+    void handlePurchaseInForm(InStoreForm form, UserInfo userInfo) {
         PurchaseStoreForm storeForm = new PurchaseStoreForm();
         storeForm.setId(form.getPurchaseId());
         storeForm.setUpdateUserName(userInfo.getUsername());
         storeForm.setUpdateUserId(userInfo.getUserId());
         storeForm.setUpdateTime(LocalDateTime.now());
-        try{
+        try {
             String storeId = form.getStoreId();
             // 找到入库备件明细
             Weekend<PurchaseStoreFormDetail> detailWeekend = new Weekend<>(PurchaseStoreFormDetail.class);
-            detailWeekend.weekendCriteria().andEqualTo(PurchaseStoreFormDetail::getPurchaseStoreFormId, form.getPurchaseId()).andEqualTo(PurchaseStoreFormDetail::getDeleteFlag,PurchaseStoreFormDetailDelFlagEnum.NORMAL.getValue());
+            detailWeekend.weekendCriteria().andEqualTo(PurchaseStoreFormDetail::getPurchaseStoreFormId, form.getPurchaseId()).andEqualTo(PurchaseStoreFormDetail::getDeleteFlag, PurchaseStoreFormDetailDelFlagEnum.NORMAL.getValue());
             List<PurchaseStoreFormDetail> detailList = purchaseStoreFormDetailMapper.selectByExample(detailWeekend);
             // 更新库存
             for (PurchaseStoreFormDetail detail : detailList) {
@@ -668,10 +675,10 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
             mapper.updateByPrimaryKeySelective(updForm);
             // 修正采购入库单状态
             storeForm.setStatus(PurchaseStoreFormStatusEnum.COMPLETED.getValue());
-        }catch (Exception e){
-            log.error("采购入库失败----------------"+e.getCause().getMessage());
+        } catch (Exception e) {
+            log.error("采购入库失败----------------" + e.getCause().getMessage());
             storeForm.setStatus(PurchaseStoreFormStatusEnum.STORE_FAIL.getValue());
-        }finally {
+        } finally {
             purchaseStoreFormMapper.updateByPrimaryKeySelective(storeForm);
         }
     }
@@ -849,7 +856,7 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
                 spareStore.setUpdateTime(LocalDateTime.now());
                 spareStore.setUpdateUserId(userInfo.getUserId());
                 spareStore.setUpdateUserName(userInfo.getRealName());
-                spareStore.setPrice(getNewPrice(spareStore,detail));
+                spareStore.setPrice(getNewPrice(spareStore, detail));
                 spareStoreMapper.updateByPrimaryKeySelective(spareStore);
             }
         }

+ 46 - 9
platform-service/src/main/java/com/platform/service/store/impl/PurchaseStoreFormServiceImpl.java

@@ -16,10 +16,7 @@ import com.platform.dao.entity.sqarepartmanage.SparePartInfo;
 import com.platform.dao.entity.store.*;
 import com.platform.dao.enums.*;
 import com.platform.dao.mapper.sqarepartmanage.SparePartInfoMapper;
-import com.platform.dao.mapper.store.InStoreFormMapper;
-import com.platform.dao.mapper.store.PurchaseStoreFormDetailMapper;
-import com.platform.dao.mapper.store.PurchaseStoreFormMapper;
-import com.platform.dao.mapper.store.SpareStoreMapper;
+import com.platform.dao.mapper.store.*;
 import com.platform.dao.vo.query.store.PurchaseStoreFormVO;
 import com.platform.service.base.impl.BaseServiceImpl;
 import com.platform.service.store.PurchaseStoreFormService;
@@ -33,6 +30,7 @@ import tk.mybatis.mapper.weekend.Weekend;
 import tk.mybatis.mapper.weekend.WeekendCriteria;
 
 import java.time.LocalDateTime;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -50,6 +48,7 @@ public class PurchaseStoreFormServiceImpl extends BaseServiceImpl<PurchaseStoreF
     private final SparePartInfoMapper sparePartInfoMapper;
     private final StoreService storeService;
     private final InStoreFormMapper inStoreFormMapper;
+    private final InStoreDetailMapper inStoreDetailMapper;
     @Override
     public int batchDelete(List<String> ids) {
         Weekend<PurchaseStoreForm> weekend = new Weekend<>(PurchaseStoreForm.class);
@@ -87,14 +86,17 @@ public class PurchaseStoreFormServiceImpl extends BaseServiceImpl<PurchaseStoreF
         UserInfo userInfo = SecurityUtils.getUserInfo();
         try{
             // 用户名下已创建单数
-            PurchaseStoreForm queryForm = new PurchaseStoreForm();
-            queryForm.setCreatedUserId(userInfo.getUserId());
-            queryForm.setStatus(PurchaseStoreFormStatusEnum.CREATED.getValue());
-            List<PurchaseStoreForm> formList = mapper.select(queryForm);
+            PurchaseStoreFormDTO queryFormDTO = new PurchaseStoreFormDTO();
+            queryFormDTO.setCreatedUserId(userInfo.getUserId());
+            List<Integer> statusList = new ArrayList<>();
+            statusList.add(PurchaseStoreFormStatusEnum.CREATED.getValue());
+            statusList.add(PurchaseStoreFormStatusEnum.PURCHASING.getValue());
+            queryFormDTO.setStatusList(statusList);
+            List<PurchaseStoreForm> formList = mapper.selectListByUser(queryFormDTO);
             if(formList == null || formList.size() == 0 || formList.size() > 1){
                 throw new DeniedException("您尚未创建采购单或多个采购单");
             }
-            queryForm = formList.get(0);
+            PurchaseStoreForm queryForm = formList.get(0);
             if(StringUtils.isBlank(record.getSpareId())){
                 throw new DeniedException("备件ID未携带");
             }
@@ -152,6 +154,13 @@ public class PurchaseStoreFormServiceImpl extends BaseServiceImpl<PurchaseStoreF
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void transferInStoreForm(String id) {
+        PurchaseStoreFormDetail detail = new PurchaseStoreFormDetail();
+        detail.setPurchaseStoreFormId(id);
+        detail.setDeleteFlag(0);
+        List<PurchaseStoreFormDetail> list = purchaseStoreFormDetailMapper.select(detail);
+        if(list == null || list.size() == 0){
+            throw new DeniedException("采购单中没有数据");
+        }
         PurchaseStoreForm form = mapper.selectByPrimaryKey(id);
         UserInfo userInfo = SecurityUtils.getUserInfo();
         InStoreForm model = new InStoreForm();
@@ -177,7 +186,11 @@ public class PurchaseStoreFormServiceImpl extends BaseServiceImpl<PurchaseStoreF
         }
         model.setStatus(InStoreStatusEnum.NOT_EXECUTE.getValue());
         model.setId(IdGeneratorUtils.getObjectId());
+        String inId = model.getId(); // 入库单的ID
+        String inNo = model.getInNo();
         inStoreFormMapper.insertSelective(model);
+        // 存入明细
+        saveDetails(inId,inNo,list,form.getSpareStoreId());
         // 回写采购入库单状态
         PurchaseStoreForm formUpd = new PurchaseStoreForm();
         formUpd.setId(id);
@@ -188,6 +201,30 @@ public class PurchaseStoreFormServiceImpl extends BaseServiceImpl<PurchaseStoreF
         mapper.updateByPrimaryKeySelective(formUpd);
     }
 
+    /**
+     * 存入明细
+     * @param inId
+     */
+    private void saveDetails(String inId,String inNo,List<PurchaseStoreFormDetail> list,String storeId){
+        List<InStoreDetail> detailList = new ArrayList<>();
+        for(PurchaseStoreFormDetail inDetail : list){
+            InStoreDetail detail = new InStoreDetail();
+            detail.setId(IdGeneratorUtils.getObjectId());
+            detail.setInId(inId);
+            detail.setInNo(inNo);
+            detail.setStoreId(storeId);
+            detail.setSpareId(inDetail.getSparePartInfoId());
+            detail.setNum(inDetail.getNum());
+            detail.setPrice(inDetail.getPrice());
+            detail.setTotalPrice(inDetail.getTotalPrice());
+            detail.setCreatedTime(LocalDateTime.now());
+            detail.setCreatedUserId(SecurityUtils.getUserInfo().getUserId());
+            detail.setType(InStoreTypeEnum.CAIGOU_RUKU.getValue());
+            detailList.add(detail);
+        }
+        inStoreDetailMapper.insertListforComplex(detailList);
+    }
+
     @Override
     public PurchaseStoreFormVO getVOById(String id) {
         PurchaseStoreForm entity = this.getModelById(id);

+ 1 - 0
platform-service/src/main/java/com/platform/service/store/impl/StoreServiceImpl.java

@@ -240,6 +240,7 @@ public class StoreServiceImpl extends BaseServiceImpl<StoreMapper, Store, StoreD
         ExecuteSql.executeNotEmpty(model.getId(), () -> weekendCriteria.andNotEqualTo(Store::getId, model.getId()));
         ExecuteSql.executeNotEmpty(model.getUseProject(), () -> weekendCriteria.andEqualTo(Store::getUseProject, model.getUseProject()));
         ExecuteSql.executeNotNull(model.getLevel(), () -> weekendCriteria.andEqualTo(Store::getLevel, model.getLevel()));
+        ExecuteSql.executeNotNull(model.getUserId(), () -> weekendCriteria.andEqualTo(Store::getUserId, model.getUserId()));
 
         // 登录人自己负责的仓库列表
         if (model.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == model.getFilter().intValue()) {