ソースを参照

封仓确认单-性质转变效验

hanqingsong 1 年間 前
コミット
2dee629ad6

+ 37 - 15
src/main/resources/static/app/business/storageSealedConfirmation/controller/pageEditCtrl.js

@@ -63,10 +63,10 @@ angular.module('app.business').controller("pageEditCtrl", function ($scope, $htt
63 63
         $scope.sealedStorage.saveProcess.applyNameId = $rootScope.userInfo.userId;
64 64
         $scope.sealedStorage.saveProcess.applyName = $rootScope.userInfo.realName;
65 65
 
66
-        if(auditType === '2' && $scope.sealedStorage.auditState === 1) {
66
+        if (auditType === '2' && $scope.sealedStorage.auditState === 1) {
67 67
             $scope.sealedStorage.saveProcess.taskName = '员工提交';
68 68
             $scope.sealedStorage.saveProcess.applyResult = '待审批';
69
-            $scope.sealedStorage.saveProcess.applyContent = $rootScope.userInfo.realName +  '提交';
69
+            $scope.sealedStorage.saveProcess.applyContent = $rootScope.userInfo.realName + '提交';
70 70
             $scope.sealedStorage.auditState = auditType;
71 71
         } else if (auditType === '3') {
72 72
             $scope.sealedStorage.saveProcess.taskName = '驳回';
@@ -104,30 +104,52 @@ angular.module('app.business').controller("pageEditCtrl", function ($scope, $htt
104 104
     $scope.selectNotSealedStorageList();
105 105
 
106 106
     // 货位列表
107
-    $scope.loadWare = function() {
107
+    $scope.loadWare = function () {
108 108
         // datatype 0:仓房,1:油罐
109
-        console.log($rootScope.storehouseObj[$scope.sealedStorage.houseId].datatype)
109
+        // console.log($rootScope.storehouseObj[$scope.sealedStorage.houseId].datatype)
110 110
         if ($rootScope.storehouseObj[$scope.sealedStorage.houseId].datatype == 1) {
111 111
             // 油罐,没有货位
112 112
             $scope.warelist = [];
113 113
             $scope.checkGrainAttribute();
114 114
         } else {
115 115
             // 仓房获取货位
116
-            warehouseService.getStorehouse($rootScope.orgInfo.orgId, $scope.sealedStorage.houseId).then(function(data){
116
+            warehouseService.getStorehouse($rootScope.orgInfo.orgId, $scope.sealedStorage.houseId).then(function (data) {
117 117
                 $scope.warelist = data.wareList;
118
-            },function(data){
118
+            }, function (data) {
119 119
                 console.log(data);
120 120
             });
121 121
         }
122 122
     };
123 123
 
124 124
     // 获取封仓数据
125
-    $scope.checkGrainAttribute = function() {
126
-        console.log($scope.sealedStorage.houseId)
127
-        pageListService.checkGrainAttribute($rootScope.orgInfo.orgId, $scope.sealedStorage.houseId, $scope.sealedStorage.warehouseId).then(function(data){
128
-            $scope.sealedStorage = data.data;
125
+    $scope.checkGrainAttribute = function () {
126
+        pageListService.checkGrainAttribute($rootScope.orgInfo.orgId, $scope.sealedStorage.houseId, $scope.sealedStorage.warehouseId).then(function (data) {
127
+            let sealedStorage = data.data;
128
+            if (sealedStorage === null) {
129
+                alert("未查询到关联数据");
130
+            } else {
131
+                $scope.sealedStorage = data.data;
132
+                console.log("sealedStorage:", $scope.sealedStorage)
133
+                for (let i = 0; i < $scope.warelist.length; i++) {
134
+                    if ($scope.sealedStorage.warehouseId === $scope.warelist[i].warehouseId) {
135
+                        // 存放粮油类型(0:原粮/油,1:成品粮/油)
136
+                        if ('0' === $scope.warelist[i].lylx) {// 效验性质转变单审批状态
137
+                            pageListService.checkAuditState($scope.sealedStorage.houseId, $scope.sealedStorage.harvestYear, $scope.sealedStorage.warehouseId).then(function (data) {
138
+                                // 审批状态(0:仓储部经理审批,1:质检部经理审批,2:统计经理审批,3:会计审批,4:库领导审批,5:审批结束)
139
+                                let auditState = data.data;
140
+                                if (auditState !== '5') {
141
+                                    alert("性质转变单审批未通过");
142
+                                    $scope.sealedStorage = {};
143
+                                }
144
+                            }, function (data) {
145
+                                console.log(data);
146
+                            });
147
+                        }
148
+                    }
149
+                }
150
+            }
129 151
             console.log($scope.sealedStorage)
130
-        },function(data){
152
+        }, function (data) {
131 153
             console.log(data);
132 154
         });
133 155
     };
@@ -135,8 +157,8 @@ angular.module('app.business').controller("pageEditCtrl", function ($scope, $htt
135 157
     // 表单效验
136 158
     var validator = $("#storageSealed-form").validate();
137 159
     // 保存
138
-    $scope.save = function() {
139
-        if(validator.form()) {
160
+    $scope.save = function () {
161
+        if (validator.form()) {
140 162
             pageListService.saveData($scope.sealedStorage).then(function (data) {
141 163
                 if (data.retCode === '200') {
142 164
                     alert('保存成功');
@@ -151,8 +173,8 @@ angular.module('app.business').controller("pageEditCtrl", function ($scope, $htt
151 173
     };
152 174
 
153 175
     // 修改
154
-    $scope.update = function() {
155
-        if(validator.form()) {
176
+    $scope.update = function () {
177
+        if (validator.form()) {
156 178
             pageListService.updateData($scope.sealedStorage).then(function (data) {
157 179
                 if (data.retCode === '200') {
158 180
                     alert('修改成功');

+ 18 - 0
src/main/resources/static/app/business/storageSealedConfirmation/service/pageListService.js

@@ -124,4 +124,22 @@ angular.module('app.business').service("pageListService", function ($http, $root
124 124
         });
125 125
         return d.promise;
126 126
     };
127
+
128
+    this.checkAuditState = function(houseId, harvestYear, warehouseId) {
129
+        var d = $q.defer();
130
+        $http({
131
+            method : 'GET',
132
+            url : APP_CONFIG.sharedUrl + '/storageSealedConfirmation/checkAuditState/' + houseId + '/' + harvestYear,
133
+            params : {
134
+                warehouseId : warehouseId
135
+            }
136
+        }).then(function successCallback(response) {
137
+            // 请求成功执行代码
138
+            d.resolve(response.data);
139
+        }, function errorCallback(response) {
140
+            // 请求失败执行代码
141
+            d.reject("error");
142
+        });
143
+        return d.promise;
144
+    };
127 145
 });