From ac020ff0a39df6a993fd69ff16f1ef0c989413a6 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期三, 16 十一月 2022 09:34:28 +0800
Subject: [PATCH] 班组人员工资接口修改
---
VueWebApi/DLL/DAL/ProductionManagementDAL.cs | 551 ++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 508 insertions(+), 43 deletions(-)
diff --git a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
index 1bc7550..a56f202 100644
--- a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
+++ b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
@@ -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)
@@ -2410,7 +2410,7 @@
// --------------鏌ヨ鎸囧畾鑷埗鎶ュ伐澶栧崗鏀舵枡鏁版嵁--------------
var total = 0; //鎬绘潯鏁�
var sql = @"select * from(
- select A.id,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,A.task_qty,M.wkshp_code,G.org_name as wkshp_name,A.eqp_code,E.name as eqp_name,
+ select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,A.task_qty,M.wkshp_code,G.org_name as wkshp_name,A.eqp_code,E.name as eqp_name,
M.route_code,R.name as route_name,A.step_code,S.stepname,S.flwtype,D.first_choke,D.last_choke,T.unprice,B.usergroup_code,O.group_name as usergroup_name,B.report_person as usercode,U.username,
B.report_date,B.report_qty,B.ng_qty,B.bad_qty
from TK_Wrk_Record A
@@ -2425,24 +2425,24 @@
left join TFlw_Rtdt D on M.route_code=D.rout_code and A.step_code=D.step_code
left join TUser U on B.report_person=U.usercode
left join TGroup O on U.usergroup_code=O.group_code
- where A.style='B' and B.style='B'
- union all
- select A.id,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,M.plan_qty as task_qty,M.wkshp_code,G.org_name as wkshp_name,A.wx_code as eqp_code,E.name as eqp_name,
- M.route_code,R.name as route_name,A.step_code,S.stepname,S.flwtype,D.first_choke,D.last_choke,T.unprice,''as usergroup_code,''as usergroup_name,B.in_person as usercode,U.username,
- B.in_time as report_date,B.sqty as report_qty,B.ng_qty,B.bad_qty
- from TK_Wrk_OutRecord A
- inner join TK_Wrk_OutRecordSub B on A.id=B.m_id
- left join TK_Wrk_Man M on A.wo_code=M.wo_code
- left join TStep S on A.step_code=S.stepcode
- left join TPrteEqp_Stad T on A.materiel_code=T.materiel_code and M.route_code=T.route_code and A.step_code=T.step_code and A.wx_code=T.eqp_code
- left join TMateriel_Info P on A.materiel_code=P.partcode
- left join TOrganization G on M.wkshp_code=G.org_code
- left join TCustomer E on A.wx_code=E.code and E.btype='WX'
- left join TFlw_Rout R on M.route_code=R.code
- left join TFlw_Rtdt D on M.route_code=D.rout_code and A.step_code=D.step_code
- left join TUser U on B.in_person=U.usercode
- where A.style='S' and B.style='S'
+ where A.style='B' and B.style='B' and M.status<>'CLOSED'
) as AA where" + search;
+ //union all
+ //select A.id,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,M.plan_qty as task_qty,M.wkshp_code,G.org_name as wkshp_name,A.wx_code as eqp_code,E.name as eqp_name,
+ //M.route_code,R.name as route_name,A.step_code,S.stepname,S.flwtype,D.first_choke,D.last_choke,T.unprice,'' as usergroup_code,'' as usergroup_name,B.in_person as usercode,U.username,
+ //B.in_time as report_date,B.sqty as report_qty,B.ng_qty,B.bad_qty
+ //from TK_Wrk_OutRecord A
+ //inner join TK_Wrk_OutRecordSub B on A.id = B.m_id
+ //left join TK_Wrk_Man M on A.wo_code = M.wo_code
+ //left join TStep S on A.step_code = S.stepcode
+ //left join TPrteEqp_Stad T on A.materiel_code = T.materiel_code and M.route_code = T.route_code and A.step_code = T.step_code and A.wx_code = T.eqp_code
+ //left join TMateriel_Info P on A.materiel_code = P.partcode
+ //left join TOrganization G on M.wkshp_code = G.org_code
+ //left join TCustomer E on A.wx_code = E.code and E.btype = 'WX'
+ //left join TFlw_Rout R on M.route_code = R.code
+ //left join TFlw_Rtdt D on M.route_code = D.rout_code and A.step_code = D.step_code
+ //left join TUser U on B.in_person = U.usercode
+ //where A.style = 'S' and B.style = 'S' and M.status<>'CLOSED'
var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
mes.code = "200";
mes.Message = "鏌ヨ鎴愬姛!";
@@ -2461,13 +2461,11 @@
#endregion
#region[鐢熶骇绠$悊,淇敼鎶ュ伐鏁版嵁鎻愪氦]
- public static ToMessage MesOrderStepVerifySeave(string username, List<UpdateProductReport> json)
+ public static ToMessage MesOrderStepUpdateSeave(string username, List<UpdateProductReport> json)
{
var sql = "";
- string[] arra1 = new string[] { };
List<object> list = new List<object>();
var dynamicParams = new DynamicParameters();
- decimal sumrepair_qty = 0, sumbad_qty = 0; //绱缁翠慨鏁伴噺銆佺疮璁℃姤搴熸暟閲�
try
{
string date = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
@@ -2478,10 +2476,10 @@
for (int i = 0; i < json.Count; i++)
{
//鑷埗宸ュ簭
- if (json[i].flw_type.ToString()== "Z")
+ if (json[i].flw_type.ToString() == "Z")
{
//鏄惁棣栭亾
- if (json[i].first_choke == "Y")
+ if (json[i].first_choke == "Y")
{
decimal this_reportqty = decimal.Parse(json[i].report_qty.ToString()); //鎶ュ伐鏁伴噺(鍚堟牸)
decimal this_ngqty = decimal.Parse(json[i].ng_qty.ToString()); //涓嶈壇鏁伴噺
@@ -2493,16 +2491,16 @@
dynamicParams.Add("@id", json[i].id);
dynamicParams.Add("@step_code", json[i].step_code);
var dt = DapperHelper.selectdata(sql, dynamicParams);
- decimal notthis_reportqty =decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
+ decimal notthis_reportqty = decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
decimal notthis_ngqty = decimal.Parse(dt.Rows[0]["ng_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
decimal notthis_badqty = decimal.Parse(dt.Rows[0]["bad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
//鍒ゆ柇锛氬綋鍓嶅伐搴忔姤宸ヨ褰曪細鏈鎶ュ伐鏁伴噺+鏈涓嶈壇鏁伴噺+鏈鎶ュ簾鏁伴噺+褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟+褰撳墠宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠宸ュ簭闈炴湰娆℃姤搴熸�绘暟>宸ュ崟浠诲姟鏁伴噺
decimal updatereportsumqty = this_reportqty + this_ngqty + this_badqty + notthis_reportqty + notthis_ngqty + notthis_badqty;
- if (updatereportsumqty > decimal.Parse(json[i].task_qty.ToString()))
+ if (updatereportsumqty > decimal.Parse(json[i].task_qty.ToString()))
{
mes.code = "300";
mes.count = 0;
- mes.Message = "鑷埗棣栭亾宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�"+ updatereportsumqty + "銆戜笉鑳藉ぇ浜庡伐鍗曚换鍔℃暟閲忥細銆�"+ json[i].task_qty.ToString() + "銆�!";
+ mes.Message = "鑷埗棣栭亾宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庡伐鍗曚换鍔℃暟閲忥細銆�" + json[i].task_qty.ToString() + "銆�!";
mes.data = null;
return mes;
}
@@ -2515,11 +2513,11 @@
if (dt0.Rows.Count > 0)
{
//鍒ゆ柇褰撳墠宸ュ簭锛氭姤宸ユ�绘暟鏁伴噺+涓嶈壇鎬绘暟鏁伴噺+鎶ュ簾鎬绘暟鏁伴噺<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�+涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�+涓嬮亾宸ュ簭鎶ュ簾鎬绘暟閲�
- decimal last_reportqty = decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�
- decimal last_ngqty = decimal.Parse(dt.Rows[0]["ng_qty"].ToString()); //涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�
- decimal last_badqty = decimal.Parse(dt.Rows[0]["bad_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ簾鎬绘暟閲�
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�
+ decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�
+ decimal last_badqty = decimal.Parse(dt0.Rows[0]["bad_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ簾鎬绘暟閲�
decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_badqty;
- if (updatereportsumqty<last_updatereportsumqty)
+ if (updatereportsumqty < last_updatereportsumqty)
{
mes.code = "300";
mes.count = 0;
@@ -2528,7 +2526,7 @@
return mes;
}
}
- //淇敼鎶ュ伐
+
}
//鏄惁鏈亾
if (json[i].last_choke == "Y")
@@ -2548,7 +2546,7 @@
decimal notthis_badqty = decimal.Parse(dt.Rows[0]["bad_qty"].ToString()); //褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
//鑾峰彇褰撳墠鏈亾宸ュ簭鎶ュ伐鎬绘暟閲忥細鏈淇敼鎶ュ伐鏁伴噺+鏈淇敼涓嶈壇鏁伴噺+鏈淇敼鎶ュ簾鏁伴噺+褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ユ�绘暟+褰撳墠鏈亾宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤搴熸�绘暟
decimal updatereportsumqty = this_reportqty + this_ngqty + this_badqty + notthis_reportqty + notthis_ngqty + notthis_badqty;
-
+
//鏌ヨ褰撳墠鏈亾宸ュ簭涓婇亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(bad_qty),0) as bad_qty
from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq-1";
@@ -2558,11 +2556,11 @@
if (dt0.Rows.Count > 0)
{
//鍒ゆ柇锛氬綋鍓嶆湯閬撳伐搴忔姤宸ヨ褰曪細褰撳墠鏈亾宸ュ簭鎶ュ伐鎬绘暟(鍚堟牸+涓嶈壇+鎶ュ簾)>涓婇亾宸ュ簭鎶ュ伐鎬绘暟(鍚堟牸+涓嶈壇+鎶ュ簾)
- decimal last_reportqty = decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�
- decimal last_ngqty = decimal.Parse(dt.Rows[0]["ng_qty"].ToString()); //涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�
- decimal last_badqty = decimal.Parse(dt.Rows[0]["bad_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ簾鎬绘暟閲�
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�
+ decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�
+ decimal last_badqty = decimal.Parse(dt0.Rows[0]["bad_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ簾鎬绘暟閲�
decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_badqty;
- if (updatereportsumqty >last_updatereportsumqty)
+ if (updatereportsumqty > last_updatereportsumqty)
{
mes.code = "300";
mes.count = 0;
@@ -2571,22 +2569,130 @@
return mes;
}
}
- //淇敼鎶ュ伐
}
else //闈為閬撻潪鏈亾
- {
-
+ {
+ decimal this_reportqty = decimal.Parse(json[i].report_qty.ToString()); //鎶ュ伐鏁伴噺(鍚堟牸)
+ decimal this_ngqty = decimal.Parse(json[i].ng_qty.ToString()); //涓嶈壇鏁伴噺
+ decimal this_badqty = decimal.Parse(json[i].bad_qty.ToString()); //鎶ュ簾鏁伴噺
+ //鏌ヨ褰撳墠宸ュ簭闈炴娆℃姤宸ワ細鎬绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(bad_qty),0) as bad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and id<>@id and step_code=@step_code";
+ dynamicParams.Add("@wo_code", json[i].wo_code);
+ dynamicParams.Add("@id", json[i].id);
+ dynamicParams.Add("@step_code", json[i].step_code);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ decimal notthis_reportqty = decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
+ decimal notthis_ngqty = decimal.Parse(dt.Rows[0]["ng_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
+ decimal notthis_badqty = decimal.Parse(dt.Rows[0]["bad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
+ //鑾峰彇褰撳墠鏈亾宸ュ簭鎶ュ伐鎬绘暟閲忥細鏈淇敼鎶ュ伐鏁伴噺+鏈淇敼涓嶈壇鏁伴噺+鏈淇敼鎶ュ簾鏁伴噺+褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟+褰撳墠宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠宸ュ簭闈炴湰娆℃姤搴熸�绘暟
+ decimal updatereportsumqty = this_reportqty + this_ngqty + this_badqty + notthis_reportqty + notthis_ngqty + notthis_badqty;
+ //鏌ヨ褰撳墠宸ュ簭涓婇亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(bad_qty),0) as bad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq-1";
+ dynamicParams.Add("@wo_code", json[i].wo_code);
+ dynamicParams.Add("@step_seq", json[i].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇锛氬綋鍓嶅伐搴忔姤宸ヨ褰曪細褰撳墠宸ュ簭鎶ュ伐鎬绘暟(鍚堟牸+涓嶈壇+鎶ュ簾)>涓婇亾宸ュ簭鎶ュ伐鎬绘暟(鍚堟牸+涓嶈壇+鎶ュ簾)
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�
+ decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�
+ decimal last_badqty = decimal.Parse(dt0.Rows[0]["bad_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ簾鎬绘暟閲�
+ decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_badqty;
+ if (updatereportsumqty > last_updatereportsumqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "鑷埗宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庝笂閬撳伐搴忔姤宸ユ�绘暟閲忥細銆�" + last_updatereportsumqty + "銆�,璇疯緭鍏ュ悎娉曟暟鍊兼垨鍏堜慨鏀逛笂閬撳伐搴忔姤宸ユ暟閲�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(bad_qty),0) as bad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[i].wo_code);
+ dynamicParams.Add("@step_seq", json[i].step_seq);
+ var dt1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt1.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氭姤宸ユ�绘暟鏁伴噺+涓嶈壇鎬绘暟鏁伴噺+鎶ュ簾鎬绘暟鏁伴噺<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�+涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�+涓嬮亾宸ュ簭鎶ュ簾鎬绘暟閲�
+ decimal last_reportqty = decimal.Parse(dt1.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�
+ decimal last_ngqty = decimal.Parse(dt1.Rows[0]["ng_qty"].ToString()); //涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�
+ decimal last_badqty = decimal.Parse(dt1.Rows[0]["bad_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ簾鎬绘暟閲�
+ decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_badqty;
+ if (updatereportsumqty < last_updatereportsumqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "鑷埗宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉皬浜庝笅閬撳伐搴忔姤宸ユ�绘暟閲忥細銆�" + last_updatereportsumqty + "銆�,璇疯緭鍏ュ悎娉曟暟鍊兼垨鍏堜慨鏀逛笅閬撳伐搴忔姤宸ユ暟閲�!";
+ mes.data = null;
+ return mes;
+ }
+ }
}
-
+
+ ///////////////////////////////淇敼鎶ュ伐//////////////////////////////
+
+ //鍥炲啓瀵瑰簲鐨勬姤宸ヨ褰曞瓙琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
+ sql = @"update TK_Wrk_RecordSub set report_qty=report_qty+@repair_qty,ng_qty=ng_qty+@ng_qty,bad_qty=bad_qty+@bad_qty,
+ updatereportuser=@updatereportuser,updatereportdate=@updatereportdate
+ where m_id=@m_id and id=@id and style='B'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ m_id = int.Parse(json[i].id),
+ id = int.Parse(json[i].sbid),
+ repair_qty = decimal.Parse(json[i].report_qty),
+ ng_qty = decimal.Parse(json[i].ng_qty),
+ bad_qty = decimal.Parse(json[i].bad_qty),
+ updatereportuser = username,
+ updatereportdate = date
+ }
+ });
+ //鍥炲啓瀵瑰簲鐨勬姤宸ヨ褰曚富琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
+ sql = @"update TK_Wrk_Record set good_qty=good_qty+@good_qty,ng_qty=ng_qty+@ng_qty,bad_qty=bad_qty+@bad_qty
+ where wo_code=@wo_code and step_code=@step_code and id=@id and style='B'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ good_qty = decimal.Parse(json[i].report_qty),
+ ng_qty = decimal.Parse(json[i].ng_qty),
+ bad_qty = decimal.Parse(json[i].bad_qty),
+ wo_code = json[i].wo_code,
+ step_code = json[i].step_code,
+ id = int.Parse(json[i].id)
+ }
+ });
+ //鍥炲啓涓嶈壇
+ sql = @"update CSR_WorkRecord_Defect set defect_qty=defect_qty+@ng_qty,updatereportuser=@updatereportuser,updatereportdate=@updatereportdate
+ where wo_code=@wo_code and step_code=@step_code and record_id=@id and style='B'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ ng_qty = decimal.Parse(json[i].ng_qty),
+ wo_code = json[i].wo_code,
+ step_code = json[i].step_code,
+ id = int.Parse(json[i].id),
+ updatereportuser = username,
+ updatereportdate = date
+ }
+ });
}
//澶栧崗宸ュ簭
if (json[i].flw_type.ToString() == "S")
{
-
+
}
}
-
bool aa = DapperHelper.DoTransaction(list);
if (aa)
{
@@ -2614,6 +2720,365 @@
}
#endregion
+ #region[鐢熶骇绠$悊,淇敼鎶ュ伐瀹℃牳鎻愪氦]
+ public static ToMessage MesOrderStepVerifySeave(string username, List<UpdateProductReport> json)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ try
+ {
+ string date = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
+ list.Clear();
+
+ //寰幆json鏁版嵁
+ for (int i = 0; i < json.Count; i++)
+ {
+
+ ///////////////////////////////淇敼鎶ュ伐//////////////////////////////
+
+ //鍥炲啓瀵瑰簲鐨勬姤宸ヨ褰曞瓙琛ㄥ鏍哥姸鎬併�佸鏍镐汉銆佸鏍告椂闂�
+ sql = @"update TK_Wrk_RecordSub set verify=@verify,verifyuser=@verifyuser,verifydate=@verifydate
+ where m_id=@m_id and id=@id and style='B'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ m_id = int.Parse(json[i].id),
+ id = int.Parse(json[i].sbid),
+ verify="Y",
+ verifyuser = username,
+ verifydate = date
+ }
+ });
+ //鍥炲啓涓嶈壇
+ sql = @"update CSR_WorkRecord_Defect set verify=verify,verifyuser=@verifyuser,verifydate=@verifydate
+ where wo_code=@wo_code and step_code=@step_code and record_id=@id and style='B'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = json[i].wo_code,
+ step_code = json[i].step_code,
+ id = int.Parse(json[i].id),
+ verify="Y",
+ verifyuser = username,
+ verifydate = date
+ }
+ });
+ //鍐欏叆鎶ュ伐璁板綍瀹℃牳琛�
+ sql = @"insert into TK_WorkRecord_Verify(report_id,report_sbid,wo_code,partnumber,task_qty,wkshp_code,eqp_code,route_code,
+ step_seq,step_code,flw_type,first_choke,last_choke,unprice,usergroup_code,usercode,report_date,report_qty,report_dvalue,ng_qty,ng_dvalue,bad_qty,bad_dvalue,bad_money)
+ values(@report_id,@report_sbid,@wo_code,@partnumber,@task_qty,@wkshp_code,@eqp_code,@route_code,
+ @step_seq,@step_code,@flw_type,@first_choke,@last_choke,@unprice,@usergroup_code,@usercode,@report_date,@report_qty,@report_dvalue,@ng_qty,@ng_dvalue,@bad_qty,@bad_dvalue,@bad_money)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ report_id=json[i].id.ToString(),
+ report_sbid=json[i].sbid.ToString(),
+ wo_code=json[i].wo_code.ToString(),
+ partnumber=json[i].partnumber.ToString(),
+ task_qty=json[i].task_qty.ToString(),
+ wkshp_code=json[i].wkshp_code.ToString(),
+ eqp_code=json[i].eqp_code.ToString(),
+ route_code=json[i].route_code.ToString(),
+ step_seq=json[i].step_seq.ToString(),
+ step_code=json[i].step_code.ToString(),
+ flw_type=json[i].flw_type.ToString(),
+ first_choke=json[i].first_choke.ToString(),
+ last_choke=json[i].last_choke.ToString(),
+ unprice=json[i].unprice.ToString(),
+ usergroup_code=json[i].usergroup_code.ToString(),
+ usercode=json[i].usercode.ToString(),
+ report_date=json[i].report_date.ToString(),
+ report_qty=json[i].report_qty.ToString(),
+ report_dvalue=json[i].report_dvalue.ToString(),
+ ng_qty=json[i].ng_qty.ToString(),
+ ng_dvalue=json[i].ng_dvalue.ToString(),
+ bad_qty=json[i].bad_qty.ToString(),
+ bad_dvalue=json[i].bad_dvalue.ToString(),
+ bad_money=json[i].bad_money.ToString()
+ }
+ });
+ }
+
+ 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 MesOrderStepNoVerifySeave(string username, List<UpdateProductReport> json)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ try
+ {
+ string date = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
+ list.Clear();
+
+ //寰幆json鏁版嵁
+ for (int i = 0; i < json.Count; i++)
+ {
+
+ ///////////////////////////////淇敼鎶ュ伐//////////////////////////////
+
+ //鍥炲啓瀵瑰簲鐨勬姤宸ヨ褰曞瓙琛ㄥ鏍哥姸鎬併�佸鏍镐汉銆佸鏍告椂闂�
+ sql = @"update TK_Wrk_RecordSub set verify=@verify,verifyuser=@verifyuser,verifydate=@verifydate
+ where m_id=@m_id and id=@id and style='B'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ m_id = int.Parse(json[i].id),
+ id = int.Parse(json[i].sbid),
+ verify = "N",
+ verifyuser = "",
+ verifydate = ""
+ }
+ });
+ //鍥炲啓涓嶈壇
+ sql = @"update CSR_WorkRecord_Defect set verify=verify,verifyuser=@verifyuser,verifydate=@verifydate
+ where wo_code=@wo_code and step_code=@step_code and record_id=@id and style='B'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = json[i].wo_code,
+ step_code = json[i].step_code,
+ id = int.Parse(json[i].id),
+ verify = "N",
+ verifyuser = "",
+ verifydate = ""
+ }
+ });
+ //鍒犻櫎鎶ュ伐璁板綍瀹℃牳琛�
+ sql = @"delete from TK_WorkRecord_Verify where wo_code=@wo_code and report_id=@report_id and report_sbid=@report_sbid and step_seq=@step_seq and step_code=@step_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ report_id = json[i].id.ToString(),
+ report_sbid = json[i].sbid.ToString(),
+ wo_code = json[i].wo_code.ToString(),
+ step_seq = json[i].step_seq.ToString(),
+ step_code = json[i].step_code.ToString()
+ }
+ });
+ }
+
+ 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 MesOrderStepDeleteSeave(string username, List<UpdateProductReport> json)
+ {
+ var sql = "";
+ string[] arra1 = new string[] { };
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ string date = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
+ list.Clear();
+
+ //寰幆json鏁版嵁
+ for (int i = 0; i < json.Count; i++)
+ {
+ //鑷埗宸ュ簭
+ if (json[i].flw_type.ToString() == "Z")
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭鏄惁瀛樺湪涓嬮亾宸ュ簭寮�宸ヨ褰�
+ sql = @"select * from TK_Wrk_Record where wo_code=@wo_code and style='S' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[i].wo_code);
+ dynamicParams.Add("@step_seq", json[i].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭鏄惁瀛樺湪涓嬮亾宸ュ簭鎶ュ伐璁板綍
+ sql = @"select * from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[i].wo_code);
+ dynamicParams.Add("@step_seq", json[i].step_seq);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "褰撳墠宸ュ簭涓嬮亾宸ュ簭宸叉姤宸ヤ笉鍏佽鍒犻櫎!";
+ mes.data = null;
+ return mes;
+ }
+ }
+
+ ///////////////////////////////鍒犻櫎鎶ュ伐//////////////////////////////
+ //鍒犻櫎涓嬮亾宸ュ簭寮�宸ヨ褰�(涓昏澶勭悊涓嬮亾宸ュ簭宸插紑宸ユ湭鎶ュ伐)
+ sql = @"delete from TK_Wrk_Record where wo_code=@wo_code and step_seq=@step_seq+1 and style=@style";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code=json[i].wo_code.ToString(),
+ step_seq=json[i].step_seq.ToString(),
+ style = "S"
+ }
+ });
+ //鍒犻櫎鎶ュ伐缂洪櫡璁板綍琛�
+ sql = @"delete from CSR_WorkRecord_Defect where wo_code=@wo_code and partnumber=@partnumber and step_seq=@step_seq and step_code=@step_code and record_id=@record_id and style=@style ";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code=json[i].wo_code.ToString(),
+ partnumber = json[i].partnumber.ToString(),
+ step_seq = json[i].step_seq.ToString(),
+ step_code = json[i].step_code.ToString(),
+ record_id = int.Parse(json[i].id),
+ style = "B"
+ }
+ });
+ //鍒犻櫎鎶ュ伐缂洪櫡澶勭悊璁板綍琛�
+ sql = @"delete from CSR_WorkRecord_DefectHandle where wo_code=@wo_code and partnumber=@partnumber and step_seq=@step_seq and step_code=@step_code and record_subid=@record_subid and style=@style";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = json[i].wo_code.ToString(),
+ partnumber = json[i].partnumber.ToString(),
+ step_seq = json[i].step_seq.ToString(),
+ step_code = json[i].step_code.ToString(),
+ record_subid = int.Parse(json[i].id),
+ style = "B"
+ }
+ });
+ //鍒犻櫎鎶ュ伐璁板綍瀛愯〃
+ sql = @"delete from TK_Wrk_RecordSub where id=@id and m_id=@m_id and style=@style";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ id = int.Parse(json[i].id),
+ m_id = int.Parse(json[i].sbid),
+ style = "B"
+ }
+ });
+ //鍒犻櫎鎶ュ伐璁板綍涓昏〃
+ sql = @"delete from TK_Wrk_Record where id=@id and style=@style";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ id = int.Parse(json[i].id),
+ m_id = int.Parse(json[i].sbid),
+ style = "B"
+ }
+ });
+ //鍥炲啓宸ュ崟宸ュ簭琛�(鍚堟牸鏁伴噺銆佷笉鑹暟閲忋�佹姤搴熸暟閲�)
+ sql = @"update TK_Wrk_Step set good_qty=good_qty-@report_qty,ng_qty=ng_qty-@ng_qty,bad_qty=bad_qty-@bad_qty where wo_code=@wo_code and seq=@step_seq and step_code=@step_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code=json[i].wo_code.ToString(),
+ step_seq=json[i].step_seq.ToString(),
+ step_code=json[i].step_code.ToString(),
+ repair_qty = decimal.Parse(json[i].report_qty),
+ ng_qty = decimal.Parse(json[i].ng_qty),
+ bad_qty = decimal.Parse(json[i].bad_qty),
+ }
+ });
+ }
+ //澶栧崗宸ュ簭
+ if (json[i].flw_type.ToString() == "S")
+ {
+
+ }
+ }
+
+ 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[MES宸ュ崟鎵归噺鍏抽棴鏌ヨ]
--
Gitblit v1.9.3