|
@ -26,58 +26,105 @@ namespace Win_in.Sfs.Wms.Store.Jobs.AgvJobs; |
|
|
public class AgvJobAccountService : ApplicationService |
|
|
public class AgvJobAccountService : ApplicationService |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
private readonly Func<string, IAgvJobAccountService> _Accessor; |
|
|
//private readonly Func<string, IAgvJobAccountService> _Accessor;
|
|
|
|
|
|
|
|
|
|
|
|
//private readonly IAssembleIssueJobAppService _assembleIssueJobAppService;
|
|
|
public AgvJobAccountService( |
|
|
//private readonly ICoatingIssueJobAppService _coatingIssueJobAppService;
|
|
|
Func<string, IAgvJobAccountService> Accessor |
|
|
//private readonly IInjectionIssueJobAppService _injectionIssueJobAppService;
|
|
|
|
|
|
//private readonly IKittingIssueJobAppService _kittingIssueJobAppService;
|
|
|
|
|
|
//private readonly ISparePartIssueJobAppService _sparePartIssueJobAppService;
|
|
|
) |
|
|
//private readonly IProductionLineAppService _productionLineAppService;
|
|
|
{ |
|
|
|
|
|
_Accessor = Accessor; |
|
|
//private readonly IUnplannedIssueJobAppService _unplannedIssueJobAppService;
|
|
|
|
|
|
//private readonly IUnplannedReceiptJobAppService _unplannedReceiptJobAppService;
|
|
|
} |
|
|
|
|
|
[HttpPost("accountOutOrder")] |
|
|
|
|
|
public async Task<AgvResultObject> AccountOutOrderAsync(AgvRequestOnlyJobHK request) |
|
|
//public AgvJobAccountService(
|
|
|
{ |
|
|
|
|
|
var res = new AgvResultObject(); |
|
|
// IAssembleIssueJobAppService assembleIssueJobAppService,
|
|
|
; |
|
|
// ICoatingIssueJobAppService coatingIssueJobAppService,
|
|
|
|
|
|
// IInjectionIssueJobAppService injectionIssueJobAppService,
|
|
|
|
|
|
// IKittingIssueJobAppService kittingIssueJobAppService,
|
|
|
List<string> errors= new List<string>(); |
|
|
// ISparePartIssueJobAppService sparePartIssueJobAppService,
|
|
|
var jobList = request.Data.Select(p => p.OrderNum).Distinct(); |
|
|
// IProductionLineAppService productionLineAppService,
|
|
|
foreach (var job in jobList) |
|
|
// IUnplannedIssueJobAppService unplannedIssueJobAppService,
|
|
|
{ |
|
|
// IUnplannedReceiptJobAppService unplannedReceiptJobAppService
|
|
|
var jobdetails = request.Data.Where(p => p.OrderNum == job); |
|
|
// //Func<string, IAgvJobAccountService> Accessor
|
|
|
if (jobdetails!=null && jobdetails.Any()) |
|
|
|
|
|
{ |
|
|
// )
|
|
|
var first= jobdetails.FirstOrDefault(); |
|
|
//{
|
|
|
var agvJobAccountService = _Accessor(first.OrderType); |
|
|
// _unplannedIssueJobAppService = unplannedIssueJobAppService;
|
|
|
var jobreq = new AgvRequestOnlyJobHK(); |
|
|
// _assembleIssueJobAppService = assembleIssueJobAppService;
|
|
|
jobreq.Data =jobdetails.ToList(); |
|
|
// _coatingIssueJobAppService = coatingIssueJobAppService;
|
|
|
var result = await agvJobAccountService.AccountOutOrderAsync(jobreq).ConfigureAwait(false); |
|
|
// _injectionIssueJobAppService = injectionIssueJobAppService;
|
|
|
if (result.Code != "0") |
|
|
// _kittingIssueJobAppService = kittingIssueJobAppService;
|
|
|
{ |
|
|
// _sparePartIssueJobAppService = sparePartIssueJobAppService;
|
|
|
errors.Add($"任务{job}类型{first.OrderType}错误{result.Message}"); |
|
|
// _productionLineAppService = productionLineAppService;
|
|
|
} |
|
|
// _unplannedIssueJobAppService = unplannedIssueJobAppService;
|
|
|
} |
|
|
// _unplannedReceiptJobAppService = unplannedReceiptJobAppService;
|
|
|
} |
|
|
|
|
|
if (errors.Count > 0) |
|
|
//}
|
|
|
{ |
|
|
//[HttpPost("accountOutOrder")]
|
|
|
res.Code = "1"; |
|
|
//public async Task<AgvResultObject> CallBackAgvAsync(AgvRequestDto request)
|
|
|
res.Message =string.Join(",",errors); |
|
|
//{
|
|
|
res.ReqCode = "0"; |
|
|
// var res = new AgvResultObject();
|
|
|
return res; |
|
|
// List<string> errors= new List<string>();
|
|
|
} |
|
|
// var jobList = request.Data.Select(p => p.OrderNum).Distinct();//多少个任务
|
|
|
|
|
|
// foreach (var job in jobList)
|
|
|
res.Code = "0"; |
|
|
// {
|
|
|
res.ReqCode = "0"; |
|
|
// var jobdetails = request.Data.Where(p => p.OrderNum == job);//每个任务的明细
|
|
|
res.Message = "OK"; |
|
|
// if (jobdetails!=null && jobdetails.Any())
|
|
|
|
|
|
// {
|
|
|
return res; |
|
|
// var first= jobdetails.FirstOrDefault();//每个任务指定那种类型
|
|
|
|
|
|
// var jobreq = new AgvRequestDto();
|
|
|
} |
|
|
// jobreq.Data = jobdetails.ToList();//
|
|
|
|
|
|
// switch (int.Parse(first.OrderType))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// case (int)EnumJobType.AssembleIssueJob:
|
|
|
|
|
|
// await _assembleIssueJobAppService.CallBackAgvAsync(jobreq).ConfigureAwait(false);
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case (int)EnumJobType.CoatingIssueJob:
|
|
|
|
|
|
// await _coatingIssueJobAppService.CallBackAgvAsync(jobreq).ConfigureAwait(false);
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case (int)EnumJobType.InjectionIssueJob:
|
|
|
|
|
|
// await _injectionIssueJobAppService.CallBackAgvAsync(jobreq).ConfigureAwait(false);
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case (int)EnumJobType.KittingIssueJob:
|
|
|
|
|
|
// await _assembleIssueJobAppService.CallBackAgvAsync(jobreq).ConfigureAwait(false);
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case (int)EnumJobType.SparePartIssueJob:
|
|
|
|
|
|
// await _sparePartIssueJobAppService.CallBackAgvAsync(jobreq).ConfigureAwait(false);
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case (int)EnumJobType.UnplannedIssueJob:
|
|
|
|
|
|
// await _sparePartIssueJobAppService.CallBackAgvAsync(jobreq).ConfigureAwait(false);
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case (int)EnumJobType.UnplannedReceiptJob:
|
|
|
|
|
|
// await _sparePartIssueJobAppService.CallBackAgvAsync(jobreq).ConfigureAwait(false);
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// // var result = await agvJobAccountService.CallBackAgvAsync(jobreq).ConfigureAwait(false);
|
|
|
|
|
|
// if (result.Code != "0")
|
|
|
|
|
|
// {
|
|
|
|
|
|
// errors.Add($"任务{job}类型{first.OrderType}错误{result.Message}");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (errors.Count > 0)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// res.Code = "1";
|
|
|
|
|
|
// res.Message =string.Join(",",errors);
|
|
|
|
|
|
// res.ReqCode = "0";
|
|
|
|
|
|
// return res;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// res.Code = "0";
|
|
|
|
|
|
// res.ReqCode = "0";
|
|
|
|
|
|
// res.Message = "OK";
|
|
|
|
|
|
|
|
|
|
|
|
// return res;
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|