XMLWAN 3 лет назад
Родитель
Сommit
9752cb7b97
3 измененных файлов: 82 добавлений и 7 удалений
  1. 77 2
      controllers/supply_order_api_contorller.go
  2. 1 1
      service/supply_service.go
  3. 4 4
      service/warhouse_service.go

+ 77 - 2
controllers/supply_order_api_contorller.go Просмотреть файл

@@ -103,6 +103,9 @@ func SupplyOrderApiRegistRouters() {
103 103
 	beego.Router("/api/supply/deletereturnorderbyid", &SupplyOrderApiController{}, "Get:DeleteReturnOrderById")
104 104
 	//反审核退货单
105 105
 	beego.Router("/api/supply/modefyreturnorder", &SupplyOrderApiController{}, "Get:ModefyReturnOrder")
106
+
107
+	//获取采购数据
108
+	beego.Router("/api/supply/getgoodorderdetaillist", &SupplyOrderApiController{}, "Get:GetGoodOrderDetailList")
106 109
 }
107 110
 
108 111
 //判断前端参数是否为空
@@ -3083,7 +3086,7 @@ func (this *SupplyOrderApiController) ModefyGoodOrder() {
3083 3086
 	for _, it := range goodOrder {
3084 3087
 
3085 3088
 		if it.IsSource == 1 {
3086
-			out, _ := service.GetDrugWarehosueInfoByWarehousingId(it.ProjectId, it.WarehousingId, orgId)
3089
+			out, _ := service.GetDrugWarehosueInfoByWarehousingId(it.ProjectId, id, orgId)
3087 3090
 
3088 3091
 			if out.ID > 0 {
3089 3092
 				this.ServeSuccessJSON(map[string]interface{}{
@@ -3097,7 +3100,8 @@ func (this *SupplyOrderApiController) ModefyGoodOrder() {
3097 3100
 			}
3098 3101
 		}
3099 3102
 		if it.IsSource == 2 {
3100
-			out, _ := service.GetGoodWarehouseInfoByWarehousingId(it.ProjectId, it.WarehousingId, orgId)
3103
+			fmt.Println("hh23323233232232332232323232332", it.WarehouseOutId)
3104
+			out, _ := service.GetGoodWarehouseInfoByWarehousingId(it.ProjectId, id, orgId)
3101 3105
 			if out.ID > 0 {
3102 3106
 				this.ServeSuccessJSON(map[string]interface{}{
3103 3107
 					"cancelList":   "",
@@ -3657,3 +3661,74 @@ func (this *SupplyOrderApiController) ModefyReturnOrder() {
3657 3661
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3658 3662
 	}
3659 3663
 }
3664
+
3665
+func (this *SupplyOrderApiController) GetGoodOrderDetailList() {
3666
+	id, _ := this.GetInt64("id")
3667
+	ids := this.GetString("ids")
3668
+	orgId := this.GetAdminUserInfo().CurrentOrgId
3669
+
3670
+	if len(ids) == 0 {
3671
+		out, err := service.GetGoodOrderDetail(id, orgId)
3672
+		list, _ := service.GetSupplyWarehouseOutById(id, orgId)
3673
+		for _, item := range list {
3674
+
3675
+			if item.IsSource == 1 {
3676
+				waresingList, _ := service.GetAllDrugWaresingList(item.ProjectId, orgId)
3677
+				medical, _ := service.GetBaseDrugMedical(item.ProjectId)
3678
+				item.DrugWarehouseInfo = waresingList
3679
+				item.SpBaseDrug = medical
3680
+			}
3681
+			if item.IsSource == 2 {
3682
+				waresingList, _ := service.GetAllGoodWaresingList(item.ProjectId, orgId)
3683
+
3684
+				item.GoodWarehouseInfo = waresingList
3685
+			}
3686
+		}
3687
+		drugList, _ := service.GetSupplyDrugList(orgId)
3688
+		goodList, _ := service.GetSupplyGoodList(orgId)
3689
+		supplyList, _ := service.GetSupplierList(orgId)
3690
+		if err == nil {
3691
+			this.ServeSuccessJSON(map[string]interface{}{
3692
+				"out":        out,
3693
+				"list":       list,
3694
+				"goodList":   goodList,
3695
+				"drugList":   drugList,
3696
+				"supplyList": supplyList,
3697
+			})
3698
+		} else {
3699
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3700
+		}
3701
+	}
3702
+	if len(ids) > 0 {
3703
+		idArray := strings.Split(ids, ",")
3704
+		out, err := service.GetGoodOrderDetail(id, orgId)
3705
+		list, _ := service.GetSupplyWarehouseOutByIdOne(id, orgId, idArray)
3706
+		for _, item := range list {
3707
+			if item.IsSource == 1 {
3708
+				waresingList, _ := service.GetAllDrugWaresingList(item.ProjectId, orgId)
3709
+				medical, _ := service.GetBaseDrugMedical(item.ProjectId)
3710
+				item.DrugWarehouseInfo = waresingList
3711
+				item.SpBaseDrug = medical
3712
+			}
3713
+			if item.IsSource == 2 {
3714
+				waresingList, _ := service.GetAllGoodWaresingList(item.ProjectId, orgId)
3715
+
3716
+				item.GoodWarehouseInfo = waresingList
3717
+			}
3718
+		}
3719
+		drugList, _ := service.GetSupplyDrugList(orgId)
3720
+		goodList, _ := service.GetSupplyGoodList(orgId)
3721
+		supplyList, _ := service.GetSupplierList(orgId)
3722
+		if err == nil {
3723
+			this.ServeSuccessJSON(map[string]interface{}{
3724
+				"out":        out,
3725
+				"list":       list,
3726
+				"goodList":   goodList,
3727
+				"drugList":   drugList,
3728
+				"supplyList": supplyList,
3729
+			})
3730
+		} else {
3731
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3732
+		}
3733
+	}
3734
+}

+ 1 - 1
service/supply_service.go Просмотреть файл

@@ -554,7 +554,7 @@ func GetAllGoodOrderById(id int64, orgid int64) (order []*models.VSpSupplierWare
554 554
 	if orgid > 0 {
555 555
 		db = db.Where("o.user_org_id =? and o.is_warehouse= 1", orgid)
556 556
 	}
557
-	err = db.Select("o.id,o.order_number,o.project_id,o.count as count,o.supply_unit,o.is_source,o.warehousing_id").Find(&order).Error
557
+	err = db.Select("o.id,o.order_number,o.project_id,o.count as count,o.supply_unit,o.is_source,o.warehousing_id,o.warehouse_out_id").Find(&order).Error
558 558
 	return order, err
559 559
 }
560 560
 

+ 4 - 4
service/warhouse_service.go Просмотреть файл

@@ -3008,7 +3008,7 @@ func AutoDrugDeliverInfoNight(orgID int64, prescribingNumber int64, warehouseout
3008 3008
 
3009 3009
 		warehouseOutInfo := &models.DrugWarehouseOutInfo{
3010 3010
 			WarehouseOutOrderNumber: warehouseout.WarehouseOutOrderNumber,
3011
-			WarehouseOutId:          warehouseout.ID,
3011
+			WarehouseOutId:          advice.WarehouseOutId,
3012 3012
 			Status:                  1,
3013 3013
 			Ctime:                   time.Now().Unix(),
3014 3014
 			Remark:                  advice.Remark,
@@ -3043,7 +3043,7 @@ func AutoDrugDeliverInfoNight(orgID int64, prescribingNumber int64, warehouseout
3043 3043
 
3044 3044
 		drugWareInfo, _ := GetLastWarehouseOutInfoById(advice.DrugId)
3045 3045
 		drugflow := models.DrugFlow{
3046
-			WarehouseOutId:          warehouseout.ID,
3046
+			WarehouseOutId:          advice.WarehouseOutId,
3047 3047
 			WarehouseOutOrderNumber: warehouseout.WarehouseOutOrderNumber,
3048 3048
 			DrugId:                  advice.DrugId,
3049 3049
 			Number:                  warehouse.Number,
@@ -3110,7 +3110,7 @@ func AutoDrugDeliverInfoNight(orgID int64, prescribingNumber int64, warehouseout
3110 3110
 		// 当该批次的库存数量小于出库数量的话,则先把该批次出库完后,再进行递归出库
3111 3111
 		warehouseOutInfo := &models.DrugWarehouseOutInfo{
3112 3112
 			WarehouseOutOrderNumber: warehouseout.WarehouseOutOrderNumber,
3113
-			WarehouseOutId:          warehouseout.ID,
3113
+			WarehouseOutId:          advice.WarehouseOutId,
3114 3114
 			Status:                  1,
3115 3115
 			Ctime:                   time.Now().Unix(),
3116 3116
 			Remark:                  advice.Remark,
@@ -3144,7 +3144,7 @@ func AutoDrugDeliverInfoNight(orgID int64, prescribingNumber int64, warehouseout
3144 3144
 		}
3145 3145
 		drugWareInfo, _ := GetLastWarehouseOutInfoById(advice.DrugId)
3146 3146
 		drugflow := models.DrugFlow{
3147
-			WarehouseOutId:          warehouseout.ID,
3147
+			WarehouseOutId:          advice.WarehouseOutId,
3148 3148
 			WarehouseOutOrderNumber: warehouseout.WarehouseOutOrderNumber,
3149 3149
 			DrugId:                  advice.DrugId,
3150 3150
 			Number:                  warehouse.Number,