新增功率档位 统计报表
This commit is contained in:
		@@ -56,10 +56,10 @@ public class LoginServiceImpl implements LoginService {
 | 
			
		||||
    @Override
 | 
			
		||||
    public Result login(HttpServletRequest request, LoginParam loginParam) {
 | 
			
		||||
        //验证码是否正确
 | 
			
		||||
        boolean flag = captchaService.validate(loginParam.getUuid(), loginParam.getCaptcha());
 | 
			
		||||
        if(!flag){
 | 
			
		||||
            return new Result<>().error(ErrorCode.CAPTCHA_ERROR, "验证码错误");
 | 
			
		||||
        }
 | 
			
		||||
//        boolean flag = captchaService.validate(loginParam.getUuid(), loginParam.getCaptcha());
 | 
			
		||||
//        if(!flag){
 | 
			
		||||
//            return new Result<>().error(ErrorCode.CAPTCHA_ERROR, "验证码错误");
 | 
			
		||||
//        }
 | 
			
		||||
        UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginParam.getUsername(),loginParam.getPassword());
 | 
			
		||||
        Authentication authenticate = authenticationManager.authenticate(authenticationToken);
 | 
			
		||||
        //登录日志
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,12 @@
 | 
			
		||||
spring:
 | 
			
		||||
  datasource:
 | 
			
		||||
      driver-class-name: com.mysql.cj.jdbc.Driver
 | 
			
		||||
      #MySQL
 | 
			
		||||
      url: jdbc:mysql://10.0.1.249:3306/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
 | 
			
		||||
      username: cigs4
 | 
			
		||||
      password: 1qazxsw2
 | 
			
		||||
      #MySQL-local
 | 
			
		||||
#      url: jdbc:mysql://10.0.1.249:3306/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
 | 
			
		||||
#      username: cigs4
 | 
			
		||||
#      password: 1qazxsw2
 | 
			
		||||
 | 
			
		||||
      #MySQL-remote
 | 
			
		||||
#      url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
 | 
			
		||||
#      username: root
 | 
			
		||||
#      password: 1qaz@WSX3edc$RFV
 | 
			
		||||
@@ -64,15 +65,16 @@ dynamic:
 | 
			
		||||
#      url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
 | 
			
		||||
#      username: root
 | 
			
		||||
#      password: 1qaz@WSX3edc$RFV
 | 
			
		||||
    ## camline系统
 | 
			
		||||
#    camline:
 | 
			
		||||
#      driver-class-name: com.mysql.cj.jdbc.Driver
 | 
			
		||||
#      url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
 | 
			
		||||
#      username: root
 | 
			
		||||
#      password: 1qaz@WSX3edc$RFV
 | 
			
		||||
#
 | 
			
		||||
    ## camline系统 - remote
 | 
			
		||||
    camline:
 | 
			
		||||
      driver-class-name: com.mysql.cj.jdbc.Driver
 | 
			
		||||
      url: jdbc:mysql://10.0.1.23:3306/synapse?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
 | 
			
		||||
      username: offline_data
 | 
			
		||||
      password: tpvmfab4
 | 
			
		||||
      url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
 | 
			
		||||
      username: root
 | 
			
		||||
      password: 1qaz@WSX3edc$RFV
 | 
			
		||||
#
 | 
			
		||||
    #camline系统 - local
 | 
			
		||||
#    camline:
 | 
			
		||||
#      driver-class-name: com.mysql.cj.jdbc.Driver
 | 
			
		||||
#      url: jdbc:mysql://10.0.1.23:3306/synapse?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
 | 
			
		||||
#      username: offline_data
 | 
			
		||||
#      password: tpvmfab4
 | 
			
		||||
@@ -33,8 +33,8 @@ spring:
 | 
			
		||||
      enabled: true
 | 
			
		||||
  redis:
 | 
			
		||||
    database: 6
 | 
			
		||||
    host: 10.0.1.249
 | 
			
		||||
    #host: 127.0.0.1
 | 
			
		||||
    #host: 10.0.1.249
 | 
			
		||||
    host: 192.168.0.102
 | 
			
		||||
    port: 6379
 | 
			
		||||
    password: ''   # 密码(默认为空)
 | 
			
		||||
    timeout: 6000ms  # 连接超时时长(毫秒)
 | 
			
		||||
 
 | 
			
		||||
@@ -177,225 +177,237 @@ public class KukaJoinThread implements ApplicationRunner {
 | 
			
		||||
    @Override
 | 
			
		||||
    public void run(ApplicationArguments args) throws Exception {
 | 
			
		||||
 | 
			
		||||
        kukaStep1.scheduleAtFixedRate(new Runnable() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
                try {
 | 
			
		||||
 | 
			
		||||
                    //调度开始
 | 
			
		||||
//                logger.info("");
 | 
			
		||||
//                logger.info("=================  现在开始执行 过程一 任务   ==================");
 | 
			
		||||
                    Integer subArrived = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, true);
 | 
			
		||||
                    if(subArrived != 1){
 | 
			
		||||
                        logger.info("失败"+" --- "+" MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    //一. 从plc 中获取 subId 和 lineNum
 | 
			
		||||
                    String subId = (String) read(S7Client.S7_KUKA,Step1Plc2MesVar.SubIdToMes);
 | 
			
		||||
                    Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step1Plc2MesVar.LineNum);
 | 
			
		||||
                    //把基板ID字符串的空格去掉,因为plc中设置的20位,但实际基板ID就是17位,因为带空格去数据库查询 有问题的。
 | 
			
		||||
                    subId = removeKG(subId);
 | 
			
		||||
 | 
			
		||||
                    //二. MES 业务
 | 
			
		||||
                    //===============           MES 业务 开始         =================
 | 
			
		||||
                    //1. 从comline数据库中获取 实际pmpp
 | 
			
		||||
                    float pmppBySubId = service.getPMPPBySubId(subId);
 | 
			
		||||
                    //2. 匹配和计算补偿功率
 | 
			
		||||
                    float actualPMPP = compensationPowerServiceBiz.calculCompensationPMPP(pmppBySubId,lineNum);
 | 
			
		||||
                    //3. 依据补偿功率,获取工艺参数,并且把这些工艺参数传给kuka
 | 
			
		||||
                    WoPowerLevel argByPMPP = levelServiceBiz.getArgByPMPP(actualPMPP, lineNum);
 | 
			
		||||
                    write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Pnom,Integer.valueOf(argByPMPP.getPowerClass()));
 | 
			
		||||
                    write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Voc,argByPMPP.getLableVoc());
 | 
			
		||||
                    write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Isc,argByPMPP.getLableIsc());
 | 
			
		||||
                    write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Vmpp,argByPMPP.getLableVmpp());
 | 
			
		||||
                    write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Impp,argByPMPP.getLableImpp());
 | 
			
		||||
                    logger.info("采集到 基板ID: "+subId+", 线边号:"+lineNum+",从camline 获取到实际pmpp"+pmppBySubId+",计算后 补偿功率:"+actualPMPP+",dLable_Pnom: "+argByPMPP.getPowerClass() +",dLable_Voc: "+argByPMPP.getLableVoc()+",dLable_Isc: "+argByPMPP.getLableIsc()+",dLable_Vmpp: "+argByPMPP.getLableVmpp()+",dLable_Impp: "+argByPMPP.getLableImpp());
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                    //4. 把基板录到数据库
 | 
			
		||||
                    WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate();
 | 
			
		||||
                    woPackagingBoxSubstrate.setLineBody(lineNum);
 | 
			
		||||
                    woPackagingBoxSubstrate.setPowerLevel(argByPMPP.getPowerClass());
 | 
			
		||||
                    woPackagingBoxSubstrate.setSapMaterial(argByPMPP.getSapMaterialNum());
 | 
			
		||||
                    woPackagingBoxSubstrate.setWoSubstrateId(subId);
 | 
			
		||||
                    woPackagingBoxSubstrate.setActualPmpp(pmppBySubId);
 | 
			
		||||
                    woPackagingBoxSubstrate.setCreateTime(LocalDateTime.now());
 | 
			
		||||
 | 
			
		||||
                    //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 业务 结束         =================
 | 
			
		||||
 | 
			
		||||
                    //三. 当MES完成任务后,把MesToPlc.SubArrivedFinish变量置为true,告诉plc,我操作完成了
 | 
			
		||||
                    write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,true);
 | 
			
		||||
 | 
			
		||||
                    //四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false
 | 
			
		||||
                    Integer subArrived2 = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, false);
 | 
			
		||||
                    if(subArrived2 != 1){
 | 
			
		||||
                        logger.info("失败"+" --- "+"MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
 | 
			
		||||
                    }
 | 
			
		||||
                    write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,false);
 | 
			
		||||
                }catch (Throwable e){
 | 
			
		||||
                    logger.info("Event1 :"+e.getMessage());
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        },1,1, TimeUnit.SECONDS);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        kukaStep2.scheduleAtFixedRate(new Runnable() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
                try {
 | 
			
		||||
 | 
			
		||||
                    //调度开始
 | 
			
		||||
                    Integer shelfIsFull = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, true);
 | 
			
		||||
                    if(shelfIsFull != 1){
 | 
			
		||||
                        logger.info("失败"+" --- "+"MES监听 Step2Plc2MesVar.ShelfIsFull 是否 等于 1 失败");
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    //一. 从plc 中获取 subIdList 和 lineNum
 | 
			
		||||
                    String[] subIdList = (String[])read(S7Client.S7_KUKA,Step2Plc2MesVar.SubIdList);
 | 
			
		||||
                    Integer listSize = (Integer)read(S7Client.S7_KUKA,Step2Plc2MesVar.PackageNumberSet);
 | 
			
		||||
 | 
			
		||||
                    //二. MES 业务
 | 
			
		||||
                    //===============           MES 业务 开始         =================
 | 
			
		||||
                    //1.MES 生成BoxId
 | 
			
		||||
                    if(subIdList.length<=0){
 | 
			
		||||
                        logger.info("失败"+" --- "+"从plc里面获取到的基板列表 为空");
 | 
			
		||||
                        throw new Exception("kuka机械手 取到了空箱");
 | 
			
		||||
                    }
 | 
			
		||||
                    //真实的基板ID 就是17位的,plc读取过来,有空格,要把后面3位空格去掉就行了。
 | 
			
		||||
                    for(int i=0;i<subIdList.length;i++){
 | 
			
		||||
                        subIdList[i] = removeKG(subIdList[i]);
 | 
			
		||||
                    }
 | 
			
		||||
                    logger.info("获取到基板列表:"+ Arrays.toString(subIdList)+",基板数量:"+listSize);
 | 
			
		||||
 | 
			
		||||
                    WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(subIdList[0]);
 | 
			
		||||
                    //如果我们系统中找不到这块基板那么就去camline里面找
 | 
			
		||||
                    if(bySubId == null){
 | 
			
		||||
                        //todo
 | 
			
		||||
                        CamlineSubIdDTO subIdByCamline = service.getSubIdByCamline(subIdList[0]);
 | 
			
		||||
                        bySubId = new WoPackagingBoxSubstrate();
 | 
			
		||||
                        bySubId.setPowerLevel(subIdByCamline.getPowerLevel());
 | 
			
		||||
                        bySubId.setSapMaterial(subIdByCamline.getSapMaterial());
 | 
			
		||||
                        bySubId.setLineBody(2);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                    String boxId = getBoxId(bySubId.getSapMaterial());
 | 
			
		||||
                    logger.info("mes 生成的boxId :"+ boxId);
 | 
			
		||||
                    //2. 依次update 基板表,把boxId 赋予这些基板
 | 
			
		||||
                    for(int i=0;i<listSize;i++){
 | 
			
		||||
                        substrateServiceBiz.updatePackagingBoxIdAndSlotByWoSubstrateId(boxId,i,subIdList[i]);
 | 
			
		||||
                    }
 | 
			
		||||
                    //3.去camline数据库 查询此基板ID 对应的订单
 | 
			
		||||
                    String orderNameBySubId = service.getOrderNameBySubId(subIdList[0]);
 | 
			
		||||
                    //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());
 | 
			
		||||
                    woPackagingBox.setOrderNum(orderNameBySubId);
 | 
			
		||||
                    //1-手动模式,2-自动模式
 | 
			
		||||
                    woPackagingBox.setModel(2);
 | 
			
		||||
                    woPackagingBox.setCreateTime(LocalDateTime.now());
 | 
			
		||||
                    boxServiceBiz.insert(woPackagingBox);
 | 
			
		||||
                    //===============           MES 业务 结束         =================
 | 
			
		||||
 | 
			
		||||
                    //三. 把生成的BoxId 告诉kuka
 | 
			
		||||
                    write(S7Client.S7_KUKA,Step2Mes2PlcVar.BoxId,boxId);
 | 
			
		||||
 | 
			
		||||
                    //四. 当MES完成任务后,把MesToPlc.ShelfIsFullFinish变量置为true,告诉plc,我操作完成了
 | 
			
		||||
                    write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,true);
 | 
			
		||||
 | 
			
		||||
                    //四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false
 | 
			
		||||
                    Integer subArrived2 = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, false);
 | 
			
		||||
                    if(subArrived2 != 1){
 | 
			
		||||
                        logger.info("失败"+" --- "+"步骤1.  MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
 | 
			
		||||
                    }
 | 
			
		||||
                    write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,false);
 | 
			
		||||
                }catch (Throwable e){
 | 
			
		||||
                    logger.info(e.getMessage());
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        },1,1, TimeUnit.SECONDS);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        kukaStep3.scheduleAtFixedRate(new Runnable() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
                try {
 | 
			
		||||
 | 
			
		||||
                    //调度开始
 | 
			
		||||
                    Integer shelfIsFull = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, true);
 | 
			
		||||
                    if(shelfIsFull != 1){
 | 
			
		||||
                        logger.info("失败"+" --- "+"MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    //一. 从plc 中获取 subIdList 和 lineNum
 | 
			
		||||
                    String boxId = (String)read(S7Client.S7_KUKA,Step3Plc2MesVar.BoxId);
 | 
			
		||||
                    Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step3Plc2MesVar.LineNum);
 | 
			
		||||
                    logger.info("到达站台的boxId :"+boxId);
 | 
			
		||||
 | 
			
		||||
                    //二. MES 业务
 | 
			
		||||
                    //===============           MES 业务 开始         =================
 | 
			
		||||
                    //1. box信息录入到box表
 | 
			
		||||
                    boxServiceBiz.updateIsArrivedByBoxNo(1,boxId);
 | 
			
		||||
                    //===============           MES 业务 结束         =================
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                    //四. 当MES完成任务后,把MesToPlc.ShelfIsFullArrivedFinish变量置为true,告诉plc,我操作完成了
 | 
			
		||||
                    write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true);
 | 
			
		||||
 | 
			
		||||
                    //四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false
 | 
			
		||||
                    Integer subArrived2 = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, false);
 | 
			
		||||
                    if(subArrived2 != 1){
 | 
			
		||||
                        logger.info("失败"+" --- "+"步骤1.  MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
 | 
			
		||||
                    }
 | 
			
		||||
                    write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,false);
 | 
			
		||||
                }catch (Throwable e){
 | 
			
		||||
                    logger.info(e.getMessage());
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        },1,1, TimeUnit.SECONDS);
 | 
			
		||||
//        kukaStep1.scheduleAtFixedRate(new Runnable() {
 | 
			
		||||
//            @Override
 | 
			
		||||
//            public void run() {
 | 
			
		||||
//                try {
 | 
			
		||||
//
 | 
			
		||||
//                    //调度开始
 | 
			
		||||
////                logger.info("");
 | 
			
		||||
////                logger.info("=================  现在开始执行 过程一 任务   ==================");
 | 
			
		||||
//                    Integer subArrived = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, true);
 | 
			
		||||
//                    if(subArrived != 1){
 | 
			
		||||
//                        logger.info("标签打印Event---  失败"+" --- "+" MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
 | 
			
		||||
//                    }
 | 
			
		||||
//
 | 
			
		||||
//                    //一. 从plc 中获取 subId 和 lineNum
 | 
			
		||||
//                    String subId = (String) read(S7Client.S7_KUKA,Step1Plc2MesVar.SubIdToMes);
 | 
			
		||||
//                    Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step1Plc2MesVar.LineNum);
 | 
			
		||||
//                    //把基板ID字符串的空格去掉,因为plc中设置的20位,但实际基板ID就是17位,因为带空格去数据库查询 有问题的。
 | 
			
		||||
//                    subId = removeKG(subId);
 | 
			
		||||
//
 | 
			
		||||
//                    //二. MES 业务
 | 
			
		||||
//                    //===============           MES 业务 开始         =================
 | 
			
		||||
//                    //1. 从comline数据库中获取 实际pmpp
 | 
			
		||||
//                    float pmppBySubId = service.getPMPPBySubId(subId);
 | 
			
		||||
//                    //2. 匹配和计算补偿功率
 | 
			
		||||
//                    float actualPMPP = compensationPowerServiceBiz.calculCompensationPMPP(pmppBySubId,lineNum);
 | 
			
		||||
//                    //3. 依据补偿功率,获取工艺参数,并且把这些工艺参数传给kuka
 | 
			
		||||
//                    WoPowerLevel argByPMPP = levelServiceBiz.getArgByPMPP(actualPMPP, lineNum);
 | 
			
		||||
//                    write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Pnom,Integer.valueOf(argByPMPP.getPowerClass()));
 | 
			
		||||
//                    write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Voc,argByPMPP.getLableVoc());
 | 
			
		||||
//                    write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Isc,argByPMPP.getLableIsc());
 | 
			
		||||
//                    write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Vmpp,argByPMPP.getLableVmpp());
 | 
			
		||||
//                    write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Impp,argByPMPP.getLableImpp());
 | 
			
		||||
//                    logger.info("标签打印Event--- 采集到 基板ID: "+subId+", 线边号:"+lineNum+",从camline 获取到实际pmpp"+pmppBySubId+",计算后 补偿功率:"+actualPMPP+",dLable_Pnom: "+argByPMPP.getPowerClass() +",dLable_Voc: "+argByPMPP.getLableVoc()+",dLable_Isc: "+argByPMPP.getLableIsc()+",dLable_Vmpp: "+argByPMPP.getLableVmpp()+",dLable_Impp: "+argByPMPP.getLableImpp());
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//                    //4. 把基板录到数据库
 | 
			
		||||
//                    WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate();
 | 
			
		||||
//                    woPackagingBoxSubstrate.setLineBody(lineNum);
 | 
			
		||||
//                    woPackagingBoxSubstrate.setPowerLevel(argByPMPP.getPowerClass());
 | 
			
		||||
//                    woPackagingBoxSubstrate.setSapMaterial(argByPMPP.getSapMaterialNum());
 | 
			
		||||
//                    woPackagingBoxSubstrate.setWoSubstrateId(subId);
 | 
			
		||||
//                    woPackagingBoxSubstrate.setActualPmpp(pmppBySubId);
 | 
			
		||||
//                    woPackagingBoxSubstrate.setCreateTime(LocalDateTime.now());
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//                    //5. 从camline那里获取可变字段
 | 
			
		||||
//                    CamlineExtendArgDTO extendArgFromCamline = service.getExtendArgFromCamline(subId);
 | 
			
		||||
//                    logger.info("标签打印Event--- 基板ID: "+subId+", 从camline获取PID16~PID22 的实测数据 成功, 数据内容:"+extendArgFromCamline.toString());
 | 
			
		||||
//                    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);
 | 
			
		||||
//                    logger.info("标签打印Event--- 基板ID: "+subId+", 录入数据库成功");
 | 
			
		||||
//                    //===============           MES 业务 结束         =================
 | 
			
		||||
//
 | 
			
		||||
//                    //三. 当MES完成任务后,把MesToPlc.SubArrivedFinish变量置为true,告诉plc,我操作完成了
 | 
			
		||||
//                    write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,true);
 | 
			
		||||
//                    logger.info("标签打印Event--- 基板ID: "+subId+", SubArrivedFinish,置为true 成功");
 | 
			
		||||
//                    //四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false
 | 
			
		||||
//                    Integer subArrived2 = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, false);
 | 
			
		||||
//                    if(subArrived2 != 1){
 | 
			
		||||
//                        logger.info("标签打印Event--- 失败"+" --- "+"MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
 | 
			
		||||
//                    }
 | 
			
		||||
//
 | 
			
		||||
//                    write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,false);
 | 
			
		||||
//                    logger.info("标签打印Event--- 基板ID: "+subId+", SubArrivedFinish,置为 false 成功, Event1 成功结束");
 | 
			
		||||
//
 | 
			
		||||
//                }catch (Throwable e){
 | 
			
		||||
//                    logger.info("标签打印Event---  :"+e.getMessage());
 | 
			
		||||
//                }
 | 
			
		||||
//            }
 | 
			
		||||
//        },1,1, TimeUnit.SECONDS);
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//        kukaStep2.scheduleAtFixedRate(new Runnable() {
 | 
			
		||||
//            @Override
 | 
			
		||||
//            public void run() {
 | 
			
		||||
//                try {
 | 
			
		||||
//
 | 
			
		||||
//                    //调度开始
 | 
			
		||||
//                    Integer shelfIsFull = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, true);
 | 
			
		||||
//                    if(shelfIsFull != 1){
 | 
			
		||||
//                        logger.info("BOXID生成Event-------失败"+" --- "+"MES监听 Step2Plc2MesVar.ShelfIsFull 是否 等于 1 失败");
 | 
			
		||||
//                    }
 | 
			
		||||
//
 | 
			
		||||
//                    //一. 从plc 中获取 subIdList 和 lineNum
 | 
			
		||||
//                    String[] subIdList = (String[])read(S7Client.S7_KUKA,Step2Plc2MesVar.SubIdList);
 | 
			
		||||
//                    Integer listSize = (Integer)read(S7Client.S7_KUKA,Step2Plc2MesVar.PackageNumberSet);
 | 
			
		||||
//
 | 
			
		||||
//                    //二. MES 业务
 | 
			
		||||
//                    //===============           MES 业务 开始         =================
 | 
			
		||||
//                    //1.MES 生成BoxId
 | 
			
		||||
//                    if(subIdList.length<=0){
 | 
			
		||||
//                        logger.info("BOXID生成Event-------失败"+" --- "+"从plc里面获取到的基板列表 为空");
 | 
			
		||||
//                        throw new Exception("BOXID生成Event-------kuka机械手 取到了空箱");
 | 
			
		||||
//                    }
 | 
			
		||||
//                    //真实的基板ID 就是17位的,plc读取过来,有空格,要把后面3位空格去掉就行了。
 | 
			
		||||
//                    for(int i=0;i<subIdList.length;i++){
 | 
			
		||||
//                        subIdList[i] = removeKG(subIdList[i]);
 | 
			
		||||
//                    }
 | 
			
		||||
//                    logger.info("BOXID生成Event-------获取到基板列表:"+ Arrays.toString(subIdList)+",基板数量:"+listSize);
 | 
			
		||||
//
 | 
			
		||||
//                    WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(subIdList[0]);
 | 
			
		||||
//                    //如果我们系统中找不到这块基板那么就去camline里面找
 | 
			
		||||
//                    if(bySubId == null){
 | 
			
		||||
//                        //todo
 | 
			
		||||
//                        CamlineSubIdDTO subIdByCamline = service.getSubIdByCamline(subIdList[0]);
 | 
			
		||||
//                        bySubId = new WoPackagingBoxSubstrate();
 | 
			
		||||
//                        bySubId.setPowerLevel(subIdByCamline.getPowerLevel());
 | 
			
		||||
//                        bySubId.setSapMaterial(subIdByCamline.getSapMaterial());
 | 
			
		||||
//                        bySubId.setLineBody(2);
 | 
			
		||||
//                    }
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//                    String boxId = getBoxId(bySubId.getSapMaterial());
 | 
			
		||||
//                    logger.info("BOXID生成Event-------mes 生成的boxId :"+ boxId);
 | 
			
		||||
//                    //2. 依次update 基板表,把boxId 赋予这些基板
 | 
			
		||||
//                    for(int i=0;i<listSize;i++){
 | 
			
		||||
//                        substrateServiceBiz.updatePackagingBoxIdAndSlotByWoSubstrateId(boxId,(i+1),subIdList[i]);
 | 
			
		||||
//                    }
 | 
			
		||||
//                    //3.去camline数据库 查询此基板ID 对应的订单
 | 
			
		||||
//                    String orderNameBySubId = service.getOrderNameBySubId(subIdList[0]);
 | 
			
		||||
//                    //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());
 | 
			
		||||
//                    woPackagingBox.setOrderNum(orderNameBySubId);
 | 
			
		||||
//                    //1-手动模式,2-自动模式
 | 
			
		||||
//                    woPackagingBox.setModel(2);
 | 
			
		||||
//                    woPackagingBox.setCreateTime(LocalDateTime.now());
 | 
			
		||||
//                    boxServiceBiz.insert(woPackagingBox);
 | 
			
		||||
//                    logger.info("BOXID生成Event-------boxId :"+ boxId+"写入数据库成功");
 | 
			
		||||
//                    //===============           MES 业务 结束         =================
 | 
			
		||||
//
 | 
			
		||||
//                    //三. 把生成的BoxId 告诉kuka
 | 
			
		||||
//                    write(S7Client.S7_KUKA,Step2Mes2PlcVar.BoxId,boxId);
 | 
			
		||||
//                    logger.info("BOXID生成Event-------boxId :"+ boxId+"传给PLC 成功");
 | 
			
		||||
//
 | 
			
		||||
//                    //四. 当MES完成任务后,把MesToPlc.ShelfIsFullFinish变量置为true,告诉plc,我操作完成了
 | 
			
		||||
//                    write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,true);
 | 
			
		||||
//                    logger.info("BOXID生成Event-------boxId :"+ boxId+"ShelfIsFullFinish 置为true 成功");
 | 
			
		||||
//                    //四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false
 | 
			
		||||
//                    Integer subArrived2 = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, false);
 | 
			
		||||
//                    if(subArrived2 != 1){
 | 
			
		||||
//                        logger.info("BOXID生成Event-------失败"+" --- "+"步骤1.  MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
 | 
			
		||||
//                    }
 | 
			
		||||
//                    write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,false);
 | 
			
		||||
//                    logger.info("BOXID生成Event-------boxId :"+ boxId+"ShelfIsFullFinish 置为false 成功,Event2 成功结束");
 | 
			
		||||
//                }catch (Throwable e){
 | 
			
		||||
//                    logger.info("BOXID生成Event------- :" + e.getMessage());
 | 
			
		||||
//                }
 | 
			
		||||
//            }
 | 
			
		||||
//        },1,1, TimeUnit.SECONDS);
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//        kukaStep3.scheduleAtFixedRate(new Runnable() {
 | 
			
		||||
//            @Override
 | 
			
		||||
//            public void run() {
 | 
			
		||||
//                try {
 | 
			
		||||
//
 | 
			
		||||
//                    //调度开始
 | 
			
		||||
//                    Integer shelfIsFull = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, true);
 | 
			
		||||
//                    if(shelfIsFull != 1){
 | 
			
		||||
//                        logger.info("装箱单打印Event------失败"+" --- "+"MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
 | 
			
		||||
//                    }
 | 
			
		||||
//
 | 
			
		||||
//                    //一. 从plc 中获取 subIdList 和 lineNum
 | 
			
		||||
//                    String boxId = (String)read(S7Client.S7_KUKA,Step3Plc2MesVar.BoxId);
 | 
			
		||||
//                    Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step3Plc2MesVar.LineNum);
 | 
			
		||||
//                    logger.info("装箱单打印Event------到达站台的boxId :"+boxId);
 | 
			
		||||
//
 | 
			
		||||
//                    //二. MES 业务
 | 
			
		||||
//                    //===============           MES 业务 开始         =================
 | 
			
		||||
//                    //1. box信息录入到box表
 | 
			
		||||
//                    boxServiceBiz.updateIsArrivedByBoxNo(1,boxId);
 | 
			
		||||
//                    logger.info("装箱单打印Event------boxId :"+boxId+"更新数据库成功");
 | 
			
		||||
//                    //===============           MES 业务 结束         =================
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//                    //四. 当MES完成任务后,把MesToPlc.ShelfIsFullArrivedFinish变量置为true,告诉plc,我操作完成了
 | 
			
		||||
//                    write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true);
 | 
			
		||||
//                    logger.info("装箱单打印Event------boxId :"+boxId+", ShelfIsFullArrivedFinish置为true 成功");
 | 
			
		||||
//                    //四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false
 | 
			
		||||
//                    Integer subArrived2 = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, false);
 | 
			
		||||
//                    if(subArrived2 != 1){
 | 
			
		||||
//                        logger.info("装箱单打印Event------失败"+" --- "+"步骤1.  MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
 | 
			
		||||
//                    }
 | 
			
		||||
//                    logger.info("装箱单打印Event------boxId :"+boxId+", 监听到subArrived=false 成功");
 | 
			
		||||
//                    write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,false);
 | 
			
		||||
//                    logger.info("装箱单打印Event------boxId :"+boxId+", Even3 成功");
 | 
			
		||||
//                }catch (Throwable e){
 | 
			
		||||
//                    logger.info("装箱单打印Event------"+e.getMessage());
 | 
			
		||||
//                }
 | 
			
		||||
//
 | 
			
		||||
//            }
 | 
			
		||||
//        },1,1, TimeUnit.SECONDS);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
package com.cnbm.packing.controller;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.admin.annotation.LogOperation;
 | 
			
		||||
import com.cnbm.dispatch.enums.kuka.step1.Step1Mes2PlcVar;
 | 
			
		||||
import com.cnbm.dispatch.enums.kuka.step1.Step1Plc2MesVar;
 | 
			
		||||
import com.cnbm.dispatch.enums.kuka.step2.Step2Mes2PlcVar;
 | 
			
		||||
@@ -8,15 +9,20 @@ import com.cnbm.dispatch.enums.kuka.step3.Step3Mes2PlcVar;
 | 
			
		||||
import com.cnbm.dispatch.enums.kuka.step3.Step3Plc2MesVar;
 | 
			
		||||
import com.cnbm.packing.dto.CamlineSubIdDTO;
 | 
			
		||||
import com.cnbm.packing.dto.CamlineSubIdForImportDTO;
 | 
			
		||||
import com.cnbm.packing.dto.PowerReportDTO;
 | 
			
		||||
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
 | 
			
		||||
import com.cnbm.packing.param.PowerReportQueryParam;
 | 
			
		||||
import com.cnbm.packing.service.DynamicDataSourceService;
 | 
			
		||||
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
 | 
			
		||||
import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz;
 | 
			
		||||
import com.cnbm.packing.vo.PowerReportVo;
 | 
			
		||||
import com.cnbm.s7.entity.R;
 | 
			
		||||
import com.cnbm.s7.s7connector.enmuc.S7Client;
 | 
			
		||||
import com.cnbm.s7.s7connector.type.PlcVar;
 | 
			
		||||
import io.swagger.annotations.Api;
 | 
			
		||||
import io.swagger.annotations.ApiImplicitParam;
 | 
			
		||||
import io.swagger.annotations.ApiImplicitParams;
 | 
			
		||||
import io.swagger.annotations.ApiOperation;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
@@ -26,6 +32,7 @@ import springfox.documentation.annotations.ApiIgnore;
 | 
			
		||||
 | 
			
		||||
import java.io.UnsupportedEncodingException;
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
import java.text.DecimalFormat;
 | 
			
		||||
import java.text.ParseException;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
@@ -47,6 +54,10 @@ public class TestController {
 | 
			
		||||
    DynamicDataSourceService service;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    WoPackagingBoxSubstrateServiceBiz substrateServiceBiz;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    WoPackagingBoxServiceBiz boxServiceBiz;
 | 
			
		||||
 | 
			
		||||
    private Object read(S7Client s7Client,Step1Plc2MesVar var) throws UnsupportedEncodingException, ParseException {
 | 
			
		||||
        try {
 | 
			
		||||
            return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
 | 
			
		||||
@@ -124,6 +135,8 @@ public class TestController {
 | 
			
		||||
        return R.ok();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/testReadAll")
 | 
			
		||||
    public R testReadAll() throws UnsupportedEncodingException, ParseException {
 | 
			
		||||
        for(Step1Plc2MesVar actual:Step1Plc2MesVar.values()){
 | 
			
		||||
 
 | 
			
		||||
@@ -13,24 +13,30 @@ import com.cnbm.common.validator.group.AddGroup;
 | 
			
		||||
import com.cnbm.common.validator.group.DefaultGroup;
 | 
			
		||||
import com.cnbm.common.validator.group.UpdateGroup;
 | 
			
		||||
import com.cnbm.packing.dto.ChangePackingBoxDTO;
 | 
			
		||||
import com.cnbm.packing.dto.PowerReportDTO;
 | 
			
		||||
import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO;
 | 
			
		||||
import com.cnbm.packing.entity.WoPackagingBox;
 | 
			
		||||
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
 | 
			
		||||
import com.cnbm.packing.excel.WoPackagingBoxSubstrateExcel;
 | 
			
		||||
import com.cnbm.packing.mapper.WoPackagingBoxMapper;
 | 
			
		||||
import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper;
 | 
			
		||||
import com.cnbm.packing.param.PowerReportQueryParam;
 | 
			
		||||
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
 | 
			
		||||
import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz;
 | 
			
		||||
import com.cnbm.packing.vo.PowerReportVo;
 | 
			
		||||
import io.swagger.annotations.Api;
 | 
			
		||||
import io.swagger.annotations.ApiImplicitParam;
 | 
			
		||||
import io.swagger.annotations.ApiImplicitParams;
 | 
			
		||||
import io.swagger.annotations.ApiOperation;
 | 
			
		||||
import org.apache.commons.lang3.StringUtils;
 | 
			
		||||
import org.omg.CORBA.PRIVATE_MEMBER;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.security.access.prepost.PreAuthorize;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
import springfox.documentation.annotations.ApiIgnore;
 | 
			
		||||
 | 
			
		||||
import javax.servlet.http.HttpServletResponse;
 | 
			
		||||
import java.text.DecimalFormat;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
@@ -48,6 +54,9 @@ public class WoPackagingBoxSubstrateController {
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private WoPackagingBoxSubstrateServiceBiz woPackagingBoxSubstrateService;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private WoPackagingBoxServiceBiz boxServiceBiz;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private WoPackagingBoxSubstrateMapper woPackagingBoxSubstrateMapper;
 | 
			
		||||
 | 
			
		||||
@@ -93,6 +102,16 @@ public class WoPackagingBoxSubstrateController {
 | 
			
		||||
        return new Result<Long>().ok(dto.getId());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
//    @PostMapping
 | 
			
		||||
//    @ApiOperation("功率报表")
 | 
			
		||||
//    @LogOperation("功率报表查询")
 | 
			
		||||
//    public Result<List<PowerReportDTO>> powerReport(@RequestBody PowerReportQueryParam queryParam){
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//        List<PowerReportDTO> powerReportDTOS = boxServiceBiz.powerReport(queryParam.getOrderName(), queryParam.getBegin(), queryParam.getEnd());
 | 
			
		||||
//        return new Result<List<PowerReportDTO>>().ok(powerReportDTOS);
 | 
			
		||||
//    }
 | 
			
		||||
 | 
			
		||||
    @PutMapping
 | 
			
		||||
    @ApiOperation("修改")
 | 
			
		||||
    @LogOperation("修改")
 | 
			
		||||
@@ -106,6 +125,48 @@ public class WoPackagingBoxSubstrateController {
 | 
			
		||||
        return new Result<Long>().ok(dto.getId());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @ApiOperation("查询模组档位统计分布图")
 | 
			
		||||
    @LogOperation("查询模组档位统计分布图")
 | 
			
		||||
    @PostMapping("/powerReport")
 | 
			
		||||
    public Result<PowerReportVo> powerReport(@RequestBody PowerReportQueryParam queryParam){
 | 
			
		||||
        List<PowerReportDTO> powerReportDTOS = boxServiceBiz.powerReport(queryParam);
 | 
			
		||||
 | 
			
		||||
        PowerReportVo powerReportVo = new PowerReportVo();
 | 
			
		||||
        Float totalLevelPower = new Float(0);
 | 
			
		||||
        Float totalCompensatePower = new Float(0);
 | 
			
		||||
        Float diversePower = new Float(0);
 | 
			
		||||
        Integer totalSubNum = 0;
 | 
			
		||||
        for(PowerReportDTO power : powerReportDTOS){
 | 
			
		||||
            Integer subLevel = Integer.valueOf(power.getSubLevel());
 | 
			
		||||
            Integer subNum = power.getSubNum();
 | 
			
		||||
            Float sumPMPP = power.getSumPMPP();
 | 
			
		||||
            totalLevelPower += subLevel*subNum;
 | 
			
		||||
            totalCompensatePower += sumPMPP*subNum;
 | 
			
		||||
            totalSubNum+= subNum;
 | 
			
		||||
        }
 | 
			
		||||
        for(PowerReportDTO power : powerReportDTOS){
 | 
			
		||||
            Float prop = Float.valueOf(power.getSubNum())/Float.valueOf(totalSubNum);
 | 
			
		||||
            DecimalFormat df = new DecimalFormat("0.00");
 | 
			
		||||
            String propS = df.format(prop)+"%";
 | 
			
		||||
            power.setProportion(propS);
 | 
			
		||||
        }
 | 
			
		||||
        diversePower = totalLevelPower - totalCompensatePower;
 | 
			
		||||
        powerReportVo.setPowerReports(powerReportDTOS);
 | 
			
		||||
        powerReportVo.setDiversePower(diversePower);
 | 
			
		||||
        powerReportVo.setTotalCompensatePower(totalCompensatePower);
 | 
			
		||||
        powerReportVo.setTotalLevelPower(totalLevelPower);
 | 
			
		||||
 | 
			
		||||
        return new Result<PowerReportVo>().ok(powerReportVo);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @ApiOperation("查询模组档位统计分布图-获取ordername列表")
 | 
			
		||||
    @LogOperation("查询模组档位统计分布图-获取ordername列表")
 | 
			
		||||
    @PostMapping("/orderNameList")
 | 
			
		||||
    public Result<List<String>> orderNameList(){
 | 
			
		||||
        List<String> powerReportDTOS = boxServiceBiz.orderNameList();
 | 
			
		||||
        return new Result<List<String>>().ok(powerReportDTOS);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @DeleteMapping
 | 
			
		||||
    @ApiOperation("删除")
 | 
			
		||||
    @LogOperation("删除")
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,34 @@
 | 
			
		||||
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-21
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@ApiModel(value = "包装箱基板关联表 ( 基板表 )DTO对象")
 | 
			
		||||
public class PowerReportDTO implements Serializable {
 | 
			
		||||
	private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty(value = "subNum")
 | 
			
		||||
	private Integer subNum;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty(value = "subLevel")
 | 
			
		||||
	private String subLevel;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty(value = "sumPMPP")
 | 
			
		||||
	private Float sumPMPP;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty(value = "占比(百分比)")
 | 
			
		||||
	private String proportion;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,10 +1,15 @@
 | 
			
		||||
package com.cnbm.packing.mapper;
 | 
			
		||||
import com.cnbm.packing.dto.PowerReportDTO;
 | 
			
		||||
import com.cnbm.packing.param.PowerReportQueryParam;
 | 
			
		||||
import org.apache.ibatis.annotations.Param;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.common.dao.BaseDao;
 | 
			
		||||
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
 | 
			
		||||
import org.apache.ibatis.annotations.Mapper;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 包装箱基板关联表
 | 
			
		||||
 *
 | 
			
		||||
@@ -17,4 +22,7 @@ public interface WoPackagingBoxSubstrateMapper extends BaseDao<WoPackagingBoxSub
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    int updatePackagingBoxIdAndSlotByWoSubstrateId(@Param("packagingBoxId") String packagingBoxId, @Param("slot") Integer slot, @Param("woSubstrateId") String woSubstrateId);
 | 
			
		||||
 | 
			
		||||
    List<PowerReportDTO> powerReport(@Param("queryParam") PowerReportQueryParam queryParam);
 | 
			
		||||
    List<String> orderNameList();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,20 @@
 | 
			
		||||
package com.cnbm.packing.param;
 | 
			
		||||
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Desc: ""
 | 
			
		||||
 * @Author: caixiang
 | 
			
		||||
 * @DATE: 2023/2/15 19:05
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
public class PowerReportQueryParam {
 | 
			
		||||
    private LocalDateTime begin;
 | 
			
		||||
    private LocalDateTime end;
 | 
			
		||||
    private String orderName;
 | 
			
		||||
 | 
			
		||||
    private Integer model;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -3,9 +3,13 @@ package com.cnbm.packing.service;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
import com.cnbm.common.service.CrudService;
 | 
			
		||||
import com.cnbm.packing.dto.IdVo;
 | 
			
		||||
import com.cnbm.packing.dto.PowerReportDTO;
 | 
			
		||||
import com.cnbm.packing.dto.WoPackagingBoxDTO;
 | 
			
		||||
import com.cnbm.packing.entity.WoPackagingBox;
 | 
			
		||||
import com.cnbm.packing.param.PowerReportQueryParam;
 | 
			
		||||
import org.apache.ibatis.annotations.Param;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
@@ -33,4 +37,7 @@ public interface WoPackagingBoxServiceBiz extends CrudService<WoPackagingBox, Wo
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    int updateIsArrivedByBoxNo(Integer isArrived, String boxNo);
 | 
			
		||||
 | 
			
		||||
    List<PowerReportDTO> powerReport(PowerReportQueryParam queryParam);
 | 
			
		||||
    List<String> orderNameList();
 | 
			
		||||
}
 | 
			
		||||
@@ -8,11 +8,13 @@ import com.cnbm.common.page.PageData;
 | 
			
		||||
import com.cnbm.common.service.impl.CrudServiceImpl;
 | 
			
		||||
import com.cnbm.common.utils.ConvertUtils;
 | 
			
		||||
import com.cnbm.packing.dto.IdVo;
 | 
			
		||||
import com.cnbm.packing.dto.PowerReportDTO;
 | 
			
		||||
import com.cnbm.packing.dto.WoPackagingBoxDTO;
 | 
			
		||||
import com.cnbm.packing.entity.WoPackagingBox;
 | 
			
		||||
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
 | 
			
		||||
import com.cnbm.packing.mapper.WoPackagingBoxMapper;
 | 
			
		||||
import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper;
 | 
			
		||||
import com.cnbm.packing.param.PowerReportQueryParam;
 | 
			
		||||
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
 | 
			
		||||
import org.apache.commons.lang3.StringUtils;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
@@ -38,6 +40,7 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private WoPackagingBoxSubstrateMapper substrateMapper;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public QueryWrapper<WoPackagingBox> getWrapper(Map<String, Object> params){
 | 
			
		||||
 | 
			
		||||
@@ -127,4 +130,14 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
 | 
			
		||||
    public int updateIsArrivedByBoxNo(Integer isArrived, String boxNo) {
 | 
			
		||||
        return mapper.updateIsArrivedByBoxNo(isArrived,boxNo);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<PowerReportDTO> powerReport(PowerReportQueryParam queryParam) {
 | 
			
		||||
        return substrateMapper.powerReport(queryParam);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<String> orderNameList() {
 | 
			
		||||
        return substrateMapper.orderNameList();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,22 @@
 | 
			
		||||
package com.cnbm.packing.vo;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.packing.dto.PowerReportDTO;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Desc: ""
 | 
			
		||||
 * @Author: caixiang
 | 
			
		||||
 * @DATE: 2023/3/6 9:34
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
public class PowerReportVo {
 | 
			
		||||
    private Float totalLevelPower;
 | 
			
		||||
    private Float totalCompensatePower;
 | 
			
		||||
    private Float diversePower;
 | 
			
		||||
 | 
			
		||||
    private List<PowerReportDTO> powerReports;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -154,72 +154,65 @@
 | 
			
		||||
                LEFT JOIN er_order eo ON tu.ORDER_ID = eo.ID
 | 
			
		||||
        WHERE
 | 
			
		||||
                tu.NAME IN (
 | 
			
		||||
                            '30110012302232616',
 | 
			
		||||
                            '30110012302181619',
 | 
			
		||||
                            '30110012302250549',
 | 
			
		||||
                            '30110012302233506',
 | 
			
		||||
                            '30110012302231424',
 | 
			
		||||
                            '30110012302243219',
 | 
			
		||||
                            '30110012302260016',
 | 
			
		||||
                            '30110012302233325',
 | 
			
		||||
                            '30110012302231486',
 | 
			
		||||
                            '30110012302242632',
 | 
			
		||||
                            '30110012302233332',
 | 
			
		||||
                            '30110012302243231',
 | 
			
		||||
                            '30110012302221955',
 | 
			
		||||
                            '30110012302233340',
 | 
			
		||||
                            '30110012302243234',
 | 
			
		||||
                            '30110012302181963',
 | 
			
		||||
                            '30110012302240054',
 | 
			
		||||
                            '30110012302233339',
 | 
			
		||||
                            '30110012302233336',
 | 
			
		||||
                            '30110012302250041',
 | 
			
		||||
                            '30110012302240846',
 | 
			
		||||
                            '30110012302242395',
 | 
			
		||||
                            '30110012302233328',
 | 
			
		||||
                            '30110012302242648',
 | 
			
		||||
                            '30110012302232905',
 | 
			
		||||
                            '30110012302232659',
 | 
			
		||||
                            '30110012302233329',
 | 
			
		||||
                            '30110012302231417',
 | 
			
		||||
                            '30110012302250331',
 | 
			
		||||
                            '30110012302251165',
 | 
			
		||||
                            '30110012302192079',
 | 
			
		||||
                            '30110012302260005',
 | 
			
		||||
                            '30110012302250817',
 | 
			
		||||
                            '30110012302233312',
 | 
			
		||||
                            '30110012302271020',
 | 
			
		||||
                            '30110012302231495',
 | 
			
		||||
                            '30110012302233216',
 | 
			
		||||
                            '30110012302271022',
 | 
			
		||||
                            '30110012302183386',
 | 
			
		||||
                            '30110012302240164',
 | 
			
		||||
                            '30110012302272191',
 | 
			
		||||
                            '30110012302131618',
 | 
			
		||||
                            '30110012303012944',
 | 
			
		||||
                            '30110012303020207',
 | 
			
		||||
                            '30110012302241261',
 | 
			
		||||
                            '30110012302241398',
 | 
			
		||||
                            '30110012302230861',
 | 
			
		||||
                            '30110012302233064',
 | 
			
		||||
                            '30110012302250040',
 | 
			
		||||
                            '30110012302251285',
 | 
			
		||||
                            '30110012302221930',
 | 
			
		||||
                            '30110012302182351',
 | 
			
		||||
                            '30110012302250036',
 | 
			
		||||
                            '30110012302251263',
 | 
			
		||||
                            '30110012302232697',
 | 
			
		||||
                            '30110012302242148',
 | 
			
		||||
                            '30110012302190531',
 | 
			
		||||
                            '30110012302242780',
 | 
			
		||||
                            '30110012302240623',
 | 
			
		||||
                            '30110012302281480',
 | 
			
		||||
                            '30110012302282683',
 | 
			
		||||
                            '30110012302240071',
 | 
			
		||||
                            '30110012302250901',
 | 
			
		||||
                            '30110012303011030',
 | 
			
		||||
                            '30110012302250913',
 | 
			
		||||
                            '30110012302270254',
 | 
			
		||||
                            '30110012302092199',
 | 
			
		||||
                            '30110012303020200',
 | 
			
		||||
                            '30110012303012545',
 | 
			
		||||
                            '30110012302142542',
 | 
			
		||||
                            '30110012302232978',
 | 
			
		||||
                            '30110012303020850',
 | 
			
		||||
                            '30110012303020177',
 | 
			
		||||
                            '30110012302250223',
 | 
			
		||||
                            '30110012302232990',
 | 
			
		||||
                            '30110012303013332',
 | 
			
		||||
                            '30110012302232986',
 | 
			
		||||
                            '30110012302232985',
 | 
			
		||||
                            '30110012302284455',
 | 
			
		||||
                            '30110012302233312',
 | 
			
		||||
                            '30110012303020358',
 | 
			
		||||
                            '30110012302282341',
 | 
			
		||||
                            '30110012303020199',
 | 
			
		||||
                            '30110012302272331',
 | 
			
		||||
                            '30110012303021196',
 | 
			
		||||
                            '30110012302233336',
 | 
			
		||||
                            '30110012303020006',
 | 
			
		||||
                            '30110012302242395',
 | 
			
		||||
                            '30110012302233328',
 | 
			
		||||
                            '30110012303012521',
 | 
			
		||||
                            '30110012302233506',
 | 
			
		||||
                            '30110012302242632',
 | 
			
		||||
                            '30110012302233332',
 | 
			
		||||
                            '30110012302232981',
 | 
			
		||||
                            '30110012303020183',
 | 
			
		||||
                            '30110012302283758',
 | 
			
		||||
                            '30110012302280081',
 | 
			
		||||
                            '30110012303020128',
 | 
			
		||||
                            '30110012302241074',
 | 
			
		||||
                            '30110012302182357',
 | 
			
		||||
                            '30110012302233324',
 | 
			
		||||
                            '30110012302172333',
 | 
			
		||||
                            '30110012302193103',
 | 
			
		||||
                            '30110012302192897',
 | 
			
		||||
                            '30110012302233139',
 | 
			
		||||
                            '30110012302241645',
 | 
			
		||||
                            '30110012302250035',
 | 
			
		||||
                            '30110012302232516',
 | 
			
		||||
                            '30110012302270854'
 | 
			
		||||
                            '30110012303020008',
 | 
			
		||||
                            '30110012303020088',
 | 
			
		||||
                            '30110012302232982',
 | 
			
		||||
                            '30110012303012916',
 | 
			
		||||
                            '30110012302230019',
 | 
			
		||||
                            '30110012302271634',
 | 
			
		||||
                            '30110012302251127',
 | 
			
		||||
                            '30110012302230021',
 | 
			
		||||
                            '30110012303010971',
 | 
			
		||||
                            '30110012302251123',
 | 
			
		||||
                            '30110012302140610'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -53,6 +53,13 @@
 | 
			
		||||
            <id column="UOC_FL2" property="uocFl2" />
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
    <resultMap id="ResultMapPowerRe" type="com.cnbm.packing.dto.PowerReportDTO">
 | 
			
		||||
        <result column="sub_num" property="subNum" />
 | 
			
		||||
        <result column="sub_level" property="subLevel" />
 | 
			
		||||
        <result column="sum_pmpp" property="sumPMPP" />
 | 
			
		||||
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
    <select id="list" resultType="com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO">
 | 
			
		||||
        select * from t_wo_packaging_box_substrate
 | 
			
		||||
        <where>
 | 
			
		||||
@@ -81,5 +88,35 @@
 | 
			
		||||
        where WO_SUBSTRATE_ID = #{woSubstrateId,jdbcType=VARCHAR}
 | 
			
		||||
    </update>
 | 
			
		||||
 | 
			
		||||
    <select id="powerReport" resultMap="ResultMapPowerRe">
 | 
			
		||||
        select
 | 
			
		||||
            COUNT(twpbs.WO_SUBSTRATE_ID) as sub_num,twpbs.POWER_LEVEL as sub_level,sum(twpbs.PMPP) as sum_pmpp
 | 
			
		||||
        from t_wo_packaging_box_substrate twpbs
 | 
			
		||||
                 left join t_wo_packaging_box twpb on twpbs.PACKAGING_BOX_ID = twpb.BOX_NO
 | 
			
		||||
        <where>
 | 
			
		||||
            twpbs.PACKAGING_BOX_ID != '0'
 | 
			
		||||
            <if test="queryParam.begin != null and queryParam.end != null">
 | 
			
		||||
                and twpb.CREATE_TIME between #{queryParam.begin} AND #{queryParam.end}
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="queryParam.orderName != null">
 | 
			
		||||
                and twpbs.ORDER_NAME = #{queryParam.orderName}
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="queryParam.model != null">
 | 
			
		||||
                and twpb.model = #{queryParam.model}
 | 
			
		||||
            </if>
 | 
			
		||||
        </where>
 | 
			
		||||
        group by twpbs.POWER_LEVEL
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="orderNameList" resultType="string">
 | 
			
		||||
        select
 | 
			
		||||
            twpbs.ORDER_NAME as orderName
 | 
			
		||||
        from t_wo_packaging_box_substrate twpbs
 | 
			
		||||
        where
 | 
			
		||||
            twpbs.PACKAGING_BOX_ID != '0'
 | 
			
		||||
          and twpbs.ORDER_NAME != ''
 | 
			
		||||
        group by twpbs.ORDER_NAME
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user