Browse Source

物料库存金额,调整取数逻辑,MAIN取productonhand表,新增成本单价。物料放大镜新增成本单价

rainco 7 years ago
parent
commit
e5f8e67e3b

+ 1 - 2
applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/ProductDTO.java

@@ -39,6 +39,5 @@ public class ProductDTO implements Serializable {
     //productonhand
     private Double po_onhand;
 
-
-
+    private Double po_avprice;
 }

+ 11 - 10
applications/document/document-server/src/main/resources/mapper/ProductMapper.xml

@@ -43,6 +43,7 @@
         <result column="pr_whname" property="pr_whname" jdbcType="VARCHAR"/>
         <!--productonhand-->
         <result column="po_onhand" property="po_onhand" jdbcType="DOUBLE"/>
+        <result column="po_avprice" property="po_avprice" jdbcType="DOUBLE"/>
         <!--productonhand-->
         <result column="pr_kind" property="pr_kind" jdbcType="VARCHAR"/>
         <result column="pr_orispeccode" property="pr_orispeccode" jdbcType="VARCHAR"/>
@@ -459,36 +460,36 @@
         <result column="pr_unit" property="rc_prodUnit" jdbcType="VARCHAR"/>
         <result column="wh_code" property="rc_whCode" jdbcType="VARCHAR"/>
         <result column="wh_description" property="rc_whName" jdbcType="VARCHAR"/>
-        <result column="pw_onhand" property="rc_number" jdbcType="DOUBLE"/>
-        <result column="pw_avprice" property="rc_price" jdbcType="DOUBLE"/>
-        <result column="pw_amount" property="rc_amount" jdbcType="DOUBLE"/>
+        <result column="onhand" property="rc_number" jdbcType="DOUBLE"/>
+        <result column="po_avprice" property="rc_price" jdbcType="DOUBLE"/>
+        <result column="po_amount" property="rc_amount" jdbcType="DOUBLE"/>
     </resultMap>
     <select id="selectReserveCost" resultMap="ProdReserveCostResultMap">
-        select * from productWH tab left join Product on pw_prodid=pr_id left join warehouse on pw_whid=wh_id
+        select pr_code,pr_spec,pr_detail,pr_unit,wh_code,wh_description,pw_onhand onhand
+        from productWH left join Product on pw_prodid=pr_id 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 productWH.companyId=#{companyId} and Product.companyId=#{companyId} and warehouse.companyId=#{companyId}
                 and pw_onhand!=0
             </if>
         </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_prodid=pr_id left join warehouse on pw_whid=wh_id
+        select pr_code,pr_spec,pr_detail,pr_unit,po_onhand onhand,po_avprice,po_amount
+        from productonhand  left join product on pr_id = po_prodid and productonhand.companyId = product.companyId
         <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
+                and productonhand.companyId=#{companyId}
+                and po_onhand != 0
             </if>
         </where>
-        group by pr_code,pr_spec,pr_detail,pr_unit,pr_id
         ORDER BY PR_ID DESC
     </select>
     <select id="selectCalculateFields" resultType="string">