From 3e723b8c4227f00a2e3879a33665b88c13a22983 Mon Sep 17 00:00:00 2001 From: yehongyang Date: Wed, 29 Dec 2021 14:54:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A1=E5=88=92=E5=8F=91=E5=B8=83=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E5=90=8E=E4=B8=8D=E8=BF=9B=E8=A1=8C=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PlanOrderVersion.service.impl.go | 23 +++++++++++-------- task/bindCustomer/main.go | 17 ++++++++++++++ 2 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 task/bindCustomer/main.go diff --git a/services/ap/implments/PlanOrderVersion.service.impl.go b/services/ap/implments/PlanOrderVersion.service.impl.go index 2d8958f..fafbccf 100644 --- a/services/ap/implments/PlanOrderVersion.service.impl.go +++ b/services/ap/implments/PlanOrderVersion.service.impl.go @@ -135,7 +135,7 @@ func (impl *PlanOrderVersionServiceImplement) Publish(info utils.ChannelsInfo) ( session := engine.NewSession() defer func() { //在panic前声明defer,能捕获异常 if err := recover(); err != nil { - innerLog, _ := logger.NewLogger("system", "planOrderVersion_cancel") + innerLog, _ := logger.NewLogger("system", "plan") innerLog.Debug("系统异常:", err) } }() @@ -164,17 +164,11 @@ func (impl *PlanOrderVersionServiceImplement) Publish(info utils.ChannelsInfo) ( //TODO ids := "" _init := utilService.PLN_PLANORDER_Init() + iserr := false for _, v := range detailList { _ids, err := _init.Save(v.PlantNr, "system", &v, &alldata_Article) if err != nil || _ids == "" { - //删除计划订单 并停止程序将状态修改为100 并且删除之前创建订单 - if ids != "" { - _ = _init.Delete(ids) - } - entity.Status = 100 - _ = dao.UpdateOne(&entity) - _ = session.Commit() - panic(err) + iserr = true } else { if ids != "" { ids += "," @@ -182,6 +176,17 @@ func (impl *PlanOrderVersionServiceImplement) Publish(info utils.ChannelsInfo) ( ids += _ids } } + if iserr { + ////删除计划订单 并停止程序将状态修改为100 并且删除之前创建订单 + //if ids != "" { + // _ = _init.Delete(ids) + //} + entity.Operator = ids + entity.Status = 100 + _ = dao.UpdateOne(&entity) + _ = session.Commit() + panic("回滚异常") + } //查询物料 entity.Status = 80 entity.Operator = ids diff --git a/task/bindCustomer/main.go b/task/bindCustomer/main.go new file mode 100644 index 0000000..dbf9f81 --- /dev/null +++ b/task/bindCustomer/main.go @@ -0,0 +1,17 @@ +package main + +import ( + "fmt" + "leit.com/LAPP_CHEERSSON_BACKEND/task" +) + +func main() { + err, taskVal := task.EtlTaskArticleInit() + if err != nil { + fmt.Println(err) + return + } + task.BindCustomer(taskVal) + fmt.Println("OK") + return +}