XMLWAN преди 3 години
родител
ревизия
a1f5ddbf0a

+ 1 - 0
controllers/new_mobile_api_controllers/new_manage_api_controller.go Целия файл

106
 	endtime := this.GetString("end_time")
106
 	endtime := this.GetString("end_time")
107
 	enddate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", endtime)
107
 	enddate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", endtime)
108
 	enddateunix := enddate.Unix()
108
 	enddateunix := enddate.Unix()
109
+
109
 	scheduledate, _ := this.GetInt64("schedule_date")
110
 	scheduledate, _ := this.GetInt64("schedule_date")
110
 	zoneid, _ := this.GetInt64("zone_id")
111
 	zoneid, _ := this.GetInt64("zone_id")
111
 	patientid, _ := this.GetInt64("patient_id")
112
 	patientid, _ := this.GetInt64("patient_id")

+ 5 - 15
controllers/stock_in_api_controller.go Целия файл

342
 	info, _ := service.FindLastWarehousingInfo(warehousing.WarehousingOrder)
342
 	info, _ := service.FindLastWarehousingInfo(warehousing.WarehousingOrder)
343
 
343
 
344
 	for _, item := range warehousingInfo {
344
 	for _, item := range warehousingInfo {
345
+
345
 		goodInfo, _ := service.GetGoodInformationByGoodId(item.GoodId)
346
 		goodInfo, _ := service.GetGoodInformationByGoodId(item.GoodId)
346
 		str := strconv.FormatInt(item.WarehousingCount, 10)
347
 		str := strconv.FormatInt(item.WarehousingCount, 10)
347
 		minFloat, _ := strconv.ParseFloat(str, 64)
348
 		minFloat, _ := strconv.ParseFloat(str, 64)
350
 			Total: minFloat + goodInfo.Total,
351
 			Total: minFloat + goodInfo.Total,
351
 		}
352
 		}
352
 		//更该库存
353
 		//更该库存
353
-		parseDateErr := service.UpdateGoodInfoList(good, goodInfo.ID)
354
-		break
355
-		fmt.Println(parseDateErr)
354
+		service.UpdateGoodInfoList(good, item.GoodId)
355
+
356
+		service.ModifyGoodAddInformation(item.GoodId, item.WarehousingCount, item.OrgId)
356
 	}
357
 	}
357
 
358
 
358
 	c.ServeSuccessJSON(map[string]interface{}{
359
 	c.ServeSuccessJSON(map[string]interface{}{
701
 				Total: good.Total + total,
702
 				Total: good.Total + total,
702
 			}
703
 			}
703
 			errcodescode = service.UpdateGoodInfoMation(info.GoodId, goodInfo)
704
 			errcodescode = service.UpdateGoodInfoMation(info.GoodId, goodInfo)
705
+			service.ModifyGoodReduceInformation(info.GoodId, info.WarehousingCount, info.OrgId)
704
 			fmt.Println(errcodescode)
706
 			fmt.Println(errcodescode)
705
 		}
707
 		}
706
 	}
708
 	}
732
 
734
 
733
 				service.UpdateWarehouseInfoByGoodIdOne(goodinfo, item.ID)
735
 				service.UpdateWarehouseInfoByGoodIdOne(goodinfo, item.ID)
734
 
736
 
735
-				//flowStock := models.VmStockFlow{
736
-				//	Count:         item.WarehousingCount,
737
-				//	Number:        item.Number,
738
-				//	ProductDate:   item.ProductDate,
739
-				//	ExpireDate:    item.ExpiryDate,
740
-				//	Price:         item.Price,
741
-				//	Manufacturer:  item.Manufacturer,
742
-				//	Dealer:        item.Dealer,
743
-				//	LicenseNumber: info.LicenseNumber,
744
-				//}
745
-				//fmt.Println("大于233232322323233232232323233232233223")
746
-				//service.UpdatedStockFlowByGoodIdOne(item.WarehousingId, item.GoodId, flowStock)
747
 				//改变库存
737
 				//改变库存
748
 				good, _ := service.GetLastInfoMationById(info.GoodId)
738
 				good, _ := service.GetLastInfoMationById(info.GoodId)
749
 				warhouseCount := strconv.FormatInt(total, 10)
739
 				warhouseCount := strconv.FormatInt(total, 10)

+ 6 - 3
controllers/supply_order_api_contorller.go Целия файл

3075
 				service.CreateCancelReturnOrder(item)
3075
 				service.CreateCancelReturnOrder(item)
3076
 			}
3076
 			}
3077
 		}
3077
 		}
3078
+		list, err := service.GetReturnCancelOrderList(warehouse_out_id, orgId)
3078
 		if err == nil {
3079
 		if err == nil {
3079
-			returnData := make(map[string]interface{}, 0)
3080
-			returnData["msg"] = "ok"
3081
-			this.ServeSuccessJSON(returnData)
3080
+			this.ServeSuccessJSON(map[string]interface{}{
3081
+				"list": list,
3082
+				"msg":  "msg",
3083
+			})
3082
 			return
3084
 			return
3085
+
3083
 		} else {
3086
 		} else {
3084
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3087
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3085
 		}
3088
 		}

+ 2 - 0
models/good_models.go Целия файл

86
 	IsUser                      int64                `gorm:"column:is_user" json:"is_user" form:"is_user"`
86
 	IsUser                      int64                `gorm:"column:is_user" json:"is_user" form:"is_user"`
87
 	Number                      string               `gorm:"column:number" json:"number" form:"number"`
87
 	Number                      string               `gorm:"column:number" json:"number" form:"number"`
88
 	IsWarehouse                 int64                `gorm:"column:is_warehouse" json:"is_warehouse" form:"is_warehouse"`
88
 	IsWarehouse                 int64                `gorm:"column:is_warehouse" json:"is_warehouse" form:"is_warehouse"`
89
+	SumCount                    int64                `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
90
+	BatchRetaiPrice             float64              `gorm:"column:batch_retai_price" json:"batch_retai_price" form:"batch_retai_price"`
89
 }
91
 }
90
 
92
 
91
 func (GoodInfo) TableName() string {
93
 func (GoodInfo) TableName() string {

+ 17 - 0
service/stock_service.go Целия файл

5795
 	err = XTReadDB().Where("drug_id = ? and patient_id = ? and sys_record_time = ? and org_id = ? and status = 1", drugid, patient_id, advicedate, orgid).Find(&info).Error
5795
 	err = XTReadDB().Where("drug_id = ? and patient_id = ? and sys_record_time = ? and org_id = ? and status = 1", drugid, patient_id, advicedate, orgid).Find(&info).Error
5796
 	return info, err
5796
 	return info, err
5797
 }
5797
 }
5798
+
5799
+//耗材加库存
5800
+func ModifyGoodAddInformation(good_id int64, sum_count int64, orgid int64) (models.GoodInfo, error) {
5801
+
5802
+	info := models.GoodInfo{}
5803
+
5804
+	err = XTWriteDB().Model(&info).Where("id = ? and org_id = ? and status = 1", good_id, orgid).UpdateColumn("sum_count", gorm.Expr("sum_count + ?", sum_count)).Error
5805
+	return info, err
5806
+}
5807
+
5808
+func ModifyGoodReduceInformation(good_id int64, sum_count int64, orgid int64) (models.GoodInfo, error) {
5809
+
5810
+	info := models.GoodInfo{}
5811
+
5812
+	err = XTWriteDB().Model(&info).Where("id = ? and org_id = ? and status = 1", good_id, orgid).UpdateColumn("sum_count", gorm.Expr("sum_count - ?", sum_count)).Error
5813
+	return info, err
5814
+}