| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- "use strict";
- angular.module('app.numbermanage').controller("numberManageCtrl", function(APP_CONFIG, $scope,$rootScope, $http, $state, $filter,
- numberMangaeService, sheetService, StorehouseService, warehouseService, enumService,
- kcswService, archiveService,$stateParams) {
- $scope.searchCondition = {houseId : "", warehouseId : "", pz : ""};
- $scope.getBasicData = function() {
- //按照单位获取单位下的仓房信息
- var depotId = $rootScope.orgInfo.orgId;
- warehouseService.getStorehouse(depotId, $scope.searchCondition.houseId,"0").then(function(data){
- $scope.warehouseList = data.wareList; //下拉列表数据
- $scope.warehouseObj = data.wares; //查询数据列表货位信息转换
- },function (data) {
- console.log(data);
- });
- };
-
- /* 分页信息 */
- $scope.pageInfo = {pageNum : 1, pageSize : 10};
- $scope.isArchiveHouse = 0;
- $scope.loadDataSelect = function() {
- /* 先拿到库存实物表的数据 */
- var serchCh = null;
- var serchHwh = null;
- var serchPz = null;
- //归档用
- if($stateParams.dataState == "archive"){
- $scope.isArchive = true;
- //查询归档仓房下拉
- archiveService.getArchiveDataList().then(function (data) {
- if($scope.isArchiveHouse == 0){
- $scope.store_tank_list = data;
- }
- $scope.isArchiveHouse++;
- //如果不是下拉的则可能是点查看则按照这种方式跳转
- if($scope.searchCondition.houseId == undefined || $scope.searchCondition.houseId == ""){
- $scope.searchCondition.houseId = $rootScope.archiveState.storehouseId;
- $scope.searchCondition.createTime = $rootScope.archiveState.createTime;
- $scope.getBasicData();
- }else{
- $scope.searchCondition.createTime = $scope.store_tank_list[$scope.searchCondition.houseId].createTime;
- }
- if($scope.searchCondition.createTime == "" || $scope.searchCondition.createTime == undefined){
- $scope.pageInfo.pageNum = 0;
- $scope.pageInfo.pageSize = 0;
- $scope.searchCondition.houseId = '000';
- }
- if (undefined != $scope.searchCondition) {
- if (undefined != $scope.searchCondition.houseId) {
- serchCh = $scope.searchCondition.houseId;
- }
- if (undefined != $scope.searchCondition.warehouseId) {
- serchHwh = $scope.searchCondition.warehouseId;
- }
- if (undefined != $scope.searchCondition.pz) {
- serchPz = $scope.searchCondition.pz;
- }
- if (undefined != $scope.searchCondition.pz) {
- serchPz = $scope.searchCondition.pz;
- }
- if (undefined != $scope.searchCondition.createTime) {
- var createTime = $scope.searchCondition.createTime;
- }
- $scope.kcswStr = {ch: serchCh, hwh: serchHwh, pz: serchPz, unitid: $rootScope.orgInfo.orgId, modifydate: createTime};
- } else {
- $scope.kcswStr = {ch: null, hwh: null, pz: null, unitid: $rootScope.orgInfo.orgId};
- }
- $scope.searchCondition.createTime = $filter('date')($scope.searchCondition.createTime, "yyyy-MM-dd HH:mm:ss");
- //原来代码
- kcswService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize, $scope.kcswStr, "ch").then(function (data) {
- $scope.pageInfo = data;
- }, function (data) {
- console.log(data);
- });
- }, function (data) {
- console.log(data);
- });
- }else {
- if (undefined != $scope.searchCondition) {
- if (undefined != $scope.searchCondition.houseId) {
- serchCh = $scope.searchCondition.houseId;
- }
- if (undefined != $scope.searchCondition.warehouseId) {
- serchHwh = $scope.searchCondition.warehouseId;
- }
- if (undefined != $scope.searchCondition.pz) {
- serchPz = $scope.searchCondition.pz;
- }
- $scope.kcswStr = {ch: serchCh, hwh: serchHwh, pz: serchPz, unitid: $rootScope.orgInfo.orgId};
- } else {
- $scope.kcswStr = {ch: null, hwh: null, pz: null, unitid: $rootScope.orgInfo.orgId};
- }
- kcswService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize, $scope.kcswStr, "ch").then(function (data) {
- $scope.pageInfo = data;
- }, function (data) {
- console.log(data);
- });
- }
- kcswService.getCountKczl($rootScope.orgInfo.orgId).then(function(data){
- $scope.lskczl = data.lskczl;
- if ($scope.lskczl != "0") {
- $scope.lskczl = parseFloat($scope.lskczl)/1000;
- $scope.lskczl = Number($scope.lskczl.toString().match(/^\d+(?:\.\d{0,3})?/));
- }
- $scope.yzkczl = data.yzkczl;
- if ($scope.yzkczl != "0") {
- $scope.yzkczl = parseFloat($scope.yzkczl)/1000;
- $scope.yzkczl = Number($scope.yzkczl.toString().match(/^\d+(?:\.\d{0,3})?/));
- }
- },function(data){
- console.log(data);
- });
- //加载打印数据
- kcswService.getPageInfo(null, null, $scope.kcswStr, null).then(function (data) {
- $scope.pageInfoprint = data;
- }, function (data) {
- console.log(data);
- });
- }
- $scope.getBasicData();
- $scope.loadDataSelect();
- $scope.searchCondition = {};
- //清空
- $scope.clearConditions = function() {
- $scope.searchCondition = {};
- $scope.loadData();
- };
-
- // 分页相关方法.
- $scope.go_pages = function(type, pageNum, pigeSize, pages) {
- var pageNumC = pageNum;
- if (type == 'previousPage') {
- if (pageNum <= 1) {
- return;
- }
- pageNumC = pageNum - 1
- } else if (type == 'nextPage') {
- if (pageNum >= pages) {
- return;
- }
- pageNumC = pageNum + 1
- } else if (type == 'firstPage') {
- if (pageNum == 1) {
- return;
- }
- pageNumC = 1;
- } else if (type == 'lastPage') {
- if (pageNum == pages) {
- return;
- }
- pageNumC = pages;
- }
- $scope.loadData = function() {
- kcswService.getPageInfo(pageNumC, pigeSize,$scope.kcswStr, "ch").then(function(data){
- $scope.pageInfo = data;
- },function(data){
- //console.log(data);
- });
- };
- $scope.loadData();
- };
-
- // 改变页码.
- $scope.change_pageSize = function(pigeSizeChange) {
- $scope.loadData = function() {
- kcswService.getPageInfo(1, pigeSizeChange,$scope.kcswStr).then(function(data){
- $scope.pageInfo = data;
- },function(data){
- //console.log(data);
- });
- };
- $scope.loadData();
- }
- //打印
- $scope.print = function() {
- $("#kcprint").printArea();
- }
- });
|