protected override string[] FormatExportRecord(object obj)
        {
            //return new string[]{((InvoicesExt)obj).InvNo,
            //                    this.GetInvInName(((InvoicesExt)obj).InvType),
            //                    this.GetStatusName(((InvoicesExt)obj).InvStatus),
            //                    ((InvoicesExt)obj).FinishFlag,
            //                    ((InvoicesExt)obj).CUser,
            //                    FormatHelper.ToDateString(((InvoicesExt)obj).CDate),
            //                    "",//((InvoicesExt)obj).VendorCode,
            //                    ((InvoicesExt)obj).VendorName,
            //                    ((InvoicesExt)obj).OaMo,
            //                    ((InvoicesExt)obj).AsnAvailable
            //                   };

            string[]    objs = new string[this.SAPHeadViewFieldList.Length];
            InvoicesExt inv  = obj as InvoicesExt;
            Type        type = inv.GetType();

            for (int i = 0; i < this.SAPHeadViewFieldList.Length; i++)
            {
                ViewField field    = this.SAPHeadViewFieldList[i];
                string    strValue = string.Empty;
                System.Reflection.FieldInfo fieldInfo = type.GetField(field.FieldName);
                if (fieldInfo != null)
                {
                    strValue = fieldInfo.GetValue(inv).ToString();
                }
                if (field.FieldName == "InvType")
                {
                    strValue = this.GetInvInName(inv.InvType);
                }
                if (field.FieldName == "FinishFlag1")
                {
                    strValue = inv.FinishFlag;
                }
                else if (field.FieldName == "OrderStatus1")
                {
                    strValue = inv.OrderStatus;// this.GetStatusName(inv.OrderStatus);
                }
                else if (field.FieldName == "InvStatus")
                {
                    strValue = inv.InvStatus;// this.GetStatusName(inv.InvStatus);
                }
                else if (field.FieldName == "PoCreateDate")
                {
                    strValue = FormatHelper.ToDateString(inv.PoCreateDate);
                }
                else if (field.FieldName == "PoupDateDate")
                {
                    strValue = FormatHelper.ToDateString(inv.PoupDateDate);
                }
                else if (field.FieldName == "PoupDateTime")
                {
                    strValue = FormatHelper.ToTimeString(inv.PoupDateTime);
                }
                else if (field.FieldName == "ApplyDate")
                {
                    strValue = FormatHelper.ToDateString(inv.ApplyDate);
                }
                else if (field.FieldName == "VoucherDate")
                {
                    strValue = FormatHelper.ToDateString(inv.VoucherDate);
                }
                else if (field.FieldName == "CDate")
                {
                    strValue = FormatHelper.ToDateString(inv.CDate);
                }
                else if (field.FieldName == "CTime")
                {
                    strValue = FormatHelper.ToTimeString(inv.CTime);
                }
                else if (field.FieldName == "PlangiDate")
                {
                    strValue = FormatHelper.ToDateString(inv.PlangiDate);
                }
                else if (field.FieldName == "DnMDate")
                {
                    strValue = FormatHelper.ToDateString(inv.DnMDate);
                }
                else if (field.FieldName == "AsnAvailable")
                {
                    if (CanCreateASN(inv.InvNo))
                    {
                        strValue = "是";
                    }
                    else
                    {
                        strValue = "否";
                    }
                }
                objs[i] = strValue;
            }
            return(objs);
        }
        protected override void Grid_ClickCell(GridRecord row, string commandName)
        {
            if (_InventoryFacade == null)
            {
                _InventoryFacade = new InventoryFacade(base.DataProvider);
            }

            if (_warehouseFacade == null)
            {
                _warehouseFacade = new WarehouseFacade(base.DataProvider);
            }
            string      invNo = row.Items.FindItemByKey("InvNo").Text.Trim();
            InvoicesExt ext   = this._InventoryFacade.QueryInvoices(
                string.Empty,
                invNo,
                string.Empty,
                string.Empty,
                string.Empty,
                0,
                0,
                1, 1)[0] as InvoicesExt;

            string storageInType = ext.InvType;
            string asnAvailable  = ext.AsnAvailable;

            if (commandName == "CreateASN")
            {
                if (asnAvailable == "N")
                {
                    WebInfoPublish.Publish(this, "不可以创建入库指令", this.languageComponent1);
                    return;
                }



                if (!CanCreateASN(invNo))
                {
                    WebInfoPublish.Publish(this, "已超出" + invNo + "的数量或者入库需求已经被取消", this.languageComponent1);
                    return;
                }



                if (storageInType == "UB")
                {
                    Pick pick = (Pick)_InventoryFacade.GetPickByInvNo(invNo);
                    if (pick == null)
                    {
                        WebInfoPublish.Publish(this, "对应的拣货任务令不存在!", this.languageComponent1);
                        return;
                    }
                    if (pick.Status != "Close")
                    {
                        WebInfoPublish.Publish(this, "调拨单未出库", this.languageComponent1);
                        return;
                    }

                    bool isFirst = _InventoryFacade.IsFirstCreateAsn(invNo);
                    if (isFirst)
                    {
                        string stno = autoCreateASNFromCheckoutInfo(invNo, pick);
                        Response.Redirect(this.MakeRedirectUrl("FASNForBuyerAndLogisticMP.aspx",
                                                               new string[] { "InvNo", "StorageInType", "StNo" },
                                                               new string[] { invNo, storageInType, stno }));
                    }
                }


                if (isVendor)
                {
                    Response.Redirect(this.MakeRedirectUrl("FASNForVendorMP.aspx",
                                                           new string[] { "InvNo", "StorageInType" },
                                                           new string[] { invNo, storageInType }));
                }
                else
                {
                    Response.Redirect(this.MakeRedirectUrl("FASNForBuyerAndLogisticMP.aspx",
                                                           new string[] { "InvNo", "StorageInType" },
                                                           new string[] { invNo, storageInType }));
                }
            }
            else if (commandName == "LinkToDetail")
            {
                //67	7.完成字段为Y时,还能跳转。fix
                if (asnAvailable == "Y")
                {
                    return;
                }

                Response.Redirect(this.MakeRedirectUrl("FSAPStorageInDemandDeatil.aspx",
                                                       new string[] { "InvNo", "StorageInType", "StorageInType", "Complete", "VendorCode", "CreateUser" },
                                                       new string[] { invNo, storageInType,
                                                                      FormatHelper.CleanString(this.drpStorageInTypeQuery.SelectedValue),
                                                                      FormatHelper.CleanString(this.drpCompleteQuery.SelectedValue),
                                                                      FormatHelper.CleanString(this.txtVendorCodeQuery.Text),
                                                                      FormatHelper.CleanString(this.txtCreateUserQuery.Text), }));
            }
        }
 /// <remarks/>
 public Status EndEP_GetPaidInvoicesExt(System.IAsyncResult asyncResult, out InvoicesExt invoices_ext)
 {
     object[] results = this.EndInvoke(asyncResult);
     invoices_ext = ((InvoicesExt)(results[1]));
     return ((Status)(results[0]));
 }
        protected override DataRow GetGridRow(object obj)
        {
            DataRow row = this.DtSource.NewRow();

            //row["InvNo"] = ((InvoicesExt)obj).InvNo;
            //row["StorageInType"] = this.GetInvInName(((InvoicesExt)obj).InvType);//入库类型(单据类型)
            //row["StorageInTypeCode"] = ((InvoicesExt)obj).InvType;
            //row["InvStatus"] = this.GetStatusName(((InvoicesExt)obj).InvStatus);
            //row["FinishFlag"] = ((InvoicesExt)obj).FinishFlag;
            ////row["CUser"] = ((InvoicesExt)obj).CUser;
            ////row["CDate"] = ((InvoicesExt)obj).CDate;
            //row["CUser"] = ((InvoicesExt)obj).CreateUser;
            //row["CDate"] = ((InvoicesExt)obj).PoCreateDate;
            //row["VendorCode"] = ((InvoicesExt)obj).VendorCode; // ((InvoicesExt)obj).VendorCode;
            //row["VendorName"] = ((InvoicesExt)obj).VendorName;
            //row["OANo"] = ((InvoicesExt)obj).OaMo;
            //row["ASNAvailable"] = ((InvoicesExt)obj).AsnAvailable;

            InvoicesExt inv  = obj as InvoicesExt;
            Type        type = inv.GetType();

            for (int i = 0; i < this.SAPHeadViewFieldList.Length; i++)
            {
                ViewField field    = this.SAPHeadViewFieldList[i];
                string    strValue = string.Empty;
                System.Reflection.FieldInfo fieldInfo = type.GetField(field.FieldName);
                if (fieldInfo != null)
                {
                    strValue = fieldInfo.GetValue(inv).ToString();
                }
                if (field.FieldName == "InvType")
                {
                    strValue = this.GetInvInName(inv.InvType);
                }
                if (field.FieldName == "FinishFlag1")
                {
                    strValue = inv.FinishFlag;
                }
                else if (field.FieldName == "OrderStatus1")
                {
                    strValue = inv.OrderStatus;// this.GetStatusName(inv.OrderStatus);
                }
                else if (field.FieldName == "InvStatus")
                {
                    strValue = inv.InvStatus;// this.GetStatusName(inv.InvStatus);
                }
                else if (field.FieldName == "OrderStatus")
                {
                    strValue = this.GetStatusName(inv.OrderStatus);
                }
                else if (field.FieldName == "CreateUser")
                {
                    strValue = inv.CreateUser;
                    //if ((inv.InvType == "PRC") || (inv.InvType == "YFR") || (inv.InvType == "GZC"))
                    //{
                    //    strValue = inv.SAPCuser;
                    //}
                    //else
                    //{
                    //    strValue = inv.CreateUser;
                    //}
                }
                else if (field.FieldName == "PoCreateDate")
                {
                    if ((inv.InvType == "PRC") || (inv.InvType == "YFR") || (inv.InvType == "GZC"))
                    {
                        strValue = FormatHelper.ToDateString(inv.PoupDateDate);
                    }
                    else
                    {
                        strValue = FormatHelper.ToDateString(inv.PoCreateDate);
                    }
                }
                else if (field.FieldName == "PoupDateDate")
                {
                    strValue = FormatHelper.ToDateString(inv.PoupDateDate);
                }
                else if (field.FieldName == "PoupDateTime")
                {
                    strValue = FormatHelper.ToTimeString(inv.PoupDateTime);
                }
                else if (field.FieldName == "ApplyDate")
                {
                    strValue = FormatHelper.ToDateString(inv.ApplyDate);
                }
                else if (field.FieldName == "VoucherDate")
                {
                    strValue = FormatHelper.ToDateString(inv.VoucherDate);
                }

                else if (field.FieldName == "MESCDate")
                {
                    strValue = FormatHelper.ToDateString(inv.CDate);
                }
                else if (field.FieldName == "MESCTime")
                {
                    strValue = FormatHelper.ToTimeString(inv.CTime);
                }
                else if (field.FieldName == "MESCUser")
                {
                    strValue = inv.CUser;
                }
                else if (field.FieldName == "MESMaintainUser")
                {
                    strValue = inv.MaintainUser;
                }
                else if (field.FieldName == "MESMaintainDate")
                {
                    strValue = FormatHelper.ToDateString(inv.MaintainDate);
                }
                else if (field.FieldName == "MESMaintainTime")
                {
                    strValue = FormatHelper.ToTimeString(inv.MaintainTime);
                }

                else if (field.FieldName == "PlangiDate")
                {
                    strValue = FormatHelper.ToDateString(inv.PlangiDate);
                }
                else if (field.FieldName == "DnMDate")
                {
                    strValue = FormatHelper.ToDateString(inv.DnMDate);
                }
                else if (field.FieldName == "SAPRSCuser ")
                {
                    strValue = inv.SAPCuser;
                }
                else if (field.FieldName == "InvNo")
                {
                }
                else if (field.FieldName == "AsnAvailable")
                {
                    if (CanCreateASN(inv.InvNo))
                    {
                        strValue = "是";
                    }
                    else
                    {
                        strValue = "否";
                    }
                }
                else if (field.FieldName.ToUpper() == "NOTOUTCHECKFLAG")
                {
                    if (string.IsNullOrEmpty(inv.NotOutCheckFlag))
                    {
                        strValue = "否";
                    }
                    else if (inv.NotOutCheckFlag.ToUpper() == "X")
                    {
                        strValue = "是";
                    }
                    else
                    {
                        strValue = inv.NotOutCheckFlag;
                    }
                }
                //PlanSendDate
                row[i + 1] = strValue;
            }

            return(row);
        }
 public Status EP_GetPaidInvoicesExt(string mer_no, string pass, string order, out InvoicesExt invoices_ext)
 {
     object[] results = this.Invoke("EP_GetPaidInvoicesExt", new object[] {
             mer_no,
             pass,
             order});
     invoices_ext = ((InvoicesExt)(results[1]));
     return ((Status)(results[0]));
 }