diff --git a/ym-packing/src/main/java/com/cnbm/packing/dispatch/KukaJoinThread.java b/ym-packing/src/main/java/com/cnbm/packing/dispatch/KukaJoinThread.java index c7ec919..dcf847d 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/dispatch/KukaJoinThread.java +++ b/ym-packing/src/main/java/com/cnbm/packing/dispatch/KukaJoinThread.java @@ -8,6 +8,7 @@ import com.cnbm.packing.dispatch.enums.kuka.step2.Step2Mes2PlcVar; import com.cnbm.packing.dispatch.enums.kuka.step2.Step2Plc2MesVar; import com.cnbm.packing.dispatch.enums.kuka.step3.Step3Mes2PlcVar; import com.cnbm.packing.dispatch.enums.kuka.step3.Step3Plc2MesVar; +import com.cnbm.packing.dto.CamlineExtendArgDTO; import com.cnbm.packing.dto.WoPowerLevelDTO; import com.cnbm.packing.entity.WoPackagingBox; import com.cnbm.packing.entity.WoPackagingBoxSubstrate; @@ -155,32 +156,6 @@ public class KukaJoinThread implements ApplicationRunner { @Override public void run(ApplicationArguments args) throws Exception { - kukaStep1.execute(new Runnable() { - @Override - public void run() { -// while (true){ -// //read one -//// logger.info("过程一 : "+ Arrays.toString((String[])read(S7Client.S7_1500,PlcVarActual.SubIdArrays))); -//// try { -//// Thread.sleep(300); -//// } catch (InterruptedException e) { -//// throw new S7ParseDataException(e); -//// } -//// //write one -//// String[] toWrite = new String[60]; -//// for(int i=0;i<60;i++){ -//// toWrite[i] = RandomStringUtils.randomAlphanumeric(18); -//// } -//// try { -//// write(S7Client.S7_1500,PlcVarActual.SubIdArrays,toWrite); -//// } catch (Exception e) { -//// throw new S7ParseDataException(e); -//// } -// -// -// } - } - }); kukaStep1.scheduleAtFixedRate(new Runnable() { @Override @@ -190,7 +165,7 @@ public class KukaJoinThread implements ApplicationRunner { logger.info("================= 现在开始执行 过程一 任务 =================="); Integer subArrived = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, true); if(subArrived != 1){ - logger.info("失败"+" --- "+"步骤1. MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败"); + logger.info("失败"+" --- "+" MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败"); } //一. 从plc 中获取 subId 和 lineNum @@ -211,8 +186,6 @@ public class KukaJoinThread implements ApplicationRunner { write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Vmpp,argByPMPP.getLableVmpp()); write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Impp,argByPMPP.getLableImpp()); - //4. 从camline那里获取可变字段 - //4. 把基板录到数据库 WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate(); @@ -220,6 +193,43 @@ public class KukaJoinThread implements ApplicationRunner { woPackagingBoxSubstrate.setPowerLevel(argByPMPP.getPowerClass()); woPackagingBoxSubstrate.setSapMaterial(argByPMPP.getSapMaterialNum()); woPackagingBoxSubstrate.setWoSubstrateId(subId); + + //5. 从camline那里获取可变字段 + CamlineExtendArgDTO extendArgFromCamline = service.getExtendArgFromCamline(subId); + woPackagingBoxSubstrate.setLastUpdateTime(extendArgFromCamline.getLastUpdateTime()); + woPackagingBoxSubstrate.setPmpp(actualPMPP); + woPackagingBoxSubstrate.setOrderName(extendArgFromCamline.getOrderName()); + woPackagingBoxSubstrate.setBinclassFl1(extendArgFromCamline.getBinclassFl1()); + woPackagingBoxSubstrate.setBinclassFl2(extendArgFromCamline.getBinclassFl2()); + woPackagingBoxSubstrate.setEtaFl1(extendArgFromCamline.getEtaFl1()); + woPackagingBoxSubstrate.setEtaFl2(extendArgFromCamline.getEtaFl2()); + woPackagingBoxSubstrate.setFfFl1(extendArgFromCamline.getFfFl1()); + woPackagingBoxSubstrate.setFfFl2(extendArgFromCamline.getFfFl2()); + woPackagingBoxSubstrate.setImppFl1(extendArgFromCamline.getImppFl1()); + woPackagingBoxSubstrate.setImppFl2(extendArgFromCamline.getImppFl2()); + woPackagingBoxSubstrate.setInsolflashcontrolFl1(extendArgFromCamline.getInsolflashcontrolFl1()); + woPackagingBoxSubstrate.setInsolflashcontrolFl2(extendArgFromCamline.getInsolflashcontrolFl2()); + woPackagingBoxSubstrate.setInsolmppFl1(extendArgFromCamline.getInsolmppFl1()); + woPackagingBoxSubstrate.setInsolmppFl2(extendArgFromCamline.getInsolmppFl2()); + woPackagingBoxSubstrate.setInsolvocFl1(extendArgFromCamline.getInsolvocFl1()); + woPackagingBoxSubstrate.setInsolvocFl2(extendArgFromCamline.getInsolvocFl2()); + woPackagingBoxSubstrate.setInsolFl1(extendArgFromCamline.getInsolFl1()); + woPackagingBoxSubstrate.setInsolFl2(extendArgFromCamline.getInsolFl2()); + woPackagingBoxSubstrate.setIscFl1(extendArgFromCamline.getIscFl1()); + woPackagingBoxSubstrate.setIscFl2(extendArgFromCamline.getIscFl2()); + woPackagingBoxSubstrate.setMeasTimeFl1(extendArgFromCamline.getMeasTimeFl1()); + woPackagingBoxSubstrate.setMeasTimeFl2(extendArgFromCamline.getMeasTimeFl2()); + woPackagingBoxSubstrate.setPmppFl1(extendArgFromCamline.getPmppFl1()); + woPackagingBoxSubstrate.setPmppFl2(extendArgFromCamline.getPmppFl2()); + woPackagingBoxSubstrate.setTcellFl1(extendArgFromCamline.getTcellFl1()); + woPackagingBoxSubstrate.setTcellFl2(extendArgFromCamline.getTcellFl2()); + woPackagingBoxSubstrate.setTmonicellFl1(extendArgFromCamline.getTmonicellFl1()); + woPackagingBoxSubstrate.setTmonicellFl2(extendArgFromCamline.getTmonicellFl2()); + woPackagingBoxSubstrate.setUmppFl1(extendArgFromCamline.getUmppFl1()); + woPackagingBoxSubstrate.setUmppFl2(extendArgFromCamline.getUmppFl2()); + woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl1()); + woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl2()); + substrateServiceBiz.insert(woPackagingBoxSubstrate); //=============== MES 业务 结束 ================= @@ -229,9 +239,10 @@ public class KukaJoinThread implements ApplicationRunner { //四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false Integer subArrived2 = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, false); if(subArrived2 != 1){ - logger.info("失败"+" --- "+"步骤1. MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败"); + logger.info("失败"+" --- "+"MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败"); } write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,false); + logger.info("采集到的基板id : "+subId); logger.info("================= 过程一 任务成功完成 =================="); logger.info(""); @@ -277,7 +288,7 @@ public class KukaJoinThread implements ApplicationRunner { woPackagingBox.setPowerLevel(bySubId.getPowerLevel()); woPackagingBox.setLineBody(bySubId.getLineBody()); woPackagingBox.setSapMaterial(bySubId.getSapMaterial()); - //todo box表新增一个 orderNum 字段 + woPackagingBox.setOrderNum(orderNameBySubId); //1-手动模式,2-自动模式 woPackagingBox.setModel(2); boxServiceBiz.insert(woPackagingBox); @@ -340,45 +351,6 @@ public class KukaJoinThread implements ApplicationRunner { } },1,1, TimeUnit.SECONDS); -// kukaStep2.scheduleAtFixedRate(new Runnable() { -// @Override -// public void run() { -// try { -// String s = RandomUtil.randomString(5); -// System.out.println("start + "+s+" : "+LocalDateTime.now()); -// Thread.sleep(3000); -// -// -// -// WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId("sub123"); -// System.out.println("bySubId:"+ bySubId.toString()); -// -// String boxId = getBoxId(bySubId.getSapMaterial()); -// System.out.println("boxId:"+ boxId.toString()); -// -// //2. 依次update 基板表,把boxId 赋予这些基板 -// substrateServiceBiz.updatePackagingBoxIdByWoSubstrateId(boxId,"sub123"); -// //3.去camline数据库 查询此基板ID 对应的订单 -// //String orderNameBySubId = service.getOrderNameBySubId("sub123"); -// //4. box信息录入到box表 -// WoPackagingBox woPackagingBox = new WoPackagingBox(); -// woPackagingBox.setBoxNo(boxId); -// woPackagingBox.setPackagingTime(LocalDateTime.now()); -// woPackagingBox.setPowerLevel(bySubId.getPowerLevel()); -// woPackagingBox.setLineBody(bySubId.getLineBody()); -// woPackagingBox.setSapMaterial(bySubId.getSapMaterial()); -// //todo box表新增一个 orderNum 字段 -// //1-手动模式,2-自动模式 -// woPackagingBox.setModel(2); -// boxServiceBiz.insert(woPackagingBox); -// }catch (Throwable e){ -// //Error 和 Exception 都继承于Throwable ,所以当业务代码出现Error/Exception 都不会导致程序down掉 -// e.printStackTrace(); -// } -// } -// },1,1, TimeUnit.SECONDS); - - } /** diff --git a/ym-packing/src/main/java/com/cnbm/packing/dto/CamlineExtendArgDTO.java b/ym-packing/src/main/java/com/cnbm/packing/dto/CamlineExtendArgDTO.java new file mode 100644 index 0000000..2d76671 --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/packing/dto/CamlineExtendArgDTO.java @@ -0,0 +1,85 @@ +package com.cnbm.packing.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + + +/** + * 打印标签模板表 + * + * @author codeGenerator + * @since 2023-02-20 + */ +@Data +@ApiModel(value = "camline 查询对象") +public class CamlineExtendArgDTO implements Serializable { + private static final long serialVersionUID = 1L; + + private LocalDateTime lastUpdateTime; + private float pmpp; + private String orderName; + private Long binclassFl1; + + private Long binclassFl2; + + private Float etaFl1; + + private Float etaFl2; + + private Float ffFl1; + + private Float ffFl2; + + private Float imppFl1; + + private Float imppFl2; + + private Float insolflashcontrolFl1; + + private Float insolflashcontrolFl2; + + private Float insolmppFl1; + + private Float insolmppFl2; + + private Float insolvocFl1; + + private Float insolvocFl2; + + private Float insolFl1; + + private Float insolFl2; + + private Float iscFl1; + + private Float iscFl2; + + private LocalDateTime measTimeFl1; + + private LocalDateTime measTimeFl2; + + private Float pmppFl1; + + private Float pmppFl2; + + private Float tcellFl1; + + private Float tcellFl2; + + private Float tmonicellFl1; + + private Float tmonicellFl2; + + private Float umppFl1; + + private Float umppFl2; + + private Float uocFl1; + + private Float uocFl2; + +} \ No newline at end of file diff --git a/ym-packing/src/main/java/com/cnbm/packing/mapper/CamlineMapper.java b/ym-packing/src/main/java/com/cnbm/packing/mapper/CamlineMapper.java index 40e843d..c803425 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/mapper/CamlineMapper.java +++ b/ym-packing/src/main/java/com/cnbm/packing/mapper/CamlineMapper.java @@ -1,5 +1,6 @@ package com.cnbm.packing.mapper; +import com.cnbm.packing.dto.CamlineExtendArgDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -22,7 +23,7 @@ public interface CamlineMapper { String getOrderNameBySubId(@Param("subId") String subId); - + CamlineExtendArgDTO getExtendArgFromCamline(@Param("subId") String subId); Integer getTodayBoxNum(); } \ No newline at end of file diff --git a/ym-packing/src/main/java/com/cnbm/packing/service/DynamicDataSourceService.java b/ym-packing/src/main/java/com/cnbm/packing/service/DynamicDataSourceService.java index 8eea8f3..5af32ad 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/service/DynamicDataSourceService.java +++ b/ym-packing/src/main/java/com/cnbm/packing/service/DynamicDataSourceService.java @@ -1,6 +1,7 @@ package com.cnbm.packing.service; import com.cnbm.dynamic.datasource.annotation.DataSource; +import com.cnbm.packing.dto.CamlineExtendArgDTO; import com.cnbm.packing.dto.WoPowerLevelDTO; import com.cnbm.packing.mapper.CamlineMapper; @@ -40,4 +41,10 @@ public class DynamicDataSourceService { return mapper.getOrderNameBySubId(subId); } + @DataSource("camline") + @Transactional + public CamlineExtendArgDTO getExtendArgFromCamline(String subId){ + return mapper.getExtendArgFromCamline(subId); + } + } diff --git a/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxSubstrateServiceBizImpl.java b/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxSubstrateServiceBizImpl.java index 472951c..533e618 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxSubstrateServiceBizImpl.java +++ b/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxSubstrateServiceBizImpl.java @@ -17,6 +17,7 @@ import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper; import com.cnbm.packing.service.ChangePackagingBoxHistoryServiceBiz; import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz; import org.apache.commons.lang3.StringUtils; +import org.omg.CORBA.PRIVATE_MEMBER; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -37,6 +38,8 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl getWrapper(Map params){ @@ -164,11 +167,11 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +