From 13319c7cf3ada03aae0313f82d1da2c05ac581b6 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期三, 30 十月 2024 14:54:56 +0800 Subject: [PATCH] U9C视图实体更新 --- Tiger.Business/MES/Biz.Route.cs | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 51 insertions(+), 3 deletions(-) diff --git a/Tiger.Business/MES/Biz.Route.cs b/Tiger.Business/MES/Biz.Route.cs index 2e6c16b..f1f4a08 100644 --- a/Tiger.Business/MES/Biz.Route.cs +++ b/Tiger.Business/MES/Biz.Route.cs @@ -14,6 +14,7 @@ using Tiger.Model.Entitys.WMS.DTOS; using static Tiger.Model.BIZ_MES_WO; using Tiger.Model.Entitys.MES.Position; +using System.Security.Cryptography; namespace Tiger.Business { @@ -521,9 +522,9 @@ expableOper.And(x => x.ROT_ID == item.ID); } } - - expable.And(x => x.PROD_CODE == input.prodCode && x.CUST_CODE == input.custCode); - expableOper.And(x => x.PROD_CODE == input.prodCode && x.CUST_CODE == input.custCode); + string _custCode = input.custCode ?? ""; + expable.And(x => x.PROD_CODE == input.prodCode && (x.CUST_CODE == _custCode)); + expableOper.And(x => x.PROD_CODE == input.prodCode && x.CUST_CODE == _custCode); var exp = expable.ToExpression(); var expOper = expableOper.ToExpression(); @@ -990,6 +991,53 @@ } return result; } + + /// <summary> + /// 娣诲姞宸ュ崟宸ヨ壓璺嚎 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + public async Task<ApiAction> ProdRouteToWo(WoRotInput input) + { + var result = new ApiAction(); + try + { + //淇濆瓨鍓嶅垽鏂� + if (Db.Queryable<BIZ_MES_WO>().Any(x => x.ORDER_NO == input.wo && x.STATUS > STATUSs.Init.GetValue() && x.STATUS < STATUSs.Closed.GetValue())) { + + result.IsSuccessed = false; + result.LocaleMsg = new($"宸ュ崟[{input.wo}]鐘舵�佷笉鏄垵濮嬪寲鎴栬�呭畬鎴愶紝涓嶅彲浠ヤ慨鏀瑰伐鑹鸿矾绾匡紒"); + return result; + } + + var wo = await Db.Queryable<BIZ_MES_WO>().Where(x => x.ORDER_NO == input.wo).FirstAsync(); + wo.ROUTE_STATUS = ROUTE_STATUSs.Finish.GetValue(); + + SugarParameter[] pars = Biz.Db.Ado.GetParameters(new { ROT_ID = input.rotId, WO = input.wo, ERR_CODE = 0, ERR_MSG = "" }); + pars[2].Direction = System.Data.ParameterDirection.Output; + pars[3].Direction = System.Data.ParameterDirection.Output; + Biz.Db.Ado.UseStoredProcedure().ExecuteCommand("SP_MES_PROD2WO", pars); + result.Data = pars[2].Value; + result.IsSuccessed = pars[2].Value.ToInt32() == 0 ? true : false; + result.LocaleMsg = new(pars[3].Value.ToString()); + + var db = Db; + var dbTran = db.UseTran(() => + { + db.Updateable(wo, input.userId).UpdateColumns(x => new { x.ROUTE_STATUS, x.UPDATE_USER, x.UPDATE_TIME }).ExecuteCommand(); + }); + if (!dbTran.IsSuccess) + { + result.IsSuccessed = false; + result.LocaleMsg = new($"娣诲姞宸ュ崟宸ヨ壓璺嚎寮傚父"); + } + } + catch (Exception ex) + { + result.CatchExceptionWithLog(ex, "娣诲姞宸ュ崟宸ヨ壓璺嚎寮傚父"); + } + return result; + } } //endClass Route } //endClass Biz } -- Gitblit v1.9.3