package http import ( "fmt" "kpt.xdmy/apiserver/config" "kpt.xdmy/apiserver/model" "kpt.xdmy/pkg/util" ) type ChargeOffReq struct { Dest `json:"DEST"` Data ChargeOff `json:"DATA"` } type ChargeOffDetail struct { RowNumber int `json:"ZEILE"` } type ChargeOff struct { ProofCode string `json:"MBLNR"` // 物料凭证号 ProofYear string `json:"MJAHR"` // 物料凭证年度 ChargeDate string `json:"BUDAT"` // 凭证中的过帐日期 YYYYMMDD OrderNumber string `json:"FRBNR"` // 设备管理平台单号 RowsNumber []ChargeOffDetail `json:"TMSEG"` // 设备管理平台行号 HasTicket string `json:"ZTHFLG"` // 是否已开票退货单 "是: X ,※仅采购业务需要 } func (c *ChargeOffReq) NewDest() { c.Dest = Dest{ DestID: "EQMAN", BussTp: "MM015", //Url: "http://192.168.61.117/SAPP0/Common/MM015/CancelMblnr", Url: fmt.Sprintf("%s/Common/MM015/CancelMblnr", config.Conf.Http.Routing), } } func (c *ChargeOffReq) NewReq(p *model.ProofReq) { c.NewDest() h := ChargeOff{ ProofCode: p.ProofCode, ProofYear: p.ProofYear, ChargeDate: p.ChargeDate, OrderNumber: p.OrderNumber, HasTicket: util.ZeroStr(p.HasTicket == 1, "X"), } s := make([]ChargeOffDetail, len(p.RowsNumber)) for v := range p.RowsNumber { s = append(s, ChargeOffDetail{RowNumber: v}) } h.RowsNumber = s c.Data = h }