فهرست منبع

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss-server-mdm

changhaoning 1 سال پیش
والد
کامیت
21f3e97227

+ 22 - 57
src/main/java/com/dk/mdm/mapper/ivt/InventoryMapper.xml

@@ -312,8 +312,8 @@
         FROM dkic_b.t_psi_inventory tpi
         <include refid="Join_Table"/>
         <where>
-            (tmgs.warning_lower_limit &lt;&gt; 0 OR tmgs.warning_upper_limit &lt;&gt; 0)
-            AND (tpi.inv_qty > tmgs.warning_lower_limit OR tpi.inv_qty > tmgs.warning_upper_limit)
+            (tmgs.warning_lower_limit &lt;&gt; 0 AND tpi.inv_qty &lt; tmgs.warning_lower_limit)
+            OR (tmgs.warning_upper_limit &lt;&gt; 0 AND tpi.inv_qty > tmgs.warning_upper_limit)
             <if test="whId != null and whId != ''">
                 AND tpi.wh_id = #{whId}::UUID
             </if>
@@ -374,64 +374,25 @@
 
     <select id="warningSelectByCond" resultType="com.dk.mdm.model.response.ivt.InventoryResponse">
         SELECT
-        <include refid="Base_Column_List_Response"/>
-        ,tmgs.sku_code
-        ,tmgs.sku_model
+        SUM(sys.f_remove_zero(tpi.inv_qty)) as inv_qty
         ,tmgs.sku_name
         ,tmgs.sku_spec
-        ,tmgs.price_purchase
-        ,tmgs.price_standard
-        ,tmgs.price_wholesale
-        ,tmgs.price_other
-        ,tmgs.price_limited
-        ,tmgs.sku_images
         ,tmgs.unit_id
+        ,tmgs.sku_model
         ,tmgs.sub_unit_id
         ,tmgs.warning_upper_limit
         ,tmgs.warning_lower_limit
         ,tmgs.pack_box
         ,tmu.unit_name    AS "unitName"
         ,subtmu.unit_name AS "subUnitName"
-        ,tmgs.flg_sub_unit
-        ,tmgb.brand_name
-        ,tmgb.short_name
-        ,tmw.wh_name
-        ,tmgc.cat_name as "catName"
-        ,tmgseries.series_name as "seriesName"
         ,tmu.decimal_places    as "decimalPlaces"
         FROM dkic_b.t_psi_inventory tpi
-        <include refid="Join_Table"/>
+        left join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id = tpi.sku_id
+        LEFT JOIN dkic_b.t_mst_unit tmu ON tmu.unit_id = tmgs.unit_id
+        LEFT JOIN dkic_b.t_mst_unit subtmu ON subtmu.unit_id = tmgs.sub_unit_id
         <where>
-            (tmgs.warning_lower_limit &lt;&gt; 0 OR tmgs.warning_upper_limit &lt;&gt; 0)
-            AND (tpi.inv_qty > tmgs.warning_lower_limit OR tpi.inv_qty > tmgs.warning_upper_limit)
-            <if test="whId != null and whId != ''">
-                AND tpi.wh_id = #{whId}::UUID
-            </if>
-            <if test="whIds != null and whIds.size()>0">
-                AND tpi.wh_id =
-                any(#{whIds, typeHandler=UuidListTypeHandler})
-            </if>
-            <if test="skuId != null and skuId != ''">
-                AND tpi.sku_id = #{skuId}
-            </if>
-            <if test="nonStdCode != null and nonStdCode != ''">
-                AND tpi.non_std_code = #{nonStdCode}
-            </if>
-            <if test="invQty != null">
-                AND tpi.inv_qty = #{invQty}
-            </if>
-            <if test="outingQty != null">
-                AND tpi.outing_qty = #{outingQty}
-            </if>
-            <if test="usableQty != null">
-                AND tpi.usable_qty = #{usableQty}
-            </if>
-            <if test="costPrice != null">
-                AND tpi.cost_price = #{costPrice}
-            </if>
-            <if test="costAmt != null">
-                AND tpi.cost_amt = #{costAmt}
-            </if>
+            (tmgs.warning_lower_limit &lt;&gt; 0 AND tpi.inv_qty &lt; tmgs.warning_lower_limit)
+            OR (tmgs.warning_upper_limit &lt;&gt; 0 AND tpi.inv_qty > tmgs.warning_upper_limit)
             <if test="flgValid != null">
                 AND tpi.flg_valid = #{flgValid}
             </if>
@@ -441,9 +402,6 @@
             <if test="cpId != null">
                 AND tpi.cp_id = #{cpId}
             </if>
-            <if test="freezeQty != null">
-                AND tpi.freeze_qty = #{freezeQty}
-            </if>
             <if test="categoryId != null and categoryId != ''">
                 AND tmgs.category_id = #{categoryId}::UUID
             </if>
@@ -460,12 +418,19 @@
                 and tpi.inv_qty != 0
             </if>
         </where>
-        <if test="desc != null and desc != ''">
-            order by tpi.usable_qty desc
-        </if>
-        <if test="desc == null or desc == ''">
-            order by tpi.usable_qty
-        </if>
+        group by
+        tmgs.sku_name
+        ,tmgs.sku_spec
+        ,tmgs.unit_id
+        ,tmgs.sku_model
+        ,tmgs.sub_unit_id
+        ,tmgs.warning_upper_limit
+        ,tmgs.warning_lower_limit
+        ,tmgs.pack_box
+        ,tmu.unit_name
+        ,subtmu.unit_name
+        ,tmgs.flg_sub_unit
+        ,tmu.decimal_places
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
         </if>

+ 7 - 0
src/main/java/com/dk/mdm/mapper/report/ReportMapper.xml

@@ -1661,6 +1661,13 @@
         FROM
          dkic_b.t_psi_order_item t
         inner join dkic_b.t_psi_order tpo on tpo.order_id = t.order_id
+        inner join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
+        left join dkic_b.t_mst_warehouse tmw on tmw.wh_id = t.wh_id
+        left join dkic_b.t_mst_customer tmc on tmc.cus_id = tpo.cus_id
+        LEFT JOIN dkic_b.t_mst_goods_brand tmgb ON tmgb.brand_id = tmgs.brand_id
+        left join sys.t_data_kind as tdk3 on tpo.out_status = tdk3.kind_code
+        LEFT JOIN dkic_b.t_mst_unit AS tmgu ON tmgs.unit_id = tmgu.unit_id
+        LEFT JOIN dkic_b.t_mst_unit AS tmgus ON tmgs.sub_unit_id = tmgus.unit_id
         <include refid="ConditionSaleItem"/>
     </select>
 

+ 4 - 4
src/main/java/com/dk/mdm/service/ivt/inventory/InventoryService.java

@@ -2224,11 +2224,11 @@ public class InventoryService extends BaseService<Inventory> {
             int invQty = item.getInvQty().intValue();
             Long warningLowerLimit = item.getWarningLowerLimit();
             Long warningUpperLimit = item.getWarningUpperLimit();
-            if (invQty > warningLowerLimit){
-                item.setWarningMsg("超出警戒上限");
+            if (warningUpperLimit != 0 && invQty > warningUpperLimit){
+                item.setWarningMsg("超出警戒上限" + "(" + warningUpperLimit + item.getUnitName() + ")");
             }
-            if (invQty > warningUpperLimit){
-                item.setWarningMsg("超出警戒下限");
+            if (warningLowerLimit != 0 && invQty < warningLowerLimit){
+                item.setWarningMsg("超出警戒下限" + "(" + warningLowerLimit + item.getUnitName() + ")");
             }
         });