/// <summary> /// 根据产品ID获取产品类型。 /// </summary> /// <param name="sProductCode">产品ID。</param> /// <returns> /// 产品类型的数据集合。 /// </returns> public DataSet GetProductModeByPID(string sProductCode) { DataSet dsReturn = null; try { IServerObjFactory iServerObjFactory = CallRemotingService.GetRemoteObject(); dsReturn = iServerObjFactory.Get <ILotCreateEngine>().GetProductModeByPID(sProductCode); _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); } catch (Exception ex) { _errorMsg = ex.Message; } finally { CallRemotingService.UnregisterChannel(); } return(dsReturn); }
/// <summary> /// 获取领料项目信息。 /// </summary> /// <param name="roomKey">车间主键。</param> /// <param name="operationName">工序名称。</param> /// <param name="orderNo">工单号。</param> /// <param name="proId">产品ID号。</param> /// <returns>包含领料项目信息的数据集对象。</returns> public DataSet GetReceiveMaterialInfo(string roomKey, string operationName, string orderNo, string proId) { DataSet dsReturn = null; try { IServerObjFactory iServerObjFactory = CallRemotingService.GetRemoteObject(); dsReturn = iServerObjFactory.Get <ILotCreateEngine>().GetReceiveMaterialInfo(roomKey, operationName, orderNo, proId); _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); } catch (Exception ex) { _errorMsg = ex.Message; } finally { CallRemotingService.UnregisterChannel(); } return(dsReturn); }
/// <summary> /// 获取有效的认证类型 /// </summary> /// <returns></returns> public DataSet GetValidCertificationType() { DataSet dsReturn = null; try { IServerObjFactory iServerObjFactory = CallRemotingService.GetRemoteObject(); dsReturn = iServerObjFactory.Get <IBasicCertificationEngine>().GetValidCertificationType(); _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); } catch (Exception ex) { _errorMsg = ex.Message; } finally { CallRemotingService.UnregisterChannel(); } return(dsReturn); }
// /// <summary> /// 查询质检明细记录。 /// </summary> /// <param name="id">外向交货明细ID。</param> /// <returns>对应外向交货ID质检明细记录信息的数据集对象。</returns> public DataSet GetQCItem(string VBELN, string POSNR) { DataSet dsReturn = null; try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); dsReturn = serverFactory.Get <IOutDeliveryQuerryEngine>().GetQCItem(VBELN, POSNR); _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); } catch (Exception ex) { _errorMsg = ex.Message; } finally { CallRemotingService.UnregisterChannel(); } return(dsReturn); }
/// <summary> /// 刷新来料数据 /// </summary> /// <param name="dataTable">登录用户工号,所在时区时区</param> public void RefreshReceiveMaterial(DataTable dataTable) { DataSet dsReturn = new DataSet(); try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (null != serverFactory) { dsReturn = serverFactory.Get <ISAPEngine>().RefreshReceiveMaterial(dataTable); _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); } } catch (Exception ex) { _errorMsg = ex.Message; } finally { CallRemotingService.UnregisterChannel(); } }
public DataSet GetMaterialDateByCodeAndBarcode(string code, string barCode) { DataSet dsReturn = new DataSet(); try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (null != serverFactory) { dsReturn = serverFactory.Get <IBomMaterialBandEngine>().GetMaterialDateByCodeAndBarcode(code, barCode); _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); } } catch (Exception ex) { _errorMsg = ex.Message; } finally { CallRemotingService.UnregisterChannel(); } return(dsReturn); }
/// <summary> /// 获取标签或铭牌明细数据。 /// </summary> /// <returns>包含标签或铭牌明细数据的数据集对象。</returns> public DataSet GetPrintLabelDetailData(string labelId) { try { IServerObjFactory obj = CallRemotingService.GetRemoteObject(); DataSet dsReturn = obj.Get <IBasicPrintLabelEngine>().GetPrintLabelDetailData(labelId); _errorMsg = ReturnMessageUtils.GetServerReturnMessage(dsReturn); if (!string.IsNullOrEmpty(_errorMsg)) { return(null); } return(dsReturn); } catch (Exception ex) { _errorMsg = ex.Message; } finally { CallRemotingService.UnregisterChannel(); } return(null); }
/// <summary> /// 是否允许设置标签或数据为无效数据。 /// </summary> /// <param name="labelId">标签或铭牌ID</param> /// <returns>包含执行结果的数据集对象。</returns> public bool IsAllowInvalid(string labelId) { try { IServerObjFactory obj = CallRemotingService.GetRemoteObject(); DataSet dsReturn = obj.Get <IBasicPrintLabelEngine>().IsAllowInvalid(labelId); _errorMsg = ReturnMessageUtils.GetServerReturnMessage(dsReturn); if (!string.IsNullOrEmpty(_errorMsg)) { return(false); } } catch (Exception ex) { _errorMsg = ex.Message; return(false); } finally { CallRemotingService.UnregisterChannel(); } return(true); }
/// <summary> /// 从SAP接口数据库获取工单信息 /// </summary> /// <param name="workOrder">工单号</param> /// <returns>工单信息</returns> public DataTable GetWorkOrder(String workOrder, String user) { //定义返回的工单信息表 DataTable dtWorkOrder = CreateWorkOrderInfoTable(); //调用远程对象为工单信息表赋值 try { //调用远程对象 IServerObjFactory factor = CallRemotingService.GetRemoteObject(); if (null != factor) { //调用接口函数创建工单对象,并调用工单对象的获取工单信息方法,并在中间数据库写入读取标志。 DataSet retDS = factor.Get <ISAPEngine>().GetWorkOrderInfo(workOrder, user); string returnMessage = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(retDS); //若返回错误消息,则显示 if (returnMessage.Length > 0) { MessageService.ShowError(returnMessage); } else { return(retDS.Tables[0]); } } } catch (Exception e) { MessageService.ShowError(e); } finally { //注销通道 CallRemotingService.UnregisterChannel(); } return(dtWorkOrder); }
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="factory"><see cref="IServerObjFactory"/></param> /// <returns>操作数据库数据的实例。</returns> public static IDBEngine CreateIDBEngine(this IServerObjFactory factory) { return(factory.Get <IDBEngine>()); }
/// <summary> /// 获取批次预设暂停数据的管理实例。 /// </summary> /// <param name="factory"><see cref="IServerObjFactory"/></param> /// <returns>批次预设暂停数据的管理实例。</returns> public static ILotFutureHoldEngine CreateILotFutureHoldEngine(this IServerObjFactory factory) { return(factory.Get <ILotFutureHoldEngine>()); }
/// <summary> /// 获取虚拟托盘管理 /// </summary> /// <param name="factory"><see cref="IServerObjFactory"/></param> /// <returns>虚拟托盘管理实例。</returns> public static ILotComponentTrayEngine CreateILotComponentTrayEngine(this IServerObjFactory factory) { return(factory.Get <ILotComponentTrayEngine>()); }
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 btADD_Click(object sender, EventArgs e) { try { if (dsReturn.Tables["OUTB_TAB"].Rows.Count <= 0) { return; } } catch { return; } string Sapvbeln = dsReturn.Tables["OUTB_TAB"].Rows[0]["REF_NO"].ToString(); if (string.IsNullOrEmpty(Sapvbeln) == true) { MessageBox.Show(this, "无法获取相关销售订单信息", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } 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", Sapvbeln); dsAdd = rfcCallObj.ExecuteRFC(rfcFuntionName, dsParams); } if (dsAdd.Tables["RT_VBAP"].Rows.Count <= 0) { MessageBox.Show(this, "没有可添加的数据!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } dsAdd.Tables["RT_VBAP"].Columns.Add("Sapqty", typeof(string)); dsAdd.Tables["RT_VBAP"].Columns.Add("OutBQty", typeof(float)); dsAdd.Tables["RT_VBAP"].Columns.Add("CI", typeof(string)); dsAdd.Tables["RT_VBAP"].Columns.Add("ShipmentType", typeof(string)); dsAdd.Tables["RT_VBAP"].Columns.Add("ShipmentNo", typeof(string)); dsAdd.Tables["RT_CUSTOMER_RQ"].Columns.Add("DEC", typeof(string)); dsAdd.Tables["RT_CUSTOMER_RQ"].Columns.Add("FATNAM", typeof(string)); if (dsAdd.Tables["RT_VBAP"].Columns.Contains("CONTAINER_CODE") == false) //判断是否包含指定列 { dsAdd.Tables["RT_VBAP"].Columns.Add("CONTAINER_CODE", typeof(string)); } if (dsAdd.Tables["RT_VBAP"].Columns.Contains("CONTAINER_KEY") == false) //判断是否包含指定列 { dsAdd.Tables["RT_VBAP"].Columns.Add("CONTAINER_KEY", typeof(string)); } for (int i = 0; i < ds.Tables["RT_VBAP"].Rows.Count; i++) { dsAdd.Tables["RT_VBAP"].Rows[i]["Sapqty"] = dsAdd.Tables["RT_VBAP"].Rows[i]["KWMENG"]; dsAdd.Tables["RT_VBAP"].Rows[i]["OutBQty"] = 0; } PMAddProd pmadd = new PMAddProd(dsAdd); pmadd.ShowDialog(); if (dsAdd.Tables.IndexOf("SelectedRow") < 0) //若没有选中或者不存在数据,返回 { return; } if (dsAdd.Tables["SelectedRow"].Rows.Count <= 0) { MessageBox.Show(this, "未选中任何行", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } for (int i = 0; i < dsAdd.Tables["SelectedRow"].Rows.Count; i++) { DataRow[] drM = dsReturn.Tables["OUTB_TAB"].Select(" REF_NO = '" + dsAdd.Tables["SelectedRow"].Rows[i]["VBELN"] + "' and REF_ITEM = '" + dsAdd.Tables["SelectedRow"].Rows[i]["POSNR"] + "'"); if (drM.Length <= 0) //若已存在此行,则不添加,否则添加 { DataRow Newrow = dsReturn.Tables["OUTB_TAB"].NewRow(); Newrow["PLANT"] = dsAdd.Tables["SelectedRow"].Rows[i]["WERKS"].ToString(); Newrow["STORAGELOCATION"] = dsAdd.Tables["SelectedRow"].Rows[i]["LGORT"].ToString(); Newrow["CPBH"] = dsAdd.Tables["SelectedRow"].Rows[i]["matnr"].ToString(); Newrow["XHGG"] = dsAdd.Tables["SelectedRow"].Rows[i]["ARKTX"].ToString(); Newrow["OBDQTY"] = 0; Newrow["UNIT"] = dsAdd.Tables["SelectedRow"].Rows[i]["VRKME"].ToString(); Newrow["VSTEL"] = dsAdd.Tables["SelectedRow"].Rows[i]["VSTEL"].ToString(); Newrow["REF_NO"] = dsAdd.Tables["SelectedRow"].Rows[i]["VBELN"].ToString(); Newrow["REF_ITEM"] = dsAdd.Tables["SelectedRow"].Rows[i]["POSNR"].ToString(); Newrow["LAST_CNG_BY"] = PropertyService.Get(PROPERTY_FIELDS.USER_NAME_MZ); Newrow["DemandNO"] = dsAdd.Tables["SelectedRow"].Rows[i]["AUFNR"].ToString(); Newrow["DemardPOS"] = dsAdd.Tables["SelectedRow"].Rows[i]["VGPOS"].ToString(); Newrow["DemardSch"] = dsAdd.Tables["SelectedRow"].Rows[i]["GRKOR"].ToString(); dsReturn.Tables["OUTB_TAB"].Rows.Add(Newrow); } dsReturn.Tables["OUTB_TAB"].AcceptChanges(); } }
/// <summary> /// 进行外向交货过帐 /// </summary> /// <param name="VebelNO"></param> private void OUTB_DELIVERY_CONFIRM(string VebelNO, string OutboundNo, out int flag) { DataSet ds = new DataSet(); DataTable H_DATA = new DataTable(); DataTable H_CONTROL = new DataTable(); DataTable returnTable; string strReturn = string.Empty; string Mes = string.Empty; flag = 1; string rfcFuntionName = "BAPI_OUTB_DELIVERY_CONFIRM_DEC"; IServerObjFactory sapserverFactory = CallRemotingService.GetRemoteObject(); if (null != sapserverFactory) { IRFCEngine rfcCallObj = sapserverFactory.Get <IRFCEngine>(); DataSet dsParams = new DataSet(); DataRow HEADER_DATA; DataRow HEADER_CONTROL; //定义一个table用于传入HEADER_DATA H_DATA.Columns.Add("DELIV_NUMB", typeof(string)); //传入HEADER_DATA值 HEADER_DATA = H_DATA.NewRow(); HEADER_DATA["DELIV_NUMB"] = VebelNO; H_DATA.Rows.Add(HEADER_DATA); //定义一个table用于传入HEADER_CONTROL H_CONTROL.Columns.Add("DELIV_NUMB", typeof(string)); H_CONTROL.Columns.Add("POST_GI_FLG", typeof(string)); H_CONTROL.Columns.Add("DELIV_DATE_FLG", typeof(string)); H_CONTROL.Columns.Add("GROSS_WT_FLG", typeof(string)); //传入HEADER_CONTROL值 HEADER_CONTROL = H_CONTROL.NewRow(); HEADER_CONTROL["DELIV_NUMB"] = VebelNO; HEADER_CONTROL["POST_GI_FLG"] = "X"; HEADER_CONTROL["DELIV_DATE_FLG"] = "X"; HEADER_CONTROL["GROSS_WT_FLG"] = "X"; H_CONTROL.Rows.Add(HEADER_CONTROL); //将table加入dataset dsParams.Tables.Add(H_DATA); dsParams.Tables[0].TableName = "HEADER_DATA"; dsParams.Tables.Add(H_CONTROL); dsParams.Tables[1].TableName = "HEADER_CONTROL"; //dsParams.ExtendedProperties.Add("HEADER_DATA", HEADER_DATA); //dsParams.ExtendedProperties.Add("HEADER_CONTROL", HEADER_CONTROL); dsParams.ExtendedProperties.Add("DELIVERY", VebelNO); //调用BAPI ds = rfcCallObj.ExecuteRFC(rfcFuntionName, dsParams); returnTable = ds.Tables["RETURN"]; if (returnTable.Rows.Count > 0) { for (int i = 0; i < returnTable.Rows.Count; i++) { //失败的产品信息dsOutboudInfo.Tables[0].Rows[0][0].ToString() string type = returnTable.Rows[i]["TYPE"].ToString(); string id = returnTable.Rows[i]["id"].ToString(); string number = returnTable.Rows[i]["NUMBER"].ToString(); string message = returnTable.Rows[i]["MESSAGE"].ToString(); string system = returnTable.Rows[i]["SYSTEM"].ToString(); string REF_EXT1 = returnTable.Rows[i]["MESSAGE_V1"].ToString(); string REF_EXT2 = returnTable.Rows[i]["MESSAGE_V2"].ToString(); string REF_EXT3 = returnTable.Rows[i]["MESSAGE_V3"].ToString(); Mes = Mes + type + message; if ((type == "E") || (type == "A")) { flag = 0; } } } if (flag == 0) { Mes = "外向交货单过账失败:" + Mes; } else { Mes = "外向交货单过账成功!"; } } //return Mes; MessageService.ShowMessage(Mes, "提示"); this._entity.UpdateTable(strReturn, VebelNO, OutboundNo, flag); }
/// <summary> /// 获取工单退料数据的管理实例。 /// </summary> /// <param name="factory"><see cref="IServerObjFactory"/></param> /// <returns>工单退料数据的管理实例。</returns> public static IWOMaterialReturnEngine CreateIWOMaterialReturnEngine(this IServerObjFactory factory) { return(factory.Get <IWOMaterialReturnEngine>()); }
/// <summary> ///扣料基础数据 /// </summary> /// <param name="factory"></param> /// <returns></returns> public static IMaterialBuckleControlEngine CreateIMaterialBuckleControlEngine(this IServerObjFactory factory) { return(factory.Get <IMaterialBuckleControlEngine>()); }
/// <summary> ///线别维护设置 /// </summary> /// <param name="factory"></param> /// <returns></returns> public static ILineSettingEngine CreateILineSettingEngine(this IServerObjFactory factory) { return(factory.Get <ILineSettingEngine>()); }
/// <summary> ///联副主副产品 /// </summary> /// <param name="factory"></param> /// <returns></returns> public static IByProductPartEngine CreateIByProductPartEngine(this IServerObjFactory factory) { return(factory.Get <IByProductPartEngine>()); }
/// <summary> ///发料退料 /// </summary> /// <param name="factory"></param> /// <returns></returns> public static ISendingMaterialEngine CreateISendingMaterialEngine(this IServerObjFactory factory) { return(factory.Get <ISendingMaterialEngine>()); }
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(); }
private void btDelete_Click(object sender, EventArgs e) { string t1 = ""; try { if (dsReturn.Tables["OUTB_TAB"].Rows.Count <= 0) { return; } } catch { return; } string Sapvbeln = dsReturn.Tables["OUTB_TAB"].Rows[0]["VBELN"].ToString(); DataSet dsBAPI = new DataSet(); string rfcFuntionName = "ZDZSW_XSDD"; IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (null != serverFactory) { IRFCEngine rfcCallObj = serverFactory.Get <IRFCEngine>(); DataSet dsParams = new DataSet(); dsParams.ExtendedProperties.Add("BZ", "WD"); dsParams.ExtendedProperties.Add("WK_VBELN", Sapvbeln); dsBAPI = rfcCallObj.ExecuteRFC(rfcFuntionName, dsParams); bool isSuccess = true; string errstr = ""; for (int i = 0; i < dsBAPI.Tables["LI_RETURN"].Rows.Count; i++) { if (dsBAPI.Tables["LI_RETURN"].Rows[i]["TYPE"].ToString() == "E") { errstr += dsBAPI.Tables["LI_RETURN"].Rows[i]["MESSAGE"].ToString() + 13; isSuccess = false; } } if (isSuccess == false) { MessageBox.Show(this, errstr, "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } try { serverFactory = CallRemotingService.GetRemoteObject(); serverFactory.Get <IPickOperationEngine>().DeleteOutBand(Sapvbeln, 1); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } finally { CallRemotingService.UnregisterChannel(); } try { dsReturn.Clear(); ds.Clear(); dsReturn.AcceptChanges(); ds.AcceptChanges(); } catch { }; MessageBox.Show(this, "删除成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); }
/// <summary> ///特殊物料管控 /// </summary> /// <param name="factory"></param> /// <returns></returns> public static ISpecialMatTeamEngine CreateISpecialMatTeamEngine(this IServerObjFactory factory) { return(factory.Get <ISpecialMatTeamEngine>()); }
private void btQuery_Click(object sender, EventArgs e) { if ((string.IsNullOrEmpty(edOutBandNO.Text) == true) && (string.IsNullOrEmpty(edSapvbeln.Text))) { MessageBox.Show("请输入查询单号!"); edOutBandNO.Focus(); return; } try { dsReturn.Clear(); ds.Clear(); dsAdd.Clear(); dsReturn.AcceptChanges(); ds.AcceptChanges(); dsAdd.AcceptChanges(); } catch { }; string SalesNO = ""; IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); dsReturn = serverFactory.Get <IPickOperationEngine>().GetPickedInfo(edOutBandNO.Text, edSapvbeln.Text); if (dsReturn.Tables["OUTB_TAB"].Rows.Count <= 0) { MessageBox.Show("没有你要查询的单据,请核对后重试!"); return; } SalesNO = dsReturn.Tables["OUTB_TAB"].Rows[0]["REF_NO"].ToString(); //string rfcFuntionName = "ZAST_GET_SO"; //serverFactory = CallRemotingService.GetRemoteObject(); //if (null != serverFactory) //{ // IRFCEngine rfcCallObj = serverFactory.Get<IRFCEngine>(); // DataSet dsParams = new DataSet(); // dsParams.ExtendedProperties.Add("WK_VBELN", SalesNO); // ds = rfcCallObj.ExecuteRFC(rfcFuntionName, dsParams); // ds.Tables["RT_CUSTOMER_RQ"].Columns.Add("DEC", typeof(string)); // ds.Tables["RT_CUSTOMER_RQ"].Columns.Add("FATNAM", typeof(string)); //} //// --------------------------------去除无关特性------------------------------------------------------------- //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(); //} //catch (Exception ex) //{ // MessageBox.Show(this, ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); // return; //} //finally //{ // CallRemotingService.UnregisterChannel(); //} Content.DataSource = dsReturn.Tables["OUTB_TAB"]; //gridControl1.DataSource = ds.Tables["RT_CUSTOMER_RQ"].DefaultView; Content_Click(this, EventArgs.Empty); }
/// <summary> /// 组件不良跟踪 /// </summary> /// <param name="factory"></param> /// <returns></returns> public static ILotExceptionEngine CreateILotExceptionEngine(this IServerObjFactory factory) { return(factory.Get <ILotExceptionEngine>()); }
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); //} }
/// <summary> /// 铭牌自动打印 /// </summary> /// <param name="factory"></param> /// <returns></returns> public static INameplateLabelAutoPrintEngine CreateINameplateLabelAutoPrintEngine(this IServerObjFactory factory) { return(factory.Get <INameplateLabelAutoPrintEngine>()); }
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(); } }
/// <summary> ///获取未打印的组件序列号 /// </summary> /// <param name="factory"></param> /// <returns></returns> public static ILotNumPrintEngine CreateILotNumPrintEngine(this IServerObjFactory factory) { return(factory.Get <ILotNumPrintEngine>()); }