XMLWAN 3 years ago
parent
commit
f6cf203ca8

+ 4 - 2
src/xt_pages/outpatientDoctorStation/components/deskPrescription.vue View File

@@ -2621,7 +2621,9 @@
2621 2621
             var temp2 = this.deepClone(this.teamList)
2622 2622
 
2623 2623
             var temp3 = this.deepClone(templateDrugs)
2624
-
2624
+            console.log("hhhhhhhhhhhhhh",temp)
2625
+            console.log("hhhh23",temp2)
2626
+            console.log("hhhh23",temp3)
2625 2627
             if (temp3.length > 0) {
2626 2628
               for (let b = 0; b < temp3.length; b++) {
2627 2629
                 let obj = {
@@ -2658,7 +2660,7 @@
2658 2660
                   single_dose: temp[b].single_dose,
2659 2661
                   delivery_way: temp[b].delivery_way,
2660 2662
                   execution_frequency: temp[b].execution_frequency,
2661
-                  retail_price: temp[b].retail_price.toString(),
2663
+                  retail_price: temp[b].min_price.toString(),
2662 2664
                   remark: '',
2663 2665
                   day: temp[b].drug_day ? temp[b].drug_day : 1,
2664 2666
                   prescribing_number: temp[b].prescribing_number,

+ 1 - 1
src/xt_pages/stock/cancelStockOrderAdd.vue View File

@@ -584,7 +584,7 @@ export default {
584 584
                 return
585 585
              }
586 586
              if(msg == 2){
587
-               this.$message.error("退库数量大于出库数量")
587
+               this.$message.error("该批次退库数量大于出库数量")
588 588
              }
589 589
               if(msg == 4){
590 590
                this.$message.error("该批次退库数量大于入库数量")

+ 3 - 3
src/xt_pages/stock/cancelStockOrderEdit.vue View File

@@ -392,13 +392,13 @@
392 392
         tempObj['id'] = 0
393 393
         tempObj['good_type_id'] = 0
394 394
         tempObj['good_id'] = 0
395
-        tempObj['count'] = ''
395
+        tempObj['count'] = 0
396 396
         tempObj["number"] = ""
397 397
         tempObj["dealer"] = ""
398 398
         tempObj["manufacturer"]= ""
399 399
         tempObj["register_account"] = ""
400 400
         tempObj["remark"] = ""
401
-        tempObj["price"] = ""
401
+        tempObj["price"] = 0
402 402
         tempObj["warehouse_info_id"] = 0
403 403
         this.recordInfo.recordData.push(tempObj)
404 404
       }, handleDelete: function(index, row) {
@@ -546,7 +546,7 @@
546 546
                   this.$message.error("退库数量大于出库数量")
547 547
                 }
548 548
                 if(msg == 4){
549
-                  this.$message.error("该批次退库数量大于库数量")
549
+                  this.$message.error("该批次退库数量大于库数量")
550 550
                 }
551 551
                  if(msg == 5){
552 552
                   this.$message.error("该批次退库数量大于入库数量")

+ 2 - 2
src/xt_pages/stock/drugs/cancelDrugOrderPrint.vue View File

@@ -9,7 +9,7 @@
9 9
       <div id="dialysis-print-box">
10 10
         <div class="dialysis-print-order" v-for="(it,index) in tableList" :key="index">
11 11
          <div class="order-yy-name" style="font-size:22px;font-weight:bold;letter-spacing:0px;">{{orgName}}</div>
12
-          <div class="order-title" style="font-weight:500;font-size:18px;">药品库登记表</div>
12
+          <div class="order-title" style="font-weight:500;font-size:18px;">药品退库登记表</div>
13 13
 
14 14
           <div style="float: left;margin-bottom: 1px;">单据编号:{{it.order_number}}</div>
15 15
           <div style="float: right;margin-bottom: 1px;">{{getDateTwo()}}</div>
@@ -18,7 +18,7 @@
18 18
             <tbody>
19 19
             <tr>
20 20
               <td style="line-height: 50px" width="230">药品名称</td>
21
-              <td style="line-height: 50px" width="260">品名/注册证号(备案凭证号)</td>
21
+              <td style="line-height: 50px" width="260">批准文号</td>
22 22
               <td style="line-height: 50px" width="230">规格型号</td>
23 23
               <td style="line-height: 50px" width="200">生产厂商</td>
24 24
               <td style="line-height: 50px" width="180">批号(序列号)</td>

+ 2 - 2
src/xt_pages/stock/drugs/cancelDrugStockOrder.vue View File

@@ -162,7 +162,7 @@
162 162
             border
163 163
             highlight-current-row
164 164
             ref="multipleTableOne"
165
-            @current-change="handleCurrentChangeOne"
165
+           
166 166
             @selection-change="select"
167 167
             :row-style="{ color: '#303133' }"
168 168
             :header-cell-style="{
@@ -489,7 +489,7 @@ export default {
489 489
         ids: idStr
490 490
       };
491 491
 
492
-      this.$confirm("确认删除出库退库单记录?", "删除出库退库单记录", {
492
+      this.$confirm("确认删除退库单记录?", "删除退库单记录", {
493 493
         confirmButtonText: "确定",
494 494
         cancelButtonText: "取消",
495 495
         type: "warning"

+ 1 - 1
src/xt_pages/stock/drugs/cancelDrugStockOrderAdd.vue View File

@@ -371,7 +371,7 @@ export default {
371 371
       },
372 372
       tableRules: {
373 373
         return_count: [
374
-          { required: true, message: "数量不能为空", trigge: "blur" }
374
+          { required: true, message: "数量不能为空", trigger: "blur" }
375 375
         ]
376 376
       },
377 377
       ruleForm: {

+ 5 - 2
src/xt_pages/stock/drugs/cancelDrugStockOrderEdit.vue View File

@@ -306,7 +306,7 @@
306 306
         },
307 307
         tableRules: {
308 308
           count: [
309
-            { required: true, message: '数量不能为空', trigge: 'blur' }
309
+            { required: true, message: '数量不能为空', trigger: 'blur' }
310 310
           ]
311 311
 
312 312
         },
@@ -547,7 +547,7 @@
547 547
                    this.recordInfo.recordData[i].batch_number_id = this.numberList[j].id
548 548
                  }
549 549
               }
550
-             
550
+              this.recordInfo.recordData[i].price = this.recordInfo.recordData[i].price.toString()
551 551
             }
552 552
 
553 553
             const params = {
@@ -567,6 +567,9 @@
567 567
                 if(response.data.data.msg == 2){
568 568
                    this.$message.error("退库数量大于入库数量")
569 569
                 }
570
+                if(response.data.data.msg == 4){
571
+                  this.$message.error("退库数量大于出库数量")
572
+                }
570 573
               
571 574
               }
572 575
             })

+ 2 - 2
src/xt_pages/stock/drugs/drugBatchNumber.vue View File

@@ -6,7 +6,7 @@
6 6
     <div class="app-container ">
7 7
       <div class="cell clearfix">
8 8
        药品名称:<span>{{this.$route.query.drug_name}}</span>&nbsp;
9
-       库存:{{getCountTwo(this.$route.query.drug_id,this.$route.query.min_number,this.$route.query.max_unit,this.$route.query.min_unit)}}&nbsp;
9
+       库存:{{this.$route.query.overPlus}}&nbsp;
10 10
        规格:<span>{{this.$route.query.unit}}</span>&nbsp;
11 11
        厂家:<span>{{this.$route.query.manufacturer}}</span>&nbsp;
12 12
       </div>
@@ -136,7 +136,7 @@
136 136
       this.drugCategory.push(...drugCategory)
137 137
       this.drugTypeList = getDictionaryDataConfig('system','drug_type') 
138 138
       this.getlist()
139
-      this.getDrugCountList()
139
+      // this.getDrugCountList()
140 140
     },
141 141
     components: {
142 142
       SettingDialog,

+ 143 - 20
src/xt_pages/stock/drugs/drugQueryPrint.vue View File

@@ -45,10 +45,10 @@
45 45
               <td style="line-height: 50px">
46 46
                 <span> {{getManufacturerList(item.manufacturer)}}</span>
47 47
               </td>
48
-              <td><span>{{getInCount(item.drug_id)}}{{item.max_unit}}</span ></td>
49
-              <td><span>{{getCount(item.drug_id,item.min_number,item.max_unit,item.min_unit)}}</span></td>
48
+              <td><span v-if="getWarehoseInfo(item.drug_warehouse_info)!=0">{{getWarehoseInfo(item.drug_warehouse_info)}}{{item.max_unit}}</span ></td>
49
+              <td><span v-if="getWarehouseOutInfo(item.drug_warehouse_out,item.max_unit,item.min_unit,item.min_number)!=0">{{getWarehouseOutInfo(item.drug_warehouse_out,item.max_unit,item.min_unit,item.min_number)}}</span></td>
50 50
               <td>
51
-                <span>{{getCountTwo(item.drug_id,item.min_number,item.max_unit,item.min_unit)}}</span>
51
+                <span v-if="getOverFlushInfo(item.drug_warehouse_info,item.max_unit,item.min_unit,item.min_number)!=0">{{getOverFlushInfo(item.drug_warehouse_info,item.max_unit,item.min_unit,item.min_number)}}</span>
52 52
              </td> 
53 53
             </tr>
54 54
             </tbody>
@@ -117,6 +117,7 @@
117 117
         autoCountList:[],
118 118
         minCount:[],
119 119
         drugOutList:[],
120
+        allCountList:[],
120 121
       }
121 122
     },
122 123
     methods: {
@@ -164,7 +165,7 @@
164 165
           start_time:this.$route.query.start_time,
165 166
           end_time:this.$route.query.end_time,
166 167
         }
167
-        console.log("parasm22222",Params)
168
+        console.log("数据23232",Params)
168 169
         this.WarehouseInfo.warehouseInfoDate = []
169 170
         getAllDrugStockQueryList(Params).then(response => {
170 171
           if (response.data.state == 0) {
@@ -239,15 +240,26 @@
239 240
           page: this.$route.query.page,
240 241
           limit:this.$route.query.limit,
241 242
           keyword: this.$route.query.keyword,
242
-          drug_type:this.$route.drug_type,
243
-          start_time:this.$route.start_time,
244
-          end_time:this.$route.end_time,
243
+          drug_type:this.$route.query.drug_type,
244
+          start_time:this.$route.query.start_time,
245
+          end_time:this.$route.query.end_time,
245 246
         }
246
-        console.log("parasm222222",params)
247
+       console.log("数据23232",params)
247 248
         getDrugStockList(params).then(response=>{
248 249
           if(response.data.state == 1){
249 250
              var list = response.data.data.list
250 251
              console.log("list99999",list)
252
+             for(let i=0;i<list.length;i++){
253
+               for(let j=0;j<list[i].drug_warehouse_info.length;j++){
254
+                 list[i].drug_warehouse_info[j].stock_max_number = list[i].min_number * list[i].drug_warehouse_info[j].stock_max_number
255
+               }
256
+               for(let y=0;y<list[i].drug_warehouse_out.length;y++){
257
+                  if(list[i].drug_warehouse_out[y].count_unit == list[i].max_unit){
258
+                    list[i].drug_warehouse_out[y].count = list[i].drug_warehouse_out[y].count * list[i].min_number
259
+                  }
260
+               }
261
+             }
262
+             
251 263
              this.tableList = list
252 264
              this.manufacturerList = response.data.data.manufacturerList
253 265
              this.loading = false
@@ -277,9 +289,12 @@
277 289
             var outcountlist = response.data.data.outCountList
278 290
             console.log("出库数据",outcountlist)
279 291
             this.outCountList = outcountlist
292
+             this.allCountList.push(...outcountlist)
280 293
             var aucountlist = response.data.data.auCountList
281 294
             console.log("自动数据",aucountlist)
295
+          
282 296
             this.autoCountList = aucountlist
297
+            this.allCountList.push(...aucountlist)
283 298
             var minCount = response.data.data.minCount
284 299
             console.log("minCount",minCount)
285 300
             this.minCount = minCount
@@ -331,24 +346,61 @@
331 346
         }
332 347
         return count
333 348
       },
334
-      getCount(drug_id,min_number,max_unit,min_unit){
335
-        var count= 0
349
+      // getCount(drug_id,min_number,max_unit,min_unit){
350
+      //   var count= 0
351
+      //   var str = ""
352
+      //   var min_str = ""
353
+      //   for(let i=0;i<this.drugOutList.length;i++){
354
+      //     if(drug_id == this.drugOutList[i].drug_id){
355
+      //        count += parseInt(this.drugOutList[i].count)
356
+      //     }
357
+      //   }
358
+      //   if(parseInt(count/min_number)!=0){
359
+      //     str = parseInt(count/min_number)+ max_unit
360
+      //   }
361
+      //   if((count%min_number)!=0){
362
+      //     min_str =  count%min_number + min_unit
363
+      //   }
364
+      //   return str + min_str
365
+      // },
366
+        getCount(drug_id,min_number,max_unit,min_unit){
367
+        var total= 0
336 368
         var str = ""
337 369
         var min_str = ""
338
-        for(let i=0;i<this.drugOutList.length;i++){
339
-          if(drug_id == this.drugOutList[i].drug_id){
340
-             count += parseInt(this.drugOutList[i].count)
370
+        var arr = []
371
+        for(let i=0;i<this.allCountList.length;i++){
372
+          if(drug_id == this.allCountList[i].drug_id){
373
+             arr.push(this.allCountList[i])
341 374
           }
342 375
         }
343
-        if(parseInt(count/min_number)!=0){
344
-          str = parseInt(count/min_number)+ max_unit
376
+        var arrTwo = []
377
+        for(let i=0;i<arr.length;i++){
378
+          if(arr[i].drug_id == 1236){
379
+             arrTwo.push(arr[i])
380
+          }
381
+          if(arr[i].count_unit == max_unit){
382
+             arr[i].count = arr[i].count * min_number
383
+          }
384
+          if(arr[i].count_unit == min_unit){
385
+            arr[i].count = arr[i].count
386
+          }
387
+          total += arr[i].count
345 388
         }
346
-        if((count%min_number)!=0){
347
-          min_str =  count%min_number + min_unit
389
+        if(total<min_number){
390
+           str = ""
391
+           min_str = total + min_unit
348 392
         }
393
+        if(total >= min_number){
394
+          if(parseInt(total/min_number)!=0){
395
+            str = parseInt(total/min_number)+ max_unit
396
+          }
397
+          if((total%min_number)!=0){
398
+            min_str =  total%min_number + min_unit
399
+          }
400
+        }
401
+    
349 402
         return str + min_str
350 403
       },
351
-
352 404
       getCountOne(drug_id){
353 405
         var count= 0
354 406
         for(let i=0;i<this.drugOutList.length;i++){
@@ -383,7 +435,78 @@
383 435
          }
384 436
        }
385 437
        return name
386
-     }
438
+     },
439
+     getWarehoseInfo(arr){
440
+        var total = 0
441
+        if (arr.length > 0) {
442
+          for(let i=0;i<arr.length;i++){
443
+            total += parseInt(arr[i].warehousing_count)
444
+          }
445
+        }
446
+        if(total == 0){
447
+           total = ""
448
+        }
449
+       
450
+        return total
451
+      },
452
+      getOverFlushInfo(arr,max_unit,min_unit,min_number){
453
+       
454
+         var max_str=  ""
455
+         var min_str = ""
456
+         var total = 0
457
+         var newarr = arr
458
+         if(newarr.length > 0 ){
459
+           for(let i=0;i<newarr.length;i++){
460
+            total += (newarr[i].stock_max_number+newarr[i].stock_min_number)
461
+           }
462
+         }
463
+         if (total < min_number){
464
+           min_str = total + min_unit
465
+         }
466
+         if (total == 0) {
467
+            min_str = ""
468
+            max_str = ""
469
+         }
470
+         if (total >=min_number) {
471
+           if(parseInt(total/min_number)!=0){
472
+              max_str = parseInt(total/min_number) + max_unit
473
+           }
474
+           if(total%min_number!=0){
475
+              min_str = total%min_number + min_unit
476
+           }
477
+         
478
+         }
479
+        return max_str + min_str
480
+      },
481
+      getWarehouseOutInfo(arr,max_unit,min_unit,min_number){
482
+         var min_str = ""
483
+         var max_str = ""
484
+        var total = 0
485
+        if (arr.length > 0) {
486
+          for(let i=0;i<arr.length;i++){
487
+            total += parseInt(arr[i].count)
488
+          }
489
+        }
490
+      
491
+        if (total < min_number){
492
+           min_str = total + min_unit
493
+         }
494
+         if (total == 0) {
495
+            min_str = ""
496
+            max_str = ""
497
+         }
498
+         if (total >=min_number) {
499
+           if(parseInt(total/min_number)!=0){
500
+              max_str = parseInt(total/min_number) + max_unit
501
+           }
502
+           if(total%min_number!=0){
503
+              min_str = total%min_number + min_unit
504
+           }
505
+         
506
+         }
507
+        return max_str + min_str
508
+
509
+      }
387 510
     },
388 511
     created() {
389 512
       // this.GetAllDrugStockQueryList()
@@ -392,7 +515,7 @@
392 515
       console.log("222343",drugType)
393 516
       this.drugType.push(...drugType)
394 517
       this.getlist()
395
-      this.getDrugCountList()
518
+      // this.getDrugCountList()
396 519
     }
397 520
 
398 521
   }

+ 2 - 2
src/xt_pages/stock/drugs/drugStockFlow.vue View File

@@ -6,7 +6,7 @@
6 6
     <div class="app-container ">
7 7
       <div class="cell clearfix">
8 8
        药品名称:<span>{{this.$route.query.drug_name}}</span>&nbsp;
9
-       库存: {{getCountTwo(this.$route.query.drug_id,this.$route.query.min_number,this.$route.query.max_unit,this.$route.query.min_unit)}}
9
+       库存: {{this.$route.query.overPlus}}
10 10
        规格:<span>{{this.$route.query.unit}}</span>&nbsp;
11 11
        厂家:<span>{{this.$route.query.manufacturer}}</span>&nbsp;
12 12
 
@@ -170,7 +170,7 @@
170 170
       this.drugTypeList = getDictionaryDataConfig('system','drug_type') 
171 171
       // this.getlist()
172 172
       // this.getOutList()
173
-      this.getDrugCountList()
173
+      // this.getDrugCountList()
174 174
 
175 175
       this.getDrugFlow()
176 176
     },

+ 1 - 1
src/xt_pages/stock/drugs/drugStockInOrder.vue View File

@@ -476,7 +476,7 @@ export default {
476 476
           for (let i = 0; i < response.data.data.list.length; i++) {
477 477
             this.Warehouse.warehouseDate.push(response.data.data.list[i]);
478 478
           }
479
-          console.log("列表999988888",this.warehouse.warehouseDate)
479
+          // console.log("列表999988888",this.warehouse.warehouseDate)
480 480
         }
481 481
       });
482 482
     },

+ 57 - 42
src/xt_pages/stock/drugs/drugStockOutOrder.vue View File

@@ -233,8 +233,8 @@
233 233
           </el-table-column> -->
234 234
           <el-table-column label="出库数量" align="center">
235 235
             <template slot-scope="scope">
236
-              <!-- {{getTotalCount(scope.row.drug_id)}} -->
237
-              {{getTotalCountOne(scope.row.drug_id,scope.row.min_number,scope.row.max_unit,scope.row.min_unit)}}
236
+              <span v-if="scope.row.is_sys ==  0">{{getTotalCount(scope.row.drug_id,scope.row.min_number,scope.row.max_unit,scope.row.min_unit)}}</span>
237
+              <span v-if="scope.row.is_sys == 1"> {{getTotalCountOne(scope.row.drug_id,scope.row.min_number,scope.row.max_unit,scope.row.min_unit)}}</span>
238 238
             </template>
239 239
           </el-table-column>
240 240
           <el-table-column label="出货单价" align="center">
@@ -349,7 +349,7 @@
349 349
               <span>批次号</span>
350 350
             </template>
351 351
             <template slot-scope="scope">
352
-              <span>{{getDrugBatchNumber(scope.row.drug_id)}}</span>
352
+              <span>{{getDrugBatchNumber(scope.row.drug_id,scope.row.count)}}</span>
353 353
             </template>
354 354
           </el-table-column>
355 355
           
@@ -393,7 +393,7 @@
393 393
               <span>使用数量</span>
394 394
             </template>
395 395
             <template slot-scope="scope">
396
-               {{scope.row.count}}
396
+               {{scope.row.count}}{{scope.row.count_unit}}
397 397
             </template>
398 398
           </el-table-column>
399 399
 
@@ -671,9 +671,9 @@ export default {
671 671
       this.$router.push({path:"/drug/out/drugstockoutorderedit?id="+row.id+"&type="+this.type+"&is_sys="+row.is_sys})
672 672
     },
673 673
     handleSearch(val){
674
-      
674
+       console.log("val23233232",val)
675 675
        this.getInitializtion()
676
-       this.getSinleOrderDetail(val.id)
676
+       this.getSinleOrderDetail(val.id,val.warehouse_out_time)
677 677
        this.list = []
678 678
       //  this.getDrugAutoMaticList(val.id,val.time,val.warehouse_out_order_number)
679 679
 
@@ -944,9 +944,10 @@ export default {
944 944
      }
945 945
      return name
946 946
    },
947
-   getSinleOrderDetail(id){
947
+   getSinleOrderDetail(id,start_time){
948 948
        var params = {
949 949
          id:id,
950
+         start_time:start_time,
950 951
        }
951 952
      getSinleOrderDetail(params).then(response=>{
952 953
         if(response.data.state == 1){
@@ -955,8 +956,15 @@ export default {
955 956
           var list =  response.data.data.list
956 957
           console.log("list2323232",list)
957 958
           var outList = response.data.data.outList
959
+          for(let i=0;i<outList.length;i++){
960
+            console.log("55555",outList[i].count_unit)
961
+            console.log("666",outList[i].max_unit)
962
+          if(outList[i].count_unit == outList[i].max_unit){
963
+              outList[i].count =outList[i].count * outList[i].min_number
964
+            }
965
+          }
958 966
           this.outList = outList
959
-         console.log("outList222",outList)
967
+         console.log("出库数据44444",outList)
960 968
          this.manufacturerList = response.data.data.manufacturerList
961 969
          this.dealerList = response.data.data.dealerList
962 970
          var drugFlowList = response.data.data.drugFlowList
@@ -1019,7 +1027,7 @@ export default {
1019 1027
           start_time:this.start_time,
1020 1028
           end_time:this.end_time,
1021 1029
          }
1022
-         console.log("paramsw2ww",params)
1030
+       
1023 1031
         getDrugCountList(params).then(response=>{
1024 1032
           if(response.data.state == 1){
1025 1033
             var countlist =  response.data.data.countList
@@ -1063,45 +1071,69 @@ export default {
1063 1071
         }
1064 1072
         return str + min_str
1065 1073
       },
1066
-      getTotalCount(drug_id){
1074
+      getTotalCount(drug_id,min_number,max_unit,min_unit){
1075
+        console.log("hhhhhhhhh",this.outList)
1067 1076
          var str = ""
1068 1077
          var min_str = ""
1078
+         var arr = []
1079
+         var total = 0
1069 1080
          for(let i=0;i<this.outList.length;i++){
1070 1081
            if(this.outList[i].drug_id == drug_id){
1071
-            if(parseInt(this.outList[i].count/this.outList[i].min_number)!=0){
1072
-              str = parseInt(this.outList[i].count/this.outList[i].min_number)+ this.outList[i].max_unit
1082
+             total += this.outList[i].count
1083
+           }
1084
+         }
1085
+
1086
+         if (total >=min_number){
1087
+            if(parseInt(total/min_number)!=0){
1088
+              str = parseInt(total/min_number)+ max_unit
1073 1089
             }
1074
-            if((this.outList[i].count%this.outList[i].min_number)!=0){
1075
-              min_str =  this.outList[i].count%this.outList[i].min_number + this.outList[i].min_unit
1090
+            if((total%min_number)!=0){
1091
+              min_str =  total%min_number + min_unit
1076 1092
             }
1077
-           }
1078 1093
          }
1094
+        
1095
+        if (total < min_number){
1096
+            str = ""
1097
+            min_str = total + min_unit
1098
+        }
1099
+       
1079 1100
          return str + min_str
1080 1101
       },
1081 1102
       getTotalCountOne(id,min_number,max_unit,min_unit){
1103
+        console.log("列表",this.drugFlowList)
1082 1104
         var arr = []
1083 1105
         for(let i=0;i<this.drugFlowList.length;i++){
1084 1106
           if(id == this.drugFlowList[i].drug_id){
1085 1107
              arr.push(this.drugFlowList[i])
1086 1108
           }
1087 1109
         }
1110
+      
1088 1111
         var total = 0
1089 1112
         for(let i=0;i<arr.length;i++){
1090
-          if(arr[i].max_unit == max_unit){
1091
-             arr[i].count = arr[i].count * arr[i].min_number
1113
+          if(arr[i].count_unit == max_unit){
1114
+             arr[i].count = arr[i].count * min_number
1092 1115
           }
1093
-          if(arr[i].max_unit == min_unit){
1116
+          if(arr[i].count_unit == min_unit){
1094 1117
             arr[i].count = arr[i].count
1095 1118
           }
1096 1119
           total += arr[i].count
1097 1120
         }
1098
-
1121
+      console.log("arr00000000000",arr)
1099 1122
         var str = ""
1100 1123
         var min_str = ""
1101
-        
1102
-        str = parseInt(total/min_number)+ max_unit
1103
-        min_str =  total%min_number + min_unit
1104
-
1124
+        if(total >= min_number){
1125
+          if(parseInt(total/min_number)!=0){
1126
+            str = parseInt(total/min_number)+ max_unit
1127
+          }
1128
+          if(total%min_number !=0){
1129
+            min_str =  total%min_number + min_unit
1130
+          }
1131
+        }
1132
+        if (total < min_number){
1133
+          str = ""
1134
+          min_str = total + min_unit
1135
+        }
1136
+       
1105 1137
         return str + min_str 
1106 1138
 
1107 1139
       },
@@ -1179,25 +1211,10 @@ export default {
1179 1211
          total_price = strprice + minstrprice
1180 1212
          return  total_price
1181 1213
       },
1182
-
1183
-      // getDrugBatchNumber(id){
1184
-        
1185
-      //   var arr= []
1186
-      //   var batchNumber =[]
1187
-        
1188
-      //   for(let i=0;i<this.userList.length;i++){
1189
-      //      if(id == this.userList[i].id){
1190
-      //        for(let j=0;j<this.userList[i].drugwarehouseoutinfo.length;j++){
1191
-      //           batchNumber.push(this.userList[i].drugwarehouseoutinfo[j].batch_number)
1192
-      //        }
1193
-      //      }
1194
-      //   }
1195
-      //   return batchNumber.join(",")
1196
-      // },
1197
-      getDrugBatchNumber(drugid){
1214
+      getDrugBatchNumber(drugid,count){
1198 1215
         var arr = []
1199 1216
         for(let i=0;i<this.batchNumberList.length;i++){
1200
-          if(drugid == this.batchNumberList[i].drug_id){
1217
+          if(drugid == this.batchNumberList[i].drug_id && count == this.batchNumberList[i].count){
1201 1218
             arr.push(this.batchNumberList[i].batch_number)
1202 1219
           }
1203 1220
         }
@@ -1243,8 +1260,6 @@ export default {
1243 1260
           }
1244 1261
          
1245 1262
         }
1246
-        console.log("23232323",this.exportList)
1247
-         console.log("了下23",this.drugTypeList)
1248 1263
       
1249 1264
        import('@/vendor/Export2Excel').then(excel => {
1250 1265
         for(let i=0;i<this.exportList.length;i++){

+ 6 - 5
src/xt_pages/stock/drugs/drugStockOutOrderAdd.vue View File

@@ -149,7 +149,7 @@
149 149
               >
150 150
                 <div style="display:flex;">
151 151
                   <el-input
152
-                     oninput="value=value.replace(/\D|^0/g,'')"
152
+                    oninput="value=value.replace(/\D|^0/g,'')"
153 153
                     style="width:80px"
154 154
                     placeholder="请输入出库数量"
155 155
                     type="number"
@@ -337,8 +337,8 @@ export default {
337 337
       },
338 338
       tableRules: {
339 339
         price: [{ required: true, message: "单价不能为空", trigger: "blur" }],
340
-        count: [{ required: true, message: "数量不能为空", trigge: "blur" }],
341
-        min_unit:[{required:true,message:"单位不能为空",trigge:"blur"}]
340
+        count: [{ required: true, message: "数量不能为空", trigger: "blur" }],
341
+        min_unit:[{required:true,message:"单位不能为空",trigger:"blur"}]
342 342
       },
343 343
       ruleForm: {
344 344
         manufacturer: [
@@ -607,7 +607,7 @@ export default {
607 607
               var str = drug_name + " " + dose + dose_unit + "*" + min_number + min_unit+"/"+max_unit
608 608
               console.log("str22222222",str)
609 609
               if(msg == 1){
610
-                this.$message.error(str + "库存不足,请入库")
610
+                this.$message.error(str + "该批次库存不足")
611 611
               }else{
612 612
                 this.$message.success("出库成功");
613 613
                 this.recordInfo.recordData = [];
@@ -686,7 +686,7 @@ export default {
686 686
             this.recordInfo.recordData[i].max_unit = val.max_unit
687 687
             this.recordInfo.recordData[i].min_number = val.min_number
688 688
             this.recordInfo.recordData[i].min_unit = val.min_unit
689
-         
689
+          
690 690
             this.recordInfo.recordData[i].number = val.number
691 691
             if(val.retail_price == 0){
692 692
               this.recordInfo.recordData[i].price = ""
@@ -749,6 +749,7 @@ export default {
749 749
     tempObj["dealer"] = ""
750 750
     tempObj["number"] = ""
751 751
     tempObj["warehouse_info_id"] = 0
752
+    tempObj["count"] = ""
752 753
     this.recordInfo.recordData.push(tempObj);
753 754
     this.GetConfigInfo();
754 755
     this.propForm.goodUnit = this.$store.getters.good_unit;

+ 9 - 4
src/xt_pages/stock/drugs/drugStockOutOrderEdit.vue View File

@@ -300,7 +300,7 @@
300 300
         },
301 301
         tableRules: {
302 302
           count: [
303
-            { required: true, message: '数量不能为空', trigge: 'blur' }
303
+            { required: true, message: '数量不能为空', trigger: 'blur' }
304 304
           ],
305 305
           price: [
306 306
             { required: true, message: '单价不能为空', trigger: 'blur' }
@@ -449,8 +449,8 @@
449 449
         tempObj['batch_number'] = ''
450 450
         tempObj['number'] = ''
451 451
         tempObj['count_unit'] = ""
452
-        tempObj['dealer'] = 0
453
-        tempObj['manufacturer'] = 0
452
+        tempObj['dealer'] = ""
453
+        tempObj['manufacturer'] = ""
454 454
         tempObj['warehouse_info_id'] = 0
455 455
         this.recordInfo.recordData.push(tempObj)
456 456
       }, handleDelete: function(index, row) {
@@ -755,11 +755,16 @@
755 755
              this.recordInfo.recordData[i].drug_name = val.drug_name
756 756
              this.recordInfo.recordData[i].drug_type = val.drug_type
757 757
              this.recordInfo.recordData[i].name  = val.dose +val.dose_unit+"*"+val.min_number+ val.min_unit+"/"+val.max_unit
758
-             this.recordInfo.recordData[i].last_price = val.retail_price
758
+             this.recordInfo.recordData[i].price = val.retail_price
759 759
              this.recordInfo.recordData[i].manufacturer =  val.manufacturer
760 760
              this.recordInfo.recordData[i].number = val.number
761 761
              this.recordInfo.recordData[i].max_unit = val.max_unit
762 762
              this.recordInfo.recordData[i].min_unit = val.min_unit
763
+             if(val.dealer == 0){
764
+               this.recordInfo.recordData[i].dealer = ""
765
+             }else{
766
+               this.recordInfo.recordData[i].dealer = val.dealer
767
+             }
763 768
            }
764 769
         }
765 770
         console.log("333333",this.recordInfo.recordData)

+ 165 - 131
src/xt_pages/stock/drugs/query.vue View File

@@ -111,25 +111,17 @@
111 111
         </el-table-column>
112 112
         <el-table-column prop="drug_name" label="入库数量" align="center">
113 113
            <template slot-scope="scope">
114
-             <!-- {{getInCount(scope.row.drug_id)}} -->
115
-              {{getInCount(scope.row.drug_id)}}{{scope.row.max_unit}}
114
+            <span v-if="getWarehoseInfo(scope.row.drug_warehouse_info)!=0">{{getWarehoseInfo(scope.row.drug_warehouse_info)}}{{scope.row.max_unit}}</span> 
116 115
            </template>
117 116
         </el-table-column>
118 117
         <el-table-column prop="drug_name" label="出库数量" align="center">
119 118
            <template slot-scope="scope">
120
-             <!-- {{getOutCount(scope.row.drug_id) + getAutoCount(scope.row.drug_id)}} -->
121
-             {{getCount(scope.row.drug_id,scope.row.min_number,scope.row.max_unit,scope.row.min_unit)}}
119
+            {{getWarehouseOutInfo(scope.row.drug_warehouse_out,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}
122 120
            </template>
123 121
         </el-table-column>
124
-        <!-- <el-table-column prop="drug_name" label="退库数量" align="center">
125
-           <template slot-scope="scope">
126
-             {{getCancelCount(scope.row.drug_id)}}{{scope.row.max_unit}}
127
-           </template>
128
-        </el-table-column> -->
129 122
         <el-table-column prop="drug_name" label="剩余库存量" align="center">
130 123
            <template slot-scope="scope">
131
-             <span v-if="getCountTwo(scope.row.drug_id,scope.row.min_number,scope.row.max_unit,scope.row.min_unit)!=''">{{getCountTwo(scope.row.drug_id,scope.row.min_number,scope.row.max_unit,scope.row.min_unit)}}</span>
132
-              <span v-if="getCountTwo(scope.row.drug_id,scope.row.min_number,scope.row.max_unit,scope.row.min_unit) ==''">0{{scope.row.max_unit}}0{{scope.row.min_unit}}</span>
124
+             <span>{{getOverFlushInfo(scope.row.drug_warehouse_info,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}</span> 
133 125
            </template>
134 126
         </el-table-column>
135 127
         <el-table-column prop="drug_name" label="操作" align="center" width="200px">
@@ -150,10 +142,10 @@
150 142
         </el-table-column>
151 143
        </el-table>
152 144
        
153
-      <el-pagination
145
+    <el-pagination
154 146
         @size-change="handleSizeChange"
155 147
         @current-change="handleCurrentChange"
156
-        :page-sizes="[10, 50, 100,500,1000]"
148
+        :page-sizes="[10, 50, 100,200,500,1000]"
157 149
         :page-size="10"
158 150
         background
159 151
         align="right"
@@ -181,32 +173,26 @@ import { min } from 'moment'
181 173
   export default {
182 174
     name: 'stockIn',
183 175
     created() {
176
+      
184 177
       var nowDate = new Date();
185 178
       var nowYear = nowDate.getFullYear();
186 179
       var nowMonth = nowDate.getMonth() + 1;
187 180
       var nowDay = nowDate.getDate();
188
-      this.end_time =
189
-        nowYear +
190
-        "-" +
191
-        (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
192
-        "-" +
193
-        (nowDay < 10 ? "0" + nowDay : nowDay);
181
+      this.end_time =nowYear +"-" +(nowMonth < 10 ? "0" + nowMonth : nowMonth) +"-" +(nowDay < 10 ? "0" + nowDay : nowDay);
194 182
       nowDate.setMonth(nowDate.getMonth() - 1);
195 183
       nowYear = nowDate.getFullYear();
196 184
       nowMonth = nowDate.getMonth() + 1;
197 185
       nowDay = nowDate.getDate();
198
-      this.start_time =
199
-        nowYear +
200
-        "-" +
201
-        (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
202
-        "-" +
203
-        (nowDay < 10 ? "0" + nowDay : nowDay);
186
+      this.start_time =nowYear +"-" +(nowMonth < 10 ? "0" + nowMonth : nowMonth) +"-" +(nowDay < 10 ? "0" + nowDay : nowDay);
187
+      this.getlist()
204 188
       var drugCategory = getDictionaryDataConfig('system','drug_category')
205 189
       this.drugCategory.push(...drugCategory)
206 190
       var drugTypeList = getDictionaryDataConfig('system','drug_type') 
207 191
       this.drugTypeList.push(...drugTypeList)
208
-      this.getlist()
209
-      this.getDrugCountList()
192
+     
193
+      // this.getDrugCountList()
194
+     
195
+      
210 196
     },
211 197
     components: {
212 198
       SettingDialog,
@@ -219,13 +205,14 @@ import { min } from 'moment'
219 205
           { path: '/stock/drugs/stock/query', name: '药品库存查询' }
220 206
         ],
221 207
         keywords: '',
222
-        total: 0,
208
+       
223 209
         multipleSelection: [],
224 210
         signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
225 211
         start_time: '',
226 212
         end_time: '',
227 213
         page: 1,
228 214
         limit: 10,
215
+        total: 0,
229 216
         goodType: [],
230 217
         goodInfo: [],
231 218
         tempArr: [],
@@ -252,9 +239,45 @@ import { min } from 'moment'
252 239
         minCount:[],
253 240
         drugOutList:[],
254 241
         cancelCountList:[],
242
+        allCountList:[],
255 243
       }
256 244
     },
257 245
     methods: {
246
+     //获取库存
247
+      getlist(){
248
+      
249
+        const params = {
250
+          page: this.page,
251
+          limit: this.limit,
252
+          keyword: this.keywords,
253
+          drug_type:this.drug_type,
254
+          start_time:this.start_time,
255
+          end_time:this.end_time,
256
+        }
257
+        console.log("parasm222222",params)
258
+        getDrugStockList(params).then(response=>{
259
+          if(response.data.state == 1){
260
+             var list = response.data.data.list
261
+             console.log("list99999",list)
262
+             for(let i=0;i<list.length;i++){
263
+               for(let j=0;j<list[i].drug_warehouse_info.length;j++){
264
+                 list[i].drug_warehouse_info[j].stock_max_number = list[i].min_number * list[i].drug_warehouse_info[j].stock_max_number
265
+               }
266
+               for(let y=0;y<list[i].drug_warehouse_out.length;y++){
267
+                  if(list[i].drug_warehouse_out[y].count_unit == list[i].max_unit){
268
+                    list[i].drug_warehouse_out[y].count = list[i].drug_warehouse_out[y].count * list[i].min_number
269
+                  }
270
+               }
271
+             }
272
+             console.log("列表list232323323232323223",list)
273
+             this.tableList = list
274
+             var total = response.data.data.total
275
+             this.total = total
276
+             this.manufacturerList = response.data.data.manufacturerList
277
+           
278
+           }
279
+        })
280
+      },
258 281
       handleSpanTempArr() {
259 282
         this.tempArr = []
260 283
 
@@ -301,47 +324,7 @@ import { min } from 'moment'
301 324
           }
302 325
         }
303 326
       },
304
-      GetAllDrugStockQueryList: function() {
305
-       
306
-        const Params = {
307
-          page: this.page,
308
-          limit: this.limit,
309
-          keyword: this.keywords,
310
-          drug_category:this.drug_category,
311
-          start_time:this.start_time,
312
-          end_time:this.end_time,
313
-        }
314
-        this.WarehouseInfo.loading = true
315
-        this.WarehouseInfo.warehouseInfoDate = []
316
-        getAllDrugStockQueryList(Params).then(response => {
317
-          if (response.data.state == 0) {
318
-            this.WarehouseInfo.loading = false
319
-            this.$message.error(response.data.msg)
320
-            return false
321
-          } else {
322
-            this.WarehouseInfo.loading = false
323
-            this.total = response.data.data.total
324
-            var arr = []
325
-            for (let i = 0; i < response.data.data.list.length; i++) {
326
-              this.WarehouseInfo.warehouseInfoDate.push(response.data.data.list[i])
327
-              arr.push(response.data.data.list[i])
328
-            }
329
-           
330
-            for(let i=0;i<arr.length;i++){
331
-               arr[i].stockInCount =  this.stockInCount(arr[i])
332
-               arr[i].salesReturnCount = this.salesReturnCount(arr[i])
333
-               arr[i].reactCount = (this.stockInCount(arr[i]) - this.salesReturnCount(arr[i]))?this.stockInCount(arr[i]) - this.salesReturnCount(arr[i]):0
334
-               arr[i].stockOutCount = this.stockOutCount(arr[i])
335
-               arr[i].cancelStockCount = this.cancelStockCount(arr[i])?this.cancelStockCount(arr[i]):0
336
-               arr[i].reactOutCount = (this.stockOutCount(arr[i]) - this.cancelStockCount(arr[i]))?(this.stockOutCount(arr[i]) - this.cancelStockCount(arr[i])):0
337
-               arr[i].overplusCount = (this.stockInCount(arr[i])-this.salesReturnCount(arr[i])-this.stockOutCount(arr[i])+this.cancelStockCount(arr[i]))?this.stockInCount(arr[i])-this.salesReturnCount(arr[i])-this.stockOutCount(arr[i])+this.cancelStockCount(arr[i]):0
338
-            }
339
-          
340
-             this.tableData = arr
341
-            this.handleSpanTempArr()
342
-          }
343
-        })
344
-      },
327
+    
345 328
       getSpecificationName: function(id) {
346 329
         let name = ''
347 330
         for (let i = 0; i < this.goodInfo.length; i++) {
@@ -366,12 +349,10 @@ import { min } from 'moment'
366 349
       },
367 350
       handleSizeChange(val) {
368 351
         this.limit = val
369
-     
370 352
         this.getlist()
371 353
       },
372 354
       handleCurrentChange(val) {
373 355
         this.page = val
374
-       
375 356
         this.getlist()
376 357
       },
377 358
       calculate: function(val) {
@@ -395,7 +376,7 @@ import { min } from 'moment'
395 376
         this.$message.error("结束时间不能小于开始时间");
396 377
         this.end_time = "";
397 378
       } else {
398
-        // this.GetAllDrugStockQueryList();
379
+       
399 380
         this.getlist()
400 381
       }
401 382
      
@@ -430,14 +411,6 @@ import { min } from 'moment'
430 411
         }
431 412
         return total
432 413
       },
433
-      showStockInDetailDialog: function(val) {
434
-      },
435
-      showSaleReturnDetailDialog: function() {
436
-      },
437
-      showStockOutDetailDialog: function() {
438
-      },
439
-      showCancelStockDetailDialog: function() {
440
-      },
441 414
       search: function() {
442 415
         this.getlist()
443 416
       }, 
@@ -451,9 +424,10 @@ import { min } from 'moment'
451 424
            this.tableList[i].drug_type_name = this.getDrugType(this.tableList[i].drug_type)
452 425
            this.tableList[i].unit = this.tableList[i].dose + this.tableList[i].dose_unit +"*"+this.tableList[i].min_number+this.tableList[i].min_unit+"/"+this.tableList[i].max_unit
453 426
            this.tableList[i].manufacturer_name = this.getManufacturerList(this.tableList[i].manufacturer)
454
-           this.tableList[i].inCount =  this.getInCount(this.tableList[i].drug_id) + this.tableList[i].max_unit
455
-           this.tableList[i].outCount = this.getCount(this.tableList[i].drug_id,this.tableList[i].min_number,this.tableList[i].max_unit,this.tableList[i].min_unit)
456
-           this.tableList[i].overplusCount = this.getCountTwo(this.tableList[i].drug_id,this.tableList[i].min_number,this.tableList[i].max_unit,this.tableList[i].min_unit)
427
+
428
+          this.tableList[i].inCount =  this.getWarehoseInfo(this.tableList[i].drug_warehouse_info)
429
+          this.tableList[i].outCount = this.getWarehouseOutInfo(this.tableList[i].drug_warehouse_out,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number)
430
+          this.tableList[i].overplusCount =  this.getOverFlushInfo(this.tableList[i].drug_warehouse_info,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number)
457 431
          }
458 432
        
459 433
          console.log("hhhhhhhadhfadf 列表",this.tableList)
@@ -489,31 +463,6 @@ import { min } from 'moment'
489 463
           query: {drug_type:this.drug_type,keyword:this.keywords,start_time:this.start_time,end_time:this.end_time,page:this.page,limit:this.limit}
490 464
         });
491 465
       },
492
- 
493
-  //获取库存
494
-      getlist(){
495
-        const params = {
496
-          page: this.page,
497
-          limit: this.limit,
498
-          keyword: this.keywords,
499
-          drug_type:this.drug_type,
500
-          start_time:this.start_time,
501
-          end_time:this.end_time,
502
-        }
503
-        console.log("parasm222222",params)
504
-        getDrugStockList(params).then(response=>{
505
-          if(response.data.state == 1){
506
-             var list = response.data.data.list
507
-             console.log("list99999",list)
508
-             this.tableList = list
509
-             var total = response.data.data.total
510
-             console.log("total",total)
511
-             this.total = total
512
-             this.manufacturerList = response.data.data.manufacturerList
513
-           
514
-           }
515
-        })
516
-      },
517 466
       getDrugType(id){
518 467
        
519 468
         var name = ""
@@ -543,7 +492,8 @@ import { min } from 'moment'
543 492
          }
544 493
         }
545 494
         var unit =  val.dose + val.dose_unit +"*"+val.min_number+val.min_unit+"/"+val.max_unit
546
-        this.$router.push({path:'/drugstock/in/drugstockflow?drug_id='+val.drug_id+"&drug_name="+val.drug_name+"&manufacturer="+manufacturer_name+"&unit="+unit+"&min_number="+val.min_number+"&max_unit="+val.max_unit+"&min_unit="+val.min_unit})
495
+        var overPlus = this.getOverFlushInfo(val.drug_warehouse_info,val.max_unit,val.min_unit,val.min_number)
496
+        this.$router.push({path:'/drugstock/in/drugstockflow?drug_id='+val.id+"&drug_name="+val.drug_name+"&manufacturer="+manufacturer_name+"&unit="+unit+"&min_number="+val.min_number+"&max_unit="+val.max_unit+"&min_unit="+val.min_unit+"&overPlus="+overPlus})
547 497
       },
548 498
       handleBatch(val){
549 499
         var manufacturer_name = ""
@@ -553,7 +503,8 @@ import { min } from 'moment'
553 503
          }
554 504
         }
555 505
         var unit =  val.dose + val.dose_unit +"*"+val.min_number+val.min_unit+"/"+val.max_unit
556
-        this.$router.push({path:'/drugstock/in/drugbatchnumber?drug_id='+val.drug_id+"&drug_name="+val.drug_name+"&manufacturer="+manufacturer_name+"&unit="+unit+"&min_number="+val.min_number+"&max_unit="+val.max_unit+"&min_unit="+val.min_unit})
506
+        var overPlus = this.getOverFlushInfo(val.drug_warehouse_info,val.max_unit,val.min_unit,val.min_number)
507
+        this.$router.push({path:'/drugstock/in/drugbatchnumber?drug_id='+val.id+"&drug_name="+val.drug_name+"&manufacturer="+manufacturer_name+"&unit="+unit+"&min_number="+val.min_number+"&max_unit="+val.max_unit+"&min_unit="+val.min_unit+"&overPlus="+overPlus})
557 508
       },
558 509
       getDrugCountList(){
559 510
          var params = {
@@ -565,19 +516,11 @@ import { min } from 'moment'
565 516
         getDrugCountList(params).then(response=>{
566 517
           if(response.data.state == 1){
567 518
             var countlist =  response.data.data.countList
568
-            console.log("入库数据",countlist)
569 519
             this.countList = countlist
570
-            var outcountlist = response.data.data.outCountList
571
-            console.log("出库数据",outcountlist)
572
-            this.outCountList = outcountlist
573
-            var aucountlist = response.data.data.auCountList
574
-            console.log("自动数据",aucountlist)
575
-            this.autoCountList = aucountlist
576 520
             var minCount = response.data.data.minCount
577 521
             console.log("minCount",minCount)
578 522
             this.minCount = minCount
579 523
             var cancelCountList =  response.data.data.cancelCountList
580
-            console.log("退库数据",cancelCountList)
581 524
             this.cancelCountList = cancelCountList
582 525
             var info = response.data.data.info
583 526
             for(let i=0;i<info.length;i++){
@@ -585,6 +528,7 @@ import { min } from 'moment'
585 528
                  info[i].count = info[i].count * info[i].min_number
586 529
               }
587 530
             }
531
+            console.log("搜有列表",this.autoCountList)
588 532
             console.log("info2222222",info)
589 533
             this.drugOutList = info
590 534
           }
@@ -627,24 +571,45 @@ import { min } from 'moment'
627 571
         }
628 572
         return count
629 573
       },
630
-      getCount(drug_id,min_number,max_unit,min_unit){
631
-        var count= 0
574
+     getCount(drug_id,min_number,max_unit,min_unit){
575
+        var total= 0
632 576
         var str = ""
633 577
         var min_str = ""
634
-        for(let i=0;i<this.drugOutList.length;i++){
635
-          if(drug_id == this.drugOutList[i].drug_id){
636
-             count += parseInt(this.drugOutList[i].count)
578
+        var arr = []
579
+        for(let i=0;i<this.allCountList.length;i++){
580
+          if(drug_id == this.allCountList[i].drug_id){
581
+             arr.push(this.allCountList[i])
637 582
           }
638 583
         }
639
-        if(parseInt(count/min_number)!=0){
640
-          str = parseInt(count/min_number)+ max_unit
584
+        var arrTwo = []
585
+        for(let i=0;i<arr.length;i++){
586
+          if(arr[i].drug_id == 1236){
587
+             arrTwo.push(arr[i])
588
+          }
589
+          if(arr[i].count_unit == max_unit){
590
+             arr[i].count = arr[i].count * min_number
591
+          }
592
+          if(arr[i].count_unit == min_unit){
593
+            arr[i].count = arr[i].count
594
+          }
595
+          total += arr[i].count
596
+        }
597
+        if(total<min_number){
598
+           str = ""
599
+           min_str = total + min_unit
641 600
         }
642
-        if((count%min_number)!=0){
643
-          min_str =  count%min_number + min_unit
601
+        if(total >= min_number){
602
+          if(parseInt(total/min_number)!=0){
603
+            str = parseInt(total/min_number)+ max_unit
604
+          }
605
+          if((total%min_number)!=0){
606
+            min_str =  total%min_number + min_unit
607
+          }
644 608
         }
609
+    
645 610
         return str + min_str
646 611
       },
647
-
612
+  
648 613
       getCountOne(drug_id){
649 614
         var count= 0
650 615
         for(let i=0;i<this.drugOutList.length;i++){
@@ -669,12 +634,10 @@ import { min } from 'moment'
669 634
        if(parseInt(count/min_number)!=0){
670 635
          str = parseInt(count/min_number) + max_unit
671 636
        }
672
-       console.log("str2222",str)
637
+     
673 638
        if((count%min_number)!=0){
674 639
          str_min = count%min_number + min_unit
675 640
        }
676
-
677
-       console.log("str0000000",str,str_min)
678 641
        return str+str_min
679 642
      },
680 643
       getCancelCount(id){
@@ -686,6 +649,77 @@ import { min } from 'moment'
686 649
         }
687 650
         return count
688 651
       },
652
+      getWarehoseInfo(arr){
653
+        var total = 0
654
+        if (arr.length > 0) {
655
+          for(let i=0;i<arr.length;i++){
656
+            total += parseInt(arr[i].warehousing_count)
657
+          }
658
+        }
659
+        if(total == 0){
660
+           total = ""
661
+        }
662
+       
663
+        return total
664
+      },
665
+      getOverFlushInfo(arr,max_unit,min_unit,min_number){
666
+       
667
+         var max_str=  ""
668
+         var min_str = ""
669
+         var total = 0
670
+         var newarr = arr
671
+         if(newarr.length > 0 ){
672
+           for(let i=0;i<newarr.length;i++){
673
+            total += (newarr[i].stock_max_number+newarr[i].stock_min_number)
674
+           }
675
+         }
676
+         if (total < min_number){
677
+           min_str = total + min_unit
678
+         }
679
+         if (total == 0) {
680
+            min_str = ""
681
+            max_str = ""
682
+         }
683
+         if (total >=min_number) {
684
+           if(parseInt(total/min_number)!=0){
685
+              max_str = parseInt(total/min_number) + max_unit
686
+           }
687
+           if(total%min_number!=0){
688
+              min_str = total%min_number + min_unit
689
+           }
690
+         
691
+         }
692
+        return max_str + min_str
693
+      },
694
+      getWarehouseOutInfo(arr,max_unit,min_unit,min_number){
695
+         var min_str = ""
696
+         var max_str = ""
697
+        var total = 0
698
+        if (arr.length > 0) {
699
+          for(let i=0;i<arr.length;i++){
700
+            total += parseInt(arr[i].count)
701
+          }
702
+        }
703
+      
704
+        if (total < min_number){
705
+           min_str = total + min_unit
706
+         }
707
+         if (total == 0) {
708
+            min_str = ""
709
+            max_str = ""
710
+         }
711
+         if (total >=min_number) {
712
+           if(parseInt(total/min_number)!=0){
713
+              max_str = parseInt(total/min_number) + max_unit
714
+           }
715
+           if(total%min_number!=0){
716
+              min_str = total%min_number + min_unit
717
+           }
718
+         
719
+         }
720
+        return max_str + min_str
721
+
722
+      }
689 723
     }
690 724
   }
691 725
 </script>

+ 2 - 3
src/xt_pages/stock/stockBatchNumber.vue View File

@@ -6,8 +6,7 @@
6 6
     <div class="app-container ">
7 7
       <div class="cell clearfix">
8 8
         耗材名称:{{this.$route.query.good_name}} &nbsp;
9
-        <!-- 库存: {{getInCount(this.$route.query.id)- getOutCount(this.$route.query.id) - getAutoCount(this.$route.query.id) + getCancelCount(this.$route.query.id)}}{{this.$route.query.packing_unit}}&nbsp; -->
10
-        库存: {{getStockCount(this.$route.query.id)}}
9
+        库存:{{this.$route.query.overCount}}{{packing_unit}} &nbsp;
11 10
         规格:{{this.$route.query.specification_name}} &nbsp;
12 11
         厂家:{{this.$route.query.manufacturer}} 
13 12
       </div>
@@ -140,7 +139,7 @@
140 139
         "-" +
141 140
         (nowDay < 10 ? "0" + nowDay : nowDay);
142 141
       this.getlist()
143
-      this.getStockDrugCount()
142
+      // this.getStockDrugCount()
144 143
       this.packing_unit = this.$route.query.packing_unit
145 144
     },
146 145
     components: {

+ 2 - 3
src/xt_pages/stock/stockFlow.vue View File

@@ -6,8 +6,7 @@
6 6
     <div class="app-container ">
7 7
       <div class="cell clearfix">
8 8
        耗材名称:{{this.$route.query.good_name}} &nbsp;
9
-       <!-- 库存:  {{getInCount(this.$route.query.id)- getOutCount(this.$route.query.id) - getAutoCount(this.$route.query.id) + getCancelCount(this.$route.query.id)}}{{this.$route.query.packing_unit }} &nbsp; -->
10
-       库存: {{getStockCount(this.$route.query.id)}}{{this.$route.query.packing_unit }}
9
+       库存: {{this.$route.query.overCount}}{{packing_unit}} &nbsp;
11 10
        规格:{{this.$route.query.specification_name}} &nbsp;
12 11
        厂家:{{this.$route.query.manufacturer}} 
13 12
       </div>
@@ -167,7 +166,7 @@
167 166
         (nowDay < 10 ? "0" + nowDay : nowDay);
168 167
       // this.getlist()
169 168
       // this.getStockOutList()
170
-      this.getStockDrugCount()
169
+      // this.getStockDrugCount()
171 170
     
172 171
       this.getStockFlow()
173 172
       this.packing_unit = this.$route.query.packing_unit

+ 2 - 2
src/xt_pages/stock/stockInOrderEdit.vue View File

@@ -671,7 +671,7 @@ export default {
671 671
             stockIn: this.recordInfo.recordData
672 672
           };
673 673
           console.log("params2222",params)
674
-        
674
+          
675 675
           EditWarehouse(
676 676
             params,
677 677
             this.warehousing_time,
@@ -803,7 +803,7 @@ export default {
803 803
             this.recordInfo.recordData[i].good_type_id = val.id
804 804
             this.recordInfo.recordData[i].good_name = val.good_name
805 805
             this.recordInfo.recordData[i].good_type_id = val.good_type_id
806
-            this.recordInfo.recordData[i].name = val.specification_name + "*" + val.min_number+val.min_unit +"/"+val.packing_unit
806
+            this.recordInfo.recordData[i].name = val.specification_name +"/"+val.packing_unit
807 807
             this.recordInfo.recordData[i].number =  val.number
808 808
             this.recordInfo.recordData[i].manufacturer = val.manufacturer
809 809
             this.recordInfo.recordData[i].remark = val.remark

+ 17 - 7
src/xt_pages/stock/stockOutOrder.vue View File

@@ -606,7 +606,7 @@
606 606
               <span>使用人</span>
607 607
             </template>
608 608
             <template slot-scope="scope">
609
-              <span v-if="scope.row.is_total == 0">{{scope.row.user.name}}</span>
609
+              <span v-if="scope.row.is_total == 0">{{scope.row.name}}</span>
610 610
               <span v-if="scope.row.is_total == 1"></span>
611 611
             </template>
612 612
           </el-table-column>
@@ -615,7 +615,7 @@
615 615
               <span>使用数量</span>
616 616
             </template>
617 617
             <template slot-scope="scope">
618
-              <span v-if="scope.row.is_total == 0">{{scope.row.count}}{{scope.row.info.packing_unit}}</span>
618
+              <span v-if="scope.row.is_total == 0">{{scope.row.count}}{{scope.row.packing_unit}}</span>
619 619
               <span  v-if="scope.row.is_total == 1">{{scope.row.total}} </span>
620 620
 
621 621
             </template>
@@ -634,8 +634,7 @@
634 634
               <span>批次号</span>
635 635
             </template>
636 636
             <template slot-scope="scope">
637
-              <!-- <span v-if="scope.row.is_total == 0">{{getNumber(scope.row.id)}}</span> -->
638
-               <span v-if="scope.row.is_total ==0">{{getBatchNumber(scope.row.patient_id,scope.row.good_id)}}</span>
637
+               <span v-if="scope.row.is_total ==0">{{scope.row.number}}</span>
639 638
             </template>
640 639
           </el-table-column>
641 640
 <!-- 
@@ -1539,11 +1538,22 @@ export default {
1539 1538
               var stockflowlist = response.data.data.stockFlowList
1540 1539
               console.log("stockflowlist",stockflowlist)
1541 1540
               this.stockFlowList = stockflowlist
1542
-              for (let i = 0; i < arrList.length; i++) {
1543
-                var obj = arrList[i]
1541
+              // for (let i = 0; i < arrList.length; i++) {
1542
+              //   var obj = arrList[i]
1543
+              //   obj['is_total'] = 0
1544
+              //   this.userList.push(obj)
1545
+              //   total = total + arrList[i].count
1546
+              // }
1547
+              // this.userList.push({
1548
+              //   is_total: 1,
1549
+              //   total: total,
1550
+              // })
1551
+
1552
+              for (let i = 0; i <  this.stockFlowList.length; i++) {
1553
+                var obj =  this.stockFlowList[i]
1544 1554
                 obj['is_total'] = 0
1545 1555
                 this.userList.push(obj)
1546
-                total = total + arrList[i].count
1556
+                total = total +  this.stockFlowList[i].count
1547 1557
               }
1548 1558
               this.userList.push({
1549 1559
                 is_total: 1,

+ 45 - 8
src/xt_pages/stock/stockPrint.vue View File

@@ -36,14 +36,18 @@
36 36
                                    <td>{{getGoodType(item.good_type_id)}}</td>
37 37
                                    <td>{{item.good_name }}</td>
38 38
                                    <td><span>{{item.specification_name }} / {{item.packing_unit}}</span></td>
39
-                                   <td>{{item.price}}</td>
39
+                                   <td>{{item.buy_price}}</td>
40 40
                                    <td>{{getManufacture(item.manufacturer)}}</td>
41
-                                   <td>{{getInCount(item.good_id)}}</td>
42
-                                   <!-- <td><span>{{getOutCount(item.good_id) + getAutoCount(item.good_id)}}</span></td>  -->
43
-                                   <td><span>{{getInCount(item.good_id) - getStockCount(item.good_id)}}{{item.packing_unit}}</span></td>
44
-                                   <!-- <td>{{getInCount(item.good_id)- getOutCount(item.good_id) - getAutoCount(item.good_id)}}</td> -->
45
-                                   <!-- <td>{{getCancelCount(item.good_id)}}{{item .packing_unit}}</td> -->
46
-                                   <td> {{getStockCount(item.good_id)}} {{item.packing_unit}} </td>
41
+                                   <td>
42
+                                      <span v-if="getWareInfo(item.xt_warehouse_info)>0">{{getWareInfo(item.xt_warehouse_info)}}{{item.packing_unit}}</span>
43
+                                   </td>
44
+                                   <td>
45
+                                       <span v-if="getWareInfo(item.xt_warehouse_info)>0">{{getWareInfo(item.xt_warehouse_info) - getOverplus(item.xt_warehouse_info) - getCancelInfo(item.cancel_stock_info)}}{{item.packing_unit}}</span>
46
+                                   </td>
47
+                                  
48
+                                   <td>
49
+                                     <span v-if="getOverplus(item.xt_warehouse_info)>0">{{getOverplus(item.xt_warehouse_info)}}{{item.packing_unit}}</span>  
50
+                                   </td>
47 51
                                 </tr>
48 52
                             </tbody>
49 53
                         </table>
@@ -251,7 +255,40 @@ export default {
251 255
        }
252 256
      }
253 257
      return stock_count
258
+     },
259
+   getWareInfo(arr){
260
+     var total = 0
261
+     if(arr.length > 0){
262
+       for(let i=0;i<arr.length;i++){
263
+         total += parseInt(arr[i].warehousing_count)
264
+       }
265
+     }else{
266
+       total = ""
267
+     }
268
+     return total
269
+   },
270
+   getOverplus(arr){
271
+     var total = 0
272
+     if(arr.length > 0){
273
+      for(let i=0;i<arr.length;i++){
274
+        total += arr[i].stock_count
275
+      }
276
+     }else{
277
+       total = ""
278
+     }
279
+     return total
280
+   },
281
+   getCancelInfo(arr){
282
+     var total = 0
283
+     if(arr.length > 0){
284
+      for(let i=0;i<arr.length;i++){
285
+        total += arr[i].count
286
+      }
287
+     }else{
288
+       total = ""
254 289
      }
290
+     return total
291
+   }
255 292
     },
256 293
     created(){
257 294
       var starttime =  this.$route.query.start_time
@@ -266,7 +303,7 @@ export default {
266 303
       this.limit = this.$route.query.limit
267 304
       this.getlist()
268 305
       this.GetAllGoodType()
269
-      this.getStockDrugCount()
306
+      // this.getStockDrugCount()
270 307
     }
271 308
 }
272 309
 </script>

+ 48 - 25
src/xt_pages/stock/stockQuery.vue View File

@@ -93,7 +93,7 @@
93 93
          </el-table-column>
94 94
         <el-table-column label="进货单价" align="center">
95 95
           <template slot-scope="scope">
96
-            {{scope.row.price}}
96
+             {{scope.row.buy_price}}
97 97
           </template>
98 98
         </el-table-column>
99 99
         <el-table-column label="生产商" align="center">
@@ -103,30 +103,19 @@
103 103
         </el-table-column>
104 104
        <el-table-column label="入库数量" align="center">
105 105
          <template slot-scope="scope">
106
-          <span>{{getInCount(scope.row.good_id)}}{{scope.row.packing_unit}}</span>
106
+          
107
+          <span v-if="getWareInfo(scope.row.xt_warehouse_info)>0">{{getWareInfo(scope.row.xt_warehouse_info)}}{{scope.row.packing_unit}}</span>
107 108
          </template>
108 109
        </el-table-column>
109 110
        <el-table-column label="出库数量" align="center">
110 111
          <template slot-scope="scope">
111
-           <!-- <span>{{getOutCount(scope.row.good_id) + getAutoCount(scope.row.good_id)}}{{scope.row.packing_unit}}</span> -->
112
-
113
-           {{getInCount(scope.row.good_id) - getStockCount(scope.row.good_id)}}{{scope.row.packing_unit}}
112
+            <span v-if="getWareInfo(scope.row.xt_warehouse_info)>0">{{getWareInfo(scope.row.xt_warehouse_info) - getOverplus(scope.row.xt_warehouse_info) - getCancelInfo(scope.row.cancel_stock_info)}}{{scope.row.packing_unit}}</span>
114 113
          </template>
115 114
        </el-table-column>
116 115
 
117
-       <!-- <el-table-column label="退库数量" align="center">
118
-         <template slot-scope="scope">
119
-           <span>{{getCancelCount(scope.row.good_id)}}{{scope.row.packing_unit}}</span>
120
-
121
-         </template>
122
-       </el-table-column>
123
-       -->
124 116
        <el-table-column label="剩余库存量" align="center">
125 117
          <template slot-scope="scope">
126
-           <!-- {{getInCount(scope.row.good_id)- getOutCount(scope.row.good_id) - getAutoCount(scope.row.good_id) + getCancelCount(scope.row.good_id)}} {{scope.row.packing_unit}} -->
127
-           
128
-           {{getStockCount(scope.row.good_id)}} {{scope.row.packing_unit}} 
129
-
118
+           <span v-if="getOverplus(scope.row.xt_warehouse_info)>0">{{getOverplus(scope.row.xt_warehouse_info)}}{{scope.row.packing_unit}}</span>
130 119
          </template>
131 120
        </el-table-column>
132 121
        <el-table-column label="操作" align="center" width="260px">
@@ -199,7 +188,7 @@ export default {
199 188
     this.GetAllGoodInfo();
200 189
     this.GetAllGoodType();
201 190
     this.getlist()
202
-    this.getStockDrugCount()
191
+    // this.getStockDrugCount()
203 192
   },
204 193
   components: {
205 194
     BreadCrumb
@@ -406,18 +395,17 @@ export default {
406 395
          import('@/vendor/Export2Excel').then(excel => {
407 396
 
408 397
          const tHeader = ['耗材类型', '耗材名称', '规格&单位','进货单价','生产商','入库数量','出库数量','库存剩余量']
409
-         const filterVal = ['type_name', 'good_name', 'unit','price','prodect_name','inCount','outCount','overplus']
398
+         const filterVal = ['type_name', 'good_name', 'unit','buy_price','prodect_name','inCount','outCount','overplus']
410 399
 
411 400
        
412 401
          for(let i=0;i<this.tableList.length;i++){
413 402
            this.tableList[i].type_name = this.getGoodType(this.tableList[i].good_type_id)
414 403
            this.tableList[i].unit = this.tableList[i].specification_name + "/" + this.tableList[i].packing_unit
415 404
            this.tableList[i].prodect_name = this.getManufacture(this.tableList[i].manufacturer)
416
-           this.tableList[i].inCount =  this.getInCount(this.tableList[i].good_id)
417
-          //  this.tableList[i].outCount = this.getOutCount(this.tableList[i].good_id) + this.getAutoCount(this.tableList[i].good_id)
418
-          //  this.tableList[i].overplus =this.getInCount(this.tableList[i].good_id)- this.getOutCount(this.tableList[i].good_id) - this.getAutoCount(this.tableList[i].good_id)
419
-          this.tableList[i].outCount =  this.getInCount(this.tableList[i].good_id) - this.getStockCount(this.tableList[i].good_id)
420
-          this.tableList[i].overplus = this.getStockCount(this.tableList[i].good_id)
405
+           this.tableList[i].inCount =  this.getWareInfo(this.tableList[i].xt_warehouse_info)
406
+        
407
+          this.tableList[i].outCount = this.getWareInfo(this.tableList[i].xt_warehouse_info) - this.getOverplus(this.tableList[i].xt_warehouse_info) - this.getCancelInfo(this.tableList[i].cancel_stock_info)
408
+          this.tableList[i].overplus = this.getOverplus(this.tableList[i].xt_warehouse_info)
421 409
          }
422 410
          console.log("table",this.tableList)
423 411
          const data = this.formatJson(filterVal, this.tableList)
@@ -505,7 +493,8 @@ export default {
505 493
           }
506 494
        }
507 495
       specification_name = val.specification_name + "/" + val.packing_unit
508
-      this.$router.push({path:"/stock/in/stockflow?id="+val.good_id+"&good_name="+val.good_name+"&manufacturer="+manufacturer_name+"&specification_name="+specification_name+"&packing_unit="+val.packing_unit})
496
+      var overCount  = this.getOverplus(val.xt_warehouse_info)
497
+      this.$router.push({path:"/stock/in/stockflow?id="+val.id+"&good_name="+val.good_name+"&manufacturer="+manufacturer_name+"&specification_name="+specification_name+"&packing_unit="+val.packing_unit+"&overCount="+overCount})
509 498
     },
510 499
     toClickOne(val){
511 500
        var manufacturer_name = ""
@@ -516,7 +505,8 @@ export default {
516 505
           }
517 506
        }
518 507
       specification_name = val.specification_name + "/" + val.packing_unit
519
-      this.$router.push({path:"/stock/in/stockbatchnumber?id="+val.good_id+"&good_name="+val.good_name+"&manufacturer="+manufacturer_name+"&specification_name="+specification_name+"&packing_unit="+val.packing_unit})
508
+       var overCount  = this.getOverplus(val.xt_warehouse_info)
509
+      this.$router.push({path:"/stock/in/stockbatchnumber?id="+val.id+"&good_name="+val.good_name+"&manufacturer="+manufacturer_name+"&specification_name="+specification_name+"&packing_unit="+val.packing_unit+"&overCount="+overCount})
520 510
     },
521 511
     getStockDrugCount(){
522 512
         var params ={
@@ -585,6 +575,39 @@ export default {
585 575
        }
586 576
      }
587 577
      return stock_count
578
+   },
579
+   getWareInfo(arr){
580
+     var total = 0
581
+     if(arr.length > 0){
582
+       for(let i=0;i<arr.length;i++){
583
+         total += parseInt(arr[i].warehousing_count)
584
+       }
585
+     }else{
586
+       total = ""
587
+     }
588
+     return total
589
+   },
590
+   getOverplus(arr){
591
+     var total = 0
592
+     if(arr.length > 0){
593
+      for(let i=0;i<arr.length;i++){
594
+        total += arr[i].stock_count
595
+      }
596
+     }else{
597
+       total = ""
598
+     }
599
+     return total
600
+   },
601
+   getCancelInfo(arr){
602
+     var total = 0
603
+     if(arr.length > 0){
604
+      for(let i=0;i<arr.length;i++){
605
+        total += arr[i].count
606
+      }
607
+     }else{
608
+       total = ""
609
+     }
610
+     return total
588 611
    }
589 612
   }
590 613
 };