|
|
@@ -45,15 +45,17 @@ import com.jeesite.modules.sys.utils.UserUtils;
|
|
|
|
|
|
/**
|
|
|
* 成品包装入库 / 出库(安卓 PDA)
|
|
|
- * 包装码由 MES 生成(/mes/mesBatchSn/getBatchSn、createBatchSn),逻辑同原 OP265 包装:
|
|
|
- * 前工位 UDF/NG 拦截 → 绑定 mes_product_batch → 更新 mes_product → OP265 记录置 OK → 包装码 nums+1,满额封箱
|
|
|
+ * 包装码由 MES 生成(/mes/mesBatchSn/getBatchSn、createBatchSn)。
|
|
|
+ * CZ060 包装入库同时完成 OP260 和 OP265,两道工位记录均置 OK。
|
|
|
* 出库:扫包装码,包装码及包装内所有工件 state 置为 1(已出库)
|
|
|
*/
|
|
|
@Controller
|
|
|
@RequestMapping(value = "${adminPath}/mes/mesProductPack")
|
|
|
public class MesProductPackController extends BaseController {
|
|
|
|
|
|
- private static final String PACK_OPRNO = "OP265"; // 包装工位
|
|
|
+ private static final String CZ060_LINE_SN = "CZ060";
|
|
|
+ private static final String BOX_PACK_OPRNO = "OP260";
|
|
|
+ private static final String PACK_OPRNO = "OP265";
|
|
|
private static final int PACK_OP = 265;
|
|
|
private static final String CRAFT = "100000"; // 工位结果记录
|
|
|
private static final String CATE = "2"; // 成品
|
|
|
@@ -171,8 +173,10 @@ public class MesProductPackController extends BaseController {
|
|
|
p.setBindDate(now);
|
|
|
p.setState("1");
|
|
|
mesProductService.save(p);
|
|
|
- // OP265 工位结果置 OK
|
|
|
- passPackOprno(p.getSn());
|
|
|
+ if (CZ060_LINE_SN.equals(lineSn)) {
|
|
|
+ passPackOprno(p.getSn(), BOX_PACK_OPRNO);
|
|
|
+ }
|
|
|
+ passPackOprno(p.getSn(), PACK_OPRNO);
|
|
|
}
|
|
|
|
|
|
// 重新读取最新 nums,满额封箱
|
|
|
@@ -320,7 +324,7 @@ public class MesProductPackController extends BaseController {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- // 单件校验(同原 OP265 包装),返回错误信息,null 表示通过
|
|
|
+ // 单件校验,返回错误信息,null 表示通过
|
|
|
private String checkPiece(String code, MesProduct p, String lineSn) {
|
|
|
if (p == null) {
|
|
|
return "工件【" + code + "】不存在";
|
|
|
@@ -346,14 +350,17 @@ public class MesProductPackController extends BaseController {
|
|
|
if (StringUtils.isNoneBlank(lineSn, pieceLine) && !lineSn.equals(pieceLine)) {
|
|
|
return "工件【" + code + "】属于产线" + pieceLine + ",与当前产线不一致";
|
|
|
}
|
|
|
- // 前工位检查:OP265 之前的工位不能有 UDF(未加工)/ NG,跳站配置 mes.pass.oprno.{产线} 不拦截
|
|
|
+ // CZ060 的 OP260 由本次包装入库完成,前工位校验跳过该站。
|
|
|
List<MesProductRecord> recs = findRecords(p.getSn(), null);
|
|
|
if (recs.isEmpty()) {
|
|
|
return "工件【" + code + "】追溯记录不存在";
|
|
|
}
|
|
|
+ boolean completesOp260 = CZ060_LINE_SN.equals(lineSn);
|
|
|
String pass = CommonUitl.getPassOprnos(lineSn);
|
|
|
for (MesProductRecord r : recs) {
|
|
|
- if (opNum(r.getOprno()) >= PACK_OP || CommonUitl.matchOprnos(pass, r.getOprno())) {
|
|
|
+ if (opNum(r.getOprno()) >= PACK_OP
|
|
|
+ || (completesOp260 && isStation(r, BOX_PACK_OPRNO))
|
|
|
+ || CommonUitl.matchOprnos(pass, r.getOprno())) {
|
|
|
continue;
|
|
|
}
|
|
|
if ("UDF".equals(r.getContent())) {
|
|
|
@@ -366,16 +373,20 @@ public class MesProductPackController extends BaseController {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- // OP265 工位结果置 OK
|
|
|
- private void passPackOprno(String shortSn) {
|
|
|
- findRecords(shortSn, PACK_OPRNO).stream()
|
|
|
- .filter(r -> CommonUitl.formatOprno(r.getOprno()).equals(PACK_OPRNO))
|
|
|
+ private void passPackOprno(String shortSn, String oprno) {
|
|
|
+ findRecords(shortSn, oprno).stream()
|
|
|
+ .filter(r -> isStation(r, oprno))
|
|
|
.forEach(r -> {
|
|
|
r.setContent("OK");
|
|
|
mesProductRecordService.save(r);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ private boolean isStation(MesProductRecord record, String oprno) {
|
|
|
+ return StringUtils.isNotBlank(record.getOprno())
|
|
|
+ && oprno.equals(CommonUitl.formatOprno(record.getOprno()));
|
|
|
+ }
|
|
|
+
|
|
|
// 工位结果记录(craft=100000),oprno 为空查全部
|
|
|
private List<MesProductRecord> findRecords(String shortSn, String oprno) {
|
|
|
MesProductRecord q = new MesProductRecord();
|