Browse Source

更新版本

FoShanPG
Administrator 3 years ago
parent
commit
a83507e785
  1. 138
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsUnInterface.cs

138
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsUnInterface.cs

@ -71,47 +71,95 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
var _count= _wmsRepository.Count(p => p.Version == version && p.State>0);
if (_count > 0)
{
throw new BusinessException("8899", "不能重新生成此版本!");
var _query= _wmsRepository.Where(p => p.State == 0 && p.Version == version);
await _query.BatchDeleteAsync();
var _query1= _wmsRepository.Where(p => p.Version == version);
var _existLst = _query1.ToList();
var _maxLine = _existLst.Max(p => p.LineNumber);
var _diffls = from itm1 in _ls
join itm2 in _existLst
on new { BillNum=itm1., MaterialCode=itm1., Pric=itm1. }
equals new { BillNum = itm2.BillNum, MaterialCode = itm2.MaterialCode, Pric = itm2.Price } into temp1
from tm1 in temp1.DefaultIfEmpty()
select itm1;
var _difflst=_diffls.ToList();
List<WmsDetailReport> _lst = new List<WmsDetailReport>();
if (_difflst != null && _difflst.Count() > 0)
{
foreach (var itm in _difflst)
{
_maxLine = _maxLine++;
_lst.Add(new WmsDetailReport(Guid.NewGuid(),
_maxLine,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
String.Empty,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.WMS待出库金额,
itm.,
itm.,
itm.,
String.Empty,
0,
version,
DateTime.MaxValue
));
}
}
await _wmsRepository.GetDbContext().BulkInsertAsync(_lst);
}
else
{
var query = _wmsRepository.Where(p => p.Version == version);
_wmsRepository.GetDbContext().BulkDelete(query.ToList());
await query.BatchDeleteAsync();
}
List<WmsDetailReport> _lst = new List<WmsDetailReport>();
if (_ls != null && _ls.Count() > 0)
{
foreach (var itm in _ls)
List<WmsDetailReport> _lst = new List<WmsDetailReport>();
if (_ls != null && _ls.Count() > 0)
{
_lst.Add(new WmsDetailReport(Guid.NewGuid(),
int.Parse(itm.),
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
String.Empty,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.WMS待出库金额,
itm.,
itm.,
itm.,
String.Empty,
0,
version,
DateTime.MaxValue
));
foreach (var itm in _ls)
{
_lst.Add(new WmsDetailReport(Guid.NewGuid(),
int.Parse(itm.),
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
String.Empty,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.,
itm.WMS待出库金额,
itm.,
itm.,
itm.,
String.Empty,
0,
version,
DateTime.MaxValue
));
}
}
}
await _wmsRepository.GetDbContext().BulkInsertAsync(_lst);
await _wmsRepository.GetDbContext().BulkInsertAsync(_lst);
}
return ApplicationConsts.SuccessStr;
}
/// <summary>
@ -197,19 +245,31 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, int.MaxValue,
0, true);
entities = entities.Where(p => p.OutputQty != 0 && p.State==0).ToList();
var _count= entities.Count(p => p.State==2);
await _wmsRepository.GetDbContext().BulkUpdateAsync(entities);
if (_count > 1)
{
throw new BusinessException("8989", "记录不在同一物料组车型、出库类型、客户编码");
return false;
}
var count = entities.GroupBy(p => new { p.Type, p.ClientCode }).Count();
if (count > 1)
foreach (var itm in entities)
{
throw new BusinessException("8989", "记录不在同一物料组车型、出库类型、客户编码");
return false;
itm.State = 2;
}
await _wmsRepository.GetDbContext().BulkUpdateAsync(entities);
// var count = entities.GroupBy(p => new { p.Type, p.ClientCode }).Count();
//if (count > 1)
// {
// throw new BusinessException("8989", "记录不在同一物料组车型、出库类型、客户编码");
// return false;
// }
List<WmsDetailReport> _ls = new List<WmsDetailReport>();
if (entities.Count() > 0)

Loading…
Cancel
Save