Browse Source

采购验退单修改限制

zhoudw 7 years ago
parent
commit
5eb216ad86

+ 1 - 1
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/ProdInOutMapper.java

@@ -23,7 +23,7 @@ public interface ProdInOutMapper extends CommonBaseMapper<ProdInOut> {
 
     int checkQtyFromPurchase(String pu_code);
 
-    int checkQtyFromProdIn(String pu_code);
+    int checkQtyFromProdIn(Long id);
 
     void updateCreator(@Param("userId") Long userId,@Param("userName") String userName,@Param("id") Long pi_id);
 }

+ 3 - 6
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java

@@ -205,10 +205,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         }
 
         //检查更新后数据是否
-        String pu_code = prodInOut.getPi_pucode();
-        if (!StringUtils.isEmpty(pu_code)){
-            checkUpdateQty(pu_code,pi_class);
-        }
+        checkUpdateQty(pi_id,pi_class);
 
         baseDTO = getBaseDTOById(pi_id,pi_class,pi_inoutno);
         //计算金额,未税单价,未税金额等
@@ -390,10 +387,10 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         }
     }
 
-    private void checkUpdateQty(String pu_code, String pi_class) {
+    private void checkUpdateQty(Long id, String pi_class) {
         int count = 0;
         if ("采购验退单".equals(pi_class)) {
-            count = getMapper().checkQtyFromProdIn(pu_code);
+            count = getMapper().checkQtyFromProdIn(id);
             if (count>0){
                 throw new BizException(BizExceptionCode.PURCHASE_DETAIL_OVERNUM);
             }

+ 2 - 2
applications/purchase/purchase-server/src/main/resources/mapper/ProdInOutMapper.xml

@@ -432,9 +432,9 @@
   GROUP BY pd_orderid) t  where t.nowqty>t.totalqty
   </select>
 
-  <select id="checkQtyFromProdIn" resultType="int" parameterType="string">
+  <select id="checkQtyFromProdIn" resultType="int" parameterType="long">
   select count(1) from(
-  select sum(b.pd_outqty) nowqty,(select a.pd_inqty from prodiodetail a where a.pd_id = b.pd_ioid and a.pd_piclass='采购验收单') totalqty from prodiodetail b where b.pd_ordercode=#{pu_code} and b.pd_piclass='采购验退单'
+  select sum(b.pd_outqty) nowqty,(select a.pd_inqty from prodiodetail a where a.pd_id = b.pd_ioid and a.pd_piclass='采购验收单') totalqty from prodiodetail b where b.pd_piid = #{id} and b.pd_piclass='采购验退单'
   GROUP BY b.pd_ioid) t where t.nowqty>t.totalqty
   </select>