Browse Source

Merge remote-tracking branch 'origin/dev' into dev

heqinwei 7 years ago
parent
commit
eb18a4360e
18 changed files with 415 additions and 92 deletions
  1. 2 0
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java
  2. 2 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseDetail.java
  3. 2 0
      applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/PurchaseDetailDTO.java
  4. 2 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaleMapper.java
  5. 33 22
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java
  6. 10 4
      applications/sale/sale-server/src/main/resources/mapper/SaleMapper.xml
  7. 1 1
      base-servers/account/account-server/src/main/resources/mapper/AccountMapper.xml
  8. 2 1
      frontend/saas-web/app/util/FormUtil.js
  9. 6 1
      frontend/saas-web/app/view/core/dbfind/MultiDbfindTrigger.js
  10. 3 0
      frontend/saas-web/app/view/core/dbfind/types/BankInfoDbfindTrigger.js
  11. 1 1
      frontend/saas-web/app/view/core/dbfind/types/BomDbfindTrigger.js
  12. 5 3
      frontend/saas-web/app/view/core/dbfind/types/OriOrderMutiDbfindTrigger.js
  13. 26 0
      frontend/saas-web/app/view/core/form/field/ConDateField.scss
  14. 3 1
      frontend/saas-web/app/view/core/form/field/DetailGridField.js
  15. 53 24
      frontend/saas-web/app/view/money/verification/FormPanel.js
  16. 171 0
      frontend/saas-web/app/view/money/verification/FormPanelController.js
  17. 88 34
      frontend/saas-web/app/view/money/verification/QueryPanel.js
  18. 5 0
      frontend/saas-web/resources/json/navigation.json

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

@@ -70,6 +70,7 @@ public enum BizExceptionCode implements BaseExceptionCode {
     SALEOUT_POST_ERROR(72005,""),
     SALEOUT_UNAUDIT_ERROR(72006,"销售订单已转出货单,无法反审核"),
     SALE_ORDER_HASAUDIT(72003, "存在已审核单据,单据编号:%s"),
+    SALE_EXISTS_PURCHASE(72004, "存在已转的采购单据,单据编号:%s"),
 
     //资金
     PAYBALANCE_OUTNOWBALANCE(74001,"本次核销金额不能大于未核销金额"),
@@ -80,6 +81,7 @@ public enum BizExceptionCode implements BaseExceptionCode {
     BEFORE_UNAUDIT(74006, "单据:<u>%s</u>未审核,无法反审核"),
     BANK_AMOUNT_NOTENOUGH(74004, "资金账号不足"),
     SUBLEDGER_NOT_EXIS(74005,"来源单据不存在"),
+    CHECK_SETACOUNT_EXIS(74006, "不能删除单据日期小于等于结账期间<u>%s</u>的单据"),
 
 
 

+ 2 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseDetail.java

@@ -42,6 +42,8 @@ public class PurchaseDetail extends CommonBaseEntity implements Serializable {
 
     private Integer pd_saledetno;
 
+    private Long pd_saleid;
+
     private Integer pd_sdid;
 
     private String pd_text1;

+ 2 - 0
applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/PurchaseDetailDTO.java

@@ -42,6 +42,8 @@ public class PurchaseDetailDTO extends CommonBaseEntity implements Serializable
 
     private Integer pd_saledetno;
 
+    private Long pd_saleid;
+
     private Integer pd_sdid;
 
     private String pd_text1;

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

@@ -50,4 +50,6 @@ public interface SaleMapper extends CommonBaseMapper<Sale> {
     void turnPurchaseDetail(List<PurchaseDetailDTO> list);
 
     Integer selectPurchaseId(@Param("code") String code,@Param("companyid") Long companyid);
+
+    String checkIsTurnPurchase(@Param("id") Long id,@Param("companyid") Long companyid);
 }

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

@@ -29,6 +29,7 @@ import com.usoftchina.saas.sale.service.SaleService;
 import com.usoftchina.saas.storage.po.ProdIODetail;
 import com.usoftchina.saas.storage.po.ProdInOut;
 import com.usoftchina.saas.utils.BeanMapper;
+import io.swagger.models.auth.In;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -285,6 +286,12 @@ public class SaleServiceImpl implements SaleService{
         if (num > 0) {
             throw new BizException(BizExceptionCode.SALEOUT_UNAUDIT_ERROR);
         }
+        //检查是否转采购订单
+        String purchaseCode = saleMapper.checkIsTurnPurchase(id,BaseContextHolder.getCompanyId());
+        if (purchaseCode != null && purchaseCode.length()>0){
+            throw new BizException(BizExceptionCode.SALE_EXISTS_PURCHASE.getCode(),
+                    String.format(BizExceptionCode.SALE_EXISTS_PURCHASE.getMessage(),purchaseCode));
+        }
         singleUnAudit(id);
     }
 
@@ -534,6 +541,13 @@ public class SaleServiceImpl implements SaleService{
         Sale sale = saleMapper.selectByPrimaryKey(id);
         List<SaleList> dateilList = saleListMapper.selectSaleListByCondition("sa_id="+id,BaseContextHolder.getCompanyId());
 
+        //判断是否已转采购单
+        String purchaseCode = saleMapper.checkIsTurnPurchase(id,BaseContextHolder.getCompanyId());
+        if (purchaseCode != null && purchaseCode.length()>0){
+            throw new BizException(BizExceptionCode.SALE_EXISTS_PURCHASE.getCode(),
+                    String.format(BizExceptionCode.SALE_EXISTS_PURCHASE.getMessage(),purchaseCode));
+        }
+
         PurchaseDTO purchase = new PurchaseDTO();
         List<PurchaseDetailDTO> listPurchaseDetail = new ArrayList<PurchaseDetailDTO>();
 
@@ -550,33 +564,30 @@ public class SaleServiceImpl implements SaleService{
 
         Long purchaseId = purchase.getId();
         for (SaleList detail : dateilList){
-            PurchaseDetailDTO purchaseDetailDTO = new PurchaseDetailDTO();
+            PurchaseDetailDTO purchaseDetail = new PurchaseDetailDTO();
             Double taxPrice = detail.getPr_purcprice()==null?new Double(0):Double.valueOf(detail.getPr_purcprice());
             Double taxrate = detail.getSd_taxrate()==null?new Double(0):detail.getSd_taxrate();
             Double qty = detail.getSd_qty()==null?new Double(0):detail.getSd_qty();
-            purchaseDetailDTO.setPd_prodid(Long.valueOf(String.valueOf(detail.getSd_prodid())));
-            purchaseDetailDTO.setPd_prodcode(detail.getSd_prodcode());
-            purchaseDetailDTO.setPd_detno(detail.getSd_detno());
-            purchaseDetailDTO.setPd_qty(detail.getSd_qty());
-            purchaseDetailDTO.setPd_price(taxPrice/(1+taxrate));
-            purchaseDetailDTO.setPd_salecode(sale.getSa_code());
-            purchaseDetailDTO.setPd_saledetno(detail.getSd_detno());
-            purchaseDetailDTO.setPd_taxrate(taxrate);
-            purchaseDetailDTO.setPd_taxprice(taxPrice);
-            purchaseDetailDTO.setPd_taxtotal(taxPrice*qty);
-            purchaseDetailDTO.setCompanyId(BaseContextHolder.getCompanyId());
-            purchaseDetailDTO.setCreatorId(BaseContextHolder.getUserId());
-            purchaseDetailDTO.setCreateTime(new Date());
-            purchaseDetailDTO.setCreatorName(BaseContextHolder.getUserName());
-            purchaseDetailDTO.setPd_puid(purchaseId);
-            purchaseDetailDTO.setPd_code(result.getData());
-            listPurchaseDetail.add(purchaseDetailDTO);
+            purchaseDetail.setPd_prodid(Long.valueOf(String.valueOf(detail.getSd_prodid())));
+            purchaseDetail.setPd_prodcode(detail.getSd_prodcode());
+            purchaseDetail.setPd_detno(detail.getSd_detno());
+            purchaseDetail.setPd_qty(detail.getSd_qty());
+            purchaseDetail.setPd_price(taxPrice/(1+taxrate));
+            purchaseDetail.setPd_salecode(sale.getSa_code());
+            purchaseDetail.setPd_saledetno(detail.getSd_detno());
+            purchaseDetail.setPd_saleid(sale.getId());
+            purchaseDetail.setPd_taxrate(taxrate);
+            purchaseDetail.setPd_taxprice(taxPrice);
+            purchaseDetail.setPd_taxtotal(taxPrice*qty);
+            purchaseDetail.setCompanyId(BaseContextHolder.getCompanyId());
+            purchaseDetail.setCreatorId(BaseContextHolder.getUserId());
+            purchaseDetail.setCreateTime(new Date());
+            purchaseDetail.setCreatorName(BaseContextHolder.getUserName());
+            purchaseDetail.setPd_puid(purchaseId);
+            purchaseDetail.setPd_code(result.getData());
+            listPurchaseDetail.add(purchaseDetail);
         }
-
         saleMapper.turnPurchaseDetail(listPurchaseDetail);
-
-
-
         DocBaseDTO baseDTO = new DocBaseDTO();
         baseDTO.setCode(result.getData());
         baseDTO.setId(Long.valueOf(String.valueOf(purchaseId)));

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

@@ -421,11 +421,17 @@
   <update id="updateCreator">
     update sale set creatorId = #{userId} , creatorName=#{userName} where sa_id=#{id}
   </update>
-  
+
+  <select id="checkIsTurnPurchase"  resultType="java.lang.String">
+    select distinct pu_code from purchasedetail left join purchase on pd_puid=pu_id and
+    purchasedetail.companyid = purchase.companyid
+    where pd_saleid = #{id}
+    and purchasedetail.companyid= #{companyid}
+  </select>
   
   
   <!-- 销售订单转采购单-->
-  <insert id="turnPurchase" parameterType="com.usoftchina.saas.sale.dto.PurchaseDTO" >
+  <insert id="turnPurchase" parameterType="com.usoftchina.saas.purchase.po.Purchase" >
     <selectKey resultType="java.lang.Long" keyProperty="id">
       SELECT LAST_INSERT_ID() AS ID
     </selectKey>
@@ -633,7 +639,7 @@
     PD_DETNO, PD_PRODID, PD_PRODCODE,
     PD_UNIT, PD_QTY, PD_PRICE,PD_TAXPRICE,
     PD_TOTAL,PD_TAXRATE, PD_TAXTOTAL, PD_ACCEPTQTY,
-    PD_DELIVERY, PD_SALECODE, PD_SALEDETNO,
+    PD_DELIVERY, PD_SALECODE, PD_SALEDETNO,PD_SALEID,
     PD_SDID, companyId, updaterId,
     updateTime, pd_text1, pd_text2,
     pd_text3, pd_text4, pd_text5,
@@ -645,7 +651,7 @@
       #{item.pd_detno,jdbcType=INTEGER}, #{item.pd_prodid,jdbcType=INTEGER}, #{item.pd_prodcode,jdbcType=VARCHAR},
       #{item.pd_unit,jdbcType=VARCHAR}, #{item.pd_qty,jdbcType=DOUBLE}, #{item.pd_price,jdbcType=DOUBLE},#{item.pd_taxprice,jdbcType=DOUBLE},
       #{item.pd_total,jdbcType=DOUBLE},#{item.pd_taxrate,jdbcType=DOUBLE}, #{item.pd_taxtotal,jdbcType=DOUBLE}, #{item.pd_acceptqty,jdbcType=DOUBLE},
-      #{item.pd_delivery,jdbcType=DOUBLE}, #{item.pd_salecode,jdbcType=VARCHAR}, #{item.pd_saledetno,jdbcType=INTEGER},
+      #{item.pd_delivery,jdbcType=DOUBLE}, #{item.pd_salecode,jdbcType=VARCHAR}, #{item.pd_saledetno,jdbcType=INTEGER},#{item.pd_saleid,jdbcType=INTEGER},
       #{item.pd_sdid,jdbcType=INTEGER}, #{item.companyId,jdbcType=INTEGER}, #{item.updaterId,jdbcType=INTEGER},
       #{item.updateTime,jdbcType=TIMESTAMP}, #{item.pd_text1,jdbcType=VARCHAR}, #{item.pd_text2,jdbcType=VARCHAR},
       #{item.pd_text3,jdbcType=VARCHAR}, #{item.pd_text4,jdbcType=VARCHAR}, #{item.pd_text5,jdbcType=VARCHAR},

+ 1 - 1
base-servers/account/account-server/src/main/resources/mapper/AccountMapper.xml

@@ -172,7 +172,7 @@
                 updater_id=#{updaterId,jdbcType=BIGINT},
             </if>
             <if test="updateTime != null">
-                update_time=#{updateTime,jdbcType=TIMESTAMP})
+                update_time=#{updateTime,jdbcType=TIMESTAMP}
             </if>
         </set>
         where id=#{id,jdbcType=BIGINT}

+ 2 - 1
frontend/saas-web/app/util/FormUtil.js

@@ -254,8 +254,9 @@ Ext.define('saas.util.FormUtil', {
                                 var detno = 0;
                                 var detnoColumn = grid.detnoColumn;
                                 var datas = [];
+                                var emptyRows = grid.emptyRows;
                                 
-                                Ext.Array.each(new Array(5), function() {
+                                Ext.Array.each(new Array(emptyRows), function() {
                                     detno += 1;
                                     var data = {};
                                     data[detnoColumn] = detno;

+ 6 - 1
frontend/saas-web/app/view/core/dbfind/MultiDbfindTrigger.js

@@ -26,6 +26,9 @@ Ext.define('saas.view.core.dbfind.MultiDbfindTrigger', {
     },
     //输入值之后进行模糊查询
     doQuery: function(queryString, forceAll, rawQuery) {
+        if(!this.fireEvent('beforequery', this)) {
+            return;
+        };
     	queryString = queryString || '';
     	var me = this;
     	if(me.lastQueryValue!=queryString){
@@ -129,7 +132,9 @@ Ext.define('saas.view.core.dbfind.MultiDbfindTrigger', {
     	}
     },
     onTriggerClick:function(f){
-        this.fireEvent('beforetriggerclick', this);
+        if(!this.fireEvent('beforetriggerclick', this)) {
+            return;
+        };
         f.blur(f);
         //判断dbfindtrigger归属
         f.judge(f);

+ 3 - 0
frontend/saas-web/app/view/core/dbfind/types/BankInfoDbfindTrigger.js

@@ -1,3 +1,6 @@
+/**
+ * 资金账户放大镜
+ */
 Ext.define('saas.view.core.dbfind.types.BankInfoDbfindTrigger', {
     extend: 'saas.view.core.dbfind.DbfindTrigger',
     xtype: 'bandinfoDbfindTrigger',

+ 1 - 1
frontend/saas-web/app/view/core/dbfind/types/BomDbfindTrigger.js

@@ -1,5 +1,5 @@
 /**
- * 客户资料放大镜
+ * BOM资料放大镜
  */
 Ext.define('saas.view.core.dbfind.types.BomDbfindTrigger', {
     extend: 'saas.view.core.dbfind.DbfindTrigger',

+ 5 - 3
frontend/saas-web/app/view/core/dbfind/types/OriOrderMutiDbfindTrigger.js

@@ -1,10 +1,12 @@
+/**
+ * 资金来源单据放大镜(多选)
+ */
 Ext.define('saas.view.core.dbfind.types.OriOrderMutiDbfindTrigger', {
     extend: 'saas.view.core.dbfind.MultiDbfindTrigger',
     xtype: 'oriOrderMutiDbfindTrigger',
-/**
- * 用于资金首付款单明细
- */
+   
     dataUrl: '/api/money/subledger/list',
+    // dataUrl: 'http://192.168.253.35:8880/subledger/list',
     addTitle: '源单资料',
     dbtpls: [{
         field: 'sl_code',

+ 26 - 0
frontend/saas-web/app/view/core/form/field/ConDateField.scss

@@ -0,0 +1,26 @@
+.x-condatefield {
+    .x-field {
+        background: #fff;
+    }
+
+    .x-field:first-child {
+        .x-form-trigger-wrap-default {
+            border-top-right-radius: 0;
+            border-bottom-right-radius: 0;
+        }
+    }
+    .x-field:nth-child(2) {
+        .x-form-trigger-wrap-default {
+            border-radius: 0;
+            border-left: 0;
+            border-right: 0;
+        }
+    }
+    .x-field:last-child {
+        .x-form-trigger-wrap-default {
+            border-top-left-radius: 0;
+            border-bottom-left-radius: 0;
+        }
+    }
+
+}

+ 3 - 1
frontend/saas-web/app/view/core/form/field/DetailGridField.js

@@ -27,6 +27,8 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
     allowEmpty: false, // 表格为空时校验合法
     showCount: true, // 显示合计栏
 
+    emptyRows: 5,
+
     // Clearing selection disables the Actions.
     allowDeselect: true,
     defaultActionType: 'button',
@@ -201,7 +203,7 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
         selectedRecord = me.selModel.lastSelected,
         datas = [];
 
-        num = num || 3;
+        num = num || me.emptyRows;
 
         //当前行后序号全部加1
         var detno = selectedRecord ? selectedRecord.data[detnoColumn] : 0;

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

@@ -78,7 +78,7 @@ Ext.define('saas.view.money.verification.FormPanel', {
                     queryMode : "local",
                     store : null,
                     valueField : "value",
-                    xtype : "multidbfindtrigger"
+                    xtype : "oriOrderMutiDbfindTrigger"
                 }
             }, {
                 text: '业务类型',
@@ -173,7 +173,7 @@ Ext.define('saas.view.money.verification.FormPanel', {
         detail2: {
             xtype: "detailGridField",
             storeModel: 'saas.model.money.Verification1',
-            detnoColumn: 'vd_detno',
+            detnoColumn: 'vcd_detno',
             deleteDetailUrl: '/api/money/verification/deleteDetail2/',
             columnWidth: 1,
             columns: [{
@@ -182,11 +182,11 @@ Ext.define('saas.view.money.verification.FormPanel', {
                 hidden: true
             }, {
                 text: '来源ID',
-                dataIndex: 'vd_slid',
+                dataIndex: 'vcd_slid',
                 hidden: true
             }, {
                 text: '来源单号',
-                dataIndex: 'vd_slcode',
+                dataIndex: 'vcd_slcode',
                 width: 150,
                 editor:{
                     displayField : "display",
@@ -199,21 +199,21 @@ Ext.define('saas.view.money.verification.FormPanel', {
                     queryMode : "local",
                     store : null,
                     valueField : "value",
-                    xtype : "multidbfindtrigger"
+                    xtype : "oriOrderMutiDbfindTrigger"
                 }
             }, {
                 text: '业务类型',
-                dataIndex: "vd_slkind",
+                dataIndex: "vcd_slkind",
                 width: 110
             }, {
                 text: "单据日期",
-                dataIndex: "vd_sldate",
+                dataIndex: "vcd_sldate",
                 xtype: 'datecolumn',
                 width: 110
             }, {
                 text: "单据金额",
                 xtype: 'numbercolumn',
-                dataIndex: "vd_amount",
+                dataIndex: "vcd_amount",
                 width: 110,
                 renderer : function(v) {
                     var arr = (v + '.').split('.');
@@ -269,7 +269,7 @@ Ext.define('saas.view.money.verification.FormPanel', {
             }, {
                 text: "本次核销金额",
                 xtype: 'numbercolumn',
-                dataIndex: "vd_nowbalance",
+                dataIndex: "vcd_nowbalance",
                 width:150,
                 editor : {
                     xtype : "numberfield",
@@ -291,19 +291,22 @@ Ext.define('saas.view.money.verification.FormPanel', {
                 }
             }]
         },
-        other: {
+        other: [{
             fieldLabel: '备注',
             xtype: 'textfield',
             columnWidth: 1,
             name: 'vc_remark'
-        },
+        }],
 
         // 预收冲应收
         receipts_offset_receivable : {
             main: [{
                 xtype: 'hidden',
-                fieldLabel: '客户id',
+                fieldLabel: '客户名称',
                 name: 'vc_custid',
+                listeners: {
+                    change: 'clearDetails'
+                }
             }, {
                 fieldLabel: '客户编号',
                 xtype: 'hidden',
@@ -325,7 +328,10 @@ Ext.define('saas.view.money.verification.FormPanel', {
             main: [{
                 xtype: 'hidden',
                 name: 'vc_vendid',
-                fieldLabel: '供应商ID'
+                fieldLabel: '供应商名称',
+                listeners: {
+                    change: 'clearDetails'
+                }
             }, {
                 xtype: "hidden",
                 name: "vc_vendcode",
@@ -346,10 +352,13 @@ Ext.define('saas.view.money.verification.FormPanel', {
         // 应收冲应付
         receivable_offset_payable: {
             main: [{
-                fieldLabel: '客户id',
+                fieldLabel: '客户名称',
                 xtype: 'textfield',
                 name: 'vc_custid',
-                hidden: true
+                hidden: true,
+                listeners: {
+                    change: 'clearDetail0'
+                }
             }, {
                 fieldLabel: '客户编号',
                 xtype: 'textfield',
@@ -358,11 +367,14 @@ Ext.define('saas.view.money.verification.FormPanel', {
             }, {
                 fieldLabel: '客户名称',
                 xtype: 'customerDbfindTrigger',
-                name: 'vc_custname',
+                name: 'vc_custname'
             }, {
                 xtype: 'hidden',
                 name: 'vc_vendid',
-                fieldLabel: '供应商ID'
+                fieldLabel: '供应商ID',
+                listeners: {
+                    change: 'clearDetail1'
+                }
             }, {
                 xtype: "hidden",
                 name: "vc_vendcode",
@@ -383,10 +395,13 @@ Ext.define('saas.view.money.verification.FormPanel', {
         // 应收转应收
         receivable_to_receivable: {
             main: [{
-                fieldLabel: '转出客户id',
+                fieldLabel: '转出客户',
                 xtype: 'textfield',
                 name: 'vc_outcustid',
-                hidden: true
+                hidden: true,
+                listeners: {
+                    change: 'clearDetail0'
+                }
             }, {
                 fieldLabel: '转出客户编号',
                 xtype: 'textfield',
@@ -395,7 +410,7 @@ Ext.define('saas.view.money.verification.FormPanel', {
             }, {
                 fieldLabel: '转出客户',
                 xtype: 'customerDbfindTrigger',
-                name: 'vc_outcustname',
+                name: 'vc_outcustname'
             }, {
                 fieldLabel: '转入客户id',
                 xtype: 'textfield',
@@ -421,10 +436,13 @@ Ext.define('saas.view.money.verification.FormPanel', {
         // 应付转应付
         payable_to_payable: {
             main: [{
-                fieldLabel: '转出供应商id',
+                fieldLabel: '转出供应商',
                 xtype: 'textfield',
                 name: 'vc_outvendid',
-                hidden: true
+                hidden: true,
+                listeners: {
+                    change: 'clearDetail0'
+                }
             }, {
                 fieldLabel: '转出供应商编号',
                 xtype: 'textfield',
@@ -433,7 +451,7 @@ Ext.define('saas.view.money.verification.FormPanel', {
             }, {
                 fieldLabel: '转出供应商',
                 xtype: 'vendorDbfindTrigger',
-                name: 'vc_outvendname',
+                name: 'vc_outvendname'
             }, {
                 fieldLabel: '转入供应商id',
                 xtype: 'textfield',
@@ -454,6 +472,17 @@ Ext.define('saas.view.money.verification.FormPanel', {
                 name: 'vc_date'
             }],
             details: ['detail1']
+        },
+
+        defaultConditions: {
+            receipts_offset_receivable: ['ifnull(sl_custid,0)={vc_custid} and ifnull(sl_preamount,0)<>0 and ifnull(sl_namount,0)<>0',
+                'ifnull(sl_custid,0)={vc_custid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0'],
+            prepaid_offset_payable: ['ifnull(sl_vendid,0)={vc_vendid} and ifnull(sl_preamount,0)<>0 and ifnull(sl_namount,0)<>0',
+                'ifnull(sl_vendid,0)={vc_vendid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0'],
+            receivable_offset_payable: ['ifnull(sl_custid,0)={vc_custid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0',
+                'ifnull(sl_vendid,0)={vc_vendid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0'],
+            receivable_to_receivable: ['ifnull(sl_custid,0)={vc_outcustid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0'],
+            payable_to_payable: ['ifnull(sl_vendtid,0)={vc_outvendid} and ifnull(sl_preamount,0)=0 and ifnull(sl_namount,0)<>0']
         }
     },
 
@@ -528,7 +557,7 @@ Ext.define('saas.view.money.verification.FormPanel', {
 
         base[0].defaultValue = acitveType;
 
-        items = Ext.Array.merge(base, mainItems, (details[0] ? [detail1] : []), (details[1] ? [detail2] : []), [other] );
+        items = Ext.Array.merge(base, mainItems, (details[0] ? [detail1] : []), (details[1] ? [detail2] : []), other );
 
         return items;
     },

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

@@ -110,6 +110,177 @@ Ext.define('saas.view.money.verification.FormPanelController', {
 
                 }
             },
+
+            // 来源单号1
+            'oriOrderMutiDbfindTrigger[name=vd_slcode]': {
+                beforerender: function (f) {
+                    Ext.apply(f, {
+                        dbfinds: [{
+                            from: 'id',
+                            to: 'vd_slid',ignore:true
+                        }, {
+                            from: 'sl_code',
+                            to: 'vd_slcode'
+                        },{
+                            from: 'sl_orderamount',
+                            to: 'vd_amount'
+                        },{
+                            from: 'sl_yamount',
+                            to: 'sl_yamount'
+                        },{
+                            from:'sl_date',
+                            to:'vd_sldate'
+                        },{
+                            from:'sl_kind',
+                            to:'vd_slkind'
+                        },{
+                            from: 'sl_namount',
+                            to: 'vd_nowbalance'
+                        }],
+                    });
+                },
+                beforequery: function(f) {
+                    var defaultCondition = this.getDefaultCondition(0);
+                    if(!defaultCondition) {
+                        return false;
+                    }
+                    Ext.apply(f, {
+                        defaultCondition: defaultCondition
+                    });
+                },
+                beforetriggerclick: function(f) {
+                    var defaultCondition = this.getDefaultCondition(0);
+                    if(!defaultCondition) {
+                        return false;
+                    }
+                    Ext.apply(f, {
+                        defaultCondition: defaultCondition
+                    });
+                }
+            },
+
+            // 来源单号2
+            'oriOrderMutiDbfindTrigger[name=vcd_slcode]': {
+                beforerender: function (f) {
+                    Ext.apply(f, {
+                        dbfinds: [{
+                            from: 'id',
+                            to: 'vd_slid',ignore:true
+                        }, {
+                            from: 'sl_code',
+                            to: 'vd_slcode'
+                        },{
+                            from: 'sl_orderamount',
+                            to: 'vd_amount'
+                        },{
+                            from: 'sl_yamount',
+                            to: 'sl_yamount'
+                        },{
+                            from:'sl_date',
+                            to:'vd_sldate'
+                        },{
+                            from:'sl_kind',
+                            to:'vd_slkind'
+                        },{
+                            from: 'sl_namount',
+                            to: 'vd_nowbalance'
+                        }],
+                    });
+                },
+                beforequery: function(f) {
+                    var defaultCondition = this.getDefaultCondition(1);
+                    if(!defaultCondition) {
+                        return false;
+                    }
+                    Ext.apply(f, {
+                        defaultCondition: defaultCondition
+                    });
+                },
+                beforetriggerclick: function(f) {
+                    var defaultCondition = this.getDefaultCondition(1);
+                    if(!defaultCondition) {
+                        return false;
+                    }
+                    Ext.apply(f, {
+                        defaultCondition: defaultCondition
+                    });
+                }
+            },
         });
     },
+
+    getDefaultCondition: function(idx) {
+        var me = this,
+        form = me.getView(),
+        formItems = form.formItems,
+        viewModel = me.getViewModel(),
+        acitveType = form.acitveType,
+        etc = form.etc,
+        defaultConditions = etc.defaultConditions,
+        defaultConditionMode = defaultConditions[acitveType][idx];
+
+        var reg = /(.*){(.*)}(.*)/g;
+        var fieldName = defaultConditionMode.match(/(.*){(.*)}(.*)/)[2];
+        var fieldLabel = Ext.Array.findBy(formItems, function(f) {
+            return f.name == fieldName;
+        }).fieldLabel;
+        var fieldValue = viewModel.get(fieldName);
+        if(!fieldValue) {
+            saas.util.BaseUtil.showErrorToast('请先录入主表字段【' + '<span style="color: red;">' + fieldLabel + '</span>】');
+            return null;
+        }
+        var defaultCondition = defaultConditionMode.replace(reg, '$1' + fieldValue + '$3');
+
+        return defaultCondition;
+    },
+
+    /**
+     * 清空所有从表数据
+     */
+    clearDetails: function() {
+        var me = this;
+        
+        me.clearDetail0();
+        me.clearDetail1();
+    },
+
+    /**
+     * 清空第一个从表数据
+     */
+    clearDetail0: function(f, n, o) {
+        var me = this,
+        form = me.getView(),
+        grid = form.query('detailGridField')[0];
+        me.clearDetail(grid);
+    },
+
+    /**
+     * 清空第二个从表数据
+     */
+    clearDetail1: function() {
+        var me = this,
+        form = me.getView(),
+        grid = form.query('detailGridField')[1];
+        me.clearDetail(grid);
+    },
+
+    /**
+     * 清空一个从表数据
+     */
+    clearDetail: function(grid) {
+        var datas = [],
+        emptyRows = grid.emptyRows,
+        detnoColumn = grid.detnoColumn,
+        detno = 0,
+        store = grid.getStore();
+        
+        Ext.Array.each(new Array(emptyRows), function() {
+            detno += 1;
+            var data = {};
+            data[detnoColumn] = detno;
+            datas.push(data);
+        })
+        store.removeAll();
+        store.add(datas);
+    },
 });

+ 88 - 34
frontend/saas-web/app/view/money/verification/QueryPanel.js

@@ -8,64 +8,118 @@ Ext.define('saas.view.money.verification.QueryPanel', {
     viewName: 'money-verification-querypanel',
     
     queryFormItems: [{
-        xtype: 'hidden',
-        name: 'rb_id',
-        fieldLabel: 'ID',
-        allowBlank: true,
+        xtype: 'textfield',
+        name: 'vc_code',
+        fieldLabel: '单号/供应商名/客户名',
+        emptyText :'请输入单号或者供应商名或者客户名',
         getCondition: function(value) {
-            return 'rb_id=' + value;
+            if(value == 'ALL') {
+                return '1=1';
+            }else {
+                return  ' (vc_code like\'%' + value + '%\' '
+                    +' or vc_vendcode like \'%'+value+'%\' '
+                    +' or vc_custcode like \'%'+value+'%\') ';
+            }
         }
-    }, {
-        xtype: 'textfield',
-        name: 'rb_code',
-        emptyText:'请输入单据编号'
-    }, {
+    },{
         xtype: 'condatefield',
-        name: 'rb_date',
-        fieldLabel: '日期',
+        name: 'vc_date',
+        fieldLabel: '单据日期',
         columnWidth: 0.5,
         operation: 'between'
+    },{
+        xtype: 'combobox',
+        name: 'vc_statuscode',
+        fieldLabel: '审核状态',
+        queryMode: 'local',
+        displayField: 'name',
+        valueField: 'value',
+        emptyText :'全部',
+        editable:false,
+        store: Ext.create('Ext.data.ArrayStore', {
+            fields: ['value', 'name'],
+            data: [
+                ["ALL", "全部"],
+                ["AUDITED", "已审核"],
+                ["UNAUDITED", "未审核"]
+            ]
+        }),
+        getCondition: function(value) {
+            if(value == 'ALL') {
+                return '1=1';
+            }else {
+                return 'vc_statuscode=\'' + value + '\'';
+            }
+        }
+    },{
+        xtype: 'combobox',
+        name: 'vc_kind',
+        fieldLabel: '业务类型',
+        queryMode: 'local',
+        displayField: 'name',
+        valueField: 'value',
+        emptyText :'全部',
+        editable:false,
+        store: Ext.create('Ext.data.ArrayStore', {
+            fields: ['value', 'name'],
+            data: [
+                ["ALL", "全部"],
+                ["预收冲应收", "预收冲应收"],
+                ["预付冲应付", "预付冲应付"],
+                ["应收冲应付", "应收冲应付"],
+                ["应收转应收", "应收转应收"],
+                ["应付转应付", "应付转应付"]
+            ]
+        }),
+        getCondition: function(value) {
+            if(value == 'ALL') {
+                return '1=1';
+            }else {
+                return 'vc_kind=\'' + value + '\'';
+            }
+        }
     }],
     moreQueryFormItems: [],
     queryGridConfig: {
         idField: 'id',
-        codeField: 'rb_code',
-        addTitle: '收款单',
-        addXtype: 'money-recbalance-formpanel',
+        codeField: 'vc_code',
+        addTitle: '核销单',
+        addXtype: 'money-verification-formpanel',
         defaultCondition:'',
-        baseVastUrl: '/api/money/recbalance/',
+        baseVastUrl: '/api/money/verification/',
         baseColumn: [{
             text: 'id',
             dataIndex: 'id',
+            width: 100,
             xtype: 'numbercolumn',
             hidden: true
         }, {
             text: '单据编号',
-            dataIndex: 'rb_code',
-            width: 150
+            dataIndex: 'vc_code',
+            width: 200
+        }, {
+            text: '审核状态',
+            dataIndex: 'vc_status',
+            width: 120
         }, {
-            text: '单据状态',
-            dataIndex: 'rb_status',
-            width: 90
+            text: '业务类型',
+            dataIndex: 'vc_kind',
+            width: 200
         }, {
-            text: '日期',
-            dataIndex: 'rb_date',
-            xtype: 'datecolumn',
-            width: 110
+            text: '客户编号',
+            dataIndex: 'vc_custcode',
+            hidden: true
         }, {
             text: '客户名称',
-            dataIndex: 'rb_custname',
-            width: 150
+            dataIndex: 'vc_custname',
         }, {
-            text: '收款人',
-            dataIndex: 'rb_manname',
-            xtype: 'numbercolumn',
-            width: 110
+            text: '供应商名称',
+            dataIndex: 'vc_vendcode'
         }, {
-            text: '收款金额',
-            dataIndex: 'rb_rdamount',
+            text: '核销金额',
+            dataIndex: 'vc_amount1',
             xtype: 'numbercolumn',
-            width: 110,
+            width: 120,
             flex: 1,
             hidden: true
         }]

+ 5 - 0
frontend/saas-web/resources/json/navigation.json

@@ -159,6 +159,11 @@
             "text": "资金转存",
             "addType": "money-fundtransfer-formpanel",
             "viewType": "money-fundtransfer-querypanel"
+        }, {
+            "id": "verification",
+            "text": "核销单",
+            "addType": "money-verification-formpanel",
+            "viewType": "money-verification-querypanel"
         }]
     }, {
         "text": "报表",