Ver código fonte

11月8日库存管理

XMLWAN 3 anos atrás
pai
commit
a1f5ddbf0a

+ 1 - 0
controllers/new_mobile_api_controllers/new_manage_api_controller.go Ver arquivo

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

+ 5 - 15
controllers/stock_in_api_controller.go Ver arquivo

@@ -342,6 +342,7 @@ func (c *StockManagerApiController) CreateWarehouse() {
342 342
 	info, _ := service.FindLastWarehousingInfo(warehousing.WarehousingOrder)
343 343
 
344 344
 	for _, item := range warehousingInfo {
345
+
345 346
 		goodInfo, _ := service.GetGoodInformationByGoodId(item.GoodId)
346 347
 		str := strconv.FormatInt(item.WarehousingCount, 10)
347 348
 		minFloat, _ := strconv.ParseFloat(str, 64)
@@ -350,9 +351,9 @@ func (c *StockManagerApiController) CreateWarehouse() {
350 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 359
 	c.ServeSuccessJSON(map[string]interface{}{
@@ -701,6 +702,7 @@ func (c *StockManagerApiController) EditWarehouse() {
701 702
 				Total: good.Total + total,
702 703
 			}
703 704
 			errcodescode = service.UpdateGoodInfoMation(info.GoodId, goodInfo)
705
+			service.ModifyGoodReduceInformation(info.GoodId, info.WarehousingCount, info.OrgId)
704 706
 			fmt.Println(errcodescode)
705 707
 		}
706 708
 	}
@@ -732,18 +734,6 @@ func (c *StockManagerApiController) EditWarehouse() {
732 734
 
733 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 738
 				good, _ := service.GetLastInfoMationById(info.GoodId)
749 739
 				warhouseCount := strconv.FormatInt(total, 10)

+ 6 - 3
controllers/supply_order_api_contorller.go Ver arquivo

@@ -3075,11 +3075,14 @@ func (this *SupplyOrderApiController) UpdateGoodReturn() {
3075 3075
 				service.CreateCancelReturnOrder(item)
3076 3076
 			}
3077 3077
 		}
3078
+		list, err := service.GetReturnCancelOrderList(warehouse_out_id, orgId)
3078 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 3084
 			return
3085
+
3083 3086
 		} else {
3084 3087
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
3085 3088
 		}

+ 2 - 0
models/good_models.go Ver arquivo

@@ -86,6 +86,8 @@ type GoodInfo struct {
86 86
 	IsUser                      int64                `gorm:"column:is_user" json:"is_user" form:"is_user"`
87 87
 	Number                      string               `gorm:"column:number" json:"number" form:"number"`
88 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 93
 func (GoodInfo) TableName() string {

+ 17 - 0
service/stock_service.go Ver arquivo

@@ -5795,3 +5795,20 @@ func GetAllDrugFlowById(drugid int64, patient_id int64, advicedate int64, orgid
5795 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 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
+}