protected override bool VerifyConfirmedLine(ScanHeader header, ScanLine line, Action rollbackAction, out WMSFlowStatus flowStatus)
            {
                if (!base.VerifyConfirmedLine(header, line, rollbackAction, out flowStatus))
                {
                    return(false);
                }
                if (header.Remove == true)
                {
                    return(true);
                }
                var args = new WMSLineVerifyingArguments <Header, INTran>(
                    (Header)HeaderView.Cache.GetMain(header),
                    (INTran)LinesView.Cache.GetMain(line));

                Base1.VerifyAvailability(args);
                if (args.Cancel)
                {
                    flowStatus = WMSFlowStatus.Fail(args.ErrorInfo.MessageFormat, args.ErrorInfo.MessageArguments);

                    rollbackAction();

                    args.Processed = true;

                    SetScanState(MainCycleStartState);
                    return(false);
                }
                flowStatus = WMSFlowStatus.Ok;
                return(true);
            }
예제 #2
0
        protected virtual bool ValidateConfirmation(out WMSFlowStatus flowStatus)
        {
            flowStatus = WMSFlowStatus.Ok;

            var needLotSerialNbr = IsLotSerialRequired &&
                                   CurrentHeader.LotSerAssign == INLotSerAssign.WhenReceived;

            if (needLotSerialNbr && CurrentHeader.LotSerialNbr == null)
            {
                flowStatus = WMSFlowStatus.Fail(Msg.LotSerialNotSet);
                return(false);
            }
            if (IsLocationRequired &&
                CurrentHeader.CartLoaded == true &&
                CurrentHeader.ToLocationID == null)
            {
                flowStatus = WMSFlowStatus.Fail(Msg.ToLocationNotSelected);
                return(false);
            }
            if (CurrentHeader.LotSerTrack == INLotSerTrack.SerialNumbered &&
                CurrentHeader.LotSerAssign.IsNotIn(null, INLotSerAssign.WhenUsed) &&
                CurrentHeader.Qty != 1)
            {
                flowStatus = WMSFlowStatus.Fail(Msg.SerialItemNotComplexQty);
                return(false);
            }
            return(true);
        }
예제 #3
0
        protected virtual bool EnsureSplitsLotSerial(string userLotSerial, ScanHeader header, Action rollbackAction, out WMSFlowStatus flowStatus)
        {
            if (!string.IsNullOrEmpty(userLotSerial) &&
                SplitsView != null &&
                SplitsView.SelectMain().Any(s => s.LotSerialNbr != userLotSerial))
            {
                flowStatus = WMSFlowStatus.Fail(Msg.QtyIssueExceedsQtyOnLot, userLotSerial,
                                                HeaderView.Cache.GetValueExt <ScanHeader.inventoryID>(header));

                rollbackAction();

                SetScanState(MainCycleStartState);

                return(false);
            }
            flowStatus = WMSFlowStatus.Ok;
            return(true);
        }
예제 #4
0
        protected virtual bool EnsureSplitsLocation(int?userLocationID, ScanHeader header, Action rollbackAction, out WMSFlowStatus flowStatus)
        {
            if (IsLocationRequired &&
                SplitsView != null &&
                SplitsView.SelectMain().Any(s => s.LocationID != userLocationID))
            {
                flowStatus = WMSFlowStatus.Fail(Msg.QtyIssueExceedsQtyOnLocation,
                                                HeaderView.Cache.GetValueExt <ScanHeader.locationID>(header),
                                                HeaderView.Cache.GetValueExt <ScanHeader.inventoryID>(header));

                rollbackAction();

                SetScanState(MainCycleStartState);

                return(false);
            }
            flowStatus = WMSFlowStatus.Ok;
            return(true);
        }
 protected override WMSFlowStatus LineMissingStatus() => WMSFlowStatus.Fail(INScanTransfer.Msg.TransferLineMissing, InventoryItem.PK.Find(Base, CurrentHeader.InventoryID).InventoryCD);
예제 #6
0
        protected virtual bool SyncWithLines(ScanHeader header, decimal?qty, ref ScanLine line, out WMSFlowStatus flowStatus)
        {
            var      linesCache     = LinesView.Cache;
            Action   rollbackAction = null;
            ScanLine existLine      = line;

            if (existLine != null)
            {
                decimal?newQty = existLine.Qty + qty;

                var backup = linesCache.CreateCopy(existLine) as ScanLine;
                if (newQty == 0)
                {
                    //remove
                    linesCache.SetValueExt <ScanLine.qty>(existLine, newQty);
                    existLine      = (ScanLine)linesCache.Delete(existLine);
                    rollbackAction = () =>
                    {
                        linesCache.Insert(backup);
                    };
                }
                else
                {
                    if (CurrentHeader.LotSerTrack == INLotSerTrack.SerialNumbered && newQty != 1)
                    {
                        flowStatus = WMSFlowStatus.Fail(Msg.SerialItemNotComplexQty);
                        return(false);
                    }

                    linesCache.SetValueExt <ScanLine.qty>(existLine, newQty);
                    linesCache.SetValueExt <ScanLine.lotSerialNbr>(existLine, null);
                    existLine = (ScanLine)linesCache.Update(existLine);

                    linesCache.SetValueExt <INTran.lotSerialNbr>(existLine, header.LotSerialNbr);
                    existLine = (ScanLine)linesCache.Update(existLine);

                    rollbackAction = () =>
                    {
                        linesCache.Delete(existLine);
                        linesCache.Insert(backup);
                    };
                }
            }
            else
            {
                if (qty < 0)
                {
                    flowStatus = LineMissingStatus();
                    return(false);
                }
                existLine = (ScanLine)linesCache.Insert();
                linesCache.SetValueExt <ScanLine.inventoryID>(existLine, header.InventoryID);
                linesCache.SetValueExt <ScanLine.siteID>(existLine, header.SiteID);
                linesCache.SetValueExt <ScanLine.toSiteID>(existLine, header.ToSiteID);
                linesCache.SetValueExt <ScanLine.locationID>(existLine, header.LocationID);
                linesCache.SetValueExt <ScanLine.toLocationID>(existLine, header.ToLocationID);
                linesCache.SetValueExt <ScanLine.uOM>(existLine, header.UOM);
                linesCache.SetValueExt <ScanLine.reasonCode>(existLine, header.ReasonCode);
                existLine = (ScanLine)linesCache.Update(existLine);

                linesCache.SetValueExt <INTran.qty>(existLine, qty);
                existLine = (ScanLine)linesCache.Update(existLine);

                linesCache.SetValueExt <INTran.lotSerialNbr>(existLine, header.LotSerialNbr);
                existLine = (ScanLine)linesCache.Update(existLine);

                rollbackAction = () => linesCache.Delete(existLine);
            }

            if (!VerifyConfirmedLine(header, existLine, rollbackAction, out flowStatus))
            {
                return(false);
            }

            flowStatus = WMSFlowStatus.Ok;
            line       = existLine;
            return(true);
        }
예제 #7
0
 protected virtual WMSFlowStatus LineMissingStatus() => WMSFlowStatus.Fail(Msg.InventoryNotSet);
예제 #8
0
 protected virtual bool VerifyConfirmedLine(ScanHeader header, ScanLine line, Action rollbackAction, out WMSFlowStatus flowStatus)
 => EnsureSplitsLotSerial(header.LotSerialNbr, header, rollbackAction, out flowStatus) &&
 (header.Remove == true || EnsureSplitsLocation(header.LocationID, header, rollbackAction, out flowStatus));