Browse Source

调整拣料7种单据主查询接口

master
lilili 2 years ago
parent
commit
314721fdd9
  1. 263
      WMS-BS/NFine.Application/WMS/PickMaterialApp.cs
  2. 7
      WMS-BS/NFine.Web/Areas/WMS/Views/PickMaterial/ICSMOPickMerge.cshtml

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

@ -116,7 +116,8 @@ where b.MOCode='{0}' and a.WorkPoint='{1}'";
// left join ICSMOPickMerge e on a.ID = e.SourceID and a.WorkPoint = e.WorkPoint
sqlString.Append($@"
select a.ApplyCode as Code,a.CreateDateTime as MTIME,a.createperson as MUSER,
SELECT * from (select row_number() over(partition by a.ApplyCode ORDER BY a.ApplyCode) as row,
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
@ -135,7 +136,9 @@ where b.MOCode='{0}' and a.WorkPoint='{1}'";
sqlString.Append($@" and a.InvCode like '%{queryParam["InvCode"]}%' ");
}
}
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");
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) as t where t.row=1");
#endregion
@ -183,7 +186,8 @@ 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";
sqlString.Append($@"select a.IssueCode as Code,a.CreateDateTime as MTIME,a.createperson as MUSER,
sqlString.Append($@"SELECT * FROM(SELECT row_number ( ) OVER ( partition BY a.IssueCode ORDER BY a.IssueCode ) AS row,
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
@ -204,7 +208,7 @@ where b.MOCode='{0}' and a.WorkPoint='{1}'";
}
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");
f.cFree8, f.cFree9, f.cFree10 ) AS t WHERE t.row= 1 ");
#endregion
@ -242,39 +246,40 @@ 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 b.OOCode as Code, b.CreateDateTime as MTIME,b.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 ICSOOPick a
inner join ICSOutsourcingOrder b on a.OODetailID=b.OODetailID and a.WorkPoint=b.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 b.WorkPoint='{0}'
group by b.OOCode,b.CreateDateTime,b.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
if (!string.IsNullOrWhiteSpace(queryJson))
{
sqlString.Append($@"select * from (select row_number() over(partition by b.OOCode order by b.OOCode) row, b.OOCode as Code,
b.CreateDateTime as MTIME,
b.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 ICSOOPick a
inner join ICSOutsourcingOrder b on a.OODetailID = b.OODetailID and a.WorkPoint = b.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 b.WorkPoint = '{WorkPoint}' ");
if (!string.IsNullOrWhiteSpace(queryJson))
{
if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString()))
{
sql += " and a.OOCode like '%" + queryParam["POCode"].ToString() + "%' ";
sqlString.Append($@" and a.OOCode 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 b.OOCode,b.CreateDateTime,b.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) t where t.row=1");
#endregion
return Repository().FindTablePageBySql(sqlString.ToString(), parameter.ToArray(), ref jqgridparam);
}
//委外备料(委外备料)子表查询
@ -316,7 +321,7 @@ 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";
sqlString.Append($@"select a.ApplyCode as Code,a.CreateDateTime as MTIME,a.CreatePerson as MUSER,
sqlString.Append($@"select * from (select row_number() over (partition by a.ApplyCode order by a.ApplyCode ) row, 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,
@ -338,7 +343,7 @@ where a.IssueCode='{0}' and a.WorkPoint='{1}'";
}
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");
f.cFree6,f.cFree7,f.cFree8,f.cFree9,f.cFree10 ) t where row=1");
#endregion
return Repository().FindTablePageBySql(sqlString.ToString(), parameter.ToArray(), ref jqgridparam);
@ -376,7 +381,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.IssueCode as Code,a.Sequence,a.MTIME,a.MUSERName,a.MUSER,a.WHCode,b.WarehouseCode,a.InvCode,d.InvName,d.InvDesc,d.InvStd,d.InvUnit,
//case when e.SourceID is null then '未合并' else '已合并' end as IsNew,a.Quantity
@ -385,36 +390,38 @@ 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.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 * from(select row_number() over(partition by a.IssueCode order by a.IssueCode) row, 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 ICSOIssue 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
if (!string.IsNullOrWhiteSpace(queryJson))
{
if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString()))
{
sql += " and a.IssueCode like '%" + queryParam["POCode"].ToString() + "%' ";
}
if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString()))
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 = '{WorkPoint}'");
if (!string.IsNullOrWhiteSpace(queryJson))
{
sql += " and a.InvCode like '%" + queryParam["InvCode"].ToString() + "%' ";
if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString()))
{
sqlString.Append($@" and a.IssueCode like '%{queryParam["POCode"]}%' ");
}
if (!string.IsNullOrWhiteSpace(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.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) t where t.row=1");
#endregion
return Repository().FindTablePageBySql(sqlString.ToString(), parameter.ToArray(), ref jqgridparam);
}
@ -461,7 +468,7 @@ 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 a.Type='1' and e.ID is null";
sqlString.Append($@"SELECT a.SDNCode AS Code,
sqlString.Append($@"SELECT * from (SELECT Row_Number() over(partition by a.SDNCode Order by a.SDNCode) as r, a.SDNCode AS Code,
a.CreateDateTime AS MTIME,
a.CreatePerson AS MUSER,
(CASE WHEN max(e.SourceID) IS NULL THEN '' ELSE '' END) AS IsNew,
@ -483,9 +490,8 @@ where a.IssueCode='{0}' and a.WorkPoint='{1}'";
}
}
sqlString.Append(@"GROUP BY a.SDNCode, 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");
f.cFree1, f.cFree2, f.cFree3, f.cFree4, f.cFree5, f.cFree6, f.cFree7, f.cFree8, f.cFree9, f.cFree10) t WHERE t.r=1");
#endregion
string test=sqlString.ToString();
return Repository().FindTablePageBySql(sqlString.ToString(), parameter.ToArray(), ref jqgridparam);
}
@ -519,7 +525,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.OutCode 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
@ -528,37 +534,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
from ICSOtherOut 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.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());
sqlString.Append($@"select * from(select row_number() over(partition by a.OutCode order by a.OutCode) row, 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
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 = '{WorkPoint}'");
#endregion
if (!string.IsNullOrWhiteSpace(queryJson))
{
if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString()))
{
sql += " and a.OutCode 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) t where t.row=1");
return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
return Repository().FindTablePageBySql(sqlString.ToString(), parameter.ToArray(), ref jqgridparam);
}
//其它出库(其它出库)子表查询
@ -591,7 +596,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,
@ -601,37 +606,38 @@ 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.BrrowCode 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 ICSBrrow 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.BrrowCode,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
sqlString.Append($@"select * from(select row_number() over(partition by a.BrrowCode order by a.BrrowCode) row, a.BrrowCode 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 ICSBrrow 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 = '{WorkPoint}'");
if (!string.IsNullOrWhiteSpace(queryJson))
{
if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString()))
{
sql += " and a.BrrowCode like '%" + queryParam["POCode"].ToString() + "%' ";
sqlString.Append($@" and a.BrrowCode 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.BrrowCode,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) t where t.row=1");
#endregion
return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
return Repository().FindTablePageBySql(sqlString.ToString(), parameter.ToArray(), ref jqgridparam);
}
//借用(借用)子表查询
@ -650,7 +656,7 @@ 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
left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint
where a.OutCode='{0}' and b.WorkPoint='{1}'";
where a.BrrowCode='{0}' and b.WorkPoint='{1}'";
sql = string.Format(sql, Code, WorkPoint);
return Repository().FindTableBySql(sql.ToString());
}
@ -662,7 +668,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,
@ -672,37 +678,34 @@ 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.TransferNO 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 ICSTransfer 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}' and a.Status='1'
group by a.TransferNO,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
if (!string.IsNullOrWhiteSpace(queryJson))
sqlString.Append($@"select * from (select row_number() over(partition by a.TransferNO order by a.TransferNO) row,
a.TransferNO 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 ICSTransfer 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 = '{WorkPoint}' and a.Status = '1'");
if (!string.IsNullOrWhiteSpace(queryJson))
{
if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString()))
{
sql += " and a.BrrowCode like '%" + queryParam["POCode"].ToString() + "%' ";
sqlString.Append($@" and a.BrrowCode 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.TransferNO,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) t where t.row=1");
#endregion
return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
return Repository().FindTablePageBySql(sqlString.ToString(), parameter.ToArray(), ref jqgridparam);
}
//物料调拨子表查询
public DataTable GetSubGridJson10(string Code)
@ -742,7 +745,7 @@ 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 ";
sqlString.Append($@"select a.OutCode as Code, a.CreateDateTime as MTIME, a.CreatePerson as MUSER,
sqlString.Append($@"select * from (select row_number() over(partition by a.OutCode order by a.OutCode)row, 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
@ -765,7 +768,7 @@ where a.IssueCode='{0}' and a.WorkPoint='{1}'";
}
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");
f.cFree5, f.cFree6, f.cFree7, f.cFree8, f.cFree9, f.cFree10) t where t.row=1");
#endregion

7
WMS-BS/NFine.Web/Areas/WMS/Views/PickMaterial/ICSMOPickMerge.cshtml

@ -89,7 +89,7 @@
var cols = new Array();
var collast = { label: "主键", name: "ID", hidden: true, key: true };
cols.push(collast);
cols.push(collast);
var collast = { label: '单据号', name: 'Code', width: 120, align: 'left' };
cols.push(collast);
var collast = { label: '操作日期', name: 'MTIME', width: 150, align: 'left' };
@ -140,7 +140,8 @@
width: 80,
align: "left"
}
cols.push(obj);
if (ColCode != "BatchCode")
cols.push(obj);
cols1.push(obj);
}
}
@ -158,6 +159,7 @@
POCode: $("#txt_POCode").val(),
InvCode: $("#txt_InvCode").val(),
}
$gridList.dataGrid({
url: "/WMS/PickMaterial/GetGridJson?Type=" + Type + "&" + Math.random(),
postData: { queryJson: JSON.stringify(queryJson) },
@ -215,6 +217,7 @@
{ label: '料品名称', name: 'InvName', width: 100, align: 'left' },
{ label: '料品描述', name: 'InvDesc', width: 100, align: 'left' },
{ label: '规格型号', name: 'InvStd', width: 100, align: 'left' },
{ label: '批次', name: 'BatchCode', width: 100, align: 'left' },
{ label: '数量', name: 'Quantity', width: 100, align: 'left' },
{ label: '已发数量', name: 'IssueQuantity', width: 100, align: 'left' },
{ label: '单位', name: 'InvUnit', width: 100, align: 'left' },

Loading…
Cancel
Save