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 | 559 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 534 insertions(+), 25 deletions(-)
diff --git a/VueWebApi/DLL/DAL/ProductModelDAL.cs b/VueWebApi/DLL/DAL/ProductModelDAL.cs
index f92eef6..642940f 100644
--- a/VueWebApi/DLL/DAL/ProductModelDAL.cs
+++ b/VueWebApi/DLL/DAL/ProductModelDAL.cs
@@ -27,7 +27,7 @@
try
{
//鑾峰彇璁惧绫诲瀷鏁版嵁
- sql = @"select code,name from T_Dict where dict_group='CHLX' ";
+ sql = @"select code,name from T_Dict where dict_type='CHLX' ";
var data = DapperHelper.selecttable(sql);
mes.code = "200";
mes.Message = "鏌ヨ鎴愬姛!";
@@ -74,7 +74,7 @@
var total = 0; //鎬绘潯鏁�
var sql = @"select A.id,A.code,A.name,A.dict_code as stockcode,B.name as stockname,A.lm_user,A.lm_date
from TMateriel_Type A
- left join T_Dict B on A.dict_code=B.code and B.dict_group='CHLX'
+ left join T_Dict B on A.dict_code=B.code and B.dict_type='CHLX'
where A.is_delete<>'1' " + search;
var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
mes.code = "200";
@@ -373,6 +373,30 @@
}
#endregion
+ #region[鍗曚綅涓嬫媺鍒楄〃鏌ヨ]
+ public static ToMessage UomSelect()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇宸ヨ壓璺嚎鏁版嵁
+ sql = @"select code,name from TUom where is_delete<>'1' ";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
#region[瀛樿揣妗f鏌ヨ]
public static ToMessage InventoryFileSelect(string partcode, string partname, string partspec, string stocktypecode, string materialtypecode, string storehousecode, int startNum, int endNum, string prop, string order)
{
@@ -416,7 +440,7 @@
}
// --------------鏌ヨ鎸囧畾鏁版嵁--------------
var total = 0; //鎬绘潯鏁�
- var sql = @"select A.partcode,A.partname,A.partspec,A.uom_code,B.name as uom_name,D.code as stocktypecode,D.name as stocktypename,
+ var sql = @"select A.id,A.partcode,A.partname,A.partspec,A.uom_code,B.name as uom_name,D.code as stocktypecode,D.name as stocktypename,
C.code as materialtypecode,C.name as materialtypename,A.stck_code,T.name as stck_name,A.maxqty,A.minqty,A.lm_user,
A.lm_date,A.proute_id
from TMateriel_Info A
@@ -450,8 +474,8 @@
{
if (operType == "Add")
{
- var sql = @"insert into TMateriel_Info(partcode,partname,partspec,uom_code,materialtypecode,stck_code,proute_id,maxqty,minqty,lm_user,lm_date)
- values(@stocktypecode,@materialtypecode,@materialtypename,@username,@CreateDate)";
+ var sql = @"insert into TMateriel_Info(partcode,partname,partspec,uom_code,materieltype_code,stck_code,maxqty,minqty,lm_user,lm_date)
+ values(@materialcode,@materialname,@materialspec,@uomcode,@materialtypecode,@warehousecode,@maxstockqty,@minstockqty,@username,@CreateDate)";
dynamicParams.Add("@materialcode", materialcode);
dynamicParams.Add("@materialname", materialname);
dynamicParams.Add("@materialspec", materialspec);
@@ -480,8 +504,8 @@
}
if (operType == "Update")
{
- var sql = @"update TMateriel_Type set partname=@materialname,partspec=@materialspec,uom_code=@uomcode,materialtypecode=@materialtypecode,stck_code=@warehousecode,
- maxqty=@maxstockqty,minqty=@minstockqty lm_user=@username,lm_date=@CreateDate where id=@materialid";
+ 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);
dynamicParams.Add("@materialspec", materialspec);
@@ -635,8 +659,8 @@
for (int i = 0; i < data.Rows.Count; i++)
{
MaterialRout rout = new MaterialRout();
- rout.code = data.Rows[i]["CODE"].ToString();
- rout.name = data.Rows[i]["NAME"].ToString();
+ rout.code = data.Rows[i]["ROUTECODE"].ToString();
+ rout.name = data.Rows[i]["ROUTENAME"].ToString();
rout.flag = data.Rows[i]["FLAG"].ToString();
//鏍规嵁宸ヨ壓璺嚎缂栫爜鑾峰彇鍏宠仈鐨勫伐搴忎俊鎭�
@@ -768,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);
@@ -848,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);
@@ -911,7 +935,7 @@
mes.Message = "宸ヨ壓璺嚎宸茶宸ュ崟寮曠敤锛屼笉鍏佽鍒犻櫎!";
mes.data = null;
}
- else
+ else
{
//鍒ゆ柇褰撳墠宸ヨ壓璺嚎鏄惁鏈夎缃妭鎷嶅伐浠�(鏈夎缃紝鎻愮ず鍏堝垹闄よ妭鎷嶅伐浠疯缃�)
sql = @"select * from TPrteEqp_Stad where route_code=@routecode";
@@ -924,7 +948,7 @@
mes.Message = "宸ヨ壓璺嚎宸茶缃妭鎷嶅伐浠凤紝璇峰厛鍒犻櫎璁剧疆!";
mes.data = null;
}
- else
+ else
{
//鍒犻櫎宸ヨ壓璺嚎鍏宠仈宸ュ簭琛�
sql = @"delete TFlw_Rtdt where rout_code=@routecode";
@@ -967,6 +991,30 @@
+ #region[宸ュ簭涓嬫媺鏌ヨ鎺ュ彛]
+ public static ToMessage StepSelect()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇宸ュ簭鏁版嵁
+ sql = @"select stepcode,stepname from TStep where is_delete<>'1' ";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
#region[宸ュ簭鏌ヨ]
public static ToMessage StepSearch(string stepcode, string stepname, string enable, string steptypecode, string createuser, int startNum, int endNum, string prop, string order)
{
@@ -1005,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);
@@ -1139,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)
@@ -1199,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++)
@@ -1241,14 +1289,15 @@
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++)
{
StepEqpCn cn = new StepEqpCn();
- cn.code= data0.Rows[j]["CODE"].ToString();//璁惧缂栫爜
+ cn.code = data0.Rows[j]["CODE"].ToString();//璁惧缂栫爜
cn.name = data0.Rows[j]["NAME"].ToString();//璁惧鍚嶇О
cn.type = data0.Rows[j]["TYPE"].ToString();//宸ヤ綔绔欑被鍨�(E:璁惧 W:澶栧崗渚涙柟)
cn.flag = data0.Rows[j]["FLAG"].ToString();//鍏宠仈鏍囪瘑
@@ -1286,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
@@ -1341,5 +1390,465 @@
return mes;
}
#endregion
+
+ #region[宸ュ簭鍏宠仈缂洪櫡鏌ヨ]
+ public static ToMessage StepAssociationDefect(string stepcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<StepDefect> list = new List<StepDefect>();
+ try
+ {
+ //鑾峰彇宸ュ簭鍏宠仈缂洪櫡鏁版嵁(鍖呭惈鍏宠仈鏍囪瘑)
+ 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=@stepcode and is_delete<>'1'
+ ) B on A.code=B.defect_code";
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ for (int i = 0; i < data.Rows.Count; i++)
+ {
+ StepDefect dft = new StepDefect();
+ dft.code = data.Rows[i]["CODE"].ToString();
+ dft.name = data.Rows[i]["NAME"].ToString();
+ dft.flag = data.Rows[i]["FLAG"].ToString();
+ list.Add(dft);
+ }
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = list;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ュ簭鍏宠仈缂洪櫡鎻愪氦]
+ public static ToMessage SaveStepAssociationDefect(string stepcode, string username, List<ObjectData> json)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ if (json == null || json.Count <= 0)
+ {
+ //娓呴櫎宸ュ簭鍏宠仈缂洪櫡琛ㄦ暟鎹�
+ sql = @"delete TDefect_Step where step_code=@stepcode";
+ list.Add(new { str = sql, parm = new { stepcode = stepcode } });
+ //鏍囪宸ュ簭琛ㄥ叧鑱斿伐浣滅珯鏍囪瘑
+ sql = @"update TStep set is_defect='N' where stepcode=@stepcode";
+ list.Add(new { str = sql, parm = new { stepcode = stepcode } });
+ }
+ else
+ {
+ //娓呴櫎宸ュ簭鍏宠仈缂洪櫡琛ㄦ暟鎹�
+ sql = @"delete TDefect_Step where step_code=@stepcode";
+ list.Add(new { str = sql, parm = new { stepcode = stepcode } });
+ //寰幆鍐欏叆鐢ㄦ埛鍏宠仈瑙掕壊琛�
+ for (int i = 0; i < json.Count; i++)
+ {
+ sql = @"insert into TDefect_Step(defect_code,step_code,lm_user,lm_date) values(@defect_code,@stepcode,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ defect_code = json[i].code,
+ stepcode = stepcode,
+ lm_user = username,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ //鏍囪鐗╂枡琛ㄥ叧鑱斿伐鑹鸿矾绾挎爣璇�
+ sql = @"update TStep set is_defect='Y' where stepcode=@stepcode";
+ list.Add(new { str = sql, parm = new { stepcode = stepcode } });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.Message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+
+ #region[浜у搧淇℃伅涓嬫媺妗嗘煡璇
+ public static ToMessage PartSelect()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇璁惧绫诲瀷鏁版嵁
+ sql = @"select partcode,partname,partspec from TMateriel_Info where is_delete<>'1' ";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浜у搧缂栫爜鏌ユ壘宸ヨ壓璺嚎涓嬫媺妗哴
+ public static ToMessage PartSelectRpute(string partcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //閫氳繃浜у搧缂栫爜鏌ユ壘鍏宠仈鐨勫伐鑹鸿矾绾夸俊鎭�
+ sql = @"select A.route_code,B.name as route_name
+ from TMateriel_Route A
+ inner join TFlw_Rout B on A.route_code=B.code
+ where A.materiel_code=@partcode and B.is_delete<>'1' and A.is_delete<>'1'";
+ dynamicParams.Add("@partcode", partcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鏍规嵁宸ヨ壓璺嚎缂栫爜鏌ユ壘鍏宠仈宸ュ簭闆嗗悎]
+ public static ToMessage RouteSelectStep(string routecode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //閫氳繃浜у搧缂栫爜鏌ユ壘鍏宠仈鐨勫伐鑹鸿矾绾夸俊鎭�
+ sql = @"select B.stepcode as code,B.stepname as name
+ from TFlw_Rtdt A
+ inner join TStep B on A.step_code=B.stepcode
+ where A.rout_code=@routecode and B.is_delete<>'1' and A.is_delete<>'1'";
+ dynamicParams.Add("@routecode", routecode);
+ var data = DapperHelper.select<ObjectData>(sql, dynamicParams);
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鏍规嵁宸ュ簭绾跨紪鐮佹煡鎵惧叧鑱旇澶囦笅鎷夋闆嗗悎]
+ public static ToMessage StepSelectEqp(string stepcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //閫氳繃浜у搧缂栫爜鏌ユ壘鍏宠仈鐨勫伐鑹鸿矾绾夸俊鎭�
+ sql = @"select B.code,B.name from TFlw_Rteqp A
+ left join TEqpInfo B on A.eqp_code=B.code
+ where A.step_code=@stepcode and A.style='E' and A.is_delete<>'1' and B.is_delete<>'1'";
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.select<ObjectData>(sql, dynamicParams);
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鏍规嵁宸ュ簭绾跨紪鐮佹煡鎵惧叧鑱旇澶囬泦鍚圿
+ public static ToMessage StepSelectEqpList(string partcode, string routecode, string stepcode, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ 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
+ union all
+ select @partcode as materiel_code,eqp_code,'0' as eqp_value,'0' as stand_value,'0' as cavity_qty,'0' as unprice
+ from TFlw_Rteqp where step_code=@stepcode and style='E' and @partcode+eqp_code+step_code not in(select materiel_code+eqp_code+step_code from TPrteEqp_Stad)
+ ) A
+ left join TEqpInfo B on A.eqp_code=B.code
+ left join TOrganization T on B.wksp_code=T.org_code
+ left join TMateriel_Info C on A.materiel_code=C.partcode
+ where B.is_delete<>'1' and T.is_delete<>'1' and C.is_delete<>'1' ";
+ dynamicParams.Add("@partcode", partcode);
+ dynamicParams.Add("@routecode", routecode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鑺傛媿宸ヤ环鏌ヨ]
+ public static ToMessage BeatRateSearch(string partcode, string routecode, string stepcode, string eqpcode, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (partcode != "" && partcode != null)
+ {
+ search += "and A.materiel_code=@partcode ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (routecode != "" && routecode != null)
+ {
+ search += "and A.route_code=@routecode ";
+ dynamicParams.Add("@routecode", routecode);
+ }
+ if (stepcode != "" && stepcode != null)
+ {
+ search += "and A.step_code=@stepcode ";
+ dynamicParams.Add("@stepcode", stepcode);
+ }
+ if (eqpcode != "" && eqpcode != null)
+ {
+ search += "and A.eqp_code=@eqpcode";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.materiel_code as partcode,B.partname,B.partspec,A.route_code,C.name as route_name,
+ D.stepcode,D.stepname,A.eqp_code,E.name as eqp_name,E.wksp_code,F.org_name as wksp_name,
+ A.eqp_value,A.stand_value,A.cavity_qty,A.unprice
+ from TPrteEqp_Stad A
+ left join TMateriel_Info B on A.materiel_code=B.partcode
+ left join TFlw_Rout C on A.route_code=C.code
+ left join TStep D on A.step_code=D.stepcode
+ left join TEqpInfo E on A.eqp_code=E.code
+ left join TOrganization F on E.wksp_code=F.org_code
+ where B.is_delete<>'1' and C.is_delete<>'1' and D.is_delete<>'1' and E.is_delete<>'1' and F.is_delete<>'1' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鑺傛媿宸ヤ环鎻愪氦]
+ public static ToMessage SaveBeatRate(string partcode, string routecode, string stepcode, string eqpcode, string wkshopcode, string eqp_value, string stand_value, string cavity_qty, string unprice, string username)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //褰撳墠宸ュ簭鏄惁鍏宠仈宸ヨ壓璺嚎
+ sql = @"select * from TPrteEqp_Stad
+ where materiel_code=@partcode and route_code=@routecode and step_code=@stepcode and eqp_code=@eqpcode";
+ dynamicParams.Add("@partcode", partcode);
+ dynamicParams.Add("@routecode", routecode);
+ dynamicParams.Add("@stepcode", stepcode);
+ dynamicParams.Add("@eqpcode", eqpcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0) //琚缃叧鑱旇繃灏变慨鏀�
+ {
+ sql = @"update TPrteEqp_Stad set stand_value=@stand_value,eqp_value=@eqp_value,cavity_qty=@cavity_qty,unprice=@unprice,lm_user=@username,lm_date=@userdate
+ where materiel_code=@partcode and route_code=@routecode and step_code=@stepcode and eqp_code=@eqpcode ";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ partcode = partcode,
+ routecode = routecode,
+ stepcode = stepcode,
+ eqpcode = eqpcode,
+ stand_value = stand_value,
+ eqp_value = eqp_value,
+ cavity_qty = cavity_qty,
+ unprice = unprice,
+ username = username,
+ userdate = DateTime.Now.ToString()
+ }
+ });
+ }
+ else
+ {
+ sql = @"insert into TPrteEqp_Stad(materiel_code,eqp_code,stand_value,route_code,unprice,eqp_value,cavity_qty,wkspcode,lm_user,lm_date,step_code)
+ values(@partcode,@eqpcode,@stand_value,@routecode,@unprice,@eqp_value,@cavity_qty,@wkspcode,@username,@userdate,@stepcode)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ partcode = partcode,
+ eqpcode = eqpcode,
+ stand_value = stand_value,
+ routecode = routecode,
+ unprice = unprice,
+ eqp_value = eqp_value,
+ cavity_qty = cavity_qty,
+ wkspcode = wkshopcode,
+ username = username,
+ userdate = DateTime.Now.ToString(),
+ stepcode = stepcode
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.Message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鑺傛媿宸ヤ环鍒犻櫎]
+ public static ToMessage SaveBeatRate(string partcode, string routecode, string stepcode, string eqpcode)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+
+ //鍒犻櫎鑺傛媿宸ヤ环琛�
+ sql = @"delete TPrteEqp_Stad where materiel_code=@partcode and route_code=@routecode and step_code=@stepcode and eqp_code=@eqpcode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ partcode = partcode,
+ routecode = routecode,
+ stepcode = stepcode,
+ eqpcode = eqpcode
+ }
+ });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.Message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
}
}
\ No newline at end of file
--
Gitblit v1.9.3