From 39f66c32212f11d9a9d41c69e37f68e989c55cde Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期一, 08 十二月 2025 10:56:23 +0800
Subject: [PATCH] 1.报工调整增加工序查询条件 2.报工调整增加批量改价 3.生产订单、生产工单车间查询条件改为多选

---
 VueWebCoreApi/DLL/DAL/WorkOrderDAL.cs |  134 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 127 insertions(+), 7 deletions(-)

diff --git a/VueWebCoreApi/DLL/DAL/WorkOrderDAL.cs b/VueWebCoreApi/DLL/DAL/WorkOrderDAL.cs
index f20820a..fc7d964 100644
--- a/VueWebCoreApi/DLL/DAL/WorkOrderDAL.cs
+++ b/VueWebCoreApi/DLL/DAL/WorkOrderDAL.cs
@@ -42,8 +42,9 @@
                 }
                 if (wkshopcode != "" && wkshopcode != null)
                 {
-                    search += "and A.wkshp_code=@wkshopcode ";
-                    dynamicParams.Add("@wkshopcode", wkshopcode);
+                    string[] wkshoplist = Array.ConvertAll<string, string>(wkshopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[] 
+                    search += "and A.wkshp_code in @wkshoplist ";
+                    dynamicParams.Add("@wkshoplist", wkshoplist);
                 }
                 if (erpordercode != "" && erpordercode != null)
                 {
@@ -850,8 +851,9 @@
                 }
                 if (wkshopcode != "" && wkshopcode != null)
                 {
-                    search += "and A.wkshp_code=@wkshopcode ";
-                    dynamicParams.Add("@wkshopcode", wkshopcode);
+                    string[] wkshoplist = Array.ConvertAll<string, string>(wkshopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[] 
+                    search += "and A.wkshp_code in @wkshoplist ";
+                    dynamicParams.Add("@wkshoplist", wkshoplist);
                 }
                 if (mesordercode != "" && mesordercode != null)
                 {
@@ -3396,7 +3398,7 @@
 
 
         #region[鐢熶骇鎵ц,鎶ュ伐璋冩暣鏁版嵁鏌ヨ鎺ュ彛]
-        public static ToMessage MesOrderStepVerifySearch(string wkshopcode, string wo_code, string partnumber, string partname, string partspec, string reportuser, string reportdateopendate, string reportdateclosedate, int startNum, int endNum, string prop, string order)
+        public static ToMessage MesOrderStepVerifySearch(string wkshopcode, string wo_code, string partnumber, string partname, string partspec,string stepcode, string reportuser, string reportdateopendate, string reportdateclosedate, int startNum, int endNum, string prop, string order)
         {
             var dynamicParams = new DynamicParameters();
             string search = "";
@@ -3427,6 +3429,11 @@
                     search += "and AA.partspec like '%'+@partspec+'%' ";
                     dynamicParams.Add("@partspec", partspec);
                 }
+                if (stepcode != "" && stepcode != null)
+                {
+                    search += "and AA.step_code=@stepcode ";
+                    dynamicParams.Add("@stepcode", stepcode);
+                }
                 if (reportuser != "" && reportuser != null)
                 {
                     search += "and AA.usercode like '%'+@reportuser+'%' ";
@@ -3449,7 +3456,7 @@
                 var total = 0; //鎬绘潯鏁�
                 var sql = @"select *  from(
                             select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,K.plan_quantity,K.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.eqp_code,E.name as eqp_name,
-                            A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,k.isbott as first_choke,k.isend as last_choke,A.step_price,B.reckway,B.usergroup_code,G.usergroupname as usergroup_name,
+                            A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,A.style,k.isbott as first_choke,k.isend as last_choke,A.step_price,B.reckway,B.usergroup_code,G.usergroupname as usergroup_name,
                             B.report_person as usercode,
                              STUFF((SELECT ',' + U.username
                                     FROM TUser U
@@ -3468,7 +3475,7 @@
                             where A.style='B' and B.style='B' and M.status<>'CLOSED' and A.verify='N'
                             union all
                             select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,K.plan_quantity,K.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.wx_code as eqp_code,E.name as eqp_name,
-                            A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,k.isbott as first_choke,k.isend as last_choke,A.step_price,'person' as reckway,'' as usergroup_code,'' as usergroup_name,
+                            A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,A.style,k.isbott as first_choke,k.isend as last_choke,A.step_price,'person' as reckway,'' as usergroup_code,'' as usergroup_name,
                             B.in_person as usercode,
                             STUFF((SELECT ',' + U.username
                                     FROM TUser U
@@ -4398,6 +4405,118 @@
         }
         #endregion
 
+        #region[鐢熶骇鎵ц,鎶ュ伐璋冩暣鎵归噺鏀逛环鏁版嵁鎻愪氦]
+        public static ToMessage MesOrderStepPriceBatchUpdateSeave(User us, List<BatchPrice> json)
+        {
+            string sql = "";
+            List<object> list = new List<object>();
+            var dynamicParams = new DynamicParameters();
+            try
+            {
+                if (json.Count > 0)
+                {
+                    // 浣跨敤Lambda琛ㄨ揪寮忓垽鏂被鍨嬪垎甯�:鍏ㄩ儴鎶ュ伐鎴栬�呭叏閮ㄦ敹鏂�
+                    bool allB = json.All(p => p.type == "B");
+                    bool allS = json.All(p => p.type == "S");
+                    if (allB)//鍏ㄩ儴鎶ュ伐
+                    {
+                        //灏哃ist<BatchPrice>涓殑id瀛楁杞崲涓哄瓧绗︿覆鏁扮粍
+                        string[] idArray = json.Select(bp => bp.id).ToArray();
+                        //鍥炲啓瀵瑰簲鐨勬姤宸ヨ褰曚富琛ㄥ伐浠�
+                        sql = @"update TK_Wrk_Record set step_price=@step_price where id in @idArray and style='B'";
+                        list.Add(new
+                        {
+                            str = sql,
+                            parm = new
+                            {
+                                step_price = decimal.Parse(json[0].price),
+                                idArray = idArray
+                            }
+                        });
+                    }
+                    else if (allS)//鍏ㄩ儴鏀舵枡
+                    {
+                        //灏哃ist<BatchPrice>涓殑id瀛楁杞崲涓哄瓧绗︿覆鏁扮粍
+                        string[] idArray = json.Select(bp => bp.id).ToArray();
+                        //鍥炲啓瀵瑰簲鐨勬姤宸ヨ褰曚富琛ㄥ伐浠�
+                        sql = @"update TK_Wrk_OutRecord set step_price=@step_price where id in @idArray and style='S'";
+                        list.Add(new
+                        {
+                            str = sql,
+                            parm = new
+                            {
+                                step_price = decimal.Parse(json[0].price),
+                                idArray = idArray
+                            }
+                        });
+                    }
+                    else // 娣峰悎鎯呭喌
+                    {
+                        //灏哃ist<BatchPrice>涓负鎶ュ伐鐨刬d瀛楁杞崲涓哄瓧绗︿覆鏁扮粍
+                        var bList = json.Where(p => p.type == "B").ToList();
+                        string[] idBArray = bList.Select(bp => bp.id).ToArray();
+                        //鍥炲啓瀵瑰簲鐨勬姤宸ヨ褰曚富琛ㄥ伐浠�
+                        sql = @"update TK_Wrk_Record set step_price=@step_price where id in @idBArray and style='B'";
+                        list.Add(new
+                        {
+                            str = sql,
+                            parm = new
+                            {
+                                step_price = decimal.Parse(json[0].price),
+                                idBArray = idBArray
+                            }
+                        });
+                        //灏哃ist<BatchPrice>涓负鏀舵枡鐨刬d瀛楁杞崲涓哄瓧绗︿覆鏁扮粍
+                        var sList = json.Where(p => p.type == "S").ToList();
+                        string[] idSArray = sList.Select(bp => bp.id).ToArray();
+                        //鍥炲啓瀵瑰簲鐨勬姤宸ヨ褰曚富琛ㄥ伐浠�
+                        sql = @"update TK_Wrk_OutRecord set step_price=@step_price where id in @idSArray and style='S'";
+                        list.Add(new
+                        {
+                            str = sql,
+                            parm = new
+                            {
+                                step_price = decimal.Parse(json[0].price),
+                                idSArray = idSArray
+                            }
+                        });
+                    }
+                    bool aa = DapperHelper.DoTransaction(list);
+                    if (aa)
+                    {
+                        //鍐欏叆鎿嶄綔璁板綍琛�
+                        LogHelper.DbOperateLog(us.usercode, "鎵归噺淇敼宸ヤ环", "鎶ュ伐ID:" + string.Join(",",json.Select(bp => bp.id).ToArray())+",鎿嶄綔绫诲瀷:"+ string.Join(",", json.Select(bp => bp.type).ToArray()), us.usertype);
+                        mes.code = "200";
+                        mes.count = 0;
+                        mes.message = "鎿嶄綔鎴愬姛!";
+                        mes.data = null;
+                    }
+                    else
+                    {
+                        mes.code = "300";
+                        mes.count = 0;
+                        mes.message = "鎿嶄綔澶辫触!";
+                        mes.data = null;
+                    }
+                }
+                else 
+                {
+                    mes.code = "300";
+                    mes.count = 0;
+                    mes.message = "璇烽�夋嫨闇�瑕佹壒閲忚皟鏁村伐浠风殑鎶ュ伐璁板綍!";
+                    mes.data = null;
+                    return mes;
+                }
+                return mes;
+            }
+            catch (Exception)
+            {
+
+                throw;
+            }
+        }
+        #endregion
+
 
 
         #region[鐢熶骇鎵ц,鎶ュ伐瀹℃牳鍒楄〃鏁版嵁鏌ヨ鎺ュ彛]
@@ -4637,6 +4756,7 @@
         #endregion
 
 
+
         #region[鐢熶骇鍏ュ簱鏉$爜琛ユ墦]
         public static ToMessage ProductInHouseLabCode(string ordercode)
         {

--
Gitblit v1.9.3