|
@@ -20,11 +20,11 @@ type SupplyOrderApiController struct {
|
20
|
20
|
}
|
21
|
21
|
|
22
|
22
|
func SupplyOrderApiRegistRouters() {
|
23
|
|
- //获取供应商列表GetSupplyList
|
|
23
|
+ //获取供应商列表(orgid)
|
24
|
24
|
beego.Router("/api/supply/getsupplylist", &SupplyOrderApiController{}, "get:GetSupplyList")
|
25
|
|
- //保存供应商及联系人(用于更改)
|
|
25
|
+ //保存供应商及联系人(用于更改N)
|
26
|
26
|
beego.Router("/api/supply/updatesupply", &SupplyOrderApiController{}, "post:UpdateSupply")
|
27
|
|
- //删除单条联系人
|
|
27
|
+ //删除单条联系人(N)
|
28
|
28
|
beego.Router("/api/supply/delcontactone", &SupplyOrderApiController{}, "get:DelContactOne")
|
29
|
29
|
//获取单条供应商和涉及到的联系人记录
|
30
|
30
|
beego.Router("/api/supply/getsupplyandcontactone", &SupplyOrderApiController{}, "get:GetSupplyAndContactOne")
|
|
@@ -148,7 +148,7 @@ func (this *SupplyOrderApiController) GetSupplyList() {
|
148
|
148
|
if err == nil {
|
149
|
149
|
for i := 0; i < len(list); i++ {
|
150
|
150
|
code := list[i].SupplierCode
|
151
|
|
- fistname, errs := service.FindName(code)
|
|
151
|
+ fistname, errs := service.FindName(code, orgId)
|
152
|
152
|
if errs != nil && errs.Error() != "record not found" {
|
153
|
153
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
154
|
154
|
return
|
|
@@ -211,6 +211,7 @@ func (this *SupplyOrderApiController) GetSupplyList() {
|
211
|
211
|
|
212
|
212
|
//保存供应商及联系人(用于更改)
|
213
|
213
|
func (this *SupplyOrderApiController) UpdateSupply() {
|
|
214
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
214
|
215
|
dataBody := make(map[string]interface{}, 0)
|
215
|
216
|
err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
216
|
217
|
if err != nil {
|
|
@@ -248,7 +249,7 @@ func (this *SupplyOrderApiController) UpdateSupply() {
|
248
|
249
|
}
|
249
|
250
|
if supplierName != supply.SupplierName {
|
250
|
251
|
//判断供应商名称是否有重复的
|
251
|
|
- sbool, _ := service.FindSupplierName(supplierName)
|
|
252
|
+ sbool, _ := service.FindSupplierName(supplierName, orgId)
|
252
|
253
|
if sbool { //有重复的
|
253
|
254
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商名称重复")
|
254
|
255
|
return
|
|
@@ -256,7 +257,7 @@ func (this *SupplyOrderApiController) UpdateSupply() {
|
256
|
257
|
}
|
257
|
258
|
if supplierCode != supply.SupplierCode {
|
258
|
259
|
//判断供应商编号是否有重复的
|
259
|
|
- codebool, _ := service.FindSupplierCode(supplierCode, supplierid)
|
|
260
|
+ codebool, _ := service.FindSupplierCode(supplierCode, supplierid, orgId)
|
260
|
261
|
if codebool {
|
261
|
262
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商编号重复")
|
262
|
263
|
return
|
|
@@ -279,7 +280,6 @@ func (this *SupplyOrderApiController) UpdateSupply() {
|
279
|
280
|
bank := dataBody["bank"].(string) //纳税人识别号
|
280
|
281
|
//bankAccount := this.GetString("bankAccount") //银行账号
|
281
|
282
|
bankAccount := dataBody["bankaccount"].(string)
|
282
|
|
- orgId := this.GetAdminUserInfo().CurrentOrgId
|
283
|
283
|
//contacts := this.Get("contacts")//联系人
|
284
|
284
|
//dataBody := make(map[string]interface{}, 0)
|
285
|
285
|
//err = json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
|
@@ -317,6 +317,7 @@ func (this *SupplyOrderApiController) UpdateSupply() {
|
317
|
317
|
|
318
|
318
|
//获取单条供应商和涉及到的联系人记录
|
319
|
319
|
func (this *SupplyOrderApiController) GetSupplyAndContactOne() {
|
|
320
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
320
|
321
|
id, _ := this.GetInt64("id")
|
321
|
322
|
check := map[string][]string{
|
322
|
323
|
"id": {"must", "string", "id"},
|
|
@@ -329,9 +330,8 @@ func (this *SupplyOrderApiController) GetSupplyAndContactOne() {
|
329
|
330
|
// this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商id不能为空")
|
330
|
331
|
// return
|
331
|
332
|
//}
|
332
|
|
- supply, contact, err := service.GetSupplyAndContactOne(id)
|
|
333
|
+ supply, contact, err := service.GetSupplyAndContactOne(id, orgId)
|
333
|
334
|
//获取供应商类别
|
334
|
|
- orgId := this.GetAdminUserInfo().CurrentOrgId
|
335
|
335
|
costClassify := "供应商类别"
|
336
|
336
|
drugTypeParent, _ := service.GetDrugDataConfig(0, costClassify)
|
337
|
337
|
drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, orgId)
|
|
@@ -478,6 +478,7 @@ func (this *SupplyOrderApiController) GetSupplyCode() {
|
478
|
478
|
|
479
|
479
|
//保存供应商
|
480
|
480
|
func (this *SupplyOrderApiController) SaveSupply() {
|
|
481
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
481
|
482
|
//supplierName := this.GetString("suppliername") //供应商名称
|
482
|
483
|
dataBody := make(map[string]interface{}, 0)
|
483
|
484
|
err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
|
@@ -492,7 +493,7 @@ func (this *SupplyOrderApiController) SaveSupply() {
|
492
|
493
|
return
|
493
|
494
|
}
|
494
|
495
|
//判断供应商名称是否有重复的
|
495
|
|
- sbool, _ := service.FindSupplierName(supplierName)
|
|
496
|
+ sbool, _ := service.FindSupplierName(supplierName, orgId)
|
496
|
497
|
if sbool { //有重复的
|
497
|
498
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商名称重复")
|
498
|
499
|
return
|
|
@@ -504,7 +505,7 @@ func (this *SupplyOrderApiController) SaveSupply() {
|
504
|
505
|
return
|
505
|
506
|
}
|
506
|
507
|
//判断供应商编号是否有重复的
|
507
|
|
- codebool, _ := service.FindSupplierCodes(supplierCode)
|
|
508
|
+ codebool, _ := service.FindSupplierCodes(supplierCode, orgId)
|
508
|
509
|
if codebool {
|
509
|
510
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商编号重复")
|
510
|
511
|
return
|
|
@@ -530,7 +531,7 @@ func (this *SupplyOrderApiController) SaveSupply() {
|
530
|
531
|
bank := dataBody["bank"].(string)
|
531
|
532
|
//bankAccount := this.GetString("bankAccount")
|
532
|
533
|
bankAccount := dataBody["bankaccount"].(string)
|
533
|
|
- orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
534
|
+
|
534
|
535
|
//contacts := this.Get("contacts")//联系人
|
535
|
536
|
//err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
536
|
537
|
//if err != nil {
|