/// <summary> 绑定工厂车间。 /// 绑定工厂车间。 /// </summary> private void BindFactoryRoom() { string stores = PropertyService.Get(PROPERTY_FIELDS.STORES); this.lueFactoryRoom.Properties.ReadOnly = false; DataTable dt = FactoryUtils.GetFactoryRoomByStores(stores); if (dt != null) { this.lueFactoryRoom.Properties.DataSource = dt; this.lueFactoryRoom.Properties.DisplayMember = "LOCATION_NAME"; this.lueFactoryRoom.Properties.ValueMember = "LOCATION_KEY"; this.lueFactoryRoom.ItemIndex = 0; } else { this.lueFactoryRoom.Properties.DataSource = null; this.lueFactoryRoom.EditValue = string.Empty; } //禁用领料车间 if (dt == null || dt.Rows.Count <= 1) { this.lueFactoryRoom.Properties.ReadOnly = true; } }
//窗体载入(Load)事件方法 private void WorkOrderMatRetListQueryDialogCtrl_Load(object sender, EventArgs e) { //1、根据登录用户将登录用户拥有权限的工序名称绑定到窗体控件中,设置空为控件默认值。 string StrOperation = PropertyService.Get(PROPERTY_FIELDS.OPERATIONS); cmbBEOperation.Properties.Items.Add(""); if (StrOperation.Length > 0) { string[] StrArrOperation = StrOperation.Split(','); for (int i = 0; i < StrArrOperation.Length; i++) { cmbBEOperation.Properties.Items.Add(StrArrOperation[i]); } } //"2、根据登录用户将登录用户拥有权限的线边仓名称绑定到窗体控件中,设置空为控件默认值。 string strStore = PropertyService.Get(PROPERTY_FIELDS.STORES); cmbBEStore.Properties.Items.Add(""); if (strStore.Length > 0) { string[] strArrStore = strStore.Split(','); for (int i = 0; i < strArrStore.Length; i++) { cmbBEStore.Properties.Items.Add(strArrStore[i]); } } //3、根据PropertyService获取PROPERTY_FIELDS.STORES的值。从WST_STORES,FMM_LOCATION,FMM_LOCATION_RET根据线边仓名称获取用户拥有权限的工厂车间名称集合绑定到窗体控件中,设置空为控件默认值。 DataTable dtStore = FactoryUtils.GetFactoryRoomByStores(PropertyService.Get(PROPERTY_FIELDS.STORES)); cmbBERoom.Properties.Items.Add(""); for (int i = 0; i < dtStore.Rows.Count; i++) { cmbBERoom.Properties.Items.Add(dtStore.Rows[i]["LOCATION_NAME"]); } //没有不需要了 //"4、根据工序名称和工厂车间获取设备名称数据绑定到窗体控件中,设置空为控件默认值。 //从FMM_LOCATION c , EMS_EQUIPMENTS d ,EMS_OPERATION_EQUIPMENT e , POR_ROUTE_OPERATION_VER f表中获取。" //5、绑定班别数据到控件,设置空为控件默认值。从CRM_ATTRIBUTE a,BASE_ATTRIBUTE b,BASE_ATTRIBUTE_CATEGORY c数据表中查询c.CATEGORY_NAME=Basic_Shift的数据。显示a.NAME=CODE对应的属性值。 string[] columns = new string[] { "CODE" }; KeyValuePair <string, string> category = new KeyValuePair <string, string>("CATEGORY_NAME", "Basic_Shift"); DataTable dtShift = BaseData.Get(columns, category); cmbBEShift.Properties.Items.Add(""); for (int i = 0; i < dtShift.Rows.Count; i++) { cmbBEShift.Properties.Items.Add(dtShift.Rows[i]["CODE"]); } //6、退料日期默认为当月月初到当前日期 dateEStart.DateTime = DateTime.Now.AddDays(-DateTime.Now.Day + 1); dateEEnd.DateTime = DateTime.Now; }
/// <summary> /// 绑定车间。 /// </summary> private void BindRoom() { //根据PropertyService获取PROPERTY_FIELDS.STORES的值。从WST_STORES,FMM_LOCATION,FMM_LOCATION_RET //根据线边仓名称获取用户拥有权限的工厂车间名称集合绑定到窗体控件中,设置空为控件默认值。 DataTable dtFacRoom = FactoryUtils.GetFactoryRoomByStores(PropertyService.Get(PROPERTY_FIELDS.STORES)); DataRow dr = dtFacRoom.NewRow(); dr["LOCATION_NAME"] = string.Empty; dtFacRoom.Rows.Add(dr); lueRoom.Properties.DataSource = dtFacRoom; lueRoom.Properties.DisplayMember = "LOCATION_NAME"; lueRoom.Properties.ValueMember = "LOCATION_KEY"; }
/// <summary> /// 绑定数据表数据 /// </summary> public void BindGridViewSource() { string operations = PropertyService.Get(PROPERTY_FIELDS.OPERATIONS); //string stores = PropertyService.Get(PROPERTY_FIELDS.STORES); //获取用户拥有权限的工厂名称 DataTable dt2 = FactoryUtils.GetFactoryRoomByStores(PropertyService.Get(PROPERTY_FIELDS.STORES)); OperationHandover _operationHandover = new OperationHandover(); gdcData.MainView = gdvHandOverTheWatch; DataSet ds = _operationHandover.GetOperationHandoverBySAndF(operations, dt2); gdcData.DataSource = ds.Tables.Count > 0 ? ds.Tables[0] : null; }
/// <summary> /// 绑定工厂车间 /// </summary> public void BindFactoryRoom() { #region //绑定工厂车间名称 DataTable dt2 = FactoryUtils.GetFactoryRoomByStores(PropertyService.Get(PROPERTY_FIELDS.STORES)); //绑定工厂车间数据到窗体控件。 lpFacName.Properties.DataSource = dt2; lpFacName.Properties.DisplayMember = "LOCATION_NAME"; lpFacName.Properties.ValueMember = "LOCATION_KEY"; //表中有数据,设置窗体控件的默认索引为0。 if (dt2.Rows.Count > 0) { lpFacName.ItemIndex = 0; } #endregion }
/// <summary> /// 通过用户拥有的线边仓获取工厂名称到控件中 /// </summary> public void GetFacRoomByStores() { #region //绑定工厂车间名称 DataTable dt2 = FactoryUtils.GetFactoryRoomByStores(PropertyService.Get(PROPERTY_FIELDS.STORES)); dt2.Rows.InsertAt(dt2.NewRow(), 0); //绑定工厂车间数据到窗体控件。 lupFactoryRoom.Properties.DataSource = dt2; lupFactoryRoom.Properties.DisplayMember = "LOCATION_NAME"; lupFactoryRoom.Properties.ValueMember = "LOCATION_KEY"; //线别表中有数据,设置窗体控件的默认索引为0。 if (dt2.Rows.Count > 0) { lupFactoryRoom.ItemIndex = -1; } #endregion }
/// <summary> /// 查询交接班记录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbSelect_Click(object sender, EventArgs e) { HandOverTheWatchDialog handOverTheWatchDialog = new HandOverTheWatchDialog(); if (handOverTheWatchDialog.ShowDialog() == DialogResult.OK) { SetRetrunToDefine(handOverTheWatchDialog); string operations = PropertyService.Get(PROPERTY_FIELDS.OPERATIONS); //string stores = PropertyService.Get(PROPERTY_FIELDS.STORES); //获取用户拥有权限的工厂名称 DataTable dt2 = FactoryUtils.GetFactoryRoomByStores(PropertyService.Get(PROPERTY_FIELDS.STORES)); OperationHandover _operationHandover = new OperationHandover(); gdcData.MainView = gdvHandOverTheWatch; //查询 DataSet ds = _operationHandover.GetOperationHandoverByReturn(_lupFactoryRoom, _cmbGongXuName, _lupJiaoBanShife, _lupJieBanShife, _timJiaoBanStart, _timJiaoBanEnd, _lupZhuangTai, operations, dt2); gdcData.DataSource = ds.Tables.Count > 0 ? ds.Tables[0] : null; } }
//数据绑定------------------------------------------------------------------------------- /// <summary> /// 绑定工厂车间。 /// </summary> private void BindFactoryRoom() { string stores = PropertyService.Get(PROPERTY_FIELDS.STORES); DataTable dt = FactoryUtils.GetFactoryRoomByStores(stores); string[] columns = new string[] { "MESDATASOURCE", "ERPFACTORY" }; KeyValuePair <string, string> category = new KeyValuePair <string, string>("CATEGORY_NAME", "MEScontrastERP"); DataTable dtFac = BaseData.Get(columns, category); for (int i = 0; i < dt.Rows.Count; i++) { DataRow drF = dt.Rows[i]; for (int j = 0; j < dtFac.Rows.Count; j++) { DataRow drFac = dtFac.Rows[j]; if (drFac["MESDATASOURCE"].ToString().Trim() == drF["LOCATION_NAME"].ToString().Trim()) { this.cbeWerks.Text = drFac["ERPFACTORY"].ToString(); } } } }
private void UseMaterialDialog_Load(object sender, EventArgs e) { //绑定工序 #region Bind Operation string operations = PropertyService.Get(PROPERTY_FIELDS.OPERATIONS); if (operations.Length > 0) { string[] strOperations = operations.Split(','); cmbGongXuName.Properties.Items.Add(""); for (int i = 0; i < strOperations.Length; i++) { cmbGongXuName.Properties.Items.Add(strOperations[i]); } this.cmbGongXuName.SelectedIndex = -1; } #endregion //绑定线边仓 #region Bind Operation string STORE = PropertyService.Get(PROPERTY_FIELDS.STORES); if (STORE.Length > 0) { string[] strOperations = STORE.Split(','); cmbLineCang.Properties.Items.Add(""); for (int i = 0; i < strOperations.Length; i++) { cmbLineCang.Properties.Items.Add(strOperations[i]); } this.cmbLineCang.SelectedIndex = -1; } #endregion #region //绑定工厂车间名称 DataTable dt2 = FactoryUtils.GetFactoryRoomByStores(PropertyService.Get(PROPERTY_FIELDS.STORES)); dt2.Rows.InsertAt(dt2.NewRow(), 0); //绑定工厂车间数据到窗体控件。 cmbFactoryRoomName.Properties.DataSource = dt2; cmbFactoryRoomName.Properties.DisplayMember = "LOCATION_NAME"; cmbFactoryRoomName.Properties.ValueMember = "LOCATION_KEY"; //线别表中有数据,设置窗体控件的默认索引为0。 if (dt2.Rows.Count > 0) { cmbFactoryRoomName.ItemIndex = -1; } #endregion #region /// <summary> /// 绑定班别信息 /// </summary> string[] columns = new string[] { "CODE" }; KeyValuePair <string, string> category = new KeyValuePair <string, string>("CATEGORY_NAME", "Basic_Shift"); DataTable dt1 = BaseData.Get(columns, category); dt1.Rows.InsertAt(dt1.NewRow(), 0); this.cmbBanCi.Properties.DataSource = dt1; this.cmbBanCi.Properties.DisplayMember = "CODE"; this.cmbBanCi.Properties.ValueMember = "CODE"; this.cmbBanCi.ItemIndex = -1; //GetNowShift(); #endregion }