From 4e7803e64656655103a96c4e426bf1bf2563e3f7 Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期四, 24 十月 2024 11:26:25 +0800 Subject: [PATCH] Merge branch 'master' of http://47.115.28.255:8110/r/TigerClouds-Tech/Server/TigerApi6_2024 --- Tiger.Business.MES/BIZ/BIZ_MES_WO.cs | 54 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 47 insertions(+), 7 deletions(-) diff --git a/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs b/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs index a9e64a7..b62afc1 100644 --- a/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs +++ b/Tiger.Business.MES/BIZ/BIZ_MES_WO.cs @@ -329,27 +329,34 @@ try { //淇濆瓨鍓嶇殑鍒ゆ柇 - if (input.WORK_ORDER.IsNullOrEmpty()) + if (input.WORK_ORDER.IsNullOrEmpty() && input.PROD_CODE.IsNullOrEmpty()) { result.IsSuccessed = false; - result.LocaleMsg = new($"宸ュ崟鍙蜂笉鑳戒负绌猴紒"); + result.LocaleMsg = new($"宸ュ崟鍙锋垨鑰呬骇鍝佺紪鐮佷笉鑳戒负绌猴紒"); return result; } List<BAS_LABEL_VAR_WO> varWoList = new(); string imageFileName = Path.GetFileNameWithoutExtension(input.LABEL_VIEW_PATH); - string path = @$"{BizConfig.Configuration["UploadAddress"]}//Upload/Template//Temp//{ imageFileName}.png"; + string path = @$"{BizConfig.Configuration["UploadAddress"]}//Upload/Template//Temp//{imageFileName}.png"; if (File.Exists(path)) { - varWoList = await Biz.Db.Queryable<BAS_LABEL_VAR_WO>().Where(x => x.LABEL_ID == input.LABEL_ID && x.WORK_ORDER == input.WORK_ORDER).ToListAsync(); - foreach (var item in varWoList) { + varWoList = await Biz.Db.Queryable<BAS_LABEL_VAR_WO>() + .Where(x => x.LABEL_ID == input.LABEL_ID) + .WhereIF(!input.WORK_ORDER.IsNullOrEmpty(), x => x.WORK_ORDER == input.WORK_ORDER) + .WhereIF(!input.PROD_CODE.IsNullOrEmpty(), x => x.PROD_CODE == input.PROD_CODE) + .ToListAsync(); + foreach (var item in varWoList) + { item.LABEL_VIEW_PATH = $"{BizConfig.Configuration["DownloadAddress"]}//Template//Temp//{imageFileName}.png"; } } var db = Biz.Db; var dbTran = db.UseTran(() => { + Expression<Func<BAS_LABEL_VAR_WO, object>> predicate = !input.WORK_ORDER.IsNullOrEmpty() ? t => new { t.LABEL_ID, t.WORK_ORDER, t.VAR_NAME, t.GHOST_ROW } : + !input.PROD_CODE.IsNullOrEmpty() ? t => new { t.LABEL_ID, t.PROD_CODE, t.VAR_NAME, t.GHOST_ROW } : t => new { t.LABEL_ID, t.VAR_NAME, t.GHOST_ROW }; var y = db.Storageable(input) - .WhereColumns(t => new { t.LABEL_ID, t.WORK_ORDER, t.VAR_NAME, t.GHOST_ROW }) + .WhereColumns(predicate) .ToStorage(); y.AsInsertable.ExecuteCommand(); y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand(); @@ -403,7 +410,7 @@ var queryable = Biz.Db.Queryable<BAS_LABEL_VAR_WO>() .Where(q => q.LABEL_ID.Equals(labeltemp.ID)) .WhereIF(!input.WorkOrder.IsNullOrEmpty(), q => q.WORK_ORDER.Equals(input.WorkOrder)) - .WhereIF(!input.ProdCode.IsNullOrEmpty(), q=>q.PROD_CODE.Equals(input.ProdCode)) + .WhereIF(!input.ProdCode.IsNullOrEmpty(), q => q.PROD_CODE.Equals(input.ProdCode)) .WhereIF(!input.CustCode.IsNullOrEmpty(), q => q.PROD_CODE.Equals(input.CustCode)); query.page = await queryable.ToPageAsync(input.page, input.pageSize); //濡傛灉涓嶅瓨鍦紝鍒欒繑鍥炲垵濮嬫暟鎹� @@ -426,6 +433,7 @@ var list = queryable.ToList().Where(q => q.VAR_NAME == item.VAR_NAME).First(); item.ID = list?.ID; item.WORK_ORDER = input.WorkOrder; + item.PROD_CODE = input.ProdCode; item.VAR_VALUE = list?.VAR_VALUE; item.LABEL_VIEW_PATH = list?.LABEL_VIEW_PATH; } @@ -442,5 +450,37 @@ } return result; } + + /// <summary> + /// 鑾峰彇閲嶆墦鏍囩淇℃伅 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + /// <exception cref="NotImplementedException"></exception> + public async Task<ApiAction<LOG_LABEL_PRINT>> GetRePrintInfo(RePrintInput input) + { + var result = new ApiAction<LOG_LABEL_PRINT>(); + try + { + //鍏堟煡鍑哄伐鍗曟潯鐮佷腑鏄惁瀛樺湪 + var woSn = await Biz.Db.Queryable<BIZ_MES_WO_SN>().Where(q => q.SN.Equals(input.Code) || q.FLOW_SN.Equals(input.Code)).FirstAsync(); + if (woSn == null) + { + result.IsSuccessed = false; + result.LocaleMsg = new($"鏉$爜涓嶅瓨鍦紒"); + return result; + } + + result.Data = await Biz.Db.Queryable<LOG_LABEL_PRINT>() + .WhereIF(input.ReqType == 0, q => q.SN.Equals(input.Code)) //鐧界洅鏍囩 + .WhereIF(input.ReqType == 1, q => q.SN.Equals(woSn.OUTER_SN)) //绠辨爣绛� + .FirstAsync(); + } + catch (Exception ex) + { + result.CatchExceptionWithLog(ex, "鑾峰彇閲嶆墦鏍囩淇℃伅寮傚父"); + } + return result; + } } } -- Gitblit v1.9.3