Exemple #1
0
        public ContentResult Edit(Supply supply)
        {
            string result = "{success:false,Id:1}";

            try
            {
                Supply row = dao.FindById(supply.Id);
                UpdateModel(row);
                dao.Update();

                result = "{success:true}";
            }
            catch { }

            return(new ContentResult
            {
                Content = result
            });
        }
Exemple #2
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));
                        }
                    }
                }
            }
        }