|
@@ -80,6 +80,9 @@ func StockManagerApiRegistRouters() {
|
80
|
80
|
beego.Router("/api/good/postsearchgoodlist", &StockManagerApiController{}, "Get:PostSearchGoodList")
|
81
|
81
|
|
82
|
82
|
beego.Router("/api/good/getallstocklist", &StockManagerApiController{}, "Get:GetAllStockList")
|
|
83
|
+
|
|
84
|
+ beego.Router("/api/stock/getstocklistbyid", &StockManagerApiController{}, "Get:GetStockListById")
|
|
85
|
+ beego.Router("/api/stock/getstockoutlist", &StockManagerApiController{}, "Get:GetStockOutList")
|
83
|
86
|
}
|
84
|
87
|
|
85
|
88
|
func (c *StockManagerApiController) CreateWarehouse() {
|
|
@@ -3652,3 +3655,79 @@ func (this *StockManagerApiController) GetAllStockList() {
|
3652
|
3655
|
"manufacturerList": manufacturerList,
|
3653
|
3656
|
})
|
3654
|
3657
|
}
|
|
3658
|
+
|
|
3659
|
+func (this *StockManagerApiController) GetStockListById() {
|
|
3660
|
+
|
|
3661
|
+ id, _ := this.GetInt64("id")
|
|
3662
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
3663
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
3664
|
+ limit, _ := this.GetInt64("limit")
|
|
3665
|
+ page, _ := this.GetInt64("page")
|
|
3666
|
+ timeLayout := "2006-01-02"
|
|
3667
|
+ loc, _ := time.LoadLocation("Local")
|
|
3668
|
+ start_time := this.GetString("start_time")
|
|
3669
|
+ end_time := this.GetString("end_time")
|
|
3670
|
+ var startTime int64
|
|
3671
|
+ if len(start_time) > 0 {
|
|
3672
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
3673
|
+ if err != nil {
|
|
3674
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
3675
|
+ return
|
|
3676
|
+ }
|
|
3677
|
+ startTime = theTime.Unix()
|
|
3678
|
+ }
|
|
3679
|
+ var endTime int64
|
|
3680
|
+ if len(end_time) > 0 {
|
|
3681
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
3682
|
+ if err != nil {
|
|
3683
|
+ utils.ErrorLog(err.Error())
|
|
3684
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
3685
|
+ return
|
|
3686
|
+ }
|
|
3687
|
+ endTime = theTime.Unix()
|
|
3688
|
+ }
|
|
3689
|
+ manufacturerList, _ := service.GetAllManufacturerList(orgId)
|
|
3690
|
+ list, total, _ := service.GetStockListById(id, orgId, limit, page, startTime, endTime)
|
|
3691
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
3692
|
+ "list": list,
|
|
3693
|
+ "total": total,
|
|
3694
|
+ "manufacturerList": manufacturerList,
|
|
3695
|
+ })
|
|
3696
|
+}
|
|
3697
|
+
|
|
3698
|
+func (this *StockManagerApiController) GetStockOutList() {
|
|
3699
|
+
|
|
3700
|
+ id, _ := this.GetInt64("id")
|
|
3701
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
3702
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
3703
|
+ limit, _ := this.GetInt64("limit")
|
|
3704
|
+ page, _ := this.GetInt64("page")
|
|
3705
|
+ timeLayout := "2006-01-02"
|
|
3706
|
+ loc, _ := time.LoadLocation("Local")
|
|
3707
|
+ start_time := this.GetString("start_time")
|
|
3708
|
+ end_time := this.GetString("end_time")
|
|
3709
|
+ var startTime int64
|
|
3710
|
+ if len(start_time) > 0 {
|
|
3711
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
3712
|
+ if err != nil {
|
|
3713
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
3714
|
+ return
|
|
3715
|
+ }
|
|
3716
|
+ startTime = theTime.Unix()
|
|
3717
|
+ }
|
|
3718
|
+ var endTime int64
|
|
3719
|
+ if len(end_time) > 0 {
|
|
3720
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
3721
|
+ if err != nil {
|
|
3722
|
+ utils.ErrorLog(err.Error())
|
|
3723
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
3724
|
+ return
|
|
3725
|
+ }
|
|
3726
|
+ endTime = theTime.Unix()
|
|
3727
|
+ }
|
|
3728
|
+ outList, total, _ := service.GetStockOutList(id, orgId, limit, page, startTime, endTime)
|
|
3729
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
3730
|
+ "outList": outList,
|
|
3731
|
+ "total": total,
|
|
3732
|
+ })
|
|
3733
|
+}
|