|
|
@@ -1,7 +1,7 @@
|
|
|
define([ 'app/app' ], function(app) {
|
|
|
'use strict';
|
|
|
app.register.controller('vendor_storageCtrl', ['$scope', '$rootScope', '$stateParams', 'BaseService', 'Goods', 'KdnLogistics', '$modal', 'toaster', 'Loading', 'AuthenticationService', '$q', '$upload', '$http', 'ngTableParams', 'InvoiceFPurchase', 'ShippingAddress', 'Enterprise', function ($scope, $rootScope, $stateParams, BaseService, Goods, KdnLogistics, $modal, toaster, Loading, AuthenticationService, $q, $upload, $http, ngTableParams, InvoiceFPurchase, ShippingAddress, Enterprise) {
|
|
|
- $rootScope.active = 'vendor_storage';
|
|
|
+ $rootScope.active = 'vendor_material';
|
|
|
$scope.keyword = '';
|
|
|
$scope.type = '';
|
|
|
$scope.tab = 'storage';
|
|
|
@@ -344,7 +344,8 @@ define([ 'app/app' ], function(app) {
|
|
|
type.id = key.id;
|
|
|
type.qty = ($scope.storage_tab === 'outBound' ? key.erpReserve : '');
|
|
|
type.price = key.price;
|
|
|
- if((!type.erpReserve || type.erpReserve === 0) && $scope.storage_tab === 'outBound'){
|
|
|
+ type.erpReserve = key.erpReserve;
|
|
|
+ if((type.erpReserve <= 0) && $scope.storage_tab === 'outBound'){
|
|
|
toaster.pop('info', '提示', '该型号在产品库中库存数量为0,不能出库!');
|
|
|
}
|
|
|
};
|
|
|
@@ -371,12 +372,14 @@ define([ 'app/app' ], function(app) {
|
|
|
var flag = 0;
|
|
|
angular.forEach($scope.otherData, function(val) {
|
|
|
if(val.id) {
|
|
|
- if(!val.erpReserve || val.erpReserve === 0 && $scope.storage_tab === 'outBound'){
|
|
|
+ if((val.erpReserve <= 0) && $scope.storage_tab === 'outBound'){
|
|
|
flag = 1
|
|
|
- } else if(val.erpReserve < val.qty) {
|
|
|
+ } else if((val.erpReserve < val.qty) && $scope.storage_tab === 'outBound') {
|
|
|
flag = 2
|
|
|
} else if(val.qty && val.price) {
|
|
|
$scope.othenParam.detail.push({productId: val.id, qty: Number(val.qty), price: Number(val.price)});
|
|
|
+ } else {
|
|
|
+ flag = 3
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
@@ -388,6 +391,10 @@ define([ 'app/app' ], function(app) {
|
|
|
toaster.pop('info', '提示', '出库量数量不能大于库存数!');
|
|
|
return;
|
|
|
}
|
|
|
+ if(flag === 3) {
|
|
|
+ toaster.pop('info', '提示', '请填写数量和单价!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
if($scope.othenParam.detail.length <= 0) {
|
|
|
toaster.pop('info', '提示', '至少填写一条数据!');
|
|
|
return;
|
|
|
@@ -396,6 +403,7 @@ define([ 'app/app' ], function(app) {
|
|
|
if(data.code === 1) {
|
|
|
toaster.pop('success', '申请成功!');
|
|
|
initOtherData();
|
|
|
+ $scope.toggleType(0);
|
|
|
}
|
|
|
}, function(res) {
|
|
|
toaster.pop('error', '申请失败,请检查再试')
|