| | |
| | | String maxKeySql = "select max(FInterID) as num from CPICMO"; |
| | | List<ERPselectParam> maxKeyList = erpSqlServer.select(maxKeySql, ERPselectParam.class); |
| | | Integer maxKey = maxKeyList.get(0).getNum(); |
| | | String ErpSql = "insert into CPICMO(FBrNo, FSourceBillNo, FBillNo, FTranType, FStatus, FMRP, FItemID, FQty, FCommitQty, FSourceEntryID, FClosed, FUnitID, FAuxCommitQty, FCancellation, FQtyFinish, FQtyScrap, FQtyLost, FAuxQtyFinish, FAuxQtyScrap, FAuxQtyLost, FMrpClosed, FBomInterID, FQtyPass, FAuxQtyPass, FQtyBack, FAuxQtyBack, FFinishTime, FReadyTIme, FPowerCutTime, FFixTime, FWaitItemTime, FWaitToolTime, FTaskID, FWorkTypeID, FCostObjID, FStockQty, FAuxStockQty, FSuspend, FReleasedQty, FReleasedAuxQty, FUnScheduledQty, FUnScheduledAuxQty, FSubEntryID, FScheduleID, FPlanOrderInterID, FProcessPrice, FProcessFee, FGMPBatchNo, FGMPCollectRate, FGMPItemBalance, FGMPBulkQty, FCustID, FMRPLockFlag, FHandworkClose, FInHighLimit, FInHighLimitQty, FInLowLimit, FInLowLimitQty, FChangeTimes, FCheckCommitQty, FAuxCheckCommitQty, FPlanConfirmed, FPlanMode, FMTONo, FPrintCount, FFinClosed, FStockFlag, FStartFlag, FVchBillNo, FVchInterID, FCardClosed, FHRReadyTime, FSourceTranType, FSourceInterId, FInterID, FAuxQty, FAuxInHighLimitQty, FAuxInLowLimitQty, Fnumber, FWorkShop) values (0, 0, '0', 85, 0, 1052, 0, 0, 0, 0, 0, 250, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14036, '0', 0, 0, 14215, 0, '0', 0, 1059, 0, 0, 0, 0, {0,number,#}, {1,number,#}, {2,number,#}, {3,number,#}, ''{4}'', 11378)"; |
| | | ErpSql = MessageFormat.format(ErpSql, maxKey + 1, es.getCount(), es.getCount(), es.getCount(), es.getMatNo()); |
| | | String ErpSql = "insert into CPICMO(FBrNo, FSourceBillNo, FBillNo, FTranType, FStatus, FMRP, FItemID, FQty, FCommitQty, FSourceEntryID, FClosed, FUnitID, FAuxCommitQty, FCancellation, FQtyFinish, FQtyScrap, FQtyLost, FAuxQtyFinish, FAuxQtyScrap, FAuxQtyLost, FMrpClosed, FBomInterID, FQtyPass, FAuxQtyPass, FQtyBack, FAuxQtyBack, FFinishTime, FReadyTIme, FPowerCutTime, FFixTime, FWaitItemTime, FWaitToolTime, FTaskID, FWorkTypeID, FCostObjID, FStockQty, FAuxStockQty, FSuspend, FReleasedQty, FReleasedAuxQty, FUnScheduledQty, FUnScheduledAuxQty, FSubEntryID, FScheduleID, FPlanOrderInterID, FProcessPrice, FProcessFee, FGMPBatchNo, FGMPCollectRate, FGMPItemBalance, FGMPBulkQty, FCustID, FMRPLockFlag, FHandworkClose, FInHighLimit, FInHighLimitQty, FInLowLimit, FInLowLimitQty, FChangeTimes, FCheckCommitQty, FAuxCheckCommitQty, FPlanConfirmed, FPlanMode, FMTONo, FPrintCount, FFinClosed, FStockFlag, FStartFlag, FVchBillNo, FVchInterID, FCardClosed, FHRReadyTime, FSourceTranType, FSourceInterId, FInterID, FAuxQty, FAuxInHighLimitQty, FAuxInLowLimitQty, Fnumber, FWorkShop) values (0, ''{6}'', '0', 85, 0, 1052, 0, 0, 0, 0, 0, 250, {5,number,#}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14036, '0', 0, 0, 14215, 0, '0', 0, 1059, 0, 0, 0, 0, {0,number,#}, {1,number,#}, {2,number,#}, {3,number,#}, ''{4}'', 11378)"; |
| | | ErpSql = MessageFormat.format(ErpSql, maxKey + 1, es.getCount(), es.getCount(), es.getCount(), es.getMatNo(), es.getCount(), es.getStr5()); |
| | | erpSqlServer.update(ErpSql); |
| | | } |
| | | } |
| | |
| | | BasDevp staNo = basDevpService.checkSiteStatus(devpNo); |
| | | if (!Cools.isEmpty(staNo.getFronting()) && staNo.getFronting().equals("Y")) { |
| | | // 小车入库搬运命令 ---------------------------------------------------- |
| | | BasAgv idleAgv = basAgvService.selectIdleAgv(); |
| | | AgvCommand command = new AgvCommand(); |
| | | command.setAgvId(idleAgv.getAgvId()); |
| | | command.setInterCode(basAgvService.getEmptyAgvWorkNo()); |
| | | command.setBeginLoc(String.valueOf(devpNo)); |
| | | command.setEndLoc("1088"); |
| | | log.info(JSON.toJSONString(command)); |
| | | String result; |
| | | try { |
| | | result = new HttpHandler.Builder() |
| | | .setUri(agvUrl + "/api/interfaceTask/SendTaskByThirdParty") |
| | | .setJson(JSON.toJSONString(command)) |
| | | .build() |
| | | .doPost(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | throw new CoolException("访问AGV接口失败"); |
| | | // 判断是否有空闲小车 |
| | | if (basAgvService.haveIdleAgv()) { |
| | | AgvCommand command = new AgvCommand(); |
| | | command.setAgvId(0); |
| | | command.setInterCode(basAgvService.getEmptyAgvWorkNo()); |
| | | command.setBeginLoc(String.valueOf(devpNo)); |
| | | command.setEndLoc("1088"); |
| | | log.info(JSON.toJSONString(command)); |
| | | String result; |
| | | try { |
| | | result = new HttpHandler.Builder() |
| | | .setUri(agvUrl + "/api/interfaceTask/SendTaskByThirdParty") |
| | | .setJson(JSON.toJSONString(command)) |
| | | .build() |
| | | .doPost(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | throw new CoolException("访问AGV接口失败"); |
| | | } |
| | | AgvResult agvResult = JSON.parseObject(result, AgvResult.class); |
| | | log.info(JSON.toJSONString(agvResult)); |
| | | if (!agvResult.getResult()) { |
| | | log.error("agv命令发送失败[agvId={}],错误信息={}", command.getAgvId(), agvResult.getExplain()); |
| | | throw new CoolException("agv命令发送失败[agvId=" + command.getAgvId() + "],错误信息=" + agvResult.getExplain()); |
| | | } |
| | | } else { |
| | | throw new CoolException("没有空闲小车"); |
| | | } |
| | | AgvResult agvResult = JSON.parseObject(result, AgvResult.class); |
| | | log.info(JSON.toJSONString(agvResult)); |
| | | if (!agvResult.getResult()) { |
| | | log.error("agv命令发送失败[agvId={}],错误信息={}", command.getAgvId(), agvResult.getExplain()); |
| | | throw new CoolException("agv命令发送失败[agvId=" + command.getAgvId() + "],错误信息=" + agvResult.getExplain()); |
| | | } |
| | | |
| | | return "待定"; |
| | | } else { |
| | | // 源站点状态检测 |