陆晔 2 years ago
parent
commit
95c2bb33f3
  1. 170
      WMS-BS/NFine.Application/WMS/PickMaterialApp.cs
  2. 7
      WMS-BS/NFine.Web/Areas/WMS/Controllers/HomeWorkController.cs

170
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,44 +103,43 @@ 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
// from ICSMOApply a
// 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
// from ICSMOApply a
// left join ICSWarehouse b on a.WHCode = b.WarehouseCode and a.WorkPoint = b.WorkPoint
// left join ICSWarehouse b on a.WHCode = b.WarehouseCode and a.WorkPoint = b.WorkPoint
// left join ICSInventory d on a.InvCode = d.InvCode and a.WorkPoint = d.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
// 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
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.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
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
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 = '{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
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
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 = '{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);
}
//委外领料(委外发料申请)子表查询
@ -469,7 +461,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 a.SDNCode AS Code,
a.CreateDateTime AS MTIME,
a.CreatePerson AS MUSER,
(CASE WHEN max(e.SourceID) IS NULL THEN '' ELSE '' END) AS IsNew,
@ -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
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
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 = '{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");
#endregion
return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
return Repository().FindTablePageBySql(sqlString.ToString(), parameter.ToArray(), ref jqgridparam);
}
//两步调拨子表查询

7
WMS-BS/NFine.Web/Areas/WMS/Controllers/HomeWorkController.cs

@ -50,7 +50,12 @@ namespace NFine.Web.Areas.WMS.Controllers
return "只可以选择Excel(.xls .xlsx)文件";//当选择的不是Excel文件时,返回
}
string filename = DateTime.Now.ToString("yyyyMMddhhmmss") + UPLoadType + IsXls; //获取Execle文件名 DateTime日期函数
string savePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\UPLoadFile\\" + filename);//Server.MapPath 获得虚拟服务器相对路径
var folder = System.Web.HttpContext.Current.Server.MapPath("~\\File\\UPLoadFile"); //Server.MapPath 获得虚拟服务器相对路径
if(!Directory.Exists(folder))
Directory.CreateDirectory(folder);
string savePath = Path.Combine(folder, filename);
int iLen = hpFiles[0].ContentLength;
if (Directory.Exists(savePath)) return "文件已存在";

Loading…
Cancel
Save