1 year ago
parent
commit
adb2c4c79a

+ 7 - 8
platform-dao/src/main/resources/mapper/store/InStoreFormMapper.xml

@@ -119,18 +119,17 @@
         info.type_id,info.no,info.name,info.ggxh,info.brand,
         info.type_id,info.no,info.name,info.ggxh,info.brand,
         info.initial_value,info.unit,sum(if(spareStore.num is null,0,spareStore.num)) currentStock,
         info.initial_value,info.unit,sum(if(spareStore.num is null,0,spareStore.num)) currentStock,
         info.max_stock,info.min_stock,info.level,info.producer_id,
         info.max_stock,info.min_stock,info.level,info.producer_id,
-        info.yt
+        info.yt,producer.name as producerName,spareType.name as typeName
         from t_in_store_form as instoreform
         from t_in_store_form as instoreform
-        left join t_store store on store.id = instoreform.store_id
         left join t_spare_part_info info on info.id = instoreform.spare_id
         left join t_spare_part_info info on info.id = instoreform.spare_id
         left join t_spare_store spareStore on
         left join t_spare_store spareStore on
         spareStore.spare_id = instoreform.spare_id
         spareStore.spare_id = instoreform.spare_id
-        <if test="producerName != null and producerName != ''">
+        left join t_store store on store.id = spareStore.store_id
-            LEFT JOIN t_firm_producer producer on producer.id = info.producer_id
+
-        </if>
+        LEFT JOIN t_firm_producer producer on producer.id = info.producer_id
-        <if test="supplierName != null and supplierName != ''">
+        LEFT JOIN t_supplier supplier on supplier.id = info.supplier_id
-            LEFT JOIN t_supplier supplier on supplier.id = info.supplier_id
+        left join t_spare_type spareType on spareType.id = info.type_id
-        </if>
+
         <where>
         <where>
             <include refid="List_Condition"/>
             <include refid="List_Condition"/>
             <if test="useCompany != null and useCompany != ''">
             <if test="useCompany != null and useCompany != ''">

+ 8 - 11
platform-dao/src/main/resources/mapper/store/OutStoreFormMapper.xml

@@ -98,19 +98,17 @@
         select outstoreform.*, store.name storeName,info.name as spareName,
         select outstoreform.*, store.name storeName,info.name as spareName,
         info.type_id,info.no,info.name,info.ggxh,info.brand,
         info.type_id,info.no,info.name,info.ggxh,info.brand,
         info.initial_value,info.unit,sum(if(spareStore.num is null,0,spareStore.num)) currentStock,
         info.initial_value,info.unit,sum(if(spareStore.num is null,0,spareStore.num)) currentStock,
-        info.max_stock,info.min_stock,info.level,info.producer_id,
+        info.max_stock,info.min_stock,info.level,info.producer_id,producer.name as producerName,
-        info.yt
+        info.yt,spareType.name as typeName
         from t_out_store_form as outstoreform
         from t_out_store_form as outstoreform
-        left join t_store store on store.id = outstoreform.store_id
         left join t_spare_part_info info on outstoreform.spare_id = info.id
         left join t_spare_part_info info on outstoreform.spare_id = info.id
         left join t_spare_store spareStore on
         left join t_spare_store spareStore on
         spareStore.spare_id = outstoreform.spare_id
         spareStore.spare_id = outstoreform.spare_id
-        <if test="producerName != null and producerName != ''">
+        left join t_store store on store.id = spareStore.store_id
-            LEFT JOIN t_firm_producer producer on producer.id = info.producer_id
+        LEFT JOIN t_firm_producer producer on producer.id = info.producer_id
-        </if>
+        LEFT JOIN t_supplier supplier on supplier.id = info.supplier_id
-        <if test="supplierName != null and supplierName != ''">
+        left join t_spare_type spareType on spareType.id = info.type_id
-            LEFT JOIN t_supplier supplier on supplier.id = info.supplier_id
+
-        </if>
         <where>
         <where>
             <include refid="List_Condition"/>
             <include refid="List_Condition"/>
             <if test="useCompany != null and useCompany != ''">
             <if test="useCompany != null and useCompany != ''">
@@ -280,9 +278,8 @@
     <select id="getOutStoreFormCollect" resultType="com.platform.dao.vo.query.store.OutStoreFormVO"
     <select id="getOutStoreFormCollect" resultType="com.platform.dao.vo.query.store.OutStoreFormVO"
             parameterType="com.platform.dao.dto.store.OutStoreFormDTO">
             parameterType="com.platform.dao.dto.store.OutStoreFormDTO">
         select info.*,sum(form.out_num ) totalNum,sum(form.out_num )*info.initial_value as totalPrice,form.id outId,
         select info.*,sum(form.out_num ) totalNum,sum(form.out_num )*info.initial_value as totalPrice,form.id outId,
-        form.out_no outNo,store.id storeId,spareStore.spare_id spareId,
+        form.out_no outNo,store.id storeId,spareStore.spare_id spareId,store.name as storeName,
         spareType.name as typeName,sum(spareStore.num) currentStock,producer.name as producerName
         spareType.name as typeName,sum(spareStore.num) currentStock,producer.name as producerName
-
           from t_spare_part_info info
           from t_spare_part_info info
         inner join t_out_store_form form on info.id = form.spare_id
         inner join t_out_store_form form on info.id = form.spare_id
         left join t_spare_store spareStore on spareStore.spare_id = info.id
         left join t_spare_store spareStore on spareStore.spare_id = info.id

+ 13 - 11
platform-service/src/main/java/com/platform/service/sqarepartmanage/impl/SparePartInfoServiceImpl.java

@@ -136,7 +136,7 @@ public class SparePartInfoServiceImpl extends BaseServiceImpl<SparePartInfoMappe
         Set<String> ids = map.keySet();
         Set<String> ids = map.keySet();
         for (String id:ids){
         for (String id:ids){
             for (SparePartInfoVO vo:sparePartInfoVOS){
             for (SparePartInfoVO vo:sparePartInfoVOS){
-                if (vo.getStoreId().equals(id)){
+                if (vo.getStoreId()!=null&&vo.getStoreId().equals(id)){
                     vo.setStoreName(map.get(id));
                     vo.setStoreName(map.get(id));
                     continue;
                     continue;
                 }
                 }
@@ -602,17 +602,19 @@ public class SparePartInfoServiceImpl extends BaseServiceImpl<SparePartInfoMappe
             SpareStore spareStore = new SpareStore();
             SpareStore spareStore = new SpareStore();
             spareStore.setSpareId(model.getId());
             spareStore.setSpareId(model.getId());
             spareStore.setId(IdGeneratorUtils.getObjectId());
             spareStore.setId(IdGeneratorUtils.getObjectId());
-            if (StringUtils.isBlank(model.getStoreId())) {
+//            if (StringUtils.isBlank(model.getStoreId())) {
-                throw new BusinessException("请设置库位信息");
+//                throw new BusinessException("请设置库位信息");
-            }
+//            }
-            Store store = storeMapper.selectByPrimaryKey(model.getStoreId());
+            if (StringUtils.isNotBlank(model.getStoreId())) {
-            if (store == null) {
+                Store store = storeMapper.selectByPrimaryKey(model.getStoreId());
-                throw new BusinessException("找不到仓库,请重新选择");
+                if (store == null) {
-            }
+                    throw new BusinessException("找不到仓库,请重新选择");
-            if (StoreLevelEnum.ZONGCANG.getValue().equals(store.getLevel())) {
+                }
-                throw new BusinessException("备件不可放到总仓,请具体到库位");
+                if (StoreLevelEnum.ZONGCANG.getValue().equals(store.getLevel())) {
+                    throw new BusinessException("备件不可放到总仓,请具体到库位");
+                }
+                spareStore.setStoreId(model.getStoreId());
             }
             }
-            spareStore.setStoreId(model.getStoreId());
             BigDecimal price = model.getInitialValue();
             BigDecimal price = model.getInitialValue();
             spareStore.setPrice(model.getInitialValue());
             spareStore.setPrice(model.getInitialValue());
             spareStore.setNum(model.getInitStock());
             spareStore.setNum(model.getInitStock());