You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
614 lines
22 KiB
614 lines
22 KiB
using NFine.Data.Extensions;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Text;
|
|
using NFine.Code;
|
|
using NFine.Repository;
|
|
using System.Data.Common;
|
|
using NFine.Domain._03_Entity.SRM;
|
|
using Newtonsoft.Json;
|
|
using System.Configuration;
|
|
using System.Net;
|
|
using System.IO;
|
|
using Newtonsoft.Json.Linq;
|
|
using System.Linq;
|
|
|
|
namespace NFine.Application.OMAY
|
|
{
|
|
public class OMAYApsApp : RepositoryFactory<ICSVendor>
|
|
{
|
|
public DataTable GetGridJsonChengPing(string queryJson, ref Pagination jqgridparam)
|
|
{
|
|
DataTable dt = new DataTable();
|
|
var queryParam = queryJson.ToJObject();
|
|
List<DbParameter> parameter = new List<DbParameter>();
|
|
//object Figure = GetDecimalDigits();
|
|
|
|
#region [SQL]
|
|
string sql = @" select
|
|
a.*
|
|
from
|
|
(
|
|
select '' isSelect
|
|
,a.ID
|
|
,a.EATTRIBUTE5 as PreOrderNo --预订单号
|
|
,a.EATTRIBUTE6 as BusinessName --业务员
|
|
,a.MOCode
|
|
,a.Sequence MoSeq
|
|
,a.MODetailID
|
|
,a.EATTRIBUTE1 MoTypeValue
|
|
,a.DepCode
|
|
,b.DepName --生产部门
|
|
,a.CreateDateTime --生产日期
|
|
,a.EATTRIBUTE3 PackageAsk --包装要求
|
|
,a.EATTRIBUTE4 SpecialAsk--特殊要求
|
|
,a.EATTRIBUTE2 Useage--用途
|
|
,a.InvCode ItemCode
|
|
,c.EATTRIBUTE2 ItemAddCode
|
|
,c.InvName ItemName
|
|
,c.InvStd ItemStd
|
|
,c.InvUnit ItemUnit
|
|
,a.Amount
|
|
,CONVERT(varchar(10), a.StartDate,120) StartDate
|
|
,CONVERT(varchar(10), a.DueDate,120) DueDate
|
|
,case when a.PlanStartDate is null then CONVERT(varchar(10), a.StartDate,120)
|
|
else CONVERT(varchar(10), a.PlanStartDate,120) end as PlanStartDate
|
|
,case when a.PlanEndDate is null then CONVERT(varchar(10), a.DueDate,120)
|
|
else CONVERT(varchar(10), a.PlanEndDate,120) end as PlanEndDate
|
|
,a.ApsOrderDate
|
|
,a.APSStatus
|
|
,a.OrderStatus
|
|
from ICSMO a with(nolock)
|
|
left join ICSDepartment b with(nolock) on a.DepCode=b.DepCode
|
|
left join ICSInventory c with(nolock) on a.InvCode=c.InvCode
|
|
where 1=1
|
|
<1>
|
|
|
|
--order by a.CreateDateTime desc
|
|
) a
|
|
where 1=1
|
|
|
|
|
|
";
|
|
// sql += " WHERE 1=1 and a.MOStatus<>'3' ";
|
|
//sql = string.Format(sql, Figure);
|
|
//sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName());
|
|
#endregion
|
|
|
|
if (!string.IsNullOrWhiteSpace(queryJson))
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(queryParam["ItemCode"].ToString()))
|
|
{
|
|
sql += " and a.ItemCode like '%" + queryParam["ItemCode"].ToString() + "%' ";
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(queryParam["ItemName"].ToString()))
|
|
{
|
|
sql += " and a.ItemName like '%" + queryParam["ItemName"].ToString() + "%' ";
|
|
}
|
|
var ssName1 = queryParam["SSName"].ToString();
|
|
var ssName2 = queryParam["SSName2"].ToString();
|
|
if (string.IsNullOrEmpty(ssName1) && string.IsNullOrEmpty(ssName2))
|
|
{
|
|
sql = sql.Replace("<1>", "and a.APSStatus is null ");
|
|
}
|
|
else
|
|
{
|
|
if (!string.IsNullOrEmpty(ssName1) && !string.IsNullOrEmpty(ssName2))
|
|
{
|
|
sql += " and a.DepName ='" + ssName1 + "' and a.APSStatus='Y' ";
|
|
sql = sql.Replace("<1>", " ");
|
|
|
|
}
|
|
if (!string.IsNullOrEmpty(ssName1))
|
|
{
|
|
sql += " and a.DepName ='" + ssName1 + "' and a.APSStatus='Y' ";
|
|
sql = sql.Replace("<1>", " ");
|
|
|
|
}
|
|
if (!string.IsNullOrEmpty(ssName2))
|
|
{
|
|
sql += " and a.DepName ='" + ssName2 + "' ";
|
|
sql = sql.Replace("<1>", " and a.APSStatus is null ");
|
|
|
|
}
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(queryParam["MoCode"].ToString()))
|
|
{
|
|
sql += " and a.MOCode like '%" + queryParam["MoCode"].ToString() + "%' ";
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(queryParam["OrderStatus"].ToString()))
|
|
{
|
|
sql += " and a.OrderStatus = '" + queryParam["OrderStatus"].ToString() + "' ";
|
|
}
|
|
else
|
|
{
|
|
sql += " and (a.OrderStatus is null or a.OrderStatus='')";
|
|
}
|
|
}
|
|
//if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin")
|
|
//{
|
|
// sql = sql.Replace("{0}", "and a.WorkPoint = '" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'");
|
|
// // sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'";
|
|
//}
|
|
//else
|
|
//{
|
|
// sql = sql.Replace("{0}", "");
|
|
//}
|
|
//if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode == "Vendor")
|
|
//{
|
|
// sql += " and a.VenCode='" + NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode + "'";
|
|
//}
|
|
return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
|
|
}
|
|
|
|
public string CancelSendMo(string keyValue)
|
|
{
|
|
string returnValue = string.Empty;
|
|
try
|
|
{
|
|
var queryParam = keyValue.ToJObject();
|
|
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
|
|
var ids = queryParam["ids"].ToString().Split(',');
|
|
|
|
string sql = @" UPDATE dbo.ICSMO
|
|
set MTIME=GETDATE(),MUSER='{0}',MUSERName='{1}',WorkPoint='{2}',APSStatus=null,ApsOrderDate=null,PlanStartDate=null,PlanEndDate=null
|
|
WHERE ID in ('{3}') ";
|
|
|
|
sql = string.Format(sql, MUSER, MUSERNAME, WorkPoint, string.Join("','", ids));
|
|
|
|
|
|
var rows = SqlHelper.CmdExecuteNonQueryLi(sql) > 0;
|
|
if (!rows)
|
|
{
|
|
throw new Exception("修改失败");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
returnValue = ex.Message;
|
|
}
|
|
|
|
|
|
return returnValue;
|
|
}
|
|
|
|
public string UpdateMoOrderStatus(string keyValue)
|
|
{
|
|
string returnValue = string.Empty;
|
|
try
|
|
{
|
|
var queryParam = keyValue.ToJObject();
|
|
var ids = queryParam["ids"].ToString().Split(',');
|
|
if (ids.Length == 0)
|
|
{
|
|
throw new Exception("编号获取失败");
|
|
}
|
|
|
|
var orderStatus = queryParam["orderStatus"].ToString();
|
|
//orderStatus = orderStatus == "" ? null : orderStatus;
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
var sql = @"update ICSMO set OrderStatus ='{3}',MTIME=GETDATE(),MUSER='{0}',WorkPoint='{1}' where ID in ('{2}') ";
|
|
|
|
sql = string.Format(sql, MUSER, WorkPoint, string.Join("','", ids),orderStatus);
|
|
|
|
var rows = SqlHelper.CmdExecuteNonQueryLi(sql) > 0;
|
|
if (!rows)
|
|
{
|
|
throw new Exception("修改失败");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
throw new Exception(ex.Message);
|
|
}
|
|
return returnValue;
|
|
}
|
|
|
|
public string GetOrgAName()
|
|
{
|
|
string returnValue = string.Empty;
|
|
|
|
string sql = @"select
|
|
b.F_FullName as OrgName
|
|
,b.F_EnCode as OrgCode
|
|
,a.*
|
|
from [dbo].[Sys_SRM_Role] a
|
|
left join Sys_SRM_Organize b on a.F_OrganizeId=b.F_Id
|
|
where 1=1
|
|
and a.F_EnCode='{0}'
|
|
";
|
|
|
|
sql = string.Format(sql, NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode);
|
|
var dt = Repository().FindDataSetBySql(sql.ToString()).Tables[0];
|
|
if (dt == null || dt.Rows.Count == 0)
|
|
{
|
|
return returnValue;
|
|
}
|
|
returnValue = dt.Rows[0]["OrgName"].ToStringExt();
|
|
return returnValue;
|
|
}
|
|
|
|
public string UpdateMoPlan2(string keyValue)
|
|
{
|
|
string returnValue = string.Empty;
|
|
|
|
var queryParam = keyValue.ToJObject();
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
|
|
string sql = string.Empty;
|
|
sql = @"
|
|
|
|
UPDATE dbo.ICSMO set MTIME=GETDATE(),MUSER='{0}',WorkPoint='{1}'
|
|
<1>
|
|
<2>
|
|
<3>
|
|
WHERE ID in ('{2}')";
|
|
|
|
var ids = queryParam["ids"].ToString().Split(',');
|
|
sql = string.Format(sql, MUSER, WorkPoint, string.Join("','", ids));
|
|
|
|
if (!string.IsNullOrEmpty(queryParam["orderDate"].ToString()))
|
|
{
|
|
sql = sql.Replace("<1>", ",ApsOrderDate='" + queryParam["orderDate"].ToString() + "'");
|
|
}
|
|
if (!string.IsNullOrEmpty(queryParam["planStartDate"].ToString()))
|
|
{
|
|
sql = sql.Replace("<2>", ",planStartDate='" + queryParam["planStartDate"].ToString() + "'");
|
|
}
|
|
if (!string.IsNullOrEmpty(queryParam["planEndDate"].ToString()))
|
|
{
|
|
sql = sql.Replace("<3>", ",planEndDate='" + queryParam["planEndDate"].ToString() + "'");
|
|
}
|
|
var rows = SqlHelper.CmdExecuteNonQueryLi(sql) > 0;
|
|
if (!rows)
|
|
{
|
|
throw new Exception("修改失败");
|
|
}
|
|
|
|
return returnValue;
|
|
}
|
|
|
|
public string UpdateMoPlan(string keyValue)
|
|
{
|
|
string returnValue = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
var queryParam = keyValue.ToJObject();
|
|
var isCanUpdateStatus = queryParam["isCanUpdateStatus"].ToBool();
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
|
|
string sql = string.Empty;
|
|
sql = @"
|
|
declare @DepCode nvarchar(100)
|
|
|
|
select @DepCode= DepCode from ICSDepartment
|
|
where DepName='{0}'
|
|
|
|
--select @DepCode
|
|
UPDATE dbo.ICSMO set DepCode=@DepCode, MTIME=GETDATE(),MUSER='{1}',WorkPoint='{2}',APSStatus='Y' <1> <2> <3> WHERE ID in ('{3}')";
|
|
|
|
var ids = queryParam["ids"].ToString().Split(',');
|
|
|
|
var sql4 = @"select count(1) Value
|
|
from ICSMOPick a
|
|
left join ICSMO b on a.MODetailID=b.MODetailID
|
|
left join ICSInventory c on a.InvCode =c.InvCode
|
|
where 1=1
|
|
and a.EATTRIBUTE1=0
|
|
and a.WorkPoint='"+ WorkPoint + "' and b.ID in ('"+string.Join("','", ids) +"')";
|
|
|
|
var isCanUpdateDepCode= Repository().FindDataSetBySql(sql4.ToString()).Tables[0];
|
|
if(isCanUpdateDepCode!=null&& isCanUpdateDepCode.Rows.Count > 0)
|
|
{
|
|
if (isCanUpdateDepCode.Rows[0]["Value"].ToInt() > 0)
|
|
{
|
|
sql = @"
|
|
--select @DepCode
|
|
UPDATE dbo.ICSMO set MTIME=GETDATE(),MUSER='{1}',WorkPoint='{2}',APSStatus='Y' <1> <2> <3> WHERE ID in ('{3}')";
|
|
}
|
|
}
|
|
string APIURL = ConfigurationManager.ConnectionStrings["ERPAPIURL"].ConnectionString + "MOHKWam/Update";
|
|
var planStartDate = queryParam["planStartDate"].ToStringExt();
|
|
var planEndDate = queryParam["planEndDate"].ToStringExt();
|
|
sql = string.Format(sql, queryParam["line"].ToString(), MUSER, WorkPoint, string.Join("','", ids), queryParam["orderDate"].ToString());
|
|
if (!string.IsNullOrEmpty(queryParam["orderDate"].ToString()))
|
|
{
|
|
sql = sql.Replace("<1>", ",ApsOrderDate='" + queryParam["orderDate"].ToString() + "' ");
|
|
}
|
|
else
|
|
{
|
|
sql = sql.Replace("<1>", ",ApsOrderDate=getdate()");
|
|
}
|
|
if (!string.IsNullOrEmpty(planStartDate))
|
|
{
|
|
sql = sql.Replace("<2>", ",PlanStartDate='" + planStartDate + "'");
|
|
}
|
|
else
|
|
{
|
|
sql = sql.Replace("<2>", " ,PlanStartDate=StartDate");
|
|
}
|
|
if (!string.IsNullOrEmpty(planEndDate))
|
|
{
|
|
sql = sql.Replace("<3>", ",PlanEndDate='" + planEndDate + "'");
|
|
}
|
|
else
|
|
{
|
|
sql = sql.Replace("<3>", " ,PlanEndDate=DueDate");
|
|
}
|
|
|
|
|
|
|
|
//string sql11 = @"select a.* from ICSMO a where a.ID in ('0')";
|
|
//sql11 = string.Format(sql11, string.Join("','", ids));
|
|
//var dt11 = Repository().FindDataSetBySql(sql11.ToString()).Tables[0];
|
|
//if (dt11 == null || dt11.Rows.Count == 0)
|
|
//{
|
|
// throw new Exception("获取工单数据失败");
|
|
//}
|
|
//foreach (DataRow item in dt11.Rows)
|
|
//{
|
|
|
|
//}
|
|
|
|
try
|
|
{
|
|
string sql3 = @"
|
|
|
|
declare @DepCode nvarchar(100)
|
|
|
|
select @DepCode= DepCode from ICSDepartment
|
|
where DepName='{0}'
|
|
|
|
select @DepCode as DepCode ";
|
|
sql3 = string.Format(sql3, queryParam["line"].ToString());
|
|
var dt5 = Repository().FindDataSetBySql(sql3.ToString()).Tables[0];
|
|
if (dt5 == null || dt5.Rows.Count == 0)
|
|
{
|
|
throw new Exception("当前部门获取失败");
|
|
}
|
|
var deptCode = dt5.Rows[0]["DepCode"].ToString();
|
|
if (!isCanUpdateStatus)
|
|
{
|
|
sql = sql.Replace(",APSStatus='Y'", " ");
|
|
//var rows2 = SqlHelper.CmdExecuteNonQueryLi(sql) > 0;
|
|
//if (!rows2)
|
|
//{
|
|
// throw new Exception("修改失败");
|
|
//}
|
|
|
|
//return returnValue;
|
|
}
|
|
|
|
string objsql = @"
|
|
declare @WorkPointCode varchar(100)
|
|
|
|
select @WorkPointCode=WorkPointCode from Sys_WorkPoint
|
|
select
|
|
@WorkPointCode as WorkPoint
|
|
,a.MODetailID as MoDid
|
|
,CONVERT(varchar(10), a.StartDate,120) StartDate
|
|
,CONVERT(varchar(10), a.DueDate,120) DueDate
|
|
,a.DepCode cDept
|
|
from ICSMO a with(nolock)
|
|
where a.ID in ('{0}')
|
|
";
|
|
objsql = string.Format(objsql, string.Join("','", ids));
|
|
var dt = Repository().FindDataSetBySql(objsql.ToString()).Tables[0];
|
|
if (dt == null || dt.Rows.Count == 0)
|
|
{
|
|
return returnValue;
|
|
}
|
|
List<object> objList = new List<object>();
|
|
foreach (DataRow item in dt.Rows)
|
|
{
|
|
if (!string.IsNullOrEmpty(planStartDate))
|
|
{
|
|
|
|
}
|
|
object obj = new
|
|
{
|
|
WorkPoint = item["WorkPoint"].ToString(),
|
|
MoDid = item["MoDid"].ToString(),
|
|
StartDate = string.IsNullOrEmpty(planStartDate) ? item["StartDate"].ToString() : planStartDate,
|
|
DueDate = string.IsNullOrEmpty(planEndDate) ? item["DueDate"].ToString() : planEndDate,
|
|
cDept = deptCode,
|
|
|
|
};
|
|
|
|
objList.Add(obj);
|
|
}
|
|
|
|
var result = HttpMethods.Post<ResultDto>(APIURL, objList).Result;
|
|
if (!result.Success)
|
|
{
|
|
return result.Message;
|
|
}
|
|
|
|
var rows = SqlHelper.CmdExecuteNonQueryLi(sql) > 0;
|
|
if (!rows)
|
|
{
|
|
throw new Exception("修改失败");
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
returnValue = ex.Message;
|
|
|
|
}
|
|
|
|
return returnValue;
|
|
}
|
|
|
|
public DataTable GetApsPlanSelectSubItemList(string ids, ref Pagination pagination)
|
|
{
|
|
DataTable dt = new DataTable();
|
|
// var queryParam = queryJson.ToJObject();
|
|
List<DbParameter> parameter = new List<DbParameter>();
|
|
//object Figure = GetDecimalDigits();
|
|
|
|
#region [SQL]
|
|
string sql = @"select
|
|
a.SubItemCode,a.SubItemName,a.SubItemStd,a.InvUnit,a.AmountUnit
|
|
,sum( a.Quantity) Quantity
|
|
,sum( a.Amount) Amount
|
|
,max(a.ID) ID
|
|
from
|
|
(
|
|
select 0 Code
|
|
--a.*
|
|
,a.ID
|
|
,c.InvCode SubItemCode
|
|
,c.InvName SubItemName
|
|
,c.InvStd SubItemStd
|
|
,a.Quantity --主数量
|
|
,c.InvUnit --主单位
|
|
,a.Amount --辅计量
|
|
,c.AmountUnit --辅单位
|
|
from ICSMOPick a with(nolock)
|
|
left join ICSMO b with(nolock) on a.MODetailID=b.MODetailID
|
|
left join ICSInventory c with(nolock) on a.InvCode =c.InvCode
|
|
where 1=1
|
|
<1>
|
|
and a.EATTRIBUTE1=0
|
|
) a
|
|
group by a.SubItemCode,a.SubItemName,a.SubItemStd,a.InvUnit,a.AmountUnit
|
|
order by a.SubItemCode,a.SubItemName,a.SubItemStd
|
|
|
|
";
|
|
// sql += " WHERE 1=1 and a.MOStatus<>'3' ";
|
|
var list = ids.Split(',');
|
|
sql = sql.Replace("<1>", " and b.ID in ('" + string.Join("','", list) + "')");
|
|
//sql = sql.Replace("<2>", "and b.Sequence=" + moSeq + "");
|
|
//sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName());
|
|
#endregion
|
|
|
|
|
|
//if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin")
|
|
//{
|
|
// sql = sql.Replace("<3>", "and a.WorkPoint = '" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'");
|
|
// // sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'";
|
|
//}
|
|
//else
|
|
//{
|
|
// sql = sql.Replace("<3>", "");
|
|
//}
|
|
//if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode == "Vendor")
|
|
//{
|
|
// sql += " and a.VenCode='" + NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode + "'";
|
|
//}
|
|
return Repository().FindDataSetBySql(sql.ToString(), parameter.ToArray()).Tables[0];
|
|
}
|
|
|
|
public DataTable GetApsPlanSubGridJsonList(string moCode, int moSeq, ref Pagination pagination)
|
|
{
|
|
DataTable dt = new DataTable();
|
|
// var queryParam = queryJson.ToJObject();
|
|
List<DbParameter> parameter = new List<DbParameter>();
|
|
//object Figure = GetDecimalDigits();
|
|
|
|
#region [SQL]
|
|
string sql = @"select 0 Code
|
|
--a.*
|
|
,a.ID
|
|
,a.Sequence SubSeq
|
|
,c.InvCode SubItemCode
|
|
,c.InvName SubItemName
|
|
--,c.ClassCode
|
|
--,c.ClassName
|
|
,c.InvStd SubItemDtd
|
|
,convert(nvarchar(100), floor (isnull( a.EATTRIBUTE3,0) *100)) +'%' as Rate --比例
|
|
,a.Quantity --主数量
|
|
,c.InvUnit --主单位
|
|
,a.Amount --辅计量
|
|
,c.AmountUnit --辅单位
|
|
from ICSMOPick a with(nolock)
|
|
left join ICSMO b with(nolock) on a.MODetailID=b.MODetailID
|
|
left join ICSInventory c with(nolock) on a.InvCode =c.InvCode and a.WorkPoint=c.WorkPoint
|
|
where 1=1
|
|
<1>
|
|
<2>
|
|
and a.EATTRIBUTE1=0
|
|
--and left( c.ClassCode,2)='01'
|
|
order by a.Sequence
|
|
|
|
";
|
|
// sql += " WHERE 1=1 and a.MOStatus<>'3' ";
|
|
sql = sql.Replace("<1>", "and b.MOCode='" + moCode + "'");
|
|
sql = sql.Replace("<2>", "and b.Sequence=" + moSeq + "");
|
|
//sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName());
|
|
#endregion
|
|
|
|
//if (!string.IsNullOrWhiteSpace(queryJson))
|
|
//{
|
|
// if (!string.IsNullOrWhiteSpace(queryParam["ItemCode"].ToString()))
|
|
// {
|
|
// sql += " and a.ItemCode like '%" + queryParam["ItemCode"].ToString() + "%' ";
|
|
// }
|
|
// if (!string.IsNullOrWhiteSpace(queryParam["ItemName"].ToString()))
|
|
// {
|
|
// sql += " and a.ItemName like '%" + queryParam["ItemName"].ToString() + "%' ";
|
|
// }
|
|
// //if (!string.IsNullOrWhiteSpace(queryParam["InvName"].ToString()))
|
|
// //{
|
|
// // sql += " and b.InvName like '%" + queryParam["InvName"].ToString() + "%' ";
|
|
// //}
|
|
// //if (!string.IsNullOrWhiteSpace(queryParam["BatchCode"].ToString()))
|
|
// //{
|
|
// // sql += " and f.BatchCode like '%" + queryParam["BatchCode"].ToString() + "%' ";
|
|
// //}
|
|
// //if (!string.IsNullOrWhiteSpace(queryParam["SelGDLX"].ToString()))
|
|
// //{
|
|
// // sql += " and a.MOType like '%" + queryParam["SelGDLX"].ToString() + "%' ";
|
|
// //}
|
|
|
|
// //if (!string.IsNullOrWhiteSpace(queryParam["POStatus"].ToString()))
|
|
// //{
|
|
// // string POStatus = queryParam["POStatus"].ToString();
|
|
// // if (POStatus == "0")
|
|
// // {
|
|
// // //sql += " and a.Quantity=ISNULL(c.LotQty,0)";
|
|
// // }
|
|
// // else if (POStatus == "1")
|
|
// // {
|
|
// // sql += " and ISNULL(c.LOTQTY,0)>=a.Quantity";
|
|
// // }
|
|
// // else
|
|
// // {
|
|
// // sql += " and ISNULL(c.LOTQTY,0)<a.Quantity";
|
|
// // }
|
|
// //}
|
|
//}
|
|
//if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin")
|
|
//{
|
|
// sql = sql.Replace("<3>", "and a.WorkPoint = '" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'");
|
|
// // sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'";
|
|
//}
|
|
//else
|
|
//{
|
|
// sql = sql.Replace("<3>", "");
|
|
//}
|
|
//if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode == "Vendor")
|
|
//{
|
|
// sql += " and a.VenCode='" + NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode + "'";
|
|
//}
|
|
return Repository().FindDataSetBySql(sql.ToString(), parameter.ToArray()).Tables[0];
|
|
}
|
|
}
|
|
}
|