|
@@ -18,6 +18,7 @@
|
18
|
18
|
v-model="supplier_name"
|
19
|
19
|
style="width: 140px; margin-right: 10px"
|
20
|
20
|
placeholder="请选择"
|
|
21
|
+ :disabled="disabled"
|
21
|
22
|
>
|
22
|
23
|
<el-option
|
23
|
24
|
v-for="item in supplyList"
|
|
@@ -29,6 +30,7 @@
|
29
|
30
|
</el-select>
|
30
|
31
|
<span>单据日期:</span>
|
31
|
32
|
<el-date-picker
|
|
33
|
+ :disabled="disabled"
|
32
|
34
|
size="small"
|
33
|
35
|
v-model="start_time"
|
34
|
36
|
prefix-icon="el-icon-date"
|
|
@@ -73,7 +75,7 @@
|
73
|
75
|
>
|
74
|
76
|
<el-button size="small" type="primary" @click="checkGoodOrder" v-if="is_check == 2" >审核</el-button>
|
75
|
77
|
<el-button size="small" type="primary" @click="MofyGoodOrder" v-if="is_check == 1">反审核</el-button>
|
76
|
|
- <el-button size="small" type="primary" @click="" v-if="is_check == 1" >生成采购退货单</el-button>
|
|
78
|
+ <el-button size="small" type="primary" @click="toClick" v-if="is_check == 1" >生成采购退货单</el-button>
|
77
|
79
|
</div>
|
78
|
80
|
</div>
|
79
|
81
|
|
|
@@ -402,6 +404,7 @@
|
402
|
404
|
v-model="rate_of_concession"
|
403
|
405
|
@input="addressChange"
|
404
|
406
|
placeholder="请输入优惠率"
|
|
407
|
+ :disabled="disabled"
|
405
|
408
|
></el-input
|
406
|
409
|
>%</span
|
407
|
410
|
>
|
|
@@ -412,6 +415,7 @@
|
412
|
415
|
v-model="discount_amount"
|
413
|
416
|
@input="count_discount"
|
414
|
417
|
placeholder="请输入优惠金额"
|
|
418
|
+ :disabled="disabled"
|
415
|
419
|
></el-input
|
416
|
420
|
></span>
|
417
|
421
|
|
|
@@ -421,6 +425,7 @@
|
421
|
425
|
v-model="payment"
|
422
|
426
|
@input="count_payment"
|
423
|
427
|
placeholder="请输入本次付款"
|
|
428
|
+ :disabled="disabled"
|
424
|
429
|
></el-input
|
425
|
430
|
></span>
|
426
|
431
|
|
|
@@ -464,7 +469,8 @@ import {
|
464
|
469
|
checkGoodOrderById,
|
465
|
470
|
getGoodOrderCountList,
|
466
|
471
|
ModefySupplyWarehousing,
|
467
|
|
- MofyGoodOrder
|
|
472
|
+ MofyGoodOrder,
|
|
473
|
+ getSupplyWarehouseOutById
|
468
|
474
|
} from "@/api/supply";
|
469
|
475
|
export default {
|
470
|
476
|
name: "addPurchaseOrder",
|
|
@@ -533,7 +539,7 @@ export default {
|
533
|
539
|
goodList: [],
|
534
|
540
|
id: 0,
|
535
|
541
|
disabled: false,
|
536
|
|
- is_check: 2,
|
|
542
|
+ is_check: 0,
|
537
|
543
|
dialogVisible: false,
|
538
|
544
|
arrearage: "",
|
539
|
545
|
payment: "",
|
|
@@ -986,8 +992,9 @@ export default {
|
986
|
992
|
this.showTwo = true;
|
987
|
993
|
var orderInfo = response.data.data.list;
|
988
|
994
|
var warehouseOut = response.data.data.warehouseOut;
|
989
|
|
- console.log("采购单323322323",warehouseOut)
|
|
995
|
+ this.is_check = 2
|
990
|
996
|
this.warese_out_id = warehouseOut.id;
|
|
997
|
+ console.log("采购单id2322332",this.warese_out_id)
|
991
|
998
|
this.good_number = warehouseOut.good_number;
|
992
|
999
|
this.rate_of_concession = warehouseOut.rate_of_concession;
|
993
|
1000
|
this.discount_amount = warehouseOut.discount_amount;
|
|
@@ -1117,7 +1124,7 @@ export default {
|
1117
|
1124
|
getGoodOrderCountList(id, warehousing_id).then((response) => {
|
1118
|
1125
|
if (response.data.state == 1) {
|
1119
|
1126
|
this.$message.success("审核成功!");
|
1120
|
|
-
|
|
1127
|
+ this.disabled = true
|
1121
|
1128
|
this.is_check = 1
|
1122
|
1129
|
this.showOne = false;
|
1123
|
1130
|
this.showTwo = true;
|
|
@@ -1256,7 +1263,7 @@ export default {
|
1256
|
1263
|
var ids = "";
|
1257
|
1264
|
// 如果采购单没有数据,则代表改订单第一次生成采购订单数据
|
1258
|
1265
|
if (goodOrder.length == 0) {
|
1259
|
|
- this.$router.push({path: "/good/order/add?id=" + id + "&ids=" + ids});
|
|
1266
|
+ this.$router.push({path: "/good/order/add?id=" + this.id + "&ids=" + ids});
|
1260
|
1267
|
}
|
1261
|
1268
|
for (let i = 0; i < purcaseOrder.length; i++) {
|
1262
|
1269
|
for (let j = 0; j < drugList.length; j++) {
|
|
@@ -1345,6 +1352,118 @@ export default {
|
1345
|
1352
|
}
|
1346
|
1353
|
});
|
1347
|
1354
|
},
|
|
1355
|
+ toClick() {
|
|
1356
|
+ //先判断采购单号有没有关联的采购退货单号,如果没有,则为首次生成采购退货单
|
|
1357
|
+ if (this.is_check == 2) {
|
|
1358
|
+ this.$message.error("该采购单未审核,不能生成退货单数据!");
|
|
1359
|
+ return false;
|
|
1360
|
+ }
|
|
1361
|
+ var id = this.warese_out_id;
|
|
1362
|
+ console.log("生成采购单ID22323",id)
|
|
1363
|
+ getSupplyWarehouseOutById(id).then((response) => {
|
|
1364
|
+ if (response.data.state == 1) {
|
|
1365
|
+ var cancelList = response.data.data.cancelList;
|
|
1366
|
+ console.log("退库单", cancelList);
|
|
1367
|
+ var drugList = response.data.data.drugList;
|
|
1368
|
+ console.log("药品列表", drugList);
|
|
1369
|
+ var cancelOrderList = response.data.data.cancelOrderList;
|
|
1370
|
+ console.log("退库单详情", cancelOrderList);
|
|
1371
|
+ var ids =""
|
|
1372
|
+ if(cancelList.length == 0){
|
|
1373
|
+ this.$router.push({ path: "/good/return/add?id=" +id+"&ids="+ids });
|
|
1374
|
+ }
|
|
1375
|
+ if (cancelList.length > 0) {
|
|
1376
|
+ var outList = response.data.data.outList;
|
|
1377
|
+ console.log("购货单2322323",outList)
|
|
1378
|
+ for(let i=0;i<outList.length;i++){
|
|
1379
|
+ if(outList[i].is_source == 1){
|
|
1380
|
+ for(let j=0;j<drugList.length;j++){
|
|
1381
|
+ if(outList[i].project_id == drugList[j].id){
|
|
1382
|
+ if(outList[i].supply_unit == drugList[j].max_unit){
|
|
1383
|
+ outList[i].count = outList[i].count * drugList[j].min_number
|
|
1384
|
+ }
|
|
1385
|
+
|
|
1386
|
+ }
|
|
1387
|
+ }
|
|
1388
|
+ }
|
|
1389
|
+ }
|
|
1390
|
+
|
|
1391
|
+ for(let i=0;i<cancelOrderList.length;i++){
|
|
1392
|
+ if(cancelOrderList[i].is_source == 1){
|
|
1393
|
+ for(let j=0;j<drugList.length;j++){
|
|
1394
|
+ if(cancelOrderList[i].project_id == drugList[j].id){
|
|
1395
|
+ if(cancelOrderList[i].supply_unit == drugList[j].max_unit){
|
|
1396
|
+ cancelOrderList[i].count = cancelOrderList[i].count * drugList[j].min_number
|
|
1397
|
+ }
|
|
1398
|
+ }
|
|
1399
|
+ }
|
|
1400
|
+ }
|
|
1401
|
+ }
|
|
1402
|
+
|
|
1403
|
+
|
|
1404
|
+
|
|
1405
|
+ let objInfo = {};
|
|
1406
|
+ if(cancelOrderList.length >0){
|
|
1407
|
+ cancelOrderList.forEach((item, index) => {
|
|
1408
|
+ let { project_id } = item;
|
|
1409
|
+ if (!objInfo[project_id]) {
|
|
1410
|
+ objInfo[project_id] = {
|
|
1411
|
+ project_id,
|
|
1412
|
+ child: [],
|
|
1413
|
+ count: 0,
|
|
1414
|
+ };
|
|
1415
|
+ }
|
|
1416
|
+ });
|
|
1417
|
+ let newArr = Object.values(objInfo)
|
|
1418
|
+
|
|
1419
|
+ for (let i = 0; i < cancelOrderList.length; i++) {
|
|
1420
|
+ for (let j = 0; j < newArr.length; j++) {
|
|
1421
|
+ if (cancelOrderList[i].project_id == newArr[j].project_id) {
|
|
1422
|
+ newArr[j].child.push(cancelOrderList[i])
|
|
1423
|
+ }
|
|
1424
|
+ }
|
|
1425
|
+
|
|
1426
|
+ }
|
|
1427
|
+
|
|
1428
|
+ for (let i = 0; i < newArr.length; i++) {
|
|
1429
|
+ for (let j = 0; j < newArr[i].child.length; j++) {
|
|
1430
|
+ newArr[i].count += newArr[i].child[j].count;
|
|
1431
|
+ }
|
|
1432
|
+ }
|
|
1433
|
+
|
|
1434
|
+ var arr = []
|
|
1435
|
+ var total = 0;
|
|
1436
|
+ var str = "";
|
|
1437
|
+ //如果采购单有数据,则需要比较数量
|
|
1438
|
+ if (newArr.length > 0) {
|
|
1439
|
+ for (let i = 0; i < outList.length; i++) {
|
|
1440
|
+ for (let j = 0; j < newArr.length; j++) {
|
|
1441
|
+ if (outList[i].project_id == newArr[j].project_id) {
|
|
1442
|
+ //根据商品ID比较数量大小,把数量不足的商品ID储存,表示退货单的数量未满足采购单的数据,可以继续生成退货单
|
|
1443
|
+ if (outList[i].count > newArr[j].count) {
|
|
1444
|
+ arr.push(outList[i].project_id);
|
|
1445
|
+ }
|
|
1446
|
+ }
|
|
1447
|
+ }
|
|
1448
|
+ }
|
|
1449
|
+ //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成
|
|
1450
|
+
|
|
1451
|
+ if (arr.length == 0) {
|
|
1452
|
+ this.$message.error("该订单已全部生成退库单,请知悉!");
|
|
1453
|
+ return
|
|
1454
|
+ }
|
|
1455
|
+ console.log("arr23323232232323",arr)
|
|
1456
|
+ if (arr.length > 0) {
|
|
1457
|
+ str = arr.join(",");
|
|
1458
|
+ this.$router.push({ path: "/good/return/edit?id=" + id + "&ids=" + str});
|
|
1459
|
+ }
|
|
1460
|
+ }
|
|
1461
|
+
|
|
1462
|
+ }
|
|
1463
|
+ }
|
|
1464
|
+ }
|
|
1465
|
+ });
|
|
1466
|
+ },
|
1348
|
1467
|
},
|
1349
|
1468
|
created() {
|
1350
|
1469
|
const tempObj = {};
|