|
|
@ -703,46 +703,11 @@ func GenerateDeliveryCar() { |
|
|
|
session.Rollback() |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
fmt.Println("---------------------生成xmL_msg1") |
|
|
|
//APS向WMS传递发运包装信息
|
|
|
|
var o = PlnCalloffdataLandingXml{} |
|
|
|
o.Packorderid = pkotablst[j].Packorderid |
|
|
|
o.Packtemplateid = pkotablst[j].Packtemplateid |
|
|
|
o.Projnr = pkotablst[j].Projnr |
|
|
|
o.Status = strconv.Itoa(pkotablst[j].Status) |
|
|
|
o.Shortpack = strconv.Itoa(pkotablst[j].Shortpack) |
|
|
|
o.Orderinfo = pkotablst[j].Orderinfo |
|
|
|
o.Boxsn = pkotablst[j].Boxsn |
|
|
|
o.Packtypeid = pkotablst[j].Packtypeid |
|
|
|
o.Printerid = pkotablst[j].Printerid |
|
|
|
o.Templatefile = pkotablst[j].Templatefile |
|
|
|
o.Planqty = strconv.Itoa(pkotablst[j].Planqty) |
|
|
|
o.Actqty = strconv.Itoa(pkotablst[j].Actqty) |
|
|
|
for _, info := range pkotablst[j].Itemlst{ |
|
|
|
o.Details = append(o.Details, Pln_calloffdata_landing_Xml{ |
|
|
|
Packorderid :info.Packorderid, |
|
|
|
Pos :common.ValueToString(info.Pos,""), |
|
|
|
Poscode :info.Poscode, |
|
|
|
Oemseq : common.ValueToString(info.Oemseq, ""), |
|
|
|
Checkseq :common.ValueToString(info.Seq,""), |
|
|
|
Supplygroupid : info.Supplygroupid, |
|
|
|
Workordernr : info.Workordernr, |
|
|
|
Status : common.ValueToString(info.Status,""), |
|
|
|
Planqty :common.ValueToString(info.Planqty,""), |
|
|
|
Actqty :common.ValueToString(info.Actqty,""), |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
jsonBytes, err := json.Marshal(o) |
|
|
|
if err != nil { |
|
|
|
fmt.Println(err) |
|
|
|
} |
|
|
|
bl_xmlmsg := service.BL_Xmlmsg{MsgType: common.MSG_TYPE_SHIP, Msg: string(jsonBytes)} |
|
|
|
fmt.Println("---------------------生成xmL_msg2") |
|
|
|
if err = bl_xmlmsg.Create(session); err != nil { |
|
|
|
fmt.Println(err) |
|
|
|
// 生成发运xml
|
|
|
|
if err = CreateXml(pkotablst, j, session); err != nil { |
|
|
|
glog.InfoExtln("Calloff包装单", "Failed to create xml!") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
err = session.Commit() |
|
|
@ -757,7 +722,50 @@ func GenerateDeliveryCar() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func CallOffXmlTick(){ |
|
|
|
func CreateXml(pkotablst []db.Jit_packorder, j int, session *xorm.Session) error { |
|
|
|
fmt.Println("---------------------生成xmL_msg1") |
|
|
|
//APS向WMS传递发运包装信息
|
|
|
|
var o = PlnCalloffdataLandingXml{} |
|
|
|
o.Packorderid = pkotablst[j].Packorderid |
|
|
|
o.Packtemplateid = pkotablst[j].Packtemplateid |
|
|
|
o.Projnr = pkotablst[j].Projnr |
|
|
|
o.Status = strconv.Itoa(pkotablst[j].Status) |
|
|
|
o.Shortpack = strconv.Itoa(pkotablst[j].Shortpack) |
|
|
|
o.Orderinfo = pkotablst[j].Orderinfo |
|
|
|
o.Boxsn = pkotablst[j].Boxsn |
|
|
|
o.Packtypeid = pkotablst[j].Packtypeid |
|
|
|
o.Printerid = pkotablst[j].Printerid |
|
|
|
o.Templatefile = pkotablst[j].Templatefile |
|
|
|
o.Planqty = strconv.Itoa(pkotablst[j].Planqty) |
|
|
|
o.Actqty = strconv.Itoa(pkotablst[j].Actqty) |
|
|
|
for _, info := range pkotablst[j].Itemlst { |
|
|
|
o.Details = append(o.Details, Pln_calloffdata_landing_Xml{ |
|
|
|
Packorderid: info.Packorderid, |
|
|
|
Pos: common.ValueToString(info.Pos, ""), |
|
|
|
Poscode: info.Poscode, |
|
|
|
Oemseq: common.ValueToString(info.Oemseq, ""), |
|
|
|
Checkseq: common.ValueToString(info.Seq, ""), |
|
|
|
Supplygroupid: info.Supplygroupid, |
|
|
|
Workordernr: info.Workordernr, |
|
|
|
Status: common.ValueToString(info.Status, ""), |
|
|
|
Planqty: common.ValueToString(info.Planqty, ""), |
|
|
|
Actqty: common.ValueToString(info.Actqty, ""), |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
jsonBytes, err := json.Marshal(o) |
|
|
|
if err != nil { |
|
|
|
fmt.Println(err) |
|
|
|
} |
|
|
|
bl_xmlmsg := service.BL_Xmlmsg{MsgType: common.MSG_TYPE_SHIP, Msg: string(jsonBytes)} |
|
|
|
fmt.Println("---------------------生成xmL_msg2") |
|
|
|
if err = bl_xmlmsg.Create(session); err != nil { |
|
|
|
fmt.Println(err) |
|
|
|
} |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
func CallOffXmlTick(XmlFolder string){ |
|
|
|
timer := time.NewTicker(60 * time.Second) |
|
|
|
for { |
|
|
|
select { |
|
|
@ -776,7 +784,7 @@ func CallOffXmlTick(){ |
|
|
|
} |
|
|
|
timeS := time.Now().Format("20060102150405.999") |
|
|
|
fileName := strings.Trim(timeS,".") |
|
|
|
f, err := os.Create("./OutData/"+fileName +".xml") |
|
|
|
f, err := os.Create(XmlFolder+"/"+fileName +".xml") |
|
|
|
if err != nil { |
|
|
|
glog.InfoExtln("Calloff包装单", "Failed to create xml due to :",err) |
|
|
|
} |
|
|
|