|
|
@@ -1135,6 +1135,11 @@ public class MesProductRecordController extends BaseController {
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+ // OK/NG样件:无需录入正式产品,直接放行
|
|
|
+ if(mesProductSampleService.checkSampleSn(CommonUitl.formatOprno(oldOprno), lineSn, sn)){
|
|
|
+ return bs+"UD";
|
|
|
+ }
|
|
|
+
|
|
|
// ========== 新增:当前产线生产类型限制 ==========
|
|
|
// 单部件工位扫精追码,不做整件产品类型限制
|
|
|
if (!mesLineProcess1.getType().equals("3") && !mesProductCateService.isCurrentProductAllowed(lineSn, sn)) {
|
|
|
@@ -1294,12 +1299,7 @@ public class MesProductRecordController extends BaseController {
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
- // 0.检查工件是否是样件,是样件可直接做
|
|
|
- if(mesProductSampleService.checkSampleSn(oprno,lineSn,sn)){
|
|
|
- return bs+"UD"; // 检查工件是否是样件
|
|
|
- }
|
|
|
-
|
|
|
- // 1.检查开班样件点检
|
|
|
+ // 1.检查开班样件点检(正式件才校验;样件已在上方提前放行)
|
|
|
if(!mesProductSampleService.checkRecord(oprno,lineSn,sn)){
|
|
|
return bs+"SJ"; // 未进行开班点检
|
|
|
}
|
|
|
@@ -1563,7 +1563,7 @@ public class MesProductRecordController extends BaseController {
|
|
|
|
|
|
//320添加子工位
|
|
|
|
|
|
- // 判断是否是OK/NG样件
|
|
|
+ // 判断是否是OK/NG样件:样件只记点检结果,不走正式件过站
|
|
|
MesProductSample mesProductSample = new MesProductSample();
|
|
|
mesProductSample.setSn(sn);
|
|
|
mesProductSample.setOprno(CommonUitl.formatOprno(oprno));
|
|
|
@@ -1585,6 +1585,7 @@ public class MesProductRecordController extends BaseController {
|
|
|
}
|
|
|
mesProductSampleRecord.setResult(testResult);
|
|
|
mesProductSampleRecordService.save(mesProductSampleRecord);
|
|
|
+ return "RSOK";
|
|
|
}
|
|
|
|
|
|
if(isFlag){
|
|
|
@@ -2611,37 +2612,40 @@ public class MesProductRecordController extends BaseController {
|
|
|
String ret = checkQualityCommon(oldOprno,sn,lineSn,userCode);
|
|
|
String checkret = ret.substring(3,5);
|
|
|
if(checkret.equals("UD")){
|
|
|
+ boolean isSample = mesProductSampleService.checkSampleSn(oprno, lineSn, sn);
|
|
|
+ // 样件跳过最大NG次数、15分钟间隔限制
|
|
|
+ if(!isSample){
|
|
|
+ String qmMaxErr = validateQmMaxTimes(oldOprno, lineSn, sn, oprno);
|
|
|
+ if(qmMaxErr != null){
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage(qmMaxErr);
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
|
|
|
- String qmMaxErr = validateQmMaxTimes(oldOprno, lineSn, sn, oprno);
|
|
|
- if(qmMaxErr != null){
|
|
|
- resp.setResult(Global.FALSE);
|
|
|
- resp.setMessage(qmMaxErr);
|
|
|
- return resp;
|
|
|
- }
|
|
|
-
|
|
|
- String check = Global.getConfig("mes.qm.ng.time");
|
|
|
- if(check.equals("1")){
|
|
|
- // 检查是否超过15分钟
|
|
|
- MesProductQm mpr2 = new MesProductQm();
|
|
|
- mpr2.setComponentNum(sn);
|
|
|
- mpr2.getSqlMap().getWhere().and("a.oprno",QueryType.RIGHT_LIKE,oprno);
|
|
|
- mpr2.getSqlMap().getOrder().setOrderBy("a.test_time desc");
|
|
|
- MesProductQm mprinfo = mesProductQmService.findInfo(mpr2);
|
|
|
- if(!ObjectUtils.isEmpty(mprinfo)){
|
|
|
- // 计算两个日期之间相差的分钟数
|
|
|
- Date curDate = new Date();
|
|
|
- Date date2 = mprinfo.getTestTime();
|
|
|
- long minutesBetween = Math.abs(ChronoUnit.MINUTES.between(curDate.toInstant(), date2.toInstant()));
|
|
|
- logger.info("minutesBetween:"+ minutesBetween);
|
|
|
- if(minutesBetween < 15){ // 未超过15分钟
|
|
|
- resp.setResult(Global.FALSE);
|
|
|
- resp.setMessage("两次气密必须间隔15分钟");
|
|
|
- return resp;
|
|
|
+ String check = Global.getConfig("mes.qm.ng.time");
|
|
|
+ if(check.equals("1")){
|
|
|
+ // 检查是否超过15分钟
|
|
|
+ MesProductQm mpr2 = new MesProductQm();
|
|
|
+ mpr2.setComponentNum(sn);
|
|
|
+ mpr2.getSqlMap().getWhere().and("a.oprno",QueryType.RIGHT_LIKE,oprno);
|
|
|
+ mpr2.getSqlMap().getOrder().setOrderBy("a.test_time desc");
|
|
|
+ MesProductQm mprinfo = mesProductQmService.findInfo(mpr2);
|
|
|
+ if(!ObjectUtils.isEmpty(mprinfo)){
|
|
|
+ // 计算两个日期之间相差的分钟数
|
|
|
+ Date curDate = new Date();
|
|
|
+ Date date2 = mprinfo.getTestTime();
|
|
|
+ long minutesBetween = Math.abs(ChronoUnit.MINUTES.between(curDate.toInstant(), date2.toInstant()));
|
|
|
+ logger.info("minutesBetween:"+ minutesBetween);
|
|
|
+ if(minutesBetween < 15){ // 未超过15分钟
|
|
|
+ resp.setResult(Global.FALSE);
|
|
|
+ resp.setMessage("两次气密必须间隔15分钟");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- resp.setMessage("工件可以加工");
|
|
|
+ resp.setMessage(isSample ? "样件可以检测" : "工件可以加工");
|
|
|
resp.setResult(Global.TRUE);
|
|
|
}else{
|
|
|
String lx = ret.substring(0,3);
|
|
|
@@ -2712,9 +2716,12 @@ public class MesProductRecordController extends BaseController {
|
|
|
|
|
|
try{
|
|
|
String formatOprno = CommonUitl.formatOprno(oprno);
|
|
|
- String qmMaxErr = validateQmMaxTimes(oprno, lineSn, sn, formatOprno);
|
|
|
- if(qmMaxErr != null){
|
|
|
- return renderResult(Global.FALSE, text(qmMaxErr));
|
|
|
+ boolean isSample = mesProductSampleService.checkSampleSn(oprno, lineSn, sn);
|
|
|
+ if(!isSample){
|
|
|
+ String qmMaxErr = validateQmMaxTimes(oprno, lineSn, sn, formatOprno);
|
|
|
+ if(qmMaxErr != null){
|
|
|
+ return renderResult(Global.FALSE, text(qmMaxErr));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
MesProductQm mesProductQm = new MesProductQm();
|
|
|
@@ -2734,30 +2741,43 @@ public class MesProductRecordController extends BaseController {
|
|
|
mesProductQm.setRemark(remark);
|
|
|
mesProductQmService.add(mesProductQm);
|
|
|
|
|
|
- // 检查是否是样件
|
|
|
- if(mesProductSampleService.checkSampleSn(oprno,lineSn,sn)){ // 是样件
|
|
|
+ // 样件:只记点检结果,不走正式件过站
|
|
|
+ if(isSample){
|
|
|
MesProductSample mesProductSample = new MesProductSample();
|
|
|
mesProductSample.setSn(sn);
|
|
|
- mesProductSample.setOprno(CommonUitl.formatOprno(oprno));
|
|
|
+ mesProductSample.setOprno(formatOprno);
|
|
|
+ mesProductSample.setLineSn(lineSn);
|
|
|
+ mesProductSample.setStatus("0");
|
|
|
MesProductSample mesProductSample1 = mesProductSampleService.findInfo(mesProductSample);
|
|
|
if(!ObjectUtils.isEmpty(mesProductSample1)){
|
|
|
- double maxVal = StringUtils.isEmpty(mesProductSample1.getUpLimit())?Double.valueOf("0"):Double.valueOf(mesProductSample1.getUpLimit());
|
|
|
- double minVal = StringUtils.isEmpty(mesProductSample1.getLowLimit())?Double.valueOf("0"):Double.valueOf(mesProductSample1.getLowLimit());
|
|
|
- double val = StringUtils.isEmpty(leakVal)?Double.valueOf("0"):Double.valueOf(leakVal);
|
|
|
- if(val > maxVal || val < minVal){
|
|
|
- if(mesProductSample1.getType().equals("1")){ // OK件
|
|
|
- result = "NG";
|
|
|
- }else{
|
|
|
- result = "OK";
|
|
|
+ String deviceResult = result;
|
|
|
+ // 仅配置了上下限时才按泄漏值校正设备结果
|
|
|
+ if(!StringUtils.isEmpty(mesProductSample1.getUpLimit()) || !StringUtils.isEmpty(mesProductSample1.getLowLimit())){
|
|
|
+ double maxVal = StringUtils.isEmpty(mesProductSample1.getUpLimit()) ? Double.MAX_VALUE : Double.valueOf(mesProductSample1.getUpLimit());
|
|
|
+ double minVal = StringUtils.isEmpty(mesProductSample1.getLowLimit()) ? -Double.MAX_VALUE : Double.valueOf(mesProductSample1.getLowLimit());
|
|
|
+ double val = StringUtils.isEmpty(leakVal) ? 0D : Double.valueOf(leakVal);
|
|
|
+ if(val > maxVal || val < minVal){
|
|
|
+ if("1".equals(mesProductSample1.getType())){ // OK件超限视为设备判坏
|
|
|
+ deviceResult = "NG";
|
|
|
+ }else{ // NG件超限视为设备判好(与配置区间不符)
|
|
|
+ deviceResult = "OK";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ // 点检结果:OK件需设备OK,NG件需设备NG
|
|
|
+ String testResult = "OK";
|
|
|
+ if("1".equals(mesProductSample1.getType()) && !"OK".equalsIgnoreCase(deviceResult)){
|
|
|
+ testResult = "NG";
|
|
|
+ }else if("2".equals(mesProductSample1.getType()) && !"NG".equalsIgnoreCase(deviceResult)){
|
|
|
+ testResult = "NG";
|
|
|
+ }
|
|
|
|
|
|
MesProductSampleRecord mesProductSampleRecord = new MesProductSampleRecord();
|
|
|
mesProductSampleRecord.setSn(sn);
|
|
|
mesProductSampleRecord.setOprno(oprno);
|
|
|
mesProductSampleRecord.setLineSn(lineSn);
|
|
|
mesProductSampleRecord.setType(mesProductSample1.getType());
|
|
|
- mesProductSampleRecord.setResult(result);
|
|
|
+ mesProductSampleRecord.setResult(testResult);
|
|
|
mesProductSampleRecord.setTestVal(leakVal);
|
|
|
mesProductSampleRecord.setUpLimit(mesProductSample1.getUpLimit());
|
|
|
mesProductSampleRecord.setLowLimit(mesProductSample1.getLowLimit());
|
|
|
@@ -2766,9 +2786,9 @@ public class MesProductRecordController extends BaseController {
|
|
|
mesProductSampleRecord.setStatus("0");
|
|
|
mesProductSampleRecordService.save(mesProductSampleRecord);
|
|
|
}
|
|
|
+ return renderResult(Global.TRUE, text("样件点检成功!"));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
List<ParamsResp> params = new ArrayList<>();
|
|
|
|
|
|
String content = "NG";
|
|
|
@@ -2833,21 +2853,10 @@ public class MesProductRecordController extends BaseController {
|
|
|
@ResponseBody
|
|
|
public Page<MesProductRecord> workData(MesProductRecordUser mesProductRecordUser,MesProductRecord mesProductRecord, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
|
- Date edate = new Date();
|
|
|
-
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.add(Calendar.HOUR, -48); // 减去48小时
|
|
|
- Date sdate = calendar.getTime();
|
|
|
-
|
|
|
- mesProductRecord.setUpdateDate_gte(sdate);
|
|
|
- mesProductRecord.setUpdateDate_lte(edate);
|
|
|
-
|
|
|
if(mesProductRecord.getOprno().length() == 5){
|
|
|
mesProductRecord.setOprno(mesProductRecord.getOprno()+"A");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
Page page1 = new Page<>(request, response);
|
|
|
mesProductRecord.setPage(page1);
|
|
|
mesProductRecord.setCraft("100000");
|