44673626 3 years ago
parent
commit
c539fac6d2
  1. 7
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSHQFKanbanAppService.cs
  2. 37
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSHQFSharePartAppService .cs
  3. 4
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSHQHKanbanAppService.cs
  4. 41
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSHQHSharePartAppService.cs
  5. 4
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs
  6. 4
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs
  7. 4
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs
  8. 4
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQMKanbanAppService.cs
  9. 36
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQMSharePartAppService.cs
  10. 2
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  11. 21
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
  12. 17
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs
  13. 4
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs
  14. 32
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/SettleAccounts/SettleAccountRepository.cs
  15. 130
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs

7
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSHQFKanbanAppService.cs

@ -254,7 +254,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
var _list = _excelHelper.ExcelToList<WmsHQFKanbanOutPutDetial>();
foreach (var itm in _list)
{
itm.SetData(GuidGenerator.Create(),string.Empty,!string.IsNullOrEmpty(itm.WmsBillNum)? itm.WmsBillNum:string.Empty,input.Version,GuidGenerator.Create());
itm.SetData(GuidGenerator.Create(), string.Empty, !string.IsNullOrEmpty(itm.WmsBillNum) ? itm.WmsBillNum : string.Empty, input.Version, GuidGenerator.Create());
}
_lst.AddRange(_list.ToArray());
}
@ -263,9 +263,9 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
var error = from itm1 in outPutDetail
join itm2 in _lst on
new { itm1.MaterialCode, itm1.Kanban,itm1.PoLine }
new { itm1.MaterialCode, itm1.Kanban, itm1.PoLine }
equals
new { itm2.MaterialCode, itm2.Kanban,itm2.PoLine }
new { itm2.MaterialCode, itm2.Kanban, itm2.PoLine }
select itm1;
var errList = error.GroupBy(p => new { p.BillNum }).Select(p => new { BillNum = p.Key.BillNum, Number = p.Sum(itm => itm.Qty) });
if (errList.Count() == 0)
@ -380,7 +380,6 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
sql
);
}
return true;

37
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSHQFSharePartAppService .cs

@ -170,7 +170,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
itm.TaskId,
itm.Remark,
itm.Qty,
tm1 == null ? 0 : tm1.Qty
tm1 == null ? 0 : tm1.Qty,
itm.OutPutQty
);
return new PagedResultDto<WmsHQFSharePartOutPutDetial>(totalCount, entities);
}
@ -236,7 +237,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
GuidGenerator.Create(),
string.Empty,
p.Qty,
p.StockQty
p.StockQty,
p.Qty
));
_lst.AddRange(_lsAry.ToArray());
}
@ -296,7 +298,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
"SELECT 'Return Value' = @return_value";
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
string.Format(sql, input.BillNum,input.AccountDate));
string.Format(sql, input.BillNum,input.AccountDate.ToShortDateString()));
}
}
@ -329,7 +331,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
" @accountdate = N'{2}'\n" +
"SELECT 'Return Value' = @return_value";
sql = string.Format(sql, str, input.BillNum, input.AccountDate);
sql = string.Format(sql, str, input.BillNum, input.AccountDate.ToShortDateString());
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
sql
@ -337,6 +339,32 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
}
return true;
}
/// <summary>
/// 任务明细标记已确认
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpPost]
[Route("WmsSharePartOutPutModify")]
[DisableRequestSizeLimit]
public async Task<bool> WmsSharePartUpdate(WmsHQHSharePartOutPutDetial detial)
{
var _entityList = _wmsRepository.Where(p => p.Id == detial.Id).ToList();
if (_entityList.Count() > 0)
{
foreach (var itm in _entityList)
{
itm.OutPutQty = detial.OutPutQty;
await _wmsRepository.UpdateAsync(itm);
}
}
return true;
}
[HttpPost]
[Route("ExcelImport")]
[DisableRequestSizeLimit]
@ -370,6 +398,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
, string.Empty
, itm.Qty
,0
,itm.Qty
);
_lsCopy.Add(_detail);
}

4
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSHQHKanbanAppService.cs

@ -339,7 +339,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
" @date = N'{1}'\n" +
"SELECT 'Return Value' = @return_value";
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
string.Format(sql, input.BillNum, input.AccountDate)
string.Format(sql, input.BillNum, input.AccountDate.ToShortDateString())
);
@ -375,7 +375,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
" @accountdate = N'{2}'\n" +
"SELECT 'Return Value' = @return_value";
sql = string.Format(sql, str, input.BillNum, input.AccountDate);
sql = string.Format(sql, str, input.BillNum, input.AccountDate.ToShortDateString());
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
sql

41
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSHQHSharePartAppService.cs

@ -170,7 +170,8 @@ into temp1
itm.TaskId,
itm.Remark,
itm.Qty,
tm1==null?0:tm1.Qty
tm1==null?0:tm1.Qty,
itm.OutPutQty
);
@ -198,6 +199,35 @@ into temp1
return true;
}
/// <summary>
/// 任务明细标记已确认
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpPost]
[Route("WmsSharePartOutPutModify")]
[DisableRequestSizeLimit]
public async Task<bool> WmsSharePartUpdate(WmsHQHSharePartOutPutDetial detial)
{
var _entityList= _wmsRepository.Where(p => p.Id == detial.Id).ToList();
if (_entityList.Count() > 0)
{
foreach (var itm in _entityList)
{
itm.OutPutQty = detial.OutPutQty;
await _wmsRepository.UpdateAsync(itm);
}
}
return true;
}
/// <summary>
/// 选择任务,生成出库单,只包含已确认的单据
/// </summary>
@ -240,7 +270,8 @@ into temp1
GuidGenerator.Create(),
string.Empty,
p.Qty,
p.StockQty
p.StockQty,
p.Qty
));
_lst.AddRange(_lsAry.ToArray());
}
@ -319,8 +350,7 @@ into temp1
" @date = N'{1}',\n"+
"SELECT 'Return Value' = @return_value";
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
string.Format(sql, input.BillNum,input.AccountDate));
string.Format(sql, input.BillNum,input.AccountDate.ToShortDateString()));
}
}
return true;
@ -352,7 +382,7 @@ into temp1
" @accountdate = N'{2}'\n" +
"SELECT 'Return Value' = @return_value";
sql = string.Format(sql, str, input.BillNum, input.AccountDate);
sql = string.Format(sql, str, input.BillNum, input.AccountDate.ToShortDateString());
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
sql
@ -393,6 +423,7 @@ into temp1
, string.Empty
, itm.Qty
,0
,itm.Qty
);
_lsCopy.Add(_detail);
}

4
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs

@ -417,7 +417,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
" @date = N'{1}'\n"+
"SELECT 'Return Value' = @return_value";
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
string.Format(sql,input.BillNum,input.AccountDate)
string.Format(sql,input.BillNum,input.AccountDate.ToShortDateString())
);
@ -455,7 +455,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
" @accountdate = N'{2}'\n" +
"SELECT 'Return Value' = @return_value";
sql= string.Format(sql, str, input.BillNum, input.AccountDate);
sql= string.Format(sql, str, input.BillNum, input.AccountDate.ToShortDateString());
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
sql

4
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs

@ -395,7 +395,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
" @date = N'{1}'\n" +
"SELECT 'Return Value' = @return_value";
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
string.Format(sql, input.BillNum));
string.Format(sql, input.BillNum,input.AccountDate.ToShortDateString()));
}
}
@ -429,7 +429,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
" @accountdate = N'{2}'\n" +
"SELECT 'Return Value' = @return_value";
sql = string.Format(sql, str, input.BillNum, input.AccountDate);
sql = string.Format(sql, str, input.BillNum, input.AccountDate.ToShortDateString());
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
sql

4
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs

@ -319,7 +319,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
" @date = N'{1}'\n" +
"SELECT 'Return Value' = @return_value";
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
string.Format(sql, input.BillNum));
string.Format(sql, input.BillNum,input.AccountDate.ToShortDateString()));
}
}
@ -353,7 +353,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
" @accountdate = N'{2}'\n" +
"SELECT 'Return Value' = @return_value";
sql = string.Format(sql, str, input.BillNum, input.AccountDate);
sql = string.Format(sql, str, input.BillNum, input.AccountDate.ToShortDateString());
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
sql

4
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQMKanbanAppService.cs

@ -257,7 +257,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
" @date = N'{1}'\n" +
"SELECT 'Return Value' = @return_value";
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
string.Format(sql, input.BillNum, input.AccountDate)
string.Format(sql, input.BillNum, input.AccountDate.ToShortDateString())
);
@ -293,7 +293,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
" @accountdate = N'{2}'\n" +
"SELECT 'Return Value' = @return_value";
sql = string.Format(sql, str, input.BillNum, input.AccountDate);
sql = string.Format(sql, str, input.BillNum, input.AccountDate.ToShortDateString());
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
sql

36
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQMSharePartAppService.cs

@ -150,6 +150,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
itm.Remark,
itm.Qty,
tm1 == null ? 0 : tm1.Qty
,itm.OutPutQty
);
@ -219,7 +220,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
GuidGenerator.Create(),
string.Empty,
p.Qty,
p.StockQty
p.StockQty,
p.Qty
));
_lst.AddRange(_lsAry.ToArray());
}
@ -298,12 +301,38 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
" @date = N'{1}',\n" +
"SELECT 'Return Value' = @return_value";
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
string.Format(sql, input.BillNum,input.AccountDate));
string.Format(sql, input.BillNum,input.AccountDate.ToShortDateString()));
}
}
return true;
}
/// <summary>
/// 任务明细标记已确认
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpPost]
[Route("WmsSharePartOutPutModify")]
[DisableRequestSizeLimit]
public async Task<bool> WmsSharePartUpdate(WmsHQHSharePartOutPutDetial detial)
{
var _entityList = _wmsRepository.Where(p => p.Id == detial.Id).ToList();
if (_entityList.Count() > 0)
{
foreach (var itm in _entityList)
{
itm.OutPutQty = detial.OutPutQty;
await _wmsRepository.UpdateAsync(itm);
}
}
return true;
}
/// <summary>
///出库界面功能, 撤销核准出库
/// </summary>
@ -331,7 +360,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
" @accountdate = N'{2}'\n" +
"SELECT 'Return Value' = @return_value";
sql = string.Format(sql, str, input.BillNum, input.AccountDate);
sql = string.Format(sql, str, input.BillNum, input.AccountDate.ToShortDateString());
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
sql
@ -372,6 +401,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
, string.Empty
, itm.Qty
, 0
,itm.Qty
);
_lsCopy.Add(_detail);
}

2
src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs

@ -33,7 +33,7 @@ using Win.Sfs.SettleAccount.Reports.ReportRequestDto;
namespace Win.Sfs.SettleAccount.Reports.ReportServices
{
[Authorize(SettleAccountPermissions.Reports.Default)]
//[AllowAnonymous]
[Route("api/settleaccount/ReportMakeService")]
public class ReportService : ApplicationService
{

21
src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml

@ -1805,6 +1805,13 @@
<param name="version"></param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.SettleAccounts.WMSHQFSharePartAppService.WmsSharePartUpdate(Win.Sfs.SettleAccount.Entities.WMS.WmsHQHSharePartOutPutDetial)">
<summary>
任务明细标记已确认
</summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="T:Win.Sfs.SettleAccount.Entities.SettleAccounts.WmsHQHKanbanAppService">
<summary>
红旗H平台准时化-出库
@ -1901,6 +1908,13 @@
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.SettleAccounts.WmsHQHSharePartAppService.WmsSharePartUpdate(Win.Sfs.SettleAccount.Entities.WMS.WmsHQHSharePartOutPutDetial)">
<summary>
任务明细标记已确认
</summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.SettleAccounts.WmsHQHSharePartAppService.WmsSharePartOutPut(Win.Sfs.SettleAccount.Entities.Wms.WmsJitRequestDto)">
<summary>
选择任务,生成出库单,只包含已确认的单据
@ -2851,6 +2865,13 @@
<param name="p_list"></param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS.WmsHQMSharePartAppService.WmsSharePartUpdate(Win.Sfs.SettleAccount.Entities.WMS.WmsHQHSharePartOutPutDetial)">
<summary>
任务明细标记已确认
</summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS.WmsHQMSharePartAppService.WmsSharePartOutPutCancel(Win.Sfs.SettleAccount.Entities.Wms.WmsJitRequestDto)">
<summary>
出库界面功能, 撤销核准出库

17
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs

@ -470,7 +470,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
public WmsHQMSharePartOutPutDetial()
{
}
public WmsHQMSharePartOutPutDetial(Guid id, string wmsBillNum, string orderBillNum, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty, decimal stockQty)
public WmsHQMSharePartOutPutDetial(Guid id, string wmsBillNum, string orderBillNum, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty, decimal stockQty,decimal outputQty)
{
Id = id;
WmsBillNum = wmsBillNum;
@ -490,6 +490,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
Remark = remark;
Qty = qty;
StockQty = stockQty;
OutPutQty = outputQty;
}
public void SetId(Guid id)
{
@ -545,6 +546,8 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
public string BillNum { set; get; }
[ImporterHeader(Name = "任务ID", IsIgnore = true)]
public Guid TaskId { set; get; }
[ImporterHeader(Name = "出库数量", IsIgnore = true)]
public decimal OutPutQty { set; get; }
}
#endregion
@ -824,7 +827,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
public WmsHQFSharePartOutPutDetial()
{
}
public WmsHQFSharePartOutPutDetial(Guid id, string wmsBillNum, string orderBillNum, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty, decimal stockQty)
public WmsHQFSharePartOutPutDetial(Guid id, string wmsBillNum, string orderBillNum, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty, decimal stockQty,decimal outPutQty)
{
Id = id;
WmsBillNum = wmsBillNum;
@ -844,6 +847,8 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
Remark = remark;
Qty = qty;
StockQty = stockQty;
OutPutQty = outPutQty;
}
public void SetId(Guid id)
{
@ -899,6 +904,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
public string BillNum { set; get; }
[ImporterHeader(Name = "任务ID", IsIgnore = true)]
public Guid TaskId { set; get; }
[ImporterHeader(Name = "出库数量", IsIgnore = true)]
public decimal OutPutQty { set; get; }
}
@ -1054,7 +1062,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
public WmsHQHSharePartOutPutDetial()
{
}
public WmsHQHSharePartOutPutDetial(Guid id, string wmsBillNum, string orderBillNum, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty,decimal stockQty)
public WmsHQHSharePartOutPutDetial(Guid id, string wmsBillNum, string orderBillNum, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty,decimal stockQty,decimal outputQty)
{
Id = id;
WmsBillNum = wmsBillNum;
@ -1074,6 +1082,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
Remark = remark;
Qty = qty;
StockQty = stockQty;
OutPutQty = outputQty;
}
public void SetId(Guid id)
{
@ -1129,6 +1138,8 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
public string BillNum { set; get; }
[ImporterHeader(Name = "任务ID", IsIgnore = true)]
public Guid TaskId { set; get; }
[ImporterHeader(Name = "出库数量", IsIgnore = true)]
public decimal OutPutQty { set; get; }
}

4
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs

@ -70,13 +70,9 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public override decimal Price { set; get; }
[ExporterHeader(DisplayName = "金额") ]
public override decimal Amt { set; get; }
//发运数量
[ExporterHeader(DisplayName = "M100数量")]
public decimal Qty { set; get; }
//结算数量
[ExporterHeader(DisplayName = "结算数量")]
public decimal SettledQty { set; get; }

32
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/SettleAccounts/SettleAccountRepository.cs

@ -106,24 +106,24 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccount
try
{
DbContext.Database.SetCommandTimeout(1200);
List<Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccount> _insertls = new List<Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccount>();
if (list.Count > 0)
{
var _version = list.FirstOrDefault().Version;
var _ls= GetQueryable().Where(p => p.Version == _version).Select(p=>new { MaterialCode=p.MaterialCode, ChassisNumber=p.ChassisNumber }).ToList();
var _query = from r1 in list join r2 in _ls on new { r1.ChassisNumber, r1.MaterialCode } equals new { r2.ChassisNumber, r2.MaterialCode }
into temp from t in temp.DefaultIfEmpty()
where t==null
select r1 ;
foreach (var s in _query.ToList())
{
_insertls.Add(s);
}
}
//List<Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccount> _insertls = new List<Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccount>();
//if (list.Count > 0)
//{
// var _version = list.FirstOrDefault().Version;
// var _ls= GetQueryable().Where(p => p.Version == _version).Select(p=>new { MaterialCode=p.MaterialCode, ChassisNumber=p.ChassisNumber }).ToList();
// var _query = from r1 in list join r2 in _ls on new { r1.ChassisNumber, r1.MaterialCode } equals new { r2.ChassisNumber, r2.MaterialCode }
// into temp from t in temp.DefaultIfEmpty()
// where t==null
// select r1 ;
// foreach (var s in _query.ToList())
// {
// _insertls.Add(s);
// }
//}
BulkConfig cfg = new BulkConfig() { BulkCopyTimeout=0, BatchSize=2000};
DbContext.BulkInsert(_insertls,cfg);
BulkConfig cfg = new BulkConfig() { BulkCopyTimeout=0, BatchSize=100000, };
DbContext.BulkInsert(list,cfg);
}
catch (Exception e)
{

130
src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs

@ -59,71 +59,71 @@ namespace TaskJob.Services
{
var filePath = fileSavePath + itm;//获取到导入的excel
var exten = Path.GetExtension(fileSavePath);
List<string> _errorList = new List<string>();
var checkList = new List<ErrorExportDto>();
//var _chList = await _relrepository.GetAllAsync(GuidGenerator.Create(), true);
//var _chls = _chList.Select(p => p.SettleMaterialCode).Distinct();
List<string> _precodeList = new List<string>();//
if (exten.ToUpper() == ".TXT")
{
using (TextReader textReader = new StreamReader(filePath))
{
int i = 0;
while (true)
{
string str = textReader.ReadLine();
if (string.IsNullOrEmpty(str))
{
break;
}
else
{
try
{
var _lst = str.Split(new char[] { '|' }).ToList();
string _settleyear = _lst[1].Trim();
string _kENNCode = _lst[2].Trim();
string _chassisNumber = _lst[3].Trim();
string _model = _lst[4].Trim();
DateTime _cP5A = DateTime.Parse(_lst[5].Trim());
DateTime _cP7 = DateTime.Parse(_lst[6].Trim());
string _materialCode = _lst[7].Trim();
decimal _qty = decimal.Parse(_lst[8].Trim());
string _settlementID = _lst[9].Trim();
string _settlementSupplier = _lst[10].Trim();
_setls.Add(new Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccount(
Guid.NewGuid(),
Guid.NewGuid(),
_settleyear,
_kENNCode,
_chassisNumber,
_model,
_cP5A,
_cP7,
_materialCode,
_qty,
_settlementID,
_settlementSupplier,
DateTime.Now.Year.ToString(),
DateTime.Now.Month.ToString(),
_id,
version,
DateTime.Now,
Guid.NewGuid()
));
}
catch
{
//List<string> _errorList = new List<string>();
//var checkList = new List<ErrorExportDto>();
////var _chList = await _relrepository.GetAllAsync(GuidGenerator.Create(), true);
////var _chls = _chList.Select(p => p.SettleMaterialCode).Distinct();
//List<string> _precodeList = new List<string>();//
//if (exten.ToUpper() == ".TXT")
//{
// using (TextReader textReader = new StreamReader(filePath))
// {
// int i = 0;
// while (true)
// {
// string str = textReader.ReadLine();
// if (string.IsNullOrEmpty(str))
// {
// break;
// }
// else
// {
// try
// {
// var _lst = str.Split(new char[] { '|' }).ToList();
// string _settleyear = _lst[1].Trim();
// string _kENNCode = _lst[2].Trim();
// string _chassisNumber = _lst[3].Trim();
// string _model = _lst[4].Trim();
// DateTime _cP5A = DateTime.Parse(_lst[5].Trim());
// DateTime _cP7 = DateTime.Parse(_lst[6].Trim());
// string _materialCode = _lst[7].Trim();
// decimal _qty = decimal.Parse(_lst[8].Trim());
// string _settlementID = _lst[9].Trim();
// string _settlementSupplier = _lst[10].Trim();
// _setls.Add(new Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccount(
// Guid.NewGuid(),
// Guid.NewGuid(),
// _settleyear,
// _kENNCode,
// _chassisNumber,
// _model,
// _cP5A,
// _cP7,
// _materialCode,
// _qty,
// _settlementID,
// _settlementSupplier,
// DateTime.Now.Year.ToString(),
// DateTime.Now.Month.ToString(),
// _id,
// version,
// DateTime.Now,
// Guid.NewGuid()
// ));
// }
// catch
// {
}
}
i++;
}
textReader.Close();
}
}
else
{
// }
// }
// i++;
// }
// textReader.Close();
// }
//}
//else
//{
// _setls= _inputService.Input<Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccount>(filePath);
var errorlist = new List<ErrorExportDto>();
var dtoList = _inputService.Input<SettleAccountImportDto>(filePath, null, errorlist);
@ -139,7 +139,7 @@ namespace TaskJob.Services
DateTime.Now.Month.ToString(), dto.SettleYear, _id, version, DateTime.Now, Guid.NewGuid());
_setls.Add(_settleaccount);
}
}
//}
#region
//var errorFileName = "错误文件.xlsx";
//checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("ERP物料号{0}底盘号 {1}有重复", "11111111111", "22222222222"), string.Empty));

Loading…
Cancel
Save