浏览代码

11月14日 库存扣减更新

XMLWAN 3 年前
父节点
当前提交
4c20f3ef05

+ 3 - 2
src/xt_pages/outpatientCharges/statementTemplate/printThree.vue 查看文件

147
 
147
 
148
         </div>
148
         </div>
149
         <div v-else id='prescription-print' class="prescription-print" style="position: relative;">
149
         <div v-else id='prescription-print' class="prescription-print" style="position: relative;">
150
-            <img style="width:100%;height:80px" v-if="$store.getters.xt_user.org_id != 10278" src="https://kuyi.shengws.com/bailin/bltotle.jpg" alt="">
151
-            <img style="width:100%;height:80px" v-else src="https://kuyi.shengws.com/beierlog.png" alt="">
150
+            <img style="width:100%;height:80px" v-if="$store.getters.xt_user.org_id == 10138" src="https://kuyi.shengws.com/bailin/bltotle.jpg" alt="">
151
+            <img style="width:100%;height:80px" v-if="$store.getters.xt_user.org_id == 10278" src="https://kuyi.shengws.com/beierlog.png" alt="">
152
+           
152
             <div class="printTitle" style="position: absolute;left: 40%;top: 50px;">门诊收费清单</div>
153
             <div class="printTitle" style="position: absolute;left: 40%;top: 50px;">门诊收费清单</div>
153
             <div style="display:flex;">
154
             <div style="display:flex;">
154
                 <div>单据号:<span style="display:inline-block;width:200px;">{{balanceAccounts.his.number ? balanceAccounts.his.number : ''}}</span>
155
                 <div>单据号:<span style="display:inline-block;width:200px;">{{balanceAccounts.his.number ? balanceAccounts.his.number : ''}}</span>

+ 2 - 2
src/xt_pages/outpatientDoctorStation/template/printThree.vue 查看文件

3
   <div id='prescriptionPrint1'>
3
   <div id='prescriptionPrint1'>
4
     <div v-for="(item,index) in advicePrint" :key="index">
4
     <div v-for="(item,index) in advicePrint" :key="index">
5
       <div id='prescription-print' v-if="item.project.length == 0" v-for='(i,pageIndex) in item.pageArr.length' :key="pageIndex" class="prescription-print" style="page-break-after: always;">
5
       <div id='prescription-print' v-if="item.project.length == 0" v-for='(i,pageIndex) in item.pageArr.length' :key="pageIndex" class="prescription-print" style="page-break-after: always;">
6
-          <span v-if="org_id = 10138"> <img src="https://kuyi.shengws.com/bailin/bltotle.jpg" style="width:100%" alt=""></span> 
7
-          <span v-if="org_id = 10278"> <img src="https://kuyi.shengws.com/beierlog.png" style="width:100%" alt=""></span> 
6
+          <span v-if="org_id == 10138"> <img src="https://kuyi.shengws.com/bailin/bltotle.jpg" style="width:100%" alt=""></span> 
7
+          <span v-if="org_id == 10278"> <img src="https://kuyi.shengws.com/beierlog.png" style="width:100%" alt=""></span> 
8
           <div class="printTitle">
8
           <div class="printTitle">
9
             处方笺
9
             处方笺
10
             <span v-if="item.med_type == '1111'" style="margin-left: 50px;border: 1px solid #000;">精一</span>
10
             <span v-if="item.med_type == '1111'" style="margin-left: 50px;border: 1px solid #000;">精一</span>

+ 4 - 4
src/xt_pages/outpatientDoctorStation/treatTemplate/printTwo.vue 查看文件

2
    <div id='prescriptionPrint2'>
2
    <div id='prescriptionPrint2'>
3
     <div id='prescription-print' v-if="item.advices.length == 0" class="prescription-print" v-for="(item,index) in advicePrint" :key="index">
3
     <div id='prescription-print' v-if="item.advices.length == 0" class="prescription-print" v-for="(item,index) in advicePrint" :key="index">
4
 
4
 
5
-        <span v-if="org_id = 10138"> <img src="https://kuyi.shengws.com/bailin/bltotle.jpg" style="width:100%" alt=""></span>
6
-         <span v-if="org_id = 10278"> <img src="https://kuyi.shengws.com/beierlog.png" style="width:100%" alt=""></span>
5
+        <span v-if="org_id == 10138"> <img src="https://kuyi.shengws.com/bailin/bltotle.jpg" style="width:100%" alt=""></span>
6
+         <span v-if="org_id == 10278"> <img src="https://kuyi.shengws.com/beierlog.png" style="width:100%" alt=""></span>
7
         <div class="printTitle">治疗单
7
         <div class="printTitle">治疗单
8
           <span v-if="item.med_type == '1111'" style="margin-left: 50px;border: 1px solid #000;">精一</span>
8
           <span v-if="item.med_type == '1111'" style="margin-left: 50px;border: 1px solid #000;">精一</span>
9
           <span v-if="item.med_type == '1112'" style="margin-left: 50px;border: 1px solid #000;">精二</span>
9
           <span v-if="item.med_type == '1112'" style="margin-left: 50px;border: 1px solid #000;">精二</span>
92
           <div style="display:flex;">
92
           <div style="display:flex;">
93
             打印时间:<span style="border-bottom:1px solid #000;">{{getTime(new Date())?getTime(new Date()):""}}</span>
93
             打印时间:<span style="border-bottom:1px solid #000;">{{getTime(new Date())?getTime(new Date()):""}}</span>
94
           </div>
94
           </div>
95
-          <span v-if="org_id == 10138"></span> <img src="https://kuyi.shengws.com/bailin/blend.jpg" style="width:100%" alt="">
96
-          <span v-if="org_id == 10278"></span> <img src="https://kuyi.shengws.com/bailinbeier.png" style="width:100%" alt="">
95
+          <span v-if="org_id == 10138"><img src="https://kuyi.shengws.com/bailin/blend.jpg" style="width:100%" alt=""></span> 
96
+          <span v-if="org_id == 10278"><img src="https://kuyi.shengws.com/bailinbeier.png" style="width:100%" alt=""></span> 
97
           <div style="page-break-after:always"></div>
97
           <div style="page-break-after:always"></div>
98
      </div>
98
      </div>
99
 
99
 

+ 119 - 3
src/xt_pages/supply/components/addGoodReturn.vue 查看文件

202
                 :rules="tableRules.supply_count"
202
                 :rules="tableRules.supply_count"
203
               >
203
               >
204
                 <el-input
204
                 <el-input
205
+                  @input="getSupplyCount(scope.row.supply_count,scope.row.sum_count,scope.row.supply_unit,scope.row.type,scope.row.min_number,scope.row.max_unit,scope.row.min_unit,scope.$index)"
205
                   v-model="scope.row.supply_count"
206
                   v-model="scope.row.supply_count"
206
                   style="width: 80px"
207
                   style="width: 80px"
207
                   :disabled="disabled"
208
                   :disabled="disabled"
554
               drugList[i].unitList[0].name = drugList[i].max_unit;
555
               drugList[i].unitList[0].name = drugList[i].max_unit;
555
               drugList[i].unitList[1].name = drugList[i].min_unit;
556
               drugList[i].unitList[1].name = drugList[i].min_unit;
556
             }
557
             }
558
+            drugList[i].sum_count =  this.getWarehoseInfoTwo(
559
+              drugList[i].drug_warehouse_info,
560
+              drugList[i].max_unit,
561
+              drugList[i].min_unit,
562
+              drugList[i].min_number
563
+            );
557
             this.tabList.push(drugList[i]);
564
             this.tabList.push(drugList[i]);
558
           }
565
           }
559
           this.drugList = drugList;
566
           this.drugList = drugList;
601
             for (let j = 0; j < goodList[i].unitList.length; j++) {
608
             for (let j = 0; j < goodList[i].unitList.length; j++) {
602
               goodList[i].unitList[0].name = goodList[i].packing_unit;
609
               goodList[i].unitList[0].name = goodList[i].packing_unit;
603
             }
610
             }
611
+        
612
+            goodList[i].sum_count = this.getTotalStockCountTwo(
613
+              goodList[i].good_warehouse_info
614
+            );
604
             this.tabList.push(goodList[i]);
615
             this.tabList.push(goodList[i]);
605
           }
616
           }
606
           this.goodList = goodList;
617
           this.goodList = goodList;
611
       this.currentIndex = val;
622
       this.currentIndex = val;
612
     },
623
     },
613
     changeName(val) {
624
     changeName(val) {
625
+      console.log("val332322323233",val)
614
       for (let i = 0; i < this.recordInfo.tableList.length; i++) {
626
       for (let i = 0; i < this.recordInfo.tableList.length; i++) {
615
         if (this.currentIndex == i) {
627
         if (this.currentIndex == i) {
616
           this.recordInfo.tableList[i].project_id = val.id;
628
           this.recordInfo.tableList[i].project_id = val.id;
643
           this.recordInfo.tableList[i].supply_unit = val.supply_unit;
655
           this.recordInfo.tableList[i].supply_unit = val.supply_unit;
644
           this.recordInfo.tableList[i].unitList = val.unitList;
656
           this.recordInfo.tableList[i].unitList = val.unitList;
645
           this.recordInfo.tableList[i].count = val.count
657
           this.recordInfo.tableList[i].count = val.count
658
+          this.recordInfo.tableList[i].sum_count = val.sum_count
659
+          if(val.type == 1){
660
+            this.recordInfo.tableList[i].min_number = val.min_number
661
+            this.recordInfo.tableList[i].max_unit = val.max_unit
662
+            this.recordInfo.tableList[i].min_unit = val.min_unit
663
+          }else{
664
+             this.recordInfo.tableList[i].max_unit = ""
665
+             this.recordInfo.tableList[i].min_unit = ""
666
+             this.recordInfo.tableList[i].min_number = ""
667
+          }
646
         }
668
         }
647
       }
669
       }
648
     },
670
     },
674
       tempObj["good_number"] = ""
696
       tempObj["good_number"] = ""
675
       tempObj["min_price"] = "";
697
       tempObj["min_price"] = "";
676
       tempObj["deposit_rate"] = ""
698
       tempObj["deposit_rate"] = ""
699
+      tempObj["sum_count"] = 0
700
+      tempObj["min_number"] = 0
701
+      tempObj["max_unit"] = ""
702
+      tempObj["min_unit"] = ""
677
       this.recordInfo.tableList.push(tempObj);
703
       this.recordInfo.tableList.push(tempObj);
678
     },
704
     },
679
     handleDelete: function (index, row) {
705
     handleDelete: function (index, row) {
712
       console.log("hh2332232332",max_str + min_str)
738
       console.log("hh2332232332",max_str + min_str)
713
       return max_str + min_str;
739
       return max_str + min_str;
714
     },
740
     },
741
+    getWarehoseInfoTwo(arr, max_unit, min_unit, min_number){
742
+      var total = 0;
743
+      if (arr.length > 0) {
744
+        for (let i = 0; i < arr.length; i++) {
745
+          total += parseInt(arr[i].stock_max_number+ arr[i].stock_min_number);
746
+        }
747
+      }
748
+      return total
749
+    },
715
     getTotalStockCount(arr) {
750
     getTotalStockCount(arr) {
716
       var total_count = 0;
751
       var total_count = 0;
717
       for (let i = 0; i < arr.length; i++) {
752
       for (let i = 0; i < arr.length; i++) {
723
         return ""
758
         return ""
724
       }
759
       }
725
       
760
       
761
+    },
762
+    getTotalStockCountTwo(arr) {
763
+      var total_count = 0;
764
+      for (let i = 0; i < arr.length; i++) {
765
+        total_count += arr[i].stock_count;
766
+      }
767
+      return total_count
768
+    
726
     },
769
     },
727
     calculate: function (val) {
770
     calculate: function (val) {
728
       if (isNaN(val)) {
771
       if (isNaN(val)) {
833
             }
876
             }
834
             orderInfo[i].id = orderInfo[i].id;
877
             orderInfo[i].id = orderInfo[i].id;
835
             orderInfo[i].supply_count = orderInfo[i].supply_count;
878
             orderInfo[i].supply_count = orderInfo[i].supply_count;
836
-            orderInfo[i].count = orderInfo[i].count
879
+            
837
             orderInfo[i].supply_price = orderInfo[i].price;
880
             orderInfo[i].supply_price = orderInfo[i].price;
838
             orderInfo[i].supply_remake = orderInfo[i].remark;
881
             orderInfo[i].supply_remake = orderInfo[i].remark;
839
             orderInfo[i].type = orderInfo[i].is_source;
882
             orderInfo[i].type = orderInfo[i].is_source;
864
                     orderInfo[i].unitList = [{ id: 1, name: "" }];
907
                     orderInfo[i].unitList = [{ id: 1, name: "" }];
865
                     orderInfo[i].unitList[0].name = drugList[j].max_unit;
908
                     orderInfo[i].unitList[0].name = drugList[j].max_unit;
866
                   }
909
                   }
910
+                   //用来统计数量比大小
911
+                 if(orderInfo[i].supply_unit == drugList[j].max_unit){
912
+                    orderInfo[i].sum_count = orderInfo[i].count*drugList[j].min_number
913
+                  }
914
+                  if(orderInfo[i].supply_unit == drugList[j].min_unit){
915
+                     orderInfo[i].sum_count = orderInfo[i].count
916
+                  }
917
+                  orderInfo[i].min_number =  drugList[j].min_number
918
+                  orderInfo[i].max_unit =drugList[j].max_unit
919
+                  orderInfo[i].min_unit =drugList[j].min_unit
867
                 }
920
                 }
921
+               
868
               }
922
               }
923
+              orderInfo[i].count = orderInfo[i].count + orderInfo[i].supply_unit
869
             }
924
             }
870
             if (orderInfo[i].is_source == 2) {
925
             if (orderInfo[i].is_source == 2) {
871
               for (let j = 0; j < goodList.length; j++) {
926
               for (let j = 0; j < goodList.length; j++) {
874
                   orderInfo[i].unitList[0].name = goodList[j].packing_unit;
929
                   orderInfo[i].unitList[0].name = goodList[j].packing_unit;
875
                 }
930
                 }
876
               }
931
               }
932
+              orderInfo[i].sum_count = orderInfo[i].count
933
+              orderInfo[i].min_number = 0
934
+              orderInfo[i].count = orderInfo[i].count;
935
+              orderInfo[i].max_unit =""
936
+              orderInfo[i].min_unit =""
877
             }
937
             }
878
           }
938
           }
879
 
939
 
880
           this.recordInfo.tableList = [];
940
           this.recordInfo.tableList = [];
941
+          console.log("相亲233232322332323223322323",orderInfo)
881
           this.recordInfo.tableList = orderInfo;
942
           this.recordInfo.tableList = orderInfo;
882
           this.tableDataList = []
943
           this.tableDataList = []
883
           this.tableDataList = orderInfo
944
           this.tableDataList = orderInfo
894
         if(valid){
955
         if(valid){
895
           this.loading = true
956
           this.loading = true
896
           for(let i=0;i<this.recordInfo.tableList.length;i++){
957
           for(let i=0;i<this.recordInfo.tableList.length;i++){
958
+            if(this.recordInfo.tableList[i].count == ""){
959
+              this.$message.error(this.recordInfo.tableList[i].name+"无可退库数量,保存失败!")
960
+              this.loading = false
961
+              return false
962
+            }
897
             this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count);
963
             this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count);
898
             this.recordInfo.tableList[i].supply_price =this.recordInfo.tableList[i].supply_price.toString();
964
             this.recordInfo.tableList[i].supply_price =this.recordInfo.tableList[i].supply_price.toString();
899
             this.recordInfo.tableList[i].supply_total =this.recordInfo.tableList[i].supply_total.toString();
965
             this.recordInfo.tableList[i].supply_total =this.recordInfo.tableList[i].supply_total.toString();
916
             }
982
             }
917
           } 
983
           } 
918
            //判断是否在采购单数据中做了删除,如果长度相等则代表没有删除,如果不等则代表做了删除或者新增
984
            //判断是否在采购单数据中做了删除,如果长度相等则代表没有删除,如果不等则代表做了删除或者新增
919
-           if(this.recordInfo.tableList.length != this.tableDataList.length){
985
+           if(this.recordInfo.tableList.length < this.tableDataList.length){
920
              warehouse_out_id = 0
986
              warehouse_out_id = 0
921
              for(let i=0;i<this.recordInfo.tableList.length;i++){
987
              for(let i=0;i<this.recordInfo.tableList.length;i++){
922
                 this.recordInfo.tableList[i].id = 0
988
                 this.recordInfo.tableList[i].id = 0
1102
         }
1168
         }
1103
       });
1169
       });
1104
     },
1170
     },
1105
-   
1171
+    getSupplyCount(supply_count,sum_count,supply_unit,type,min_number,max_unit,min_unit,index){
1172
+     console.log("val23322323",supply_count,sum_count,supply_unit,type,min_number,max_unit,min_unit)
1173
+      var total_count = 0
1174
+      
1175
+      if(type == 1){
1176
+       if(supply_unit == max_unit){
1177
+          total_count = supply_count * min_number
1178
+       }
1179
+       if(supply_unit == min_unit){
1180
+         total_count = supply_count
1181
+       }
1182
+       console.log("sum_counts",sum_count)
1183
+       console.log("count232232332",total_count)
1184
+       if(total_count > sum_count){
1185
+         this.$message.error("数量不能大于可退数量!")
1186
+         for(let i=0;i<this.recordInfo.tableList.length;i++){
1187
+           if(index == i){
1188
+             this.recordInfo.tableList[i].supply_count = ""
1189
+           }
1190
+         }
1191
+       }else{
1192
+           for(let i=0;i<this.recordInfo.tableList.length;i++){
1193
+            if(index == i){
1194
+              this.recordInfo.tableList[i].supply_count = supply_count
1195
+            }
1196
+          }
1197
+         }
1198
+      }
1199
+       
1200
+      if(type == 2){
1201
+         if(supply_count > sum_count){
1202
+          this.$message.error("数量不能大于可退数量!")
1203
+          for(let i=0;i<this.recordInfo.tableList.length;i++){
1204
+            if(index == i){
1205
+              this.recordInfo.tableList[i].supply_count = ""
1206
+            }
1207
+          }
1208
+         }else{
1209
+           for(let i=0;i<this.recordInfo.tableList.length;i++){
1210
+            if(index == i){
1211
+              this.recordInfo.tableList[i].supply_count = supply_count
1212
+            }
1213
+          }
1214
+         }
1215
+      }
1216
+    
1217
+    },
1106
   },
1218
   },
1107
   created() {
1219
   created() {
1108
     const tempObj = {};
1220
     const tempObj = {};
1132
     tempObj["good_number"] = ""
1244
     tempObj["good_number"] = ""
1133
     tempObj["min_price"] = "";
1245
     tempObj["min_price"] = "";
1134
     tempObj["deposit_rate"] = ""
1246
     tempObj["deposit_rate"] = ""
1247
+    tempObj["sum_count"] = 0
1248
+    tempObj["min_number"] = 0
1249
+    tempObj["max_unit"] = ""
1250
+    tempObj["min_unit"] = ""
1135
     this.recordInfo.tableList.push(tempObj);
1251
     this.recordInfo.tableList.push(tempObj);
1136
    
1252
    
1137
     this.getInitOrder();
1253
     this.getInitOrder();

+ 131 - 16
src/xt_pages/supply/components/editGoodReturn.vue 查看文件

174
                   placeholder="请选择"
174
                   placeholder="请选择"
175
                   :disabled="disabled"
175
                   :disabled="disabled"
176
                 >
176
                 >
177
-                  <!-- <el-option
178
-                            v-for="(item,index) in scope.row.unitList"
179
-                            :key="index"
180
-                            :label="item.name"
181
-                            :value="item.name">
182
-                        </el-option> -->
177
+                  <el-option
178
+                    v-for="(item,index) in scope.row.unitList"
179
+                    :key="index"
180
+                    :label="item.name"
181
+                    :value="item.name">
182
+                  </el-option>
183
                 </el-select>
183
                 </el-select>
184
               </el-form-item>
184
               </el-form-item>
185
             </template>
185
             </template>
214
                 :rules="tableRules.supply_count"
214
                 :rules="tableRules.supply_count"
215
               >
215
               >
216
                 <el-input
216
                 <el-input
217
+                 @input="getSupplyCount(scope.row.supply_count,scope.row.sum_count,scope.row.supply_unit,scope.row.type,scope.row.min_number,scope.row.max_unit,scope.row.min_unit,scope.$index)"
217
                   v-model="scope.row.supply_count"
218
                   v-model="scope.row.supply_count"
218
                   style="width: 80px"
219
                   style="width: 80px"
219
                   :disabled="disabled"
220
                   :disabled="disabled"
554
               drugList[i].min_unit,
555
               drugList[i].min_unit,
555
               drugList[i].min_number
556
               drugList[i].min_number
556
             );
557
             );
558
+            
557
             drugList[i].supply_count = "";
559
             drugList[i].supply_count = "";
558
             drugList[i].supply_total_price = "";
560
             drugList[i].supply_total_price = "";
559
             drugList[i].supply_manufacturer = drugList[i].manufacturer;
561
             drugList[i].supply_manufacturer = drugList[i].manufacturer;
562
             drugList[i].type = 1;
564
             drugList[i].type = 1;
563
             drugList[i].supply_price = drugList[i].last_price;
565
             drugList[i].supply_price = drugList[i].last_price;
564
             drugList[i].name = drugList[i].drug_name;
566
             drugList[i].name = drugList[i].drug_name;
565
-            drugList[i].count = ""
566
             drugList[i].unitList = [
567
             drugList[i].unitList = [
567
               { id: 1, name: "" },
568
               { id: 1, name: "" },
568
               { id: 2, name: "" },
569
               { id: 2, name: "" },
572
               drugList[i].unitList[0].name = drugList[i].max_unit;
573
               drugList[i].unitList[0].name = drugList[i].max_unit;
573
               drugList[i].unitList[1].name = drugList[i].min_unit;
574
               drugList[i].unitList[1].name = drugList[i].min_unit;
574
             }
575
             }
576
+            drugList[i].sum_count =  this.getWarehoseInfoTwo(
577
+              drugList[i].drug_warehouse_info,
578
+              drugList[i].max_unit,
579
+              drugList[i].min_unit,
580
+              drugList[i].min_number
581
+            );
575
             this.tabList.push(drugList[i]);
582
             this.tabList.push(drugList[i]);
576
           }
583
           }
577
           this.drugList = drugList;
584
           this.drugList = drugList;
617
             ];
624
             ];
618
 
625
 
619
             goodList[i].supply_unit = goodList[i].packing_unit;
626
             goodList[i].supply_unit = goodList[i].packing_unit;
620
-            goodList[i].count = ""
627
+
621
             for (let j = 0; j < goodList[i].unitList.length; j++) {
628
             for (let j = 0; j < goodList[i].unitList.length; j++) {
622
               goodList[i].unitList[0].name = goodList[i].packing_unit;
629
               goodList[i].unitList[0].name = goodList[i].packing_unit;
623
             }
630
             }
631
+            goodList[i].sum_count = this.getTotalStockCountTwo(
632
+              goodList[i].good_warehouse_info
633
+            );
624
             this.tabList.push(goodList[i]);
634
             this.tabList.push(goodList[i]);
625
           }
635
           }
626
           this.goodList = goodList;
636
           this.goodList = goodList;
631
       this.currentIndex = val;
641
       this.currentIndex = val;
632
     },
642
     },
633
     changeName(val) {
643
     changeName(val) {
644
+    
634
       for (let i = 0; i < this.recordInfo.tableList.length; i++) {
645
       for (let i = 0; i < this.recordInfo.tableList.length; i++) {
635
         if (this.currentIndex == i) {
646
         if (this.currentIndex == i) {
636
           this.recordInfo.tableList[i].project_id = val.id;
647
           this.recordInfo.tableList[i].project_id = val.id;
638
           this.recordInfo.tableList[i].name = val.name;
649
           this.recordInfo.tableList[i].name = val.name;
639
           this.recordInfo.tableList[i].supply_name = val.supply_name;
650
           this.recordInfo.tableList[i].supply_name = val.supply_name;
640
           this.recordInfo.tableList[i].supply_type = val.supply_type;
651
           this.recordInfo.tableList[i].supply_type = val.supply_type;
641
-          this.recordInfo.tableList[i].supply_specification_name =
642
-            val.supply_specification_name;
652
+          this.recordInfo.tableList[i].supply_specification_name = val.supply_specification_name;
643
           this.recordInfo.tableList[i].supply_total = val.supply_total;
653
           this.recordInfo.tableList[i].supply_total = val.supply_total;
644
           if (val.supply_count == NaN) {
654
           if (val.supply_count == NaN) {
645
             this.recordInfo.tableList[i].supply_count = "";
655
             this.recordInfo.tableList[i].supply_count = "";
663
           this.recordInfo.tableList[i].supply_unit = val.supply_unit;
673
           this.recordInfo.tableList[i].supply_unit = val.supply_unit;
664
           this.recordInfo.tableList[i].unitList = val.unitList;
674
           this.recordInfo.tableList[i].unitList = val.unitList;
665
           this.recordInfo.tableList[i].count = val.count
675
           this.recordInfo.tableList[i].count = val.count
676
+          this.recordInfo.tableList[i].sum_count = val.sum_count
677
+          
678
+          if(val.type == 1){
679
+            this.recordInfo.tableList[i].min_number = val.min_number
680
+            this.recordInfo.tableList[i].max_unit = val.max_unit
681
+            this.recordInfo.tableList[i].min_unit = val.min_unit
682
+          }else{
683
+             this.recordInfo.tableList[i].max_unit = ""
684
+             this.recordInfo.tableList[i].min_unit = ""
685
+             this.recordInfo.tableList[i].min_number = ""
686
+          }
687
+          
688
+         
666
         }
689
         }
667
       }
690
       }
668
     },
691
     },
698
       tempObj["good_number"] = ""
721
       tempObj["good_number"] = ""
699
       tempObj["deposit_rate"] = ""
722
       tempObj["deposit_rate"] = ""
700
       tempObj["order_number"] = ""
723
       tempObj["order_number"] = ""
724
+      tempObj["sum_count"] =0
725
+      tempObj["min_number"] = 0
726
+      tempObj["max_unit"] = ""
727
+      tempObj["min_unit"] = ""
701
       this.recordInfo.tableList.push(tempObj);
728
       this.recordInfo.tableList.push(tempObj);
702
     },
729
     },
703
     handleDelete: function (index, row) {
730
     handleDelete: function (index, row) {
744
       var min_str = "";
771
       var min_str = "";
745
       if (arr.length > 0) {
772
       if (arr.length > 0) {
746
         for (let i = 0; i < arr.length; i++) {
773
         for (let i = 0; i < arr.length; i++) {
774
+
747
           total += parseInt(arr[i].stock_max_number+ arr[i].stock_min_number);
775
           total += parseInt(arr[i].stock_max_number+ arr[i].stock_min_number);
748
         }
776
         }
749
       }
777
       }
764
       }
792
       }
765
       return max_str + min_str;
793
       return max_str + min_str;
766
     },
794
     },
795
+    getWarehoseInfoTwo(arr, max_unit, min_unit, min_number){
796
+      var total = 0;
797
+      if (arr.length > 0) {
798
+        for (let i = 0; i < arr.length; i++) {
799
+          total += parseInt(arr[i].stock_max_number+ arr[i].stock_min_number);
800
+        }
801
+      }
802
+      return total
803
+    },
767
     getTotalStockCount(arr) {
804
     getTotalStockCount(arr) {
768
       var total_count = 0;
805
       var total_count = 0;
769
       for (let i = 0; i < arr.length; i++) {
806
       for (let i = 0; i < arr.length; i++) {
775
         return ""
812
         return ""
776
       }
813
       }
777
     
814
     
815
+    },
816
+    getTotalStockCountTwo(arr) {
817
+      var total_count = 0;
818
+      for (let i = 0; i < arr.length; i++) {
819
+        total_count += arr[i].stock_count;
820
+      }
821
+      return total_count
822
+    
778
     },
823
     },
779
     calculate: function (val) {
824
     calculate: function (val) {
780
       if (isNaN(val)) {
825
       if (isNaN(val)) {
893
     count_arrearage() {
938
     count_arrearage() {
894
       this.payment = this.total_price - this.arrearage;
939
       this.payment = this.total_price - this.arrearage;
895
     },
940
     },
941
+    getSupplyCount(supply_count,sum_count,supply_unit,type,min_number,max_unit,min_unit,index){
942
+     console.log("val23322323",supply_count,sum_count,supply_unit,type,min_number,max_unit,min_unit)
943
+      var total_count = 0
944
+      
945
+      if(type == 1){
946
+       if(supply_unit == max_unit){
947
+          total_count = supply_count * min_number
948
+       }
949
+       if(supply_unit == min_unit){
950
+         total_count = supply_count
951
+       }
952
+       console.log("sum_counts",sum_count)
953
+       console.log("count232232332",total_count)
954
+       if(total_count > sum_count){
955
+         this.$message.error("数量不能大于可退数量!")
956
+         for(let i=0;i<this.recordInfo.tableList.length;i++){
957
+           if(index == i){
958
+             this.recordInfo.tableList[i].supply_count = ""
959
+           }
960
+         }
961
+       }else{
962
+           for(let i=0;i<this.recordInfo.tableList.length;i++){
963
+            if(index == i){
964
+              this.recordInfo.tableList[i].supply_count = supply_count
965
+            }
966
+          }
967
+         }
968
+      }
969
+       
970
+      if(type == 2){
971
+         if(supply_count > sum_count){
972
+          this.$message.error("数量不能大于可退数量!")
973
+          for(let i=0;i<this.recordInfo.tableList.length;i++){
974
+            if(index == i){
975
+              this.recordInfo.tableList[i].supply_count = ""
976
+            }
977
+          }
978
+         }else{
979
+           for(let i=0;i<this.recordInfo.tableList.length;i++){
980
+            if(index == i){
981
+              this.recordInfo.tableList[i].supply_count = supply_count
982
+            }
983
+          }
984
+         }
985
+      }
986
+    
987
+    },
896
     getGoodReturnDetail() {
988
     getGoodReturnDetail() {
897
       var id = this.$route.query.id;
989
       var id = this.$route.query.id;
898
       getGoodReturnDetail(id).then((response) => {
990
       getGoodReturnDetail(id).then((response) => {
921
           for (let i = 0; i < orderInfo.length; i++) {
1013
           for (let i = 0; i < orderInfo.length; i++) {
922
             orderInfo[i].id = orderInfo[i].id;
1014
             orderInfo[i].id = orderInfo[i].id;
923
             orderInfo[i].supply_count = orderInfo[i].supply_count;
1015
             orderInfo[i].supply_count = orderInfo[i].supply_count;
924
-            orderInfo[i].count = orderInfo[i].count;
925
             orderInfo[i].supply_price = orderInfo[i].price;
1016
             orderInfo[i].supply_price = orderInfo[i].price;
926
             orderInfo[i].supply_remake = orderInfo[i].remark;
1017
             orderInfo[i].supply_remake = orderInfo[i].remark;
927
             orderInfo[i].type = orderInfo[i].is_source;
1018
             orderInfo[i].type = orderInfo[i].is_source;
937
             if (orderInfo[i].is_source == 1) {
1028
             if (orderInfo[i].is_source == 1) {
938
               for (let j = 0; j < drugList.length; j++) {
1029
               for (let j = 0; j < drugList.length; j++) {
939
                 if (orderInfo[i].project_id == drugList[j].id) {
1030
                 if (orderInfo[i].project_id == drugList[j].id) {
1031
+                  
940
                   if (drugList[j].max_unit != drugList[j].min_unit) {
1032
                   if (drugList[j].max_unit != drugList[j].min_unit) {
941
-                    orderInfo[i].unitList = [
942
-                      { id: 1, name: "" },
943
-                      { id: 2, name: "" },
944
-                    ];
1033
+                    orderInfo[i].unitList = [{ id: 1, name: "" },{ id: 2, name: "" }];
945
                     orderInfo[i].unitList[0].name = drugList[j].max_unit;
1034
                     orderInfo[i].unitList[0].name = drugList[j].max_unit;
946
                     orderInfo[i].unitList[1].name = drugList[j].min_unit;
1035
                     orderInfo[i].unitList[1].name = drugList[j].min_unit;
947
                   }
1036
                   }
949
                     orderInfo[i].unitList = [{ id: 1, name: "" }];
1038
                     orderInfo[i].unitList = [{ id: 1, name: "" }];
950
                     orderInfo[i].unitList[0].name = drugList[j].max_unit;
1039
                     orderInfo[i].unitList[0].name = drugList[j].max_unit;
951
                   }
1040
                   }
1041
+                  //用来统计数量比大小
1042
+                  if(orderInfo[i].supply_unit == drugList[j].max_unit){
1043
+                    orderInfo[i].sum_count = orderInfo[i].count*drugList[j].min_number
1044
+                  }
1045
+                  if(orderInfo[i].supply_unit == drugList[j].min_unit){
1046
+                     orderInfo[i].sum_count = orderInfo[i].count
1047
+                  }
1048
+                  orderInfo[i].min_number =  drugList[j].min_number
1049
+                  orderInfo[i].max_unit =drugList[j].max_unit
1050
+                  orderInfo[i].min_unit =drugList[j].min_unit
952
                 }
1051
                 }
953
               }
1052
               }
1053
+              orderInfo[i].count = orderInfo[i].count + orderInfo[i].supply_unit
954
             }
1054
             }
955
             if (orderInfo[i].is_source == 2) {
1055
             if (orderInfo[i].is_source == 2) {
956
               for (let j = 0; j < goodList.length; j++) {
1056
               for (let j = 0; j < goodList.length; j++) {
959
                   orderInfo[i].unitList[0].name = goodList[j].packing_unit;
1059
                   orderInfo[i].unitList[0].name = goodList[j].packing_unit;
960
                 }
1060
                 }
961
               }
1061
               }
1062
+              orderInfo[i].sum_count = orderInfo[i].count
1063
+              orderInfo[i].min_number = 0
1064
+              orderInfo[i].count = orderInfo[i].count;
1065
+              orderInfo[i].max_unit =""
1066
+              orderInfo[i].min_unit =""
962
             }
1067
             }
963
           }
1068
           }
964
 
1069
 
965
           this.recordInfo.tableList = [];
1070
           this.recordInfo.tableList = [];
1071
+          console.log("or233232332233223233223",orderInfo)
966
           this.recordInfo.tableList = orderInfo;
1072
           this.recordInfo.tableList = orderInfo;
967
         }
1073
         }
968
       });
1074
       });
977
         if (valid) {
1083
         if (valid) {
978
           this.loading = true;
1084
           this.loading = true;
979
           for (let i = 0; i < this.recordInfo.tableList.length; i++) {
1085
           for (let i = 0; i < this.recordInfo.tableList.length; i++) {
1086
+            if(this.recordInfo.tableList[i].count == ""){
1087
+              this.$message.error(this.recordInfo.tableList[i].name+"无可退库数量,保存失败!")
1088
+              this.loading = false
1089
+              return false
1090
+            }
980
             this.recordInfo.tableList[i].supply_count = parseInt(
1091
             this.recordInfo.tableList[i].supply_count = parseInt(
981
               this.recordInfo.tableList[i].supply_count
1092
               this.recordInfo.tableList[i].supply_count
982
             );
1093
             );
1008
             return_marke: this.return_remark,
1119
             return_marke: this.return_remark,
1009
           };
1120
           };
1010
           console.log("parms32322332",params)
1121
           console.log("parms32322332",params)
1011
-         
1122
+          
1012
           updateGoodReturn(
1123
           updateGoodReturn(
1013
             params,
1124
             params,
1014
             warehouse_out_id,
1125
             warehouse_out_id,
1114
     tempObj["good_number"] = ""
1225
     tempObj["good_number"] = ""
1115
     tempObj["deposit_rate"] = ""
1226
     tempObj["deposit_rate"] = ""
1116
     tempObj["order_number"] = ""
1227
     tempObj["order_number"] = ""
1228
+    tempObj["sum_count"] = 0
1229
+    tempObj["min_number"] = 0
1230
+    tempObj["max_unit"] = ""
1231
+    tempObj["min_unit"] = ""
1117
     this.recordInfo.tableList.push(tempObj);
1232
     this.recordInfo.tableList.push(tempObj);
1118
     this.getInitOrder();
1233
     this.getInitOrder();
1119
 
1234
 

+ 10 - 3
src/xt_pages/supply/purchaseOrderQuery.vue 查看文件

128
             <!-- <span v-if="scope.row.is_warehouse == 1">全部入库</span>
128
             <!-- <span v-if="scope.row.is_warehouse == 1">全部入库</span>
129
             <span v-if="scope.row.is_warehouse == 2">未入库</span>
129
             <span v-if="scope.row.is_warehouse == 2">未入库</span>
130
             <span v-if="scope.row.is_warehouse == 3">部分入库</span> -->
130
             <span v-if="scope.row.is_warehouse == 3">部分入库</span> -->
131
-            <span v-if="scope.row.orderOut!= undefined && scope.row.orderOut.length == 0">未入库</span> 
131
+          
132
             <span v-if="scope.row.orderOut!= undefined && scope.row.orderOut.length > 0">
132
             <span v-if="scope.row.orderOut!= undefined && scope.row.orderOut.length > 0">
133
-            <span v-if="getStatus(scope.row.orderOut) >= getAllCount(scope.row.orderInfo) ">全部入库</span> 
134
-            <span v-if="getStatus(scope.row.orderOut) < getAllCount(scope.row.orderInfo) ">部分入库</span> 
133
+              <span >
134
+                <span v-if="getStatus(scope.row.orderOut) == 0">未入库</span>
135
+                <span v-if="getStatus(scope.row.orderOut) > 0">
136
+                  <span v-if="getStatus(scope.row.orderOut) >= getAllCount(scope.row.orderInfo) ">全部入库</span> 
137
+                  <span v-if="getStatus(scope.row.orderOut) < getAllCount(scope.row.orderInfo) ">部分入库</span>
138
+                </span>
139
+              </span> 
140
+              
141
+              
135
             </span> 
142
             </span> 
136
           </template>
143
           </template>
137
         </el-table-column>
144
         </el-table-column>