auto_create_week_schedules_service.go 33KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914
  1. package service
  2. import (
  3. "bytes"
  4. "encoding/json"
  5. "fmt"
  6. "gdyb/models"
  7. "gdyb/utils"
  8. "github.com/astaxie/beego"
  9. "github.com/robfig/cron"
  10. "io/ioutil"
  11. "math/rand"
  12. "net/http"
  13. "strconv"
  14. "time"
  15. )
  16. type ResultSix struct {
  17. Cainfo interface{} `json:"cainfo"`
  18. ErrMsg string `json:"err_msg"`
  19. InfRefmsgid string `json:"inf_refmsgid"`
  20. Infcode int64 `json:"infcode"`
  21. Output struct {
  22. } `json:"output"`
  23. RefmsgTime string `json:"refmsg_time"`
  24. RespondTime string `json:"respond_time"`
  25. Signtype interface{} `json:"signtype"`
  26. WarnMsg interface{} `json:"warn_msg"`
  27. }
  28. type ResultSix10265 struct {
  29. Cainfo interface{} `json:"cainfo"`
  30. ErrMsg string `json:"err_msg"`
  31. InfRefmsgid string `json:"inf_refmsgid"`
  32. Infcode string `json:"infcode"`
  33. Output struct {
  34. } `json:"output"`
  35. RefmsgTime string `json:"refmsg_time"`
  36. RespondTime string `json:"respond_time"`
  37. Signtype interface{} `json:"signtype"`
  38. WarnMsg interface{} `json:"warn_msg"`
  39. }
  40. // cron表达式 https://www.cnblogs.com/zuxingyu/p/6023919.html
  41. var createWeekSchedulesCronJob *cron.Cron
  42. func init() {
  43. utils.InfoLog("开启自动排班定时任务")
  44. createWeekSchedulesCronJob = cron.New()
  45. spec := "0 0 18 * * ?" // 每天6点上传当天数据
  46. //spec := "0 */1 * * * ?"
  47. createWeekSchedulesCronJob.AddFunc(spec, func() {
  48. AutoCreateStock()
  49. })
  50. }
  51. func BeginAutoCreateWeekSchedulesJob() {
  52. createWeekSchedulesCronJob.Start()
  53. }
  54. func AutoCreateStock() {
  55. org_id, _ := beego.AppConfig.Int64("org_id")
  56. var NewWarehousing []*models.NewWarehousingInfo
  57. var NewWarehouseOut []*models.NewWarehouseOutInfo
  58. var NewCancelStock []*models.NewCancelStockInfo
  59. var NewDrugWarehouse []*models.NewDrugWarehouseInfo
  60. var NewDrugWarehouseOut []*models.NewDrugWarehouseOutInfo
  61. var NewDrugCancelStock []*models.NewDrugCancelStockInfo
  62. var XtDrugInventorys []*models.XtDrugInventory
  63. var NewDrugWarehouseOutTwo []*models.NewDrugWarehouseOutInfo
  64. //var XtDrugInventorys2 []*models.XtDrugInventory
  65. //readDb.Model(&models.XtDrugInventory{}).Where("user_org_id = ? and status = 1 and is_upload <> 1 AND stock_max_number > 0", org_id).Preload("BaseDrugLib", "status = 1").Find(&XtDrugInventorys)
  66. //readDb.Model(&models.NewWarehousingInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).First(&NewWarehousing)
  67. //readDb.Model(&models.NewWarehouseOutInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewWarehouseOut)
  68. //readDb.Model(&models.NewCancelStockInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewCancelStock)
  69. ////大丰
  70. //readDb.Model(&models.NewDrugWarehouseInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 AND id >= 4778", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouse)
  71. //readDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 AND id >= 360136", org_id).Preload("NewDrugWarehouseInfo","status = 1").Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouseOut)
  72. //readDb.Model(&models.NewDrugCancelStockInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugCancelStock)
  73. //香水
  74. //readDb.Model(&models.NewDrugWarehouseInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 AND id >= 5720", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouse)
  75. //readDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 AND id >= 366003", org_id).Preload("NewDrugWarehouseInfo","status = 1").Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouseOut)
  76. //readDb.Model(&models.NewDrugCancelStockInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 ", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugCancelStock)
  77. //3502
  78. //readDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("org_id = ? and status = 1 and is_upload = 1 ", org_id).Preload("NewDrugWarehouseInfo","status = 1").Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouseOut)
  79. //3502
  80. readDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("org_id = ? and status = 1 and is_upload = 1 ", org_id).Preload("NewDrugWarehouseInfo", "status = 1").Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouseOutTwo)
  81. for _, item := range XtDrugInventorys {
  82. res := Post3501ForDrug(org_id, item)
  83. if res.Infcode == 0 {
  84. writeDb.Model(&models.XtDrugInventory{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
  85. "is_upload": 1,
  86. })
  87. } else {
  88. continue
  89. }
  90. }
  91. for _, item := range NewDrugWarehouseOutTwo {
  92. res := Post3502ForDrug(org_id, item)
  93. if res.Infcode == 0 {
  94. writeDb.Model(&models.XtDrugInventory{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
  95. "is_upload": 1,
  96. })
  97. } else {
  98. continue
  99. }
  100. }
  101. for _, item := range NewWarehousing {
  102. res := Post3503ForGoodInfo(org_id, item)
  103. if res.Infcode == 0 {
  104. writeDb.Model(&models.NewWarehousingInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
  105. "is_upload": 1,
  106. })
  107. } else {
  108. continue
  109. }
  110. }
  111. for _, item := range NewWarehouseOut {
  112. res := Post3505ForGoodInfo(org_id, item)
  113. if res.Infcode == 0 {
  114. writeDb.Model(&models.NewWarehouseOutInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
  115. "is_upload": 1,
  116. })
  117. } else {
  118. continue
  119. }
  120. }
  121. for _, item := range NewCancelStock {
  122. res := Post3506ForGoodInfo(org_id, item)
  123. if res.Infcode == 0 {
  124. writeDb.Model(&models.NewCancelStockInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
  125. "is_upload": 1,
  126. })
  127. } else {
  128. continue
  129. }
  130. }
  131. for _, item := range NewDrugWarehouse {
  132. res := Post3503ForDrug(org_id, item)
  133. if res.Infcode == 0 {
  134. writeDb.Model(&models.NewDrugWarehouseInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
  135. "is_upload": 1,
  136. })
  137. } else {
  138. continue
  139. }
  140. }
  141. for _, item := range NewDrugWarehouseOut {
  142. res := Post3505ForDrug(org_id, item)
  143. if res.Infcode == 0 {
  144. writeDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
  145. "is_upload": 1,
  146. })
  147. }
  148. }
  149. for _, item := range NewDrugCancelStock {
  150. res := Post3506ForDrug(org_id, item)
  151. if res.Infcode == 0 {
  152. writeDb.Model(&models.NewDrugCancelStockInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
  153. "is_upload": 1,
  154. })
  155. } else {
  156. continue
  157. }
  158. }
  159. }
  160. func Post3501ForGoodInfo(org_id int64, infos *models.XtDrugInventory) ResultSix {
  161. var res ResultSix
  162. miConfig, _ := FindMedicalInsuranceInfo(org_id)
  163. data := make(map[string]interface{})
  164. var struct3501s []models.Struct3501
  165. var struct3501 models.Struct3501
  166. struct3501.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber
  167. struct3501.FixmedinsHilistId = miConfig.Code
  168. struct3501.FixmedinsHilistName = miConfig.OrgName
  169. struct3501.FixmedinsBchno = infos.BatchNumber
  170. struct3501.RxFlag = "0"
  171. struct3501.Invdate = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
  172. struct3501.OrgName = miConfig.OrgName
  173. struct3501.AccessKey = miConfig.AccessKey
  174. struct3501.RequestUrl = miConfig.Url
  175. struct3501.SecretKey = miConfig.SecretKey
  176. struct3501.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
  177. struct3501.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
  178. struct3501.InvCnt = strconv.FormatInt(infos.Count, 10)
  179. struct3501.ManuDate = time.Unix(infos.DrugWarehouseInfo.ProductDate, 0).Format("2006-01-02 15:04:05")
  180. struct3501.ExpyEnd = time.Unix(infos.DrugWarehouseInfo.ExpiryDate, 0).Format("2006-01-02 15:04:05")
  181. struct3501s = append(struct3501s, struct3501)
  182. data["struct_3501s"] = struct3501s[0]
  183. client := &http.Client{}
  184. bytesData, _ := json.Marshal(data)
  185. var req *http.Request
  186. if miConfig.MdtrtareaAdmvs == "320921" {
  187. req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3501", bytes.NewReader(bytesData))
  188. } else {
  189. req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3501", bytes.NewReader(bytesData))
  190. }
  191. resp, _ := client.Do(req)
  192. defer resp.Body.Close()
  193. body, ioErr := ioutil.ReadAll(resp.Body)
  194. if ioErr != nil {
  195. utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  196. res.Infcode = -1
  197. return res
  198. }
  199. var respJSON map[string]interface{}
  200. if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  201. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  202. res.Infcode = -1
  203. return res
  204. }
  205. var resSix10265 ResultSix10265 //1101结果
  206. respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
  207. result, _ := json.Marshal(respJSON)
  208. if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
  209. utils.ErrorLog("解析失败:%v", err)
  210. res.Infcode = -1
  211. return res
  212. }
  213. res.InfRefmsgid = resSix10265.InfRefmsgid
  214. res.Output = resSix10265.Output
  215. res.ErrMsg = resSix10265.ErrMsg
  216. res.Cainfo = resSix10265.Cainfo
  217. res.WarnMsg = resSix10265.WarnMsg
  218. infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
  219. res.Infcode = infocode
  220. return res
  221. }
  222. func Post3501ForDrug(org_id int64, infos *models.XtDrugInventory) ResultSix {
  223. var res ResultSix
  224. miConfig, _ := FindMedicalInsuranceInfo(org_id)
  225. data := make(map[string]interface{})
  226. var struct3501s []models.Struct3501
  227. var struct3501 models.Struct3501
  228. struct3501.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber
  229. struct3501.FixmedinsHilistId = miConfig.Code
  230. struct3501.FixmedinsHilistName = miConfig.OrgName
  231. struct3501.FixmedinsBchno = infos.BatchNumber
  232. struct3501.FixmedinsCode = miConfig.Code
  233. struct3501.RxFlag = "0"
  234. struct3501.Invdate = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
  235. struct3501.OrgName = miConfig.OrgName
  236. struct3501.AccessKey = miConfig.AccessKey
  237. struct3501.RequestUrl = miConfig.Url
  238. struct3501.SecretKey = miConfig.SecretKey
  239. struct3501.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
  240. struct3501.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
  241. struct3501.InvCnt = strconv.FormatInt(infos.StockMaxNumber, 10)
  242. struct3501.ManuDate = time.Unix(infos.DrugWarehouseInfo.ProductDate, 0).Format("2006-01-02 15:04:05")
  243. struct3501.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
  244. struct3501s = append(struct3501s, struct3501)
  245. data["struct_3501s"] = struct3501s[0]
  246. client := &http.Client{}
  247. bytesData, _ := json.Marshal(data)
  248. var req *http.Request
  249. if miConfig.MdtrtareaAdmvs == "320921" {
  250. req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3501", bytes.NewReader(bytesData))
  251. } else {
  252. req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3501", bytes.NewReader(bytesData))
  253. }
  254. resp, _ := client.Do(req)
  255. defer resp.Body.Close()
  256. body, ioErr := ioutil.ReadAll(resp.Body)
  257. if ioErr != nil {
  258. utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  259. res.Infcode = -1
  260. return res
  261. }
  262. var respJSON map[string]interface{}
  263. if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  264. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  265. res.Infcode = -1
  266. return res
  267. }
  268. var resSix10265 ResultSix10265 //1101结果
  269. respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
  270. result, _ := json.Marshal(respJSON)
  271. if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
  272. utils.ErrorLog("解析失败:%v", err)
  273. res.Infcode = -1
  274. return res
  275. }
  276. res.InfRefmsgid = resSix10265.InfRefmsgid
  277. res.Output = resSix10265.Output
  278. res.ErrMsg = resSix10265.ErrMsg
  279. res.Cainfo = resSix10265.Cainfo
  280. res.WarnMsg = resSix10265.WarnMsg
  281. infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
  282. res.Infcode = infocode
  283. return res
  284. }
  285. func Post3502ForDrug(org_id int64, infos *models.NewDrugWarehouseOutInfo) ResultSix {
  286. var res ResultSix
  287. miConfig, _ := FindMedicalInsuranceInfo(org_id)
  288. data := make(map[string]interface{})
  289. //var struct3502s []models.Struct3502
  290. var struct3502 models.Struct3502
  291. struct3502.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber
  292. struct3502.FixmedinsHilistId = miConfig.Code
  293. struct3502.FixmedinsHilistName = miConfig.OrgName
  294. struct3502.FixmedinsBchno = infos.NewDrugWarehouseInfo.BatchNumber
  295. struct3502.FixmedinsCode = miConfig.Code
  296. struct3502.RxFlag = "0"
  297. struct3502.InvChgTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
  298. struct3502.OrgName = miConfig.OrgName
  299. struct3502.AccessKey = miConfig.AccessKey
  300. struct3502.RequestUrl = miConfig.Url
  301. struct3502.SecretKey = miConfig.SecretKey
  302. struct3502.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
  303. struct3502.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
  304. struct3502.InvChgType = "102"
  305. struct3502.Cnt = strconv.FormatInt(infos.Count, 10)
  306. struct3502.Pric = fmt.Sprintf("%.2f", infos.BaseDrugLib.RetailPrice)
  307. data["struct_3502s"] = struct3502
  308. client := &http.Client{}
  309. bytesData, _ := json.Marshal(data)
  310. var req *http.Request
  311. if miConfig.MdtrtareaAdmvs == "320921" {
  312. req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3502", bytes.NewReader(bytesData))
  313. } else {
  314. req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3502", bytes.NewReader(bytesData))
  315. }
  316. resp, _ := client.Do(req)
  317. defer resp.Body.Close()
  318. body, ioErr := ioutil.ReadAll(resp.Body)
  319. if ioErr != nil {
  320. utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  321. res.Infcode = -1
  322. return res
  323. }
  324. var respJSON map[string]interface{}
  325. if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  326. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  327. res.Infcode = -1
  328. return res
  329. }
  330. var resSix10265 ResultSix10265 //1101结果
  331. respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
  332. result, _ := json.Marshal(respJSON)
  333. if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
  334. utils.ErrorLog("解析失败:%v", err)
  335. res.Infcode = -1
  336. return res
  337. }
  338. res.InfRefmsgid = resSix10265.InfRefmsgid
  339. res.Output = resSix10265.Output
  340. res.ErrMsg = resSix10265.ErrMsg
  341. res.Cainfo = resSix10265.Cainfo
  342. res.WarnMsg = resSix10265.WarnMsg
  343. infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
  344. res.Infcode = infocode
  345. return res
  346. }
  347. //采购
  348. func Post3503ForGoodInfo(org_id int64, infos *models.NewWarehousingInfo) ResultSix {
  349. fmt.Println(&infos)
  350. var res ResultSix
  351. miConfig, _ := FindMedicalInsuranceInfo(org_id)
  352. data := make(map[string]interface{})
  353. var struct3503s []models.Struct3503
  354. var struct3503 models.Struct3503
  355. struct3503.MedListCodg = infos.GoodInfo.MedicalInsuranceNumber
  356. struct3503.FixmedinsHilistId = miConfig.Code
  357. struct3503.FixmedinsCode = miConfig.Code
  358. struct3503.FixmedinsHilistName = miConfig.OrgName
  359. struct3503.FixmedinsBchno = infos.Number
  360. var d models.Dealers
  361. readDb.Model(&models.Dealers{}).Where("id = ?", infos.Dealer).First(&d)
  362. if d.ID == 0 {
  363. struct3503.SplerName = infos.Manufacturers.ManufacturerName
  364. } else {
  365. struct3503.SplerName = d.DealerName
  366. }
  367. struct3503.ManuLotnum = infos.Number
  368. struct3503.ProdentpName = infos.Manufacturers.ManufacturerName
  369. struct3503.Aprvno = infos.GoodInfo.Number
  370. struct3503.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02")
  371. struct3503.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02")
  372. struct3503.PurcRetnCnt = strconv.FormatInt(infos.TotalCount, 10)
  373. struct3503.RxFlag = "0"
  374. struct3503.PurcRetnStoinTime = time.Unix(infos.Ctime, 0).Format("2006-01-02")
  375. if org_id == 10217 {
  376. struct3503.PurcRetnOpterName = "施实芹"
  377. } else {
  378. struct3503.PurcRetnOpterName = ""
  379. }
  380. struct3503.OrgName = miConfig.OrgName
  381. struct3503.AccessKey = miConfig.AccessKey
  382. struct3503.RequestUrl = miConfig.Url
  383. struct3503.SecretKey = miConfig.SecretKey
  384. struct3503.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
  385. struct3503.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
  386. struct3503.Memo = ""
  387. struct3503s = append(struct3503s, struct3503)
  388. data["struct_3503s"] = struct3503s[0]
  389. client := &http.Client{}
  390. bytesData, _ := json.Marshal(data)
  391. fmt.Println(string(bytesData))
  392. var req *http.Request
  393. if miConfig.MdtrtareaAdmvs == "320921" {
  394. req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3503", bytes.NewReader(bytesData))
  395. } else {
  396. fmt.Println("111111")
  397. req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3503", bytes.NewReader(bytesData))
  398. }
  399. resp, _ := client.Do(req)
  400. defer resp.Body.Close()
  401. body, ioErr := ioutil.ReadAll(resp.Body)
  402. if ioErr != nil {
  403. utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  404. res.Infcode = -1
  405. return res
  406. }
  407. var respJSON map[string]interface{}
  408. if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  409. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  410. res.Infcode = -1
  411. return res
  412. }
  413. var resSix10265 ResultSix10265 //1101结果
  414. respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
  415. result, _ := json.Marshal(respJSON)
  416. if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
  417. utils.ErrorLog("解析失败:%v", err)
  418. res.Infcode = -1
  419. return res
  420. }
  421. res.InfRefmsgid = resSix10265.InfRefmsgid
  422. res.Output = resSix10265.Output
  423. res.ErrMsg = resSix10265.ErrMsg
  424. res.Cainfo = resSix10265.Cainfo
  425. res.WarnMsg = resSix10265.WarnMsg
  426. infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
  427. res.Infcode = infocode
  428. return res
  429. }
  430. func Post3503ForDrug(org_id int64, infos *models.NewDrugWarehouseInfo) ResultSix {
  431. var res ResultSix
  432. miConfig, _ := FindMedicalInsuranceInfo(org_id)
  433. data := make(map[string]interface{})
  434. var struct3503s []models.Struct3503
  435. var struct3503 models.Struct3503
  436. struct3503.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber
  437. struct3503.FixmedinsHilistId = miConfig.Code
  438. struct3503.FixmedinsHilistName = miConfig.OrgName
  439. struct3503.FixmedinsBchno = infos.BatchNumber
  440. var d models.Dealers
  441. readDb.Model(&models.Dealers{}).Where("id = ?", infos.Dealer).First(&d)
  442. struct3503.SplerName = d.DealerName
  443. struct3503.ManuLotnum = infos.BatchNumber
  444. struct3503.ProdentpName = infos.Manufacturers.ManufacturerName
  445. struct3503.Aprvno = infos.BaseDrugLib.Number
  446. struct3503.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
  447. struct3503.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
  448. struct3503.PurcRetnCnt = strconv.FormatInt(infos.WarehousingCount, 10)
  449. struct3503.RxFlag = "0"
  450. struct3503.PurcRetnStoinTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
  451. if org_id == 10217 {
  452. struct3503.PurcRetnOpterName = "施实芹"
  453. } else {
  454. struct3503.PurcRetnOpterName = "顾林玲"
  455. }
  456. struct3503.OrgName = miConfig.OrgName
  457. struct3503.AccessKey = miConfig.AccessKey
  458. struct3503.RequestUrl = miConfig.Url
  459. struct3503.SecretKey = miConfig.SecretKey
  460. struct3503.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
  461. struct3503.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
  462. struct3503.Memo = ""
  463. struct3503s = append(struct3503s, struct3503)
  464. data["struct_3503s"] = struct3503s[0]
  465. client := &http.Client{}
  466. bytesData, _ := json.Marshal(data)
  467. var req *http.Request
  468. if miConfig.MdtrtareaAdmvs == "320921" {
  469. req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3503", bytes.NewReader(bytesData))
  470. } else {
  471. req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3503", bytes.NewReader(bytesData))
  472. }
  473. resp, _ := client.Do(req)
  474. defer resp.Body.Close()
  475. body, ioErr := ioutil.ReadAll(resp.Body)
  476. if ioErr != nil {
  477. utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  478. res.Infcode = -1
  479. return res
  480. }
  481. var respJSON map[string]interface{}
  482. if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  483. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  484. res.Infcode = -1
  485. return res
  486. }
  487. var resSix10265 ResultSix10265 //1101结果
  488. respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
  489. result, _ := json.Marshal(respJSON)
  490. if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
  491. utils.ErrorLog("解析失败:%v", err)
  492. res.Infcode = -1
  493. return res
  494. }
  495. res.InfRefmsgid = resSix10265.InfRefmsgid
  496. res.Output = resSix10265.Output
  497. res.ErrMsg = resSix10265.ErrMsg
  498. res.Cainfo = resSix10265.Cainfo
  499. res.WarnMsg = resSix10265.WarnMsg
  500. infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
  501. res.Infcode = infocode
  502. return res
  503. }
  504. //销售
  505. func Post3505ForGoodInfo(org_id int64, infos *models.NewWarehouseOutInfo) ResultSix {
  506. var res ResultSix
  507. miConfig, _ := FindMedicalInsuranceInfo(org_id)
  508. data := make(map[string]interface{})
  509. var struct3501s []models.Struct3505
  510. var struct3501 models.Struct3505
  511. struct3501.OrgName = miConfig.OrgName
  512. struct3501.AccessKey = miConfig.AccessKey
  513. struct3501.RequestUrl = miConfig.Url
  514. struct3501.SecretKey = miConfig.SecretKey
  515. struct3501.MedListCodg = infos.GoodInfo.MedicalInsuranceNumber
  516. struct3501.FixmedinsHilistId = miConfig.Code
  517. struct3501.FixmedinsHilistName = miConfig.OrgName
  518. struct3501.FixmedinsBchno = infos.Number
  519. if org_id == 10188 {
  520. struct3501.PrscDrName = "王曙光"
  521. struct3501.PharName = "王曙光"
  522. struct3501.PharPracCertNo = ""
  523. } else if org_id == 10217 {
  524. struct3501.PrscDrName = "王云刚"
  525. struct3501.PharName = "王云刚"
  526. struct3501.PharPracCertNo = ""
  527. }
  528. timestamp := time.Now().Unix()
  529. tempTime := time.Unix(timestamp, 0)
  530. timeFormat := tempTime.Format("20060102150405")
  531. chrgBchno := rand.Intn(100000) + 10000
  532. ipt_otp_no := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
  533. struct3501.MdtrtSn = ipt_otp_no
  534. struct3501.ManuLotnum = infos.Number
  535. struct3501.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
  536. struct3501.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
  537. struct3501.RxFlag = "0"
  538. struct3501.TrdnFlag = "1"
  539. struct3501.RtalDocno = strconv.FormatInt(int64(infos.ID), 10)
  540. struct3501.SelRetnCnt = strconv.FormatInt(int64(infos.Count), 10)
  541. struct3501.SelRetnTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
  542. struct3501.SelRetnOpterName = "仓管员"
  543. struct3501s = append(struct3501s, struct3501)
  544. data["struct_3501s"] = struct3501s
  545. client := &http.Client{}
  546. bytesData, _ := json.Marshal(data)
  547. var req *http.Request
  548. if miConfig.MdtrtareaAdmvs == "320921" {
  549. req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3501", bytes.NewReader(bytesData))
  550. } else {
  551. req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3501", bytes.NewReader(bytesData))
  552. }
  553. resp, _ := client.Do(req)
  554. defer resp.Body.Close()
  555. body, ioErr := ioutil.ReadAll(resp.Body)
  556. if ioErr != nil {
  557. utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  558. res.Infcode = -1
  559. return res
  560. }
  561. var respJSON map[string]interface{}
  562. if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  563. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  564. res.Infcode = -1
  565. return res
  566. }
  567. var resSix10265 ResultSix10265 //1101结果
  568. respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
  569. result, _ := json.Marshal(respJSON)
  570. if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
  571. utils.ErrorLog("解析失败:%v", err)
  572. res.Infcode = -1
  573. return res
  574. }
  575. res.InfRefmsgid = resSix10265.InfRefmsgid
  576. res.Output = resSix10265.Output
  577. res.ErrMsg = resSix10265.ErrMsg
  578. res.Cainfo = resSix10265.Cainfo
  579. res.WarnMsg = resSix10265.WarnMsg
  580. infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
  581. res.Infcode = infocode
  582. return res
  583. }
  584. func Post3505ForDrug(org_id int64, infos *models.NewDrugWarehouseOutInfo) ResultSix {
  585. var res ResultSix
  586. miConfig, _ := FindMedicalInsuranceInfo(org_id)
  587. data := make(map[string]interface{})
  588. var struct3505s []models.Struct3505
  589. var struct3505 models.Struct3505
  590. struct3505.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber
  591. struct3505.FixmedinsHilistId = miConfig.Code
  592. struct3505.FixmedinsHilistName = miConfig.OrgName
  593. struct3505.FixmedinsBchno = infos.NewDrugWarehouseInfo.BatchNumber
  594. struct3505.FixmedinsCode = miConfig.Code
  595. struct3505.OrgName = miConfig.OrgName
  596. struct3505.AccessKey = miConfig.AccessKey
  597. struct3505.RequestUrl = miConfig.Url
  598. struct3505.SecretKey = miConfig.SecretKey
  599. struct3505.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
  600. struct3505.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
  601. struct3505.FixmedinsBchno = infos.NewDrugWarehouseInfo.BatchNumber
  602. if org_id == 10188 {
  603. struct3505.PrscDrName = "王曙光"
  604. struct3505.PharName = "顾林玲"
  605. struct3505.PharPracCertNo = "K0404020449"
  606. } else if org_id == 10217 {
  607. struct3505.PrscDrName = "王云刚"
  608. struct3505.PharName = "施实芹"
  609. struct3505.PharPracCertNo = "1532050832051512010002"
  610. }
  611. timestamp := time.Now().Unix()
  612. tempTime := time.Unix(timestamp, 0)
  613. timeFormat := tempTime.Format("20060102150405")
  614. chrgBchno := rand.Intn(100000) + 10000
  615. ipt_otp_no := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
  616. struct3505.MdtrtSn = ipt_otp_no
  617. struct3505.ManuLotnum = infos.NewDrugWarehouseInfo.BatchNumber
  618. struct3505.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
  619. //struct3505.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
  620. struct3505.RxFlag = "0"
  621. struct3505.TrdnFlag = "1"
  622. struct3505.RtalDocno = strconv.FormatInt(int64(infos.ID), 10)
  623. struct3505.SelRetnCnt = strconv.FormatInt(int64(infos.Count), 10)
  624. struct3505.SelRetnTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
  625. if org_id == 10188 {
  626. struct3505.SelRetnOpterName = "孙欣欣"
  627. } else if org_id == 10217 {
  628. struct3505.SelRetnOpterName = "晁海燕"
  629. }
  630. struct3505s = append(struct3505s, struct3505)
  631. data["struct_3505s"] = struct3505s[0]
  632. client := &http.Client{}
  633. bytesData, _ := json.Marshal(data)
  634. var req *http.Request
  635. if miConfig.MdtrtareaAdmvs == "320921" {
  636. req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3505", bytes.NewReader(bytesData))
  637. } else {
  638. req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3505", bytes.NewReader(bytesData))
  639. }
  640. resp, _ := client.Do(req)
  641. defer resp.Body.Close()
  642. body, ioErr := ioutil.ReadAll(resp.Body)
  643. if ioErr != nil {
  644. utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  645. res.Infcode = -1
  646. return res
  647. }
  648. var respJSON map[string]interface{}
  649. if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  650. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  651. res.Infcode = -1
  652. return res
  653. }
  654. var resSix10265 ResultSix10265 //1101结果
  655. respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
  656. result, _ := json.Marshal(respJSON)
  657. if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
  658. utils.ErrorLog("解析失败:%v", err)
  659. res.Infcode = -1
  660. return res
  661. }
  662. res.InfRefmsgid = resSix10265.InfRefmsgid
  663. res.Output = resSix10265.Output
  664. res.ErrMsg = resSix10265.ErrMsg
  665. res.Cainfo = resSix10265.Cainfo
  666. res.WarnMsg = resSix10265.WarnMsg
  667. infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
  668. res.Infcode = infocode
  669. return res
  670. }
  671. //销售退货
  672. func Post3506ForGoodInfo(org_id int64, infos *models.NewCancelStockInfo) ResultSix {
  673. var res ResultSix
  674. miConfig, _ := FindMedicalInsuranceInfo(org_id)
  675. data := make(map[string]interface{})
  676. var struct3506s []models.Struct3506
  677. var struct3506 models.Struct3506
  678. struct3506.OrgName = miConfig.OrgName
  679. struct3506.AccessKey = miConfig.AccessKey
  680. struct3506.RequestUrl = miConfig.Url
  681. struct3506.SecretKey = miConfig.SecretKey
  682. struct3506.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
  683. struct3506.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
  684. struct3506.MedListCodg = infos.GoodInfo.MedicalInsuranceNumber
  685. struct3506.FixmedinsHilistId = miConfig.Code
  686. struct3506.FixmedinsHilistName = miConfig.OrgName
  687. struct3506.FixmedinsBchno = infos.Number
  688. struct3506.ManuLotnum = infos.Number
  689. struct3506.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
  690. //struct3501.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
  691. struct3506.RxFlag = "0"
  692. struct3506.TrdnFlag = "1"
  693. struct3506.SelRetnCnt = strconv.FormatInt(int64(infos.Count), 10)
  694. struct3506.SelRetnTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
  695. //struct3506.SelRetnOpterName = "仓管员"
  696. if org_id == 10188 {
  697. struct3506.SelRetnOpterName = "孙欣欣"
  698. } else if org_id == 10217 {
  699. struct3506.SelRetnOpterName = "晁海燕"
  700. }
  701. struct3506.Memo = ""
  702. struct3506s = append(struct3506s, struct3506)
  703. data["struct_3506s"] = struct3506s
  704. client := &http.Client{}
  705. bytesData, _ := json.Marshal(data)
  706. var req *http.Request
  707. if miConfig.MdtrtareaAdmvs == "320921" {
  708. req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3506", bytes.NewReader(bytesData))
  709. } else {
  710. req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3506", bytes.NewReader(bytesData))
  711. }
  712. resp, _ := client.Do(req)
  713. defer resp.Body.Close()
  714. body, ioErr := ioutil.ReadAll(resp.Body)
  715. if ioErr != nil {
  716. utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  717. res.Infcode = -1
  718. return res
  719. }
  720. var respJSON map[string]interface{}
  721. if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  722. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  723. res.Infcode = -1
  724. return res
  725. }
  726. var resSix10265 ResultSix10265 //1101结果
  727. respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
  728. result, _ := json.Marshal(respJSON)
  729. if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
  730. utils.ErrorLog("解析失败:%v", err)
  731. res.Infcode = -1
  732. return res
  733. }
  734. res.InfRefmsgid = resSix10265.InfRefmsgid
  735. res.Output = resSix10265.Output
  736. res.ErrMsg = resSix10265.ErrMsg
  737. res.Cainfo = resSix10265.Cainfo
  738. res.WarnMsg = resSix10265.WarnMsg
  739. infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
  740. res.Infcode = infocode
  741. return res
  742. }
  743. func Post3506ForDrug(org_id int64, infos *models.NewDrugCancelStockInfo) ResultSix {
  744. var res ResultSix
  745. miConfig, _ := FindMedicalInsuranceInfo(org_id)
  746. data := make(map[string]interface{})
  747. var struct3506s []models.Struct3506
  748. var struct3506 models.Struct3506
  749. struct3506.FixmedinsCode = miConfig.Code
  750. struct3506.OrgName = miConfig.OrgName
  751. struct3506.AccessKey = miConfig.AccessKey
  752. struct3506.RequestUrl = miConfig.Url
  753. struct3506.SecretKey = miConfig.SecretKey
  754. struct3506.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
  755. struct3506.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
  756. struct3506.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber
  757. struct3506.FixmedinsHilistId = miConfig.Code
  758. struct3506.FixmedinsHilistName = miConfig.OrgName
  759. struct3506.FixmedinsBchno = infos.BatchNumber
  760. struct3506.ManuLotnum = infos.BatchNumber
  761. struct3506.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
  762. //struct3501.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
  763. struct3506.RxFlag = "0"
  764. struct3506.TrdnFlag = "1"
  765. struct3506.SelRetnCnt = strconv.FormatInt(int64(infos.Count), 10)
  766. struct3506.SelRetnTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
  767. //struct3506.SelRetnOpterName = "仓管员"
  768. if org_id == 10188 {
  769. struct3506.SelRetnOpterName = "孙欣欣"
  770. } else if org_id == 10217 {
  771. struct3506.SelRetnOpterName = "晁海燕"
  772. }
  773. struct3506.Memo = ""
  774. struct3506s = append(struct3506s, struct3506)
  775. data["struct_3506s"] = struct3506s[0]
  776. client := &http.Client{}
  777. bytesData, _ := json.Marshal(data)
  778. var req *http.Request
  779. if miConfig.MdtrtareaAdmvs == "320921" {
  780. req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3506", bytes.NewReader(bytesData))
  781. } else {
  782. req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3506", bytes.NewReader(bytesData))
  783. }
  784. resp, _ := client.Do(req)
  785. defer resp.Body.Close()
  786. body, ioErr := ioutil.ReadAll(resp.Body)
  787. if ioErr != nil {
  788. utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  789. res.Infcode = -1
  790. return res
  791. }
  792. var respJSON map[string]interface{}
  793. if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  794. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  795. res.Infcode = -1
  796. return res
  797. }
  798. var resSix10265 ResultSix10265 //1101结果
  799. respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
  800. result, _ := json.Marshal(respJSON)
  801. if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
  802. utils.ErrorLog("解析失败:%v", err)
  803. res.Infcode = -1
  804. return res
  805. }
  806. res.InfRefmsgid = resSix10265.InfRefmsgid
  807. res.Output = resSix10265.Output
  808. res.ErrMsg = resSix10265.ErrMsg
  809. res.Cainfo = resSix10265.Cainfo
  810. res.WarnMsg = resSix10265.WarnMsg
  811. infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
  812. res.Infcode = infocode
  813. return res
  814. }