(function () { 'use strict'; angular.module('task.controller') .controller('ConveyorMonitorDetail1Ctrl', ConveyorMonitorDetail1Ctrl); function ConveyorMonitorDetail1Ctrl($scope, $window, CurdHelper,Common, ETaskTypeService, $state, $timeout, Utils, Global, $stateParams) { $scope.data = []; $scope.info_div = { width: $window.innerWidth/2-30, height: 460 } $scope.input_length = { width: ($window.innerWidth) / 4 - 132 - 45, } $scope.task_send_div = { width: $window.innerWidth - 50 }; $scope.sysModes ={ name: "批次状态", value: false } $scope.changeMode = changeMode; $scope.materialcode = ""; $scope.sendFlag = false; $scope.init = init; $scope.clearText = clearText; $scope.sendTask = sendTask; function init() { $scope.conveyorName = $stateParams.name+"输送机监控"; queryConveyor(); } function queryConveyor() { CurdHelper.queryByParam("./Device/GetGateInfo", { conveyorName: "conveyor1", gateName: "gate11" }, function (data) { if (Utils.isBlank(data.Message)) { $scope.gate11 = data.Result; } }); CurdHelper.queryByParam("./Device/GetGateInfo", { conveyorName: "conveyor1", gateName: "gate12" }, function (data) { if (Utils.isBlank(data.Message)) { $scope.gate12 = data.Result; } }); CurdHelper.queryByParam("./Device/GetGateInfo", { conveyorName: "conveyor1", gateName: "gate13" }, function (data) { if (Utils.isBlank(data.Message)) { $scope.gate13 = data.Result; } }); CurdHelper.queryByParam("./Device/GetGateInfo", { conveyorName: "conveyor1", gateName: "gate14" }, function (data) { if (Utils.isBlank(data.Message)) { $scope.gate14 = data.Result; } }); CurdHelper.queryByParam("./Device/GetGateInfo", { conveyorName: "conveyor1", gateName: "gate15" }, function (data) { if (Utils.isBlank(data.Message)) { $scope.gate15 = data.Result; } }); CurdHelper.query("./Home/GetIsLots", function (data) { if (Utils.isBlank(data.Message)) { $scope.sysModes.value = data.Result; } }); if ($state.includes("task.conveyor-monitor-detail1")) { $timeout(queryConveyor, 1000); } } function clearText() { $scope.materialcode = ""; $scope.sendFlag = false; } function changeMode() { var flag = !$scope.sysModes.value; CurdHelper.queryByParam("./Home/SetIsLots", { flag: flag }, function (data) { }); } function sendTask() { debugger $scope.sendFlag = true; if ($scope.materialcode == "" || $scope.gate11.RIsEmpty == "无钢材") { alert("请确保物料不为空或入库的gate11口有钢材!"); clearText(); } else { CurdHelper.save("./Task/SendAndChackMaterial", { materialcode: $scope.materialcode }, function (data) { $scope.sendFlag = true; alert(Utils.isBlank(data.Message) ? "下发成功" : data.Message); clearText(); }); } } } })();