| | |
| | | import cn.stylefeng.guns.modular.om.productionOrdeInfo.model.params.ProductionOrdeInfoParam; |
| | | import cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult; |
| | | import cn.stylefeng.guns.modular.om.productionOrdeInfo.service.ProductionOrdeInfoService; |
| | | import cn.stylefeng.guns.modular.om.productionOrderBatchInfo.model.params.ProductionOrderBatchInfoParam; |
| | | import cn.stylefeng.guns.modular.om.productionOrderBatchInfo.model.result.ProductionOrderBatchInfoResult; |
| | | import cn.stylefeng.guns.modular.om.productionOrderBatchInfo.service.ProductionOrderBatchInfoService; |
| | | import cn.stylefeng.guns.modular.sc.repairManageInfo.model.params.RepairManageInfoParam; |
| | | import cn.stylefeng.guns.modular.sc.repairManageInfo.model.result.RepairManageInfoResult; |
| | | import cn.stylefeng.guns.modular.sc.repairManageInfo.service.RepairManageInfoService; |
| | |
| | | private static List list = null; |
| | | private static Group group = null; |
| | | |
| | | private int count = 0; |
| | | |
| | | |
| | | /** |
| | | * 设置心跳标志位,保存到全局变量 |
| | | */ |
| | | public void setHeartbeat(String value) { |
| | | if ("false".equals(value)) { |
| | | OPCUnit.write(opc.getDOP010_F_HEART_BEAT(), "true"); |
| | | GlobalVariable.DOP010_F_HEART_BEAT = true; |
| | | count = 0; |
| | | } else { |
| | | count++; |
| | | } |
| | | // 循环读取频率是:500ms一次,如果超过6次,也就是3s认定超时 |
| | | if (count > GlobalVariable.HEART_MAX_COUNT) { |
| | | GlobalVariable.DOP010_F_HEART_BEAT = false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void monitor() { |
| | | public synchronized void monitor() { |
| | | String ecpStr = "";//异常记录标记 |
| | | try{ |
| | | /* String isHeartBeat = OPCUnit.read(opc.getDOP010_F_HEART_BEAT()); |
| | | setHeartbeat(isHeartBeat);*/ |
| | | |
| | | if(GlobalVariable.DOP010_F_HEART_BEAT) { |
| | | |
| | |
| | | String isFinish = OPCUnit.read(opc.getDOP010_J_PC_FINISH());//PC操作完成 |
| | | if(isFinish.equals("false")){ |
| | | handleFinsh(); |
| | | handleMaterial(); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | public void handleMaterial() { |
| | | |
| | | //查询批次上料信息 |
| | | ProductionOrderBatchInfoParam productionOrderBatchInfoParam = new ProductionOrderBatchInfoParam(); |
| | | productionOrderBatchInfoParam.setWorkOrderNo(S_ORDER_CODE); |
| | | productionOrderBatchInfoParam.setLocationCode(LOCATION_CODE); |
| | | ProductionOrderBatchInfoService productionOrderBatchInfoService = opc.productionOrderBatchInfoService; |
| | | List<ProductionOrderBatchInfoResult> list1 = productionOrderBatchInfoService.findListBySpec(productionOrderBatchInfoParam); |
| | | for(int i=0;i<list1.size();i++){ |
| | | ProductionOrderBatchInfoResult productionOrderBatchInfoResult = list1.get(i); |
| | | |
| | | |
| | | |
| | | int remainingQuantity = productionOrderBatchInfoResult.getResidueQuantity();//剩余数量 |
| | | if(remainingQuantity>0 ){ |
| | | //新增物料追溯 |
| | | MaterialTraceabilityParam materialTraceabilityParam = new MaterialTraceabilityParam(); |
| | | materialTraceabilityParam.setWorkOrderNo(S_ORDER_CODE); |
| | | materialTraceabilityParam.setProductCode(S_PRODUCT_CODE); |
| | | materialTraceabilityParam.setProductNo(S_SFC_CODE); |
| | | materialTraceabilityParam.setLineCode(PRODUCTION_LINE); |
| | | materialTraceabilityParam.setLocationCode(LOCATION_CODE); |
| | | materialTraceabilityParam.setAssemblyQty(1); |
| | | materialTraceabilityParam.setAssemblyTime(DateTool.getLocalTimeForDate()); |
| | | materialTraceabilityParam.setMaterialCode(productionOrderBatchInfoResult.getMaterialCode());//物料编码 |
| | | materialTraceabilityParam.setMaterialBatchNo(productionOrderBatchInfoResult.getBatch());//物料批次 |
| | | |
| | | MaterialTraceabilityService materialTraceabilityService = opc.materialTraceabilityService; |
| | | materialTraceabilityService.add(materialTraceabilityParam); |
| | | //更新剩余数量 |
| | | productionOrderBatchInfoParam.setId(productionOrderBatchInfoResult.getId()); |
| | | productionOrderBatchInfoParam.setResidueQuantity(remainingQuantity-1);//剩余数量 |
| | | productionOrderBatchInfoService.update(productionOrderBatchInfoParam); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //PC完成 |