瀏覽代碼

11月14日 库存扣减更新

XMLWAN 3 年之前
父節點
當前提交
c4be6c9efc

+ 2 - 1
src/components/Popup/index.vue 查看文件

@@ -63,7 +63,8 @@ export default {
63 63
       this.show = false;
64 64
     },
65 65
     toClick(id) {
66
-      this.$router.push("/good/order/edit?id=" + id);
66
+      
67
+      this.$router.push({path:"/good/order/edit?id=" + id});
67 68
     },
68 69
   },
69 70
 };

+ 2 - 2
src/views/layout/Layout.vue 查看文件

@@ -16,10 +16,10 @@
16 16
           <i class="iconfont icon-computer_fill navIcon"></i>
17 17
           <p>透析管理</p>
18 18
         </div>
19
-        <!-- <div v-if="caigouShow" :class="index == 5 ? 'navOne navActive' : 'navOne'" @click="clickActive(5,'采购管理')">
19
+        <div v-if="caigouShow" :class="index == 5 ? 'navOne navActive' : 'navOne'" @click="clickActive(5,'采购管理')">
20 20
          <i class="iconfont icon-kccx navIcon"></i>
21 21
           <p>采购管理</p>
22
-        </div> -->
22
+        </div>
23 23
         <div v-if="kucunShow" :class="index == 3 ? 'navOne navActive' : 'navOne'" @click="clickActive(3,'库房管理')">
24 24
           <i class="iconfont icon-kccx navIcon"></i>
25 25
           <p>库房管理</p>

+ 87 - 44
src/xt_pages/supply/components/editGoodOrder.vue 查看文件

@@ -556,33 +556,10 @@ export default {
556 556
                 drugList[i].drug_type = this.drugTypeList[y].name;
557 557
               }
558 558
             }
559
-            drugList[i].supply_name =
560
-              drugList[i].drug_name +
561
-              " " +
562
-              drugList[i].dose +
563
-              drugList[i].dose_unit +
564
-              "*" +
565
-              drugList[i].min_number +
566
-              drugList[i].min_unit +
567
-              "/" +
568
-              drugList[i].max_unit +
569
-              " " +
570
-              drugList[i].manufacturer;
559
+            drugList[i].supply_name =drugList[i].drug_name +" " +drugList[i].dose +drugList[i].dose_unit +"*" +drugList[i].min_number +drugList[i].min_unit +"/" +drugList[i].max_unit +" " +drugList[i].manufacturer;
571 560
             drugList[i].supply_type = drugList[i].drug_type;
572
-            drugList[i].supply_specification_name =
573
-              drugList[i].dose +
574
-              drugList[i].dose_unit +
575
-              "*" +
576
-              drugList[i].min_number +
577
-              drugList[i].min_unit +
578
-              "/" +
579
-              drugList[i].max_unit;
580
-            drugList[i].supply_total = this.getWarehoseInfo(
581
-              drugList[i].drug_warehouse_info,
582
-              drugList[i].max_unit,
583
-              drugList[i].min_unit,
584
-              drugList[i].min_number
585
-            );
561
+            drugList[i].supply_specification_name =drugList[i].dose + drugList[i].dose_unit +"*" +drugList[i].min_number +drugList[i].min_unit +"/" +drugList[i].max_unit;
562
+            drugList[i].supply_total = this.getWarehoseInfo(drugList[i].drug_warehouse_info,drugList[i].max_unit,drugList[i].min_unit,drugList[i].min_number);
586 563
             drugList[i].supply_count = "";
587 564
             drugList[i].supply_total_price = "";
588 565
             drugList[i].supply_manufacturer = drugList[i].manufacturer;
@@ -629,19 +606,11 @@ export default {
629 606
                 goodList[i].good_type_id = this.goodTypeList[y].type_name;
630 607
               }
631 608
             }
632
-            goodList[i].supply_name =
633
-              goodList[i].good_name +
634
-              " " +
635
-              goodList[i].specification_name +
636
-              " " +
637
-              goodList[i].manufacturer;
609
+            goodList[i].supply_name =goodList[i].good_name +" " +goodList[i].specification_name +" " +goodList[i].manufacturer;
638 610
             goodList[i].supply_type = goodList[i].good_type_id;
639
-            goodList[i].supply_specification_name =
640
-              goodList[i].specification_name;
611
+            goodList[i].supply_specification_name =goodList[i].specification_name;
641 612
             goodList[i].supply_price = goodList[i].buy_price;
642
-            goodList[i].supply_total = this.getTotalStockCount(
643
-              goodList[i].good_warehouse_info
644
-            );
613
+            goodList[i].supply_total = this.getTotalStockCount(goodList[i].good_warehouse_info);
645 614
             goodList[i].supply_count = "";
646 615
             goodList[i].supply_total_price = "";
647 616
             goodList[i].supply_manufacturer = goodList[i].manufacturer;
@@ -1111,17 +1080,91 @@ export default {
1111 1080
         if (response.data.state == 1) {
1112 1081
           var cancelList = response.data.data.cancelList;
1113 1082
           console.log("cancelList23232232323323223", cancelList);
1114
-          if (cancelList.length > 0) {
1115
-          }
1116
-          var outList = response.data.data.outList;
1117
-          console.log("outList2332232332", outList);
1083
+           var drugList = response.data.data.drugList;
1084
+          console.log("drugList233223232323232", drugList);
1118 1085
           var cancelOrderList = response.data.data.cancelOrderList;
1119 1086
           console.log("cancelOrderList2323322322332", cancelOrderList);
1120
-          var drugList = response.data.data.drugList;
1121
-          console.log("drugList233223232323232", drugList);
1087
+          if(cancelList.length == 0){
1088
+            this.$router.push({ path: "/good/return/add?id=" + this.id });
1089
+          }
1090
+          if (cancelList.length > 0) {
1091
+            var outList = response.data.data.outList;
1092
+            for(let i=0;i<outList.length;i++){
1093
+              if(outList[i].is_source == 1){
1094
+                for(let j=0;j<drugList.length;j++){
1095
+                  if(outList[i].project_id == drugList[j].id){
1096
+                    if(outList[i].supply_unit == drugList[j].max_unit){
1097
+                      outList[i].count = outList[i].count * drugList[j].min_number
1098
+                    }
1099
+
1100
+                  }
1101
+                }
1102
+              }
1103
+            }
1104
+
1105
+            for(let i=0;i<cancelOrderList.length;i++){
1106
+             if(cancelOrderList[i].is_source == 1){
1107
+                for(let j=0;j<drugList.length;j++){
1108
+                  if(cancelOrderList[i].supply_unit == drugList[j].max_unit){
1109
+                    cancelOrderList[i].count = cancelOrderList[i].count * drugList[j].min_number
1110
+                  }
1111
+                 }
1112
+               }
1113
+            }
1114
+            
1115
+            let objInfo = {};
1116
+            if(cancelOrderList.length >0){
1117
+              cancelOrderList.forEach((item, index) => {
1118
+                let { project_id } = item;
1119
+                if (!objInfo[project_id]) {
1120
+                  objInfo[project_id] = {
1121
+                    project_id,
1122
+                    child: [],
1123
+                    count: 0,
1124
+                  };
1125
+                }
1126
+              });
1127
+              let newArr = Object.values(objInfo)
1128
+
1129
+              console.log("outList2332232332", outList)
1130
+              for (let i = 0; i < cancelOrderList.length; i++) {
1131
+                for (let j = 0; j < newArr.length; j++) {
1132
+                  if (cancelOrderList[i].project_id == newArr[j].project_id) {
1133
+                    newArr[j].child.push(cancelOrderList[i])
1134
+                }
1135
+              }
1136
+              console.log("newAr2332232323", newArr)
1137
+
1138
+                //如果采购单有数据,则需要比较数量
1139
+            if (newArr.length > 0) {
1140
+              for (let i = 0; i < purcaseOrder.length; i++) {
1141
+                for (let j = 0; j < newArr.length; j++) {
1142
+                  if (purcaseOrder[i].project_id == newArr[j].project_id) {
1143
+                    //根据商品ID比较数量大小,把数量不足的商品ID储存,表示采购单的数量未满足采购订单的数据,可以继续生成采购单
1144
+                    if (purcaseOrder[i].count > newArr[j].count) {
1145
+                      arr.push(purcaseOrder[i].project_id);
1146
+                    }
1147
+                  }
1148
+                }
1149
+              }
1150
+              //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成
1151
+
1152
+              if (arr.length == 0) {
1153
+                this.$message.error("该订单已全部生成采购单,请知悉!");
1154
+                return;
1155
+              }
1156
+
1157
+              if (total != goodOrder.length) {
1158
+                str = arr.join(",");
1159
+                this.$router.push({ path: "/good/order/add?id=" + id + "&ids=" + str});
1160
+              }
1161
+             }
1162
+            }
1163
+          }
1164
+         }
1122 1165
         }
1123 1166
       });
1124
-      this.$router.push({ path: "/good/return/add?id=" + this.id });
1167
+     
1125 1168
     },
1126 1169
     //反审核
1127 1170
     MofyGoodOrder() {

+ 11 - 13
src/xt_pages/supply/components/editPurchaseOrder.vue 查看文件

@@ -904,8 +904,7 @@ export default {
904 904
             for (let j = 0; j < drugList.length; j++) {
905 905
               if (purcaseOrder[i].is_source == 1) {
906 906
                 if (purcaseOrder[i].supply_unit == drugList[j].max_unit) {
907
-                  purcaseOrder[i].count =
908
-                    purcaseOrder[i].count * drugList[j].min_number;
907
+                  purcaseOrder[i].count = purcaseOrder[i].count * drugList[j].min_number;
909 908
                 }
910 909
               }
911 910
             }
@@ -915,8 +914,7 @@ export default {
915 914
             for (let j = 0; j < drugList.length; j++) {
916 915
               if (goodOrder[i].is_source == 1) {
917 916
                 if (goodOrder[i].supply_unit == drugList[j].max_unit) {
918
-                  goodOrder[i].count =
919
-                    goodOrder[i].count * drugList[j].min_number;
917
+                    goodOrder[i].count = goodOrder[i].count * drugList[j].min_number;
920 918
                 }
921 919
               }
922 920
             }
@@ -998,11 +996,11 @@ export default {
998 996
       //获取购货订单号
999 997
       getGoodOrderList(id).then((response) => {
1000 998
         if (response.data.state == 1) {
1001
-          var list = response.data.data.list;
1002
-          this.orderList = list;
999
+          var list = response.data.data.list
1000
+          console.log("list23232323",list)
1001
+          this.orderList = list
1003 1002
           //如果长度大于0,有购货单不能反审核
1004
-          if (list.length < 0) {
1005
-            // this.dialogVisible = true
1003
+          if (list.length > 0) {
1006 1004
             this.$popup({
1007 1005
               title: "系统提示",
1008 1006
               content: this.number,
@@ -1012,10 +1010,10 @@ export default {
1012 1010
             });
1013 1011
           }
1014 1012
           if (list.length == 0) {
1015
-            this.getReturnOrder();
1016
-            this.showOne = false;
1017
-            this.showTwo = true;
1018
-            this.showThree = false;
1013
+            this.getReturnOrder()
1014
+            this.showOne = false
1015
+            this.showTwo = true
1016
+            this.showThree = false
1019 1017
           }
1020 1018
         }
1021 1019
       });
@@ -1032,7 +1030,7 @@ export default {
1032 1030
       });
1033 1031
     },
1034 1032
     toClick(id) {
1035
-      this.$router.push("/good/order/edit?id=" + id);
1033
+      this.$router.push({path:"/good/order/edit?id=" + id});
1036 1034
     },
1037 1035
   },
1038 1036
   created() {