From e807bc7e010a93b85cae988b0d2d3c969d8b10f5 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期三, 16 十一月 2022 10:28:59 +0800
Subject: [PATCH] 班组、个人计件工资接口修改

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

diff --git a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
index d0eb571..d605892 100644
--- a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
+++ b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
@@ -477,7 +477,7 @@
         #endregion
 
         #region[MES宸ュ崟鏂板銆佺紪杈戞彁浜
-        public static ToMessage AddUpdateMesOrder(string mesorderstus, string sourceorder, string ordertype, string mesordercode, string partcode, string mesqty, string routecode, string wkshopcode, string planstartdate, string planenddate, string orderlev, string username, string opertype,string is_aps)
+        public static ToMessage AddUpdateMesOrder(string mesorderstus, string sourceorder, string ordertype, string mesordercode, string partcode, string mesqty, string routecode, string wkshopcode, string planstartdate, string planenddate, string orderlev, string username, string opertype)
         {
             var sql = "";
             var dynamicParams = new DynamicParameters();
@@ -638,7 +638,7 @@
             try
             {
                 //鍒ゆ柇宸ュ崟鏄惁涓烘湭寮�濮嬬姸鎬佹垨鑰呭凡娲惧彂鐘舵��(婊¤冻鍏朵腑涓�绉嶉兘鍙垹闄わ紝鍚﹀垯涓嶅厑璁稿垹闄�)
-                sql = @"select *  from TK_Wrk_Man where wo_code=@wocode and status='NEW' or status='ALLO'";
+                sql = @"select *  from TK_Wrk_Man where wo_code=@wocode and status in('NEW','ALLO')";
                 dynamicParams.Add("@wocode", wocode);
                 var data = DapperHelper.selectdata(sql, dynamicParams);
                 if (data.Rows.Count > 0)
@@ -759,7 +759,7 @@
                          left join TStep B on A.step_code=B.stepcode
                          left join TK_Wrk_Man M on A.wo_code=M.wo_code
                          left join TMateriel_Info P on M.materiel_code=P.partcode
-                        where A.wo_code=@wo_code";
+                        where A.wo_code=@wo_code order by A.seq";
                 dynamicParams.Add("@wo_code", wo_code);
                 var data = DapperHelper.selectdata(sql, dynamicParams);
                 mes.code = "200";
@@ -2623,14 +2623,14 @@
             {
                 if (type == "Add")
                 {
-                    var sql = @"insert into TWkm_capac_plan(wkshop, eqp_typecode, wkshift_code, enable, lm_user, lm_time,classtype) 
-                            values(@wkshop,@eqp_typecode,@wkshift_code,@enable,@lm_user,@lm_time,@classtype)";
+                    var sql = @"insert into TWkm_capac_plan(wkshop, eqp_typecode, wkshift_code, enable, lm_user, lm_date,classtype) 
+                            values(@wkshop,@eqp_typecode,@wkshift_code,@enable,@lm_user,@lm_date,@classtype)";
                     dynamicParams.Add("@wkshop", wkshopcode);
                     dynamicParams.Add("@eqp_typecode", capunitcode);
                     dynamicParams.Add("@wkshift_code", capsetupcode);
                     dynamicParams.Add("@enable", "Y");
                     dynamicParams.Add("@lm_user", username);
-                    dynamicParams.Add("@lm_time", DateTime.Now.ToString());
+                    dynamicParams.Add("@lm_date", DateTime.Now.ToString());
                     dynamicParams.Add("@classtype", captplantype);
                     int cont = DapperHelper.SQL(sql, dynamicParams);
                     if (cont > 0)
@@ -2694,10 +2694,10 @@
                 sql = @"select CONVERT(varchar(100), wkdate, 23) DataTime,wkshift_code   from TWkm_capac_plan_sub where m_id=@captplanid";
                 dynamicParams.Add("@captplanid", captplanid);
                 var data = DapperHelper.selectdata(sql, dynamicParams);
-                for (int i = 0; i < dt.Rows.Count; i++)
+                for (int i = 0; i < data.Rows.Count; i++)
                 {
-                    string DataTime = dt.Rows[i]["DataTime"].ToString();//鏃ユ湡
-                    string key = dt.Rows[i]["wkshift_code"].ToString(); //鏂规缂栫爜
+                    string DataTime = data.Rows[i]["DataTime"].ToString();//鏃ユ湡
+                    string key = data.Rows[i]["wkshift_code"].ToString(); //鏂规缂栫爜
                     CapaPlan cmp = new CapaPlan();
                     cmp.name = DataTime;
                     cmp.key = key;
@@ -2735,11 +2735,11 @@
                 dynamicParams.Add("@captplanid", captplanid);
                 dynamicParams.Add("@datetime", datetime);
                 var data = DapperHelper.selectdata(sql, dynamicParams);
-                for (int i = 0; i < dt.Rows.Count; i++)
+                for (int i = 0; i < data.Rows.Count; i++)
                 {
-                    string code = dt.Rows[i]["code"].ToString();//鏂规缂栫爜
-                    string name = dt.Rows[i]["name"].ToString();//鏂规鍚嶇О
-                    string flag = dt.Rows[i]["flag"].ToString();   //閫変腑鏂规鏍囪瘑
+                    string code = data.Rows[i]["code"].ToString();//鏂规缂栫爜
+                    string name = data.Rows[i]["name"].ToString();//鏂规鍚嶇О
+                    string flag = data.Rows[i]["flag"].ToString();   //閫変腑鏂规鏍囪瘑
                     CapacityPlanSect cmp = new CapacityPlanSect();
                     cmp.CapCode = code;
                     cmp.CapName = name;
@@ -2748,7 +2748,7 @@
 
                     string sql1 = @"select wktme1_start,wktme2_start,wktme3_start,wktme4_start,wktme5_start  from TBas_wkshift_info where code=@code";
                     dynamicParams.Add("@code", code);
-                    var db = DapperHelper.selectdata(sql, dynamicParams);
+                    var db = DapperHelper.selectdata(sql1, dynamicParams);
 
                     for (int j = 0; j < db.Columns.Count; j++) //鏃堕棿娈�
                     {
@@ -2862,11 +2862,10 @@
                     List<CapaPlan> list4 = ids1.Except(ids).ToList(); //琛ㄧずids1涓摢浜涘�兼槸ids涓墍涓嶅瓨鍦ㄧ殑;
                     list4 = list3.Union(list4).ToList();
                     //鏌ユ壘鍏抽敭宸ュ簭璁惧銆佸伐浣嶇兢缁勭殑鎵�鏈夎澶�
-                    string sql3 = @"select *  from(
-                                  select distinct A.code,A.name  from TEqpInfo A 
+                    string sql3 = @"select distinct A.code,A.name  from TEqpInfo A 
                                   left join TFlw_Rteqp B on A.code=B.eqp_code
                                   left join TFlw_Rtdt D on B.step_code=D.step_code                 
-                                  where A.wksp_code=@wkshopcode  and D.first_choke='Y'  order by A.code)";
+                                  where A.wksp_code=@wkshopcode  and D.first_choke='Y'  order by A.code";
                     dynamicParams.Add("@wkshopcode", wkshopcode);
                     var dt3 = DapperHelper.selectdata(sql3, dynamicParams);
                     if (list4.Count > 0)  //濡傛灉鏃ユ湡鏈夊彉鍔�
@@ -2902,7 +2901,7 @@
                         }
                     }
                     //鏇存柊鎺掍骇鐢熶骇璧勬簮涓昏〃
-                    sql = @"update gn_wkm_capac_plan set wkshift_code=@wkshift_code,classtype=@classtype,lm_user=@lm_user,lm_time=@lm_time  where id=@id";
+                    sql = @"update TWkm_capac_plan set wkshift_code=@wkshift_code,classtype=@classtype,lm_user=@lm_user,lm_date=@lm_time  where id=@id";
                     list.Add(new
                     {
                         str = sql,
@@ -2928,7 +2927,7 @@
                     //寰幆鍐欏叆鎺掍骇鐢熶骇璧勬簮瀛愯〃
                     for (int i = 0; i < objs.Count; i++)
                     {
-                        sql = @"insert into TWkm_capac_plan_sub(m_id,wkdate,wkshift_code) values()";
+                        sql = @"insert into TWkm_capac_plan_sub(m_id,wkdate,wkshift_code) values(@m_id,@wkdate,@wkshift_code)";
                         list.Add(new
                         {
                             str = sql,

--
Gitblit v1.9.3