Просмотр исходного кода

物料库存数量金额表接口修改

chenw 7 лет назад
Родитель
Сommit
ba588117f6

+ 2 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductMapper.java

@@ -50,4 +50,6 @@ public interface ProductMapper extends CommonBaseMapper<Product> {
     boolean deleteProdIODetailByCode(@Param("code") String code, @Param("companyId") Long companyId);
 
     Long selectIdByCode(@Param("code") String code, @Param("companyId") Long companyId);
+
+    List<ProductReserveCostDTO> selectReserveCostByIgnoreWarehouse(@Param("con") String con, @Param("companyId") Long companyId);
 }

+ 6 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductServiceImpl.java

@@ -617,7 +617,12 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
         if(condition == null){
             condition = "1=1";
         }
-        return getMapper().selectReserveCost(condition, companyId);
+        if ("DETAIL".equals(listReqDTO.getMode())) {
+            return getMapper().selectReserveCost(condition, companyId);
+        } else {
+            return getMapper().selectReserveCostByIgnoreWarehouse(condition, companyId);
+        }
+
     }
 
     private List<ProductDTO> getList(ListReqDTO listReqDTO){

+ 15 - 0
applications/document/document-server/src/main/resources/mapper/ProductMapper.xml

@@ -476,6 +476,21 @@
         </where>
         ORDER BY PR_ID DESC
     </select>
+    <select id="selectReserveCostByIgnoreWarehouse" resultMap="ProdReserveCostResultMap">
+        select pr_code,pr_spec,pr_detail,pr_unit,sum(pw_onhand) pw_onhand,sum(pw_amount) pw_amount
+        from productWH tab left join Product on pw_prodcode=pr_code left join warehouse on pw_whid=wh_id
+        <where>
+            <if test="con!=null">
+                ${con}
+            </if>
+            <if test="companyId!=null">
+                and tab.companyId=#{companyId} and Product.companyId=#{companyId} and warehouse.companyId=#{companyId}
+                and pw_onhand!=0
+            </if>
+        </where>
+        group by pr_code,pr_spec,pr_detail,pr_unit,pr_id
+        ORDER BY PR_ID DESC
+    </select>
     <select id="getCountFromPurc" resultType="int">
         SELECT COUNT(*) FROM PURCHASEDETAIL
         WHERE PD_PRODID = #{id} AND COMPANYID=#{companyId}