diff --git a/calloff/Callofftask.go b/calloff/Callofftask.go index d0f0d60..1ce92fc 100644 --- a/calloff/Callofftask.go +++ b/calloff/Callofftask.go @@ -15,7 +15,6 @@ import ( "os" "regexp" "strconv" - "strings" "time" ) @@ -743,7 +742,7 @@ func CreateXml(pkotablst []db.Jit_packorder, j int, session *xorm.Session) error Packorderid: info.Packorderid, Pos: common.ValueToString(info.Pos, ""), Poscode: info.Poscode, - Oemseq: common.ValueToString(info.Oemseq, ""), + Oemseq: common.ValueToString(common.ValueToInt(info.Oemseq, 0), ""), Checkseq: common.ValueToString(info.Seq, ""), Supplygroupid: info.Supplygroupid, Workordernr: info.Workordernr, @@ -782,8 +781,13 @@ func CallOffXmlTick(XmlFolder string){ if err != nil { glog.InfoExtln("Calloff包装单", "Failed to create xml due to :",err) } - timeS := time.Now().Format("20060102150405.999") - fileName := strings.Trim(timeS,".") + //timeS := time.Now().Format("20060102150405.000") + //fileName := strings.Trim(timeS,".") + //fileName, err := service.SN_SyncGetNextSnr2("Out") + //if err != nil { + // glog.InfoExtln("Calloff包装单", "Failed to create xml due to :",err) + //} + fileName := "Out" + xmlInfo.Msgid f, err := os.Create(XmlFolder+"/"+fileName +".xml") if err != nil { glog.InfoExtln("Calloff包装单", "Failed to create xml due to :",err) diff --git a/service/Snrtab.go b/service/Snrtab.go index 43ed8db..38f3f69 100644 --- a/service/Snrtab.go +++ b/service/Snrtab.go @@ -233,6 +233,18 @@ func SN_SyncGetNextSnr(snr string) (retsnr string, err error) { return str, nil } +func SN_SyncGetNextSnr2() (retsnr string, err error) { + tmStr := time.Now().Format("20060102150405.999999") + "000000" + str := strings.Replace(tmStr, ".", "", -1) + if len(str) < 16 { + tmStr = tmStr + common.CreateCaptchaFour() + return tmStr, err + } + str = str[:16] + str = str + common.CreateCaptchaFour() + return str, nil +} + // 获取指定序列的下一个流水号(异步获取) //func SN_SyncGetNextSnr(snr string) (retsnr string, err error) { // /* 获取锁 */ diff --git a/service/Xmlmsg.go b/service/Xmlmsg.go index 462c46c..7df1ee7 100644 --- a/service/Xmlmsg.go +++ b/service/Xmlmsg.go @@ -40,7 +40,7 @@ func (bl_xmlmsg *BL_Xmlmsg) Create(session *xorm.Session) (err error) { //} // 获取消息号 - if msgid, err = SN_SyncGetNextSnr(""); err != nil { + if msgid, err = SN_SyncGetNextSnr2(); err != nil { return }