|
|
@@ -1,459 +1,466 @@
|
|
1
|
1
|
"use strict";
|
|
2
|
2
|
|
|
3
|
3
|
angular.module('app.storage')
|
|
4
|
|
-.controller("waterCheckCtrl", function($scope, $rootScope, $state, $stateParams,
|
|
5
|
|
- waterCheckService, warehouseService, archiveService,$filter) {
|
|
|
4
|
+ .controller("waterCheckCtrl", function ($scope, $rootScope, $state, $stateParams,
|
|
|
5
|
+ waterCheckService, warehouseService, archiveService, $filter) {
|
|
6
|
6
|
|
|
7
|
|
- $scope.pageInfo = {pageNum : 1, pageSize : 10};
|
|
8
|
|
- $scope.search = {houseId:"", wareId:""};
|
|
9
|
|
- $scope.isArchive = false;
|
|
10
|
|
- $scope.isArchiveHouse = 0;
|
|
11
|
|
- //加載列表
|
|
12
|
|
- $scope.loadData = function() {
|
|
13
|
|
- //归档用
|
|
14
|
|
- if($stateParams.dataState == "archive"){
|
|
15
|
|
- $scope.isArchive = true;
|
|
16
|
|
- //查询归档仓房下拉
|
|
17
|
|
- archiveService.getArchiveDataList().then(function (data) {
|
|
18
|
|
- if($scope.isArchiveHouse == 0){
|
|
19
|
|
- $scope.storelist = data;
|
|
20
|
|
- }
|
|
21
|
|
- $scope.isArchiveHouse++;
|
|
|
7
|
+ $scope.pageInfo = {pageNum: 1, pageSize: 10};
|
|
|
8
|
+ $scope.search = {houseId: "", wareId: ""};
|
|
|
9
|
+ $scope.isArchive = false;
|
|
|
10
|
+ $scope.isArchiveHouse = 0;
|
|
|
11
|
+ //加載列表
|
|
|
12
|
+ $scope.loadData = function () {
|
|
|
13
|
+ //归档用
|
|
|
14
|
+ if ($stateParams.dataState == "archive") {
|
|
|
15
|
+ $scope.isArchive = true;
|
|
|
16
|
+ //查询归档仓房下拉
|
|
|
17
|
+ archiveService.getArchiveDataList().then(function (data) {
|
|
|
18
|
+ if ($scope.isArchiveHouse == 0) {
|
|
|
19
|
+ $scope.storelist = data;
|
|
|
20
|
+ }
|
|
|
21
|
+ $scope.isArchiveHouse++;
|
|
22
|
22
|
|
|
23
|
|
- //如果不是下拉的则可能是点查看则按照这种方式跳转
|
|
24
|
|
- if($scope.search.houseId == undefined || $scope.search.houseId == ""){
|
|
25
|
|
- $scope.search.houseId = $rootScope.archiveState.storehouseId;
|
|
26
|
|
- $scope.search.createTime = $rootScope.archiveState.createTime;
|
|
27
|
|
- $scope.loadWare();
|
|
28
|
|
- }else{
|
|
29
|
|
- $scope.search.createTime = $scope.storelist[$scope.search.houseId].createTime;
|
|
30
|
|
- }
|
|
31
|
|
- if($scope.search.createTime == "" || $scope.search.createTime == undefined){
|
|
32
|
|
- $scope.pageInfo.pageNum = 0;
|
|
33
|
|
- $scope.pageInfo.pageSize = 0;
|
|
34
|
|
- $scope.search.houseId = '000';
|
|
35
|
|
- }
|
|
36
|
|
- $scope.search.createTime = $filter('date')($scope.search.createTime, "yyyy-MM-dd HH:mm:ss");
|
|
37
|
|
- //原来代码
|
|
38
|
|
- waterCheckService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize, $scope.search).then(function (data) {
|
|
39
|
|
- $scope.pageInfo = data;
|
|
40
|
|
- }, function (data) {
|
|
41
|
|
- console.log(data);
|
|
42
|
|
- });
|
|
43
|
|
- }, function (data) {
|
|
44
|
|
- console.log(data);
|
|
45
|
|
- });
|
|
46
|
|
- }else {
|
|
47
|
|
- waterCheckService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize, $scope.search).then(function (data) {
|
|
48
|
|
- $scope.pageInfo = data;
|
|
49
|
|
- }, function (data) {
|
|
50
|
|
- console.log(data);
|
|
51
|
|
- });
|
|
52
|
|
- }
|
|
53
|
|
- }
|
|
|
23
|
+ //如果不是下拉的则可能是点查看则按照这种方式跳转
|
|
|
24
|
+ if ($scope.search.houseId == undefined || $scope.search.houseId == "") {
|
|
|
25
|
+ $scope.search.houseId = $rootScope.archiveState.storehouseId;
|
|
|
26
|
+ $scope.search.createTime = $rootScope.archiveState.createTime;
|
|
|
27
|
+ $scope.loadWare();
|
|
|
28
|
+ } else {
|
|
|
29
|
+ $scope.search.createTime = $scope.storelist[$scope.search.houseId].createTime;
|
|
|
30
|
+ }
|
|
|
31
|
+ if ($scope.search.createTime == "" || $scope.search.createTime == undefined) {
|
|
|
32
|
+ $scope.pageInfo.pageNum = 0;
|
|
|
33
|
+ $scope.pageInfo.pageSize = 0;
|
|
|
34
|
+ $scope.search.houseId = '000';
|
|
|
35
|
+ }
|
|
|
36
|
+ $scope.search.createTime = $filter('date')($scope.search.createTime, "yyyy-MM-dd HH:mm:ss");
|
|
|
37
|
+ //原来代码
|
|
|
38
|
+ waterCheckService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize, $scope.search).then(function (data) {
|
|
|
39
|
+ $scope.pageInfo = data;
|
|
|
40
|
+ }, function (data) {
|
|
|
41
|
+ console.log(data);
|
|
|
42
|
+ });
|
|
|
43
|
+ }, function (data) {
|
|
|
44
|
+ console.log(data);
|
|
|
45
|
+ });
|
|
|
46
|
+ } else {
|
|
|
47
|
+ waterCheckService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize, $scope.search).then(function (data) {
|
|
|
48
|
+ $scope.pageInfo = data;
|
|
|
49
|
+ }, function (data) {
|
|
|
50
|
+ console.log(data);
|
|
|
51
|
+ });
|
|
|
52
|
+ }
|
|
|
53
|
+ }
|
|
54
|
54
|
|
|
55
|
|
- $scope.loadData();
|
|
|
55
|
+ $scope.loadData();
|
|
56
|
56
|
|
|
57
|
|
- // 货位列表
|
|
58
|
|
- $scope.loadWare = function(houseId) {
|
|
59
|
|
- if (null != houseId && houseId != "") {
|
|
60
|
|
- warehouseService.getStorehouse($rootScope.orgInfo.orgId, houseId, "0").then(function(data){
|
|
61
|
|
- $scope.warelist = data.wareList; //下拉列表数据
|
|
62
|
|
- },function (data) {
|
|
63
|
|
- console.log(data);
|
|
64
|
|
- });
|
|
65
|
|
- } else {
|
|
66
|
|
- $scope.warelist = [];
|
|
67
|
|
- }
|
|
68
|
|
- }
|
|
|
57
|
+ // 货位列表
|
|
|
58
|
+ $scope.loadWare = function (houseId) {
|
|
|
59
|
+ if (null != houseId && houseId != "") {
|
|
|
60
|
+ warehouseService.getStorehouse($rootScope.orgInfo.orgId, houseId, "0").then(function (data) {
|
|
|
61
|
+ $scope.warelist = data.wareList; //下拉列表数据
|
|
|
62
|
+ }, function (data) {
|
|
|
63
|
+ console.log(data);
|
|
|
64
|
+ });
|
|
|
65
|
+ } else {
|
|
|
66
|
+ $scope.warelist = [];
|
|
|
67
|
+ }
|
|
|
68
|
+ }
|
|
69
|
69
|
|
|
70
|
|
- // 翻页
|
|
71
|
|
- $scope.goPage = function(pageNum) {
|
|
72
|
|
- if ($scope.pageInfo.pageNum != pageNum && pageNum > 0) {
|
|
73
|
|
- $scope.pageInfo.pageNum = pageNum;
|
|
74
|
|
- $scope.loadData();
|
|
75
|
|
- }
|
|
76
|
|
- }
|
|
|
70
|
+ // 翻页
|
|
|
71
|
+ $scope.goPage = function (pageNum) {
|
|
|
72
|
+ if ($scope.pageInfo.pageNum != pageNum && pageNum > 0) {
|
|
|
73
|
+ $scope.pageInfo.pageNum = pageNum;
|
|
|
74
|
+ $scope.loadData();
|
|
|
75
|
+ }
|
|
|
76
|
+ }
|
|
77
|
77
|
|
|
78
|
|
- //新增、修改或查看
|
|
79
|
|
- $scope.edit = function(id, butType) {
|
|
80
|
|
- $state.go('app.storage.qualitycheck.waterCheckList.edit', {id:id, butType:butType});
|
|
81
|
|
- }
|
|
|
78
|
+ //新增、修改或查看
|
|
|
79
|
+ $scope.edit = function (id, butType) {
|
|
|
80
|
+ $state.go('app.storage.qualitycheck.waterCheckList.edit', {id: id, butType: butType});
|
|
|
81
|
+ }
|
|
82
|
82
|
|
|
83
|
|
- //刪除
|
|
84
|
|
- $scope.deletes = function(id) {
|
|
85
|
|
- var flag = confirm("确定要删除吗?");
|
|
86
|
|
- if (!flag) {
|
|
87
|
|
- return;
|
|
|
83
|
+ //刪除
|
|
|
84
|
+ $scope.deletes = function (id) {
|
|
|
85
|
+ var flag = confirm("确定要删除吗?");
|
|
|
86
|
+ if (!flag) {
|
|
|
87
|
+ return;
|
|
|
88
|
+ }
|
|
|
89
|
+ waterCheckService.remove(id).then(function (data) {
|
|
|
90
|
+ if (data.status == "success") {
|
|
|
91
|
+ $scope.loadData();
|
|
|
92
|
+ alert(data.msg);
|
|
|
93
|
+ } else {
|
|
|
94
|
+ alert("删除失败!");
|
|
|
95
|
+ }
|
|
|
96
|
+ }, function (data) {
|
|
|
97
|
+ console.log(data);
|
|
|
98
|
+ });
|
|
88
|
99
|
}
|
|
89
|
|
- waterCheckService.remove(id).then(function(data){
|
|
90
|
|
- if (data.status == "success") {
|
|
91
|
|
- $scope.loadData();
|
|
92
|
|
- alert(data.msg);
|
|
|
100
|
+ })
|
|
|
101
|
+ .controller("waterCheckEditCtrl", function ($scope, $state, $rootScope, $http, $filter, $location, $stateParams,
|
|
|
102
|
+ waterCheckService, warehouseService, kcswService, productService, commonUtilService, APP_CONFIG) {
|
|
|
103
|
+
|
|
|
104
|
+ // 用于存放固定点数据行
|
|
|
105
|
+ $scope.gdd_list = [];
|
|
|
106
|
+ // 用于存放机动点数据行
|
|
|
107
|
+ $scope.jdd_list = [];
|
|
|
108
|
+ // 初始化
|
|
|
109
|
+ $scope.waterCheck = {};
|
|
|
110
|
+
|
|
|
111
|
+ // 修改用户信息
|
|
|
112
|
+ $scope.edit = function () {
|
|
|
113
|
+ if ($stateParams.id !== '') {
|
|
|
114
|
+ waterCheckService.edit($stateParams.id).then(function (data) {
|
|
|
115
|
+ $scope.waterCheck = data.storageWaterCheck;
|
|
|
116
|
+ if ($scope.waterCheck.houseId != null && $scope.waterCheck.houseId != "") {
|
|
|
117
|
+ $scope.loadWare($scope.waterCheck.houseId);
|
|
|
118
|
+ }
|
|
|
119
|
+
|
|
|
120
|
+ $scope.gdd_list = data.storageWarterFixedPoint;
|
|
|
121
|
+ for (var i = 0; i < $scope.gdd_list.length; i++) {
|
|
|
122
|
+ $scope.gdd_list[i].inputTime = $filter('date')($scope.gdd_list[i].inputTime, "yyyy-MM-dd");
|
|
|
123
|
+ }
|
|
|
124
|
+ $scope.jdd_list = data.storageWarterMobilePoint;
|
|
|
125
|
+ for (var i = 0; i < $scope.jdd_list.length; i++) {
|
|
|
126
|
+ $scope.jdd_list[i].inputTime = $filter('date')($scope.jdd_list[i].inputTime, "yyyy-MM-dd");
|
|
|
127
|
+ }
|
|
|
128
|
+ $scope.waterCheck.hyDate = $filter('date')($scope.waterCheck.hyDate, "yyyy-MM-dd");
|
|
|
129
|
+ if ($stateParams.butType == '1') {//查看
|
|
|
130
|
+ $scope.isNotEdit = true;
|
|
|
131
|
+ } else if ($stateParams.butType == '0') {//修改
|
|
|
132
|
+ $scope.isNotEdit_lspz = true;
|
|
|
133
|
+ $scope.waterCheck.commitPeople = $rootScope.userInfo.realName; // 提交人
|
|
|
134
|
+ $scope.waterCheck.commitTime = $filter('date')(new Date(), "yyyy-MM-dd HH:mm:ss");// 提交时间
|
|
|
135
|
+ } else {
|
|
|
136
|
+ // $scope.waterCheck.hyDate = $filter('date')(new Date(), "yyyy-MM-dd");
|
|
|
137
|
+ // $scope.waterCheck.hyPerson = $rootScope.userInfo.realName;
|
|
|
138
|
+ }
|
|
|
139
|
+ }, function (data) {
|
|
|
140
|
+ console.log(data);
|
|
|
141
|
+ });
|
|
93
|
142
|
} else {
|
|
94
|
|
- alert("删除失败!");
|
|
|
143
|
+ $scope.waterCheck.commitPeople = $rootScope.userInfo.realName; // 提交人
|
|
|
144
|
+ $scope.waterCheck.commitTime = $filter('date')(new Date(), "yyyy-MM-dd HH:mm:ss");// 提交时间
|
|
95
|
145
|
}
|
|
96
|
|
- },function(data){
|
|
97
|
|
- console.log(data);
|
|
98
|
|
- });
|
|
99
|
|
- }
|
|
100
|
|
-})
|
|
101
|
|
-.controller("waterCheckEditCtrl", function($scope, $state, $rootScope, $http, $filter, $location, $stateParams,
|
|
102
|
|
- waterCheckService, warehouseService, kcswService, productService, commonUtilService, APP_CONFIG) {
|
|
103
|
|
-
|
|
104
|
|
- // 用于存放固定点数据行
|
|
105
|
|
- $scope.gdd_list = [];
|
|
106
|
|
- // 用于存放机动点数据行
|
|
107
|
|
- $scope.jdd_list = [];
|
|
|
146
|
+ };
|
|
|
147
|
+ $scope.edit();
|
|
108
|
148
|
|
|
109
|
|
- // 修改用户信息
|
|
110
|
|
- $scope.edit = function() {
|
|
111
|
|
- waterCheckService.edit($stateParams.id).then(function(data){
|
|
112
|
|
- $scope.waterCheck = data.storageWaterCheck;
|
|
113
|
|
- if ($scope.waterCheck.houseId != null && $scope.waterCheck.houseId != "") {
|
|
114
|
|
- $scope.loadWare($scope.waterCheck.houseId);
|
|
|
149
|
+ // 货位列表
|
|
|
150
|
+ $scope.loadWare = function (houseId) {
|
|
|
151
|
+ if (null != houseId && houseId != "") {
|
|
|
152
|
+ warehouseService.getStorehouse($rootScope.orgInfo.orgId, houseId, "0").then(function (data) {
|
|
|
153
|
+ $scope.warelist = data.wareList; //下拉列表数据
|
|
|
154
|
+ }, function (data) {
|
|
|
155
|
+ console.log(data);
|
|
|
156
|
+ });
|
|
|
157
|
+ } else {
|
|
|
158
|
+ $scope.warelist = [];
|
|
115
|
159
|
}
|
|
|
160
|
+ }
|
|
116
|
161
|
|
|
117
|
|
- $scope.gdd_list = data.storageWarterFixedPoint;
|
|
118
|
|
- for (var i = 0; i < $scope.gdd_list.length; i++) {
|
|
119
|
|
- $scope.gdd_list[i].inputTime = $filter('date')($scope.gdd_list[i].inputTime, "yyyy-MM-dd");
|
|
120
|
|
- }
|
|
121
|
|
- $scope.jdd_list = data.storageWarterMobilePoint;
|
|
122
|
|
- for (var i = 0; i < $scope.jdd_list.length; i++) {
|
|
123
|
|
- $scope.jdd_list[i].inputTime = $filter('date')($scope.jdd_list[i].inputTime, "yyyy-MM-dd");
|
|
124
|
|
- }
|
|
|
162
|
+ //通过仓房和货位获取出入库粮食品种
|
|
|
163
|
+ $scope.getCrkLspz = function () {
|
|
|
164
|
+ var houseId = $scope.waterCheck.houseId;
|
|
|
165
|
+ var wareId = $scope.waterCheck.wareId;
|
|
|
166
|
+ if (null != houseId && null != wareId) {
|
|
|
167
|
+ var datatype = $rootScope.storehouseObj[houseId].datatype;
|
|
|
168
|
+ var lylx;
|
|
|
169
|
+ if (datatype == "0") {//粮仓
|
|
|
170
|
+ lylx = $rootScope.wares[wareId].lylx;
|
|
|
171
|
+ } else if (datatype == "1") {//油罐
|
|
|
172
|
+ lylx = $rootScope.tankObj[houseId].lylx;
|
|
|
173
|
+ }
|
|
125
|
174
|
|
|
126
|
|
- $scope.waterCheck.hyDate = $filter('date')($scope.waterCheck.hyDate, "yyyy-MM-dd");
|
|
127
|
|
- if ($stateParams.butType == '1') {//查看
|
|
128
|
|
- $scope.isNotEdit = true;
|
|
129
|
|
- } else if ($stateParams.butType == '0') {//修改
|
|
130
|
|
- $scope.isNotEdit_lspz = true;
|
|
131
|
|
- } else {
|
|
132
|
|
- $scope.waterCheck.hyDate = $filter('date')(new Date(), "yyyy-MM-dd");
|
|
133
|
|
- $scope.waterCheck.hyPerson = $rootScope.userInfo.realName;
|
|
|
175
|
+ if (lylx != null && lylx == 0) {
|
|
|
176
|
+ var kcswStr = {ch: houseId, hwh: wareId, unitid: $rootScope.orgInfo.orgId};
|
|
|
177
|
+ kcswService.getPageInfo(null, null, kcswStr, " ModifyDate desc ").then(function (data) {
|
|
|
178
|
+ if (data.list != null && data.list.length > 0) {
|
|
|
179
|
+ //粮食品种
|
|
|
180
|
+ $scope.waterCheck.lspz = parseInt(data.list[0].pz);
|
|
|
181
|
+ } else {
|
|
|
182
|
+ $scope.waterCheck.lspz = null;
|
|
|
183
|
+ }
|
|
|
184
|
+ }, function (data) {
|
|
|
185
|
+ console.log(data);
|
|
|
186
|
+ });
|
|
|
187
|
+ } else if (lylx != null && lylx == 1) {
|
|
|
188
|
+ $scope.search = {houseId: houseId, wareId: wareId};
|
|
|
189
|
+ productService.getNumberList(null, null, $scope.search).then(function (data) {
|
|
|
190
|
+ //如果从分仓保管账查找到数据就取出赋值到对应的数据 否则清空上次的数据
|
|
|
191
|
+ if (typeof(data.list[0]) != "undefined" && data.list.length > 0) {
|
|
|
192
|
+ //粮食品种
|
|
|
193
|
+ $scope.waterCheck.lspz = parseInt(data.list[0].lypz);
|
|
|
194
|
+ }
|
|
|
195
|
+ }, function (data) {
|
|
|
196
|
+ console.log(data);
|
|
|
197
|
+ });
|
|
|
198
|
+ }
|
|
134
|
199
|
}
|
|
135
|
|
- },function(data){
|
|
136
|
|
- console.log(data);
|
|
137
|
|
- });
|
|
138
|
|
- };
|
|
|
200
|
+ }
|
|
139
|
201
|
|
|
140
|
|
- $scope.edit();
|
|
141
|
|
-
|
|
142
|
|
- // 货位列表
|
|
143
|
|
- $scope.loadWare = function(houseId) {
|
|
144
|
|
- if (null != houseId && houseId != "") {
|
|
145
|
|
- warehouseService.getStorehouse($rootScope.orgInfo.orgId, houseId, "0").then(function(data){
|
|
146
|
|
- $scope.warelist = data.wareList; //下拉列表数据
|
|
147
|
|
- },function (data) {
|
|
148
|
|
- console.log(data);
|
|
149
|
|
- });
|
|
150
|
|
- } else {
|
|
151
|
|
- $scope.warelist = [];
|
|
152
|
|
- }
|
|
153
|
|
- }
|
|
|
202
|
+ // 新增一行
|
|
|
203
|
+ $scope.addEducation = function (zId, typeId) {
|
|
|
204
|
+ var i;
|
|
|
205
|
+ if (typeId === 1) {
|
|
|
206
|
+ i = $scope.gdd_list.length;
|
|
|
207
|
+ if (null == $scope.gdd_list[i - 1].qy) {
|
|
|
208
|
+ alert("请先录入空行!");
|
|
|
209
|
+ return;
|
|
|
210
|
+ }
|
|
|
211
|
+ $scope.gdd_list.push({zId: zId});
|
|
|
212
|
+ } else if (typeId === 2) {
|
|
|
213
|
+ i = $scope.jdd_list.length;
|
|
|
214
|
+ if (null == $scope.jdd_list[i - 1].qy) {
|
|
|
215
|
+ alert("请先录入空行!");
|
|
|
216
|
+ return;
|
|
|
217
|
+ }
|
|
|
218
|
+ $scope.jdd_list.push({zId: zId});
|
|
|
219
|
+ }
|
|
|
220
|
+ }
|
|
154
|
221
|
|
|
155
|
|
- //通过仓房和货位获取出入库粮食品种
|
|
156
|
|
- $scope.getCrkLspz = function() {
|
|
157
|
|
- var houseId = $scope.waterCheck.houseId;
|
|
158
|
|
- var wareId = $scope.waterCheck.wareId;
|
|
159
|
|
- if (null != houseId && null != wareId) {
|
|
160
|
|
- var datatype = $rootScope.storehouseObj[houseId].datatype;
|
|
161
|
|
- var lylx;
|
|
162
|
|
- if (datatype == "0") {//粮仓
|
|
163
|
|
- lylx = $rootScope.wares[wareId].lylx;
|
|
164
|
|
- } else if (datatype == "1") {//油罐
|
|
165
|
|
- lylx = $rootScope.tankObj[houseId].lylx;
|
|
|
222
|
+ // 删除一行
|
|
|
223
|
+ $scope.delRow = function (typeId, obj) {
|
|
|
224
|
+ var index;
|
|
|
225
|
+ if (typeId === 1) {
|
|
|
226
|
+ if ($scope.gdd_list.length <= 1) {
|
|
|
227
|
+ alert("至少要有一条固定点检验信息!");
|
|
|
228
|
+ return;
|
|
|
229
|
+ }
|
|
|
230
|
+ // 如果有ID,说明当前数据已经是存在于数据库的,那么要郑重删除
|
|
|
231
|
+ if (obj.id != undefined) {
|
|
|
232
|
+ if (!confirm("当前数据已经存在于系统中,确定要删除吗?")) {
|
|
|
233
|
+ return;
|
|
|
234
|
+ }
|
|
|
235
|
+ $scope.deleteEdu(obj.id, typeId);
|
|
|
236
|
+ }
|
|
|
237
|
+ index = $scope.gdd_list.indexOf(obj);
|
|
|
238
|
+ $scope.gdd_list.splice(index, 1);
|
|
166
|
239
|
}
|
|
167
|
|
-
|
|
168
|
|
- if (lylx != null && lylx == 0) {
|
|
169
|
|
- var kcswStr = {ch:houseId, hwh: wareId, unitid:$rootScope.orgInfo.orgId};
|
|
170
|
|
- kcswService.getPageInfo(null, null, kcswStr, " ModifyDate desc ").then(function(data){
|
|
171
|
|
- if (data.list != null && data.list.length > 0) {
|
|
172
|
|
- //粮食品种
|
|
173
|
|
- $scope.waterCheck.lspz = parseInt(data.list[0].pz);
|
|
174
|
|
- } else {
|
|
175
|
|
- $scope.waterCheck.lspz = null;
|
|
176
|
|
- }
|
|
177
|
|
- },function (data) {
|
|
178
|
|
- console.log(data);
|
|
179
|
|
- });
|
|
180
|
|
- } else if (lylx != null && lylx == 1) {
|
|
181
|
|
- $scope.search = {houseId:houseId, wareId:wareId};
|
|
182
|
|
- productService.getNumberList(null, null, $scope.search).then(function(data){
|
|
183
|
|
- //如果从分仓保管账查找到数据就取出赋值到对应的数据 否则清空上次的数据
|
|
184
|
|
- if (typeof(data.list[0]) != "undefined" && data.list.length > 0 ) {
|
|
185
|
|
- //粮食品种
|
|
186
|
|
- $scope.waterCheck.lspz = parseInt(data.list[0].lypz);
|
|
|
240
|
+ if (typeId === 2) {
|
|
|
241
|
+ if ($scope.jdd_list.length <= 1) {
|
|
|
242
|
+ alert("至少要有一条机动点检验信息!");
|
|
|
243
|
+ return;
|
|
|
244
|
+ }
|
|
|
245
|
+ // 如果有ID,说明当前数据已经是存在于数据库的,那么要郑重删除
|
|
|
246
|
+ if (obj.id != undefined) {
|
|
|
247
|
+ if (!confirm("当前数据已经存在于系统中,确定要删除吗?")) {
|
|
|
248
|
+ return;
|
|
187
|
249
|
}
|
|
188
|
|
- },function(data){
|
|
189
|
|
- console.log(data);
|
|
190
|
|
- });
|
|
|
250
|
+ $scope.deleteEdu(obj.id, typeId);
|
|
|
251
|
+ }
|
|
|
252
|
+ index = $scope.jdd_list.indexOf(obj);
|
|
|
253
|
+ $scope.jdd_list.splice(index, 1);
|
|
191
|
254
|
}
|
|
192
|
|
- }
|
|
193
|
|
- }
|
|
|
255
|
+ }
|
|
194
|
256
|
|
|
195
|
|
- // 新增一行
|
|
196
|
|
- $scope.addEducation = function(zId,typeId) {
|
|
197
|
|
- var i;
|
|
198
|
|
- if (typeId === 1) {
|
|
199
|
|
- i = $scope.gdd_list.length;
|
|
200
|
|
- if (null == $scope.gdd_list[i-1].qy) {
|
|
201
|
|
- alert("请先录入空行!");
|
|
202
|
|
- return;
|
|
203
|
|
- }
|
|
204
|
|
- $scope.gdd_list.push({zId:zId});
|
|
205
|
|
- } else if (typeId === 2) {
|
|
206
|
|
- i = $scope.jdd_list.length;
|
|
207
|
|
- if (null == $scope.jdd_list[i-1].qy) {
|
|
208
|
|
- alert("请先录入空行!");
|
|
209
|
|
- return;
|
|
210
|
|
- }
|
|
211
|
|
- $scope.jdd_list.push({zId:zId});
|
|
212
|
|
- }
|
|
213
|
|
- }
|
|
|
257
|
+ $scope.deleteEdu = function (id, dataType) {
|
|
|
258
|
+ // 提交
|
|
|
259
|
+ waterCheckService.removeEdu(id, dataType).then(function (data) {
|
|
|
260
|
+ if (data.status == 'success') {
|
|
|
261
|
+ alert("删除成功!");
|
|
|
262
|
+ } else {
|
|
|
263
|
+ alert("删除失败!");
|
|
|
264
|
+ }
|
|
|
265
|
+ }, function (data) {
|
|
|
266
|
+ console.log(data);
|
|
|
267
|
+ });
|
|
|
268
|
+ }
|
|
214
|
269
|
|
|
215
|
|
- // 删除一行
|
|
216
|
|
- $scope.delRow = function(typeId, obj) {
|
|
217
|
|
- var index;
|
|
218
|
|
- if (typeId === 1) {
|
|
219
|
|
- if ($scope.gdd_list.length <=1 ) {
|
|
220
|
|
- alert("至少要有一条固定点检验信息!");
|
|
221
|
|
- return;
|
|
222
|
|
- }
|
|
223
|
|
- // 如果有ID,说明当前数据已经是存在于数据库的,那么要郑重删除
|
|
224
|
|
- if (obj.id != undefined) {
|
|
225
|
|
- if (!confirm("当前数据已经存在于系统中,确定要删除吗?")) {
|
|
226
|
|
- return;
|
|
227
|
|
- }
|
|
228
|
|
- $scope.deleteEdu(obj.id, typeId);
|
|
229
|
|
- }
|
|
230
|
|
- index = $scope.gdd_list.indexOf(obj);
|
|
231
|
|
- $scope.gdd_list.splice(index, 1);
|
|
232
|
|
- }
|
|
233
|
|
- if (typeId === 2) {
|
|
234
|
|
- if ($scope.jdd_list.length <=1 ) {
|
|
235
|
|
- alert("至少要有一条机动点检验信息!");
|
|
236
|
|
- return;
|
|
237
|
|
- }
|
|
238
|
|
- // 如果有ID,说明当前数据已经是存在于数据库的,那么要郑重删除
|
|
239
|
|
- if (obj.id != undefined) {
|
|
240
|
|
- if (!confirm("当前数据已经存在于系统中,确定要删除吗?")) {
|
|
241
|
|
- return;
|
|
242
|
|
- }
|
|
243
|
|
- $scope.deleteEdu(obj.id, typeId);
|
|
244
|
|
- }
|
|
245
|
|
- index = $scope.jdd_list.indexOf(obj);
|
|
246
|
|
- $scope.jdd_list.splice(index, 1);
|
|
247
|
|
- }
|
|
248
|
|
- }
|
|
249
|
|
-
|
|
250
|
|
- $scope.deleteEdu = function(id, dataType) {
|
|
251
|
|
- // 提交
|
|
252
|
|
- waterCheckService.removeEdu(id, dataType).then(function(data){
|
|
253
|
|
- if (data.status == 'success') {
|
|
254
|
|
- alert("删除成功!");
|
|
255
|
|
- } else {
|
|
256
|
|
- alert("删除失败!");
|
|
|
270
|
+ //计算平均水分
|
|
|
271
|
+ $scope.getAvgWarter = function (i) {
|
|
|
272
|
+ $scope.gdd_list[i].avgVal = "";
|
|
|
273
|
+ i = parseInt(i);
|
|
|
274
|
+ var zy_s = 0;
|
|
|
275
|
+ if ($scope.gdd_list[i].zyS != null && $scope.gdd_list[i].zyS != "NaN" && $scope.gdd_list[i].zyS != "") {
|
|
|
276
|
+ //zy_s = parseFloat($scope.gdd_list[i].zyS);
|
|
|
277
|
+ //$scope.gdd_list[i].zyS = commonUtilService.getMath1(zy_s);
|
|
|
278
|
+ zy_s = $scope.gdd_list[i].zyS;
|
|
|
279
|
+ }
|
|
|
280
|
+ var zy_z = 0;
|
|
|
281
|
+ if ($scope.gdd_list[i].zyZ != null && $scope.gdd_list[i].zyZ != "NaN" && $scope.gdd_list[i].zyZ != "") {
|
|
|
282
|
+ zy_z = $scope.gdd_list[i].zyZ;
|
|
|
283
|
+ }
|
|
|
284
|
+ var zy_x = 0;
|
|
|
285
|
+ if ($scope.gdd_list[i].zyX != null && $scope.gdd_list[i].zyX != "NaN" && $scope.gdd_list[i].zyX != "") {
|
|
|
286
|
+ zy_x = $scope.gdd_list[i].zyX;
|
|
|
287
|
+ }
|
|
|
288
|
+ var dn_s = 0;
|
|
|
289
|
+ if ($scope.gdd_list[i].dnS != null && $scope.gdd_list[i].dnS != "NaN" && $scope.gdd_list[i].dnS != "") {
|
|
|
290
|
+ dn_s = $scope.gdd_list[i].dnS;
|
|
|
291
|
+ }
|
|
|
292
|
+ var dn_z = 0;
|
|
|
293
|
+ if ($scope.gdd_list[i].dnZ != null && $scope.gdd_list[i].dnZ != "NaN" && $scope.gdd_list[i].dnZ != "") {
|
|
|
294
|
+ dn_z = $scope.gdd_list[i].dnZ;
|
|
|
295
|
+ }
|
|
|
296
|
+ var dn_x = 0;
|
|
|
297
|
+ if ($scope.gdd_list[i].dnX != null && $scope.gdd_list[i].dnX != "NaN" && $scope.gdd_list[i].dnX != "") {
|
|
|
298
|
+ dn_x = $scope.gdd_list[i].dnX;
|
|
|
299
|
+ }
|
|
|
300
|
+ var db_s = 0;
|
|
|
301
|
+ if ($scope.gdd_list[i].dbS != null && $scope.gdd_list[i].dbS != "NaN" && $scope.gdd_list[i].dbS != "") {
|
|
|
302
|
+ db_s = $scope.gdd_list[i].dbS;
|
|
|
303
|
+ }
|
|
|
304
|
+ var db_z = 0;
|
|
|
305
|
+ if ($scope.gdd_list[i].dbZ != null && $scope.gdd_list[i].dbZ != "NaN" && $scope.gdd_list[i].dbZ != "") {
|
|
|
306
|
+ db_z = $scope.gdd_list[i].dbZ;
|
|
|
307
|
+ }
|
|
|
308
|
+ var db_x = 0;
|
|
|
309
|
+ if ($scope.gdd_list[i].dbX != null && $scope.gdd_list[i].dbX != "NaN" && $scope.gdd_list[i].dbX != "") {
|
|
|
310
|
+ db_x = $scope.gdd_list[i].dbX;
|
|
|
311
|
+ }
|
|
|
312
|
+ var xn_s = 0;
|
|
|
313
|
+ if ($scope.gdd_list[i].xnS != null && $scope.gdd_list[i].xnS != "NaN" && $scope.gdd_list[i].xnS != "") {
|
|
|
314
|
+ xn_s = $scope.gdd_list[i].xnS;
|
|
|
315
|
+ }
|
|
|
316
|
+ var xn_z = 0;
|
|
|
317
|
+ if ($scope.gdd_list[i].xnZ != null && $scope.gdd_list[i].xnZ != "NaN" && $scope.gdd_list[i].xnZ != "") {
|
|
|
318
|
+ xn_z = $scope.gdd_list[i].xnZ;
|
|
257
|
319
|
}
|
|
258
|
|
- },function(data){
|
|
259
|
|
- console.log(data);
|
|
260
|
|
- });
|
|
261
|
|
- }
|
|
262
|
|
-
|
|
263
|
|
- //计算平均水分
|
|
264
|
|
- $scope.getAvgWarter = function(i) {
|
|
265
|
|
- $scope.gdd_list[i].avgVal = "";
|
|
266
|
|
- i = parseInt(i);
|
|
267
|
|
- var zy_s = 0;
|
|
268
|
|
- if ($scope.gdd_list[i].zyS != null && $scope.gdd_list[i].zyS != "NaN" && $scope.gdd_list[i].zyS != "") {
|
|
269
|
|
- //zy_s = parseFloat($scope.gdd_list[i].zyS);
|
|
270
|
|
- //$scope.gdd_list[i].zyS = commonUtilService.getMath1(zy_s);
|
|
271
|
|
- zy_s = $scope.gdd_list[i].zyS;
|
|
272
|
|
- }
|
|
273
|
|
- var zy_z = 0;
|
|
274
|
|
- if ($scope.gdd_list[i].zyZ != null && $scope.gdd_list[i].zyZ != "NaN" && $scope.gdd_list[i].zyZ != "") {
|
|
275
|
|
- zy_z = $scope.gdd_list[i].zyZ;
|
|
276
|
|
- }
|
|
277
|
|
- var zy_x = 0;
|
|
278
|
|
- if ($scope.gdd_list[i].zyX != null && $scope.gdd_list[i].zyX != "NaN" && $scope.gdd_list[i].zyX != "") {
|
|
279
|
|
- zy_x = $scope.gdd_list[i].zyX;
|
|
280
|
|
- }
|
|
281
|
|
- var dn_s = 0;
|
|
282
|
|
- if ($scope.gdd_list[i].dnS != null && $scope.gdd_list[i].dnS != "NaN" && $scope.gdd_list[i].dnS != "") {
|
|
283
|
|
- dn_s = $scope.gdd_list[i].dnS;
|
|
284
|
|
- }
|
|
285
|
|
- var dn_z = 0;
|
|
286
|
|
- if ($scope.gdd_list[i].dnZ != null && $scope.gdd_list[i].dnZ != "NaN" && $scope.gdd_list[i].dnZ != "") {
|
|
287
|
|
- dn_z = $scope.gdd_list[i].dnZ;
|
|
288
|
|
- }
|
|
289
|
|
- var dn_x = 0;
|
|
290
|
|
- if ($scope.gdd_list[i].dnX != null && $scope.gdd_list[i].dnX != "NaN" && $scope.gdd_list[i].dnX != "") {
|
|
291
|
|
- dn_x = $scope.gdd_list[i].dnX;
|
|
292
|
|
- }
|
|
293
|
|
- var db_s = 0;
|
|
294
|
|
- if ($scope.gdd_list[i].dbS != null && $scope.gdd_list[i].dbS != "NaN" && $scope.gdd_list[i].dbS != "") {
|
|
295
|
|
- db_s = $scope.gdd_list[i].dbS;
|
|
296
|
|
- }
|
|
297
|
|
- var db_z = 0;
|
|
298
|
|
- if ($scope.gdd_list[i].dbZ != null && $scope.gdd_list[i].dbZ != "NaN" && $scope.gdd_list[i].dbZ != "") {
|
|
299
|
|
- db_z = $scope.gdd_list[i].dbZ;
|
|
300
|
|
- }
|
|
301
|
|
- var db_x = 0;
|
|
302
|
|
- if ($scope.gdd_list[i].dbX != null && $scope.gdd_list[i].dbX != "NaN" && $scope.gdd_list[i].dbX != "") {
|
|
303
|
|
- db_x = $scope.gdd_list[i].dbX;
|
|
304
|
|
- }
|
|
305
|
|
- var xn_s = 0;
|
|
306
|
|
- if ($scope.gdd_list[i].xnS != null && $scope.gdd_list[i].xnS != "NaN" && $scope.gdd_list[i].xnS != "") {
|
|
307
|
|
- xn_s = $scope.gdd_list[i].xnS;
|
|
308
|
|
- }
|
|
309
|
|
- var xn_z = 0;
|
|
310
|
|
- if ($scope.gdd_list[i].xnZ != null && $scope.gdd_list[i].xnZ != "NaN" && $scope.gdd_list[i].xnZ != "") {
|
|
311
|
|
- xn_z = $scope.gdd_list[i].xnZ;
|
|
312
|
|
- }
|
|
313
|
|
- var xn_x = 0;
|
|
314
|
|
- if ($scope.gdd_list[i].xnX != null && $scope.gdd_list[i].xnX != "NaN" && $scope.gdd_list[i].xnX != "") {
|
|
315
|
|
- xn_x = $scope.gdd_list[i].xnX;
|
|
316
|
|
- }
|
|
317
|
|
- var xb_s = 0;
|
|
318
|
|
- if ($scope.gdd_list[i].xbS != null && $scope.gdd_list[i].xbS != "NaN" && $scope.gdd_list[i].xbS != "") {
|
|
319
|
|
- xb_s = $scope.gdd_list[i].xbS;
|
|
320
|
|
- }
|
|
321
|
|
- var xb_z = 0;
|
|
322
|
|
- if ($scope.gdd_list[i].xbZ != null && $scope.gdd_list[i].xbZ != "NaN" && $scope.gdd_list[i].xbZ != "") {
|
|
323
|
|
- xb_z = $scope.gdd_list[i].xbZ;
|
|
324
|
|
- }
|
|
325
|
|
- var xb_x = 0;
|
|
326
|
|
- if ($scope.gdd_list[i].xbX != null && $scope.gdd_list[i].xbX != "NaN" && $scope.gdd_list[i].xbX != "") {
|
|
327
|
|
- xb_x = $scope.gdd_list[i].xbX;
|
|
328
|
|
- }
|
|
329
|
|
- //计算15个数的平均值,取1位小数
|
|
330
|
|
- var sum_val = parseFloat(zy_s)+parseFloat(zy_z)+parseFloat(zy_x)+parseFloat(dn_s)+parseFloat(dn_z)+parseFloat(dn_x)+parseFloat(db_s)+parseFloat(db_z)+parseFloat(db_x)+parseFloat(xn_s)+parseFloat(xn_z)+parseFloat(xn_x)+parseFloat(xb_s)+parseFloat(xb_z)+parseFloat(xb_x);
|
|
331
|
|
- var avg_val = parseFloat(sum_val)/15;
|
|
332
|
|
- //avg_val = Number(avg_val.toString().match(/^\d+(?:\.\d{0,1})?/));
|
|
333
|
|
- $scope.gdd_list[i].avgVal = commonUtilService.getMath1(avg_val);
|
|
334
|
|
- }
|
|
335
|
|
-
|
|
336
|
|
- $scope.dataCheck = function() {
|
|
337
|
|
- for (var i = 0; i < $scope.gdd_list.length; i++) {
|
|
338
|
|
- if ($scope.gdd_list[i].zyS != null && $scope.gdd_list[i].zyS != "NaN" && $scope.gdd_list[i].zyS != "") {
|
|
339
|
|
- $scope.gdd_list[i].zyS = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].zyS));
|
|
340
|
|
- }
|
|
341
|
|
- if ($scope.gdd_list[i].zyZ != null && $scope.gdd_list[i].zyZ != "NaN" && $scope.gdd_list[i].zyZ != "") {
|
|
342
|
|
- $scope.gdd_list[i].zyZ = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].zyZ));
|
|
343
|
|
- }
|
|
344
|
|
- if ($scope.gdd_list[i].zyX != null && $scope.gdd_list[i].zyX != "NaN" && $scope.gdd_list[i].zyX != "") {
|
|
345
|
|
- $scope.gdd_list[i].zyX = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].zyX));
|
|
346
|
|
- }
|
|
347
|
|
- if ($scope.gdd_list[i].dnS != null && $scope.gdd_list[i].dnS != "NaN" && $scope.gdd_list[i].dnS != "") {
|
|
348
|
|
- $scope.gdd_list[i].dnS = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].dnS));
|
|
349
|
|
- }
|
|
350
|
|
- if ($scope.gdd_list[i].dnZ != null && $scope.gdd_list[i].dnZ != "NaN" && $scope.gdd_list[i].dnZ != "") {
|
|
351
|
|
- $scope.gdd_list[i].dnZ = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].dnZ));
|
|
352
|
|
- }
|
|
353
|
|
- if ($scope.gdd_list[i].dnX != null && $scope.gdd_list[i].dnX != "NaN" && $scope.gdd_list[i].dnX != "") {
|
|
354
|
|
- $scope.gdd_list[i].dnX = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].dnX));
|
|
355
|
|
- }
|
|
356
|
|
- if ($scope.gdd_list[i].dbS != null && $scope.gdd_list[i].dbS != "NaN" && $scope.gdd_list[i].dbS != "") {
|
|
357
|
|
- $scope.gdd_list[i].dbS = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].dbS));
|
|
358
|
|
- }
|
|
359
|
|
- if ($scope.gdd_list[i].dbZ != null && $scope.gdd_list[i].dbZ != "NaN" && $scope.gdd_list[i].dbZ != "") {
|
|
360
|
|
- $scope.gdd_list[i].dbZ = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].dbZ));
|
|
361
|
|
- }
|
|
362
|
|
- if ($scope.gdd_list[i].dbX != null && $scope.gdd_list[i].dbX != "NaN" && $scope.gdd_list[i].dbX != "") {
|
|
363
|
|
- $scope.gdd_list[i].dbX = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].dbX));
|
|
364
|
|
- }
|
|
365
|
|
- if ($scope.gdd_list[i].xnS != null && $scope.gdd_list[i].xnS != "NaN" && $scope.gdd_list[i].xnS != "") {
|
|
366
|
|
- $scope.gdd_list[i].xnS = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].xnS));
|
|
367
|
|
- }
|
|
368
|
|
- if ($scope.gdd_list[i].xnZ != null && $scope.gdd_list[i].xnZ != "NaN" && $scope.gdd_list[i].xnZ != "") {
|
|
369
|
|
- $scope.gdd_list[i].xnZ = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].xnZ));
|
|
370
|
|
- }
|
|
371
|
|
- if ($scope.gdd_list[i].xnX != null && $scope.gdd_list[i].xnX != "NaN" && $scope.gdd_list[i].xnX != "") {
|
|
372
|
|
- $scope.gdd_list[i].xnX = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].xnX));
|
|
373
|
|
- }
|
|
374
|
|
- if ($scope.gdd_list[i].xbS != null && $scope.gdd_list[i].xbS != "NaN" && $scope.gdd_list[i].xbS != "") {
|
|
375
|
|
- $scope.gdd_list[i].xbS = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].xbS));
|
|
376
|
|
- }
|
|
377
|
|
- if ($scope.gdd_list[i].xbZ != null && $scope.gdd_list[i].xbZ != "NaN" && $scope.gdd_list[i].xbZ != "") {
|
|
378
|
|
- $scope.gdd_list[i].xbZ = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].xbZ));
|
|
379
|
|
- }
|
|
380
|
|
- if ($scope.gdd_list[i].xbX != null && $scope.gdd_list[i].xbX != "NaN" && $scope.gdd_list[i].xbX != "") {
|
|
381
|
|
- $scope.gdd_list[i].xbX = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].xbX));
|
|
382
|
|
- }
|
|
383
|
|
- }
|
|
384
|
|
- for (var i = 0; i < $scope.jdd_list.length; i++) {
|
|
385
|
|
- if ($scope.jdd_list[i].bwAVal != null && $scope.jdd_list[i].bwAVal != "NaN" && $scope.jdd_list[i].bwAVal != "") {
|
|
386
|
|
- $scope.jdd_list[i].bwAVal = commonUtilService.getMath1(parseFloat($scope.jdd_list[i].bwAVal));
|
|
387
|
|
- }
|
|
388
|
|
- if ($scope.jdd_list[i].bwBVal != null && $scope.jdd_list[i].bwBVal != "NaN" && $scope.jdd_list[i].bwBVal != "") {
|
|
389
|
|
- $scope.jdd_list[i].bwBVal = commonUtilService.getMath1(parseFloat($scope.jdd_list[i].bwBVal));
|
|
390
|
|
- }
|
|
391
|
|
- if ($scope.jdd_list[i].bwCVal != null && $scope.jdd_list[i].bwCVal != "NaN" && $scope.jdd_list[i].bwCVal != "") {
|
|
392
|
|
- $scope.jdd_list[i].bwCVal = commonUtilService.getMath1(parseFloat($scope.jdd_list[i].bwCVal));
|
|
393
|
|
- }
|
|
394
|
|
- if ($scope.jdd_list[i].bwDVal != null && $scope.jdd_list[i].bwDVal != "NaN" && $scope.jdd_list[i].bwDVal != "") {
|
|
395
|
|
- $scope.jdd_list[i].bwDVal = commonUtilService.getMath1(parseFloat($scope.jdd_list[i].bwDVal));
|
|
396
|
|
- }
|
|
397
|
|
- if ($scope.jdd_list[i].bwEVal != null && $scope.jdd_list[i].bwEVal != "NaN" && $scope.jdd_list[i].bwEVal != "") {
|
|
398
|
|
- $scope.jdd_list[i].bwEVal = commonUtilService.getMath1(parseFloat($scope.jdd_list[i].bwEVal));
|
|
399
|
|
- }
|
|
400
|
|
- }
|
|
401
|
|
- }
|
|
|
320
|
+ var xn_x = 0;
|
|
|
321
|
+ if ($scope.gdd_list[i].xnX != null && $scope.gdd_list[i].xnX != "NaN" && $scope.gdd_list[i].xnX != "") {
|
|
|
322
|
+ xn_x = $scope.gdd_list[i].xnX;
|
|
|
323
|
+ }
|
|
|
324
|
+ var xb_s = 0;
|
|
|
325
|
+ if ($scope.gdd_list[i].xbS != null && $scope.gdd_list[i].xbS != "NaN" && $scope.gdd_list[i].xbS != "") {
|
|
|
326
|
+ xb_s = $scope.gdd_list[i].xbS;
|
|
|
327
|
+ }
|
|
|
328
|
+ var xb_z = 0;
|
|
|
329
|
+ if ($scope.gdd_list[i].xbZ != null && $scope.gdd_list[i].xbZ != "NaN" && $scope.gdd_list[i].xbZ != "") {
|
|
|
330
|
+ xb_z = $scope.gdd_list[i].xbZ;
|
|
|
331
|
+ }
|
|
|
332
|
+ var xb_x = 0;
|
|
|
333
|
+ if ($scope.gdd_list[i].xbX != null && $scope.gdd_list[i].xbX != "NaN" && $scope.gdd_list[i].xbX != "") {
|
|
|
334
|
+ xb_x = $scope.gdd_list[i].xbX;
|
|
|
335
|
+ }
|
|
|
336
|
+ //计算15个数的平均值,取1位小数
|
|
|
337
|
+ var sum_val = parseFloat(zy_s) + parseFloat(zy_z) + parseFloat(zy_x) + parseFloat(dn_s) + parseFloat(dn_z) + parseFloat(dn_x) + parseFloat(db_s) + parseFloat(db_z) + parseFloat(db_x) + parseFloat(xn_s) + parseFloat(xn_z) + parseFloat(xn_x) + parseFloat(xb_s) + parseFloat(xb_z) + parseFloat(xb_x);
|
|
|
338
|
+ var avg_val = parseFloat(sum_val) / 15;
|
|
|
339
|
+ //avg_val = Number(avg_val.toString().match(/^\d+(?:\.\d{0,1})?/));
|
|
|
340
|
+ $scope.gdd_list[i].avgVal = commonUtilService.getMath1(avg_val);
|
|
|
341
|
+ }
|
|
402
|
342
|
|
|
403
|
|
- // 提交表单
|
|
404
|
|
- var validator = $("#watercheck-form").validate();
|
|
405
|
|
- $scope.save = function(dataStatus) {
|
|
|
343
|
+ $scope.dataCheck = function () {
|
|
|
344
|
+ for (var i = 0; i < $scope.gdd_list.length; i++) {
|
|
|
345
|
+ if ($scope.gdd_list[i].zyS != null && $scope.gdd_list[i].zyS != "NaN" && $scope.gdd_list[i].zyS != "") {
|
|
|
346
|
+ $scope.gdd_list[i].zyS = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].zyS));
|
|
|
347
|
+ }
|
|
|
348
|
+ if ($scope.gdd_list[i].zyZ != null && $scope.gdd_list[i].zyZ != "NaN" && $scope.gdd_list[i].zyZ != "") {
|
|
|
349
|
+ $scope.gdd_list[i].zyZ = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].zyZ));
|
|
|
350
|
+ }
|
|
|
351
|
+ if ($scope.gdd_list[i].zyX != null && $scope.gdd_list[i].zyX != "NaN" && $scope.gdd_list[i].zyX != "") {
|
|
|
352
|
+ $scope.gdd_list[i].zyX = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].zyX));
|
|
|
353
|
+ }
|
|
|
354
|
+ if ($scope.gdd_list[i].dnS != null && $scope.gdd_list[i].dnS != "NaN" && $scope.gdd_list[i].dnS != "") {
|
|
|
355
|
+ $scope.gdd_list[i].dnS = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].dnS));
|
|
|
356
|
+ }
|
|
|
357
|
+ if ($scope.gdd_list[i].dnZ != null && $scope.gdd_list[i].dnZ != "NaN" && $scope.gdd_list[i].dnZ != "") {
|
|
|
358
|
+ $scope.gdd_list[i].dnZ = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].dnZ));
|
|
|
359
|
+ }
|
|
|
360
|
+ if ($scope.gdd_list[i].dnX != null && $scope.gdd_list[i].dnX != "NaN" && $scope.gdd_list[i].dnX != "") {
|
|
|
361
|
+ $scope.gdd_list[i].dnX = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].dnX));
|
|
|
362
|
+ }
|
|
|
363
|
+ if ($scope.gdd_list[i].dbS != null && $scope.gdd_list[i].dbS != "NaN" && $scope.gdd_list[i].dbS != "") {
|
|
|
364
|
+ $scope.gdd_list[i].dbS = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].dbS));
|
|
|
365
|
+ }
|
|
|
366
|
+ if ($scope.gdd_list[i].dbZ != null && $scope.gdd_list[i].dbZ != "NaN" && $scope.gdd_list[i].dbZ != "") {
|
|
|
367
|
+ $scope.gdd_list[i].dbZ = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].dbZ));
|
|
|
368
|
+ }
|
|
|
369
|
+ if ($scope.gdd_list[i].dbX != null && $scope.gdd_list[i].dbX != "NaN" && $scope.gdd_list[i].dbX != "") {
|
|
|
370
|
+ $scope.gdd_list[i].dbX = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].dbX));
|
|
|
371
|
+ }
|
|
|
372
|
+ if ($scope.gdd_list[i].xnS != null && $scope.gdd_list[i].xnS != "NaN" && $scope.gdd_list[i].xnS != "") {
|
|
|
373
|
+ $scope.gdd_list[i].xnS = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].xnS));
|
|
|
374
|
+ }
|
|
|
375
|
+ if ($scope.gdd_list[i].xnZ != null && $scope.gdd_list[i].xnZ != "NaN" && $scope.gdd_list[i].xnZ != "") {
|
|
|
376
|
+ $scope.gdd_list[i].xnZ = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].xnZ));
|
|
|
377
|
+ }
|
|
|
378
|
+ if ($scope.gdd_list[i].xnX != null && $scope.gdd_list[i].xnX != "NaN" && $scope.gdd_list[i].xnX != "") {
|
|
|
379
|
+ $scope.gdd_list[i].xnX = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].xnX));
|
|
|
380
|
+ }
|
|
|
381
|
+ if ($scope.gdd_list[i].xbS != null && $scope.gdd_list[i].xbS != "NaN" && $scope.gdd_list[i].xbS != "") {
|
|
|
382
|
+ $scope.gdd_list[i].xbS = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].xbS));
|
|
|
383
|
+ }
|
|
|
384
|
+ if ($scope.gdd_list[i].xbZ != null && $scope.gdd_list[i].xbZ != "NaN" && $scope.gdd_list[i].xbZ != "") {
|
|
|
385
|
+ $scope.gdd_list[i].xbZ = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].xbZ));
|
|
|
386
|
+ }
|
|
|
387
|
+ if ($scope.gdd_list[i].xbX != null && $scope.gdd_list[i].xbX != "NaN" && $scope.gdd_list[i].xbX != "") {
|
|
|
388
|
+ $scope.gdd_list[i].xbX = commonUtilService.getMath1(parseFloat($scope.gdd_list[i].xbX));
|
|
|
389
|
+ }
|
|
|
390
|
+ }
|
|
|
391
|
+ for (var i = 0; i < $scope.jdd_list.length; i++) {
|
|
|
392
|
+ if ($scope.jdd_list[i].bwAVal != null && $scope.jdd_list[i].bwAVal != "NaN" && $scope.jdd_list[i].bwAVal != "") {
|
|
|
393
|
+ $scope.jdd_list[i].bwAVal = commonUtilService.getMath1(parseFloat($scope.jdd_list[i].bwAVal));
|
|
|
394
|
+ }
|
|
|
395
|
+ if ($scope.jdd_list[i].bwBVal != null && $scope.jdd_list[i].bwBVal != "NaN" && $scope.jdd_list[i].bwBVal != "") {
|
|
|
396
|
+ $scope.jdd_list[i].bwBVal = commonUtilService.getMath1(parseFloat($scope.jdd_list[i].bwBVal));
|
|
|
397
|
+ }
|
|
|
398
|
+ if ($scope.jdd_list[i].bwCVal != null && $scope.jdd_list[i].bwCVal != "NaN" && $scope.jdd_list[i].bwCVal != "") {
|
|
|
399
|
+ $scope.jdd_list[i].bwCVal = commonUtilService.getMath1(parseFloat($scope.jdd_list[i].bwCVal));
|
|
|
400
|
+ }
|
|
|
401
|
+ if ($scope.jdd_list[i].bwDVal != null && $scope.jdd_list[i].bwDVal != "NaN" && $scope.jdd_list[i].bwDVal != "") {
|
|
|
402
|
+ $scope.jdd_list[i].bwDVal = commonUtilService.getMath1(parseFloat($scope.jdd_list[i].bwDVal));
|
|
|
403
|
+ }
|
|
|
404
|
+ if ($scope.jdd_list[i].bwEVal != null && $scope.jdd_list[i].bwEVal != "NaN" && $scope.jdd_list[i].bwEVal != "") {
|
|
|
405
|
+ $scope.jdd_list[i].bwEVal = commonUtilService.getMath1(parseFloat($scope.jdd_list[i].bwEVal));
|
|
|
406
|
+ }
|
|
|
407
|
+ }
|
|
|
408
|
+ }
|
|
406
|
409
|
|
|
407
|
|
- if (validator.form()) {
|
|
408
|
|
- $scope.waterCheck.hyDate = $("#hyDate").val();
|
|
409
|
|
- $scope.waterCheck.dataStatus = dataStatus;
|
|
410
|
|
- $scope.dataCheck();
|
|
411
|
|
- waterCheckService.save($scope.waterCheck, $scope.gdd_list, $scope.jdd_list).then(function(data){
|
|
412
|
|
- if (data.status == 'success') {
|
|
413
|
|
- alert("保存成功!");
|
|
414
|
|
- } else {
|
|
415
|
|
- alert("保存失败!");
|
|
416
|
|
- }
|
|
417
|
|
- $state.go("app.storage.qualitycheck.waterCheckList");
|
|
418
|
|
- },function(data){
|
|
419
|
|
- console.log(data);
|
|
420
|
|
- });
|
|
421
|
|
- }
|
|
422
|
|
- };
|
|
|
410
|
+ // 提交表单
|
|
|
411
|
+ var validator = $("#watercheck-form").validate();
|
|
|
412
|
+ $scope.save = function (dataStatus) {
|
|
423
|
413
|
|
|
424
|
|
- $scope.returnTop = function() {
|
|
425
|
|
- if ($rootScope.previousState_name != '') {
|
|
426
|
|
- $rootScope.back();
|
|
427
|
|
- } else {
|
|
428
|
|
- $state.go("app.storage.qualitycheck.waterCheckList");
|
|
|
414
|
+ if (validator.form()) {
|
|
|
415
|
+ $scope.waterCheck.hyDate = $("#hyDate").val();
|
|
|
416
|
+ $scope.waterCheck.dataStatus = dataStatus;
|
|
|
417
|
+ $scope.dataCheck();
|
|
|
418
|
+ waterCheckService.save($scope.waterCheck, $scope.gdd_list, $scope.jdd_list).then(function (data) {
|
|
|
419
|
+ if (data.status == 'success') {
|
|
|
420
|
+ alert("保存成功!");
|
|
|
421
|
+ } else {
|
|
|
422
|
+ alert("保存失败!");
|
|
|
423
|
+ }
|
|
|
424
|
+ $state.go("app.storage.qualitycheck.waterCheckList");
|
|
|
425
|
+ }, function (data) {
|
|
|
426
|
+ console.log(data);
|
|
|
427
|
+ });
|
|
|
428
|
+ }
|
|
|
429
|
+ };
|
|
|
430
|
+
|
|
|
431
|
+ $scope.returnTop = function () {
|
|
|
432
|
+ if ($rootScope.previousState_name != '') {
|
|
|
433
|
+ $rootScope.back();
|
|
|
434
|
+ } else {
|
|
|
435
|
+ $state.go("app.storage.qualitycheck.waterCheckList");
|
|
|
436
|
+ }
|
|
429
|
437
|
}
|
|
430
|
|
- }
|
|
431
|
438
|
|
|
432
|
|
- $scope.qy_list = [
|
|
433
|
|
- {key : 1, value : "1区"},
|
|
434
|
|
- {key : 2, value : "2区"},
|
|
435
|
|
- {key : 3, value : "3区"},
|
|
436
|
|
- {key : 4, value : "4区"},
|
|
437
|
|
- {key : 5, value : "5区"},
|
|
438
|
|
- {key : 6, value : "6区"},
|
|
439
|
|
- {key : 7, value : "7区"},
|
|
440
|
|
- {key : 8, value : "8区"},
|
|
441
|
|
- {key : 9, value : "9区"},
|
|
442
|
|
- {key : 10, value : "10区"},
|
|
443
|
|
- {key : 11, value : "11区"},
|
|
444
|
|
- {key : 12, value : "12区"},
|
|
445
|
|
- {key : 13, value : "13区"},
|
|
446
|
|
- {key : 14, value : "14区"},
|
|
447
|
|
- {key : 15, value : "15区"}
|
|
448
|
|
- ];
|
|
449
|
|
- $scope.safe_list = [
|
|
450
|
|
- {key : 1, value : "安全粮"},
|
|
451
|
|
- {key : 2, value : "半安全粮"},
|
|
452
|
|
- {key : 3, value : "危险粮"}
|
|
453
|
|
- ];
|
|
|
439
|
+ $scope.qy_list = [
|
|
|
440
|
+ {key: 1, value: "1区"},
|
|
|
441
|
+ {key: 2, value: "2区"},
|
|
|
442
|
+ {key: 3, value: "3区"},
|
|
|
443
|
+ {key: 4, value: "4区"},
|
|
|
444
|
+ {key: 5, value: "5区"},
|
|
|
445
|
+ {key: 6, value: "6区"},
|
|
|
446
|
+ {key: 7, value: "7区"},
|
|
|
447
|
+ {key: 8, value: "8区"},
|
|
|
448
|
+ {key: 9, value: "9区"},
|
|
|
449
|
+ {key: 10, value: "10区"},
|
|
|
450
|
+ {key: 11, value: "11区"},
|
|
|
451
|
+ {key: 12, value: "12区"},
|
|
|
452
|
+ {key: 13, value: "13区"},
|
|
|
453
|
+ {key: 14, value: "14区"},
|
|
|
454
|
+ {key: 15, value: "15区"}
|
|
|
455
|
+ ];
|
|
|
456
|
+ $scope.safe_list = [
|
|
|
457
|
+ {key: 1, value: "安全粮"},
|
|
|
458
|
+ {key: 2, value: "半安全粮"},
|
|
|
459
|
+ {key: 3, value: "危险粮"}
|
|
|
460
|
+ ];
|
|
454
|
461
|
|
|
455
|
|
- $scope.print = function () {
|
|
456
|
|
- $("#printing").printArea();
|
|
457
|
|
- }
|
|
|
462
|
+ $scope.print = function () {
|
|
|
463
|
+ $("#printing").printArea();
|
|
|
464
|
+ }
|
|
458
|
465
|
|
|
459
|
|
-});
|
|
|
466
|
+ });
|