|  |  |  | 
|---|
|  |  |  | import com.zy.core.properties.SlaveProperties; | 
|---|
|  |  |  | import com.zy.core.thread.BarcodeThread; | 
|---|
|  |  |  | import com.zy.core.thread.SiemensDevpThread; | 
|---|
|  |  |  | import com.zy.system.service.ConfigService; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Value; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.transaction.interceptor.TransactionAspectSupport; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.io.IOException; | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | @Service("mainService") | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | public class MainServiceImpl { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static final long COMMAND_TIMEOUT = 5 * 1000; | 
|---|
|  |  |  | 
|---|
|  |  |  | if (staProtocol.isAutoing() | 
|---|
|  |  |  | && staProtocol.isLoading() | 
|---|
|  |  |  | && staProtocol.isInEnable() | 
|---|
|  |  |  | && !staProtocol.isEmptyMk() | 
|---|
|  |  |  | //                            && !staProtocol.isEmptyMk() | 
|---|
|  |  |  | && staProtocol.isPakMk() | 
|---|
|  |  |  | && (staProtocol.getWorkNo() == 9999 || staProtocol.getWorkNo() == 9998) | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | 
|---|
|  |  |  | String barcode = barcodeThread.getBarcode(); | 
|---|
|  |  |  | if (Cools.isEmpty(barcode)) { | 
|---|
|  |  |  | News.watchInfo(String.valueOf(staProtocol.getSiteId()), "入库信号满足,托盘码为空"); | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | StaDesc staDesc2 = staDescService.selectOne(new EntityWrapper<StaDesc>().eq("type_no", 1).eq("stn_no", staProtocol.getSiteId())); | 
|---|
|  |  |  | List<TaskWrk> taskWrkOutList = taskWrkService.selectList(new EntityWrapper<TaskWrk>() | 
|---|
|  |  |  | .eq("crn_no", staDesc2.getCrnNo()) | 
|---|
|  |  |  | .eq("wrk_sts", 12) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if (!taskWrkOutList.isEmpty()) { | 
|---|
|  |  |  | News.watchInfo(String.valueOf(staProtocol.getSiteId()), "申请入库任务时发现正在执行的出库任务,入库任务被强制退回"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | staProtocol.setWorkNo(9997); | 
|---|
|  |  |  | staProtocol.setStaNo(inSta.getBackSta().shortValue()); | 
|---|
|  |  |  | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | requestParam.put("wcsStatus", 0);//成功 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String response = ""; | 
|---|
|  |  |  | String response = "None"; | 
|---|
|  |  |  | Boolean success = false; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | Object object = redisUtil.get(RedisKeyType.IN_TASK_LOCK.key); | 
|---|
|  |  |  | Object object = redisUtil.get(RedisKeyType.IN_TASK_LOCK.key + inSta.getStaNo()); | 
|---|
|  |  |  | if(object != null) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | .build() | 
|---|
|  |  |  | .doPost(); | 
|---|
|  |  |  | JSONObject jsonObject = JSON.parseObject(response); | 
|---|
|  |  |  | redisUtil.set(RedisKeyType.IN_TASK_LOCK.key, "lock", 5); | 
|---|
|  |  |  | log.info(response); | 
|---|
|  |  |  | redisUtil.set(RedisKeyType.IN_TASK_LOCK.key + inSta.getStaNo(), "lock", 5); | 
|---|
|  |  |  | if (jsonObject.getInteger("code") == 200) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } else if (jsonObject.getInteger("code") == 500) { | 
|---|
|  |  |  | 
|---|
|  |  |  | taskWrk.setBarcode(barcode);//条码 | 
|---|
|  |  |  | taskWrk.setCrnNo(locMast.getCrnNo()); | 
|---|
|  |  |  | taskWrk.setTargetPoint(resultLocNo); | 
|---|
|  |  |  | taskWrk.setStartPoint(String.valueOf(staProtocol.getStaNo())); | 
|---|
|  |  |  | taskWrk.setStartPoint(String.valueOf(inSta.getStaNo())); | 
|---|
|  |  |  | if (!Cools.isEmpty(taskWrk.getTargetPoint())) { | 
|---|
|  |  |  | taskWrk.setOriginTargetPoint(taskWrk.getTargetPoint()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | flag = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!flag) { | 
|---|
|  |  |  | News.watchError(crnStn.getStaNo() + "站点", "入库 ===>> 堆垛机站点状态检测失败,站点需要满足:自动、有物、有工作号、站点可入"); | 
|---|
|  |  |  | //                    News.watchError(crnStn.getStaNo() + "站点", "入库 ===>> 堆垛机站点状态检测失败,站点需要满足:自动、有物、有工作号、站点可入"); | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|