Beispiel #1
0
        private void SplitEkanbanDeviceHistories(EKanbanDevice eKanbanDevice)
        {
            HistoryFlow.Controls.Clear();
            SysHistoryQuery sysHistoryQuery = new SysHistoryQuery(_SERVER.ServerName.Database);
            var             ehis            = sysHistoryQuery.GetEKanbanHistories(eKanbanDevice.id);
            int             TotalQty        = 0;

            if (ehis != null)
            {
                int i = 0;
                foreach (var item in ehis)
                {
                    EkanbanHisControl ekanbanHisControl = new EkanbanHisControl(item, eKanbanDevice, _SERVER.ServerName.Database);

                    HistoryFlow.Controls.Add(ekanbanHisControl);
                    if (!ekanbanHisControl.ErrorHis)
                    {
                        i++;
                        TotalQty += ekanbanHisControl.TotaPrepareQty;
                    }
                }
                lbTotalPrepare.Text    = i.ToString();
                lbTotalPrepareQty.Text = TotalQty.ToString();
            }
        }
Beispiel #2
0
 public Unblock(IDbName _database)
 {
     database        = _database;
     BuildingQuery   = new BuildingQuery(database);
     SequenceQuery   = new SequenceQuery(database);
     SysHistoryQuery = new SysHistoryQuery(database);
     ComponentQuery  = new ComponentQuery(database);
 }
Beispiel #3
0
 public EkanbanHisControl(EKanbanHis ekanbanHis, EKanbanDevice eKanbanDevice, IDbName _database)
 {
     InitializeComponent();
     EKanbanHis       = new EKanbanHis();
     EKanbanHis       = ekanbanHis;
     eKanbanTaskQuery = new EKanbanTaskQuery(_database);
     SysHistoryQuery  = new SysHistoryQuery(_database);
     lbCartName.Text  = eKanbanDevice.Name;
 }
Beispiel #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;
            }
        }