| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- "use strict";
- angular.module('app.intelligent').controller("humitureDetectionCtrl", function ($scope, $state, $rootScope, $stateParams, $uibModal, temperatureRecordService, $interval, basicThresholdSetService) {
- // 默认分页
- $scope.pageInfo = {pageNum: 1, pageSize: 10};
- // 筛选条件
- $scope.search = {};
- $scope.updateTime = 30;
- $scope.stopEvent;
- // 加载列表
- $scope.loadData = function () {
- $scope.search.time = $("input[name='time']").val(); // 时间控件获取值
- // 检测类型0测温,1粮油,2测水分
- temperatureRecordService.getTemperatureRecordPageInfo($scope.pageInfo, $scope.search, '0').then(function (data) {
- $scope.pageInfo = data.data;
- }, function (data) {
- console.log(data);
- });
- if ($scope.updateTime == 1){
- $interval.cancel($scope.stopEvent);
- console.log('测试成功停止刷新!');
- $scope.stopEvent = undefined;
- }
- };
- $scope.loadData();
- // 详情(层温)
- $scope.grainDetectionDetail = function (humitureDetection, zsfs) {
- var params = [];
- params.vCfCode = humitureDetection.storehouse; // 仓房编码
- params.time = humitureDetection.time; // 检测时间
- params.intemp = humitureDetection.intemp; // 仓内温
- params.inh = humitureDetection.inh; // 仓内湿
- params.outtemp = humitureDetection.outtemp; // 仓外温
- params.outh = humitureDetection.outh; // 仓外湿
- params.max = humitureDetection.max; // 最高粮温
- params.min = humitureDetection.min; // 最低粮温
- params.avg = humitureDetection.avg; // 平均粮温
- params.id = humitureDetection.id;
- params.zsfs = zsfs;
- /*if (zsfs == "1") {
- $uibModal.open({
- size: 'lg',
- templateUrl: 'app/intelligent/grainDetection/views/humitureDetection-model2.html',
- controller: 'humitureDetectionModel2',
- resolve: {
- // 传入参数
- items: function () {
- // 这个值会被模态框的控制器获取到
- return params;
- }
- }
- });
- } else {
- $uibModal.open({
- size: 'lg',
- templateUrl: 'app/intelligent/grainDetection/views/humitureDetection-model.html',
- controller: 'humitureDetectionModel',
- resolve: {
- // 传入参数
- items: function () {
- // 这个值会被模态框的控制器获取到
- return params;
- }
- }
- });
- }*/
- var pageurl;
- var ctrlurl;
- if (zsfs == '1') {
- pageurl = 'app/intelligent/grainDetection/views/humitureDetection-model2.html';
- ctrlurl = 'humitureDetectionModel2';
- } else {
- pageurl = 'app/intelligent/grainDetection/views/humitureDetection-model.html';
- ctrlurl = 'humitureDetectionModel';
- }
- $uibModal.open({
- size: 'lg',
- templateUrl: pageurl,
- controller: ctrlurl,
- resolve: {
- // 传入参数
- items: function () {
- // 这个值会被模态框的控制器获取到
- return params;
- }
- }
- });
- }
- // 所有仓检测
- $scope.allStoreGrainTemperatureDetection = function () {
- if (!confirm("您确认发送粮温全库检测请求!")) {
- return;
- }
- $scope.stopEvent = $interval(function () {
- $scope.updateTime = 1;
- $scope.loadData();
- }, 1000 * 60 * 3, -1);
- // 检测类型0测温,1粮油,2测水分
- temperatureRecordService.allStoreGrainTemperatureDetection('0').then(function (data) {
- if (data.retCode === '200' && data.message === 'success') {
- if (data.data === '3232302D46696C') {
- alert("无法连接到设备!");
- return;
- }
- alert(data.data);
- }
- }, function (data) {
- console.log(data);
- });
- };
- // 单仓检测
- $scope.onlyStoreGrainTemperatureDetection = function (storehouse) {
- if (!confirm("您确认检测" + $rootScope.storeHouseCodeObj[storehouse].storehouseName + "粮温!")) {
- return;
- }
- $scope.stopEvent = $interval(function () {
- $scope.updateTime = 1;
- $scope.loadData();
- }, 1000 * 60 * 1, -1);
- // 检测类型0测温,1粮油,2测水分
- temperatureRecordService.onlyStoreDetection(storehouse, '0').then(function (data) {
- if (data.retCode === '200' && data.message === 'success') {
- if (data.data === '3232302D46696C') {
- alert("无法连接到设备!");
- return;
- }
- alert(data.data);
- }
- }, function (data) {
- console.log(data);
- });
- };
- $scope.getCompareDate = function CompareDate(d1, d2) {
- //将所有的短横线替换为斜杠
- return ((new Date(d1.replace(/-/g, "\/"))) >= (new Date(d2.replace(/-/g, "\/"))));
- }
- // 清空搜索时间
- $scope.emptyTime = function () {
- $scope.search.time = '';
- $scope.search.vCfCode = '';
- $scope.loadData();
- };
- // 翻页
- $scope.goPage = function (pageNum) {
- if ($scope.pageInfo.pageNum !== pageNum && pageNum > 0) {
- $scope.pageInfo.pageNum = pageNum;
- $scope.loadData();
- }
- };
- });
|