5 changed files with 163 additions and 1 deletions
@ -0,0 +1,51 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
|
||||
|
namespace WMS_GIRAF_Interface.Entities; |
||||
|
|
||||
|
[Table("STORAGE_MAIN")] |
||||
|
public class STORAGE_MAIN |
||||
|
{ |
||||
|
[Column("STORAGE_ID")] |
||||
|
[Key] |
||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
||||
|
public int? STORAGE_ID { get; set; } |
||||
|
|
||||
|
[Column("CELL_ID")] |
||||
|
public int? CELL_ID { get; set; } |
||||
|
|
||||
|
[Column("STOCK_BARCODE")] |
||||
|
public string? STOCK_BARCODE { get; set; } |
||||
|
|
||||
|
[Column("CELL_MODEL")] |
||||
|
public string? CELL_MODEL { get; set; } |
||||
|
[Column("LOTNUMBER")] |
||||
|
public string? LOTNUMBER { get; set; } |
||||
|
[Column("PopulationNumber")] |
||||
|
public string? PopulationNumber { get; set; } |
||||
|
[Column("FabricationDateTimeInUtc")] |
||||
|
public string? FabricationDateTimeInUtc { get; set; } |
||||
|
[Column("DryDateTimeInUtc")] |
||||
|
public string? DryDateTimeInUtc { get; set; } |
||||
|
[Column("OldDateTimeInUtc")] |
||||
|
public string? OldDateTimeInUtc { get; set; } |
||||
|
[Column("HdvDateTimeInUtc")] |
||||
|
public string? HdvDateTimeInUtc { get; set; } |
||||
|
[Column("IsPriority")] |
||||
|
public bool? IsPriority { get; set; } |
||||
|
[Column("IsBlocked")] |
||||
|
public bool? IsBlocked { get; set; } |
||||
|
[Column("STORAGE_LIST_QUANTITY")] |
||||
|
public int? STORAGE_LIST_QUANTITY { get; set; } = 1; |
||||
|
[Column("EntryTime")] |
||||
|
public string? EntryTime { get; set; } |
||||
|
[Column("STORAGE_REMARK")] |
||||
|
public string? STORAGE_REMARK { get; set; } |
||||
|
[Column("GOODS_ID")] |
||||
|
public int? GOODS_ID { get; set; } |
||||
|
[Column("requestNumber")] |
||||
|
public string? requestNumber { get; set; } |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,68 @@ |
|||||
|
using Serilog; |
||||
|
using WMS_GIRAF_Interface.Data; |
||||
|
using WMS_GIRAF_Interface.Entities; |
||||
|
using WMS_GIRAF_Interface.Repositories.Interface; |
||||
|
|
||||
|
|
||||
|
namespace WMS_GIRAF_Interface.Repositories.Implement; |
||||
|
|
||||
|
public class StorageMainRepository:IStorageMainRepository |
||||
|
{ |
||||
|
private readonly MichelinDbContext _context; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 构造函数
|
||||
|
/// </summary>
|
||||
|
/// <param name="context"></param>
|
||||
|
public StorageMainRepository(MichelinDbContext context) |
||||
|
{ |
||||
|
_context = context; |
||||
|
} |
||||
|
|
||||
|
public STORAGE_MAIN? GetStorageMain(string type, string filterInfo) |
||||
|
{ |
||||
|
STORAGE_MAIN? storageMain = type switch |
||||
|
{ |
||||
|
"barcode" => _context.Storage_Main.FirstOrDefault(x => x.STOCK_BARCODE == filterInfo), |
||||
|
"storageId" => _context.Storage_Main.FirstOrDefault(x => x.STORAGE_ID == Convert.ToInt32(filterInfo)), |
||||
|
"requestNumber" => _context.Storage_Main.FirstOrDefault(x => x.requestNumber == filterInfo), |
||||
|
_ => _context.Storage_Main.FirstOrDefault(x => x.STOCK_BARCODE == filterInfo) |
||||
|
}; |
||||
|
|
||||
|
return storageMain; |
||||
|
} |
||||
|
public bool UpdateStorageMain(STORAGE_MAIN storageMain) |
||||
|
{ |
||||
|
if (storageMain == null || storageMain.STORAGE_ID == 0) |
||||
|
{ |
||||
|
throw new ArgumentNullException(nameof(UpdateStorageMain)); |
||||
|
} |
||||
|
_context.Storage_Main.Update(storageMain); |
||||
|
Log.Information($"Update storage main info({storageMain.STOCK_BARCODE});"); |
||||
|
_context.SaveChanges(); |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
public bool DeleteStorageMain(STORAGE_MAIN storageMain) |
||||
|
{ |
||||
|
if(storageMain == null || storageMain.STORAGE_ID == 0) |
||||
|
{ |
||||
|
throw new ArgumentNullException(nameof(DeleteStorageMain)); |
||||
|
} |
||||
|
_context.Storage_Main.Remove(storageMain); |
||||
|
_context.SaveChanges(); |
||||
|
Log.Information($"Deleted storage main info({storageMain.STOCK_BARCODE});"); |
||||
|
return true; |
||||
|
} |
||||
|
public bool AddStorageMain(STORAGE_MAIN storageMain) |
||||
|
{ |
||||
|
if (storageMain==null) |
||||
|
{ |
||||
|
throw new ArgumentNullException(nameof(AddStorageMain)); |
||||
|
} |
||||
|
_context.Storage_Main.Add(storageMain); |
||||
|
_context.SaveChanges(); |
||||
|
Log.Information($"Add storage main info({storageMain.STOCK_BARCODE});"); |
||||
|
return true; |
||||
|
} |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
using WMS_GIRAF_Interface.Entities; |
||||
|
|
||||
|
namespace WMS_GIRAF_Interface.Repositories.Interface; |
||||
|
|
||||
|
public interface IStorageMainRepository |
||||
|
{ |
||||
|
public STORAGE_MAIN? GetStorageMain(string type, string filterInfo); |
||||
|
public bool AddStorageMain(STORAGE_MAIN storageMain); |
||||
|
public bool UpdateStorageMain(STORAGE_MAIN storageMain); |
||||
|
public bool DeleteStorageMain(STORAGE_MAIN storageMain); |
||||
|
} |
Loading…
Reference in new issue