|
@@ -52,6 +52,8 @@ func SupplyOrderApiRegistRouters() {
|
52
|
52
|
beego.Router("/api/supply/getgoodorderlist", &SupplyOrderApiController{}, "Get:GetGoodOrderList")
|
53
|
53
|
//反审核购货订单
|
54
|
54
|
beego.Router("/api/supply/getreturnorder", &SupplyOrderApiController{}, "Get:GetReturnOrder")
|
|
55
|
+ //判断是否全部入库
|
|
56
|
+ beego.Router("/api/supply/getgoodordercountlist", &SupplyOrderApiController{}, "Get:GetGoodOrderCountList")
|
55
|
57
|
}
|
56
|
58
|
|
57
|
59
|
func (this *SupplyOrderApiController) GetInitOrder() {
|
|
@@ -1446,3 +1448,99 @@ func (this *SupplyOrderApiController) GetReturnOrder() {
|
1446
|
1448
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
1447
|
1449
|
}
|
1448
|
1450
|
}
|
|
1451
|
+
|
|
1452
|
+func (this *SupplyOrderApiController) GetGoodOrderCountList() {
|
|
1453
|
+ id, _ := this.GetInt64("id")
|
|
1454
|
+ warehousing_id, _ := this.GetInt64("warehousing_id")
|
|
1455
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
1456
|
+ checker := this.GetAdminUserInfo().AdminUser.Id
|
|
1457
|
+ recordDateStr := time.Now().Format("2006-01-02")
|
|
1458
|
+ recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
|
|
1459
|
+ record_date := recordDate.Unix()
|
|
1460
|
+ out := models.SpSupplierWarehouseOut{
|
|
1461
|
+ IsCheck: 1,
|
|
1462
|
+ Checker: checker,
|
|
1463
|
+ CheckTime: record_date,
|
|
1464
|
+ }
|
|
1465
|
+ err := service.CheckGoodOrder(id, orgId, out)
|
|
1466
|
+ //获取购货订单的数据
|
|
1467
|
+ purcaseOrder, _ := service.GetAllPurcaseOrderById(warehousing_id, orgId)
|
|
1468
|
+ //获取购货单的数据
|
|
1469
|
+ goodOrder, _ := service.GetAllGoodOrderByIdTwo(warehousing_id, orgId)
|
|
1470
|
+
|
|
1471
|
+ //查询该购货单是否审核成功
|
|
1472
|
+ detail, _ := service.GetGoodOrderDetail(id, orgId)
|
|
1473
|
+ var warehousingInfo []*models.WarehousingInfo
|
|
1474
|
+ //如果审核成功
|
|
1475
|
+ if detail.IsCheck == 1 {
|
|
1476
|
+ //入库
|
|
1477
|
+ if len(goodOrder) > 0 {
|
|
1478
|
+ for _, item := range goodOrder {
|
|
1479
|
+ //药品
|
|
1480
|
+ if item.IsSource == 1 {
|
|
1481
|
+
|
|
1482
|
+ }
|
|
1483
|
+ //耗材
|
|
1484
|
+ if item.IsSource == 2 {
|
|
1485
|
+ //获取耗材类型
|
|
1486
|
+ good, _ := service.GetGoodInformationByGoodId(item.ProjectId)
|
|
1487
|
+ timeStr := time.Now().Format("2006-01-02")
|
|
1488
|
+ timeArr := strings.Split(timeStr, "-")
|
|
1489
|
+ total, _ := service.FindAllWarehouseTotal(orgId)
|
|
1490
|
+ total = total + 1
|
|
1491
|
+ warehousing_order := "RKD" + strconv.FormatInt(orgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
|
|
1492
|
+ operation_time := time.Now().Unix()
|
|
1493
|
+ creater := this.GetAdminUserInfo().AdminUser.Id
|
|
1494
|
+ warehousing := models.Warehousing{
|
|
1495
|
+ WarehousingOrder: warehousing_order,
|
|
1496
|
+ OperationTime: operation_time,
|
|
1497
|
+ OrgId: orgId,
|
|
1498
|
+ Creater: creater,
|
|
1499
|
+ Ctime: time.Now().Unix(),
|
|
1500
|
+ Status: 1,
|
|
1501
|
+ WarehousingTime: record_date,
|
|
1502
|
+ Type: 1,
|
|
1503
|
+ }
|
|
1504
|
+ service.AddSigleWarehouse(&warehousing)
|
|
1505
|
+
|
|
1506
|
+ //入库单表格
|
|
1507
|
+ warehouseInfo := &models.WarehousingInfo{
|
|
1508
|
+ WarehousingOrder: warehousing.WarehousingOrder,
|
|
1509
|
+ WarehousingId: warehousing.ID,
|
|
1510
|
+ GoodId: item.ProjectId,
|
|
1511
|
+ Number: item.SupplyBatchNumber,
|
|
1512
|
+ GoodTypeId: good.GoodTypeId,
|
|
1513
|
+ ProductDate: item.SupplyProductDate,
|
|
1514
|
+ ExpiryDate: item.SupplyExpiryDate,
|
|
1515
|
+ WarehousingCount: item.Count,
|
|
1516
|
+ Price: item.Price,
|
|
1517
|
+ TotalPrice: 0,
|
|
1518
|
+ Status: 1,
|
|
1519
|
+ Ctime: time.Now().Unix(),
|
|
1520
|
+ Remark: item.Remark,
|
|
1521
|
+ OrgId: orgId,
|
|
1522
|
+ Type: 1,
|
|
1523
|
+ Manufacturer: item.ManufacturerId,
|
|
1524
|
+ StockCount: item.Count,
|
|
1525
|
+ Dealer: good.Dealer,
|
|
1526
|
+ LicenseNumber: item.SupplyLicenseNumber,
|
|
1527
|
+ PackingPrice: good.PackingPrice,
|
|
1528
|
+ }
|
|
1529
|
+ warehousingInfo = append(warehousingInfo, warehouseInfo)
|
|
1530
|
+
|
|
1531
|
+ }
|
|
1532
|
+ }
|
|
1533
|
+ }
|
|
1534
|
+ }
|
|
1535
|
+
|
|
1536
|
+ drugList, _ := service.GetSupplyDrugList(orgId)
|
|
1537
|
+ if err == nil {
|
|
1538
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1539
|
+ "purcaseOrder": purcaseOrder,
|
|
1540
|
+ "goodOrder": goodOrder,
|
|
1541
|
+ "drugList": drugList,
|
|
1542
|
+ })
|
|
1543
|
+ } else {
|
|
1544
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
1545
|
+ }
|
|
1546
|
+}
|