From 7597357e268f6ecf19b50a122e42ccb896295329 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期四, 26 九月 2024 00:48:38 +0800
Subject: [PATCH] 过程变量更新

---
 Tiger.Business.MES/BIZ/BIZ_MES_WO.cs |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs b/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs
index b225414..517c4f6 100644
--- a/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs
+++ b/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs
@@ -127,7 +127,7 @@
                     result.LocaleMsg = new($"宸ュ崟涓嬪彂鐨勬暟閲忚秴杩囧伐鍗曡鍒掓暟閲忥紝涓嶈兘涓嬪彂锛�");
                     return result;
                 }
-                if (Biz.Db.Queryable<BIZ_MES_WO_BATCH>().Any(x => x.ORDER_NO == input.Wo.ORDER_NO && x.ACT_LINE == input.WoBatch.ACT_LINE && x.STATUS> BIZ_MES_WO.STATUSs.Imported.GetValue() && x.STATUS< BIZ_MES_WO.STATUSs.Closed.GetValue()))
+                if (Biz.Db.Queryable<BIZ_MES_WO_BATCH>().Any(x => x.ORDER_NO == input.Wo.ORDER_NO && x.ACT_LINE == input.WoBatch.ACT_LINE && x.STATUS > BIZ_MES_WO.STATUSs.Imported.GetValue() && x.STATUS < BIZ_MES_WO.STATUSs.Closed.GetValue()))
                 {
                     result.IsSuccessed = false;
                     result.LocaleMsg = new($"宸ュ崟鎵规鍦ㄧ嚎浣揫{input.WoBatch.ACT_LINE}]涓姸鎬佷负[{input.WoBatch.STATUS.GetEnumDesc<BIZ_MES_WO.STATUSs>()}]锛屼笉鑳戒笅鍙戯紒");
@@ -228,7 +228,8 @@
                 if (_woBatch != null)
                 {
                     _woBatch.STATUS = input.Status < 0 ? _woBatch.STATUS : input.Status;
-                    if (input.Status == BIZ_MES_WO_BATCH.STATUSs.Paused.GetValue()) {
+                    if (input.Status == BIZ_MES_WO_BATCH.STATUSs.Paused.GetValue())
+                    {
                         WoContext.RemoveBatch(input.WoBatch);
                     }
                 }
@@ -242,7 +243,7 @@
                 var db = Biz.Db;
                 var dbTran = db.UseTran(() =>
                 {
-                    db.Updateable(_woBatch, input.UserId).UpdateColumns(x=> new { x.STATUS}).ExecuteCommand();
+                    db.Updateable(_woBatch, input.UserId).UpdateColumns(x => new { x.STATUS }).ExecuteCommand();
                 });
                 if (!dbTran.IsSuccess)
                 {
@@ -274,7 +275,14 @@
                     result.LocaleMsg = new($"宸ュ崟鍙蜂笉鑳戒负绌猴紒");
                     return result;
                 }
-
+                List<BAS_LABEL_VAR_WO> varWoList = new();
+                if (File.Exists(input.LABEL_VIEW_PATH))
+                {
+                    string imageFileName = Path.GetFileNameWithoutExtension(input.LABEL_VIEW_PATH);
+                    string? path = Path.GetDirectoryName(input.LABEL_VIEW_PATH);
+                    input.LABEL_VIEW_PATH = $"{path}//Temp//{imageFileName}.png";
+                    varWoList = await Biz.Db.Queryable<BAS_LABEL_VAR_WO>().Where(x => x.LABEL_ID == input.LABEL_ID && x.WORK_ORDER == input.WORK_ORDER).ToListAsync();
+                }
                 var db = Biz.Db;
                 var dbTran = db.UseTran(() =>
                 {
@@ -283,6 +291,11 @@
                        .ToStorage();
                     y.AsInsertable.ExecuteCommand();
                     y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand();
+
+                    if (varWoList.Count > 0)
+                    {
+                        db.Updateable(varWoList).UpdateColumns(q => q.LABEL_VIEW_PATH).ExecuteCommand();
+                    }
                 });
                 if (!dbTran.IsSuccess)
                 {
@@ -294,7 +307,7 @@
             {
                 result.CatchExceptionWithLog(ex, "鏇存柊宸ュ崟妯℃澘鍙橀噺寮傚父");
             }
-            return await Task.FromResult(result);
+            return result;
         }
 
         /// <summary>
@@ -315,7 +328,8 @@
                     return result;
                 }
                 var labeltemp = Biz.Db.Queryable<BAS_LABEL_TEMP>().Where(q => q.LABEL_CODE.Equals(input.LabelId) || q.ID.Equals(input.LabelId)).First();
-                if (labeltemp == null) {
+                if (labeltemp == null)
+                {
                     result.IsSuccessed = false;
                     result.LocaleMsg = new($"妯℃澘涓嶅瓨鍦紒");
                     return result;

--
Gitblit v1.9.3