|
|
@@ -1,7 +1,7 @@
|
|
1
|
1
|
angular.module('app.business').controller("grainDeliveryStorageNoticeSaveCtrl",
|
|
2
|
2
|
function($scope, $http, $filter, $stateParams, $state, $uibModal, $rootScope,agentDepotService,
|
|
3
|
3
|
deliveryStorageNoticeService, deliveryStorageNoticeAuditService, commonUtilService,
|
|
4
|
|
- storeWareDetailService, enumService, codeRuleService,planService, customerService, $location, APP_CONFIG) {
|
|
|
4
|
+ storeWareDetailService, enumService, codeRuleService,planService, customerService, contractReceiveService, $location, APP_CONFIG) {
|
|
5
|
5
|
|
|
6
|
6
|
$scope.deliveryStorageNotice = {};
|
|
7
|
7
|
$scope.billNumber = {};
|
|
|
@@ -145,16 +145,46 @@ angular.module('app.business').controller("grainDeliveryStorageNoticeSaveCtrl",
|
|
145
|
145
|
$('#xzht').css('display','none');
|
|
146
|
146
|
}
|
|
147
|
147
|
|
|
148
|
|
- //给协议号赋值
|
|
|
148
|
+ //给协议号赋值
|
|
149
|
149
|
for (var i=0; i< result.length; i++) {
|
|
150
|
|
- $scope.addedDetail[i].agreementNumber = result[i].contractNumber;
|
|
|
150
|
+ if ($stateParams.noticeType == "delivery") {//出库
|
|
|
151
|
+ if (result[i].ywtype == "2") {//销售=竞价
|
|
|
152
|
+ $scope.addedDetail[i].htbh = result[i].contractNumber;//通知单本身的协议号就是合同号
|
|
|
153
|
+ $scope.addedDetail[i].agreementNumber = null;
|
|
|
154
|
+ }else if (result[i].ywtype == "3") {//包干,通知单的合同号是从接收合同引的,本身的协议号/合同号的值就只是协议号
|
|
|
155
|
+ $scope.addedDetail[i].htbh = result[i].htbh;
|
|
|
156
|
+ $scope.addedDetail[i].agreementNumber = result[i].contractNumber;
|
|
|
157
|
+ }
|
|
|
158
|
+ }
|
|
|
159
|
+ }
|
|
|
160
|
+ //根据合同号获取接收合同信息中的客户ID
|
|
|
161
|
+ if ($scope.addedDetail[0].htbh != null) {
|
|
|
162
|
+ contractReceiveService.getPageInfo(null,
|
|
|
163
|
+ null,
|
|
|
164
|
+ $scope.addedDetail[0].htbh,
|
|
|
165
|
+ null,
|
|
|
166
|
+ null,
|
|
|
167
|
+ null).then(function (data) {
|
|
|
168
|
+ $scope.pageInfo = data;
|
|
|
169
|
+ if (data.list != null && data.list.length > 0) {
|
|
|
170
|
+ var khid = data.list[0].khid;
|
|
|
171
|
+ $scope.addedDetail[0].outCount = data.list[0].htzsl;
|
|
|
172
|
+ $scope.addedDetail[0].outPrice = data.list[0].htdj;
|
|
|
173
|
+ $scope.addedDetail[0].outDetailTotalPrice = data.list[0].htzj;
|
|
|
174
|
+ $scope.deliveryStorageNotice.shipingCount = $scope.addedDetail[0].outCount;
|
|
|
175
|
+ $scope.deliveryStorageNotice.moneyQuantity = $scope.addedDetail[0].outDetailTotalPrice;
|
|
|
176
|
+ //带出客户
|
|
|
177
|
+ $scope.getCustomer(khid);
|
|
|
178
|
+ }
|
|
|
179
|
+ }, function (data) {
|
|
|
180
|
+ console.log(data);
|
|
|
181
|
+ });
|
|
151
|
182
|
}
|
|
152
|
183
|
// 计算总数量.
|
|
153
|
184
|
$scope.countSumAmount();
|
|
154
|
185
|
//计算总金额
|
|
155
|
186
|
$scope.countMoneyQuantity();
|
|
156
|
187
|
|
|
157
|
|
-
|
|
158
|
188
|
}
|
|
159
|
189
|
|
|
160
|
190
|
}, function (reason) {
|
|
|
@@ -525,44 +555,6 @@ angular.module('app.business').controller("grainDeliveryStorageNoticeSaveCtrl",
|
|
525
|
555
|
|
|
526
|
556
|
//带出客户
|
|
527
|
557
|
$scope.getCustomer(result.khid);
|
|
528
|
|
-
|
|
529
|
|
-// storeWareDetailService.getByZidAndType(result.id, "cblContract").then(function(data) {
|
|
530
|
|
-//
|
|
531
|
|
-// // 循环删除计划明细中的id,有这个id会导致删除的时候误认为是删除已有明细.
|
|
532
|
|
-// for (var i=0; i< data.list.length; i++) {
|
|
533
|
|
-// $scope.idList.push(data.list[i].id);
|
|
534
|
|
-// data.list[i].id = "";
|
|
535
|
|
-// var sl_index;
|
|
536
|
|
-// if(result.contractType == 3147 || result.contractType == 7130){
|
|
537
|
|
-// if(data.list[i].remainingNumber!="" && data.list[i].remainingNumber!=null){
|
|
538
|
|
-// sl_index = data.list[i].remainingNumber.toString().indexOf("超出");
|
|
539
|
|
-// if (sl_index != -1) {
|
|
540
|
|
-// data.list[i].inCount = 0;
|
|
541
|
|
-// }
|
|
542
|
|
-// data.list[i].inDetailTotalPrice = commonUtilService.accMul(data.list[i].inCount,data.list[i].inPrice) ;
|
|
543
|
|
-// continue;
|
|
544
|
|
-// }
|
|
545
|
|
-// }else if(result.contractType == 3148 || result.contractType == 7131){
|
|
546
|
|
-// if(data.list[i].outRemainingNumber!="" && data.list[i].outRemainingNumber!=null){
|
|
547
|
|
-// sl_index = data.list[i].outRemainingNumber.toString().indexOf("超出");
|
|
548
|
|
-// if (sl_index != -1) {
|
|
549
|
|
-// data.list[i].outCount = 0;
|
|
550
|
|
-// }
|
|
551
|
|
-// data.list[i].outDetailTotalPrice = commonUtilService.accMul(data.list[i].outCount,data.list[i].outPrice) ;
|
|
552
|
|
-// continue;
|
|
553
|
|
-// }
|
|
554
|
|
-// }
|
|
555
|
|
-// }
|
|
556
|
|
-// $scope.addedDetail = data.list;
|
|
557
|
|
-// if(val=="2" && $scope.addedDetail.length>0){
|
|
558
|
|
-// $('#xztzdbh').css('display','none');
|
|
559
|
|
-// }
|
|
560
|
|
-//
|
|
561
|
|
-// // 计算合同数量.
|
|
562
|
|
-// $scope.countSumAmount();
|
|
563
|
|
-// $scope.countMoneyQuantity();
|
|
564
|
|
-// });
|
|
565
|
|
-
|
|
566
|
558
|
|
|
567
|
559
|
// 合同编号.
|
|
568
|
560
|
// $scope.deliveryStorageNotice.contract = result.contractNumber;
|