From e7b01bc7ec4cfb3d978f01fbe2bf1a6461fd639b Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期日, 09 十月 2022 19:58:24 +0800
Subject: [PATCH] nothing

---
 VueWebApi/DLL/DAL/ProductionManagementDAL.cs |  101 ++++++++++++++++++++++++++++++++------------------
 1 files changed, 64 insertions(+), 37 deletions(-)

diff --git a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
index 02f89de..fee23a3 100644
--- a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
+++ b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
@@ -2871,64 +2871,91 @@
                                 for (int n = 0; n < dt3.Rows.Count; n++)
                                 {
                                     string sql4 = @"select  A.wo_code,A.eqp_code,A.Time_Start,A.time_end, 
-                                                 (case  B.Status when 'SCHED' then '宸叉帓绋�' when 'ALLOC' then '宸叉淳鍙�' when 'START' then '宸插紑宸�' end ) status   
-                                                  from TK_Wrk_EqpAps  A
-                                                  left join mes_tk_wrk_man B on A.wo_code=B.Wo_Code
-                                                  left join gn_eqp_eqpinfo C on A.eqp_code=C.code
-                                                  where TO_char(time_start,'YYYY-MM-DD')='" + list4[m].name + "' and A.eqp_code='" + dt3.Rows[n]["CODE"] + "' and B.isaps='Y' and B.status IN('SCHED','ALLOC','START')";
-                                    DataTable dt4 = DBHelper.GetTable(sql4);
+                                                     (case  B.Status when 'SCHED' then '宸叉帓绋�' when 'ALLOC' then '宸叉淳鍙�' when 'START' then '宸插紑宸�' end ) status   
+                                                      from TK_Wrk_EqpAps  A
+                                                      left join TK_Wrk_Man B on A.wo_code=B.wo_code
+                                                      left join TEqpInfo C on A.eqp_code=C.code
+                                                      where CONVERT(varchar(100), time_start, 23)=@time_start and A.eqp_code=@eqp_code and B.isaps='Y' and B.status IN('SCHED','ALLOC','START')";
+                                    dynamicParams.Add("@time_start", list4[m].name);
+                                    dynamicParams.Add("@eqp_code", dt3.Rows[n]["CODE"]);
+                                    var dt4 = DapperHelper.selectdata(sql4, dynamicParams);
                                     if (dt4.Rows.Count > 0)
                                     {
                                         for (int g = 0; g < dt4.Rows.Count; g++)
                                         {
-                                            json = new DWZJson()
-                                            {
-                                                statusCode = "300",
-                                                message = "淇敼澶辫触锛�,鏃ユ湡锛�" + dt4.Rows[g]["TIME_START"] + "鏈夈��" + dt4.Rows[g]["STATUS"] + "銆戝伐鍗曪細" + dt4.Rows[g]["WO_CODE"] + "",
-                                            };
-                                            return json;
+                                            mes.code = "300";
+                                            mes.count = 0;
+                                            mes.Message = "淇敼澶辫触锛�,鏃ユ湡锛�" + dt4.Rows[g]["TIME_START"] + "鏈夈��" + dt4.Rows[g]["STATUS"] + "銆戝伐鍗曪細" + dt4.Rows[g]["WO_CODE"] + "";
+                                            mes.data = null;
+                                            return mes;
                                         }
                                     }
                                 }
                             }
                         }
                     }
-
-
-                    list.Add(@"update gn_wkm_capac_plan set wkshift_code='" + CapSetupCode + "',classtype='" + CaptPlanType + "', enable='Y',lm_user='" + lm_user + "',lm_time=sysdate  where id='" + CaptPlanId + "'");
-                    list.Add(@"delete gn_wkm_capac_plan_sub where m_id='" + CaptPlanId + "'");
+                    //鏇存柊鎺掍骇鐢熶骇璧勬簮涓昏〃
+                    sql = @"update gn_wkm_capac_plan set wkshift_code=@wkshift_code,classtype=@classtype,lm_user=@lm_user,lm_time=@lm_time  where id=@id";
+                    list.Add(new
+                    {
+                        str = sql,
+                        parm = new
+                        {
+                            id=captplanid,
+                            wkshift_code = capsetupcode,
+                            classtype = captplantype,
+                            lm_user =username,
+                            lm_time= DateTime.Now.ToString()
+                        }
+                    });
+                    //鍒犻櫎鎺掍骇鐢熶骇璧勬簮瀛愯〃
+                    sql = @"delete TWkm_capac_plan_sub  where m_id=@id";
+                    list.Add(new
+                    {
+                        str = sql,
+                        parm = new
+                        {
+                            id = captplanid
+                        }
+                    });
+                    //寰幆鍐欏叆鎺掍骇鐢熶骇璧勬簮瀛愯〃
                     for (int i = 0; i < objs.Count; i++)
                     {
-                        list.Add(@"insert into gn_wkm_capac_plan_sub(m_id, id, wkdate,wkshift_code) 
-                                     values('" + CaptPlanId + "',gn_wkm_capac_plan_sub_S.nextVal,to_date('" + objs[i].name + "','yyyy-MM-dd'),'" + objs[i].key + "')");
-                    }
-                    int count = DBHelper.Executesqltran(list, pt.ToArray());
-                    if (count > 0)
-                    {
-                        json = new DWZJson()
+                        sql = @"insert into TWkm_capac_plan_sub(m_id,wkdate,wkshift_code) values()";
+                        list.Add(new
                         {
-                            statusCode = "200",
-                            message = "淇敼鎴愬姛锛�",
-                        };
+                            str = sql,
+                            parm = new
+                            {
+                                m_id = captplanid,
+                                wkdate = objs[i].name,
+                                wkshift_code= objs[i].key
+                            }
+                        });
+                    }
+                    bool aa = DapperHelper.DoTransaction(list);
+                    if (aa)
+                    {
+                        mes.code = "200";
+                        mes.count = 0;
+                        mes.Message = "鎿嶄綔鎴愬姛!";
+                        mes.data = null;
                     }
                     else
                     {
-                        json = new DWZJson()
-                        {
-                            statusCode = "300",
-                            message = "淇敼澶辫触锛�",
-                        };
+                        mes.code = "300";
+                        mes.count = 0;
+                        mes.Message = "鎿嶄綔澶辫触!";
+                        mes.data = null;
                     }
                 }
             }
             catch (Exception e)
             {
-
-                json = new DWZJson()
-                {
-                    statusCode = "300",
-                    message = e.Message,
-                };
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
             }
             return mes;
         }

--
Gitblit v1.9.3