api.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package api
  2. import (
  3. "kpt.xdmy/apiserver/service"
  4. "kpt.xdmy/pkg/log"
  5. )
  6. var svc *service.Service
  7. func Init(s *service.Service) {
  8. svc = s
  9. }
  10. func NextService(p []map[string]interface{}) {
  11. for _, v := range p {
  12. if v["name"] == nil || v["parammaps"] == nil {
  13. continue
  14. }
  15. pf := v["parammaps"].(map[string]interface{})
  16. sqlname := v["name"].(string)
  17. switch sqlname {
  18. case "updatebigbuydetailenable", "createBuydetailBySG":
  19. log.Info(v)
  20. //采购:线下(申购配单)、线上(申购)
  21. svc.PurchaseOrder(pf)
  22. case "insertBigPartlaid":
  23. log.Info(v)
  24. laidType := pf["laidType"].(float64)
  25. switch laidType {
  26. case 0:
  27. // 入库-申购、采购(申购、线上、寄售)
  28. svc.LaidProof(pf)
  29. }
  30. case "insertBigPartUse":
  31. log.Info(v)
  32. useType := pf["useType"].(float64)
  33. // 领用、手动、报废:0、1、5
  34. switch useType {
  35. case 0, 1, 5:
  36. svc.UseProof(pf)
  37. }
  38. case "updatePartRepertoryTHS":
  39. log.Info(v)
  40. // 退货
  41. svc.RefundProof(pf)
  42. case "insertBigPartquit":
  43. log.Info(v)
  44. // 退库
  45. svc.QuitProof(pf)
  46. case "updateBigPartTransfer":
  47. // 调拨
  48. log.Info(v)
  49. // svc.ApiTransfer(pf)
  50. }
  51. }
  52. }