Browse Source

fix(i18n): 统一异常消息为英文并优化代码注释

- 将所有中文异常消息改为英文
- 修正标点符号使用一致性
- 更新代码注释为英文描述
- 规范错误提示信息格式
master
qiankanghui 4 weeks ago
parent
commit
b4685a79b6
  1. 18
      src/main/java/com/ccl/tt/service/impl/BoxManageServiceImpl.java
  2. 134
      src/main/java/com/ccl/tt/service/impl/IndigoServiceImpl.java
  3. 28
      src/main/java/com/ccl/tt/service/impl/PrintLabelServiceImpl.java
  4. 60
      src/main/java/com/ccl/tt/service/impl/RollServiceImpl.java
  5. 132
      src/main/java/com/ccl/tt/service/impl/ScanningServiceImpl.java

18
src/main/java/com/ccl/tt/service/impl/BoxManageServiceImpl.java

@ -191,7 +191,7 @@ public class BoxManageServiceImpl implements BoxManageService {
public int countHsBatchBads(String jobId, String orderNo, String firstSerialNo, String endSerialNo) { public int countHsBatchBads(String jobId, String orderNo, String firstSerialNo, String endSerialNo) {
ScanJob job = jobRepo.findByJobId(jobId); ScanJob job = jobRepo.findByJobId(jobId);
if (job == null){ if (job == null){
throw new RuntimeException("Job不存在");
throw new RuntimeException("Job does not exist");
} }
//检查工单号 //检查工单号
if (null == orderNo || "".equals(orderNo)) { if (null == orderNo || "".equals(orderNo)) {
@ -294,11 +294,11 @@ public class BoxManageServiceImpl implements BoxManageService {
//检查工单号 //检查工单号
if (null == orderNo || "".equals(orderNo)) { if (null == orderNo || "".equals(orderNo)) {
throw new RuntimeException("工单不能为空!");
throw new RuntimeException("Work order cannot be empty!");
} }
SoInfo soInfo = soInfoRepo.findByOrderNo(orderNo); SoInfo soInfo = soInfoRepo.findByOrderNo(orderNo);
if (soInfo == null) { if (soInfo == null) {
throw new RuntimeException("工单号无效!");
throw new RuntimeException("Work order number is invalid!");
} }
//查询当前物料的数据 获取编码的类型 //查询当前物料的数据 获取编码的类型
String partNo = soInfo.getPartNo(); String partNo = soInfo.getPartNo();
@ -441,7 +441,7 @@ public class BoxManageServiceImpl implements BoxManageService {
int col2 = SerialUtil.getColIndex(rm, endSerialNo); int col2 = SerialUtil.getColIndex(rm, endSerialNo);
//判断是否是同一个排位 //判断是否是同一个排位
if (col1 != col2){ if (col1 != col2){
throw new RuntimeException("The serial numbers are not in the same column");
throw new RuntimeException("The serial numbers are not in the same column!");
} }
int count = 0; int count = 0;
@ -539,7 +539,7 @@ public class BoxManageServiceImpl implements BoxManageService {
//发货计划 //发货计划
List<ShipmentDelplan> shipmentDelplanList= shipmentDelplanRepository.findByShipNo(shipNo); List<ShipmentDelplan> shipmentDelplanList= shipmentDelplanRepository.findByShipNo(shipNo);
if(shipmentDelplanList.size()==0){ if(shipmentDelplanList.size()==0){
throw new RuntimeException("发货计划不存在");
throw new RuntimeException("Delivery plan does not exist");
} }
//算本物料需要多少 //算本物料需要多少
int shipQty=0; int shipQty=0;
@ -711,7 +711,7 @@ public class BoxManageServiceImpl implements BoxManageService {
public void receiveScanAdd(Integer recvId, String recvNo, String boxNo, String type, String finalRollNo, Authentication authentication){ public void receiveScanAdd(Integer recvId, String recvNo, String boxNo, String type, String finalRollNo, Authentication authentication){
SoReceiveBoxs box = receiveBoxRepository.findByBoxNo(boxNo); SoReceiveBoxs box = receiveBoxRepository.findByBoxNo(boxNo);
if (box == null) { if (box == null) {
throw new RuntimeException("箱号不存在!");
throw new RuntimeException("Box number does not exist!");
} }
if ("Packed".equals(box.getStatus())) { if ("Packed".equals(box.getStatus())) {
@ -796,7 +796,7 @@ public class BoxManageServiceImpl implements BoxManageService {
String date1= DateUtils2.getStringDate(getCreateDates.get(0).getFirstRollTime()); String date1= DateUtils2.getStringDate(getCreateDates.get(0).getFirstRollTime());
String date2= DateUtils2.getStringDate(rollOrder.getFirstRollTime()); String date2= DateUtils2.getStringDate(rollOrder.getFirstRollTime());
if(!date1.equals(date2)){ if(!date1.equals(date2)){
throw new RuntimeException("The production date should be same for the all of rolls in one box"+date1);
throw new RuntimeException("The production date should be same for the all of rolls in one box: "+date1);
} }
} }
@ -953,12 +953,12 @@ public class BoxManageServiceImpl implements BoxManageService {
if(strList.length==1){ if(strList.length==1){
String date2= DateUtils2.getStringDate(rollOrder.getFirstRollTime()); String date2= DateUtils2.getStringDate(rollOrder.getFirstRollTime());
if(!checkDate.equals(date2)){ if(!checkDate.equals(date2)){
throw new RuntimeException("The production date should be same for the all of rolls in one box"+checkDate);
throw new RuntimeException("The production date should be same for the all of rolls in one box: "+checkDate);
} }
}else { }else {
String productDate=strList[1]; String productDate=strList[1];
if(!checkDate.equals(productDate)){ if(!checkDate.equals(productDate)){
throw new RuntimeException("The production date should be same for the all of rolls in one box"+checkDate);
throw new RuntimeException("The production date should be same for the all of rolls in one box: "+checkDate);
} }
} }
} }

134
src/main/java/com/ccl/tt/service/impl/IndigoServiceImpl.java

@ -89,7 +89,7 @@ public class IndigoServiceImpl implements IndigoService {
/** /**
* *
* @Title: getCurrentOrderNoByUsername * @Title: getCurrentOrderNoByUsername
* @Description: 根据当前用户 查询当前用户设置的工单号
* @Description: Query the working order number set by the current user
* @param authentication * @param authentication
* @return * @return
* @return: String * @return: String
@ -129,7 +129,7 @@ public class IndigoServiceImpl implements IndigoService {
/** /**
* *
* @Title: getCurrentRoutingMap * @Title: getCurrentRoutingMap
* @Description: 调用存储过程 获取当前工单得工序信息
* @Description: Call stored procedure to get the routing information of the current work order
* @author: LR * @author: LR
* @date 2024年6月25日 上午11:23:32 * @date 2024年6月25日 上午11:23:32
* @return: Map<String,Object> * @return: Map<String,Object>
@ -141,7 +141,7 @@ public class IndigoServiceImpl implements IndigoService {
params.add(itemNo); params.add(itemNo);
params.add(itemKey); params.add(itemKey);
List<Map<String, Object>> resultList = procedureDao.getProcedureData("getOrderSoRouting", params); List<Map<String, Object>> resultList = procedureDao.getProcedureData("getOrderSoRouting", params);
//如果是空集合
// If the result list is empty
if(resultList.size() == 0 || resultList.isEmpty()) { if(resultList.size() == 0 || resultList.isEmpty()) {
return new HashMap<>(); return new HashMap<>();
} }
@ -151,7 +151,7 @@ public class IndigoServiceImpl implements IndigoService {
/** /**
* *
* @Title: getFuncModelByCon * @Title: getFuncModelByCon
* @Description: 根据条件判断是否调用存储过程
* @Description: Determine whether to call stored procedure based on conditions
* @return * @return
* @return: FuncModel * @return: FuncModel
* @author LR * @author LR
@ -159,7 +159,7 @@ public class IndigoServiceImpl implements IndigoService {
* @throws * @throws
*/ */
public FuncModel getFuncModelByCon(int currentItemNo, String currentFunc, String orderNo) { public FuncModel getFuncModelByCon(int currentItemNo, String currentFunc, String orderNo) {
//没有设置订单号
// Order number not set
if("***".equals(orderNo)) { if("***".equals(orderNo)) {
return funcModelMap.get(currentFunc); return funcModelMap.get(currentFunc);
}else { }else {
@ -179,7 +179,7 @@ public class IndigoServiceImpl implements IndigoService {
/** /**
* *
* @Title: getPreItemNo * @Title: getPreItemNo
* @Description: TODO(描述这个方法的作用)
* @Description: Get the previous operation number
* @param currentItemNo * @param currentItemNo
* @param currentFunc * @param currentFunc
* @param orderNo * @param orderNo
@ -190,11 +190,11 @@ public class IndigoServiceImpl implements IndigoService {
* @throws * @throws
*/ */
public int getPreItemNo(int currentItemNo, String currentFunc, String orderNo) { public int getPreItemNo(int currentItemNo, String currentFunc, String orderNo) {
//没有订单号的情况
// Case when no order number is set
if("***".equals(orderNo)) { if("***".equals(orderNo)) {
return 0; return 0;
}else { }else {
//2024-06-25 LR 新增的方法
//2024-06-25 LR Added method
FuncModel fm = getFuncModelByCon(0, currentFunc, orderNo); FuncModel fm = getFuncModelByCon(0, currentFunc, orderNo);
return fm.getPreItemNo(); return fm.getPreItemNo();
} }
@ -214,11 +214,11 @@ public class IndigoServiceImpl implements IndigoService {
SoRollBadSerial soRollBadSerial = badSnRepo.findBySerialNoAndRollNo(firstSerialNo, rollNo); SoRollBadSerial soRollBadSerial = badSnRepo.findBySerialNoAndRollNo(firstSerialNo, rollNo);
RollModel rm = roll.getOrder().toRollModel(); RollModel rm = roll.getOrder().toRollModel();
//校验by CH
//Validate by CH
if (rollOper != null) { if (rollOper != null) {
if (!SerialUtil.betweenOut(rm, firstSerialNo, rollOper.getSetupEndSerialNo(), rollOper.getEaiFirstSerialNo()) if (!SerialUtil.betweenOut(rm, firstSerialNo, rollOper.getSetupEndSerialNo(), rollOper.getEaiFirstSerialNo())
) { ) {
throw new RuntimeException("序列号必须在扫本次可用序列号以内");
throw new RuntimeException("Serial number must be within the available serial numbers for this scan");
}else if(soRollBadSerial != null){ }else if(soRollBadSerial != null){
throw new RuntimeException("The serial number Belongs to defective part"); throw new RuntimeException("The serial number Belongs to defective part");
} }
@ -237,15 +237,15 @@ public class IndigoServiceImpl implements IndigoService {
int rowOfFirst = SerialUtil.getRowIndex(roll.getOrder().toRollModel(), firstSerialNo); int rowOfFirst = SerialUtil.getRowIndex(roll.getOrder().toRollModel(), firstSerialNo);
if (rowOfFirst != roll.getSerialRowStart() && rowOfFirst != roll.getSerialRowEnd()){ if (rowOfFirst != roll.getSerialRowStart() && rowOfFirst != roll.getSerialRowEnd()){
throw new RuntimeException("不是第一个条码, 请确认后重新扫码!");
throw new RuntimeException("Not the first barcode, please confirm and re-scan!");
} }
} }
//分切后所有的工序开工扫号都要校验是否在正确的排位上
//After cutting, all operations need to validate the correct position when starting scan
if(fm.getOperationNo() > 18){ if(fm.getOperationNo() > 18){
int columnIndex = SerialUtil.getColIndex(rm, firstSerialNo); int columnIndex = SerialUtil.getColIndex(rm, firstSerialNo);
String columnSortIndexCon = ","+columnSortIndex+","; String columnSortIndexCon = ","+columnSortIndex+",";
if (columnSortIndexCon.indexOf(","+columnIndex+",") < 0) { if (columnSortIndexCon.indexOf(","+columnIndex+",") < 0) {
throw new RuntimeException("码包不在当前卷的排位范围之内!");
throw new RuntimeException("The barcode is not within the position range of the current roll!");
} }
} }
@ -268,15 +268,15 @@ public class IndigoServiceImpl implements IndigoService {
rollOperRepo.save(rollOp); rollOperRepo.save(rollOp);
rollRepo.save(roll); rollRepo.save(roll);
//如果工序是Indigo abg现在有独立的方法 不用在这处理 如何调用存储过程 2025-10-27 LR
//If the operation is Indigo (ABG now has independent methods, no need to handle here) Call stored procedure 2025-10-27 LR
if (fm.getOperationNo() == 10) { if (fm.getOperationNo() == 10) {
SoOrderMaterialMountData materialMount = materialDao.getSoOrderMaterialMount(orderNo, 10); SoOrderMaterialMountData materialMount = materialDao.getSoOrderMaterialMount(orderNo, 10);
//1.针对首卷 需要调用存储过程
//1. For the first roll, need to call stored procedure
if (null == materialMount) { if (null == materialMount) {
//开工扫号的 首卷自动上料 工单发料的时候只有一个批次
//Start scan: first roll auto feeding material, only one batch when issuing material for the work order
this.processFirstRollAutoFeedingMaterialBatchWithSoRollForStart(orderNo, partNo, 10, "Indigo", rollNo, columnSortIndex, authentication.getName()); this.processFirstRollAutoFeedingMaterialBatchWithSoRollForStart(orderNo, partNo, 10, "Indigo", rollNo, columnSortIndex, authentication.getName());
}else { }else {
//开工扫号的 后续卷自动继承前卷的材料批次
//Start scan: subsequent rolls automatically inherit the material batch of the previous roll
this.processFirstRollAutoSplicingMaterialBatchWithSoRollForStart(orderNo, partNo, 10, "Indigo", rollNo, columnSortIndex, authentication.getName()); this.processFirstRollAutoSplicingMaterialBatchWithSoRollForStart(orderNo, partNo, 10, "Indigo", rollNo, columnSortIndex, authentication.getName());
} }
} }
@ -285,7 +285,7 @@ public class IndigoServiceImpl implements IndigoService {
/** /**
* *
* @Title: processFirstRollAutoSplicingMaterialBatchWithSoRoll * @Title: processFirstRollAutoSplicingMaterialBatchWithSoRoll
* @Description: 开工扫号的 后续卷自动继承前卷的材料批次
* @Description: Start scan: subsequent rolls automatically inherit the material batch of the previous roll
* @author: LR * @author: LR
* @date 2025年10月27日 下午6:16:38 * @date 2025年10月27日 下午6:16:38
* @return: void * @return: void
@ -307,7 +307,7 @@ public class IndigoServiceImpl implements IndigoService {
/** /**
* *
* @Title: processFirstRollAutoFeedingMaterialBatchWithSoRoll * @Title: processFirstRollAutoFeedingMaterialBatchWithSoRoll
* @Description: 开工扫号的 首卷自动上料 领料的时候只有一个批次
* @Description: Start scan: first roll auto feeding material, only one batch when issuing material
* @author: LR * @author: LR
* @date 2025年10月27日 下午6:11:04 * @date 2025年10月27日 下午6:11:04
* @return: void * @return: void
@ -337,36 +337,36 @@ public class IndigoServiceImpl implements IndigoService {
SoRollOperation rollOper = rollOperRepo.findByRollNoAndOperationNo(rollNo, OperationNo); SoRollOperation rollOper = rollOperRepo.findByRollNoAndOperationNo(rollNo, OperationNo);
SoRollBadSerial soRollBadSerial = badSnRepo.findBySerialNoAndRollNo(endSerialNo, rollNo); SoRollBadSerial soRollBadSerial = badSnRepo.findBySerialNoAndRollNo(endSerialNo, rollNo);
SoRoll roll = validateRoll(rollNo); SoRoll roll = validateRoll(rollNo);
//查询当前物料的数据 获取编码的类型
//Query current material data to get the code type
String partNo = roll.getOrder().getPartNo(); String partNo = roll.getOrder().getPartNo();
PartData part = basicDao.getPartDataByPartNo(partNo); PartData part = basicDao.getPartDataByPartNo(partNo);
String codeType = part.getCodeType(); String codeType = part.getCodeType();
RollModel rm = roll.getOrder().toRollModel(); RollModel rm = roll.getOrder().toRollModel();
//校验by CH
//Validate by CH
if (rollOper != null) { if (rollOper != null) {
if(!SerialUtil.betweenOut(rm, endSerialNo, rollOper.getSetupEndSerialNo(), rollOper.getEaiFirstSerialNo()) if(!SerialUtil.betweenOut(rm, endSerialNo, rollOper.getSetupEndSerialNo(), rollOper.getEaiFirstSerialNo())
){ ){
throw new RuntimeException("序列号必须在扫本次可用序列号以内");
throw new RuntimeException("Serial number must be within the available serial numbers for this scan");
}else if(soRollBadSerial != null){ }else if(soRollBadSerial != null){
throw new RuntimeException("The serial number Belongs to defective part"); throw new RuntimeException("The serial number Belongs to defective part");
} }
} }
//判断首序列号是否传过来了
//Check if the first serial number has been passed
if(firstSerialNo == null || "".equals(firstSerialNo)) { if(firstSerialNo == null || "".equals(firstSerialNo)) {
SoRollOperation currentRollOper = rollOperRepo.findByRollNoAndOperationNo(rollNo, fm.getOperationNo()); SoRollOperation currentRollOper = rollOperRepo.findByRollNoAndOperationNo(rollNo, fm.getOperationNo());
//重置标签
//Reset label
firstSerialNo = currentRollOper.getFirstSerialNo(); firstSerialNo = currentRollOper.getFirstSerialNo();
} }
if(fm.getOperationNo() == 30){ if(fm.getOperationNo() == 30){
int columnIndex = SerialUtil.getColIndex(rm, firstSerialNo); int columnIndex = SerialUtil.getColIndex(rm, firstSerialNo);
int endColumnIndex = SerialUtil.getColIndex(rm, endSerialNo); int endColumnIndex = SerialUtil.getColIndex(rm, endSerialNo);
//打印列信息
//Print column information
logger.info("The Position of the Second Serials No:"+endColumnIndex); logger.info("The Position of the Second Serials No:"+endColumnIndex);
String columnSortIndex = roll.getColumnSortIndex(); String columnSortIndex = roll.getColumnSortIndex();
String columnSortIndexCon = ","+columnSortIndex+","; String columnSortIndexCon = ","+columnSortIndex+",";
if (columnSortIndexCon.indexOf(","+endColumnIndex+",") < 0) { if (columnSortIndexCon.indexOf(","+endColumnIndex+",") < 0) {
throw new RuntimeException("码包不在当前卷的排位范围之内!");
throw new RuntimeException("The barcode is not within the position range of the current roll!");
} }
} }
if (StringUtils.isEmpty(firstSerialNo)){ if (StringUtils.isEmpty(firstSerialNo)){
@ -387,7 +387,7 @@ public class IndigoServiceImpl implements IndigoService {
int row2 = rm.getRowIndex(esn10); int row2 = rm.getRowIndex(esn10);
if (row1 == row2) { if (row1 == row2) {
throw new RuntimeException("两个序列号在同一排");
throw new RuntimeException("Two serial numbers are in the same row");
} }
String direction = row2 > row1 ? "+" : "-"; String direction = row2 > row1 ? "+" : "-";
@ -399,7 +399,7 @@ public class IndigoServiceImpl implements IndigoService {
rollOp.setDirection(direction); rollOp.setDirection(direction);
}else{ }else{
if (!direction.equals(rollOp.getDirection())){ if (!direction.equals(rollOp.getDirection())){
throw new RuntimeException("Setup方向不一致");
throw new RuntimeException("Setup direction is inconsistent");
} }
} }
@ -418,26 +418,26 @@ public class IndigoServiceImpl implements IndigoService {
rollOp.setStatus(SoRollOperation.SETUPED); rollOp.setStatus(SoRollOperation.SETUPED);
rollOperRepo.save(rollOp); rollOperRepo.save(rollOp);
//获取参数 判断是否校验材料
//Get parameter to determine whether to validate material
TblSystemConfigData systemConfig = systemConfigDao.getSystemConfigDataByType("material", "material_tracking"); TblSystemConfigData systemConfig = systemConfigDao.getSystemConfigDataByType("material", "material_tracking");
//null 处理
//null handling
if (systemConfig == null) { if (systemConfig == null) {
throw new RuntimeException("请联系管理员维护是否进行材料跟踪!");
throw new RuntimeException("Please contact the administrator to configure material tracking!");
} }
String systemParam = systemConfig.getBaseData(); String systemParam = systemConfig.getBaseData();
//如果工序是Indigo abg现在有独立的方法 不用在这处理 如何调用存储过程 2025-10-27 LR
//If the operation is Indigo (ABG now has independent methods, no need to handle here) Call stored procedure 2025-10-27 LR
if (fm.getOperationNo() == 10 && "Y".equalsIgnoreCase(systemParam)) { if (fm.getOperationNo() == 10 && "Y".equalsIgnoreCase(systemParam)) {
//首件调用 检查是否是首卷 材料是否上齐
//调用存储过程 必须上齐材料 半成品卷号不在管控范围 如果是第一卷 添加首卷完成记录
//First piece call: check if it is the first roll and whether materials are fully loaded
//Call stored procedure: must load all materials, semi-finished roll numbers are not in control scope. If it is the first roll, add first roll completion record
Map<String, Object> checkMap = this.checkMaterialBatchReadyWithSoRollForSetup(orderNo, partNo, 10, rollNo, authentication.getName()); Map<String, Object> checkMap = this.checkMaterialBatchReadyWithSoRollForSetup(orderNo, partNo, 10, rollNo, authentication.getName());
String resultCode = String.valueOf(checkMap.get("result_code")); String resultCode = String.valueOf(checkMap.get("result_code"));
if (!"200".equals(resultCode)) { if (!"200".equals(resultCode)) {
String resultMsg = String.valueOf(checkMap.get("result_msg")); String resultMsg = String.valueOf(checkMap.get("result_msg"));
throw new RuntimeException(resultMsg); throw new RuntimeException(resultMsg);
} }
//调用存储过程 记录开始行 或者结束行 方向
//Call stored procedure: record start row or end row and direction
this.processMaterialBatchRowAndDirectionWithSoRollForSetup(orderNo, 10, rollNo, direction, row1); this.processMaterialBatchRowAndDirectionWithSoRollForSetup(orderNo, 10, rollNo, direction, row1);
} }
} }
@ -445,7 +445,7 @@ public class IndigoServiceImpl implements IndigoService {
/** /**
* *
* @Title: checkMaterialBatchReadyWithSoRollForFai * @Title: checkMaterialBatchReadyWithSoRollForFai
* @Description: 调用存储过程 必须上齐材料 半成品卷号不在管控范围 如果是第一卷 添加首卷完成记录
* @Description: Call stored procedure: must load all materials, semi-finished roll numbers are not in control scope. If it is the first roll, add first roll completion record
* @author: LR * @author: LR
* @date 2025年10月28日 上午9:33:33 * @date 2025年10月28日 上午9:33:33
* @return: Map<String,Object> * @return: Map<String,Object>
@ -460,7 +460,7 @@ public class IndigoServiceImpl implements IndigoService {
params.add(rollNo); params.add(rollNo);
params.add(username); params.add(username);
List<Map<String, Object>> resultList = procedureDao.getProcedureData("checkMaterialBatchReadyWithSoRollForSetup", params); List<Map<String, Object>> resultList = procedureDao.getProcedureData("checkMaterialBatchReadyWithSoRollForSetup", params);
//判断是否存在数据
//Check if data exists
if(resultList.size() == 0 || resultList.isEmpty()) { if(resultList.size() == 0 || resultList.isEmpty()) {
return new HashMap<>(); return new HashMap<>();
} }
@ -470,7 +470,7 @@ public class IndigoServiceImpl implements IndigoService {
/** /**
* *
* @Title: processMaterialBatchRowAndDirectionWithSoRollForSetup * @Title: processMaterialBatchRowAndDirectionWithSoRollForSetup
* @Description: 调用存储过程 记录开始行 或者结束行 方向
* @Description: Call stored procedure: record start row or end row and direction
* @author: LR * @author: LR
* @date 2025年10月28日 上午9:24:21 * @date 2025年10月28日 上午9:24:21
* @return: void * @return: void
@ -505,33 +505,33 @@ public class IndigoServiceImpl implements IndigoService {
RollModel rm = roll.getOrder().toRollModel(); RollModel rm = roll.getOrder().toRollModel();
if(firstBadSerial != null){ if(firstBadSerial != null){
throw new RuntimeException("第一个序列号是不良品序列号");
throw new RuntimeException("The first serial number is a defective serial number");
} }
if(endBadSerial != null){ if(endBadSerial != null){
throw new RuntimeException("第二个序列号是不良品序列号");
throw new RuntimeException("The second serial number is a defective serial number");
} }
if (!SerialUtil.between(rm, firstSerialNo, rollOp.getSetupFirstSerialNo(), rollOp.getSetupEndSerialNo()) || if (!SerialUtil.between(rm, firstSerialNo, rollOp.getSetupFirstSerialNo(), rollOp.getSetupEndSerialNo()) ||
!SerialUtil.between(rm, endSerialNo, rollOp.getSetupFirstSerialNo(), rollOp.getSetupEndSerialNo())) { !SerialUtil.between(rm, endSerialNo, rollOp.getSetupFirstSerialNo(), rollOp.getSetupEndSerialNo())) {
throw new RuntimeException("两个序列号必须在调机扫描范围内");
throw new RuntimeException("Both serial numbers must be within the setup scan range");
} }
if(fm.getOperationNo() == 30){ if(fm.getOperationNo() == 30){
int columnIndex = SerialUtil.getColIndex(rm, firstSerialNo); int columnIndex = SerialUtil.getColIndex(rm, firstSerialNo);
int columnIndex2 = SerialUtil.getColIndex(rm, endSerialNo); int columnIndex2 = SerialUtil.getColIndex(rm, endSerialNo);
//判断是否在当前的卷中
//Check if within the current roll
String columnSortIndex = roll.getColumnSortIndex(); String columnSortIndex = roll.getColumnSortIndex();
String columnSortIndexCon = ","+columnSortIndex+","; String columnSortIndexCon = ","+columnSortIndex+",";
if (columnSortIndexCon.indexOf(","+columnIndex+",") < 0) { if (columnSortIndexCon.indexOf(","+columnIndex+",") < 0) {
throw new RuntimeException("码包不在当前卷的排位范围之内!");
throw new RuntimeException("The barcode is not within the position range of the current roll!");
} }
if (columnSortIndexCon.indexOf(","+columnIndex2+",") < 0) { if (columnSortIndexCon.indexOf(","+columnIndex2+",") < 0) {
throw new RuntimeException("码包不在当前卷的排位范围之内!");
throw new RuntimeException("The barcode is not within the position range of the current roll!");
} }
} }
/* if (Math.abs(SerialUtil.getRowIndex(rm, firstSerialNo) - SerialUtil.getRowIndex(rm, endSerialNo)) < 14){ /* if (Math.abs(SerialUtil.getRowIndex(rm, firstSerialNo) - SerialUtil.getRowIndex(rm, endSerialNo)) < 14){
throw new RuntimeException("FAI范围必须在15排以上");
}*/ //2024-06-24 LR 根据要求注释掉15排位的限制
throw new RuntimeException("FAI range must be above 15 rows");
}*/ //2024-06-24 LR Commented out the 15-row limit as required
String direction = rollOp.getDirection(); String direction = rollOp.getDirection();
String small; String small;
@ -579,16 +579,16 @@ public class IndigoServiceImpl implements IndigoService {
RollModel rm = rollOp.getOrder().toRollModel(); RollModel rm = rollOp.getOrder().toRollModel();
//校验by CH
//Validate by CH
if (rollOper != null) { if (rollOper != null) {
if(!SerialUtil.betweenOut(rollModel, firstSerialNo, rollOper.getSetupEndSerialNo(), rollOper.getEaiFirstSerialNo())|| if(!SerialUtil.betweenOut(rollModel, firstSerialNo, rollOper.getSetupEndSerialNo(), rollOper.getEaiFirstSerialNo())||
!SerialUtil.betweenOut(rollModel, endSerialNo, rollOper.getSetupEndSerialNo(), rollOper.getEaiFirstSerialNo()) !SerialUtil.betweenOut(rollModel, endSerialNo, rollOper.getSetupEndSerialNo(), rollOper.getEaiFirstSerialNo())
){ ){
throw new RuntimeException("序列号必须在扫本次可用序列号以内");
throw new RuntimeException("Serial number must be within the available serial numbers for this scan");
}else if(firstBadSerial != null){ }else if(firstBadSerial != null){
throw new RuntimeException("第一个序列号是不良品序列号");
throw new RuntimeException("The first serial number is a defective serial number");
}else if(endBadSerial != null){ }else if(endBadSerial != null){
throw new RuntimeException("第二个序列号是不良品序列号");
throw new RuntimeException("The second serial number is a defective serial number");
} }
} }
int columnIndex = SerialUtil.getColIndex(rm, firstSerialNo); int columnIndex = SerialUtil.getColIndex(rm, firstSerialNo);
@ -596,14 +596,14 @@ public class IndigoServiceImpl implements IndigoService {
//判断是否在当前的卷中 //判断是否在当前的卷中
String columnSortIndex = roll.getColumnSortIndex(); String columnSortIndex = roll.getColumnSortIndex();
if (columnSortIndex.indexOf(columnIndex+"") < 0) { if (columnSortIndex.indexOf(columnIndex+"") < 0) {
throw new RuntimeException("首序列号必须在扫本次可用序列号以内!");
throw new RuntimeException("The first serial number must be within the available serial numbers for this scan!");
} }
if (columnSortIndex.indexOf(columnIndex2+"") < 0) { if (columnSortIndex.indexOf(columnIndex2+"") < 0) {
throw new RuntimeException("首序列号必须在扫本次可用序列号以内!");
throw new RuntimeException("The first serial number must be within the available serial numbers for this scan!");
} }
if (SerialUtil.between(rm, firstSerialNo, rollOp.getSetupFirstSerialNo(), rollOp.getSetupEndSerialNo()) || if (SerialUtil.between(rm, firstSerialNo, rollOp.getSetupFirstSerialNo(), rollOp.getSetupEndSerialNo()) ||
SerialUtil.between(rm, endSerialNo, rollOp.getSetupFirstSerialNo(), rollOp.getSetupEndSerialNo())) { SerialUtil.between(rm, endSerialNo, rollOp.getSetupFirstSerialNo(), rollOp.getSetupEndSerialNo())) {
throw new RuntimeException("两个序列号必须在调机扫描范围之外");
throw new RuntimeException("Both serial numbers must be outside the setup scan range");
} }
int n1 = SerialUtil.getRowIndex(rm, firstSerialNo); int n1 = SerialUtil.getRowIndex(rm, firstSerialNo);
@ -612,15 +612,15 @@ public class IndigoServiceImpl implements IndigoService {
endRow = n2; endRow = n2;
/*if (Math.abs(SerialUtil.getRowIndex(rm, firstSerialNo) - SerialUtil.getRowIndex(rm, endSerialNo)) < 14){ /*if (Math.abs(SerialUtil.getRowIndex(rm, firstSerialNo) - SerialUtil.getRowIndex(rm, endSerialNo)) < 14){
throw new RuntimeException("EAI范围必须在15排以上");
}*/ //2024-06-24 LR 根据要求注释掉15排位的限制
throw new RuntimeException("EAI range must be above 15 rows");
}*/ //2024-06-24 LR Commented out the 15-row limit as required
String direction = rollOp.getDirection(); String direction = rollOp.getDirection();
//如果工序是Indigo abg现在有独立的方法 不用在这处理 如何调用存储过程 2025-10-27 LR //如果工序是Indigo abg现在有独立的方法 不用在这处理 如何调用存储过程 2025-10-27 LR
if (fm.getOperationNo() == 10) { if (fm.getOperationNo() == 10) {
//1.调用存储过程 产生下一个卷的预数据 因为结束后 不知道哪一些是接料产生的数据 卷号设置成*
//1. Call stored procedure to generate pre-data for the next roll, because after ending, unknown which data is produced by splicing, roll number is set to *
this.processMaterialBatchWithSoRollForNextRoll(orderNo, 10, rollNo); this.processMaterialBatchWithSoRollForNextRoll(orderNo, 10, rollNo);
//2.调用存储过程 完成当前卷材料的记录数据 记录开始行 或结束行 状态只更新没有完成的记录 完成的记录不处理
//2. Call stored procedure to complete material record data for the current roll, record start row or end row, status (only update unfinished records, finished records are not processed)
this.processMaterialBatchWithSoRollForEndRoll(orderNo, 10, rollNo, direction, endRow, authentication.getName()); this.processMaterialBatchWithSoRollForEndRoll(orderNo, 10, rollNo, direction, endRow, authentication.getName());
} }
String small; String small;
@ -689,7 +689,7 @@ public class IndigoServiceImpl implements IndigoService {
int snCount = new Interval(rollOp.getRemainRowFrom(), rollOp.getRemainRowTo()).length() * rollOp.getOrder().getNoOfCross(); int snCount = new Interval(rollOp.getRemainRowFrom(), rollOp.getRemainRowTo()).length() * rollOp.getOrder().getNoOfCross();
int badCount = badSnRepo.countByRollNoAndOperationNo(rollOp.getRollNo(), rollOp.getOperationNo()); int badCount = badSnRepo.countByRollNoAndOperationNo(rollOp.getRollNo(), rollOp.getOperationNo());
//计算小于当前工序且在当前行范围之内的不良
//Count defective items less than the current operation and within the current row range
int lessBadCount = countLessThanBadCount(rollOp); int lessBadCount = countLessThanBadCount(rollOp);
rollOp.setRemainSnCount(snCount - badCount - lessBadCount); rollOp.setRemainSnCount(snCount - badCount - lessBadCount);
Date date = new Date(); Date date = new Date();
@ -707,7 +707,7 @@ public class IndigoServiceImpl implements IndigoService {
/** /**
* *
* @Title: processMaterialBatchWithSoRollForEndRoll * @Title: processMaterialBatchWithSoRollForEndRoll
* @Description: 调用存储过程 完成当前卷材料的记录数据 记录开始行 或结束行 状态只更新没有完成的记录 完成的记录不处理
* @Description: Call stored procedure to complete material record data for the current roll, record start row or end row, status (only update unfinished records, finished records are not processed)
* @author: LR * @author: LR
* @date 2025年10月28日 上午9:55:17 * @date 2025年10月28日 上午9:55:17
* @return: void * @return: void
@ -728,7 +728,7 @@ public class IndigoServiceImpl implements IndigoService {
/** /**
* *
* @Title: processMaterialBatchWithSoRollForNextRoll * @Title: processMaterialBatchWithSoRollForNextRoll
* @Description: 调用存储过程 产生下一个卷的预数据 因为结束后 不知道哪一些是接料产生的数据 卷号设置成*
* @Description: Call stored procedure to generate pre-data for the next roll, because after ending, unknown which data is produced by splicing, roll number is set to *
* @author: LR * @author: LR
* @date 2025年10月28日 上午9:48:46 * @date 2025年10月28日 上午9:48:46
* @return: void * @return: void
@ -746,7 +746,7 @@ public class IndigoServiceImpl implements IndigoService {
/** /**
* *
* @Title: countLessThanBadCount * @Title: countLessThanBadCount
* @Description:统计小于当前工序的不良 范围在当前行之内的
* @Description: Count defective items less than the current operation within the current row range
* @param * @param
* @param rollOp * @param rollOp
* @return * @return
@ -756,18 +756,18 @@ public class IndigoServiceImpl implements IndigoService {
* @throws * @throws
*/ */
public int countLessThanBadCount(SoRollOperation rollOp) { public int countLessThanBadCount(SoRollOperation rollOp) {
//查询不良的数据(小于当前工序的)
//Query defective data (less than current operation)
List<SoRollBadSerial> badSerials = badSnRepo.findByRollNoAndOperationNoLessThan(rollOp.getRollNo(), rollOp.getOperationNo()); List<SoRollBadSerial> badSerials = badSnRepo.findByRollNoAndOperationNoLessThan(rollOp.getRollNo(), rollOp.getOperationNo());
//判断当前sn的行数
//Determine the row number of the current SN
RollModel rm = rollOp.getOrder().toRollModel(); RollModel rm = rollOp.getOrder().toRollModel();
Interval interval = new Interval(rollOp.getRemainRowFrom(), rollOp.getRemainRowTo()); Interval interval = new Interval(rollOp.getRemainRowFrom(), rollOp.getRemainRowTo());
int fromRow = interval.getFrom();//开始行
int fromRow = interval.getFrom();//Start row
int toRow = interval.getTo(); int toRow = interval.getTo();
//循环判断是否在范围之内
int lessBadCount = 0;//统计不良数量
//Loop to check if within range
int lessBadCount = 0;//Count of defective items
for(SoRollBadSerial badSerial : badSerials) { for(SoRollBadSerial badSerial : badSerials) {
int currentRow = SerialUtil.getRowIndex(rm, badSerial.getSerialNo()); int currentRow = SerialUtil.getRowIndex(rm, badSerial.getSerialNo());
//在当前的范围之内
//Within the current range
if(currentRow >= fromRow && currentRow <= toRow) { if(currentRow >= fromRow && currentRow <= toRow) {
lessBadCount++; lessBadCount++;
} }

28
src/main/java/com/ccl/tt/service/impl/PrintLabelServiceImpl.java

@ -86,12 +86,12 @@ public class PrintLabelServiceImpl implements PrintLabelService {
//获取打印的信息 //获取打印的信息
SoFinalRoll fr = frRepo.findByFinalRollNo(finalRollNo); SoFinalRoll fr = frRepo.findByFinalRollNo(finalRollNo);
if (fr == null){ if (fr == null){
throw new RuntimeException("打印错误:" + finalRollNo+"does not exists ");
throw new RuntimeException("Print error: " + finalRollNo+"does not exists ");
} }
//检查码包 //检查码包
List<SoFinalRollDtl> rollList = frRepoDtl.findByFinalRollNo(finalRollNo); List<SoFinalRollDtl> rollList = frRepoDtl.findByFinalRollNo(finalRollNo);
if (rollList.size() == 0){ if (rollList.size() == 0){
throw new RuntimeException("打印错误: 序列号不存在");
throw new RuntimeException("Print error: Serial number does not exist");
} }
String orderNo = fr.getOrderNo(); String orderNo = fr.getOrderNo();
cacheMap.put("serialNo", rollList.get(0).getSerialNo()); cacheMap.put("serialNo", rollList.get(0).getSerialNo());
@ -137,17 +137,17 @@ public class PrintLabelServiceImpl implements PrintLabelService {
cacheMap.put("oempn", oempn); cacheMap.put("oempn", oempn);
String revNo = part.getRevNo(); String revNo = part.getRevNo();
if(revNo == null){ if(revNo == null){
throw new RuntimeException("物料未维护RevNo。");
throw new RuntimeException("Material RevNo not maintained.");
} }
cacheMap.put("revNo", revNo); cacheMap.put("revNo", revNo);
String apn = part.getApn(); String apn = part.getApn();
if(apn == null){ if(apn == null){
throw new RuntimeException("物料未维护Apn。");
throw new RuntimeException("Material Apn not maintained.");
} }
cacheMap.put("apn", apn); cacheMap.put("apn", apn);
labelFlag = part.getLabelType(); labelFlag = part.getLabelType();
if(labelFlag == null){ if(labelFlag == null){
throw new RuntimeException("物料未维护LabelFlag。");
throw new RuntimeException("Material LabelFlag not maintained.");
} }
cacheMap.put("labelFlag", labelFlag); cacheMap.put("labelFlag", labelFlag);
resource = part.getCustomerDrawing(); resource = part.getCustomerDrawing();
@ -176,10 +176,10 @@ public class PrintLabelServiceImpl implements PrintLabelService {
//良品和不良品 //良品和不良品
String type = ""; String type = "";
if (fr.getFinalRollNo().indexOf("-S") > 0){ if (fr.getFinalRollNo().indexOf("-S") > 0){
type = "不良品卷";
type = "Defective Roll";
} }
if (fr.getFinalRollNo().indexOf("-Q") > 0){ if (fr.getFinalRollNo().indexOf("-Q") > 0){
type = "QC品卷";
type = "QC Roll";
} }
cacheMap.put("type", type); cacheMap.put("type", type);
//处理qrCreator //处理qrCreator
@ -347,7 +347,7 @@ public class PrintLabelServiceImpl implements PrintLabelService {
} }
cacheMap.put("serialNo", rollList.get(0).getSerialNo()); cacheMap.put("serialNo", rollList.get(0).getSerialNo());
if (fr == null){ if (fr == null){
throw new RuntimeException("打印错误: " + finalRollNo+"does not exists ");
throw new RuntimeException("Print error: " + finalRollNo+"does not exists ");
} }
String standardRollQty = ""; String standardRollQty = "";
SoInfo order = null; SoInfo order = null;
@ -390,17 +390,17 @@ public class PrintLabelServiceImpl implements PrintLabelService {
cacheMap.put("oempn", oempn); cacheMap.put("oempn", oempn);
String revNo = part.getRevNo(); String revNo = part.getRevNo();
if(revNo == null){ if(revNo == null){
throw new RuntimeException("物料未维护RevNo。");
throw new RuntimeException("Material RevNo not maintained.");
} }
cacheMap.put("revNo", revNo); cacheMap.put("revNo", revNo);
String apn = part.getApn(); String apn = part.getApn();
if(apn == null){ if(apn == null){
throw new RuntimeException("物料未维护Apn。");
throw new RuntimeException("Material Apn not maintained.");
} }
cacheMap.put("apn", apn); cacheMap.put("apn", apn);
labelFlag = part.getLabelType(); labelFlag = part.getLabelType();
if(labelFlag == null){ if(labelFlag == null){
throw new RuntimeException("物料未维护LabelFlag。");
throw new RuntimeException("Material LabelFlag not maintained.");
} }
cacheMap.put("labelFlag", labelFlag); cacheMap.put("labelFlag", labelFlag);
resource = part.getCustomerDrawing(); resource = part.getCustomerDrawing();
@ -538,7 +538,7 @@ public class PrintLabelServiceImpl implements PrintLabelService {
} }
if("C".equals(labelFlag)){ if("C".equals(labelFlag)){
if(customerPartNoAll.split(",")[0].length()<2){ if(customerPartNoAll.split(",")[0].length()<2){
throw new RuntimeException("CustomerPartNoAll字段格式不对");
throw new RuntimeException("CustomerPartNoAll field format is incorrect");
} }
DateFormat yy = new SimpleDateFormat("yy"); DateFormat yy = new SimpleDateFormat("yy");
String year = yy.format(new Date()); String year = yy.format(new Date());
@ -557,7 +557,7 @@ public class PrintLabelServiceImpl implements PrintLabelService {
List<Map<String, Object>> getSerialNo = procedureDao.getProcedureData("getSerialNo", params); List<Map<String, Object>> getSerialNo = procedureDao.getProcedureData("getSerialNo", params);
int seqNoNum = Integer.parseInt(getSerialNo.get(0).get("serial_no").toString(),10); int seqNoNum = Integer.parseInt(getSerialNo.get(0).get("serial_no").toString(),10);
if ("".equals(part.getCustomerPartNo()) || part.getCustomerPartNo().length() < 5){ if ("".equals(part.getCustomerPartNo()) || part.getCustomerPartNo().length() < 5){
throw new RuntimeException("客户料号维护有误");
throw new RuntimeException("Customer part number maintenance error");
} }
pkcId = pkcId +"8"+ String.format("%05d", seqNoNum); pkcId = pkcId +"8"+ String.format("%05d", seqNoNum);
newQrCode.append(oempn) newQrCode.append(oempn)
@ -597,7 +597,7 @@ public class PrintLabelServiceImpl implements PrintLabelService {
cacheMap.put("boxNo", boxNo); cacheMap.put("boxNo", boxNo);
SoReceiveBoxs box = receiveBoxRepo.findByBoxNo(boxNo); SoReceiveBoxs box = receiveBoxRepo.findByBoxNo(boxNo);
if (box == null){ if (box == null){
throw new RuntimeException("打印错误: " + boxNo+"does not exists ");
throw new RuntimeException("Print error: " + boxNo+"does not exists ");
} }
String receiveNo = box.getReceiveNo(); String receiveNo = box.getReceiveNo();
String boxType = box.getBoxType(); String boxType = box.getBoxType();

60
src/main/java/com/ccl/tt/service/impl/RollServiceImpl.java

@ -88,24 +88,24 @@ public class RollServiceImpl implements RollService{
String finalRollNo = inData.getFinalRollNo(); String finalRollNo = inData.getFinalRollNo();
//判断是否是良品卷 //判断是否是良品卷
if(finalRollNo.indexOf("-R") < 0) { if(finalRollNo.indexOf("-R") < 0) {
throw new RuntimeException("良品卷才可以参与冻结!");
throw new RuntimeException("Only good rolls can be frozen!");
} }
//添加创建时间 保存数据 //添加创建时间 保存数据
SoFinalRoll soFinalRoll = soFinalRollRepository.findByFinalRollNo(finalRollNo); SoFinalRoll soFinalRoll = soFinalRollRepository.findByFinalRollNo(finalRollNo);
//判断是否存在 //判断是否存在
if(null == soFinalRoll) { if(null == soFinalRoll) {
throw new RuntimeException("查无此卷记录!");
throw new RuntimeException("Roll record not found!");
} }
//判断状态是否正确 //判断状态是否正确
String finalStatus = soFinalRoll.getStatus(); String finalStatus = soFinalRoll.getStatus();
if(!"Inspected - Passed".equals(finalStatus)) { if(!"Inspected - Passed".equals(finalStatus)) {
throw new RuntimeException("只有状态为:已检 - 合格的卷才可以冻结!");
throw new RuntimeException("Only rolls with status: Inspected - Passed can be frozen!");
} }
//判断是否已经出库 //判断是否已经出库
ShipmentBoxRoll shipmentBoxRoll = shipmentBoxRollRepository.findByFinalRollNo(finalRollNo); ShipmentBoxRoll shipmentBoxRoll = shipmentBoxRollRepository.findByFinalRollNo(finalRollNo);
//判断是否存在 //判断是否存在
if(shipmentBoxRoll != null) { if(shipmentBoxRoll != null) {
throw new RuntimeException("RollNo"+finalRollNo+" shipped!");
throw new RuntimeException("RollNo: "+finalRollNo+" shipped!");
} }
//查询是否存在冻结卷记录 //查询是否存在冻结卷记录
@ -115,7 +115,7 @@ public class RollServiceImpl implements RollService{
String unFrozenFlag = freezeRoll.getUnfrozenFlag(); String unFrozenFlag = freezeRoll.getUnfrozenFlag();
//判断是否已经解冻 //判断是否已经解冻
if("N".equalsIgnoreCase(unFrozenFlag)) { if("N".equalsIgnoreCase(unFrozenFlag)) {
throw new RuntimeException("同一个卷号只能存在一个冻结记录!");
throw new RuntimeException("Only one freeze record can exist for the same roll number!");
} }
} }
//修改出货卷的状态 //修改出货卷的状态
@ -135,18 +135,18 @@ public class RollServiceImpl implements RollService{
SoFinalRoll soFinalRoll = soFinalRollRepository.findByFinalRollNo(finalRollNo); SoFinalRoll soFinalRoll = soFinalRollRepository.findByFinalRollNo(finalRollNo);
//判断是否存在 //判断是否存在
if(null == soFinalRoll) { if(null == soFinalRoll) {
throw new RuntimeException("查无此卷记录!");
throw new RuntimeException("Roll record not found!");
} }
//查询是否存在冻结卷记录 //查询是否存在冻结卷记录
FreezeRollOutData freezeRoll = rollDao.getFreezeRollByFinalRollNo(finalRollNo); FreezeRollOutData freezeRoll = rollDao.getFreezeRollByFinalRollNo(finalRollNo);
//如果存在 不能是冻结的状态 //如果存在 不能是冻结的状态
if(freezeRoll == null) { if(freezeRoll == null) {
throw new RuntimeException("查无此卷冻结记录!");
throw new RuntimeException("No freeze record found for this roll!");
}else { }else {
String unFrozenFlag = freezeRoll.getUnfrozenFlag(); String unFrozenFlag = freezeRoll.getUnfrozenFlag();
//判断是否已经解冻 //判断是否已经解冻
if("Y".equalsIgnoreCase(unFrozenFlag)) { if("Y".equalsIgnoreCase(unFrozenFlag)) {
throw new RuntimeException("已经解冻,无需重复解冻!");
throw new RuntimeException("Already unfrozen, no need to unfreeze again!");
} }
} }
//修改出货卷的状态 //修改出货卷的状态
@ -198,11 +198,11 @@ public class RollServiceImpl implements RollService{
if(!SerialUtil.betweenOut(rollModel, firstSerialNo, rollOper.getSetupEndSerialNo(), rollOper.getEaiFirstSerialNo())|| if(!SerialUtil.betweenOut(rollModel, firstSerialNo, rollOper.getSetupEndSerialNo(), rollOper.getEaiFirstSerialNo())||
!SerialUtil.betweenOut(rollModel, endSerialNo, rollOper.getSetupEndSerialNo(), rollOper.getEaiFirstSerialNo()) !SerialUtil.betweenOut(rollModel, endSerialNo, rollOper.getSetupEndSerialNo(), rollOper.getEaiFirstSerialNo())
){ ){
throw new RuntimeException("序列号必须在扫本次可用序列号以内");
throw new RuntimeException("Serial number must be within the available serial numbers for this scan");
}else if(firstBadSerial != null){ }else if(firstBadSerial != null){
throw new RuntimeException("第一个序列号是不良品序列号");
throw new RuntimeException("The first serial number is a defective serial number");
}else if(endBadSerial != null){ }else if(endBadSerial != null){
throw new RuntimeException("第二个序列号是不良品序列号");
throw new RuntimeException("The second serial number is a defective serial number");
} }
} }
int columnIndex = SerialUtil.getColIndex(rm, firstSerialNo); int columnIndex = SerialUtil.getColIndex(rm, firstSerialNo);
@ -210,14 +210,14 @@ public class RollServiceImpl implements RollService{
//判断是否在当前的卷中 //判断是否在当前的卷中
String columnSortIndex = roll.getColumnSortIndex(); String columnSortIndex = roll.getColumnSortIndex();
if (columnSortIndex.indexOf(columnIndex+"") < 0) { if (columnSortIndex.indexOf(columnIndex+"") < 0) {
throw new RuntimeException("首序列号必须在扫本次可用序列号以内!");
throw new RuntimeException("The first serial number must be within the available serial numbers for this scan!");
} }
if (columnSortIndex.indexOf(columnIndex2+"") < 0) { if (columnSortIndex.indexOf(columnIndex2+"") < 0) {
throw new RuntimeException("首序列号必须在扫本次可用序列号以内!");
throw new RuntimeException("The first serial number must be within the available serial numbers for this scan!");
} }
if (SerialUtil.between(rm, firstSerialNo, rollOp.getSetupFirstSerialNo(), rollOp.getSetupEndSerialNo()) || if (SerialUtil.between(rm, firstSerialNo, rollOp.getSetupFirstSerialNo(), rollOp.getSetupEndSerialNo()) ||
SerialUtil.between(rm, endSerialNo, rollOp.getSetupFirstSerialNo(), rollOp.getSetupEndSerialNo())) { SerialUtil.between(rm, endSerialNo, rollOp.getSetupFirstSerialNo(), rollOp.getSetupEndSerialNo())) {
throw new RuntimeException("两个序列号必须在调机扫描范围之外");
throw new RuntimeException("Both serial numbers must be outside the setup scan range");
} }
int n1 = SerialUtil.getRowIndex(rm, firstSerialNo); int n1 = SerialUtil.getRowIndex(rm, firstSerialNo);
@ -226,7 +226,7 @@ public class RollServiceImpl implements RollService{
endRow = n2; endRow = n2;
/*if (Math.abs(SerialUtil.getRowIndex(rm, firstSerialNo) - SerialUtil.getRowIndex(rm, endSerialNo)) < 14){ /*if (Math.abs(SerialUtil.getRowIndex(rm, firstSerialNo) - SerialUtil.getRowIndex(rm, endSerialNo)) < 14){
throw new RuntimeException("EAI范围必须在15排以上");
throw new RuntimeException("EAI range must be at least 15 rows");
}*/ //2024-06-24 LR 根据要求注释掉15排位的限制 }*/ //2024-06-24 LR 根据要求注释掉15排位的限制
String direction = rollOp.getDirection(); String direction = rollOp.getDirection();
@ -522,7 +522,7 @@ public class RollServiceImpl implements RollService{
private void calcRemainSn(SoRollOperation rollOp, String sn1, String sn2) throws IllegalAccessException { private void calcRemainSn(SoRollOperation rollOp, String sn1, String sn2) throws IllegalAccessException {
if (sn1 == null || sn2 == null) { if (sn1 == null || sn2 == null) {
throw new RuntimeException("EAI状态错误");
throw new RuntimeException("EAI status error");
} }
RollModel rm = rollOp.getOrder().toRollModel(); RollModel rm = rollOp.getOrder().toRollModel();
@ -566,7 +566,7 @@ public class RollServiceImpl implements RollService{
operationNo=funcModel.operationNo; operationNo=funcModel.operationNo;
} else { } else {
// 没有找到对应的对象 // 没有找到对应的对象
throw new RuntimeException("工序不存在!");
throw new RuntimeException("Operation does not exist!");
} }
//获取工单信息 //获取工单信息
SoRoll roll =validateRoll(rollNo); SoRoll roll =validateRoll(rollNo);
@ -627,7 +627,7 @@ public class RollServiceImpl implements RollService{
Map<String, Object> routingMap = getCurrentRoutingMap(orderNo, -1, func); Map<String, Object> routingMap = getCurrentRoutingMap(orderNo, -1, func);
//如果是空集合 说明无需进入当前的工序 //如果是空集合 说明无需进入当前的工序
if(routingMap.isEmpty()) { if(routingMap.isEmpty()) {
throw new RuntimeException("当前物料对应的工单无法进入分切!");
throw new RuntimeException("The current material's corresponding order cannot enter cutting!");
} }
String itemNoStr = String.valueOf(routingMap.get("itemNo")); String itemNoStr = String.valueOf(routingMap.get("itemNo"));
int itemNo = Integer.parseInt(itemNoStr); int itemNo = Integer.parseInt(itemNoStr);
@ -640,7 +640,7 @@ public class RollServiceImpl implements RollService{
//判断当前卷能否在当前工序生产 //判断当前卷能否在当前工序生产
int createItemNo = roll.getCreateItemNo(); int createItemNo = roll.getCreateItemNo();
if(createItemNo >= itemNo) { if(createItemNo >= itemNo) {
throw new RuntimeException("后道工序创建的分卷不可以在前道使用!");
throw new RuntimeException("Sub-process rolls cannot be used in previous processes!");
} }
//获取前道工序 //获取前道工序
String preItemNoStr = String.valueOf(routingMap.get("preItemNo")); String preItemNoStr = String.valueOf(routingMap.get("preItemNo"));
@ -649,7 +649,7 @@ public class RollServiceImpl implements RollService{
SoRollOperation preRollOPer = rollOperRepo.findByRollNoAndOperationNo(rollNo, preItemNo); SoRollOperation preRollOPer = rollOperRepo.findByRollNoAndOperationNo(rollNo, preItemNo);
if(preItemNo < 18) { if(preItemNo < 18) {
if (preRollOPer == null) { if (preRollOPer == null) {
throw new RuntimeException(func+"的前道工序未结束!");
throw new RuntimeException("The previous process of "+func+" has not ended!");
} }
} }
SoInfo soInfo = roll.getOrder(); SoInfo soInfo = roll.getOrder();
@ -662,7 +662,7 @@ public class RollServiceImpl implements RollService{
if("cut".equals(func)) { if("cut".equals(func)) {
//查询料号的信息 //查询料号的信息
if(!"Y".equalsIgnoreCase(cutFlag)) { if(!"Y".equalsIgnoreCase(cutFlag)) {
throw new RuntimeException("只有特殊的排位的工单才能进入分切!");
throw new RuntimeException("Only rolls with special column positions can enter cutting!");
} }
} }
//查询卷的工序信息 //查询卷的工序信息
@ -739,7 +739,7 @@ public class RollServiceImpl implements RollService{
TblSystemConfigData systemConfig = systemConfigService.getSystemConfigDataByType("material", "material_tracking"); TblSystemConfigData systemConfig = systemConfigService.getSystemConfigDataByType("material", "material_tracking");
//null 处理 //null 处理
if (systemConfig == null) { if (systemConfig == null) {
throw new RuntimeException("请联系管理员维护是否进行材料跟踪!");
throw new RuntimeException("Please contact the administrator to configure material tracking!");
} }
String systemParam = systemConfig.getBaseData(); String systemParam = systemConfig.getBaseData();
if ("N".equalsIgnoreCase(systemParam)) { if ("N".equalsIgnoreCase(systemParam)) {
@ -814,7 +814,7 @@ public class RollServiceImpl implements RollService{
if (itemNo > 10 && itemNo <= 20){ //get privious count if (itemNo > 10 && itemNo <= 20){ //get privious count
SoRollOperation prevRollOp = rollOperRepo.findTopByRollNoAndOperationNoLessThanOrderByOperationNoDesc(rollNo, itemNo); SoRollOperation prevRollOp = rollOperRepo.findTopByRollNoAndOperationNoLessThanOrderByOperationNoDesc(rollNo, itemNo);
if (!"EAI".equalsIgnoreCase(prevRollOp.getStatus()) ) { if (!"EAI".equalsIgnoreCase(prevRollOp.getStatus()) ) {
throw new RuntimeException("前道工序没有结束 ,请检查后再试!");
throw new RuntimeException("Previous process has not ended, please check and try again!");
} }
resultMap.put("prevCount", prevRollOp.getRemainSnCount()); resultMap.put("prevCount", prevRollOp.getRemainSnCount());
SoRollOperation ollOpNow = rollOperRepo.findByRollNoAndOperationNo(rollNo, itemNo); SoRollOperation ollOpNow = rollOperRepo.findByRollNoAndOperationNo(rollNo, itemNo);
@ -1080,7 +1080,7 @@ public class RollServiceImpl implements RollService{
int itemNo = rollOp.getOperationNo(); int itemNo = rollOp.getOperationNo();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (rollOp.getFirstSerialNo() != null){ if (rollOp.getFirstSerialNo() != null){
sb.append("<h4>开工序列号排</h4>");
sb.append("<h4>Start Serial Number Row</h4>");
sb.append(printRoll(roll, rm, rollOp.getFirstSerialNo(),rollOp.getFirstSerialNo(),template, roll.getColumnSortIndex())); sb.append(printRoll(roll, rm, rollOp.getFirstSerialNo(),rollOp.getFirstSerialNo(),template, roll.getColumnSortIndex()));
} }
@ -1093,15 +1093,15 @@ public class RollServiceImpl implements RollService{
sb.append(printEaiLabelWithCut(roll, cross, "eai")); sb.append(printEaiLabelWithCut(roll, cross, "eai"));
}else { }else {
if (rollOp.getSetupFirstSerialNo() != null && rollOp.getSetupEndSerialNo() != null){ if (rollOp.getSetupFirstSerialNo() != null && rollOp.getSetupEndSerialNo() != null){
sb.append("<h4>调机序列号段</h4>");
sb.append("<h4>Setup Serial Number Range</h4>");
sb.append(printRoll(roll, rm, rollOp.getSetupFirstSerialNo(),rollOp.getSetupEndSerialNo(),template, roll.getColumnSortIndex())); sb.append(printRoll(roll, rm, rollOp.getSetupFirstSerialNo(),rollOp.getSetupEndSerialNo(),template, roll.getColumnSortIndex()));
} }
if (rollOp.getFaiFirstSerialNo() != null && rollOp.getFaiEndSerialNo() != null){ if (rollOp.getFaiFirstSerialNo() != null && rollOp.getFaiEndSerialNo() != null){
sb.append("<h4>FAI序列号段</h4>");
sb.append("<h4>FAI Serial Number Range</h4>");
sb.append(printRoll(roll, rm, rollOp.getFaiFirstSerialNo(),rollOp.getFaiEndSerialNo(),template, roll.getColumnSortIndex())); sb.append(printRoll(roll, rm, rollOp.getFaiFirstSerialNo(),rollOp.getFaiEndSerialNo(),template, roll.getColumnSortIndex()));
} }
if (rollOp.getEaiFirstSerialNo() != null && rollOp.getEaiEndSerialNo() != null){ if (rollOp.getEaiFirstSerialNo() != null && rollOp.getEaiEndSerialNo() != null){
sb.append("<h4>EAI序列号段</h4>");
sb.append("<h4>EAI Serial Number Range</h4>");
sb.append(printRoll(roll, rm, rollOp.getEaiFirstSerialNo(),rollOp.getEaiEndSerialNo(),template, roll.getColumnSortIndex())); sb.append(printRoll(roll, rm, rollOp.getEaiFirstSerialNo(),rollOp.getEaiEndSerialNo(),template, roll.getColumnSortIndex()));
}; };
} }
@ -1131,11 +1131,11 @@ public class RollServiceImpl implements RollService{
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
//区分不同类型 设置不同的参数 //区分不同类型 设置不同的参数
if("setup".equalsIgnoreCase(typeFlag)) { if("setup".equalsIgnoreCase(typeFlag)) {
sb.append("<h4>调机序列号段</h4>");
sb.append("<h4>Setup Serial Number Range</h4>");
}else if("fai".equalsIgnoreCase(typeFlag)) { }else if("fai".equalsIgnoreCase(typeFlag)) {
sb.append("<h4>FAI序列号段</h4>");
sb.append("<h4>FAI Serial Number Range</h4>");
}else if("eai".equalsIgnoreCase(typeFlag)) { }else if("eai".equalsIgnoreCase(typeFlag)) {
sb.append("<h4>EAI序列号段</h4>");
sb.append("<h4>EAI Serial Number Range</h4>");
} }
sb.append("<table class='roll-op-serials'>"); sb.append("<table class='roll-op-serials'>");

132
src/main/java/com/ccl/tt/service/impl/ScanningServiceImpl.java

@ -105,7 +105,7 @@ public class ScanningServiceImpl implements ScanningService {
ScanJob job = jobRepo.findByJobId(jobId); ScanJob job = jobRepo.findByJobId(jobId);
if (job == null){ if (job == null){
throw new RuntimeException("Job不存在");
throw new RuntimeException("Job does not exist");
} }
List<Map<String, Object>> checkpoolSerials = null; List<Map<String, Object>> checkpoolSerials = null;
for(int i = 1; i<4 ;i++){ for(int i = 1; i<4 ;i++){
@ -130,10 +130,10 @@ public class ScanningServiceImpl implements ScanningService {
} }
} }
if (pass2 == 0) { if (pass2 == 0) {
throw new RuntimeException("下卷首序列号不在池中!");
throw new RuntimeException("The first serial number of the next roll is not in the pool!");
} }
if(pass!=pass2){ if(pass!=pass2){
throw new RuntimeException("2个序列号不在同一个通道!");
throw new RuntimeException("The two serial numbers are not in the same channel!");
} }
List<Map<String, Object>> map1= scanStationService.returnHSSerialNoId(job,String.valueOf(pass),endSerialNo); List<Map<String, Object>> map1= scanStationService.returnHSSerialNoId(job,String.valueOf(pass),endSerialNo);
List<Map<String, Object>> map2= scanStationService.returnHSSerialNoId(job,String.valueOf(pass2),nextSerialNo); List<Map<String, Object>> map2= scanStationService.returnHSSerialNoId(job,String.valueOf(pass2),nextSerialNo);
@ -141,7 +141,7 @@ public class ScanningServiceImpl implements ScanningService {
int id1=Integer.parseInt(map1.get(0).get("id").toString()); int id1=Integer.parseInt(map1.get(0).get("id").toString());
int id2=Integer.parseInt(map2.get(0).get("id").toString()); int id2=Integer.parseInt(map2.get(0).get("id").toString());
if(id1>=id2){ if(id1>=id2){
throw new RuntimeException("不允许创卷!原因:下卷开始序列号在本卷中。");
throw new RuntimeException("Roll creation not allowed! Reason: The next roll's starting serial number is within the current roll.");
} }
@ -154,10 +154,10 @@ public class ScanningServiceImpl implements ScanningService {
List<Map<String, Object>> poolSerials = scanStationService.retrieveHsSerialsFromPool(job,Integer.toString(pass)); List<Map<String, Object>> poolSerials = scanStationService.retrieveHsSerialsFromPool(job,Integer.toString(pass));
String firstSn = kvService.getValueOrDefault(authentication.getName() + "_firstSn-"+pass, ""); String firstSn = kvService.getValueOrDefault(authentication.getName() + "_firstSn-"+pass, "");
if (StringUtils.isEmpty(firstSn)) { if (StringUtils.isEmpty(firstSn)) {
throw new RuntimeException("请先扫描第一个序列号!");
throw new RuntimeException("Please scan the first serial number first!");
} }
if (poolSerials == null || poolSerials.size() == 0) { if (poolSerials == null || poolSerials.size() == 0) {
throw new RuntimeException("池中无序列号!");
throw new RuntimeException("No serial numbers in the pool!");
} }
for (int i=0;i<poolSerials.size();i++){ for (int i=0;i<poolSerials.size();i++){
String serialNo = (String) poolSerials.get(i).get("serialNo"); String serialNo = (String) poolSerials.get(i).get("serialNo");
@ -172,10 +172,10 @@ public class ScanningServiceImpl implements ScanningService {
} }
} }
if (index == -1) { if (index == -1) {
throw new RuntimeException("序列号不在池中!");
throw new RuntimeException("The serial number is not in the pool!");
} }
if (firstIndex == -1 || index < firstIndex) { if (firstIndex == -1 || index < firstIndex) {
throw new RuntimeException("结束序列号位置需大于第一个序列号");
throw new RuntimeException("The end serial number position must be greater than the first serial number");
} }
int qty = index - firstIndex + 1; int qty = index - firstIndex + 1;
nowQty=qty; nowQty=qty;
@ -184,7 +184,7 @@ public class ScanningServiceImpl implements ScanningService {
throw new RuntimeException("*****"); throw new RuntimeException("*****");
} }
if(qty > maxRollQty){//数量改成配置文件设置参数 2023-02-28 LR if(qty > maxRollQty){//数量改成配置文件设置参数 2023-02-28 LR
throw new RuntimeException("实际数量("+qty+")大于创卷最大数量("+maxRollQty+"),禁止创建!");
throw new RuntimeException("Actual quantity ("+qty+") exceeds the maximum roll creation quantity ("+maxRollQty+"), creation prohibited!");
} }
String partMask = null; String partMask = null;
logger.info("CFR-checkOrder"); logger.info("CFR-checkOrder");
@ -194,17 +194,17 @@ public class ScanningServiceImpl implements ScanningService {
String serialNo = (String) poolSerials.get(i).get("serialNo"); String serialNo = (String) poolSerials.get(i).get("serialNo");
SoInfo order = getOrderBySerialNo(serialNo); SoInfo order = getOrderBySerialNo(serialNo);
if (order == null){ if (order == null){
throw new RuntimeException("无法根据序列号模板定位订单: " + serialNo);
throw new RuntimeException("Unable to locate order by serial number template: " + serialNo);
} }
if ( i == firstIndex ) { if ( i == firstIndex ) {
partMask = SerialUtil.getPartMaskSerial(serialNo); partMask = SerialUtil.getPartMaskSerial(serialNo);
orderNo = order.getOrderNo(); orderNo = order.getOrderNo();
} else { } else {
if (orderNo != null && !orderNo.equals(order.getOrderNo())){ if (orderNo != null && !orderNo.equals(order.getOrderNo())){
throw new RuntimeException("卷中存在不同订单的序列号,无法保存");
throw new RuntimeException("Roll contains serial numbers from different orders, unable to save");
} }
if (partMask != null && !partMask.equals(SerialUtil.getPartMaskSerial(serialNo))){ if (partMask != null && !partMask.equals(SerialUtil.getPartMaskSerial(serialNo))){
throw new RuntimeException("卷中存在不同part的序列号,无法保存");
throw new RuntimeException("Roll contains serial numbers from different parts, unable to save");
} }
} }
} }
@ -220,7 +220,7 @@ public class ScanningServiceImpl implements ScanningService {
String serialNo = (String) poolSerials.get(i).get("serialNo"); String serialNo = (String) poolSerials.get(i).get("serialNo");
SoInfo order = getOrderBySerialNo(serialNo); SoInfo order = getOrderBySerialNo(serialNo);
if (order == null){ if (order == null){
throw new RuntimeException("无法定位订单: " + serialNo);
throw new RuntimeException("Unable to locate order: " + serialNo);
} }
if (i == firstIndex) { if (i == firstIndex) {
finalRollNo = order.getOrderNo() + "-R" + sequenceService.getSequence(order.getOrderNo(), 4); finalRollNo = order.getOrderNo() + "-R" + sequenceService.getSequence(order.getOrderNo(), 4);
@ -228,7 +228,7 @@ public class ScanningServiceImpl implements ScanningService {
if(qty < standardRollQty){//数量改成配置文件设置参数 2023-02-28 LR if(qty < standardRollQty){//数量改成配置文件设置参数 2023-02-28 LR
finalRoll.setStatus("Inspected - Frozen"); finalRoll.setStatus("Inspected - Frozen");
}else if(qty > maxRollQty){//数量改成配置文件设置参数 2023-02-28 LR }else if(qty > maxRollQty){//数量改成配置文件设置参数 2023-02-28 LR
throw new RuntimeException("实际数量("+qty+")大于创卷最大数量("+maxRollQty+"),禁止创建!");
throw new RuntimeException("Actual quantity ("+qty+") exceeds the maximum roll creation quantity ("+maxRollQty+"), creation prohibited!");
}else{ }else{
finalRoll.setStatus("Inspected - Passed"); finalRoll.setStatus("Inspected - Passed");
} }
@ -259,13 +259,13 @@ public class ScanningServiceImpl implements ScanningService {
if (i == index) { if (i == index) {
Integer id = (Integer) poolSerials.get(i).get("id"); Integer id = (Integer) poolSerials.get(i).get("id");
if (id == null || id <= 0) { if (id == null || id <= 0) {
throw new RuntimeException("id没有找到");
throw new RuntimeException("id not found");
} }
List<Map<String, Object>> countList = scanStationService.countDataIdex(jobRepo.findByJobId(jobId), fromId, id,Integer.toString(pass)); List<Map<String, Object>> countList = scanStationService.countDataIdex(jobRepo.findByJobId(jobId), fromId, id,Integer.toString(pass));
int noReadQty = Integer.parseInt(String.valueOf(countList.get(0).get("countNumb"))); int noReadQty = Integer.parseInt(String.valueOf(countList.get(0).get("countNumb")));
int countNumb = (id - fromId + 1)-noReadQty; int countNumb = (id - fromId + 1)-noReadQty;
if(qty!=countNumb){ if(qty!=countNumb){
throw new RuntimeException("序列号有丢失,无法保存");
throw new RuntimeException("Serial numbers have been lost, unable to save");
} }
lastId=id; lastId=id;
} }
@ -296,7 +296,7 @@ public class ScanningServiceImpl implements ScanningService {
ScanJob job = jobRepo.findByJobId(jobId); ScanJob job = jobRepo.findByJobId(jobId);
if (job == null){ if (job == null){
throw new RuntimeException("Job不存在");
throw new RuntimeException("Job does not exist");
} }
List<Map<String, Object>> checkpoolSerials = null; List<Map<String, Object>> checkpoolSerials = null;
for(int i = 1; i<4 ;i++){ for(int i = 1; i<4 ;i++){
@ -321,10 +321,10 @@ public class ScanningServiceImpl implements ScanningService {
} }
} }
if (pass2 == 0) { if (pass2 == 0) {
throw new RuntimeException("下卷首序列号不在池中!");
throw new RuntimeException("The first serial number of the next roll is not in the pool!");
} }
if(pass!=pass2){ if(pass!=pass2){
throw new RuntimeException("2个序列号不在同一个通道!");
throw new RuntimeException("The two serial numbers are not in the same channel!");
} }
List<Map<String, Object>> map1= scanStationService.returnHSSerialNoId(job,String.valueOf(pass),endSerialNo); List<Map<String, Object>> map1= scanStationService.returnHSSerialNoId(job,String.valueOf(pass),endSerialNo);
List<Map<String, Object>> map2= scanStationService.returnHSSerialNoId(job,String.valueOf(pass2),nextSerialNo); List<Map<String, Object>> map2= scanStationService.returnHSSerialNoId(job,String.valueOf(pass2),nextSerialNo);
@ -332,7 +332,7 @@ public class ScanningServiceImpl implements ScanningService {
int id1=Integer.parseInt(map1.get(0).get("id").toString()); int id1=Integer.parseInt(map1.get(0).get("id").toString());
int id2=Integer.parseInt(map2.get(0).get("id").toString()); int id2=Integer.parseInt(map2.get(0).get("id").toString());
if(id1>=id2){ if(id1>=id2){
throw new RuntimeException("不允许创卷!原因:下卷开始序列号在本卷中。");
throw new RuntimeException("Roll creation not allowed! Reason: The next roll's starting serial number is within the current roll.");
} }
@ -344,10 +344,10 @@ public class ScanningServiceImpl implements ScanningService {
List<Map<String, Object>> poolSerials = scanStationService.retrieveHsSerialsFromPool(job,Integer.toString(pass)); List<Map<String, Object>> poolSerials = scanStationService.retrieveHsSerialsFromPool(job,Integer.toString(pass));
String firstSn = kvService.getValueOrDefault(authentication.getName() + "_firstSn-"+pass, ""); String firstSn = kvService.getValueOrDefault(authentication.getName() + "_firstSn-"+pass, "");
if (StringUtils.isEmpty(firstSn)) { if (StringUtils.isEmpty(firstSn)) {
throw new RuntimeException("请先扫描第一个序列号!");
throw new RuntimeException("Please scan the first serial number first!");
} }
if (poolSerials == null || poolSerials.size() == 0) { if (poolSerials == null || poolSerials.size() == 0) {
throw new RuntimeException("池中无序列号!");
throw new RuntimeException("No serial numbers in the pool!");
} }
for (int i=0;i<poolSerials.size();i++){ for (int i=0;i<poolSerials.size();i++){
String serialNo = (String) poolSerials.get(i).get("serialNo"); String serialNo = (String) poolSerials.get(i).get("serialNo");
@ -362,10 +362,10 @@ public class ScanningServiceImpl implements ScanningService {
} }
} }
if (index == -1) { if (index == -1) {
throw new RuntimeException("序列号不在池中!");
throw new RuntimeException("The serial number is not in the pool!");
} }
if (firstIndex == -1 || index < firstIndex) { if (firstIndex == -1 || index < firstIndex) {
throw new RuntimeException("结束序列号位置需大于第一个序列号");
throw new RuntimeException("The end serial number position must be greater than the first serial number");
} }
int qty = index - firstIndex + 1; int qty = index - firstIndex + 1;
String partMask = null; String partMask = null;
@ -380,10 +380,10 @@ public class ScanningServiceImpl implements ScanningService {
orderNo = order.getOrderNo(); orderNo = order.getOrderNo();
} else { } else {
if (orderNo != null && !orderNo.equals(order.getOrderNo())){ if (orderNo != null && !orderNo.equals(order.getOrderNo())){
throw new RuntimeException("卷中存在不同订单的序列号,无法保存");
throw new RuntimeException("Roll contains serial numbers from different orders, unable to save");
} }
if (partMask != null && !partMask.equals(SerialUtil.getPartMaskSerial(serialNo))){ if (partMask != null && !partMask.equals(SerialUtil.getPartMaskSerial(serialNo))){
throw new RuntimeException("卷中存在不同part的序列号,无法保存");
throw new RuntimeException("Roll contains serial numbers from different parts, unable to save");
} }
} }
} }
@ -399,7 +399,7 @@ public class ScanningServiceImpl implements ScanningService {
String serialNo = (String) poolSerials.get(i).get("serialNo"); String serialNo = (String) poolSerials.get(i).get("serialNo");
SoInfo order = getOrderBySerialNo(serialNo); SoInfo order = getOrderBySerialNo(serialNo);
if (order == null){ if (order == null){
throw new RuntimeException("无法定位订单: " + serialNo);
throw new RuntimeException("Unable to locate order: " + serialNo);
} }
if (i == firstIndex) { if (i == firstIndex) {
finalRollNo = order.getOrderNo() + "-R" + sequenceService.getSequence(order.getOrderNo(), 4); finalRollNo = order.getOrderNo() + "-R" + sequenceService.getSequence(order.getOrderNo(), 4);
@ -407,7 +407,7 @@ public class ScanningServiceImpl implements ScanningService {
if(qty < standardRollQty){//数量改成配置文件设置参数 2023-02-28 LR if(qty < standardRollQty){//数量改成配置文件设置参数 2023-02-28 LR
finalRoll.setStatus("Inspected - Frozen"); finalRoll.setStatus("Inspected - Frozen");
}else if(qty > maxRollQty){//数量改成配置文件设置参数 2023-02-28 LR }else if(qty > maxRollQty){//数量改成配置文件设置参数 2023-02-28 LR
throw new RuntimeException("实际数量("+qty+")大于创卷最大数量("+maxRollQty+"),禁止创建!");
throw new RuntimeException("Actual quantity ("+qty+") exceeds the maximum roll creation quantity ("+maxRollQty+"), creation prohibited!");
}else{ }else{
finalRoll.setStatus("Inspected - Passed"); finalRoll.setStatus("Inspected - Passed");
} }
@ -438,13 +438,13 @@ public class ScanningServiceImpl implements ScanningService {
if (i == index) { if (i == index) {
Integer id = (Integer) poolSerials.get(i).get("id"); Integer id = (Integer) poolSerials.get(i).get("id");
if (id == null || id <= 0) { if (id == null || id <= 0) {
throw new RuntimeException("id没有找到");
throw new RuntimeException("id not found");
} }
List<Map<String, Object>> countList = scanStationService.countDataIdex(jobRepo.findByJobId(jobId), fromId, id,Integer.toString(pass)); List<Map<String, Object>> countList = scanStationService.countDataIdex(jobRepo.findByJobId(jobId), fromId, id,Integer.toString(pass));
int noReadQty = Integer.parseInt(String.valueOf(countList.get(0).get("countNumb"))); int noReadQty = Integer.parseInt(String.valueOf(countList.get(0).get("countNumb")));
int countNumb = (id - fromId + 1)-noReadQty; int countNumb = (id - fromId + 1)-noReadQty;
if(qty!=countNumb){ if(qty!=countNumb){
throw new RuntimeException("序列号有丢失,无法保存");
throw new RuntimeException("Serial numbers have been lost, unable to save");
} }
lastId=id; lastId=id;
// scanStationService.cutHsSerialsById(jobRepo.findByJobId(jobId), fromId, id,Integer.toString(pass)); // scanStationService.cutHsSerialsById(jobRepo.findByJobId(jobId), fromId, id,Integer.toString(pass));
@ -490,7 +490,7 @@ public class ScanningServiceImpl implements ScanningService {
int nowQty=0; int nowQty=0;
ScanJob job = jobRepo.findByJobId(jobId); ScanJob job = jobRepo.findByJobId(jobId);
if (job == null){ if (job == null){
throw new RuntimeException("Job不存在");
throw new RuntimeException("Job does not exist");
} }
SoInfo soInfo = getOrderBySerialNo(endSerialNo); SoInfo soInfo = getOrderBySerialNo(endSerialNo);
String orderNo = soInfo.getOrderNo(); String orderNo = soInfo.getOrderNo();
@ -507,14 +507,14 @@ public class ScanningServiceImpl implements ScanningService {
int id1=Integer.parseInt(map1.get(0).get("id").toString()); int id1=Integer.parseInt(map1.get(0).get("id").toString());
int id2=Integer.parseInt(map2.get(0).get("id").toString()); int id2=Integer.parseInt(map2.get(0).get("id").toString());
if(id1>=id2){ if(id1>=id2){
throw new RuntimeException("不允许创卷!原因:下卷开始序列号在本卷中。");
throw new RuntimeException("Roll creation not allowed! Reason: The next roll's starting serial number is within the current roll.");
} }
} }
//2023-05-08 阮琦添加 检验下个首个序列号是否存在 end //2023-05-08 阮琦添加 检验下个首个序列号是否存在 end
String firstSn = kvService.getValueOrDefault(authentication.getName() + "_firstSn", ""); String firstSn = kvService.getValueOrDefault(authentication.getName() + "_firstSn", "");
if (StringUtils.isEmpty(firstSn)) { if (StringUtils.isEmpty(firstSn)) {
throw new RuntimeException("请先扫描第一个序列号!");
throw new RuntimeException("Please scan the first serial number first!");
} }
// String rollNo = kvService.getValueOrDefault(authentication.getName() + "_slittingRollNo", ""); // String rollNo = kvService.getValueOrDefault(authentication.getName() + "_slittingRollNo", "");
// if (StringUtils.isEmpty(rollNo)) { // if (StringUtils.isEmpty(rollNo)) {
@ -526,7 +526,7 @@ public class ScanningServiceImpl implements ScanningService {
List<Map<String, Object>> poolSerials = scanStationService.retrieveSerialsFromPool(job); List<Map<String, Object>> poolSerials = scanStationService.retrieveSerialsFromPool(job);
if (poolSerials == null || poolSerials.size() == 0) { if (poolSerials == null || poolSerials.size() == 0) {
throw new RuntimeException("池中无序列号!");
throw new RuntimeException("No serial numbers in the pool!");
} }
for (int i=0;i<poolSerials.size();i++){ for (int i=0;i<poolSerials.size();i++){
@ -548,14 +548,14 @@ public class ScanningServiceImpl implements ScanningService {
throw new RuntimeException("*****"); throw new RuntimeException("*****");
} }
if (index == -1) { if (index == -1) {
throw new RuntimeException("序列号不在池中!");
throw new RuntimeException("The serial number is not in the pool!");
} }
if (firstIndex == -1 || index < firstIndex) { if (firstIndex == -1 || index < firstIndex) {
throw new RuntimeException("结束序列号位置需大于第一个序列号");
throw new RuntimeException("The end serial number position must be greater than the first serial number");
} }
if(qty > maxRollQty){//数量改成配置文件设置参数 2023-02-28 LR if(qty > maxRollQty){//数量改成配置文件设置参数 2023-02-28 LR
throw new RuntimeException("实际数量("+qty+")大于创卷最大数量("+maxRollQty+"),禁止创建!");
throw new RuntimeException("Actual quantity ("+qty+") exceeds the maximum roll creation quantity ("+maxRollQty+"), creation prohibited!");
} }
String partMask = null; String partMask = null;
for (int i=firstIndex;i<=index;i++) { for (int i=firstIndex;i<=index;i++) {
@ -567,11 +567,11 @@ public class ScanningServiceImpl implements ScanningService {
} else { } else {
if (orderNo != null && !orderNo.equals(order.getOrderNo())){ if (orderNo != null && !orderNo.equals(order.getOrderNo())){
throw new RuntimeException("卷中存在不同订单的序列号,无法保存");
throw new RuntimeException("Roll contains serial numbers from different orders, unable to save");
} }
if (partMask != null && !partMask.equals(SerialUtil.getPartMaskSerial(serialNo))){ if (partMask != null && !partMask.equals(SerialUtil.getPartMaskSerial(serialNo))){
throw new RuntimeException("卷中存在不同part的序列号,无法保存");
throw new RuntimeException("Roll contains serial numbers from different parts, unable to save");
} }
} }
@ -588,7 +588,7 @@ public class ScanningServiceImpl implements ScanningService {
String serialNo = (String) poolSerials.get(i).get("serialNo"); String serialNo = (String) poolSerials.get(i).get("serialNo");
SoInfo order = getOrderBySerialNo(serialNo); SoInfo order = getOrderBySerialNo(serialNo);
if (order == null){ if (order == null){
throw new RuntimeException("无法定位订单: " + serialNo);
throw new RuntimeException("Unable to locate order: " + serialNo);
} }
if (i == firstIndex) { if (i == firstIndex) {
@ -597,7 +597,7 @@ public class ScanningServiceImpl implements ScanningService {
if(qty < standardRollQty){//数量改成配置文件设置参数 2023-02-28 LR if(qty < standardRollQty){//数量改成配置文件设置参数 2023-02-28 LR
finalRoll.setStatus("Inspected - Frozen"); finalRoll.setStatus("Inspected - Frozen");
}else if(qty > maxRollQty){//数量改成配置文件设置参数 2023-02-28 LR }else if(qty > maxRollQty){//数量改成配置文件设置参数 2023-02-28 LR
throw new RuntimeException("实际数量("+qty+")大于创卷最大数量("+maxRollQty+"),禁止创建!");
throw new RuntimeException("Actual quantity ("+qty+") exceeds the maximum roll creation quantity ("+maxRollQty+"), creation prohibited!");
}else{ }else{
finalRoll.setStatus("Inspected - Passed"); finalRoll.setStatus("Inspected - Passed");
} }
@ -629,13 +629,13 @@ public class ScanningServiceImpl implements ScanningService {
// frDtlRepo.save(dtl); // frDtlRepo.save(dtl);
dtlList.add(dtl); dtlList.add(dtl);
}catch (Exception e){ }catch (Exception e){
throw new RuntimeException("错误:" + e.getMessage());
throw new RuntimeException("Error:" + e.getMessage());
} }
if (i == index) { if (i == index) {
Integer id = (Integer) poolSerials.get(i).get("id"); Integer id = (Integer) poolSerials.get(i).get("id");
if (id == null || id <= 0) { if (id == null || id <= 0) {
throw new RuntimeException("id没有找到");
throw new RuntimeException("id not found");
} }
// int rows = scanStationService.cutById(job, fromId, id); // int rows = scanStationService.cutById(job, fromId, id);
// //todo: check if delete rows equals insert rows // //todo: check if delete rows equals insert rows
@ -660,7 +660,7 @@ public class ScanningServiceImpl implements ScanningService {
Map ret = new HashMap(); Map ret = new HashMap();
ScanJob job = jobRepo.findByJobId(jobId); ScanJob job = jobRepo.findByJobId(jobId);
if (job == null){ if (job == null){
throw new RuntimeException("Job不存在");
throw new RuntimeException("Job does not exist");
} }
//2023-05-08 阮琦添加 检验下个首个序列号是否存在 //2023-05-08 阮琦添加 检验下个首个序列号是否存在
if(nextSerialNo!=null && !"".equals(nextSerialNo)){ if(nextSerialNo!=null && !"".equals(nextSerialNo)){
@ -670,7 +670,7 @@ public class ScanningServiceImpl implements ScanningService {
int id1=Integer.parseInt(map1.get(0).get("id").toString()); int id1=Integer.parseInt(map1.get(0).get("id").toString());
int id2=Integer.parseInt(map2.get(0).get("id").toString()); int id2=Integer.parseInt(map2.get(0).get("id").toString());
if(id1>=id2){ if(id1>=id2){
throw new RuntimeException("不允许创卷!原因:下卷开始序列号在本卷中。");
throw new RuntimeException("Roll creation not allowed! Reason: The next roll's starting serial number is within the current roll.");
} }
} }
@ -685,7 +685,7 @@ public class ScanningServiceImpl implements ScanningService {
//2023-05-08 阮琦添加 检验下个首个序列号是否存在 end //2023-05-08 阮琦添加 检验下个首个序列号是否存在 end
String firstSn = kvService.getValueOrDefault(authentication.getName() + "_firstSn", ""); String firstSn = kvService.getValueOrDefault(authentication.getName() + "_firstSn", "");
if (StringUtils.isEmpty(firstSn)) { if (StringUtils.isEmpty(firstSn)) {
throw new RuntimeException("请先扫描第一个序列号!");
throw new RuntimeException("Please scan the first serial number first!");
} }
// String rollNo = kvService.getValueOrDefault(authentication.getName() + "_slittingRollNo", ""); // String rollNo = kvService.getValueOrDefault(authentication.getName() + "_slittingRollNo", "");
// if (StringUtils.isEmpty(rollNo)) { // if (StringUtils.isEmpty(rollNo)) {
@ -697,7 +697,7 @@ public class ScanningServiceImpl implements ScanningService {
List<Map<String, Object>> poolSerials = scanStationService.retrieveSerialsFromPool(job); List<Map<String, Object>> poolSerials = scanStationService.retrieveSerialsFromPool(job);
if (poolSerials == null || poolSerials.size() == 0) { if (poolSerials == null || poolSerials.size() == 0) {
throw new RuntimeException("池中无序列号!");
throw new RuntimeException("No serial numbers in the pool!");
} }
for (int i=0;i<poolSerials.size();i++){ for (int i=0;i<poolSerials.size();i++){
@ -716,11 +716,11 @@ public class ScanningServiceImpl implements ScanningService {
if (index == -1) { if (index == -1) {
throw new RuntimeException("序列号不在池中!");
throw new RuntimeException("The serial number is not in the pool!");
} }
if (firstIndex == -1 || index < firstIndex) { if (firstIndex == -1 || index < firstIndex) {
throw new RuntimeException("结束序列号位置需大于第一个序列号");
throw new RuntimeException("The end serial number position must be greater than the first serial number");
} }
String partMask = null; String partMask = null;
@ -733,11 +733,11 @@ public class ScanningServiceImpl implements ScanningService {
} else { } else {
if (orderNo != null && !orderNo.equals(order.getOrderNo())){ if (orderNo != null && !orderNo.equals(order.getOrderNo())){
throw new RuntimeException("卷中存在不同订单的序列号,无法保存");
throw new RuntimeException("Roll contains serial numbers from different orders, unable to save");
} }
if (partMask != null && !partMask.equals(SerialUtil.getPartMaskSerial(serialNo))){ if (partMask != null && !partMask.equals(SerialUtil.getPartMaskSerial(serialNo))){
throw new RuntimeException("卷中存在不同part的序列号,无法保存");
throw new RuntimeException("Roll contains serial numbers from different parts, unable to save");
} }
} }
@ -754,7 +754,7 @@ public class ScanningServiceImpl implements ScanningService {
String serialNo = (String) poolSerials.get(i).get("serialNo"); String serialNo = (String) poolSerials.get(i).get("serialNo");
SoInfo order = getOrderBySerialNo(serialNo); SoInfo order = getOrderBySerialNo(serialNo);
if (order == null){ if (order == null){
throw new RuntimeException("无法定位订单: " + serialNo);
throw new RuntimeException("Unable to locate order: " + serialNo);
} }
if (i == firstIndex) { if (i == firstIndex) {
finalRollNo = order.getOrderNo() + "-R" + sequenceService.getSequence(order.getOrderNo(), 4); finalRollNo = order.getOrderNo() + "-R" + sequenceService.getSequence(order.getOrderNo(), 4);
@ -762,7 +762,7 @@ public class ScanningServiceImpl implements ScanningService {
if(qty < standardRollQty){//数量改成配置文件设置参数 2023-02-28 LR if(qty < standardRollQty){//数量改成配置文件设置参数 2023-02-28 LR
finalRoll.setStatus("Inspected - Frozen"); finalRoll.setStatus("Inspected - Frozen");
}else if(qty > maxRollQty){//数量改成配置文件设置参数 2023-02-28 LR }else if(qty > maxRollQty){//数量改成配置文件设置参数 2023-02-28 LR
throw new RuntimeException("实际数量("+qty+")大于创卷最大数量("+maxRollQty+"),禁止创建!");
throw new RuntimeException("Actual quantity ("+qty+") exceeds the maximum roll creation quantity ("+maxRollQty+"), creation prohibited!");
}else{ }else{
finalRoll.setStatus("Inspected - Passed"); finalRoll.setStatus("Inspected - Passed");
} }
@ -793,13 +793,13 @@ public class ScanningServiceImpl implements ScanningService {
dtlList.add(dtl); dtlList.add(dtl);
// frDtlRepo.save(dtl); // frDtlRepo.save(dtl);
}catch (Exception e){ }catch (Exception e){
throw new RuntimeException("错误:" + e.getMessage());
throw new RuntimeException("Error:" + e.getMessage());
} }
if (i == index) { if (i == index) {
Integer id = (Integer) poolSerials.get(i).get("id"); Integer id = (Integer) poolSerials.get(i).get("id");
if (id == null || id <= 0) { if (id == null || id <= 0) {
throw new RuntimeException("id没有找到");
throw new RuntimeException("id not found");
} }
// int rows = scanStationService.cutById(job, fromId, id); // int rows = scanStationService.cutById(job, fromId, id);
//todo: check if delete rows equals insert rows //todo: check if delete rows equals insert rows
@ -819,12 +819,12 @@ public class ScanningServiceImpl implements ScanningService {
//校验工单 //校验工单
SoInfo order = soInfoRepo.findByOrderNo(orderNo); SoInfo order = soInfoRepo.findByOrderNo(orderNo);
if (order == null) { if (order == null) {
throw new RuntimeException("订单不存在!");
throw new RuntimeException("Order does not exist!");
} }
//校验是否已经创建过了 //校验是否已经创建过了
List<SoFinalRoll> existing = finalRollRepo.findByOrderNoAndJobId(orderNo, "ROLLOP_40_S"); List<SoFinalRoll> existing = finalRollRepo.findByOrderNoAndJobId(orderNo, "ROLLOP_40_S");
if (existing.size() > 0) { if (existing.size() > 0) {
throw new RuntimeException("重复创建");
throw new RuntimeException("Duplicate creation");
} }
//查询工单 40工序所有的不良 //查询工单 40工序所有的不良
List<SoRollBadSerial> badSerials = badRepo.findByOrderNoAndOperationNo(orderNo, 40); List<SoRollBadSerial> badSerials = badRepo.findByOrderNoAndOperationNo(orderNo, 40);
@ -900,15 +900,15 @@ public class ScanningServiceImpl implements ScanningService {
public int countBatchBads(String jobId, String orderNo, String firstSerialNo, String endSerialNo) { public int countBatchBads(String jobId, String orderNo, String firstSerialNo, String endSerialNo) {
ScanJob job = jobRepo.findByJobId(jobId); ScanJob job = jobRepo.findByJobId(jobId);
if (job == null){ if (job == null){
throw new RuntimeException("Job不存在");
throw new RuntimeException("Job does not exist");
} }
//检查工单号 //检查工单号
if (null == orderNo || "".equals(orderNo)) { if (null == orderNo || "".equals(orderNo)) {
throw new RuntimeException("工单不能为空!");
throw new RuntimeException("Shop order cannot be empty!");
} }
SoInfo soInfo = soInfoRepo.findByOrderNo(orderNo); SoInfo soInfo = soInfoRepo.findByOrderNo(orderNo);
if (soInfo == null) { if (soInfo == null) {
throw new RuntimeException("工单号无效!");
throw new RuntimeException("Shop order number is invalid!");
} }
String partNo = soInfo.getPartNo(); String partNo = soInfo.getPartNo();
PartData part = basicDao.getPartDataByPartNo(partNo); PartData part = basicDao.getPartDataByPartNo(partNo);
@ -940,7 +940,7 @@ public class ScanningServiceImpl implements ScanningService {
Map<String, Object> poolSerial2 = scanStationService.getSerialFromPoolBySn(jdbcTemplate, endSerialNo); Map<String, Object> poolSerial2 = scanStationService.getSerialFromPoolBySn(jdbcTemplate, endSerialNo);
//先循环查询排位 //先循环查询排位
if(poolSerial2 == null) { if(poolSerial2 == null) {
throw new RuntimeException("结束码包不在当前码池中!");
throw new RuntimeException("The end code package is not in the current code pool!");
} }
int endId = Integer.parseInt(String.valueOf(poolSerial2.get("id"))); int endId = Integer.parseInt(String.valueOf(poolSerial2.get("id")));
//获取开始和结束的ID //获取开始和结束的ID
@ -984,16 +984,16 @@ public class ScanningServiceImpl implements ScanningService {
public List<SoRollBadSerial> createBatchBads(String jobId, String orderNo, String firstSerialNo, String endSerialNo, String username) { public List<SoRollBadSerial> createBatchBads(String jobId, String orderNo, String firstSerialNo, String endSerialNo, String username) {
ScanJob job = jobRepo.findByJobId(jobId); ScanJob job = jobRepo.findByJobId(jobId);
if (job == null){ if (job == null){
throw new RuntimeException("Job不存在");
throw new RuntimeException("Job does not exist");
} }
//检查工单号 //检查工单号
if (null == orderNo || "".equals(orderNo)) { if (null == orderNo || "".equals(orderNo)) {
throw new RuntimeException("工单不能为空!");
throw new RuntimeException("Shop order cannot be empty!");
} }
SoInfo soInfo = soInfoRepo.findByOrderNo(orderNo); SoInfo soInfo = soInfoRepo.findByOrderNo(orderNo);
if (soInfo == null) { if (soInfo == null) {
throw new RuntimeException("工单号无效!");
throw new RuntimeException("Shop order number is invalid!");
} }
//查询当前物料的数据 获取编码的类型 //查询当前物料的数据 获取编码的类型
String partNo = soInfo.getPartNo(); String partNo = soInfo.getPartNo();
@ -1025,7 +1025,7 @@ public class ScanningServiceImpl implements ScanningService {
Map<String, Object> poolSerial2 = scanStationService.getSerialFromPoolBySn(jdbcTemplate, endSerialNo); Map<String, Object> poolSerial2 = scanStationService.getSerialFromPoolBySn(jdbcTemplate, endSerialNo);
//先循环查询排位 //先循环查询排位
if(poolSerial2 == null) { if(poolSerial2 == null) {
throw new RuntimeException("结束码包不在当前码池中!");
throw new RuntimeException("The end code package is not in the current code pool!");
} }
int endId = Integer.parseInt(String.valueOf(poolSerial2.get("id"))); int endId = Integer.parseInt(String.valueOf(poolSerial2.get("id")));
//获取开始和结束的ID //获取开始和结束的ID
@ -1124,7 +1124,7 @@ public class ScanningServiceImpl implements ScanningService {
//String username = inData.getUsername(); //String username = inData.getUsername();
SoReceiveBoxsData resultRow = scanningDao.getOrderLastedActiveBox(receiveNo); SoReceiveBoxsData resultRow = scanningDao.getOrderLastedActiveBox(receiveNo);
if (resultRow == null) { if (resultRow == null) {
throw new RuntimeException("等待新增新的箱号");
throw new RuntimeException("Waiting for new box number to be added");
} }
return resultRow; return resultRow;
} }

Loading…
Cancel
Save