Commit 497a1a28 by zxw

装备表新增UpdateTime字段 新增or修改currentstate时更新

三方接口中增加本仓库出入库业务
parent 5c072baa
......@@ -174,6 +174,11 @@ namespace JmpModel.Model
[Column("tid")]
[StringLength(255)]
public string Tid { get; set; }
/// <summary>
/// 更新时间
/// </summary>
[Column("update_time", TypeName = "datetime")]
public DateTime? UpdateTime { get; set; }
[ForeignKey(nameof(BagInventoryId))]
[InverseProperty(nameof(CommonJpBagInventory.CommonJpEquipmentInventories))]
......
......@@ -11,15 +11,11 @@ namespace JmpModel.Model.DataContext
{
public JunmppolicesqlContext()
{
//60秒超时
this.Database.SetCommandTimeout(60);
}
public JunmppolicesqlContext(DbContextOptions<JunmppolicesqlContext> options)
: base(options)
{
//60秒超时
this.Database.SetCommandTimeout(60);
}
public virtual DbSet<AlipayConfig> AlipayConfigs { get; set; }
......@@ -333,19 +329,6 @@ namespace JmpModel.Model.DataContext
.HasConstraintName("base_jp_cabinet_policeman_ibfk_2");
});
modelBuilder.Entity<BaseJpCabinetPolicemanMultiple>(entity =>
{
entity.Property(e => e.Id).IsFixedLength();
entity.Property(e => e.BoxNo).IsFixedLength();
entity.Property(e => e.CabinetRealId).IsFixedLength();
entity.Property(e => e.UserId).IsFixedLength();
entity.Property(e => e.UserName).IsFixedLength();
});
modelBuilder.Entity<BaseJpCabinetWorklog>(entity =>
{
entity.Property(e => e.Id).IsUnicode(false);
......@@ -1165,6 +1148,12 @@ Smart:智能货架
entity.HasIndex(e => e.CurrentState)
.HasName("IX_common_jp_borrow_return");
entity.HasIndex(e => new { e.WarehouseId, e.OrderCode, e.OrgId, e.CreateTime, e.IsWork, e.CurrentState, e.ActionType, e.ApplyId, e.Id })
.HasName("_dta_index_common_jp_borrow_return_9_1013578649__K4_K5_K12_K1_6_8_9_11_14");
entity.HasIndex(e => new { e.Sort, e.PolicemanId, e.CurrentState, e.ActionType, e.WarehouseId, e.OutTime, e.OrderCode, e.OrgId, e.CreateUser, e.CreateTime, e.IsAfter, e.IsWork, e.UpdateUser, e.ApplyId, e.Id })
.HasName("_dta_index_common_jp_borrow_return_5_1013578649__K12_K1_2_3_4_5_6_7_8_9_10_11_13_14_15");
entity.Property(e => e.Id).IsUnicode(false);
entity.Property(e => e.ApplyId).IsUnicode(false);
......@@ -1205,6 +1194,9 @@ Smart:智能货架
modelBuilder.Entity<CommonJpBorrowReturnApply>(entity =>
{
entity.HasIndex(e => new { e.ProcessCurrentId, e.ActionType })
.HasName("_dta_index_common_jp_borrow_return_apply_5_1029578706__K22_K4");
entity.Property(e => e.Id).IsUnicode(false);
entity.Property(e => e.ApplyId).IsUnicode(false);
......@@ -1317,6 +1309,9 @@ Smart:智能货架
modelBuilder.Entity<CommonJpBorrowReturnDetailReality>(entity =>
{
entity.HasIndex(e => new { e.RealityId, e.EquipmentDetailId })
.HasName("_dta_index_common_jp_borrow_return_detail_r_9_1061578820__K2_K7");
entity.Property(e => e.Id).IsUnicode(false);
entity.Property(e => e.EquipmentDetailId).IsUnicode(false);
......@@ -1778,6 +1773,9 @@ Smart:智能货架
entity.HasIndex(e => new { e.Id, e.SupplierCode, e.WarrantyCycle, e.UseTime, e.EquipmentCode, e.WarehouseCode, e.CabinetId, e.EquipmentSizecode, e.CurrentState })
.HasName("_dta_index_common_jp_equipment_inventory_8_1109578991__K6_K8_K9_K10_K12_1_3_20_23");
entity.HasIndex(e => new { e.CurrentState, e.CreateTime, e.Price, e.SafeLevel, e.IsFixed, e.OrgId, e.InventoryState, e.EquipmentSizecode, e.EquipmentCode, e.WarehouseCode })
.HasName("_dta_index_common_jp_equipment_inventory_9_1109578991__K41_K31_K10_K6_K8_12_15_24_36_42");
entity.HasIndex(e => new { e.Sort, e.SupplierCode, e.Epc, e.PoliceCode, e.EquipmentCode, e.Wzdm, e.CabinetId, e.EquipmentSizecode, e.EquipmentLocation, e.OutTime, e.ReturnTime, e.CreateTime, e.FirstUseTime, e.FixCount, e.CreateUser, e.UpdateUser, e.WarrantyCycle, e.RepairCycle, e.ProductTime, e.UseTime, e.Price, e.UseDirection, e.CurrentState, e.Id, e.WarehouseCode })
.HasName("_dta_index_common_jp_equipment_inventory_8_1109578991__K12_K1_K8_2_3_4_5_6_7_9_10_11_13_14_15_16_17_18_19_20_21_22_23_24_25");
......@@ -1854,6 +1852,8 @@ Smart:智能货架
.IsUnicode(false)
.HasComment("标签TID");
entity.Property(e => e.UpdateTime).HasComment("更新时间");
entity.Property(e => e.UpdateUser).IsUnicode(false);
entity.Property(e => e.WarehouseCode).IsUnicode(false);
......
......@@ -435,9 +435,11 @@
"ObjectType": 3
}
],
"UiHint": "PC.junmppolicesqldev",
"UiHint": "pc.junmppolicesqldev.dbo",
"UncountableWords": null,
"UseBoolPropertiesWithoutDefaultSql": false,
"UseDatabaseNames": false,
"UseDateOnlyTimeOnly": false,
"UseDbContextSplitting": false,
"UseFluentApiOnly": false,
"UseHandleBars": false,
......@@ -445,9 +447,7 @@
"UseInflector": true,
"UseLegacyPluralizer": false,
"UseManyToManyEntity": false,
"UseNoConstructor": false,
"UseNoDefaultConstructor": false,
"UseNoNavigations": false,
"UseNoObjectFilter": false,
"UseNodaTime": false,
"UseNullableReferences": false,
......
......@@ -323,6 +323,8 @@ namespace JunmpPoliceStation.Controllers
{
inventory.CabinetId = null;
inventory.CurrentState = 8;
//更新时间
inventory.UpdateTime = DateTime.Now;
updateInvs.Add(inventory);
}
}
......@@ -331,6 +333,8 @@ namespace JunmpPoliceStation.Controllers
{
Inv.CabinetId = null;
Inv.CurrentState = 8;
//更新时间
Inv.UpdateTime = DateTime.Now;
updateInvs.Add(Inv);
}
}
......@@ -1267,6 +1271,16 @@ namespace JunmpPoliceStation.Controllers
}
}
var newInvList = _unitOfWork.DbContext.ChangeTracker.Entries()
.Where(x => x.Entity is CommonJpEquipmentInventory)
.Select(x => x.Entity as CommonJpEquipmentInventory)
.ToList();
foreach (var inventory in newInvList)
{
inventory.UpdateTime = DateTime.Now;
}
bool result = true;
if (OutEpc.Count > 0)
{
......@@ -1563,6 +1577,16 @@ namespace JunmpPoliceStation.Controllers
}
}
var newInvList = _unitOfWork.DbContext.ChangeTracker.Entries()
.Where(x => x.Entity is CommonJpEquipmentInventory)
.Select(x => x.Entity as CommonJpEquipmentInventory)
.ToList();
foreach (var inventory in newInvList)
{
inventory.UpdateTime = DateTime.Now;
}
bool result = true;
if (OutEpc.Count > 0)
{
......@@ -2225,6 +2249,16 @@ namespace JunmpPoliceStation.Controllers
}
}
}
var newInvList = _unitOfWork.DbContext.ChangeTracker.Entries()
.Where(x => x.Entity is CommonJpEquipmentInventory)
.Select(x => x.Entity as CommonJpEquipmentInventory)
.ToList();
foreach (var inventory in newInvList)
{
inventory.UpdateTime = DateTime.Now;
}
bool result = true;
if (OutEpc.Count > 0)
{
......@@ -2560,6 +2594,16 @@ namespace JunmpPoliceStation.Controllers
}
}
}
var newInvList = _unitOfWork.DbContext.ChangeTracker.Entries()
.Where(x => x.Entity is CommonJpEquipmentInventory)
.Select(x => x.Entity as CommonJpEquipmentInventory)
.ToList();
foreach (var inventory in newInvList)
{
inventory.UpdateTime = DateTime.Now;
}
bool result = true;
if (OutEpc.Count > 0)
{
......@@ -2958,6 +3002,15 @@ namespace JunmpPoliceStation.Controllers
}
var newInvList = _unitOfWork.DbContext.ChangeTracker.Entries()
.Where(x => x.Entity is CommonJpEquipmentInventory)
.Select(x => x.Entity as CommonJpEquipmentInventory)
.ToList();
foreach (var inventory in newInvList)
{
inventory.UpdateTime = DateTime.Now;
}
bool result = true;
if (InsertState.Count > 0)
......@@ -3751,6 +3804,7 @@ namespace JunmpPoliceStation.Controllers
item.CurrentState = 7;
item.PoliceCode = null;
item.CabinetId = null;
item.UpdateTime = DateTime.Now;
EqInv.Add(item);
}
_unitOfWork.EquipmentInventoryRepository.Update(EqInv, false);
......@@ -3999,6 +4053,7 @@ namespace JunmpPoliceStation.Controllers
item.CurrentState = 7;
item.PoliceCode = null;
item.CabinetId = null;
item.UpdateTime = DateTime.Now;
EqInv.Add(item);
}
_unitOfWork.EquipmentInventoryRepository.Update(EqInv, false);
......
......@@ -1292,6 +1292,7 @@ namespace JunmpPoliceStation.Controllers
//单警柜解绑
x.CabinetId = null;
x.PoliceCode = null;
x.UpdateTime=DateTime.Now;
_unitOfWork.EquipmentInventoryRepository.Update(x, false);
});
......@@ -1370,6 +1371,7 @@ namespace JunmpPoliceStation.Controllers
x.EquipmentLocation = 0;
x.IsFixed = true;
x.UpdateTime = DateTime.Now;
_unitOfWork.EquipmentInventoryRepository.Update(x, false);
});
......
......@@ -5999,7 +5999,7 @@ namespace JunmpPoliceStation.Controllers
/// "orgId": "0320200512000808",
/// "warehouseId": "",
/// "orderNo": "",//订单号
/// "type": "类型",采购,调拨,借用,领用,维修,跨库借用,跨库归还
/// "type": "类型",采购,调拨,借用,领用,维修,跨库借用,跨库归还,无单据
/// "outInState": "","当前出入库状态",//出库,入库
/// "policeId": "",//警员ID
/// "picUrl": "出入库图片路径",
......@@ -6138,7 +6138,7 @@ namespace JunmpPoliceStation.Controllers
if (UpdateEpc.Count > 0)//同时有插入和更新的数据
{
_unitOfWork.EquipmentInventoryRepository.Update(UpdateEpc, true);
_unitOfWork.EquipmentInventoryRepository.Update(UpdateEpc, false);
}
......@@ -6178,11 +6178,52 @@ namespace JunmpPoliceStation.Controllers
if (UpdateEpc.Count > 0)//同时有插入和更新的数据
{
_unitOfWork.EquipmentInventoryRepository.Update(UpdateEpc, true);
_unitOfWork.EquipmentInventoryRepository.Update(UpdateEpc, false);
}
}
else if (type.Equals("无单据"))
{
var orderCode = "WDJ" + DateTime.Now.Ticks.ToString().PadLeft(19, '0');
foreach (var outsideItem in OuterInvens)////所有的异常出库
{
if (outsideItem.WarehouseCode.Equals(warehouseId) && outsideItem.EquipmentLocation.Equals(0) && outsideItem.CurrentState.Equals(0))//如果物资在本仓库中,异常出库为借用出库
{
outsideItem.CurrentState = 14;
outsideItem.EquipmentLocation = 3;
outsideItem.UpdateUser = policeId;
outsideItem.WarehouseCode = warehouseId;
outsideItem.CommonJpEquipmentStates?.Add(new CommonJpEquipmentState//新增一条记录表
{
Id = Guid.NewGuid().ToString(),
OutTime = DateTime.Now,
PicUrl = picUrl,
OrgId = orgId,
WarehouseId = warehouseId,
State = 6,
PoliceId = policeId,
EqiupmentId = outsideItem.Id,
CreateTime = DateTime.Now,
ActionState = 14,
OutInState = 0,
OrderCode = orderCode
});
UpdateEpc.Add(outsideItem);
}
}
_unitOfWork.DbContext.CommonJpNoborrowOrders.Add(new CommonJpNoborrowOrder()
{
Id = Guid.NewGuid().ToString(),
CreateTime = DateTime.Now,
OrderCode = orderCode,
State = 0,
WarehouseId = warehouseId,
WarehouseName = warehouseInfo.Name,
});
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
......@@ -6224,7 +6265,7 @@ namespace JunmpPoliceStation.Controllers
}
if (InsertEpc.Count > 0)
{
_unitOfWork.EquipmentInventoryRepository.Insert(InsertEpc, true);
_unitOfWork.EquipmentInventoryRepository.Insert(InsertEpc, false);
}
}
......@@ -6249,7 +6290,7 @@ namespace JunmpPoliceStation.Controllers
}
if (UpdateEpc.Count > 0)
{
_unitOfWork.EquipmentInventoryRepository.Update(UpdateEpc, true);
_unitOfWork.EquipmentInventoryRepository.Update(UpdateEpc, false);
}
}
#endregion
......@@ -6275,7 +6316,7 @@ namespace JunmpPoliceStation.Controllers
}
if (UpdateEpc.Count > 0)
{
_unitOfWork.EquipmentInventoryRepository.Update(UpdateEpc, true);
_unitOfWork.EquipmentInventoryRepository.Update(UpdateEpc, false);
}
}
#endregion
......@@ -6329,15 +6370,66 @@ namespace JunmpPoliceStation.Controllers
}
if (UpdateEpc.Count > 0)
{
_unitOfWork.EquipmentInventoryRepository.Update(UpdateEpc, true);
_unitOfWork.EquipmentInventoryRepository.Update(UpdateEpc, false);
}
}
#endregion
if (type.Equals("无单据"))
{
var orderCode = "WDJ" + DateTime.Now.Ticks.ToString().PadLeft(19, '0');
foreach (var InsideItem in InsideInvens)
{
var InsideState = _unitOfWork.EquipmentStateRepository.GetList(p => p.EqiupmentId.Equals(InsideItem.Id)).FirstOrDefault();//取出该物品中除去单警柜的第一条出入库记录
if ((InsideItem.CurrentState.Equals(14) || InsideState.Equals(14)) && InsideItem.WarehouseCode.Equals(warehouseId))//借用入库
{
InsideItem.CurrentState = 0;
InsideItem.EquipmentLocation = 0;
InsideItem.UpdateUser = policeId;
InsideItem.WarehouseCode = warehouseId;
InsideItem.CommonJpEquipmentStates?.Add(new CommonJpEquipmentState//新增一条记录表
{
Id = Guid.NewGuid().ToString(),
IntoTime = DateTime.Now,
PicUrl = picUrl,
OrgId = orgId,
WarehouseId = warehouseId,
State = 6,
PoliceId = policeId,
EqiupmentId = InsideItem.Id,
CreateTime = DateTime.Now,
ActionState = 13,
OutInState = 1,
OrderCode = orderCode
});
UpdateEpc.Add(InsideItem);
}
}
_unitOfWork.DbContext.CommonJpNoborrowOrders.Add(new CommonJpNoborrowOrder()
{
Id = Guid.NewGuid().ToString(),
CreateTime = DateTime.Now,
OrderCode = orderCode,
State = 1,
WarehouseId = warehouseId,
WarehouseName = warehouseInfo.Name,
});
}
}
var newInvList = _unitOfWork.DbContext.ChangeTracker.Entries()
.Where(x => x.Entity is CommonJpEquipmentInventory)
.Select(x => x.Entity as CommonJpEquipmentInventory)
.ToList();
foreach (var inventory in newInvList)
{
//更新时间
inventory.UpdateTime = DateTime.Now;
}
_unitOfWork.SaveChanges();
//#endregion
......@@ -7310,6 +7402,18 @@ namespace JunmpPoliceStation.Controllers
}
}
var newInvList = _unitOfWork.DbContext.ChangeTracker.Entries()
.Where(x => x.Entity is CommonJpEquipmentInventory)
.Select(x => x.Entity as CommonJpEquipmentInventory)
.ToList();
foreach (var inventory in newInvList)
{
//更新时间
inventory.UpdateTime = DateTime.Now;
}
bool errorResult = false;
if (ErrorState.Count > 0)
{
......
......@@ -1032,6 +1032,7 @@ namespace JunmpPoliceStation.Controllers
x.WarehouseCode = null;
x.OrgId = orgId;
x.PoliceCode = policeId;
x.UpdateTime=DateTime.Now;
_unitOfWork.EquipmentInventoryRepository.Update(x, false);
});
......
......@@ -1541,7 +1541,8 @@ namespace JunmpPoliceStation.Controllers
RepairCycle = repairCycle,
IsBorrowed = false,
InstantiationState = 2,
OrgId = warehouse?.OrgizationId
OrgId = warehouse?.OrgizationId,
UpdateTime = DateTime.Now
};
res = _unitOfWork.EquipmentInventoryRepository.Insert(ent);
}
......@@ -1713,7 +1714,8 @@ namespace JunmpPoliceStation.Controllers
RepairCycle = repairCycle,
IsBorrowed = false,
InstantiationState = 2,
OrgId = warehouse?.OrgizationId
OrgId = warehouse?.OrgizationId,
UpdateTime = DateTime.Now
};
if (!string.IsNullOrEmpty(shelfId))
......@@ -1951,7 +1953,8 @@ namespace JunmpPoliceStation.Controllers
RepairCycle = repairCycle,
IsBorrowed = false,
InstantiationState = 2,
OrgId = warehouse?.OrgizationId
OrgId = warehouse?.OrgizationId,
UpdateTime = DateTime.Now
};
_unitOfWork.EquipmentInventoryRepository.Insert(ent, false);
}
......@@ -2170,7 +2173,8 @@ namespace JunmpPoliceStation.Controllers
IsInBox = true,
BoxMarkId = boxMark.Id,
InstantiationState = 1,
OrgId = warehouse?.OrgizationId
OrgId = warehouse?.OrgizationId,
UpdateTime = DateTime.Now
};
if (!string.IsNullOrEmpty(shelfId))
{
......@@ -2389,7 +2393,8 @@ namespace JunmpPoliceStation.Controllers
InstantiationState = 1,
BoxMarkId = boxMark.Id,
IsInBox = true,
OrgId = warehouse?.OrgizationId
OrgId = warehouse?.OrgizationId,
UpdateTime = DateTime.Now
};
if (!string.IsNullOrEmpty(shelfId))
{
......@@ -2613,6 +2618,7 @@ namespace JunmpPoliceStation.Controllers
ShelfRow = epcObj.ShelfRow,
ShelfColumn = epcObj.ShelfColumn,
OrgId = epcObj.Detail?.Order?.OrgId,
UpdateTime = DateTime.Now
}, false);
epcObj.CurrentState = 2;
purchaseCount++;
......@@ -3054,6 +3060,7 @@ namespace JunmpPoliceStation.Controllers
invNew.UseTime = DateTime.Now;
invNew.ProductTime = DateTime.Parse(item.生产日期);
invNew.OrgId = warehouseName?.OrgizationId;
invNew.UpdateTime=DateTime.Now;
//var ent = new CommonJpEquipmentInventory
//{
// Id = Guid.NewGuid().ToString(),
......@@ -3933,6 +3940,7 @@ namespace JunmpPoliceStation.Controllers
old.BoxMarkId = boxMarkId;
old.InstantiationState = instantiationState;
old.OrgId = warehouse?.OrgizationId;
old.UpdateTime=DateTime.Now;
updateList.Add(old);
}
if (editType == "ADD")
......@@ -3968,6 +3976,7 @@ namespace JunmpPoliceStation.Controllers
IsInBox = isInBox,
BoxMarkId = boxMarkId,
InstantiationState = instantiationState,
UpdateTime = DateTime.Now
});
}
if (editType == "DELETE")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论