加入MES委外 查询
This commit is contained in:
@@ -559,5 +559,46 @@ CREATE INDEX IX_test ON tempdb..tablepuapp20210625 (cinvcode)
|
||||
return conn.Query<object>(sql, new { info.cpersonname, info.InvCodes, info.cday, info.BeginDate, info.EndDate });
|
||||
}
|
||||
}
|
||||
|
||||
public NX.ERP.Model.PmcWwInvlRes Purchasesuww()
|
||||
{
|
||||
var PmcWwInvlRes = new NX.ERP.Model.PmcWwInvlRes();
|
||||
|
||||
using (var conn = U8LoginContext.Instance.Connection)
|
||||
{
|
||||
var sql = @" select aa.TaskItemID,aa.materialid,dd.code,dd.name,dd.standard, CONVERT(DECIMAL(13,3),aa.Qua) as Qua , CONVERT(DECIMAL(13,3),bb.qty) as qty , CONVERT(DECIMAL(13,3),(isnull(aa.Qua,0)-isnull(bb.qty,0))) as diff from [10.0.0.230].wxnx2021.dbo.t_TaskItem aa left join (
|
||||
select TaskItemID, sum(Qua) AS qty
|
||||
from [10.0.0.230].wxnx2021.dbo.t_OutSourcing_SendItems a left join
|
||||
[10.0.0.230].wxnx2021.dbo.t_OutSourcing_SendSheet b on a.SID_Sheet= b.SID_Sheet
|
||||
where b.IsChecked =1 and isnull(b.IsDeleted,0)=0 group by TaskItemID ) bb on aa. SID_Item= bb.TaskItemID
|
||||
left join [10.0.0.230].wxnx2021.dbo.t_TaskSheet cc on aa.SID_Sheet = cc.SID_Sheet
|
||||
left join [10.0.0.230].wxnx2021.dbo.t_Material dd on dd.SysID=aa.materialid
|
||||
where cc.IsChecked=1 and (isnull(aa.Qua,0)-isnull(bb.qty,0))>0 and cc.SheetType=3 and isnull(cc.IsDeleted,0)=0
|
||||
";
|
||||
|
||||
PmcWwInvlRes.wfdetails=conn.Query< NX.ERP.Model.wfdetail> (sql,"" );
|
||||
|
||||
var sql2 = @" select b.sheetid,dd.code,dd.name,dd.standard, CONVERT(DECIMAL(13,3),a.Qua) as Qua, CONVERT(DECIMAL(13,3),a.ReceivedQua) as ReceivedQua , CONVERT(DECIMAL(13,3),a.Qua-a.ReceivedQua) as diff
|
||||
from [10.0.0.230].wxnx2021.dbo.t_OutSourcing_SendItems a left join
|
||||
[10.0.0.230].wxnx2021.dbo.t_OutSourcing_SendSheet b on a.SID_Sheet= b.SID_Sheet
|
||||
left join [10.0.0.230].wxnx2021.dbo.t_Material dd on dd.SysID=a.materialid
|
||||
where b.IsChecked =1 and isnull(b.IsDeleted,0)=0 and a.Qua<>a.ReceivedQua
|
||||
|
||||
";
|
||||
|
||||
PmcWwInvlRes.wsdetails = conn.Query<NX.ERP.Model.wsdetail>(sql2, "");
|
||||
|
||||
|
||||
PmcWwInvlRes.wfjl = PmcWwInvlRes.wfdetails.Count();
|
||||
|
||||
PmcWwInvlRes.wsjl = PmcWwInvlRes.wsdetails.Count();
|
||||
|
||||
|
||||
}
|
||||
|
||||
return PmcWwInvlRes;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user