|
@@ -130,13 +130,17 @@ define(['app/app'], function(app) {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
var getInvoiceFPurchase = function () {
|
|
var getInvoiceFPurchase = function () {
|
|
|
- return InvoiceFPurchase.tobeshippedByInvoiceid({ids: $stateParams.ids}, function(data) {
|
|
|
|
|
- $scope.checkinvoice = data[0];
|
|
|
|
|
|
|
+ return Purchase.findPurchaseByPurchaseId({purchaseId: $stateParams.ids}, function(data) {
|
|
|
|
|
+ $scope.checkinvoice = data.data;
|
|
|
// Purchase.getOrderIdByPurchaseId({purchaseId:$scope.checkinvoice.sourceid},function(result) {
|
|
// Purchase.getOrderIdByPurchaseId({purchaseId:$scope.checkinvoice.sourceid},function(result) {
|
|
|
// $scope.checkinvoice.orderId = result.data;
|
|
// $scope.checkinvoice.orderId = result.data;
|
|
|
// });
|
|
// });
|
|
|
- $scope.checkinvoice.jsonSpAddress = angular.fromJson($scope.checkinvoice.jsonSpAddress);
|
|
|
|
|
|
|
+ $scope.checkinvoice.jsonSpAddress = angular.fromJson($scope.checkinvoice.jsonAddress);
|
|
|
$scope.checkinvoice.jsonSpAddress.area = $scope.checkinvoice.jsonSpAddress.area.replace(/,/g,' ');
|
|
$scope.checkinvoice.jsonSpAddress.area = $scope.checkinvoice.jsonSpAddress.area.replace(/,/g,' ');
|
|
|
|
|
+ $scope.checkinvoice.purchaseDetails.forEach(function(item) {
|
|
|
|
|
+ item.sendCount = ''
|
|
|
|
|
+ item.shipQty = item.shipQty || 0
|
|
|
|
|
+ })
|
|
|
$scope.checkinvoice.show = false;
|
|
$scope.checkinvoice.show = false;
|
|
|
if ($scope.checkinvoice.jsonRule){
|
|
if ($scope.checkinvoice.jsonRule){
|
|
|
$scope.rule = angular.fromJson($scope.checkinvoice.jsonRule);
|
|
$scope.rule = angular.fromJson($scope.checkinvoice.jsonRule);
|
|
@@ -358,10 +362,15 @@ define(['app/app'], function(app) {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
$scope.saveCheck = function() {
|
|
$scope.saveCheck = function() {
|
|
|
- if(!$scope.checkinvoice || angular.equals(angular.toJson($scope.checkinvoice), "{}")) {
|
|
|
|
|
|
|
+ // if(!$scope.checkinvoice || angular.equals(angular.toJson($scope.checkinvoice), "{}")) {
|
|
|
|
|
+ // toaster.pop("info", "提示", "出货单信息为空,不能保存,请返回出货单管理界面");
|
|
|
|
|
+ // return ;
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
|
|
+ if(!$scope.checkinvoice) {
|
|
|
toaster.pop("info", "提示", "出货单信息为空,不能保存,请返回出货单管理界面");
|
|
toaster.pop("info", "提示", "出货单信息为空,不能保存,请返回出货单管理界面");
|
|
|
return ;
|
|
return ;
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if(!$scope.jsonSdAddress || angular.equals({}, $scope.jsonSdAddress)) {
|
|
if(!$scope.jsonSdAddress || angular.equals({}, $scope.jsonSdAddress)) {
|
|
|
toaster.pop("info", "提示", "发货地址不能为空,请返回出货单管理界面");
|
|
toaster.pop("info", "提示", "发货地址不能为空,请返回出货单管理界面");
|
|
@@ -410,6 +419,14 @@ define(['app/app'], function(app) {
|
|
|
sendInfo.logisticsInfo.companyName = $scope.logistics.companyName;
|
|
sendInfo.logisticsInfo.companyName = $scope.logistics.companyName;
|
|
|
sendInfo.logisticsInfo.number = $scope.logistics.number;
|
|
sendInfo.logisticsInfo.number = $scope.logistics.number;
|
|
|
}
|
|
}
|
|
|
|
|
+ var _obj = {}
|
|
|
|
|
+ for (var i = 0; i < $scope.checkinvoice.purchaseDetails.length; i++) {
|
|
|
|
|
+ if (Math.abs($scope.checkinvoice.purchaseDetails[i].sendCount) > 0) {
|
|
|
|
|
+ var _id = $scope.checkinvoice.purchaseDetails[i].id
|
|
|
|
|
+ _obj[_id] = $scope.checkinvoice.purchaseDetails[i].sendCount
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ sendInfo.map = _obj
|
|
|
// if($scope.checkinvoice.deliveryType == 'logistics') {
|
|
// if($scope.checkinvoice.deliveryType == 'logistics') {
|
|
|
// sendInfo.deliveryType = 'logistics';
|
|
// sendInfo.deliveryType = 'logistics';
|
|
|
// sendInfo.logisticsInfo = {};
|
|
// sendInfo.logisticsInfo = {};
|
|
@@ -424,7 +441,7 @@ define(['app/app'], function(app) {
|
|
|
// }
|
|
// }
|
|
|
sendInfo.jsonSdAddress = angular.toJson($scope.jsonSdAddress);
|
|
sendInfo.jsonSdAddress = angular.toJson($scope.jsonSdAddress);
|
|
|
InvoiceFPurchase.saveInvoiceFPurchase({id : $scope.checkinvoice.id}, sendInfo, function(data) {
|
|
InvoiceFPurchase.saveInvoiceFPurchase({id : $scope.checkinvoice.id}, sendInfo, function(data) {
|
|
|
- toaster.pop("success", "信息", "发货成功");
|
|
|
|
|
|
|
+
|
|
|
// TODO 这边要停5秒钟之后,在跳转到出货单管理界面
|
|
// TODO 这边要停5秒钟之后,在跳转到出货单管理界面
|
|
|
/*var fromPage = window.sessionStorage.getItem("orderAdmin");
|
|
/*var fromPage = window.sessionStorage.getItem("orderAdmin");
|
|
|
if(fromPage == "invoiceProofing") {
|
|
if(fromPage == "invoiceProofing") {
|
|
@@ -433,7 +450,8 @@ define(['app/app'], function(app) {
|
|
|
$state.go('invoice');
|
|
$state.go('invoice');
|
|
|
}*/
|
|
}*/
|
|
|
// TODO huxz 跳转到订单管理页面
|
|
// TODO huxz 跳转到订单管理页面
|
|
|
- $state.go('vendor_order');
|
|
|
|
|
|
|
+ if (data.success) {toaster.pop("success", "信息", "发货成功");$state.go('vendor_order');}
|
|
|
|
|
+ else { toaster.pop("error", data.message); }
|
|
|
}, function(response) {
|
|
}, function(response) {
|
|
|
toaster.pop('error', '错误', response.data);
|
|
toaster.pop('error', '错误', response.data);
|
|
|
});
|
|
});
|
|
@@ -707,12 +725,12 @@ define(['app/app'], function(app) {
|
|
|
// 修改本次发货
|
|
// 修改本次发货
|
|
|
$scope.isSendCount = 0
|
|
$scope.isSendCount = 0
|
|
|
// todo 已发货信息到时候需要根据当前对象获取信息
|
|
// todo 已发货信息到时候需要根据当前对象获取信息
|
|
|
- $scope.ChangeSendCount = function(details, val) {
|
|
|
|
|
- if (val > details.number - $scope.isSendCount) {
|
|
|
|
|
|
|
+ $scope.ChangeSendCount = function(details, val, ind) {
|
|
|
|
|
+ if (val > details.number - details.shipQty) {
|
|
|
toaster.pop('warning', '提示', '本次发货数量不能大于已够数量')
|
|
toaster.pop('warning', '提示', '本次发货数量不能大于已够数量')
|
|
|
- val = details.number - $scope.isSendCount
|
|
|
|
|
|
|
+ val = details.number - details.shipQty
|
|
|
}
|
|
}
|
|
|
- $scope.mockModal = val
|
|
|
|
|
|
|
+ $scope.checkinvoice.purchaseDetails[ind].sendCount = val
|
|
|
}
|
|
}
|
|
|
}]);
|
|
}]);
|
|
|
|
|
|