private void btnRefresh_Click_Extend(object sender, EventArgs e)
 {
     if (this.CurrentState["PurchaseOrderView"] != null)
     {
         IUIRecordCollection iuiRercords = this.CurrentState["PurchaseOrderView"] as IUIRecordCollection;
         foreach (IUIRecord record in iuiRercords)
         {
             UFIDA.U9.Cust.GS.FI.BatchPaymentForPOUIModel.PurchaseOrderViewRecord poRecord = record as UFIDA.U9.Cust.GS.FI.BatchPaymentForPOUIModel.PurchaseOrderViewRecord;
             if (poRecord != null)
             {
                 PurchaseOrderViewRecord newRecord = this.Model.PurchaseOrderView.AddNewUIRecord();
                 newRecord.DocumentType    = poRecord.DocumentType;
                 newRecord.POOrg           = poRecord.POOrg;
                 newRecord.POOrg_Code      = poRecord.POOrg_Code;
                 newRecord.POOrg_Name      = poRecord.POOrg_Name;
                 newRecord.PODocNo         = poRecord.PODocNo;
                 newRecord.PODocID         = poRecord.PODocID;
                 newRecord.BusDate         = poRecord.BusDate;
                 newRecord.Supplier        = poRecord.Supplier;
                 newRecord.Supplier_Code   = poRecord.Supplier_Code;
                 newRecord.Supplier_Name   = poRecord.Supplier_Name;
                 newRecord.Currency        = poRecord.Currency;
                 newRecord.Currency_Code   = poRecord.Currency_Code;
                 newRecord.Currency_Name   = poRecord.Currency_Name;
                 newRecord.Currency_Symbol = poRecord.Currency_Symbol;
                 newRecord.Currency_MoneyRound_Precision  = poRecord.Currency_MoneyRound_Precision;
                 newRecord.Currency_MoneyRound_RoundType  = poRecord.Currency_MoneyRound_RoundType;
                 newRecord.Currency_MoneyRound_RoundValue = poRecord.Currency_MoneyRound_RoundValue;
                 newRecord.Buyer            = poRecord.Buyer;
                 newRecord.Buyer_Code       = poRecord.Buyer_Code;
                 newRecord.Buyer_Name       = poRecord.Buyer_Name;
                 newRecord.Dept             = poRecord.Dept;
                 newRecord.Dept_Code        = poRecord.Dept_Code;
                 newRecord.Dept_Name        = poRecord.Dept_Name;
                 newRecord.TotalMoney       = poRecord.TotalMoney;
                 newRecord.PrePayMoney      = poRecord.PrePayMoney;
                 newRecord.PayMoney         = poRecord.PayMoney;
                 newRecord.TotalPayRedMoney = poRecord.TotalPayRedMoney;
                 newRecord.PreApplyMoney    = poRecord.PreApplyMoney;
                 newRecord.RedMoney         = poRecord.RedMoney;
                 newRecord.MoveMoney        = poRecord.MoveMoney;
                 newRecord.IntoMoney        = poRecord.IntoMoney;
                 newRecord.CanPreMoney      = poRecord.CanPreMoney;
                 //newRecord.ThisMoveMoney = poRecord.ThisPreMoney;
             }
         }
         this.CurrentState["PurchaseOrderView"] = null;
     }
 }
예제 #2
0
 private void SetRecord(List <UFIDA.U9.Cust.GS.FI.PrePaymentBP.PurchaseOrderDTOData> dtoList)
 {
     this.Model.PurchaseOrderView.Clear();
     foreach (UFIDA.U9.Cust.GS.FI.PrePaymentBP.PurchaseOrderDTOData dto in dtoList)
     {
         PurchaseOrderViewRecord record = this.Model.PurchaseOrderView.AddNewUIRecord();
         record.DocumentType    = dto.DocumentType;
         record.POOrg           = dto.POOrg;
         record.POOrg_Code      = dto.POOrg_Code;
         record.POOrg_Name      = dto.POOrg_Name;
         record.PODocNo         = dto.PODocNo;
         record.PODocID         = dto.PODocID;
         record.BusDate         = dto.BusDate;
         record.Supplier        = dto.Supplier;
         record.Supplier_Code   = dto.Supplier_Code;
         record.Supplier_Name   = dto.Supplier_Name;
         record.Currency        = dto.Currency;
         record.Currency_Code   = dto.Currency_Code;
         record.Currency_Name   = dto.Currency_Name;
         record.Currency_Symbol = dto.Currency_Symbol;
         record.Currency_MoneyRound_Precision  = dto.Currency_MoneyRound_Precision;
         record.Currency_MoneyRound_RoundType  = dto.Currency_MoneyRound_RoundType;
         record.Currency_MoneyRound_RoundValue = dto.Currency_MoneyRound_RoundValue;
         record.Buyer            = dto.Buyer;
         record.Buyer_Code       = dto.Buyer_Code;
         record.Buyer_Name       = dto.Buyer_Name;
         record.Dept             = dto.Dept;
         record.Dept_Code        = dto.Dept_Code;
         record.Dept_Name        = dto.Dept_Name;
         record.TotalMoney       = dto.TotalMoney;
         record.PrePayMoney      = dto.PrePayMoney;
         record.PayMoney         = dto.TotalPayMoney;
         record.TotalPayRedMoney = dto.TotalPayRedMoney;
         record.PreApplyMoney    = dto.PreApplyMoney;
         record.RedMoney         = dto.RedMoney;
         record.MoveMoney        = dto.MoveMoney;
         record.IntoMoney        = dto.IntoMoney;
         record.CanPreMoney      = dto.CanPreMoney;
         record.ThisPreMoney     = dto.ThisPreMoney;
         record.Meno             = dto.Meno;
     }
 }
예제 #3
0
        /// <summary>
        /// 批量拉单
        /// </summary>
        private void BatchCreatePrePayment()
        {
            int selectCount = this.Model.PurchaseOrderView.SelectRecords.Count;

            if (selectCount == 0)
            {
                throw new Exception("未选中数据!");
            }

            DataTable table = new DataTable();

            table.Columns.Add("Supplier", typeof(long));
            table.Columns.Add("Currency", typeof(long));
            table.Columns.Add("POOrg", typeof(long));
            table.Columns.Add("Dept", typeof(long));
            table.Columns.Add("Buyer", typeof(long));

            #region 对选中的数据按照供应商、币种、采购组织、来源组织、采购部门、业务员进行分组
            foreach (PurchaseOrderViewRecord record in this.Model.PurchaseOrderView.SelectRecords)
            {
                decimal preMoney = record.ThisPreMoney ?? decimal.Zero;
                decimal canMoney = record.CanPreMoney ?? decimal.Zero;
                if (preMoney <= 0)
                {
                    throw new Exception("本次预付金额必须大于0!");
                }
                if (preMoney > canMoney)
                {
                    throw new Exception("本次预付金额不能大于可预付金额!");
                }

                StringBuilder strWhere = new StringBuilder(300);
                strWhere.Append("Supplier='" + record.Supplier.ToString() + "'");
                strWhere.Append(" and Currency='" + record.Currency.ToString() + "'");
                strWhere.Append(" and POOrg='" + record.POOrg.ToString() + "'");
                strWhere.Append(" and Dept='" + record.Dept.ToString() + "'");
                strWhere.Append(" and Buyer='" + record.Buyer.ToString() + "'");

                DataRow[] drs = table.Select(strWhere.ToString());
                if (drs != null && drs.Length == 0)
                {
                    DataRow dr = table.NewRow();
                    dr["Supplier"] = record.Supplier;
                    dr["Currency"] = record.Currency;
                    dr["POOrg"]    = record.POOrg;
                    dr["Dept"]     = record.Dept;
                    dr["Buyer"]    = record.Buyer;
                    table.Rows.Add(dr);
                }
            }
            #endregion

            #region 把分单后的数据赋值给创建预付款通知单的BP
            List <UFIDA.U9.Cust.GS.FI.PrePaymentBP.PrePaymentHeadDTOData> headList = new List <PrePaymentBP.PrePaymentHeadDTOData>();
            foreach (DataRow dr in table.Rows)
            {
                UFIDA.U9.Cust.GS.FI.PrePaymentBP.PrePaymentHeadDTOData head = new PrePaymentBP.PrePaymentHeadDTOData();
                if (this.NameValues["DocumentType"] != null)
                {
                    head.DocumentType = long.Parse(this.NameValues["DocumentType"].ToString());
                }
                head.Currency = long.Parse(dr["Currency"].ToString());
                head.Supplier = long.Parse(dr["Supplier"].ToString());
                head.POOrg    = long.Parse(dr["POOrg"].ToString());
                head.Dept     = long.Parse(dr["Dept"].ToString());
                head.Buyer    = long.Parse(dr["Buyer"].ToString());

                LocateExpressionCollection expList = new LocateExpressionCollection();

                LocateExpression exp1 = new LocateExpression("Supplier", ExpressionOperator.Equal, long.Parse(dr["Supplier"].ToString()));
                LocateExpression exp2 = new LocateExpression("Currency", ExpressionOperator.Equal, long.Parse(dr["Currency"].ToString()));
                LocateExpression exp3 = new LocateExpression("POOrg", ExpressionOperator.Equal, long.Parse(dr["POOrg"].ToString()));
                LocateExpression exp4 = new LocateExpression("Dept", ExpressionOperator.Equal, long.Parse(dr["Dept"].ToString()));
                LocateExpression exp5 = new LocateExpression("Buyer", ExpressionOperator.Equal, long.Parse(dr["Buyer"].ToString()));

                expList.Add(exp1);
                expList.Add(exp2);
                expList.Add(exp3);
                expList.Add(exp4);
                expList.Add(exp5);

                ILocateExpression   _ILocateExpression = expList;
                IUIRecordCollection records            = this.Model.PurchaseOrderView.SelectRecords.FindAll(expList);
                head.PrePaymentLineDTOs = new List <PrePaymentBP.PrePaymentLineDTOData>();
                foreach (IUIRecord record in records)
                {
                    PurchaseOrderViewRecord poRecord = record as PurchaseOrderViewRecord;

                    PrePaymentBP.PrePaymentLineDTOData line = new PrePaymentBP.PrePaymentLineDTOData();
                    line.PurchaseOrder = poRecord.PODocID.Value;
                    line.PrePayMoney   = poRecord.ThisPreMoney.Value;
                    head.PrePaymentLineDTOs.Add(line);
                }
                headList.Add(head);
            }
            UFIDA.U9.Cust.GS.FI.PrePaymentBP.Proxy.BatchCreatePrePaymentBPProxy bp = new PrePaymentBP.Proxy.BatchCreatePrePaymentBPProxy();
            bp.PrePaymentHeadDTOs = headList;
            List <UFIDA.U9.Cust.GS.FI.PubBP.CommonDTOData> resultList = bp.Do();

            this.CurrentState["CommonDTODataList"] = resultList;
            #endregion

            if (this.Model.QueryConditionView.FocusedRecord.IsShow.Value)
            {
                NameValueCollection param = new NameValueCollection();
                param.Add("PDPageStatus", "Browse");//这行代码是控制弹开画面为浏览状态
                string FormID = "9b3eb33f-d188-4d0d-8856-aff8c6c23f1e";
                this.ShowModalDialog(FormID, "批量预付结果", "810", "375", null, param, false, false);
            }
        }