From c63b40452aeaf1b46ef716da9f5dc9e8c2a843a6 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期三, 13 七月 2022 20:30:33 +0800
Subject: [PATCH] 生产开报工提交

---
 VueWebApi/DLL/DAL/ProductModelDAL.cs |   45 +++++++++++++++++++++++----------------------
 1 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/VueWebApi/DLL/DAL/ProductModelDAL.cs b/VueWebApi/DLL/DAL/ProductModelDAL.cs
index 05b65c2..642940f 100644
--- a/VueWebApi/DLL/DAL/ProductModelDAL.cs
+++ b/VueWebApi/DLL/DAL/ProductModelDAL.cs
@@ -504,7 +504,7 @@
                 }
                 if (operType == "Update")
                 {
-                    var sql = @"update TMateriel_Type set partname=@materialname,partspec=@materialspec,uom_code=@uomcode,materieltype_code=@materialtypecode,stck_code=@warehousecode,
+                    var sql = @"update TMateriel_Info set partname=@materialname,partspec=@materialspec,uom_code=@uomcode,materieltype_code=@materialtypecode,stck_code=@warehousecode,
                                 maxqty=@maxstockqty,minqty=@minstockqty,lm_user=@username,lm_date=@CreateDate where id=@materialid";
                     dynamicParams.Add("@materialid", materialid);
                     dynamicParams.Add("@materialname", materialname);
@@ -792,7 +792,7 @@
                 }
                 // --------------鏌ヨ鎸囧畾鏁版嵁--------------
                 var total = 0; //鎬绘潯鏁�
-                var sql = @"select code,name,description,enable,lm_user,lm_date  
+                var sql = @"select id,code,name,description,enable,lm_user,lm_date  
                             from TFlw_Rout
                             where is_delete<>'1' " + search;
                 var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
@@ -872,20 +872,20 @@
                     //鏂板宸ヨ壓璺嚎琛�
                     sql = @"insert into TFlw_Rout(code,name,description,enable,lm_user,lm_date) values(@code,@name,@description,@enable,@lm_user,@lm_date)";
                     list.Add(new { str = sql, parm = new { code = json.code, name = json.name, description = json.description, enable = json.enable, lm_user = username, lm_date = DateTime.Now.ToString() } });
-                    string is_firststep = "N"; //鏄惁棣栭亾宸ュ簭
-                    string is_laststep = "N"; //鏄惁鏈亾宸ュ簭
                     for (int i = 0; i < json.Data.Rows.Count; i++)
                     {
+                        string is_firststep = "N"; //鏄惁棣栭亾宸ュ簭
+                        string is_laststep = "N"; //鏄惁鏈亾宸ュ簭
                         if (json.Data.Rows[i]["SEQ"].ToString() == "1")  //鏄惁棣栭亾宸ュ簭
                         {
                             is_firststep = "Y";
                         }
-                        if (Convert.ToInt32(json.Data.Rows[i]["SEQ"].ToString()) == json.Data.Rows.Count) //鏄惁鏈亾宸ュ簭
+                        else if (Convert.ToInt32(json.Data.Rows[i]["SEQ"].ToString()) == json.Data.Rows.Count) //鏄惁鏈亾宸ュ簭
                         {
                             is_laststep = "Y";
                         }
                         //鏂板宸ヨ壓璺嚎鍏宠仈宸ュ簭琛�
-                        sql = @"insert TFlw_Rtdt (rout_code,seq,step_code,first_choke,last_choke,lm_user,lm_date) values()";
+                        sql = @"insert TFlw_Rtdt (rout_code,seq,step_code,first_choke,last_choke,lm_user,lm_date) values(@rout_code,@seq,@step_code,@first_choke,@last_choke,@lm_user,@lm_date)";
                         list.Add(new { str = sql, parm = new { rout_code = json.code, seq = Convert.ToInt32(json.Data.Rows[i]["SEQ"].ToString()), step_code = json.Data.Rows[i]["STEPCODE"].ToString(), first_choke = is_firststep, last_choke = is_laststep, lm_user = username, lm_date = DateTime.Now.ToString() } });
                     }
                     bool aa = DapperHelper.DoTransaction(list);
@@ -991,14 +991,14 @@
 
 
 
-        #region[宸ヨ壓璺嚎涓嬫媺鏌ヨ鎺ュ彛]
-        public static ToMessage RouteSearch()
+        #region[宸ュ簭涓嬫媺鏌ヨ鎺ュ彛]
+        public static ToMessage StepSelect()
         {
             string sql = "";
             try
             {
-                //鑾峰彇宸ヨ壓璺嚎鏁版嵁
-                sql = @"select code,name from TFlw_Rout where is_delete<>'1' ";
+                //鑾峰彇宸ュ簭鏁版嵁
+                sql = @"select stepcode,stepname from TStep where is_delete<>'1' ";
                 var data = DapperHelper.selecttable(sql);
                 mes.code = "200";
                 mes.Message = "鏌ヨ鎴愬姛!";
@@ -1053,7 +1053,7 @@
                 }
                 // --------------鏌ヨ鎸囧畾鏁版嵁--------------
                 var total = 0; //鎬绘潯鏁�
-                var sql = @"select stepcode,stepname,flwtype,enable,descr,lm_user,lm_date,is_eqp,is_defect  
+                var sql = @"select id,stepcode,stepname,flwtype,enable,descr,lm_user,lm_date,is_eqp,is_defect  
                             from TStep
                             where is_delete<>'1' " + search;
                 var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
@@ -1187,16 +1187,16 @@
                 }
 
                 //鍒犻櫎璁惧鑺傛媿宸ヤ环琛�
-                sql = @"delete TPrteEqp_Stad  where stepcode=@stepcode";
+                sql = @"delete TPrteEqp_Stad  where step_code=@stepcode";
                 list.Add(new { str = sql, parm = new { stepcode = stepcode } });
                 //鍒犻櫎宸ュ簭鍏宠仈宸ヤ綔绔欒〃
                 sql = @"delete TFlw_Rteqp   where step_code=@stepcode";
                 list.Add(new { str = sql, parm = new { stepcode = stepcode } });
                 //鍒犻櫎缂洪櫡鍏宠仈宸ュ簭琛�
-                sql = @"update TDefect_Step  where step_code=@stepcode";
+                sql = @"delete TDefect_Step  where step_code=@stepcode";
                 list.Add(new { str = sql, parm = new { stepcode = stepcode } });
                 //鍒犻櫎宸ュ簭
-                sql = @"update TStep set is_delete='1' where partcode=@stepcode";
+                sql = @"update TStep set is_delete='1' where stepcode=@stepcode";
                 list.Add(new { str = sql, parm = new { stepcode = stepcode } });
                 bool aa = DapperHelper.DoTransaction(list);
                 if (aa)
@@ -1247,7 +1247,7 @@
                         select distinct A.eqp_code,B.btype  from TFlw_Rteqp A 
                         inner join TCustomer B on A.eqp_code=B.code 
                         where A.step_code=@stepcode and A.is_delete<>'1' and B.is_delete<>'1'
-                        ) B on T.code=B.eqp_code where T.btype='WX' and T.is_delete<>'1'";
+                        ) B on T.btype=B.btype where T.btype='WX' and T.is_delete<>'1'";
                 dynamicParams.Add("@stepcode", stepcode);
                 var data = DapperHelper.selectdata(sql, dynamicParams);
                 for (int i = 0; i < data.Rows.Count; i++)
@@ -1289,9 +1289,10 @@
                               left join(
                               select distinct A.eqp_code  from TFlw_Rteqp A 
                               inner join TEqpInfo B on A.eqp_code=B.code 
-                              where B.wksp_code='W001' and A.is_delete<>'1' and B.is_delete<>'1'
-                              ) B on A.code=B.eqp_code and A.is_delete<>'1'";
+                              where A.step_code=@stepcode and A.is_delete<>'1' and B.is_delete<>'1'
+                              ) B on A.code=B.eqp_code where A.wksp_code=@wkspcode and A.is_delete<>'1'";
                         dynamicParams.Add("@stepcode", stepcode);
+                        dynamicParams.Add("@wkspcode", data.Rows[i]["WKSP_CODE"].ToString());
                         var data0 = DapperHelper.selectdata(sql, dynamicParams);
                         for (int j = 0; j < data0.Rows.Count; j++)
                         {
@@ -1334,7 +1335,7 @@
                     sql = @"delete TFlw_Rteqp where step_code=@stepcode";
                     list.Add(new { str = sql, parm = new { stepcode = stepcode } });
                     //鏍囪宸ュ簭琛ㄥ叧鑱斿伐浣滅珯鏍囪瘑
-                    sql = @"update TStep is_eqp='N' where stepcode=@stepcode";
+                    sql = @"update TStep set is_eqp='N' where stepcode=@stepcode";
                     list.Add(new { str = sql, parm = new { stepcode = stepcode } });
                 }
                 else
@@ -1401,7 +1402,7 @@
                 //鑾峰彇宸ュ簭鍏宠仈缂洪櫡鏁版嵁(鍖呭惈鍏宠仈鏍囪瘑)
                 sql = @"select A.code,A.name,(case when B.defect_code is null then 'N' else 'Y' end) flag from TDefect A
                         left join(
-                        select distinct defect_code  from TDefect_Step where step_code='' and is_delete<>'1'
+                        select distinct defect_code  from TDefect_Step where step_code=@stepcode and is_delete<>'1'
                         ) B on A.code=B.defect_code";
                 dynamicParams.Add("@stepcode", stepcode);
                 var data = DapperHelper.selectdata(sql, dynamicParams);
@@ -1442,7 +1443,7 @@
                     sql = @"delete TDefect_Step where step_code=@stepcode";
                     list.Add(new { str = sql, parm = new { stepcode = stepcode } });
                     //鏍囪宸ュ簭琛ㄥ叧鑱斿伐浣滅珯鏍囪瘑
-                    sql = @"update TStep is_defect='N' where stepcode=@stepcode";
+                    sql = @"update TStep set is_defect='N' where stepcode=@stepcode";
                     list.Add(new { str = sql, parm = new { stepcode = stepcode } });
                 }
                 else
@@ -1619,7 +1620,7 @@
             {
                 // --------------鏌ヨ鎸囧畾鏁版嵁--------------
                 var total = 0; //鎬绘潯鏁�
-                var sql = @"select C.partcode,C.partname,B.wksp_code,T.org_name as wksp_name,A.eqp_value,A.stand_value,A.cavity_qty,A.unprice  
+                var sql = @"select B.code as eqpcode,B.name as eqpname,B.wksp_code,T.org_name as wksp_name,A.eqp_value,A.stand_value,A.cavity_qty,A.unprice  
                             from (
                             select materiel_code, eqp_code,eqp_value,stand_value,cavity_qty,unprice   from TPrteEqp_Stad
                             where materiel_code=@partcode  and route_code=@routecode and step_code=@stepcode 
@@ -1661,7 +1662,7 @@
                 if (partcode != "" && partcode != null)
                 {
                     search += "and A.materiel_code=@partcode ";
-                    dynamicParams.Add("@stepcode", partcode);
+                    dynamicParams.Add("@partcode", partcode);
                 }
                 if (routecode != "" && routecode != null)
                 {

--
Gitblit v1.9.3