public DataSet GetByProductInf(DataSet dsreturn) { DataSet dsReturn = new DataSet(); try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (null != serverFactory) { //dsReturn = serverFactory.CreateIByProductEngine().GetByProductInf(dsreturn); dsReturn = serverFactory.Get <IByProductEngine>().GetByProductInf(dsreturn); _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); } } catch (Exception ex) { _errorMsg = ex.Message; } finally { CallRemotingService.UnregisterChannel(); } return(dsReturn); }
/// <summary>通过参数名获取材料耗用设定基础表参数信息 /// 通过参数名获取参数信息 /// </summary> /// <param name="parameter">参数名</param> /// <returns></returns> public DataSet GetInfByParameter(string parameter) { DataSet dsReturn = new DataSet(); try { //创建远程调用的工厂对象。 IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (null != serverFactory) { dsReturn = serverFactory.CreateIMaterialBuckleControlEngine().GetInfByParameter(parameter); _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); } } catch (Exception ex) { _errorMsg = ex.Message; } finally { CallRemotingService.UnregisterChannel(); } return(dsReturn); }
public bool SaveDecayCoeffiData(DataSet dsDecayCoeffi) { try { _errorMsg = string.Empty; IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); DataSet dsReturn = serverFactory.CreateIDecayCoeffiEngine().SaveDecayCoeffiData(dsDecayCoeffi); _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); if (!string.IsNullOrEmpty(_errorMsg)) { return(false); } } catch (Exception ex) { _errorMsg = ex.Message; return(false); } finally { CallRemotingService.UnregisterChannel(); } return(true); }
//保存更新数据 public bool Save(string strRetMatNo, string strRetMatDate, string strShift, string strOperator, string strRetMatReason, DataTable dtMatLotList) { bool blReturn = false; try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (null != serverFactory) { blReturn = serverFactory.CreateIWOMaterialReturnEngine().Save(strRetMatNo, strRetMatDate, strShift, strOperator, strRetMatReason, dtMatLotList); // _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); } } catch (Exception ex) { _errorMsg = ex.Message; } finally { CallRemotingService.UnregisterChannel(); } return(blReturn); }
public DataSet GetLinesAndLocationLine() { #region variable define DataSet dsReturn = new DataSet(); DataSet dsFrom = new DataSet(); DataTable dataTable = new DataTable(); Hashtable hashTable = new Hashtable(); hashTable.Add(FMM_LOCATION_LINE_FIELDS.FIELD_LOCATION_KEY, _locationKey); dataTable = FanHai.Hemera.Share.Common.CommonUtils.ParseToDataTable(hashTable); dataTable.TableName = FMM_LOCATION_LINE_FIELDS.DATABASE_TABLE_NAME; dsFrom.Tables.Add(dataTable); #endregion #region detail deal try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (null != serverFactory) { dsReturn = serverFactory.CreateILocationEngine().GetLinesAndLocationLine(dsFrom); _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); } } catch (Exception ex) { _errorMsg = ex.Message; } finally { CallRemotingService.UnregisterChannel(); } return(dsReturn); #endregion }
public DataSet GetBaseParamsByCategory() { DataSet dsReturn = null; try { _msg = string.Empty; IServerObjFactory factor = CallRemotingService.GetRemoteObject(); if (null != factor) { dsReturn = factor.CreateIParamEngine().GetBaseParamsByCategory(); _msg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); } } catch (Exception ex) { _msg = ex.Message; } finally { CallRemotingService.UnregisterChannel(); } return(dsReturn); }
/// <summary> /// Execute Factory Engine Method from Remoting Server /// </summary> /// <param name="engineName"></param> /// <param name="engineMethod"></param> /// <param name="engineParamValue"></param> /// <param name="msg"></param> /// <returns></returns> /// Owner:Andy Gao 2011-07-12 08:14:19 public static DataSet ExecuteEngineMethod(string engineName, string engineMethod, DataSet engineParamValue, out string msg) { msg = string.Empty; DataSet resDS = null; #region Call Remoting Interface try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (serverFactory == null) { msg = "The Server Factory is null."; } else { resDS = serverFactory.ExecuteEngineMethod(engineName, engineMethod, engineParamValue); msg = resDS.ExtendedProperties.ContainsKey(PARAMETERS.OUTPUT_MESSAGE) ? resDS.ExtendedProperties[PARAMETERS.OUTPUT_MESSAGE].ToString() : string.Empty; } } catch (Exception ex) { msg = ex.Message; } finally { CallRemotingService.UnregisterChannel(); } #endregion return(resDS); }
/// <summary> /// 根据条件获取工单数据。 /// </summary> /// <param name="strFactory">工厂名称。</param> /// <param name="strWorkOrderNo">工单号。左匹配。</param> /// <param name="strPart">成品料号。左匹配。</param> /// <param name="strType">成品类型。</param> /// <param name="strStore">入库库位。</param> /// <param name="strStatus">状态。</param> /// <returns>包含工单数据的数据集。</returns> public DataSet GetWorkOrderByCondition(string strFactory, string strWorkOrderNo, string strPart, string strType, string strStore, string strStatus, ref PagingQueryConfig config) { DataSet dsReturn = new DataSet(); try { //调用远程对象 IServerObjFactory factor = CallRemotingService.GetRemoteObject(); if (null != factor) { dsReturn = factor.CreateIWorkOrders().GetWorkOrderByCondition(strFactory, strWorkOrderNo, strPart, strType, strStore, strStatus, ref config); string returnMessage = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); //若返回错误消息,则显示 if (returnMessage.Length > 0) { MessageService.ShowError(returnMessage); } else { return(dsReturn); } } } catch (Exception e) { MessageService.ShowError(e); } finally { //注销通道 CallRemotingService.UnregisterChannel(); } return(dsReturn); }
/// <summary> /// Execute SAP Remote Function Call from Remoting Server /// </summary> /// <param name="functionName"></param> /// <param name="inputData"></param> /// <param name="msg"></param> /// <returns></returns> /// Owner:Andy Gao 2011-05-31 10:39:48 public static DataSet ExecuteRFC(string functionName, DataSet inputData, out string msg) { msg = string.Empty; DataSet outputData = null; #region Call Remoting Interface try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (serverFactory == null) { msg = "The Server Factory is null."; } else { outputData = serverFactory.CreateIRFCEngine().ExecuteRFC(functionName, inputData); msg = ReturnMessageUtils.GetServerReturnMessage(outputData); } } catch (Exception ex) { msg = ex.Message; } finally { CallRemotingService.UnregisterChannel(); } #endregion return(outputData); }
public bool updateTemplate(string prodId, string template, string editor, string editTime) { bool flag = false; try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (null != serverFactory) { flag = serverFactory.CreateINameplateLabelAutoPrintEngine().updateTemplate(prodId, template, editor, editTime); } } catch (Exception ex) { _errorMsg = ex.Message; flag = false; } finally { CallRemotingService.UnregisterChannel(); } return(flag); }
public bool SaveRptPlanAimData(DataSet dsSave) { bool blBack = false; try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); DataSet dsReturn = serverFactory.CreateIRptCommonEngine().SaveRptPlanAimData(dsSave); _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); if (string.IsNullOrEmpty(_errorMsg)) { blBack = true; } } catch (Exception ex) { _errorMsg = ex.Message; } finally { CallRemotingService.UnregisterChannel(); } return(blBack); }
/// <summary> /// 记录用户登出信息。 /// </summary> public void LogUserLogoutInfo() { string loginLogKey = PropertyService.Get(PROPERTY_FIELDS.LOGIN_LOG_KEY); if (!string.IsNullOrEmpty(loginLogKey)) { try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (serverFactory != null) { serverFactory.CreateIUserEngine().LogUserLogoutInfo(loginLogKey); } } catch { //TODO: Ignore Generant Exception. } finally { CallRemotingService.UnregisterChannel(); } } }
public bool IsExistPowerSetData(DataTable dtInsertPowerSetData) { try { _errorMsg = string.Empty; IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); DataSet dsReturn = serverFactory.CreateIBasicPowerSetEngine().IsExistPowerSetData(dtInsertPowerSetData); _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); if (!string.IsNullOrEmpty(_errorMsg)) { return(false); } } catch (Exception ex) { _errorMsg = ex.Message; return(false); } finally { CallRemotingService.UnregisterChannel(); } return(true); }
/// <summary> /// 根据线边仓主键,查出线边仓信息和区域名称 /// </summary> /// <returns></returns> public DataSet GetStore() { DataSet dsReturn = new DataSet(); try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (null != serverFactory) { //调用远程对象的取得线边仓信息的方法 dsReturn = serverFactory.CreateIStoreEngine().GetStore(_storeKey); _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); } } catch (Exception ex) { _errorMsg = ex.Message; } finally { CallRemotingService.UnregisterChannel(); } return(dsReturn); }
public bool SaveEdcMainInfo(string LotKey, string edcPointKey) { bool bResult = false; try { IServerObjFactory factor = CallRemotingService.GetRemoteObject(); //DataSet dsReturn = factor.CreateIEDCEngine().SaveEdcMainInfo(null,LotKey, edcPointKey, PropertyService.Get(PROPERTY_FIELDS.USER_NAME),"","",""); //_errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); //if (_errorMsg == string.Empty) //{ // bResult = true; //} } catch (Exception ex) { MessageService.ShowError("SaveEdcMainInfo Error" + ex.Message); } finally { CallRemotingService.UnregisterChannel(); } return(bResult); }
public override bool Insert() { bool bResult = false; DataSet dataSet = new DataSet(); DataTable dtComputerConf = CreateDataTableForInsert(); Dictionary <string, string> dataRow = new Dictionary <string, string>() { { COMPUTER_FIELDS.FIELDS_CODE_KEY, _codeKey }, { COMPUTER_FIELDS.FIELDS_COMPUTER_NAME, _computerName.ToUpper() }, { COMPUTER_FIELDS.FIELDS_EDITOR, PropertyService.Get(PROPERTY_FIELDS.USER_NAME) }, { COMPUTER_FIELDS.FIELDS_DESCRIPTION, _computerDesc.ToUpper() } }; FanHai.Hemera.Utils.Common.Utils.AddRowDataToDataTable(ref dtComputerConf, dataRow); if (dtComputerConf.Rows.Count > 0) { dataSet.Tables.Add(dtComputerConf); } // WorkOrder UDAs if (_UDAs.UserDefinedAttrList.Count > 0) { DataTable dtUDAs = DataTableHelper.CreateDataTableForUDA(COMPUTER_ATTR_FIELDS.DATABASE_TABLE_NAME, COMPUTER_ATTR_FIELDS.FIELDS_COMPUTER_KEY); _UDAs.ParseInsertDataToDataTable(ref dtUDAs); if (dtUDAs.Rows.Count > 0) { dataSet.Tables.Add(dtUDAs); } } try { IServerObjFactory factor = CallRemotingService.GetRemoteObject(); if (null != factor) { if (dataSet.Tables.Count > 0) { DataSet retDS = factor.CreateIComputerEngine().AddComputer(dataSet); string strMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(retDS); if (strMsg.Length < 1) { foreach (UserDefinedAttr uda in _UDAs.UserDefinedAttrList) { uda.OperationAction = OperationAction.Update; } this.ResetDirtyList(); bResult = true; } else { MessageService.ShowError(strMsg); } } else { MessageService.ShowWarning("No dataTable in input parameter"); } } } catch (Exception e) { MessageService.ShowError(e.Message); } finally { CallRemotingService.UnregisterChannel(); } return(bResult); }
/// <summary> /// Load Equipment State Type Data 绑定设备状态类型的值 /// </summary> private void LoadEquipmentStateTypeData() { #region Variables DataSet reqDS = new DataSet(); DataSet resDS = new DataSet(); #endregion #region Build Input Parameters //GetTwoColumnsDataTable返回值为数据表包含2列 Key 和 Value DataTable dataTable = AddinCommonStaticFunction.GetTwoColumnsDataTable(); dataTable.TableName = TRANS_TABLES.TABLE_PARAM; //表名PARAM dataTable.Rows.Add(new object[] { "CODE", EMS_EQUIPMENT_STATES_FIELDS.FIELD_EQUIPMENT_STATE_TYPE }); //EQUIPMENT_STATE_TYPE状态类型 dataTable.Rows.Add(new object[] { "CATEGORY", EMS_EQUIPMENT_STATES_FIELDS.FIELD_EQUIPMENT_STATE_CATEGORY }); //EQUIPMENT_STATE_CATEGORY设备状态分类 //对datatable进行更改 dataTable.AcceptChanges(); //将数据表添加到数据集reqDS中 reqDS.Tables.Add(dataTable); #endregion #region Call Remoting Interface try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (serverFactory != null) { //获取基础数据的设备状态类型 resDS = serverFactory.CreateICrmAttributeEngine().GetSpecifyAttributeData(reqDS); } } catch (Exception ex) { MessageService.ShowError(ex); return; } finally { CallRemotingService.UnregisterChannel(); } #endregion #region Process Output Parameters string returnMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(resDS); if (string.IsNullOrEmpty(returnMsg)) { //绑定设备状态类型下拉列表的数据 BindDataToStateTypeList(resDS.Tables[TRANS_TABLES.TABLE_UDAS]); } else { MessageService.ShowError(returnMsg); } #endregion }
/// <summary> /// Update Operation Equipments Data /// </summary> /// <returns></returns> /// Owner:Andy Gao 2010-08-11 16:05:22 private bool UpdateOperationEquipmentsData() { #region Variables DataSet reqDS = new DataSet(); DataSet resDS = new DataSet(); #endregion #region Build Equipment Change Reasons Data if (this.grdEquipments.DataSource != null && this.grdEquipments.DataSource is DataTable) { DataTable equipmentsDataTable = (DataTable)this.grdEquipments.DataSource; DataTable addedDataTable = equipmentsDataTable.GetChanges(DataRowState.Added); DataTable modifiedDataTable = equipmentsDataTable.GetChanges(DataRowState.Modified); DataTable deletedDataTable = equipmentsDataTable.GetChanges(DataRowState.Deleted); if ((addedDataTable != null && addedDataTable.Rows.Count > 0) || (modifiedDataTable != null && modifiedDataTable.Rows.Count > 0) || (deletedDataTable != null && deletedDataTable.Rows.Count > 0)) { equipmentsDataTable.TableName = EMS_OPERATION_EQUIPMENT_FIELDS.DATABASE_TABLE_NAME; reqDS.Tables.Add(equipmentsDataTable.Copy()); } else { MessageService.ShowMessage("${res:FanHai.Hemera.Addins.EMS.OperationEquipments.M0002}", "${res:Global.SystemInfo}"); return(false); } } #endregion #region Call Remoting Interface try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (serverFactory != null) { resDS = serverFactory.CreateIOperationEquipments().UpdateOperationEquipments(reqDS); } } catch (Exception ex) { MessageService.ShowError(ex); return(false); } finally { CallRemotingService.UnregisterChannel(); } #endregion #region Process Output Parameters string returnMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(resDS); if (string.IsNullOrEmpty(returnMsg)) { return(true); } else { MessageService.ShowError(returnMsg); return(false); } #endregion }
/// <summary> /// Load Operations Data /// </summary> /// <param name="operationName"></param> /// Owner:Andy Gao 2010-08-11 11:19:37 private void LoadOperationsData(string operationName) { #region Variables DataSet reqDS = new DataSet(); DataSet resDS = new DataSet(); #endregion #region Call Remoting Interface try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (serverFactory != null) { int pages; int records; int pageNo = this.paginationOperations.PageNo; int pageSize = this.paginationOperations.PageSize; if (pageNo <= 0) { pageNo = 1; } if (pageSize <= 0) { pageSize = PaginationControl.DEFAULT_PAGESIZE; } resDS = serverFactory.CreateIOperationEngine().GetOperations(reqDS, operationName, pageNo, pageSize, out pages, out records); if (pages > 0 && records > 0) { this.paginationOperations.PageNo = pageNo > pages ? pages : pageNo; this.paginationOperations.PageSize = pageSize; this.paginationOperations.Pages = pages; this.paginationOperations.Records = records; } else { this.paginationOperations.PageNo = 0; this.paginationOperations.PageSize = PaginationControl.DEFAULT_PAGESIZE; this.paginationOperations.Pages = 0; this.paginationOperations.Records = 0; } } } catch (Exception ex) { MessageService.ShowError(ex); return; } finally { CallRemotingService.UnregisterChannel(); } #endregion #region Process Output Parameters string returnMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(resDS); if (string.IsNullOrEmpty(returnMsg)) { BindDataToOperationsGrid(resDS.Tables[POR_ROUTE_OPERATION_VER_FIELDS.DATABASE_TABLE_NAME]); } else { MessageService.ShowError(returnMsg); } #endregion }
/// <summary> /// Send insert data to server /// </summary> /// <returns>bool</returns> public override bool Insert() { DataSet dataSet = new DataSet(); //Add basic data DataTable enterpriseTable = DataTableHelper.CreateDataTableForInsertEnterprise(); Dictionary <string, string> dataRow = new Dictionary <string, string>() { { POR_ROUTE_ENTERPRISE_VER_FIELDS.FIELD_ROUTE_ENTERPRISE_VER_KEY, _enterpriseKey }, { POR_ROUTE_ENTERPRISE_VER_FIELDS.FIELD_ENTERPRISE_NAME, _enterpriseName }, { POR_ROUTE_ENTERPRISE_VER_FIELDS.FIELD_DESCRIPTION, _enterpriseDescription }, { POR_ROUTE_ENTERPRISE_VER_FIELDS.FIELD_ENTERPRISE_STATUS, Convert.ToInt32(_enterpriseStatus).ToString() }, { COMMON_FIELDS.FIELD_COMMON_CREATOR, PropertyService.Get(PROPERTY_FIELDS.USER_NAME) }, { COMMON_FIELDS.FIELD_COMMON_EDITOR, PropertyService.Get(PROPERTY_FIELDS.USER_NAME) } }; FanHai.Hemera.Utils.Common.Utils.AddRowDataToDataTable(ref enterpriseTable, dataRow); dataSet.Tables.Add(enterpriseTable); if (enterpriseList.Count > 0) { DataTable relationTable = DataTableHelper.CreateDataTableForInsertEpAndRtRelation(); foreach (Enterprises enterprises in enterpriseList) { enterprises.EnterpriseKey = _enterpriseKey; enterprises.ParseInsertAndDeleteDataToDataTable(ref relationTable); } if (relationTable.Rows.Count > 0) { dataSet.Tables.Add(relationTable); } } try { int code = 0; string msg = string.Empty; DataSet dsReturn = null; IServerObjFactory factor = CallRemotingService.GetRemoteObject(); if (null != factor) { dsReturn = factor.CreateIEnterpriseEngine().EnterpriseInsert(dataSet); msg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn, ref code); if (code == -1) { MessageService.ShowError(msg); return(false); } else { this.EnterpriseVersion = msg; this.ResetDirtyList(); foreach (Enterprises enterprises in enterpriseList) { enterprises.IsInitializeFinished = true; } MessageService.ShowMessage("${res:Global.SuccessMessage}", "${res:Global.SystemInfo}"); } } } catch (Exception ex) { MessageService.ShowError(ex); } finally { CallRemotingService.UnregisterChannel(); } return(true); }
/// <summary> /// control status function /// </summary> public override bool UpdateStatus() { if (IsDirty) { DataSet dataSet = new DataSet(); if (this.DirtyList.Count > 0) { DataTable enterpriseTable = DataTableHelper.CreateDataTableForUpdateBasicData(POR_ROUTE_ENTERPRISE_VER_FIELDS.DATABASE_TABLE_NAME); List <string> possibleDirtyFields = new List <string>() { POR_ROUTE_ENTERPRISE_VER_FIELDS.FIELD_EDITOR, POR_ROUTE_ENTERPRISE_VER_FIELDS.FIELD_EDIT_TIME, POR_ROUTE_ENTERPRISE_VER_FIELDS.FIELD_EDIT_TIMEZONE, POR_ROUTE_ENTERPRISE_VER_FIELDS.FIELD_ENTERPRISE_STATUS }; string newValue = string.Empty; foreach (string field in possibleDirtyFields) { if (this.DirtyList.ContainsKey(field)) { Dictionary <string, string> rowData = new Dictionary <string, string>() { { COMMON_FIELDS.FIELD_COMMON_UPDATE_KEY, _enterpriseKey }, { COMMON_FIELDS.FIELD_COMMON_UPDATE_NAME, field }, { COMMON_FIELDS.FIELD_COMMON_UPDATE_OLD_VALUE, this.DirtyList[field].FieldOriginalValue }, { COMMON_FIELDS.FIELD_COMMON_UPDATE_NEW_VALUE, this.DirtyList[field].FieldNewValue } }; FanHai.Hemera.Utils.Common.Utils.AddRowDataToDataTable(ref enterpriseTable, rowData); } } if (enterpriseTable.Rows.Count > 0) { dataSet.Tables.Add(enterpriseTable); } } try { string msg = string.Empty; DataSet dsReturn = null; IServerObjFactory factor = CallRemotingService.GetRemoteObject(); if (null != factor) { dsReturn = factor.CreateIEnterpriseEngine().EnterpriseUpdate(dataSet); msg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); if (msg != string.Empty) { MessageService.ShowError(msg); return(false); } else { this.ResetDirtyList(); MessageService.ShowMessage("${res:Global.UpdateStatusMessage}", "${res:Global.SystemInfo}"); } } } catch (Exception ex) { MessageService.ShowError(ex); } finally { CallRemotingService.UnregisterChannel(); } } return(true); }
public override bool Delete() { #region Variables DataSet reqDS = new DataSet(); DataSet resDS = new DataSet(); #endregion #region Build Input Parameters if (!string.IsNullOrEmpty(equipmentKey)) { DataTable inputParamDataTable = PARAMETERS_INPUT.CreateDataTable(); object inputKey = DBNull.Value; object inputEditor = DBNull.Value; object inputEditTime = DBNull.Value; if (!string.IsNullOrEmpty(equipmentKey)) { inputKey = equipmentKey; } if (!string.IsNullOrEmpty(Editor)) { inputEditor = Editor; } if (!string.IsNullOrEmpty(EditTime)) { inputEditTime = EditTime; } inputParamDataTable.Rows.Add(new object[] { inputKey, inputEditor, inputEditTime }); inputParamDataTable.AcceptChanges(); reqDS.Tables.Add(inputParamDataTable); } #endregion #region Call Remoting Interface try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (serverFactory != null) { resDS = serverFactory.CreateIEquipments().DeleteEquipments(reqDS); } } catch (Exception ex) { MessageService.ShowError(ex); return(false); } finally { CallRemotingService.UnregisterChannel(); } #endregion #region Process Output Parameters string returnMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(resDS); if (string.IsNullOrEmpty(returnMsg)) { return(true); } else { MessageService.ShowError(returnMsg); return(false); } #endregion }
public override bool Update() { #region Variables DataSet reqDS = new DataSet(); DataSet resDS = new DataSet(); #endregion #region Build Input Parameters if (!string.IsNullOrEmpty(equipmentKey)) { DataTable inputParamDataTable = PARAMETERS_INPUT.CreateDataTable(); object inputKey = DBNull.Value; object inputEditor = DBNull.Value; object inputEditTime = DBNull.Value; if (!string.IsNullOrEmpty(equipmentKey)) { inputKey = equipmentKey; } if (!string.IsNullOrEmpty(Editor)) { inputEditor = Editor; } if (!string.IsNullOrEmpty(EditTime)) { inputEditTime = EditTime; } inputParamDataTable.Rows.Add(new object[] { inputKey, inputEditor, inputEditTime }); inputParamDataTable.AcceptChanges(); reqDS.Tables.Add(inputParamDataTable); } #endregion #region Build Equipment Data this.DirtyList.Add(EMS_EQUIPMENTS_FIELDS.FIELD_EDIT_TIME, new DirtyItem(EMS_EQUIPMENTS_FIELDS.FIELD_EDIT_TIME, "", "")); Editor = PropertyService.Get(PROPERTY_FIELDS.USER_NAME); EditTimeZone = PropertyService.Get(PROPERTY_FIELDS.TIMEZONE); DataTable equipmentsDataTable = EMS_EQUIPMENTS_FIELDS.CreateDataTable(); FanHai.Hemera.Utils.Common.Utils.AddKeyValuesToDataTable(ref equipmentsDataTable, DirtyList); equipmentsDataTable.AcceptChanges(); reqDS.Tables.Add(equipmentsDataTable); #endregion #region Call Remoting Interface try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (serverFactory != null) { resDS = serverFactory.CreateIEquipments().UpdateEquipments(reqDS); } } catch (Exception ex) { MessageService.ShowError(ex); return(false); } finally { CallRemotingService.UnregisterChannel(); } #endregion #region Process Output Parameters string outputEditTime = string.Empty; string returnMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(resDS, ref outputEditTime); if (string.IsNullOrEmpty(returnMsg)) { EditTime = outputEditTime; return(true); } else { MessageService.ShowError(returnMsg); return(false); } #endregion }
public override bool Insert(DataSet ds) { #region Variables DataSet reqDS = new DataSet(); DataSet resDS = new DataSet(); #endregion #region Build Equipment Data DataTable equipmentsDataTable = EMS_EQUIPMENTS_FIELDS.CreateDataTable(); Dictionary <string, string> dataRow = new Dictionary <string, string>() { { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_KEY, equipmentKey }, { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_NAME, equipmentName }, { EMS_EQUIPMENTS_FIELDS.FIELD_DESCRIPTION, description }, { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_CODE, equipmentCode }, { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_MODE, equipmentMode }, { EMS_EQUIPMENTS_FIELDS.FIELD_MAXQUANTITY, maxQuantity }, { EMS_EQUIPMENTS_FIELDS.FIELD_MINQUANTITY, minQuantity }, { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_TYPE, equipmentType }, { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_GROUP_KEY, equipmentGroupKey }, { EMS_EQUIPMENTS_FIELDS.FIELD_LOCATION_KEY, equipmentLocationKey }, { EMS_EQUIPMENTS_FIELDS.FIELD_ISBATCH, isBatch }, { EMS_EQUIPMENTS_FIELDS.FIELD_ISCHAMBER, IsChamber }, { EMS_EQUIPMENTS_FIELDS.FIELD_CHAMBER_INDEX, chamberIndex }, { EMS_EQUIPMENTS_FIELDS.FIELD_CHAMBER_TOTAL, chamberTotal }, { EMS_EQUIPMENTS_FIELDS.FIELD_ISMULTICHAMBER, isMultiChamber }, { EMS_EQUIPMENTS_FIELDS.FIELD_PARENT_EQUIPMENT_KEY, parentEquipmentKey }, { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_STATE_KEY, equipmentStateKey }, { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_CHANGE_STATE_KEY, equipmentChangeStateKey }, { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_REAL_KEY, equipmentRealKey }, { EMS_EQUIPMENTS_FIELDS.FIELD_CREATOR, Creator }, { EMS_EQUIPMENTS_FIELDS.FIELD_CREATE_TIMEZONE_KEY, CreateTimeZone }, { EMS_EQUIPMENTS_FIELDS.FIELD_CREATE_TIME, string.Empty }, { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_ASSETSNO, equipment_assetsno }, { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_AV_TIME, equipment_av_time }, { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_WPH, equipment_wph }, { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_TRACT_TIME, equipment_tract_time } }; FanHai.Hemera.Utils.Common.Utils.AddKeyValuesToDataTable(ref equipmentsDataTable, dataRow); equipmentsDataTable.AcceptChanges(); //reqDS.Tables.Add(equipmentsDataTable); ds.Tables.Add(equipmentsDataTable); #endregion #region Build Input Parameters if (!string.IsNullOrEmpty(equipmentKey)) { DataTable inputParamDataTable = PARAMETERS_INPUT.CreateDataTable(); object inputKey = DBNull.Value; object inputEditor = DBNull.Value; object inputEditTime = DBNull.Value; if (!string.IsNullOrEmpty(equipmentKey)) { inputKey = equipmentKey; } if (!string.IsNullOrEmpty(Creator)) { inputEditor = Creator; } if (!string.IsNullOrEmpty(CreateTime)) { inputEditTime = CreateTime; } inputParamDataTable.Rows.Add(new object[] { inputKey, inputEditor, inputEditTime }); inputParamDataTable.AcceptChanges(); //reqDS.Tables.Add(inputParamDataTable); ds.Tables.Add(inputParamDataTable); } #endregion #region Call Remoting Interface try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (serverFactory != null) { resDS = serverFactory.CreateIEquipments().InsertEquipments(ds); } } catch (Exception ex) { MessageService.ShowError(ex); return(false); } finally { CallRemotingService.UnregisterChannel(); } #endregion #region Process Output Parameters string outputcreateTime = string.Empty; string returnMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(resDS, ref outputcreateTime); if (string.IsNullOrEmpty(returnMsg)) { CreateTime = outputcreateTime; return(true); } else { MessageService.ShowError(returnMsg); return(false); } #endregion }
private void edCabinetNO_Leave(object sender, EventArgs e) { if (string.IsNullOrEmpty(edCabinetNO.Text) == true) { return; } string msg = string.Empty; try { if (dsCabinet != null) { if (dsCabinet.Tables.Count > 0) { if (dsCabinet.Tables.Contains("CabinetData") == true) { DataRow[] CheckCabinet = dsCabinet.Tables["CabinetData"].Select("CONTAINER_CODE <> '" + edCabinetNO.Text + "'"); if (CheckCabinet.Length > 0) { if (MessageBox.Show(this, "柜号与您上次所输入的柜号不符,是否重新刷柜?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { if (MessageBox.Show(this, "重新刷柜将清除所有刷柜信息,请再次确认!", "操作提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { if (ClearCabinetInfo() == false) { return; } } } } } } } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); dsCabinet = serverFactory.Get <IPickOperationEngine>().GetCabinetData(edCabinetNO.Text, out msg); if (msg != "") { MessageBox.Show(this, msg, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } finally { CallRemotingService.UnregisterChannel(); } }
private void toolStripButton1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(TBVbeln.Text)) { MessageBox.Show(this, "请输入销售订单号!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } ClearDataset(); string rfcFuntionName = "ZAST_GET_SO"; IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (null != serverFactory) { IRFCEngine rfcCallObj = serverFactory.Get <IRFCEngine>(); DataSet dsParams = new DataSet(); dsParams.ExtendedProperties.Add("WK_VBELN", this.TBVbeln.Text); ds = rfcCallObj.ExecuteRFC(rfcFuntionName, dsParams); } if (ds.Tables["RT_VBAP"].Rows.Count <= 0) { MessageBox.Show(this, "没有查询到你所要的数据,请核对查询条件!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } addCol(ds.Tables["RT_VBAP"], "Sapqty", typeof(float)); addCol(ds.Tables["RT_VBAP"], "OutBQty", typeof(float)); addCol(ds.Tables["RT_VBAP"], "CI", typeof(string)); addCol(ds.Tables["RT_VBAP"], "ShipmentType", typeof(string)); addCol(ds.Tables["RT_VBAP"], "ShipmentNo", typeof(string)); addCol(ds.Tables["RT_CUSTOMER_RQ"], "DEC", typeof(string)); addCol(ds.Tables["RT_CUSTOMER_RQ"], "FATNAM", typeof(string)); addCol(ds.Tables["RT_AUSP"], "DEC", typeof(string)); addCol(ds.Tables["RT_AUSP"], "FATNAM", typeof(string)); addCol(ds.Tables["RT_VBAP"], "CONTAINER_CODE", typeof(string)); addCol(ds.Tables["RT_VBAP"], "CONTAINER_KEY", typeof(string)); addCol(ds.Tables["RT_VBAP"], "PALLET", typeof(string)); foreach (DataRow DR in ds.Tables["RT_VBAP"].Rows) { DR["Sapqty"] = float.Parse(DR["KWMENG"].ToString()); DR["OutBQty"] = 0; DR["PALLET"] = ""; } try { DataSet dsATINN = new DataSet(); serverFactory = CallRemotingService.GetRemoteObject(); dsATINN = serverFactory.Get <IPickOperationEngine>().GetCRRelation(); //foreach (DataRow dr in dsATINN.Tables["AWMS_ATINN"].Rows) //{ // DataRow[] drmatrix = ds.Tables["RT_CUSTOMER_RQ"].Select(" ATINN = '" + dr["ATINN"].ToString() + "'"); // foreach ( DataRow dm in drmatrix ) // { // dm["ATINN"] = dr["ATNAM"].ToString(); // dm["FATNAM"] = dr["FATNAM"].ToString(); // dm["DEC"] = dr["DEC"].ToString(); // } //} //foreach (DataRow dr in ds.Tables["RT_CUSTOMER_RQ"].Rows) //{ // if (string.IsNullOrEmpty(dr["FATNAM"].ToString()) == true) // { // dr.Delete(); // } //} //ds.Tables["RT_CUSTOMER_RQ"].AcceptChanges(); foreach (DataRow dr in dsATINN.Tables["AWMS_ATINN"].Rows) { DataRow[] drmatrix = ds.Tables["RT_AUSP"].Select(" ATINN = '" + dr["ATINN"].ToString() + "'"); foreach (DataRow dm in drmatrix) { dm["ATINN"] = dr["ATNAM"].ToString(); dm["FATNAM"] = dr["FATNAM"].ToString(); dm["DEC"] = dr["DEC"].ToString(); } } foreach (DataRow dr in ds.Tables["RT_AUSP"].Rows) //去除无关特性 { if (string.IsNullOrEmpty(dr["FATNAM"].ToString()) == true) { dr.Delete(); } } ds.Tables["RT_AUSP"].AcceptChanges(); //foreach (DataRow dr in ds.Tables["RT_AUSP"].Rows) // //{ // if (string.IsNullOrEmpty(dr["ATWRT"].ToString()) == true) // { // dr["ATWRT"] = float.Parse(dr["ATFLV"].ToString()).ToString(); // } //} //ds.Tables["RT_AUSP"].AcceptChanges(); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } finally { CallRemotingService.UnregisterChannel(); } ds.Tables["RT_VBAP"].AcceptChanges(); this.Content.DataSource = ds.Tables["RT_VBAP"]; this.gridControl1.DataSource = ds.Tables["RT_AUSP"].DefaultView; Content_Click(this, EventArgs.Empty); }
private void btConfirm_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(edOutBandNO.Text) == true) { MessageBox.Show(this, "请输入出库单号!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); edOutBandNO.Focus(); return; } string SAPVBELN = ""; string vbeln = ""; DataTable REQUEST; //-----------------------------------------从数据库中读取已经保存的信息-------------------------------------------- try { DataSet dsReturn = new DataSet(); IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); dsReturn = serverFactory.Get <IPickOperationEngine>().ImportPickdata(edOutBandNO.Text); REQUEST = dsReturn.Tables["REQUEST"].Copy(); REQUEST.Columns.Add("DOCUMENT_TYPE", typeof(string)); REQUEST.Columns.Add("SHIP_TO", typeof(string)); REQUEST.Columns.Add("SOLD_TO", typeof(string)); if (dsReturn.Tables["CK_CONTAINER"].Rows.Count > 0) { MessageBox.Show(this, "不存在此单号或者此订单已经确认,请核对单号!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (REQUEST.Rows.Count <= 0) { MessageBox.Show(this, "不存在此单号或者此订单已经确认,请核对单号!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } for (int i = 0; i < REQUEST.Rows.Count; i++) { REQUEST.Rows[i]["DOCUMENT_TYPE"] = "A"; REQUEST.Rows[i]["SHIP_TO"] = dsReturn.Tables["HEADER"].Rows[0]["SHIPTO"].ToString(); REQUEST.Rows[i]["SOLD_TO"] = dsReturn.Tables["HEADER"].Rows[0]["SALESTO"].ToString(); } vbeln = REQUEST.Rows[0]["DOCUMENT_NUMB"].ToString(); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } finally { CallRemotingService.UnregisterChannel(); } //-------------------------------------------------------------------------------------------------------------- //-----------------------------------------同步SAP生成外向交货单------------------------------------------------ try { string rfcFuntionName = "ZSOLAR_OUTBAND_DELIVERY";//BAPI_DELIVERYPROCESSING_EXEC IServerObjFactory sapserverFactory = CallRemotingService.GetRemoteObject(); if (null != sapserverFactory) { IRFCEngine rfcCallObj = sapserverFactory.Get <IRFCEngine>(); DataSet dsParams = new DataSet(); dsParams.Tables.Add(REQUEST); dsParams.Tables[0].TableName = "REQUEST"; //dsParams.ExtendedProperties.Add("WK_VBELN", this.TBVbeln.Text); ds = rfcCallObj.ExecuteRFC(rfcFuntionName, dsParams); SAPVBELN = ds.Tables["CREATEDITEMS"].Rows[0]["DOCUMENT_NUMB"].ToString(); } if (string.IsNullOrEmpty(SAPVBELN)) { MessageBox.Show(this, "同步SAP失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } finally { CallRemotingService.UnregisterChannel(); } //-------------------------------------------------------------------------------------------------------------- //-------------------------------------------保存状态----------------------------------------------------------- try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); serverFactory.Get <IPickOperationEngine>().UpdateSapVbeln(SAPVBELN, edOutBandNO.Text); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } finally { CallRemotingService.UnregisterChannel(); } //-------------------------------------------------------------------------------------------------------------- MessageBox.Show("成功生成外向交货单:" + SAPVBELN); //---------------------------------------更新拣配数量------------------------------------------- //System.Threading.Thread.Sleep(1000); //DataTable VBKOK_WA = new DataTable(); //DataTable VBPOK_TAB = new DataTable(); //VBKOK_WA.Columns.Add("VBELN_VL",typeof(string)); //VBKOK_WA.Columns.Add("VBELN", typeof(string)); //DataRow dr = VBKOK_WA.NewRow(); //dr["VBELN_VL"] = vbeln ; //dr["VBELN"] = SAPVBELN; //VBKOK_WA.Rows.Add(dr); //VBPOK_TAB.Columns.Add("VBELN_VL", typeof(string)); //VBPOK_TAB.Columns.Add("VBELN", typeof(string)); //VBPOK_TAB.Columns.Add("POSNR_VL", typeof(string)); //VBPOK_TAB.Columns.Add("POSNN", typeof(string)); //VBPOK_TAB.Columns.Add("VBTYP_N", typeof(string)); //VBPOK_TAB.Columns.Add("PIKMG", typeof(string)); //VBPOK_TAB.Columns.Add("MEINS", typeof(string)); //VBPOK_TAB.Columns.Add("NDIFM", typeof(string)); //VBPOK_TAB.Columns.Add("TAQUI", typeof(string)); //VBPOK_TAB.Columns.Add("CHARG", typeof(string)); //VBPOK_TAB.Columns.Add("ORPOS", typeof(string)); //for (int i = 0; i < REQUEST.Rows.Count; i++) //{ // DataRow drV = VBPOK_TAB.NewRow(); // drV["VBELN_VL"] = REQUEST.Rows[i]["DOCUMENT_NUMB"]; // drV["POSNR_VL"] = REQUEST.Rows[i]["DOCUMENT_ITEM"]; // drV["VBELN"] = SAPVBELN; // drV["POSNN"] = REQUEST.Rows[i]["POSNR"]; // drV["VBTYP_N"] = "Q"; // drV["PIKMG"] = REQUEST.Rows[i]["QUANTITY_SALES_UOM"]; // drV["MEINS"] = REQUEST.Rows[i]["SALES_UNIT"]; // drV["NDIFM"] = "0"; // drV["TAQUI"] = ""; // //dr["CHARG"] = REQUEST.Rows[i]["BATCH"]; // drV["ORPOS"] = "0"; // VBPOK_TAB.Rows.Add(drV); //} //rfcFuntionName = "WS_DELIVERY_UPDATE"; //sapserverFactory = CallRemotingService.GetRemoteObject(); //if (null != sapserverFactory) //{ // IRFCEngine rfcCallObj = sapserverFactory.Get<IRFCEngine>(); // DataSet dsParams = new DataSet(); // dsParams.Tables.Add(VBKOK_WA); // dsParams.Tables.Add(VBPOK_TAB); // dsParams.Tables[0].TableName = "VBKOK_WA"; // dsParams.Tables[0].TableName = "VBPOK_TAB"; // dsParams.ExtendedProperties.Add("UPDATE_PICKING", "X"); // dsParams.ExtendedProperties.Add("DELIVERY", SAPVBELN); // ds = rfcCallObj.ExecuteRFC(rfcFuntionName, dsParams); //} }
private bool ComputerUpdate() { bool bReturn = false; DataSet dataSet = new DataSet(); if (IsDirty) { if (DirtyList.Count > 0)// { DataTable entityTable = DataTableHelper.CreateDataTableForUpdateBasicData(COMPUTER_FIELDS.DATABASE_TABLE_NAME); foreach (string Key in this.DirtyList.Keys) { Dictionary <string, string> rowData = new Dictionary <string, string>() { { COMMON_FIELDS.FIELD_COMMON_UPDATE_KEY, _codeKey }, { COMMON_FIELDS.FIELD_COMMON_UPDATE_NAME, Key }, { COMMON_FIELDS.FIELD_COMMON_UPDATE_OLD_VALUE, this.DirtyList[Key].FieldOriginalValue }, { COMMON_FIELDS.FIELD_COMMON_UPDATE_NEW_VALUE, this.DirtyList[Key].FieldNewValue } }; FanHai.Hemera.Utils.Common.Utils.AddRowDataToDataTable(ref entityTable, rowData); } if (entityTable.Rows.Count > 0) { dataSet.Tables.Add(entityTable); } } if (_UDAs.IsDirty) { DataTable dtUDAs = DataTableHelper.CreateDataTableForUDA(COMPUTER_ATTR_FIELDS.DATABASE_TABLE_NAME, COMPUTER_ATTR_FIELDS.FIELDS_COMPUTER_KEY); _UDAs.ParseUpdateDataToDataTable(ref dtUDAs); dataSet.Tables.Add(dtUDAs); } try { DataSet dsReturn = null; IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); dsReturn = serverFactory.CreateIComputerEngine().UpdateComputer(dataSet); string returnMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); if (returnMsg.Length < 1) { foreach (UserDefinedAttr uda in _UDAs.UserDefinedAttrList) { uda.OperationAction = OperationAction.Update; } this.ResetDirtyList(); bReturn = true; } else { MessageService.ShowError(returnMsg); } } catch (Exception ex) { MessageService.ShowError(ex.Message); } finally { CallRemotingService.UnregisterChannel(); } } else { MessageService.ShowMessage ("${res:Global.UpdateItemDataMessage}", "${res:Global.SystemInfo}"); } return(bReturn); }
///// <summary> ///// Get Config Information Data ///// </summary> ///// <param name="strComputerName"></param> ///// <returns></returns> //public DataSet GetConfigInformationData() //{ // DataSet dsReturn = new DataSet(); // try // { // Hashtable hsTable = new Hashtable(); // DataTable dataTable = new DataTable(); // hsTable.Add(COMPUTER_FIELDS.FIELDS_COMPUTER_NAME, _computerName); // hsTable.Add(COMPUTER_FIELDS.FIELDS_CODE_KEY, _codeKey); // dataTable = FanHai.Hemera.Share.Common.CommonUtils.ParseToDataTable(hsTable); // IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); // if (null != serverFactory) // { // DataSet ds = new DataSet(); // dsReturn = serverFactory.CreateIQMSEngine().GetConfigInformation(dataTable); // _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); // } // } // catch (Exception ex) // { // _errorMsg = ex.Message; // } // finally // { // CallRemotingService.UnregisterChannel(); // if (_errorMsg != "") // { // //throw new Exception("获取配置信息失败!"); // throw new Exception("${res:FanHai.Hemera.Addins.WIP.LotCategoryTest.GetConfigurationFailed}"); // } // } // return dsReturn; //} /// <summary> /// 获取客户端计算机连接的打印机信息。 /// </summary> /// <param name="computerName">客户端计算机名称。</param> /// <returns>true:获取打印机信息成功。false:获取打印机信息失败。</returns> public bool GetComputerPrinterInfo(string computerName) { bool bResult = false; try { DataSet dsReturn = new DataSet(); IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); dsReturn = serverFactory.CreateIComputerEngine().GetComputerByName(computerName); _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); if (_errorMsg == string.Empty) { if (dsReturn == null || dsReturn.Tables.Count > 0 && dsReturn.Tables.Contains(COMPUTER_ATTR_FIELDS.DATABASE_TABLE_NAME)) { if (dsReturn.Tables[COMPUTER_ATTR_FIELDS.DATABASE_TABLE_NAME].Rows.Count > 0) { DataTable table = dsReturn.Tables[COMPUTER_ATTR_FIELDS.DATABASE_TABLE_NAME]; foreach (DataRow dataRow in table.Rows) { switch (Convert.ToString(dataRow[COMMON_FIELDS.FIELD_ATTRIBUTE_NAME])) { case "PRINTER_NAME": _printerName = Convert.ToString(dataRow[COMMON_FIELDS.FIELD_COMMON_ATTRIBUTE_VALUE]); break; case "PRINTER_IP": _printerIP = Convert.ToString(dataRow[COMMON_FIELDS.FIELD_COMMON_ATTRIBUTE_VALUE]); break; case "PRINTER_PORT": _printerPort = Convert.ToString(dataRow[COMMON_FIELDS.FIELD_COMMON_ATTRIBUTE_VALUE]); break; case "PRINTER_TYPE": _printerType = Convert.ToString(dataRow[COMMON_FIELDS.FIELD_COMMON_ATTRIBUTE_VALUE]); break; case "PRINTER_LABEL": _barcodeModule = Convert.ToString(dataRow[COMMON_FIELDS.FIELD_COMMON_ATTRIBUTE_VALUE]); break; default: break; } } bResult = true; } } } else { MessageService.ShowError(_errorMsg); } } catch (Exception ex) { MessageService.ShowError(ex.Message); } finally { CallRemotingService.UnregisterChannel(); } return(bResult); }
private void toolStripButton2_Click(object sender, EventArgs e) { try { foreach (DataRow dr in ds.Tables["RT_VBAP"].Rows) //删除出库数量为0的行 { dr["ERNAM"] = PropertyService.Get(PROPERTY_FIELDS.USER_NAME_MZ); if (float.Parse(dr["OutBQty"].ToString()) <= 0) { dr.Delete(); } } ds.Tables["RT_VBAP"].AcceptChanges(); if (ds.Tables["RT_VBAP"].Rows.Count <= 0) { return; } if (string.IsNullOrEmpty(edCI.Text) == true) { MessageBox.Show(this, "请输入CI!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); edCI.Focus(); return; } if (string.IsNullOrEmpty(edShipNO.Text) == true) { MessageBox.Show(this, "请输入牌照号!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); edShipNO.Focus(); return; } if (string.IsNullOrEmpty(cbShipType.Text) == true) { MessageBox.Show(this, "请选择运输类型!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); cbShipType.Focus(); return; } if (ds.Tables["RT_VBAK"].Columns.Contains("CI") == false) //判断是否包含指定列 { ds.Tables["RT_VBAK"].Columns.Add("CI", typeof(string)); } if (ds.Tables["RT_VBAK"].Columns.Contains("ShipmentType") == false) //判断是否包含指定列 { ds.Tables["RT_VBAK"].Columns.Add("ShipmentType", typeof(string)); } if (ds.Tables["RT_VBAK"].Columns.Contains("ShipmentNO") == false) //判断是否包含指定列 { ds.Tables["RT_VBAK"].Columns.Add("ShipmentNO", typeof(string)); } DataRow[] drCheck = dsCabinet.Tables["CabinetData"].Select("IsUsed <> 'Y'"); if (drCheck.Length > 0) { MessageBox.Show(this, "此柜中仍有托盘未刷!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch { return; } try { ds.Tables["RT_VBAK"].Rows[0]["CI"] = edCI.Text; ds.Tables["RT_VBAK"].Rows[0]["ShipmentNO"] = edShipNO.Text; ds.Tables["RT_VBAK"].Rows[0]["ShipmentType"] = cbShipType.Items.IndexOf(cbShipType.Text); ds.Tables["RT_VBAK"].Rows[0]["BNAME"] = PropertyService.Get(PROPERTY_FIELDS.USER_NAME_MZ); ds.Tables["RT_VBAK"].AcceptChanges(); edOutBandNO.Text = ""; IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); edOutBandNO.Text = serverFactory.Get <IPickOperationEngine>().SavePickData( ds, "CK" + PropertyService.Get(PROPERTY_FIELDS.USER_NAME).Substring(0, 3).ToUpper() ); MessageBox.Show("成功保存出库单,单号为:" + edOutBandNO.Text); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } finally { CallRemotingService.UnregisterChannel(); } ClearDataset(); }