public void Save(string channelCode, string cigaretteCode, string cigaretteName, int quantity, string status,string isStockIn)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         StockChannelDao stockChannelDao = new StockChannelDao();
         stockChannelDao.UpdateEntity(channelCode, cigaretteCode, cigaretteName, quantity, status, isStockIn);
     }
 }
 public DataTable GetAll(int pageIndex, int pageSize, string filter)
 {
     DataTable table = null;
     using (PersistentManager pm = new PersistentManager())
     {
         StockChannelDao stockChannelDao = new StockChannelDao();
         table = stockChannelDao.FindAll((pageIndex - 1) * pageSize, pageSize, filter);
     }
     return table;
 }
 public int GetCount(string filter)
 {
     int count = 0;
     using (PersistentManager pm = new PersistentManager())
     {
         StockChannelDao stockChannelDao = new StockChannelDao();
         count = stockChannelDao.FindCount(filter);
     }
     return count;
 }
Пример #4
0
        /// <summary>
        /// 清除指定批次数据
        /// </summary>
        /// <param name="orderDate"></param>
        /// <param name="batchNo"></param>
        public void ClearSchedule(string orderDate, int batchNo)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                //AS_BI_BATCH
                BatchDao batchDao = new BatchDao();
                batchDao.UpdateExecuter("0", "0", orderDate, batchNo);
                batchDao.UpdateIsValid(orderDate, batchNo, "0");

                //AS_SC_CHANNELUSED
                ChannelScheduleDao csDao = new ChannelScheduleDao();
                csDao.DeleteSchedule(orderDate, batchNo);

                //AS_SC_LINE
                LineScheduleDao lsDao = new LineScheduleDao();
                lsDao.DeleteSchedule(orderDate, batchNo);

                //AS_SC_PALLETMASTER,AS_SC_ORDER
                OrderScheduleDao osDao = new OrderScheduleDao();
                osDao.DeleteSchedule(orderDate, batchNo);

                //AS_I_ORDERDETAIL,AS_I_ORDERMASTER
                OrderDao orderDao = new OrderDao();
                orderDao.DeleteOrder(orderDate, batchNo);

                //AS_SC_STOCKMIXCHANNEL
                StockChannelDao scDao = new StockChannelDao();
                scDao.DeleteSchedule(orderDate, batchNo);

                //AS_SC_SUPPLY
                SupplyDao supplyDao = new SupplyDao();
                supplyDao.DeleteSchedule(orderDate, batchNo);

                //AS_SC_HANDLESUPPLY
                HandleSupplyDao handleSupplyDao = new HandleSupplyDao();
                handleSupplyDao.DeleteHandleSupply(orderDate, batchNo);

            }
        }
Пример #5
0
        /// <summary>
        /// 清除历史数据,并下载数据。
        /// </summary>
        /// <param name="orderDate"></param>
        /// <param name="batchNo"></param>
        public void DownloadData(string orderDate, int batchNo,string dataBase)
        {
            try
            {
                DateTime dtOrder = DateTime.Parse(orderDate);
                string historyDate = dtOrder.AddDays(-7).ToShortDateString();
                using (PersistentManager pm = new PersistentManager())
                {
                    BatchDao batchDao = new BatchDao();
                    using (PersistentManager ssPM = new PersistentManager(dataBase))
                    {
                        SalesSystemDao ssDao = new SalesSystemDao();
                        ssDao.SetPersistentManager(ssPM);
                        try
                        {
                            pm.BeginTransaction();

                            //AS_BI_BATCH
                            batchDao.DeleteHistory(historyDate);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 1, 14));

                            //AS_SC_CHANNELUSED
                            ChannelScheduleDao csDao = new ChannelScheduleDao();
                            csDao.DeleteHistory(historyDate);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 2, 14));

                            //AS_SC_LINE
                            LineScheduleDao lsDao = new LineScheduleDao();
                            lsDao.DeleteHistory(historyDate);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 3, 14));

                            //AS_SC_PALLETMASTER ,AS_SC_ORDER
                            OrderScheduleDao osDao = new OrderScheduleDao();
                            osDao.DeleteHistory(historyDate);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 4, 14));

                            //AS_I_ORDERMASTER,AS_I_ORDERDETAIL,
                            OrderDao orderDao = new OrderDao();
                            orderDao.DeleteHistory(historyDate);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 5, 14));

                            //AS_SC_STOCKMIXCHANNEL
                            StockChannelDao scDao = new StockChannelDao();
                            scDao.DeleteHistory(historyDate);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 6, 14));

                            //AS_SC_SUPPLY
                            SupplyDao supplyDao = new SupplyDao();
                            supplyDao.DeleteHistory(historyDate);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 7, 14));

                            //AS_SC_HANDLESUPPLY
                            HandleSupplyDao handleSupplyDao = new HandleSupplyDao();
                            handleSupplyDao.DeleteHistory(historyDate);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 8, 14));

                            ClearSchedule(orderDate, batchNo);

                            //////////////////////////////////////////////////////////////////////////

                            //下载区域表
                            AreaDao areaDao = new AreaDao();
                            DataTable areaTable = ssDao.FindArea();
                            areaDao.SynchronizeArea(areaTable);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 9, 14));

                            //下载配送线路表
                            RouteDao routeDao = new RouteDao();
                            DataTable routeTable = ssDao.FindRoute();
                            routeDao.SynchronizeRoute(routeTable);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 10, 14));

                            //下载客户表
                            CustomerDao customerDao = new CustomerDao();
                            DataTable customerTable = ssDao.FindCustomer(dtOrder);
                            customerDao.SynchronizeCustomer(customerTable);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 11, 14));

                            //下载卷烟表 进行同步
                            CigaretteDao cigaretteDao = new CigaretteDao();
                            DataTable cigaretteTable = ssDao.FindCigarette(dtOrder);
                            cigaretteDao.SynchronizeCigarette(cigaretteTable);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 12, 14));

                            //查询已优化过的线路,以进行排除。
                            string routes = lsDao.FindRoutes(orderDate);

                            //下载订单主表
                            DataTable masterTable = ssDao.FindOrderMaster(dtOrder, batchNo, routes);
                            orderDao.BatchInsertMaster(masterTable);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 13, 14));

                            //下载订单明细
                            DataTable detailTable = ssDao.FindOrderDetail(dtOrder, batchNo, routes);
                            orderDao.BatchInsertDetail(detailTable);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 14, 14));

                            pm.Commit();
                        }
                        catch (Exception e)
                        {
                            pm.Rollback();
                            throw e;
                        }
                    }
                }
            }
            catch (Exception ee)
            {
                if (OnSchedule != null)
                    OnSchedule(this, new ScheduleEventArgs(OptimizeStatus.ERROR, ee.Message));
                throw ee;
            }
        }
Пример #6
0
        /// <summary>
        /// 备货烟道优化2010-07-08
        /// </summary>
        /// <param name="orderDate"></param>
        /// <param name="batchNo"></param>
        public void GenStockChannelSchedule(string orderDate, int batchNo)
        {
            using (THOK.Util.PersistentManager pm = new THOK.Util.PersistentManager())
            {
                StockChannelDao schannelDao = new StockChannelDao();
                OrderDao orderDao = new OrderDao();
                OrderDao detailDao = new OrderDao(); 

                SysParameterDao parameterDao = new SysParameterDao();
                Dictionary<string, string> parameter = parameterDao.FindParameters();
                
                //每天分拣结束后备货烟道是否为空
                if (parameter["ClearStockChannel"] == "1")
                    schannelDao.ClearCigarette();

                //查询补货烟道表
                DataTable channelTable = schannelDao.FindChannel();
                //查询通道机卷烟数量信息表
                DataTable orderCTable = orderDao.FindCigaretteQuantityFromChannelUsed(orderDate, batchNo, "3");
                //查询立式机卷烟数量信息表(应加上混合烟道问题)
                DataTable orderTTable = orderDao.FindCigaretteQuantityFromChannelUsed(orderDate, batchNo, "2");
                //取所有订单品牌及总数量
                DataTable orderTable = detailDao.FindAllCigaretteQuantity(orderDate, batchNo,false).Tables[0];

                StockOptimize stockOptimize = new StockOptimize();

                bool isUseSynchronizeOptimize = Convert.ToBoolean(parameter["IsUseSynchronizeOptimize"]);
                DataTable mixTable = stockOptimize.Optimize(isUseSynchronizeOptimize, channelTable, isUseSynchronizeOptimize ? orderCTable : orderTable, isUseSynchronizeOptimize ? orderTTable : orderTable, orderDate, batchNo);

                schannelDao.UpdateChannel(channelTable);
                schannelDao.InsertStockChannelUsed(orderDate, batchNo,channelTable);
                schannelDao.InsertMixChannel(mixTable);

                if (OnSchedule != null)
                    OnSchedule(this, new ScheduleEventArgs(6, "备货烟道优化", 1, 1));
            }
        }
Пример #7
0
        /// <summary>
        /// 清除历史数据,并下载数据。
        /// </summary>
        /// <param name="orderDate"></param>
        /// <param name="batchNo"></param>
        public void DownloadData(string orderDate, int batchNo, string dataBase)
        {
            try
            {
                ProcessState.Status = "PROCESSING";
                ProcessState.TotalCount = 15;
                ProcessState.Step = 1;

                DateTime dtOrder = DateTime.Parse(orderDate);
                string historyDate = dtOrder.AddDays(-7).ToShortDateString();
                using (PersistentManager pm = new PersistentManager())
                {
                    BatchDao batchDao = new BatchDao();
                    using (PersistentManager ssPM = new PersistentManager(dataBase))
                    {
                        SalesSystemDao ssDao = new SalesSystemDao();
                        ssDao.SetPersistentManager(ssPM);
                        try
                        {
                            pm.BeginTransaction();

                            //AS_BI_BATCH
                            batchDao.DeleteHistory(historyDate);
                            ProcessState.CompleteCount = 1;

                            //AS_SC_CHANNELUSED
                            ChannelScheduleDao csDao = new ChannelScheduleDao();
                            csDao.DeleteHistory(historyDate);
                            ProcessState.CompleteCount = 2;

                            //AS_SC_LINE
                            LineScheduleDao lsDao = new LineScheduleDao();
                            lsDao.DeleteHistory(historyDate);
                            ProcessState.CompleteCount = 3;

                            //AS_SC_PALLETMASTER ,AS_SC_ORDER
                            OrderScheduleDao osDao = new OrderScheduleDao();
                            osDao.DeleteHistory(historyDate);
                            ProcessState.CompleteCount = 4;

                            //AS_I_ORDERMASTER,AS_I_ORDERDETAIL,
                            OrderDao orderDao = new OrderDao();
                            orderDao.DeleteHistory(historyDate);
                            ProcessState.CompleteCount = 5;

                            //AS_SC_STOCKMIXCHANNEL
                            StockChannelDao scDao = new StockChannelDao();
                            scDao.DeleteHistory(historyDate);
                            ProcessState.CompleteCount = 6;

                            //AS_SC_SUPPLY
                            SupplyDao supplyDao = new SupplyDao();
                            supplyDao.DeleteHistory(historyDate);
                            ProcessState.CompleteCount = 7;

                            //AS_SC_HANDLESUPPLY
                            HandleSupplyDao handleSupplyDao = new HandleSupplyDao();
                            handleSupplyDao.DeleteHistory(historyDate);
                            ProcessState.CompleteCount = 8;

                            ClearSchedule(orderDate, batchNo);

                            //////////////////////////////////////////////////////////////////////////

                            //下载区域表
                            AreaDao areaDao = new AreaDao();
                            DataTable areaTable = ssDao.FindArea();
                            areaDao.SynchronizeArea(areaTable);
                            ProcessState.CompleteCount = 9;

                            //下载配送线路表
                            RouteDao routeDao = new RouteDao();
                            DataTable routeTable = ssDao.FindRoute();
                            routeDao.SynchronizeRoute(routeTable);
                            ProcessState.CompleteCount = 10;

                            //下载客户表
                            CustomerDao customerDao = new CustomerDao();
                            DataTable customerTable = ssDao.FindCustomer(dtOrder);
                            customerDao.SynchronizeCustomer(customerTable);
                            ProcessState.CompleteCount = 11;

                            //下载卷烟表 进行同步
                            CigaretteDao cigaretteDao = new CigaretteDao();
                            DataTable cigaretteTable = ssDao.FindCigarette(dtOrder);
                            cigaretteDao.SynchronizeCigarette(cigaretteTable);
                            ProcessState.CompleteCount = 12;

                            //查询已优化过的线路,以进行排除。
                            string routes = lsDao.FindRoutes(orderDate);

                            //下载订单主表
                            DataTable masterTable = ssDao.FindOrderMaster(dtOrder, batchNo, routes);
                            orderDao.BatchInsertMaster(masterTable);
                            ProcessState.CompleteCount = 13;

                            //下载订单明细
                            DataTable detailTable = ssDao.FindOrderDetail(dtOrder, batchNo, routes);
                            orderDao.BatchInsertDetail(detailTable);
                            ProcessState.CompleteCount = 14;

                            pm.Commit();
                        }
                        catch (Exception e)
                        {
                            pm.Rollback();
                            throw e;
                        }
                    }
                }
            }
            catch (Exception ee)
            {
                ProcessState.Status = "ERROR";
                ProcessState.Message = ee.Message;
            }
        }