|
@@ -447,7 +447,9 @@ import {
|
447
|
447
|
getPurchaseOrderInfo,
|
448
|
448
|
addGoodOrder,
|
449
|
449
|
updateGoodOrder,
|
450
|
|
- checkGoodOrderById
|
|
450
|
+ checkGoodOrderById,
|
|
451
|
+ getGoodOrderCountList,
|
|
452
|
+ ModefySupplyWarehousing
|
451
|
453
|
} from "@/api/supply";
|
452
|
454
|
export default {
|
453
|
455
|
name: "addPurchaseOrder",
|
|
@@ -526,6 +528,7 @@ export default {
|
526
|
528
|
showTwo: false,
|
527
|
529
|
warese_out_id: 0,
|
528
|
530
|
return_remark: "",
|
|
531
|
+ is_warehouse:0
|
529
|
532
|
};
|
530
|
533
|
},
|
531
|
534
|
methods: {
|
|
@@ -630,11 +633,7 @@ export default {
|
630
|
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
|
637
|
goodList[i].manufacturer;
|
639
|
638
|
goodList[i].supply_type = goodList[i].good_type_id;
|
640
|
639
|
goodList[i].supply_specification_name =
|
|
@@ -947,17 +946,7 @@ export default {
|
947
|
946
|
stockIn: this.recordInfo.tableList,
|
948
|
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
|
950
|
if (response.data.state == 1) {
|
962
|
951
|
this.loading = false;
|
963
|
952
|
this.$message.success("保存成功!");
|
|
@@ -973,6 +962,7 @@ export default {
|
973
|
962
|
this.arrearage = warehouseOut.arrearage;
|
974
|
963
|
this.supplier_name = warehouseOut.supplier_id;
|
975
|
964
|
this.return_remake = warehouseOut.return_remake;
|
|
965
|
+ this.warehousing_id = warehouseOut.warehousing_id
|
976
|
966
|
this.start_time = this.getTimes(warehouseOut.document_date);
|
977
|
967
|
for (let i = 0; i < orderInfo.length; i++) {
|
978
|
968
|
orderInfo[i].supply_count = orderInfo[i].count;
|
|
@@ -1038,7 +1028,6 @@ export default {
|
1038
|
1028
|
this.loading = false;
|
1039
|
1029
|
return false;
|
1040
|
1030
|
}
|
1041
|
|
- console.log("表哥2323233232", this.recordInfo.tableList);
|
1042
|
1031
|
for (let i = 0; i < this.recordInfo.tableList.length; i++) {
|
1043
|
1032
|
this.recordInfo.tableList[i].supply_count = parseInt(
|
1044
|
1033
|
this.recordInfo.tableList[i].supply_count
|
|
@@ -1076,8 +1065,7 @@ export default {
|
1076
|
1065
|
stockIn: this.recordInfo.tableList,
|
1077
|
1066
|
return_remake: this.return_remake,
|
1078
|
1067
|
};
|
1079
|
|
- console.log("sotckind23232232323232323232", params);
|
1080
|
|
-
|
|
1068
|
+
|
1081
|
1069
|
updateGoodOrder(
|
1082
|
1070
|
params,
|
1083
|
1071
|
this.supplier_name,
|
|
@@ -1098,14 +1086,121 @@ export default {
|
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
|
1205
|
created() {
|
1111
|
1206
|
const tempObj = {};
|