This commit is contained in:
caixiang 2023-03-04 13:57:07 +08:00
parent ec1e5097f7
commit 9ccc971a38
7 changed files with 178 additions and 18 deletions

View File

@ -2,13 +2,13 @@ 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
url: jdbc:mysql://10.0.1.249:3306/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: cigs4
password: 1qazxsw2
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
# 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
# #Oracle
# driver-class-name: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@192.168.10.10:1521:xe

View File

@ -15,6 +15,7 @@ import com.cnbm.packing.entity.WoPowerLevel;
import com.cnbm.packing.service.*;
import com.cnbm.s7.s7connector.enmuc.S7Client;
import com.cnbm.s7.s7connector.type.PlcVar;
import io.swagger.models.auth.In;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -23,6 +24,8 @@ import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.text.DecimalFormat;
import java.text.Format;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Date;
@ -66,6 +69,7 @@ public class KukaJoinThread implements ApplicationRunner {
/**
* return
* 成功 返回相应的object对象
@ -150,7 +154,9 @@ public class KukaJoinThread implements ApplicationRunner {
public String getBoxId(String sapMaterial){
Integer todayBoxNum = service.getTodayBoxNum();
String nowTime = DateUtil.format(new Date(), "yyMMdd");
String res = "301"+sapMaterial+nowTime+todayBoxNum;
todayBoxNum+=500;
String res = "301"+sapMaterial+nowTime+formateString(todayBoxNum);
return res;
}
@ -159,9 +165,13 @@ public class KukaJoinThread implements ApplicationRunner {
}
public static void main(String[] args) {
String str = "30110012302210707 ";
String substring = str.substring(0,17);
System.out.println(substring);
Integer a = 102;
Format f1 = new DecimalFormat("000");
System.out.println(f1.format(a));
}
public String formateString(Integer a){
Format f1 = new DecimalFormat("000");
return f1.format(a);
}
@Override
@ -209,6 +219,8 @@ public class KukaJoinThread implements ApplicationRunner {
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);
@ -271,7 +283,6 @@ public class KukaJoinThread implements ApplicationRunner {
try {
//调度开始
Integer shelfIsFull = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, true);
if(shelfIsFull != 1){
logger.info("失败"+" --- "+"MES监听 Step2Plc2MesVar.ShelfIsFull 是否 等于 1 失败");

View File

@ -7,6 +7,7 @@ import com.cnbm.dispatch.enums.kuka.step2.Step2Plc2MesVar;
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.entity.WoPackagingBoxSubstrate;
import com.cnbm.packing.service.DynamicDataSourceService;
import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz;
@ -27,6 +28,7 @@ import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -107,6 +109,21 @@ public class TestController {
System.out.println(Step2Plc2MesVar.SubIdList.getName()+" : "+Arrays.toString(s));
return R.ok();
}
@PostMapping("/forImport")
public R forImport() throws UnsupportedEncodingException, ParseException {
List<CamlineSubIdForImportDTO> alllCamlineSubForImp = service.getAlllCamlineSubForImp();
for(CamlineSubIdForImportDTO cam:alllCamlineSubForImp){
WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate();
woPackagingBoxSubstrate.setWoSubstrateId(cam.getSubId());
woPackagingBoxSubstrate.setLineBody(2);
woPackagingBoxSubstrate.setPowerLevel(cam.getPowerLevel());
woPackagingBoxSubstrate.setOrderName(cam.getOrderName());
woPackagingBoxSubstrate.setSapMaterial(cam.getSapMaterial());
substrateServiceBiz.insert(woPackagingBoxSubstrate);
}
return R.ok();
}
@PostMapping("/testReadAll")
public R testReadAll() throws UnsupportedEncodingException, ParseException {
for(Step1Plc2MesVar actual:Step1Plc2MesVar.values()){
@ -205,6 +222,7 @@ public class TestController {
}
@PostMapping("getPMPPBySubId")
@ApiImplicitParams({
@ApiImplicitParam(name = "subId", value = "基板ID", paramType = "query", required = true, dataTypeClass=Integer.class) ,

View File

@ -0,0 +1,28 @@
package com.cnbm.packing.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.io.Serializable;
/**
* 打印标签模板表
*
* @author codeGenerator
* @since 2023-02-20
*/
@Data
@ApiModel(value = "camline 查询对象")
public class CamlineSubIdForImportDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String subId;
private String powerLevel;
private String sapMaterial;
private String orderName;
}

View File

@ -2,6 +2,7 @@ package com.cnbm.packing.mapper;
import com.cnbm.packing.dto.CamlineExtendArgDTO;
import com.cnbm.packing.dto.CamlineSubIdDTO;
import com.cnbm.packing.dto.CamlineSubIdForImportDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -29,4 +30,6 @@ public interface CamlineMapper {
Integer getTodayBoxNum();
CamlineSubIdDTO getSubIdByCamline(@Param("subId") String subId);
List<CamlineSubIdForImportDTO> getSubIdByCamlineForImpoet();
}

View File

@ -3,6 +3,7 @@ package com.cnbm.packing.service;
import com.cnbm.dynamic.datasource.annotation.DataSource;
import com.cnbm.packing.dto.CamlineExtendArgDTO;
import com.cnbm.packing.dto.CamlineSubIdDTO;
import com.cnbm.packing.dto.CamlineSubIdForImportDTO;
import com.cnbm.packing.dto.WoPowerLevelDTO;
import com.cnbm.packing.mapper.CamlineMapper;
@ -54,4 +55,10 @@ public class DynamicDataSourceService {
return mapper.getExtendArgFromCamline(subId);
}
@DataSource("camline")
@Transactional
public List<CamlineSubIdForImportDTO> getAlllCamlineSubForImp(){
return mapper.getSubIdByCamlineForImpoet();
}
}

View File

@ -11,6 +11,12 @@
<result column="power_level" property="powerLevel" />
<result column="sap_material" property="sapMaterial" />
</resultMap>
<resultMap id="ResultMapCamIm" type="com.cnbm.packing.dto.CamlineSubIdForImportDTO">
<result column="power_level" property="powerLevel" />
<result column="sap_material" property="sapMaterial" />
<result column="sub_id" property="subId" />
<result column="order_name" property="orderName" />
</resultMap>
<resultMap id="ResultAMap" type="com.cnbm.packing.dto.CamlineExtendArgDTO">
<result column="LAST_UPDATE_TIME" property="lastUpdateTime" />
@ -58,16 +64,15 @@
<select id="getPMPPBySubId" resultType="float">
SELECT
flc.PMPP
flr.PMPP_FL2 as PMPP
FROM
ue_flasher_data_calc flc
LEFT JOIN e_tracking_unit tu ON flc.mainid = tu.id
ue_flasher_data_raw flr
LEFT JOIN e_tracking_unit tu ON flr.mainid = tu.id
WHERE
flc.PMPP != 0
and
tu.name=#{subId} -- 查特定基板功率
flr.PMPP_FL2 != 0
and tu.name=#{subId} -- 查特定基板功率
ORDER BY
flc.LAST_UPDATE_TIME DESC
flr.LAST_UPDATE_TIME DESC
LIMIT 1
</select>
@ -137,6 +142,94 @@
and tu.name = #{subId}
</select>
<select id="getSubIdByCamlineForImpoet" resultMap="ResultMapCamIm">
SELECT
tu.`NAME` as sub_id,-- DMC
flc.SAP_Material as sap_material,
flc.Nenn_Leistung as power_level,
eo.`NAME` as order_name
FROM
ue_flasher_data_calc flc
LEFT JOIN e_tracking_unit tu ON flc.mainid = tu.id
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',
'30110012302241261',
'30110012302241398',
'30110012302230861',
'30110012302233064',
'30110012302250040',
'30110012302251285',
'30110012302221930',
'30110012302182351',
'30110012302250036',
'30110012302251263',
'30110012302232697',
'30110012302242148',
'30110012302190531',
'30110012302242780',
'30110012302240623',
'30110012302241074',
'30110012302182357',
'30110012302233324',
'30110012302172333',
'30110012302193103',
'30110012302192897',
'30110012302233139',
'30110012302241645',
'30110012302250035',
'30110012302232516',
'30110012302270854'
)
and flc.PMPP != 0
GROUP BY tu.`NAME`
</select>
<select id="getOrderNameBySubId" resultType="string">
SELECT
eorder.name