コード例 #1
0
        public ActionResult _GetEngineTraceView(OrderItemTraceResultSearchModel searchModel)
        {
                string hql = " select e from EngineTraceDet as e where 1=1";
                IList<object> parameters = new List<object>();
                if (!string.IsNullOrWhiteSpace(searchModel.EngineCodeSearch))
                {
                    hql += " and  EngineCode=?";
                    parameters.Add(searchModel.EngineCodeSearch);
                }
                if (!string.IsNullOrWhiteSpace(searchModel.TraceCodeSearch))
                {
                    hql += " and  TraceCode=?";
                    parameters.Add(searchModel.TraceCodeSearch);
                }
                if (searchModel.TraceDateFrom != null)
                {
                    hql += " and  CreateDate>= ?";
                    parameters.Add(searchModel.TraceDateFrom.Value);
                }
                if (searchModel.TraceDateTo != null)
                {
                    hql += " and  CreateDate <= ?";
                    parameters.Add(searchModel.TraceDateTo.Value);
                }
                var returnList = this.genericMgr.FindAll<EngineTraceDet>(hql, parameters.ToArray());

                return View(returnList.OrderBy(r => r.TraceCode).ToList());
        }
コード例 #2
0
        public ActionResult _GetTraceResut(OrderItemTraceResultSearchModel searchModel)
        {
            try
            {
                if (!this.CheckSearchModelIsNull(searchModel))
                {
                    throw new BusinessException("请输入查询条件。");
                }
                string hql = " select r from OrderItemTraceResult as r where 1=1";
                IList<object> parameters = new List<object>();
                if (!string.IsNullOrWhiteSpace(searchModel.OrderNo))
                {
                    hql += " and  OrderNo=?";
                    parameters.Add(searchModel.OrderNo);
                }
                if (!string.IsNullOrWhiteSpace(searchModel.TraceCode))
                {
                    hql += " and  TraceCode=?";
                    parameters.Add(searchModel.TraceCode);
                }
                if (!string.IsNullOrWhiteSpace(searchModel.Item))
                {
                    hql += " and  Item=?";
                    parameters.Add(searchModel.Item);
                }
                if (!string.IsNullOrWhiteSpace(searchModel.OpReference))
                {
                    hql += " and  OpReference=?";
                    parameters.Add(searchModel.OpReference);
                }
                if (searchModel.TraceDateFrom != null)
                {
                    hql += " and  CreateDate>= ?";
                    parameters.Add(searchModel.TraceDateFrom.Value);
                }
                if (searchModel.TraceDateTo != null)
                {
                    hql += " and  CreateDate <= ?";
                    parameters.Add(searchModel.TraceDateTo.Value);
                }
                var returnList = this.genericMgr.FindAll<OrderItemTraceResult>(hql, parameters.ToArray());

                if (returnList != null && returnList.Count > 0)
                {
                    foreach (var result in returnList)
                    {
                        if (!string.IsNullOrWhiteSpace(result.Item))
                        {
                            Item item = this.genericMgr.FindById<Item>(result.Item);
                            result.ItemShortCode = item.ShortCode;
                        }
                    }
                }
                return View(returnList.OrderBy(r => r.BarCode).ToList());
            }
            catch (BusinessException ex)
            {
                SaveErrorMessage(ex.GetMessages()[0].GetMessageString());
                return Json(null);

            }
            catch (System.Exception)
            {
                SaveErrorMessage("车身条码找不到对应的一车一单号,请确认。");
                return Json(null);
            }
        }