Browse Source

调整拣料查询接口

master
lilili 2 years ago
parent
commit
97b10544d3
  1. 132
      WMS-BS/NFine.Application/WMS/PickMaterialApp.cs

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

@ -53,7 +53,7 @@ namespace NFine.Application.WMS
{
if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString()))
{
sqlstring.Append($" and b.MOCode like '%{queryParam["POCode"]}%' ");
sqlstring.Append($" and a.MOCode like '%{queryParam["POCode"]}%' ");
}
if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString()))
{
@ -103,7 +103,7 @@ where b.MOCode='{0}' and a.WorkPoint='{1}'";
DataTable dt = new DataTable();
var queryParam = queryJson.ToJObject();
List<DbParameter> parameter = new List<DbParameter>();
string sql = "";
StringBuilder sqlString=new StringBuilder();
#region [SQL]
// select a.ID,a.ApplyCode as Code,a.Sequence,a.MTIME,a.MUSERName,a.MUSER,a.WHCode,b.WarehouseName ,a.InvCode,d.InvName,d.InvDesc,d.InvStd,d.InvUnit,
//case when e.SourceID is null then '未合并' else '已合并' end as IsNew,a.Quantity
@ -115,32 +115,31 @@ where b.MOCode='{0}' and a.WorkPoint='{1}'";
// left join ICSMOPickMerge e on a.ID = e.SourceID and a.WorkPoint = e.WorkPoint
sql = @"
sqlString.Append($@"
select a.ApplyCode as Code,a.CreateDateTime as MTIME,a.createperson as MUSER,
case when max(e.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
case when max(e.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 ICSMOApply a
left join ICSMOPickMerge e on a.ID=e.SourceID and a.WorkPoint=e.WorkPoint
left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint
where a.WorkPoint='{0}'
group by a.ApplyCode, 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
where a.WorkPoint='{WorkPoint}' ");
if (!string.IsNullOrWhiteSpace(queryJson))
{
if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString()))
{
sql += " and a.ApplyCode like '%" + queryParam["POCode"].ToString() + "%' ";
sqlString.Append($@" and a.ApplyCode 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"]}%' ");
}
}
return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
sqlString.Append(" group by a.ApplyCode, 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");
#endregion
return Repository().FindTablePageBySql(sqlString.ToString(), parameter.ToArray(), ref jqgridparam);
}
//工单领料(发料申请)子表查询
@ -175,7 +174,7 @@ where b.MOCode='{0}' and a.WorkPoint='{1}'";
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,a.IssueCode as Code,a.Sequence,a.MTIME,a.MUSERName,a.MUSER,a.WHCode ,b.WarehouseName ,a.InvCode,d.InvName,d.InvDesc,d.InvStd,d.InvUnit,
// case when e.SourceID is null then '未合并' else '已合并' end as IsNew,a.Quantity
@ -184,37 +183,33 @@ where b.MOCode='{0}' and a.WorkPoint='{1}'";
//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.IssueCode as Code,a.CreateDateTime as MTIME,a.createperson as MUSER,
case when max(e.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
sqlString.Append($@"select a.IssueCode as Code,a.CreateDateTime as MTIME,a.createperson as MUSER,
case when max(e.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 ICSMOIssue a
left join ICSMOPickMerge e on a.ID = e.SourceID and a.WorkPoint = e.WorkPoint
left join ICSExtension f on a.ExtensionID = f.ID and a.WorkPoint = f.WorkPoint
where a.WorkPoint='{0}'
group by a.IssueCode, 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
where a.WorkPoint = '{WorkPoint}' ");
if (!string.IsNullOrWhiteSpace(queryJson))
{
if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString()))
{
sql += " and a.IssueCode like '%" + queryParam["POCode"].ToString() + "%' ";
sqlString.Append($@" and a.IssueCode 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"]}%' ");
}
if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin")
{
sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'";
}
sqlString.Append(@"group by a.IssueCode,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");
#endregion
return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
return Repository().FindTablePageBySql(sqlString.ToString(), parameter.ToArray(), ref jqgridparam);
}
//工单材料出库(材料出库)子表查询
@ -312,7 +307,7 @@ where a.IssueCode='{0}' and a.WorkPoint='{1}'";
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,a.ApplyCode as Code,a.Sequence,a.MTIME,a.MUSERName,a.MUSER,a.WHCode,b.WarehouseName,a.InvCode,d.InvName,d.InvDesc,d.InvStd,d.InvUnit,
//case when e.SourceID is null then '未合并' else '已合并' end as IsNew,a.Quantity
@ -321,35 +316,32 @@ where a.IssueCode='{0}' and a.WorkPoint='{1}'";
//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.ApplyCode as Code, a.CreateDateTime as MTIME,a.CreatePerson as MUSER,
case when max(e.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
sqlString.Append($@"select a.ApplyCode as Code,a.CreateDateTime as MTIME,a.CreatePerson as MUSER,
case when max(e.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 ICSOApply a
left join ICSMOPickMerge e on a.ID = e.SourceID and a.WorkPoint = e.WorkPoint
left join ICSExtension f on a.ExtensionID = f.ID and a.WorkPoint = f.WorkPoint
where a.WorkPoint='{0}'
group by a.ApplyCode,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
where a.WorkPoint = '{WorkPoint}'");
if (!string.IsNullOrWhiteSpace(queryJson))
{
if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString()))
{
sql += " and a.ApplyCode like '%" + queryParam["POCode"].ToString() + "%' ";
sqlString.Append($@" and a.ApplyCode 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"]}%' ");
}
if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin")
{
sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'";
}
return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
sqlString.Append(@"group by a.ApplyCode,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");
#endregion
return Repository().FindTablePageBySql(sqlString.ToString(), parameter.ToArray(), ref jqgridparam);
}
//委外领料(委外发料申请)子表查询
@ -740,7 +732,7 @@ where a.IssueCode='{0}' and a.WorkPoint='{1}'";
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,a.BrrowCode as Code,a.Sequence,a.MTIME,a.MUSERName,a.MUSER,a.WHCode,b.WarehouseName,a.InvCode,d.InvName,d.InvDesc,d.InvStd,d.InvUnit,
@ -750,38 +742,36 @@ where a.IssueCode='{0}' and a.WorkPoint='{1}'";
// 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.OutCode as Code, a.CreateDateTime as MTIME,a.CreatePerson as MUSER,
case when max(e.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
sqlString.Append($@"select a.OutCode as Code, a.CreateDateTime as MTIME, a.CreatePerson as MUSER,
case when max(e.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 ICSOtherOut a
INNER JOIN ICSTransfer tra ON a.TransferDetailID = tra.TransferDetailID AND a.WorkPoint = tra.WorkPoint
left join ICSMOPickMerge e on a.ID = e.SourceID and a.WorkPoint = e.WorkPoint
left join ICSExtension f on a.ExtensionID = f.ID and a.WorkPoint = f.WorkPoint
where a.WorkPoint='{0}' and a.Status='2'
group by a.OutCode,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
where a.WorkPoint = '{WorkPoint}'
and a.Status = '2' ");
if (!string.IsNullOrWhiteSpace(queryJson))
{
if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString()))
{
sql += " and a.BrrowCode like '%" + queryParam["POCode"].ToString() + "%' ";
sqlString.Append($@" and a.OutCode 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"]}%' ");
}
if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin")
{
sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'";
}
sqlString.Append(@" group by a.OutCode, 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