internal void ProcessScanFGTag(string data) { try { // Extract part no. code = GenericCode.ConvertDataToGenericCode(data); code["Delivery Order Tag"] = _deliveryOrderTag; if (!string.IsNullOrEmpty(GetFGTag())) { var result = InsertFGTag(); } else { errFlag = true; errMsg = ""; } var value = ""; if (!string.IsNullOrEmpty(code["Tag No."].ToString()) && !string.IsNullOrEmpty(code["Qty."].ToString())) { data = code["Tag No."].ToString() + "/" + code["Qty."].ToString(); } SaveLog(OperationLog.LogEvent.Scan, "FGTag", value); } catch (Exception) { } }
private void SumUpCustomerQty(GenericCode code) { if (code["Customer Part No."] != null && code["Customer Qty."] != null) { foreach (var row in _dataSet.Tables[0].Select()) { if (row["DO Part No."].Equals(code["Customer Part No."].ToString())) { int custQty = Convert.ToInt32(row["Customer Qty."]); custQty += Convert.ToInt32(code["Customer Qty."]); if (custQty > Convert.ToInt32(row["DO Qty."])) { _view.ShowMessage("ERR_04", Properties.Resources.ERR_04); errFlag = true; errMsg = "ERR_04"; return; } else { code["Customer Qty."] = custQty; int rowAffected = _repository.UpdateCustomerQty(code); if (rowAffected > 0) { // update row row["Customer Qty."] = custQty; row["Pass"] = ((Convert.ToInt32(row["FATH Qty."]) == Convert.ToInt32(row["DO Qty."])) && (Convert.ToInt32(row["Customer Qty."]) == Convert.ToInt32(row["DO Qty."]))) ? "Y" : "N"; } } } } } }
public ShippingPresenter(IShippingView view, IShippingRepository repository, string deliveryOrderTag) : base("M02") { _view = view; view.Presenter = this; _repository = repository; _deliveryOrderTag = deliveryOrderTag; view.DeliveryOrderTag = deliveryOrderTag; code = new GenericCode(); code["Delivery Order Tag"] = deliveryOrderTag; ShowDetails(); }
private bool IsPartNoExists(GenericCode fathTag) { bool exists = false; foreach (var row in _dataSet.Tables[0].Select()) { if (row["Part No."].Equals(fathTag["Part No."])) { exists = true; break; } } return(exists); }
public TrapV1Message(VersionCode version, IPAddress agent, OctetString community, ObjectIdentifier enterprise, GenericCode generic, int specific, uint time, IList<Variable> variables) { if (variables == null) { throw new ArgumentNullException("variables"); } if (enterprise == null) { throw new ArgumentNullException("enterprise"); } if (community == null) { throw new ArgumentNullException("community"); } if (agent == null) { throw new ArgumentNullException("agent"); } if (version != VersionCode.V1) { throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "TRAP v1 is not supported in this SNMP version: {0}", version), "version"); } Version = version; AgentAddress = agent; Community = community; Enterprise = enterprise; Generic = generic; Specific = specific; TimeStamp = time; var pdu = new TrapV1Pdu( Enterprise, new IP(AgentAddress), new Integer32((int)Generic), new Integer32(Specific), new TimeTicks(TimeStamp), variables); _pdu = pdu; Parameters = SecurityParameters.Create(Community); }
public TrapV1Message(VersionCode version, IPAddress agent, OctetString community, ObjectIdentifier enterprise, GenericCode generic, int specific, uint time, IList<Variable> variables) { if (variables == null) { throw new ArgumentNullException("variables"); } if (enterprise == null) { throw new ArgumentNullException("enterprise"); } if (community == null) { throw new ArgumentNullException("community"); } if (agent == null) { throw new ArgumentNullException("agent"); } Version = version; AgentAddress = agent; Community = community; Variables = variables; Enterprise = enterprise; Generic = generic; Specific = specific; TimeStamp = time; TrapV1Pdu pdu = new TrapV1Pdu( Enterprise, new IP(AgentAddress), new Integer32((int)Generic), new Integer32(Specific), new TimeTicks(TimeStamp), Variables); Parameters = new SecurityParameters(null, null, null, Community, null, null); _bytes = SnmpMessageExtension.PackMessage(Version, Community, pdu).ToBytes(); }
public static void SendTrapV1(EndPoint receiver, IPAddress agent, OctetString community, ObjectIdentifier enterprise, GenericCode generic, int specific, uint timestamp, IList<Variable> variables) { var message = new TrapV1Message(VersionCode.V1, agent, community, enterprise, generic, specific, timestamp, variables); message.Send(receiver); }
internal void ProcessScanFATHTag(string data) { GenericCode tempCode = null; try { tempCode = GenericCode.ConvertDataToGenericCode(data); code["Delivery Order Tag"] = _deliveryOrderTag; code["FATH Part No."] = tempCode["Part No."]; code["FATH Tag No."] = tempCode["Tag No."]; code["FATH Qty."] = tempCode["Qty."]; if (_repository.IsTagNoDuplicate(code)) { _view.ShowMessage("ERR_05", Properties.Resources.ERR_05); errFlag = true; errMsg = "ERR_05"; } if (!IsPartNoExists(code["FATH Part No."].ToString()) && !errFlag) { _view.ShowMessage("ERR_03", Properties.Resources.ERR_03); errFlag = true; errMsg = "ERR_03"; } } catch (Exception) { errFlag = true; errMsg = ""; } if (!errFlag) { #region Update Row foreach (var row in _dataSet.Tables[0].Select()) { if (row["DO Part No."].Equals(code["FATH Part No."].ToString())) { // sum-up qty int fathQty = 0; fathQty = Convert.ToInt32(row["FATH Qty."]) + Convert.ToInt32(code["FATH Qty."]); if (fathQty > Convert.ToInt32(row["DO Qty."])) { _view.ShowMessage("ERR_04", Properties.Resources.ERR_04); errFlag = true; errMsg = "ERR_04"; break; } else { int rowAffected = 0; //update to db try { rowAffected = _repository.UpdateFATHTag(code); } catch { } if (rowAffected > 0) { row["FATH Part No."] = code["FATH Part No."]; row["FATH Qty."] = fathQty; if (_shipping.CustomerCheckingPoints == 2) { row["Pass"] = Convert.ToInt32(row["FATH Qty."]) == Convert.ToInt32(row["DO Qty."]) ? "Y" : "N"; } else { row["Pass"] = ((Convert.ToInt32(row["FATH Qty."]) == Convert.ToInt32(row["DO Qty."])) && (Convert.ToInt32(row["Customer Qty."]) == Convert.ToInt32(row["DO Qty."]))) ? "Y" : "N"; } } } } } #endregion } var value = ""; if (tempCode == null) { value = ""; } else { value = string.Format("{0}/{1}", tempCode["Part No."].ToString(), tempCode["Qty."].ToString()); } SaveLog(OperationLog.LogEvent.Scan, "FATHTag", value); }
//---------------------------------------------------------------- private CResultAErreurType <CSnmpTrap> CreateTrap() { CResultAErreurType <CSnmpTrap> result = new CResultAErreurType <CSnmpTrap>(); CSnmpTrap trap = new CSnmpTrap(); trap.AgentIpString = m_txtIP.Text; trap.Communaute = m_txtCommunity.Text; try { GenericCode code = (GenericCode)Enum.Parse(typeof(GenericCode), m_cmbGenericCode.Text); trap.GenericCode = code; } catch { result.EmpileErreur(I.T("Invalid generic code|20115")); } try { VersionCode code = (VersionCode)Enum.Parse(typeof(VersionCode), m_cmbTrapVersion.Text); trap.VersionCode = code; } catch { result.EmpileErreur(I.T("Invalide version code|20116")); } if (trap.GenericCode == GenericCode.EnterpriseSpecific) { try { trap.EntrepriseOID = new ObjectIdentifier(m_txtEntreprise.Text); } catch { result.EmpileErreur(I.T("Invalid entreprise value|20117")); } if (m_txtSpecificCode.IntValue == null) { result.EmpileErreur(I.T("Invalide specific code[20118")); } else { trap.SpecificCode = m_txtSpecificCode.IntValue.Value; } } trap.TrapDateTime = DateTime.Now; foreach (Control ctrl in m_panelVariables.Controls) { CControlTrapVariable trapV = ctrl as CControlTrapVariable; if (trapV != null) { CResultAErreurType <ISnmpData> resData = trapV.GetValue(); if (!resData) { result.EmpileErreur(resData.Erreur); } else if (resData.DataType != null) { IDefinition def = trapV.Definition; trap.SetVariableValue(ObjectIdentifier.Convert(def.GetNumericalForm()), resData.DataType); } } } if (result) { result.DataType = trap; } return(result); }