Browse Source

Merge branch 'dev' of ssh://10.10.100.21/source/saas-platform into dev

hy 6 years ago
parent
commit
0d7ea91433

+ 10 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/controller/SubledgerController.java

@@ -1,8 +1,10 @@
 package com.usoftchina.saas.money.controller;
 package com.usoftchina.saas.money.controller;
 
 
+import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.money.mapper.SubledgerMapper;
 import com.usoftchina.saas.money.mapper.SubledgerMapper;
+import com.usoftchina.saas.money.po.VerificationList;
 import com.usoftchina.saas.money.service.SubledgerService;
 import com.usoftchina.saas.money.service.SubledgerService;
 import com.usoftchina.saas.page.PageRequest;
 import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,4 +26,12 @@ public class SubledgerController {
     public Result getListData(PageRequest page, ListReqDTO condition){
     public Result getListData(PageRequest page, ListReqDTO condition){
         return Result.success(subledgerService.seleteList(page, condition));
         return Result.success(subledgerService.seleteList(page, condition));
     }
     }
+
+    /**
+     * 核销单明细1放大镜特殊处理--应收转应收、应付转应付
+     */
+    @RequestMapping("/dbfindlist")
+    public Result getDbfindlistData(PageRequest page, ListReqDTO condition) {
+        return Result.success(subledgerService.getDbfindlistData(page, condition));
+    }
 }
 }

+ 2 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/SubledgerMapper.java

@@ -32,4 +32,6 @@ public interface SubledgerMapper {
 
 
     void updateProdInOut(@Param("companyid") Long companyid , @Param("code") String code , @Param("kind") String kind ,
     void updateProdInOut(@Param("companyid") Long companyid , @Param("code") String code , @Param("kind") String kind ,
                          @Param("status") String status , @Param("statuscode") String statuscode);
                          @Param("status") String status , @Param("statuscode") String statuscode);
+
+    List<Subledger>  selectSubledgerSpeBycondition(@Param("con") String con, @Param("companyId") Long companyId);
 }
 }

+ 1 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/SubledgerService.java

@@ -11,4 +11,5 @@ import com.usoftchina.saas.page.PageRequest;
  **/
  **/
 public interface SubledgerService {
 public interface SubledgerService {
     PageInfo<Subledger> seleteList(PageRequest page, ListReqDTO reqDTO);
     PageInfo<Subledger> seleteList(PageRequest page, ListReqDTO reqDTO);
+    PageInfo<Subledger> getDbfindlistData(PageRequest page, ListReqDTO reqDTO);
 }
 }

+ 24 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/SubledgerServiceImpl.java

@@ -52,4 +52,28 @@ public class SubledgerServiceImpl implements SubledgerService {
         subledgerList = subledgerMapper.selectSubledgerBycondition(con, companyId);
         subledgerList = subledgerMapper.selectSubledgerBycondition(con, companyId);
         return subledgerList;
         return subledgerList;
     }
     }
+
+    @Override
+    public PageInfo<Subledger> getDbfindlistData(PageRequest page, ListReqDTO reqDTO) {
+        //设置默认分页
+        if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
+            page = new PageRequest();
+            page.setNumber(1);
+            page.setSize(10);
+        }
+        PageHelper.startPage(page.getNumber(), page.getSize());
+        List<Subledger> subledgerList = null;
+        Long companyId = BaseContextHolder.getCompanyId();
+        if (StringUtils.isEmpty(reqDTO)) {
+            return  null;
+        }
+        String con = reqDTO.getFinalCondition();
+        if (null == con) {
+            con = "1=1";
+        }
+        subledgerList = subledgerMapper.selectSubledgerSpeBycondition(con, companyId);
+        //取分页信息
+        PageInfo<Subledger> pageInfo = new PageInfo<Subledger>(subledgerList);
+        return pageInfo;
+    }
 }
 }

+ 43 - 27
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/VerificationServiceImpl.java

@@ -220,36 +220,47 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
 
 
         String type = main.getVc_kind();
         String type = main.getVc_kind();
         type = transferKind(type);
         type = transferKind(type);
+
+        for(Verificationdet det : items1){
+            //本次核销金额
+            Double nowbalanceDet = det.getVd_nowbalance()==null?new Double(0):det.getVd_nowbalance();
+            //单据金额
+            Double amount = det.getSl_namount();
+            //已核销金额
+            Double namount = det.getSl_namount()==null?new Double(0):det.getSl_namount();
+            //核销金额
+            if(amount.doubleValue()>0 && nowbalanceDet.doubleValue()<0){
+                String msg = BizExceptionCode.MONEY_NOWAMOUNT_POSITIVE.getMessage();
+                int code = BizExceptionCode.MONEY_NOWAMOUNT_POSITIVE.getCode();
+                String error = String.format(msg, det.getVd_slkind());
+                throw new BizException(code, error);
+            }
+            if(amount.doubleValue()<0 && nowbalanceDet.doubleValue()>0){
+                String msg = BizExceptionCode.MONEY_NOWAMOUNT_NEGATIVE.getMessage();
+                int code = BizExceptionCode.MONEY_NOWAMOUNT_NEGATIVE.getCode();
+                String error = String.format(msg, det.getVd_slkind());
+                throw new BizException(code, error);
+            }
+            Double nowbalance = det.getVd_nowbalance()==null?new Double(0):det.getVd_nowbalance();
+            if( Math.abs(namount.doubleValue()) <  Math.abs(nowbalanceDet.doubleValue()) ){
+                throw new BizException(500, BizExceptionCode.RECALANCE_OUTNOWBALANCE.getMessage());
+            }
+        }
         if(type.equals("receipts_offset_receivable") || type.equals("prepaid_offset_payable") ||
         if(type.equals("receipts_offset_receivable") || type.equals("prepaid_offset_payable") ||
-                type.equals("receivable_offset_payable")){
+                type.equals("receivable_offset_payable")){//预收冲应收、预付冲应付、应收冲应付
             Double total1 = new Double(0);
             Double total1 = new Double(0);
             for(Verificationdet det : items1){
             for(Verificationdet det : items1){
                 Double nowbalanceDet = det.getVd_nowbalance()==null?new Double(0):det.getVd_nowbalance();
                 Double nowbalanceDet = det.getVd_nowbalance()==null?new Double(0):det.getVd_nowbalance();
                 total1 += nowbalanceDet;
                 total1 += nowbalanceDet;
-
-                //单据金额
-                Double amount = det.getSl_namount();
-                //核销金额
-                if(amount.doubleValue()>0 && nowbalanceDet.doubleValue()<0){
-                    String msg = BizExceptionCode.MONEY_NOWAMOUNT_POSITIVE.getMessage();
-                    int code = BizExceptionCode.MONEY_NOWAMOUNT_POSITIVE.getCode();
-                    String error = String.format(msg, det.getVd_slkind());
-                    throw new BizException(code, error);
-                }
-                if(amount.doubleValue()<0 && nowbalanceDet.doubleValue()>0){
-                    String msg = BizExceptionCode.MONEY_NOWAMOUNT_NEGATIVE.getMessage();
-                    int code = BizExceptionCode.MONEY_NOWAMOUNT_NEGATIVE.getCode();
-                    String error = String.format(msg, det.getVd_slkind());
-                    throw new BizException(code, error);
-                }
             }
             }
             Double total2 = new Double(0);
             Double total2 = new Double(0);
             for(Verificationdetail detail : items2){
             for(Verificationdetail detail : items2){
                 Double nowbalanceDet = detail.getVcd_nowbalance()==null?new Double(0):detail.getVcd_nowbalance();
                 Double nowbalanceDet = detail.getVcd_nowbalance()==null?new Double(0):detail.getVcd_nowbalance();
                 total2 += nowbalanceDet;
                 total2 += nowbalanceDet;
-
                 //单据金额
                 //单据金额
                 Double amount = detail.getVcd_amount();
                 Double amount = detail.getVcd_amount();
+                //已核销金额
+                Double namount = detail.getSl_namount()==null?new Double(0):detail.getSl_namount();
                 //核销金额
                 //核销金额
                 if(amount.doubleValue()>0 && nowbalanceDet.doubleValue()<0){
                 if(amount.doubleValue()>0 && nowbalanceDet.doubleValue()<0){
                     String msg = BizExceptionCode.MONEY_NOWAMOUNT_POSITIVE.getMessage();
                     String msg = BizExceptionCode.MONEY_NOWAMOUNT_POSITIVE.getMessage();
@@ -263,20 +274,14 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
                     String error = String.format(msg, detail.getVcd_slkind());
                     String error = String.format(msg, detail.getVcd_slkind());
                     throw new BizException(code, error);
                     throw new BizException(code, error);
                 }
                 }
+                if( Math.abs(namount.doubleValue()) <  Math.abs(nowbalanceDet.doubleValue()) ){
+                    throw new BizException(500, BizExceptionCode.RECALANCE_OUTNOWBALANCE.getMessage());
+                }
             }
             }
             if(total1.doubleValue()!=total2.doubleValue()){
             if(total1.doubleValue()!=total2.doubleValue()){
                 throw new BizException(500, BizExceptionCode.VERIFICATION_CHECK_BALANCE.getMessage());
                 throw new BizException(500, BizExceptionCode.VERIFICATION_CHECK_BALANCE.getMessage());
             }
             }
-        }else if(type.equals("receivable_to_receivable") || type.equals("payable_to_payable")){
-            for(Verificationdet det : items1){
-                Double namount = det.getSl_namount()==null?new Double(0):det.getSl_namount();
-                Double nowbalance = det.getVd_nowbalance()==null?new Double(0):det.getVd_nowbalance();
-                if(namount.doubleValue()<nowbalance.doubleValue()){
-                    throw new BizException(500, BizExceptionCode.RECALANCE_OUTNOWBALANCE.getMessage());
-                }
-            }
         }
         }
-
     }
     }
 
 
     //插入中间表
     //插入中间表
@@ -598,6 +603,11 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
             if(items1!=null){
             if(items1!=null){
                 for(VerificationdetDTO det : items1){
                 for(VerificationdetDTO det : items1){
                     Double nowbalanceDet = det.getVd_nowbalance()==null?new Double(0):det.getVd_nowbalance();
                     Double nowbalanceDet = det.getVd_nowbalance()==null?new Double(0):det.getVd_nowbalance();
+                    Subledger sub = subledgerMapper.selectByPrimaryKey(Math.toIntExact(det.getVd_slid()));
+                    if (sub != null && sub.getSl_preamount() != 0 &&
+                            ("receivable_to_receivable".equals(verificationDTO.getVc_kind()) || "payable_to_payable".equals(verificationDTO.getVc_kind()))) {
+                        nowbalanceDet=-1*nowbalanceDet;
+                    }
                     updateAuditSubledeger(det.getVd_slid(),nowbalanceDet);
                     updateAuditSubledeger(det.getVd_slid(),nowbalanceDet);
                 }
                 }
             }
             }
@@ -887,6 +897,12 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
         List<Verificationdetail> items2 = verificationdetailMapper.selectByFK(id);
         List<Verificationdetail> items2 = verificationdetailMapper.selectByFK(id);
         for(Verificationdet det : items1){
         for(Verificationdet det : items1){
             Double nowbalanceDet = det.getVd_nowbalance()==null?new Double(0):det.getVd_nowbalance();
             Double nowbalanceDet = det.getVd_nowbalance()==null?new Double(0):det.getVd_nowbalance();
+            Subledger sub = subledgerMapper.selectByPrimaryKey(Math.toIntExact(det.getVd_slid()));
+            if (sub != null && sub.getSl_preamount() != 0 &&
+                    ("receivable_to_receivable".equals(verificationDTO.getVc_kind()) || "payable_to_payable".equals(verificationDTO.getVc_kind())
+                    || "应收转应收".equals(verificationDTO.getVc_kind()) || "应付转应付".equals(verificationDTO.getVc_kind()))) {
+                nowbalanceDet=-1*nowbalanceDet;
+            }
             updateResAuditSubledeger(det.getVd_slid(),nowbalanceDet);
             updateResAuditSubledeger(det.getVd_slid(),nowbalanceDet);
         }
         }
         for(Verificationdetail detail : items2){
         for(Verificationdetail detail : items2){

+ 17 - 0
applications/money/money-server/src/main/resources/mapper/SubledgerMapper.xml

@@ -275,4 +275,21 @@
     update prodinout set pi_prstatuscode=#{statuscode},pi_prstatus=#{status} where
     update prodinout set pi_prstatuscode=#{statuscode},pi_prstatus=#{status} where
     companyid=#{companyid} and pi_class=#{kind} and pi_inoutno=#{code}
     companyid=#{companyid} and pi_class=#{kind} and pi_inoutno=#{code}
   </update>
   </update>
+
+  <select id="selectSubledgerSpeBycondition" resultMap="BaseResultMap">
+    select sl_id,sl_kind,sl_code,sl_custid,sl_vendid,sl_date,
+    (case when ifnull(sl_preamount,0)!=0 then ifnull(sl_orderamount,0)*(-1)  else sl_orderamount end ) as sl_orderamount,
+    (case when ifnull(sl_preamount,0)!=0 then ifnull(sl_yamount,0)*(-1)  else sl_yamount end ) as sl_yamount,
+    (case when ifnull(sl_preamount,0)!=0 then ifnull(sl_namount,0)*(-1)  else sl_namount end ) as sl_namount,
+    sl_remark,companyid,sl_ym,sl_currency
+    from subledger
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and   subledger.companyId = #{companyId}
+      </if>
+    </where>  order by sl_date desc
+  </select>
 </mapper>
 </mapper>

+ 3 - 2
applications/money/money-server/src/main/resources/mapper/VerificationdetMapper.xml

@@ -481,8 +481,9 @@
   <select id="selectByFK" parameterType="long" resultMap="BaseResultMap">
   <select id="selectByFK" parameterType="long" resultMap="BaseResultMap">
     select
     select
     <include refid="Base_Column_List" />,
     <include refid="Base_Column_List" />,
-    <include refid="subledger_Column_List" />
-    from verificationdet left join subledger on sl_id=vd_slid and subledger.companyid=verificationdet.companyId
+    (case when vc_kind in ('应收转应收','应付转应付') and ifnull(sl_preamount,0)!=0 then sl_yamount*(-1) else sl_yamount end) as sl_yamount,
+    (case when vc_kind in ('应收转应收','应付转应付') and ifnull(sl_preamount,0)!=0 then sl_namount*(-1) else sl_namount end) as sl_namount
+    from verificationdet left join subledger on sl_id=vd_slid and subledger.companyid=verificationdet.companyId left join verification on verificationdet.vd_vcid=vc_id
       where vd_vcid=#{vc_id} order by vd_id
       where vd_vcid=#{vc_id} order by vd_id
   </select>
   </select>
 
 

+ 2 - 0
frontend/saas-web/app/view/money/payBalance/FormPanel.js

@@ -601,6 +601,8 @@ Ext.define('saas.view.money.payBalance.FormPanel', {
 
 
         var flag = sum_pd_amount + pb_discounts - sum_pbd_nowbalance;
         var flag = sum_pd_amount + pb_discounts - sum_pbd_nowbalance;
         viewModel.set("pb_preamount", flag);
         viewModel.set("pb_preamount", flag);
+        viewModel.set("pb_pbdamount",sum_pbd_nowbalance);
+        viewModel.set("pb_pdamount",sum_pd_amount);
         if (flag != 0) {
         if (flag != 0) {
             var t = flag > 0 ? '大' : '小';
             var t = flag > 0 ? '大' : '小';
 
 

+ 3 - 0
frontend/saas-web/app/view/money/recBalance/FormPanel.js

@@ -607,6 +607,9 @@ Ext.define('saas.view.money.recBalance.FormPanel', {
         var flag = sum_rd_amount + rb_discounts - sum_rbd_nowbalance;
         var flag = sum_rd_amount + rb_discounts - sum_rbd_nowbalance;
 
 
         viewModel.set("rb_preamount", flag);
         viewModel.set("rb_preamount", flag);
+        viewModel.set("rb_rbdamount",sum_rbd_nowbalance);
+        viewModel.set("rb_rdamount",sum_rd_amount);
+        viewModel.set("rb_preamount",sum_rd_amount-sum_rbd_nowbalance);
         if (flag != 0) {
         if (flag != 0) {
             var t = flag > 0 ? '大' : '小';
             var t = flag > 0 ? '大' : '小';
 
 

+ 2 - 2
frontend/saas-web/app/view/money/verification/FormPanel.js

@@ -951,11 +951,11 @@ Ext.define('saas.view.money.verification.FormPanel', {
                         ' and sl_ym<=DATE_FORMAT(str_to_date(\'{vc_date}\', \'%Y-%m-%d\'),\'%Y%m\')' +
                         ' and sl_ym<=DATE_FORMAT(str_to_date(\'{vc_date}\', \'%Y-%m-%d\'),\'%Y%m\')' +
                         ' and sl_kind in (\'采购验收单\',\'采购验退单\',\'期初余额\')'
                         ' and sl_kind in (\'采购验收单\',\'采购验退单\',\'期初余额\')'
                     ],
                     ],
-                    receivable_to_receivable: ['ifnull(sl_currency,\'RMB\') = \'{vc_currency}\' and ifnull(sl_custid,0)={vc_custid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0 ' +
+                    receivable_to_receivable: ['ifnull(sl_currency,\'RMB\') = \'{vc_currency}\' and ifnull(sl_custid,0)={vc_custid} and ifnull(sl_namount,0)<>0 ' +
                         ' and sl_ym<=DATE_FORMAT(str_to_date(\'{vc_date}\', \'%Y-%m-%d\'),\'%Y%m\')' +
                         ' and sl_ym<=DATE_FORMAT(str_to_date(\'{vc_date}\', \'%Y-%m-%d\'),\'%Y%m\')' +
                         ' and sl_kind in (\'出货单\',\'销售退货单\',\'期初余额\')'
                         ' and sl_kind in (\'出货单\',\'销售退货单\',\'期初余额\')'
                     ],
                     ],
-                    payable_to_payable: ['ifnull(sl_currency,\'RMB\') = \'{vc_currency}\' and ifnull(sl_vendid,0)={vc_vendid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0' +
+                    payable_to_payable: ['ifnull(sl_currency,\'RMB\') = \'{vc_currency}\' and ifnull(sl_vendid,0)={vc_vendid} and ifnull(sl_namount,0)<>0' +
                         ' and sl_ym<=DATE_FORMAT(str_to_date(\'{vc_date}\', \'%Y-%m-%d\'),\'%Y%m\')' +
                         ' and sl_ym<=DATE_FORMAT(str_to_date(\'{vc_date}\', \'%Y-%m-%d\'),\'%Y%m\')' +
                         ' and sl_kind in (\'采购验收单\',\'采购验退单\',\'期初余额\')'
                         ' and sl_kind in (\'采购验收单\',\'采购验退单\',\'期初余额\')'
                     ]
                     ]

+ 14 - 0
frontend/saas-web/app/view/money/verification/FormPanelController.js

@@ -119,6 +119,13 @@ Ext.define('saas.view.money.verification.FormPanelController', {
                 },
                 },
                 beforequery: function(f) {
                 beforequery: function(f) {
                     var defaultCondition = this.getDefaultCondition(0);
                     var defaultCondition = this.getDefaultCondition(0);
+                    var form = me.getView(),
+                        viewModel = me.getViewModel();
+                    var kind=viewModel.get('vc_kind');
+                    console.log(kind);
+                    if (kind == 'receivable_to_receivable' || kind == 'payable_to_payable'){
+                        f.dataUrl='/api/money/subledger/dbfindlist';
+                    }
                     if(!defaultCondition) {
                     if(!defaultCondition) {
                         return false;
                         return false;
                     }
                     }
@@ -127,7 +134,14 @@ Ext.define('saas.view.money.verification.FormPanelController', {
                     });
                     });
                 },
                 },
                 beforetriggerclick: function(f) {
                 beforetriggerclick: function(f) {
+                    console.log('beforetriggerclick');
                     var defaultCondition = this.getDefaultCondition(0);
                     var defaultCondition = this.getDefaultCondition(0);
+                    var form = me.getView(),
+                        viewModel = me.getViewModel();
+                    var kind=viewModel.get('vc_kind');
+                    if (kind == 'receivable_to_receivable' || kind == 'payable_to_payable'){
+                        f.dataUrl='/api/money/subledger/dbfindlist';
+                    }
                     if(!defaultCondition) {
                     if(!defaultCondition) {
                         return false;
                         return false;
                     }
                     }