AdminProductionSpec.php
6.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminBase.php" ;?>
<?
if (! class_exists("AdminProductionSpec")){
class AdminProductionSpec extends AdminBase{
function __construct($req)
{
parent::__construct($req);
}
function getListOfProductionSpec(){
$searchType=$this->req["searchType"];
$searchText=$this->req["searchText"];
$dateFormer=$this->req["dateFormer"];
$dateLatter=$this->req["dateLatter"];
$where=" WHERE PS.status=1";
if($searchType=="CN")
$where.=" AND companyName LIKE '%{$searchText}%'";
else if($searchType=="PN")
$where.=" AND productName LIKE '%{$searchText}%'";
else if($searchType=="MN")
$where.=" AND userName LIKE '%{$searchText}%'";
else if($searchType=="")
$where.=" AND (companyName LIKE '%{$searchText}%' OR productName LIKE '%{$searchText}%' OR userName LIKE '%{$searchText}%')";
if($dateFormer != "")
$where.=" AND DATE_FORMAT(PS.regDate, '%Y%m%d') >= DATE_FORMAT('{$dateFormer}', '%Y%m%d')";
if($dateLatter != "")
$where.=" AND DATE_FORMAT(PS.regDate, '%Y%m%d') <= DATE_FORMAT('{$dateLatter}', '%Y%m%d')";
$sql="
SELECT COUNT(*) AS rn
FROM tblProductionSpec PS
LEFT JOIN tblUser U ON PS.userFk=U.userNo
{$where}
ORDER BY PS.regDate DESC
";
$this->initPage();
$this->rownum=$this->getValue($sql, 'rn');
$this->setPage($this->rownum);
$limit=" LIMIT {$this->startNum}, {$this->endNum} ;";
$sql="
SELECT productionNo, DATE_FORMAT(PS.requestDate, '%Y-%m-%d') AS requestDate, PS.companyName, PS.productName, U.userName
FROM tblProductionSpec PS
LEFT JOIN tblUser U ON PS.userFk=U.userNo
{$where}
ORDER BY PS.productionNo DESC
{$limit}
";
$result=$this->getArray($sql);
// echo $sql;
return $result;
}
function getInfoOfProductionSpec(){
$productionNo=$this->req["no"];
$sql="
SELECT *
FROM tblProductionSpec
WHERE productionNo='{$productionNo}'
";
$result=$this->getRow($sql);
//echo json_encode($result);
return $result;
}
function getListOfManager(){
$sql="
SELECT userNo, userName
FROM tblUser
WHERE userType=2 AND status=1
ORDER BY userNo ASC
";
$result=$this->getArray($sql);
return $result;
}
function saveProductionSpec(){
$productionNo=$this->req["productionNo"];
$managerFk=$this->req["managerFk"];
$requestDate=$this->req["requestDate"];
$customerName=$this->req["customerName"];
$companyName=$this->req["companyName"];
$vehicleTON=$this->req["vehicleTON"];
$vehicleText=$this->req["vehicleText"];
$vehicleType=$this->req["vehicleType"];
$productName=$this->req["productName"];
$telephone=$this->req["telephone1"].$this->req["telephone2"].$this->req["telephone3"];
$type=$this->req["type"];
$typeValue=$this->req["typeValue"];
$internalLength=$this->req["internalLength"];
$internalHeight=$this->req["internalHeight"];
$internalWidth=$this->req["internalWidth"];
$alCoil=$this->req["alCoil"];
$alCoilValue=$this->req["alCoilValue"];
$floor=$this->req["floor"];
$floorValueT=$this->req["floorValueT"];
$floorValueText=$this->req["floorValueText"];
$tent=$this->req["tent"];
$sideBoard=$this->req["sideBoard"];
$sideBoardValue=$this->req["sideBoardValue"];
$windStopper=$this->req["windStopper"];
$windStopperValue=$this->req["windStopperValue"];
$freezer=$this->req["freezer"];
$freezerValue=$this->req["freezerValue"];
$gateType=$this->req["gateType"];
$gateSize=$this->req["gateSize"];
$gateValue=$this->req["gateValue"];
$load=$this->req["load"];
$frontBack=$this->req["frontBack"];
$eTrackGate=$this->req["eTrackGate"];
$eTrackWing=$this->req["eTrackWing"];
$eTrackValue=$this->req["eTrackValue"];
$toolBucket=$this->req["toolBucket"];
$toolBucketValue=$this->req["toolBucketValue"];
$bumperFootHold=$this->req["bumperFootHold"];
$wingProtector=$this->req["wingProtector"];
$axis=$this->req["axis"];
$axisValue=$this->req["axisValue"];
$balance=$this->req["balance"];
$specialAddition1=$this->req["specialAddition1"];
$specialAddition2=$this->req["specialAddition2"];
$specialAddition3=$this->req["specialAddition3"];
$specialAddition4=$this->req["specialAddition4"];
$specialAddition5=$this->req["specialAddition5"];
$sql = "
UPDATE `tblProductionSpec`
SET
`userFk` = '{$managerFk}',
`requestDate` = '{$requestDate}',
`customerName` = '{$customerName}',
`companyName` = '{$companyName}',
`vehicleTON` = '{$vehicleTON}',
`vehicleText` = '{$vehicleText}',
`vehicleType` = '{$vehicleType}',
`productName` = '{$productName}',
`telephone` = '{$telephone}',
`type` = '{$type}',
`typeValue` = '{$typeValue}',
`internalLength` = '{$internalLength}',
`internalHeight` = '{$internalHeight}',
`internalWidth` = '{$internalWidth}',
`alCoil` = '{$alCoil}',
`alCoilValue` = '{$alCoilValue}',
`floor` = '{$floor}',
`floorValueT` = '{$floorValueT}',
`floorValueText` = '{$floorValueText}',
`tent` = '{$tent}',
`sideBoard` = '{$sideBoard}',
`sideBoardValue` = '{$sideBoardValue}',
`windStopper` = '{$windStopper}',
`windStopperValue` = '{$windStopperValue}',
`freezer` = '{$freezer}',
`freezerValue` = '{$freezerValue}',
`gateType` = '{$gateType}',
`gateSize` = '{$gateSize}',
`gateValue` = '{$gateValue}',
`load` = '{$load}',
`frontBack` = '{$frontBack}',
`eTrackGate` = '{$eTrackGate}',
`eTrackWing` = '{$eTrackWing}',
`eTrackValue` = '{$eTrackValue}',
`toolBucket` = '{$toolBucket}',
`toolBucketValue` = '{$toolBucketValue}',
`bumperFootHold` = '{$bumperFootHold}',
`wingProtector` = '{$wingProtector}',
`axis` = '{$axis}',
`axisValue` = '{$axisValue}',
`balance` = '{$balance}',
`specialAddition1` = '{$specialAddition1}',
`specialAddition2` = '{$specialAddition2}',
`specialAddition3` = '{$specialAddition3}',
`specialAddition4` = '{$specialAddition4}',
`specialAddition5` = '{$specialAddition5}'
WHERE `productionNo` = '{$productionNo}';
";
$this->update($sql);
return $this->makeResultJson(1, "저장되었습니다");
}
function deleteProductionSpec(){
$noArr = $this->req["no"];
$noStr = implode(',', $noArr);
$sql = "
UPDATE tblProductionSpec
SET status = 0
WHERE `productionNo` IN({$noStr})
";
$this->update($sql);
}
}
}
?>