FjController.cs 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131
  1. using AutoMapper;
  2. using Microsoft.AspNetCore.Mvc;
  3. using Newtonsoft.Json;
  4. using SqlSugar;
  5. using WCS.Entity.fj;
  6. using wms.api.Job;
  7. using wms.dto;
  8. using wms.dto.request.fj;
  9. using wms.dto.request.hj;
  10. using wms.dto.request.hj.dto;
  11. using wms.dto.request.share;
  12. using wms.dto.response;
  13. using wms.dto.response.fj;
  14. using wms.service.IService;
  15. using wms.service.Service;
  16. using wms.sqlsugar.model.fj;
  17. using wms.util.Check;
  18. using wms.util.Ext;
  19. using wms.util.Http;
  20. namespace wms.api.Controllers
  21. {
  22. /// <summary>
  23. /// 分拣库控制器
  24. /// </summary>
  25. [Route("api/[controller]/[action]")]
  26. [ApiController]
  27. public class FjController : BaseController
  28. {
  29. /// <summary>
  30. /// 分拣服务 逻辑类
  31. /// </summary>
  32. private readonly IFJService _fjService;
  33. /// <summary>
  34. /// 日志
  35. /// </summary>
  36. private readonly ILogger<FjController> _logger;
  37. /// <summary>
  38. /// 映射器
  39. /// </summary>
  40. private readonly IMapper _mapper;
  41. #region 锁
  42. private static object lockerCurtainProductionOrder = new object();
  43. private static object lockerCurtainOrderStartCheck = new object();
  44. private static object lockerFjEditorialFlow = new object();
  45. private static object lockerSpoolMaterialInfoTrans = new object();
  46. private static object lockerCurtainProductionStockOut = new object();
  47. private static object lockerCurtainProductionStockOut1 = new object();
  48. private static object lockerProductionBack = new object();
  49. private static object lockerCreateMaterialPalletWarehouTask = new object();
  50. private static object lockerCreateMaterialPalletWarehouTask1 = new object();
  51. private static object lockerCreateMaterialPalletWarehouTask2 = new object();
  52. private static object lockerMaterialReturnTaskCreator = new object();
  53. private static object lockerErrorMaterialStockOut = new object();
  54. private static object lockerBGradeMaterialStockOut = new object();
  55. private static object lockerlockerStockChange = new object();
  56. private static object lockerWetFormulaInfo = new object();
  57. private static object lockerManualBuildEmptyStock = new object();
  58. private static object lockFindAvailableFlatStorageSlot=new object();
  59. /// <summary>
  60. /// 人工组盘传输接口
  61. /// </summary>
  62. private static object lockerManualBuildStockTrans = new object();
  63. /// <summary>
  64. /// 一层工人创建创建空托盘库存
  65. /// </summary>
  66. private static object lockOneFloorWorkerBuildEmptyPalletsStock = new object();
  67. /// <summary>
  68. ///
  69. /// </summary>
  70. private static object lockGroupTask = new object();
  71. // <summary>
  72. ///
  73. /// </summary>
  74. private static object lockBingPallet = new object();
  75. // <summary>
  76. ///
  77. /// </summary>
  78. private static object lockGetTwoPallet = new object();
  79. /// <summary>
  80. /// 申请货位
  81. /// </summary>
  82. private static object lockApplyStockInLoc = new object();
  83. /// <summary>
  84. /// 完成任务
  85. /// </summary>
  86. private static object lockerCompleteTask = new object();
  87. /// <summary>
  88. /// 取消任务
  89. /// </summary>
  90. private static object lockerCancelTask = new object();
  91. /// <summary>
  92. /// 手动出库任务
  93. /// </summary>
  94. private static object lockManualTask = new object();
  95. /// <summary>
  96. /// 空托盘组申请出库
  97. /// </summary>
  98. private static object lockApplyEmptyPalletGroupOutStorage = new object();
  99. /// <summary>
  100. /// 组盘工字轮创建异常任务
  101. /// </summary>
  102. private static object palletizingCreateseErrorTasks = new object();
  103. /// <summary>
  104. /// 空托盘组申请出库
  105. /// </summary>
  106. private static object lockRingApplyStockInLoc = new object();
  107. /// <summary>
  108. /// 环形库请求码垛出库任务
  109. /// </summary>
  110. private static object lockApplyPalletizingStockOut = new object();
  111. /// <summary>
  112. /// 堆垛机从出库完成
  113. /// </summary>
  114. private static object lockerSrmPickOutCompleted = new object();
  115. private static object lockerBomInfoTrans = new object();
  116. private static object lockFJEnteMainLineRequest = new object();
  117. private static object lockAllocatedSpoolFlow = new object();
  118. #endregion 锁
  119. /// <summary>
  120. /// 分拣控制器构造函数
  121. /// </summary>
  122. /// <param name="fjService">分拣服务 逻辑类</param>
  123. /// <param name="logger">日志</param>
  124. /// <param name="mapper">映射器</param>
  125. public FjController(IFJService fjService, ILogger<FjController> logger, IMapper mapper) : base(fjService)
  126. {
  127. _fjService = fjService;
  128. _logger = logger;
  129. _mapper = mapper;
  130. }
  131. #region 暂时不用
  132. /// <summary>
  133. /// 同步物料基础信息
  134. /// </summary>
  135. /// <param name="reqDto"></param>
  136. /// <returns></returns>
  137. //[HttpPost]
  138. //public string SyncMaterInfo(SyncMaterInfoRequest reqBody)
  139. //{
  140. // var result = new SRes();
  141. // //_logger.LogInformation("请求参数:{@reqBody},{aa}", reqBody,1);
  142. // FJSyncMaterInfoResponse resbody = JsonConvert.DeserializeObject<FJSyncMaterInfoResponse>(WmsServiceExportApi(reqBody));
  143. // if (reqBody.SyncType == 1)
  144. // {
  145. // reqBody.PageIndex = 1;
  146. // while (resbody.ResData !=null && resbody.ResData.Any())
  147. // {
  148. // _fjService.SyncMaterInfo(resbody.ResData);
  149. // reqBody.PageIndex++;
  150. // resbody = JsonConvert.DeserializeObject<FJSyncMaterInfoResponse>(WmsServiceExportApi(reqBody));
  151. // }
  152. // }
  153. // else if (reqBody.SyncType == 2)
  154. // {
  155. // //拿到增量
  156. // var increconf = _fjService.GetSysConfigByCode(Const.MESMaterialInitIncrement);
  157. // if (increconf != null)
  158. // {
  159. // reqBody.StartTime = DateTime.Parse(increconf.SContent);
  160. // //reqBody.Count = int.Parse(increconf.Remark);
  161. // resbody = JsonConvert.DeserializeObject<FJSyncMaterInfoResponse>(WmsServiceExportApi(reqBody));
  162. // if (resbody.ResData.Any())
  163. // {
  164. // if (_fjService.SyncMaterInfo(resbody.ResData))
  165. // {
  166. // var lastdata = resbody.ResData.OrderBy(p => p.UpdatedTime).Last();
  167. // _fjService.UpdateSysConfigModelColumns(new sqlsugar.model.UpdateModelColumns<fjSysConfig>()
  168. // {
  169. // Columns = it => new fjSysConfig { SContent = lastdata.UpdatedTime.ToString("yyyy-MM-dd HH:mm:ss.fff") },
  170. // WhereExpression = it => it.Code == Const.MESMaterialInitIncrement
  171. // });
  172. // }
  173. // }
  174. // else
  175. // {
  176. // result.ResCode = ResponseStatusCodeEnum.NoResult.GetHashCode();
  177. // result.ResMsg = ResponseStatusCodeEnum.NoResult.GetDescription();
  178. // }
  179. // }
  180. // else
  181. // {
  182. // result.ResCode = ResponseStatusCodeEnum.AccountError.GetHashCode();
  183. // result.ResMsg = "没有配置信息" + Const.MESMaterialInitIncrement;
  184. // }
  185. // }
  186. // else
  187. // {
  188. // if (!string.IsNullOrEmpty(reqBody.MatCode))
  189. // {
  190. // resbody = JsonConvert.DeserializeObject<FJSyncMaterInfoResponse>(WmsServiceExportApi(reqBody));
  191. // if (resbody.ResData.Any())
  192. // {
  193. // if (_fjService.SyncMaterInfo(resbody.ResData))
  194. // {
  195. // }
  196. // }
  197. // }
  198. // }
  199. // return result.ToCamelCaseString();
  200. //}
  201. /// <summary>
  202. /// BOM信息传输接口
  203. /// </summary>
  204. /// <param name="reqDto"></param>
  205. /// <returns></returns>
  206. //[HttpPost]
  207. //public SRes BomInfoTrans(BomInfoTransRequest reqDto)
  208. //{
  209. // return ConcurrencyReqControl<BomInfoTransRequest, SRes>(lockerBomInfoTrans, "BomInfoTrans" + reqDto.BomCode, reqDto.BomCode, reqDto, _fjService.BomInfoTrans);
  210. //}
  211. #endregion 暂时不用
  212. /// <summary>
  213. /// 创建货位,用于少数虚拟货位及平库
  214. /// </summary>
  215. /// <param name="WarehouseCode">仓库号</param>
  216. /// <param name="Code">货位号</param>
  217. /// <returns></returns>
  218. [HttpPost]
  219. public SRes CreatWarecell(string WarehouseCode, string Code)
  220. {
  221. return _fjService.CreatWarecell(WarehouseCode, Code);
  222. }
  223. /// <summary>
  224. /// 物料主数据推送接口(湿拉)
  225. /// </summary>
  226. /// <param name="reqBody"></param>
  227. /// <returns></returns>
  228. [HttpPost]
  229. public SRes SyncMaterInfoList(FJSyncMaterInfoListRequest reqBody)
  230. {
  231. var res = new SRes();
  232. if (reqBody.ListInfo == null || !reqBody.ListInfo.Any())
  233. {
  234. res.ResCode = ResponseStatusCodeEnum.DocDetailNotExist.GetHashCode();
  235. res.ResMsg = ResponseStatusCodeEnum.DocDetailNotExist.GetDescription();
  236. return res;
  237. }
  238. _fjService.SyncMaterInfo(_mapper.Map<List<FJSyncMaterInfoResponseItem>>(reqBody.ListInfo));
  239. return res;
  240. }
  241. /// <summary>
  242. /// 物料主数据推送接口(帘线)
  243. /// </summary>
  244. /// <param name="reqBody"></param>
  245. /// <returns></returns>
  246. [HttpPost]
  247. public SRes SyncMaterInfoListForLX(SxSyncMaterInfoListRequest reqBody)
  248. {
  249. var res = new SRes();
  250. if (reqBody.ListInfo == null || !reqBody.ListInfo.Any())
  251. {
  252. res.ResCode = ResponseStatusCodeEnum.DocDetailNotExist.GetHashCode();
  253. res.ResMsg = ResponseStatusCodeEnum.DocDetailNotExist.GetDescription();
  254. return res;
  255. }
  256. _fjService.SyncMaterInfoLX(reqBody.ListInfo);
  257. return res;
  258. }
  259. /// <summary>
  260. /// 机台信息同步接口
  261. /// </summary>
  262. /// <param name=""></param>
  263. /// <returns></returns>
  264. [HttpPost(Name = "SyncMachineInfo")]
  265. public SRes SyncMachineInfo(SyncMachineInfoRequest reqDto)
  266. {
  267. //SyncMachineInfoResponse resbody = JsonConvert.DeserializeObject<SyncMachineInfoResponse>(WmsServiceExportApi(reqDto));
  268. //if (resbody.ResCode == ResponseStatusCodeEnum.Sucess.GetHashCode() && resbody.ResData != null && resbody.ResData.Any())
  269. //{
  270. return _fjService.SyncMachineInfo(reqDto);
  271. //}
  272. }
  273. /// <summary>
  274. /// 创建芯股用空托入库任务
  275. /// </summary>
  276. /// <returns></returns>
  277. [HttpPost(Name = "CreateCoreStrandEmptyPalletEnterWarehouse")]
  278. public void CreateCoreStrandEmptyPalletEnterWarehouse()
  279. {
  280. _fjService.CreateCoreStrandEmptyPalletEnterWarehouse();
  281. }
  282. /// <summary>
  283. /// 创建芯股站台用的空托出库任务
  284. /// </summary>
  285. /// <returns></returns>
  286. [HttpPost(Name = "CoreStrandSupportReplenishEmptyPallet")]
  287. public SRes CoreStrandSupportReplenishEmptyPallet()
  288. {
  289. return _fjService.CoreStrandSupportReplenishEmptyPallet();
  290. }
  291. /// <summary>
  292. /// 投料信息同步接口
  293. /// </summary>
  294. /// <param name=""></param>
  295. /// <returns></returns>
  296. [HttpPost(Name = "WetFormulaInfo")]
  297. public SRes WetFormulaInfo(WetFormulaInfoRequest reqDto)
  298. {
  299. return ConcurrencyReqControl<WetFormulaInfoRequest, SRes>(lockerWetFormulaInfo, "WetFormulaInfo", reqDto.FeedCode, reqDto, _fjService.WetFormulaInfo);
  300. }
  301. /// <summary>
  302. /// 帘线生产工单信息传输接口
  303. /// </summary>
  304. /// <param name="reqDto"></param>
  305. /// <returns></returns>
  306. [HttpPost]
  307. public SRes CurtainProductionOrder(CurtainProductionOrderRequest reqDto)
  308. {
  309. var res = ConcurrencyReqControl<CurtainProductionOrderRequest, SRes>(lockerCurtainProductionOrder, "CurtainProductionOrder", reqDto.BillCode, reqDto, _fjService.CurtainProductionOrder);
  310. try
  311. {
  312. HttpUtil.PostRequest("http://10.30.44.3:8011/api/sx/CurtainProductionOrder", JsonConvert.SerializeObject(reqDto), 30000, "UTF-8", "application/json");
  313. }
  314. catch (Exception ex)
  315. {
  316. _logger.LogInformation("调用时效工单异常" + ex.ToString());
  317. }
  318. return res;
  319. }
  320. /// <summary>
  321. /// 湿拉工单启动验证
  322. /// </summary>
  323. /// <param name="reqDto"></param>
  324. /// <returns></returns>
  325. [HttpPost]
  326. public SRes CurtainOrderStartCheck(CurtainOrderStartCheckRequest reqDto)
  327. {
  328. return ConcurrencyReqControl<CurtainOrderStartCheckRequest, SRes>(lockerCurtainOrderStartCheck, "CurtainOrderStartCheck", reqDto.BillCode, reqDto, _fjService.CurtainOrderStartCheck);
  329. }
  330. /// <summary>
  331. /// 变更流向
  332. /// </summary>
  333. /// <param name="reqDto"></param>
  334. /// <returns></returns>
  335. [HttpPost]
  336. public SRes EditorialFlow(FjEditorialFlowRequest reqDto)
  337. {
  338. return ConcurrencyReqControl<FjEditorialFlowRequest, SRes>(lockerFjEditorialFlow, "EditorialFlow", reqDto.LocCode, reqDto, _fjService.EditorialFlow);
  339. }
  340. /// <summary>
  341. /// 湿拉工字轮/芯股信息传输接口
  342. /// </summary>
  343. /// <param name="reqDto"></param>
  344. /// <returns></returns>
  345. [HttpPost]
  346. public SRes SpoolMaterialInfoTrans(SpoolMaterialInfoTransRequest reqDto)
  347. {
  348. return ConcurrencyReqControl<SpoolMaterialInfoTransRequest, SRes>(lockerSpoolMaterialInfoTrans, "SpoolMaterialInfoTrans", reqDto.SpoolCode, reqDto, _fjService.SpoolMaterialInfoTrans);
  349. }
  350. /// <summary>
  351. /// AGV上报状态变更接口
  352. /// </summary>
  353. /// <param name="reqDto"></param>
  354. /// <returns></returns>
  355. [HttpPost]
  356. public AgvCallbackResponse AgvCallback(AgvCallbackRequest reqDto)
  357. {
  358. return _fjService.AgvCallback(reqDto);
  359. //return ConcurrencyReqControl<SpoolMaterialInfoTransRequest, SRes>(lockerSpoolMaterialInfoTrans, "SpoolMaterialInfoTrans", reqDto.SpoolCode, reqDto, _fjService.SpoolMaterialInfoTrans);
  360. }
  361. /// <summary>
  362. /// 获取工字轮流向(江锦调用)
  363. /// </summary>
  364. /// <param name="reqDto"></param>
  365. /// <returns></returns>
  366. [HttpPost]
  367. public SRes<string> AllocatedSpoolFlow(AllocatedSpoolFlowRequest reqDto)
  368. {
  369. return _fjService.AllocatedSpoolFlow(reqDto);
  370. }
  371. /// <summary>
  372. /// MES获取流向异常信息
  373. /// </summary>
  374. /// <param name="reqDto"></param>
  375. /// <returns></returns>
  376. [HttpPost]
  377. public SRes QueryFlowDirectionExceptions(GetFlowExceptionResultsRequest reqDto)
  378. {
  379. return _fjService.QueryFlowDirectionExceptions(reqDto);
  380. }
  381. private SRes ComPushData(SRes resbody, List<long> ids)
  382. {
  383. var res = new SRes();
  384. try
  385. {
  386. if (resbody.ResCode == ResponseStatusCodeEnum.Sucess.GetHashCode())
  387. {
  388. //更新推送表数据
  389. _fjService.UpdateBillPushinfoModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
  390. {
  391. Columns = it => new BillPushinfo { PostResult = 1, PostQty = it.PostQty + 1 },
  392. WhereExpression = it => ids.Contains(it.Id)
  393. });
  394. //删除单据表数据
  395. //_fjService.DeleteDoc(p => doccodelist.Contains(p.DocNo));
  396. }
  397. else
  398. {
  399. //更新推送表数据
  400. _fjService.UpdateBillPushinfoModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
  401. {
  402. Columns = it => new BillPushinfo { PostResult = 2, PostQty = it.PostQty + 1 },
  403. WhereExpression = it => ids.Contains(it.Id)
  404. });
  405. }
  406. }
  407. catch (Exception ex)
  408. {
  409. res.ResCode = ResponseStatusCodeEnum.DataSaveErr.GetHashCode();
  410. res.ResMsg = ResponseStatusCodeEnum.DataSaveErr.GetDescription();
  411. _logger.LogInformation("反馈数据推送" + ex.ToString());
  412. }
  413. return res;
  414. }
  415. /// <summary>
  416. /// 湿拉工字轮入库反馈接口
  417. /// </summary>
  418. /// <returns></returns>
  419. [HttpPost(Name = "WetProductStockInFeedBack")]
  420. public SRes WetProductStockInFeedBack()
  421. {
  422. var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_StockIn.ToString());
  423. var dtolist = _mapper.Map<List<WetProductStockInFeedBackRequestItem>>(list);
  424. var dto = new WetProductStockInFeedBackRequest() { ListInfo = dtolist };
  425. SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
  426. return ComPushData(resbody, list.Select(p => p.Id).ToList());
  427. }
  428. /// <summary>
  429. /// 数据推送接口
  430. /// </summary>
  431. /// <param name="request"></param>
  432. /// <returns></returns>
  433. [HttpPost]
  434. public PushResponse FJPushErpDate(PushDate request)
  435. {
  436. var result = new PushResponse();
  437. //自动推送
  438. request.Type = FackbeekType.InterfaceType_HJ_1F_StockIn.ToString();
  439. var onefloor = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_StockIn.ToString(), true);
  440. foreach (var item in onefloor.GroupBy(p => p.RFIDBarCode))
  441. {
  442. PushRequest push = new PushRequest() { ListInfo = new List<ListInfoInfo>() };
  443. push.WareCode = "fjhouse";
  444. push.WareName = "分拣库";
  445. push.LocCode = item.First().WareCellCode;
  446. push.TrayCode = "TPB";
  447. push.TrayType = "TPB";
  448. push.ListInfo = item.Select(q => new ListInfoInfo() { MatBarCode = q.CLBarCode, SpoolCode = q.HWBarCode }).ToList();
  449. var resbody = JsonConvert.DeserializeObject<PushResponse>(WmsServiceExportMq(push));
  450. var matBarCode = push.ListInfo.Select(p => p.MatBarCode).ToList();
  451. if (resbody.success == true || resbody.ResCode == 200)
  452. {
  453. _fjService.UpdatePushModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
  454. {
  455. Columns = it => new BillPushinfo { PostResult = 1, PostQty = it.PostQty + 1, ResDesc = "自动推送", EditTime = DateTime.Now },
  456. WhereExpression = it => matBarCode.Contains(it.CLBarCode)
  457. });
  458. }
  459. else
  460. {
  461. _fjService.UpdatePushModelColumns(new sqlsugar.model.UpdateModelColumns<BillPushinfo>()
  462. {
  463. Columns = it => new BillPushinfo { PostResult = 2, PostQty = it.PostQty + 1, EditTime = DateTime.Now, Memo = resbody.ResMsg },
  464. WhereExpression = it => matBarCode.Contains(it.CLBarCode)
  465. });
  466. }
  467. }
  468. return result;
  469. }
  470. /// <summary>
  471. /// 帘线叫料接口
  472. /// </summary>
  473. /// <param name="reqDto"></param>
  474. /// <returns></returns>
  475. [HttpPost(Name = "CurtainProductionStockOut")]
  476. public SRes CurtainProductionStockOut(CurtainProductionStockOutRequest reqDto)
  477. {
  478. return ConcurrencyReqControl<CurtainProductionStockOutRequest, SRes>(lockerCurtainProductionStockOut, "CurtainProductionStockOut" + reqDto.BillCode, reqDto.BillCode, reqDto, _fjService.CurtainProductionStockOut);
  479. }
  480. /// <summary>
  481. /// 帘线叫料接口(人工码垛托盘)
  482. /// </summary>
  483. /// <param name="reqDto"></param>
  484. /// <returns></returns>
  485. [HttpPost(Name = "CurtainProductionStockOut1")]
  486. public SRes CurtainProductionStockOut1(CurtainProductionStockOutRequest1 reqDto)
  487. {
  488. return ConcurrencyReqControl<CurtainProductionStockOutRequest1, SRes>(lockerCurtainProductionStockOut1, "CurtainProductionStockOut1" + reqDto.BillCode, reqDto.BillCode, reqDto, _fjService.CurtainProductionStockOut1);
  489. }
  490. /// <summary>
  491. /// 帘线手动叫料接口
  492. /// </summary>
  493. /// <param name="reqDto"></param>
  494. /// <returns></returns>
  495. [HttpPost(Name = "ManualCurtainProductionStockOut")]
  496. public SRes ManualCurtainProductionStockOut(ManualCurtainProductionStockOut reqDto)
  497. {
  498. return _fjService.ManualCurtainProductionStockOut(reqDto);
  499. }
  500. /// <summary>
  501. /// 人工创建满托入库任务
  502. /// </summary>
  503. /// <param name="reqDto"></param>
  504. /// <returns></returns>
  505. [HttpPost]
  506. public SRes CreateMaterialPalletWarehouTask(CreateMaterialPalletWarehouTaskRequest reqDto)
  507. {
  508. return ConcurrencyReqControl<CreateMaterialPalletWarehouTaskRequest, SRes>(lockerCreateMaterialPalletWarehouTask, "CreateMaterialPalletWarehouTask", reqDto.SpoolNr, reqDto, _fjService.CreateMaterialPalletWarehouTask);
  509. }
  510. /// <summary>
  511. /// 人工创建UT满托入库任务
  512. /// </summary>
  513. /// <param name="reqDto"></param>
  514. /// <returns></returns>
  515. [HttpPost]
  516. public SRes CreateMaterialUTPalletWarehouTask(CreateMaterialPalletWarehouTaskRequest reqDto)
  517. {
  518. return ConcurrencyReqControl<CreateMaterialPalletWarehouTaskRequest, SRes>(lockerCreateMaterialPalletWarehouTask, "CreateMaterialUTPalletWarehouTask", reqDto.SpoolNr, reqDto, _fjService.CreateMaterialUTPalletWarehouTask);
  519. }
  520. /// <summary>
  521. /// 芯股满托创建库存信息
  522. /// </summary>
  523. /// <param name="reqDto"></param>
  524. /// <returns></returns>
  525. [HttpPost]
  526. public SRes CreateMaterialPalletWarehouTask1(CreateMaterialPalletWarehouTask1Request reqDto)
  527. {
  528. return ConcurrencyReqControl<CreateMaterialPalletWarehouTask1Request, SRes>(lockerCreateMaterialPalletWarehouTask1, "CreateMaterialPalletWarehouTask1", reqDto.SpoolNr, reqDto, _fjService.CreateMaterialPalletWarehouTask1);
  529. }
  530. /// <summary>
  531. /// 芯股满托创建库存信息
  532. /// </summary>
  533. /// <param name="reqDto"></param>
  534. /// <returns></returns>
  535. [HttpPost]
  536. public SRes CreateMaterialPalletWarehouTask2(RewindFullPalletTaskRequest reqDto)
  537. {
  538. return ConcurrencyReqControl<RewindFullPalletTaskRequest, SRes>(lockerCreateMaterialPalletWarehouTask2, "CreateMaterialPalletWarehouTask2", reqDto.TrayCode, reqDto, _fjService.CreateMaterialPalletWarehouTask2);
  539. }
  540. /// <summary>
  541. /// 创建退料任务
  542. /// </summary>
  543. /// <param name="reqDto"></param>
  544. /// <returns></returns>
  545. [HttpPost]
  546. public SRes MaterialReturnTaskCreator(MaterialReturnTaskCreatorRequest reqDto)
  547. {
  548. return ConcurrencyReqControl<MaterialReturnTaskCreatorRequest, SRes>(lockerMaterialReturnTaskCreator, "lockerMaterialReturnTaskCreator", reqDto.LocCode, reqDto, _fjService.MaterialReturnTaskCreator);
  549. }
  550. /// <summary>
  551. /// 叫料信息反馈接口
  552. /// </summary>
  553. /// <param name="billcode"></param>
  554. /// <returns></returns>
  555. [HttpPost(Name = "CurtainProductionStockOutFeedBack")]
  556. public SRes CurtainProductionStockOutFeedBack()
  557. {
  558. var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_StockOut.ToString());
  559. var dtolist = _mapper.Map<List<CurtainProductionStockOutFeedBackRequestItem>>(list);
  560. var dto = new CurtainProductionStockOutFeedBackRequest() { ListInfo = dtolist };
  561. SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
  562. return ComPushData(resbody, list.Select(p => p.Id).ToList());
  563. }
  564. /// <summary>
  565. /// 生产退料/余料接口
  566. /// </summary>
  567. /// <param name="reqDto"></param>
  568. /// <returns></returns>
  569. [HttpPost]
  570. public SRes ProductionBack(FjProductionBackRequest reqDto)
  571. {
  572. return ConcurrencyReqControl<FjProductionBackRequest, SRes>(lockerProductionBack, "ProductionBack", reqDto.BillCode, reqDto, _fjService.ProductionBack);
  573. }
  574. /// <summary>
  575. /// 余料反馈接口
  576. /// </summary>
  577. /// <param name="billcode"></param>
  578. /// <returns></returns>
  579. [HttpPost]
  580. public SRes ProductionLeftFeedBack()
  581. {
  582. var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_LeftStockIn.ToString());
  583. var dtolist = _mapper.Map<List<ProductionLeftFeedBackRequestItem>>(list);
  584. var dto = new ProductionLeftFeedBackRequest() { ListInfo = dtolist };
  585. SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
  586. return ComPushData(resbody, list.Select(p => p.Id).ToList());
  587. }
  588. /// <summary>
  589. /// 异常料出库单传输接口
  590. /// </summary>
  591. /// <param name="reqDto"></param>
  592. /// <returns></returns>
  593. [HttpPost]
  594. public SRes ErrorMaterialStockOut(FjErrorMaterialStockOutRequest reqDto)
  595. {
  596. return ConcurrencyReqControl<FjErrorMaterialStockOutRequest, SRes>(lockerErrorMaterialStockOut, "ErrorMaterialStockOut", reqDto.BillCode, reqDto, _fjService.ErrorMaterialStockOut);
  597. }
  598. /// <summary>
  599. /// 异常料出库反馈接口
  600. /// </summary>
  601. /// <param name="billcode"></param>
  602. /// <returns></returns>
  603. [HttpPost]
  604. public SRes ErrorMaterialStockOutFeedBack()
  605. {
  606. var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_ErrStockOut.ToString());
  607. var dtolist = _mapper.Map<List<ErrorMaterialStockOutFeedBackRequestItem>>(list);
  608. var dto = new ErrorMaterialStockOutFeedBackRequest() { ListInfo = dtolist };
  609. SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
  610. return ComPushData(resbody, list.Select(p => p.Id).ToList());
  611. }
  612. /// <summary>
  613. /// B站叫料单传输接口
  614. /// </summary>
  615. /// <param name="reqDto"></param>
  616. /// <returns></returns>
  617. [HttpPost]
  618. public SRes BGradeMaterialStockOut(BGradeMaterialStockOutRequest reqDto)
  619. {
  620. return ConcurrencyReqControl<BGradeMaterialStockOutRequest, SRes>(lockerBGradeMaterialStockOut, "BGradeMaterialStockOut", reqDto.BillCode, reqDto, _fjService.BGradeMaterialStockOut);
  621. }
  622. /// <summary>
  623. /// B站出库反馈接口
  624. /// </summary>
  625. /// <param name="billcode"></param>
  626. /// <returns></returns>
  627. [HttpPost]
  628. public SRes BGradeMaterialStockOutFeedBack()
  629. {
  630. var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_BGradeStockOut.ToString());
  631. var dtolist = _mapper.Map<List<BGradeMaterialStockOutFeedBackRequestItem>>(list);
  632. var dto = new BGradeMaterialStockOutFeedBackRequest() { ListInfo = dtolist };
  633. SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
  634. return ComPushData(resbody, list.Select(p => p.Id).ToList());
  635. }
  636. /// <summary>
  637. /// 库存改判
  638. /// </summary>
  639. /// <param name="reqDto"></param>
  640. /// <returns></returns>
  641. [HttpPost]
  642. public SRes StockChange(FjStockChangeRequest reqDto)
  643. {
  644. return ConcurrencyReqControl<FjStockChangeRequest, SRes>(lockerlockerStockChange, "FJStockChange", reqDto.BillCode, reqDto, _fjService.StockChange);
  645. }
  646. /// <summary>
  647. /// 改判反馈接口
  648. /// </summary>
  649. /// <param name="request"></param>
  650. /// <returns></returns>
  651. [HttpPost]
  652. public SRes StockChangeFeedBack()
  653. {
  654. var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_StockChanage.ToString());
  655. var dtolist = _mapper.Map<List<StockChangeFeedBackRequestItem>>(list);
  656. var dto = new dto.request.fj.StockChangeFeedBackRequest() { ListInfo = dtolist };
  657. SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
  658. return ComPushData(resbody, list.Select(p => p.Id).ToList());
  659. }
  660. /// <summary>
  661. /// 实时库存查询接口
  662. /// </summary>
  663. /// <param name="reqDto"></param>
  664. /// <returns></returns>
  665. [HttpPost(Name = "GetFJCurStockList")]
  666. public GetFJCurStockListResponse GetFJCurStockList(GetFJCurStockListRequest reqDto)
  667. {
  668. return _fjService.GetCurStockList(reqDto);
  669. }
  670. /// <summary>
  671. /// 回库反馈接口(出库途中改判的,入库之后再次上传入库信息)
  672. /// </summary>
  673. /// <param name="request"></param>
  674. /// <returns></returns>
  675. [HttpPost]
  676. public SRes StockChangeStockInFeedBack()
  677. {
  678. var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_ChanageBack.ToString());
  679. var dtolist = _mapper.Map<List<StockChangeStockInFeedBackRequestItem>>(list);
  680. var dto = new StockChangeStockInFeedBackRequest() { ListInfo = dtolist };
  681. SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
  682. return resbody;
  683. }
  684. /// <summary>
  685. /// 人工组盘传输接口
  686. /// </summary>
  687. /// <param name="reqDto"></param>
  688. /// <returns></returns>
  689. [HttpPost]
  690. public SRes ManualBuildStockTrans(ManualBuildStockTransRequest reqDto)
  691. {
  692. return ConcurrencyReqControl<ManualBuildStockTransRequest, SRes>(lockerManualBuildStockTrans, "ManualBuildStockTrans", reqDto.PalletCode, reqDto, _fjService.ManualBuildStockTrans);
  693. }
  694. /// <summary>
  695. /// 条码信息查询接口
  696. /// </summary>
  697. /// <param name="req"></param>
  698. /// <returns></returns>
  699. [HttpPost]
  700. public string GetMesBarCodeInfo(string req)
  701. {
  702. return "";
  703. }
  704. /// <summary>
  705. /// 空托组盘
  706. /// </summary>
  707. /// <param name="reqDto"></param>
  708. /// <returns></returns>
  709. [HttpPost]
  710. public SRes ManualBuildEmptyStock(ManualBuildEmptyStockRequest reqDto)
  711. {
  712. return ConcurrencyReqControl<ManualBuildEmptyStockRequest, SRes>(lockerManualBuildEmptyStock, "ManualBuildEmptyStock", reqDto.ContGrpBarCode, reqDto, _fjService.ManualBuildEmptyStock);
  713. }
  714. #region 一楼入库任务生成接口
  715. /// <summary>
  716. /// 一楼空托盘人工入库任务创建
  717. /// </summary>
  718. /// <param name="reqDto"></param>
  719. /// <returns></returns>
  720. [HttpPost]
  721. public SRes OneFloorWorkerBuildEmptyPalletsStock(FJBuildEmptyPalletsStockRequest reqDto)
  722. {
  723. return ConcurrencyReqControl<FJBuildEmptyPalletsStockRequest, SRes>(lockOneFloorWorkerBuildEmptyPalletsStock, "OneFloorWorkerBuildEmptyPalletsStock", reqDto.StartLoc, reqDto, _fjService.OneFloorWorkerBuildEmptyPalletsStock);
  724. }
  725. #endregion 一楼入库任务生成接口
  726. /// <summary>
  727. /// 生成组盘任务,空托盘
  728. /// </summary>
  729. /// <param name="reqDto"></param>
  730. /// <returns></returns>
  731. [HttpPost]
  732. public SRes GroupTask(FJBuildEmptyPalletsStockDto reqDto)
  733. {
  734. return ConcurrencyReqControl<FJBuildEmptyPalletsStockDto, SRes>(lockGroupTask, "GroupTask", reqDto.StartLoc, reqDto, _fjService.GroupTask);
  735. }
  736. /// <summary>
  737. /// 整托入库
  738. /// </summary>
  739. /// <param name="reqDto"></param>
  740. /// <returns></returns>
  741. [HttpPost]
  742. public SRes BingPallet(FJBingPalletDto reqDto)
  743. {
  744. return ConcurrencyReqControl<FJBingPalletDto, SRes>(lockBingPallet, "BingPallet" + reqDto.loc, reqDto.loc, reqDto, _fjService.BingPallet);
  745. }
  746. /// <summary>
  747. /// 整托入库
  748. /// </summary>
  749. /// <param name="reqDto"></param>
  750. /// <returns></returns>
  751. [HttpPost]
  752. public SRes<int> GetTwoPallet(FJGetTwoPalletDto reqDto)
  753. {
  754. return ConcurrencyReqControl<FJGetTwoPalletDto, SRes<int>>(lockGetTwoPallet, "GetTwoPallet", reqDto.WarehouseCode, reqDto, _fjService.GetTwoPallet);
  755. }
  756. /// <summary>
  757. /// 申请货位
  758. /// </summary>
  759. /// <param name="reqDto"></param>
  760. /// <returns></returns>
  761. [HttpPost]
  762. public SRes ApplyStockInLoc(FJApplyStockInLocRequest reqDto)
  763. {
  764. return ConcurrencyReqControl<FJApplyStockInLocRequest, SRes<FJApplyStockInLocResponse>>(lockApplyStockInLoc, "ApplyStockInLoc" + reqDto.PickUpEquipmentNo, reqDto.PickUpEquipmentNo, reqDto, _fjService.ApplyStockInLoc);
  765. }
  766. /// <summary>
  767. /// 平库申请货位
  768. /// </summary>
  769. /// <param name="reqEntity"></param>
  770. /// <returns></returns>
  771. [HttpPost]
  772. public SRes<FJApplyStockInLocResponse> FindAvailableFlatStorageSlot(FJApplyStockInLocRequest reqDto)
  773. {
  774. return ConcurrencyReqControl<FJApplyStockInLocRequest, SRes<FJApplyStockInLocResponse>>(lockFindAvailableFlatStorageSlot, "FindAvailableFlatStorageSlot" + reqDto.PickUpEquipmentNo, reqDto.PickUpEquipmentNo, reqDto, _fjService.FindAvailableFlatStorageSlot);
  775. }
  776. /// <summary>
  777. /// 空托出库任务
  778. /// </summary>
  779. /// <param name="reqDto"></param>
  780. /// <returns></returns>
  781. [HttpPost]
  782. public SRes ApplyEmptyPalletGroupOutStorage(FjApplyEmptyPalletGroupOutStorageRequest reqDto)
  783. {
  784. return ConcurrencyReqControl<FjApplyEmptyPalletGroupOutStorageRequest, SRes>(lockApplyEmptyPalletGroupOutStorage, "ApplyEmptyPalletGroupOutStorage", reqDto.AddTo, reqDto, _fjService.ApplyEmptyPalletGroupOutStorage);
  785. }
  786. /// <summary>
  787. /// 获取垛型数组
  788. /// </summary>
  789. /// <param name="req"></param>
  790. /// <returns></returns>
  791. [HttpPost]
  792. public SRes<List<BillBomsetgrp>> FjGetSetGrpList(FjGetSetGrpListRequest req)
  793. {
  794. return _fjService.FjGetSetGrpList(req);
  795. }
  796. /// <summary>
  797. /// 环形库申请货位
  798. /// </summary>
  799. /// <param name="reqDto"></param>
  800. /// <returns></returns>
  801. [HttpPost]
  802. public SRes<FJApplyStockInLocResponse> RingApplyStockInLoc(FJApplyStockInLocRequest reqDto)
  803. {
  804. return ConcurrencyReqControl<FJApplyStockInLocRequest, SRes<FJApplyStockInLocResponse>>(lockRingApplyStockInLoc, "RingApplyStockInLoc" + "Robot", "Robot", reqDto, _fjService.RingApplyStockInLoc);
  805. }
  806. /// <summary>
  807. /// WCS申请码垛出库
  808. /// </summary>
  809. /// <param name="reqDto"></param>
  810. /// <returns></returns>
  811. [HttpPost]
  812. public SRes ApplyPalletizingStockOut(RingApplyPalletizingStockOutRequest reqDto)
  813. {
  814. return ConcurrencyReqControl<RingApplyPalletizingStockOutRequest, SRes>(lockApplyPalletizingStockOut, "ApplyPalletizingStockOut" + reqDto.WareHouseCode, reqDto.WareHouseCode, reqDto, _fjService.ApplyPalletizingStockOut);
  815. }
  816. /// <summary>
  817. /// 手动出库
  818. /// </summary>
  819. /// <param name="request"></param>
  820. /// <returns></returns>
  821. [HttpPost]
  822. public string ManualTask(FJManualTaskRequest request)
  823. {
  824. lock (lockManualTask)
  825. {
  826. return _fjService.ManualTask(request);
  827. }
  828. }
  829. /// <summary>
  830. /// 堆垛机出库放货完成
  831. /// </summary>
  832. /// <param name="reqEntity"></param>
  833. /// <returns></returns>
  834. [HttpPost]
  835. public SRes<int> SrmPickOutCompleted(SrmPickOutCompletedRequest reqDto)
  836. {
  837. lock (lockerSrmPickOutCompleted)
  838. {
  839. return _fjService.SrmPickOutCompleted(reqDto);
  840. }
  841. }
  842. /// <summary>
  843. /// 码垛创建异常任务
  844. /// </summary>
  845. /// <param name="reqEntity"></param>
  846. /// <returns></returns>
  847. [HttpPost]
  848. public SRes PalletizingCreateseErrorTasks(PalletizingCreateseErrorTasksRequest reqDto)
  849. {
  850. return ConcurrencyReqControl<PalletizingCreateseErrorTasksRequest, SRes>(palletizingCreateseErrorTasks, "PalletizingCreateseErrorTasks" + reqDto.EquNo, reqDto.EquNo, reqDto, _fjService.PalletizingCreateseErrorTasks);
  851. }
  852. /// <summary>
  853. /// 获取任务信息
  854. /// </summary>
  855. /// <param name="barCode">条码</param>
  856. /// <returns></returns>
  857. [HttpPost]
  858. public SRes<WCS_TaskOld> GetTaskInfo(FJGetTaskInfoRequest dto)
  859. {
  860. return _fjService.GetTaskInfo(dto);
  861. }
  862. /// <summary>
  863. /// 完成任务
  864. /// </summary>
  865. /// <param name="reqEntity"></param>
  866. /// <returns></returns>
  867. [HttpPost]
  868. public SRes<int> CompleteTask(CompleteTaskRequest reqDto)
  869. {
  870. lock (lockerCompleteTask)
  871. {
  872. return _fjService.CompleteTask(reqDto);
  873. }
  874. }
  875. /// <summary>
  876. /// 取消任务
  877. /// </summary>
  878. /// <param name="reqDto"></param>
  879. /// <returns></returns>
  880. [HttpPost]
  881. public SRes<int> CancelTask(CompleteTaskRequest reqDto)
  882. {
  883. lock (lockerCancelTask)
  884. {
  885. return _fjService.CancelTask(reqDto);
  886. }
  887. }
  888. #region 生成货位基础配置
  889. /// <summary>
  890. /// 分拣自动生成货位信息
  891. /// </summary>
  892. [HttpPost]
  893. public void FJAutoGenerateLocation()
  894. {
  895. //_fjService.FJ1NorthAutoGenerateLocation();
  896. _fjService.FJSouthAutoGenerateLocation();
  897. }
  898. #endregion 生成货位基础配置
  899. #region 生成货位基础配置
  900. /// <summary>
  901. /// 分拣环形库自动生成库位
  902. /// </summary>
  903. [HttpPost]
  904. public void RingLibraryAutoGenerateLocation(string WareCode)
  905. {
  906. _fjService.RingLibraryAutoGenerateLocation(WareCode);
  907. }
  908. #endregion 生成货位基础配置
  909. /// <summary>
  910. /// 工字轮/芯股进入主线扫码
  911. /// </summary>
  912. [HttpPost]
  913. public SRes<SRes> EnteMainLine(FJEnteMainLineRequest reqDto)
  914. {
  915. return ConcurrencyReqControl<FJEnteMainLineRequest, SRes<SRes>>(lockFJEnteMainLineRequest, "EnteMainLine" + reqDto.equNo, reqDto.equNo, reqDto, _fjService.EnteMainLine);
  916. }
  917. [HttpPost]
  918. public string GetId()
  919. {
  920. //var list = _fjService.GetBaseMatinfoList(p => p.Id < 1000);
  921. //foreach (var item in list)
  922. //{
  923. // var id = IdFactory.NewId();
  924. // //var tempid = item.Id;
  925. // item.WarehouseId = id;
  926. // _fjService.UpdateMaterModel(item);
  927. //}
  928. return IdFactory.NewId().ToString();
  929. }
  930. #region 定时器
  931. [HttpPost]
  932. public string StartJob(DetailRequest2Str req)
  933. {
  934. var res = new SRes();
  935. var sysjob = _fjService.GetSysJobEntity(new DetailRequest2Str() { Id = req.Id });
  936. if (sysjob == null)
  937. {
  938. res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
  939. res.ResMsg = "没有找到对应的定时任务";
  940. return res.ToCamelCaseString();
  941. }
  942. JobScheduler.Start(sysjob.Code, Type.GetType("wms.api.Job.PostJob"), sysjob.CronExpression);
  943. return res.ToCamelCaseString();
  944. }
  945. /// <summary>
  946. /// 执行job
  947. /// </summary>
  948. /// <param name="reqEntity"></param>
  949. /// <returns></returns>
  950. [HttpPost]
  951. public string ExecuteJob(DetailCodeRequest reqEntity)
  952. {
  953. var res = new SRes();
  954. if (string.IsNullOrEmpty(reqEntity.Code))
  955. {
  956. res.ResCode = ResponseStatusCodeEnum.ErrParam.GetHashCode();
  957. res.ResMsg = "参数错误";
  958. return res.ToCamelCaseString();
  959. }
  960. var jobEntity = _fjService.GetSysJobEntityByCode(reqEntity.Code);
  961. if (jobEntity == null)
  962. {
  963. res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
  964. res.ResMsg = "没有找到该编码";
  965. return res.ToCamelCaseString();
  966. }
  967. var jobapilist = _fjService.GetSysApiDetail(jobEntity.Id);
  968. if (jobapilist.Any())
  969. {
  970. foreach (var item in jobapilist)
  971. {
  972. Task.Run(() => { HttpUtil.PostRequest(item.ApiUrl, item.RequestBody); });
  973. }
  974. }
  975. return res.ToCamelCaseString();
  976. }
  977. /// <summary>
  978. /// 分页Job列表
  979. /// </summary>
  980. /// <param name="reqEntity"></param>
  981. /// <returns></returns>
  982. [HttpPost]
  983. public List<dto.response.hj.SysJobDto> GetSysJobList(GetSysJobListRequest reqEntity)
  984. {
  985. var list = _fjService.GetJobList();
  986. var listdto = _mapper.Map<List<dto.response.hj.SysJobDto>>(list);
  987. if (listdto != null && listdto.Any())
  988. {
  989. for (int i = 0; i < list.Count; i++)
  990. {
  991. listdto[i].JobExecuteStatus = GetExecuteStatus(new DetailCodeRequest() { Code = listdto[i].Code });
  992. }
  993. return listdto;
  994. }
  995. return new List<dto.response.hj.SysJobDto>();
  996. }
  997. /// <summary>
  998. /// 获取执行状态
  999. /// </summary>
  1000. /// <param name="reqEntity"></param>
  1001. /// <returns></returns>
  1002. [HttpPost]
  1003. public string GetExecuteStatus(DetailCodeRequest reqEntity)
  1004. {
  1005. var jobInfo = _fjService.GetSysJobEntityByCode(reqEntity.Code);
  1006. var jobs = JobScheduler.GetJobList(Const.JobGroupName).Result;
  1007. if (jobs != null)
  1008. {
  1009. var temp = jobs.Where(p => p.JobName == jobInfo.Code);
  1010. if (temp.Any())
  1011. {
  1012. return temp.First().JobStatus;
  1013. }
  1014. else
  1015. {
  1016. return "Stop";
  1017. }
  1018. }
  1019. else
  1020. {
  1021. return "Stop";
  1022. }
  1023. }
  1024. #endregion 定时器
  1025. }
  1026. }