/// <summary> /// 设置工厂车间主键。 /// </summary> private void SetFactoryRoomKey() { string code = PropertyService.Get(PROPERTY_FIELDS.FACTORY_CODE); LocationEntity entity = new LocationEntity(); if (!string.IsNullOrEmpty(code)) { DataSet ds = entity.GetFactoryRoom(code); if (string.IsNullOrEmpty(entity.ErrorMsg)) { if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { _factoryRoomKey = Convert.ToString(ds.Tables[0].Rows[0][FMM_LOCATION_FIELDS.FIELD_LOCATION_KEY]); } else { _factoryRoomKey = code; } } else { MessageBox.Show(entity.ErrorMsg); _factoryRoomKey = code; } } }