|
@@ -19,7 +19,12 @@ type SupplyOrderApiController struct {
|
19
|
19
|
}
|
20
|
20
|
|
21
|
21
|
func SupplyOrderApiRegistRouters() {
|
22
|
|
-
|
|
22
|
+ //删除单条联系人
|
|
23
|
+ beego.Router("/api/supply/delcontactone", &SupplyOrderApiController{}, "get:DelContactOne")
|
|
24
|
+ //获取单条供应商记录
|
|
25
|
+ beego.Router("/api/supply/getsupplyone", &SupplyOrderApiController{}, "get:GetSupplyOne")
|
|
26
|
+ //获取供应商类别
|
|
27
|
+ beego.Router("/api/supply/getsupplytype", &SupplyOrderApiController{}, "get:GetSupplyType")
|
23
|
28
|
//删除供应商及联系人
|
24
|
29
|
beego.Router("/api/supply/delsupply", &SupplyOrderApiController{}, "post:DelSupply")
|
25
|
30
|
//获取供应商编码
|
|
@@ -62,6 +67,38 @@ func SupplyOrderApiRegistRouters() {
|
62
|
67
|
beego.Router("/api/supply/getgoodordercountlist", &SupplyOrderApiController{}, "Get:GetGoodOrderCountList")
|
63
|
68
|
}
|
64
|
69
|
|
|
70
|
+//获取单条供应商记录
|
|
71
|
+func (this *SupplyOrderApiController) GetSupplyOne() {
|
|
72
|
+ id, _ := this.GetInt64("id")
|
|
73
|
+ if id == 0 {
|
|
74
|
+ this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商id不能为空")
|
|
75
|
+ return
|
|
76
|
+ }
|
|
77
|
+ supply, contact, err := service.GetSupplyOne(id)
|
|
78
|
+ if err != nil {
|
|
79
|
+ utils.ErrorLog(err.Error())
|
|
80
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
81
|
+ return
|
|
82
|
+ }
|
|
83
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
84
|
+ "supply": supply,
|
|
85
|
+ "contact": contact,
|
|
86
|
+ })
|
|
87
|
+ return
|
|
88
|
+}
|
|
89
|
+
|
|
90
|
+//获取供应商类别
|
|
91
|
+func (this *SupplyOrderApiController) GetSupplyType() {
|
|
92
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
93
|
+ costClassify := "供应商类别"
|
|
94
|
+ drugTypeParent, _ := service.GetDrugDataConfig(0, costClassify)
|
|
95
|
+ drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, orgId)
|
|
96
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
97
|
+ "list": drugTypeList,
|
|
98
|
+ })
|
|
99
|
+ return
|
|
100
|
+}
|
|
101
|
+
|
65
|
102
|
//删除供应商及联系人
|
66
|
103
|
func (this *SupplyOrderApiController) DelSupply() {
|
67
|
104
|
//拿到供应商的id
|
|
@@ -85,6 +122,25 @@ func (this *SupplyOrderApiController) DelSupply() {
|
85
|
122
|
return
|
86
|
123
|
}
|
87
|
124
|
|
|
125
|
+//删除单条联系人记录
|
|
126
|
+func (this *SupplyOrderApiController) DelContactOne() {
|
|
127
|
+ id, _ := this.GetInt64("id")
|
|
128
|
+ if id == 0 {
|
|
129
|
+ this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "联系人id不能为空")
|
|
130
|
+ return
|
|
131
|
+ }
|
|
132
|
+ err := service.DelContactOne(id)
|
|
133
|
+ if err != nil {
|
|
134
|
+ utils.ErrorLog(err.Error())
|
|
135
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
136
|
+ return
|
|
137
|
+ }
|
|
138
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
139
|
+ "list": "删除成功",
|
|
140
|
+ })
|
|
141
|
+ return
|
|
142
|
+}
|
|
143
|
+
|
88
|
144
|
//获取供应商编码
|
89
|
145
|
func (this *SupplyOrderApiController) GetSupplyCode() {
|
90
|
146
|
supply, err := service.GetSuppliyCode()
|
|
@@ -135,6 +191,11 @@ func (this *SupplyOrderApiController) SaveSupply() {
|
135
|
191
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商编号不能为空")
|
136
|
192
|
return
|
137
|
193
|
}
|
|
194
|
+ //判断供应商编号是否有重复的
|
|
195
|
+ codebool, _ := service.FindSupplierCode(supplierCode)
|
|
196
|
+ if codebool {
|
|
197
|
+ this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商编号重复")
|
|
198
|
+ }
|
138
|
199
|
supplierType, _ := this.GetInt64("suppliertype") //供应商类别
|
139
|
200
|
vatRate, _ := this.GetFloat("vatrate") //增值税税率
|
140
|
201
|
number := this.GetString("number") //纳税人识别号
|