| | |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @Service("mainService") |
| | | @Transactional |
| | | public class MainServiceImpl { |
| | | |
| | | @Autowired |
| | | private RowLastnoService rowLastnoService; |
| | | |
| | | public void test(){ |
| | | try { |
| | | // 工作号 |
| | | int workNo = commonService.getWorkNo(0); |
| | | System.out.println(workNo); |
| | | if (workNo > 0) { |
| | | throw new CoolException("21321"); |
| | | } |
| | | RowLastno rowLastno = rowLastnoService.selectById(1); |
| | | rowLastno.setCurrentRow(rowLastno.getCurrentRow() + 1); |
| | | rowLastnoService.updateById(rowLastno); |
| | | System.out.println(rowLastno.getCurrentRow()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | | private CommonService commonService; |
| | |
| | | log.error("无此入库条码数据。条码号={}", barcode); |
| | | continue; |
| | | } |
| | | |
| | | try { |
| | | // 工作号 |
| | | int workNo = commonService.getWorkNo(0); |
| | | // 检索库位 |
| | |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | |
| | | } |
| | |
| | | continue; |
| | | } |
| | | |
| | | // todo:luxiaotao |
| | | |
| | | try { |
| | | // 保存工作明细档历史档 |
| | | if (wrkMastMapper.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) { |
| | | throw new CoolException("保存工作明细档历史档失败"); |
| | |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("修改库位状态失败"); |
| | | } |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | // 检索库位 |
| | | StartupDto startupDto = commonService.getLocNo(1, 10, emptyInSta.getStaNo(), null); |
| | | |
| | | // todo:luxiaotao |
| | | |
| | | try { |
| | | // 插入工作主档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | // todo:luxiaotao |
| | | |
| | | try { |
| | | // 修改主档led标记 |
| | | for (WrkMast wrkMast : wrkMasts) { |
| | | wrkMast.setOveMk("Y"); |
| | |
| | | // 更新线程当前工作号集合 |
| | | ledThread.setWorkNos(workNos); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |