Esempio n. 1
0
 public void SaveExecuter(string user, string ip, string orderDate, int batchNo)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         BatchDao batchDao = new BatchDao();
         batchDao.UpdateExecuter(user, ip, orderDate, batchNo);
     }
 }
Esempio n. 2
0
 public void Save(string orderDate, string sortBatch, string no1Batch,string no1UpLoadState)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         BatchDao batchDao = new BatchDao();
         batchDao.UpdateEntity(orderDate,sortBatch,no1Batch,no1UpLoadState);
     }
 }
Esempio n. 3
0
 public void SaveExecuter(string user, string ip, string orderDate, int batchNo)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         BatchDao batchDao = new BatchDao();
         batchDao.UpdateExecuter(user, ip, orderDate, batchNo);
     }
 }
Esempio n. 4
0
 public DataTable GetBatch(string orderDate, int batchNo)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         BatchDao batchDao = new BatchDao();
         return(batchDao.FindBatch(orderDate, batchNo));
     }
 }
Esempio n. 5
0
 public void Save(string orderDate, string sortBatch, string no1Batch, string no1UpLoadState)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         BatchDao batchDao = new BatchDao();
         batchDao.UpdateEntity(orderDate, sortBatch, no1Batch, no1UpLoadState);
     }
 }
Esempio n. 6
0
 public void SaveUploadUser(string user, string orderDate, int batchNo)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         BatchDao batchDao = new BatchDao();
         batchDao.UpdateNoOnePro(orderDate, batchNo, user);
     }
 }
Esempio n. 7
0
 public void AddBatch(string orderDate, int batchNo)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         BatchDao batchDao = new BatchDao();
         batchDao.InsertEntity(orderDate, batchNo);
     }
 }
Esempio n. 8
0
 public void SaveUploadUser(string user, string orderDate, int batchNo)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         BatchDao batchDao = new BatchDao();
         batchDao.UpdateNoOnePro(orderDate, batchNo, user);
     }
 }
Esempio n. 9
0
 public DataTable GetBatch(string orderDate, int batchNo)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         BatchDao batchDao = new BatchDao();
         return batchDao.FindBatch(orderDate, batchNo);
     }
 }
Esempio n. 10
0
 public void AddBatch(string orderDate, int batchNo)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         BatchDao batchDao = new BatchDao();
         batchDao.InsertEntity(orderDate, batchNo);
     }
 }
Esempio n. 11
0
 public DataTable GetBatchNo(string orderDate)
 {
     DataTable table = null;
     using (PersistentManager pm = new PersistentManager())
     {
         BatchDao batchDao = new BatchDao();
         table = batchDao.FindBatch(orderDate);
     }
     return table;
 }
Esempio n. 12
0
 public int GetCount(string filter)
 {
     int count = 0;
     using (PersistentManager pm = new PersistentManager())
     {
         BatchDao batchDao = new BatchDao();
         count = batchDao.FindCount(filter);
     }
     return count;
 }
Esempio n. 13
0
 public DataTable GetAll(int pageIndex, int pageSize, string filter)
 {
     DataTable table = null;
     using (PersistentManager pm = new PersistentManager())
     {
         BatchDao batchDao = new BatchDao();
         table = batchDao.FindAll((pageIndex - 1) * pageSize, pageSize, filter);
     }
     return table;
 }
Esempio n. 14
0
        public DataTable GetAll(int pageIndex, int pageSize, string filter)
        {
            DataTable table = null;

            using (PersistentManager pm = new PersistentManager())
            {
                BatchDao batchDao = new BatchDao();
                table = batchDao.FindAll((pageIndex - 1) * pageSize, pageSize, filter);
            }
            return(table);
        }
Esempio n. 15
0
 public bool DeleteBatch(BatchDao batch)
 {
     try
     {
         return(ac.DeleteBatch(emap.MapToData(batch)));
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public bool Validate(BatchDao b)
 {
     if (PrimaryKeyValidate(b.BatchID) &&
         StringValidate(b.Name, 100) &&
         IntValidate(b.Instructor)
         )
     {
         return(true);
     }
     return(false);
 }
Esempio n. 17
0
        public DataTable GetBatchNo(string orderDate)
        {
            DataTable table = null;

            using (PersistentManager pm = new PersistentManager())
            {
                BatchDao batchDao = new BatchDao();
                table = batchDao.FindBatch(orderDate);
            }
            return(table);
        }
Esempio n. 18
0
        public int GetCount(string filter)
        {
            int count = 0;

            using (PersistentManager pm = new PersistentManager())
            {
                BatchDao batchDao = new BatchDao();
                count = batchDao.FindCount(filter);
            }
            return(count);
        }
Esempio n. 19
0
        private void GenerateBatchForm_Load(object sender, EventArgs e)
        {
            cdtval = DateTime.Now.ToString("yyyy-MM-dd");
            var servceDao = new ServiceDao();

            cmbServiceName.DataSource = servceDao.GetAllPoojasExceptPrasadam();
            var batchDaoObject = new BatchDao();

            dgvBatchTokens.AutoGenerateColumns = false;
            dgvBatchTokens.DataSource          = batchDaoObject.GetAllBatches();
        }
Esempio n. 20
0
        /// <summary>
        /// 开始优化
        /// </summary>
        /// <param name="orderDate"></param>
        /// <param name="batchNo"></param>
        public void GenSchedule(string orderDate, int batchNo)
        {
            try
            {
                //分拣线优化
                GenLineSchedule(orderDate, batchNo);

                //分拣线烟道优化
                GenChannelSchedule(orderDate, batchNo);

                //拆分订单
                GenSplitOrder(orderDate, batchNo);

                //订单优化
                GenOrderSchedule(orderDate, batchNo);

                //备货烟道优化
                GenStockChannelSchedule(orderDate, batchNo);

                //补货优化
                GenSupplySchedule(orderDate, batchNo);

                //手工补货优化
                GenHandleSupplySchedule(orderDate, batchNo);

                //更新为已优化
                using (PersistentManager pm = new PersistentManager())
                {
                    BatchDao batchDao = new BatchDao();
                    if (!batchDao.CheckOrder(orderDate, batchNo))
                    {
                        throw new Exception("优化过程出错,请检查!");
                    }
                    batchDao.SelectBalanceIntoHistory(orderDate, batchNo);
                    batchDao.UpdateIsValid(orderDate, batchNo, "1");
                    batchCount = batchDao.BatchCount(orderDate, batchNo);
                }

                if (OnSchedule != null)
                {
                    OnSchedule(this, new ScheduleEventArgs(OptimizeStatus.COMPLETE, Convert.ToString(batchCount)));
                }
            }
            catch (Exception e)
            {
                ClearSchedule(orderDate, batchNo);
                if (OnSchedule != null)
                {
                    OnSchedule(this, new ScheduleEventArgs(OptimizeStatus.ERROR, "[" + e.TargetSite + "]\n" + e.Message + e.StackTrace));
                }
            }
        }
Esempio n. 21
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            long startuniid = 0;
            long lastuniid  = 0;
            int  serviceId  = (cmbServiceName.SelectedItem as Service).Id;

            startuniid = new BatchDao().GetLastBatchDailyNumberByService(serviceId);

            int dailyBID = new BatchDao().GetDailyBatchByService(serviceId, cdtval);

            var tokenObj = new TokenDao();

            if (startuniid == 0)
            {
                startuniid = tokenObj.getLeastDailyNumber(serviceId);
                lastuniid  = tokenObj.getHighestDailyNumber(serviceId);
            }
            else
            {
                startuniid = startuniid + 1;
                lastuniid  = tokenObj.getHighestDailyNumber(serviceId);
            }
            if (startuniid < lastuniid)
            {
                var batchObj = new Batch
                {
                    ServiceId        = serviceId,
                    StartDailyNumber = startuniid,
                    LastDailyNumber  = lastuniid,
                    CreatedOn        = DateTime.Now,
                    DailyBatchId     = dailyBID,
                    CreatedBy        = App.LoggedInEmployee.Id
                };

                var batchDaoObject = new BatchDao();
                batchDaoObject.SaveBatch(batchObj);
                //batchDaoObject.GetLastBatchByService(serviceId);

                dgvBatchTokens.DataSource = batchDaoObject.GetAllBatches();

                //dgvBatchTokens.DataSource = tokenObj.GetSelectedServiceDevotees(startuniid, lastuniid, serviceId);

                MessageBox.Show("Batch Data Generated Successfully.");
            }
            else
            {
                MessageBox.Show("There is no new data to generate Batch");
            }
        }
Esempio n. 22
0
 public bool UpdateBatch(BatchDao batch)
 {
     try
     {
         if (batchVal.Validate(batch))
         {
             return(ac.UpdateBatch(emap.MapToData(batch)));
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 23
0
 public bool InsertBatch(BatchDao newbatch)
 {
     try
     {
         if (batchVal.Validate(newbatch))
         {
             return(ac.InsertBatch(emap.MapToData(newbatch)));;
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 24
0
        public bool doEditProduction(DynamicParameters d)
        {
            BatchDao dao = new BatchDao();

            //修改表tf_production数据
            dao.doEcitProduction(d);
            //修改表tf_production_quality数据
            dao.doEditQuality(d);
            //修改表tf_production_quality_item
            dao.doEditQalityItem(d);
            //修改表tf_production
            dao.doUpdHarvest(d);
            //修改表tf_production_sales
            dao.doUpdSales(d);
            return(true);
        }
Esempio n. 25
0
        /// <summary>
        /// Validates the data coming in from the data layer
        /// </summary>
        public bool ValidateSoapData(BatchDao batch)
        {
            int maxName    = 50;
            int maxSection = 100;

            if (val.ValidateInt(batch.BatchID) &&
                val.ValidateDate(batch.EndDate) &&
                val.ValidateInt(batch.Instructor) &&
                val.ValidateRequiredString(batch.Name, maxName) &&
                val.ValidateRequiredString(batch.Section, maxSection) &&
                val.ValidateDate(batch.StartDate))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <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);

            }
        }
Esempio n. 27
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);
            }
        }
Esempio n. 28
0
        public dynamic queryEnterAndProduceCode(int corpProductId)
        {
            BatchDao dao = new BatchDao();

            return(dao.queryEnterAndProduceCode(corpProductId));
        }
Esempio n. 29
0
        public dynamic queryProductionById(int productionId)
        {
            BatchDao dao = new BatchDao();

            return(dao.queryProductionById(productionId));
        }
Esempio n. 30
0
        public List <dynamic> queryBatchRecord(int corpId)
        {
            BatchDao dao = new BatchDao();

            return(dao.queryBatchRecord(corpId));
        }
Esempio n. 31
0
        public bool delProduction(int productionId)
        {
            BatchDao dao = new BatchDao();

            return(dao.delProduction(productionId));
        }
Esempio n. 32
0
        public bool doUpdSales(DynamicParameters d)
        {
            BatchDao dao = new BatchDao();

            return(dao.doUpdSales(d));
        }
Esempio n. 33
0
        public int doAddSales(DynamicParameters d)
        {
            BatchDao dao = new BatchDao();

            return(dao.doAddSales(d));
        }
        /// <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;
            }
        }
Esempio n. 35
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(-5).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;
            }
        }
        /// <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;
            }
        }
Esempio n. 37
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;
            }
        }
        /// <summary>
        /// 开始优化
        /// </summary>
        /// <param name="orderDate"></param>
        /// <param name="batchNo"></param>
        public void GenSchedule(string orderDate, int batchNo)
        {
            try
            {
                //分拣线优化
                GenLineSchedule(orderDate, batchNo);                

                //分拣线烟道优化
                GenChannelSchedule(orderDate, batchNo);
                
                //拆分订单
                GenSplitOrder(orderDate, batchNo);

                //订单优化
                GenOrderSchedule(orderDate, batchNo);

                //备货烟道优化
                GenStockChannelSchedule(orderDate, batchNo);

                //补货优化
                GenSupplySchedule(orderDate, batchNo);

                //手工补货优化
                GenHandleSupplySchedule(orderDate, batchNo);

                //更新为已优化
                using (PersistentManager pm = new PersistentManager())
                {
                    BatchDao batchDao = new BatchDao();
                    if (!batchDao.CheckOrder(orderDate, batchNo))
                    {
                        throw new Exception("优化过程出错,请检查!");
                    }
                    batchDao.SelectBalanceIntoHistory(orderDate, batchNo);
                    batchDao.UpdateIsValid(orderDate, batchNo, "1");
                    batchCount= batchDao.BatchCount(orderDate,batchNo);
                }

                if (OnSchedule != null)
                    OnSchedule(this, new ScheduleEventArgs(OptimizeStatus.COMPLETE,Convert.ToString(batchCount)));
                
            }
            catch (Exception e)
            {
                ClearSchedule(orderDate, batchNo);
                if (OnSchedule != null)
                    OnSchedule(this, new ScheduleEventArgs(OptimizeStatus.ERROR,"[" + e.TargetSite + "]\n" + e.Message));
            }
        }
Esempio n. 39
0
        public List <dynamic> queryQualitys(int corpId)
        {
            BatchDao dao = new BatchDao();

            return(dao.queryQualitys(corpId));
        }
Esempio n. 40
0
        public bool doUpdHarvest(DynamicParameters d)
        {
            BatchDao dao = new BatchDao();

            return(dao.doUpdHarvest(d));
        }
Esempio n. 41
0
        public int doAddProduction(DynamicParameters d)
        {
            //插入production
            BatchDao dao = new BatchDao();
            int      id  = dao.doAddProduction(d);

            d.Add("productionId", id);
            int qualityId = dao.doAddQuality(d);//插入检测记录

            //新增检测项目及值 tf_production_quality_item(农残检测特有)
            d.Add("qualityId", qualityId);
            int itemId = dao.doAddItemVal(d);

            //2、更新采收harvest_date harvest_amount 根据production_id
            dao.doUpdHarvest(d);
            //3、新增销售去向 包括production_id
            int saleId = dao.doAddSales(d);

            //上传数据
            //tf_production
            StringBuilder productionSql = new StringBuilder();

            productionSql.Append("select production_id,corp_product_id,production_code,quality_result,");
            productionSql.Append("strftime('%Y-%m-%d', harvest_date, 'localtime') HARVEST_DATE,harvest_amount,harvest_amount_unit,status,");
            productionSql.Append("strftime('%Y-%m-%d', create_date, 'localtime') CREATE_DATE,create_staff_id,");
            productionSql.Append("strftime('%Y-%m-%d', state_date, 'localtime') STATE_DATE ");
            productionSql.Append(" from tf_production where production_id=").Append(id).Append(";");
            //doUploadData("tf_production", "add", Convert.ToString(id), "PRODUCTION_ID", productionSql.ToString());

            DataItem item1 = new DataItem();

            item1.tabName   = "tf_production";
            item1.tabIdType = "add";
            item1.tabId     = Convert.ToString(id);
            item1.tabIdName = "PRODUCTION_ID";
            item1.sql       = productionSql.ToString();
            Thread t = new Thread(new ThreadStart(item1.H));

            t.Start();

            //tf_production_quality
            StringBuilder qualitySql = new StringBuilder();

            qualitySql.Append("select quality_id,production_id,quality_code,check_name,check_type,sample_type,");
            qualitySql.Append("strftime('%Y-%m-%d', check_date, 'localtime') CHECK_DATE,check_person,");
            qualitySql.Append("status,strftime('%Y-%m-%d', create_date, 'localtime') CREATE_DATE,create_staff_id ");
            qualitySql.Append(" from tf_production_quality where quality_id=").Append(qualityId).Append(";");
            //doUploadData("tf_production_quality", "add", Convert.ToString(qualityId), "QUALITY_ID", qualitySql.ToString());
            DataItem item2 = new DataItem();

            item2.tabName   = "tf_production_quality";
            item2.tabIdType = "add";
            item2.tabId     = Convert.ToString(qualityId);
            item2.tabIdName = "QUALITY_ID";
            item2.sql       = qualitySql.ToString();
            Thread t2 = new Thread(new ThreadStart(item2.H));

            t2.Start();

            //tf_production_quality_item
            StringBuilder itemSql = new StringBuilder();

            itemSql.Append("select quality_item_id,quality_id,check_item_id,check_item_value,status from tf_production_quality_item ");
            itemSql.Append("  where quality_item_id=").Append(itemId).Append(";");
            //doUploadData("tf_production_quality_item", "add", Convert.ToString(itemId), "QUALITY_ITEM_ID", itemSql.ToString());
            DataItem item3 = new DataItem();

            item3.tabName   = "tf_production_quality_item";
            item3.tabIdType = "add";
            item3.tabId     = Convert.ToString(itemId);
            item3.tabIdName = "QUALITY_ITEM_ID";
            item3.sql       = itemSql.ToString();
            Thread t3 = new Thread(new ThreadStart(item3.H));

            t3.Start();

            //tf_production_sales
            StringBuilder saleSql = new StringBuilder();

            saleSql.Append("select production_sales_id,production_id,sales_type,");
            saleSql.Append("strftime('%Y-%m-%d', sales_date, 'localtime') SALES_DATE,buy_unit,contact_way,loco,status,");
            saleSql.Append("strftime('%Y-%m-%d', create_date, 'localtime') CREATE_DATE,create_staff_id from tf_production_sales ");
            saleSql.Append(" where production_sales_id=").Append(saleId).Append(";");
            //doUploadData("tf_production_sales", "add", Convert.ToString(saleId), "PRODUCTION_SALES_ID", saleSql.ToString());
            DataItem item4 = new DataItem();

            item4.tabName   = "tf_production_sales";
            item4.tabIdType = "add";
            item4.tabId     = Convert.ToString(saleId);
            item4.tabIdName = "PRODUCTION_SALES_ID";
            item4.sql       = saleSql.ToString();
            Thread t4 = new Thread(new ThreadStart(item4.H));

            t4.Start();
            return(id);
        }
Esempio n. 42
0
        /// <summary>
        /// After successful validation, this method will map the data from the Data Layer to the Dto
        /// </summary>
        public BatchDto MapToRest(BatchDao b)
        {
            var mapper = batchMapper.CreateMapper();

            return(mapper.Map <BatchDto>(b));
        }