2 rokov pred
rodič
commit
299f01dc91
19 zmenil súbory, kde vykonal 291 pridanie a 1 odobranie
  1. 2 0
      platform-dao/src/main/java/com/platform/dao/dto/store/InStoreFormDTO.java
  2. 4 0
      platform-dao/src/main/java/com/platform/dao/dto/store/OutStoreFormDTO.java
  3. 1 0
      platform-dao/src/main/java/com/platform/dao/entity/store/InStoreForm.java
  4. 4 0
      platform-dao/src/main/java/com/platform/dao/entity/store/OutStoreForm.java
  5. 2 0
      platform-dao/src/main/java/com/platform/dao/mapper/sqarepartmanage/SparePartInfoMapper.java
  6. 3 0
      platform-dao/src/main/java/com/platform/dao/vo/query/sparepartmanage/SparePartInfoVO.java
  7. 1 0
      platform-dao/src/main/java/com/platform/dao/vo/query/store/InStoreFormVO.java
  8. 1 0
      platform-dao/src/main/java/com/platform/dao/vo/query/store/OutStoreFormVO.java
  9. 115 0
      platform-dao/src/main/resources/mapper/sqarepartmanage/SparePartInfoMapper.xml
  10. 24 0
      platform-rest/src/main/java/com/platform/rest/controller/sqarepartmanage/SparePartInfoController.java
  11. 16 0
      platform-rest/src/main/java/com/platform/rest/controller/store/InStoreFormController.java
  12. 14 0
      platform-rest/src/main/java/com/platform/rest/controller/store/OutStoreFormController.java
  13. 1 0
      platform-rest/src/main/resources/application-dev.yml
  14. 5 0
      platform-service/src/main/java/com/platform/service/sqarepartmanage/SparePartInfoService.java
  15. 15 0
      platform-service/src/main/java/com/platform/service/sqarepartmanage/impl/SparePartInfoServiceImpl.java
  16. 5 0
      platform-service/src/main/java/com/platform/service/store/InStoreFormService.java
  17. 2 0
      platform-service/src/main/java/com/platform/service/store/OutStoreFormService.java
  18. 50 1
      platform-service/src/main/java/com/platform/service/store/impl/InStoreFormServiceImpl.java
  19. 26 0
      platform-service/src/main/java/com/platform/service/store/impl/OutStoreFormServiceImpl.java

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

@@ -24,6 +24,8 @@ import java.util.List;
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = true)
 public class InStoreFormDTO extends BaseDTO implements Serializable {
+    private Integer inNum;
+    private String spareId;
     /**
      * 使用公司
      */

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/dto/store/OutStoreFormDTO.java

@@ -24,6 +24,10 @@ import java.util.List;
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = true)
 public class OutStoreFormDTO extends BaseDTO implements Serializable {
+    private Integer outNum;
+    private String spareStoreId;
+
+    private String spareId;
     /**
      * 使用公司
      */

+ 1 - 0
platform-dao/src/main/java/com/platform/dao/entity/store/InStoreForm.java

@@ -22,6 +22,7 @@ import javax.persistence.Transient;
 @Accessors(chain = true)
 @Table(name = "t_in_store_form")
 public class InStoreForm implements Serializable{
+    private String spareId;
     /**
      * 总价
      */

+ 4 - 0
platform-dao/src/main/java/com/platform/dao/entity/store/OutStoreForm.java

@@ -22,6 +22,10 @@ import javax.persistence.Transient;
 @Accessors(chain = true)
 @Table(name = "t_out_store_form")
 public class OutStoreForm implements Serializable{
+    /**
+     * 备件id
+     */
+    private String spareId;
     /**
      * 总价
      */

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

@@ -17,6 +17,8 @@ import java.util.List;
  */
 @Component
 public interface SparePartInfoMapper extends MyMapper<SparePartInfo> {
+    List<SparePartInfoVO> getInOrOut(SparePartInfoDTO dto);
+
     /**
      * 分页查询
      * @param dto

+ 3 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/sparepartmanage/SparePartInfoVO.java

@@ -28,6 +28,9 @@ import java.util.List;
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = true)
 public class SparePartInfoVO extends BaseVO implements Serializable {
+    private String spareStoreId;
+
+    private String storeName;
     /**
      * 品牌
      */

+ 1 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/store/InStoreFormVO.java

@@ -25,6 +25,7 @@ import java.util.List;
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = true)
 public class InStoreFormVO extends BaseVO implements Serializable {
+    private String spareId;
 
     /**
      * 主键

+ 1 - 0
platform-dao/src/main/java/com/platform/dao/vo/query/store/OutStoreFormVO.java

@@ -25,6 +25,7 @@ import java.util.List;
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = true)
 public class OutStoreFormVO extends BaseVO implements Serializable {
+    private String spareId;
 
     /**
      * 主键

+ 115 - 0
platform-dao/src/main/resources/mapper/sqarepartmanage/SparePartInfoMapper.xml

@@ -343,4 +343,119 @@ warn_status,forecast_status,
             </if>
         </where>
     </select>
+
+    <select id="getInOrOut" parameterType="com.platform.dao.dto.sqarepartmanage.SparePartInfoDTO"
+            resultType="com.platform.dao.vo.query.sparepartmanage.SparePartInfoVO">
+        select info.*, SUM(spareStore.num) currentStock,store.name as storeName,spareStore.id as spareStoreId
+        from t_spare_part_info info
+        LEFT JOIN t_spare_store spareStore on spareStore.spare_id = info.id
+        left join t_store store on spareStore.store_id = store.id
+        <if test="producerName != null and producerName != ''">
+            LEFT JOIN t_firm_producer producer on producer.id = info.producer_id
+        </if>
+        <if test="supplierName != null and supplierName != ''">
+            LEFT JOIN t_supplier supplier on supplier.id = info.supplier_id
+        </if>
+        <where>
+            <if test="spareIdList != null and spareIdList.size > 0">
+                and sparestore.spare_id in
+                <foreach item="item" index="index" collection="spareIdList" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="warnStatusList != null and warnStatusList.size > 0">
+                AND info.warn_status in
+                <foreach item="item" index="index" collection="warnStatusList" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="forecastStatusList != null and forecastStatusList.size > 0">
+                AND info.forecast_status in
+                <foreach item="item" index="index" collection="forecastStatusList" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="typeId != null and typeId != ''">
+                and info.type_id = #{typeId}
+            </if>
+            <if test="isSpecial != null and isSpecial != ''">
+                and info.is_special = #{isSpecial}
+            </if>
+            <if test="producerName != null and producerName != ''">
+                AND producer.name like concat('%',#{producerName},'%')
+            </if>
+            <if test="supplierName != null and supplierName != ''">
+                AND supplier.name like concat('%',#{supplierName},'%')
+            </if>
+            <if test="keyword != null and keyword != ''">
+                AND ( info.name like concat('%',#{keyword},'%') or
+                info.no like concat('%',#{keyword},'%'))
+            </if>
+            <if test="name != null and name != ''">
+                AND info.name = #{name}
+            </if>
+            <if test="warnStatus != null and warnStatus != ''">
+                AND info.warn_status = #{warnStatus}
+            </if>
+            <if test="forecastStatus != null and forecastStatus != ''">
+                AND info.forecast_status = #{forecastStatus}
+            </if>
+            <if test="ggxh != null and ggxh != ''">
+                AND info.ggxh like concat('%',#{ggxh},'%')
+            </if>
+            <if test="initNo != null and initNo != ''">
+                AND info.init_no like concat('%',#{initNo},'%')
+            </if>
+            <if test="yt != null">
+                AND info.yt=#{yt}
+            </if>
+            <if test="storeId != null and storeId != ''">
+                AND spare.store_id=#{storeId}
+            </if>
+            <if test="level != null and level != ''">
+                AND info.level=#{level}
+            </if>
+            <if test="typeIds != null and typeIds.size > 0">
+                AND info.type_id in
+                <foreach item="item" index="index" collection="typeIds" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="producerId != null and producerId != ''">
+                AND info.producer_id=#{producerId}
+            </if>
+            <if test="supplierId != null and producerId != ''">
+                AND info.supplier_id=#{supplierId}
+            </if>
+            <if test="parentTypeId != null and parentTypeId != ''">
+                AND info.parent_type_id=#{parentTypeId}
+            </if>
+            <!-- <if test="typeId != null and typeId != ''">
+                 AND info.type_id=#{typeId}
+             </if>-->
+            <if test="parentNo != null and parentNo != ''">
+                AND info.parent_no=#{parentNo}
+            </if>
+            <if test="childNo != null and childNo != ''">
+                AND info.child_no=#{childNo}
+            </if>
+            <if test="searchMinStockWarn">
+                AND info.min_stock is not null
+            </if>
+            <if test="searchMinStockWarn">
+                AND info.warn_status = 0
+            </if>
+            <if test="searchType">
+                AND info.type_id not in (select id from t_spare_type)
+            </if>
+            <if test="brand!=null">
+                and info.brand like concat('%',#{brand},'%')
+            </if>
+        </where>
+        group by info.id
+        <if test="searchMinStockWarn">
+            HAVING info.min_stock > SUM( spareStore.num )
+        </if>
+    </select>
 </mapper>

+ 24 - 0
platform-rest/src/main/java/com/platform/rest/controller/sqarepartmanage/SparePartInfoController.java

@@ -293,4 +293,28 @@ public class SparePartInfoController {
     public R<AbstractPageResultBean<SparePartInfoVO>> queryByUsedSource(SparePartInfoDTO sparePartInfoDTO, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
         return new R<>(sparePartInfoService.getSpareList(sparePartInfoDTO,pageNum,pageSize));
     }
+
+    /**
+     *
+     * @param sparePartInfoDTO
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/getInOrOut")
+    public R inOrOUt(SparePartInfoDTO sparePartInfoDTO, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
+        return new R(sparePartInfoService.getInOrOut(sparePartInfoDTO,pageNum,pageSize));
+    }
+
+    /**
+     *
+     * @param sparePartInfoDTO
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/getInAndOutReport")
+    public R getInAndOutReport(SparePartInfoDTO sparePartInfoDTO) {
+        return new R(sparePartInfoService.getInAndOutReport(sparePartInfoDTO));
+    }
 }

+ 16 - 0
platform-rest/src/main/java/com/platform/rest/controller/store/InStoreFormController.java

@@ -2,6 +2,7 @@ package com.platform.rest.controller.store;
 
 import com.platform.common.util.R;
 import com.platform.dao.dto.store.InStoreFormDTO;
+import com.platform.dao.dto.store.OutStoreFormDTO;
 import com.platform.dao.entity.store.InStoreForm;
 import com.platform.service.store.InStoreFormService;
 import com.platform.dao.util.ExcelUtil;
@@ -56,6 +57,21 @@ public class InStoreFormController {
       return new R<>(inStoreFormService.saveModelByDTO(inStoreFormDTO));
   }
 
+  /**
+   * 入库
+   *
+   * @param outStoreFormDTO 入库登记单DTO
+   * @return R
+   */
+  @SysLog("新增入库登记单")
+  @PostMapping("/inStoreForm")
+  @PreAuthorize("@pms.hasPermission('store-out-store-forms-add')")
+  public R save2(@Validated({AddGroup.class}) @RequestBody InStoreFormDTO inStoreFormDTO) {
+    inStoreFormService.spareInStore(inStoreFormDTO);
+    return new R();
+  }
+
+
   /**
    * 修改记录
    *

+ 14 - 0
platform-rest/src/main/java/com/platform/rest/controller/store/OutStoreFormController.java

@@ -56,6 +56,20 @@ public class OutStoreFormController {
       return new R<>(outStoreFormService.saveModelByDTO(outStoreFormDTO));
   }
 
+  /**
+   * 出库
+   *
+   * @param outStoreFormDTO 出库登记单DTO
+   * @return R
+   */
+  @SysLog("新增出库登记单")
+  @PostMapping("/outStoreForm")
+  @PreAuthorize("@pms.hasPermission('store-out-store-forms-add')")
+  public R save2(@Validated({AddGroup.class}) @RequestBody OutStoreFormDTO outStoreFormDTO) {
+    outStoreFormService.spareOutStore(outStoreFormDTO);
+    return new R();
+  }
+
   /**
    * 修改记录
    *

+ 1 - 0
platform-rest/src/main/resources/application-dev.yml

@@ -81,6 +81,7 @@ ignore:
     - /ignores/**
     - /wechat/**
     - /upms/configs/**
+    - /sqarepartmanage/spare-part-info/**
 upload:
   root-dir: D://data//xian
 

+ 5 - 0
platform-service/src/main/java/com/platform/service/sqarepartmanage/SparePartInfoService.java

@@ -1,10 +1,12 @@
 package com.platform.service.sqarepartmanage;
 
 import com.platform.common.bean.AbstractPageResultBean;
+import com.platform.dao.bean.MyPage;
 import com.platform.dao.dto.sqarepartmanage.SparePartInfoDTO;
 import com.platform.dao.dto.store.SpareStoreDTO;
 import com.platform.dao.entity.sqarepartmanage.SparePartInfo;
 import com.platform.dao.vo.query.sparepartmanage.SparePartInfoVO;
+import com.platform.dao.vo.report.InAndOutReportVO;
 import com.platform.dao.vo.sb.SbInfoVO;
 import com.platform.service.base.IBaseService;
 import org.springframework.transaction.annotation.Transactional;
@@ -19,6 +21,9 @@ import java.util.List;
  * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved.
  */
 public interface SparePartInfoService extends IBaseService<SparePartInfo, SparePartInfoDTO> {
+    List<InAndOutReportVO> getInAndOutReport(SparePartInfoDTO dto);
+
+    AbstractPageResultBean<SparePartInfoVO> getInOrOut(SparePartInfoDTO dto,Integer pageNum,Integer pageSize);
 
    /**
     * 批量删除

+ 15 - 0
platform-service/src/main/java/com/platform/service/sqarepartmanage/impl/SparePartInfoServiceImpl.java

@@ -39,6 +39,7 @@ import com.platform.dao.util.CustomExcelImportUtil;
 import com.platform.dao.util.MessageTemplateUtil;
 import com.platform.dao.vo.query.check.CheckStandardSpareVO;
 import com.platform.dao.vo.query.sparepartmanage.SparePartInfoVO;
+import com.platform.dao.vo.report.InAndOutReportVO;
 import com.platform.dao.vo.sb.SbInfoVO;
 import com.platform.dao.vo.sb.SbModelSpareBomVO;
 import com.platform.dao.vo.spare.SparePartUsedVO;
@@ -89,6 +90,20 @@ public class SparePartInfoServiceImpl extends BaseServiceImpl<SparePartInfoMappe
     private CheckStandardSpareMapper checkStandardSpareMapper;
     private CheckStandardService checkStandardService;
 
+
+    @Override
+    public List<InAndOutReportVO> getInAndOutReport(SparePartInfoDTO dto) {
+
+        return null;
+    }
+
+    @Override
+    public AbstractPageResultBean<SparePartInfoVO> getInOrOut(SparePartInfoDTO dto, Integer pageNum, Integer pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        AbstractPageResultBean<SparePartInfoVO> pageInfos = new MyPage(mapper.getInOrOut(dto));
+        return pageInfos;
+    }
+
     @Override
     public int batchDelete(List<String> ids) {
 

+ 5 - 0
platform-service/src/main/java/com/platform/service/store/InStoreFormService.java

@@ -1,6 +1,7 @@
 package com.platform.service.store;
 
 import com.platform.dao.dto.purchase.PurchaseOrderDTO;
+import com.platform.dao.dto.store.OutStoreFormDTO;
 import com.platform.dao.dto.store.SpareBackFormDTO;
 import com.platform.dao.dto.store.SparePickFormDTO;
 import com.platform.dao.entity.purchase.PurchaseDispatchOrder;
@@ -25,6 +26,10 @@ import java.util.List;
  * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
  */
 public interface InStoreFormService extends IBaseService<InStoreForm, InStoreFormDTO> {
+    void spareInStore(InStoreFormDTO dto);
+
+    InStoreForm saveInStoreForm(InStoreFormDTO dto);
+
     InStoreForm saveModelByDTOImp(InStoreFormDTO model) ;
    /**
     * 批量删除

+ 2 - 0
platform-service/src/main/java/com/platform/service/store/OutStoreFormService.java

@@ -19,6 +19,8 @@ import java.util.List;
  */
 public interface OutStoreFormService extends IBaseService<OutStoreForm, OutStoreFormDTO> {
 
+    void spareOutStore(OutStoreFormDTO dto);
+
    /**
     * 批量删除
     *

+ 50 - 1
platform-service/src/main/java/com/platform/service/store/impl/InStoreFormServiceImpl.java

@@ -17,11 +17,13 @@ import com.platform.dao.entity.purchase.PurchaseOrder;
 import com.platform.dao.entity.sb.SbCheckDetail;
 import com.platform.dao.entity.sb.SbCheckForm;
 import com.platform.dao.entity.sb.SbInfo;
+import com.platform.dao.entity.sqarepartmanage.SparePartInfo;
 import com.platform.dao.entity.store.*;
 import com.platform.dao.enums.*;
 import com.platform.dao.mapper.purchase.PurchaseDispatchOrderListMapper;
 import com.platform.dao.mapper.purchase.PurchaseDispatchOrderMapper;
 import com.platform.dao.mapper.purchase.PurchaseListMapper;
+import com.platform.dao.mapper.sqarepartmanage.SparePartInfoMapper;
 import com.platform.dao.mapper.store.InStoreDetailMapper;
 import com.platform.dao.mapper.store.InStoreFormMapper;
 import com.platform.dao.mapper.store.SpareBackFormMapper;
@@ -63,6 +65,7 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
     private SpareStoreMapper spareStoreMapper;
     private StoreService storeService;
     private SpareBackFormMapper spareBackFormMapper;
+    private SparePartInfoMapper sparePartInfoMapper;
 
     @Override
     public int batchDelete(List<String> ids) {
@@ -219,13 +222,59 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
                 detailMapper.updateByPrimaryKeySelective(storeDetail);
             }
         }
-        ;
+
         inStoreForm.setTotalPrice(totalPrice);
         mapper.updateByPrimaryKey(inStoreForm);
         updateStore(inStoreForm.getId());
         return inStoreForm;
     }
 
+
+    @Override
+    public void spareInStore(InStoreFormDTO model) {
+        SparePartInfo sparePartInfo = sparePartInfoMapper.selectById(model.getSpareId());
+        SpareStore spareStore = new SpareStore();
+        spareStore.setSpareId(model.getSpareId());
+        List<SpareStore> spareStores = spareStoreMapper.select(spareStore);
+        Integer currentStock=0;
+        for (SpareStore store:spareStores){
+            Integer num = (store.getNum()==null?0:store.getNum().intValue());
+            currentStock+=num;
+        }
+        if (currentStock+model.getInNum()>sparePartInfo.getMaxStock().intValue()){
+            throw new BusinessException("该备件的最大库存量为"+sparePartInfo.getMaxStock()+"目前已超出,请修改入库数量!");
+        }
+        UserInfo userInfo = SecurityUtils.getUserInfo();
+        Weekend<InStoreForm> weekend = new Weekend<>(InStoreForm.class);
+        weekend.weekendCriteria().andIsNotNull(InStoreForm::getId);
+        Integer count = mapper.selectCountByExample(weekend);
+        model.setInNo(IdGeneratorUtils.getOutStoreNo(++count));
+        model.setDelFlag(false);
+        model.setUserInfo(userInfo);
+        model.setStatus(InStoreStatusEnum.EXECUTING.getValue());
+        InStoreForm inStoreForm = super.saveModelByDTO(model);
+    }
+
+    @Override
+    public InStoreForm saveInStoreForm(InStoreFormDTO model) {
+        Store store = storeService.getModelById(model.getStoreId());
+        if (store == null) {
+            throw new BusinessException("仓库不存在, storeId:" + model.getStoreId() );
+        }
+        if (store.getLevel().equals(StoreLevelEnum.ZONGCANG)){
+            throw new BusinessException("请选择库位");
+        }
+        UserInfo userInfo = SecurityUtils.getUserInfo();
+        model.setUserInfo(userInfo);
+        Weekend<InStoreForm> weekend = new Weekend<>(InStoreForm.class);
+        weekend.weekendCriteria().andIsNotNull(InStoreForm::getId);
+        Integer count = mapper.selectCountByExample(weekend);
+        model.setInNo(IdGeneratorUtils.getInStoreNo(++count));
+        model.setStatus(InStoreStatusEnum.NOT_EXECUTE.getValue());
+        InStoreForm inStoreForm = super.saveModelByDTO(model);
+        return inStoreForm;
+    }
+
     @Override
     public InStoreForm saveModelByDTOImp(InStoreFormDTO model) {
         UserInfo userInfo = SecurityUtils.getUserInfo();

+ 26 - 0
platform-service/src/main/java/com/platform/service/store/impl/OutStoreFormServiceImpl.java

@@ -53,6 +53,32 @@ public class OutStoreFormServiceImpl extends BaseServiceImpl<OutStoreFormMapper,
 
     private SparePickFormMapper sparePickFormMapper;
     private SparePickDetailMapper sparePickDetailMapper;
+
+    @Override
+    public void spareOutStore(OutStoreFormDTO model) {
+        SpareStore spareStore = new SpareStore();
+        spareStore.setSpareId(model.getSpareId());
+        List<SpareStore> spareStores = spareStoreMapper.select(spareStore);
+        Integer currentStock=0;
+        for (SpareStore store:spareStores){
+            Integer num = (store.getNum()==null?0:store.getNum().intValue());
+            currentStock+=num;
+        }
+        if (currentStock<model.getOutNum()){
+            throw new BusinessException("库存不足,请修改出库数量!");
+        }
+        UserInfo userInfo = SecurityUtils.getUserInfo();
+        Weekend<OutStoreForm> weekend = new Weekend<>(OutStoreForm.class);
+        weekend.weekendCriteria().andIsNotNull(OutStoreForm::getId);
+        Integer count = mapper.selectCountByExample(weekend);
+        model.setOutNo(IdGeneratorUtils.getOutStoreNo(++count));
+        model.setDelFlag(false);
+        model.setUserInfo(userInfo);
+        model.setStatus(OutStoreStatusEnum.EXECUTING.getValue());
+        OutStoreForm outStoreForm = super.saveModelByDTO(model);
+
+    }
+
     @Override
     public int batchDelete(List<String> ids) {
         //Weekend<OutStoreForm> weekend = new Weekend<>(OutStoreForm.class);