|
|
@ -18,6 +18,7 @@ type CustOrders struct { |
|
|
|
Custordernr string //客户订单号
|
|
|
|
Oemordernr string //Oemordernr订单号
|
|
|
|
Oemseq string //oem订单号
|
|
|
|
Calloffnr string //oem订单号
|
|
|
|
Finr int //工厂编号
|
|
|
|
} |
|
|
|
|
|
|
@ -63,11 +64,11 @@ func CustProduct(conf *config.EnvConfig) { |
|
|
|
) |
|
|
|
//停机时间
|
|
|
|
stime := "yyyy-MM-dd 02:00:00" |
|
|
|
if !common.ValueIsEmpty(conf.Begtime){ |
|
|
|
if !common.ValueIsEmpty(conf.Begtime) { |
|
|
|
stime = conf.Begtime |
|
|
|
} |
|
|
|
etime := "yyyy-MM-dd 03:00:00" |
|
|
|
if !common.ValueIsEmpty(conf.Endtime){ |
|
|
|
if !common.ValueIsEmpty(conf.Endtime) { |
|
|
|
etime = conf.Endtime |
|
|
|
} |
|
|
|
stime = common.TimeFormat(time.Now(), stime) |
|
|
@ -148,14 +149,20 @@ func CustProduct(conf *config.EnvConfig) { |
|
|
|
|
|
|
|
if vv.Status < common.CO_STATUS_CLOSED { |
|
|
|
isOk = false |
|
|
|
glog.InfoExtln("infoShip", "workOrders:", vv.Workordernr) |
|
|
|
glog.InfoExtln("infoShip", "Status:", vv.Status) |
|
|
|
break |
|
|
|
} |
|
|
|
if vv.Shippable != 1 { |
|
|
|
glog.InfoExtln("infoShip", "workOrders:", vv.Workordernr) |
|
|
|
glog.InfoExtln("infoShip", "Shippable:", vv.Shippable) |
|
|
|
isOk = false |
|
|
|
break |
|
|
|
} |
|
|
|
if vv.Packstatus != 1 { |
|
|
|
isOk = false |
|
|
|
glog.InfoExtln("infoShip", "workOrders:", vv.Workordernr) |
|
|
|
glog.InfoExtln("infoShip", "Packstatus:", vv.Packstatus) |
|
|
|
break |
|
|
|
} |
|
|
|
|
|
|
@ -163,15 +170,21 @@ func CustProduct(conf *config.EnvConfig) { |
|
|
|
infoShip := db.Jit_shiporder_datalst{} |
|
|
|
ok, err := e.Table("jit_shiporder_datalst").Join("INNER", "jit_packorder_itemlst", "jit_packorder_itemlst.finr = jit_shiporder_datalst.finr and jit_packorder_itemlst.packorderid = jit_shiporder_datalst.packorderid").Where("jit_packorder_itemlst.finr =? and jit_packorder_itemlst.workordernr = ?", db.G_FINR, vv.Workordernr).Get(&infoShip) |
|
|
|
if !ok || err != nil { |
|
|
|
glog.InfoExtln("infoShip", "workOrders:", vv.Workordernr) |
|
|
|
glog.InfoExtln("infoShip", "err:", err) |
|
|
|
glog.InfoExtln("infoShip", "ok:", ok) |
|
|
|
isOk = false |
|
|
|
break |
|
|
|
} |
|
|
|
if infoShip.Status < common.CO_STATUS_CLOSED { |
|
|
|
glog.InfoExtln("infoShip", "workOrders:", vv.Workordernr) |
|
|
|
glog.InfoExtln("infoShip", "infoShip.Status:", infoShip.Status) |
|
|
|
isOk = false |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
if !isOk { |
|
|
|
glog.InfoExtln("infoShip", "Custordernr:", v.Custordernr) |
|
|
|
//验证不通过
|
|
|
|
continue |
|
|
|
} |
|
|
@ -996,14 +1009,18 @@ func Archive_Pln_workorder(custorder CustOrders) { |
|
|
|
//备份:Jit_shiporder
|
|
|
|
func ArchiveJit_shiporder(conf *config.EnvConfig) { |
|
|
|
for { |
|
|
|
|
|
|
|
if !conf.Shiptog { |
|
|
|
fmt.Println("stop ArchiveJit_shiporder!") |
|
|
|
time.Sleep(1 * time.Hour) |
|
|
|
continue |
|
|
|
} |
|
|
|
//停机时间
|
|
|
|
stime := "yyyy-MM-dd 02:00:00" |
|
|
|
if !common.ValueIsEmpty(conf.Begtime){ |
|
|
|
if !common.ValueIsEmpty(conf.Begtime) { |
|
|
|
stime = conf.Begtime |
|
|
|
} |
|
|
|
etime := "yyyy-MM-dd 03:00:00" |
|
|
|
if !common.ValueIsEmpty(conf.Endtime){ |
|
|
|
if !common.ValueIsEmpty(conf.Endtime) { |
|
|
|
etime = conf.Endtime |
|
|
|
} |
|
|
|
stime = common.TimeFormat(time.Now(), stime) |
|
|
@ -1021,35 +1038,33 @@ func ArchiveJit_shiporder(conf *config.EnvConfig) { |
|
|
|
var ( |
|
|
|
err error |
|
|
|
oneWeek time.Time |
|
|
|
archive db.Pln_custorder_archive |
|
|
|
shiporderids []string |
|
|
|
) |
|
|
|
e := db.G_DbEngine |
|
|
|
s := db.G_DbSalve |
|
|
|
//查询缓存记录表
|
|
|
|
cust, err := archive.SelectAll() |
|
|
|
if err != nil { |
|
|
|
glog.InfoExtln("调度生成终止", "cust is error!") |
|
|
|
return |
|
|
|
} |
|
|
|
for _, v := range cust { |
|
|
|
shiporderids = append(shiporderids, v.Custordernr) |
|
|
|
} |
|
|
|
|
|
|
|
data := make([]db.Jit_shiporder, 0) |
|
|
|
//获取七天前的字符串
|
|
|
|
if common.ValueIsEmpty(conf.Day) { |
|
|
|
oneWeek = time.Now().AddDate(0, 0, -14) |
|
|
|
oneWeek = time.Now().AddDate(0, 0, -30) |
|
|
|
} else { |
|
|
|
oneWeek = time.Now().AddDate(0, 0, -conf.Day) |
|
|
|
oneWeek = time.Now().AddDate(0, 0, -(conf.Day + 30)) |
|
|
|
} |
|
|
|
oneWeekStr := common.TimeFormat(oneWeek, "yyyyMMddHHmmss") |
|
|
|
//查询出订单状态是80,并且是七天前的客户订单的信息,每次查询10条
|
|
|
|
err = e.Table("jit_shiporder").NotIn("shiporderid", shiporderids).Where("status = ? and credatuz <= ?", common.CO_STATUS_CLOSED, oneWeekStr).Desc("credatuz").Limit(10).Find(&data) |
|
|
|
err = e.Table("jit_shiporder").Where("status = ? and credatuz <= ?", common.CO_STATUS_CLOSED, oneWeekStr).Desc("credatuz").Limit(10).Find(&data) |
|
|
|
if err != nil { |
|
|
|
glog.InfoExtln("调度生成终止", "err : ", err) |
|
|
|
return |
|
|
|
} |
|
|
|
for _, v := range data { |
|
|
|
|
|
|
|
packlst := make([]db.Jit_packorder, 0) |
|
|
|
//判断对应的包装单是否全部导出
|
|
|
|
err = e.Table("jit_packorder").Join("INNER","jit_shiporder_datalst","jit_packorder.finr = jit_shiporder_datalst.finr and jit_packorder.packorderid = jit_shiporder_datalst.packorderid").Where("jit_shiporder_datalst.finr = ? and jit_shiporder_datalst.shiporderid = ?", db.G_FINR, v.Shiporderid).Find(&packlst) |
|
|
|
if len(packlst) > 0{ |
|
|
|
glog.InfoExtln("archive数据jit_packorder", "Jit_packorder:","对应的包装单没有全部导出!",v.Shiporderid) |
|
|
|
continue |
|
|
|
} |
|
|
|
itemlst := make([]db.Jit_shiporder_itemlst, 0) |
|
|
|
datalst := make([]db.Jit_shiporder_datalst, 0) |
|
|
|
var delitemlst db.Jit_shiporder_itemlst |
|
|
@ -1330,14 +1345,18 @@ func ArchivePln_pickorder(conf *config.EnvConfig) { |
|
|
|
//备份:jit_packorder
|
|
|
|
func ArchiveJit_packorder(conf *config.EnvConfig) { |
|
|
|
for { |
|
|
|
|
|
|
|
if !conf.Packtog { |
|
|
|
fmt.Println("stop ArchiveJit_packorder!") |
|
|
|
time.Sleep(1 * time.Hour) |
|
|
|
continue |
|
|
|
} |
|
|
|
//停机时间
|
|
|
|
stime := "yyyy-MM-dd 02:00:00" |
|
|
|
if !common.ValueIsEmpty(conf.Begtime){ |
|
|
|
if !common.ValueIsEmpty(conf.Begtime) { |
|
|
|
stime = conf.Begtime |
|
|
|
} |
|
|
|
etime := "yyyy-MM-dd 03:00:00" |
|
|
|
if !common.ValueIsEmpty(conf.Endtime){ |
|
|
|
if !common.ValueIsEmpty(conf.Endtime) { |
|
|
|
etime = conf.Endtime |
|
|
|
} |
|
|
|
stime = common.TimeFormat(time.Now(), stime) |
|
|
@ -1361,9 +1380,9 @@ func ArchiveJit_packorder(conf *config.EnvConfig) { |
|
|
|
data := make([]db.Jit_packorder, 0) |
|
|
|
//获取七天前的字符串
|
|
|
|
if common.ValueIsEmpty(conf.Day) { |
|
|
|
oneWeek = time.Now().AddDate(0, 0, -14) |
|
|
|
oneWeek = time.Now().AddDate(0, 0, -30) |
|
|
|
} else { |
|
|
|
oneWeek = time.Now().AddDate(0, 0, -conf.Day) |
|
|
|
oneWeek = time.Now().AddDate(0, 0, -(conf.Day + 30)) |
|
|
|
} |
|
|
|
|
|
|
|
oneWeekStr := common.TimeFormat(oneWeek, "yyyyMMddHHmmss") |
|
|
@ -1378,6 +1397,15 @@ func ArchiveJit_packorder(conf *config.EnvConfig) { |
|
|
|
continue |
|
|
|
} |
|
|
|
for _, v := range data { |
|
|
|
|
|
|
|
wolst := make([]db.Pln_workorder, 0) |
|
|
|
//判断对应的工单是否全部导出
|
|
|
|
err = e.Table("pln_workorder").Join("INNER","jit_packorder_itemlst","pln_workorder.finr = jit_packorder_itemlst.finr and pln_workorder.workordernr = jit_packorder_itemlst.workordernr").Where("jit_packorder_itemlst.finr = ? and jit_packorder_itemlst.packorderid = ?", db.G_FINR, v.Packorderid).Find(&wolst) |
|
|
|
if len(wolst) > 0{ |
|
|
|
glog.InfoExtln("archive数据jit_packorder", "pln_workorder:","对应的工单没有全部导出!",v.Packorderid) |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
|
itemlst := make([]db.Jit_packorder_itemlst, 0) |
|
|
|
var delitemlst db.Jit_packorder_itemlst |
|
|
|
var deldata db.Jit_shiporder |
|
|
@ -1479,163 +1507,165 @@ func ArchiveJit_packorder(conf *config.EnvConfig) { |
|
|
|
|
|
|
|
//删除一个礼拜前的打印消息
|
|
|
|
func DelPrinterInfo(conf *config.EnvConfig) { |
|
|
|
tick := time.Tick(10 * time.Second) |
|
|
|
for { |
|
|
|
select { |
|
|
|
case <-tick: |
|
|
|
stime := "yyyy-MM-dd 02:00:00" |
|
|
|
if !common.ValueIsEmpty(conf.Begtime){ |
|
|
|
stime = conf.Begtime |
|
|
|
} |
|
|
|
etime := "yyyy-MM-dd 03:00:00" |
|
|
|
if !common.ValueIsEmpty(conf.Endtime){ |
|
|
|
etime = conf.Endtime |
|
|
|
} |
|
|
|
stime = common.TimeFormat(time.Now(), stime) |
|
|
|
etime = common.TimeFormat(time.Now(), etime) |
|
|
|
//停机时间
|
|
|
|
timeLayout := "2006-01-02 15:04:05" |
|
|
|
loc, _ := time.LoadLocation("Local") |
|
|
|
timeStart, _ := time.ParseInLocation(timeLayout, stime, loc) |
|
|
|
timeEnd, _ := time.ParseInLocation(timeLayout, etime, loc) |
|
|
|
now := time.Now() |
|
|
|
fmt.Println(timeStart) |
|
|
|
fmt.Println(timeEnd) |
|
|
|
if now.After(timeEnd) || now.Before(timeStart) { |
|
|
|
fmt.Println("不在处理时间内!") |
|
|
|
time.Sleep(60 * time.Second) |
|
|
|
continue |
|
|
|
} |
|
|
|
var ( |
|
|
|
err error |
|
|
|
oneWeek time.Time |
|
|
|
) |
|
|
|
e := db.G_DbEngine |
|
|
|
s := db.G_DbSalve |
|
|
|
data := make([]db.Printheadtab, 0) |
|
|
|
//获取七天前的字符串
|
|
|
|
if common.ValueIsEmpty(conf.Day) { |
|
|
|
oneWeek = time.Now().AddDate(0, 0, -14) |
|
|
|
} else { |
|
|
|
oneWeek = time.Now().AddDate(0, 0, -conf.Day) |
|
|
|
} |
|
|
|
stime := "yyyy-MM-dd 02:00:00" |
|
|
|
if !common.ValueIsEmpty(conf.Begtime) { |
|
|
|
stime = conf.Begtime |
|
|
|
} |
|
|
|
etime := "yyyy-MM-dd 03:00:00" |
|
|
|
if !common.ValueIsEmpty(conf.Endtime) { |
|
|
|
etime = conf.Endtime |
|
|
|
} |
|
|
|
stime = common.TimeFormat(time.Now(), stime) |
|
|
|
etime = common.TimeFormat(time.Now(), etime) |
|
|
|
//停机时间
|
|
|
|
timeLayout := "2006-01-02 15:04:05" |
|
|
|
loc, _ := time.LoadLocation("Local") |
|
|
|
timeStart, _ := time.ParseInLocation(timeLayout, stime, loc) |
|
|
|
timeEnd, _ := time.ParseInLocation(timeLayout, etime, loc) |
|
|
|
now := time.Now() |
|
|
|
fmt.Println(timeStart) |
|
|
|
fmt.Println(timeEnd) |
|
|
|
if now.After(timeEnd) || now.Before(timeStart) { |
|
|
|
fmt.Println("the time is not start!") |
|
|
|
time.Sleep(60 * time.Second) |
|
|
|
continue |
|
|
|
} |
|
|
|
fmt.Println("start capy data!") |
|
|
|
var ( |
|
|
|
err error |
|
|
|
oneWeek time.Time |
|
|
|
) |
|
|
|
e := db.G_DbEngine |
|
|
|
s := db.G_DbSalve |
|
|
|
data := make([]db.Printheadtab, 0) |
|
|
|
//获取七天前的字符串
|
|
|
|
if common.ValueIsEmpty(conf.Day) { |
|
|
|
oneWeek = time.Now().AddDate(0, 0, -14) |
|
|
|
} else { |
|
|
|
oneWeek = time.Now().AddDate(0, 0, -conf.Day) |
|
|
|
} |
|
|
|
|
|
|
|
oneWeekStr := common.TimeFormat(oneWeek, "yyyyMMddHHmmss") |
|
|
|
fmt.Println() |
|
|
|
fmt.Printf("备份时间:%v", oneWeekStr) |
|
|
|
fmt.Println() |
|
|
|
//查询出订单状态是80,并且是七天前的客户订单的信息,每次查询10条
|
|
|
|
|
|
|
|
oneWeekStr := common.TimeFormat(oneWeek, "yyyyMMddHHmmss") |
|
|
|
//查询出订单状态是80,并且是七天前的客户订单的信息,每次查询10条
|
|
|
|
//查询status = 'C' ,并且是七天前的数据
|
|
|
|
err = e.Table("printheadtab").Where("finr = ? and status = ? and credatuz < ?", db.G_FINR, "C", oneWeekStr).Limit(50).Find(&data) |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
//查询status = 'C' ,并且是七天前的数据
|
|
|
|
err = e.Table("printheadtab").Where("finr = ? and status = ? and credatuz < ?", db.G_FINR, "C", oneWeekStr).Limit(50).Find(&data) |
|
|
|
if len(data) == 0 { |
|
|
|
time.Sleep(60 * time.Second) |
|
|
|
continue |
|
|
|
} |
|
|
|
for _, v := range data { |
|
|
|
//转义为json
|
|
|
|
jsondata, err := json.Marshal(&v) |
|
|
|
if err != nil { |
|
|
|
info := new(db.Pln_custorder_archive_error) |
|
|
|
info.Tablename = "printheadtab" |
|
|
|
info.Errorinfo = err.Error() |
|
|
|
info.Add() |
|
|
|
glog.InfoExtln("archive数据printheadtab", "err:", err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if len(data) == 0 { |
|
|
|
time.Sleep(60 * time.Second) |
|
|
|
continue |
|
|
|
} |
|
|
|
for _, v := range data { |
|
|
|
//转义为json
|
|
|
|
jsondata, err := json.Marshal(&v) |
|
|
|
//判断是否需要备份
|
|
|
|
if strings.TrimSpace(v.Printobjtype) == conf.Printobjtype { |
|
|
|
//备份数据
|
|
|
|
InfoLog := new(db.TableDataInfoLog) |
|
|
|
InfoLog.Servername = "Archive_printheadtab" |
|
|
|
InfoLog.Tablename = "printheadtab" |
|
|
|
InfoLog.Pkname = v.Printheadid |
|
|
|
InfoLog.Message = string(jsondata) |
|
|
|
InfoLog.Createtime = common.TimeFormat(time.Now(), "yyyyMMddHHmmss") |
|
|
|
InfoLog.InsertRecord() |
|
|
|
//查询是否存在
|
|
|
|
//导出
|
|
|
|
_, err = s.Table("printheadtab").Insert(&v) |
|
|
|
if err != nil { |
|
|
|
info := new(db.Pln_custorder_archive_error) |
|
|
|
info.Tablename = "printheadtab" |
|
|
|
info.Errorinfo = err.Error() |
|
|
|
info.Add() |
|
|
|
glog.InfoExtln("archive数据printheadtab", "err:", err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
//判断是否需要备份
|
|
|
|
if strings.TrimSpace(v.Printobjtype) == conf.Printobjtype { |
|
|
|
//备份数据
|
|
|
|
InfoLog := new(db.TableDataInfoLog) |
|
|
|
InfoLog.Servername = "Archive_printheadtab" |
|
|
|
InfoLog.Tablename = "printheadtab" |
|
|
|
InfoLog.Pkname = v.Printheadid |
|
|
|
InfoLog.Message = string(jsondata) |
|
|
|
InfoLog.Createtime = common.TimeFormat(time.Now(), "yyyyMMddHHmmss") |
|
|
|
InfoLog.InsertRecord() |
|
|
|
//导出
|
|
|
|
_, err = s.Table("printheadtab").Insert(&v) |
|
|
|
if err != nil { |
|
|
|
info := new(db.Pln_custorder_archive_error) |
|
|
|
info.Tablename = "printheadtab" |
|
|
|
info.Errorinfo = err.Error() |
|
|
|
info.Add() |
|
|
|
glog.InfoExtln("archive数据printheadtab", "err:", err.Error()) |
|
|
|
continue |
|
|
|
} |
|
|
|
itemlst := make([]db.Printdetailtab, 0) |
|
|
|
//查询(printdetailtab)
|
|
|
|
err = e.Table("printdetailtab").Where("finr = ? and printheadid = ?", db.G_FINR, v.Printheadid).Find(&itemlst) |
|
|
|
if err != nil { |
|
|
|
info := new(db.Pln_custorder_archive_error) |
|
|
|
info.Tablename = "printdetailtab" |
|
|
|
info.Errorinfo = err.Error() |
|
|
|
info.Add() |
|
|
|
glog.InfoExtln("archive数据printdetailtab", "err:", err.Error()) |
|
|
|
continue |
|
|
|
} |
|
|
|
//转义为json
|
|
|
|
jsonitemlst, err := json.Marshal(&itemlst) |
|
|
|
if err != nil { |
|
|
|
info := new(db.Pln_custorder_archive_error) |
|
|
|
info.Tablename = "printdetailtab" |
|
|
|
info.Errorinfo = err.Error() |
|
|
|
info.Add() |
|
|
|
glog.InfoExtln("archive数据printdetailtab", "err:", err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
//备份数据
|
|
|
|
InfoLog1 := new(db.TableDataInfoLog) |
|
|
|
InfoLog1.Servername = "Archive_printdetailtab" |
|
|
|
InfoLog1.Tablename = "printdetailtab" |
|
|
|
InfoLog1.Pkname = v.Printheadid |
|
|
|
InfoLog1.Message = string(jsonitemlst) |
|
|
|
InfoLog1.Createtime = common.TimeFormat(time.Now(), "yyyyMMddHHmmss") |
|
|
|
InfoLog1.InsertRecord() |
|
|
|
//导出
|
|
|
|
_, err = s.Table("printdetailtab").Insert(&itemlst) |
|
|
|
if err != nil { |
|
|
|
info := new(db.Pln_custorder_archive_error) |
|
|
|
info.Tablename = "printdetailtab" |
|
|
|
info.Errorinfo = err.Error() |
|
|
|
info.Add() |
|
|
|
glog.InfoExtln("archive数据printdetailtab", "err:", err.Error()) |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
|
//删除数据
|
|
|
|
_, err = e.Table("printheadtab").Where("finr = ? and printheadid = ?", db.G_FINR, v.Printheadid).Delete(&db.Printheadtab{}) |
|
|
|
itemlst := make([]db.Printdetailtab, 0) |
|
|
|
//查询(printdetailtab)
|
|
|
|
err = e.Table("printdetailtab").Where("finr = ? and printheadid = ?", db.G_FINR, v.Printheadid).Find(&itemlst) |
|
|
|
if err != nil { |
|
|
|
info := new(db.Pln_custorder_archive_error) |
|
|
|
info.Tablename = "printheadtab" |
|
|
|
info.Tablename = "printdetailtab" |
|
|
|
info.Errorinfo = err.Error() |
|
|
|
info.Add() |
|
|
|
glog.InfoExtln("archive数据printheadtab", "err:", err.Error()) |
|
|
|
glog.InfoExtln("archive数据printdetailtab", "err:", err.Error()) |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
|
//删除数据
|
|
|
|
_, err = e.Table("printdetailtab").Where("finr = ? and printheadid = ?", db.G_FINR, v.Printheadid).Delete(&db.Printdetailtab{}) |
|
|
|
//转义为json
|
|
|
|
jsonitemlst, err := json.Marshal(&itemlst) |
|
|
|
if err != nil { |
|
|
|
info := new(db.Pln_custorder_archive_error) |
|
|
|
info.Tablename = "printdetailtab" |
|
|
|
info.Errorinfo = err.Error() |
|
|
|
info.Add() |
|
|
|
glog.InfoExtln("archive数据printdetailtab", "err:", err.Error()) |
|
|
|
continue |
|
|
|
return |
|
|
|
} |
|
|
|
//备份数据
|
|
|
|
InfoLog1 := new(db.TableDataInfoLog) |
|
|
|
InfoLog1.Servername = "Archive_printdetailtab" |
|
|
|
InfoLog1.Tablename = "printdetailtab" |
|
|
|
InfoLog1.Pkname = v.Printheadid |
|
|
|
InfoLog1.Message = string(jsonitemlst) |
|
|
|
InfoLog1.Createtime = common.TimeFormat(time.Now(), "yyyyMMddHHmmss") |
|
|
|
InfoLog1.InsertRecord() |
|
|
|
//导出
|
|
|
|
for _, vv := range itemlst { |
|
|
|
_, err = s.Table("printdetailtab").Insert(&vv) |
|
|
|
if err != nil { |
|
|
|
info := new(db.Pln_custorder_archive_error) |
|
|
|
info.Tablename = "printdetailtab" |
|
|
|
info.Errorinfo = err.Error() |
|
|
|
info.Add() |
|
|
|
glog.InfoExtln("archive数据printdetailtab", "err:", err.Error()) |
|
|
|
continue |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//删除数据
|
|
|
|
_, err = e.Table("printheadtab").Where("finr = ? and printheadid = ?", db.G_FINR, v.Printheadid).Delete(&db.Printheadtab{}) |
|
|
|
if err != nil { |
|
|
|
info := new(db.Pln_custorder_archive_error) |
|
|
|
info.Tablename = "printheadtab" |
|
|
|
info.Errorinfo = err.Error() |
|
|
|
info.Add() |
|
|
|
glog.InfoExtln("archive数据printheadtab", "err:", err.Error()) |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
|
//删除数据
|
|
|
|
_, err = e.Table("printdetailtab").Where("finr = ? and printheadid = ?", db.G_FINR, v.Printheadid).Delete(&db.Printdetailtab{}) |
|
|
|
if err != nil { |
|
|
|
info := new(db.Pln_custorder_archive_error) |
|
|
|
info.Tablename = "printdetailtab" |
|
|
|
info.Errorinfo = err.Error() |
|
|
|
info.Add() |
|
|
|
glog.InfoExtln("archive数据printdetailtab", "err:", err.Error()) |
|
|
|
continue |
|
|
|
} |
|
|
|
time.Sleep(1 * time.Second) |
|
|
|
|
|
|
|
} |
|
|
|
time.Sleep(10 * time.Second) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//备份(pln_calloffdata_landing)
|
|
|
|
func Archive_Pln_calloffdata_landing(custorder CustOrders) { |
|
|
@ -1647,7 +1677,7 @@ func Archive_Pln_calloffdata_landing(custorder CustOrders) { |
|
|
|
s := db.G_DbSalve |
|
|
|
data := make([]db.Pln_calloffdata_landing, 0) |
|
|
|
//查询出客户订单状态是80,并且是七天前的客户订单的信息,每次查询10条
|
|
|
|
err = e.Table("pln_calloffdata_landing").Where("finr = ? and oemordernr = ?", db.G_FINR, custorder.Oemordernr).Find(&data) |
|
|
|
err = e.Table("pln_calloffdata_landing").Where("finr = ? and calloffnr = ?", db.G_FINR, custorder.Calloffnr).Find(&data) |
|
|
|
if err != nil { |
|
|
|
info := new(db.Pln_custorder_archive_error) |
|
|
|
info.Tablename = "pln_calloffdata_landing" |
|
|
@ -1673,7 +1703,7 @@ func Archive_Pln_calloffdata_landing(custorder CustOrders) { |
|
|
|
InfoLog := new(db.TableDataInfoLog) |
|
|
|
InfoLog.Servername = "Archive_pln_calloffdata_landing" |
|
|
|
InfoLog.Tablename = "pln_calloffdata_landing" |
|
|
|
InfoLog.Pkname = common.ValueToString(v.Calloffnr,"") |
|
|
|
InfoLog.Pkname = common.ValueToString(v.Calloffnr, "") |
|
|
|
InfoLog.Message = string(jsondata) |
|
|
|
InfoLog.Createtime = common.TimeFormat(time.Now(), "yyyyMMddHHmmss") |
|
|
|
InfoLog.InsertRecord() |
|
|
@ -1703,4 +1733,4 @@ func Archive_Pln_calloffdata_landing(custorder CustOrders) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |