|
|
@ -460,7 +460,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.SDNCode 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
|
|
|
@ -469,37 +469,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 a.Type='1' and e.ID is null";
|
|
|
|
sql = @"select a.SDNCode 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 ICSSDN 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.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";
|
|
|
|
sql = string.Format(sql, WorkPoint); |
|
|
|
sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); |
|
|
|
#endregion
|
|
|
|
|
|
|
|
sqlString.Append($@"SELECT a.SDNCode 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 ICSSDN 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.SDNCode like '%" + queryParam["POCode"].ToString() + "%' "; |
|
|
|
sqlString.Append($" and a.SDNCode 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.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");
|
|
|
|
#endregion
|
|
|
|
string test=sqlString.ToString(); |
|
|
|
return Repository().FindTablePageBySql(sqlString.ToString(), parameter.ToArray(), ref jqgridparam); |
|
|
|
} |
|
|
|
|
|
|
|
//销售发货(销售发货)子表查询
|
|
|
|