|
@ -164,8 +164,15 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts |
|
|
{ |
|
|
{ |
|
|
if (p_list != null) |
|
|
if (p_list != null) |
|
|
{ |
|
|
{ |
|
|
|
|
|
List<WmsJitOutPutDetial> _ls = new List<WmsJitOutPutDetial>(); |
|
|
var _ls = await _wmsRepository.Where(p => p_list.Contains(p.Id) && p.Version == version && p.State != 2).ToListAsync(); |
|
|
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) |
|
|
if (_ls.Count() > 0) |
|
|
{ |
|
|
{ |
|
|
var _first = _ls.FirstOrDefault(); |
|
|
var _first = _ls.FirstOrDefault(); |
|
@ -179,11 +186,11 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts |
|
|
{ |
|
|
{ |
|
|
TaskId = _guid, |
|
|
TaskId = _guid, |
|
|
SourceBillNum = _first.BillNum, |
|
|
SourceBillNum = _first.BillNum, |
|
|
TableName = "WmsJitOutPutDetail", |
|
|
//TableName = "WmsJitOutPutDetail",
|
|
|
InterfaceType = "1", |
|
|
InterfaceType = "1", |
|
|
Version = version, |
|
|
Version = version, |
|
|
State = 0, |
|
|
State = 0, |
|
|
|
|
|
|
|
|
}; |
|
|
}; |
|
|
var _l = new List<TS_UNI_API>(); |
|
|
var _l = new List<TS_UNI_API>(); |
|
|
_l.Add(uniapi); |
|
|
_l.Add(uniapi); |
|
@ -202,33 +209,34 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts |
|
|
[HttpGet] |
|
|
[HttpGet] |
|
|
[Route("WmsJitOutPut-Cancel")] |
|
|
[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>(); |
|
|
//var _guid = GuidGenerator.Create();
|
|
|
foreach (var filename in fileList) |
|
|
//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; |
|
|
var _guid = GuidGenerator.Create(); |
|
|
IExcelImporter Importer = new Magicodes.ExporterAndImporter.Excel.ExcelImporter(); |
|
|
await _wmsefRespository.GetDbContext().BulkInsertAsync(_ls,new BulkConfig() { BulkCopyTimeout=0 }); |
|
|
var _list = await Importer.ImportSameSheets<WmsJitOutPutDetialDto, WmsJitOutPutDetial>(fileSavePath); |
|
|
var uniapi = new TS_UNI_API(GuidGenerator.Create(), "1", version, "WmsJitOutPutDetail", _first.BillNum, 0, _guid) |
|
|
foreach (var itm in _list) |
|
|
|
|
|
{ |
|
|
{ |
|
|
var list = itm.Value.Data.ToList(); |
|
|
TaskId = _guid, |
|
|
_lst.AddRange(list.ToArray()); |
|
|
SourceBillNum = _first.BillNum, |
|
|
} |
|
|
TableName = "WmsJitOutPutDetail", |
|
|
} |
|
|
InterfaceType = "1", |
|
|
var _ls1 = _lst.Where(p => p.ParentMaterialCode == p.MaterialCode).ToList(); |
|
|
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; |
|
|
return true; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|