|
|
@@ -9764,6 +9764,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
orderItems : {
|
|
|
product : {},
|
|
|
},
|
|
|
+ rate: 17
|
|
|
};
|
|
|
|
|
|
//商品信息
|
|
|
@@ -9787,6 +9788,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.order.cust.enName = data.vendorEnterprise.enName;
|
|
|
$scope.order.cust.enAddress = data.vendorEnterprise.enAddress;
|
|
|
$scope.order.cust.uu = data.vendorEnterprise.uu;
|
|
|
+ $scope.order.paymethods = data.paymethod;
|
|
|
$rootScope.venduu = data.vendorEnterprise.uu;
|
|
|
Vendor.contacts({venduu: $scope.order.cust.uu}, {}, function(data) {
|
|
|
$scope.contacts = data;
|
|
|
@@ -9811,10 +9813,12 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
});
|
|
|
|
|
|
modalInstance.result.then(function(data) {
|
|
|
+ console.log(data);
|
|
|
$rootScope.venduu = data.vendorEnterprise.uu;
|
|
|
$scope.id = data.id;
|
|
|
$scope.order.cust = data.vendorEnterprise;
|
|
|
$scope.order.custUser = data.vendorUser;
|
|
|
+ $scope.order.payments = data.paymethod;
|
|
|
$scope.order.orderItems = [];
|
|
|
var item = {
|
|
|
code: null,
|
|
|
@@ -9879,7 +9883,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
if($scope.order.orderItems[index].code == null) {
|
|
|
toaster.pop('info', '提示', '请先选择商品');
|
|
|
} else {
|
|
|
- $scope.order.orderItems.push({code: null, title: null, spec: null, unit: null, qty: null, price: null, remark: null, delivery: null, $endDateOpen: false});
|
|
|
+ $scope.order.orderItems.push({code: null, title: null, spec: null, unit: null, qty: null, price: null, remark: null, delivery: null, $endDateOpen: false, rate: $scope.order.rate});
|
|
|
}
|
|
|
};
|
|
|
//删除商品
|
|
|
@@ -9924,9 +9928,33 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
|
|
|
// 选择
|
|
|
$scope.check = function(data) {
|
|
|
- $scope.order.orderItems.push({code: data.code, title: data.title, spec: data.spec, unit: data.unit, qty: null, price: null, remark: null, delivery: null, id: data.id});
|
|
|
+ $scope.order.orderItems.push({code: data.code, title: data.title, spec: data.spec, unit: data.unit, qty: null, price: null, remark: null, delivery: null, id: data.id, rate: $scope.order.rate});
|
|
|
};
|
|
|
|
|
|
+ // 导入商品信息
|
|
|
+ $scope.uplodaByBatch = function() {
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ templateUrl: 'static/tpl/index/purc/modal/purc_uplodaByBatch.html',
|
|
|
+ controller: 'PurcUploadByBatchCtrl',
|
|
|
+ size: 'lg',
|
|
|
+ resolve: {
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ modalInstance.result.then(function(data) {
|
|
|
+ angular.forEach(data, function(prod) {
|
|
|
+ $scope.order.orderItems.push({code: prod.code, title: data.title, unit: 'PCS', spec: prod.spec, qty: prod.amount, price: prod.price, remark: prod.remark, delivery: prod.date, id: prod.id, rate: prod.rate});
|
|
|
+// for(var i = 0; i < $scope.inquiry.inquiryItems.length; i++) {
|
|
|
+// if($scope.order.orderItems[i].qty == null && $scope.order.orderItems[i].price == null && $scope.order.orderItems[i].qty == null && $scope.order.orderItems[i].delivery == null && $scope.order.orderItems[i].remark == null) { // 如果没有填写就删除这行数据
|
|
|
+// $scope.inquiry.inquiryItems.splice(i, 1);
|
|
|
+// }
|
|
|
+// }
|
|
|
+ })
|
|
|
+
|
|
|
+ }, function(){
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
// 监听custuu发生变化,重新加载物料信息
|
|
|
$scope.$watch('order.cust.uu', function(n, o) {
|
|
|
if(n==o) {
|
|
|
@@ -10077,6 +10105,42 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
|
|
|
}]);
|
|
|
|
|
|
+ /**
|
|
|
+ * 采购批量导入
|
|
|
+ */
|
|
|
+ app.controller('PurcUploadByBatchCtrl', ['$scope', 'toaster', '$upload', '$modalInstance', function($scope, toaster, $upload, $modalInstance) {
|
|
|
+ // 通过excel批量上传物料
|
|
|
+ $scope.result = null;
|
|
|
+ $scope.upload = function() {
|
|
|
+ var file = $scope.myFiles[0];
|
|
|
+ $upload.upload({
|
|
|
+ url: 'purchase/release/excel',
|
|
|
+ file: file,
|
|
|
+ method: 'POST'
|
|
|
+ }).success(function(data) {
|
|
|
+ $scope.result = data;
|
|
|
+ $scope.success = $scope.result.success;
|
|
|
+ $scope.total = $scope.result.total;
|
|
|
+ $scope.alters = $scope.result.alters;
|
|
|
+ }).error(function(response) {
|
|
|
+ toaster.pop('error', response.data || response);
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ // 下载模板
|
|
|
+ $scope.download = function() {
|
|
|
+ window.location.href = 'purchase/upload/template';
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.enSure = function() {
|
|
|
+ $modalInstance.close($scope.result.products);
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.cancel = function() {
|
|
|
+ $modalInstance.dismiss();
|
|
|
+ }
|
|
|
+ }]);
|
|
|
+
|
|
|
// 查找供应商
|
|
|
app.controller('DbfindVendorInfoCtrl', ['$scope', 'BaseService', 'ngTableParams', 'toaster', '$modalInstance', 'Vendor', '$rootScope', 'orderItems', function($scope, BaseService, ngTableParams, toaster, $modalInstance, Vendor, $rootScope, orderItems){
|
|
|
$scope.prod = false;
|
|
|
@@ -13633,7 +13697,9 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
// 取消合作关系
|
|
|
$scope.disableCust = function(id) {
|
|
|
VendorInfo.disableCust({id: id}, {}, function(data) {
|
|
|
- toaster.pop('success', '提示', '取消合作关系成功');
|
|
|
+ if(data.success) {
|
|
|
+ toaster.pop('success', '提示', data.success);
|
|
|
+ }
|
|
|
$scope.customerParams.page(1);
|
|
|
$scope.customerParams.reload();
|
|
|
}, function(response) {
|
|
|
@@ -13644,7 +13710,9 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
// 解除禁用
|
|
|
$scope.activeCust = function(id) {
|
|
|
VendorInfo.activeCust({id: id}, {}, function(data) {
|
|
|
- toaster.pop('success', '提示', '取消合作关系成功');
|
|
|
+ if(data.success) {
|
|
|
+ toaster.pop('success', '提示', data.success);
|
|
|
+ }
|
|
|
$scope.customerParams.page(1);
|
|
|
$scope.customerParams.reload();
|
|
|
}, function(response) {
|
|
|
@@ -13706,7 +13774,9 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
// 取消合作关系
|
|
|
$scope.relieve = function(id) {
|
|
|
VendorInfo.relieve({id: id}, {}, function(data) {
|
|
|
- toaster.pop('success', '提示', '取消合作关系成功');
|
|
|
+ if(data.success) {
|
|
|
+ toaster.pop('success', '提示', data.success);
|
|
|
+ }
|
|
|
$scope.customerParams.page(1);
|
|
|
$scope.customerParams.reload();
|
|
|
}, function(response) {
|
|
|
@@ -13714,10 +13784,12 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- // 取消合作关系
|
|
|
+ // 建立合作关系
|
|
|
$scope.activeVend = function(id) {
|
|
|
VendorInfo.activeVend({id: id}, {}, function(data) {
|
|
|
- toaster.pop('success', '提示', '取消禁用成功');
|
|
|
+ if(data.success) {
|
|
|
+ toaster.pop('success', '提示', data.success);
|
|
|
+ }
|
|
|
$scope.customerParams.page(1);
|
|
|
$scope.customerParams.reload();
|
|
|
}, function(response) {
|