wanggang
1 year ago
19 changed files with 5941 additions and 122 deletions
@ -1,66 +1,145 @@ |
|||||
using System; |
using System; |
||||
|
using System.IO; |
||||
|
using System.Linq; |
||||
|
using System.Linq.Dynamic.Core; |
||||
using System.Threading.Tasks; |
using System.Threading.Tasks; |
||||
using Microsoft.AspNetCore.Authorization; |
using Microsoft.AspNetCore.Authorization; |
||||
using Microsoft.AspNetCore.Mvc; |
using Microsoft.AspNetCore.Mvc; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Microsoft.EntityFrameworkCore.Infrastructure; |
||||
|
using Microsoft.EntityFrameworkCore.Storage; |
||||
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
||||
using Volo.Abp.Application.Dtos; |
using Volo.Abp.Application.Dtos; |
||||
using Volo.Abp.Application.Services; |
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.AspNetCore.Uow; |
||||
using Volo.Abp.DependencyInjection; |
using Volo.Abp.DependencyInjection; |
||||
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; |
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; |
||||
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
||||
|
using Win.Sfs.SettleAccount.EntityFrameworkCore; |
||||
|
using Win.Sfs.Shared.Filter; |
||||
using Win.Sfs.Shared.RepositoryBase; |
using Win.Sfs.Shared.RepositoryBase; |
||||
|
using static Microsoft.EntityFrameworkCore.DbLoggerCategory; |
||||
|
|
||||
namespace Win.Sfs.SettleAccount.Entities.BQ; |
namespace Win.Sfs.SettleAccount.Entities.BQ; |
||||
|
|
||||
public interface IVmiService : IApplicationService, ITransientDependency, IJobService |
public interface IVmiService : IApplicationService, ITransientDependency, IJobService |
||||
{ |
{ |
||||
string Test(); |
|
||||
|
|
||||
void In(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message); |
void In(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message); |
||||
|
|
||||
void Out(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message); |
void Out(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message); |
||||
|
|
||||
Task<PagedResultDto<VmiBalance>> Query(RequestDto request); |
void Run(string logGroupId, VmiType type); |
||||
} |
} |
||||
|
|
||||
[AllowAnonymous] |
[AllowAnonymous] |
||||
[Route("api/settleaccount/[controller]/[action]")]
|
[Route("api/settleaccount/[controller]/[action]")]
|
||||
public class VmiAppService : ApplicationService, IVmiService, IJobService, ITransientDependency |
public class VmiAppService : ApplicationService, IVmiService, IJobService, ITransientDependency |
||||
{ |
{ |
||||
private readonly INormalEfCoreRepository<VmiBalance, Guid> _repository; |
private readonly INormalEfCoreRepository<VmiBalance, Guid> _balanceRepository; |
||||
|
private readonly INormalEfCoreRepository<VmiLog, Guid> _logRepository; |
||||
|
private readonly INormalEfCoreRepository<VmiSnapshot, Guid> _snapshotRepository; |
||||
|
|
||||
public VmiAppService(INormalEfCoreRepository<VmiBalance, Guid> repository) |
public VmiAppService(INormalEfCoreRepository<VmiBalance, Guid> balanceRepository, |
||||
|
INormalEfCoreRepository<VmiLog, Guid> logRepository, |
||||
|
INormalEfCoreRepository<VmiSnapshot, Guid> snapshotRepository) |
||||
{ |
{ |
||||
this._repository = repository; |
this._balanceRepository = balanceRepository; |
||||
|
this._logRepository = logRepository; |
||||
|
this._snapshotRepository = snapshotRepository; |
||||
} |
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 定时备份
|
||||
|
/// </summary>
|
||||
[HttpPost] |
[HttpPost] |
||||
public void Invoke() |
public void Invoke() |
||||
{ |
{ |
||||
|
Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/files/vmi")); |
||||
|
var date = DateTime.Now.ToString("yyyyMMddHH"); |
||||
|
var connectionString = $"Data Source=wwwroot/files/vmi/{date}.db"; |
||||
|
using var dbContext = new VmiSqliteContext(connectionString); |
||||
|
if (!dbContext.GetService<IRelationalDatabaseCreator>().Exists() && dbContext.Database.EnsureCreated()) |
||||
|
{ |
||||
|
this._balanceRepository.AsNoTracking().ForEachAsync(o => |
||||
|
{ |
||||
|
dbContext.Set<VmiBalance>().Add(o); |
||||
|
}); |
||||
|
dbContext.SaveChanges(); |
||||
|
var snapshot = new VmiSnapshot { Name = date, Path = connectionString }; |
||||
|
this._snapshotRepository.InsertAsync(snapshot).Wait(); |
||||
|
} |
||||
Console.WriteLine($"{nameof(VmiAppService)}:{DateTime.Now}"); |
Console.WriteLine($"{nameof(VmiAppService)}:{DateTime.Now}"); |
||||
} |
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 入库
|
||||
|
/// </summary>
|
||||
[HttpPost] |
[HttpPost] |
||||
public void In(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message) |
public void In(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message) |
||||
{ |
{ |
||||
} |
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 出库
|
||||
|
/// </summary>
|
||||
[HttpPost] |
[HttpPost] |
||||
public void Out(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message) |
public void Out(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message) |
||||
{ |
{ |
||||
} |
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 库存事务重放
|
||||
|
/// </summary>
|
||||
|
/// <param name="logGroupId"></param>
|
||||
|
/// <param name="type"></param>
|
||||
|
[NonAction] |
||||
|
public void Run(string logGroupId, VmiType type) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 库存余额查询
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
[HttpPost] |
[HttpPost] |
||||
public async Task<PagedResultDto<VmiBalance>> Query(RequestDto input) |
public async Task<PagedResultDto<VmiBalance>> Balance(RequestDto input) |
||||
{ |
{ |
||||
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false); |
var entities = await _balanceRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false); |
||||
var totalCount = await _repository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); |
var totalCount = await _balanceRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); |
||||
//var dtos = ObjectMapper.Map<List<CodeSetting>, List<CodeSettingDto>>(entities);
|
//var dtos = ObjectMapper.Map<List<CodeSetting>, List<CodeSettingDto>>(entities);
|
||||
return new PagedResultDto<VmiBalance>(totalCount, entities); |
return new PagedResultDto<VmiBalance>(totalCount, entities); |
||||
} |
} |
||||
|
|
||||
[HttpGet] |
/// <summary>
|
||||
public string Test() |
/// 库存事务查询
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost] |
||||
|
public async Task<PagedResultDto<VmiLog>> Log(RequestDto input) |
||||
|
{ |
||||
|
var entities = await _logRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false); |
||||
|
var totalCount = await _logRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); |
||||
|
//var dtos = ObjectMapper.Map<List<CodeSetting>, List<CodeSettingDto>>(entities);
|
||||
|
return new PagedResultDto<VmiLog>(totalCount, entities); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 时点库存查询
|
||||
|
/// </summary>
|
||||
|
/// <param name="name">备份名称</param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("{name}")] |
||||
|
public async Task<PagedResultDto<VmiBalance>> Backup(string name, RequestDto input) |
||||
{ |
{ |
||||
return "Test"; |
var connectionString = $"Data Source=wwwroot/files/vmi/{name}.db"; |
||||
|
using var dbContext = new VmiSqliteContext(connectionString); |
||||
|
var repo = dbContext.Set<VmiBalance>(); |
||||
|
var filters = input.Filters.ToLambda<VmiBalance>(); |
||||
|
var query = (input.Filters.Count > 0 ? repo.Where(input.Filters.ToLambda<VmiBalance>()) : repo); |
||||
|
var totalCount = query.Count(); |
||||
|
var entities = await query.PageBy(input.SkipCount, input.MaxResultCount).ToListAsync(); |
||||
|
return new PagedResultDto<VmiBalance>(totalCount, entities); |
||||
} |
} |
||||
} |
} |
||||
|
@ -1,20 +1,18 @@ |
|||||
using System; |
using System; |
||||
using System.Collections.Generic; |
|
||||
using Volo.Abp.Domain.Entities; |
using Volo.Abp.Domain.Entities; |
||||
|
|
||||
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
||||
|
|
||||
public class JobItem : Entity<Guid>, IHasConcurrencyStamp |
public class JobItem : Entity<Guid>, IHasConcurrencyStamp |
||||
{ |
{ |
||||
public JobItem() |
public JobItem(Guid id) |
||||
{ |
{ |
||||
this.Id = Guid.NewGuid(); |
this.Id = id; |
||||
} |
} |
||||
|
|
||||
public string Name { get; set; } |
public string Name { get; set; } |
||||
public string Cron { get; set; } |
public string Cron { get; set; } |
||||
public string Service { get; set; } |
public string Service { get; set; } |
||||
public bool IsRunning { get; set; } |
public bool IsRunning { get; set; } |
||||
public List<JobLog> Logs { get; set; } = new List<JobLog>(); |
|
||||
public string ConcurrencyStamp { get; set; } |
public string ConcurrencyStamp { get; set; } |
||||
} |
} |
||||
|
@ -1,56 +1,90 @@ |
|||||
using System; |
using System; |
||||
using System.Collections.Generic; |
|
||||
using System.ComponentModel.DataAnnotations; |
using System.ComponentModel.DataAnnotations; |
||||
using Volo.Abp.Domain.Entities; |
using Volo.Abp.Domain.Entities; |
||||
|
|
||||
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// ERP库位+零件号+生产码
|
||||
|
/// </summary>
|
||||
public class VmiBalance : Entity<Guid> |
public class VmiBalance : Entity<Guid> |
||||
{ |
{ |
||||
[Display(Name = "Erp目标库位", Description = "Key")] |
public VmiBalance(Guid id) |
||||
|
{ |
||||
|
this.Id = id; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Erp目标库位
|
||||
|
/// </summary>
|
||||
public string ErpToLoc { get; set; } |
public string ErpToLoc { get; set; } |
||||
|
|
||||
[Display(Name = "LU零件号", Description = "Key")] |
/// <summary>
|
||||
|
/// LU零件号
|
||||
|
/// </summary>
|
||||
public string LU { get; set; } |
public string LU { get; set; } |
||||
|
|
||||
[Display(Name = "客户零件号")] |
/// <summary>
|
||||
|
/// 客户零件号
|
||||
|
/// </summary>
|
||||
public string PartCode { get; set; } |
public string PartCode { get; set; } |
||||
|
|
||||
[Display(Name = "生产码", Description = "Key")] |
/// <summary>
|
||||
|
/// 生产码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "", Description = "Key")] |
||||
public string VinCode { get; set; } |
public string VinCode { get; set; } |
||||
|
|
||||
[Display(Name = "生产码类型")] |
/// <summary>
|
||||
|
/// 生产码类型
|
||||
|
/// </summary>
|
||||
public string CodeType { get; set; } |
public string CodeType { get; set; } |
||||
|
|
||||
[Display(Name = "发货类型")] |
/// <summary>
|
||||
|
/// 发货类型
|
||||
|
/// </summary>
|
||||
public string ProType { get; set; } |
public string ProType { get; set; } |
||||
|
|
||||
[Display(Name = "数量")] |
/// <summary>
|
||||
|
/// 数量
|
||||
|
/// </summary>
|
||||
public decimal Qty { get; set; } |
public decimal Qty { get; set; } |
||||
|
|
||||
[Display(Name = "发运日期")] |
/// <summary>
|
||||
|
/// 发运日期
|
||||
|
/// </summary>
|
||||
public DateTime ShippingDate { get; set; } |
public DateTime ShippingDate { get; set; } |
||||
|
|
||||
[Display(Name = "订单日期")] |
/// <summary>
|
||||
|
/// 订单日期
|
||||
|
/// </summary>
|
||||
public DateTime CreationTime { get; set; } |
public DateTime CreationTime { get; set; } |
||||
|
|
||||
[Display(Name = "EDI顺序号")] |
/// <summary>
|
||||
|
/// EDI顺序号
|
||||
|
/// </summary>
|
||||
public string SeqNumber { get; set; } |
public string SeqNumber { get; set; } |
||||
|
|
||||
[Display(Name = "客户订单号")] |
/// <summary>
|
||||
|
/// 客户订单号
|
||||
|
/// </summary>
|
||||
public string Tmpe4 { get; set; } |
public string Tmpe4 { get; set; } |
||||
|
|
||||
[Display(Name = "塑件唯一码")] |
/// <summary>
|
||||
|
/// 塑件唯一码
|
||||
|
/// </summary>
|
||||
public string UniqueCode { get; set; } |
public string UniqueCode { get; set; } |
||||
|
|
||||
[Display(Name = "EDI总成号")] |
/// <summary>
|
||||
|
/// EDI总成号
|
||||
|
/// </summary>
|
||||
public string MatchNumber { get; set; } |
public string MatchNumber { get; set; } |
||||
|
|
||||
[Display(Name = "PJIS生产顺序号")] |
/// <summary>
|
||||
|
/// PJIS生产顺序号
|
||||
|
/// </summary>
|
||||
public string PjsNum { get; set; } |
public string PjsNum { get; set; } |
||||
|
|
||||
[Display(Name = "备注")] |
[Display(Name = "备注")] |
||||
public string Desc { get; set; } |
public string Desc { get; set; } |
||||
|
|
||||
public List<VmiLog> Logs { get; set; } = new List<VmiLog>(); |
|
||||
} |
} |
||||
|
@ -1,8 +0,0 @@ |
|||||
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|
||||
|
|
||||
public enum VmiOperatorType |
|
||||
{ |
|
||||
Do, |
|
||||
UnDo, |
|
||||
ReDo |
|
||||
} |
|
@ -0,0 +1,26 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.EntityFrameworkCore; |
||||
|
|
||||
|
public class VmiSqliteContext : DbContext |
||||
|
{ |
||||
|
private readonly string _connectionString; |
||||
|
|
||||
|
public VmiSqliteContext(string connectionString) |
||||
|
{ |
||||
|
this._connectionString = connectionString; |
||||
|
} |
||||
|
|
||||
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) |
||||
|
{ |
||||
|
optionsBuilder.UseSqlite(this._connectionString); |
||||
|
} |
||||
|
|
||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder) |
||||
|
{ |
||||
|
modelBuilder.Entity<VmiBalance>().HasKey(o => o.Id); |
||||
|
modelBuilder.Entity<VmiBalance>().Property<DateTime>("BackupDate"); |
||||
|
} |
||||
|
} |
File diff suppressed because it is too large
@ -0,0 +1,435 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Migrations |
||||
|
{ |
||||
|
public partial class vmi3 : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropForeignKey( |
||||
|
name: "FK_JobLog_Set_JobItem_JobId", |
||||
|
table: "JobLog"); |
||||
|
|
||||
|
migrationBuilder.DropPrimaryKey( |
||||
|
name: "PK_JobLog", |
||||
|
table: "JobLog"); |
||||
|
|
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_JobItem", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("c318a2b7-df89-4c68-aa3a-0e9c470d584f")); |
||||
|
|
||||
|
migrationBuilder.RenameTable( |
||||
|
name: "JobLog", |
||||
|
newName: "Set_JobLog"); |
||||
|
|
||||
|
migrationBuilder.RenameColumn( |
||||
|
name: "SessionId", |
||||
|
table: "Set_VmiLog", |
||||
|
newName: "VinCode"); |
||||
|
|
||||
|
migrationBuilder.RenameIndex( |
||||
|
name: "IX_JobLog_JobId", |
||||
|
table: "Set_JobLog", |
||||
|
newName: "IX_Set_JobLog_JobId"); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "BalanceDesc", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "CodeType", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<DateTime>( |
||||
|
name: "CreationTime", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "datetime2", |
||||
|
nullable: false, |
||||
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "D2", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "Desc", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "ErpToLoc", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "F2", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "G2", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "GroupId", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "H2", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "I2", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "J2", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "K2", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "LU", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "MatchNumber", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "PartCode", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "PjsNum", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "ProType", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<decimal>( |
||||
|
name: "Qty", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "decimal(18,2)", |
||||
|
nullable: false, |
||||
|
defaultValue: 0m); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "SeqNumber", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<DateTime>( |
||||
|
name: "ShippingDate", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "datetime2", |
||||
|
nullable: false, |
||||
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "Tmpe4", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "UniqueCode", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<int>( |
||||
|
name: "VmiType", |
||||
|
table: "Set_VmiLog", |
||||
|
type: "int", |
||||
|
nullable: false, |
||||
|
defaultValue: 0); |
||||
|
|
||||
|
migrationBuilder.AlterColumn<Guid>( |
||||
|
name: "JobId", |
||||
|
table: "Set_JobLog", |
||||
|
type: "uniqueidentifier", |
||||
|
nullable: false, |
||||
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), |
||||
|
oldClrType: typeof(Guid), |
||||
|
oldType: "uniqueidentifier", |
||||
|
oldNullable: true); |
||||
|
|
||||
|
migrationBuilder.AddPrimaryKey( |
||||
|
name: "PK_Set_JobLog", |
||||
|
table: "Set_JobLog", |
||||
|
column: "Id"); |
||||
|
|
||||
|
migrationBuilder.InsertData( |
||||
|
table: "Set_JobItem", |
||||
|
columns: new[] { "Id", "ConcurrencyStamp", "Cron", "IsRunning", "Name", "Service" }, |
||||
|
values: new object[] { new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"), null, "0 0 8 26 *", false, "库存快照", "Win.Sfs.SettleAccount.Entities.BQ.VmiService" }); |
||||
|
|
||||
|
migrationBuilder.InsertData( |
||||
|
table: "Set_VmiBalance", |
||||
|
columns: new[] { "Id", "CodeType", "CreationTime", "Desc", "ErpToLoc", "LU", "MatchNumber", "PartCode", "PjsNum", "ProType", "Qty", "SeqNumber", "ShippingDate", "Tmpe4", "UniqueCode", "VinCode" }, |
||||
|
values: new object[] { new Guid("cd6b8f09-2146-73d3-cade-4e832627b4f6"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "test", "key1", "key3", null, "key2", null, null, 0m, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, null, null }); |
||||
|
|
||||
|
migrationBuilder.InsertData( |
||||
|
table: "Set_VmiCategory", |
||||
|
columns: new[] { "Id", "Name", "Number", "Type" }, |
||||
|
values: new object[,] |
||||
|
{ |
||||
|
{ new Guid("a6462ee4-6e2c-bc8b-b1cb-5203c8dcaea8"), "发运", "100", 0 }, |
||||
|
{ new Guid("869f1589-9063-a545-719e-a83b6dca03c3"), "结算", "200", 1 }, |
||||
|
{ new Guid("c9199f7f-7cc8-7423-d608-f206167ae0b6"), "客户退货", "300", 1 }, |
||||
|
{ new Guid("5fda8ad4-f424-a9e1-8174-72c0f29fc225"), "调整入库", "400", 0 }, |
||||
|
{ new Guid("42230472-9f26-7484-ff2a-451878e9955f"), "调整出库", "500", 1 }, |
||||
|
{ new Guid("3e0655a6-2532-a861-344f-b9c53c809c64"), "漏发补货", "600", 0 }, |
||||
|
{ new Guid("27b1609e-05af-cef7-f5f4-dd598c31b4de"), "负库存补货", "700", 0 } |
||||
|
}); |
||||
|
|
||||
|
migrationBuilder.CreateIndex( |
||||
|
name: "IX_Set_VmiCategory_Name", |
||||
|
table: "Set_VmiCategory", |
||||
|
column: "Name", |
||||
|
unique: true); |
||||
|
|
||||
|
migrationBuilder.AddForeignKey( |
||||
|
name: "FK_Set_JobLog_Set_JobItem_JobId", |
||||
|
table: "Set_JobLog", |
||||
|
column: "JobId", |
||||
|
principalTable: "Set_JobItem", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.Cascade); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropForeignKey( |
||||
|
name: "FK_Set_JobLog_Set_JobItem_JobId", |
||||
|
table: "Set_JobLog"); |
||||
|
|
||||
|
migrationBuilder.DropIndex( |
||||
|
name: "IX_Set_VmiCategory_Name", |
||||
|
table: "Set_VmiCategory"); |
||||
|
|
||||
|
migrationBuilder.DropPrimaryKey( |
||||
|
name: "PK_Set_JobLog", |
||||
|
table: "Set_JobLog"); |
||||
|
|
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_JobItem", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824")); |
||||
|
|
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_VmiBalance", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("cd6b8f09-2146-73d3-cade-4e832627b4f6")); |
||||
|
|
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_VmiCategory", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("27b1609e-05af-cef7-f5f4-dd598c31b4de")); |
||||
|
|
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_VmiCategory", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("3e0655a6-2532-a861-344f-b9c53c809c64")); |
||||
|
|
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_VmiCategory", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("42230472-9f26-7484-ff2a-451878e9955f")); |
||||
|
|
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_VmiCategory", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("5fda8ad4-f424-a9e1-8174-72c0f29fc225")); |
||||
|
|
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_VmiCategory", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("869f1589-9063-a545-719e-a83b6dca03c3")); |
||||
|
|
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_VmiCategory", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("a6462ee4-6e2c-bc8b-b1cb-5203c8dcaea8")); |
||||
|
|
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_VmiCategory", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("c9199f7f-7cc8-7423-d608-f206167ae0b6")); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "BalanceDesc", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "CodeType", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "CreationTime", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "D2", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "Desc", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "ErpToLoc", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "F2", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "G2", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "GroupId", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "H2", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "I2", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "J2", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "K2", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "LU", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "MatchNumber", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "PartCode", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "PjsNum", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "ProType", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "Qty", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "SeqNumber", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "ShippingDate", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "Tmpe4", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "UniqueCode", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "VmiType", |
||||
|
table: "Set_VmiLog"); |
||||
|
|
||||
|
migrationBuilder.RenameTable( |
||||
|
name: "Set_JobLog", |
||||
|
newName: "JobLog"); |
||||
|
|
||||
|
migrationBuilder.RenameColumn( |
||||
|
name: "VinCode", |
||||
|
table: "Set_VmiLog", |
||||
|
newName: "SessionId"); |
||||
|
|
||||
|
migrationBuilder.RenameIndex( |
||||
|
name: "IX_Set_JobLog_JobId", |
||||
|
table: "JobLog", |
||||
|
newName: "IX_JobLog_JobId"); |
||||
|
|
||||
|
migrationBuilder.AlterColumn<Guid>( |
||||
|
name: "JobId", |
||||
|
table: "JobLog", |
||||
|
type: "uniqueidentifier", |
||||
|
nullable: true, |
||||
|
oldClrType: typeof(Guid), |
||||
|
oldType: "uniqueidentifier"); |
||||
|
|
||||
|
migrationBuilder.AddPrimaryKey( |
||||
|
name: "PK_JobLog", |
||||
|
table: "JobLog", |
||||
|
column: "Id"); |
||||
|
|
||||
|
migrationBuilder.InsertData( |
||||
|
table: "Set_JobItem", |
||||
|
columns: new[] { "Id", "ConcurrencyStamp", "Cron", "IsRunning", "Name", "Service" }, |
||||
|
values: new object[] { new Guid("c318a2b7-df89-4c68-aa3a-0e9c470d584f"), null, "0 0 8 26 *", false, "库存快照", "Win.Sfs.SettleAccount.Entities.BQ.VmiService" }); |
||||
|
|
||||
|
migrationBuilder.AddForeignKey( |
||||
|
name: "FK_JobLog_Set_JobItem_JobId", |
||||
|
table: "JobLog", |
||||
|
column: "JobId", |
||||
|
principalTable: "Set_JobItem", |
||||
|
principalColumn: "Id", |
||||
|
onDelete: ReferentialAction.SetNull); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
using System; |
||||
|
using System.Security.Cryptography; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Win.Sfs.Shared |
||||
|
{ |
||||
|
public static class SharedExtensions |
||||
|
{ |
||||
|
public static Guid ToGuid(this string input) |
||||
|
{ |
||||
|
var hash = MD5.HashData(Encoding.UTF8.GetBytes(input)); |
||||
|
return new Guid(hash); |
||||
|
} |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue