commit for pull

This commit is contained in:
caixiang 2023-02-24 08:46:36 +08:00
parent 384b1a3d54
commit 6d3b1e9cbb
6 changed files with 228 additions and 73 deletions

View File

@ -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);
}
/**

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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);
}
}

View File

@ -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<WoPac
@Autowired
private ChangePackagingBoxHistoryServiceBiz changePackagingBoxHistoryService;
@Autowired
private WoPackagingBoxSubstrateMapper mapper;
@Override
public QueryWrapper<WoPackagingBoxSubstrate> getWrapper(Map<String, Object> params){
@ -164,11 +167,11 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
@Override
public WoPackagingBoxSubstrate getBySubId(String subId) {
return woPackagingBoxSubstrateMapper.getOneByWoSubstrateId(subId);
return mapper.getOneByWoSubstrateId(subId);
}
@Override
public int updatePackagingBoxIdByWoSubstrateId(String packagingBoxId, String woSubstrateId) {
return woPackagingBoxSubstrateMapper.updatePackagingBoxIdByWoSubstrateId(packagingBoxId,woSubstrateId);
return mapper.updatePackagingBoxIdByWoSubstrateId(packagingBoxId,woSubstrateId);
}
}

View File

@ -7,6 +7,41 @@
<result column="platform_id" property="platformId" />
<result column="create_time" property="createTime" />
</resultMap>
<resultMap id="ResultAMap" type="com.cnbm.packing.dto.CamlineExtendArgDTO">
<result column="LAST_UPDATE_TIME" property="lastUpdateTime" />
<result column="PMPP" property="pmpp" />
<result column="ORDER_NAME" property="orderName" />
<result column="BINCLASS_FL1" property="binclassFl1" />
<result column="BINCLASS_FL2" property="binclassFl2" />
<result column="ETA_FL1" property="etaFl1" />
<result column="ETA_FL2" property="etaFl2" />
<result column="FF_FL1" property="ffFl1" />
<result column="FF_FL2" property="ffFl2" />
<result column="IMPP_FL1" property="imppFl1" />
<result column="IMPP_FL2" property="imppFl2" />
<result column="InsolFlashControl_FL1" property="insolflashcontrolFl1" />
<result column="InsolFlashControl_FL2" property="insolflashcontrolFl2" />
<result column="InsolMPP_FL1" property="insolmppFl1" />
<result column="InsolMPP_FL2" property="insolmppFl2" />
<result column="InsolVoc_FL1" property="insolvocFl1" />
<result column="InsolVoc_FL2" property="insolvocFl2" />
<result column="Insol_FL1" property="insolFl1" />
<result column="Insol_FL2" property="insolFl2" />
<result column="ISC_FL1" property="iscFl1" />
<result column="ISC_FL2" property="iscFl2" />
<result column="MEAS_TIME_FL1" property="measTimeFl1" />
<result column="MEAS_TIME_FL2" property="measTimeFl2" />
<result column="PMPP_FL1" property="pmppFl1" />
<result column="PMPP_FL2" property="pmppFl2" />
<result column="Tcell_FL1" property="tcellFl1" />
<result column="Tcell_FL2" property="tcellFl2" />
<result column="Tmonicell_FL1" property="tmonicellFl1" />
<result column="Tmonicell_FL2" property="tmonicellFl2" />
<result column="UMPP_FL1" property="umppFl1" />
<result column="UMPP_FL2" property="umppFl2" />
<result column="UOC_FL1" property="uocFl1" />
<result column="UOC_FL2" property="uocFl2" />
</resultMap>
<select id="getByid" resultType="float">
select pd.pmpp from process_data pd
@ -31,6 +66,58 @@
LIMIT 1
</select>
<select id="getExtendArgFromCamline" resultMap="ResultAMap">
SELECT
eo.`NAME` as ORDER_NAME,
flr.LAST_UPDATE_TIME,
flr.BINCLASS_FL1,-- 1为 PID16 电池相关信息
flr.BINCLASS_FL2,-- 2为 PID22 电池相关信息
flr.ETA_FL1,
flr.ETA_FL2,
flr.FF_FL1,
flr.FF_FL2,
flr.IMPP_FL1,
flr.IMPP_FL2,
flr.InsolFlashControl_FL1,
flr.InsolFlashControl_FL2,
flr.InsolMPP_FL1,
flr.InsolMPP_FL2,
flr.InsolVoc_FL1,
flr.InsolVoc_FL2,
flr.Insol_FL1,
flr.Insol_FL2,
flr.ISC_FL1,
flr.ISC_FL2,
flr.MEAS_TIME_FL1,
flr.MEAS_TIME_FL2,
flr.PMPP_FL1,-- pid16实测PMPP
flr.PMPP_FL2,-- pid22实测PMPP
flr.Tcell_FL1,
flr.Tcell_FL2,
flr.Tmonicell_FL1,
flr.Tmonicell_FL2,
flr.UMPP_FL1,
flr.UMPP_FL2,
flr.UOC_FL1,
flr.UOC_FL2,
flc.PMPP -- 补偿后功率,用我们的
FROM
ue_flasher_data_raw flr
LEFT JOIN e_tracking_unit tu ON flr.mainid = tu.id
LEFT JOIN ue_flasher_data_calc flc ON flc.mainid = tu.id
LEFT JOIN er_order eo ON tu.ORDER_ID = eo.ID
WHERE
flr.PMPP_FL2 != 0
and
tu.name=#{subId}
GROUP BY
tu.`NAME`
ORDER BY
flr.LAST_UPDATE_TIME DESC
LIMIT 1
</select>
<select id="getOrderNameBySubId" resultType="string">
SELECT
eorder.name