|
@@ -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")
|
|
@@ -138,7 +138,7 @@ func (this *SupplyOrderApiController) GetSupplyList() {
|
138
|
138
|
keyword := this.GetString("keyword") //供应商编号\供应商名称\联系人名字
|
139
|
139
|
orgId := this.GetAdminUserInfo().CurrentOrgId
|
140
|
140
|
//获取分页的数据
|
141
|
|
- list, total, err := service.GetSupplyList(ctype, page, limit, keyword)
|
|
141
|
+ list, total, err := service.GetSupplyList(ctype, page, limit, keyword, orgId)
|
142
|
142
|
//获取供应商类别
|
143
|
143
|
costClassify := "供应商类别"
|
144
|
144
|
drugTypeParent, _ := service.GetDrugDataConfig(0, costClassify)
|
|
@@ -154,7 +154,7 @@ func (this *SupplyOrderApiController) GetSupplyList() {
|
154
|
154
|
if err == nil {
|
155
|
155
|
for i := 0; i < len(list); i++ {
|
156
|
156
|
code := list[i].SupplierCode
|
157
|
|
- fistname, errs := service.FindName(code)
|
|
157
|
+ fistname, errs := service.FindName(code, orgId)
|
158
|
158
|
if errs != nil && errs.Error() != "record not found" {
|
159
|
159
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
160
|
160
|
return
|
|
@@ -217,6 +217,7 @@ func (this *SupplyOrderApiController) GetSupplyList() {
|
217
|
217
|
|
218
|
218
|
//保存供应商及联系人(用于更改)
|
219
|
219
|
func (this *SupplyOrderApiController) UpdateSupply() {
|
|
220
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
220
|
221
|
dataBody := make(map[string]interface{}, 0)
|
221
|
222
|
err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
222
|
223
|
if err != nil {
|
|
@@ -254,7 +255,7 @@ func (this *SupplyOrderApiController) UpdateSupply() {
|
254
|
255
|
}
|
255
|
256
|
if supplierName != supply.SupplierName {
|
256
|
257
|
//判断供应商名称是否有重复的
|
257
|
|
- sbool, _ := service.FindSupplierName(supplierName)
|
|
258
|
+ sbool, _ := service.FindSupplierName(supplierName, orgId)
|
258
|
259
|
if sbool { //有重复的
|
259
|
260
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商名称重复")
|
260
|
261
|
return
|
|
@@ -262,7 +263,7 @@ func (this *SupplyOrderApiController) UpdateSupply() {
|
262
|
263
|
}
|
263
|
264
|
if supplierCode != supply.SupplierCode {
|
264
|
265
|
//判断供应商编号是否有重复的
|
265
|
|
- codebool, _ := service.FindSupplierCode(supplierCode)
|
|
266
|
+ codebool, _ := service.FindSupplierCode(supplierCode, supplierid, orgId)
|
266
|
267
|
if codebool {
|
267
|
268
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商编号重复")
|
268
|
269
|
return
|
|
@@ -285,7 +286,6 @@ func (this *SupplyOrderApiController) UpdateSupply() {
|
285
|
286
|
bank := dataBody["bank"].(string) //纳税人识别号
|
286
|
287
|
//bankAccount := this.GetString("bankAccount") //银行账号
|
287
|
288
|
bankAccount := dataBody["bankaccount"].(string)
|
288
|
|
- orgId := this.GetAdminUserInfo().CurrentOrgId
|
289
|
289
|
//contacts := this.Get("contacts")//联系人
|
290
|
290
|
//dataBody := make(map[string]interface{}, 0)
|
291
|
291
|
//err = json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
|
@@ -323,6 +323,7 @@ func (this *SupplyOrderApiController) UpdateSupply() {
|
323
|
323
|
|
324
|
324
|
//获取单条供应商和涉及到的联系人记录
|
325
|
325
|
func (this *SupplyOrderApiController) GetSupplyAndContactOne() {
|
|
326
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
326
|
327
|
id, _ := this.GetInt64("id")
|
327
|
328
|
check := map[string][]string{
|
328
|
329
|
"id": {"must", "string", "id"},
|
|
@@ -335,9 +336,8 @@ func (this *SupplyOrderApiController) GetSupplyAndContactOne() {
|
335
|
336
|
// this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商id不能为空")
|
336
|
337
|
// return
|
337
|
338
|
//}
|
338
|
|
- supply, contact, err := service.GetSupplyAndContactOne(id)
|
|
339
|
+ supply, contact, err := service.GetSupplyAndContactOne(id, orgId)
|
339
|
340
|
//获取供应商类别
|
340
|
|
- orgId := this.GetAdminUserInfo().CurrentOrgId
|
341
|
341
|
costClassify := "供应商类别"
|
342
|
342
|
drugTypeParent, _ := service.GetDrugDataConfig(0, costClassify)
|
343
|
343
|
drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, orgId)
|
|
@@ -451,7 +451,8 @@ func (this *SupplyOrderApiController) DelContactOne() {
|
451
|
451
|
|
452
|
452
|
//获取供应商编码
|
453
|
453
|
func (this *SupplyOrderApiController) GetSupplyCode() {
|
454
|
|
- supply, err := service.GetSuppliyCode()
|
|
454
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
455
|
+ supply, err := service.GetSuppliyCode(orgId)
|
455
|
456
|
if err != nil {
|
456
|
457
|
return
|
457
|
458
|
}
|
|
@@ -483,6 +484,7 @@ func (this *SupplyOrderApiController) GetSupplyCode() {
|
483
|
484
|
|
484
|
485
|
//保存供应商
|
485
|
486
|
func (this *SupplyOrderApiController) SaveSupply() {
|
|
487
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
486
|
488
|
//supplierName := this.GetString("suppliername") //供应商名称
|
487
|
489
|
dataBody := make(map[string]interface{}, 0)
|
488
|
490
|
err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
|
@@ -497,7 +499,7 @@ func (this *SupplyOrderApiController) SaveSupply() {
|
497
|
499
|
return
|
498
|
500
|
}
|
499
|
501
|
//判断供应商名称是否有重复的
|
500
|
|
- sbool, _ := service.FindSupplierName(supplierName)
|
|
502
|
+ sbool, _ := service.FindSupplierName(supplierName, orgId)
|
501
|
503
|
if sbool { //有重复的
|
502
|
504
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商名称重复")
|
503
|
505
|
return
|
|
@@ -509,7 +511,7 @@ func (this *SupplyOrderApiController) SaveSupply() {
|
509
|
511
|
return
|
510
|
512
|
}
|
511
|
513
|
//判断供应商编号是否有重复的
|
512
|
|
- codebool, _ := service.FindSupplierCode(supplierCode)
|
|
514
|
+ codebool, _ := service.FindSupplierCodes(supplierCode, orgId)
|
513
|
515
|
if codebool {
|
514
|
516
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商编号重复")
|
515
|
517
|
return
|
|
@@ -528,14 +530,14 @@ func (this *SupplyOrderApiController) SaveSupply() {
|
528
|
530
|
}
|
529
|
531
|
supplierType := int64(dataBody["suppliertype"].(float64)) //供应商类别
|
530
|
532
|
//vatRate, _ := this.GetFloat("vatrate")
|
531
|
|
- vatRate, _ := dataBody["suppliertype"].(float64) //增值税税率
|
|
533
|
+ vatRate, _ := dataBody["vatrate"].(float64) //增值税税率
|
532
|
534
|
//number := this.GetString("number")
|
533
|
535
|
number := dataBody["number"].(string)
|
534
|
536
|
//bank := this.GetString("bank")
|
535
|
537
|
bank := dataBody["bank"].(string)
|
536
|
538
|
//bankAccount := this.GetString("bankAccount")
|
537
|
539
|
bankAccount := dataBody["bankaccount"].(string)
|
538
|
|
- orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
540
|
+
|
539
|
541
|
//contacts := this.Get("contacts")//联系人
|
540
|
542
|
//err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
541
|
543
|
//if err != nil {
|