Example #1
0
 private UFIDA.U9.Cust.GS.FI.PubBP.ErrorMessageDTOData ApprovedDoc(int type)
 {
     UFIDA.U9.Cust.GS.FI.PubBP.ErrorMessageDTOData dto = new UFIDA.U9.Cust.GS.FI.PubBP.ErrorMessageDTOData();
     UFIDA.U9.Cust.GS.FI.PrePaymentBP.Proxy.ApprovedPrePaymentBPProxy bp = new PrePaymentBP.Proxy.ApprovedPrePaymentBPProxy();
     bp.Type      = type;
     bp.EntityKey = this.Model.PrePayment.FocusedRecord.ID;
     dto          = bp.Do();
     this.Action.NavigateAction.Refresh(null, true);
     return(dto);
 }
        //BtnOk_Click...
        private void BtnOk_Click_Extend(object sender, EventArgs e)
        {
            //调用模版提供的默认实现.--默认实现可能会调用相应的Action.

            if (this.Model.DocumentTypeView.FocusedRecord.DocType <= 0L)
            {
                throw new Exception("红冲类型不能为空!");
            }

            if (this.Model.PrePaymentLine.SelectRecords.Count <= 0)
            {
                throw new Exception("没有选择要红冲的预付款通知单行!");
            }
            List <UFIDA.U9.Cust.GS.FI.PrePaymentBP.PrePaymentHeadDTOData> headList = new List <PrePaymentBP.PrePaymentHeadDTOData>();

            UFIDA.U9.Cust.GS.FI.PrePaymentBP.PrePaymentHeadDTOData head = new PrePaymentBP.PrePaymentHeadDTOData();
            head.DocumentType       = this.Model.DocumentTypeView.FocusedRecord.DocType;
            head.SrcPrePayDocID     = long.Parse(this.Model.PrePaymentLine.SelectRecords[0]["PrePayment_ID"].ToString());
            head.PrePaymentLineDTOs = new List <PrePaymentBP.PrePaymentLineDTOData>();

            foreach (PrePaymentLineRecord record in this.Model.PrePaymentLine.SelectRecords)
            {
                decimal canRedMoney  = record.CanRedMoney ?? decimal.Zero;
                decimal thisRedMoney = record.ThisRedMoney ?? decimal.Zero;

                if (thisRedMoney <= 0)
                {
                    throw new Exception("第" + record.LineNum.ToString() + "行:本次红冲金额必须大于0!");
                }
                if (thisRedMoney > canRedMoney)
                {
                    throw new Exception("第" + record.LineNum.ToString() + "行:本次红冲金额不能大于可红冲金额!");
                }

                UFIDA.U9.Cust.GS.FI.PrePaymentBP.PrePaymentLineDTOData line = new PrePaymentBP.PrePaymentLineDTOData();
                line.SrcPrePayLineID = record.ID;
                line.ThisRedMoney    = thisRedMoney;

                head.PrePaymentLineDTOs.Add(line);
            }
            headList.Add(head);
            UFIDA.U9.Cust.GS.FI.PrePaymentBP.Proxy.RedFlushPrePaymentBPProxy bp = new PrePaymentBP.Proxy.RedFlushPrePaymentBPProxy();
            bp.PrePaymentHeadDTOs = headList;
            List <UFIDA.U9.Cust.GS.FI.PubBP.CommonDTOData> resultList = bp.Do();

            if (resultList != null && resultList.Count > 0)
            {
                foreach (UFIDA.U9.Cust.GS.FI.PubBP.CommonDTOData result in resultList)
                {
                    UFIDA.U9.Cust.GS.FI.PrePaymentBP.Proxy.ApprovedPrePaymentBPProxy subBP = new PrePaymentBP.Proxy.ApprovedPrePaymentBPProxy();
                    subBP.EntityKey = result.ID;
                    subBP.Type      = 0;
                    subBP.Do();

                    UFIDA.U9.Cust.GS.FI.PrePaymentBP.Proxy.ApprovedPrePaymentBPProxy appBP = new PrePaymentBP.Proxy.ApprovedPrePaymentBPProxy();
                    appBP.EntityKey = result.ID;
                    appBP.Type      = 1;
                    appBP.Do();
                }
            }
            BtnOk_Click_DefaultImpl(sender, e);
        }