From 32c0daf9a78039004bb6c39d578f7734f13d54b1 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期二, 10 十月 2023 10:54:47 +0800
Subject: [PATCH] 1.工单派发校验工价,工价未提前设置或设置部分,如果开关关闭时,不校验是否未设置 或者未设置全,工价复制表中都会写入,没有设置的工价就默认0 如果开关打开就必须要设置工价
---
VueWebApi/DLL/DAL/ProductionManagementDAL.cs | 86 ++++++++++++++++++++++++++++---------------
1 files changed, 56 insertions(+), 30 deletions(-)
diff --git a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
index 6a7c8d6..21d1d67 100644
--- a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
+++ b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
@@ -680,7 +680,7 @@
try
{
//鑾峰彇宸ヨ壓璺嚎瀵瑰簲宸ュ簭淇℃伅
- sql = @"select A.seq,T.stepcode,T.stepname,T.flwtype,T.descr from TFlw_Rtdt A
+ sql = @"select A.seq,T.stepcode,T.stepname,T.flwtype,T.descr,'0' as stepprice from TFlw_Rtdt A
left join TStep T on A.step_code=T.stepcode
where A.rout_code=@partcode ";
dynamicParams.Add("@partcode", routecode);
@@ -726,7 +726,7 @@
#endregion
#region[宸ュ崟娲惧彂閫夋嫨宸ヨ壓璺嚎鎴栭�夋嫨鐢熶骇杞﹂棿鏃跺垽鏂粦瀹氭潯浠禲
- public static ToMessage SelectRouteOrWkshop(string partcode, string routecode, string wkshopcode)
+ public static ToMessage SelectRouteOrWkshop(string partcode, string routecode, string wkshopcode,string is_steprice)
{
string sql = "";
var dynamicParams = new DynamicParameters();
@@ -781,8 +781,10 @@
return mes;
}
}
- //鍒ゆ柇宸ヨ壓璺嚎瀵瑰簲宸ュ簭鍏宠仈鐨勫伐浣滅珯鏄惁鏈夎缃妭鎷嶅伐浠�
- sql = @"select AA.step_code,AA.eqp_code,AA.flwtype,S.unprice from (
+ if (is_steprice == "Y")
+ {
+ //鍒ゆ柇宸ヨ壓璺嚎瀵瑰簲宸ュ簭鍏宠仈鐨勫伐浣滅珯鏄惁鏈夎缃妭鎷嶅伐浠�
+ sql = @"select AA.step_code,AA.eqp_code,AA.flwtype,S.unprice from (
select A.code,B.step_code,C.eqp_code,S.flwtype from TFlw_Rout A
inner join TFlw_Rtdt B on A.code=B.rout_code
left join TFlw_Rteqp C on B.step_code=C.step_code
@@ -791,21 +793,22 @@
) as AA
left join (select * from TPrteEqp_Stad where materiel_code=@partcode and route_code=@route_code and wkspcode=@wkshopcode) as S on
AA.code=S.route_code and AA.step_code=S.step_code and AA.eqp_code=S.eqp_code";
- dynamicParams.Add("@partcode", partcode);
- dynamicParams.Add("@route_code", routecode);
- dynamicParams.Add("@wkshopcode", wkshopcode);
- var dtc = DapperHelper.selectdata(sql, dynamicParams);
- for (int i = 0; i < dtc.Rows.Count; i++)
- {
- if (dtc.Rows[i]["flwtype"].ToString() == "Z") //鍒ゆ柇宸ュ簭鏄惁涓鸿嚜鍒�
+ dynamicParams.Add("@partcode", partcode);
+ dynamicParams.Add("@route_code", routecode);
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ var dtc = DapperHelper.selectdata(sql, dynamicParams);
+ for (int i = 0; i < dtc.Rows.Count; i++)
{
- if (dtc.Rows[i].IsNull("unprice") || decimal.Parse(dtc.Rows[i]["unprice"].ToString()) == 0)
+ if (dtc.Rows[i]["flwtype"].ToString() == "Z") //鍒ゆ柇宸ュ簭鏄惁涓鸿嚜鍒�
{
- mes.code = "300";
- mes.count = 0;
- mes.Message = "鑺傛媿宸ヤ环涓細褰撳墠浜у搧銆�" + partcode + "銆戯紝瀵瑰簲宸ヨ壓璺嚎銆�" + routecode + "銆戞湭璁剧疆(鎴栨湭璁剧疆鍏�)鎴栧伐浠峰皬浜庣瓑浜�0!";
- mes.data = null;
- return mes;
+ if (dtc.Rows[i].IsNull("unprice") || decimal.Parse(dtc.Rows[i]["unprice"].ToString()) == 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "鑺傛媿宸ヤ环涓細褰撳墠浜у搧銆�" + partcode + "銆戯紝瀵瑰簲宸ヨ壓璺嚎銆�" + routecode + "銆戞湭璁剧疆(鎴栨湭璁剧疆鍏�)鎴栧伐浠峰皬浜庣瓑浜�0!";
+ mes.data = null;
+ return mes;
+ }
}
}
}
@@ -954,21 +957,28 @@
CreateDate = DateTime.Now.ToString()
}
});
+
//鍐欏叆宸ュ崟宸ヨ壓璺嚎宸ュ簭宸ヤ环澶嶅埗琛�
sql = @"insert into TWoPrteEqp_Stad(wo,materiel_code,eqp_code,stand_value,opc_conver,route_code,unprice,eqp_value,cavity_qty,wkspcode,lm_user,lm_date,torg_code,is_delete,step_code)
- select distinct @mesordercode as wo,S.materiel_code,S.eqp_code,S.stand_value,S.opc_conver,S.route_code,S.unprice,
- S.eqp_value,S.cavity_qty,S.wkspcode,S.lm_user,S.lm_date,S.torg_code,S.is_delete,S.step_code
+ select distinct @mesordercode as wo,@partcode as materiel_code,AA.eqp_code,isnull(S.stand_value,0) as stand_value,isnull(S.opc_conver,0) as opc_conver,AA.rout_code,
+ isnull(S.unprice,0) as unprice,isnull(S.eqp_value,0) as eqp_value,isnull(S.cavity_qty,0) as cavity_qty,@wkshopcode as wkspcode,@usercode as lm_user,
+ getdate() as lm_date,S.torg_code,isnull(S.is_delete,0) as is_delete,AA.step_code from (
+ select A.rout_code,A.step_code,C.eqp_code
from TFlw_Rtdt A
inner join TFlw_Rteqp C on A.step_code=C.step_code
- inner join (select * from TPrteEqp_Stad where materiel_code=@materiel_code and route_code=@routecode) as S on C.step_code=S.step_code and C.eqp_code=S.eqp_code";
+ where A.rout_code=@routecode
+ ) as AA
+ left join (select * from TPrteEqp_Stad where materiel_code=@partcode and route_code=@routecode) as S on AA.step_code=S.step_code and AA.eqp_code=S.eqp_code";
list.Add(new
{
str = sql,
parm = new
{
mesordercode = mesordercode,
- materiel_code = partcode,
- routecode = routecode
+ wkshopcode = wkshopcode,
+ partcode = partcode,
+ routecode = routecode,
+ usercode = username
}
});
@@ -1076,21 +1086,28 @@
});
//鍐欏叆宸ュ崟宸ヨ壓璺嚎宸ュ簭宸ヤ环澶嶅埗琛�
sql = @"insert into TWoPrteEqp_Stad(wo,materiel_code,eqp_code,stand_value,opc_conver,route_code,unprice,eqp_value,cavity_qty,wkspcode,lm_user,lm_date,torg_code,is_delete,step_code)
- select distinct @mesordercode as wo,S.materiel_code,S.eqp_code,S.stand_value,S.opc_conver,S.route_code,S.unprice,
- S.eqp_value,S.cavity_qty,S.wkspcode,S.lm_user,S.lm_date,S.torg_code,S.is_delete,S.step_code
+ select distinct @mesordercode as wo,@partcode as materiel_code,AA.eqp_code,isnull(S.stand_value,0) as stand_value,isnull(S.opc_conver,0) as opc_conver,AA.rout_code,
+ isnull(S.unprice,0) as unprice,isnull(S.eqp_value,0) as eqp_value,isnull(S.cavity_qty,0) as cavity_qty,@wkshopcode as wkspcode,@usercode as lm_user,
+ getdate() as lm_date,S.torg_code,isnull(S.is_delete,0) as is_delete,AA.step_code from (
+ select A.rout_code,A.step_code,C.eqp_code
from TFlw_Rtdt A
inner join TFlw_Rteqp C on A.step_code=C.step_code
- inner join (select * from TPrteEqp_Stad where materiel_code=@materiel_code and route_code=@routecode) as S on C.step_code=S.step_code and C.eqp_code=S.eqp_code";
+ where A.rout_code=@routecode
+ ) as AA
+ left join (select * from TPrteEqp_Stad where materiel_code=@partcode and route_code=@routecode) as S on AA.step_code=S.step_code and AA.eqp_code=S.eqp_code";
list.Add(new
{
str = sql,
parm = new
{
mesordercode = mesordercode,
- materiel_code = partcode,
- routecode = routecode
+ wkshopcode = wkshopcode,
+ partcode = partcode,
+ routecode = routecode,
+ usercode = username
}
});
+
bool aa = DapperHelper.DoTransaction(list);
if (aa)
@@ -2009,9 +2026,18 @@
dynamicParams.Add("@wo_code", ordercode);
dynamicParams.Add("@stepcode", stepcode);
var data = DapperHelper.selectdata(sql, dynamicParams);
- mes.code = "200";
- mes.Message = "鏌ヨ鎴愬姛!";
- mes.data = data;
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.Message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.Message = "褰撳墠宸ュ簭鏈叧鑱旂敓浜ц澶�!";
+ mes.data = null;
+ }
}
catch (Exception e)
{
--
Gitblit v1.9.3