protected void Error(LocationEntity entity, string message, params object[] args) { throw new LensCompilerException( string.Format(message, args), entity ); }
public string GetNearestPlace(string longitude, string latitude, string quantity) { // Parameters Parsing LocationEntity location = new LocationEntity(); decimal longitudeBuffer; decimal latitudeBuffer; if (decimal.TryParse(longitude, out longitudeBuffer) && decimal.TryParse(latitude, out latitudeBuffer)) { location.Longitude = longitudeBuffer; location.Latitude = latitudeBuffer; } int quantityBuffer; if (!int.TryParse(quantity, out quantityBuffer)) { quantityBuffer = 10; } // Call to the Database return JsonConvert.SerializeObject(this._manager.GetNearestPlaces(location, quantityBuffer)); }
public int SaveItem(LocationEntity item) { return(db.SaveItem <LocationEntity>(item)); }
/// <summary> /// 添加或编辑货位 /// </summary> /// <param name="entity"></param> /// <param name="operatorFlag">添加或编辑</param> /// <returns>1:成功;-2:已被删除;-1:编号已存在;-3:货位使用中,不允许修改</returns> public int Save(LocationEntity entity, bool isNew) { IMapper map = DatabaseInstance.Instance(); int ret = -2; if (isNew) { //检查编号是否已经存在 if (IsLocationCodeExists(entity)) { return(-1); } ret = map.Execute("insert into WM_LOCATION(LC_CODE, LC_NAME, ZN_CODE, PASSAGE_CODE, " + "FLOOR_CODE, SHELF_CODE, CELL_CODE, SORT_ORDER, WH_CODE, IS_ACTIVE, " + "LOWER_SIZE, UPPER_SIZE, UG_CODE, UM_CODE) " + "values(@COD, @NAM, @ZONE_CODE, @PASSAGE_CODE, @FLOOR_CODE, @SHELF_CODE, " + "@CELL_CODE, @SORT_ORDER, @WH_CODE, @IS_ACTIVE, @LOWER_SIZE, @UPPER_SIZE, @UG_CODE, @UM_CODE)", new { COD = entity.LocationCode, NAM = entity.LocationName, ZONE_CODE = entity.ZoneCode, PASSAGE_CODE = entity.PassageCode, FLOOR_CODE = entity.FloorCode, SHELF_CODE = entity.ShelfCode, CELL_CODE = entity.CellCode, SORT_ORDER = entity.SortOrder, WH_CODE = entity.WarehouseCode, IS_ACTIVE = entity.IsActive, LOWER_SIZE = entity.LowerSize, UPPER_SIZE = entity.UpperSize, UG_CODE = entity.GrpCode, UM_CODE = entity.UnitCode }); } else { //bool isUsing = new StockDal().IsLocationUsing(entity.LocationCode); //if (isUsing) return -3; //更新 ret = map.Execute("update WM_LOCATION set LC_NAME = @NAM, ZN_CODE = @ZONE_CODE, PASSAGE_CODE = @PASSAGE_CODE, " + "FLOOR_CODE = @FLOOR_CODE, SHELF_CODE = @SHELF_CODE, CELL_CODE = @CELL_CODE, SORT_ORDER = @SORT_ORDER, IS_ACTIVE = @IS_ACTIVE, " + "LOWER_SIZE = @LOWER_SIZE, UPPER_SIZE = @UPPER_SIZE, UG_CODE = @UG_CODE, UM_CODE = @UM_CODE where LC_CODE = @COD", new { NAM = entity.LocationName, ZONE_CODE = entity.ZoneCode, PASSAGE_CODE = entity.PassageCode, FLOOR_CODE = entity.FloorCode, SHELF_CODE = entity.ShelfCode, CELL_CODE = entity.CellCode, SORT_ORDER = entity.SortOrder, IS_ACTIVE = entity.IsActive, LOWER_SIZE = entity.LowerSize, UPPER_SIZE = entity.UpperSize, UM_CODE = entity.UnitCode, UG_CODE = entity.GrpCode, COD = entity.LocationCode }); } return(ret); }
private IQueryable <UserEntity> GetListModel(int?locationId, int?organizationId) { LinqMetaData m = new LinqMetaData(); var user = Membership.GetUser().GetUserEntity(); if (!organizationId.HasValue) { if (RoleUtils.IsUserServiceAdmin()) { if (!locationId.HasValue) { // Service admin gets all users. return(m.User); } // Location specified, so just users assigned to that location. return(m.User .Where( x => x.UserAssignedLocations.Any( y => y.LocationId == locationId.Value))); } // Other users assume their organization ID. organizationId = user.OrganizationId; } // View needs this for building URLs. ViewData.Add("organizationId", organizationId.Value); var organization = new OrganizationEntity(organizationId.Value); if (organization.IsNew) { throw new HttpException(404, SharedRes.Error.NotFound_Organization); } ViewData.Add("organization", organization); if (!locationId.HasValue) { if (RoleUtils.IsUserServiceAdmin() || RoleUtils.IsUserOrgAdmin()) { // All users for the specified organization. return(new LinqMetaData().User.Where(u => u.OrganizationId == organizationId.Value)); } // Other users only see unrestricted users at their assigned locations. // TODO: Decide if we even want to allow this. var query = from ual1 in m.UserAssignedLocation join ual2 in m.UserAssignedLocation on ual1.LocationId equals ual2.LocationId join usr in m.User on ual2.UserId equals usr.UserId where ual1.UserId == user.UserId && !usr.UserAccountRestrictions.Any() select usr; return(query); } var location = new LocationEntity(locationId.Value); if (location.IsNew || location.OrganizationId != organizationId.Value) { throw new HttpException(404, SharedRes.Error.NotFound_Location); } ViewData.Add("location", location); // View needs this for building URLs. ViewData.Add("locationId", locationId.Value); var users = m.User .Where( x => x.UserAssignedLocations.Any( y => y.LocationId == locationId.Value)); // Service admin can see all users for any organization. if (RoleUtils.IsUserServiceAdmin()) { return(users); } // Other users must be from the organization. if (organizationId.Value != user.OrganizationId) { throw new HttpException(401, SharedRes.Error.Unauthorized_User); } // Organization admin can see all the users of the organization. if (RoleUtils.IsUserOrgAdmin()) { return(users); } // Other users can only see unrestricted users in their location. if (user.UserAssignedLocations.Count(l => l.LocationId == locationId.Value) > 0) { return(users.Where(u => !u.UserAccountRestrictions.Any())); } throw new HttpException(401, SharedRes.Error.Unauthorized_User); }
/// <summary> /// 查询单据详细数据分页 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public override List <MoveOrderDetailEntity> GetDetailList(MoveOrderDetailEntity entity, ref Framework.DataTypes.PageInfo pageInfo) { MoveOrderDetailEntity detail = new MoveOrderDetailEntity(); detail .And(a => a.CompanyID == this.CompanyID); if (entity.OrderSnNum.IsNotEmpty()) { detail.And(item => item.OrderSnNum == entity.OrderSnNum); } if (entity.ProductName.IsNotEmpty()) { detail.And("ProductName", ECondition.Like, "%" + entity.ProductName + "%"); } if (entity.BarCode.IsNotEmpty()) { detail.And("BarCode", ECondition.Like, "%" + entity.BarCode + "%"); } detail.IncludeAll(); detail.OrderBy(a => a.ID, EOrderBy.DESC); MoveOrderEntity moveOrder = new MoveOrderEntity(); moveOrder.Include(item => new { Status = item.Status, MoveType = item.MoveType, AuditeTime = item.AuditeTime }); detail.Left <MoveOrderEntity>(moveOrder, new Params <string, string>() { Item1 = "OrderSnNum", Item2 = "SnNum" }); moveOrder.And(item => item.IsDelete == (int)EIsDelete.NotDelete); if (entity.OrderNum.IsNotEmpty()) { moveOrder.And("OrderNum", ECondition.Like, "%" + entity.OrderNum + "%"); } if (entity.Status > 0) { moveOrder.And(item => item.Status == entity.Status); } if (entity.BeginTime.IsNotEmpty()) { DateTime begin = ConvertHelper.ToType <DateTime>(entity.BeginTime, DateTime.Now.AddDays(-10)).Date; moveOrder.And(item => item.CreateTime >= begin); } if (entity.EndTime.IsNotEmpty()) { DateTime end = ConvertHelper.ToType <DateTime>(entity.EndTime, DateTime.Now).AddDays(1).Date; moveOrder.And(item => item.CreateTime < end); } if (entity.MoveType > 0) { moveOrder.And(item => item.MoveType == entity.MoveType); } if (entity.StorageNum.IsNotEmpty()) { moveOrder.And(item => item.StorageNum == entity.StorageNum); } AdminEntity admin = new AdminEntity(); admin.Include(a => new { CreateUserName = a.UserName }); moveOrder.Left <AdminEntity>(admin, new Params <string, string>() { Item1 = "CreateUser", Item2 = "UserNum" }); AdminEntity auditeAdmin = new AdminEntity(); auditeAdmin.Include(a => new { AuditUserName = a.UserName }); moveOrder.Left <AdminEntity>(auditeAdmin, new Params <string, string>() { Item1 = "AuditUser", Item2 = "UserNum" }); int rowCount = 0; List <MoveOrderDetailEntity> listResult = this.MoveOrderDetail.GetList(detail, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); pageInfo.RowCount = rowCount; if (!listResult.IsNullOrEmpty()) { List <LocationEntity> listLocation = new LocationProvider(this.CompanyID).GetList(); listLocation = listLocation == null ? new List <LocationEntity>() : listLocation; ProductProvider productProvider = new ProductProvider(this.CompanyID); foreach (MoveOrderDetailEntity item in listResult) { LocationEntity location = listLocation.FirstOrDefault(a => a.LocalNum == item.FromLocalNum); item.FromLocalName = location == null ? "" : location.LocalName; location = listLocation.FirstOrDefault(a => a.LocalNum == item.ToLocalNum); item.ToLocalName = location == null ? "" : location.LocalName; item.StorageName = location == null ? "" : location.StorageName; ProductEntity productEntity = productProvider.GetProduct(item.ProductNum); item.UnitName = productEntity != null ? productEntity.ProductName : string.Empty; item.Size = productEntity != null ? productEntity.Size : string.Empty; } } return(listResult); }
private Tuple <bool, string> IsLocationWithInRange(int rangeInMiles, LocationEntity source, LocationEntity target) { if (source == null || target == null) { return(null); } var sourceCoordinates = new GeoCoordinate(source.Latitude, source.Longitude); var targetCoordinates = new GeoCoordinate(target.Latitude, target.Longitude); var distance = (GeoCoordinateTool.Distance(sourceCoordinates, targetCoordinates, 1)); //1 - For MILES, 2 - For KM string distanceInSubstring = distance.ToString().Substring(0, 4); return(Tuple.Create(distance <= (rangeInMiles) ? true : false, distanceInSubstring)); }
public LensCompilerException(string msg, LocationEntity entity) : base(msg) { BindToLocation(entity); }
public FrmLocationEdit(LocationEntity locationEntity) : this() { this.locationEntity = locationEntity; }
public LocationEntity PrepareSave() { LocationEntity editEntity = locationEntity; if (editEntity == null) { editEntity = new LocationEntity(); editEntity.WarehouseCode = GlobeSettings.LoginedUser.WarehouseCode; editEntity.WarehouseName = GlobeSettings.LoginedUser.WarehouseName; } editEntity.LocationCode = txtCode.Text.Trim(); editEntity.LocationName = txtName.Text.Trim(); ZoneEntity zone = listZones.Properties.GetDataSourceRowByKeyValue(listZones.EditValue) as ZoneEntity; editEntity.ZoneCode = zone.ZoneCode; editEntity.PassageCode = txtPassage.Text.Trim(); editEntity.ShelfCode = txtShelf.Text.Trim(); editEntity.FloorCode = txtFloor.Text.Trim(); editEntity.CellCode = txtCellCode.Text.Trim(); editEntity.SortOrder = (int)spinSortOrder.Value; editEntity.ZoneName = zone.ZoneName; if (listUnitGroup.EditValue != null) { editEntity.GrpCode = ConvertUtil.ToString(listUnitGroup.EditValue); editEntity.GrpName = listUnitGroup.Text; } else { editEntity.GrpCode = null; editEntity.GrpName = null; } if (listUnits.EditValue != null) { editEntity.UnitCode = ConvertUtil.ToString(listUnits.EditValue); editEntity.UnitName = listUnits.Text; } else { editEntity.UnitCode = editEntity.UnitName = null; } editEntity.LowerSize = (int)spinLowerSize.Value; editEntity.UpperSize = (int)spinUpperSize.Value; editEntity.IsActive = comboIsActive.Text; if (lookUpChannel.EditValue != null) { editEntity.Ch_Code = ConvertUtil.ToInt(lookUpChannel.EditValue); foreach (DataRow row in dtChannel.Rows) { if (row["CH_CODE"].ToString() == editEntity.Ch_Code.ToString()) { if (row["IS_ACTIVE"].ToString() == "Y") { editEntity.Ch_Name = row["CH_NAME"].ToString(); } else { editEntity.Ch_Name = row["BAK_CH_NAME"].ToString(); } } } } else { editEntity.Ch_Name = ""; } return(editEntity); }
public static void Seed(ImmunizationDbContext context) { LocationEntity loc1 = new LocationEntity { Name = "VCHA", City = "Vancouver", Country = "CA", PostalCode = "V8A 0K0" }; context.Locations.Add(loc1); LocationEntity loc2 = new LocationEntity { Name = "VCHA", City = "Vancouver", Country = "CA", PostalCode = "V8A 0K0" }; context.Locations.Add(loc2); LocationEntity loc3 = new LocationEntity { Name = "Rexall", StreetLine1 = "6580 Fraser St.", City = "Vancouver", Country = "CA", PostalCode = "V5X 3T4" }; context.Locations.Add(loc3); LocationEntity loc4 = new LocationEntity { Name = "VCHA - Simon Fraser Elementary School", StreetLine1 = "100 W 15th Ave", City = "Vancouver", Country = "CA", PostalCode = "V5Y 3B7" }; context.Locations.Add(loc4); context.SaveChanges(); PatientEntity patient1 = new PatientEntity { BirthDate = new System.DateTime(1957, 6, 22), GivenNames = "Johnny Michael", LastName = "Rose", Id = "9039555099" }; context.Patients.Add(patient1); PatientEntity patient2 = new PatientEntity { BirthDate = new System.DateTime(1961, 3, 17), GivenNames = "Moira Maria", LastName = "Rose", Id = "9034545122" }; context.Patients.Add(patient2); PatientEntity patient3 = new PatientEntity { BirthDate = new System.DateTime(1952, 1, 14), GivenNames = "Roland Ethan", LastName = "Schitt", Id = "900489178" }; context.Patients.Add(patient3); PatientEntity patient4 = new PatientEntity { BirthDate = new System.DateTime(1991, 9, 22), GivenNames = "Veronica", LastName = "Lee", Id = "9902489314" }; context.Patients.Add(patient4); context.SaveChanges(); VaccineEntity vaccine1 = new VaccineEntity { Id = "02510014", // DIN Name = "MODERNA COVID-19 mRNA-1273", Manufacturer = "Moderna Therapeutics Inc.", Disease = "COVID-19" }; context.Vaccines.Add(vaccine1); VaccineEntity vaccine2 = new VaccineEntity { Id = "02510847", // DIN Name = "ASTRAZENECA COVID-19 VACCINE (COVID-19)", Manufacturer = "AstraZeneca Canada Inc.", Disease = "COVID-19" }; context.Vaccines.Add(vaccine2); VaccineEntity vaccine3 = new VaccineEntity { Id = "02509210", // DIN Name = "PFIZER-BIONTECH COVID-19 VACCINE mRNA (COVID-19)", Manufacturer = "BioNTech Manufacturing GmbH", Disease = "COVID-19" }; context.Vaccines.Add(vaccine3); VaccineEntity vaccine4 = new VaccineEntity { Id = "02512947", // DIN Name = "COVISHIELD (COVID-19)", Manufacturer = "Verity Pharmaceuticals Inc.", Disease = "COVID-19" }; context.Vaccines.Add(vaccine4); VaccineEntity vaccine5 = new VaccineEntity { Id = "02513153", // DIN Name = "JANSSEN COVID-19 VACCINE (COVID-19)", Manufacturer = "Janssen Inc.", Disease = "COVID-19" }; context.Vaccines.Add(vaccine5); VaccineEntity vaccine6 = new VaccineEntity { Id = "02445646", // DIN Name = "Fluzone High-Dose", Manufacturer = "SANOFI PASTEUR LIMITED", Disease = "Influenza" }; context.Vaccines.Add(vaccine6); VaccineEntity vaccine7 = new VaccineEntity { Id = "02240255", // DIN Name = "ADACEL", Manufacturer = "SANOFI PASTEUR LIMITED", Disease = "Diphtheria, Tetanus and Pertussis" }; context.Vaccines.Add(vaccine7); VaccineEntity vaccine8 = new VaccineEntity { Id = "02246081", // DIN Name = "VARIVAX III SINGLE-DOSE VIAL 0.5 ML", Manufacturer = "Merck Canada Inc", Disease = "Varicella (Chickenpox)" }; context.Vaccines.Add(vaccine8); VaccineEntity vaccine9 = new VaccineEntity { Id = "02243167", // DIN Name = "Pediacel 0.5 mL", Manufacturer = "Sanofi Pasteur Limited", AtcCode = "J07CA06", Disease = "DIPH,PERT(A),TET,POLIO,HIB/PF 15-20-5-10 HV" }; context.Vaccines.Add(vaccine9); VaccineEntity vaccine10 = new VaccineEntity { Id = "02437058", // DIN Name = "Gardasil 9", Manufacturer = "MERCK CANADA INC", AtcCode = "", Disease = "HPV VACCINE 9-VALENT/PF 0.5 ML HV" }; context.Vaccines.Add(vaccine10); VaccineEntity vaccine11 = new VaccineEntity { Id = "00466085", // DIN Name = "M-M-R II", Manufacturer = "MERCK CANADA INC", AtcCode = "", Disease = "MEASLES,MUMPS,RUBELLA VACC/PF 1K-5K/0.5 HS" }; context.Vaccines.Add(vaccine11); context.SaveChanges(); ImmunizationEntity imm1 = new ImmunizationEntity { AdministeredOnDate = new DateTime(2021, 1, 31), AdministeredAt = loc1, DoseNumber = 1, LotNumber = "123456A", NextDueDate = new DateTime(2021, 4, 30), PatientId = patient1.Id, VaccineId = vaccine1.Id }; context.Immunizations.Add(imm1); ImmunizationEntity imm2 = new ImmunizationEntity { AdministeredOnDate = new DateTime(2021, 4, 08), DoseNumber = 2, LotNumber = "123456A", AdministeredAt = loc2, PatientId = patient1.Id, VaccineId = vaccine1.Id }; context.Immunizations.Add(imm2); ImmunizationEntity imm3 = new ImmunizationEntity { AdministeredOnDate = new DateTime(2021, 1, 22), DoseNumber = 1, LotNumber = "MT0055", AdministeredAt = loc1, PatientId = patient2.Id, VaccineId = vaccine2.Id }; context.Immunizations.Add(imm3); ImmunizationEntity imm4 = new ImmunizationEntity { AdministeredOnDate = new DateTime(2021, 2, 27), DoseNumber = 1, LotNumber = "AB1234", AdministeredAt = loc2, PatientId = patient3.Id, VaccineId = vaccine5.Id }; context.Immunizations.Add(imm4); ImmunizationEntity imm5 = new ImmunizationEntity { AdministeredOnDate = new DateTime(2021, 4, 2), DoseNumber = 1, LotNumber = "AA3303", AdministeredAt = loc1, Patient = patient4, VaccineId = vaccine4.Id }; context.Immunizations.Add(imm4); ImmunizationEntity imm6 = new ImmunizationEntity { AdministeredOnDate = new DateTime(2020, 9, 22), AdministeredAt = loc3, DoseNumber = 1, LotNumber = "", NextDueDate = new DateTime(2021, 10, 1), PatientId = patient3.Id, VaccineId = vaccine6.Id }; context.Immunizations.Add(imm6); ImmunizationEntity imm7 = new ImmunizationEntity { AdministeredOnDate = new DateTime(2019, 7, 10), AdministeredAt = loc1, DoseNumber = 1, LotNumber = "AA10101", NextDueDate = new DateTime(2029, 7, 1), PatientId = patient4.Id, VaccineId = vaccine7.Id }; context.Immunizations.Add(imm7); ImmunizationEntity imm8 = new ImmunizationEntity { AdministeredOnDate = new DateTime(2003, 3, 19), AdministeredAt = loc3, DoseNumber = 1, LotNumber = "10344AB", PatientId = patient4.Id, VaccineId = vaccine8.Id }; context.Immunizations.Add(imm8); ImmunizationEntity imm9 = new ImmunizationEntity { AdministeredOnDate = new DateTime(1991, 11, 28), AdministeredAt = loc1, DoseNumber = 1, LotNumber = "", NextDueDate = new DateTime(1992, 1, 30), PatientId = patient4.Id, VaccineId = vaccine9.Id }; context.Immunizations.Add(imm9); ImmunizationEntity imm10 = new ImmunizationEntity { AdministeredOnDate = new DateTime(1992, 2, 2), AdministeredAt = loc1, DoseNumber = 2, LotNumber = "", NextDueDate = new DateTime(1992, 4, 2), PatientId = patient4.Id, VaccineId = vaccine9.Id }; context.Immunizations.Add(imm10); ImmunizationEntity imm11 = new ImmunizationEntity { AdministeredOnDate = new DateTime(1992, 4, 6), AdministeredAt = loc2, DoseNumber = 3, LotNumber = "", NextDueDate = new DateTime(1993, 3, 22), PatientId = patient4.Id, VaccineId = vaccine9.Id }; context.Immunizations.Add(imm11); ImmunizationEntity imm12 = new ImmunizationEntity { AdministeredOnDate = new DateTime(1993, 3, 29), AdministeredAt = loc2, DoseNumber = 4, LotNumber = "", PatientId = patient4.Id, VaccineId = vaccine9.Id }; context.Immunizations.Add(imm12); ImmunizationEntity imm13 = new ImmunizationEntity { AdministeredOnDate = new DateTime(1992, 10, 10), AdministeredAt = loc1, DoseNumber = 1, LotNumber = "", PatientId = patient4.Id, VaccineId = vaccine11.Id }; context.Immunizations.Add(imm13); ImmunizationEntity imm14 = new ImmunizationEntity { AdministeredOnDate = new DateTime(2005, 3, 10), AdministeredAt = loc4, DoseNumber = 1, LotNumber = "", PatientId = patient4.Id, VaccineId = vaccine10.Id }; context.Immunizations.Add(imm14); ImmunizationEntity imm15 = new ImmunizationEntity { AdministeredOnDate = new DateTime(2020, 11, 19), AdministeredAt = loc3, DoseNumber = 1, LotNumber = "", NextDueDate = new DateTime(2021, 10, 1), PatientId = patient3.Id, VaccineId = vaccine8.Id }; context.Immunizations.Add(imm15); context.SaveChanges(); }
///<summary> ///根据所选货区查询所有货位 ///</summary> ///<returns></returns> public List <LocationEntity> GetAllLocationByZone(string zoneCode) { List <LocationEntity> list = new List <LocationEntity>(); try { #region 请求数据 System.Text.StringBuilder loStr = new System.Text.StringBuilder(); loStr.Append("znCode=").Append(zoneCode); string jsonQuery = WebWork.SendRequest(loStr.ToString(), WebWork.URL_GetAllLocationByZone); if (string.IsNullOrEmpty(jsonQuery)) { MsgBox.Warn(WebWork.RESULT_NULL); //LogHelper.InfoLog(WebWork.RESULT_NULL); return(list); } #endregion #region 正常错误处理 JsonGetAllLocationByZone bill = JsonConvert.DeserializeObject <JsonGetAllLocationByZone>(jsonQuery); if (bill == null) { MsgBox.Warn(WebWork.JSON_DATA_NULL); return(list); } if (bill.flag != 0) { MsgBox.Warn(bill.error); return(list); } #endregion #region 赋值数据 foreach (JsonGetAllLocationByZoneResult jbr in bill.result) { LocationEntity asnEntity = new LocationEntity(); #region 0-10 asnEntity.CellCode = jbr.cellCode; asnEntity.FloorCode = jbr.floorCode; asnEntity.IsActive = jbr.isActive; asnEntity.LocationCode = jbr.lcCode; asnEntity.LocationName = jbr.lcName; asnEntity.LowerSize = Convert.ToInt32(jbr.lowerSize); asnEntity.PassageCode = jbr.passageCode; asnEntity.ShelfCode = jbr.shelfCode; asnEntity.SortOrder = Convert.ToInt32(jbr.sortOrder); asnEntity.UpperSize = Convert.ToInt32(jbr.upperSize); #endregion #region 11-14 asnEntity.WarehouseCode = jbr.whCode; asnEntity.WarehouseName = jbr.whName; asnEntity.ZoneCode = jbr.znCode; asnEntity.ZoneName = jbr.znName; #endregion list.Add(asnEntity); } return(list); #endregion } catch (Exception ex) { MsgBox.Err(ex.Message); } return(list); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='locationEntity'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task ApiLocationByIdPutAsync(this IHomeAutomationAPI operations, int id, LocationEntity locationEntity = default(LocationEntity), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.ApiLocationByIdPutWithHttpMessagesAsync(id, locationEntity, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='locationEntity'> /// </param> public static void ApiLocationByIdPut(this IHomeAutomationAPI operations, int id, LocationEntity locationEntity = default(LocationEntity)) { operations.ApiLocationByIdPutAsync(id, locationEntity).GetAwaiter().GetResult(); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='locationEntity'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <LocationEntity> ApiLocationPostAsync(this IHomeAutomationAPI operations, LocationEntity locationEntity = default(LocationEntity), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ApiLocationPostWithHttpMessagesAsync(locationEntity, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='locationEntity'> /// </param> public static LocationEntity ApiLocationPost(this IHomeAutomationAPI operations, LocationEntity locationEntity = default(LocationEntity)) { return(operations.ApiLocationPostAsync(locationEntity).GetAwaiter().GetResult()); }
/// <summary> /// 库存转移---库存转移 /// </summary> /// <returns></returns> public List <LocationEntity> GetAllLocation() { List <LocationEntity> list = new List <LocationEntity>(); try { #region 请求数据 System.Text.StringBuilder loStr = new System.Text.StringBuilder(); loStr.Append("billState=").Append(BillStateConst.ASN_STATE_CODE_COMPLETE).Append("&"); //loStr.Append("wareHouseCode=").Append(warehouseCode); string jsonQuery = WebWork.SendRequest(string.Empty, WebWork.URL_GetAllLocation); if (string.IsNullOrEmpty(jsonQuery)) { //MsgBox.Warn(WebWork.RESULT_NULL); LogHelper.InfoLog(WebWork.RESULT_NULL); return(list); } #endregion #region 正常错误处理 JsonGetAllLocation bill = JsonConvert.DeserializeObject <JsonGetAllLocation>(jsonQuery); if (bill == null) { MsgBox.Warn(WebWork.JSON_DATA_NULL); return(list); } if (bill.flag != 0) { MsgBox.Warn(bill.error); return(list); } #endregion #region 赋值数据 foreach (JsonGetAllLocationResult jbr in bill.result) { LocationEntity asnEntity = new LocationEntity(); #region 0-10 asnEntity.CellCode = jbr.cellCode; asnEntity.FloorCode = jbr.floorCode; asnEntity.LocationCode = jbr.lcCode; asnEntity.LocationName = jbr.lcName; asnEntity.LowerSize = Convert.ToInt32(jbr.lowerSize); asnEntity.IsActive = jbr.isActive; asnEntity.PassageCode = jbr.passageCode; asnEntity.ShelfCode = jbr.shelfCode; asnEntity.SortOrder = Convert.ToInt32(jbr.shortOrder); asnEntity.UpperSize = Convert.ToInt32(jbr.upperSize); #endregion asnEntity.WarehouseCode = jbr.whCode; asnEntity.WarehouseName = jbr.whName; asnEntity.ZoneCode = jbr.znCode; asnEntity.ZoneName = jbr.znName; try { //if (!string.IsNullOrEmpty(jbr.closeDate)) // asnEntity.CloseDate = Convert.ToDateTime(jbr.closeDate); //if (!string.IsNullOrEmpty(jbr.printedTime)) // asnEntity.PrintedTime = Convert.ToDateTime(jbr.printedTime); //if (!string.IsNullOrEmpty(jbr.createDate)) // asnEntity.CreateDate = Convert.ToDateTime(jbr.createDate); } catch (Exception msg) { LogHelper.errorLog("FrmVehicle+QueryNotRelatedBills", msg); } list.Add(asnEntity); } return(list); #endregion } catch (Exception ex) { MsgBox.Err(ex.Message); } return(list); }
public ImportReportModel LoadData(string file) { var configuration = _configuration.Load(); var import = _import.ImportDataRow(file); var importReport = new ImportReportModel(); foreach (var districtsGroup in import.GroupBy(x => x.District.Name)) { var firstDistrict = districtsGroup.FirstOrDefault(); if (firstDistrict == null) { continue; } var district = AddOrCreate(firstDistrict.District); foreach (var addressGroup in districtsGroup.GroupBy(x => x.Address.Name)) { var firstAddress = addressGroup.FirstOrDefault(); if (firstAddress == null) { continue; } var street = AddOrCreate(firstAddress.Address, district.Id); var accountsToUpdate = new List <AccountEntity>(); var accountsToAdd = new List <AccountEntity>(); foreach (var dataRow in addressGroup) { try { var account = _accountService.GetItem(x => x.Account == dataRow.Account.PersonalAccount && !x.IsDeleted); if (account != null) { account.IsArchive = account.IsEmpty && account.IsEmptyAgain && string.IsNullOrWhiteSpace(dataRow.Account.ServiceProviderCode); account.IsEmptyAgain = string.IsNullOrWhiteSpace(dataRow.Account.ServiceProviderCode) && account.IsEmpty; account.IsEmpty = string.IsNullOrWhiteSpace(dataRow.Account.ServiceProviderCode); account.IsNew = false; accountsToUpdate.Add(account); continue; } account = new AccountEntity { AccountCreationDate = ConvertAccrualMonth(dataRow.Account.AccrualMonth), Account = dataRow.Account.PersonalAccount, AccountType = ConvertAccountType(dataRow.Account.AccountType, configuration.MunicipalMark), IsEmpty = string.IsNullOrWhiteSpace(dataRow.Account.ServiceProviderCode), IsNew = true }; if (street.Locations == null) { street.Locations = new List <LocationEntity>(); } var location = new LocationEntity { HouseNumber = dataRow.LocationImport.HouseNumber, BuildingCorpus = dataRow.LocationImport.BuildingNumber, ApartmentNumber = dataRow.LocationImport.ApartmentNumber, StreetId = street.Id, }; street.Locations.Add(location); account.StreetId = street.Id; account.Location = location; accountsToAdd.Add(account); } catch (Exception e) { _brokenRecordsReport.WriteException(e.Message, FileType.Excel); } } if (accountsToAdd.Count != 0) { _accountService.Add(accountsToAdd); importReport.Add += accountsToAdd.Count; } else { _accountService.Update(accountsToUpdate); importReport.Updates += accountsToUpdate.Count; } } } return(importReport); }
/// <summary> /// 编辑报损单 /// </summary> /// <param name="entity"></param> /// <param name="list"></param> /// <returns></returns> public override string EditOrder(AllocateOrderEntity entity, List <AllocateDetailEntity> list) { using (TransactionScope ts = new TransactionScope()) { int line = 0; entity.Include(a => new { a.AllocateType, a.ProductType, a.StorageNum, a.ContractOrder, a.Remark, a.Num, a.Amount, a.Weight }); entity.Where(a => a.SnNum == entity.SnNum) .And(a => a.CompanyID == this.CompanyID) ; AllocateDetailEntity detail = new AllocateDetailEntity(); detail.Where(a => a.OrderSnNum == entity.SnNum) .And(a => a.CompanyID == this.CompanyID) ; this.AllocateDetail.Delete(detail); if (!list.IsNullOrEmpty()) { string StorageNum = list[0].ToStorageNum; LocationProvider locationProvider = new LocationProvider(this.CompanyID); List <LocationEntity> listLocation = locationProvider.GetList(StorageNum); if (listLocation.IsNullOrEmpty()) { return("1001"); } LocationEntity location = listLocation.FirstOrDefault(a => a.LocalType == (int)ELocalType.WaitIn); if (location.IsNull()) { return("1002"); } foreach (AllocateDetailEntity item in list) { item.OrderNum = entity.OrderNum; item.OrderSnNum = entity.SnNum; item.CompanyID = this.CompanyID; item.ToLocalNum = location.LocalNum; item.CreateTime = DateTime.Now; item.IncludeAll(); } } entity.Num = list.Sum(a => a.Num); entity.Amount = list.Sum(a => a.Amount); line = this.AllocateOrder.Update(entity); this.AllocateDetail.Add(list); ts.Complete(); return(line > 0 ? EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success) : string.Empty); } }
public int Insert(LocationEntity locationEntity) { return(locationdal.Insert(locationEntity)); }
/// <summary> /// Bind exception to a location. /// </summary> public LensCompilerException BindToLocation(LocationEntity entity) { return(BindToLocation(entity.StartLocation, entity.EndLocation)); }
public void Update(LocationEntity locationEntity) { locationdal.Update(locationEntity); }
/// <summary> /// 将调用远程对象查出的结果赋值给下拉框 /// </summary> private void BindDataToLoopUpEdit() { DataSet dsLocation = new DataSet(); LocationEntity location = new LocationEntity(); //根据区域名称和区域类型查询区域信息 location.LocalLevel = "5";//只查询车间数据 dsLocation = location.SearchLocation(); if (location.ErrorMsg != "") { //提示“获取区域出错!” MessageService.ShowError("${res:FanHai.Hemera.Addins.FMM.StoreCtrl.Msg.GetLocationError}"); } else { //若结果集中包含“FMM_LOCATION”表 if (dsLocation.Tables.Contains(FMM_LOCATION_FIELDS.DATABASE_TABLE_NAME)) { //为界面上的“区域”下拉框赋值 this.lueLocation.Properties.DataSource = dsLocation.Tables[FMM_LOCATION_FIELDS.DATABASE_TABLE_NAME]; this.lueLocation.Properties.DisplayMember = FMM_LOCATION_FIELDS.FIELD_LOCATION_NAME; this.lueLocation.Properties.ValueMember = FMM_LOCATION_FIELDS.FIELD_LOCATION_KEY; } } string[] columns = new string[] { "CODE", "NAME" }; KeyValuePair <string, string> category = new KeyValuePair <string, string>("CATEGORY_NAME", "Store_Type"); //得到线边仓类型的基础数据 DataTable dataTable = BaseData.Get(columns, category); //为界面上的“类型”下拉框赋值 this.lueType.Properties.DataSource = dataTable; this.lueType.Properties.DisplayMember = "NAME"; this.lueType.Properties.ValueMember = "CODE"; //????? this.lueStoreType.DataSource = dataTable; this.lueStoreType.DisplayMember = "NAME"; this.lueStoreType.ValueMember = "CODE"; try { IServerObjFactory factor = CallRemotingService.GetRemoteObject(); //调用远程对象的方法,得到最新版本的工序 DataSet dsReturn = factor.CreateIOperationEngine().GetMaxVerOperation(null); string msg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); if (msg == string.Empty) { if (dsReturn != null && dsReturn.Tables.Count > 0 && dsReturn.Tables.Contains(POR_ROUTE_OPERATION_VER_FIELDS.DATABASE_TABLE_NAME)) { DataTable operationTable = dsReturn.Tables[POR_ROUTE_OPERATION_VER_FIELDS.DATABASE_TABLE_NAME]; foreach (DataRow dataRow in operationTable.Rows) { //设置界面上的“工序”内容为POR_ROUTE_OPERATION_VER表的工序名称 cmbOperation.Properties.Items.Add(dataRow[POR_ROUTE_OPERATION_VER_FIELDS.FIELD_ROUTE_OPERATION_NAME].ToString()); } } } else { throw new Exception(msg); } } catch (Exception ex) { MessageService.ShowError(ex.Message); } finally { CallRemotingService.UnregisterChannel(); } }
/// <summary> /// 修改 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Update(LocationEntity entity) { using (TransactionScope ts = new TransactionScope()) { string Key = string.Format(CacheKey.JOOSHOW_LOCATION_CACHE, this.CompanyID); if (entity.IsDefault == (int)EBool.Yes) { LocationEntity location = new LocationEntity(); location.IsDefault = (int)EBool.No; location.IncludeIsDefault(true); location.Where(a => a.LocalType == entity.LocalType) .And(a => a.CompanyID == this.CompanyID) ; this.Location.Update(location); LocationEntity temp = new LocationEntity(); temp.IsDefault = (int)EBool.No; temp.IncludeIsDefault(true); temp.Where(a => a.CompanyID == this.CompanyID); this.Location.Update(temp); } //绑定仓库信息 StorageProvider storageProvider = new StorageProvider(this.CompanyID); List <StorageEntity> listStorage = storageProvider.GetList(); listStorage = listStorage.IsNull() ? new List <StorageEntity>() : listStorage; if (entity.StorageNum.IsEmpty()) { StorageEntity storage = listStorage.FirstOrDefault(a => a.IsDefault == (int)EBool.Yes); if (storage != null) { entity.StorageNum = storage.StorageNum; entity.StorageType = storage.StorageType; } } else { StorageEntity storage = listStorage.FirstOrDefault(a => a.StorageNum == entity.StorageNum); if (storage != null) { entity.StorageType = storage.StorageType; } } if (entity.UnitName.IsEmpty() && !entity.UnitNum.IsEmpty()) { MeasureProvider provider = new MeasureProvider(this.CompanyID); List <MeasureEntity> listMeasure = provider.GetList(); listMeasure = listMeasure.IsNull() ? new List <MeasureEntity>() : listMeasure; MeasureEntity measureEntity = listMeasure.FirstOrDefault(a => a.SN == entity.UnitNum); entity.UnitName = measureEntity != null ? measureEntity.MeasureName : entity.UnitName; } entity.UnitNum = entity.UnitNum.IsEmpty() ? "" : entity.UnitNum; entity.UnitName = entity.UnitName.IsEmpty() ? "" : entity.UnitName; entity.Include(a => new { a.LocalBarCode, a.LocalName, a.StorageNum, a.StorageType, a.LocalType, a.Rack, a.Length, a.Width, a.Height, a.X, a.Y, a.Z, a.UnitNum, a.UnitName, a.Remark, a.IsForbid, a.IsDefault }); entity.Where(a => a.LocalNum == entity.LocalNum) .And(a => a.CompanyID == this.CompanyID) ; int line = this.Location.Update(entity); if (line > 0) { CacheHelper.Remove(Key); } ts.Complete(); return(line); } }
/// <summary> /// 初始化某个仓库的库位 /// </summary> /// <param name="StorageNum"></param> /// <param name="CreateUser"></param> /// <returns></returns> public int Init(string StorageNum, string CreateUser) { string Key = string.Format(CacheKey.JOOSHOW_LOCATION_CACHE, this.CompanyID); int line = 0; LocationEntity entity = new LocationEntity(); entity.Where(item => item.StorageNum == StorageNum) .And(item => item.CompanyID == this.CompanyID) ; if (this.Location.GetCount(entity) == 0) { StorageProvider storageProvider = new StorageProvider(this.CompanyID); StorageEntity storage = storageProvider.GetSingleByNum(StorageNum); if (storage != null) { LocationEntity location = new LocationEntity(); location.LocalNum = ConvertHelper.NewGuid(); location.LocalBarCode = new SequenceProvider(this.CompanyID).GetSequence(typeof(LocationEntity)); location.LocalName = "默认待入库位"; location.LocalType = (int)ELocalType.WaitIn; location.StorageNum = storage.SnNum; location.StorageType = storage.StorageType; location.CreateUser = CreateUser; location.CreateTime = DateTime.Now; location.IsDefault = (int)EBool.Yes; location.IsDelete = (int)EIsDelete.NotDelete; location.IsForbid = (int)EBool.No; location.CompanyID = this.CompanyID; location.IncludeAll(); line += this.Location.Add(location); location = new LocationEntity(); location.LocalNum = ConvertHelper.NewGuid(); location.LocalBarCode = new SequenceProvider(this.CompanyID).GetSequence(typeof(LocationEntity)); location.LocalName = "默认正式库位"; location.LocalType = (int)ELocalType.Normal; location.StorageNum = storage.SnNum; location.StorageType = storage.StorageType; location.CreateUser = CreateUser; location.CreateTime = DateTime.Now; location.IsDefault = (int)EBool.Yes; location.IsDelete = (int)EIsDelete.NotDelete; location.IsForbid = (int)EBool.No; location.CompanyID = this.CompanyID; location.IncludeAll(); line += this.Location.Add(location); location = new LocationEntity(); location.LocalNum = ConvertHelper.NewGuid(); location.LocalBarCode = new SequenceProvider(this.CompanyID).GetSequence(typeof(LocationEntity)); location.LocalName = "默认待检库位"; location.LocalType = (int)ELocalType.WaitCheck; location.StorageNum = storage.SnNum; location.StorageType = storage.StorageType; location.CreateUser = CreateUser; location.CreateTime = DateTime.Now; location.IsDefault = (int)EBool.Yes; location.IsDelete = (int)EIsDelete.NotDelete; location.IsForbid = (int)EBool.No; location.CompanyID = this.CompanyID; location.IncludeAll(); line += this.Location.Add(location); location = new LocationEntity(); location.LocalNum = ConvertHelper.NewGuid(); location.LocalBarCode = new SequenceProvider(this.CompanyID).GetSequence(typeof(LocationEntity)); location.LocalName = "默认待出库位"; location.LocalType = (int)ELocalType.WaitOut; location.StorageNum = storage.SnNum; location.StorageType = storage.StorageType; location.CreateUser = CreateUser; location.CreateTime = DateTime.Now; location.IsDefault = (int)EBool.Yes; location.IsDelete = (int)EIsDelete.NotDelete; location.IsForbid = (int)EBool.No; location.CompanyID = this.CompanyID; location.IncludeAll(); line += this.Location.Add(location); location = new LocationEntity(); location.LocalNum = ConvertHelper.NewGuid(); location.LocalBarCode = new SequenceProvider(this.CompanyID).GetSequence(typeof(LocationEntity)); location.LocalName = "默认报损库位"; location.LocalType = (int)ELocalType.Bad; location.StorageNum = storage.SnNum; location.StorageType = storage.StorageType; location.CreateUser = CreateUser; location.CreateTime = DateTime.Now; location.IsDefault = (int)EBool.Yes; location.IsDelete = (int)EIsDelete.NotDelete; location.IsForbid = (int)EBool.No; location.CompanyID = this.CompanyID; location.IncludeAll(); line += this.Location.Add(location); } } if (line > 0) { CacheHelper.Remove(Key); } return(line); }
private Location _Translate(LocationEntity entity) => new Location(entity.Id) { Name = entity.Name };
/// <summary> Removes the sync logic for member _location</summary> /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param> /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param> private void DesetupSyncLocation(bool signalRelatedEntity, bool resetFKFields) { this.PerformDesetupSyncRelatedEntity(_location, new PropertyChangedEventHandler(OnLocationPropertyChanged), "Location", EPICCentralDL.RelationClasses.StaticLocationCreditCardRelations.LocationEntityUsingLocationIdStatic, true, signalRelatedEntity, "LocationCreditCards", resetFKFields, new int[] { (int)LocationCreditCardFieldIndex.LocationId }); _location = null; }
public void Save(Location location) { using (var db = GetDbContext()) { LocationEntity dbLocation; if (location.Id != Guid.Empty) { dbLocation = db.Locations .Include(l => l.ProfileGroup) .SingleOrDefault(l => l.Id == location.Id); if (dbLocation == null) { throw new NullReferenceException("Location"); } } else { dbLocation = new LocationEntity { Id = Guid.NewGuid(), CreatedBy = location.CreatedBy, CreatedOn = DateTime.UtcNow }; location.Id = dbLocation.Id; location.CreatedOn = dbLocation.CreatedOn; db.Locations.Add(dbLocation); } dbLocation.Name = location.Name; dbLocation.ShortName = location.ShortName; dbLocation.Comment = location.Comment; dbLocation.CarrierConnectionId = location.CarrierConnectionId; dbLocation.UpdatedBy = location.UpdatedBy; dbLocation.UpdatedOn = DateTime.UtcNow; location.UpdatedOn = dbLocation.UpdatedOn; // IP V4 if (IPNetwork.TryParse(location.Net, location.Cidr ?? 0, out IPNetwork ipv4Network)) { dbLocation.Net_Address_v4 = ipv4Network.Network.ToString(); dbLocation.Cidr = ipv4Network.Cidr; } else { dbLocation.Net_Address_v4 = location.Net; dbLocation.Cidr = location.Cidr; } // IP v6 if (IPNetwork.TryParse(location.Net_v6, location.Cidr_v6 ?? 0, out IPNetwork ipv6Network)) { dbLocation.Net_Address_v6 = ipv6Network.Network.ToString(); dbLocation.Cidr_v6 = ipv6Network.Cidr; } else { dbLocation.Net_Address_v6 = location.Net_v6; dbLocation.Cidr_v6 = location.Cidr_v6; } // Profile Group dbLocation.ProfileGroup = db.ProfileGroups.SingleOrDefault(r => r.Id == location.ProfileGroup.Id); // Region dbLocation.Region = location.Region != null && location.Region.Id != Guid.Empty ? db.Regions.SingleOrDefault(r => r.Id == location.Region.Id) : null; // City dbLocation.City = location.City != null && location.City.Id != Guid.Empty ? db.Cities.SingleOrDefault(c => c.Id == location.City.Id) : null; db.SaveChanges(); } }
/// <summary> /// Gets the local time as a <see cref="ZonedDateTime" />. /// </summary> /// <param name="inZoneLeniantly">Whether to use leniant or strict zone conversion.</param> public static ZonedDateTime GetZonedLocaltime(this LocationEntity locationEntity, bool inZoneLeniantly = true) { return(GetZonedDateTime(locationEntity.LocalTime, locationEntity.TimeZoneID, inZoneLeniantly)); }
private void OnbtnSaveClick(object sender, EventArgs e) { List <StockTransEntity> items = bindingSource2.DataSource as List <StockTransEntity>; if (items == null || items.Count == 0) { MsgBox.Warn("请先选择要进行移库的行。"); return; } List <LocationEntity> localtionList = repositoryItemSearchLookUpEdit1.DataSource as List <LocationEntity>; //检查是否全部填写了 foreach (StockTransEntity line in items) { LocationEntity locEntity = localtionList.Find(u => u.LocationCode == line.TargetLocation); if (locEntity != null && locEntity.IsActive == "N") { MsgBox.Warn(string.Format("目标货位 {0} 被禁用,不允许执行移库操作。", locEntity.LocationCode)); return; } if (line.TransferQty <= 0) { MsgBox.Warn(string.Format("请填写“移出数量”,对应的物料为“{0}”。", line.MaterialName)); return; } if (line.TransferQty > line.IdleQty) { MsgBox.Warn(string.Format("“移出数量”不能大于“可移出量”,对应的物料为“{0}”。", line.MaterialName)); return; } if (string.IsNullOrEmpty(line.TargetLocation)) { MsgBox.Warn(string.Format("请填写“移至货位”,对应的物料为“{0}”。", line.MaterialName)); return; } } if (MsgBox.AskOK("确定要保存吗?") != DialogResult.OK) { return; } try { int billID = -1; List <int> billIdList = SaveBill( BaseCodeConstant.BILL_TYPE_TRANS, string.Empty, GlobeSettings.LoginedUser.WarehouseCode, GlobeSettings.LoginedUser.UserName, items); //if (MsgBox.AskYes("保存成功,是否现在分派任务?") == DialogResult.Yes) //{ if (billIdList.Count > 0) { bool result = false; foreach (int item in billIdList) { result = Schedule(item, "144"); } if (result) { this.DialogResult = DialogResult.OK; btnSave.Enabled = false; } //string result = string.Empty; //foreach (int item in billIdList) // result = TaskDal.Schedule(item, "144"); //if (result == "Y") //{ // this.DialogResult = DialogResult.OK; // btnSave.Enabled = false; //} //else //{ // MsgBox.Warn(result); //} } //} } catch (Exception ex) { MsgBox.Err(ex.Message); } }
/// <summary> /// 查询单据详细数据分页 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public override List <OutStoDetailEntity> GetDetailList(OutStoDetailEntity entity, ref Framework.DataTypes.PageInfo pageInfo) { OutStoDetailEntity detail = new OutStoDetailEntity(); detail.IncludeAll(); detail.OrderBy(a => a.ID, EOrderBy.DESC); detail.And(a => a.CompanyID == this.CompanyID); if (!entity.BarCode.IsEmpty()) { detail.And("BarCode", ECondition.Like, "%" + entity.BarCode + "%"); } if (!entity.ProductName.IsEmpty()) { detail.And("ProductName", ECondition.Like, "%" + entity.ProductName + "%"); } if (!entity.StorageNum.IsEmpty()) { detail.And(a => a.StorageNum == entity.StorageNum); } OutStorageEntity OutOrder = new OutStorageEntity(); detail.Left <OutStorageEntity>(OutOrder, new Params <string, string>() { Item1 = "OrderSnNum", Item2 = "SnNum" }); OutOrder.Include(a => new { CusNum = a.CusNum, CusName = a.CusName, SendDate = a.SendDate, Status = a.Status, OutType = a.OutType, AuditeTime = a.AuditeTime, CarrierName = a.CarrierName, LogisticsNo = a.LogisticsNo }); OutOrder.And(a => a.IsDelete == (int)EIsDelete.NotDelete); if (!entity.CusNum.IsEmpty()) { OutOrder.AndBegin <OutStorageEntity>() .And <OutStorageEntity>("CusNum", ECondition.Like, "%" + entity.CusNum + "%") .Or <OutStorageEntity>("CusName", ECondition.Like, "%" + entity.CusNum + "%") .End <OutStorageEntity>() ; } if (!entity.CusName.IsEmpty()) { OutOrder.AndBegin <OutStorageEntity>() .And <OutStorageEntity>("CusNum", ECondition.Like, "%" + entity.CusName + "%") .Or <OutStorageEntity>("CusName", ECondition.Like, "%" + entity.CusName + "%") .End <OutStorageEntity>() ; } if (!entity.BeginTime.IsEmpty()) { DateTime time = ConvertHelper.ToType <DateTime>(entity.BeginTime, DateTime.Now.Date.AddDays(30)).Date; OutOrder.And(a => a.CreateTime >= time); } if (!entity.EndTime.IsEmpty()) { DateTime time = ConvertHelper.ToType <DateTime>(entity.EndTime, DateTime.Now).Date.AddDays(1); OutOrder.And(a => a.CreateTime < time); } if (entity.Status > 0) { OutOrder.And(item => item.Status == entity.Status); } if (entity.OutType > 0) { OutOrder.And(item => item.OutType == entity.OutType); } if (entity.OrderNum.IsNotEmpty()) { OutOrder.And("OrderNum", ECondition.Like, "%" + entity.OrderNum + "%"); } if (!entity.CarrierNum.IsEmpty()) { OutOrder.And(item => item.CarrierNum == entity.CarrierNum); } if (!entity.CarrierName.IsEmpty()) { OutOrder.And("CarrierName", ECondition.Like, "%" + entity.CarrierName + "%"); } if (!entity.LogisticsNo.IsEmpty()) { OutOrder.And("LogisticsNo", ECondition.Like, "%" + entity.LogisticsNo + "%"); } ProductEntity product = new ProductEntity(); product.Include(item => new { Size = item.Size }); detail.Left <ProductEntity>(product, new Params <string, string>() { Item1 = "ProductNum", Item2 = "SnNum" }); AdminEntity admin = new AdminEntity(); admin.Include(a => new { CreateUserName = a.UserName }); OutOrder.Left <AdminEntity>(admin, new Params <string, string>() { Item1 = "CreateUser", Item2 = "UserNum" }); AdminEntity auditeAdmin = new AdminEntity(); auditeAdmin.Include(a => new { AuditeUserName = a.UserName }); OutOrder.Left <AdminEntity>(auditeAdmin, new Params <string, string>() { Item1 = "AuditUser", Item2 = "UserNum" }); int rowCount = 0; List <OutStoDetailEntity> listResult = this.OutStoDetail.GetList(detail, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); pageInfo.RowCount = rowCount; if (!listResult.IsNullOrEmpty()) { List <LocationEntity> listLocation = new LocationProvider(this.CompanyID).GetList(); listLocation = listLocation == null ? new List <LocationEntity>() : listLocation; foreach (OutStoDetailEntity item in listResult) { LocationEntity location = listLocation.FirstOrDefault(a => a.LocalNum == item.LocalNum); item.LocalName = location == null ? "" : location.LocalName; item.StorageName = location == null ? "" : location.StorageName; } } return(listResult); }
public static DataHandler SeedData(decimal accrued = 200, decimal received = 100, decimal percent = 25, decimal rate = 166) { var district = new DistrictEntity() { Code = 1, Name = "test" }; var street = new StreetEntity() { DistrictId = district.Id, District = district, StreetName = "1", }; var location = new LocationEntity() { StreetId = street.Id, Street = street, HouseNumber = "1", BuildingCorpus = "2", ApartmentNumber = "3", }; var account = new AccountEntity() { StreetId = street.Id, Account = 1, LocationId = location.Id, Location = location }; var payment = new PaymentDocumentEntity() { AccountId = account.Id, Account = account, Accrued = accrued, Received = received, PaymentDate = DateTime.Now }; var defaultRate = new RateEntity() { Price = Convert.ToDecimal(ConfigurationManager.AppSettings["DefaultPrice"]), IsDefault = true }; var connectionString = ConfigurationManager.ConnectionStrings[ConfigurationManager.AppSettings["ConnectionName"]].ConnectionString; using (var dataBase = new ApplicationDbContext(connectionString)) { dataBase.Database.Delete(); dataBase.Database.Create(); dataBase.Districts.Add(district); dataBase.Streets.Add(street); dataBase.Locations.Add(location); dataBase.Accounts.Add(account); dataBase.PaymentDocuments.Add(payment); dataBase.Rates.Add(defaultRate); dataBase.SaveChanges(); } return(new DataHandler() { AccountEntity = account, StreetEntity = street, LocationEntity = location }); }