|
|
@@ -123,23 +123,31 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
|
|
|
@Autowired
|
|
|
private MesProductDhbService mesProductDhbService;
|
|
|
|
|
|
+ /**
|
|
|
+ * 设置计件时间:首次从UDF变为OK或NG时记录
|
|
|
+ */
|
|
|
+ private void setPieceworkDateIfNeeded(MesProductRecord mesProductRecord) {
|
|
|
+ if (StringUtils.isEmpty(mesProductRecord.getId()) || mesProductRecord.getPieceworkDate() != null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ MesProductRecord oldRecord = super.get(mesProductRecord);
|
|
|
+ if (oldRecord != null
|
|
|
+ && "UDF".equals(oldRecord.getContent())
|
|
|
+ && !"UDF".equals(mesProductRecord.getContent())
|
|
|
+ && !StringUtils.isEmpty(mesProductRecord.getContent())) {
|
|
|
+ mesProductRecord.setPieceworkDate(new Date());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void save(MesProductRecord mesProductRecord) {
|
|
|
if (StringUtils.isEmpty(mesProductRecord.getSource())) {
|
|
|
mesProductRecord.setSource("0");
|
|
|
}
|
|
|
|
|
|
- // 计件时间逻辑:首次从UDF变为OK或NG时,记录计件时间
|
|
|
- if (!StringUtils.isEmpty(mesProductRecord.getId())) {
|
|
|
- MesProductRecord oldRecord = super.get(mesProductRecord);
|
|
|
- if (oldRecord != null
|
|
|
- && "UDF".equals(oldRecord.getContent())
|
|
|
- && !"UDF".equals(mesProductRecord.getContent())
|
|
|
- && !StringUtils.isEmpty(mesProductRecord.getContent())
|
|
|
- && mesProductRecord.getPieceworkDate() == null) {
|
|
|
- mesProductRecord.setPieceworkDate(new Date());
|
|
|
- }
|
|
|
- }
|
|
|
+ // 设置计件时间
|
|
|
+ setPieceworkDateIfNeeded(mesProductRecord);
|
|
|
|
|
|
super.save(mesProductRecord);
|
|
|
}
|
|
|
@@ -776,6 +784,7 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
|
|
|
mesProductRecord.setOprno(oldOprno);
|
|
|
}
|
|
|
mesProductRecord.setSource("0");
|
|
|
+ setPieceworkDateIfNeeded(mesProductRecord);
|
|
|
super.update(mesProductRecord);
|
|
|
break;
|
|
|
}
|
|
|
@@ -789,6 +798,7 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
|
|
|
}
|
|
|
mesProductRecord.setMaterielSn(mesLineProcess1.getDevices());
|
|
|
mesProductRecord.setContent("OK");
|
|
|
+ setPieceworkDateIfNeeded(mesProductRecord);
|
|
|
super.update(mesProductRecord);
|
|
|
}else if(mesProductRecord.getCraft().equals("400003")){
|
|
|
if(!oldOprno.equals(oprno)){
|
|
|
@@ -796,6 +806,7 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
|
|
|
}
|
|
|
mesProductRecord.setMaterielSn(mesLineProcess1.getGzs());
|
|
|
mesProductRecord.setContent("OK");
|
|
|
+ setPieceworkDateIfNeeded(mesProductRecord);
|
|
|
super.update(mesProductRecord);
|
|
|
}
|
|
|
|
|
|
@@ -811,6 +822,7 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
|
|
|
|
|
|
mesProductRecord.setMaterielSn(materielSn);
|
|
|
mesProductRecord.setContent(content);
|
|
|
+ setPieceworkDateIfNeeded(mesProductRecord);
|
|
|
super.update(mesProductRecord);
|
|
|
}
|
|
|
}
|
|
|
@@ -1153,6 +1165,7 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
|
|
|
mesProductRecord.setMaterielSn(materielSn);
|
|
|
mesProductRecord.setContent(content);
|
|
|
mesProductRecord.setSource("0");
|
|
|
+ setPieceworkDateIfNeeded(mesProductRecord);
|
|
|
super.update(mesProductRecord);
|
|
|
|
|
|
/*if(CommonUitl.formatOprno(oprno).equals("OP290") && craft.equals("400002")){
|
|
|
@@ -1242,6 +1255,7 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
|
|
|
|
|
|
mesProductRecord.setMaterielSn(materielSn);
|
|
|
mesProductRecord.setContent(content);
|
|
|
+ setPieceworkDateIfNeeded(mesProductRecord);
|
|
|
super.update(mesProductRecord);
|
|
|
|
|
|
// 更新用户
|
|
|
@@ -1273,6 +1287,7 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
|
|
|
|
|
|
mesProductRecord.setMaterielSn("");
|
|
|
mesProductRecord.setContent(content);
|
|
|
+ setPieceworkDateIfNeeded(mesProductRecord);
|
|
|
super.update(mesProductRecord);
|
|
|
|
|
|
if(!craft.equals("400001")){ // 不是绑定操作人员的
|