package com.ruoyi.init; import com.ruoyi.ams.agv.ndc.AciService; import com.ruoyi.ams.agv.ndc.config.TestTagConfig; import com.ruoyi.ams.agv.ndc.thread.AciServiceThread; import com.ruoyi.ams.agv.ndc.thread.AutoTaskThread; import com.ruoyi.ams.business.IBusinessService; import com.ruoyi.ams.erp.service.ISyncService; import com.ruoyi.ams.erp.service.impl.SyncServiceImpl; import com.ruoyi.common.utils.http.HttpRequest; import com.ruoyi.common.utils.http.HttpUtils; import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.thread.ServerGs; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; @Component("startService") public class StartService implements CommandLineRunner { @Autowired private IBusinessService businessService; @Autowired private ISysConfigService configService; @Autowired private TestTagConfig testTagConfig; @Autowired private AciService aciService; @Autowired private ISyncService iSyncService; @Override public void run(String... args) throws Exception { //自动下发任务 if (testTagConfig.getAutoSend()) { Thread thread = new Thread(new AutoTaskThread(businessService)); thread.start(); } //ndc下发 if (testTagConfig.getAciService()) { Thread thread = new Thread(new AciServiceThread(aciService)); thread.start(); } //光栅检测 if (testTagConfig.getGsService()) { ServerGs server = new ServerGs(2002, configService); server.start(); } } // 同步ERP表,sqlserver插入redis public void yongHuErp() throws Exception { HttpRequest.postData(SyncServiceImpl.ERP_SYNC_URL); } // 同步ERP表,redis插入mysql public void syncService() { iSyncService.syncSkuType(); iSyncService.syncSku(); iSyncService.syncSkuBarcode(); iSyncService.syncOrderList(); } // 回传ERP入库单 public void callBackAsn() throws Exception { iSyncService.callBackAsn(); } // 回传ERP出库单 public void callBackOrder() throws Exception { iSyncService.callBackOrder(); } }