|
@@ -495,65 +495,65 @@
|
495
|
495
|
}
|
496
|
496
|
},
|
497
|
497
|
changePrescribingNumber(scope) {
|
498
|
|
- // var max_number = 0
|
499
|
|
- // if(scope.row.prescribing_number_unit == scope.row.drug.max_unit){
|
500
|
|
- // max_number = parseInt(scope.row.prescribing_number) * scope.row.drug.min_number
|
501
|
|
- // }
|
502
|
|
- // if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
|
503
|
|
- // max_number = parseInt(scope.row.prescribing_number)
|
504
|
|
- // }
|
505
|
|
- // console.log("修改的数量",max_number)
|
506
|
|
- // //查询该药品库存
|
507
|
|
- // if(this.drugList.length > 0){
|
508
|
|
- // var stock_number = 0
|
509
|
|
- // for(let i=0;i<this.drugList.length;i++){
|
510
|
|
- // if(scope.row.id == this.drugList[i].id){
|
511
|
|
- // for(let j=0;j<this.drugList[i].stock_in.length;j++){
|
512
|
|
- // stock_number += this.drugList[i].stock_in[j].stock_max_number * this.drugList[i].min_number + this.drugList[i].stock_in[j].stock_min_number
|
513
|
|
- // }
|
514
|
|
- // }
|
515
|
|
- // }
|
516
|
|
- // console.log("库存数量",stock_number)
|
517
|
|
- // }
|
518
|
|
- // if(scope.row.advice_id > 0){
|
519
|
|
- // //获取该药品上一次出库的的数量
|
520
|
|
- // getHisDoctorAdviceInfo(scope.row.advice_id).then(response=>{
|
521
|
|
- // if(response.data.state == 1){
|
522
|
|
- // var out_count = 0
|
523
|
|
- // var adviceList = response.data.data.advice
|
524
|
|
- // if(adviceList.prescribing_number_unit == adviceList.drug.max_number){
|
525
|
|
- // out_count = adviceList.prescribing_number * adviceList.drug.min_number
|
526
|
|
- // }
|
527
|
|
- // if(adviceList.prescribing_number_unit == adviceList.drug.min_unit){
|
528
|
|
- // out_count = adviceList.prescribing_number
|
529
|
|
- // }
|
|
498
|
+ var max_number = 0
|
|
499
|
+ if(scope.row.prescribing_number_unit == scope.row.drug.max_unit){
|
|
500
|
+ max_number = parseInt(scope.row.prescribing_number) * scope.row.drug.min_number
|
|
501
|
+ }
|
|
502
|
+ if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
|
|
503
|
+ max_number = parseInt(scope.row.prescribing_number)
|
|
504
|
+ }
|
|
505
|
+ console.log("修改的数量",max_number)
|
|
506
|
+ //查询该药品库存
|
|
507
|
+ if(this.drugList.length > 0){
|
|
508
|
+ var stock_number = 0
|
|
509
|
+ for(let i=0;i<this.drugList.length;i++){
|
|
510
|
+ if(scope.row.id == this.drugList[i].id){
|
|
511
|
+ for(let j=0;j<this.drugList[i].stock_in.length;j++){
|
|
512
|
+ stock_number += this.drugList[i].stock_in[j].stock_max_number * this.drugList[i].min_number + this.drugList[i].stock_in[j].stock_min_number
|
|
513
|
+ }
|
|
514
|
+ }
|
|
515
|
+ }
|
|
516
|
+ console.log("库存数量",stock_number)
|
|
517
|
+ }
|
|
518
|
+ if(scope.row.advice_id > 0){
|
|
519
|
+ //获取该药品上一次出库的的数量
|
|
520
|
+ getHisDoctorAdviceInfo(scope.row.advice_id).then(response=>{
|
|
521
|
+ if(response.data.state == 1){
|
|
522
|
+ var out_count = 0
|
|
523
|
+ var adviceList = response.data.data.advice
|
|
524
|
+ if(adviceList.prescribing_number_unit == adviceList.drug.max_number){
|
|
525
|
+ out_count = adviceList.prescribing_number * adviceList.drug.min_number
|
|
526
|
+ }
|
|
527
|
+ if(adviceList.prescribing_number_unit == adviceList.drug.min_unit){
|
|
528
|
+ out_count = adviceList.prescribing_number
|
|
529
|
+ }
|
530
|
530
|
|
531
|
|
- // //如果更改的数量大于修改之前的数量
|
532
|
|
- // if(max_number > out_count){
|
533
|
|
- // if((max_number - out_count)>stock_number){
|
534
|
|
- // this.$message.error(scope.row.drug_name + '库存不足')
|
535
|
|
- // }
|
536
|
|
- // }
|
537
|
|
- // }
|
538
|
|
- // })
|
539
|
|
- // }
|
540
|
|
-
|
541
|
|
- // if(scope.row.advice_id == 0){
|
542
|
|
- // if(max_number > stock_number){
|
543
|
|
- // this.$message.error(scope.row.drug_name + '库存不足')
|
544
|
|
- // }
|
545
|
|
- // }
|
546
|
|
-
|
|
531
|
+ //如果更改的数量大于修改之前的数量
|
|
532
|
+ if(max_number > out_count){
|
|
533
|
+ if((max_number - out_count)>stock_number){
|
|
534
|
+ this.$message.error(scope.row.drug_name + '库存不足')
|
|
535
|
+ }
|
|
536
|
+ }
|
|
537
|
+ }
|
|
538
|
+ })
|
|
539
|
+ }
|
547
|
540
|
|
548
|
|
- if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
|
549
|
|
- if (parseInt(scope.row.prescribing_number) > scope.row.drug.total) {
|
|
541
|
+ if(scope.row.advice_id == 0){
|
|
542
|
+ if(max_number > stock_number){
|
550
|
543
|
this.$message.error(scope.row.drug_name + '库存不足')
|
551
|
|
- }
|
552
|
|
- } else {
|
553
|
|
- if ((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.total) {
|
554
|
|
- this.$message.error(scope.row.drug_name + '库存不足')
|
555
|
|
- }
|
|
544
|
+ }
|
556
|
545
|
}
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+ // if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
|
|
549
|
+ // if (parseInt(scope.row.prescribing_number) > scope.row.drug.total) {
|
|
550
|
+ // this.$message.error(scope.row.drug_name + '库存不足')
|
|
551
|
+ // }
|
|
552
|
+ // } else {
|
|
553
|
+ // if ((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.total) {
|
|
554
|
+ // this.$message.error(scope.row.drug_name + '库存不足')
|
|
555
|
+ // }
|
|
556
|
+ // }
|
557
|
557
|
},
|
558
|
558
|
getProjectSingleDose(scope) {
|
559
|
559
|
this.prescription.project[scope.$index].total = scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.number_days ? scope.row.number_days : 1)
|