修改称量SQL

dep_wangsr
CaesarBao 5 months ago
parent a430382a28
commit 2270faec18

@ -17,7 +17,7 @@ namespace Admin.Core.Repository
}
public async Task<List<XLPlanWeightView>> GetPlanWeightList()
{
string sql = @" select t.Batch,t.ProductName,t.Plan_Id,t.Recipe_Name,o.Bin_Code,t.Plan_StateText,t.Plan_Num,t.Real_Num,t.Start_Date,t.End_Date,t.Total_Weight,t.Total_Error,p.Total_Weight Plan_TotalWeight ,p.Total_Error Plan_TotalError from (select p.Batch,p.ProductName, p.Plan_Id,p.Recipe_ID,p.Recipe_Name,p.Version,p.Plan_StateText,p.Plan_Num,p.Real_Num,p.Start_Date,p.Weight_Man,r.Total_Weight,Total_Error,case when IsRetransmission=0 then '是' when IsRetransmission=1 then '否' when IsRetransmission is null then '否' end as IsRetransmission,(CASE WHEN p.End_Date IS NULL THEN GETDATE() ELSE p.End_Date END) End_Date from xl_plan p left join xl_recipe r on p.Recipe_ID=r.ID) t left join ( select t1.Plan_ID,t2.Bin_Code from LR_weigh t1 left join dbo.Pmt_Bin t2 on t1.Bin_Serial = t2.Bin_Serial) o on t.Plan_Id = o.Plan_ID left join ( select ID,Dosing_Id,Plan_Id, Real_Num,SUM(Total_Weight) as Total_Weight,SUM(Total_Error) as Total_Error from LR_plan group by ID,Dosing_Id,Plan_Id, Real_Num,Total_Weight,Total_Error ) p on t.Plan_Id=p.Plan_Id WHERE 1=1 and Plan_StateText = '已完成' and Recipe_Name != '产前检测'";
string sql = @" select t.Batch,t.ProductName,t.Plan_Id,t.Recipe_Name,o.Bin_Code,t.Plan_StateText,t.Plan_Num,t.Real_Num,t.Start_Date,t.End_Date,t.Total_Weight,t.Total_Error,p.Total_Weight Plan_TotalWeight ,p.Total_Error Plan_TotalError from (select p.Batch,p.ProductName, p.Plan_Id,p.Recipe_ID,p.Recipe_Name,p.Version,p.Plan_StateText,p.Plan_Num,p.Real_Num,p.Start_Date,p.Weight_Man,r.Total_Weight,Total_Error,case when IsRetransmission=0 then '是' when IsRetransmission=1 then '否' when IsRetransmission is null then '否' end as IsRetransmission,(CASE WHEN p.End_Date IS NULL THEN GETDATE() ELSE p.End_Date END) End_Date from xl_plan p left join xl_recipe r on p.Recipe_ID=r.ID where Plan_State = 8 and Plan_Id != '2023000000001') t left join ( select t1.Plan_ID,t2.Bin_Code from LR_weigh t1 left join dbo.Pmt_Bin t2 on t1.Bin_Serial = t2.Bin_Serial) o on t.Plan_Id = o.Plan_ID left join ( select ID,Dosing_Id,Plan_Id, Real_Num,SUM(Total_Weight) as Total_Weight,SUM(Total_Error) as Total_Error from LR_plan group by ID,Dosing_Id,Plan_Id, Real_Num,Total_Weight,Total_Error ) p on t.Plan_Id=p.Plan_Id WHERE 1=1";
var r = await Db.Ado.SqlQueryAsync<XLPlanWeightView>(sql);
if (r != null) { return r; }

Loading…
Cancel
Save