28 Mar 2016
Posted by: Juliano Bachesque in: X++
Olá Pessoal,
Tudo bem?
Pessoal estou compartilhando com vocês o processo para realizar o lançamento de lista de separação, inicar roteiro de lista de separação e atualizar todas as linhas do roteiro por código X++ para o Microsoft Dynamics AX 2012 caso precisem.
public boolean init() { boolean ret = true; ret = this.validate(); if (ret) { //Post PickingList this.pickingList(); //Start Router from Picking list wmsPickingRouteID = this.wmsPickingRouteStart(); //Update all from Router this.pickAllLines(wmsPickingRouteID); } return ret; } |
/// <summary> /// Realiza o lançamento da lista de separação /// </summary> public void pickingList() { InventTransferParmTable localInventTransferParmTable; InventTransferMultiPick localInventTransferMultiPick = InventTransferMultiPick::construct(); ; localInventTransferParmTable.TransferId = inventTransferId; //Provide transferId localInventTransferParmTable.EditLines = NoYes::Yes; localInventTransferParmTable.AutoReceiveQty = NoYes::Yes; localInventTransferParmTable.TransDate = systemDateGet(); localInventTransferParmTable.UpdateType = InventTransferUpdateType::PickingList; localInventTransferParmTable.PickUpdateQty = InventTransferPickUpdateQty::All ; localInventTransferMultiPick.runUpdate(localInventTransferParmTable); } |
/// <summary> /// Iniciar roteiro de separação /// </summary> /// <returns> /// Retorna o nr. do roteiro /// </returns> public WMSPickingRouteID wmsPickingRouteStart() { WMSPickingRoute localWMSPickingRoute; WMSPickingRouteStart localWMSPickingRouteStart; //Buscar roteiro vinculado ao registro da lista de separação select firstOnly PickingRouteID, expeditionStatus from localWMSPickingRoute where localWMSPickingRoute.transType == InventTransType::TransferOrderShip && localWMSPickingRoute.transRefId == inventTransferId; if (localWMSPickingRoute.PickingRouteID) { //Verificar se esta com o status ativado if (localWMSPickingRoute.expeditionStatus == WMSExpeditionStatus::Activated) { localWMSPickingRouteStart = new WMSPickingRouteStart(); localWMSPickingRouteStart.parmWMSPickingRouteId(localWMSPickingRoute.PickingRouteID); localWMSPickingRouteStart.parmWorker(DirPersonUser::findUserWorkerReference()); localWMSPickingRouteStart.run(); } } return localWMSPickingRoute.PickingRouteID; } |
/// <summary> /// Atualizar todas as linhas do roteiro da lista de separação /// </summary> /// <param name="_pickingRouteID"> /// Nº do roteiro a ser atualizado /// </param> public void pickAllLines(WMSPickingRouteID _pickingRouteID) { List list = new List(Types::String); WMSPickingRoute localWMSPickingRoute; //verificar se o roteiro foi informado if (!_pickingRouteID) { //Buscar pelo nº da ordem de transferência select firstOnly PickingRouteID, expeditionStatus from localWMSPickingRoute where localWMSPickingRoute.transType == InventTransType::TransferOrderShip && localWMSPickingRoute.transRefId == inventTransferId; } else { //Buscar pelo nº do roteiro select firstOnly PickingRouteID, expeditionStatus from localWMSPickingRoute where localWMSPickingRoute.PickingRouteID == _pickingRouteID; } //Verificar se o roteiro esta com o status iniciado if (localWMSPickingRoute && localWMSPickingRoute.expeditionStatus == WMSExpeditionStatus::Started) { list.addEnd(localWMSPickingRoute.PickingRouteID); WMSPickingRoute::finishMulti(list.pack()); wmsDeliverPickedItems::checkDeliverPickedItems(localWMSPickingRoute.PickingRouteID,list.pack()); } } |
Abraços,
Juliano Bachesque
One Response
Otavio Anaga
26|Apr|2018 1Valeu Bachesque!!
Leave a reply