FjController.cs 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119
  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. /// 芯股满托创建库存信息
  512. /// </summary>
  513. /// <param name="reqDto"></param>
  514. /// <returns></returns>
  515. [HttpPost]
  516. public SRes CreateMaterialPalletWarehouTask1(CreateMaterialPalletWarehouTask1Request reqDto)
  517. {
  518. return ConcurrencyReqControl<CreateMaterialPalletWarehouTask1Request, SRes>(lockerCreateMaterialPalletWarehouTask1, "CreateMaterialPalletWarehouTask1", reqDto.SpoolNr, reqDto, _fjService.CreateMaterialPalletWarehouTask1);
  519. }
  520. /// <summary>
  521. /// 芯股满托创建库存信息
  522. /// </summary>
  523. /// <param name="reqDto"></param>
  524. /// <returns></returns>
  525. [HttpPost]
  526. public SRes CreateMaterialPalletWarehouTask2(RewindFullPalletTaskRequest reqDto)
  527. {
  528. return ConcurrencyReqControl<RewindFullPalletTaskRequest, SRes>(lockerCreateMaterialPalletWarehouTask2, "CreateMaterialPalletWarehouTask2", reqDto.TrayCode, reqDto, _fjService.CreateMaterialPalletWarehouTask2);
  529. }
  530. /// <summary>
  531. /// 创建退料任务
  532. /// </summary>
  533. /// <param name="reqDto"></param>
  534. /// <returns></returns>
  535. [HttpPost]
  536. public SRes MaterialReturnTaskCreator(MaterialReturnTaskCreatorRequest reqDto)
  537. {
  538. return ConcurrencyReqControl<MaterialReturnTaskCreatorRequest, SRes>(lockerMaterialReturnTaskCreator, "lockerMaterialReturnTaskCreator", reqDto.LocCode, reqDto, _fjService.MaterialReturnTaskCreator);
  539. }
  540. /// <summary>
  541. /// 叫料信息反馈接口
  542. /// </summary>
  543. /// <param name="billcode"></param>
  544. /// <returns></returns>
  545. [HttpPost(Name = "CurtainProductionStockOutFeedBack")]
  546. public SRes CurtainProductionStockOutFeedBack()
  547. {
  548. var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_StockOut.ToString());
  549. var dtolist = _mapper.Map<List<CurtainProductionStockOutFeedBackRequestItem>>(list);
  550. var dto = new CurtainProductionStockOutFeedBackRequest() { ListInfo = dtolist };
  551. SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
  552. return ComPushData(resbody, list.Select(p => p.Id).ToList());
  553. }
  554. /// <summary>
  555. /// 生产退料/余料接口
  556. /// </summary>
  557. /// <param name="reqDto"></param>
  558. /// <returns></returns>
  559. [HttpPost]
  560. public SRes ProductionBack(FjProductionBackRequest reqDto)
  561. {
  562. return ConcurrencyReqControl<FjProductionBackRequest, SRes>(lockerProductionBack, "ProductionBack", reqDto.BillCode, reqDto, _fjService.ProductionBack);
  563. }
  564. /// <summary>
  565. /// 余料反馈接口
  566. /// </summary>
  567. /// <param name="billcode"></param>
  568. /// <returns></returns>
  569. [HttpPost]
  570. public SRes ProductionLeftFeedBack()
  571. {
  572. var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_LeftStockIn.ToString());
  573. var dtolist = _mapper.Map<List<ProductionLeftFeedBackRequestItem>>(list);
  574. var dto = new ProductionLeftFeedBackRequest() { ListInfo = dtolist };
  575. SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
  576. return ComPushData(resbody, list.Select(p => p.Id).ToList());
  577. }
  578. /// <summary>
  579. /// 异常料出库单传输接口
  580. /// </summary>
  581. /// <param name="reqDto"></param>
  582. /// <returns></returns>
  583. [HttpPost]
  584. public SRes ErrorMaterialStockOut(FjErrorMaterialStockOutRequest reqDto)
  585. {
  586. return ConcurrencyReqControl<FjErrorMaterialStockOutRequest, SRes>(lockerErrorMaterialStockOut, "ErrorMaterialStockOut", reqDto.BillCode, reqDto, _fjService.ErrorMaterialStockOut);
  587. }
  588. /// <summary>
  589. /// 异常料出库反馈接口
  590. /// </summary>
  591. /// <param name="billcode"></param>
  592. /// <returns></returns>
  593. [HttpPost]
  594. public SRes ErrorMaterialStockOutFeedBack()
  595. {
  596. var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_ErrStockOut.ToString());
  597. var dtolist = _mapper.Map<List<ErrorMaterialStockOutFeedBackRequestItem>>(list);
  598. var dto = new ErrorMaterialStockOutFeedBackRequest() { ListInfo = dtolist };
  599. SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
  600. return ComPushData(resbody, list.Select(p => p.Id).ToList());
  601. }
  602. /// <summary>
  603. /// B站叫料单传输接口
  604. /// </summary>
  605. /// <param name="reqDto"></param>
  606. /// <returns></returns>
  607. [HttpPost]
  608. public SRes BGradeMaterialStockOut(BGradeMaterialStockOutRequest reqDto)
  609. {
  610. return ConcurrencyReqControl<BGradeMaterialStockOutRequest, SRes>(lockerBGradeMaterialStockOut, "BGradeMaterialStockOut", reqDto.BillCode, reqDto, _fjService.BGradeMaterialStockOut);
  611. }
  612. /// <summary>
  613. /// B站出库反馈接口
  614. /// </summary>
  615. /// <param name="billcode"></param>
  616. /// <returns></returns>
  617. [HttpPost]
  618. public SRes BGradeMaterialStockOutFeedBack()
  619. {
  620. var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_BGradeStockOut.ToString());
  621. var dtolist = _mapper.Map<List<BGradeMaterialStockOutFeedBackRequestItem>>(list);
  622. var dto = new BGradeMaterialStockOutFeedBackRequest() { ListInfo = dtolist };
  623. SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
  624. return ComPushData(resbody, list.Select(p => p.Id).ToList());
  625. }
  626. /// <summary>
  627. /// 库存改判
  628. /// </summary>
  629. /// <param name="reqDto"></param>
  630. /// <returns></returns>
  631. [HttpPost]
  632. public SRes StockChange(FjStockChangeRequest reqDto)
  633. {
  634. return ConcurrencyReqControl<FjStockChangeRequest, SRes>(lockerlockerStockChange, "FJStockChange", reqDto.BillCode, reqDto, _fjService.StockChange);
  635. }
  636. /// <summary>
  637. /// 改判反馈接口
  638. /// </summary>
  639. /// <param name="request"></param>
  640. /// <returns></returns>
  641. [HttpPost]
  642. public SRes StockChangeFeedBack()
  643. {
  644. var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_StockChanage.ToString());
  645. var dtolist = _mapper.Map<List<StockChangeFeedBackRequestItem>>(list);
  646. var dto = new dto.request.fj.StockChangeFeedBackRequest() { ListInfo = dtolist };
  647. SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
  648. return ComPushData(resbody, list.Select(p => p.Id).ToList());
  649. }
  650. /// <summary>
  651. /// 实时库存查询接口
  652. /// </summary>
  653. /// <param name="reqDto"></param>
  654. /// <returns></returns>
  655. [HttpPost(Name = "GetFJCurStockList")]
  656. public GetFJCurStockListResponse GetFJCurStockList(GetFJCurStockListRequest reqDto)
  657. {
  658. return _fjService.GetCurStockList(reqDto);
  659. }
  660. /// <summary>
  661. /// 回库反馈接口(出库途中改判的,入库之后再次上传入库信息)
  662. /// </summary>
  663. /// <param name="request"></param>
  664. /// <returns></returns>
  665. [HttpPost]
  666. public SRes StockChangeStockInFeedBack()
  667. {
  668. var list = _fjService.GetBillPushinfoList(p => p.PostResult != 1 && p.PostQty <= 5 && p.TypeCode == fjFackbeekType.InterfaceType_FJ_ChanageBack.ToString());
  669. var dtolist = _mapper.Map<List<StockChangeStockInFeedBackRequestItem>>(list);
  670. var dto = new StockChangeStockInFeedBackRequest() { ListInfo = dtolist };
  671. SRes resbody = JsonConvert.DeserializeObject<SRes>(WmsServiceExportApi(dto));
  672. return resbody;
  673. }
  674. /// <summary>
  675. /// 人工组盘传输接口
  676. /// </summary>
  677. /// <param name="reqDto"></param>
  678. /// <returns></returns>
  679. [HttpPost]
  680. public SRes ManualBuildStockTrans(ManualBuildStockTransRequest reqDto)
  681. {
  682. return ConcurrencyReqControl<ManualBuildStockTransRequest, SRes>(lockerManualBuildStockTrans, "ManualBuildStockTrans", reqDto.PalletCode, reqDto, _fjService.ManualBuildStockTrans);
  683. }
  684. /// <summary>
  685. /// 条码信息查询接口
  686. /// </summary>
  687. /// <param name="req"></param>
  688. /// <returns></returns>
  689. [HttpPost]
  690. public string GetMesBarCodeInfo(string req)
  691. {
  692. return "";
  693. }
  694. /// <summary>
  695. /// 空托组盘
  696. /// </summary>
  697. /// <param name="reqDto"></param>
  698. /// <returns></returns>
  699. [HttpPost]
  700. public SRes ManualBuildEmptyStock(ManualBuildEmptyStockRequest reqDto)
  701. {
  702. return ConcurrencyReqControl<ManualBuildEmptyStockRequest, SRes>(lockerManualBuildEmptyStock, "ManualBuildEmptyStock", reqDto.ContGrpBarCode, reqDto, _fjService.ManualBuildEmptyStock);
  703. }
  704. #region 一楼入库任务生成接口
  705. /// <summary>
  706. /// 一楼空托盘人工入库任务创建
  707. /// </summary>
  708. /// <param name="reqDto"></param>
  709. /// <returns></returns>
  710. [HttpPost]
  711. public SRes OneFloorWorkerBuildEmptyPalletsStock(FJBuildEmptyPalletsStockRequest reqDto)
  712. {
  713. return ConcurrencyReqControl<FJBuildEmptyPalletsStockRequest, SRes>(lockOneFloorWorkerBuildEmptyPalletsStock, "OneFloorWorkerBuildEmptyPalletsStock", reqDto.StartLoc, reqDto, _fjService.OneFloorWorkerBuildEmptyPalletsStock);
  714. }
  715. #endregion 一楼入库任务生成接口
  716. /// <summary>
  717. /// 生成组盘任务,空托盘
  718. /// </summary>
  719. /// <param name="reqDto"></param>
  720. /// <returns></returns>
  721. [HttpPost]
  722. public SRes GroupTask(FJBuildEmptyPalletsStockDto reqDto)
  723. {
  724. return ConcurrencyReqControl<FJBuildEmptyPalletsStockDto, SRes>(lockGroupTask, "GroupTask", reqDto.StartLoc, reqDto, _fjService.GroupTask);
  725. }
  726. /// <summary>
  727. /// 整托入库
  728. /// </summary>
  729. /// <param name="reqDto"></param>
  730. /// <returns></returns>
  731. [HttpPost]
  732. public SRes BingPallet(FJBingPalletDto reqDto)
  733. {
  734. return ConcurrencyReqControl<FJBingPalletDto, SRes>(lockBingPallet, "BingPallet" + reqDto.loc, reqDto.loc, reqDto, _fjService.BingPallet);
  735. }
  736. /// <summary>
  737. /// 整托入库
  738. /// </summary>
  739. /// <param name="reqDto"></param>
  740. /// <returns></returns>
  741. [HttpPost]
  742. public SRes<int> GetTwoPallet(FJGetTwoPalletDto reqDto)
  743. {
  744. return ConcurrencyReqControl<FJGetTwoPalletDto, SRes<int>>(lockGetTwoPallet, "GetTwoPallet", reqDto.WarehouseCode, reqDto, _fjService.GetTwoPallet);
  745. }
  746. /// <summary>
  747. /// 申请货位
  748. /// </summary>
  749. /// <param name="reqDto"></param>
  750. /// <returns></returns>
  751. [HttpPost]
  752. public SRes ApplyStockInLoc(FJApplyStockInLocRequest reqDto)
  753. {
  754. return ConcurrencyReqControl<FJApplyStockInLocRequest, SRes<FJApplyStockInLocResponse>>(lockApplyStockInLoc, "ApplyStockInLoc" + reqDto.PickUpEquipmentNo, reqDto.PickUpEquipmentNo, reqDto, _fjService.ApplyStockInLoc);
  755. }
  756. /// <summary>
  757. /// 平库申请货位
  758. /// </summary>
  759. /// <param name="reqEntity"></param>
  760. /// <returns></returns>
  761. [HttpPost]
  762. public SRes<FJApplyStockInLocResponse> FindAvailableFlatStorageSlot(FJApplyStockInLocRequest reqDto)
  763. {
  764. return ConcurrencyReqControl<FJApplyStockInLocRequest, SRes<FJApplyStockInLocResponse>>(lockFindAvailableFlatStorageSlot, "FindAvailableFlatStorageSlot" + reqDto.PickUpEquipmentNo, reqDto.PickUpEquipmentNo, reqDto, _fjService.FindAvailableFlatStorageSlot);
  765. }
  766. /// <summary>
  767. /// 空托出库任务
  768. /// </summary>
  769. /// <param name="reqDto"></param>
  770. /// <returns></returns>
  771. [HttpPost]
  772. public SRes ApplyEmptyPalletGroupOutStorage(FjApplyEmptyPalletGroupOutStorageRequest reqDto)
  773. {
  774. return ConcurrencyReqControl<FjApplyEmptyPalletGroupOutStorageRequest, SRes>(lockApplyEmptyPalletGroupOutStorage, "ApplyEmptyPalletGroupOutStorage", reqDto.AddTo, reqDto, _fjService.ApplyEmptyPalletGroupOutStorage);
  775. }
  776. /// <summary>
  777. /// 获取垛型数组
  778. /// </summary>
  779. /// <param name="req"></param>
  780. /// <returns></returns>
  781. [HttpPost]
  782. public SRes<List<BillBomsetgrp>> FjGetSetGrpList(FjGetSetGrpListRequest req)
  783. {
  784. return _fjService.FjGetSetGrpList(req);
  785. }
  786. /// <summary>
  787. /// 环形库申请货位
  788. /// </summary>
  789. /// <param name="reqDto"></param>
  790. /// <returns></returns>
  791. [HttpPost]
  792. public SRes<FJApplyStockInLocResponse> RingApplyStockInLoc(FJApplyStockInLocRequest reqDto)
  793. {
  794. return ConcurrencyReqControl<FJApplyStockInLocRequest, SRes<FJApplyStockInLocResponse>>(lockRingApplyStockInLoc, "RingApplyStockInLoc" + "Robot", "Robot", reqDto, _fjService.RingApplyStockInLoc);
  795. }
  796. /// <summary>
  797. /// WCS申请码垛出库
  798. /// </summary>
  799. /// <param name="reqDto"></param>
  800. /// <returns></returns>
  801. [HttpPost]
  802. public SRes ApplyPalletizingStockOut(RingApplyPalletizingStockOutRequest reqDto)
  803. {
  804. return ConcurrencyReqControl<RingApplyPalletizingStockOutRequest, SRes>(lockApplyPalletizingStockOut, "ApplyPalletizingStockOut" + reqDto.WareHouseCode, reqDto.WareHouseCode, reqDto, _fjService.ApplyPalletizingStockOut);
  805. }
  806. /// <summary>
  807. /// 手动出库
  808. /// </summary>
  809. /// <param name="request"></param>
  810. /// <returns></returns>
  811. [HttpPost]
  812. public string ManualTask(FJManualTaskRequest request)
  813. {
  814. lock (lockManualTask)
  815. {
  816. return _fjService.ManualTask(request);
  817. }
  818. }
  819. /// <summary>
  820. /// 堆垛机出库放货完成
  821. /// </summary>
  822. /// <param name="reqEntity"></param>
  823. /// <returns></returns>
  824. [HttpPost]
  825. public SRes<int> SrmPickOutCompleted(SrmPickOutCompletedRequest reqDto)
  826. {
  827. lock (lockerSrmPickOutCompleted)
  828. {
  829. return _fjService.SrmPickOutCompleted(reqDto);
  830. }
  831. }
  832. /// <summary>
  833. /// 码垛创建异常任务
  834. /// </summary>
  835. /// <param name="reqEntity"></param>
  836. /// <returns></returns>
  837. [HttpPost]
  838. public SRes PalletizingCreateseErrorTasks(PalletizingCreateseErrorTasksRequest reqDto)
  839. {
  840. return ConcurrencyReqControl<PalletizingCreateseErrorTasksRequest, SRes>(palletizingCreateseErrorTasks, "PalletizingCreateseErrorTasks" + reqDto.EquNo, reqDto.EquNo, reqDto, _fjService.PalletizingCreateseErrorTasks);
  841. }
  842. /// <summary>
  843. /// 获取任务信息
  844. /// </summary>
  845. /// <param name="barCode">条码</param>
  846. /// <returns></returns>
  847. [HttpPost]
  848. public SRes<WCS_TaskOld> GetTaskInfo(FJGetTaskInfoRequest dto)
  849. {
  850. return _fjService.GetTaskInfo(dto);
  851. }
  852. /// <summary>
  853. /// 完成任务
  854. /// </summary>
  855. /// <param name="reqEntity"></param>
  856. /// <returns></returns>
  857. [HttpPost]
  858. public SRes<int> CompleteTask(CompleteTaskRequest reqDto)
  859. {
  860. lock (lockerCompleteTask)
  861. {
  862. return _fjService.CompleteTask(reqDto);
  863. }
  864. }
  865. /// <summary>
  866. /// 取消任务
  867. /// </summary>
  868. /// <param name="reqDto"></param>
  869. /// <returns></returns>
  870. [HttpPost]
  871. public SRes<int> CancelTask(CompleteTaskRequest reqDto)
  872. {
  873. lock (lockerCancelTask)
  874. {
  875. return _fjService.CancelTask(reqDto);
  876. }
  877. }
  878. #region 生成货位基础配置
  879. /// <summary>
  880. /// 分拣自动生成货位信息
  881. /// </summary>
  882. [HttpPost]
  883. public void FJAutoGenerateLocation()
  884. {
  885. //_fjService.FJ1NorthAutoGenerateLocation();
  886. _fjService.FJSouthAutoGenerateLocation();
  887. }
  888. #endregion 生成货位基础配置
  889. #region 生成货位基础配置
  890. /// <summary>
  891. /// 分拣环形库自动生成库位
  892. /// </summary>
  893. [HttpPost]
  894. public void RingLibraryAutoGenerateLocation(string WareCode)
  895. {
  896. _fjService.RingLibraryAutoGenerateLocation(WareCode);
  897. }
  898. #endregion 生成货位基础配置
  899. /// <summary>
  900. /// 工字轮/芯股进入主线扫码
  901. /// </summary>
  902. [HttpPost]
  903. public SRes<SRes> EnteMainLine(FJEnteMainLineRequest reqDto)
  904. {
  905. return ConcurrencyReqControl<FJEnteMainLineRequest, SRes<SRes>>(lockFJEnteMainLineRequest, "EnteMainLine" + reqDto.equNo, reqDto.equNo, reqDto, _fjService.EnteMainLine);
  906. }
  907. [HttpPost]
  908. public string GetId()
  909. {
  910. //var list = _fjService.GetBaseMatinfoList(p => p.Id < 1000);
  911. //foreach (var item in list)
  912. //{
  913. // var id = IdFactory.NewId();
  914. // //var tempid = item.Id;
  915. // item.WarehouseId = id;
  916. // _fjService.UpdateMaterModel(item);
  917. //}
  918. return IdFactory.NewId().ToString();
  919. }
  920. #region 定时器
  921. [HttpPost]
  922. public string StartJob(DetailRequest2Str req)
  923. {
  924. var res = new SRes();
  925. var sysjob = _fjService.GetSysJobEntity(new DetailRequest2Str() { Id = req.Id });
  926. if (sysjob == null)
  927. {
  928. res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
  929. res.ResMsg = "没有找到对应的定时任务";
  930. return res.ToCamelCaseString();
  931. }
  932. JobScheduler.Start(sysjob.Code, Type.GetType("wms.api.Job.PostJob"), sysjob.CronExpression);
  933. return res.ToCamelCaseString();
  934. }
  935. /// <summary>
  936. /// 执行job
  937. /// </summary>
  938. /// <param name="reqEntity"></param>
  939. /// <returns></returns>
  940. [HttpPost]
  941. public string ExecuteJob(DetailCodeRequest reqEntity)
  942. {
  943. var res = new SRes();
  944. if (string.IsNullOrEmpty(reqEntity.Code))
  945. {
  946. res.ResCode = ResponseStatusCodeEnum.ErrParam.GetHashCode();
  947. res.ResMsg = "参数错误";
  948. return res.ToCamelCaseString();
  949. }
  950. var jobEntity = _fjService.GetSysJobEntityByCode(reqEntity.Code);
  951. if (jobEntity == null)
  952. {
  953. res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
  954. res.ResMsg = "没有找到该编码";
  955. return res.ToCamelCaseString();
  956. }
  957. var jobapilist = _fjService.GetSysApiDetail(jobEntity.Id);
  958. if (jobapilist.Any())
  959. {
  960. foreach (var item in jobapilist)
  961. {
  962. Task.Run(() => { HttpUtil.PostRequest(item.ApiUrl, item.RequestBody); });
  963. }
  964. }
  965. return res.ToCamelCaseString();
  966. }
  967. /// <summary>
  968. /// 分页Job列表
  969. /// </summary>
  970. /// <param name="reqEntity"></param>
  971. /// <returns></returns>
  972. [HttpPost]
  973. public List<dto.response.hj.SysJobDto> GetSysJobList(GetSysJobListRequest reqEntity)
  974. {
  975. var list = _fjService.GetJobList();
  976. var listdto = _mapper.Map<List<dto.response.hj.SysJobDto>>(list);
  977. if (listdto != null && listdto.Any())
  978. {
  979. for (int i = 0; i < list.Count; i++)
  980. {
  981. listdto[i].JobExecuteStatus = GetExecuteStatus(new DetailCodeRequest() { Code = listdto[i].Code });
  982. }
  983. return listdto;
  984. }
  985. return new List<dto.response.hj.SysJobDto>();
  986. }
  987. /// <summary>
  988. /// 获取执行状态
  989. /// </summary>
  990. /// <param name="reqEntity"></param>
  991. /// <returns></returns>
  992. [HttpPost]
  993. public string GetExecuteStatus(DetailCodeRequest reqEntity)
  994. {
  995. var jobInfo = _fjService.GetSysJobEntityByCode(reqEntity.Code);
  996. var jobs = JobScheduler.GetJobList(Const.JobGroupName).Result;
  997. if (jobs != null)
  998. {
  999. var temp = jobs.Where(p => p.JobName == jobInfo.Code);
  1000. if (temp.Any())
  1001. {
  1002. return temp.First().JobStatus;
  1003. }
  1004. else
  1005. {
  1006. return "Stop";
  1007. }
  1008. }
  1009. else
  1010. {
  1011. return "Stop";
  1012. }
  1013. }
  1014. #endregion 定时器
  1015. }
  1016. }