Example #1
0
        private void AddFirstBatch()
        {
            using (PersistentManager pm = new PersistentManager())
            {
                SupplyDao  supplyDao  = new SupplyDao();
                ChannelDao channelDao = new ChannelDao();

                DataTable cigaretteTable = supplyDao.FindCigarette();
                if (cigaretteTable.Rows.Count != 0)
                {
                    foreach (DataRow row in cigaretteTable.Rows)
                    {
                        DataTable channelTable        = channelDao.FindChannelForCigaretteCode(row["CigaretteCode"].ToString());
                        int       stockRemainQuantity = Convert.ToInt32(channelTable.Rows[0]["REMAINQUANTITY"]);

                        if (Convert.ToInt32(row["Quantity"]) + stockRemainQuantity >= Convert.ToInt32(Context.Attributes["StockInCapacityQuantity"]))
                        {
                            StockInRequest(row["CigaretteCode"].ToString(), Convert.ToInt32(Context.Attributes["StockInCapacityQuantity"]), stockRemainQuantity);
                        }
                        else if (Convert.ToInt32(row["Quantity"]) + stockRemainQuantity > 0)
                        {
                            StockInRequest(row["CigaretteCode"].ToString(), Convert.ToInt32(row["Quantity"]) + stockRemainQuantity, stockRemainQuantity);
                        }
                    }
                    Logger.Info("生产第一批次入库任务成功");
                    WriteToProcess("LEDProcess", "Refresh", null);
                }
            }
        }
Example #2
0
        private void StockInRequest(string cigaretteCode)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                StockInBatchDao stockInBatchDao = new StockInBatchDao();
                SupplyDao       supplyDao       = new SupplyDao();
                ChannelDao      channelDao      = new ChannelDao();

                DataTable stockInBatchTable = stockInBatchDao.FindStockInBatch(cigaretteCode);

                DataTable channelTable        = channelDao.FindChannelForCigaretteCode(cigaretteCode);
                int       stockRemainQuantity = Convert.ToInt32(channelTable.Rows[0]["REMAINQUANTITY"]);

                DataTable cigaretteTable = supplyDao.FindCigarette(cigaretteCode, stockRemainQuantity.ToString());

                if (stockInBatchTable.Rows.Count == 0 && cigaretteTable.Rows.Count != 0)
                {
                    DataRow row = cigaretteTable.Rows[0];

                    if (Convert.ToInt32(row["Quantity"]) >= Convert.ToInt32(Context.Attributes["StockInCapacityQuantity"]))
                    {
                        StockInRequest(row["CigaretteCode"].ToString(), Convert.ToInt32(Context.Attributes["StockInCapacityQuantity"]), 0);
                        Logger.Info(row["CigaretteName"].ToString() + "生成入库任务成功");
                    }
                    else if (Convert.ToInt32(row["Quantity"]) > 0)
                    {
                        StockInRequest(row["CigaretteCode"].ToString(), Convert.ToInt32(row["Quantity"]), 0);
                        Logger.Info(row["CigaretteName"].ToString() + "生成入库任务成功");
                    }

                    WriteToProcess("LEDProcess", "Refresh", null);
                }
            }
        }
        private void timer1_Tick(object sender, EventArgs e)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                SupplyDao  supplyDao  = new SupplyDao();
                StockInDao stockInDao = new StockInDao();

                DataTable cigaretteTable = supplyDao.FindCigarette();
                DataTable stockInTable   = stockInDao.FindStockInForIsInAndNotOut();

                foreach (DataRow row in cigaretteTable.Rows)
                {
                    DataRow[] stockInRows = stockInTable.Select(string.Format("CIGARETTECODE='{0}' AND STATE ='1' AND ( STOCKOUTID IS NULL OR STOCKOUTID = 0 )", row["CIGARETTECODE"].ToString()), "STOCKINID");

                    if (stockInRows.Length <= Convert.ToInt32(Context.Attributes["StockInRequestRemainQuantity"]))
                    {
                        Context.ProcessDispatcher.WriteToProcess("StockInRequestProcess", "StockInRequest", row["CIGARETTECODE"].ToString());
                    }
                    else if (stockInRows.Length > 0 && stockInRows.Length + Convert.ToInt32(stockInRows[0]["STOCKINQUANTITY"]) <= 30)
                    {
                        Context.ProcessDispatcher.WriteToProcess("StockInRequestProcess", "StockInRequest", row["CIGARETTECODE"].ToString());
                    }
                }
            }
        }