コード例 #1
0
ファイル: SystemBusiness.cs プロジェクト: Michauxquan/MTest
        public string AddWareHouse(string warecode, string name, string shortname, string citycode, int status, string depotcode, string depotname, string description, string operateid, string clientid)
        {
            var id = Guid.NewGuid().ToString();

            if (SystemDAL.BaseProvider.AddWareHouse(id, warecode, name, shortname, citycode, status, depotcode, depotname, description, operateid, clientid))
            {
                if (!WareHouses.ContainsKey(clientid))
                {
                    GetWareHouses(clientid);
                }
                else
                {
                    var model = new WareHouse()
                    {
                        WareID      = id,
                        WareCode    = warecode,
                        Name        = name,
                        ShortName   = shortname,
                        CityCode    = citycode,
                        Status      = status,
                        Description = description,
                        ClientID    = clientid,
                        DepotSeats  = new List <DepotSeat>()
                    };
                    WareHouses[clientid].Add(model);
                }
                return(id.ToString());
            }

            return(string.Empty);
        }
コード例 #2
0
ファイル: SystemBusiness.cs プロジェクト: Michauxquan/MTest
        public List <WareHouse> GetWareHouses(string clientid)
        {
            if (WareHouses.ContainsKey(clientid))
            {
                return(WareHouses[clientid]);
            }

            DataSet ds = SystemDAL.BaseProvider.GetWareHouses(clientid);

            List <WareHouse> list = new List <WareHouse>();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                WareHouse model = new WareHouse();
                model.FillData(dr);
                model.City       = CommonBusiness.Citys.Where(c => c.CityCode == model.CityCode).FirstOrDefault();
                model.DepotSeats = new List <DepotSeat>();
                foreach (var item in ds.Tables[1].Select("WareID='" + model.WareID + "'"))
                {
                    DepotSeat depot = new DepotSeat();
                    depot.FillData(item);
                    model.DepotSeats.Add(depot);
                }
                list.Add(model);
            }
            WareHouses.Add(clientid, list);
            return(list);
        }
コード例 #3
0
        public InventoryBillPageViewModel(INavigationService navigationService,
                                          IProductService productService,
                                          ITerminalService terminalService,
                                          IUserService userService,
                                          IWareHousesService wareHousesService,
                                          IAccountingService accountingService,
                                          IInventoryService inventoryService,
                                          IDialogService dialogService) : base(navigationService, productService,
                                                                               terminalService,
                                                                               userService,
                                                                               wareHousesService,
                                                                               accountingService,
                                                                               dialogService)
        {
            Title = "选择盘点库存";

            _inventoryService = inventoryService;


            //载入仓库
            this.Load = WareHousesLoader.Load(async() =>
            {
                try
                {
                    var result      = await _wareHousesService.GetWareHousesAsync(BillTypeEnum.InventoryAllTaskBill, force: this.ForceRefresh, calToken: new System.Threading.CancellationToken());
                    this.WareHouses = new ObservableCollection <WareHouseModel>(result?.ToList());
                }
                catch (Exception ex)
                {
                    Crashes.TrackError(ex);
                }
                return(WareHouses.ToList());
            });

            //开始盘点
            this.WhenAnyValue(x => x.Selecter).Throttle(TimeSpan.FromMilliseconds(500))
            .Skip(1)
            .Where(x => x != null)
            .SubOnMainThread(async wareHouse =>
            {
                if (wareHouse != null)
                {
                    var pendings = await _inventoryService.CheckInventoryAsync(wareHouse.Id, new System.Threading.CancellationToken());
                    if (pendings != null && pendings.Count > 0)
                    {
                        await UserDialogs.Instance.AlertAsync("库存正在盘点中,不能在生成盘点单.", okText: "确定");
                        return;
                    }
                    //转向盘点
                    await this.NavigateAsync("SelectProductPage", ("Reference", this.PageName), ("WareHouse", wareHouse), ("SerchKey", ""));
                }
            })
            .DisposeWith(DeactivateWith);

            this.BindBusyCommand(Load);
        }
コード例 #4
0
 public EmployeeEntity(Employee Employee, params object[] args) : base(Employee)
 {
     foreach (object arg in args)
     {
         if (arg is ICollection <Permission> Permissions)
         {
             PermissionEntities = Permissions.Select(model => new PermissionEntity(model, model.Role)).ToList();
         }
         if (arg is ICollection <ReceiptNote> ReceiptNotes)
         {
             ReceiptNoteEntities = ReceiptNotes.Select(model => new ReceiptNoteEntity(model, model.Supplier, model.WareHouse)).ToList();
         }
         if (arg is ICollection <WareHouse> WareHouses)
         {
             WarehouseEntities = WareHouses.Select(model => new WareHouseEntity(model)).ToList();
         }
     }
 }
コード例 #5
0
ファイル: Inventory.cs プロジェクト: rsandim/test-c
 public void CalculeteQuantity()
 {
     Quantity = WareHouses.Any() ? WareHouses.Sum(s => s.Quantity) : 0;
 }
コード例 #6
0
        public void SetupMap()
        {
            Warehouse whA = new Warehouse("A");
            Warehouse whB = new Warehouse("B");
            Warehouse whC = new Warehouse("C");

            WareHouses.Add(whA);
            WareHouses.Add(whB);
            WareHouses.Add(whC);

            // Making track from a to first switch for warehouse A
            Track aFirst       = new Track();
            Track aSecondTrack = new Track();
            Track aThirthTrack = new Track();

            aThirthTrack.IsHorizontal  = false;
            aFirst.NextTrack           = aSecondTrack;
            aSecondTrack.PreviousTrack = aFirst;
            aSecondTrack.NextTrack     = aThirthTrack;
            aThirthTrack.PreviousTrack = aSecondTrack;

            // Making track from a to first switch for warehouse B
            Track bFirst       = new Track();
            Track bSecondTrack = new Track();
            Track bThirthTrack = new Track();

            bThirthTrack.IsHorizontal  = false;
            bFirst.NextTrack           = bSecondTrack;
            bSecondTrack.PreviousTrack = bFirst;
            bSecondTrack.NextTrack     = bThirthTrack;
            bThirthTrack.PreviousTrack = bSecondTrack;

            whA.NextTrack = aFirst;
            whB.NextTrack = bFirst;

            TrackSwitch abSwitch = new TrackSwitch("W");

            TrackSwitches.Add(abSwitch);
            bThirthTrack.NextTrack = abSwitch;
            abSwitch.UpTrack       = aThirthTrack;
            abSwitch.DownTrack     = bThirthTrack;
            Track trackBetweenSwitches = new Track();

            abSwitch.RightTrack = trackBetweenSwitches;
            trackBetweenSwitches.PreviousTrack = abSwitch;
            aThirthTrack.NextTrack             = abSwitch;
            // Making the switch between A and B

            // Making track from warehouse C to first switch
            Track cFirstTrack = new Track();

            whC.NextTrack = cFirstTrack;
            Track cSecondTrack = new Track();

            cFirstTrack.NextTrack      = cSecondTrack;
            cSecondTrack.PreviousTrack = cFirstTrack;

            Track cThirthTrack = new Track();

            cSecondTrack.NextTrack     = cThirthTrack;
            cThirthTrack.PreviousTrack = cSecondTrack;
            Track cFourthTrack = new Track();

            cThirthTrack.NextTrack     = cFourthTrack;
            cFourthTrack.PreviousTrack = cThirthTrack;
            Track cFifthTrack = new Track();

            cFourthTrack.NextTrack    = cFifthTrack;
            cFifthTrack.PreviousTrack = cFourthTrack;
            Track cSixthTrack = new Track();

            cSixthTrack.IsHorizontal  = false;
            cFifthTrack.NextTrack     = cSixthTrack;
            cSixthTrack.PreviousTrack = cFifthTrack;

            TrackSwitch cSwitch = new TrackSwitch("E");

            TrackSwitches.Add(cSwitch);
            cSixthTrack.NextTrack = cSwitch;
            cSwitch.DownTrack     = cSixthTrack;

            // Making track ab switch and C switch
            TrackSwitch abcSwitch = new TrackSwitch("R");

            TrackSwitches.Add(abcSwitch);
            trackBetweenSwitches.NextTrack = abcSwitch;
            abcSwitch.LeftTrack            = trackBetweenSwitches;

            Track cbOne = new Track();

            cSwitch.UpTrack = cbOne;

            Track cbTwo = new Track();

            cbTwo.IsHorizontal  = false;
            cbOne.NextTrack     = cSwitch;
            cbOne.PreviousTrack = cbTwo;
            cbTwo.PreviousTrack = abcSwitch;
            cbTwo.NextTrack     = cbOne;
            abcSwitch.DownTrack = cbTwo;

            // Track between cSwitch and cRange
            Track ccFirst = new Track();

            ccFirst.PreviousTrack = cSwitch;
            cSwitch.RightTrack    = ccFirst;
            TrackSwitch cRangeSwitch = new TrackSwitch("T");

            TrackSwitches.Add(cRangeSwitch);
            cRangeSwitch.LeftTrack = ccFirst;
            ccFirst.NextTrack      = cRangeSwitch;

            // Track between cRange and abccRange
            Track caFirst = new Track();

            cRangeSwitch.UpTrack  = caFirst;
            caFirst.PreviousTrack = cRangeSwitch;
            Track caSecond = new Track();

            caFirst.NextTrack      = caSecond;
            caSecond.PreviousTrack = caFirst;
            TrackSwitch abccRange = new TrackSwitch("Q");

            TrackSwitches.Add(abccRange);
            abccRange.DownTrack = caSecond;
            caSecond.NextTrack  = abccRange;

            // Track between abc switch and abccRange
            Track abcFirst = new Track();

            abcFirst.IsHorizontal  = false;
            abcSwitch.UpTrack      = abcFirst;
            abcFirst.PreviousTrack = abcSwitch;
            Track abcSecond = new Track();

            abcFirst.NextTrack      = abcSecond;
            abcSecond.PreviousTrack = abcFirst;
            Track abcTirth = new Track();

            abcSecond.NextTrack    = abcTirth;
            abcTirth.PreviousTrack = abcSecond;
            Track abcFourth = new Track();

            abcTirth.NextTrack      = abcFourth;
            abcFourth.PreviousTrack = abcTirth;
            Track abcFith = new Track();

            abcFourth.NextTrack   = abcFith;
            abcFith.PreviousTrack = abcFourth;
            abcFith.NextTrack     = abccRange;
            abccRange.UpTrack     = abcFith;

            // Track between abbc range k dock
            Track kFirst = new Track();

            abccRange.RightTrack = kFirst;
            kFirst.PreviousTrack = abcSwitch;
            Track kSecond = new Track();

            kSecond.IsHorizontal  = false;
            kFirst.NextTrack      = kSecond;
            kSecond.PreviousTrack = kFirst;
            Track kTirth = new Track();

            kTirth.IsHorizontal  = false;
            kSecond.NextTrack    = kTirth;
            kTirth.PreviousTrack = kSecond;
            Track kFourth = new Track();

            kFourth.IsHorizontal  = false;
            kTirth.NextTrack      = kFourth;
            kFourth.PreviousTrack = kTirth;
            Track kFith = new Track();

            kFith.IsHorizontal  = false;
            kFourth.NextTrack   = kFith;
            kFith.PreviousTrack = kFourth;
            Track kSixth = new Track();

            kFith.NextTrack         = kSixth;
            kSixth.PreviousTrack    = kFith;
            TrackDock               = new TrackDock(this);
            kSixth.NextTrack        = TrackDock;
            TrackDock.PreviousTrack = kSixth;
            Track EightTrack = new Track();

            TrackDock.NextTrack      = EightTrack;
            EightTrack.PreviousTrack = TrackDock;
            Track ninthTrack = new Track();

            EightTrack.NextTrack     = ninthTrack;
            ninthTrack.PreviousTrack = EightTrack;
            Track tenthTrack = new Track();

            ninthTrack.NextTrack     = tenthTrack;
            tenthTrack.PreviousTrack = ninthTrack;
            Track eleventhTrack = new Track();

            tenthTrack.NextTrack        = eleventhTrack;
            eleventhTrack.PreviousTrack = tenthTrack;
            Track twelfthTack = new Track();

            eleventhTrack.NextTrack   = twelfthTack;
            twelfthTack.PreviousTrack = eleventhTrack;
            Track tirtheenthTrach = new Track();

            twelfthTack.NextTrack         = tirtheenthTrach;
            tirtheenthTrach.PreviousTrack = twelfthTack;
            Track fourtheenthTrack = new Track();

            tirtheenthTrach.NextTrack      = fourtheenthTrack;
            fourtheenthTrack.PreviousTrack = tirtheenthTrach;
            Track fiftheenthTrack = new Track();

            fourtheenthTrack.NextTrack    = fiftheenthTrack;
            fiftheenthTrack.PreviousTrack = fourtheenthTrack;

            TrackEnd = new TrackEnd();
            fiftheenthTrack.NextTrack = TrackEnd;
            TrackEnd.PreviousTrack    = fiftheenthTrack;

            // Track between ccRange switch and before the range
            Track cRFirst = new Track();

            cRFirst.IsHorizontal   = false;
            cRangeSwitch.DownTrack = cRFirst;
            cRFirst.PreviousTrack  = cRangeSwitch;
            Track cRSecond = new Track();

            cRFirst.NextTrack      = cRSecond;
            cRSecond.PreviousTrack = cRFirst;
            Track cRTirth = new Track();

            cRSecond.NextTrack    = cRTirth;
            cRTirth.PreviousTrack = cRSecond;
            Track cRFourth = new Track();

            cRFourth.IsHorizontal  = false;
            cRTirth.NextTrack      = cRFourth;
            cRFourth.PreviousTrack = cRTirth;
            Track cRFifth = new Track();

            cRFifth.IsHorizontal  = false;
            cRFourth.NextTrack    = cRFifth;
            cRFifth.PreviousTrack = cRFourth;
            Track cRSixth = new Track();

            cRFifth.NextTrack     = cRSixth;
            cRSixth.PreviousTrack = cRFifth;
            Track cRSeventh = new Track();

            cRSixth.NextTrack       = cRSeventh;
            cRSeventh.PreviousTrack = cRSixth;

            // The range from right to left
            TrackYard yFirst = new TrackYard();

            cRSeventh.NextTrack  = yFirst;
            yFirst.PreviousTrack = yFirst;
            TrackYard ySecond = new TrackYard();

            yFirst.NextTrack      = ySecond;
            ySecond.PreviousTrack = yFirst;
            TrackYard yTirth = new TrackYard();

            ySecond.NextTrack    = yTirth;
            yTirth.PreviousTrack = ySecond;
            TrackYard yFourth = new TrackYard();

            yTirth.NextTrack      = yFourth;
            yFourth.PreviousTrack = yTirth;
            TrackYard yFifth = new TrackYard();

            yFourth.NextTrack    = yFifth;
            yFifth.PreviousTrack = yFourth;
            TrackYard ySixth = new TrackYard();

            yFifth.NextTrack     = ySixth;
            ySixth.PreviousTrack = yFifth;
            TrackYard ySeventh = new TrackYard();

            ySixth.NextTrack       = ySeventh;
            ySeventh.PreviousTrack = ySixth;
            TrackYard yEigth = new TrackYard();

            ySeventh.NextTrack   = yEigth;
            yEigth.PreviousTrack = ySeventh;

            cRangeSwitch.IsInverted = true;
            abcSwitch.IsInverted    = true;
            abccRange.IsInverted    = false;

            TrackYards.Add(yFirst);
            TrackYards.Add(ySecond);
            TrackYards.Add(yTirth);
            TrackYards.Add(yFourth);
            TrackYards.Add(yFifth);
            TrackYards.Add(ySixth);
            TrackYards.Add(ySeventh);
            TrackYards.Add(yEigth);

            Map[0][1]  = yEigth;
            Map[0][2]  = ySeventh;
            Map[0][3]  = ySixth;
            Map[0][4]  = yFifth;
            Map[0][5]  = yFourth;
            Map[0][6]  = yTirth;
            Map[0][7]  = ySecond;
            Map[0][8]  = yFirst;
            Map[0][9]  = cRSeventh;
            Map[0][10] = cRSixth;
            Map[0][11] = cRFifth;

            Map[1][0] = whC;
            Map[1][1] = cFirstTrack;
            Map[1][2] = cSecondTrack;
            Map[1][3] = cThirthTrack;
            Map[1][4] = cFourthTrack;
            Map[1][5] = cFifthTrack;
            Map[1][6] = cSixthTrack;
            Map[1][7] = null;

            Map[1][11] = cRFourth;
            Map[1][10] = cRTirth;
            Map[1][9]  = cRSecond;
            Map[1][8]  = cRFirst;

            Map[2][8] = cRangeSwitch;
            Map[2][7] = ccFirst;
            Map[2][6] = cSwitch;

            Map[3][0] = whB;
            Map[3][1] = bFirst;
            Map[3][2] = bSecondTrack;
            Map[3][3] = bThirthTrack;

            Map[3][5] = cbTwo;
            Map[3][6] = cbOne;
            Map[3][8] = caFirst;
            Map[3][9] = caSecond;

            Map[4][9]  = abccRange;
            Map[4][10] = kFirst;
            Map[4][11] = kSecond;
            Map[4][5]  = abcSwitch;
            Map[4][4]  = trackBetweenSwitches;
            Map[4][3]  = abSwitch;

            Map[5][0]  = whA;
            Map[5][1]  = aFirst;
            Map[5][2]  = aSecondTrack;
            Map[5][3]  = aThirthTrack;
            Map[5][5]  = abcFirst;
            Map[5][6]  = abcSecond;
            Map[5][7]  = abcTirth;
            Map[5][8]  = abcFourth;
            Map[5][9]  = abcFith;
            Map[5][11] = kTirth;

            Map[6][11] = kFourth;

            Map[7][11] = kFith;
            Map[7][10] = kSixth;
            Map[7][9]  = TrackDock;
            Map[7][8]  = EightTrack;
            Map[7][7]  = ninthTrack;
            Map[7][6]  = tenthTrack;
            Map[7][5]  = eleventhTrack;
            Map[7][4]  = twelfthTack;
            Map[7][3]  = tirtheenthTrach;
            Map[7][2]  = fourtheenthTrack;
            Map[7][1]  = fiftheenthTrack;
            Map[7][0]  = TrackEnd;
            IsPlaying  = true;

            foreach (var item in TrackSwitches)
            {
                item.Switch();
            }
        }