Ejemplo n.º 1
0
        private void UpdateOgiginalSequence()
        {
            try
            {
                SelectedOriginalPo = SequenceQuery.GetOriginalPo(SelectedSchedule);

                DS_Sequence.DataSource = SequenceQuery.GetOriginalSequence(SelectedSchedule);
            }
            catch { }
        }
Ejemplo n.º 2
0
        public EKanbanResponse(IDbName _database, int _ekanbanDeviceId)
        {
            EKanbanTaskQuery eKanbanTaskQuery = new EKanbanTaskQuery(_database);
            SequenceQuery    sequenceQuery    = new SequenceQuery(_database);
            ComponentQuery   componentQuery   = new ComponentQuery(_database);

            var ekanbanDevice = eKanbanTaskQuery.GetEKanbanDevice(_ekanbanDeviceId);

            var _Interface = eKanbanTaskQuery.GetLastEKanbanInterface(_ekanbanDeviceId);

            SizeList = new List <SizeInfo>();
            PartList = new List <PartInfo>();
            List <OriginalSize> originalSizes = new List <OriginalSize>();

            foreach (var item in _Interface.EKanbanLoadings)
            {
                var Seq = sequenceQuery.GetOriginalSequence(ShareFuncs.GetInt(item.OriginalSequence_Id));
                TotalCartQty += ShareFuncs.GetInt(Seq.Quantity);
                foreach (var size in Seq.OriginalSizes)
                {
                    originalSizes.Add(size);
                }
            }

            foreach (var item in originalSizes)
            {
                var foundSizes = SizeList.Where(i => i.SizeId == item.SizeId);
                if (foundSizes.Count() > 0)
                {
                    foundSizes.First().SizeQty += ShareFuncs.GetInt(item.Quantity);
                }
                else
                {
                    SizeList.Add(new SizeInfo(ShareFuncs.GetInt(item.SizeId), ShareFuncs.GetInt(item.Quantity)));
                }
            }

            Interface = new InterfaceInfo(_Interface);

            foreach (var item in _Interface.EkanbanComponents)
            {
                var Component = componentQuery.GetShoeComponent(ShareFuncs.GetInt(item.ShoeComponent_Id));
                PartList.Add(new PartInfo(ShareFuncs.ConvertToUnSign(Component.Reference)));
            }

            //if (DateTime.Now.Hour == 17)
            //{
            //    if (DateTime.Now.Minute > 50)
            //    {
            //        ScreenOff = true;
            //        ekanbanDevice.ScreenOff = true;
            //    }
            //}
            //else
            //{
            //    if (DateTime.Now.Hour > 17)
            //    {
            //        ScreenOff = true;
            //        ekanbanDevice.ScreenOff = true;
            //    }
            //}

            //if (DateTime.Now.Hour == 6 && DateTime.Now.Minute < 45)
            //{
            //    ScreenOff = false;
            //    ekanbanDevice.ScreenOff = false;
            //}

            ekanbanDevice.NetworkStatus = (int)SYS_MODELS._ENUM.SysActionCode.ONLINE;
            ekanbanDevice.LastOnline    = DateTime.Now;
            eKanbanTaskQuery.UpdateEKanbanDevice(ekanbanDevice);

            if (ekanbanDevice.ScreenOff == null)
            {
                ScreenOff = false;
            }
            else
            {
                ScreenOff = (bool)ekanbanDevice.ScreenOff;
            }
        }
Ejemplo n.º 3
0
        public SizeCtrl(object sequence, bool header)
        {
            InitializeComponent();
            this.Margin = new Padding(0);

            CurrentSeq = new OriginalPOsequence();
            try
            {
                CurrentSeq = sequence as OriginalPOsequence;

                CurrentSeq = SequenceQuery.GetOriginalSequence(CurrentSeq.id);
            }
            catch { }

            if (!header)
            {
                tableLayoutPanel1.RowStyles[0].Height = 0;
                this.Height = 20;
                if (CurrentSeq.SequenceNo % 2 != 0)
                {
                    this.tableLayoutPanel1.BackColor = Color.FromArgb(179, 195, 203);
                }
                else
                {
                    this.tableLayoutPanel1.BackColor = Color.FromArgb(230, 254, 253);
                }
            }
            else
            {
                tableLayoutPanel1.RowStyles[1].Height = 0;
                this.Height = 30;
                this.tableLayoutPanel1.BackColor = Color.FromArgb(155, 252, 246);
                this.tableLayoutPanel1.ForeColor = Color.FromArgb(6, 10, 255);
                return;
            }

            tableLayoutPanel1.Controls.Add(new Label
            {
                Text      = $"{CurrentSeq.SequenceNo}/{CurrentSeq.TotalSequence}",
                AutoSize  = false,
                Dock      = DockStyle.Fill,
                TextAlign = ContentAlignment.MiddleCenter,
                Font      = new Font("Arial Narrow", 10, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0)))
            }
                                           , 0, 1);
            tableLayoutPanel1.Controls.Add(new Label
            {
                Text      = CurrentSeq.Quantity.ToString(),
                AutoSize  = false,
                Dock      = DockStyle.Fill,
                TextAlign = ContentAlignment.MiddleCenter,
                Font      = new Font("Arial Narrow", 10, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0)))
            }, 1, 1);

            foreach (var item in CurrentSeq.OriginalSizes)
            {
                for (int i = 3; i <= 32; i++)
                {
                    if (item.SizeId != null && item.SizeId == i)
                    {
                        tableLayoutPanel1.Controls.Add(
                            new Label
                        {
                            Text      = item.Quantity.ToString(),
                            AutoSize  = false,
                            Dock      = DockStyle.Fill,
                            TextAlign = ContentAlignment.MiddleCenter,
                            Font      = new Font("Arial Narrow", 10, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0)))
                        }
                            , i - 1, 1);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public ConfirmResponse(IDbName _database, int _ekanbanDeviceId, int _confirmQty)
        {
            try
            {
                EKanbanTaskQuery eKanbanTaskQuery = new EKanbanTaskQuery(_database);
                SequenceQuery    sequenceQuery    = new SequenceQuery(_database);
                ComponentQuery   componentQuery   = new ComponentQuery(_database);
                StockQuery       stockQuery       = new StockQuery(_database);
                ScheduleQuery    scheduleQuery    = new ScheduleQuery(_database);
                SysHistoryQuery  sysHistoryQuery  = new SysHistoryQuery(_database);


                var Interface = eKanbanTaskQuery.GetLastEKanbanInterface(_ekanbanDeviceId);
                var his       = sysHistoryQuery.GetEKanbanHistory(Interface);

                if (Interface.SysActionCode == (int)SYS_MODELS._ENUM.SysActionCode.EKANBAN_CONFIRM_ITEM)
                {
                    ConfirmSuccess = true;
                    EMessage       = "EKanban is already conform!";
                    return;
                }

                Interface.SysActionCode = (int)SYS_MODELS._ENUM.SysActionCode.EKANBAN_CONFIRM_ITEM;
                Interface.LastUpdate    = DateTime.Now;
                if (!eKanbanTaskQuery.UpdateEKanbanInterface(Interface))
                {
                    ConfirmSuccess = false;
                    EMessage       = "EKanban is already conform!";
                    return;
                }

                List <Schedule> schedules = new List <Schedule>();

                foreach (var item in Interface.EKanbanLoadings)
                {
                    var sch = scheduleQuery.GetSchedule(ShareFuncs.GetInt(item.OriginalPo_Id));
                    var Seq = sequenceQuery.GetOriginalSequence(ShareFuncs.GetInt(item.OriginalSequence_Id));
                    if (sch != null)
                    {
                        var stock = stockQuery.GetPrepareStockMeasure(sch);

                        if (stock != null)
                        {
                            StockConfirmSequence stockConfirm = new StockConfirmSequence
                            {
                                FinishTime      = DateTime.Now,
                                SequenceNo      = Seq.SequenceNo,
                                SequenceQty     = Seq.Quantity,
                                StockMeasure_Id = stock.id,
                            };

                            StockMessage = "Update stock message successfully";
                            if (!stockQuery.AddNewStockConfirm(stockConfirm))
                            {
                                StockMessage = "An error orcured while updating stock";
                            }

                            stock.ConfirmUpdateTime  = DateTime.Now;
                            stock.EKanbanConfirmQty += Seq.Quantity;
                            if (!stockQuery.UpdateStockMeasure(stock))
                            {
                                StockMessage = "An error orcured while updating stock";
                            }
                        }
                    }

                    item.SysActionCode = (int)SYS_MODELS._ENUM.SysActionCode.SEQUENCE_CONFORM;
                    item.LastUpdate    = DateTime.Now;
                    item.ConfirmQty    = _confirmQty;
                    eKanbanTaskQuery.UpdateEKanbanLoading(item);

                    string jsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(Interface);
                    his.Data     = jsonStr;
                    his.DateTime = DateTime.Now;
                    sysHistoryQuery.UpdateEKanbanHis(his);

                    EKanbanConfirmHis eKanbanConfirmHis = new EKanbanConfirmHis
                    {
                        Conform             = true,
                        DateTime            = DateTime.Now,
                        EKanbanHis_Id       = his.id,
                        OriginalSequence_Id = Seq.id,
                        SequenceNo          = Seq.SequenceNo,
                        SequenceQty         = Seq.Quantity,
                    };
                    sysHistoryQuery.AddNewConfirmHistory(eKanbanConfirmHis);
                }

                ConfirmSuccess = true;
                EMessage       = "EKanban is conform successfully";
            }
            catch (Exception e)
            {
                EMessage = e.Message;
            }
        }