|
|
@@ -1,15 +1,19 @@
|
|
|
define([ 'app/app' ], function(app) {
|
|
|
'use strict';
|
|
|
- app.register.controller('vendor_storageCtrl', ['$scope', '$rootScope', 'BaseService', 'Goods', 'KdnLogistics', '$modal', 'toaster', 'Loading', 'AuthenticationService', '$q', '$upload', '$http', 'ngTableParams',function ($scope, $rootScope, BaseService, Goods, KdnLogistics, $modal, toaster, Loading, AuthenticationService, $q, $upload, $http, ngTableParams) {
|
|
|
+ app.register.controller('vendor_storageCtrl', ['$scope', '$rootScope', '$stateParams', 'BaseService', 'Goods', 'KdnLogistics', '$modal', 'toaster', 'Loading', 'AuthenticationService', '$q', '$upload', '$http', 'ngTableParams', 'InvoiceFPurchase', 'ShippingAddress', function ($scope, $rootScope, $stateParams, BaseService, Goods, KdnLogistics, $modal, toaster, Loading, AuthenticationService, $q, $upload, $http, ngTableParams, InvoiceFPurchase, ShippingAddress) {
|
|
|
$rootScope.active = 'vendor_storage';
|
|
|
$scope.keyword = '';
|
|
|
$scope.type = '';
|
|
|
$scope.tab = 'storage';
|
|
|
$scope.isInt = /^[0-9]*[1-9][0-9]*$/;
|
|
|
document.title = '卖家出入库-优软商城';
|
|
|
- $scope.storage_tab = 'outBound';
|
|
|
+ $scope.storage_tab = $stateParams.storage_tab? $stateParams.storage_tab : 'inBound';
|
|
|
$scope.countData = 10;
|
|
|
$scope.userInfo = $rootScope.userInfo || {}
|
|
|
+ console.log($stateParams)
|
|
|
+
|
|
|
+ //数字的正则表达式
|
|
|
+ var intPattern = /^[1-9]+$/;
|
|
|
|
|
|
// 更多操作数据和记录
|
|
|
$scope.handleLink = [
|
|
|
@@ -19,8 +23,8 @@ define([ 'app/app' ], function(app) {
|
|
|
{name: '查看出库记录', tab: 'outBound', id: 0},
|
|
|
{name: '其它出库', tab: 'outBound', id: 1},
|
|
|
{name: '销售出库', tab: 'outBound', id: 2}];
|
|
|
- // $scope.handleItem = $scope.storage_tab === 'inBound'? $scope.handleLink[0].id : $scope.handleLink[3].id;
|
|
|
- $scope.handleItem = 2;
|
|
|
+ $scope.handleItem = $stateParams.storage_tab ? 1 : ($scope.storage_tab === 'inBound'? $scope.handleLink[0].id : $scope.handleLink[3].id);
|
|
|
+ // $scope.handleItem = 2;
|
|
|
|
|
|
$scope.lockData = [
|
|
|
{id: 1,seleted: false, maiName: '324134', selfSupport: '腌肉入库', uuid: '张三1', date: 340325435434535, content: [{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'},{code: 'w324', code1: '342', code2: '2144'}]},
|
|
|
@@ -207,13 +211,13 @@ define([ 'app/app' ], function(app) {
|
|
|
total: 0,
|
|
|
getData: function ($defer, params) {
|
|
|
var param = BaseService.parseParams(params.url())
|
|
|
+ console.log($scope.keyword, 'keyword')
|
|
|
if($scope.keyword){
|
|
|
param.keyword = $scope.keyword
|
|
|
}
|
|
|
if($scope.storage_tab === 'outBound' && $scope.handleItem === 2) {
|
|
|
param.sorting = {"createtime":"DESC"};
|
|
|
param.status = '502-406';
|
|
|
- param.storeType = 'mall';
|
|
|
param.startMils = $scope.startDate ? $scope.startDate.getTime() : null;
|
|
|
param.endMils = $scope.endDate ? $scope.endDate.getTime() : null;
|
|
|
} else {
|
|
|
@@ -221,21 +225,23 @@ define([ 'app/app' ], function(app) {
|
|
|
param.fromDate = $scope.startDate ? $scope.startDate.getTime() : null;
|
|
|
param.toDate = $scope.endDate ? $scope.endDate.getTime() : null;
|
|
|
}
|
|
|
- Goods[getUrl()](param, function(data) {
|
|
|
- $scope.storageList = data.content
|
|
|
- console.log(data.content, ';data')
|
|
|
- params.total(data.totalElements);
|
|
|
- $defer.resolve(data.content);
|
|
|
- }, function(err) {
|
|
|
- toaster.pop('error', '获取信息失败')
|
|
|
- })
|
|
|
+ if ($scope.handleItem !== 1) {
|
|
|
+ Goods[getUrl()](param, function(data) {
|
|
|
+ $scope.storageList = data.content
|
|
|
+ params.total(data.totalElements);
|
|
|
+ $defer.resolve(data.content);
|
|
|
+ }, function(err) {
|
|
|
+ toaster.pop('error', '获取信息失败')
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
};
|
|
|
getLoadStorageData();
|
|
|
|
|
|
// 搜索功能
|
|
|
- $scope.onSearch = function () {
|
|
|
+ $scope.onSearch = function (type) {
|
|
|
+ $scope.keyword = type;
|
|
|
getLoadStorageData();
|
|
|
};
|
|
|
|
|
|
@@ -299,10 +305,31 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
})
|
|
|
Goods.saveOtherProductData({storage_tab: $scope.storage_tab, enName: $scope.othenParam.enName}, $scope.othenParam.detail, function(data) {
|
|
|
- console.log(data)
|
|
|
+ if(data.code === 1) {
|
|
|
+ toaster.pop('success', '申请成功!');
|
|
|
+ initOtherData();
|
|
|
+ }
|
|
|
})
|
|
|
};
|
|
|
|
|
|
+
|
|
|
+ //加载发货地址
|
|
|
+ var loadAddrs = function() {
|
|
|
+ ShippingAddress.getListEnterprise({ship : false}, function(data) {
|
|
|
+ $scope.addresss = data;
|
|
|
+ $scope.total = $scope.addresss.length;
|
|
|
+ $scope.jsonSdAddress = {};
|
|
|
+ if($scope.addresss.length > 0) {
|
|
|
+ $scope.jsonSdAddress = $scope.addresss[0];
|
|
|
+ $scope.jsonSdAddress.area = $scope.jsonSdAddress.area.replace(/,/g,' ');
|
|
|
+ }
|
|
|
+ }, function(res) {
|
|
|
+ toaster.pop('error', '错误', res.data);
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ loadAddrs();
|
|
|
+
|
|
|
// 获取物流公司信息
|
|
|
$scope.initData = function () {
|
|
|
Goods.findAllSelected({},function (data) {
|
|
|
@@ -329,9 +356,9 @@ define([ 'app/app' ], function(app) {
|
|
|
})
|
|
|
};
|
|
|
$scope.findAllKdnList();
|
|
|
+
|
|
|
$scope.logistics = {};
|
|
|
$scope.showText = function (data) {
|
|
|
- console.log(data, 'data')
|
|
|
$scope.logistics.companyName = data.companyName;
|
|
|
$scope.companyObject = data;
|
|
|
$scope.showCompanyName = false;
|
|
|
@@ -424,6 +451,69 @@ define([ 'app/app' ], function(app) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ //数量进行验证
|
|
|
+ $scope.ChangeSendCount = function(details, val) {
|
|
|
+ var newShipQty = details.shipQty ? details.shipQty : 0
|
|
|
+ if (val > details.number - newShipQty) {
|
|
|
+ toaster.pop('warning', '提示', '本次发货数量不能大于已剩数量')
|
|
|
+ val = details.number - newShipQty
|
|
|
+ }
|
|
|
+ details.sendCount = val
|
|
|
+ };
|
|
|
+
|
|
|
+ // 销售出库确认发货
|
|
|
+ $scope.saveOtherCheck = function (data) {
|
|
|
+ console.log(data, 'data')
|
|
|
+ if(!$scope.jsonSdAddress || angular.equals({}, $scope.jsonSdAddress)) {
|
|
|
+ toaster.pop("info", "提示", "发货地址不能为空,请前往物流管理新增发货地址");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ var sendInfo = {};
|
|
|
+ sendInfo.sendType = data.sendType;
|
|
|
+ if ($scope.logistics.companyName && $scope.logistics.number){
|
|
|
+ sendInfo.logisticsInfo = {};
|
|
|
+ sendInfo.logisticsInfo.companyName = $scope.logistics.companyName;
|
|
|
+ sendInfo.logisticsInfo.number = $scope.logistics.number;
|
|
|
+ }
|
|
|
+ var HasCount = false
|
|
|
+ var _obj = []
|
|
|
+ for (var i = 0; i < data.purchaseDetails.length; i++) {
|
|
|
+ if (Math.abs(data.purchaseDetails[i].sendCount) > 0) {
|
|
|
+ HasCount = true
|
|
|
+ var _id = data.purchaseDetails[i].id
|
|
|
+ _obj.push({
|
|
|
+ id: _id,
|
|
|
+ qty: data.purchaseDetails[i].sendCount
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!HasCount) {
|
|
|
+ toaster.pop("info", "提示", "最少填写一个发货数量");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ sendInfo.map = _obj
|
|
|
+ sendInfo.jsonSdAddress = angular.toJson($scope.jsonSdAddress);
|
|
|
+ InvoiceFPurchase.saveInvoiceFPurchase({id : data.id}, sendInfo, function(res) {
|
|
|
+
|
|
|
+ // TODO 这边要停5秒钟之后,在跳转到出货单管理界面
|
|
|
+ /*var fromPage = window.sessionStorage.getItem("orderAdmin");
|
|
|
+ if(fromPage == "invoiceProofing") {
|
|
|
+ $state.go('invoiceProofing');
|
|
|
+ }else {
|
|
|
+ $state.go('invoice');
|
|
|
+ }*/
|
|
|
+ // TODO huxz 跳转到订单管理页面
|
|
|
+ if (res.success) {
|
|
|
+ toaster.pop("success", "信息", "发货成功");
|
|
|
+ $state.go('vendor_order');
|
|
|
+ } else {
|
|
|
+ toaster.pop("error", res.message);
|
|
|
+ }
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '错误', response.data);
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
|
|
|
//获取登录的信息
|
|
|
var getAuthentication = function () {
|