|
|
@@ -1568,7 +1568,50 @@ public class MesProductRecordController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ //查询首件检记录是否为OK或是确认状态
|
|
|
+ if ("1".equals(Global.getConfig("mes.check.one"))) {
|
|
|
+ MesShiftDataResp mesShiftDataResp = mesShiftService.getCurShift();
|
|
|
+ try {
|
|
|
+ DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
+ Date stdate = null;
|
|
|
+ stdate = dateFormat.parse(mesShiftDataResp.getStart());
|
|
|
+ Date etdate = dateFormat.parse(mesShiftDataResp.getEnd());
|
|
|
+ String checkOprno = oprno;
|
|
|
+ if (checkOprno.length() == 5) {
|
|
|
+ checkOprno += "A";
|
|
|
+ }
|
|
|
+ String formattedOprno = CommonUitl.formatOprno(checkOprno);
|
|
|
+ List<String> oprnos = new ArrayList<>();
|
|
|
+ oprnos.add(checkOprno);
|
|
|
+ if (!StringUtils.equals(checkOprno, formattedOprno)) {
|
|
|
+ oprnos.add(formattedOprno);
|
|
|
+ }
|
|
|
+ //查询当前班次的是否有加工记录
|
|
|
+ MesProductRecord mesProductRecord5 = new MesProductRecord();
|
|
|
+ mesProductRecord5.setLineSn(lineSn);
|
|
|
+ mesProductRecord5.setCraft("100000");
|
|
|
+ mesProductRecord5.setUpdateDate_gte(stdate);
|
|
|
+ mesProductRecord5.setUpdateDate_lte(etdate);
|
|
|
+ mesProductRecord5.getSqlMap().getWhere().and("a.content", QueryType.NE,"UDF");
|
|
|
+ mesProductRecord5.getSqlMap().getWhere().and("a.oprno", QueryType.IN, oprnos);
|
|
|
+ mesProductRecord5.getSqlMap().getOrder().setOrderBy("a.update_date DESC, a.id DESC");
|
|
|
+ List<MesProductRecord> productRecords = mesProductRecordService.findList(mesProductRecord);
|
|
|
+ if (ListUtils.isEmpty(productRecords)) {
|
|
|
+ //生成首件检记录
|
|
|
+ MesProductCheckOne mesProductCheckOne1 = new MesProductCheckOne();
|
|
|
+ mesProductCheckOne1.setSn(sn);
|
|
|
+ mesProductCheckOne1.setOprno(checkOprno);
|
|
|
+ mesProductCheckOne1.setLineSn(lineSn);
|
|
|
+ mesProductCheckOne1.setResult("NG");
|
|
|
+ mesProductCheckOne1.setConfirmCheck("0");
|
|
|
+ mesProductCheckOne1.setCreateBy("system");
|
|
|
+ mesProductCheckOne1.setUpdateBy("system");
|
|
|
+ mesProductCheckOneService.save(mesProductCheckOne1);
|
|
|
+ }
|
|
|
+ } catch (ParseException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
ret = mesProductRecordService.add(mesProductRecord,params,bmlists);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
@@ -4599,13 +4642,14 @@ public class MesProductRecordController extends BaseController {
|
|
|
MesProductRecord mesProductRecord = new MesProductRecord();
|
|
|
mesProductRecord.setLineSn(lineSn);
|
|
|
mesProductRecord.setCraft("100000");
|
|
|
- mesProductRecord.setCreateDate_gte(stdate);
|
|
|
- mesProductRecord.setCreateDate_lte(etdate);
|
|
|
+ mesProductRecord.setUpdateDate_gte(stdate);
|
|
|
+ mesProductRecord.setUpdateDate_lte(etdate);
|
|
|
+ mesProductRecord.getSqlMap().getWhere().and("a.content", QueryType.NE,"UDF");
|
|
|
mesProductRecord.getSqlMap().getWhere().and("a.oprno", QueryType.IN, oprnos);
|
|
|
mesProductRecord.getSqlMap().getOrder().setOrderBy("a.update_date DESC, a.id DESC");
|
|
|
List<MesProductRecord> productRecords = mesProductRecordService.findList(mesProductRecord);
|
|
|
- if(ListUtils.isEmpty(productRecords)){
|
|
|
- //生成首件检记录
|
|
|
+ /* if(ListUtils.isEmpty(productRecords)){
|
|
|
+ *//* //生成首件检记录
|
|
|
MesProductCheckOne mesProductCheckOne1 = new MesProductCheckOne();
|
|
|
mesProductCheckOne1.setSn(sn);
|
|
|
mesProductCheckOne1.setOprno(checkOprno);
|
|
|
@@ -4614,11 +4658,13 @@ public class MesProductRecordController extends BaseController {
|
|
|
mesProductCheckOne1.setConfirmCheck("0");
|
|
|
mesProductCheckOne1.setCreateBy(userCode);
|
|
|
mesProductCheckOne1.setUpdateBy(userCode);
|
|
|
- mesProductCheckOneService.save(mesProductCheckOne1);
|
|
|
+ mesProductCheckOneService.save(mesProductCheckOne1);*//*
|
|
|
+ return true;
|
|
|
+ }*/
|
|
|
+ if(ListUtils.isEmpty(productRecords)){
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//有,判断首件检记录
|
|
|
MesProductCheckOne mesProductCheckOne = new MesProductCheckOne();
|
|
|
mesProductCheckOne.setLineSn(lineSn);
|