private static string GetCachedAlarmText(string alarmId, VocollectSession session, string languageCode) { if ((session == null) || (!session.Contains(alarmId))) { CorrelationContext context; if (session != null) { languageCode = session.ReadAsString("NLANGCOD"); } MultiPartMessage whMsg = CreateRequestMessage("wlsystem", "getalmtxt", null); whMsg.Properties.Write("ALMID_I", alarmId); whMsg.Properties.Write("NLANGCOD_I", languageCode); whMsg.Properties.Write("ALMTXT_O", ""); MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); string alarmText = context.ResponseMessages[0].Properties.ReadAsString("ALMTXT_O"); if (session != null) { session.Write(alarmId, alarmText); } return(alarmText); } else { return(session.ReadAsString(alarmId)); } }
public static void Print(string printerNumber, string containerId, VocollectSession session, bool isReprint) { if ((string.IsNullOrEmpty(printerNumber)) || (printerNumber == "1")) { printerNumber = ""; } CorrelationContext context; /* Save printer number in session for use when finish pick to print PS */ session.Write("PRINTERNUMBER", printerNumber); if (string.IsNullOrEmpty(containerId) && isReprint) { MultiPartMessage reprintMsg = CreateRequestMessage("wlvoicepick", "print_allloadcarriers", session); reprintMsg.Properties.Write("PBHEADID_I", session.ReadAsString("PBHEADID")); reprintMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); reprintMsg.Properties.Write("EMPID_I", session.ReadAsString("EMPID")); reprintMsg.Properties.Write("PRTID_I", printerNumber); reprintMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(reprintMsg, reprintMsg.MessageId, out context); } else if (string.IsNullOrEmpty(containerId)) { MultiPartMessage whMsg = CreateRequestMessage("wlvoicepick", "print", session); whMsg.Properties.Write("PBHEADID_I", session.ReadAsString("PBHEADID")); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); whMsg.Properties.Write("EMPID_I", session.ReadAsString("EMPID")); whMsg.Properties.Write("PRTID_I", printerNumber); if (string.IsNullOrEmpty(session.ReadAsString("PBROWID")) && (session.ReadAsInt("PBROW_COUNT") > 0)) { whMsg.Properties.Write("PRINTCOD_I", "BP"); } else { whMsg.Properties.Write("PRINTCOD_I", "AP"); } whMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); } else { MultiPartMessage reprintMsg = CreateRequestMessage("wlvoicepick", "print_singleloadcarrier", session); reprintMsg.Properties.Write("PBHEADID_I", session.ReadAsString("PBHEADID")); reprintMsg.Properties.Write("SEQNUM_I", TrimContainerId(containerId)); reprintMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); reprintMsg.Properties.Write("EMPID_I", session.ReadAsString("EMPID")); reprintMsg.Properties.Write("PRTID_I", printerNumber); reprintMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(reprintMsg, reprintMsg.MessageId, out context); } }
/// <summary> /// Invokes the subscriber. /// </summary> /// <param name="msg">A reference to the subscribed message.</param> /// <param name="session">The current <see cref="VocollectSession"/> object.</param> /// <exception cref="WarehouseAdapterException"> /// </exception> /// <exception cref="MessageEngineException"> /// </exception> public override void Invoke(MultiPartMessage msg, VocollectSession session) { MultiPartMessage responseMsg = CreateResponseMessage(msg); responseMsg.Properties.Write("DeliveryLocation", ""); responseMsg.Properties.Write("DeliveryLocationCheckDigits", ""); responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeNoError); responseMsg.Properties.Write("Message", ""); try { MultiPartMessage whMsg = CreateRequestMessage("wlvoicepick", "verify_loc", session); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); whMsg.Properties.Write("WSID_IO", msg.Properties.ReadAsString("AlternateDeliveryArea")); whMsg.Properties.Write("WPADR_I", msg.Properties.ReadAsString("AlternateDeliveryLocation")); whMsg.Properties.Write("WHID_I", session.ReadAsString("WHID")); whMsg.Properties.Write("ALMID_O", ""); CorrelationContext context; MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); PropertyCollection properties = context.ResponseMessages[0].Properties; responseMsg.Properties.Write("DeliveryLocation", properties.Read("WSID_IO") + " " + msg.Properties.ReadAsString("AlternateDeliveryLocation")); DropLoadCarrier(TrimContainerId(msg.Properties.ReadAsString("ContainerId")), properties.ReadAsString("WSID_IO"), msg.Properties.ReadAsString("AlternateDeliveryLocation"), session); /* Clear drop variables so the container won't be dropped in next call to PrTaskGetDeliveryLocations */ session.Write("DROPSEQNUM", ""); session.Write("DROPWSID", ""); session.Write("DROPWPADR", ""); } catch (WarehouseAdapterException ex) { if (ex.AlarmId == "WS001") { responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeAddressNotUnique); } else { responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeInvalidLocation); } responseMsg.Properties.Write("Message", ex.Message); } catch (Exception) { responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeCritialError); responseMsg.Properties.Write("Message", GetCriticalErrorMessageText(msg)); throw; } finally { TransmitResponseMessage(responseMsg, session); } }
/// <summary> /// Invokes the subscriber. /// </summary> /// <param name="msg">A reference to the subscribed message.</param> /// <param name="session">The current <see cref="VocollectSession"/> object.</param> /// <exception cref="WarehouseAdapterException"> /// </exception> /// <exception cref="MessageEngineException"> /// </exception> public override void Invoke(MultiPartMessage msg, VocollectSession session) { MultiPartMessage responseMsg = CreateResponseMessage(msg); responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeNoError); responseMsg.Properties.Write("Message", ""); try { /* Do not direct operator to collect containers when continuing a temporarily stopped assignment * or when print request is sent at the end of an assignment */ if ((string.IsNullOrEmpty(session.ReadAsString("HOLD_TYPE")) || (session.ReadAsString("HOLD_TYPE") == HOLD_TYPE_Definitely)) && string.IsNullOrEmpty(session.ReadAsString("PBROWID"))) { responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeCollectContainers); } if ((msg.Properties.ReadAsInt("PrinterNumber") > 0) && (msg.Properties.ReadAsInt("Operation") < 2)) { if ((session.ReadAsString("PRINTED") == "1") && (string.IsNullOrEmpty(TrimContainerId(msg.Properties.ReadAsString("SystemContainerId")))) && (msg.Properties.ReadAsInt("Operation") == 1)) { Print(msg.Properties.ReadAsString("PrinterNumber"), TrimContainerId(msg.Properties.ReadAsString("SystemContainerId")), session, true); } else { Print(msg.Properties.ReadAsString("PrinterNumber"), TrimContainerId(msg.Properties.ReadAsString("SystemContainerId")), session, false); } } session.Write("PRINTED", "1"); } catch (WarehouseAdapterException ex) { responseMsg.Properties.Write("ErrorCode", WarehouseAlarm); responseMsg.Properties.Write("Message", ex.Message); throw; } catch (Exception) { responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeCritialError); responseMsg.Properties.Write("Message", GetCriticalErrorMessageText(msg)); throw; } finally { TransmitResponseMessage(responseMsg, session); } }
/// <summary> /// Invokes the subscriber. /// </summary> /// <param name="msg">A reference to the subscribed message.</param> /// <param name="session">The current <see cref="VocollectSession"/> object.</param> /// <exception cref="WarehouseAdapterException"> /// </exception> /// <exception cref="MessageEngineException"> /// </exception> public override void Invoke(MultiPartMessage msg, VocollectSession session) { MultiPartMessage responseMsg = CreateResponseMessage(msg); try { MultiPartMessage whMsg = CreateRequestMessage("wlvoicepick", "get_mt_pm", session); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); whMsg.Properties.Write("PM_Cur_O", new object()); CorrelationContext context; MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); foreach (MessagePart part in context.ResponseMessages[0].Parts) { int temp; /* Packaging Type must be numeric in order to be valid */ if (!int.TryParse(part.Properties.ReadAsString("PMTYPID"), out temp)) { continue; } VocollectMessagePart responsePart = new VocollectMessagePart(); responsePart.Properties.Write("PackNumber", part.Properties.Read("PMTYPID")); responsePart.Properties.Write("PackDescription", part.Properties.Read("PMNAME")); responsePart.Properties.Write("ErrorCode", (int)VocollectErrorCodeNoError); responsePart.Properties.Write("Message", ""); responseMsg.Parts.Add(responsePart); } } catch (WarehouseAdapterException ex) { responseMsg.Parts.Clear(); MessagePart part = CreateEmptyMessagePart(2); part.Properties.Write("ErrorCode", WarehouseAlarm); part.Properties.Write("Message", ex.Message); responseMsg.Parts.Add(part); throw; } catch (Exception) { responseMsg.Parts.Clear(); MessagePart part = CreateEmptyMessagePart(2); part.Properties.Write("ErrorCode", (int)VocollectErrorCodeCritialError); part.Properties.Write("Message", GetCriticalErrorMessageText(msg)); responseMsg.Parts.Add(part); throw; } finally { TransmitResponseMessage(responseMsg, session); } }
/// <summary> /// Drops a load carrier at the specified area and location. /// </summary> /// <param name="seqnum">The sequence number of the load carrier to drop.</param> /// <param name="dropArea">The drop area.</param> /// <param name="dropAddress">The drop location.</param> /// <param name="session">The current session.</param> /// <returns></returns> public static CorrelationContext DropLoadCarrier(string seqnum, string dropArea, string dropAddress, VocollectSession session) { MultiPartMessage dropMsg = CreateRequestMessage("wlvoicepick", "drop_loadcarrier", session); dropMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); dropMsg.Properties.Write("PBHEADID_I", session.ReadAsString("PBHEADID")); dropMsg.Properties.Write("SEQNUM_I", seqnum); dropMsg.Properties.Write("DROPWSID_I", dropArea); dropMsg.Properties.Write("DROPWPADR_I", dropAddress); dropMsg.Properties.Write("ALMID_O", ""); CorrelationContext context; MessageEngine.Instance.TransmitRequestMessage(dropMsg, dropMsg.MessageId, out context); return(context); }
public override void Invoke(MultiPartMessage msg, VocollectSession session) { /* Ignore ODRs stored in flash output queue after terminal reset */ if (session == null) { return; } CatchMeasure measure = new CatchMeasure(); measure.Measurement = msg.Properties.ReadAsDouble("VariableWeight"); session.CatchMeasureEntries.Add(measure); if (msg.Properties.ReadAsString("TransmissionStatus") == "1") { /* Final variable weight message */ try { MultiPartMessage pickedMsg = new MultiPartMessage(); pickedMsg.Properties.Write("AssignmentId", session.ReadAsString("PBHEADID")); pickedMsg.Properties.Write("WorkId", "1"); pickedMsg.Properties.Write("LocationId", msg.Properties.ReadAsString("LocationId")); pickedMsg.Properties.Write("QuantityPicked", (double)session.CatchMeasureEntries.Count); pickedMsg.Properties.Write("PickedStatus", "1"); pickedMsg.Properties.Write("ContainerId", TrimContainerId(msg.Properties.ReadAsString("ContainerId"))); pickedMsg.Properties.Write("Sequence", msg.Properties.ReadAsString("Sequence")); pickedMsg.Properties.Write("DiscrepancyCode", session.ReadAsString("RESTCOD")); pickedMsg.Properties.Write("SplitExchange", "0"); try { PrTaskLUTPicked.ProcessPickedMessage(pickedMsg, session); } catch (Exception ex) { session.Write("CatchMeasureException", ex); throw; } } finally { session.CatchMeasureEntries.Clear(); } } }
public override void Invoke(MultiPartMessage msg, VocollectSession session) { MultiPartMessage responseMsg = CreateResponseMessage(msg); responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeInformationalError); responseMsg.Properties.Write("Message", ""); try { MultiPartMessage whMsg = CreateRequestMessage("wlvoicepick", "replenish_loc", session); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); whMsg.Properties.Write("PBROWID_I", msg.Properties.ReadAsString("Sequence")); whMsg.Properties.Write("EMPID_I", session.ReadAsString("EMPID")); whMsg.Properties.Write("NLANGCOD_I", session.ReadAsString("NLANGCOD")); whMsg.Properties.Write("ALMID_O", ""); whMsg.Properties.Write("RESULT_O", ""); CorrelationContext context; MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); responseMsg.Properties.Write("Message", context.ResponseMessages[0].Properties.ReadAsString("RESULT_O").ToLower()); } catch (WarehouseAdapterException ex) { responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeInformationalError); responseMsg.Properties.Write("Message", ex.Message); throw; } catch (Exception) { responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeCritialError); responseMsg.Properties.Write("Message", GetCriticalErrorMessageText(msg)); throw; } finally { TransmitResponseMessage(responseMsg, session); } }
public override void Invoke(MultiPartMessage msg, VocollectSession session) { MultiPartMessage responseMsg = CreateResponseMessage(msg); responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeInformationalError); responseMsg.Properties.Write("Message", ""); try { MultiPartMessage whMsg = CreateRequestMessage("wlvoicepick", "check_repl_status", session); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); whMsg.Properties.Write("PPKEY_I", ExtractPickPlaceKey(msg.Properties.ReadAsString("LocationId"))); whMsg.Properties.Write("NLANGCOD_I", session.ReadAsString("NLANGCOD")); whMsg.Properties.Write("RESULT_O", ""); CorrelationContext context; MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); responseMsg.Properties.Write("Message", context.ResponseMessages[0].Properties.ReadAsString("RESULT_O")); } catch (WarehouseAdapterException ex) { responseMsg.Properties.Write("ErrorCode", WarehouseAlarm); responseMsg.Properties.Write("Message", ex.Message); throw; } catch (Exception) { responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeCritialError); responseMsg.Properties.Write("Message", GetCriticalErrorMessageText(msg)); throw; } finally { TransmitResponseMessage(responseMsg, session); } }
/// <summary> /// Creates a request message ready to be transmitted to the WMS. /// </summary> /// <param name="packageName">Package name.</param> /// <param name="procedureName">Name of stored procedure to call.</param> /// <param name="session">The current <see cref="VocollectSession"/> object.</param> /// <returns>A <see cref="MultiPartMessage"/> that can be sent to the WMS.</returns> protected static MultiPartMessage CreateRequestMessage(string packageName, string procedureName, VocollectSession session) { MultiPartMessage msg = new VocollectMessage(); VocollectSection configSection = ConfigurationManager.GetSection(VocollectSection.SectionKey) as VocollectSection; msg.Metadata.Write("SendUri", new Uri(string.Format("warehouse://{2}/{0}/{1}", packageName, procedureName, configSection.Database))); if (session != null) { msg.Metadata.Write("LanguageCode", session.ReadAsString("NLANGCOD")); } return(msg); }
/// <summary> /// Verifies and connects the pick truck of a definitely stopped pick order. /// </summary> /// <param name="session">The current session.</param> /// <param name="verifyVehicleId">The vehicle id to verify.</param> public static void VerifyAndConnectPickTruck(VocollectSession session, string assignmentId, string vehicleId, string verifyVehicleId) { MultiPartMessage tuMsg = CreateRequestMessage("wlvoicepick", "verify_and_connect_tu", session); tuMsg.Properties.Write("PBHEADID_I", assignmentId); tuMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); tuMsg.Properties.Write("TUID_I", vehicleId); tuMsg.Properties.Write("VERIFY_TUID_I", verifyVehicleId); tuMsg.Properties.Write("VERIFY_TUID_O", ""); tuMsg.Properties.Write("ALMID_O", ""); CorrelationContext context; MessageEngine.Instance.TransmitRequestMessage(tuMsg, tuMsg.MessageId, out context); //Update session with new vehicle id session.Write("TUID", context.ResponseMessages[0].Properties.ReadAsString("VERIFY_TUID_O")); }
/// <summary> /// Invokes the subscriber. /// </summary> /// <param name="msg">A reference to the subscribed message.</param> /// <param name="session">The current <see cref="VocollectSession"/> object.</param> /// <exception cref="WarehouseAdapterException"> /// </exception> /// <exception cref="MessageEngineException"> /// </exception> public override void Invoke(MultiPartMessage msg, VocollectSession session) { MultiPartMessage responseMsg = CreateResponseMessage(msg); responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeNoError); responseMsg.Properties.Write("Message", ""); try { using (TransactionScope transactionScope = new TransactionScope()) { //Drop last load carrier from PrTaskLUTGetDeliveryLocation if (!string.IsNullOrEmpty(session.ReadAsString("DROPSEQNUM"))) { PrTaskLUTAltDeliveryLocations.DropLoadCarrier(session.ReadAsString("DROPSEQNUM"), session.ReadAsString("DROPWSID"), session.ReadAsString("DROPWPADR"), session); } MultiPartMessage whMsg = CreateRequestMessage("wlvoicepick", "finish_pick", session); whMsg.Properties.Write("PBHEADID_I", session.ReadAsString("PBHEADID")); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); string CPL_PRINTCOD = session.ReadAsString("CPL_PRINTCOD"); string PLCP_PRINTCOD = session.ReadAsString("PLCP_PRINTCOD"); if (session.Contains("PRINTERNUMBER")) { whMsg.Properties.Write("PRTID_I", session.ReadAsString("PRINTERNUMBER")); } else { whMsg.Properties.Write("PRTID_I", ""); } whMsg.Properties.Write("ALMID_O", ""); CorrelationContext context; MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); transactionScope.Complete(); session.Write("PBHEADID", ""); session.CurrentAssignmentData = null; } } catch (WarehouseAdapterException ex) { responseMsg.Properties.Write("ErrorCode", WarehouseAlarm); responseMsg.Properties.Write("Message", ex.Message); throw; } catch (Exception) { responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeCritialError); responseMsg.Properties.Write("Message", GetCriticalErrorMessageText(msg)); throw; } finally { TransmitResponseMessage(responseMsg, session); } }
public static void ProcessPickedMessage(MultiPartMessage msg, VocollectSession session) { CorrelationContext context; using (TransactionScope transactionScope = new TransactionScope()) { #region Exchange Container logic if ((msg.Properties.ReadAsString("SplitExchange") == "2") || (msg.Properties.ReadAsString("SplitExchange") == "3")) { /* Exchange line to new PLC */ MultiPartMessage exchangeMsg = CreateRequestMessage("wlvoicepick", "change_loadcarrier", session); exchangeMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); exchangeMsg.Properties.Write("PBHEADID_I", session.ReadAsString("PBHEADID")); exchangeMsg.Properties.Write("PBROWID_I", msg.Properties.ReadAsString("Sequence")); exchangeMsg.Properties.Write("SEQNUM_I", TrimContainerId(msg.Properties.ReadAsString("ContainerId"))); if (msg.Properties.ReadAsString("SplitExchange") == "3") { exchangeMsg.Properties.Write("CHANGEREST_I", "1"); } else { exchangeMsg.Properties.Write("CHANGEREST_I", "0"); } exchangeMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(exchangeMsg, exchangeMsg.MessageId, out context); transactionScope.Complete(); return; } #endregion #region Split Line logic if ((msg.Properties.ReadAsString("SplitExchange") == "1") && (session.ReadAsString("SPLIT_STATUS") == "0")) { /* Ignore first msg during split process for original PLC */ session.Write("SPLIT_STATUS", "1"); session.Write("SPLIT_PBROWID", msg.Properties.ReadAsString("Sequence")); return; } else if ((msg.Properties.ReadAsString("SplitExchange") == "0") && (session.ReadAsString("SPLIT_STATUS") == "1")) { /* Second msg during split process for original PLC */ MultiPartMessage splitMsg = CreateRequestMessage("wlvoicepick", "split_pickorderrow", session); splitMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); splitMsg.Properties.Write("PBROWID_I", session.ReadAsString("SPLIT_PBROWID")); splitMsg.Properties.Write("PICKQTY_I", msg.Properties.ReadAsDouble("QuantityPicked")); splitMsg.Properties.Write("PBROWID_O", ""); splitMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(splitMsg, splitMsg.MessageId, out context); msg.Properties.Write("Sequence", session.ReadAsString("SPLIT_PBROWID")); session.Write("SPLIT_PBROWID", context.ResponseMessages[0].Properties.ReadAsString("PBROWID_O")); session.Write("SPLIT_STATUS", "2"); msg.Properties.Write("PickedStatus", "1"); } else if ((msg.Properties.ReadAsString("SplitExchange") == "0") && (session.ReadAsString("SPLIT_STATUS") == "2") && (msg.Properties.ReadAsString("PickedStatus") == "0")) { /* Check for discrepancy during split process for new PLC */ msg.Properties.Write("Sequence", session.ReadAsString("SPLIT_PBROWID")); } else if ((msg.Properties.ReadAsString("SplitExchange") == "0") && (session.ReadAsString("SPLIT_STATUS") == "2") && (msg.Properties.ReadAsString("PickedStatus") == "1")) { /* Final msg during split process for new PLC */ /* Move splitted line to new PLC */ MultiPartMessage exchangeMsg = CreateRequestMessage("wlvoicepick", "change_loadcarrier", session); exchangeMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); exchangeMsg.Properties.Write("PBHEADID_I", session.ReadAsString("PBHEADID")); exchangeMsg.Properties.Write("PBROWID_I", session.ReadAsString("SPLIT_PBROWID")); exchangeMsg.Properties.Write("SEQNUM_I", TrimContainerId(msg.Properties.ReadAsString("ContainerId"))); exchangeMsg.Properties.Write("CHANGEREST_I", "0"); exchangeMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(exchangeMsg, exchangeMsg.MessageId, out context); msg.Properties.Write("Sequence", session.ReadAsString("SPLIT_PBROWID")); session.Write("SPLIT_STATUS", "0"); session.Write("SPLIT_PBROWID", ""); } else if ((msg.Properties.ReadAsString("SplitExchange") == "1") && (session.ReadAsString("SPLIT_STATUS") == "2")) { msg.Properties.Write("Sequence", session.ReadAsString("SPLIT_PBROWID")); session.Write("SPLIT_STATUS", "1"); } #endregion MultiPartMessage whMsg = CreateRequestMessage("wlvoicepick", "modify_pickorderrow", session); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); whMsg.Properties.Write("PBROWID_I", msg.Properties.ReadAsString("Sequence")); double pickedQuantity = msg.Properties.ReadAsDouble("QuantityPicked"); string discrepancyCode = msg.Properties.ReadAsString("DiscrepancyCode"); #region Discrepancy code logic for strike through if (discrepancyCode == "00") { discrepancyCode = ""; } if ((pickedQuantity == 0) && (msg.Properties.ReadAsString("LocationId") == session.ReadAsString("PREV_PPKEY")) && (string.IsNullOrEmpty(discrepancyCode))) { discrepancyCode = session.ReadAsString("RESTCOD"); } #endregion #region Catch Measure logic double measQty = 0; if (session.CatchMeasureEntries.Count > 0) { for (int i = 0; i < pickedQuantity; i++) { measQty += session.CatchMeasureEntries[session.CatchMeasureEntries.Count - 1 - i].Measurement; } } #endregion whMsg.Properties.Write("PICKQTY_I", pickedQuantity); whMsg.Properties.Write("RESTCOD_I", discrepancyCode); whMsg.Properties.Write("MEASQTY_I", measQty); whMsg.Properties.Write("PRODLOT_I", session.ReadAsString("PRODLOT")); whMsg.Properties.Write("PRODLOTQTY_I", session.ReadAsDouble("PRODLOTQTY")); whMsg.Properties.Write("EMPID_I", session.ReadAsString("EMPID")); whMsg.Properties.Write("SEQNUM_I", TrimContainerId(msg.Properties.ReadAsString("ContainerId"))); whMsg.Properties.Write("Acknowledge_I", msg.Properties.ReadAsString("PickedStatus")); whMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); transactionScope.Complete(); /* Save data in session about current pick */ session.Write("PREV_PPKEY", msg.Properties.ReadAsString("LocationId")); session.Write("RESTCOD", discrepancyCode); session.Write("PBROWID", msg.Properties.ReadAsString("Sequence")); session.Write("PRODLOT", ""); session.Write("PRODLOTQTY", 0d); if (session.CatchMeasureEntries.Count > 0) { for (int i = 0; i < pickedQuantity; i++) { session.CatchMeasureEntries.RemoveAt(session.CatchMeasureEntries.Count - 1); } } } }
/// <summary> /// Invokes the subscriber. /// </summary> /// <param name="msg">A reference to the subscribed message.</param> /// <param name="session">The current <see cref="VocollectSession"/> object.</param> /// <exception cref="WarehouseAdapterException"> /// </exception> /// <exception cref="MessageEngineException"> /// </exception> public override void Invoke(MultiPartMessage msg, VocollectSession session) { MultiPartMessage responseMsg = CreateResponseMessage(msg); try { MultiPartMessage whMsg = CreateRequestMessage("wlvoicepick", "get_mt_pbcar_pbrow", session); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); whMsg.Properties.Write("PBHEADID_I", session.ReadAsString("PBHEADID")); whMsg.Properties.Write("SEQNUM_I", TrimContainerId(msg.Properties.ReadAsString("ContainerId"))); whMsg.Properties.Write("PBROW_Cur_O", new object()); whMsg.Properties.Write("ALMID_O", ""); CorrelationContext context; MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); if (context.ResponseMessages[0].Parts.Count > 0) { foreach (MessagePart part in context.ResponseMessages[0].Parts) { MessagePart responsePart = new VocollectMessagePart(); responsePart.Properties.Write("ContainerId", msg.Properties.Read("ContainerId")); responsePart.Properties.Write("Description", part.Properties.Read("ARTNAME1")); responsePart.Properties.Write("Quantity", part.Properties.Read("PICKQTY")); responsePart.Properties.Write("Location", ""); responsePart.Properties.Write("PickTime", ""); responsePart.Properties.Write("ErrorCode", VocollectErrorCodeNoError); responsePart.Properties.Write("Message", ""); responseMsg.Parts.Add(responsePart); } } else { MessagePart part = CreateEmptyMessagePart(7); responseMsg.Parts.Add(part); } } catch (WarehouseAdapterException ex) { responseMsg.Parts.Clear(); MessagePart part = CreateEmptyMessagePart(7); part.Properties.Write("ErrorCode", WarehouseAlarm); part.Properties.Write("Message", ex.Message); responseMsg.Parts.Add(part); throw; } catch (Exception) { responseMsg.Parts.Clear(); MessagePart part = CreateEmptyMessagePart(7); part.Properties.Write("ErrorCode", VocollectErrorCodeCritialError); part.Properties.Write("Message", GetCriticalErrorMessageText(msg)); responseMsg.Parts.Add(part); throw; } finally { TransmitResponseMessage(responseMsg, session); } }
/// <summary> /// Invokes the subscriber. /// </summary> /// <param name="msg">A reference to the subscribed message.</param> /// <param name="session">The current <see cref="VocollectSession"/> object.</param> /// <exception cref="WarehouseAdapterException"> /// </exception> /// <exception cref="MessageEngineException"> /// </exception> public override void Invoke(MultiPartMessage msg, VocollectSession session) { MultiPartMessage responseMsg = CreateResponseMessage(msg); responseMsg.Properties.Write("ErrorCode", (int)VocollectErrorCodeNoError); responseMsg.Properties.Write("Message", ""); try { bool signOff = false; using (TransactionScope transactionScope = new TransactionScope()) { CorrelationContext context; string holdType = ""; switch (msg.Properties.ReadAsInt("DefiniteStop")) { case VocollectHoldTypeTemporary: holdType = HoldTypeTemporary; break; case VocollectHoldTypeDefinite: holdType = HoldTypeDefinite; break; case VocollectHoldTypeNormal: if (!string.IsNullOrEmpty(session.ReadAsString("PBHEADID"))) { holdType = HoldTypeTemporary; signOff = true; } break; } if (!string.IsNullOrEmpty(holdType)) { string area = ""; string location = ""; if (holdType == HoldTypeDefinite) { if ((session.ReadAsString("PRINTED") == "1") || ((session.ReadAsString("PRINTED") == "0") && (session.ReadAsString("CPL_PRINTCOD") == "AP") && (session.ReadAsString("PLCP_PRINTCOD") == "AP")) || ((session.ReadAsString("PRINTED") == "0") && (session.ReadAsString("CPL_PRINTCOD") == "N") && (session.ReadAsString("PLCP_PRINTCOD") == "N"))) { #region Verify Location MultiPartMessage locMsg = CreateRequestMessage("wlvoicepick", "verify_loc", session); locMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); locMsg.Properties.Write("WSID_IO", msg.Properties.ReadAsString("Area")); locMsg.Properties.Write("WPADR_I", msg.Properties.ReadAsString("Location")); locMsg.Properties.Write("WHID_I", session.ReadAsString("WHID")); locMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(locMsg, locMsg.MessageId, out context); area = context.ResponseMessages[0].Properties.ReadAsString("WSID_IO"); location = msg.Properties.ReadAsString("Location"); #endregion } else { responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeInvalidLocation); responseMsg.Properties.Write("Message", GetCachedAlarmText("VOICEPICK016", session)); return; } } #region Stop Pick MultiPartMessage stopMsg = CreateRequestMessage("wlvoicepick", "hold_rfpick", session); stopMsg.Properties.Write("PBHEADID_I", session.ReadAsString("PBHEADID")); stopMsg.Properties.Write("WSID_I", area); stopMsg.Properties.Write("WPADR_I", location); stopMsg.Properties.Write("EMPID_I", msg.Properties.ReadAsString("Operator")); stopMsg.Properties.Write("TERID_I", msg.Properties.ReadAsString("SerialNumber")); stopMsg.Properties.Write("HOLD_TYPE_I", holdType); stopMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(stopMsg, stopMsg.MessageId, out context); #endregion } if ((holdType != HoldTypeTemporary) || (signOff)) { #region Disconnect Terminal From Pick Truck if ((session != null) && (!string.IsNullOrEmpty(session.ReadAsString("TUID")))) { MultiPartMessage whMsg = CreateRequestMessage("wlvoicepick", "disconnect_ter_from_pt", session); whMsg.Properties.Write("TERID_I", msg.Properties.ReadAsString("SerialNumber")); whMsg.Properties.Write("TUID_I", session.ReadAsString("TUID")); whMsg.Properties.Write("KEEP_ONLINE_I", "0"); whMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); } #endregion #region Log Off MultiPartMessage logoffMsg = CreateRequestMessage("wlvoicepick", "logoff", session); logoffMsg.Properties.Write("TERID_I", msg.Properties.ReadAsString("SerialNumber")); logoffMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(logoffMsg, logoffMsg.MessageId, out context); SessionManager.Instance.DestroySession(msg.Properties.ReadAsString("SerialNumber")); #endregion } transactionScope.Complete(); } } catch (WarehouseAdapterException ex) { responseMsg.Properties.Write("Message", ex.Message); if (ex.AlarmId == "WS001") { responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeAddressNotUnique); } else if (ex.AlarmId == "WP001") { responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeInvalidLocation); } else { responseMsg.Properties.Write("ErrorCode", WarehouseAlarm); throw; } } catch (Exception) { responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeCritialError); responseMsg.Properties.Write("Message", GetCriticalErrorMessageText(msg)); throw; } finally { TransmitResponseMessage(responseMsg, session); } }
/// <summary> /// Invokes the subscriber. /// </summary> /// <param name="msg">A reference to the subscribed message.</param> /// <param name="session">The current <see cref="VocollectSession"/> object.</param> /// <exception cref="WarehouseAdapterException"> /// </exception> /// <exception cref="MessageEngineException"> /// </exception> public override void Invoke(MultiPartMessage msg, VocollectSession session) { MultiPartMessage responseMsg = CreateResponseMessage(msg); try { int addQty = msg.Properties.ReadAsInt("PackagingQty"); CorrelationContext context = null; switch (msg.Properties.ReadAsString("PackagingTransaction")) { case "0": MultiPartMessage whMsg = CreateRequestMessage("wlvoicepick", "get_mt_pbcarpm", session); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); whMsg.Properties.Write("PBHEADID_I", session.ReadAsString("PBHEADID")); whMsg.Properties.Write("SEQNUM_I", TrimContainerId(msg.Properties.ReadAsString("ContainerId"))); whMsg.Properties.Write("PBCARPM_Cur_O", new object()); whMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); if (context.ResponseMessages[0].Parts.Count > 0) { foreach (MessagePart part in context.ResponseMessages[0].Parts) { VocollectMessagePart responsePart = new VocollectMessagePart(); responsePart.Properties.Write("PackNumber", part.Properties.Read("PMTYPID")); responsePart.Properties.Write("PackQuantity", part.Properties.Read("ADDQTY")); responsePart.Properties.Write("ErrorCode", VocollectErrorCodeNoError); responsePart.Properties.Write("Message", ""); responseMsg.Parts.Add(responsePart); } } else { MessagePart part = CreateEmptyMessagePart(4); part.Properties.Write("ErrorCode", VocollectErrorCodeNoPackaging); part.Properties.Write("Message", ""); responseMsg.Parts.Add(part); } break; case "1": whMsg = CreateRequestMessage("wlvoicepick", "modify_pm", session); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); whMsg.Properties.Write("PBHEADID_I", session.ReadAsString("PBHEADID")); whMsg.Properties.Write("SEQNUM_I", TrimContainerId(msg.Properties.ReadAsString("ContainerId"))); whMsg.Properties.Write("PMTYPID_I", msg.Properties.Read("PackNumber").ToString()); whMsg.Properties.Write("ADDQTY_I", addQty); whMsg.Properties.Write("EMPID_I", session.ReadAsString("EMPID")); whMsg.Properties.Write("NEWQTY_O", 0); whMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); goto case "0"; case "2": addQty = -addQty; goto case "1"; } } catch (WarehouseAdapterException ex) { responseMsg.Parts.Clear(); MessagePart part = CreateEmptyMessagePart(4); if (ex.AlarmId == "PBCARPM003") { part.Properties.Write("ErrorCode", VocollectErrorCodeNoPackaging); } else if (ex.AlarmId == "PMTYP001") { part.Properties.Write("ErrorCode", VocollectErrorCodeNoPackaging); } else { part.Properties.Write("ErrorCode", WarehouseAlarm); } part.Properties.Write("Message", ex.Message); responseMsg.Parts.Add(part); throw; } catch (Exception) { responseMsg.Parts.Clear(); MessagePart part = CreateEmptyMessagePart(4); part.Properties.Write("ErrorCode", VocollectErrorCodeCritialError); part.Properties.Write("Message", GetCriticalErrorMessageText(msg)); responseMsg.Parts.Add(part); throw; } finally { TransmitResponseMessage(responseMsg, session); } }
/// <summary> /// Invokes the subscriber. /// </summary> /// <param name="msg">A reference to the subscribed message.</param> /// <param name="session">The current <see cref="VocollectSession"/> object.</param> /// <exception cref="WarehouseAdapterException"> /// </exception> /// <exception cref="MessageEngineException"> /// </exception> public override void Invoke(MultiPartMessage msg, VocollectSession session) { MultiPartMessage responseMsg = CreateResponseMessage(msg); responseMsg.Properties.Write("DeliveryLocation", ""); responseMsg.Properties.Write("DeliveryLocationCheckDigits", 0); responseMsg.Properties.Write("ContainerId", 0); responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeNoError); responseMsg.Properties.Write("Message", ""); try { using (TransactionScope transactionScope = new TransactionScope()) { /* Execute drop of previous container if not already dropped using the alternate delivery command */ if (!string.IsNullOrEmpty(session.ReadAsString("DROPSEQNUM"))) { PrTaskLUTAltDeliveryLocations.DropLoadCarrier(session.ReadAsString("DROPSEQNUM"), session.ReadAsString("DROPWSID"), session.ReadAsString("DROPWPADR"), session); } MultiPartMessage whMsg = CreateRequestMessage("wlvoicepick", "get_drop_location", session); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); whMsg.Properties.Write("PBHEADID_I", session.ReadAsString("PBHEADID")); whMsg.Properties.Write("SEQNUM_I", TrimContainerId(msg.Properties.ReadAsString("ContainerId"))); whMsg.Properties.Write("DROPWSID_O", ""); whMsg.Properties.Write("DROPWPADR_O", ""); whMsg.Properties.Write("WPCOD_O", ""); whMsg.Properties.Write("SLOT_O", ""); whMsg.Properties.Write("ALMID_O", ""); CorrelationContext context; MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); PropertyCollection properties = context.ResponseMessages[0].Properties; if (!string.IsNullOrEmpty(properties.ReadAsString("SLOT_O"))) { /* VOICEPICK015 = 'slot' */ string slot = GetCachedAlarmText("VOICEPICK015", session); responseMsg.Properties.Write("DeliveryLocation", properties.Read("DROPWSID_O") + " , " + properties.Read("DROPWPADR_O") + " , " + slot + " , " + properties.Read("SLOT_O")); } else { responseMsg.Properties.Write("DeliveryLocation", properties.Read("DROPWSID_O") + " , " + properties.Read("DROPWPADR_O")); } if (session.ReadAsString("VERIFY_DROPWPADR") == "1") { string checkDigits = properties.ReadAsString("WPCOD_O"); if (!string.IsNullOrEmpty(checkDigits)) { long temp; if (!long.TryParse(checkDigits, out temp)) { checkDigits = ""; } if (checkDigits.Length > session.ReadAsInt("VOICE_MIN_DIGITS_PPCODE")) { checkDigits = checkDigits.Substring(checkDigits.Length - session.ReadAsInt("VOICE_MIN_DIGITS_PPCODE"), session.ReadAsInt("VOICE_MIN_DIGITS_PPCODE")); } } responseMsg.Properties.Write("DeliveryLocationCheckDigits", checkDigits); } else { responseMsg.Properties.Write("DeliveryLocationCheckDigits", ""); } responseMsg.Properties.Write("ContainerId", msg.Properties.ReadAsString("ContainerId")); session.Write("DROPSEQNUM", TrimContainerId(msg.Properties.ReadAsString("ContainerId"))); session.Write("DROPWSID", properties.Read("DROPWSID_O")); session.Write("DROPWPADR", properties.Read("DROPWPADR_O")); transactionScope.Complete(); } } catch (WarehouseAdapterException ex) { responseMsg.Properties.Write("ErrorCode", WarehouseAlarm); responseMsg.Properties.Write("Message", ex.Message); throw; } catch (Exception) { responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeCritialError); responseMsg.Properties.Write("Message", GetCriticalErrorMessageText(msg)); throw; } finally { TransmitResponseMessage(responseMsg, session); } }
/// <summary> /// Invokes the subscriber. /// </summary> /// <param name="msg">A reference to the subscribed message.</param> /// <param name="session">The current <see cref="VocollectSession"/> object.</param> /// <exception cref="WarehouseAdapterException"> /// </exception> /// <exception cref="MessageEngineException"> /// </exception> public override void Invoke(MultiPartMessage msg, VocollectSession session) { MultiPartMessage responseMsg = CreateResponseMessage(msg); try { using (TransactionScope transactionScope = new TransactionScope()) { CorrelationContext context; if (!string.IsNullOrEmpty(session.ReadAsString("TUID"))) { MultiPartMessage tuMsg = CreateRequestMessage("wlvoicepick", "disconnect_ter_from_pt", session); tuMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); tuMsg.Properties.Write("TUID_I", session.ReadAsString("TUID")); tuMsg.Properties.Write("KEEP_ONLINE_I", "0"); tuMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(tuMsg, tuMsg.MessageId, out context); } MultiPartMessage whMsg = CreateRequestMessage("wlvoicepick", "connect_ter_to_pt", session); whMsg.Properties.Write("TUID_I", msg.Properties.ReadAsString("VehicleId")); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); whMsg.Properties.Write("PBHEADID_I", session.ReadAsString("PBHEADID")); whMsg.Properties.Write("TUID_O", ""); whMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); MessagePart responsePart = new VocollectMessagePart(); responsePart.Properties.Write("SafetyCheck", ""); responsePart.Properties.Write("ErrorCode", VocollectErrorCodeNoError); responsePart.Properties.Write("Message", ""); responseMsg.Parts.Add(responsePart); session.Write("TUID", context.ResponseMessages[0].Properties.ReadAsString("TUID_O")); session.Write("UPDATE_PBCAR", "1"); transactionScope.Complete(); } } catch (WarehouseAdapterException ex) { responseMsg.Parts.Clear(); MessagePart part = CreateEmptyMessagePart(3); part.Properties.Write("ErrorCode", WarehouseAlarm); part.Properties.Write("Message", ex.Message); responseMsg.Parts.Add(part); throw; } catch (Exception) { responseMsg.Parts.Clear(); MessagePart part = CreateEmptyMessagePart(3); part.Properties.Write("ErrorCode", VocollectErrorCodeCritialError); part.Properties.Write("Message", GetCriticalErrorMessageText(msg)); responseMsg.Parts.Add(part); throw; } finally { TransmitResponseMessage(responseMsg, session); } }
/// <summary> /// Invokes the subscriber. /// </summary> /// <param name="msg">A reference to the subscribed message.</param> /// <param name="session">The current <see cref="VocollectSession"/> object.</param> /// <exception cref="WarehouseAdapterException"> /// </exception> /// <exception cref="MessageEngineException"> /// </exception> public override void Invoke(MultiPartMessage msg, VocollectSession session) { MultiPartMessage responseMsg = CreateResponseMessage(msg); try { CorrelationContext context; if (!string.IsNullOrEmpty(session.ReadAsString("PBROWID"))) { /* Refresh rows in status Registrated before the shorts pass */ MultiPartMessage refreshMsg = CreateRequestMessage("wlvoicepick", "refresh_pickorderrows", session); refreshMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); refreshMsg.Properties.Write("PBHEADID_I", session.ReadAsString("PBHEADID")); refreshMsg.Properties.Write("EMPID_I", session.ReadAsString("EMPID")); refreshMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(refreshMsg, refreshMsg.MessageId, out context); } MultiPartMessage whMsg = CreateRequestMessage("wlvoicepick", "get_mt_pbrow", session); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); whMsg.Properties.Write("PBHEADID_I", session.ReadAsString("PBHEADID")); whMsg.Properties.Write("NLANGCOD_I", session.ReadAsString("NLANGCOD")); whMsg.Properties.Write("PBROW_Cur_O", new object()); whMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); PropertyCollection properties = context.ResponseMessages[0].Parts[0].Properties; string prevContainer = ""; string prevLocation = ""; int rowCount = 0; foreach (MessagePart part in context.ResponseMessages[0].Parts) { string status = null; double pickQty = 0; if ((part.Properties.ReadAsString("PBROWSTAT") == PBROWSTAT_Finished) && (part.Properties.ReadAsDouble("PICKQTY") < part.Properties.ReadAsDouble("ORDQTY"))) { rowCount++; status = "G"; //Go back for shortage pickQty = part.Properties.ReadAsDouble("ORDQTY") - part.Properties.ReadAsDouble("PICKQTY"); } else if (((part.Properties.ReadAsString("PBROWSTAT") == PBROWSTAT_Started) || (part.Properties.ReadAsString("PBROWSTAT") == PBROWSTAT_Registrated)) && (!string.IsNullOrEmpty(session.ReadAsString("PBROWID")))) { rowCount++; status = "S"; //Skipped pickQty = part.Properties.ReadAsDouble("ORDQTY"); } else if ((part.Properties.ReadAsString("PBROWSTAT") == PBROWSTAT_Started) || (part.Properties.ReadAsString("PBROWSTAT") == PBROWSTAT_Registrated)) { rowCount++; status = "N"; //Not picked pickQty = part.Properties.ReadAsDouble("ORDQTY"); } else { status = "P"; //Picked } MessagePart responsePart = new VocollectMessagePart(); responsePart.Properties.Write("Status", status); responsePart.Properties.Write("BaseItem", "0"); responsePart.Properties.Write("Sequence", part.Properties.Read("PBROWID")); /* Check if multiple picks for same location and pick load carrier */ if ((prevLocation == part.Properties.ReadAsString("PPKEY")) && (prevContainer == part.Properties.ReadAsString("SEQNUM")) && (session.ReadAsInt("NOCARS") == 1)) { /* Append PBROWID to make location unique to prevent terminal from merging the lines */ responsePart.Properties.Write("LocationId", string.Format("{0}|{1}|{2}", part.Properties.Read("PPKEY"), part.Properties.ReadAsString("ITEID"), part.Properties.Read("PBROWID"))); } else { /*Append PAKID to make location unique for each pick package. Will prevent terminal from merging different pick packages*/ responsePart.Properties.Write("LocationId", string.Format("{0}|{1}|{2}", part.Properties.Read("PPKEY"), part.Properties.ReadAsString("ITEID"), part.Properties.Read("PAKID"))); } responsePart.Properties.Write("Region", "0"); /* VOICEPICK013 = 'Go to area {0}' */ string preAisle = GetCachedAlarmText("VOICEPICK013", session); preAisle = string.Format(preAisle, part.Properties.ReadAsString("WSNAME").PadRight(35, ' ')); responsePart.Properties.Write("PreAisleDirection", preAisle); responsePart.Properties.Write("Aisle", part.Properties.ReadAsString("AISLE").PadRight(3, ' ')); responsePart.Properties.Write("PostAisleDirection", ""); string slot = part.Properties.ReadAsString("WPADR"); string itemLoadId = part.Properties.ReadAsString("ITEID"); if (!string.IsNullOrEmpty(itemLoadId)) { if (itemLoadId.Length > session.ReadAsInt("VOICE_DIGITS_ITEID")) { itemLoadId = itemLoadId.Substring(itemLoadId.Length - session.ReadAsInt("VOICE_DIGITS_ITEID"), session.ReadAsInt("VOICE_DIGITS_ITEID")); } } if ((part.Properties.ReadAsString("PBROWSTAT") == PBROWSTAT_Registrated) || (((part.Properties.ReadAsString("ITEVERIFY") == "1") || (part.Properties.ReadAsString("ITETRACE") == "1")) && (string.IsNullOrEmpty(part.Properties.ReadAsString("ITEID"))))) { /* No item load found */ slot += "," + GetCachedAlarmText("VOICEPICK010", session); } else if (part.Properties.ReadAsString("ITEVERIFY") == "1") { /* Append verify item load id to slot */ slot += string.Format("," + GetCachedAlarmText("VOICEPICK008", session), itemLoadId); } else if (part.Properties.ReadAsString("ITEVERIFY") == "2") { /* Append verify lot to slot */ string lot = part.Properties.ReadAsString("PRODLOT"); if (!string.IsNullOrEmpty(lot)) { if (lot.Length > session.ReadAsInt("VOICE_CHARS_PRODLOT")) { lot = lot.Substring(lot.Length - session.ReadAsInt("VOICE_CHARS_PRODLOT"), session.ReadAsInt("VOICE_CHARS_PRODLOT")); } } slot += string.Format("," + GetCachedAlarmText("VOICEPICK017", session), lot); } else if (!string.IsNullOrEmpty(part.Properties.ReadAsString("ITEID"))) { /* Append item load id to slot */ slot += string.Format("," + GetCachedAlarmText("VOICEPICK009", session), itemLoadId); } responsePart.Properties.Write("Slot", slot.PadRight(64, ' ')); responsePart.Properties.Write("QuantityToPick", pickQty); responsePart.Properties.Write("UnitOfMeasure", part.Properties.ReadAsString("PAKNAME").Replace('"', ' ')); responsePart.Properties.Write("ItemNumber", part.Properties.Read("ARTID")); responsePart.Properties.Write("VariableWeight", part.Properties.Read("MEASURE")); /* Convert weight tolerances from per LUM to per package */ double baseQty = part.Properties.ReadAsDouble("BASEQTY"); if (string.IsNullOrEmpty(part.Properties.ReadAsString("MEASQTYLOTOL"))) { responsePart.Properties.Write("VariableWeightMinimum", "000000.0000"); } else { double weightMinimum = part.Properties.ReadAsDouble("MEASQTYLOTOL") * baseQty; responsePart.Properties.Write("VariableWeightMinimum", weightMinimum); } if (string.IsNullOrEmpty(part.Properties.ReadAsString("MEASQTYUPTOL"))) { responsePart.Properties.Write("VariableWeightMaximum", "999999.0000"); } else { double weightMaximum = part.Properties.ReadAsDouble("MEASQTYUPTOL") * baseQty; responsePart.Properties.Write("VariableWeightMaximum", weightMaximum); } responsePart.Properties.Write("QuantityPicked", "".PadLeft(5, '0')); #region Check digits, product verification id and item load id string checkDigits = part.Properties.ReadAsString("PPCODE"); if (part.Properties.ReadAsString("ITEVERIFY") == "1") { /* Verify pick location by item load id */ string verifyItemLoadId = part.Properties.ReadAsString("ITEID"); if (!string.IsNullOrEmpty(verifyItemLoadId)) { if (verifyItemLoadId.Length > session.ReadAsInt("VOICE_MIN_DIGITS_ITEVERIFY")) { verifyItemLoadId = verifyItemLoadId.Substring(verifyItemLoadId.Length - session.ReadAsInt("VOICE_MIN_DIGITS_ITEVERIFY"), session.ReadAsInt("VOICE_MIN_DIGITS_ITEVERIFY")); } } if ((part.Properties.ReadAsString("PBROWSTAT") == PBROWSTAT_Registrated) || ((part.Properties.ReadAsString("ITEVERIFY") == "1") && (string.IsNullOrEmpty(part.Properties.ReadAsString("ITEID"))))) { responsePart.Properties.Write("CheckDigits", ""); responsePart.Properties.Write("ScanProductId", part.Properties.ReadAsString("ITEID")); responsePart.Properties.Write("SpokenProductId", "00000"); } else { responsePart.Properties.Write("CheckDigits", "0"); responsePart.Properties.Write("ScanProductId", part.Properties.ReadAsString("ITEID")); responsePart.Properties.Write("SpokenProductId", verifyItemLoadId); } } else if (part.Properties.ReadAsString("ITEVERIFY") == "2") { /* Verify pick location by lot */ string verifyLot = part.Properties.ReadAsString("PRODLOT"); if (!string.IsNullOrEmpty(verifyLot)) { if (verifyLot.Length > session.ReadAsInt("VOICE_MIN_CHARS_PRODLOTVERIFY")) { verifyLot = verifyLot.Substring(verifyLot.Length - session.ReadAsInt("VOICE_MIN_CHARS_PRODLOTVERIFY"), session.ReadAsInt("VOICE_MIN_CHARS_PRODLOTVERIFY")); } } responsePart.Properties.Write("CheckDigits", "0"); responsePart.Properties.Write("ScanProductId", part.Properties.ReadAsString("PRODLOT")); responsePart.Properties.Write("SpokenProductId", verifyLot); } else if ((part.Properties.ReadAsString("PPVERIFY") == PPVERIFY_ARTID) || (part.Properties.ReadAsString("PPVERIFY") == PPVERIFY_EANDUN)) { /* Verify pick location by ARTID or EANDUN */ if (!string.IsNullOrEmpty(checkDigits)) { if (checkDigits.Length > session.ReadAsInt("VOICE_MIN_DIGITS_PPCODE")) { checkDigits = checkDigits.Substring(checkDigits.Length - session.ReadAsInt("VOICE_MIN_DIGITS_PPCODE"), session.ReadAsInt("VOICE_MIN_DIGITS_PPCODE")); } } responsePart.Properties.Write("CheckDigits", "0"); /* If the system hasn't found any item load dont verify anything */ if ((part.Properties.ReadAsString("PBROWSTAT") == PBROWSTAT_Registrated) && (string.IsNullOrEmpty(part.Properties.ReadAsString("ITEID")))) { responsePart.Properties.Write("CheckDigits", ""); } responsePart.Properties.Write("ScanProductId", checkDigits); responsePart.Properties.Write("SpokenProductId", checkDigits); } else { /* Verify pick location by pick location code */ if (!string.IsNullOrEmpty(checkDigits)) { if (checkDigits.Length > session.ReadAsInt("VOICE_MIN_DIGITS_PPCODE")) { checkDigits = checkDigits.Substring(checkDigits.Length - session.ReadAsInt("VOICE_MIN_DIGITS_PPCODE"), session.ReadAsInt("VOICE_MIN_DIGITS_PPCODE")); } long temp; if (!long.TryParse(checkDigits, out temp)) { checkDigits = ""; } } responsePart.Properties.Write("CheckDigits", checkDigits); responsePart.Properties.Write("ScanProductId", ""); responsePart.Properties.Write("SpokenProductId", ""); /* If the system hasn't found any item load dont verify anything */ if (((part.Properties.ReadAsString("PBROWSTAT") == PBROWSTAT_Registrated) || (part.Properties.ReadAsString("ITETRACE") == "1")) && (string.IsNullOrEmpty(part.Properties.ReadAsString("ITEID")))) { responsePart.Properties.Write("CheckDigits", ""); responsePart.Properties.Write("ScanProductId", part.Properties.ReadAsString("ITEID")); responsePart.Properties.Write("SpokenProductId", "00000"); } } #endregion responsePart.Properties.Write("Description", part.Properties.ReadAsString("ARTNAME1").Replace('"', ' ')); responsePart.Properties.Write("Size", ""); if (part.Properties.ReadAsString("PPVERIFY") == PPVERIFY_EANDUN) { responsePart.Properties.Write("UniversalProductCode", part.Properties.Read("PPCODE")); } else { responsePart.Properties.Write("UniversalProductCode", ""); } responsePart.Properties.Write("WorkId", "1"); responsePart.Properties.Write("DeliveryLocation", ""); responsePart.Properties.Write("Dummy", ""); responsePart.Properties.Write("Store", ""); responsePart.Properties.Write("CaseLabelCheckDigit", ""); responsePart.Properties.Write("TargetContainer", part.Properties.ReadAsString("SEQNUM").PadLeft(session.ReadAsInt("VOICE_MIN_DIGITS_CARCODE"), '0')); if (part.Properties.ReadAsString("SERIAL") == "1") { responsePart.Properties.Write("CaptureLot", "1"); responsePart.Properties.Write("LotText", GetCachedAlarmText("VOICEPICK006", session)); } else if ((part.Properties.ReadAsString("PRODLOT_VER") == "1") && (string.IsNullOrEmpty(part.Properties.ReadAsString("PRODLOTREQ")))) { responsePart.Properties.Write("CaptureLot", "1"); responsePart.Properties.Write("LotText", GetCachedAlarmText("VOICEPICK004", session)); } else { responsePart.Properties.Write("CaptureLot", "0"); responsePart.Properties.Write("LotText", ""); } responsePart.Properties.Write("PickMessage", part.Properties.ReadAsString("INSTRUCTIONS")); string verifyLocation = "0"; if (session.ReadAsString("VOICE_VERIFY_PP_BALANCE") == "1") { verifyLocation = "1"; } else if ((session.ReadAsString("VOICE_VERIFY_PP_BALANCE") == "2") && (status == "G")) { verifyLocation = "1"; } responsePart.Properties.Write("VerifyLocation", verifyLocation); responsePart.Properties.Write("CycleCount", "0"); responsePart.Properties.Write("CustomerId", PrTaskLUTContainer.GetCotainerHashCode(part)); if (part.Properties.ReadAsString("SERIAL") == "1") { responsePart.Properties.Write("PutLotPrompt", GetCachedAlarmText("VOICEPICK005", session)); } else if (part.Properties.ReadAsString("PRODLOT_VER") == "1") { responsePart.Properties.Write("PutLotPrompt", GetCachedAlarmText("VOICEPICK003", session)); } else { responsePart.Properties.Write("PutLotPrompt", ""); } responsePart.Properties.Write("ErrorCode", VocollectErrorCodeNoError); responsePart.Properties.Write("Message", ""); responseMsg.Parts.Add(responsePart); prevLocation = part.Properties.ReadAsString("PPKEY"); prevContainer = part.Properties.ReadAsString("SEQNUM"); } //Reset session values session.Write("PBROW_COUNT", rowCount); session.Write("SPLIT_PBROWID", ""); session.Write("SPLIT_STATUS", "0"); session.Write("PREV_PPKEY", ""); session.Write("RESTCOD", ""); session.Write("PRODLOT", ""); session.Write("PRODLOTQTY", 0d); } catch (WarehouseAdapterException ex) { responseMsg.Parts.Clear(); MessagePart part = CreateEmptyMessagePart(35); part.Properties.Write("ErrorCode", WarehouseAlarm); part.Properties.Write("Message", ex.Message); responseMsg.Parts.Add(part); throw; } catch (Exception) { responseMsg.Parts.Clear(); MessagePart part = CreateEmptyMessagePart(35); part.Properties.Write("ErrorCode", VocollectErrorCodeCritialError); part.Properties.Write("Message", GetCriticalErrorMessageText(msg)); responseMsg.Parts.Add(part); throw; } finally { TransmitResponseMessage(responseMsg, session); } }
/// <summary> /// Invokes the subscriber. /// </summary> /// <param name="msg">A reference to the subscribed message.</param> /// <param name="session">The current <see cref="VocollectSession"/> object.</param> /// <exception cref="WarehouseAdapterException"> /// </exception> /// <exception cref="MessageEngineException"> /// </exception> public override void Invoke(MultiPartMessage msg, VocollectSession session) { MultiPartMessage responseMsg = CreateResponseMessage(msg); WarehouseAdapterException printException = null; try { CorrelationContext context; MultiPartMessage whMsg; switch (msg.Properties.ReadAsInt("Operation")) { case 0: break; case 4: break; case 2: //Operatoion = Create new container whMsg = CreateRequestMessage("wlvoicepick", "new_loadcarrier", session); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); whMsg.Properties.Write("PBHEADID_I", session.ReadAsString("PBHEADID")); whMsg.Properties.Write("EMPID_I", session.ReadAsString("EMPID")); whMsg.Properties.Write("SEQNUM_I", TrimContainerId(msg.Properties.ReadAsString("TargetContainer"))); whMsg.Properties.Write("SEQNUM_O", ""); whMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); try { /* Automatically print label on default printer */ if ((session.ReadAsString("CPL_PRINTCOD") == "BP") || (session.ReadAsString("PLCP_PRINTCOD") == "BP")) { PrTaskLUTPrint.Print(null, context.ResponseMessages[0].Properties.ReadAsString("SEQNUM_O"), session); } } catch (WarehouseAdapterException ex) { printException = ex; } break; } whMsg = CreateRequestMessage("wlvoicepick", "get_mt_pbcar", session); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); whMsg.Properties.Write("PBHEADID_I", session.ReadAsString("PBHEADID")); whMsg.Properties.Write("PBCAR_Cur_O", new object()); whMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); if ((msg.Properties.ReadAsString("Operation") == "4") || (msg.Properties.ReadAsString("Operation") == "2")) { /* Send container list in reverse order when dropping or when a new container has been created */ for (int i = context.ResponseMessages[0].Parts.Count - 1; i >= 0; i--) { /* Do not send empty load carriers when dropping */ if ((context.ResponseMessages[0].Parts[i].Properties.ReadAsDouble("PIKNOPAKS") > 0) || (msg.Properties.ReadAsString("Operation") == "2") || (session.ReadAsString("UPDATE_PBCAR") == "1")) { responseMsg.Parts.Add(CreateResponsePart(context.ResponseMessages[0].Parts[i], session)); } } } else { /* Send container list in default order */ for (int i = 0; i < context.ResponseMessages[0].Parts.Count; i++) { responseMsg.Parts.Add(CreateResponsePart(context.ResponseMessages[0].Parts[i], session)); } } if (printException != null) { if (responseMsg.Parts.Count > 0) { /* Report print error as information, user may continue */ responseMsg.Parts[responseMsg.Parts.Count - 1].Properties.Write("ErrorCode", VocollectErrorCodeInformationalError); responseMsg.Parts[responseMsg.Parts.Count - 1].Properties.Write("Message", printException.Message); } } session.Write("NOCARS", context.ResponseMessages[0].Parts.Count); session.Write("UPDATE_PBCAR", "0"); } catch (WarehouseAdapterException ex) { responseMsg.Parts.Clear(); MessagePart part = CreateEmptyMessagePart(13); part.Properties.Write("ErrorCode", WarehouseAlarm); part.Properties.Write("Message", ex.Message); responseMsg.Parts.Add(part); throw; } catch (Exception) { responseMsg.Parts.Clear(); MessagePart part = CreateEmptyMessagePart(13); part.Properties.Write("ErrorCode", VocollectErrorCodeCritialError); part.Properties.Write("Message", GetCriticalErrorMessageText(msg)); responseMsg.Parts.Add(part); throw; } finally { TransmitResponseMessage(responseMsg, session); } }
/// <summary> /// Invokes the subscriber. /// </summary> /// <param name="msg">A reference to the subscribed message.</param> /// <param name="session">The current <see cref="VocollectSession"/> object.</param> /// <exception cref="WarehouseAdapterException"> /// </exception> /// <exception cref="MessageEngineException"> /// </exception> public override void Invoke(MultiPartMessage msg, VocollectSession session) { MultiPartMessage responseMsg = CreateResponseMessage(msg); responseMsg.Properties.Write("RegionNumber", 0); responseMsg.Properties.Write("Description", ""); responseMsg.Properties.Write("AutoAssign", 1); responseMsg.Properties.Write("NumberAssignmentsAllowed", 1); responseMsg.Properties.Write("SkipAisleAllowed", 0); responseMsg.Properties.Write("SkipSlotAllowed", 0); responseMsg.Properties.Write("RepickSkips", 0); responseMsg.Properties.Write("CpSpeakWorkIdentifier", 0); responseMsg.Properties.Write("PrintLabels", 0); responseMsg.Properties.Write("PrintChaseLabels", 0); responseMsg.Properties.Write("SpeakSlotDescription", 0); responseMsg.Properties.Write("PickPrompt", 2); responseMsg.Properties.Write("SpeakWorkId", 0); responseMsg.Properties.Write("SignOffAllowed", 0); responseMsg.Properties.Write("ContainerType", 1); responseMsg.Properties.Write("DeliverContainerAtClose", 0); responseMsg.Properties.Write("PassAssignment", 0); responseMsg.Properties.Write("Delivery", 1); responseMsg.Properties.Write("QuantityVerification", 1); responseMsg.Properties.Write("WorkIdLength", 0); responseMsg.Properties.Write("GoBackForShorts", 0); responseMsg.Properties.Write("AllowReversePicking", 0); responseMsg.Properties.Write("UseLut", 2); responseMsg.Properties.Write("CurrentPreAisle", "".PadRight(string.Format(GetCachedAlarmText("VOICEPICK013", session), "").Length + 35, 'X')); responseMsg.Properties.Write("CurrentAisle", "".PadRight(3, 'X')); responseMsg.Properties.Write("CurrentPostAisle", ""); responseMsg.Properties.Write("CurrentSlot", "".PadRight(64, 'X')); responseMsg.Properties.Write("PrintMultipleLabels", 0); responseMsg.Properties.Write("PromptOperatorForContainerId", 0); responseMsg.Properties.Write("AllowMultipleOpenContainersPerWorkId", 1); responseMsg.Properties.Write("SpokenContainerValidationLength", 1); responseMsg.Properties.Write("StopLineNumber", 0); responseMsg.Properties.Write("AllowAlternateDelivery", 0); responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeNoError); responseMsg.Properties.Write("Message", ""); try { MultiPartMessage whMsg = CreateRequestMessage("wlvoicepick", "get_mt_pz", session); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); whMsg.Properties.Write("EMPID_I", session.ReadAsString("EMPID")); whMsg.Properties.Write("PZID_I", session.ReadAsString("PZID")); whMsg.Properties.Write("WHID_I", session.ReadAsString("WHID")); whMsg.Properties.Write("PZ_Cur_O", new object()); whMsg.Properties.Write("ALMID_O", ""); CorrelationContext context; MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); PropertyCollection properties = context.ResponseMessages[0].Parts[0].Properties; responseMsg.Properties.Write("RegionNumber", msg.Properties.Read("RegionNumber")); responseMsg.Properties.Write("Description", properties.Read("PZNAME")); responseMsg.Properties.Write("SkipAisleAllowed", properties.Read("VOICE_ALLOW_SKIP_AISLE")); responseMsg.Properties.Write("SkipSlotAllowed", properties.Read("VOICE_ALLOW_SKIP_PP")); responseMsg.Properties.Write("RepickSkips", properties.Read("VOICE_ALLOW_REPICK_PP")); responseMsg.Properties.Write("QuantityVerification", properties.Read("VOICE_VERIFY_QTY")); responseMsg.Properties.Write("GoBackForShorts", properties.Read("VOICE_REPICK_SHORTED_PBROW")); responseMsg.Properties.Write("SpokenContainerValidationLength", properties.Read("VOICE_MIN_DIGITS_CARCODE")); #region Print Label Config PrintLabelConfig labelConfig = PrintLabelConfig.Never; string CPL_PRINTCOD = properties.ReadAsString("CPL_PRINTCOD"); string PLCP_PRINTCOD = properties.ReadAsString("PLCP_PRINTCOD"); if ((CPL_PRINTCOD == "AP") || (PLCP_PRINTCOD == "AP")) { labelConfig = PrintLabelConfig.AfterPick; } if ((CPL_PRINTCOD == "BP") || (PLCP_PRINTCOD == "BP")) { if (labelConfig == PrintLabelConfig.AfterPick) { labelConfig = PrintLabelConfig.BeforeAndAfterPick; } else { labelConfig = PrintLabelConfig.BeforePick; } } responseMsg.Properties.Write("PrintLabels", (int)labelConfig); #endregion if (string.IsNullOrEmpty(properties.ReadAsString("NO_OF_PBROWS"))) { responseMsg.Properties.Write("StopLineNumber", 0); } else { responseMsg.Properties.Write("StopLineNumber", properties.Read("NO_OF_PBROWS")); } responseMsg.Properties.Write("AllowAlternateDelivery", properties.Read("ALLOW_CHANGE_ON_DROPWPADR")); responseMsg.Properties.Write("PickPrompt", properties.Read("VOICE_PICK_PROMPT")); responseMsg.Properties.Write("Delivery", properties.Read("VERIFY_DROPWPADR")); session.Write("VOICE_VERIFY_PP_BALANCE", properties.Read("VOICE_VERIFY_PP_BALANCE")); session.Write("VERIFY_DROPWPADR", properties.Read("VERIFY_DROPWPADR")); session.Write("VOICE_MIN_DIGITS_PPCODE", properties.Read("VOICE_MIN_DIGITS_PPCODE")); session.Write("VOICE_MIN_DIGITS_CARCODE", properties.Read("VOICE_MIN_DIGITS_CARCODE")); session.Write("VOICE_DIGITS_ITEID", properties.Read("VOICE_DIGITS_ITEID")); session.Write("VOICE_MIN_DIGITS_ITEVERIFY", properties.Read("VOICE_MIN_DIGITS_ITEVERIFY")); session.Write("VOICE_CHARS_PRODLOT", properties.Read("VOICE_CHARS_PRODLOT")); session.Write("VOICE_MIN_CHARS_PRODLOTVERIFY", properties.Read("VOICE_MIN_CHARS_PRODLOTVERIFY")); session.Write("ITESWAP", properties.Read("ITESWAP")); session.Write("CPL_PRINTCOD", properties.ReadAsString("CPL_PRINTCOD")); session.Write("PLCP_PRINTCOD", properties.ReadAsString("PLCP_PRINTCOD")); } catch (WarehouseAdapterException ex) { responseMsg.Properties.Write("ErrorCode", WarehouseAlarm); responseMsg.Properties.Write("Message", ex.Message); throw; } catch (Exception) { responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeCritialError); responseMsg.Properties.Write("Message", GetCriticalErrorMessageText(msg)); throw; } finally { TransmitResponseMessage(responseMsg, session); } }
/// <summary> /// Invokes the subscriber. /// </summary> /// <param name="msg">A reference to the subscribed message.</param> /// <param name="session">The current <see cref="VocollectSession"/> object.</param> /// <exception cref="WarehouseAdapterException"> /// </exception> /// <exception cref="MessageEngineException"> /// </exception> public override void Invoke(MultiPartMessage msg, VocollectSession session) { MultiPartMessage responseMsg = CreateResponseMessage(msg); try { MultiPartMessage whMsg = CreateRequestMessage("wlvoicepick", "get_mt_emp_pz", session); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); whMsg.Properties.Write("EMP_PZ_Cur_O", new object()); whMsg.Properties.Write("ALMID_O", ""); CorrelationContext context; MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); foreach (MessagePart part in context.ResponseMessages[0].Parts) { VocollectMessagePart responsePart = new VocollectMessagePart(); responsePart.Properties.Write("RegionNumber", part.Properties.Read("PZID")); responsePart.Properties.Write("RegionName", part.Properties.Read("PZNAME")); if (part.Properties.ReadAsString("FROM_TABLE") == "PZGRP") { responsePart.Properties.Write("GroupRegion", 1); } else { responsePart.Properties.Write("GroupRegion", 0); } if ((part.Properties.ReadAsString("PICKTRUCK") == "1") && (string.IsNullOrEmpty(session.ReadAsString("TUID")))) { responsePart.Properties.Write("UseVehicle", 1); } else { responsePart.Properties.Write("UseVehicle", 0); } responsePart.Properties.Write("ErrorCode", VocollectErrorCodeNoError); responsePart.Properties.Write("Message", ""); responseMsg.Parts.Add(responsePart); } } catch (WarehouseAdapterException ex) { responseMsg.Parts.Clear(); MessagePart part = CreateEmptyMessagePart(6); part.Properties.Write("ErrorCode", WarehouseAlarm); part.Properties.Write("Message", ex.Message); responseMsg.Parts.Add(part); throw; } catch (Exception) { responseMsg.Parts.Clear(); MessagePart part = CreateEmptyMessagePart(6); part.Properties.Write("ErrorCode", VocollectErrorCodeCritialError); part.Properties.Write("Message", GetCriticalErrorMessageText(msg)); responseMsg.Parts.Add(part); throw; } finally { TransmitResponseMessage(responseMsg, session); } }
/// <summary> /// Requests a pick order from the WMS. /// </summary> /// <param name="holdType">The desired hold type of the pick order.</param> /// <param name="session">The current session.</param> /// <returns></returns> public static CorrelationContext RequestPickOrder(PickOrderHoldType holdType, VocollectSession session) { MultiPartMessage whMsg = CreateRequestMessage("wlvoicepick", "get_mt_pbhead", session); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); whMsg.Properties.Write("TUID_I", session.ReadAsString("TUID")); whMsg.Properties.Write("WHID_I", session.ReadAsString("WHID")); if (holdType == PickOrderHoldType.Temporarily) { whMsg.Properties.Write("PZID_I", ""); whMsg.Properties.Write("PZGRPID_I", ""); } else { whMsg.Properties.Write("PZID_I", session.ReadAsString("PZID")); whMsg.Properties.Write("PZGRPID_I", session.ReadAsString("PZGRPID")); } whMsg.Properties.Write("NLANGCOD_I", session.ReadAsString("NLANGCOD")); whMsg.Properties.Write("PBHEAD_Cur_O", new object()); whMsg.Properties.Write("HOLD_TYPE_O", ""); whMsg.Properties.Write("LOCATION_O", ""); whMsg.Properties.Write("ALMID_O", ""); if (holdType == PickOrderHoldType.Definitely) { whMsg.Properties.Write("DEF_ON_HOLD_I", "1"); } else { whMsg.Properties.Write("DEF_ON_HOLD_I", "0"); } CorrelationContext context; MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); //Get properties from cursor PropertyCollection properties = context.ResponseMessages[0].Parts[0].Properties; if ((!string.IsNullOrEmpty(context.ResponseMessages[0].Properties.ReadAsString("HOLD_TYPE_O"))) && (!string.IsNullOrEmpty(properties.ReadAsString("TUID")))) { VerifyAndConnectPickTruck(session, properties.ReadAsString("PBHEADID"), session.ReadAsString("TUID"), properties.ReadAsString("TUID")); } //Write data to session session.Write("PBHEADID", properties.ReadAsString("PBHEADID")); session.Write("PZID", properties.ReadAsString("PZID")); session.Write("HOLD_TYPE", context.ResponseMessages[0].Properties.ReadAsString("HOLD_TYPE_O")); session.Write("CARCODE_TYPE", properties.ReadAsString("CARCODE_TYPE")); session.Write("PBROWID", ""); session.Write("DROPSEQNUM", ""); session.Write("DROPWSID", ""); session.Write("DROPWPADR", ""); session.Write("UPDATE_PBCAR", "0"); session.Write("NOCARS", properties.ReadAsInt("NOCARS")); session.Write("PRINTED", "0"); session.Write("PRINTERNUMBER", ""); session.CurrentAssignmentData = properties; TimeSpan pickTime = new TimeSpan(0, 0, Convert.ToInt32(properties.ReadAsInt("ESTPICKTME") + properties.ReadAsInt("ESTMOVTIMEPICK") + properties.ReadAsInt("ESTDRVTME") + properties.ReadAsInt("ESTPACKTME"))); session.Write("PICKTIME", pickTime); session.Write("LPDTM_SHIPWS", properties.Read("LPDTM_SHIPWS")); return(context); }
/// <summary> /// Invokes the subscriber. /// </summary> /// <param name="msg">A reference to the subscribed message.</param> /// <param name="session">The current <see cref="VocollectSession"/> object.</param> /// <exception cref="WarehouseAdapterException"> /// </exception> /// <exception cref="MessageEngineException"> /// </exception> public override void Invoke(MultiPartMessage msg, VocollectSession session) { MultiPartMessage responseMsg = CreateResponseMessage(msg); try { using (TransactionScope transactionScope = new TransactionScope()) { CorrelationContext context; if (!string.IsNullOrEmpty(msg.Properties.ReadAsString("RegionNumber"))) { //Check if region is a pick zone or a pick zone group MultiPartMessage pzMsg = CreateRequestMessage("wlvoicepick", "select_zone_or_group", session); pzMsg.Properties.Write("TERID_I", msg.Properties.ReadAsString("SerialNumber")); pzMsg.Properties.Write("PZID_I", msg.Properties.ReadAsString("RegionNumber")); pzMsg.Properties.Write("EMPID_I", msg.Properties.ReadAsString("Operator")); pzMsg.Properties.Write("WHID_I", session.ReadAsString("WHID")); pzMsg.Properties.Write("TYPE_O", ""); pzMsg.Properties.Write("ALMID_O", ""); MessageEngine.Instance.TransmitRequestMessage(pzMsg, pzMsg.MessageId, out context); if (context.ResponseMessages[0].Properties.ReadAsString("TYPE_O") == "PZ") { session.Write("PZID", msg.Properties.ReadAsString("RegionNumber")); session.Write("PZGRPID", ""); } else { session.Write("PZID", ""); session.Write("PZGRPID", msg.Properties.ReadAsString("RegionNumber")); } } MultiPartMessage whMsg = CreateRequestMessage("wlvoicepick", "get_mt_restcod", session); whMsg.Properties.Write("TERID_I", session.ReadAsString("TERID")); whMsg.Properties.Write("NLANGCOD_I", session.ReadAsString("NLANGCOD")); whMsg.Properties.Write("RESTCOD_Cur_O", new object()); whMsg.Properties.Write("WHID_I", session.ReadAsString("WHID")); whMsg.Properties.Write("PZID_I", session.ReadAsString("PZID")); MessageEngine.Instance.TransmitRequestMessage(whMsg, whMsg.MessageId, out context); foreach (MessagePart part in context.ResponseMessages[0].Parts) { int temp; /* Code must be numeric in order to be valid */ if (!int.TryParse(part.Properties.ReadAsString("OLACOD"), out temp)) { continue; } MessagePart responsePart = new VocollectMessagePart(); responsePart.Properties.Write("DiscrepancyCode", part.Properties.Read("OLACOD")); responsePart.Properties.Write("DiscrepancyCodeDescription", part.Properties.Read("RESTCODTXT")); if (part.Properties.ReadAsString("AQTYDISC") == AqtyDiscPositive) { responsePart.Properties.Write("AllowOverpick", 1); } else if (part.Properties.ReadAsString("AQTYDISC") == AqtyDiscNegative) { responsePart.Properties.Write("AllowOverpick", 0); } else { continue; } responsePart.Properties.Write("ErrorCode", VocollectErrorCodeNoError); responsePart.Properties.Write("Message", ""); responseMsg.Parts.Add(responsePart); } if (string.IsNullOrEmpty(session.ReadAsString("PBHEADID"))) { try { PrTaskLUTGetAssignment.RequestPickOrder(PickOrderHoldType.Definitely, session); if (responseMsg.Parts.Count == 0) { MessagePart part = CreateEmptyMessagePart(5); responseMsg.Parts.Add(part); } responseMsg.Parts[0].Properties.Write("ErrorCode", ErrorDefinitelyStoppedPickOrderFound); } catch (WarehouseAdapterException ex) { if (ex.AlarmId != "PBHEAD030" && ex.AlarmId != "PBHEAD057") { throw; } } } transactionScope.Complete(); } } catch (WarehouseAdapterException ex) { responseMsg.Parts.Clear(); MessagePart part = CreateEmptyMessagePart(5); part.Properties.Write("ErrorCode", WarehouseAlarm); part.Properties.Write("Message", ex.Message); responseMsg.Parts.Add(part); throw; } catch (Exception) { responseMsg.Parts.Clear(); MessagePart part = CreateEmptyMessagePart(5); part.Properties.Write("ErrorCode", VocollectErrorCodeCritialError); part.Properties.Write("Message", GetCriticalErrorMessageText(msg)); responseMsg.Parts.Add(part); throw; } finally { TransmitResponseMessage(responseMsg, session); } }
/// <summary> /// Invokes the subscriber. /// </summary> /// <param name="msg">A reference to the subscribed message.</param> /// <param name="session">The current <see cref="VocollectSession"/> object.</param> /// <exception cref="WarehouseAdapterException"> /// </exception> /// <exception cref="MessageEngineException"> /// </exception> public override void Invoke(MultiPartMessage msg, VocollectSession session) { MultiPartMessage responseMsg = CreateResponseMessage(msg); responseMsg.Properties.Write("AssignmentId", 0); responseMsg.Properties.Write("IsChase", 0); responseMsg.Properties.Write("WorkId", "1"); responseMsg.Properties.Write("Position", "1"); responseMsg.Properties.Write("TotalItems", 0); responseMsg.Properties.Write("ItemsNotPicked", 0); responseMsg.Properties.Write("BaseItemsNotPicked", 0); responseMsg.Properties.Write("Cube", 0); responseMsg.Properties.Write("GoalTime", 0); responseMsg.Properties.Write("Route", ""); responseMsg.Properties.Write("ActiveContainer", "00"); responseMsg.Properties.Write("PassAssignment", "0"); responseMsg.Properties.Write("PreviousWork", "0"); responseMsg.Properties.Write("PickLines", 0); responseMsg.Properties.Write("PickedLines", 0); responseMsg.Properties.Write("CustomerNumber", ""); responseMsg.Properties.Write("PreviousWorkVehicle", ""); responseMsg.Properties.Write("AllowPackaging", "1"); responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeNoError); responseMsg.Properties.Write("Message", ""); try { using (TransactionScope transactionScope = new TransactionScope()) { PropertyCollection properties = null; /* Check if pick order is already fetched */ if (session.ReadAsString("PBHEADID").Length == 0) { CorrelationContext context = RequestPickOrder(PickOrderHoldType.None, session); properties = context.ResponseMessages[0].Parts[0].Properties; } else /* Use data from session */ { properties = session.CurrentAssignmentData; } responseMsg.Properties.Write("AssignmentId", session.ReadAsString("PBHEADID")); responseMsg.Properties.Write("TotalItems", 0); responseMsg.Properties.Write("ItemsNotPicked", properties.ReadAsDouble("TOTQTY") - properties.ReadAsDouble("PIKQTY")); responseMsg.Properties.Write("GoalTime", ((TimeSpan)session.Read("PICKTIME")).Minutes); if (string.IsNullOrEmpty(session.ReadAsString("HOLD_TYPE"))) { responseMsg.Properties.Write("PreviousWork", 0); } else { if (string.IsNullOrEmpty(properties.ReadAsString("TUID"))) { responseMsg.Properties.Write("PreviousWork", 1); } else { responseMsg.Properties.Write("PreviousWork", 2); } } responseMsg.Properties.Write("PickLines", properties.Read("NOROWS")); responseMsg.Properties.Write("PickedLines", properties.Read("NOPIKROW")); //responseMsg.Properties.Write("AllowPackaging", properties.Read("CONFIRM_PM")); responseMsg.Properties.Write("PreviousWorkVehicle", properties.Read("TUID")); transactionScope.Complete(); } } catch (WarehouseAdapterException ex) { responseMsg.Properties.Write("ErrorCode", WarehouseAlarm); responseMsg.Properties.Write("Message", ex.Message); throw; } catch (Exception) { responseMsg.Properties.Write("ErrorCode", VocollectErrorCodeCritialError); responseMsg.Properties.Write("Message", GetCriticalErrorMessageText(msg)); throw; } finally { TransmitResponseMessage(responseMsg, session); } }