Ejemplo n.º 1
0
        public DataTable GetOrder(string orderDate, int batchNo, int mode, bool isSortAbnormityOrderByOrder)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                OrderScheduleDao            orderDao     = new OrderScheduleDao();
                THOK.AS.Dao.SysParameterDao parameterDao = new SysParameterDao();

                Dictionary <string, string> parameter = parameterDao.FindParameters();
                string handleSortLineCode             = parameter["handleSortLineCode"].ToString();
                string wholePiecesSortLineCode        = parameter["WholePiecesSortLineCode"].ToString();
                string abnormitySortLineCode          = parameter["AbnormitySortLineCode"].ToString();

                switch (mode)
                {
                case 1:    //正常分拣打码
                    return(orderDao.FindOrder(orderDate, batchNo));

                    break;

                case 2:    //手工分拣打码
                    if (handleSortLineCode != string.Empty)
                    {
                        return(orderDao.FindOrderForHandleSort(orderDate, batchNo, handleSortLineCode));
                    }
                    else
                    {
                        return(new DataTable());
                    }
                    break;

                case 3:    //整件分拣打码
                    if (wholePiecesSortLineCode != string.Empty)
                    {
                        return(orderDao.FindOrderForWholePieces(orderDate, batchNo, wholePiecesSortLineCode));
                    }
                    else
                    {
                        return(new DataTable());
                    }
                    break;

                case 4:    //异形分拣打码
                    if (abnormitySortLineCode != string.Empty)
                    {
                        return(orderDao.FindOrderForAbnormity(orderDate, batchNo, abnormitySortLineCode, isSortAbnormityOrderByOrder));
                    }
                    else
                    {
                        return(new DataTable());
                    }
                    break;

                default:
                    return(new DataTable());

                    break;
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 2011-11-21 wu
 /// </summary>
 /// <param name="parameterValue"></param>
 /// <param name="parameterName"></param>
 public void UpdateParameter(string parameterValue, string parameterName)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         SysParameterDao parameterDao = new SysParameterDao();
         parameterDao.UpdateParameter(parameterValue, parameterName);
     }
 }
Ejemplo n.º 3
0
 public void SetUpdataData(string RemoteServerDB, string RemoteServerIP, string RemoteServerUserID, string RemoteServerPassword, string DatabaseType, string OuterBatch, string ChannelBlankCount, string TowerBlankCount)
 {
     using (PersistentManager persistentManager = new PersistentManager())
     {
         SysParameterDao SysParameterDao = new SysParameterDao();
         SysParameterDao.UpdataData(RemoteServerDB, RemoteServerIP, RemoteServerUserID, RemoteServerPassword, DatabaseType, OuterBatch, ChannelBlankCount, TowerBlankCount);
     }
 }
Ejemplo n.º 4
0
 public string GetParameterValue(string paraName)
 {
     using (PersistentManager persistentManager = new PersistentManager())
     {
         SysParameterDao paraDao = new SysParameterDao();
         return(paraDao.GetParameterValue(paraName));
     }
 }
Ejemplo n.º 5
0
 public void SaveParameter(Dictionary <string, string> parameters)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         SysParameterDao parameterDao = new SysParameterDao();
         parameterDao.UpdateEntity(parameters);
     }
 }
Ejemplo n.º 6
0
        public DataSet AllGetParameterValue(string paraName)
        {
            DataSet DS = new DataSet();

            using (PersistentManager persistenManager = new PersistentManager())
            {
                SysParameterDao SysParameterDao = new SysParameterDao();
                DS = SysParameterDao.AllGetParameterValue(paraName);
            }
            return(DS);
        }
Ejemplo n.º 7
0
        public Dictionary <string, string> FindParameter()
        {
            Dictionary <string, string> d = null;

            using (PersistentManager pm = new PersistentManager())
            {
                SysParameterDao parameterDao = new SysParameterDao();
                d = parameterDao.FindParameters();
            }
            return(d);
        }
Ejemplo n.º 8
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();

                LineInfoDao lineDao1   = new LineInfoDao();
                DataTable   lineTable1 = lineDao1.GetAvailabeLine("3").Tables[0];
                bool        isUseWholePiecesSortLine = lineTable1.Rows.Count > 0;

                //每天分拣结束后备货烟道是否为空
                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, isUseWholePiecesSortLine).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.InsertMixChannel(mixTable);

                //取整件打码线所有订单品牌及总数量
                if (isUseWholePiecesSortLine)
                {
                    orderTable = detailDao.FindAllCigaretteQuantityForWholePiecesSortLine(orderDate, batchNo).Tables[0];
                    mixTable   = stockOptimize.Optimize(channelTable, orderTable, orderDate, batchNo);
                    schannelDao.InsertMixChannel(mixTable);
                }

                schannelDao.InsertStockChannelUsed(orderDate, batchNo, channelTable);

                if (OnSchedule != null)
                {
                    OnSchedule(this, new ScheduleEventArgs(6, "备货烟道优化", 1, 1));
                }
            }
        }
Ejemplo n.º 9
0
        public string SalesSystemDao()
        {
            SysParameterDao             parameterDao = new SysParameterDao();
            Dictionary <string, string> parameter    = parameterDao.FindParameters();

            //仓储业务数据接口服务器数据库类型
            if (parameter["SalesSystemDBType"] != "")
            {
                dbTypeName = parameter["SalesSystemDBType"];
            }

            return(dbTypeName);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 补货优化2010-04-19
        /// </summary>
        /// <param name="orderDate"></param>
        /// <param name="batchNo"></param>
        public void GenSupplySchedule(string orderDate, int batchNo)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                OrderDao        orderDao       = new OrderDao();
                ChannelDao      channelDao     = new ChannelDao();
                LineScheduleDao lineDao        = new LineScheduleDao();
                SupplyDao       supplyDao      = new SupplyDao();
                SupplyOptimize  supplyOptimize = new SupplyOptimize();

                SysParameterDao             parameterDao = new SysParameterDao();
                Dictionary <string, string> parameter    = parameterDao.FindParameters();

                DataTable lineTable = lineDao.FindAllLine(orderDate, batchNo).Tables[0];

                int currentCount = 0;
                int totalCount   = lineTable.Rows.Count;

                foreach (DataRow lineRow in lineTable.Rows)
                {
                    string lineCode = lineRow["LINECODE"].ToString();

                    DataTable channelTable = channelDao.FindChannelSchedule(orderDate, batchNo, lineCode, Convert.ToInt32(parameter["RemainCount"])).Tables[0];
                    DataTable supplyTable  = supplyOptimize.Optimize(channelTable);
                    supplyDao.InsertSupply(supplyTable, Convert.ToBoolean(parameter["IsSupplyOrderbyCigaretteCode"]));

                    DataTable supplyOrderTable = supplyDao.FindSupplyOrder(orderDate, batchNo, lineCode);
                    supplyOptimize.Optimize(supplyOrderTable, 1);
                    supplyOptimize.Optimize(supplyOrderTable, 2);
                    supplyDao.Update(supplyOrderTable);

                    if (OnSchedule != null)
                    {
                        OnSchedule(this, new ScheduleEventArgs(7, "正在优化" + lineRow["LINECODE"].ToString() + "补货计划", currentCount++, totalCount));
                    }
                }

                LineInfoDao lineDao1   = new LineInfoDao();
                DataTable   lineTable1 = lineDao1.GetAvailabeLine("3").Tables[0];

                foreach (DataRow lineRow in lineTable1.Rows)
                {
                    string lineCode = lineRow["LINECODE"].ToString();

                    //查询烟道信息表
                    DataTable channelTable = channelDao.FindChannelSchedule(orderDate, batchNo, lineCode, Convert.ToInt32(parameter["RemainCount"])).Tables[0];
                    //查询订单主表
                    DataTable masterTable = orderDao.FindOrderMaster(orderDate, batchNo, lineCode).Tables[0];
                    //查询订单明细表
                    DataTable orderTable = orderDao.FindOrderDetail(orderDate, batchNo, lineCode).Tables[0];

                    int serialNo = 1;
                    currentCount = 0;
                    totalCount   = masterTable.Rows.Count;

                    foreach (DataRow masterRow in masterTable.Rows)
                    {
                        DataRow[] orderRows = null;
                        //查询当前订单明细
                        orderRows = orderTable.Select(string.Format("ORDERID = '{0}'", masterRow["ORDERID"]), "CIGARETTECODE");
                        DataTable supplyTable = supplyOptimize.Optimize(channelTable, orderRows, ref serialNo);
                        supplyDao.InsertSupply(supplyTable, true);

                        if (OnSchedule != null)
                        {
                            OnSchedule(this, new ScheduleEventArgs(7, "正在优化" + lineRow["LINECODE"].ToString() + "分拣线订单补货!", ++currentCount, totalCount));
                        }
                    }
                }
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 订单优化2010-07-07
        /// </summary>
        /// <param name="orderDate"></param>
        /// <param name="batchNo"></param>
        public void GenOrderSchedule(string orderDate, int batchNo)
        {
            using (THOK.Util.PersistentManager pm = new THOK.Util.PersistentManager())
            {
                OrderDao         orderDao         = new OrderDao();
                ChannelDao       channelDao       = new ChannelDao();
                OrderScheduleDao orderScheduleDao = new OrderScheduleDao();
                SupplyDao        supplyDao        = new SupplyDao();
                OrderOptimize    orderSchedule    = new OrderOptimize();

                SysParameterDao             parameterDao = new SysParameterDao();
                Dictionary <string, string> parameter    = parameterDao.FindParameters();

                LineScheduleDao lineDao   = new LineScheduleDao();
                DataTable       lineTable = lineDao.FindAllLine(orderDate, batchNo).Tables[0];

                foreach (DataRow lineRow in lineTable.Rows)
                {
                    string lineCode = lineRow["LINECODE"].ToString();

                    //查询订单主表
                    DataTable masterTable = orderDao.FindTmpMaster(orderDate, batchNo, lineCode);
                    //查询订单明细表
                    DataTable orderTable = orderDao.FindTmpDetail(orderDate, batchNo, lineCode);
                    //查询分拣烟道表
                    DataTable channelTable = channelDao.FindChannelSchedule(orderDate, batchNo, lineCode, Convert.ToInt32(parameter["RemainCount"])).Tables[0];

                    int sortNo       = 1;
                    int currentCount = 0;
                    int totalCount   = masterTable.Rows.Count;

                    foreach (DataRow masterRow in masterTable.Rows)
                    {
                        DataRow[] orderRows = null;

                        //查询当前订单明细
                        orderRows = orderTable.Select(string.Format("SORTNO = '{0}'", masterRow["SORTNO"]), "CHANNELGROUP, CHANNELCODE");
                        DataSet ds = orderSchedule.Optimize(masterRow, orderRows, channelTable, ref sortNo);

                        orderScheduleDao.SaveOrder(ds);
                        supplyDao.InsertSupply(ds.Tables["SUPPLY"], lineCode, orderDate, batchNo);

                        if (OnSchedule != null)
                        {
                            OnSchedule(this, new ScheduleEventArgs(5, "正在优化" + lineRow["LINECODE"].ToString() + "分拣线订单", ++currentCount, totalCount));
                        }
                    }

                    channelDao.Update(channelTable);
                }

                LineInfoDao lineDao1   = new LineInfoDao();
                DataTable   lineTable1 = lineDao1.GetAvailabeLine("3").Tables[0];

                foreach (DataRow lineRow in lineTable1.Rows)
                {
                    string lineCode = lineRow["LINECODE"].ToString();

                    //查询烟道信息表
                    DataTable channelTable = channelDao.FindChannelSchedule(orderDate, batchNo, lineCode, Convert.ToInt32(parameter["RemainCount"])).Tables[0];
                    //查询订单主表
                    DataTable masterTable = orderDao.FindOrderMaster(orderDate, batchNo, lineCode).Tables[0];
                    //查询订单明细表
                    DataTable orderTable = orderDao.FindOrderDetail(orderDate, batchNo, lineCode).Tables[0];

                    int sortNo       = 1;
                    int currentCount = 0;
                    int totalCount   = masterTable.Rows.Count;

                    foreach (DataRow masterRow in masterTable.Rows)
                    {
                        DataRow[] orderRows = null;
                        //查询当前订单明细
                        orderRows = orderTable.Select(string.Format("ORDERID = '{0}'", masterRow["ORDERID"]), "CIGARETTECODE");
                        DataSet ds = orderSchedule.OptimizeUseWholePiecesSortLine(masterRow, orderRows, channelTable, ref sortNo);
                        orderScheduleDao.SaveOrder(ds);

                        if (OnSchedule != null)
                        {
                            OnSchedule(this, new ScheduleEventArgs(5, "正在优化" + lineRow["LINECODE"].ToString() + "分拣线订单", ++currentCount, totalCount));
                        }
                    }

                    channelDao.UpdateQuantity(channelTable, false);
                }
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 订单拆分2010-07-05
        /// </summary>
        /// <param name="orderDate"></param>
        /// <param name="batchNo"></param>
        public void GenSplitOrder(string orderDate, int batchNo)
        {
            using (THOK.Util.PersistentManager pm = new THOK.Util.PersistentManager())
            {
                OrderDao         orderDao         = new OrderDao();
                ChannelDao       channelDao       = new ChannelDao();
                OrderScheduleDao orderScheduleDao = new OrderScheduleDao();
                LineScheduleDao  lineDao          = new LineScheduleDao();

                OrderSplitOptimize orderSchedule = new OrderSplitOptimize();

                THOK.AS.Dao.SysParameterDao parameterDao = new SysParameterDao();
                Dictionary <string, string> parameter    = parameterDao.FindParameters();

                //查询分拣线表
                DataTable lineTable = lineDao.FindAllLine(orderDate, batchNo).Tables[0];

                //清理临时表
                orderScheduleDao.ClearSplitOrder();

                LineInfoDao lineDao1   = new LineInfoDao();
                DataTable   lineTable1 = lineDao1.GetAvailabeLine("3").Tables[0];
                bool        isUseWholePiecesSortLine = lineTable1.Rows.Count > 0;

                foreach (DataRow lineRow in lineTable.Rows)
                {
                    string lineCode = lineRow["LINECODE"].ToString();

                    //查询烟道信息表
                    DataTable channelTable = channelDao.FindChannelSchedule(orderDate, batchNo, lineCode, Convert.ToInt32(parameter["RemainCount"])).Tables[0];
                    //查询订单主表
                    DataTable masterTable = orderDao.FindOrderMaster(orderDate, batchNo, lineCode).Tables[0];
                    //查询订单明细表
                    DataTable orderTable = orderDao.FindOrderDetail(orderDate, batchNo, lineCode).Tables[0];

                    DataTable       orderDetail     = null;
                    HashTableHandle hashTableHandle = new HashTableHandle(orderTable);

                    int sortNo       = 1;
                    int currentCount = 0;
                    int totalCount   = masterTable.Rows.Count;
                    orderSchedule.moveToMixChannelProducts.Clear();
                    orderSchedule.moveToMixTChannelProducts.Clear();

                    foreach (DataRow masterRow in masterTable.Rows)
                    {
                        DataRow[] orderRows = null;

                        orderDetail = hashTableHandle.Select("ORDERID", masterRow["ORDERID"]);
                        orderRows   = orderDetail.Select(string.Format("ORDERID = '{0}'", masterRow["ORDERID"]), "QUANTITY");

                        DataSet ds = orderSchedule.Optimize(masterRow, orderRows, channelTable, lineCode, ref sortNo, parameter, isUseWholePiecesSortLine);
                        orderScheduleDao.SaveSplitOrder(ds);

                        if (OnSchedule != null)
                        {
                            OnSchedule(this, new ScheduleEventArgs(4, "正在优化" + lineRow["LINECODE"].ToString() + "分拣线订单", ++currentCount, totalCount));
                        }
                    }

                    channelDao.UpdateQuantity(channelTable, Convert.ToBoolean(parameter["IsUseBalance"]));
                }
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 生产线烟道优化
        /// </summary>
        /// <param name="orderDate"></param>
        /// <param name="batchNo"></param>
        public void GenChannelSchedule(string orderDate, int batchNo)
        {
            using (THOK.Util.PersistentManager pm = new THOK.Util.PersistentManager())
            {
                ChannelDao      channelDao      = new ChannelDao();
                OrderDao        detailDao       = new OrderDao();
                LineDeviceDao   deviceDao       = new LineDeviceDao();
                ChannelOptimize channelSchedule = new ChannelOptimize();

                THOK.AS.Dao.SysParameterDao parameterDao = new SysParameterDao();
                Dictionary <string, string> parameter    = parameterDao.FindParameters();

                LineScheduleDao lineDao   = new LineScheduleDao();
                DataTable       lineTable = lineDao.FindAllLine(orderDate, batchNo).Tables[0];

                LineInfoDao lineDao1   = new LineInfoDao();
                DataTable   lineTable1 = lineDao1.GetAvailabeLine("3").Tables[0];
                bool        isUseWholePiecesSortLine = lineTable1.Rows.Count > 0;

                int currentCount = 0;
                int totalCount   = lineTable.Rows.Count;

                foreach (DataRow lineRow in lineTable.Rows)
                {
                    string lineCode = lineRow["LINECODE"].ToString();

                    //查询分拣线烟道表
                    DataTable channelTable = channelDao.FindAvailableChannel(lineCode).Tables[0];
                    //查询分拣线设备参数表
                    DataTable deviceTable = deviceDao.FindLineDevice(lineCode).Tables[0];

                    //通道机两条分拣线品牌必须一致,立式机两条分拣线则不需要一致
                    //取所有订单品牌及总数量
                    DataTable orderTable = detailDao.FindAllCigaretteQuantity(orderDate, batchNo, isUseWholePiecesSortLine).Tables[0];
                    //取每条线订单品牌及总数量
                    DataTable lineOrderTable = detailDao.FindLineCigaretteQuantity(orderDate, batchNo, lineCode, isUseWholePiecesSortLine).Tables[0];

                    bool isUseSynchronizeOptimize = Convert.ToBoolean(parameter["IsUseSynchronizeOptimize"]);

                    channelSchedule.Optimize(isUseSynchronizeOptimize ? orderTable : lineOrderTable, lineOrderTable, channelTable, deviceTable, parameter);

                    channelDao.SaveChannelSchedule(channelTable, orderDate, batchNo);

                    if (OnSchedule != null)
                    {
                        OnSchedule(this, new ScheduleEventArgs(3, "正在优化" + lineRow["LINECODE"].ToString() + "分拣线烟道", ++currentCount, totalCount));
                    }
                }

                currentCount = 0;
                totalCount   = lineTable1.Rows.Count;

                foreach (DataRow lineRow in lineTable1.Rows)
                {
                    string lineCode = lineRow["LINECODE"].ToString();

                    //查询分拣线烟道表
                    DataTable channelTable = channelDao.FindAvailableChannel(lineCode).Tables[0];
                    channelDao.SaveChannelSchedule(channelTable, orderDate, batchNo);

                    if (OnSchedule != null)
                    {
                        OnSchedule(this, new ScheduleEventArgs(3, "正在优化" + lineRow["LINECODE"].ToString() + "分拣线烟道", ++currentCount, totalCount));
                    }
                }
            }
        }