|
|
@@ -134,6 +134,9 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
|
|
|
@Autowired
|
|
|
private MesProductModifyRecordService mesProductModifyRecordService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private MesProductOprnoService mesProductOprnoService;
|
|
|
+
|
|
|
@Override
|
|
|
public void save(MesProductRecord mesProductRecord) {
|
|
|
if (StringUtils.isEmpty(mesProductRecord.getSource())) {
|
|
|
@@ -587,14 +590,86 @@ public class MesProductRecordService extends CrudService<MesProductRecordDao, Me
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * OP290子工位:OP290A/OP290B分别提交,子表齐且都为OK后才更新主表总结果
|
|
|
+ * @return null=仅保存子工位结果,暂不更新主表;非null=汇总后的总结果
|
|
|
+ */
|
|
|
+ private String mergeOp290SubResult(String sn, String oldOprno, String lineSn, String content) {
|
|
|
+ if (!"OP290A".equals(oldOprno) && !"OP290B".equals(oldOprno)) {
|
|
|
+ return content;
|
|
|
+ }
|
|
|
+ content = "OK".equals(content) ? "OK" : "NG";
|
|
|
+
|
|
|
+ MesProductOprno query = new MesProductOprno();
|
|
|
+ query.setSn(sn);
|
|
|
+ query.setLineSn(lineSn);
|
|
|
+ query.setOprno(oldOprno);
|
|
|
+ MesProductOprno existing = mesProductOprnoService.findInfo(query);
|
|
|
+ if (ObjectUtils.isEmpty(existing)) {
|
|
|
+ initOp290SubRows(sn, lineSn);
|
|
|
+ }
|
|
|
+
|
|
|
+ MesProductOprno rowA = getOrCreateOp290Row(sn, lineSn, "OP290A");
|
|
|
+ MesProductOprno rowB = getOrCreateOp290Row(sn, lineSn, "OP290B");
|
|
|
+ if ("OP290A".equals(oldOprno)) {
|
|
|
+ rowA.setResult1(content);
|
|
|
+ mesProductOprnoService.save(rowA);
|
|
|
+ } else {
|
|
|
+ rowB.setResult1(content);
|
|
|
+ mesProductOprnoService.save(rowB);
|
|
|
+ }
|
|
|
+
|
|
|
+ rowA = getOrCreateOp290Row(sn, lineSn, "OP290A");
|
|
|
+ rowB = getOrCreateOp290Row(sn, lineSn, "OP290B");
|
|
|
+ if (StringUtils.isEmpty(rowA.getResult1()) || StringUtils.isEmpty(rowB.getResult1())) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if ("OK".equals(rowA.getResult1()) && "OK".equals(rowB.getResult1())) {
|
|
|
+ return "OK";
|
|
|
+ }
|
|
|
+ return "NG";
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initOp290SubRows(String sn, String lineSn) {
|
|
|
+ getOrCreateOp290Row(sn, lineSn, "OP290A");
|
|
|
+ getOrCreateOp290Row(sn, lineSn, "OP290B");
|
|
|
+ }
|
|
|
+
|
|
|
+ private MesProductOprno getOrCreateOp290Row(String sn, String lineSn, String subOprno) {
|
|
|
+ MesProductOprno query = new MesProductOprno();
|
|
|
+ query.setSn(sn);
|
|
|
+ query.setLineSn(lineSn);
|
|
|
+ query.setOprno(subOprno);
|
|
|
+ MesProductOprno row = mesProductOprnoService.findInfo(query);
|
|
|
+ if (ObjectUtils.isEmpty(row)) {
|
|
|
+ row = new MesProductOprno();
|
|
|
+ row.setSn(sn);
|
|
|
+ row.setLineSn(lineSn);
|
|
|
+ row.setOprno(subOprno);
|
|
|
+ mesProductOprnoService.save(row);
|
|
|
+ row = mesProductOprnoService.findInfo(query);
|
|
|
+ }
|
|
|
+ return row;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 质量上传(总结果) 100000
|
|
|
*/
|
|
|
@Transactional
|
|
|
public void updateRecordResult(String sn, String oprno, String craft, String materielSn, String content, String userCode, List<ParamsResp> paramsResps,String lineSn,Boolean optime,List<BindMaterialResp> bmlists) {
|
|
|
String oldOprno = oprno;
|
|
|
- oprno = CommonUitl.formatOprno(oprno);
|
|
|
sn = sn.trim();
|
|
|
|
|
|
+ if ("100000".equals(craft) && ("OP290A".equals(oldOprno) || "OP290B".equals(oldOprno))) {
|
|
|
+ String mergedContent = mergeOp290SubResult(sn, oldOprno, lineSn, content);
|
|
|
+ if (mergedContent == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ oldOprno = "OP290A";
|
|
|
+ content = mergedContent;
|
|
|
+ }
|
|
|
+
|
|
|
+ oprno = CommonUitl.formatOprno(oldOprno);
|
|
|
+
|
|
|
MesProductRecord mesProductRecord1 = new MesProductRecord();
|
|
|
|
|
|
mesProductRecord1.setOprno(oprno);
|