Commit 22c5f5003d25c36587f20fe5e45fbfff68b06cb3
1 parent
67523b78
Exists in
master
1. F 批次的NO生成调整代码
Showing
4 changed files
with
8 additions
and
32 deletions
Show diff stats
domain/manufacturer/Manufacturer.php
@@ -141,14 +141,8 @@ class Manufacturer | @@ -141,14 +141,8 @@ class Manufacturer | ||
141 | return "0001"; | 141 | return "0001"; |
142 | } | 142 | } |
143 | $dataNo = hexdec($findManufacturer['manufacture_no']) + 1; | 143 | $dataNo = hexdec($findManufacturer['manufacture_no']) + 1; |
144 | - $dataNo = (string) dechex($dataNo); | ||
145 | - if (strlen($dataNo) == 1) { | ||
146 | - $dataNo = "000" . $dataNo; | ||
147 | - } else if (strlen($dataNo) == 2) { | ||
148 | - $dataNo = "00" . $dataNo; | ||
149 | - } else if (strlen($dataNo) == 3) { | ||
150 | - $dataNo = "0" . $dataNo; | ||
151 | - } | 144 | + $dataNo = sprintf('%04X', $dataNo); |
145 | + | ||
152 | return strtoupper($dataNo); | 146 | return strtoupper($dataNo); |
153 | } | 147 | } |
154 | 148 |
domain/model/Model.php
@@ -86,14 +86,8 @@ class Model | @@ -86,14 +86,8 @@ class Model | ||
86 | return "0001"; | 86 | return "0001"; |
87 | } | 87 | } |
88 | $dataNo = hexdec($findModel['model_no']) + 1; | 88 | $dataNo = hexdec($findModel['model_no']) + 1; |
89 | - $dataNo = (string) dechex($dataNo); | ||
90 | - if (strlen($dataNo) == 1) { | ||
91 | - $dataNo = "000" . $dataNo; | ||
92 | - } else if (strlen($dataNo) == 2) { | ||
93 | - $dataNo = "00" . $dataNo; | ||
94 | - } else if (strlen($dataNo) == 3) { | ||
95 | - $dataNo = "0" . $dataNo; | ||
96 | - } | 89 | + $dataNo = sprintf('%04X', $dataNo); |
90 | + | ||
97 | return strtoupper($dataNo); | 91 | return strtoupper($dataNo); |
98 | } | 92 | } |
99 | } | 93 | } |
100 | \ No newline at end of file | 94 | \ No newline at end of file |
domain/production/Production.php
@@ -86,14 +86,8 @@ class Production | @@ -86,14 +86,8 @@ class Production | ||
86 | return "0001"; | 86 | return "0001"; |
87 | } | 87 | } |
88 | $dataNo = hexdec($findProduction['production_no']) + 1; | 88 | $dataNo = hexdec($findProduction['production_no']) + 1; |
89 | - $dataNo = (string) dechex($dataNo); | ||
90 | - if (strlen($dataNo) == 1) { | ||
91 | - $dataNo = "000" . $dataNo; | ||
92 | - } else if (strlen($dataNo) == 2) { | ||
93 | - $dataNo = "00" . $dataNo; | ||
94 | - } else if (strlen($dataNo) == 3) { | ||
95 | - $dataNo = "0" . $dataNo; | ||
96 | - } | 89 | + $dataNo = sprintf('%04X', $dataNo); |
90 | + | ||
97 | return strtoupper($dataNo); | 91 | return strtoupper($dataNo); |
98 | } | 92 | } |
99 | } | 93 | } |
100 | \ No newline at end of file | 94 | \ No newline at end of file |
domain/project/Project.php
@@ -86,14 +86,8 @@ class Project | @@ -86,14 +86,8 @@ class Project | ||
86 | return "0001"; | 86 | return "0001"; |
87 | } | 87 | } |
88 | $dataNo = hexdec($findModel['project_no']) + 1; | 88 | $dataNo = hexdec($findModel['project_no']) + 1; |
89 | - $dataNo = (string) dechex($dataNo); | ||
90 | - if (strlen($dataNo) == 1) { | ||
91 | - $dataNo = "000" . $dataNo; | ||
92 | - } else if (strlen($dataNo) == 2) { | ||
93 | - $dataNo = "00" . $dataNo; | ||
94 | - } else if (strlen($dataNo) == 3) { | ||
95 | - $dataNo = "0" . $dataNo; | ||
96 | - } | 89 | + $dataNo = sprintf('%04X', $dataNo); |
90 | + | ||
97 | return strtoupper($dataNo); | 91 | return strtoupper($dataNo); |
98 | } | 92 | } |
99 | } | 93 | } |
100 | \ No newline at end of file | 94 | \ No newline at end of file |