From d8fe99ab966b2369082328548bae44c4a4b63942 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期四, 12 九月 2024 01:23:03 +0800
Subject: [PATCH] 规则维护更新

---
 Tiger.Business.MES/BIZ/BIZ_MES_WO.cs |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs b/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs
index e4039bb..6d8a48e 100644
--- a/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs
+++ b/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs
@@ -13,6 +13,7 @@
 using Microsoft.AspNetCore.Http;
 using Tiger.Model.Entitys.MES.BizMesWoBatch;
 using Tiger.Model.Entitys.MES.BizMesWo;
+using Tiger.Model.Entitys.MES.Position;
 
 namespace Tiger.Business.MES
 {
@@ -124,10 +125,10 @@
                     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==(int)BIZ_MES_WO_BATCH.STATUSs.Closed))
+                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}]鏈夋病瀹屽伐鐨勫伐鍗曟壒娆★紝涓嶈兘涓嬪彂锛�");
+                    result.LocaleMsg = new($"宸ュ崟鎵规鍦ㄧ嚎浣揫{input.WoBatch.ACT_LINE}]涓姸鎬佷负[{input.WoBatch.STATUS.GetEnumDesc<BIZ_MES_WO.STATUSs>()}]锛屼笉鑳戒笅鍙戯紒");
                     return result;
                 }
                 WoContext.RemoveBatch(input.WoBatch.BATCH_NO);
@@ -194,7 +195,7 @@
                 var db = Biz.Db;
                 var dbTran = db.UseTran(() =>
                 {
-                    db.Updateable(_wo, input.UserId).ExecuteCommand();
+                    db.Updateable(_wo, input.UserId).UpdateColumns(x => new { x.STATUS }).ExecuteCommand();
                 });
                 if (!dbTran.IsSuccess)
                 {
@@ -220,12 +221,12 @@
             var result = new ApiAction();
             try
             {
-                //淇濆瓨鍓嶇殑鍒ゆ柇,骞剁敓鎴愭壒娆″彿
-                var _wo = await Biz.Db.Queryable<BIZ_MES_WO_BATCH>().Where(x => x.BATCH_NO == input.WoBatch).FirstAsync();
-                if (_wo != null)
+                //淇濆瓨鍓嶇殑鍒ゆ柇
+                var _woBatch = await Biz.Db.Queryable<BIZ_MES_WO_BATCH>().Where(x => x.BATCH_NO == input.WoBatch).FirstAsync();
+                if (_woBatch != null)
                 {
-                    _wo.STATUS = input.Status < 0 ? _wo.STATUS : input.Status;
-                    if (input.Status == (int) BIZ_MES_WO_BATCH.STATUSs.Paused) {
+                    _woBatch.STATUS = input.Status < 0 ? _woBatch.STATUS : input.Status;
+                    if (input.Status == BIZ_MES_WO_BATCH.STATUSs.Paused.GetValue()) {
                         WoContext.RemoveBatch(input.WoBatch);
                     }
                 }
@@ -239,7 +240,7 @@
                 var db = Biz.Db;
                 var dbTran = db.UseTran(() =>
                 {
-                    db.Updateable(_wo, input.UserId).ExecuteCommand();
+                    db.Updateable(_woBatch, input.UserId).UpdateColumns(x=> new { x.STATUS}).ExecuteCommand();
                 });
                 if (!dbTran.IsSuccess)
                 {

--
Gitblit v1.9.3