|
|
@@ -352,7 +352,7 @@ public class QmStation {
|
|
|
labelFont.setText(nvl(configParam.getLabelFont(), "10"));
|
|
|
stationNo.setText(nvl(configParam.getStationNo(), "1"));
|
|
|
productSnPre.setText(nvl(configParam.getProductSnPre(), ""));
|
|
|
- productSnLength.setText(nvl(configParam.getProductSnLength(), ""));
|
|
|
+ productSnLength.setText(nvl(configParam.getProductSnLength(), "33"));
|
|
|
device.setSelectedItem(nvl(configParam.getDevice(), "innomatec"));
|
|
|
oprno.setText(nvl(configParam.getOprno(), ""));
|
|
|
oprnoTitle.setText(nvl(configParam.getOprnoTitle(), ""));
|
|
|
@@ -376,14 +376,21 @@ public class QmStation {
|
|
|
configParam.setPrintLabel(printLabel.getSelectedItem().toString());
|
|
|
configParam.setStartMode(startMode.getSelectedItem().toString());
|
|
|
configParam.setProductSnPre(productSnPre.getText().trim());
|
|
|
- configParam.setProductSnLength(productSnLength.getText().trim());
|
|
|
+ String snLenTxt = productSnLength.getText().trim();
|
|
|
+ configParam.setProductSnLength(snLenTxt.isEmpty() ? "33" : snLenTxt);
|
|
|
configParam.setLeakage(leakage.getSelectedItem().toString());
|
|
|
configParam.setDevice(device.getSelectedItem().toString());
|
|
|
- configParam.setOprno(oprno.getText().trim());
|
|
|
+ String opr = oprno.getText().trim().toUpperCase();
|
|
|
+ configParam.setOprno(opr);
|
|
|
configParam.setOprnoTitle(oprnoTitle.getText().trim());
|
|
|
configParam.setLineSn(lineSn.getText().trim());
|
|
|
}
|
|
|
|
|
|
+ /** 工位号:OP080 或 OP080A */
|
|
|
+ public static boolean isValidOprno(String opr) {
|
|
|
+ return opr != null && opr.matches("^OP\\d{3}[A-Z]?$");
|
|
|
+ }
|
|
|
+
|
|
|
public static void fillDefault(ConfigParam p) {
|
|
|
if (p == null) {
|
|
|
return;
|
|
|
@@ -405,7 +412,10 @@ public class QmStation {
|
|
|
if (empty(p.getLabelFont())) p.setLabelFont("10");
|
|
|
if (empty(p.getStationNo())) p.setStationNo("1");
|
|
|
if (p.getProductSnPre() == null) p.setProductSnPre("");
|
|
|
- if (p.getProductSnLength() == null) p.setProductSnLength("");
|
|
|
+ // Modena-1B 工件码固定 33 位
|
|
|
+ if (p.getProductSnLength() == null || p.getProductSnLength().trim().isEmpty()) {
|
|
|
+ p.setProductSnLength("33");
|
|
|
+ }
|
|
|
if (empty(p.getDevice())) p.setDevice("innomatec");
|
|
|
if (p.getOprno() == null) p.setOprno("");
|
|
|
if (p.getOprnoTitle() == null) p.setOprnoTitle("");
|
|
|
@@ -461,6 +471,19 @@ public class QmStation {
|
|
|
product_sn.setText("");
|
|
|
return;
|
|
|
}
|
|
|
+ // Modena-1B:默认 33 位;配置了 productSnLength 时以配置为准
|
|
|
+ int snLen = 33;
|
|
|
+ try {
|
|
|
+ if (configParam.getProductSnLength() != null && !configParam.getProductSnLength().trim().isEmpty()) {
|
|
|
+ snLen = Integer.parseInt(configParam.getProductSnLength().trim());
|
|
|
+ }
|
|
|
+ } catch (Exception ignored) {
|
|
|
+ snLen = 33;
|
|
|
+ }
|
|
|
+ if (snLen > 0 && scanBarcode.length() != snLen) {
|
|
|
+ MesClient.setMenuStatus(title + ":工件码长度必须为" + snLen + "位", -1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (checkProductSn(scanBarcode)) {
|
|
|
if (serialPortUtils != null) {
|
|
|
serialPortUtils.changeProgram();
|