16 changed files with 10421 additions and 7 deletions
@ -0,0 +1,112 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Coravel.Invocable; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using SettleAccount.Domain.BQ; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
||||
|
using Win.Sfs.SettleAccount.Entities.Prices; |
||||
|
using Win.Sfs.SettleAccount.EntityFrameworkCore; |
||||
|
using Win.Sfs.Shared.RepositoryBase; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BQ; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// HBPO发运数据同步服务
|
||||
|
/// </summary>
|
||||
|
[AllowAnonymous] |
||||
|
[Route("api/settleaccount/[controller]/[action]")]
|
||||
|
public class HBPOSeSyncAppService : ApplicationService, IInvocable //IJobService
|
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// WMS数据上下文
|
||||
|
/// </summary>
|
||||
|
private readonly WMSBJBMPTDbContext _wmsBJBMPTContext; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// HBPO发运数据仓储
|
||||
|
/// </summary>
|
||||
|
private readonly INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> _hbpoSeDetailRepository; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 构造
|
||||
|
/// </summary>
|
||||
|
public HBPOSeSyncAppService( |
||||
|
WMSBJBMPTDbContext wmsBJBMPTContext, |
||||
|
INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> hbpoSeDetailRepository) |
||||
|
{ |
||||
|
_wmsBJBMPTContext = wmsBJBMPTContext; |
||||
|
_hbpoSeDetailRepository = hbpoSeDetailRepository; |
||||
|
} |
||||
|
|
||||
|
//private readonly IRepository<TM_BJBMPT_JIT_RECORD> _TMBJBMPTJITRECORDRepository;
|
||||
|
|
||||
|
//public HBPOSeSyncAppService(IRepository<TM_BJBMPT_JIT_RECORD> TMBJBMPTJITRECORDRepository)
|
||||
|
//{
|
||||
|
// _TMBJBMPTJITRECORDRepository = TMBJBMPTJITRECORDRepository;
|
||||
|
//}
|
||||
|
|
||||
|
[HttpPost] |
||||
|
public async Task Invoke() |
||||
|
{ |
||||
|
//using var dbContext = new WMSBJBMPTDbContext();
|
||||
|
var TM_BJBMPT_JIT_RECORDs = _wmsBJBMPTContext.TM_BJBMPT_JIT_RECORD |
||||
|
.Where(b => b.UID > 3) |
||||
|
.OrderBy(b => b.BillTime) |
||||
|
.ToList(); |
||||
|
|
||||
|
var hbpoSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<HBPO_SE_DETAIL>>(TM_BJBMPT_JIT_RECORDs); |
||||
|
|
||||
|
_hbpoSeDetailRepository.InsertManyAsync(hbpoSeDetails); |
||||
|
|
||||
|
//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();
|
||||
|
//}
|
||||
|
|
||||
|
|
||||
|
//using (var context = new HouseDbContext(optionsBuilder.Options))
|
||||
|
//{
|
||||
|
// var one = context.Notices.FirstOrDefault(n => n.Id == notice.Id);
|
||||
|
// // 当然你也可以直接初始化其他的Service
|
||||
|
// var nService = new NoticeService(context, null);
|
||||
|
// var one = nService.FindOne(notice.Id);
|
||||
|
//}
|
||||
|
|
||||
|
|
||||
|
|
||||
|
//var TM_BJBMPT_JIT_RECORDs = _wmsBJBMPTContext.TM_BJBMPT_JIT_RECORD
|
||||
|
// .Where(b => b.UID > 3)
|
||||
|
// .OrderBy(b => b.BillTime)
|
||||
|
// .ToList();
|
||||
|
//foreach (var TM_BJBMPT_JIT_RECORD in TM_BJBMPT_JIT_RECORDs)
|
||||
|
//{
|
||||
|
// Console.WriteLine($"{TM_BJBMPT_JIT_RECORD.UID}");
|
||||
|
//}
|
||||
|
|
||||
|
//using (var db = new WMSBJBMPTDbContext())
|
||||
|
//{
|
||||
|
// var blogs = db.TM_BJBMPT_JIT_RECORD
|
||||
|
// .Where(b => b.UID > 3)
|
||||
|
// .OrderBy(b => b.BillTime)
|
||||
|
// .ToList();
|
||||
|
|
||||
|
// foreach (var blog in blogs)
|
||||
|
// {
|
||||
|
// Console.WriteLine($"{blog.UID}");
|
||||
|
// }
|
||||
|
//}
|
||||
|
Console.WriteLine($"{this.GetType().FullName}执行了"); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Volo.Abp.Domain.Entities.Auditing; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 同步位置标记
|
||||
|
/// </summary>
|
||||
|
public class SyncPositionFlag : AuditedAggregateRoot<Guid> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 表名称
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "表名称")] |
||||
|
public string TableName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 位置(可排序)
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "位置")] |
||||
|
public string Position { get; set; } |
||||
|
} |
@ -0,0 +1,125 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BQ; |
||||
|
public class TM_BJBMPT_JIT_RECORD |
||||
|
{ |
||||
|
[Key] |
||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
||||
|
public int UID { get; set; } |
||||
|
|
||||
|
[DisplayName("JIT订单号")] |
||||
|
public string JISNum { get; set; } |
||||
|
|
||||
|
[DisplayName("JIT排序生产码")] |
||||
|
public string VinCode { get; set; } |
||||
|
|
||||
|
[DisplayName("JIT排序生产码类型")] |
||||
|
public string CodeType { get; set; } |
||||
|
|
||||
|
[DisplayName("订单零件号")] |
||||
|
public string PartCode { get; set; } |
||||
|
|
||||
|
[DisplayName("订单零件号")] |
||||
|
public string RealPartCode { get; set; } |
||||
|
|
||||
|
[DisplayName("订单序号")] |
||||
|
public string Seq { get; set; } |
||||
|
|
||||
|
[DisplayName("发货条码")] |
||||
|
public string DeliverCode { get; set; } |
||||
|
|
||||
|
[DisplayName("数量")] |
||||
|
public decimal? Qty { get; set; } |
||||
|
|
||||
|
[DisplayName("发货单号")] |
||||
|
public string BillNum { get; set; } |
||||
|
|
||||
|
[DisplayName("发货时间")] |
||||
|
public DateTime? BillTime { get; set; } |
||||
|
|
||||
|
[DisplayName("发货人")] |
||||
|
public string Oper { get; set; } |
||||
|
|
||||
|
[DisplayName("客户位置")] |
||||
|
public string Position { get; set; } |
||||
|
|
||||
|
public string MESConfigCode { get; set; } |
||||
|
|
||||
|
[DisplayName("生产线")] |
||||
|
public string Line { get; set; } |
||||
|
|
||||
|
[DisplayName("目标库位")] |
||||
|
public string ToLoc { get; set; } |
||||
|
|
||||
|
[DisplayName("备注")] |
||||
|
public string Remark { get; set; } |
||||
|
|
||||
|
//[DisplayName("单据类型")]
|
||||
|
//public EnumBillType BillType { get; set; }
|
||||
|
|
||||
|
//[DisplayName("子单据类型")]
|
||||
|
//public EnumSubBillType SubBillType { get; set; }
|
||||
|
|
||||
|
public int? TransType { get; set; } |
||||
|
|
||||
|
public int? DeliverBillType { get; set; } |
||||
|
|
||||
|
public int? DeliverSubBillType { get; set; } |
||||
|
|
||||
|
[DisplayName("单据性质")] |
||||
|
public string BillCharacter { get; set; } |
||||
|
|
||||
|
//[DisplayName("业务类型")]
|
||||
|
//public EnumProTpe ProType { get; set; }
|
||||
|
|
||||
|
public string OrderNum { get; set; } |
||||
|
|
||||
|
public string RealCode { get; set; } |
||||
|
|
||||
|
public string FromLoc { get; set; } |
||||
|
|
||||
|
public string RefBillNum { get; set; } |
||||
|
|
||||
|
public string ErpToLoc { get; set; } |
||||
|
|
||||
|
public string UniqueCode { get; set; } |
||||
|
|
||||
|
public string PjsNum { get; set; } |
||||
|
|
||||
|
public string MatchNumber { get; set; } |
||||
|
|
||||
|
public string RefVinCode { get; set; } |
||||
|
} |
||||
|
|
||||
|
public enum EnumProTpe |
||||
|
{ |
||||
|
无 = 0, |
||||
|
Jit发货 = 1, |
||||
|
Jit补发订单 = 2, |
||||
|
Jit备件 = 3, |
||||
|
Jit买单件 = 4, |
||||
|
Jit匹配件 = 5, |
||||
|
Jis发货 = 6, |
||||
|
Jis备件 = 7, |
||||
|
Jis买单件 = 8, |
||||
|
Jis匹配件 = 9, |
||||
|
Jis补发订单 = 10, |
||||
|
Jis退货 = 11, |
||||
|
Jis备件退货 = 12, |
||||
|
Jis买单件退货 = 13, |
||||
|
Jis匹配件退货 = 14, |
||||
|
Jis补发订单退货 = 15, |
||||
|
Jit退货 = 16, |
||||
|
Jit备件退货 = 17, |
||||
|
Jit买单件退货 = 18, |
||||
|
Jit匹配件退货 = 19, |
||||
|
Jit补发订单退货 = 20, |
||||
|
} |
||||
|
|
||||
|
public enum EnumBillType { } |
||||
|
|
||||
|
public enum EnumSubBillType { } |
||||
|
|
@ -0,0 +1,37 @@ |
|||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.Data; |
||||
|
using Win.Sfs.SettleAccount.Entities.BQ; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.EntityFrameworkCore; |
||||
|
|
||||
|
[ConnectionStringName("WMSBJBMPT")] |
||||
|
public class WMSBJBMPTDbContext : DbContext |
||||
|
{ |
||||
|
public DbSet<TM_BJBMPT_JIT_RECORD> TM_BJBMPT_JIT_RECORD { get; set; } |
||||
|
|
||||
|
public WMSBJBMPTDbContext() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
public WMSBJBMPTDbContext(DbContextOptions<WMSBJBMPTDbContext> options) : base(options) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
//protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
|
//{
|
||||
|
// if (!optionsBuilder.IsConfigured)
|
||||
|
// {
|
||||
|
// IConfiguration config = new ConfigurationBuilder()
|
||||
|
// .SetBasePath(Directory.GetCurrentDirectory())
|
||||
|
// .AddJsonFile("appsettings.json")
|
||||
|
// .Build();
|
||||
|
// var ConnectStr = config.GetConnectionString("WMSBJBMPT");
|
||||
|
// optionsBuilder.UseSqlServer(ConnectStr);
|
||||
|
// }
|
||||
|
//}
|
||||
|
|
||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder) |
||||
|
{ |
||||
|
base.OnModelCreating(modelBuilder); |
||||
|
} |
||||
|
} |
File diff suppressed because it is too large
@ -0,0 +1,24 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Migrations |
||||
|
{ |
||||
|
public partial class _202307262 : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.InsertData( |
||||
|
table: "Set_JobItem", |
||||
|
columns: new[] { "Id", "ConcurrencyStamp", "Cron", "IsRunning", "Name", "Service" }, |
||||
|
values: new object[] { new Guid("92cce083-20a8-5335-31ea-e390c57cac1f"), null, "0 0/1 * * * ?", false, "HBPO发运数据同步", "Win.Sfs.SettleAccount.Entities.BQ.HBPOSeSyncAppService" }); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_JobItem", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("92cce083-20a8-5335-31ea-e390c57cac1f")); |
||||
|
} |
||||
|
} |
||||
|
} |
File diff suppressed because it is too large
@ -0,0 +1,34 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Migrations |
||||
|
{ |
||||
|
public partial class _202307263 : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_JobItem", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("92cce083-20a8-5335-31ea-e390c57cac1f")); |
||||
|
|
||||
|
migrationBuilder.InsertData( |
||||
|
table: "Set_JobItem", |
||||
|
columns: new[] { "Id", "ConcurrencyStamp", "Cron", "IsRunning", "Name", "Service" }, |
||||
|
values: new object[] { new Guid("d50400b0-b0d4-38d1-fcdf-b1e7ac1d3a68"), null, "0 0/1 * * * ?", false, "HBPO发运数据同步", "Win.Sfs.SettleAccount.Entities.BQ.HBPOSeSyncAppService" }); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_JobItem", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("d50400b0-b0d4-38d1-fcdf-b1e7ac1d3a68")); |
||||
|
|
||||
|
migrationBuilder.InsertData( |
||||
|
table: "Set_JobItem", |
||||
|
columns: new[] { "Id", "ConcurrencyStamp", "Cron", "IsRunning", "Name", "Service" }, |
||||
|
values: new object[] { new Guid("92cce083-20a8-5335-31ea-e390c57cac1f"), null, "0 0/1 * * * ?", false, "HBPO发运数据同步", "Win.Sfs.SettleAccount.Entities.BQ.HBPOSeSyncAppService" }); |
||||
|
} |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue