|
@@ -73,7 +73,6 @@ func (this *SecondaryOrderApiController) GetStoreCode() {
|
73
|
73
|
//修改仓库状态
|
74
|
74
|
func (this *SecondaryOrderApiController) UpdateStatus() {
|
75
|
75
|
orgId := this.GetAdminUserInfo().CurrentOrgId
|
76
|
|
- //orgId = 9675
|
77
|
76
|
check := map[string][]string{
|
78
|
77
|
"id": {"must", "int", "id"},
|
79
|
78
|
}
|
|
@@ -350,6 +349,7 @@ func (this *SecondaryOrderApiController) AddStorehouse() {
|
350
|
349
|
|
351
|
350
|
//修改仓库
|
352
|
351
|
func (this *SecondaryOrderApiController) UpdateStorehouse() {
|
|
352
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
353
|
353
|
dataBody := make(map[string]interface{}, 0)
|
354
|
354
|
//orgId := this.GetAdminUserInfo().CurrentOrgId
|
355
|
355
|
err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
|
@@ -387,7 +387,26 @@ func (this *SecondaryOrderApiController) UpdateStorehouse() {
|
387
|
387
|
id := int64(dataBody["id"].(float64))
|
388
|
388
|
name := dataBody["storehouse_name"].(string) //仓库名称
|
389
|
389
|
address := dataBody["storehouse_address"].(string) //地址
|
390
|
|
-
|
|
390
|
+ //查询当前仓库状态,根据当前状态判断是否需要更改
|
|
391
|
+ list, errs := service.GetOneStorehouse(id, orgId)
|
|
392
|
+ if errs != nil {
|
|
393
|
+ this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
|
|
394
|
+ return
|
|
395
|
+ }
|
|
396
|
+ if storehouse_status != list.StorehouseStatus && storehouse_status == 0 {
|
|
397
|
+ //判断该仓库的库存是否为零
|
|
398
|
+ boolean := service.IsStorehouseNil(id, orgId)
|
|
399
|
+ if boolean == false {
|
|
400
|
+ this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "该仓库库存不为0,不支持该操作")
|
|
401
|
+ return
|
|
402
|
+ }
|
|
403
|
+ //判断该仓库是否在仓库配置表中
|
|
404
|
+ boolean = service.IsInConfig(orgId, id)
|
|
405
|
+ if boolean == true {
|
|
406
|
+ this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "当前仓库是自动出入库仓库,请先取消自动出入库之后才能进行此操作")
|
|
407
|
+ return
|
|
408
|
+ }
|
|
409
|
+ }
|
391
|
410
|
storehouse := models.Storehouse{
|
392
|
411
|
ID: id,
|
393
|
412
|
StorehouseName: name,
|