|
|
@ -164,8 +164,15 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts |
|
|
|
{ |
|
|
|
if (p_list != null) |
|
|
|
{ |
|
|
|
|
|
|
|
var _ls = await _wmsRepository.Where(p => p_list.Contains(p.Id) && p.Version == version && p.State != 2).ToListAsync(); |
|
|
|
List<WmsJitOutPutDetial> _ls = new List<WmsJitOutPutDetial>(); |
|
|
|
if (p_list.Count() > 0) |
|
|
|
{ |
|
|
|
_ls = await _wmsRepository.Where(p => p_list.Contains(p.Id) && p.Version == version && p.State != 2).ToListAsync(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
_ls = await _wmsRepository.Where(p => p.Version == version && p.State != 2).ToListAsync(); |
|
|
|
} |
|
|
|
if (_ls.Count() > 0) |
|
|
|
{ |
|
|
|
var _first = _ls.FirstOrDefault(); |
|
|
@ -179,7 +186,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts |
|
|
|
{ |
|
|
|
TaskId = _guid, |
|
|
|
SourceBillNum = _first.BillNum, |
|
|
|
TableName = "WmsJitOutPutDetail", |
|
|
|
//TableName = "WmsJitOutPutDetail",
|
|
|
|
InterfaceType = "1", |
|
|
|
Version = version, |
|
|
|
State = 0, |
|
|
@ -202,33 +209,34 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts |
|
|
|
[HttpGet] |
|
|
|
[Route("WmsJitOutPut-Cancel")] |
|
|
|
|
|
|
|
public async Task<bool> WmsJitOutPutCancel(List<string> fileList, string version) |
|
|
|
public async Task<bool> WmsJitOutPutCancel(List<Guid> ids, string version) |
|
|
|
{ |
|
|
|
|
|
|
|
List<WmsJitOutPutDetial> _lst = new List<WmsJitOutPutDetial>(); |
|
|
|
foreach (var filename in fileList) |
|
|
|
//var _guid = GuidGenerator.Create();
|
|
|
|
//foreach (var itm in _ls)
|
|
|
|
//{
|
|
|
|
// itm.TaskId = _guid;
|
|
|
|
//}
|
|
|
|
var _ls = await _wmsRepository.Where(p => ids.Contains(p.Id) && p.Version == version && p.State == 1).ToListAsync(); |
|
|
|
var _first = _ls.FirstOrDefault(); |
|
|
|
if (_ls.Count>0) |
|
|
|
{ |
|
|
|
string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename; |
|
|
|
IExcelImporter Importer = new Magicodes.ExporterAndImporter.Excel.ExcelImporter(); |
|
|
|
var _list = await Importer.ImportSameSheets<WmsJitOutPutDetialDto, WmsJitOutPutDetial>(fileSavePath); |
|
|
|
foreach (var itm in _list) |
|
|
|
var _guid = GuidGenerator.Create(); |
|
|
|
await _wmsefRespository.GetDbContext().BulkInsertAsync(_ls,new BulkConfig() { BulkCopyTimeout=0 }); |
|
|
|
var uniapi = new TS_UNI_API(GuidGenerator.Create(), "1", version, "WmsJitOutPutDetail", _first.BillNum, 0, _guid) |
|
|
|
{ |
|
|
|
var list = itm.Value.Data.ToList(); |
|
|
|
_lst.AddRange(list.ToArray()); |
|
|
|
} |
|
|
|
} |
|
|
|
var _ls1 = _lst.Where(p => p.ParentMaterialCode == p.MaterialCode).ToList(); |
|
|
|
TaskId = _guid, |
|
|
|
SourceBillNum = _first.BillNum, |
|
|
|
TableName = "WmsJitOutPutDetail", |
|
|
|
InterfaceType = "1", |
|
|
|
Version = version, |
|
|
|
State = 0, |
|
|
|
}; |
|
|
|
var _l = new List<TS_UNI_API>(); |
|
|
|
_l.Add(uniapi); |
|
|
|
await _wmsefRespository.GetDbContext().BulkInsertAsync(_l); |
|
|
|
|
|
|
|
await _wmsRepository.GetDbContext().BulkInsertAsync(_ls1, new BulkConfig() { BulkCopyTimeout = 0 }); |
|
|
|
|
|
|
|
int _count = _wmsVersionRepository.Count(p => p.Version == version); |
|
|
|
if (_count == 0) |
|
|
|
{ |
|
|
|
var _version = new List<WmsJitOutPut>(); |
|
|
|
_version.Add(new WmsJitOutPut { Version = version, BillNum = "T" + DateTime.Now.ToString("yyyyMMddhhmmssdddd"), Creator = CurrentUser.Email }); |
|
|
|
await _wmsVersionRepository.GetDbContext().BulkInsertAsync(_version); |
|
|
|
} |
|
|
|
//_wmsRepository.Where(p=>p)
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|