Browse Source

销售出货转退货优化

rainco 7 years ago
parent
commit
068d8f4a1f

+ 2 - 2
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/ProdInOutService.java

@@ -70,7 +70,7 @@ public interface ProdInOutService extends CommonBaseService<ProdInOutMapper, Pro
 
     void batchUnAudit(BatchDealBaseDTO baseDTOs);
 
-    void close(long id);
+    void open(Long id);
 
-    void open(Long id)
+    void close(Long id);
 }

+ 16 - 9
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/ProdInOutServiceImpl.java

@@ -439,11 +439,20 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         return Result.success();
 
     }
+
     @Override
     @Transactional
-    public void close(long id) {
-        ProdInOut prodInOut = new ProdInOut();
-        prodInOut.setId(id);
+    public void close(Long id) {
+        if(id == null || id <= 0) {
+            throw new BizException(BizExceptionCode.ILLEGAL_ID);
+        }
+        ProdInOut prodInOut =  prodInOutMapper.selectByPrimaryKey(id);
+        if(prodInOut==null){
+            throw new BizException(BizExceptionCode.NO_DATA);
+        }
+        if(Status.CLOSE.name().equals(prodInOut.getPi_status())){
+            throw new BizException(BizExceptionCode.BIZ_CLOSE);
+        }
         prodInOut.setPi_status(Status.CLOSE.getDisplay());
         prodInOut.setPi_statuscode(Status.CLOSE.name());
 
@@ -452,16 +461,14 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         //日志
         messageLogService.close(docBaseDTO);
     }
-   public void batchClose(BatchDealBaseDTO baseDTOs){
-       if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
-               baseDTOs.getBaseDTOs().size() == 0) {
-           return;
-       }
-   }
+
     @Override
     @Transactional
     public void open(Long id){
         ProdInOut prodInOut = prodInOutMapper.selectByPrimaryKey(id);
+        if(prodInOut==null){
+            throw new BizException(BizExceptionCode.NO_DATA);
+        }
         List<ProdIODetail> prodIODetailList = prodIODetailMapper.selectByFK(id);
         //部分入库、全部入库
         int partTurnCount = 0,turnCount = 0;