api.go 938 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 "insertBigPartlaid":
  19. log.Info(v)
  20. laidType := pf["laidType"].(float64)
  21. switch laidType {
  22. case 0:
  23. // 入库-申购、采购(申购、线上、寄售)
  24. svc.LaidProof(pf)
  25. }
  26. case "insertBigPartUse":
  27. log.Info(v)
  28. useType := pf["useType"].(float64)
  29. // 领用、手动、报废:0、1、5
  30. switch useType {
  31. case 0, 1, 5:
  32. svc.UseProof(pf)
  33. }
  34. case "updatePartRepertoryTHS":
  35. log.Info(v)
  36. // 退货
  37. svc.RefundProof(pf)
  38. case "insertBigPartquit":
  39. log.Info(v)
  40. // 退库
  41. svc.QuitProof(pf)
  42. }
  43. }
  44. }