public decimal GetCurrentInv(string location, string item) { DetachedCriteria criteria = DetachedCriteria.For(typeof(LocationDetail)); if (location != null && location.Trim() != string.Empty) { criteria.Add(Expression.Eq("Location.Code", location)); } if (item != null && item.Trim() != string.Empty) { criteria.Add(Expression.Eq("Item.Code", item)); } criteria.SetProjection(Projections.Sum("Qty")); IList result = CriteriaMgr.FindAll(criteria); if (result[0] != null) { return((decimal)result[0]); } else { return(0); } }
private IList <LocationTransaction> GetLocationTransaction(int mark) { DetachedCriteria criteria = DetachedCriteria.For(typeof(LocationTransaction)); criteria.Add(Expression.Eq("IsSubcontract", false)); criteria.Add(Expression.In("TransactionType", new string[] { BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_WO, BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_WO, BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_WO_BF })); criteria.Add(Expression.Gt("Id", mark)); criteria.SetProjection(Projections.ProjectionList() .Add(Projections.Max("Id").As("Id")) .Add(Projections.GroupProperty("OrderNo").As("OrderNo")) .Add(Projections.GroupProperty("OrderDetailId").As("OrderDetailId")) .Add(Projections.GroupProperty("OrderLocationTransactionId").As("OrderLocationTransactionId")) .Add(Projections.GroupProperty("TransactionType").As("TransactionType")) .Add(Projections.GroupProperty("Item").As("Item")) .Add(Projections.GroupProperty("Location").As("Location")) .Add(Projections.Sum("Qty").As("Qty")) .Add(Projections.GroupProperty("EffectiveDate").As("EffectiveDate")) .Add(Projections.GroupProperty("PartyFrom").As("PartyFrom")) .Add(Projections.GroupProperty("PartyTo").As("PartyTo")) .Add(Projections.GroupProperty("RefLocation").As("RefLocation"))); criteria.SetResultTransformer(Transformers.AliasToBean(typeof(LocationTransaction))); return(criteriaMgr.FindAll <LocationTransaction>(criteria)); }
public IList <TransportPriceListDetail> GetAllTransportPriceListDetail(string transportPriceListCode) { DetachedCriteria criteria = DetachedCriteria.For <TransportPriceListDetail>(); criteria.Add(Expression.Eq("TransportPriceList.Code", transportPriceListCode)); return(criteriaMgr.FindAll <TransportPriceListDetail>(criteria)); }
public IList <Favorites> GetFavorites(string userCode, string type) { DetachedCriteria criteria = DetachedCriteria.For <Favorites>(); criteria.Add(Expression.Eq("User.Code", userCode)); criteria.Add(Expression.Eq("Type", type)); criteria.AddOrder(Order.Desc("Id")); return(criteriaMgr.FindAll <Favorites>(criteria)); }
public IList GetAllBillAddress(bool includeInactive) { DetachedCriteria criteria = DetachedCriteria.For(typeof(BillAddress)); if (!includeInactive) { criteria.Add(Expression.Eq("IsActive", true)); } return(criteriaMgr.FindAll(criteria)); }
public IList <ItemFlowPlanDetail> GetActiveItemFlowPlanDetailListSort(int itemFlowPlanId) { DetachedCriteria criteria = DetachedCriteria.For(typeof(ItemFlowPlanDetail)); criteria.Add(Expression.Eq("ItemFlowPlan.Id", itemFlowPlanId)); criteria.Add(Expression.Ge("ReqDate", DateTime.Now.Date)); criteria.AddOrder(Order.Asc("ReqDate")); return(CriteriaMgr.FindAll <ItemFlowPlanDetail>(criteria)); }
//[Transaction(TransactionMode.Unspecified)] //public OrderHead LoadOrderHead(String orderNo, bool includeDetail, bool includeLocTrans) //{ // return LoadOrderHead(orderNo, true, false, true); //} public IList <OrderHead> GetOrderHead(int count, string status) { DetachedCriteria criteria = DetachedCriteria.For(typeof(OrderHead)); criteria.AddOrder(Order.Desc("CreateDate")); if (status != null && status != string.Empty) { criteria.Add(Expression.Eq("Status", status)); } return(criteriaMgr.FindAll <OrderHead>(criteria, 0, count)); }
public IList <Role> GetRolesByUserCode(string userCode) { DetachedCriteria criteria = DetachedCriteria.For(typeof(UserRole)).Add(Expression.Eq("User.Code", userCode)); List <Role> rList = new List <Role>(); IList <UserRole> urList = criteriaMgr.FindAll <UserRole>(criteria); foreach (UserRole ur in urList) { rList.Add(ur.Role); } return(rList); }
public IList <TransportationOrder> GetTransportationOrder(string status, bool isValuated) { DetachedCriteria criteria = DetachedCriteria.For(typeof(TransportationOrder)); criteria.AddOrder(Order.Desc("CreateDate")); if (status != null && status != string.Empty) { criteria.Add(Expression.Eq("Status", status)); } criteria.Add(Expression.Eq("IsValuated", isValuated)); return(criteriaMgr.FindAll <TransportationOrder>(criteria)); }
public Permission GetPermission(string code) { DetachedCriteria criteria = DetachedCriteria.For(typeof(Permission)); criteria.Add(Expression.Eq("Code", code)); IList list = criteriaMgr.FindAll(criteria); if (list != null && list.Count > 0) { return((Permission)list[0]); } return(null); }
public IList <Permission> GetPermissionsByRoleCode(string code, string categoryCode) { DetachedCriteria criteria = DetachedCriteria.For(typeof(RolePermission)).Add(Expression.Eq("Role.Code", code)); criteria.SetProjection(Projections.Property("Permission")); if (categoryCode != null) { criteria.CreateAlias("Permission", "p").CreateAlias("p.Category", "c").Add(Expression.Eq("c.Code", categoryCode)); } IList <Permission> permissions = criteriaMgr.FindAll <Permission>(criteria); permissions = permissions.OrderBy(p => p.Description).ToList(); return(permissions); }
public IList<SubjectList> GetSubjectList(string subjectCode) { DetachedCriteria criteria = DetachedCriteria.For<SubjectList>(); if (subjectCode != string.Empty && subjectCode != null) { criteria.Add(Expression.Eq("SubjectCode", subjectCode)); } else { return null; } return criteriaMgr.FindAll<SubjectList>(criteria); }
public IList <Item> GetItem(DateTime lastModifyDate, int firstRow, int maxRows) { DetachedCriteria criteria = DetachedCriteria.For(typeof(Item)); criteria.Add(Expression.Gt("LastModifyDate", lastModifyDate)); criteria.AddOrder(Order.Asc("LastModifyDate")); IList <Item> itemList = criteriaMgr.FindAll <Item>(criteria, firstRow, maxRows); if (itemList.Count > 0) { return(itemList); } return(null); }
public IList <CustomerScheduleDetail> GetCustomerScheduleDetails(string flowCode, DateTime currentDate) { DetachedCriteria criteria = DetachedCriteria.For(typeof(CustomerScheduleDetail)); criteria.CreateAlias("CustomerSchedule", "cs"); criteria.Add(Expression.Eq("cs.Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT)); if (flowCode != null && flowCode.Trim() != string.Empty) { criteria.Add(Expression.Eq("cs.Flow", flowCode)); } criteria.Add(Expression.Le("cs.ReleaseDate", currentDate.Date.AddDays(1))); criteria.Add(Expression.Ge("DateFrom", currentDate)); criteria.AddOrder(Order.Asc("StartTime")); return(criteriaMgr.FindAll <CustomerScheduleDetail>(criteria, 0, 15000)); }
public IList <Shift> GetShiftsByWorkdayId(int Id) { List <Shift> sList = new List <Shift>(); DetachedCriteria criteria = DetachedCriteria.For(typeof(WorkdayShift)); criteria.Add(Expression.Eq("Workday.Id", Id)); IList <WorkdayShift> wsList = criteriaMgr.FindAll <WorkdayShift>(criteria); foreach (WorkdayShift ws in wsList) { sList.Add(ws.Shift); } return(sList); }
public ShiftPlanSchedule GetShiftPlanScheduleByItemFlowPlanDetId(int ItemFlowPlanDetId) { DetachedCriteria criteria = DetachedCriteria.For(typeof(ShiftPlanSchedule)); criteria.Add(Expression.Eq("ItemFlowPlanDetail.Id", ItemFlowPlanDetId)); IList <ShiftPlanSchedule> spsList = criteriaMgr.FindAll <ShiftPlanSchedule>(criteria); if (spsList != null && spsList.Count > 0) { return(spsList[0]); } else { return(null); } }
public void Execute(JobRunContext context) { DetachedCriteria criteria = DetachedCriteria.For(typeof(CycleCount)); criteria.Add(Expression.Eq("Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT)); criteria.Add(Expression.Not(Expression.Eq("CreateUser", "su"))); IList <CycleCount> cycleCountList = criteriaMgr.FindAll <CycleCount>(criteria); if (cycleCountList.Count > 0) { int count = 0; foreach (CycleCount cycleCount in cycleCountList) { if (count < 10) { cycleCountMgr.ProcessCycleCountResult(cycleCount.Code, userMgr.GetMonitorUser()); count++; } else { break; } } } }
public IList <PermissionCategory> GetCategoryByType(string type) { DetachedCriteria criteria = DetachedCriteria.For(typeof(PermissionCategory)); criteria.Add(Expression.Eq("Type", type)); return(criteriaMgr.FindAll <PermissionCategory>(criteria)); }
public IList <LocationTransaction> GetLocationTransactionAfterEffDate(string itemCode, string loc, DateTime effDate) { DetachedCriteria criteria = DetachedCriteria.For(typeof(LocationTransaction)); if (itemCode != null && itemCode.Trim() != string.Empty) { criteria.Add(Expression.Eq("Item", itemCode)); } if (loc != null && loc.Trim() != string.Empty) { criteria.Add(Expression.Eq("Location", loc)); } criteria.Add(Expression.Gt("EffectiveDate", effDate)); return(criteriaMgr.FindAll <LocationTransaction>(criteria)); }
protected override void GetReceiptNotes(Resolver resolver) { DetachedCriteria criteria = DetachedCriteria.For(typeof(PickList)); criteria.Add(Expression.Eq("IsPrinted", false)); OrderHelper.SetOpenOrderStatusCriteria(criteria, "Status"); //订单状态 SecurityHelper.SetRegionSearchCriteria(criteria, "PartyFrom.Code", resolver.UserCode); //区域权限 IList <PickList> pickList = criteriaMgr.FindAll <PickList>(criteria, 0, 5); List <ReceiptNote> receiptNotes = new List <ReceiptNote>(); if (pickList != null && pickList.Count > 0) { foreach (PickList pl in pickList) { string newUrl = reportMgr.WriteToFile("PickList.xls", pl.PickListNo); pl.IsPrinted = true;//to be refactored pickListMgr.UpdatePickList(pl); ReceiptNote receiptNote = PickList2ReceiptNote(pl); receiptNote.PrintUrl = newUrl; receiptNotes.Add(receiptNote); } } resolver.ReceiptNotes = receiptNotes; }
public IList <CustomerSchedule> GetCustomerSchedules(string flowCode, string referenceScheduleNo, List <string> statusList, DateTime?startDate, DateTime?endDate) { DetachedCriteria criteria = DetachedCriteria.For(typeof(CustomerSchedule)); if (referenceScheduleNo != null && referenceScheduleNo.Trim() != string.Empty) { criteria.Add(Expression.Eq("ReferenceScheduleNo", referenceScheduleNo)); } if (flowCode != null && flowCode.Trim() != string.Empty) { criteria.Add(Expression.Eq("Flow", flowCode)); } if (statusList != null && statusList.Count > 0) { criteria.Add(Expression.In("Status", statusList)); } if (startDate != null) { criteria.Add(Expression.Ge("CreateDate", startDate)); } if (endDate != null) { criteria.Add(Expression.Le("CreateDate", endDate.Value.AddDays(1))); } criteria.AddOrder(Order.Desc("Id")); return(criteriaMgr.FindAll <CustomerSchedule>(criteria)); }
public IList GetSpecialTime(DateTime starttime, DateTime endtime, string region, string workcenter) { DetachedCriteria criteria = DetachedCriteria.For(typeof(SpecialTime)); criteria.Add(Expression.Or( Expression.And(Expression.Le("StartTime", starttime), Expression.Gt("EndTime", starttime)), Expression.And(Expression.Lt("StartTime", endtime), Expression.Ge("EndTime", endtime)))); if (workcenter == null || workcenter.Trim() == "") { criteria.Add(Expression.IsNull("WorkCenter.Code")); } else { criteria.Add(Expression.Eq("WorkCenter.Code", workcenter)); } if (region == null || region.Trim() == "") { criteria.Add(Expression.IsNull("Region.Code")); } else { criteria.Add(Expression.Eq("Region.Code", region)); } criteria.AddOrder(Order.Asc("StartTime")); criteria.AddOrder(Order.Asc("EndTime")); return(criteriaMgr.FindAll(criteria)); }
public override void CreateByMaterial(ByMaterial byMaterial) { #region ¼ì²éOrderºÍItem DetachedCriteria criteria = DetachedCriteria.For(typeof(OrderLocationTransaction)); criteria.CreateAlias("OrderDetail", "od"); criteria.CreateAlias("od.OrderHead", "oh"); criteria.Add(Expression.Eq("Item.Code", byMaterial.Item.Code)); criteria.Add(Expression.Eq("oh.OrderNo", byMaterial.OrderNo)); criteria.Add(Expression.Eq("oh.Type", BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION)); criteria.Add(Expression.Eq("oh.Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS)); criteria.Add(Expression.Eq("TransactionType", BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_WO)); criteria.Add(Expression.Eq("TagNo", byMaterial.TagNo)); IList <OrderLocationTransaction> orderLocTransList = criteriaMgr.FindAll <OrderLocationTransaction>(criteria); if (orderLocTransList.Count == 0) { throw new BusinessErrorException("Mes.ByMaterial.OrderItem.NotExist"); } #endregion else { OrderLocationTransaction ol = orderLocTransList[0]; ol.Cartons = ol.Cartons + 1; base.CreateByMaterial(byMaterial); } }
public IList <Workday> GetWorkdayByDayofweek(string dayofweek, string region, string workcenter) { IList <Workday> workdays = new List <Workday>(); DetachedCriteria criteria = DetachedCriteria.For(typeof(Workday)); criteria.Add(Expression.Eq("DayOfWeek", dayofweek)); if (workcenter == null || workcenter.Trim() == "") { criteria.Add(Expression.IsNull("WorkCenter.Code")); } else { criteria.Add(Expression.Eq("WorkCenter.Code", workcenter)); } if (region == null || region.Trim() == "") { criteria.Add(Expression.IsNull("Region.Code")); } else { criteria.Add(Expression.Eq("Region.Code", region)); } return(criteriaMgr.FindAll <Workday>(criteria)); }
public IList <Receipt> GetReceipts(string userCode, int firstRow, int maxRows, params string[] orderTypes) { DetachedCriteria criteria = DetachedCriteria.For(typeof(Receipt)); //todo 权限校验 //SecurityHelper.SetPartySearchCriteria(criteria, "PartyFrom.Code", userCode); //SecurityHelper.SetPartySearchCriteria(criteria, "PartyTo.Code", userCode); criteria.Add(Expression.Eq("CreateUser.Code", userCode)); if (orderTypes.Length == 1) { criteria.Add(Expression.Eq("OrderType", orderTypes[0])); } else { criteria.Add(Expression.In("OrderType", orderTypes)); } criteria.Add(Expression.Ge("CreateDate", DateTime.Today)); criteria.AddOrder(Order.Desc("ReceiptNo")); IList <Receipt> receiptList = criteriaMgr.FindAll <Receipt>(criteria, firstRow, maxRows); if (receiptList.Count > 0) { return(receiptList); } return(null); }
public FlowBinding LoadFlowBinding(string flowCode, string slaveFlowCode) { DetachedCriteria criteria = DetachedCriteria.For(typeof(FlowBinding)); criteria.Add(Expression.Eq("MasterFlow.Code", flowCode)).Add(Expression.Eq("SlaveFlow.Code", slaveFlowCode)); IList <FlowBinding> fbList = criteriaMgr.FindAll <FlowBinding>(criteria); if (fbList.Count > 0) { return(fbList[0]); } else { return(null); } }
public bool CheckPartyPermission(string userCode, string partyCode) { bool hasPermission = false; DetachedCriteria upSubCriteria = DetachedCriteria.For <UserPermission>(); upSubCriteria.CreateAlias("User", "u"); upSubCriteria.CreateAlias("Permission", "pm"); upSubCriteria.CreateAlias("pm.Category", "pmc"); upSubCriteria.Add(Expression.Eq("pmc.Type", BusinessConstants.CODE_MASTER_PERMISSION_CATEGORY_TYPE_VALUE_ORGANIZATION)); upSubCriteria.Add(Expression.Eq("u.Code", userCode)); upSubCriteria.Add(Expression.Eq("pm.Code", partyCode)); IList <UserPermission> userPermissionList = criteriaMgr.FindAll <UserPermission>(upSubCriteria); if (userPermissionList != null && userPermissionList.Count > 0) { hasPermission = true; } if (!hasPermission) { DetachedCriteria rpSubCriteria = DetachedCriteria.For <RolePermission>(); rpSubCriteria.CreateAlias("Role", "r"); rpSubCriteria.CreateAlias("Permission", "pm"); rpSubCriteria.CreateAlias("pm.Category", "pmc"); rpSubCriteria.Add(Expression.Eq("pm.Code", partyCode)); rpSubCriteria.Add(Expression.Eq("pmc.Type", BusinessConstants.CODE_MASTER_PERMISSION_CATEGORY_TYPE_VALUE_ORGANIZATION)); // rpSubCriteria.SetProjection(Projections.ProjectionList().Add(Projections.GroupProperty("pm.Code"))); DetachedCriteria urSubCriteria = DetachedCriteria.For <UserRole>(); urSubCriteria.CreateAlias("User", "u"); urSubCriteria.CreateAlias("Role", "r"); urSubCriteria.Add(Expression.Eq("u.Code", userCode)); urSubCriteria.SetProjection(Projections.ProjectionList().Add(Projections.GroupProperty("r.Code"))); rpSubCriteria.Add(Subqueries.PropertyIn("r.Code", urSubCriteria)); IList <RolePermission> rolePermissionList = criteriaMgr.FindAll <RolePermission>(rpSubCriteria); if (rolePermissionList != null && rolePermissionList.Count > 0) { hasPermission = true; } } return(hasPermission); }
public IList <CycleCountDetail> GetCycleCountDetail(string orderNo) { DetachedCriteria criteria = DetachedCriteria.For(typeof(CycleCountDetail)); criteria.Add(Expression.Eq("CycleCount.Code", orderNo)); return(criteriaMgr.FindAll <CycleCountDetail>(criteria)); }
public IList <InProcessLocationTrack> GetInProcessLocationTrack(string ipNo, int op) { DetachedCriteria criteria = DetachedCriteria.For <InProcessLocationTrack>(); criteria.Add(Expression.Eq("IpProcessLocation.IpNo", ipNo)); criteria.Add(Expression.Ge("Operation", op)); return(criteriaMgr.FindAll <InProcessLocationTrack>(criteria)); }
public IList <TransportPriceList> GetTransportPriceList(string partyCode) { DetachedCriteria criteria = DetachedCriteria.For(typeof(TransportPriceList)); criteria.Add(Expression.Eq("Party.Code", partyCode)); criteria.Add(Expression.Eq("IsActive", true)); return(criteriaMgr.FindAll <TransportPriceList>(criteria)); }