Browse Source

BUG处理

guq 7 years ago
parent
commit
a8095ca2ad

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

@@ -75,6 +75,8 @@ public enum BizExceptionCode implements BaseExceptionCode {
     SALEOUT_UNAUDIT_ERROR(72006,"销售订单已转出货单,无法反审核"),
     SALE_ORDER_HASAUDIT(72003, "存在已审核单据,单据编号:%s"),
     SALE_EXISTS_PURCHASE(72004, "存在已转的采购单据,单据编号:%s"),
+    SALE_ALREADY_UNAUDIT(72007, "单据状态为未审核,无法反审核"),
+    SALE_CUST_CLOSE(72008, "客户已关闭,无法审核"),
 
     //资金
     PAYBALANCE_OUTNOWBALANCE(74001,"本次核销金额不能大于未核销金额"),

+ 4 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaleMapper.java

@@ -52,4 +52,8 @@ public interface SaleMapper extends CommonBaseMapper<Sale> {
     Integer selectPurchaseId(@Param("code") String code,@Param("companyid") Long companyid);
 
     String checkIsTurnPurchase(@Param("id") Long id,@Param("companyid") Long companyid);
+
+    Integer checkCustomer(Long id);
+
+    String validateCustAudit(List<DocBaseDTO> baseDTOs);
 }

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

@@ -247,6 +247,10 @@ public class SaleServiceImpl implements SaleService{
         sale.setSa_auditdate(new Date());
         //更新存在字段
         saleMapper.updateByPrimaryKeySelective(sale);*/
+        Integer integer = saleMapper.checkCustomer(id);
+        if (integer > 0) {
+            throw new BizException(BizExceptionCode.SALE_CUST_CLOSE);
+        }
         commonService.commonAudit("sale", "sa_id=" + id, "sa_status",
                 "sa_statuscode", "sa_auditdate", "sa_auditman");
         //更新销售金额
@@ -273,6 +277,10 @@ public class SaleServiceImpl implements SaleService{
             int code = BizExceptionCode.SALE_ORDER_HASAUDIT.getCode();
             throw new BizException(code, String.format(message, validate));
         }
+        String custAudit = saleMapper.validateCustAudit(baseDTOs.getBaseDTOs());
+        if (!StringUtils.isEmpty(custAudit)) {
+            throw new BizException(72009, "客户已关闭,无法审核, 单号:" + custAudit);
+        }
         for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
             singleAudit(base.getId());
         }
@@ -285,7 +293,7 @@ public class SaleServiceImpl implements SaleService{
         }
         String code = saleMapper.validateUnAudit(id);
         if (null != code) {
-            throw new BizException(BizExceptionCode.SALE_NULL_BILL);
+            throw new BizException(BizExceptionCode.SALE_ALREADY_UNAUDIT);
         }
         //检测出货状态为未出货
         Integer num = saleMapper.checkSendStatus(id);

+ 10 - 1
applications/sale/sale-server/src/main/resources/mapper/SaleMapper.xml

@@ -356,6 +356,13 @@
       #{item.id}
     </foreach>
   </select>
+
+  <select id="validateCustAudit" parameterType="com.usoftchina.saas.commons.dto.DocBaseDTO" resultType="java.lang.String">
+    select GROUP_CONCAT(sa_code) from sale left join customer on cu_id=sa_custid  where sa_statuscode='AUDITED' and sa_id in
+    <foreach collection="list" item="item" open="(" close=")" separator=",">
+      #{item.id}
+    </foreach>
+  </select>
   <select id="validateBatchUnAudit" parameterType="com.usoftchina.saas.commons.dto.DocBaseDTO" resultType="java.lang.String">
     select GROUP_CONCAT(sa_code) from sale where sa_statuscode='UNAUDITED' and sa_id in
     <foreach collection="list" item="item" open="(" close=")" separator=",">
@@ -394,7 +401,9 @@
     where pd_saleid = #{id}
     and purchasedetail.companyid= #{companyid}
   </select>
-  
+  <select id="checkCustomer" parameterType="long" resultType="integer">
+    select count(1) from sale left join  customer on sa_custid=cu_id  where  cu_statuscode='CLOSE' and cu_statuscode='CLOSE'
+  </select>
   
   <!-- 销售订单转采购单-->
   <insert id="turnPurchase" parameterType="com.usoftchina.saas.sale.dto.PurchaseDTO" >

+ 6 - 2
frontend/saas-web/app/view/sale/saleOut/QueryPanel.js

@@ -152,9 +152,13 @@ Ext.define('saas.view.sale.saleout.QueryPanel', {
             width: 90
         }, {
             text: '明细序号',
-            dataIndex: 'pd_detno',
+            dataIndex: 'pd_pdno',
             xtype: 'numbercolumn',
-            width: 100
+            width: 100,
+            renderer : function(v) {
+                var format = '0'
+                return Ext.util.Format.number(v, format);
+            }
         }, {
             text: '关联销售单号',
             dataIndex: 'pd_ordercode',