Browse Source

调整拣料表查询接口

master
lilili 2 years ago
parent
commit
ed3410155f
  1. 56
      WMS-BS/NFine.Application/WMS/PickMaterialApp.cs

56
WMS-BS/NFine.Application/WMS/PickMaterialApp.cs

@ -27,46 +27,46 @@ namespace NFine.Application.WMS
DataTable dt = new DataTable();
var queryParam = queryJson.ToJObject();
List<DbParameter> parameter = new List<DbParameter>();
string sql = "";
StringBuilder sqlstring = new StringBuilder();
#region [SQL]
// sql = @"select a.ID,b.MOCode as Code,a.Sequence,a.MTIME,a.MUSERName,a.MUSER,a.WHCode,c.WarehouseName,a.InvCode,d.InvName,d.InvDesc,d.InvStd,d.InvUnit,
//case when e.SourceID is null then '未合并' else '已合并' end as IsNew,a.Quantity
//from ICSMOPick a
//left join ICSMO b on a.MODetailID=b.MODetailID and a.WorkPoint=b.WorkPoint
//left join ICSWarehouse c on a.WHCode=c.WarehouseCode and a.WorkPoint=c.WorkPoint
//left join ICSInventory d on a.InvCode=d.InvCode and a.WorkPoint=d.WorkPoint
//left join ICSMOPickMerge e on a.ID=e.SourceID and a.WorkPoint=e.WorkPoint";
// sql += " WHERE 1=1 and e.ID is null";
sql = @"select
a.MOCode as Code,a.CreateDateTime as MTIME,a.createperson as MUSER,case when max(d.SourceID) is null then '' else '' end as IsNew
,f.Colspan ,f.ProjectCode ,f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,f.cFree2 ,f.cFree3 ,f.cFree4 ,f.cFree5 ,f.cFree6 ,f.cFree7 ,f.cFree8 ,f.cFree9 ,f.cFree10
from ICSMO a
inner join ICSMOPick b on b.MODetailID=a.MODetailID and b.WorkPoint=a.WorkPoint
left join ICSMOPickMerge d on d.SourceID=b.ID and d.WorkPoint=b.WorkPoint
left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint
where a.WorkPoint='{0}'
group by a.MOCode, a.WorkPoint,a.CreateDateTime,a.createperson,f.Colspan ,f.ProjectCode ,f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,f.cFree2 ,f.cFree3 ,f.cFree4
,f.cFree5 ,f.cFree6 ,f.cFree7 ,f.cFree8 ,f.cFree9 ,f.cFree10";
sql = string.Format(sql, WorkPoint);
sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName());
#endregion
// sql = @"select a.ID,b.MOCode as Code,a.Sequence,a.MTIME,a.MUSERName,a.MUSER,a.WHCode,c.WarehouseName,a.InvCode,d.InvName,d.InvDesc,d.InvStd,d.InvUnit,
//case when e.SourceID is null then '未合并' else '已合并' end as IsNew,a.Quantity
//from ICSMOPick a
//left join ICSMO b on a.MODetailID=b.MODetailID and a.WorkPoint=b.WorkPoint
//left join ICSWarehouse c on a.WHCode=c.WarehouseCode and a.WorkPoint=c.WorkPoint
//left join ICSInventory d on a.InvCode=d.InvCode and a.WorkPoint=d.WorkPoint
//left join ICSMOPickMerge e on a.ID=e.SourceID and a.WorkPoint=e.WorkPoint";
// sql += " WHERE 1=1 and e.ID is null";
sqlstring.Append($@"select a.MOCode as Code,a.CreateDateTime as MTIME,a.createperson as MUSER,
case when max(d.SourceID) is null then '' else '' end as IsNew,
f.Colspan ,f.ProjectCode ,f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,
f.cFree2 ,f.cFree3 ,f.cFree4 ,f.cFree5 ,f.cFree6 ,f.cFree7 ,f.cFree8 ,f.cFree9 ,f.cFree10
from ICSMO a
inner join ICSMOPick b on b.MODetailID=a.MODetailID and b.WorkPoint=a.WorkPoint
left join ICSMOPickMerge d on d.SourceID=b.ID and d.WorkPoint=b.WorkPoint
left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint
where a.WorkPoint='{WorkPoint}' ");
if (!string.IsNullOrWhiteSpace(queryJson))
{
if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString()))
{
sql += " and b.MOCode like '%" + queryParam["POCode"].ToString() + "%' ";
sqlstring.Append($" and b.MOCode like '%{queryParam["POCode"]}%' ");
}
if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString()))
{
sql += " and a.InvCode like '%" + queryParam["InvCode"].ToString() + "%' ";
sqlstring.Append($" and a.InvCode like '%{queryParam["InvCode"]}%' ");
}
}
sqlstring.Append(@" group by a.MOCode, a.WorkPoint,a.CreateDateTime,a.createperson,f.Colspan,f.ProjectCode,
f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,f.cFree2 ,f.cFree3 ,f.cFree4,
f.cFree5 ,f.cFree6 ,f.cFree7 ,f.cFree8 ,f.cFree9 ,f.cFree10");
return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
#endregion
return Repository().FindTablePageBySql(sqlstring.ToString(), parameter.ToArray(), ref jqgridparam);
}
//工单备料(工单子件)子表查询

Loading…
Cancel
Save