public ActionResult List(GridCommand command, OrderMasterSearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
     this.CheckFlow(searchModel.Flow, true);
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return View();
 }
        public ActionResult _AjaxList(GridCommand command, OrderMasterSearchModel searchModel)
        {

            if (!this.CheckSearchModelIsNull(searchModel))
            {
                return PartialView(new GridModel(new List<OrderMaster>()));
            }

            string whereStatement = "and o.OrderStrategy=" + (int)com.Sconit.CodeMaster.FlowStrategy.SEQ;
           
            if (!string.IsNullOrWhiteSpace(searchModel.SequenceGroup))
            {
                whereStatement += " and o.SeqGroup='" + searchModel.SequenceGroup + "'";
            }
            if (searchModel.IsListPrice)
            {
                whereStatement += string.Format(" and IsListPrice=0 and o.Status not in ({0},{1})", (int)com.Sconit.CodeMaster.OrderStatus.Cancel, (int)com.Sconit.CodeMaster.OrderStatus.Close);
            }
            if (searchModel.IsPrintOrder)
            {
                whereStatement += string.Format(" and IsPrintOrder=0 and o.Status not in ({0},{1})", (int)com.Sconit.CodeMaster.OrderStatus.Cancel, (int)com.Sconit.CodeMaster.OrderStatus.Close);
            }
            searchModel.SubType = (int)com.Sconit.CodeMaster.OrderSubType.Normal;
            ProcedureSearchStatementModel procedureSearchStatementModel = PrepareSearchStatement(command, searchModel, whereStatement, false);
            GridModel<OrderMaster> gridModel = GetAjaxPageDataProcedure<OrderMaster>(procedureSearchStatementModel, command);
            foreach (var ordermstr in gridModel.Data)
            {
                ordermstr.SeqOrderStrategyDescription = ordermstr.OrderTemplate == "KitOrder.xls" ? "Kit" : "排序";
            }
            return PartialView(gridModel);
        }
 public ActionResult _AjaxList(GridCommand command, OrderMasterSearchModel searchModel)
 {
     SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel);
     var gridData = GetAjaxPageData<SeqOrderChange>(searchStatementModel, command);
     gridData.Data = gridData.Data.OrderBy(o => o.OrderNo).OrderBy(o => o.OrderDetId).ToList();
     var returnList = new List<SeqOrderChange>();
     foreach (var data in gridData.Data)
     {
         foreach (var ret in returnList)
         {
             if (data.ExternalOrderNo == ret.ExternalOrderNo && data.OrderNo == ret.OrderNo&& data.Sequence == ret.Sequence)
             {
                 data.ExternalOrderNo = null;
                 data.ExternalSequence = null;
                 data.OrderNo = null;
                 data.Flow = null;
                 data.Sequence = 0;
                 data.OrderDetId = 0;
             }
         }
         returnList.Add(data);
     }
     gridData.Data = returnList;
     return PartialView(gridData);
 }
예제 #4
0
        public ActionResult _OrderDetailHierarchyAjax(GridCommand command, OrderMasterSearchModel searchModel)
        {
            if (!this.CheckSearchModelIsNull(searchModel))
            {
                return PartialView(new GridModel(new List<OrderDetail>()));
            }
            SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel, false);
            return PartialView(GetAjaxPageData<OrderDetail>(searchStatementModel, command));

        }
        public ActionResult _AjaxList(GridCommand command, OrderMasterSearchModel searchModel)
        {
            if (string.IsNullOrEmpty(searchModel.Checker))
            {
                return PartialView(new GridModel(new List<OrderDetail>()));
            }

            SearchStatementModel searchStatementModel = PrepareSearchStatement(command, searchModel);
            return PartialView(GetAjaxPageData<OrderDetail>(searchStatementModel, command));
        }
        public ActionResult _AjaxList(GridCommand command, OrderMasterSearchModel searchModel)
        {

            if (!this.CheckSearchModelIsNull(searchModel))
            {
                return PartialView(new GridModel(new List<OrderMaster>()));
            }

            string whereStatement = "and o.OrderStrategy=" + (int)com.Sconit.CodeMaster.FlowStrategy.SEQ;
            //add by ljz start
            string traceCodeGroup = string.Empty;
            if (!string.IsNullOrWhiteSpace(searchModel.TraceCode))
            {
                traceCodeGroup = searchModel.TraceCode.Replace(",", "','").Replace("\r\n", "','").Replace("\n", "','");
            }
            //add by ljz end
            if (!string.IsNullOrWhiteSpace(searchModel.Item) && !string.IsNullOrWhiteSpace(searchModel.TraceCode))
            {
                //modify by ljz start
                //whereStatement += " and exists(select 1 from OrderDetail as d where d.OrderNo=o.OrderNo and d.Item ='" + searchModel.Item + "' and d.ReserveNo ='"+searchModel.TraceCode+"')";
                whereStatement += " and exists(select 1 from OrderDetail as d where d.OrderNo=o.OrderNo and d.Item ='" + searchModel.Item + "' and d.ReserveNo in('" + traceCodeGroup + "'))";
                //modify by ljz end
            }
            if (!string.IsNullOrWhiteSpace(searchModel.Item) && string.IsNullOrWhiteSpace(searchModel.TraceCode))
            {
                whereStatement += " and exists(select 1 from OrderDetail as d where d.OrderNo=o.OrderNo and d.Item ='" + searchModel.Item + "')";
            }
            if (string.IsNullOrWhiteSpace(searchModel.Item) && !string.IsNullOrWhiteSpace(searchModel.TraceCode))
            {
                //modify by ljz strat
                //whereStatement += " and exists(select 1 from OrderDetail as d where d.OrderNo=o.OrderNo and d.ReserveNo ='" + TraceCodeGroup + "')";
                whereStatement += " and exists(select 1 from OrderDetail as d where d.OrderNo=o.OrderNo and d.ReserveNo in('" + traceCodeGroup + "'))";
                //modify by ljz end

            }
            if (!string.IsNullOrWhiteSpace(searchModel.SequenceGroup))
            {
                whereStatement += " and o.SeqGroup='" + searchModel.SequenceGroup + "'";
            }
            if (searchModel.IsPrintOrder)
            {
                whereStatement += string.Format(" and IsPrintOrder=0 ");
            }
           
            searchModel.SubType = (int)com.Sconit.CodeMaster.OrderSubType.Normal;
            ProcedureSearchStatementModel procedureSearchStatementModel = PrepareSearchStatement(command, searchModel, whereStatement, false);
            GridModel<OrderMaster> gridModel = GetAjaxPageDataProcedure<OrderMaster>(procedureSearchStatementModel, command);
            foreach (var ordermstr in gridModel.Data)
            {
                ordermstr.SeqOrderStrategyDescription=ordermstr.OrderTemplate == "KitOrder.xls"?"Kit":"排序";
            }
            return PartialView(gridModel);
        }
 public ActionResult List(GridCommand command, OrderMasterSearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
     if (this.CheckSearchModelIsNull(searchCacheModel.SearchObject))
     {
         TempData["_AjaxMessage"] = "";
     }
     else
     {
         SaveWarningMessage(Resources.ErrorMessage.Errors_NoConditions);
     }
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return View();
 }
 public ActionResult List(GridCommand command, OrderMasterSearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
     if (!string.IsNullOrEmpty(searchModel.Checker))
     {
         TempData["_AjaxMessage"] = "";
     }
     else
     {
         SaveWarningMessage("请输入保管员进行查询。");
     }
     ViewBag.PageSize =100;
     return View();
 }
 public ActionResult List(GridCommand command, OrderMasterSearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
     if (!string.IsNullOrEmpty(searchModel.Checker))
     {
         TempData["_AjaxMessage"] = "";
     }
     else
     {
         SaveWarningMessage(Resources.EXT.ControllerLan.Con_PleaseInputKeeperToSearch);
     }
     ViewBag.PageSize =100;
     return View();
 }
        public ActionResult _AjaxList(GridCommand command, OrderMasterSearchModel searchModel)
        {
            if (searchModel.DateFrom == null || searchModel.DateTo == null)
            {
                return PartialView(new GridModel(new List<OrderOperationReport>()));
            }

            string execSql = string.Empty;
            string searchSql = @"select op.WorkCenter,om.Flow,case when workcenter in ('930-03','940-05','940-08','930-04') then om.completedate when workcenter in ('940-00','960-00') then om.startdate else om.releasedate end as thedate ,op.ReportQty,om.TraceCode from ORD_OrderOpReport as op inner join ORD_OrderMstr_4 as om on op.OrderNo=om.OrderNo 
  where om.ProdLineType in (1,2,3,4,9) and op.Status = 0  ";
            IList<object> paramArr = new List<object>();
            if (!string.IsNullOrWhiteSpace(searchModel.WorkCenter))
            {
                searchSql += " and WorkCenter=? ";
                paramArr.Add(searchModel.WorkCenter);
            }
            else
            {
                searchSql += " and op.WorkCenter is not null and op.WorkCenter<>'' ";

            }
            if (!string.IsNullOrWhiteSpace(searchModel.Flow))
            {
                searchSql += " and Flow=? ";
                paramArr.Add(searchModel.Flow);
            }

            execSql = "select workcenter,flow,sum(reportqty) from (" + searchSql + ") a where thedate between ? and ? group by workcenter,flow order by workcenter asc";
            paramArr.Add(searchModel.DateFrom.Value);
            paramArr.Add(searchModel.DateTo.Value);

            IList<object[]> searchResult = this.genericMgr.FindAllWithNativeSql<object[]>(execSql, paramArr.ToArray());
            var returnResult = new List<OrderOperationReport>();
            if (searchResult != null && searchResult.Count > 0)
            {
                returnResult = (from tak in searchResult
                                select new OrderOperationReport
                                {
                                    WorkCenter = (string)tak[0],
                                    Flow = (string)tak[1],
                                    ReportQty = (decimal)tak[2],
                                }).ToList();
            }

            GridModel<OrderOperationReport> returnGrid = new GridModel<OrderOperationReport>();
            returnGrid.Total = returnResult.Count;
            returnGrid.Data = returnResult.Skip((command.Page - 1) * command.PageSize).Take(command.PageSize);
            return PartialView(returnGrid);
        }
        public ActionResult List(GridCommand command, OrderMasterSearchModel searchModel)
        {
            SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
            if (searchModel.DateFrom != null && searchModel.DateTo != null)
            {
                TempData["_AjaxMessage"] = "";
                ViewBag.DateFrom = searchModel.DateFrom.Value;
                ViewBag.DateTo = searchModel.DateTo.Value;
            }
            else
            {
                SaveWarningMessage("开始结束时间不能为空。");
            }

            ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
            return View();
        }
예제 #12
0
        public ActionResult _OrderSummaryHierarchyAjax(GridCommand command, OrderMasterSearchModel searchModel)
        {
            SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel, true);
            IList<OrderDetail> orderDetailList = queryMgr.FindAll<OrderDetail>(searchStatementModel.GetSearchStatement(), searchStatementModel.Parameters);
            var summaryOrderDetailList = from d in orderDetailList
                                         group d by new { d.Item, d.ItemDescription, d.ReferenceItemCode, d.Uom } into result
                                         select new OrderDetail
                                         {
                                             Item = result.Key.Item,
                                             ItemDescription = result.Key.ItemDescription,
                                             ReferenceItemCode = result.Key.ReferenceItemCode,
                                             Uom = result.Key.Uom,
                                             ReceivedQty = result.Sum(r => r.ReceivedQty)
                                         };

            return PartialView(new GridModel(summaryOrderDetailList));
        }
예제 #13
0
        public ActionResult ReturnDetailList(GridCommand command, OrderMasterSearchModel searchModel)
        {
            TempData["OrderMasterSearchModel"] = searchModel;
            if (this.CheckSearchModelIsNull(searchModel))
            {
                TempData["_AjaxMessage"] = "";
                IList<OrderDetail> list = base.genericMgr.FindAll<OrderDetail>(PrepareSearchDetailReturnStatement(command, searchModel)); //GetPageData<OrderDetail>(searchStatementModel, command);

                int value = Convert.ToInt32(base.systemMgr.GetEntityPreferenceValue(EntityPreference.CodeEnum.MaxRowSizeOnPage));
                if (list.Count > value)
                {
                    SaveWarningMessage(string.Format("数据超过{0}行", value));
                }
                return View(list.Take(value));
            }
            else
            {
                SaveWarningMessage(Resources.ErrorMessage.Errors_NoConditions);
                return View(new List<OrderDetail>());
            }
        }
        private SearchStatementModel PrepareSearchStatement(GridCommand command, OrderMasterSearchModel searchModel )
        {
            string whereStatement = string.Empty;

            IList<object> param = new List<object>();
            if (!string.IsNullOrWhiteSpace(searchModel.TraceCode))
            {
                searchModel.TraceCode = searchModel.TraceCode.PadLeft(10, '0').Substring(2);
            }
            HqlStatementHelper.AddLikeStatement("VanCode", searchModel.TraceCode,HqlStatementHelper.LikeMatchMode.End, "p", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("OrderNo", searchModel.OrderNo, "p", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("ProdLine", searchModel.ProdLine, "p", ref whereStatement, param);

            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);

            SearchStatementModel searchStatementModel = new SearchStatementModel();
            searchStatementModel.SelectCountStatement = selectCountStatement;
            searchStatementModel.SelectStatement = selectStatement;
            searchStatementModel.WhereStatement = whereStatement;
            searchStatementModel.SortingStatement = sortingStatement;
            searchStatementModel.Parameters = param.ToArray<object>();

            return searchStatementModel;
        }
예제 #15
0
 public ActionResult DetailNew(GridCommand command, OrderMasterSearchModel searchModel, string PageSize)
 {
     if (TempData["OrderMasterSearchModel"] == null)
     {
         TempData["OrderMasterSearchModel"] = searchModel;
     }
     if (this.CheckSearchModelIsNull(searchModel))
     {
         TempData["_AjaxMessage"] = "";
     }
     else
     {
         SaveWarningMessage(Resources.EXT.ControllerLan.Con_PleaseMustInputOneSearchConditionExceptRowNumber);
     }
     this.ProcessPageSize(command.PageSize);
     ViewBag.PageSize = (PageSize != null && PageSize != "") ? int.Parse(PageSize) : 20;
     return View();
 }
        private SearchStatementModel OrderMasterPrepareSearchStatement(GridCommand command, OrderMasterSearchModel searchModel)
        {
            string whereStatement = string.Empty;

            IList<object> param = new List<object>();

            if (searchModel.OrderNo != null && searchModel.OrderNo != string.Empty)
            {
                HqlStatementHelper.AddEqStatement("OrderNo", searchModel.OrderNo, "i", ref whereStatement, param);
            }
            else
            {
                if (searchModel.Flow != null && searchModel.Flow != string.Empty)
                {
                    HqlStatementHelper.AddEqStatement("Flow", searchModel.Flow, "i", ref whereStatement, param);
                }
                else
                {
                    if (searchModel.PartyFrom != null && searchModel.PartyFrom != string.Empty)
                    {
                        HqlStatementHelper.AddEqStatement("Flow", searchModel.PartyFrom, "i", ref whereStatement, param);
                    }
                    if (searchModel.PartyTo != null && searchModel.PartyTo != string.Empty)
                    {
                        HqlStatementHelper.AddEqStatement("Flow", searchModel.PartyTo, "i", ref whereStatement, param);
                    }
                }
            }
            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);

            SearchStatementModel searchStatementModel = new SearchStatementModel();
            searchStatementModel.SelectCountStatement = selectIpDetailCountStatement;
            searchStatementModel.SelectStatement = selectIpDetailStatement;
            searchStatementModel.WhereStatement = whereStatement;
            searchStatementModel.SortingStatement = sortingStatement;
            searchStatementModel.Parameters = param.ToArray<object>();

            return searchStatementModel;
        }
 public void ExportMasterXLS(OrderMasterSearchModel searchModel)
 {
     string whereStatement = "and o.OrderStrategy=" + (int)com.Sconit.CodeMaster.FlowStrategy.SEQ;
     //if (!string.IsNullOrWhiteSpace(searchModel.Item))
     //{
     //    whereStatement += " and exists(select 1 from OrderDetail as d where d.OrderNo=o.OrderNo and d.Item ='" + searchModel.Item + "')";
     //}
     //if (!string.IsNullOrWhiteSpace(searchModel.Item) && !string.IsNullOrWhiteSpace(searchModel.TraceCode))
     //{
     //    whereStatement += " and exists(select 1 from OrderDetail as d where d.OrderNo=o.OrderNo and d.Item ='" + searchModel.Item + "' and d.ReserveNo='" + searchModel.TraceCode + "')";
     //}
     //if (!string.IsNullOrWhiteSpace(searchModel.Item) && string.IsNullOrWhiteSpace(searchModel.TraceCode))
     //{
     //    whereStatement += " and exists(select 1 from OrderDetail as d where d.OrderNo=o.OrderNo and d.Item ='" + searchModel.Item + "')";
     //}
     //if (string.IsNullOrWhiteSpace(searchModel.Item) && !string.IsNullOrWhiteSpace(searchModel.TraceCode))
     //{
     //    whereStatement += " and exists(select 1 from OrderDetail as d where d.OrderNo=o.OrderNo and d.ReserveNo ='" + searchModel.TraceCode + "')";
     //}
     if (!string.IsNullOrWhiteSpace(searchModel.SequenceGroup))
     {
         whereStatement += " and o.SeqGroup='" + searchModel.SequenceGroup + "'";
     }
     GridCommand command = new GridCommand();
     command.Page = 1;
     command.PageSize = 65500;
     searchModel.SubType = (int)com.Sconit.CodeMaster.OrderSubType.Normal;
     ProcedureSearchStatementModel procedureSearchStatementModel = PrepareSearchStatement(command, searchModel, whereStatement, false);
     var data = GetAjaxPageDataProcedure<OrderMaster>(procedureSearchStatementModel, command).Data;
     IList<OrderMaster> exportMasterList = data != null && data.Count() > 0 ? data.ToList() : null;
     ExportToXLS<OrderMaster>("ExportSeqOrder", "xls", exportMasterList);
 }
예제 #18
0
        public ActionResult _AjaxNewDetail(GridCommand command, OrderMasterSearchModel searchModel)
        {
            if (!this.CheckSearchModelIsNull(searchModel))
            {
                return PartialView(new GridModel(new List<OrderDetail>()));
            }
            SearchStatementModel searchStatementModel = PrepareOrderDetailSearchStatement(command, searchModel);
            GridModel<OrderDetail> List = GetAjaxPageData<OrderDetail>(searchStatementModel, command);
            IList<OrderDetail> orderDetailList = List.Data.Where(o => o.CurrentPickListQty > 0).ToList();
            if (orderDetailList != null && orderDetailList.Count > 0)
            {
                var locations = orderDetailList.Select(p => p.LocationFrom).Distinct();
                var items = orderDetailList.Select(p => p.Item).Distinct().ToList();

                var paraList = new List<object>();
                paraList.AddRange(locations);
                paraList.AddRange(items);
                var sql = string.Empty;
                foreach (var location in locations)
                {
                    if (sql == string.Empty)
                    {
                        sql = @"select Location,Item,SUM(qty) from VIEW_LocationLotDet where LotNo is not null
                    and QualityType =0 and IsFreeze = 0 and IsATP = 1 and OccupyType = 0
                    and Location in(? ";
                    }
                    else
                    {
                        sql += ",?";
                    }
                }
                sql += ")";
                foreach (var item in items)
                {
                    if (items.IndexOf(item) == 0)
                    {
                        sql += " and Item in(? ";
                    }
                    else
                    {
                        sql += ",? ";
                    }
                }
                sql += " ) group by Location,Item ";

                var invs = this.genericMgr.FindAllWithNativeSql<object[]>(sql, paraList.ToArray())
                    .Select(p => new { Location = (string)p[0], Item = (string)p[1], Qty = (decimal)p[2] });

                foreach (OrderDetail orderDetail in orderDetailList)
                {
                    OrderMaster orderMaster = genericMgr.FindById<OrderMaster>(orderDetail.OrderNo);
                    //IList<LocationLotDetail> locationLotDetailList = genericMgr.FindAllWithNamedQuery<LocationLotDetail>
                    //    ("USP_Busi_GetPlusInventory",
                    //    new Object[] {
                    //        orderDetail.LocationFrom, orderDetail.Item,
                    //        com.Sconit.CodeMaster.QualityType.Qualified, 
                    //        com.Sconit.CodeMaster.OccupyType.None, 
                    //        false 
                    //    });

                    orderDetail.WindowTime = orderMaster.WindowTime;
                    orderDetail.LocationQty = invs.Where(p => p.Location == orderDetail.LocationFrom && p.Item == orderDetail.Item).Sum(p => p.Qty);
                    if (!string.IsNullOrWhiteSpace(orderDetail.Direction))
                    {
                        var directions = genericMgr.FindAll<HuTo>(" from HuTo where Code =? ", orderDetail.Direction);
                        if (directions != null && directions.Count > 0)
                        {
                            orderDetail.DirectionDescription = directions.First().Description;
                        }
                        else
                        {
                            orderDetail.DirectionDescription = orderDetail.Direction;
                        }
                    }
                }
            }
            GridModel<OrderDetail> gridList = new GridModel<OrderDetail>();
            gridList.Data = orderDetailList;
            gridList.Total = List.Total;
            // return PartialView(List);
            return PartialView(gridList);
        }
        private ProcedureSearchStatementModel PrepareReceiveSearchStatement_1(GridCommand command, OrderMasterSearchModel searchModel)
        {

            string whereStatement = " and o.IsRecScanHu = 0 and o.Status in (" + (int)com.Sconit.CodeMaster.OrderStatus.InProcess + "," + (int)com.Sconit.CodeMaster.OrderStatus.Submit + ")"
                                    + " and o.SubType = " + (int)com.Sconit.CodeMaster.OrderSubType.Normal
                                    + " and exists (select 1 from OrderDetail as d where d.RecQty < d.OrderQty and d.OrderNo = o.OrderNo) ";
            List<ProcedureParameter> paraList = new List<ProcedureParameter>();
            List<ProcedureParameter> pageParaList = new List<ProcedureParameter>();
            paraList.Add(new ProcedureParameter { Parameter = searchModel.OrderNo, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.Flow, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter
            {
                Parameter = (int)com.Sconit.CodeMaster.OrderType.Procurement + "," + (int)com.Sconit.CodeMaster.OrderType.Transfer
                    + "," + (int)com.Sconit.CodeMaster.OrderType.SubContractTransfer + "," + (int)com.Sconit.CodeMaster.OrderType.CustomerGoods + "," + (int)com.Sconit.CodeMaster.OrderType.SubContract + "," + (int)com.Sconit.CodeMaster.OrderType.ScheduleLine,
                Type = NHibernate.NHibernateUtil.String
            });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.SubType, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.PartyFrom, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.PartyTo, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.Status, Type = NHibernate.NHibernateUtil.Int16 });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.Priority, Type = NHibernate.NHibernateUtil.Int16 });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.ExternalOrderNo, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.ReferenceOrderNo, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.TraceCode, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.CreateUserName, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.DateFrom, Type = NHibernate.NHibernateUtil.DateTime });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.DateTo, Type = NHibernate.NHibernateUtil.DateTime });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.StartTime, Type = NHibernate.NHibernateUtil.DateTime });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.EndTime, Type = NHibernate.NHibernateUtil.DateTime });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.WindowTimeFrom, Type = NHibernate.NHibernateUtil.DateTime });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.WindowTimeTo, Type = NHibernate.NHibernateUtil.DateTime });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.Sequence, Type = NHibernate.NHibernateUtil.Int64 });
            paraList.Add(new ProcedureParameter { Parameter = false, Type = NHibernate.NHibernateUtil.Boolean });
            paraList.Add(new ProcedureParameter { Parameter = false, Type = NHibernate.NHibernateUtil.Boolean });
            paraList.Add(new ProcedureParameter { Parameter = CurrentUser.Id, Type = NHibernate.NHibernateUtil.Int32 });
            paraList.Add(new ProcedureParameter { Parameter = whereStatement, Type = NHibernate.NHibernateUtil.String });


            if (command.SortDescriptors.Count > 0)
            {
                if (command.SortDescriptors[0].Member == "OrderTypeDescription")
                {
                    command.SortDescriptors[0].Member = "Type";
                }
                else if (command.SortDescriptors[0].Member == "OrderPriorityDescription")
                {
                    command.SortDescriptors[0].Member = "Priority";
                }
                else if (command.SortDescriptors[0].Member == "OrderStatusDescription")
                {
                    command.SortDescriptors[0].Member = "Status";
                }
            }
            pageParaList.Add(new ProcedureParameter { Parameter = command.SortDescriptors.Count > 0 ? command.SortDescriptors[0].Member : null, Type = NHibernate.NHibernateUtil.String });
            pageParaList.Add(new ProcedureParameter { Parameter = command.SortDescriptors.Count > 0 ? (command.SortDescriptors[0].SortDirection == ListSortDirection.Descending ? "desc" : "asc") : "asc", Type = NHibernate.NHibernateUtil.String });
            pageParaList.Add(new ProcedureParameter { Parameter = command.PageSize, Type = NHibernate.NHibernateUtil.Int32 });
            pageParaList.Add(new ProcedureParameter { Parameter = command.Page, Type = NHibernate.NHibernateUtil.Int32 });

            var procedureSearchStatementModel = new ProcedureSearchStatementModel();
            procedureSearchStatementModel.Parameters = paraList;
            procedureSearchStatementModel.PageParameters = pageParaList;
            procedureSearchStatementModel.CountProcedure = "USP_Search_ProcurementOrderCount";
            procedureSearchStatementModel.SelectProcedure = "USP_Search_ProcurementOrder";

            return procedureSearchStatementModel;
        }
예제 #20
0
 public ActionResult _AjaxNewOrderList(GridCommand command, OrderMasterSearchModel searchModel)
 {
     SearchStatementModel searchStatementModel = PreparePickListSearchStatement(command, searchModel);
     return PartialView(GetAjaxPageData<OrderMaster>(searchStatementModel, command));
 }
        public ActionResult Refresh(string flow)
        {
            try
            {
                if (string.IsNullOrEmpty(flow))
                {
                    throw new BusinessException(Resources.EXT.ControllerLan.Con_FlowCodeCanNotBeEmpty);
                }
                //FlowMaster flowMaster = genericMgr.FindById<FlowMaster>(flow);
                //Region region = genericMgr.FindById<Region>(flowMaster.PartyTo);
                //SAPService.SAPService sapService = new SAPService.SAPService();
                //com.Sconit.Entity.ACC.User user = SecurityContextHolder.Get();
                //sapService.GetProcOrders(user.Code, string.Empty, flowMaster.PartyFrom, region.Plant, DateTime.Now);
                SaveSuccessMessage(Resources.EXT.ControllerLan.Con_PlanProtocolRefreshSuccessfully);
            }
            catch (BusinessException ex)
            {
                SaveErrorMessage(ex.GetMessages()[0].GetMessageString());
            }
            catch (Exception ex)
            {
                SaveErrorMessage(ex.Message);
            }

            TempData["OrderMasterSearchModel"] = new OrderMasterSearchModel { Flow = flow };
            return View("Index");
        }
예제 #22
0
        private SearchStatementModel PreparePickListSearchStatement(GridCommand command, OrderMasterSearchModel searchModel)
        {
            string whereStatement = string.Empty;
            if (searchModel.Type.HasValue && searchModel.Type > 0)
            {
                whereStatement = " where o.Type =" + searchModel.Type
                    + " and o.IsShipScanHu = 1 and o.Status in (" + (int)com.Sconit.CodeMaster.OrderStatus.InProcess + "," + (int)com.Sconit.CodeMaster.OrderStatus.Submit + ")"
                    + " and exists (select 1 from OrderDetail as d where d.PickedQty < d.OrderedQty and d.OrderNo = o.OrderNo) ";
            }
            else
            {
                whereStatement = " where o.Type in (" + (int)com.Sconit.CodeMaster.OrderType.Distribution + ","
                   + (int)com.Sconit.CodeMaster.OrderType.Transfer + ","
                   + (int)com.Sconit.CodeMaster.OrderType.SubContractTransfer + ")"
                   + " and o.IsShipScanHu = 1 and o.Status in (" + (int)com.Sconit.CodeMaster.OrderStatus.InProcess + "," + (int)com.Sconit.CodeMaster.OrderStatus.Submit + ")"
                   + " and exists (select 1 from OrderDetail as d where d.PickedQty < d.OrderedQty and d.OrderNo = o.OrderNo) ";
            }
            IList<object> param = new List<object>();
            if (!string.IsNullOrEmpty(searchModel.OrderNo))
            {
                HqlStatementHelper.AddLikeStatement("OrderNo", searchModel.OrderNo, HqlStatementHelper.LikeMatchMode.Start, "o", ref whereStatement, param);
            }
            if (!string.IsNullOrEmpty(searchModel.Flow))
            {
                HqlStatementHelper.AddEqStatement("Flow", searchModel.Flow, "o", ref whereStatement, param);
            }
            if (!string.IsNullOrEmpty(searchModel.PartyFrom))
            {
                HqlStatementHelper.AddEqStatement("PartyFrom", searchModel.PartyFrom, "o", ref whereStatement, param);
            }
            if (!string.IsNullOrEmpty(searchModel.PartyTo))
            {
                HqlStatementHelper.AddEqStatement("PartyTo", searchModel.PartyTo, "o", ref whereStatement, param);
            }

            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);
            if (command.SortDescriptors.Count == 0)
            {
                sortingStatement = " order by o.CreateDate desc";
            }
            SearchStatementModel searchStatementModel = new SearchStatementModel();
            searchStatementModel.SelectCountStatement = selectOrderCountStatement;
            searchStatementModel.SelectStatement = selectOrderStatement;
            searchStatementModel.WhereStatement = whereStatement;
            searchStatementModel.SortingStatement = sortingStatement;
            searchStatementModel.Parameters = param.ToArray<object>();
            return searchStatementModel;
        }
예제 #23
0
 public ActionResult New(GridCommand command, OrderMasterSearchModel searchModel)
 {
     TempData["OrderMasterSearchModel"] = searchModel;
     return View();
 }
        private ProcedureSearchStatementModel PrepareSearchDetailStatement(GridCommand command, OrderMasterSearchModel searchModel)
        {
            //string whereStatement = string.Format(" and exists (select 1 from OrderMaster  as o where o.OrderStrategy <> 4 and o.SubType ={0} and o.OrderNo=d.OrderNo ) ",
            //    (int)com.Sconit.CodeMaster.OrderSubType.Normal);
            string whereStatement = " and exists( select 1 from OrderMaster as o where o.OrderNo=d.OrderNo and o.OrderStrategy = 4  and o.SubType=0) ";
            if (!string.IsNullOrWhiteSpace(searchModel.Flow))
            {
                whereStatement = "  and exists( select 1 from OrderMaster as o where o.OrderNo=d.OrderNo and o.OrderStrategy = 4  and o.SubType=0 and o.Flow='" + searchModel.Flow + "' ) ";
            }

            List<ProcedureParameter> paraList = new List<ProcedureParameter>();
            List<ProcedureParameter> pageParaList = new List<ProcedureParameter>();
            paraList.Add(new ProcedureParameter { Parameter = searchModel.OrderNo, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.Flow, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter
            {
                Parameter = (int)com.Sconit.CodeMaster.OrderType.Transfer + "," + (int)com.Sconit.CodeMaster.OrderType.Procurement,
                Type = NHibernate.NHibernateUtil.String
            });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.SubType, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.PartyFrom, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.PartyTo, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.Status, Type = NHibernate.NHibernateUtil.Int16 });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.Priority, Type = NHibernate.NHibernateUtil.Int16 });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.ExternalOrderNo, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.ReferenceOrderNo, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.TraceCode, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.CreateUserName, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.DateFrom, Type = NHibernate.NHibernateUtil.DateTime });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.DateTo, Type = NHibernate.NHibernateUtil.DateTime });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.StartTime, Type = NHibernate.NHibernateUtil.DateTime });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.EndTime, Type = NHibernate.NHibernateUtil.DateTime });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.WindowTimeFrom, Type = NHibernate.NHibernateUtil.DateTime });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.WindowTimeTo, Type = NHibernate.NHibernateUtil.DateTime });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.Sequence, Type = NHibernate.NHibernateUtil.Int64 });
            paraList.Add(new ProcedureParameter { Parameter = true, Type = NHibernate.NHibernateUtil.Boolean });
            paraList.Add(new ProcedureParameter { Parameter = false, Type = NHibernate.NHibernateUtil.Boolean });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.Item, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.ManufactureParty, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.WmSSeq, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.Picker, Type = NHibernate.NHibernateUtil.String });

            paraList.Add(new ProcedureParameter { Parameter = CurrentUser.Id, Type = NHibernate.NHibernateUtil.Int32 });

            paraList.Add(new ProcedureParameter { Parameter = whereStatement, Type = NHibernate.NHibernateUtil.String });


            if (command.SortDescriptors.Count > 0)
            {
                if (command.SortDescriptors[0].Member == "OrderTypeDescription")
                {
                    command.SortDescriptors[0].Member = "Type";
                }
                else if (command.SortDescriptors[0].Member == "OrderPriorityDescription")
                {
                    command.SortDescriptors[0].Member = "Priority";
                }
                else if (command.SortDescriptors[0].Member == "OrderStatusDescription")
                {
                    command.SortDescriptors[0].Member = "Status";
                }
                else if (command.SortDescriptors[0].Member == "ItemDescription")
                {
                    command.SortDescriptors[0].Member = "Item";
                }
                else if (command.SortDescriptors[0].Member == "UnitCountDescription")
                {
                    command.SortDescriptors[0].Member = "UnitCount";
                }
                else if (command.SortDescriptors[0].Member == "ContainerDescription")
                {
                    command.SortDescriptors[0].Member = "Container";
                }
                else if (command.SortDescriptors[0].Member == "LotNo")
                {
                    command.SortDescriptors[0].Member = "Container";
                }
                else if (command.SortDescriptors[0].Member == "LocationTo")
                {
                    command.SortDescriptors[0].Member = "LocTo";
                }
                else if (command.SortDescriptors[0].Member == "OrderedQty")
                {
                    command.SortDescriptors[0].Member = "OrderQty";
                }
                else if (command.SortDescriptors[0].Member == "ShippedQty")
                {
                    command.SortDescriptors[0].Member = "ShipQty";
                }
                else if (command.SortDescriptors[0].Member == "ReceivedQty")
                {
                    command.SortDescriptors[0].Member = "RecQty";
                }
                else if (command.SortDescriptors[0].Member == "ExternalOrderNo")
                {
                    command.SortDescriptors[0].Member = "ExtNo";
                }
                else if (command.SortDescriptors[0].Member == "ExternalSequence")
                {
                    command.SortDescriptors[0].Member = "ExtSeq";
                }
            }
            pageParaList.Add(new ProcedureParameter { Parameter = command.SortDescriptors.Count > 0 ? command.SortDescriptors[0].Member : null, Type = NHibernate.NHibernateUtil.String });
            pageParaList.Add(new ProcedureParameter { Parameter = command.SortDescriptors.Count > 0 ? (command.SortDescriptors[0].SortDirection == ListSortDirection.Descending ? "desc" : "asc") : "asc", Type = NHibernate.NHibernateUtil.String });
            pageParaList.Add(new ProcedureParameter { Parameter = command.PageSize, Type = NHibernate.NHibernateUtil.Int32 });
            pageParaList.Add(new ProcedureParameter { Parameter = command.Page, Type = NHibernate.NHibernateUtil.Int32 });

            var procedureSearchStatementModel = new ProcedureSearchStatementModel();
            procedureSearchStatementModel.Parameters = paraList;
            procedureSearchStatementModel.PageParameters = pageParaList;
            procedureSearchStatementModel.CountProcedure = "USP_Search_ProcurementOrderDetCount";
            procedureSearchStatementModel.SelectProcedure = "USP_Search_ProcurementOrderDet";

            return procedureSearchStatementModel;
        }
예제 #25
0
        public ActionResult CreatePickList(string idStr, string qtyStr, OrderMasterSearchModel searchModel)
        {
            try
            {
                if (string.IsNullOrEmpty(idStr))
                {
                    throw new BusinessException(Resources.EXT.ControllerLan.Con_PickDetailCanNotBeEmpty);
                }
                string[] idArr = idStr.Split(',');
                string[] qtyArr = qtyStr.Split(',');

                IList<OrderDetail> orderDetailList = new List<OrderDetail>();
                for (int i = 0; i < idArr.Count(); i++)
                {

                    OrderDetail orderDetail = genericMgr.FindById<OrderDetail>(Convert.ToInt32(idArr[i]));
                    OrderDetailInput orderDetailInput = new OrderDetailInput();
                    orderDetailInput.PickQty = Convert.ToDecimal(qtyArr[i]);
                    orderDetail.AddOrderDetailInput(orderDetailInput);
                    //校验还没发
                    orderDetailList.Add(orderDetail);
                }

                PickListMaster pickListMaster = pickListMgr.CreatePickList(orderDetailList);
                SaveSuccessMessage(Resources.ORD.PickListMaster.PickListMaster_Created);
                return RedirectToAction("Edit/" + pickListMaster.PickListNo);
            }
            catch (BusinessException ex)
            {
                SaveErrorMessage(ex.GetMessages()[0].GetMessageString());
                TempData["OrderMasterSearchModel"] = searchModel;
                return RedirectToAction("DetailNew");

            }

        }
        public ActionResult Receive(GridCommand command, OrderMasterSearchModel searchModel)
        {
            this.ProcessSearchModel(command, searchModel);
            if (!CheckSearchModelIsNull(searchModel))
            {
                SaveWarningMessage("请选择查询条件");
            }

            ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
            return View();
        }
예제 #27
0
        private SearchStatementModel PrepareOrderDetailSearchStatement(GridCommand command, OrderMasterSearchModel searchModel)
        {
            IList<object> param = new List<object>();
            StringBuilder Sb = new StringBuilder();
            string whereStatement = " where exists (select 1 from OrderMaster  as o where o.OrderNo=d.OrderNo ";

            Sb.Append(whereStatement);

            if (searchModel.Flow != null)
            {
                Sb.Append(string.Format(" and o.Flow = '{0}'", searchModel.Flow));
            }

            if (searchModel.OrderNo != null)
            {
                Sb.Append(string.Format(" and o.OrderNo like '%{0}'", searchModel.OrderNo));
            }
            if (!string.IsNullOrEmpty(searchModel.PartyFrom))
            {
                Sb.Append(string.Format(" and o.PartyFrom = '{0}'", searchModel.PartyFrom));

            }
            if (!string.IsNullOrEmpty(searchModel.PartyTo))
            {
                Sb.Append(string.Format(" and o.PartyTo = '{0}'", searchModel.PartyTo));

            }
            if (searchModel.Type.HasValue && searchModel.Type > 0)
            {
                Sb.Append(string.Format(" and  d.OrderType ='{0}' ", searchModel.Type));
            }

            if (searchModel.DateFrom != null & searchModel.DateTo != null)
            {
                Sb.Append(string.Format(" and o.CreateDate between '{0}' and '{1}'", searchModel.DateFrom, searchModel.DateTo));

            }
            else if (searchModel.DateFrom != null & searchModel.DateTo == null)
            {
                Sb.Append(string.Format(" and o.CreateDate >= '{0}'", searchModel.DateTo));

            }
            else if (searchModel.DateFrom == null & searchModel.DateTo != null)
            {
                Sb.Append(string.Format(" and o.CreateDate <= '{0}'", searchModel.DateTo));
            }
            //满足条件1.移库或销售类型订单;2.订单数-已发数-拣货数〉0;3.排序单和分装生产单不能创建拣货单
            Sb.Append(" and o.Type in (2,3,7) and (OrderQty-ShipQty-PickQty)>0  ");
            Sb.Append("and o.Status in (" + (int)com.Sconit.CodeMaster.OrderStatus.Submit + "," + (int)com.Sconit.CodeMaster.OrderStatus.InProcess + "))");
            whereStatement = Sb.ToString();
            HqlStatementHelper.AddEqStatement("Item", searchModel.Item, "d", ref whereStatement, param);
            if (searchModel.LocationFrom != null && searchModel.LocationFromTo == null)
            {
                HqlStatementHelper.AddEqStatement("LocationFrom", searchModel.LocationFrom, "d", ref whereStatement, param);
            }
            else if (searchModel.LocationFrom != null && searchModel.LocationFromTo != null)
            {
                HqlStatementHelper.AddBetweenStatement("LocationFrom", searchModel.LocationFrom, searchModel.LocationFromTo, "d", ref whereStatement, param);
            }

            if (searchModel.LocationTo != null && searchModel.LocationToTo == null)
            {
                HqlStatementHelper.AddEqStatement("LocationTo", searchModel.LocationTo, "d", ref whereStatement, param);
            }
            else if (searchModel.LocationTo != null && searchModel.LocationToTo != null)
            {
                HqlStatementHelper.AddBetweenStatement("LocationTo", searchModel.LocationTo, searchModel.LocationToTo, "d", ref whereStatement, param);
            }

            if (command.SortDescriptors.Count > 0)
            {
                if (command.SortDescriptors[0].Member == "WindowTime")
                {
                    command.SortDescriptors.Remove(command.SortDescriptors[0]);
                    // command.SortDescriptors[0].Member = "Type";
                }
                else if (command.SortDescriptors[0].Member == "CurrentPickListQty")
                {
                    command.SortDescriptors.Remove(command.SortDescriptors[0]);
                }
                else if (command.SortDescriptors[0].Member == "CurrentPickQty")
                {
                    command.SortDescriptors.Remove(command.SortDescriptors[0]);
                }
            }

            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);
            if (command.SortDescriptors.Count == 0)
            {
                sortingStatement = " order by d.CreateDate desc";
            }


            SearchStatementModel searchStatementModel = new SearchStatementModel();
            searchStatementModel.SelectCountStatement = "select count(*) from OrderDetail as d";
            searchStatementModel.SelectStatement = "select d from OrderDetail as d";
            searchStatementModel.WhereStatement = whereStatement;
            searchStatementModel.SortingStatement = sortingStatement;
            searchStatementModel.Parameters = param.ToArray<object>();

            return searchStatementModel;
        }
        public ActionResult _AjaxReceiveOrderList(GridCommand command, OrderMasterSearchModel searchModel)
        {
            if (string.IsNullOrWhiteSpace(searchModel.OrderNo) && string.IsNullOrWhiteSpace(searchModel.Flow) && (string.IsNullOrWhiteSpace(searchModel.PartyFrom) || string.IsNullOrWhiteSpace(searchModel.PartyTo)))
            {
                return PartialView(new GridModel(new List<OrderMaster>()));
            }
            else
            {
                string whereStatement = " and o.IsRecScanHu = 0 and o.Status in (" + (int)com.Sconit.CodeMaster.OrderStatus.InProcess + "," + (int)com.Sconit.CodeMaster.OrderStatus.Submit + ")"
                                   + " and o.SubType = " + (int)com.Sconit.CodeMaster.OrderSubType.Normal
                                   + " and exists (select 1 from OrderDetail as d where d.RecQty < d.OrderQty and d.OrderNo = o.OrderNo) "
                                   + " and o.OrderStrategy=" + (int)com.Sconit.CodeMaster.FlowStrategy.SEQ + " ";
                ProcedureSearchStatementModel procedureSearchStatementModel = PrepareSearchStatement(command, searchModel, whereStatement, false);
                return PartialView(GetAjaxPageDataProcedure<OrderMaster>(procedureSearchStatementModel, command));

            }
        }
        public ActionResult List(GridCommand command, OrderMasterSearchModel searchModel)
        {
            TempData["OrderMasterSearchModel"] = searchModel;

            if (string.IsNullOrWhiteSpace(searchModel.Flow))
            {
                SaveWarningMessage(Resources.EXT.ControllerLan.Con_PleaseChooseOneFlow);
            }

            DateTime dateTimeNow = DateTime.Now;
            ScheduleView scheduleView = PrepareScheduleView(searchModel.Flow, searchModel.Item, searchModel.ScheduleType, searchModel.DateFrom, searchModel.DateTo, dateTimeNow);

            #region  grid column
            var columns = new List<GridColumnSettings>();
            columns.Add(new GridColumnSettings
                {
                    Member = scheduleView.ScheduleHead.OrderNoHead,
                    Title = Resources.ORD.OrderDetail.OrderDetail_ScheduleLineNo,
                    Sortable = false
                });
            columns.Add(new GridColumnSettings
            {
                Member = scheduleView.ScheduleHead.SequenceHead,
                Title = Resources.ORD.OrderDetail.OrderDetail_ScheduleLineSeq,
                Sortable = false
            });
            columns.Add(new GridColumnSettings
            {
                Member = scheduleView.ScheduleHead.ItemHead,
                Title = Resources.ORD.OrderDetail.OrderDetail_Item,
                Sortable = false
            });
            columns.Add(new GridColumnSettings
            {
                Member = scheduleView.ScheduleHead.ItemDescriptionHead,
                Title = Resources.ORD.OrderDetail.OrderDetail_ItemDescription,
                Sortable = false
            });
            columns.Add(new GridColumnSettings
            {
                Member = scheduleView.ScheduleHead.ReferenceItemCodeHead,
                Title = Resources.ORD.OrderDetail.OrderDetail_ReferenceItemCode,
                Sortable = false
            });
            columns.Add(new GridColumnSettings
            {
                Member = scheduleView.ScheduleHead.UomHead,
                Title = Resources.ORD.OrderDetail.OrderDetail_Uom,
                Sortable = false
            });
            columns.Add(new GridColumnSettings
            {
                Member = scheduleView.ScheduleHead.UnitCountHead,
                Title = Resources.ORD.OrderDetail.OrderDetail_UnitCount,
                Sortable = false
            });
            columns.Add(new GridColumnSettings
            {
                Member = scheduleView.ScheduleHead.LocationToHead,
                Title = Resources.ORD.OrderDetail.OrderDetail_LocationTo,
                Sortable = false
            });
            columns.Add(new GridColumnSettings
            {
                Member = scheduleView.ScheduleHead.CurrentShipQtyToHead,
                Title = Resources.ORD.OrderDetail.OrderDetail_CurrentShipQty,
                Sortable = false
            });
            #endregion

            #region
            if (scheduleView.ScheduleHead.ColumnCellList != null && scheduleView.ScheduleHead.ColumnCellList.Count > 0)
            {
                for (int i = 0; i < scheduleView.ScheduleHead.ColumnCellList.Count; i++)
                {
                    string ScheduleType = scheduleView.ScheduleHead.ColumnCellList[i].ScheduleType.ToString() == "Firm" ? Resources.EXT.ControllerLan.Con_Settled : Resources.EXT.ControllerLan.Con_Forcast;
                    columns.Add(new GridColumnSettings
                    {
                        Member = "RowCellList[" + i + "].DisplayQty",
                        MemberType = typeof(string),
                        Title = (scheduleView.ScheduleHead.ColumnCellList[i].EndDate.Value < dateTimeNow) ? Resources.EXT.ControllerLan.Con_BackOrder : (scheduleView.ScheduleHead.ColumnCellList[i].EndDate.Value.ToString() + "(" + ScheduleType + ")"),
                        Sortable = false
                    });
                }
            }
            #endregion

            ViewData["columns"] = columns.ToArray();

            IList<ScheduleBody> scheduleBodyList = scheduleView.ScheduleBodyList != null && scheduleView.ScheduleBodyList.Count > 0 ? scheduleView.ScheduleBodyList.OrderBy(s => s.Item).ThenBy(s => s.OrderNo).ToList() : new List<ScheduleBody>();
            return View(scheduleBodyList);
        }
        private ProcedureSearchStatementModel PrepareSearchStatement(GridCommand command, OrderMasterSearchModel searchModel, string whereStatement, bool isReturn)
        {
            List<ProcedureParameter> paraList = new List<ProcedureParameter>();
            List<ProcedureParameter> pageParaList = new List<ProcedureParameter>();
            paraList.Add(new ProcedureParameter { Parameter = searchModel.OrderNo, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.Flow, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter
            {
                Parameter = (int)com.Sconit.CodeMaster.OrderType.Transfer + "," + (int)com.Sconit.CodeMaster.OrderType.Procurement,
                Type = NHibernate.NHibernateUtil.String
            });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.SubType, Type = NHibernate.NHibernateUtil.Int16 });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.PartyFrom, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.PartyTo, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.Status, Type = NHibernate.NHibernateUtil.Int16 });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.Priority, Type = NHibernate.NHibernateUtil.Int16 });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.ExternalOrderNo, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.ReferenceOrderNo, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.TraceCode, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.CreateUserName, Type = NHibernate.NHibernateUtil.String });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.DateFrom, Type = NHibernate.NHibernateUtil.DateTime });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.DateTo, Type = NHibernate.NHibernateUtil.DateTime });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.StartTime, Type = NHibernate.NHibernateUtil.DateTime });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.EndTime, Type = NHibernate.NHibernateUtil.DateTime });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.WindowTimeFrom, Type = NHibernate.NHibernateUtil.DateTime });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.WindowTimeTo, Type = NHibernate.NHibernateUtil.DateTime });
            paraList.Add(new ProcedureParameter { Parameter = searchModel.Sequence, Type = NHibernate.NHibernateUtil.Int64 });
            paraList.Add(new ProcedureParameter { Parameter = true, Type = NHibernate.NHibernateUtil.Boolean });
            paraList.Add(new ProcedureParameter { Parameter = isReturn, Type = NHibernate.NHibernateUtil.Boolean });
            paraList.Add(new ProcedureParameter { Parameter = CurrentUser.Id, Type = NHibernate.NHibernateUtil.Int32 });
            paraList.Add(new ProcedureParameter { Parameter = whereStatement, Type = NHibernate.NHibernateUtil.String });


            if (command.SortDescriptors.Count > 0)
            {
                if (command.SortDescriptors[0].Member == "OrderTypeDescription")
                {
                    command.SortDescriptors[0].Member = "Type";
                }
                else if (command.SortDescriptors[0].Member == "OrderPriorityDescription")
                {
                    command.SortDescriptors[0].Member = "Priority";
                }
                else if (command.SortDescriptors[0].Member == "OrderStatusDescription")
                {
                    command.SortDescriptors[0].Member = "Status";
                }
                else if (command.SortDescriptors[0].Member == "ExternalOrderNo")
                {
                    command.SortDescriptors[0].Member = "ExtOrderNo";
                }
                else if (command.SortDescriptors[0].Member == "FlowDescription")
                {
                    command.SortDescriptors[0].Member = "FlowDesc";
                }
                else if (command.SortDescriptors[0].Member == "ProductLineFacility")
                {
                    command.SortDescriptors[0].Member = "ProdLineFact";
                }
                else if (command.SortDescriptors[0].Member == "ReferenceOrderNo")
                {
                    command.SortDescriptors[0].Member = "RefOrderNo";
                }
                else if (command.SortDescriptors[0].Member == "ExternalOrderNo")
                {
                    command.SortDescriptors[0].Member = "ExtOrderNo";
                }
                else if (command.SortDescriptors[0].Member == "EffectiveDate")
                {
                    command.SortDescriptors[0].Member = "EffDate";
                }
            }
            pageParaList.Add(new ProcedureParameter { Parameter = command.SortDescriptors.Count > 0 ? command.SortDescriptors[0].Member : "OrderNo", Type = NHibernate.NHibernateUtil.String });
            pageParaList.Add(new ProcedureParameter { Parameter = command.SortDescriptors.Count > 0 ? (command.SortDescriptors[0].SortDirection == ListSortDirection.Descending ? "desc" : "asc") : "desc", Type = NHibernate.NHibernateUtil.String });
            pageParaList.Add(new ProcedureParameter { Parameter = command.PageSize, Type = NHibernate.NHibernateUtil.Int32 });
            pageParaList.Add(new ProcedureParameter { Parameter = command.Page, Type = NHibernate.NHibernateUtil.Int32 });

            var procedureSearchStatementModel = new ProcedureSearchStatementModel();
            procedureSearchStatementModel.Parameters = paraList;
            procedureSearchStatementModel.PageParameters = pageParaList;
            procedureSearchStatementModel.CountProcedure = "USP_Search_ProcurementOrderCount";
            procedureSearchStatementModel.SelectProcedure = "USP_Search_ProcurementOrder";

            return procedureSearchStatementModel;
        }