|
@@ -199,43 +199,47 @@ public class MesProductGp12Controller extends BaseController {
|
|
|
if (StringUtils.isBlank(lineSn))
|
|
if (StringUtils.isBlank(lineSn))
|
|
|
return renderResult(Global.FALSE, "缺少必要参数");
|
|
return renderResult(Global.FALSE, "缺少必要参数");
|
|
|
|
|
|
|
|
- // 兼容老 APK:GP12 拍照固定为 OP390(OP400 已是镭雕工位)
|
|
|
|
|
- if ("OP400".equals(oprno)) {
|
|
|
|
|
- oprno = "OP390";
|
|
|
|
|
- mesProductGp12.setOprno(oprno);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // T09 GP12 下线:工位号固定 OP250A(覆盖 APK 传入的任何值)
|
|
|
|
|
+ oprno = "OP250A";
|
|
|
|
|
+ mesProductGp12.setOprno(oprno);
|
|
|
|
|
+
|
|
|
|
|
+ // 计件模式开关(参数设置:mes.gp12.pieceOnly = 1 时启用)
|
|
|
|
|
+ // 启用后:跳过返修校验、不写过站 record,仅落拍照记录作为计件明细
|
|
|
|
|
+ boolean pieceOnly = "1".equals(Global.getConfig("mes.gp12.pieceOnly"));
|
|
|
|
|
|
|
|
- // 根据工件码查询是否已存在该数据
|
|
|
|
|
|
|
+ // 根据工件码查询是否已存在该数据(去重:同 sn 只能拍一次,计件也不允许拆分扫)
|
|
|
mesProductGp12.getSqlMap().getWhere().and("a.sn", QueryType.EQ, sn);
|
|
mesProductGp12.getSqlMap().getWhere().and("a.sn", QueryType.EQ, sn);
|
|
|
List<MesProductGp12> list = mesProductGp12Service.findList(mesProductGp12);
|
|
List<MesProductGp12> list = mesProductGp12Service.findList(mesProductGp12);
|
|
|
if (list.size() > 0){return renderResult(Global.FALSE, "该记录已存在");}
|
|
if (list.size() > 0){return renderResult(Global.FALSE, "该记录已存在");}
|
|
|
|
|
|
|
|
- // ==================== 新增: 检查工件返修状态 ====================
|
|
|
|
|
- // 检查工件是否处于返修状态
|
|
|
|
|
- MesProduct mesProduct = new MesProduct();
|
|
|
|
|
- mesProduct.setSn(sn);
|
|
|
|
|
- MesProduct productInfo = mesProductService.findInfo(mesProduct);
|
|
|
|
|
-
|
|
|
|
|
- // 如果工件存在,检查是否处于返修状态
|
|
|
|
|
- if (!ObjectUtils.isEmpty(productInfo)) {
|
|
|
|
|
- // state = "2" 表示返修中, state = "4" 表示待处理
|
|
|
|
|
- if ("2".equals(productInfo.getState()) || "4".equals(productInfo.getState())) {
|
|
|
|
|
- return renderResult(Global.FALSE, "该工件处于返修状态,无法拍照");
|
|
|
|
|
|
|
+ // ==================== 返修状态校验(计件模式跳过) ====================
|
|
|
|
|
+ if (!pieceOnly) {
|
|
|
|
|
+ // 检查工件是否处于返修状态
|
|
|
|
|
+ MesProduct mesProduct = new MesProduct();
|
|
|
|
|
+ mesProduct.setSn(sn);
|
|
|
|
|
+ MesProduct productInfo = mesProductService.findInfo(mesProduct);
|
|
|
|
|
+
|
|
|
|
|
+ // 如果工件存在,检查是否处于返修状态
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(productInfo)) {
|
|
|
|
|
+ // state = "2" 表示返修中, state = "4" 表示待处理
|
|
|
|
|
+ if ("2".equals(productInfo.getState()) || "4".equals(productInfo.getState())) {
|
|
|
|
|
+ return renderResult(Global.FALSE, "该工件处于返修状态,无法拍照");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- // 进一步检查是否存在未完成的返修记录
|
|
|
|
|
- MesRepair mesRepair = new MesRepair();
|
|
|
|
|
- mesRepair.setSn(sn);
|
|
|
|
|
- // 排除已修复的(state=3),查询是否有进行中的返修
|
|
|
|
|
- mesRepair.getSqlMap().getWhere().and("a.state", QueryType.NE, "3");
|
|
|
|
|
- MesRepair repairInfo = mesRepairService.findInfo(mesRepair);
|
|
|
|
|
|
|
+ // 进一步检查是否存在未完成的返修记录
|
|
|
|
|
+ MesRepair mesRepair = new MesRepair();
|
|
|
|
|
+ mesRepair.setSn(sn);
|
|
|
|
|
+ // 排除已修复的(state=3),查询是否有进行中的返修
|
|
|
|
|
+ mesRepair.getSqlMap().getWhere().and("a.state", QueryType.NE, "3");
|
|
|
|
|
+ MesRepair repairInfo = mesRepairService.findInfo(mesRepair);
|
|
|
|
|
|
|
|
- if (!ObjectUtils.isEmpty(repairInfo)) {
|
|
|
|
|
- // state = "1" 离线返修中, state = "2" 在线返修中
|
|
|
|
|
- return renderResult(Global.FALSE, "该工件存在未完成的返修记录,无法拍照");
|
|
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(repairInfo)) {
|
|
|
|
|
+ // state = "1" 离线返修中, state = "2" 在线返修中
|
|
|
|
|
+ return renderResult(Global.FALSE, "该工件存在未完成的返修记录,无法拍照");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- // ==================== 检查结束 ====================
|
|
|
|
|
|
|
+ // ==================== 校验结束 ====================
|
|
|
|
|
|
|
|
// 向数据库添加数据
|
|
// 向数据库添加数据
|
|
|
MesProductGp12 entry = new MesProductGp12();
|
|
MesProductGp12 entry = new MesProductGp12();
|
|
@@ -247,20 +251,22 @@ public class MesProductGp12Controller extends BaseController {
|
|
|
|
|
|
|
|
FileUploadUtils.saveFileUpload(entry, entry.getId(), "mesProductGp12_image");
|
|
FileUploadUtils.saveFileUpload(entry, entry.getId(), "mesProductGp12_image");
|
|
|
|
|
|
|
|
- // GP12 拍照即过站:把 mes_product_record 里 OP390/100000 总结果置为 OK(最小改动,不触发其它副作用)
|
|
|
|
|
- try {
|
|
|
|
|
- MesProductRecord record = mesProductRecordService.findByUpdateCate(sn, oprno, "100000", lineSn);
|
|
|
|
|
- if (!ObjectUtils.isEmpty(record)
|
|
|
|
|
- && !"OK".equals(record.getContent())
|
|
|
|
|
- && !"NG".equals(record.getContent())) {
|
|
|
|
|
- record.setContent("OK");
|
|
|
|
|
- record.setUpdateBy("system");
|
|
|
|
|
- record.setUpdateDate(new Date());
|
|
|
|
|
- record.setRemark("GP12拍照过站");
|
|
|
|
|
- mesProductRecordService.save(record);
|
|
|
|
|
|
|
+ // 过站写 record(计件模式跳过:只做计件,不污染质量数据)
|
|
|
|
|
+ if (!pieceOnly) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ MesProductRecord record = mesProductRecordService.findByUpdateCate(sn, oprno, "100000", lineSn);
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(record)
|
|
|
|
|
+ && !"OK".equals(record.getContent())
|
|
|
|
|
+ && !"NG".equals(record.getContent())) {
|
|
|
|
|
+ record.setContent("OK");
|
|
|
|
|
+ record.setUpdateBy("system");
|
|
|
|
|
+ record.setUpdateDate(new Date());
|
|
|
|
|
+ record.setRemark("GP12拍照过站");
|
|
|
|
|
+ mesProductRecordService.save(record);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error("GP12拍照过站更新record失败 sn=" + sn + " oprno=" + oprno, e);
|
|
|
}
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- logger.error("GP12拍照过站更新record失败 sn=" + sn + " oprno=" + oprno, e);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return renderResult(Global.TRUE, "操作成功");
|
|
return renderResult(Global.TRUE, "操作成功");
|
|
@@ -314,9 +320,9 @@ public class MesProductGp12Controller extends BaseController {
|
|
|
// 构造图片访问的基础URL
|
|
// 构造图片访问的基础URL
|
|
|
String host = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + "/js";
|
|
String host = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + "/js";
|
|
|
|
|
|
|
|
- // 兼容老 APK:查询 OP400 重定向到 OP390(OP400 已是镭雕工位)
|
|
|
|
|
- if ("OP400".equals(mesProductGp12.getOprno())) {
|
|
|
|
|
- mesProductGp12.setOprno("OP390");
|
|
|
|
|
|
|
+ // T09 GP12 下线:APK 传入的 oprno 一律重定向到 OP250A(库里就这一个工位号)
|
|
|
|
|
+ if (StringUtils.isNotBlank(mesProductGp12.getOprno())) {
|
|
|
|
|
+ mesProductGp12.setOprno("OP250A");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 从 request 获取并设置分页参数
|
|
// 从 request 获取并设置分页参数
|