diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
index b378463d..654eb2ef 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
@@ -690,21 +690,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
// { version = $"{before.ToString()}11"; }
// else if (p_billtime >= lastYear.AddMonths(11) && p_billtime <= beforeYear)
// { version = $"{before.ToString()}12"; }
-
-
// if (string.IsNullOrEmpty(version))
// {
// return 200802;//找不到的数据默认写到这个区间
// }
// return int.Parse(version);
-
-
//}
-
-
-
-
private int GetVersionByBillTime(DateTime p_billtime, string p_day)
{
@@ -828,6 +820,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
seDetail.TransType = EnumDelTransType.发货;
seDetail.UID = 000;
seDetail.FactoryPartCode = item.RealPartCode;
+ seDetail.PartCode= item.RealPartCode;
+ seDetail.RealPartCode=item.RealPartCode;
seDetail.CustomerPartCodeNoSpace = item.RealPartCode.Replace("-", "");
seDetail.ErpToLoc = item.ErpToLoc;
seDetail.Qty = item.Qty;
@@ -861,6 +855,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
seDetail.TransType = EnumDelTransType.发货;
seDetail.UID = 000;
seDetail.FactoryPartCode = item.RealPartCode;
+ seDetail.PartCode = item.RealPartCode;
+ seDetail.RealPartCode = item.RealPartCode;
seDetail.CustomerPartCodeNoSpace = item.RealPartCode.Replace("-", "");
seDetail.ErpToLoc = item.ErpToLoc;
seDetail.Qty = item.Qty;
@@ -907,6 +903,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
seDetail.TransType = EnumDelTransType.发货;
seDetail.UID = 000;
seDetail.FactoryPartCode = item.RealPartCode;
+ seDetail.PartCode = item.RealPartCode;
+ seDetail.RealPartCode = item.RealPartCode;
seDetail.CustomerPartCodeNoSpace = item.RealPartCode.Replace("-", "");
seDetail.ErpToLoc = item.ErpToLoc;
seDetail.Qty = item.Qty;
@@ -919,7 +917,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
seDetails.Add(seDetail);
}
}
-
var result = await CheckBusinessJISLocation(seDetails, businessType).ConfigureAwait(false);
if (result != "ok")
{
@@ -953,6 +950,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
seDetail.SubBillType = 0;
seDetail.TransType = EnumDelTransType.发货;
seDetail.UID = 000;
+ seDetail.PartCode = item.RealPartCode;
+ seDetail.RealPartCode = item.RealPartCode;
seDetail.FactoryPartCode = item.RealPartCode;
seDetail.CustomerPartCodeNoSpace = item.RealPartCode.Replace("-", "");
seDetail.ErpToLoc = item.ErpToLoc;
@@ -998,6 +997,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
seDetail.SubBillType = 0;
seDetail.TransType = EnumDelTransType.发货;
seDetail.UID = 000;
+ seDetail.PartCode = item.RealPartCode;
+
seDetail.FactoryPartCode = item.RealPartCode;
seDetail.CustomerPartCodeNoSpace = item.RealPartCode.Replace("-", "");
seDetail.ToErpLocCode = item.ErpToLoc;
@@ -1005,6 +1006,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
seDetail.PN = item.VinCode;
seDetail.LU = item.CustPartCode;
seDetail.CustPartCode = item.CustPartCode;
+
+ seDetail.PartCode = item.RealPartCode;
seDetail.BillTime = DateTime.Now;
seDetail.Remark = "期初初始化";
seDetails.Add(seDetail);
@@ -1042,6 +1045,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
seDetail.SubBillType = 0;
seDetail.TransType = EnumDelTransType.发货;
seDetail.UID = 000;
+ seDetail.PartCode = item.RealPartCode;
+
seDetail.FactoryPartCode = item.RealPartCode;
seDetail.CustomerPartCodeNoSpace = item.RealPartCode.Replace("-", "");
seDetail.ToErpLocCode = item.ErpToLoc;
@@ -1086,6 +1091,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
seDetail.SubBillType = 0;
seDetail.TransType = EnumDelTransType.发货;
seDetail.UID = 000;
+ seDetail.PartCode = item.RealPartCode;
seDetail.FactoryPartCode = item.RealPartCode;
seDetail.CustomerPartCodeNoSpace = item.RealPartCode.Replace("-", "");
seDetail.ToErpLocCode = item.ErpToLoc;
@@ -1131,6 +1137,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
seDetail.TransType = EnumDelTransType.发货;
seDetail.UID = 000;
seDetail.FactoryPartCode = item.RealPartCode;
+ seDetail.PartCode = item.RealCode;
seDetail.CustomerPartCodeNoSpace = item.RealPartCode.Replace("-", "");
seDetail.ToErpLocCode = item.ErpToLoc;
seDetail.Qty = item.Qty;
@@ -1167,7 +1174,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
///
private async Task BeginTran(List p_list, List logList) where T : SE_BASE, new()
{
-
//var messageList = logList.Select(log => new VmiMessage { Message = JsonSerializer.Serialize(log) }).ToList();
var connectionString = this._serviceProvider.GetRequiredService().GetConnectionString("SettleAccountService");
var options = new DbContextOptionsBuilder().UseSqlServer(connectionString).Options;
@@ -1190,7 +1196,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
itm.Version= GetVersionByBillTime(itm.ShippingDate, value);
}
-
await context.BulkInsertAsync(p_list).ConfigureAwait(false);
await context.BulkInsertAsync(logList).ConfigureAwait(false);
transaction.Commit();
@@ -1237,7 +1242,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
p.Value == "JisHBPO"
).ToList();
break;
-
case EnumBusinessType.MaiDanJianHBPO:
locList = locList.Where(p => p.Value == "MaiDanJianHBPO").ToList();
break;
@@ -1278,7 +1282,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var locList = _codeRepository.Where(p => p.Project == "库位").ToList();
switch (enumBusinessType)
{
-
case EnumBusinessType.ZhiGongJianBBAC:
locList = locList.Where(p => p.Value == "ZhiGongJianBBAC顺义" || p.Value == "ZhiGongJianBBAC").ToList();
break;
@@ -1291,11 +1294,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
case EnumBusinessType.YinDuJian:
locList = locList.Where(p => p.Value == "YinDuJian").ToList();
break;
-
}
var locs = locList.Select(p => p.Description).ToList();
if (p_list.Any(p => !locs.Contains(p.ToErpLocCode)))
{
+
+
return "发运数据有不在" + string.Join(",", locs) + "库位中";
}
@@ -1342,6 +1346,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
var logList = tupleList.Select(o => o.Item1).ToList();
logList.AsParallel().ForEach(Update);
+
+
+
+
//List seDetails = new List();
//List hbpo_seDetails=new List();
//List pub_seDetails=new List();
@@ -1724,7 +1732,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
catch (Exception ex)
{
this._logger.LogError(ex.ToString());
- return new JsonResult(new { code = 500, data = ex.ToString(), message = ex.Message }); ;
+ return new JsonResult(new { code = 500, data = ex.ToString(), message = ex.Message });
}
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/ML_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/ML_MNG.cs
new file mode 100644
index 00000000..c15a3c94
--- /dev/null
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/ML_MNG.cs
@@ -0,0 +1,78 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.ML;
+using SettleAccount.Domain.BQ;
+using Win.Sfs.Shared.RepositoryBase;
+
+namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
+{
+ public class ML_MNG
+ {
+ private readonly INormalEfCoreRepository _canRepository;
+ private readonly INormalEfCoreRepository _saRepository;
+ public ML_MNG(
+ INormalEfCoreRepository canRepository,
+ INormalEfCoreRepository saRepository
+ )
+ {
+ _canRepository = canRepository;
+ _saRepository = saRepository;
+ }
+ //public async Task Load(string p_load)
+ //{
+ // var mlContext = new MLContext();
+ // mlContext.Regression.Trainers.OnlineGradientDescent
+ // var trainer = mlContext.Regression.Trainers.FastTreeTweedie(labelColumnName: "Label", featureColumnName: "Features");
+ // var trainingPipeline = mlContext.Transforms.Concatenate(outputColumnName: "NumFeatures", nameof(ProductData.year), nameof(ProductData.month), nameof(ProductData.units), nameof(ProductData.avg), nameof(ProductData.count),
+ // nameof(ProductData.max), nameof(ProductData.min), nameof(ProductData.prev))
+ // .Append(mlContext.Transforms.Categorical.OneHotEncoding(outputColumnName: "CatFeatures", inputColumnName: nameof(ProductData.productId)))
+ // .Append(mlContext.Transforms.Concatenate(outputColumnName: "Features", "NumFeatures", "CatFeatures"))
+ // .Append(mlContext.Transforms.CopyColumns(outputColumnName: "Label", inputColumnName: nameof(ProductData.next)))
+ // .Append(trainer);
+ // var crossValidationResults = mlContext.Regression.CrossValidate(data: trainingDataView, estimator: trainingPipeline, numberOfFolds: 6, labelColumnName: "Label");
+ // //ConsoleHelper.PrintRegressionFoldsAverageMetrics(trainer.ToString(), crossValidationResults);
+ // var model = trainingPipeline.Fit(trainingDataView);
+ //}
+
+ //public Task LoadSampleAsync(string name) {
+
+ // //// MLContext mlContext = new MLContext();
+ // ////var mlContext = new MLContext(seed: 0);
+ // ////IDataView data1View = mlContext.Data.LoadFromTextFile(_data1Path, separatorChar: ',', hasHeader: false);
+ // ////IDataView data2View = mlContext.Data.LoadFromTextFile(_data2Path, separatorChar: ',', hasHeader: false);
+ // //var ls=_canRepository.ToList();
+ // //var mlContext = new MLContext(seed: 0);
+
+ // //// Load data
+ // //IDataView data = mlContext.Data.lo
+
+
+ // // LoadFromTextFile("house-prices.csv", hasHeader: true, separatorChar: ',');
+
+ // //// Define pipeline
+
+
+
+ // //var pipeline = mlContext.Transforms.Concatenate("Features", new[] { "Size" })
+ // // .Append(mlContext.Regression.Trainers.LbfgsPoissonRegression());
+
+ // //// Train model
+ // //var model = pipeline.Fit(data);
+
+ // //// Make prediction
+ // //var predictionEngine = mlContext.Model.CreatePredictionEngine(model);
+ // //var house = new HouseData() { Size = 1500 };
+ // //var prediction = predictionEngine.Predict(house);
+
+ // //Console.WriteLine($"Predicted price for a house with size {house.Size}: {prediction.Price}");
+
+
+ //}
+
+
+
+ }
+}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/SettleAccount.Domain.csproj b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/SettleAccount.Domain.csproj
index fd274007..25a390e8 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/SettleAccount.Domain.csproj
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/SettleAccount.Domain.csproj
@@ -35,6 +35,7 @@
+