Browse Source

11月14日 库存扣减更新

XMLWAN 3 years ago
parent
commit
00df925dc5

+ 2 - 2
src/views/layout/Layout.vue View File

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

+ 123 - 28
src/xt_pages/supply/components/addGoodOrder.vue View File

447
   getPurchaseOrderInfo,
447
   getPurchaseOrderInfo,
448
   addGoodOrder,
448
   addGoodOrder,
449
   updateGoodOrder,
449
   updateGoodOrder,
450
-  checkGoodOrderById
450
+  checkGoodOrderById,
451
+  getGoodOrderCountList,
452
+  ModefySupplyWarehousing
451
 } from "@/api/supply";
453
 } from "@/api/supply";
452
 export default {
454
 export default {
453
   name: "addPurchaseOrder",
455
   name: "addPurchaseOrder",
526
       showTwo: false,
528
       showTwo: false,
527
       warese_out_id: 0,
529
       warese_out_id: 0,
528
       return_remark: "",
530
       return_remark: "",
531
+      is_warehouse:0
529
     };
532
     };
530
   },
533
   },
531
   methods: {
534
   methods: {
630
                 goodList[i].good_type_id = this.goodTypeList[y].type_name;
633
                 goodList[i].good_type_id = this.goodTypeList[y].type_name;
631
               }
634
               }
632
             }
635
             }
633
-            goodList[i].supply_name =
634
-              goodList[i].good_name +
635
-              " " +
636
-              goodList[i].specification_name +
637
-              " " +
636
+            goodList[i].supply_name =goodList[i].good_name +" " +goodList[i].specification_name + " " +
638
               goodList[i].manufacturer;
637
               goodList[i].manufacturer;
639
             goodList[i].supply_type = goodList[i].good_type_id;
638
             goodList[i].supply_type = goodList[i].good_type_id;
640
             goodList[i].supply_specification_name =
639
             goodList[i].supply_specification_name =
947
             stockIn: this.recordInfo.tableList,
946
             stockIn: this.recordInfo.tableList,
948
             return_remake: this.return_remark,
947
             return_remake: this.return_remark,
949
           };
948
           };
950
-          addGoodOrder(
951
-            params,
952
-            this.supplier_name,
953
-            start,
954
-            this.arrearage,
955
-            this.payment,
956
-            warehousing_id,
957
-            this.number,
958
-            this.rate_of_concession,
959
-            this.discount_amount
960
-          ).then((response) => {
949
+          addGoodOrder( params,this.supplier_name,start,this.arrearage,this.payment, warehousing_id,this.number,this.rate_of_concession,this.discount_amount).then((response) => {
961
             if (response.data.state == 1) {
950
             if (response.data.state == 1) {
962
               this.loading = false;
951
               this.loading = false;
963
               this.$message.success("保存成功!");
952
               this.$message.success("保存成功!");
973
               this.arrearage = warehouseOut.arrearage;
962
               this.arrearage = warehouseOut.arrearage;
974
               this.supplier_name = warehouseOut.supplier_id;
963
               this.supplier_name = warehouseOut.supplier_id;
975
               this.return_remake = warehouseOut.return_remake;
964
               this.return_remake = warehouseOut.return_remake;
965
+              this.warehousing_id  = warehouseOut.warehousing_id
976
               this.start_time = this.getTimes(warehouseOut.document_date);
966
               this.start_time = this.getTimes(warehouseOut.document_date);
977
               for (let i = 0; i < orderInfo.length; i++) {
967
               for (let i = 0; i < orderInfo.length; i++) {
978
                 orderInfo[i].supply_count = orderInfo[i].count;
968
                 orderInfo[i].supply_count = orderInfo[i].count;
1038
         this.loading = false;
1028
         this.loading = false;
1039
         return false;
1029
         return false;
1040
       }
1030
       }
1041
-      console.log("表哥2323233232", this.recordInfo.tableList);
1042
       for (let i = 0; i < this.recordInfo.tableList.length; i++) {
1031
       for (let i = 0; i < this.recordInfo.tableList.length; i++) {
1043
         this.recordInfo.tableList[i].supply_count = parseInt(
1032
         this.recordInfo.tableList[i].supply_count = parseInt(
1044
           this.recordInfo.tableList[i].supply_count
1033
           this.recordInfo.tableList[i].supply_count
1076
             stockIn: this.recordInfo.tableList,
1065
             stockIn: this.recordInfo.tableList,
1077
             return_remake: this.return_remake,
1066
             return_remake: this.return_remake,
1078
           };
1067
           };
1079
-          console.log("sotckind23232232323232323232", params);
1080
-
1068
+         
1081
           updateGoodOrder(
1069
           updateGoodOrder(
1082
             params,
1070
             params,
1083
             this.supplier_name,
1071
             this.supplier_name,
1098
         }
1086
         }
1099
       });
1087
       });
1100
     },
1088
     },
1101
-    checkGoodOrder(){
1102
-      checkGoodOrderById(this.warese_out_id).then(response=>{
1103
-         if(response.data.state == 1){
1104
-           var out = response.data.data.out
1105
-           this.$message.success("审核成功!")
1106
-         }
1107
-      })
1108
-    }
1089
+    checkGoodOrder() {
1090
+      var id = this.warese_out_id;
1091
+      var warehousing_id = this.warehousing_id;
1092
+      console.log("hhh2323232323232323",id,warehousing_id)
1093
+      getGoodOrderCountList(id, warehousing_id).then((response) => {
1094
+        if (response.data.state == 1) {
1095
+          this.$message.success("审核成功!");
1096
+          this.is_check = 1
1097
+          this.showOne = false;
1098
+          this.showTwo = true;
1099
+          this.showThree = true;
1100
+          var purcaseOrder = response.data.data.purcaseOrder;
1101
+          console.log("采购订单", purcaseOrder);
1102
+
1103
+          var goodOrder = response.data.data.goodOrder;
1104
+          console.log("采购单", goodOrder);
1105
+          var drugList = response.data.data.drugList;
1106
+          console.log("druglist23323223", drugList);
1107
+          var is_warehouse = 0;
1108
+          for (let i = 0; i < purcaseOrder.length; i++) {
1109
+            for (let j = 0; j < drugList.length; j++) {
1110
+              if (purcaseOrder[i].is_source == 1) {
1111
+                if (purcaseOrder[i].supply_unit == drugList[j].max_unit) {
1112
+                  purcaseOrder[i].count =
1113
+                    purcaseOrder[i].count * drugList[j].min_number;
1114
+                }
1115
+              }
1116
+            }
1117
+          }
1118
+
1119
+          for (let i = 0; i < goodOrder.length; i++) {
1120
+            for (let j = 0; j < drugList.length; j++) {
1121
+              if (goodOrder[i].is_source == 1) {
1122
+                if (goodOrder[i].supply_unit == drugList[j].max_unit) {
1123
+                  goodOrder[i].count =
1124
+                    goodOrder[i].count * drugList[j].min_number;
1125
+                }
1126
+              }
1127
+            }
1128
+          }
1129
+
1130
+          let objInfo = {};
1131
+          if (goodOrder.length > 0) {
1132
+            goodOrder.forEach((item, index) => {
1133
+              let { project_id } = item;
1134
+              if (!objInfo[project_id]) {
1135
+                objInfo[project_id] = {
1136
+                  project_id,
1137
+                  child: [],
1138
+                  count: 0,
1139
+                };
1140
+              }
1141
+            });
1142
+            let newArr = Object.values(objInfo);
1143
+
1144
+            for (let i = 0; i < goodOrder.length; i++) {
1145
+              for (let j = 0; j < newArr.length; j++) {
1146
+                if (goodOrder[i].project_id == newArr[j].project_id) {
1147
+                  newArr[j].child.push(goodOrder[i]);
1148
+                }
1149
+              }
1150
+            }
1151
+            console.log("newAr2332232323", newArr);
1152
+
1153
+            for (let i = 0; i < newArr.length; i++) {
1154
+              for (let j = 0; j < newArr[i].child.length; j++) {
1155
+                newArr[i].count += newArr[i].child[j].count;
1156
+              }
1157
+            }
1158
+
1159
+            var arr = [];
1160
+            var total = 0;
1161
+            var str = "";
1162
+
1163
+            //如果采购单有数据,则需要比较数量
1164
+            if (newArr.length > 0) {
1165
+              for (let i = 0; i < purcaseOrder.length; i++) {
1166
+                for (let j = 0; j < newArr.length; j++) {
1167
+                  if (purcaseOrder[i].project_id == newArr[j].project_id) {
1168
+                    //根据商品ID比较数量大小,把数量不足的商品ID储存,表示采购单的数量未满足采购订单的数据,部分入库
1169
+                    if (purcaseOrder[i].count > newArr[j].count) {
1170
+                      arr.push(purcaseOrder[i].project_id);
1171
+                    }
1172
+                  }
1173
+                }
1174
+              }
1175
+              //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成,全部入库
1176
+
1177
+              if (arr.length == 0) {
1178
+                this.is_warehouse = 1;
1179
+                this.ModefySupplyWarehousing(is_warehouse, warehousing_id);
1180
+              }
1181
+
1182
+              //部分入库
1183
+              if (total != goodOrder.length) {
1184
+                //修改订购单
1185
+                this.is_warehouse = 3;
1186
+                this.ModefySupplyWarehousing(is_warehouse, warehousing_id);
1187
+              }
1188
+            }
1189
+          }
1190
+        }
1191
+      });
1192
+    },
1193
+    ModefySupplyWarehousing(is_warehouse, warehousing_id) {
1194
+      var params = {
1195
+        is_warehouse: this.is_warehouse,
1196
+        warehousing_id: this.warehousing_id,
1197
+      };
1198
+      ModefySupplyWarehousing(params).then((response) => {
1199
+        if (response.data.state == 1) {
1200
+          var msg = response.data.data.msg;
1201
+        }
1202
+      });
1203
+    },
1109
   },
1204
   },
1110
   created() {
1205
   created() {
1111
     const tempObj = {};
1206
     const tempObj = {};

+ 12 - 9
src/xt_pages/supply/components/addGoodReturn.vue View File

162
                   placeholder="请选择"
162
                   placeholder="请选择"
163
                   :disabled="disabled"
163
                   :disabled="disabled"
164
                 >
164
                 >
165
-                  <!-- <el-option
166
-                            v-for="(item,index) in scope.row.unitList"
167
-                            :key="index"
168
-                            :label="item.name"
169
-                            :value="item.name">
170
-                        </el-option> -->
165
+                  <el-option
166
+                    v-for="(item,index) in scope.row.unitList"
167
+                    :key="index"
168
+                    :label="item.name"
169
+                    :value="item.name">
170
+                   </el-option>
171
                 </el-select>
171
                 </el-select>
172
               </el-form-item>
172
               </el-form-item>
173
             </template>
173
             </template>
184
           <el-table-column label="可退数量" align="center" width="200px">
184
           <el-table-column label="可退数量" align="center" width="200px">
185
             <template slot-scope="scope">
185
             <template slot-scope="scope">
186
               <el-input
186
               <el-input
187
-                v-model="scope.row.supply_specification_name"
187
+                v-model="scope.row.count"
188
                 style="width: 150px"
188
                 style="width: 150px"
189
                 :disabled="true"
189
                 :disabled="true"
190
                 placeholder="可退数量"
190
                 placeholder="可退数量"
257
             </template>
257
             </template>
258
           </el-table-column>
258
           </el-table-column>
259
 
259
 
260
-          <el-table-column label="源购订单号" align="center" width="200px">
260
+          <el-table-column label="源购订单号" align="center" width="200px">
261
             <template slot-scope="scope">
261
             <template slot-scope="scope">
262
               <el-input
262
               <el-input
263
                 v-model="scope.row.good_number"
263
                 v-model="scope.row.good_number"
386
     return {
386
     return {
387
       tipsInfo: "",
387
       tipsInfo: "",
388
       crumbs: [
388
       crumbs: [
389
-        { path: false, name: "货单" },
389
+        { path: false, name: "退货单" },
390
         { path: "/good/return/add", name: "新增退货单" },
390
         { path: "/good/return/add", name: "新增退货单" },
391
       ],
391
       ],
392
       showTwo: false,
392
       showTwo: false,
603
       tempObj["supply_type"] = "";
603
       tempObj["supply_type"] = "";
604
       tempObj["supply_specification_name"] = "";
604
       tempObj["supply_specification_name"] = "";
605
       tempObj["supply_total"] = "";
605
       tempObj["supply_total"] = "";
606
+      tempObj["count"] = "";
606
       tempObj["supply_count"] = "";
607
       tempObj["supply_count"] = "";
607
       tempObj["supply_price"] = "";
608
       tempObj["supply_price"] = "";
608
       tempObj["supply_total_price"] = "";
609
       tempObj["supply_total_price"] = "";
800
           var goodList = response.data.data.goodList;
801
           var goodList = response.data.data.goodList;
801
           for (let i = 0; i < orderInfo.length; i++) {
802
           for (let i = 0; i < orderInfo.length; i++) {
802
             orderInfo[i].supply_count = orderInfo[i].count;
803
             orderInfo[i].supply_count = orderInfo[i].count;
804
+            orderInfo[i].count = orderInfo[i].count
803
             orderInfo[i].supply_price = orderInfo[i].price;
805
             orderInfo[i].supply_price = orderInfo[i].price;
804
             orderInfo[i].supply_remake = orderInfo[i].remark;
806
             orderInfo[i].supply_remake = orderInfo[i].remark;
805
             orderInfo[i].type = orderInfo[i].is_source;
807
             orderInfo[i].type = orderInfo[i].is_source;
962
     tempObj["supply_expiry_date"] = ""
964
     tempObj["supply_expiry_date"] = ""
963
     tempObj["warehousing_id"] =0
965
     tempObj["warehousing_id"] =0
964
     tempObj["warehouse_info_id"] =0
966
     tempObj["warehouse_info_id"] =0
967
+    tempObj["count"] = "";
965
     this.recordInfo.tableList.push(tempObj);
968
     this.recordInfo.tableList.push(tempObj);
966
     console.log("即哪里地方2",this.recordInfo.tableList)
969
     console.log("即哪里地方2",this.recordInfo.tableList)
967
     this.getInitOrder();
970
     this.getInitOrder();

+ 1 - 0
src/xt_pages/supply/components/editGoodOrder.vue View File

1211
           var msg = response.data.data.msg;
1211
           var msg = response.data.data.msg;
1212
           if (msg == 1) {
1212
           if (msg == 1) {
1213
             this.$message.success("反审核成功!");
1213
             this.$message.success("反审核成功!");
1214
+            return 
1214
           }
1215
           }
1215
           if (msg == 2) {
1216
           if (msg == 2) {
1216
             var cancelList = response.data.data.cancelList
1217
             var cancelList = response.data.data.cancelList

+ 6 - 3
src/xt_pages/supply/components/editGoodReturn.vue View File

233
             </template>
233
             </template>
234
           </el-table-column>
234
           </el-table-column>
235
 
235
 
236
-          <el-table-column label="源购订单号" align="center" width="200px">
236
+          <el-table-column label="源购订单号" align="center" width="200px">
237
             <template slot-scope="scope">
237
             <template slot-scope="scope">
238
               <el-input
238
               <el-input
239
                 v-model="scope.row.good_number"
239
                 v-model="scope.row.good_number"
349
     return {
349
     return {
350
       tipsInfo:"",
350
       tipsInfo:"",
351
       crumbs: [
351
       crumbs: [
352
-        { path: false, name: "货单" },
352
+        { path: false, name: "退货单" },
353
         { path: "/good/return/add", name: "新增退货单" },
353
         { path: "/good/return/add", name: "新增退货单" },
354
       ],
354
       ],
355
       showTwo: true,
355
       showTwo: true,
845
        id:this.id,
845
        id:this.id,
846
      }
846
      }
847
      checkReturnOrder(params).then(response=>{
847
      checkReturnOrder(params).then(response=>{
848
-
848
+       if(response.data.state == 1){
849
+        var msg = response.data.data.msg
850
+        this.$message.success("保存成功!")
851
+       }
849
      })
852
      })
850
     }
853
     }
851
   },
854
   },