|
@@ -237,11 +237,7 @@ func (this *SupplyOrderApiController) UpdateSupply() {
|
237
|
237
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商编号不能为空")
|
238
|
238
|
return
|
239
|
239
|
}
|
240
|
|
- //supplierid, _ := this.GetInt64("id") //供应商id
|
241
|
|
- //fmt.Println(dataBody["id"])
|
242
|
|
- //utils.InfoLog("+++++++++++++前++++++++++++++++++", dataBody["id"])
|
243
|
240
|
supplierid := int64(dataBody["id"].(float64))
|
244
|
|
- //utils.InfoLog("+++++++++++++后++++++++++++++++++", supplierid)
|
245
|
241
|
if supplierid == 0 {
|
246
|
242
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "供应商id不能为空")
|
247
|
243
|
return
|
|
@@ -278,22 +274,21 @@ func (this *SupplyOrderApiController) UpdateSupply() {
|
278
|
274
|
dataBody["vatrate"] = 0
|
279
|
275
|
}
|
280
|
276
|
supplierType := int64(dataBody["suppliertype"].(float64)) //供应商类别
|
281
|
|
- //vatRate, _ := this.GetFloat("vatrate") //增值税税率
|
282
|
|
- vatRate, _ := dataBody["suppliertype"].(float64) //增值税税率
|
|
277
|
+ var tmpvarrate float64
|
|
278
|
+ datavarrate := dataBody["vatrate"]
|
|
279
|
+ switch datavarrate.(type) {
|
|
280
|
+ case float64:
|
|
281
|
+ tmpvarrate = datavarrate.(float64)
|
|
282
|
+ case string:
|
|
283
|
+ tmpvarrate, _ = strconv.ParseFloat(dataBody["vatrate"].(string), 64)
|
|
284
|
+ }
|
|
285
|
+ vatRate := tmpvarrate //增值税税率
|
283
|
286
|
//number := this.GetString("number") //纳税人识别号
|
284
|
287
|
number := dataBody["number"].(string) //纳税人识别号
|
285
|
288
|
//bank := this.GetString("bank") //开户银行
|
286
|
289
|
bank := dataBody["bank"].(string) //纳税人识别号
|
287
|
290
|
//bankAccount := this.GetString("bankAccount") //银行账号
|
288
|
291
|
bankAccount := dataBody["bankaccount"].(string)
|
289
|
|
- //contacts := this.Get("contacts")//联系人
|
290
|
|
- //dataBody := make(map[string]interface{}, 0)
|
291
|
|
- //err = json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
292
|
|
- //if err != nil {
|
293
|
|
- // utils.ErrorLog(err.Error())
|
294
|
|
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
295
|
|
- // return
|
296
|
|
- //}
|
297
|
292
|
//保存联系人
|
298
|
293
|
if dataBody["contacts"] != nil && reflect.TypeOf(dataBody["contacts"]).String() == "[]interface {}" {
|
299
|
294
|
thisStockIn, _ := dataBody["contacts"].([]interface{})
|
|
@@ -409,6 +404,7 @@ func (this *SupplyOrderApiController) GetSupplyType() {
|
409
|
404
|
|
410
|
405
|
//删除供应商及联系人
|
411
|
406
|
func (this *SupplyOrderApiController) DelSupply() {
|
|
407
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
412
|
408
|
//拿到供应商的id
|
413
|
409
|
suid, _ := this.GetInt64("id")
|
414
|
410
|
if suid == 0 {
|
|
@@ -418,7 +414,7 @@ func (this *SupplyOrderApiController) DelSupply() {
|
418
|
414
|
supply := models.SpSupplierName{
|
419
|
415
|
ID: suid,
|
420
|
416
|
}
|
421
|
|
- err := service.DelSupply(supply)
|
|
417
|
+ err := service.DelSupply(supply, orgId)
|
422
|
418
|
if err != nil {
|
423
|
419
|
utils.ErrorLog(err.Error())
|
424
|
420
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
@@ -434,7 +430,10 @@ func (this *SupplyOrderApiController) DelSupply() {
|
434
|
430
|
func (this *SupplyOrderApiController) DelContactOne() {
|
435
|
431
|
id, _ := this.GetInt64("id")
|
436
|
432
|
if id == 0 {
|
437
|
|
- this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "联系人id不能为空")
|
|
433
|
+ //this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "联系人id不能为空")
|
|
434
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
435
|
+ "list": "删除成功,没有走数据库",
|
|
436
|
+ })
|
438
|
437
|
return
|
439
|
438
|
}
|
440
|
439
|
err := service.DelContactOne(id)
|
|
@@ -530,9 +529,17 @@ func (this *SupplyOrderApiController) SaveSupply() {
|
530
|
529
|
}
|
531
|
530
|
supplierType := int64(dataBody["suppliertype"].(float64)) //供应商类别
|
532
|
531
|
//vatRate, _ := this.GetFloat("vatrate")
|
533
|
|
- vatRate, _ := dataBody["vatrate"].(float64) //增值税税率
|
534
|
|
- //number := this.GetString("number")
|
535
|
|
- number := dataBody["number"].(string)
|
|
532
|
+ var tmpvarrate float64
|
|
533
|
+ datavarrate := dataBody["vatrate"]
|
|
534
|
+ switch datavarrate.(type) {
|
|
535
|
+ case float64:
|
|
536
|
+ tmpvarrate = datavarrate.(float64)
|
|
537
|
+ case string:
|
|
538
|
+ tmpvarrate, _ = strconv.ParseFloat(dataBody["vatrate"].(string), 64)
|
|
539
|
+ }
|
|
540
|
+ vatRate := tmpvarrate //增值税税率
|
|
541
|
+ //number := dataBody["number"].(string)
|
|
542
|
+ number, _ := dataBody["number"].(string)
|
536
|
543
|
//bank := this.GetString("bank")
|
537
|
544
|
bank := dataBody["bank"].(string)
|
538
|
545
|
//bankAccount := this.GetString("bankAccount")
|