예제 #1
0
        /// <summary>
        /// 获取物料明细记录并绑定到GridControl控件中。
        /// </summary>
        public void BindMaterialDetail()
        {
            string  sapOperation  = GetSapOperation();
            string  storeNameList = GetStoreNameList();
            DataSet dsReturn      = new DataSet();
            string  msg           = string.Empty;

            try
            {
                //创建远程调用的工厂对象。
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();
                if (null != serverFactory)//工厂对象不为null
                {
                    dsReturn = serverFactory.CreatIReceiveMaterialEngine().GetMaterialDetail(sapOperation, storeNameList);
                    msg      = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);

                    if (msg != string.Empty)
                    {
                        MessageService.ShowError(msg);
                    }
                    else
                    {
                        dsReturn.Tables[0].Columns.Add(new DataColumn("IsSelected", typeof(Boolean)));
                        dsReturn.Tables[0].Columns.Add(new DataColumn("Operation", typeof(string)));
                        dsReturn.Tables[0].Columns.Add(new DataColumn("OnlineWarehouse", typeof(string)));

                        foreach (DataRow dr in dsReturn.Tables[0].Rows)
                        {
                            string strWorkOrder          = dr["AUFNR"].ToString();
                            string strMaterialCode       = dr["MATNR"].ToString();
                            string strStores             = PropertyService.Get(PROPERTY_FIELDS.STORES);
                            ReceiveMaterialEntity entity = new ReceiveMaterialEntity();
                            DataTable             dt     = entity.GetStoreByMaterialCode(strWorkOrder, strMaterialCode, strStores);
                            if (entity.ErrorMsg == string.Empty)//成功获取线上仓数据。
                            {
                                string defaultLineStore = dt.Rows.Count > 0 ? dt.Rows[0][0].ToString() : string.Empty;
                                string defaultOperation = defaultLineStore != string.Empty ? GetOperationNameByStore(defaultLineStore) : string.Empty;
                                dr["OnlineWarehouse"] = defaultLineStore;
                                dr["Operation"]       = defaultOperation;
                            }
                        }

                        gdcData.MainView   = gdvMaterialDefault;
                        gdcData.DataSource = dsReturn.Tables[0];
                    }
                }
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }
        }
예제 #2
0
        /// <summary>
        /// 进行单元格编辑时的事件方法。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gdvMaterialDefault_CustomRowCellEditForEditing(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e)
        {
            if (e.Column.FieldName == "OnlineWarehouse")//正在编辑线上仓名称。
            {
                this.Param_LineStore.Items.Clear();
                string strWorkOrder    = this.gdvMaterialDefault.GetRowCellValue(e.RowHandle, "AUFNR").ToString();
                string strMaterialCode = this.gdvMaterialDefault.GetRowCellValue(e.RowHandle, "MATNR").ToString();
                string strStores       = PropertyService.Get(PROPERTY_FIELDS.STORES);

                ReceiveMaterialEntity entity = new ReceiveMaterialEntity();
                DataTable             dt     = entity.GetStoreByMaterialCode(strWorkOrder, strMaterialCode, strStores);
                if (entity.ErrorMsg == string.Empty)//成功获取线上仓数据。
                {
                    //重新绑定线上仓名称控件。
                    foreach (DataRow dr in dt.Rows)
                    {
                        this.Param_LineStore.Items.Add(dr["STORE_NAME"]);
                    }
                }
            }
        }