charge_off.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package http
  2. import (
  3. "fmt"
  4. "kpt.xdmy/apiserver/config"
  5. "kpt.xdmy/apiserver/model"
  6. "kpt.xdmy/pkg/util"
  7. )
  8. type ChargeOffReq struct {
  9. Dest `json:"DEST"`
  10. Data ChargeOff `json:"DATA"`
  11. }
  12. type ChargeOffDetail struct {
  13. RowNumber int `json:"ZEILE"`
  14. }
  15. type ChargeOff struct {
  16. ProofCode string `json:"MBLNR"` // 物料凭证号
  17. ProofYear string `json:"MJAHR"` // 物料凭证年度
  18. ChargeDate string `json:"BUDAT"` // 凭证中的过帐日期 YYYYMMDD
  19. OrderNumber string `json:"FRBNR"` // 设备管理平台单号
  20. RowsNumber []ChargeOffDetail `json:"TMSEG"` // 设备管理平台行号
  21. HasTicket string `json:"ZTHFLG"` // 是否已开票退货单 "是: X ,※仅采购业务需要
  22. }
  23. func (c *ChargeOffReq) NewDest() {
  24. c.Dest = Dest{
  25. DestID: "EQMAN",
  26. BussTp: "MM015",
  27. //Url: "http://192.168.61.117/SAPP0/Common/MM015/CancelMblnr",
  28. Url: fmt.Sprintf("%s/Common/MM015/CancelMblnr", config.Conf.Http.Routing),
  29. }
  30. }
  31. func (c *ChargeOffReq) NewReq(p *model.ProofReq) {
  32. c.NewDest()
  33. h := ChargeOff{
  34. ProofCode: p.ProofCode,
  35. ProofYear: p.ProofYear,
  36. ChargeDate: p.ChargeDate,
  37. OrderNumber: p.OrderNumber,
  38. HasTicket: util.ZeroStr(p.HasTicket == 1, "X"),
  39. }
  40. s := make([]ChargeOffDetail, len(p.RowsNumber))
  41. for v := range p.RowsNumber {
  42. s = append(s, ChargeOffDetail{RowNumber: v})
  43. }
  44. h.RowsNumber = s
  45. c.Data = h
  46. }