StartService.java 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package com.ruoyi.init;
  2. import com.ruoyi.ams.agv.ndc.AciService;
  3. import com.ruoyi.ams.agv.ndc.config.TestTagConfig;
  4. import com.ruoyi.ams.agv.ndc.thread.AciServiceThread;
  5. import com.ruoyi.ams.agv.ndc.thread.AutoTaskThread;
  6. import com.ruoyi.ams.business.IBusinessService;
  7. import com.ruoyi.ams.erp.service.ISyncService;
  8. import com.ruoyi.ams.erp.service.impl.SyncServiceImpl;
  9. import com.ruoyi.common.utils.http.HttpRequest;
  10. import com.ruoyi.common.utils.http.HttpUtils;
  11. import com.ruoyi.system.service.ISysConfigService;
  12. import com.ruoyi.thread.ServerGs;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.boot.CommandLineRunner;
  15. import org.springframework.stereotype.Component;
  16. @Component("startService")
  17. public class StartService implements CommandLineRunner {
  18. @Autowired
  19. private IBusinessService businessService;
  20. @Autowired
  21. private ISysConfigService configService;
  22. @Autowired
  23. private TestTagConfig testTagConfig;
  24. @Autowired
  25. private AciService aciService;
  26. @Autowired
  27. private ISyncService iSyncService;
  28. @Override
  29. public void run(String... args) throws Exception {
  30. //自动下发任务
  31. if (testTagConfig.getAutoSend()) {
  32. Thread thread = new Thread(new AutoTaskThread(businessService));
  33. thread.start();
  34. }
  35. //ndc下发
  36. if (testTagConfig.getAciService()) {
  37. Thread thread = new Thread(new AciServiceThread(aciService));
  38. thread.start();
  39. }
  40. //光栅检测
  41. if (testTagConfig.getGsService()) {
  42. ServerGs server = new ServerGs(2002, configService);
  43. server.start();
  44. }
  45. }
  46. // 同步ERP表,sqlserver插入redis
  47. public void yongHuErp() throws Exception {
  48. HttpRequest.postData(SyncServiceImpl.ERP_SYNC_URL);
  49. }
  50. // 同步ERP表,redis插入mysql
  51. public void syncService() {
  52. iSyncService.syncSkuType();
  53. iSyncService.syncSku();
  54. iSyncService.syncSkuBarcode();
  55. iSyncService.syncOrderList();
  56. }
  57. // 回传ERP入库单
  58. public void callBackAsn() throws Exception {
  59. iSyncService.callBackAsn();
  60. }
  61. // 回传ERP出库单
  62. public void callBackOrder() throws Exception {
  63. iSyncService.callBackOrder();
  64. }
  65. }