From 9c634fd767aec36ef97c3a814bf7a29c67d20ee1 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期五, 29 三月 2024 10:57:35 +0800
Subject: [PATCH] 修改单据重复显示问题,增加工单源单id关联
---
VueWebApi/DLL/DAL/ProductionManagementDAL.cs | 31 ++++++++++++++++++-------------
1 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
index 5f7ba7b..6e4e477 100644
--- a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
+++ b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
@@ -579,7 +579,7 @@
var sql = @"select A.id, A.status,A.wotype,A.printcount,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.plan_qty,A.wkshp_code,C.org_name as wkshp_name,
A.route_code,E.name as route_name,A.stck_code,F.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,W.saleOrderCode,U.username as lm_user,A.lm_date
from TK_Wrk_Man A
- left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code
+ left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code and A.sourceid=W.id
left join TMateriel_Info B on A.materiel_code=B.partcode
left join TOrganization C on A.wkshp_code=C.org_code
left join T_Sec_Stck D on A.stck_code=D.code
@@ -662,7 +662,7 @@
var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.plan_qty,A.wkshp_code,C.org_name as wkshp_name,
A.route_code,E.name as route_name,A.stck_code,F.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,W.saleOrderCode,U.username as lm_user,A.lm_date,S.bad_qty
from TK_Wrk_Man A
- left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code
+ left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code and A.sourceid=W.id
left join (select wo_code,sum(bad_qty) as bad_qty from TK_Wrk_Step where bad_qty>0 group by wo_code) S on A.wo_code=S.wo_code
left join TMateriel_Info B on A.materiel_code=B.partcode
left join TOrganization C on A.wkshp_code=C.org_code
@@ -1591,7 +1591,7 @@
#endregion
#region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(鑷埗)]
- public static ToMessage MesOrderStepSearch(string stu_torgcode, string stu_torgtypecode, string wocode,string partcode,string partname,string partspec, int startNum, int endNum, string prop, string order)
+ public static ToMessage MesOrderStepSearch(string stu_torgcode, string stu_torgtypecode, string wocode, string saleOrderCode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order)
{
var sql = "";
string search = "";
@@ -1660,6 +1660,11 @@
default:
break;
}
+ if (saleOrderCode != "" && saleOrderCode != null)
+ {
+ search += "and W.saleOrderCode like '%'+@saleOrderCode+'%' ";
+ dynamicParams.Add("@saleOrderCode", saleOrderCode);
+ }
if (partcode != "" && partcode != null)
{
search += "and M.partcode like '%'+@partcode+'%' ";
@@ -1681,7 +1686,7 @@
B.m_po,W.saleOrderCode
from TK_Wrk_Step A
left join TK_Wrk_Man B on A.wo_code=B.wo_code
- left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code
+ left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code and B.sourceid=W.id
left join TMateriel_Info M on B.materiel_code=M.partcode
left join TStep S on A.step_code=S.stepcode
left join TOrganization F on B.wkshp_code=F.org_code
@@ -1804,7 +1809,7 @@
B.m_po,W.saleOrderCode
from TK_Wrk_Step A
left join TK_Wrk_Man B on A.wo_code=B.wo_code
- left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code
+ left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code and B.sourceid=W.id
left join TMateriel_Info M on B.materiel_code=M.partcode
left join TStep S on A.step_code=S.stepcode
left join TOrganization F on B.wkshp_code=F.org_code
@@ -1917,7 +1922,7 @@
B.m_po,W.saleOrderCode
from TK_Wrk_Step A
left join TK_Wrk_Man B on A.wo_code=B.wo_code
- left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code
+ left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code and B.sourceid=W.id
left join TMateriel_Info M on B.materiel_code=M.partcode
left join TStep S on A.step_code=S.stepcode
left join TOrganization F on B.wkshp_code=F.org_code
@@ -1990,7 +1995,7 @@
from TK_Wrk_Step A
left join TStep T on A.step_code=T.stepcode
left join TK_Wrk_Man M on A.wo_code=M.wo_code
- left join TKimp_Ewo W on M.m_po=W.wo and M.materiel_code=W.materiel_code
+ left join TKimp_Ewo W on M.m_po=W.wo and M.materiel_code=W.materiel_code and M.sourceid=W.id
left join TMateriel_Info P on M.materiel_code=P.partcode
where A.wo_code=@ordercode and A.step_code=@stepcode";
dynamicParams.Add("@ordercode", ordercode);
@@ -2429,12 +2434,12 @@
{
//淇敼寮�鎶ュ伐璁板綍琛�(寮�宸ユ暟閲�)
sql = @"update TK_Wrk_Record set start_qty=start_qty+@startqty where wo_code=@mesordercode and step_seq=@stepseq and step_code=@stepcode and materiel_code=@partcode and style=@style";
- list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, partcode = partcode, startqty = startqty, style = "S"} });
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, partcode = partcode, startqty = startqty, style = "S" } });
//淇敼宸ュ崟宸ュ簭琛�(寮�宸ユ暟閲�)
sql = @"update TK_Wrk_Step set start_qty=start_qty+@startqty where wo_code=@mesordercode and step_code=@stepcode";
- list.Add(new { str = sql, parm = new { mesordercode = mesordercode,stepcode = stepcode, startqty = startqty } });
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode, startqty = startqty } });
}
- else
+ else
{
//鍐欏叆寮�鎶ュ伐璁板綍琛�
sql = @"insert into TK_Wrk_Record(wo_code,step_seq,step_code,eqp_code,materiel_code,open_person,open_time,task_qty,start_qty,style,lm_user,lm_date)
@@ -2449,7 +2454,7 @@
list.Add(new { str = sql, parm = new { mesordercode = mesordercode } });
}
-
+
bool aa = DapperHelper.DoTransaction(list);
if (aa)
@@ -3532,7 +3537,7 @@
,(select sum(S.ng_qty) from TK_Wrk_Step S where S.wo_code=A.wo_code and S.isend='Y') as ng_qty
,(select sum(S.bad_qty) from TK_Wrk_Step S where S.wo_code=A.wo_code and S.isend='Y') as bad_qty
from TK_Wrk_Man A
- left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code
+ left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code and A.sourceid=W.id
left join TMateriel_Info B on A.materiel_code=B.partcode
left join TOrganization C on A.wkshp_code=C.org_code
left join T_Sec_Stck D on A.stck_code=D.code
@@ -5138,7 +5143,7 @@
inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
inner join TK_Wrk_Man M on S.wo_code=M.wo_code
inner join TMateriel_Info P on M.materiel_code=P.partcode
- left join TKimp_Ewo E on M.sourceid=E.id
+ left join TKimp_Ewo E on M.sourceid=E.id
left join T_Sec_Stck K on E.stck_code=K.code
where A.style='B' and S.isend='Y' and A.good_qty>0
union all
--
Gitblit v1.9.3