Bläddra i källkod

修改采购反审核限制

zhoudw 7 år sedan
förälder
incheckning
4f9f1015ec

+ 2 - 0
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java

@@ -38,6 +38,8 @@ public enum BizExceptionCode implements BaseExceptionCode {
 
 
     //采购 70000-71999
     //采购 70000-71999
     PURCCHECKIN_POST_ERROR(70000,""),
     PURCCHECKIN_POST_ERROR(70000,""),
+    PURCHASE_UNAUDIT_ERROR(72006,"采购订单已转采购验收单,无法反审核"),
+
 
 
     //销售
     //销售
     SALE_ALL_TURNOUT(72000, "该销售单已全部转出货,无法转出货单"),
     SALE_ALL_TURNOUT(72000, "该销售单已全部转出货,无法转出货单"),

+ 2 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchaseMapper.java

@@ -26,4 +26,6 @@ public interface PurchaseMapper extends CommonBaseMapper<Purchase>{
                                    @Param("companyId") Long companyId);
                                    @Param("companyId") Long companyId);
 
 
     String selectCodeById(Long id);
     String selectCodeById(Long id);
+
+    Integer checkTurnInstatus(Long id);
 }
 }

+ 5 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java

@@ -498,6 +498,11 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
     @Transactional
     @Transactional
     private void singleUnAudit(Long id) {
     private void singleUnAudit(Long id) {
         Purchase purchase = new Purchase();
         Purchase purchase = new Purchase();
+        //检查是否已转验收单
+        Integer num = getMapper().checkTurnInstatus(id);
+        if (num > 0) {
+            throw new BizException(BizExceptionCode.PURCHASE_UNAUDIT_ERROR);
+        }
         //生成更新对象
         //生成更新对象
         purchase.setId(id);
         purchase.setId(id);
         purchase.setPu_status(Status.UNAUDITED.getDisplay());
         purchase.setPu_status(Status.UNAUDITED.getDisplay());

+ 5 - 0
applications/purchase/purchase-server/src/main/resources/mapper/PurchaseMapper.xml

@@ -422,4 +422,9 @@
   <select id="selectCodeById" resultType="string" parameterType="long">
   <select id="selectCodeById" resultType="string" parameterType="long">
     select pu_code from purchase where pu_id=#{id}
     select pu_code from purchase where pu_id=#{id}
   </select>
   </select>
+
+  <select id="checkTurnInstatus" resultType="int" >
+    select count(1) from purchasedetail where PD_PUID=#{id} and PD_YQTY !=0;
+</select>
+
 </mapper>
 </mapper>