zhl-methods 1.1.7 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/ScanUDI.js +24 -19
- package/package.json +1 -1
package/js/ScanUDI.js
CHANGED
|
@@ -83,34 +83,39 @@ export default class ScanUDI {
|
|
|
83
83
|
expiry_time: this.setDateFormat(expiry_time, "expiry", manufacture_time),
|
|
84
84
|
batch_no: batch_no.toUpperCase(),
|
|
85
85
|
serial_no,
|
|
86
|
+
udi: str.replace(/[^a-zA-Z0-9]/g, ""),
|
|
86
87
|
};
|
|
87
88
|
return obj;
|
|
88
89
|
}
|
|
89
90
|
setDateFormat(date, type, expand) {
|
|
90
91
|
try {
|
|
91
|
-
if (date
|
|
92
|
-
if (
|
|
93
|
-
|
|
92
|
+
if (date) {
|
|
93
|
+
if (date.length === 8 && data.substr(data.length - 2) == "00") {
|
|
94
|
+
if (type === "expiry") {
|
|
95
|
+
date = dayjs(date).endOf("month");
|
|
96
|
+
}
|
|
97
|
+
date = dayjs(date).startOf("month");
|
|
94
98
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
date = "20" + date;
|
|
99
|
+
if (date.length === 6) {
|
|
100
|
+
if (date.substring(0, 2) === expand.substring(0, 2)) {
|
|
101
|
+
// 年月(6位) - 202507
|
|
102
|
+
date = date + "01";
|
|
103
|
+
} else {
|
|
104
|
+
// 年后两位月日(6位) - 250708
|
|
105
|
+
date = "20" + date;
|
|
106
|
+
}
|
|
104
107
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
// 年后两位月(4位) - 2507
|
|
109
|
+
if (date.length === 4) {
|
|
110
|
+
if (type === "expiry") {
|
|
111
|
+
date = dayjs("20" + date).endOf("month");
|
|
112
|
+
}
|
|
113
|
+
date = "20" + date + "01";
|
|
110
114
|
}
|
|
111
|
-
|
|
115
|
+
return dayjs(date).format("YYYY-MM-DD");
|
|
116
|
+
} else {
|
|
117
|
+
return "";
|
|
112
118
|
}
|
|
113
|
-
return dayjs(date).format("YYYY-MM-DD");
|
|
114
119
|
} catch (error) {
|
|
115
120
|
console.log(error, "setDateFormat error");
|
|
116
121
|
return date;
|