|
|
using NFine.Data.Extensions; using System; using System.Collections.Generic; using System.Data; using NFine.Code; using NFine.Repository; using System.Data.Common; using NFine.Domain._03_Entity.SRM; using System.Configuration; using System.Text; using System.Net; using Newtonsoft.Json.Linq; using Newtonsoft.Json; using System.IO; using NFine.Domain._03_Entity.WMS;
namespace NFine.Application.WMS { public class WMSCreateItemLotApp : RepositoryFactory<ICSVendor> { public DataTable GetGridJson(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.ID,a.ApplyNegCode,a.Sequence,a.SourceDetailID,a.InvCode,b.InvName,b.InvDesc,b.InvStd,b.InvUnit, CAST(a.Quantity AS DECIMAL(18,{0})) as Quantity
,CAST(a.Amount AS DECIMAL(18,{0})) as Amount , CAST(a.IssueNegQuantity AS DECIMAL(18,{0})) as IssueNegQuantity ,a.ExtensionID,a.MUSERName,a.MTIME , CAST(c.LOTQTY AS DECIMAL(18,{0})) as LOTQTY ,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 ICSMOApplyNegDetail a left join ICSMOApplyNeg d on a.ApplyNegCode=d.ApplyNegCode and a.WorkPoint=d.WorkPoint left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select mm.TransCode,mm.TransSequence,sum(isnull(ee.Quantity,0)) LOTQTY,ee.WorkPoint from ICSInventoryLot ee left join ICSInventoryLotDetail mm on ee.LotNo=mm.LotNo and ee.type='1' group by mm.TransCode,mm.TransSequence,ee.WorkPoint )c on a.ApplyNegCode=c.TransCode and a.Sequence=c.TransSequence and a.WorkPoint=c.WorkPoint left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint where d.Type='1'";
sql = string.Format(sql, Figure); sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); #endregion
if (!string.IsNullOrWhiteSpace(queryJson)) { if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString())) { sql += " and a.ApplyNegCode like '%" + queryParam["POCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString())) { sql += " and a.InvCode like '%" + queryParam["InvCode"].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 (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin") { sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'"; } 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 DataTable GetSubGridJson(string ApplyNegCode, string Sequence, string Type, ref Pagination jqgridparam) { DataTable dt = new DataTable(); object Figure = GetDecimalDigits(); List<DbParameter> parameter = new List<DbParameter>(); string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); string sql = @" select c.TransCode,c.TransSequence ,a.ID,a.LotNo, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity ,a.MUSERName,a.MTIME
,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 ICSInventoryLot a left join (select count(LotNo) LotNoCount,LotNo,WorkPoint from ICSWareHouseLotInfo group by LotNo,WorkPoint)b on a.LotNo=b.LotNo and a.WorkPoint=b.WorkPoint left join ICSInventoryLotDetail c on a.LotNo=c.LotNo and a.WorkPoint=c.WorkPoint left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint WHERE a.Type='" + Type + "' and c.TransCode='" + ApplyNegCode + "' and c.TransSequence='" + Sequence + "' and a.WorkPoint in ('" + WorkPoint + "')";
sql = string.Format(sql, Figure); return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam); }
/// <summary>
/// 点击生成条码
/// </summary>
public DataTable GetSubGridJsonByCreate(string ApplyNegCode, string Sequence, string WorkPoint) { DataTable dt = new DataTable(); object Figure = GetDecimalDigits(); List<DbParameter> parameter = new List<DbParameter>(); string sql = @" select a.InvCode,b.InvName,b.InvStd,b.InvUnit, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity, CAST( a.Amount as DECIMAL(18,{0})) as Amount, CAST( isnull(c.LOTQTY,0) as DECIMAL(18,{0})) as CreatedQty ,
CAST( (a.Quantity-ISNULL(c.LOTQTY,0)) as DECIMAL(18,{0})) as thisCreateQty,isnull(b.EffectiveEnable,0) as EffectiveEnable, CAST( isnull(b.EffectiveDays,0) as DECIMAL(18,{0})) as EffectiveDays from ICSMOApplyNegDetail a left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a left join ICSInventoryLotDetail b on a.LotNo=b.LotNo group by b.TransCode,b.TransSequence ) c on a.ApplyNegCode=c.TransCode and a.Sequence=c.TransSequence WHERE 1 =1 and a.ApplyNegCode='" + ApplyNegCode + "' and a.Sequence='" + Sequence + "'";
sql += " and a.WorkPoint='" + WorkPoint + "'"; sql = string.Format(sql, Figure); return Repository().FindTableBySql(sql.ToString()); }
public DataTable GetVendorLotNo(string VenCode, string WorkPoint) { DataTable dt = new DataTable(); //var queryParam = queryJson.ToJObject();
List<DbParameter> parameter = new List<DbParameter>(); string dtPre = DateTime.Now.ToString("yyyyMMdd"); string sql = @"EXEC Addins_GetSerialCode '" + WorkPoint + "','ICSITEMLotNo','VendorLotNo','" + VenCode + dtPre + "',2"; return Repository().FindTableBySql(sql.ToString()); }
/// <summary>
/// 生产退料生成条码
/// </summary>
/// <param name="POCode"></param>
/// <param name="PORow"></param>
/// <param name="keyValue"></param>
/// 已改
/// <returns></returns>
public int CreateItemLotNo(string ApplyNegCode, string Sequence, string keyValue, string WorkPoint) { var queryParam = keyValue.ToJObject(); string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString()); decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString()); decimal thisCreateQty = Convert.ToDecimal(queryParam["thisCreateQty"].ToString()); decimal LOTQTY = minPackQty; //string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
//string VenCode = GetVendorCode(ApplyNegCode, Sequence, WorkPoint);
string Pre = "MDN" + ApplyNegCode + Sequence; string sql = string.Empty; //string VendorLot = queryParam["VendorLot"].ToString();
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString(); string Colspan = ""; string sqls = string.Empty; for (int i = 0; i < createPageCount; i++) { if (i + 1 == createPageCount) { if (minPackQty * createPageCount > thisCreateQty) { LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1)); } }
Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString(); sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}'", Colspan); object ExtensionID = SqlHelper.ExecuteScalar(sqls); if (ExtensionID == null) { ExtensionID = Guid.NewGuid(); sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
ExtensionID, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(), MUSER, MUSERNAME, WorkPoints); } string LotNo = GetSerialCode(WorkPoint, "ICSInventoryLot", "LotNO", Pre, 5); sql += string.Format(@"Insert into ICSInventoryLotDetail(LotNo, TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}',getdate(),'{5}' )",
LotNo, ApplyNegCode, Sequence, MUSER, MUSERNAME, WorkPoints); //if (SqlHelper.ExecuteNonQuery(sqls) > 0)
//{
sql += string.Format(@"insert into ICSInventoryLot
(ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount) select newid(),'{0}',InvCode,'{1}','{10}','{2}','{8}','1','{3}','{4}', getdate(),'{5}','{9}' from ICSMOApplyNegDetail where ApplyNegCode='{6}' and Sequence='{7}' and WorkPoint='{5}' ",
LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, ApplyNegCode, Sequence, ExtensionID, Convert.ToDecimal(Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString()); sql += "\r\n"; //}
} int count = SqlHelper.CmdExecuteNonQueryLi(sql); return count; }
public string GetSerialCode(string workPointCode, string tbName, string colName, string Pre, int numLen) { string sql = "EXEC Addins_GetSerialCode '{0}','{1}','{2}','{3}',{4}"; sql = string.Format(sql, new object[] { workPointCode, tbName, colName, Pre, numLen }); return DbHelper.ExecuteScalar(CommandType.Text, sql).ToString(); }
/// <summary>
/// 删除条码
/// </summary>
/// <param name="keyValue"></param>
/// <returns></returns>
public string DeleteItemLot(string keyValue) { string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location; string msg = string.Empty; string sql = string.Format(@"SELECT * FROM dbo.ICSInspection
WHERE LotNo IN (SELECT LotNO FROM dbo.ICSInventoryLot WHERE ID IN ({0})) and WorkPoint in ('{1}')", keyValue.TrimEnd(','), WorkPoint);
DataTable dtASN = SqlHelper.GetDataTableBySql(sql); if (dtASN != null && dtASN.Rows.Count > 0) { msg = "所选条码已生成检验单,无法删除!"; } sql = string.Format(@"SELECT * FROM dbo.ICSWareHouseLotInfo WHERE LotNO IN
(SELECT LotNO FROM dbo.ICSInventoryLot WHERE ID IN ({0})) and WorkPoint in ('{1}')", keyValue.TrimEnd(','), WorkPoint);
DataTable dtCarton = SqlHelper.GetDataTableBySql(sql); if (dtCarton != null && dtCarton.Rows.Count > 0) { msg += "所选条码已入库,无法删除!"; } if (string.IsNullOrEmpty(msg)) {
string sqls = string.Format("DELETE FROM ICSInventoryLotDetail WHERE LotNO IN (select LotNO from ICSInventoryLot where ID in ({0}) ) and WorkPoint in ('{1}')", keyValue.TrimEnd(','), WorkPoint); sqls += string.Format("DELETE FROM dbo.ICSInventoryLot WHERE ID IN ({0}) and WorkPoint in ('{1}')", keyValue.TrimEnd(','), WorkPoint); SqlHelper.CmdExecuteNonQueryLi(sqls); } return msg;
}
public DataTable GetGridJsonWeiWai(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.ID,a.OApplyNegCode,a.Sequence,a.SourceDetailID,a.InvCode,b.InvName,b.InvDesc,b.InvStd,b.InvUnit, CAST(a.Quantity AS DECIMAL(18,{0})) as Quantity
,CAST(a.Amount AS DECIMAL(18,{0})) as Amount , CAST(a.IssueNegQuantity AS DECIMAL(18,{0})) as IssueNegQuantity,a.ExtensionID,a.MUSERName,a.MTIME , CAST(c.LOTQTY AS DECIMAL(18,{0})) as LOTQTY ,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 ICSOApplyNegDetail a left join ICSOApplyNeg d on a.OApplyNegCode=d.OApplyNegCode AND a.WorkPoint=d.WorkPoint left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select mm.TransCode,mm.TransSequence,sum(isnull(ee.Quantity,0)) LOTQTY,ee.WorkPoint from ICSInventoryLot ee left join ICSInventoryLotDetail mm on ee.LotNo=mm.LotNo and ee.type='2' group by mm.TransCode,mm.TransSequence,ee.WorkPoint )c on a.OApplyNegCode=c.TransCode and a.Sequence=c.TransSequence and a.WorkPoint=c.WorkPoint left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint WHERE d.Type='1' ";
sql = string.Format(sql, Figure); sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); #endregion
if (!string.IsNullOrWhiteSpace(queryJson)) { if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString())) { sql += " and a.OApplyNegCode like '%" + queryParam["POCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString())) { sql += " and a.InvCode like '%" + queryParam["InvCode"].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 (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin") { sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'"; } 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 DataTable GetSubGridJsonWeiWai(string OApplyNegCode, string Sequence, ref Pagination jqgridparam) { DataTable dt = new DataTable(); object Figure = GetDecimalDigits(); //var queryParam = queryJson.ToJObject();
List<DbParameter> parameter = new List<DbParameter>(); string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); string sql = @" select c.TransCode,c.TransSequence ,a.ID,a.LotNo,CAST(a.Quantity AS DECIMAL(18,{0})) as Quantity from ICSInventoryLot a
left join (select count(LotNo) LotNoCount,LotNo,WorkPoint from ICSWareHouseLotInfo group by LotNo,WorkPoint)b on a.LotNo=b.LotNo and a.WorkPoint=b.WorkPoint left join ICSInventoryLotDetail c on a.LotNo=c.LotNo WHERE c.TransCode='" + OApplyNegCode + "' and c.TransSequence='" + Sequence + "' and a.WorkPoint in (" + WorkPoint + ")";
sql = string.Format(sql, Figure); return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam); }
/// <summary>
/// 点击委外退料生成条码
/// </summary>
public DataTable GetSubGridJsonWeiWaiByCreate(string OApplyNegCode, string Sequence, string WorkPoint) { DataTable dt = new DataTable(); object Figure = GetDecimalDigits(); List<DbParameter> parameter = new List<DbParameter>(); string sql = @"select a.InvCode,b.InvName,b.InvStd,b.InvUnit, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST( a.Amount as DECIMAL(18,{0})) as Amount, CAST( isnull(c.LOTQTY,0) as DECIMAL(18,{0})) as CreatedQty,
CAST( (a.Quantity-ISNULL(c.LOTQTY,0)) as DECIMAL(18,{0})) as thisCreateQty,isnull(b.EffectiveEnable,0) as EffectiveEnable, CAST( isnull(b.EffectiveDays,0) as DECIMAL(18,{0})) as EffectiveDays
from ICSOApplyNegDetail a left join ICSOApplyNeg d on a.OApplyNegCode=d.OApplyNegCode AND a.WorkPoint=d.WorkPoint left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a left join ICSInventoryLotDetail b on a.LotNo=b.LotNo group by b.TransCode,b.TransSequence ) c on a.OApplyNegCode=c.TransCode and a.Sequence=c.TransSequence WHERE d.Type='1' and a.OApplyNegCode='" + OApplyNegCode + "' and a.Sequence='" + Sequence + "'";
sql += " and a.WorkPoint='" + WorkPoint + "'"; sql = string.Format(sql, Figure); return Repository().FindTableBySql(sql.ToString()); }
/// <summary>
/// 委外退料生成条码
/// </summary>
/// <param name="POCode"></param>
/// <param name="PORow"></param>
/// <param name="keyValue"></param>
/// 已改
/// <returns></returns>
public int SubmitFormWeiWai(string OApplyNegCode, string Sequence, string keyValue, string WorkPoint) { var queryParam = keyValue.ToJObject(); string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString()); decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString()); decimal thisCreateQty = Convert.ToDecimal(queryParam["thisCreateQty"].ToString()); decimal LOTQTY = minPackQty; string Pre = "OI" + OApplyNegCode + Sequence; string sql = string.Empty; string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString(); string sqls = string.Empty; string Colspan = ""; for (int i = 0; i < createPageCount; i++) { if (i + 1 == createPageCount) { if (minPackQty * createPageCount > thisCreateQty) { LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1)); } } Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString(); sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}'", Colspan); object ExtensionID = SqlHelper.ExecuteScalar(sqls); if (ExtensionID == null) { ExtensionID = Guid.NewGuid(); sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
ExtensionID, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(), MUSER, MUSERNAME, WorkPoints); } string LotNo = GetSerialCode(WorkPoint, "ICSInventoryLot", "LotNO", Pre, 5); sql += string.Format(@"Insert into ICSInventoryLotDetail(LotNo, TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}',getdate(),'{5}' )",
LotNo, OApplyNegCode, Sequence, MUSER, MUSERNAME, WorkPoints); sql += string.Format(@"insert into ICSInventoryLot
(ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount) select newid(),'{0}',InvCode,'{1}','{10}','{2}','{8}','2','{3}','{4}', getdate(),'{5}','{9}' from ICSOApplyNegDetail where OApplyNegCode='{6}' and Sequence='{7}' and WorkPoint='{5}' ",
LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, OApplyNegCode, Sequence, ExtensionID, Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString()); sql += "\r\n";
} int count = SqlHelper.CmdExecuteNonQueryLi(sql); return count; }
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.ID, a.MODetailID,a.MOCode,a.Sequence, CAST(a.RCVQuantity AS DECIMAL(18,{0})) as RCVQuantity ,a.InvCode,b.InvName,b.InvDesc,b.InvStd,b.InvUnit,CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST( a.Amount as DECIMAL(18,{0})) as Amount,a.StartDate
,a.DueDate,a.MOStatus,a.ExtensionID,a.MUSERName,a.MTIME ,CAST(c.LOTQTY AS DECIMAL(18,{0})) as LOTQTY ,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 ICSMO a left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select mm.TransCode,mm.TransSequence,sum(isnull(ee.Quantity,0)) LOTQTY,ee.WorkPoint from ICSInventoryLot ee left join ICSInventoryLotDetail mm on ee.LotNo=mm.LotNo and ee.type='3' group by mm.TransCode,mm.TransSequence,ee.WorkPoint )c on a.MOCode=c.TransCode and a.Sequence=c.TransSequence and a.WorkPoint=c.WorkPoint left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint ";
sql += " WHERE 1=1"; sql = string.Format(sql, Figure); sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); #endregion
if (!string.IsNullOrWhiteSpace(queryJson)) { if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString())) { sql += " and a.MOCode like '%" + queryParam["POCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString())) { sql += " and a.InvCode like '%" + queryParam["InvCode"].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 (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin") { sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'"; } 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); }
/// <summary>
/// 点击成品生成条码(成品)
/// </summary>
public DataTable GetSubGridJsonChengPingByCreate(string MOCode, string Sequence, string WorkPoint) {
DataTable dt = new DataTable(); object Figure = GetDecimalDigits(); List<DbParameter> parameter = new List<DbParameter>(); string sql = @"select d.Enable, a.InvCode,b.InvName,b.InvStd,b.InvUnit, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST( a.Amount as DECIMAL(18,{0})) as Amount, CAST( isnull(c.LOTQTY,0) as DECIMAL(18,{0})) as CreatedQty,
CAST( (a.Quantity-ISNULL(c.LOTQTY,0)) as DECIMAL(18,{0})) as thisCreateQty,isnull(b.EffectiveEnable,0) as EffectiveEnable, CAST( isnull(b.EffectiveDays,0) as DECIMAL(18,{0})) as EffectiveDays
from ICSMO a left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a left join ICSInventoryLotDetail b on a.LotNo=b.LotNo group by b.TransCode,b.TransSequence ) c on a.MOCode=c.TransCode and a.Sequence=c.TransSequence left join ICSConfiguration d on d.Code='CompleteVerification' WHERE 1 =1 and a.MOCode='" + MOCode + "' and a.Sequence='" + Sequence + "'";
sql += " and a.WorkPoint='" + WorkPoint + "'"; sql = string.Format(sql, Figure); return Repository().FindTableBySql(sql.ToString()); }
/// <summary>
/// 成品生成条码
/// </summary>
/// <param name="POCode"></param>
/// <param name="PORow"></param>
/// <param name="keyValue"></param>
/// 已改
/// <returns></returns>
public int SubmitFormChengPing(string MOCode, string Sequence, string keyValue, string WorkPoint) { var queryParam = keyValue.ToJObject(); string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString()); decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString()); decimal thisCreateQty = Convert.ToDecimal(queryParam["thisCreateQty"].ToString()); decimal LOTQTY = minPackQty; //string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
//string VenCode = GetVendorCode(ApplyNegCode, Sequence, WorkPoint);
string Pre = "CP" + MOCode + Sequence; string sql = string.Empty; //string VendorLot = queryParam["VendorLot"].ToString();
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString(); string sqls = string.Empty; string Colspan = ""; for (int i = 0; i < createPageCount; i++) { if (i + 1 == createPageCount) { if (minPackQty * createPageCount > thisCreateQty) { LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1)); } }
Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString(); sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}'", Colspan); object ExtensionID = SqlHelper.ExecuteScalar(sqls); if (ExtensionID == null) { ExtensionID = Guid.NewGuid(); sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
ExtensionID, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(), MUSER, MUSERNAME, WorkPoints); }
string LotNo = GetSerialCode(WorkPoint, "ICSInventoryLot", "LotNO", Pre, 5); sql += string.Format(@"Insert into ICSInventoryLotDetail(LotNo, TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}',getdate(),'{5}' )",
LotNo, MOCode, Sequence, MUSER, MUSERNAME, WorkPoints); //if (SqlHelper.ExecuteNonQuery(sqls) > 0)
//{
sql += string.Format(@"insert into ICSInventoryLot
(ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount) select newid(),'{0}',InvCode,'{1}','{10}','{2}','{8}','3','{3}','{4}', getdate(),'{5}','{9}' from ICSMO where MOCode='{6}' and Sequence='{7}' and WorkPoint='{5}' ",
LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, MOCode, Sequence, ExtensionID, Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString()); sql += "\r\n"; //}
} int count = SqlHelper.CmdExecuteNonQueryLi(sql); return count; }
/// <summary>
/// 销售退货单
/// </summary>
/// <param name="queryJson"></param>
/// <param name="jqgridparam"></param>
/// <returns></returns>
public DataTable GetGridJsonXiaoShou(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.ID,a.SDNCode,a.Sequence,a.SOCode,a.SOSequence,a.CusCode,a.CusName,a.Type,a.ArriveDate,a.InvCode,b.InvName,b.InvDesc,b.InvStd,b.InvUnit,CAST(a.Quantity AS DECIMAL(18,{0})) as Quantity
,cast(a.Amount as decimal(18,{0})) as Amount, CAST(a.SDNQuantity AS DECIMAL(18,{0})) as SDNQuantity ,a.Status,a.ExtensionID,a.CreatePerson,a.CreateDateTime ,CAST(c.LOTQTY AS DECIMAL(18,{0})) as LOTQTY ,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 ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select mm.TransCode,mm.TransSequence,sum(isnull(ee.Quantity,0)) LOTQTY,ee.WorkPoint from ICSInventoryLot ee left join ICSInventoryLotDetail mm on ee.LotNo=mm.LotNo and ee.type='4' group by mm.TransCode,mm.TransSequence,ee.WorkPoint )c on a.SDNCode=c.TransCode and a.Sequence=c.TransSequence and a.WorkPoint=c.WorkPoint left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint where a.Type='2'";
sql = string.Format(sql, Figure); sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); #endregion
if (!string.IsNullOrWhiteSpace(queryJson)) { if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString())) { sql += " and a.SDNCode like '%" + queryParam["POCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString())) { sql += " and a.InvCode like '%" + queryParam["InvCode"].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 (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin") { sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'"; } 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); }
/// <summary>
/// 点击销售退货生成条码(销售退货)
/// </summary>
public DataTable GetSubGridJsonXiaoShouByCreate(string SDNCode, string Sequence, string WorkPoint) {
DataTable dt = new DataTable(); object Figure = GetDecimalDigits(); List<DbParameter> parameter = new List<DbParameter>(); string sql = @"select a.InvCode,b.InvName,b.InvStd,b.InvUnit, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST( a.Amount as DECIMAL(18,{0})) as Amount, CAST( isnull(c.LOTQTY,0) as DECIMAL(18,{0})) as CreatedQty,
CAST( (a.Quantity-ISNULL(c.LOTQTY,0)) as DECIMAL(18,{0})) as thisCreateQty,isnull(b.EffectiveEnable,0) as EffectiveEnable, CAST( isnull(b.EffectiveDays,0) as DECIMAL(18,{0})) as EffectiveDays
from ICSSDN a left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a left join ICSInventoryLotDetail b on a.LotNo=b.LotNo group by b.TransCode,b.TransSequence ) c on a.SDNCode=c.TransCode and a.Sequence=c.TransSequence WHERE 1 =1 and a.Type='2' and a.SDNCode='" + SDNCode + "' and a.Sequence='" + Sequence + "'";
sql += " and a.WorkPoint='" + WorkPoint + "'"; sql = string.Format(sql, Figure);
return Repository().FindTableBySql(sql.ToString()); }
/// <summary>
/// 销售退货生成条码
/// </summary>
/// <param name="POCode"></param>
/// <param name="PORow"></param>
/// <param name="keyValue"></param>
/// 已改
/// <returns></returns>
public int SubmitFormXiaoShou(string SDNCode, string Sequence, string keyValue, string WorkPoint) { var queryParam = keyValue.ToJObject(); string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString()); decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString()); decimal thisCreateQty = Convert.ToDecimal(queryParam["thisCreateQty"].ToString()); decimal LOTQTY = minPackQty; //string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
//string VenCode = GetVendorCode(ApplyNegCode, Sequence, WorkPoint);
string Pre = "SR" + SDNCode + Sequence; string sql = string.Empty; //string VendorLot = queryParam["VendorLot"].ToString();
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString(); string sqls = string.Empty; string Colspan = ""; for (int i = 0; i < createPageCount; i++) { if (i + 1 == createPageCount) { if (minPackQty * createPageCount > thisCreateQty) { LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1)); } }
Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString(); sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}'", Colspan); object ExtensionID = SqlHelper.ExecuteScalar(sqls); if (ExtensionID == null) { ExtensionID = Guid.NewGuid(); sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
ExtensionID, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(), MUSER, MUSERNAME, WorkPoints); }
string LotNo = GetSerialCode(WorkPoint, "ICSInventoryLot", "LotNO", Pre, 5); sql += string.Format(@"Insert into ICSInventoryLotDetail(LotNo, TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}',getdate(),'{5}')",
LotNo, SDNCode, Sequence, MUSER, MUSERNAME, WorkPoints); //if (SqlHelper.ExecuteNonQuery(sqls) > 0)
//{
sql += string.Format(@"
insert into ICSInventoryLot (ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount) select newid(),'{0}',InvCode,'{1}','{10}','{2}','{8}','4','{3}','{4}', getdate(),'{5}','{9}' from ICSSDN where Type='2' and SDNCode='{6}' and Sequence='{7}' and WorkPoint='{5}' ",
LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, SDNCode, Sequence, ExtensionID, Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString()); sql += "\r\n"; //}
} int count = SqlHelper.CmdExecuteNonQueryLi(sql); return count; }
public DataTable GetGridJsonQiTa(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.ID,a.InCode,a.Sequence,a.WHCode,a.InvCode, b.InvName,b.InvStd,b.InvDesc,b.InvUnit,
CAST(a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST(a.Amount AS DECIMAL(18,{0})) as Amount, CAST(a.InQuantity AS DECIMAL(18,{0})) as InQuantity,a.CreatePerson,a.CreateDateTime,CAST(c.LOTQTY AS DECIMAL(18,{0})) as LOTQTY ,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 ICSOtherIn a left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select mm.TransCode,mm.TransSequence,sum(isnull(ee.Quantity,0)) LOTQTY,ee.WorkPoint from ICSInventoryLot ee left join ICSInventoryLotDetail mm on ee.LotNo=mm.LotNo and ee.type='5' group by mm.TransCode,mm.TransSequence,ee.WorkPoint )c on a.InCode=c.TransCode and a.Sequence=c.TransSequence and a.WorkPoint=c.WorkPoint left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint where a.Status='1'";
sql = string.Format(sql, Figure); sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); #endregion
if (!string.IsNullOrWhiteSpace(queryJson)) { if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString())) { sql += " and a.InCode like '%" + queryParam["POCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString())) { sql += " and a.InvCode like '%" + queryParam["InvCode"].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 (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin") { sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'"; } 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); }
/// <summary>
/// 点击销售退货生成条码(其他入库)
/// </summary>
public DataTable GetSubGridJsonQiTaByCreate(string InCode, string Sequence, string WorkPoint) {
DataTable dt = new DataTable(); object Figure = GetDecimalDigits(); List<DbParameter> parameter = new List<DbParameter>(); string sql = @"select a.InvCode,b.InvName,b.InvStd,b.InvUnit, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST( a.Amount as DECIMAL(18,{0})) as Amount, CAST( isnull(c.LOTQTY,0) as DECIMAL(18,{0})) as CreatedQty,
CAST( (a.Quantity-ISNULL(c.LOTQTY,0)) as DECIMAL(18,{0})) as thisCreateQty,isnull(b.EffectiveEnable,0) as EffectiveEnable, CAST( isnull(b.EffectiveDays,0) as DECIMAL(18,{0})) as EffectiveDays
from ICSOtherIn a left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a left join ICSInventoryLotDetail b on a.LotNo=b.LotNo group by b.TransCode,b.TransSequence ) c on a.InCode=c.TransCode and a.Sequence=c.TransSequence WHERE 1 =1 and a.InCode='" + InCode + "' and a.Sequence='" + Sequence + "'";
sql += " and a.WorkPoint='" + WorkPoint + "'"; sql = string.Format(sql, Figure); return Repository().FindTableBySql(sql.ToString()); }
/// <summary>
/// 其他入库生成条码
/// </summary>
/// <param name="POCode"></param>
/// <param name="PORow"></param>
/// <param name="keyValue"></param>
/// 已改
/// <returns></returns>
public int SubmitFormQiTa(string InCode, string Sequence, string keyValue, string WorkPoint) { var queryParam = keyValue.ToJObject(); string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString()); decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString()); decimal thisCreateQty = Convert.ToDecimal(queryParam["thisCreateQty"].ToString()); decimal LOTQTY = minPackQty; //string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
//string VenCode = GetVendorCode(ApplyNegCode, Sequence, WorkPoint);
string Pre = "QT" + InCode + Sequence; string sql = string.Empty; //string VendorLot = queryParam["VendorLot"].ToString();
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString(); string sqls = string.Empty; string Colspan = ""; for (int i = 0; i < createPageCount; i++) { if (i + 1 == createPageCount) { if (minPackQty * createPageCount > thisCreateQty) { LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1)); } }
Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString(); sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}'", Colspan); object ExtensionID = SqlHelper.ExecuteScalar(sqls); if (ExtensionID == null) { ExtensionID = Guid.NewGuid(); sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
ExtensionID, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(), MUSER, MUSERNAME, WorkPoints); }
string LotNo = GetSerialCode(WorkPoint, "ICSInventoryLot", "LotNO", Pre, 5); sql += string.Format(@"Insert into ICSInventoryLotDetail(LotNo, TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}',getdate(),'{5}' )",
LotNo, InCode, Sequence, MUSER, MUSERNAME, WorkPoints); //if (SqlHelper.ExecuteNonQuery(sqls) > 0)
//{
sql += string.Format(@"
insert into ICSInventoryLot (ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount) select newid(),'{0}',InvCode,'{1}','{10}','{2}','{8}','5','{3}','{4}', getdate(),'{5}','{9}' from ICSOtherIn where InCode='{6}' and Sequence='{7}' and WorkPoint='{5}' ",
LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, InCode, Sequence, ExtensionID, Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString()); sql += "\r\n"; //}
} int count = SqlHelper.CmdExecuteNonQueryLi(sql); return count; }
//归还
public DataTable GetGridJsonGuiHuan(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.ID,a.ReturnCode,a.Sequence,a.WHCode,a.InvCode, b.InvName,b.InvStd,b.InvDesc,b.InvUnit,CAST(a.Quantity AS DECIMAL(18,{0})) as Quantity ,CAST(a.Amount AS DECIMAL(18,{0})) as Amount, CAST(a.ReturnQuantity AS DECIMAL(18,{0})) as ReturnQuantity,a.CreatePerson,a.CreateDateTime,CAST(c.LOTQTY AS DECIMAL(18,{0})) as LOTQTY
,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 ICSReturn a left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select mm.TransCode,mm.TransSequence,sum(isnull(ee.Quantity,0)) LOTQTY,ee.WorkPoint from ICSInventoryLot ee left join ICSInventoryLotDetail mm on ee.LotNo=mm.LotNo and ee.type='6' group by mm.TransCode,mm.TransSequence,ee.WorkPoint ) c on a.ReturnCode=c.TransCode and a.Sequence=c.TransSequence and a.WorkPoint=c.WorkPoint left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint where a.Status='2'";
sql = string.Format(sql, Figure); sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); #endregion
if (!string.IsNullOrWhiteSpace(queryJson)) { if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString())) { sql += " and a.ReturnCode like '%" + queryParam["POCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString())) { sql += " and a.InvCode like '%" + queryParam["InvCode"].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 (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin") { sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'"; } 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 DataTable GetGridJsonSHDH(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.ID, '' as 'POCode',-- d.POCode,d.Sequence as POSequence,
'' as POSequence, a.DNCode,a.Sequence,a.VenCode,e.VenName,a.WHCode,a.InvCode, b.InvName,b.InvStd,b.InvDesc,b.InvUnit,b.EATTRIBUTE1 AS Area, CAST(a.Quantity AS DECIMAL(18,{0})) as Quantity ,CAST(a.Amount AS DECIMAL(18,{0})) as Amount,CAST(a.RCVQuantity AS DECIMAL(18,{0})) as RCVQuantity,CAST(a.UnitPrice AS DECIMAL(18,{0})) as UnitPrice,a.Currency,a.CreatePerson,a.CreateDateTime,CAST(c.LOTQTY AS DECIMAL(18,{0})) as LOTQTY ,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 ICSDeliveryNotice a left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select mm.TransCode,mm.TransSequence,sum(isnull(ee.Quantity,0)) LOTQTY,ee.WorkPoint from ICSInventoryLot ee left join ICSInventoryLotDetail mm on ee.LotNo=mm.LotNo and ee.type='7' group by mm.TransCode,mm.TransSequence,ee.WorkPoint ) c on a.DNCode=c.TransCode and a.Sequence=c.TransSequence and a.WorkPoint=c.WorkPoint -- inner join ICSPurchaseOrder d on a.POID=d.POID and a.PODetailID=d.PODetailID and a.WorkPoint=d.WorkPoint left join ICSVendor e on a.VenCode=e.VenCode and a.WorkPoint=e.WorkPoint left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint where a.DNType='1' and a.Status='2' and a.ASNCode is null ";
sql = string.Format(sql, Figure); sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); #endregion
if (!string.IsNullOrWhiteSpace(queryJson)) { if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString())) { sql += " and a.DNCode like '%" + queryParam["POCode"].ToString() + "%' "; }
if (!string.IsNullOrWhiteSpace(queryParam["VenCode"].ToString())) { sql += " and a.VenCode like '%" + queryParam["VenCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["VenName"].ToString())) { sql += " and e.VenName like '%" + queryParam["VenName"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString())) { sql += " and a.InvCode like '%" + queryParam["InvCode"].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 (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin") { sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'"; } 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 DataTable GetGridJsonWWSHDH(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.ID, d.OOCode,d.Sequence as OOSequence,a.ODNCode,a.Sequence,a.VenCode,e.VenName,a.InvCode, b.InvName,b.InvStd,b.InvDesc,b.InvUnit,CAST(a.Quantity AS DECIMAL(18,{0})) as Quantity ,CAST(a.Amount AS DECIMAL(18,{0})) as Amount,CAST(a.RCVQuantity AS DECIMAL(18,{0})) as RCVQuantity,CAST(a.UnitPrice AS DECIMAL(18,{0})) as UnitPrice,a.Currency,a.CreatePerson,a.CreateDateTime,
CAST(c.LOTQTY AS DECIMAL(18,{0})) as LOTQTY ,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 ICSODeliveryNotice a left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select mm.TransCode,mm.TransSequence,sum(isnull(ee.Quantity,0)) LOTQTY,ee.WorkPoint from ICSInventoryLot ee left join ICSInventoryLotDetail mm on ee.LotNo=mm.LotNo and ee.type='8' group by mm.TransCode,mm.TransSequence,ee.WorkPoint ) c on a.ODNCode=c.TransCode and a.Sequence=c.TransSequence and a.WorkPoint=c.WorkPoint inner join ICSOutsourcingOrder d on a.OOID=d.OOID and a.OODetailID=d.OODetailID and a.WorkPoint=d.WorkPoint left join ICSVendor e on a.VenCode=e.VenCode and a.WorkPoint=e.WorkPoint left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint where a.ODNType='1' and a.Status='2' and a.OASNCode is null";
sql = string.Format(sql, Figure); sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); #endregion
if (!string.IsNullOrWhiteSpace(queryJson)) { if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString())) { sql += " and a.ODNCode like '%" + queryParam["POCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["VenCode"].ToString())) { sql += " and a.VenCode like '%" + queryParam["VenCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["VenName"].ToString())) { sql += " and e.VenName like '%" + queryParam["VenName"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString())) { sql += " and a.InvCode like '%" + queryParam["InvCode"].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 (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin") { sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'"; } 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 DataTable GetGridJsonKLCPRK(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.ID,a.RCVCode,a.Sequence,a.WHCode,a.InvCode, b.InvName,b.InvStd,b.InvDesc,b.InvUnit,CAST(a.Quantity AS DECIMAL(18,{0})) as Quantity , CAST(a.Amount AS DECIMAL(18,{0})) as Amount,CAST(a.RCVQuantity AS DECIMAL(18,{0})) as RCVQuantity ,a.CreatePerson,a.CreateDateTime,CAST(c.LOTQTY AS DECIMAL(18,{0})) as LOTQTY ,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 ICSManufactureReceive a left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select mm.TransCode,mm.TransSequence,sum(isnull(ee.Quantity,0)) LOTQTY,ee.WorkPoint from ICSInventoryLot ee left join ICSInventoryLotDetail mm on ee.LotNo=mm.LotNo and ee.type='9' group by mm.TransCode,mm.TransSequence,ee.WorkPoint ) c on a.RCVCode=c.TransCode and a.Sequence=c.TransSequence and a.WorkPoint=c.WorkPoint left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint where a.Status='1' and a.Type='1'";
sql = string.Format(sql, Figure); sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); #endregion
if (!string.IsNullOrWhiteSpace(queryJson)) { if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString())) { sql += " and a.RCVCode like '%" + queryParam["POCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString())) { sql += " and a.InvCode like '%" + queryParam["InvCode"].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 (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin") { sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'"; } 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); }
/// <summary>
/// 点击审核委外到货单生成条码(审核委外到货单)
/// </summary>
public DataTable GetSubGridJsonWWSHDHByCreate(string ODNCode, string Sequence, string WorkPoint) {
DataTable dt = new DataTable(); object Figure = GetDecimalDigits(); List<DbParameter> parameter = new List<DbParameter>(); string sql = @"select a.InvCode,b.InvName,b.InvStd,b.InvUnit, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST( a.Amount as DECIMAL(18,{0})) as Amount, CAST( isnull(c.LOTQTY,0) as DECIMAL(18,{0})) as CreatedQty,
CAST( (a.Quantity-ISNULL(c.LOTQTY,0)) as DECIMAL(18,{0})) as thisCreateQty,isnull(b.EffectiveEnable,0) as EffectiveEnable, CAST( isnull(b.EffectiveDays,0) as DECIMAL(18,{0})) as EffectiveDays
from ICSODeliveryNotice a left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join (select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a left join ICSInventoryLotDetail b on a.LotNo=b.LotNo group by b.TransCode,b.TransSequence ) c on a.ODNCode=c.TransCode and a.Sequence=c.TransSequence
WHERE 1 =1 and a.ODNCode='" + ODNCode + "' and a.Sequence='" + Sequence + "'";
sql += " and a.WorkPoint='" + WorkPoint + "'"; sql = string.Format(sql, Figure); return Repository().FindTableBySql(sql.ToString()); }
/// <summary>
/// 点击开立成品入库生成条码(开立成品入库单)
/// </summary>
/// //--
public DataTable GetSubGridJsonKLCPRKByCreate(string RCVCode, string Sequence, string WorkPoint) {
DataTable dt = new DataTable(); object Figure = GetDecimalDigits(); List<DbParameter> parameter = new List<DbParameter>(); string sql = @"select a.InvCode,b.InvName,b.InvStd,b.InvUnit, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST( a.Amount as DECIMAL(18,{0})) as Amount, CAST( isnull(c.LOTQTY,0) as DECIMAL(18,{0})) as CreatedQty,
CAST( (a.Quantity-ISNULL(c.LOTQTY,0)) as DECIMAL(18,{0})) as thisCreateQty,isnull(b.EffectiveEnable,0) as EffectiveEnable, CAST( isnull(b.EffectiveDays,0) as DECIMAL(18,{0})) as EffectiveDays
from ICSManufactureReceive a left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join (select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a left join ICSInventoryLotDetail b on a.LotNo=b.LotNo group by b.TransCode,b.TransSequence ) c on a.RCVCode=c.TransCode and a.Sequence=c.TransSequence
WHERE 1 =1 and a.RCVCode='" + RCVCode + "' and a.Sequence='" + Sequence + "'";
sql += " and a.WorkPoint='" + WorkPoint + "'"; sql = string.Format(sql, Figure); return Repository().FindTableBySql(sql.ToString()); }
/// <summary>
/// 点击审核到货单生成条码(审核到货单)
/// </summary>
public DataTable GetSubGridJsonSHDHByCreate(string DNCode, string Sequence, string WorkPoint) {
DataTable dt = new DataTable(); object Figure = GetDecimalDigits(); List<DbParameter> parameter = new List<DbParameter>(); string sql = @"select a.InvCode,b.InvName,b.InvStd,b.InvUnit, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST( a.Amount as DECIMAL(18,{0})) as Amount, CAST( isnull(c.LOTQTY,0) as DECIMAL(18,{0})) as CreatedQty,
CAST( (a.Quantity-ISNULL(c.LOTQTY,0)) as DECIMAL(18,{0})) as thisCreateQty,isnull(b.EffectiveEnable,0) as EffectiveEnable, CAST( isnull(b.EffectiveDays,0) as DECIMAL(18,{0})) as EffectiveDays from ICSDeliveryNotice a left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join (select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a left join ICSInventoryLotDetail b on a.LotNo=b.LotNo group by b.TransCode,b.TransSequence ) c on a.DNCode=c.TransCode and a.Sequence=c.TransSequence
WHERE 1 =1 and a.DNCode='" + DNCode + "' and a.Sequence='" + Sequence + "'";
sql += " and a.WorkPoint='" + WorkPoint + "'"; sql = string.Format(sql, Figure); return Repository().FindTableBySql(sql.ToString()); }
/// <summary>
/// 点击归还生成条码(归还)
/// </summary>
public DataTable GetSubGridJsonGuiHuanByCreate(string ReturnCode, string Sequence, string WorkPoint) {
DataTable dt = new DataTable(); object Figure = GetDecimalDigits(); List<DbParameter> parameter = new List<DbParameter>(); string sql = @"select a.InvCode,b.InvName,b.InvStd,b.InvUnit, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST( a.Amount as DECIMAL(18,{0})) as Amount, CAST( isnull(c.LOTQTY,0) as DECIMAL(18,{0})) as CreatedQty,
CAST( (a.Quantity-ISNULL(c.LOTQTY,0)) as DECIMAL(18,{0})) as thisCreateQty,isnull(b.EffectiveEnable,0) as EffectiveEnable, CAST( isnull(b.EffectiveDays,0) as DECIMAL(18,{0})) as EffectiveDays from ICSReturn a left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join (select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a left join ICSInventoryLotDetail b on a.LotNo=b.LotNo group by b.TransCode,b.TransSequence ) c on a.ReturnCode=c.TransCode and a.Sequence=c.TransSequence
WHERE 1 =1 and a.ReturnCode='" + ReturnCode + "' and a.Sequence='" + Sequence + "'";
sql += " and a.WorkPoint='" + WorkPoint + "'"; sql = string.Format(sql, Figure); return Repository().FindTableBySql(sql.ToString()); }
/// <summary>
/// 归还单生成条码
/// </summary>
/// <param name="POCode"></param>
/// <param name="PORow"></param>
/// <param name="keyValue"></param>
/// 已改
/// <returns></returns>
public int SubmitFormGuiHuan(string ReturnCode, string Sequence, string keyValue, string WorkPoint) { var queryParam = keyValue.ToJObject(); string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString()); decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString()); decimal thisCreateQty = Convert.ToDecimal(queryParam["thisCreateQty"].ToString()); decimal LOTQTY = minPackQty; string Pre = "GH" + ReturnCode + Sequence; string sql = string.Empty; string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString(); string sqls = string.Empty; string Colspan = ""; for (int i = 0; i < createPageCount; i++) { if (i + 1 == createPageCount) { if (minPackQty * createPageCount > thisCreateQty) { LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1)); } }
Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString(); sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}'", Colspan); object ExtensionID = SqlHelper.ExecuteScalar(sqls); if (ExtensionID == null) { ExtensionID = Guid.NewGuid(); sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
ExtensionID, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(), MUSER, MUSERNAME, WorkPoints); }
string LotNo = GetSerialCode(WorkPoint, "ICSInventoryLot", "LotNO", Pre, 5); sql += string.Format(@"Insert into ICSInventoryLotDetail(LotNo, TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}',getdate(),'{5}' )",
LotNo, ReturnCode, Sequence, MUSER, MUSERNAME, WorkPoints); //if (SqlHelper.ExecuteNonQuery(sqls) > 0)
//{
sql += string.Format(@"
insert into ICSInventoryLot (ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount) select newid(),'{0}',InvCode,'{1}','{10}','{2}','{8}','6','{3}','{4}', getdate(),'{5}','{9}' from ICSReturn where ReturnCode='{6}' and Sequence='{7}' and WorkPoint='{5}' ",
LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, ReturnCode, Sequence, ExtensionID, Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString()); sql += "\r\n"; //}
} int count = SqlHelper.CmdExecuteNonQueryLi(sql); return count; }
/// <summary>
/// 审核到货单生成条码
/// </summary>
/// <param name="POCode"></param>
/// <param name="PORow"></param>
/// <param name="keyValue"></param>
/// 已改
/// <returns></returns>
public int SubmitFormSHDH(string DNCode, string Sequence, string INVCode, string keyValue, string WorkPoint) { try { string postUrlStr = System.Configuration.ConfigurationManager.AppSettings["HGDocpostUrlStr"].ToString(); var queryParam = keyValue.ToJObject(); string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString()); decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString()); decimal thisCreateQty = Convert.ToDecimal(queryParam["thisCreateQty"].ToString()); decimal LOTQTY = minPackQty; string Pre = "DN" + DNCode + Sequence; string sql = string.Empty; string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString(); string sqls = string.Empty; string Colspan = ""; string InspectJosn = ""; InspectJosn += "{"; InspectJosn += "\"IMP_ORDINI\":["; InspectJosn += "{"; InspectJosn += "\"ORD_ORDINE\":\"" + DNCode + "\","; InspectJosn += "\"ORD_DES\":\"采购入库-采购到货单\","; InspectJosn += "\"ORD_TIPOOP\":\"V\""; InspectJosn += "}"; InspectJosn += "],"; InspectJosn += "\"IMP_ORDINI_RIGHE\":[";
for (int i = 0; i < createPageCount; i++) { if (i + 1 == createPageCount) { if (minPackQty * createPageCount > thisCreateQty) { LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1)); } }
//Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString();
//sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}'", Colspan);
//object ExtensionID = SqlHelper.ExecuteScalar(sqls);
sqls = $@"SELECT TOP 1 ExtensionID FROM ICSDeliveryNotice WHERE DNCode='{DNCode}'"; object ExtensionID = SqlHelper.ExecuteScalar(sqls); if (ExtensionID == null) { ExtensionID = Guid.NewGuid(); sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
ExtensionID, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(), MUSER, MUSERNAME, WorkPoints); }
string LotNo = GetSerialCode(WorkPoint, "ICSInventoryLot", "LotNO", Pre, 5); sql += string.Format(@"Insert into ICSInventoryLotDetail(LotNo, TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}',getdate(),'{5}' )",
LotNo, DNCode, Sequence, MUSER, MUSERNAME, WorkPoints);
sql += string.Format(@"insert into ICSInventoryLot
(ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount) select newid(),'{0}',InvCode,'{1}','{10}','{2}','{8}','7','{3}','{4}', getdate(),'{5}','{9}' from ICSDeliveryNotice where DNCode='{6}' and Sequence='{7}' and WorkPoint='{5}'",
LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, DNCode, Sequence, ExtensionID, Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString()); sql += "\r\n";
if (i == createPageCount - 1) { InspectJosn += "{"; InspectJosn += "\"RIG_ORDINE\":\"" + DNCode + "\","; InspectJosn += "\"RIG_ARTICOLO\": \"" + INVCode + "\","; InspectJosn += "\"RIG_SUB1\": \""+LotNo+"\","; InspectJosn += "\"RIG_SUB2\": \"\","; InspectJosn += "\"RIG_QTAR\": " + thisCreateQty + ","; InspectJosn += "\"RIG_HOSTINF\": " + Sequence + ""; InspectJosn += "}"; } else { InspectJosn += "{"; InspectJosn += "\"RIG_ORDINE\":\"" + DNCode + "\","; InspectJosn += "\"RIG_ARTICOLO\": \"" + INVCode + "\","; InspectJosn += "\"RIG_SUB1\": \"" + LotNo + "\","; InspectJosn += "\"RIG_SUB2\": \"\","; InspectJosn += "\"RIG_QTAR\": " + thisCreateQty + ","; InspectJosn += "\"RIG_HOSTINF\": " + Sequence + ""; InspectJosn += "},"; } }
InspectJosn += "]"; InspectJosn += "}"; string result = ""; if (Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UploadERP"])) { result = HTTPHelper.RestFulGet(InspectJosn, postUrlStr); if (result.Contains("Error")) { ICSHGResult hgresult = JsonConvert.DeserializeObject<ICSHGResult>(result.TrimStart('[').TrimEnd(']')); throw new Exception("货柜单据传输接口调用报错,主要报错信息:" + hgresult.PrimaryError + ",次要报错信息:" + hgresult.SecondaryError + ""); } } int count = SqlHelper.CmdExecuteNonQueryLi(sql); return count; } catch (Exception ex) { throw new Exception(ex.Message); } } /// <summary>
/// 审核委外到货单生成条码
/// </summary>
/// <param name="POCode"></param>
/// <param name="PORow"></param>
/// <param name="keyValue"></param>
/// 已改
/// <returns></returns>
public int SubmitFormWWSHDH(string ODNCode, string Sequence, string keyValue, string WorkPoint) { var queryParam = keyValue.ToJObject(); string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString()); decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString()); decimal thisCreateQty = Convert.ToDecimal(queryParam["thisCreateQty"].ToString()); decimal LOTQTY = minPackQty; string Pre = "ODN" + ODNCode + Sequence; string sql = string.Empty; string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString(); string sqls = string.Empty; string Colspan = ""; for (int i = 0; i < createPageCount; i++) { if (i + 1 == createPageCount) { if (minPackQty * createPageCount > thisCreateQty) { LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1)); } }
Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString(); sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}'", Colspan); object ExtensionID = SqlHelper.ExecuteScalar(sqls); if (ExtensionID == null) { ExtensionID = Guid.NewGuid(); sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
ExtensionID, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(), MUSER, MUSERNAME, WorkPoints); }
string LotNo = GetSerialCode(WorkPoint, "ICSInventoryLot", "LotNO", Pre, 5); sql += string.Format(@"Insert into ICSInventoryLotDetail(LotNo, TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}',getdate(),'{5}' )",
LotNo, ODNCode, Sequence, MUSER, MUSERNAME, WorkPoints);
sql += string.Format(@"
insert into ICSInventoryLot (ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount) select newid(),'{0}',InvCode,'{1}','{10}','{2}','{8}','8','{3}','{4}', getdate(),'{5}','{9}' from ICSODeliveryNotice where ODNCode='{6}' and Sequence='{7}' and WorkPoint='{5}'",
LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, ODNCode, Sequence, ExtensionID, Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString()); sql += "\r\n";
} int count = SqlHelper.CmdExecuteNonQueryLi(sql); return count; }
/// <summary>
/// 开立成品入库单
/// </summary>
/// <param name="POCode"></param>
/// <param name="PORow"></param>
/// <param name="keyValue"></param>
/// 已改
/// <returns></returns>
public int SubmitFormKLCPRK(string RCVCode, string Sequence, string keyValue, string WorkPoint) { var queryParam = keyValue.ToJObject(); string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString()); decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString()); decimal thisCreateQty = Convert.ToDecimal(queryParam["thisCreateQty"].ToString()); decimal LOTQTY = minPackQty; string Pre = "KCP" + RCVCode + Sequence; string sql = string.Empty; string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString(); string sqls = string.Empty; string Colspan = ""; for (int i = 0; i < createPageCount; i++) { if (i + 1 == createPageCount) { if (minPackQty * createPageCount > thisCreateQty) { LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1)); } }
Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString(); sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}'", Colspan); object ExtensionID = SqlHelper.ExecuteScalar(sqls); if (ExtensionID == null) { ExtensionID = Guid.NewGuid(); sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
ExtensionID, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(), MUSER, MUSERNAME, WorkPoints); }
string LotNo = GetSerialCode(WorkPoint, "ICSInventoryLot", "LotNO", Pre, 5); sql += string.Format(@"Insert into ICSInventoryLotDetail(LotNo, TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}',getdate(),'{5}' )",
LotNo, RCVCode, Sequence, MUSER, MUSERNAME, WorkPoints);
sql += string.Format(@"
insert into ICSInventoryLot (ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount) select newid(),'{0}',InvCode,'{1}','{10}','{2}','{8}','9','{3}','{4}', getdate(),'{5}','{9}' from ICSManufactureReceive where RCVCode='{6}' and Sequence='{7}' and WorkPoint='{5}'",
LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, RCVCode, Sequence, ExtensionID, Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString()); sql += "\r\n";
} int count = SqlHelper.CmdExecuteNonQueryLi(sql); return count; }
//委外拒收单
public DataTable GetGridJsonWWJSD(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.ID, a.ODNCode OOCode,a.Sequence OOSequence,a.VenCode,e.VenName,a.InvCode, b.InvName,b.InvStd,b.InvDesc,b.InvUnit,
CAST(a.Quantity AS DECIMAL(18,{0})) as Quantity ,CAST(a.Amount AS DECIMAL(18,{0})) as Amount,CAST(a.RCVQuantity AS DECIMAL(18,{0})) as RCVQuantity,CAST(a.UnitPrice AS DECIMAL(18,{0})) as UnitPrice,a.Currency,a.CreatePerson,a.CreateDateTime,CAST(c.LOTQTY AS DECIMAL(18,{0})) as LOTQTY ,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 ICSODeliveryNotice a left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select mm.TransCode,mm.TransSequence,sum(isnull(ee.Quantity,0)) LOTQTY,ee.WorkPoint from ICSInventoryLot ee left join ICSInventoryLotDetail mm on ee.LotNo=mm.LotNo and ee.type='11' group by mm.TransCode,mm.TransSequence,ee.WorkPoint ) c on a.ODNCode=c.TransCode and a.Sequence=c.TransSequence and a.WorkPoint=c.WorkPoint --inner join ICSOutsourcingOrder d on a.OOID=d.OOID and a.OODetailID=d.OODetailID and a.WorkPoint=d.WorkPoint left join ICSVendor e on a.VenCode=e.VenCode and a.WorkPoint=e.WorkPoint left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint where a.ODNType='3' and a.Status='2' and a.EATTRIBUTE1 is NOT null ";
sql = string.Format(sql, Figure); sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); #endregion
if (!string.IsNullOrWhiteSpace(queryJson)) { if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString())) { sql += " and a.ODNCode like '%" + queryParam["POCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["VenCode"].ToString())) { sql += " and a.VenCode like '%" + queryParam["VenCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["VenName"].ToString())) { sql += " and e.VenName like '%" + queryParam["VenName"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString())) { sql += " and a.InvCode like '%" + queryParam["InvCode"].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 (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin") { sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'"; } 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 DataTable GetGridJsonJSD(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.ID,a.DNCode ,a.Sequence ,a.VenCode,e.VenName,a.InvCode, b.InvName,b.InvStd,b.InvDesc,b.InvUnit,
CAST(a.Quantity AS DECIMAL(18,{0})) as Quantity ,CAST(a.Amount AS DECIMAL(18,{0})) as Amount,CAST(a.RCVQuantity AS DECIMAL(18,{0})) as RCVQuantity,CAST( a.UnitPrice AS DECIMAL(18,{0})) as UnitPrice,a.Currency,a.CreatePerson,a.CreateDateTime, CAST(c.LOTQTY AS DECIMAL(18,{0})) as LOTQTY ,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 ICSDeliveryNotice a left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select mm.TransCode,mm.TransSequence,sum(isnull(ee.Quantity,0)) LOTQTY,ee.WorkPoint from ICSInventoryLot ee left join ICSInventoryLotDetail mm on ee.LotNo=mm.LotNo and ee.type='10' group by mm.TransCode,mm.TransSequence,ee.WorkPoint ) c on a.DNCode=c.TransCode and a.Sequence=c.TransSequence and a.WorkPoint=c.WorkPoint --inner join ICSPurchaseOrder d on a.POID=d.POID and a.PODetailID=d.PODetailID and a.WorkPoint=d.WorkPoint left join ICSVendor e on a.VenCode=e.VenCode and a.WorkPoint=e.WorkPoint left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint where a.DNType='3' and a.Status='2' and a.EATTRIBUTE1 is NOT null ";
sql = string.Format(sql, Figure); sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); #endregion
if (!string.IsNullOrWhiteSpace(queryJson)) { if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString())) { sql += " and a.DNCode like '%" + queryParam["POCode"].ToString() + "%' "; }
if (!string.IsNullOrWhiteSpace(queryParam["VenCode"].ToString())) { sql += " and a.VenCode like '%" + queryParam["VenCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["VenName"].ToString())) { sql += " and e.VenName like '%" + queryParam["VenName"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString())) { sql += " and a.InvCode like '%" + queryParam["InvCode"].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 (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin") { sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'"; } 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 DataTable GetGridJsonLLSQTL(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.ID,a.ApplyNegCode,a.Sequence,a.SourceDetailID,a.InvCode,b.InvName,b.InvDesc,b.InvStd,b.InvUnit,
CAST(a.Quantity AS DECIMAL(18,{0})) as Quantity ,CAST(a.Amount AS DECIMAL(18,{0})) as Amount,CAST(a.IssueNegQuantity AS DECIMAL(18,{0})) as IssueNegQuantity ,a.ExtensionID,a.MUSERName,a.MTIME ,CAST(c.LOTQTY AS DECIMAL(18,{0})) as LOTQTY ,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 ICSMOApplyNegDetail a left join ICSMOApplyNeg d on a.ApplyNegCode=d.ApplyNegCode and a.WorkPoint=d.WorkPoint left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select mm.TransCode,mm.TransSequence,sum(isnull(ee.Quantity,0)) LOTQTY,ee.WorkPoint from ICSInventoryLot ee left join ICSInventoryLotDetail mm on ee.LotNo=mm.LotNo and ee.type='12' group by mm.TransCode,mm.TransSequence,ee.WorkPoint )c on a.ApplyNegCode=c.TransCode and a.Sequence=c.TransSequence and a.WorkPoint=c.WorkPoint left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint WHERE d.Type='2'";
sql = string.Format(sql, Figure); sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); #endregion
if (!string.IsNullOrWhiteSpace(queryJson)) { if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString())) { sql += " and a.ApplyNegCode like '%" + queryParam["POCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString())) { sql += " and a.InvCode like '%" + queryParam["InvCode"].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 (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin") { sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'"; } 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); }
/// <summary>
/// 拒收生成条码
/// </summary>
/// <param name="POCode"></param>
/// <param name="PORow"></param>
/// <param name="keyValue"></param>
/// <returns></returns>
public int SubmitFormJSD(string DNCode, string Sequence, string keyValue, string WorkPoint) { var queryParam = keyValue.ToJObject(); string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString()); decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString()); decimal thisCreateQty = Convert.ToDecimal(queryParam["thisCreateQty"].ToString()); decimal LOTQTY = minPackQty; string Pre = "JS" + DNCode + Sequence; string sql = string.Empty; string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString(); string sqls = string.Empty; string Colspan = ""; for (int i = 0; i < createPageCount; i++) { if (i + 1 == createPageCount) { if (minPackQty * createPageCount > thisCreateQty) { LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1)); } }
Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString(); sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}'", Colspan); object ExtensionID = SqlHelper.ExecuteScalar(sqls); if (ExtensionID == null) { ExtensionID = Guid.NewGuid(); sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
ExtensionID, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(), MUSER, MUSERNAME, WorkPoints); }
string LotNo = GetSerialCode(WorkPoint, "ICSInventoryLot", "LotNO", Pre, 5); sql += string.Format(@"Insert into ICSInventoryLotDetail(LotNo, TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}',getdate(),'{5}' )",
LotNo, DNCode, Sequence, MUSER, MUSERNAME, WorkPoints); //if (SqlHelper.ExecuteNonQuery(sqls) > 0)
//{
sql += string.Format(@"
insert into ICSInventoryLot (ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount) select newid(),'{0}',InvCode,'{1}','{10}','{2}','{8}','10','{3}','{4}', getdate(),'{5}','{9}' from ICSDeliveryNotice where DNCode='{6}' and Sequence='{7}' and WorkPoint='{5}'",
LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, DNCode, Sequence, ExtensionID, Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString()); sql += "\r\n"; //}
} int count = SqlHelper.CmdExecuteNonQueryLi(sql); return count; } /// <summary>
/// 委外拒收生成条码
/// </summary>
/// <param name="POCode"></param>
/// <param name="PORow"></param>
/// <param name="keyValue"></param>
/// <returns></returns>
public int SubmitFormWWJSD(string ODNCode, string Sequence, string keyValue, string WorkPoint) { var queryParam = keyValue.ToJObject(); string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString()); decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString()); decimal thisCreateQty = Convert.ToDecimal(queryParam["thisCreateQty"].ToString()); decimal LOTQTY = minPackQty; string Pre = "OJS" + ODNCode + Sequence; string sql = string.Empty; string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString(); string sqls = string.Empty; string Colspan = ""; for (int i = 0; i < createPageCount; i++) { if (i + 1 == createPageCount) { if (minPackQty * createPageCount > thisCreateQty) { LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1)); } }
Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString(); sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}'", Colspan); object ExtensionID = SqlHelper.ExecuteScalar(sqls); if (ExtensionID == null) { ExtensionID = Guid.NewGuid(); sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
ExtensionID, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(), MUSER, MUSERNAME, WorkPoints); }
string LotNo = GetSerialCode(WorkPoint, "ICSInventoryLot", "LotNO", Pre, 5); sql += string.Format(@"Insert into ICSInventoryLotDetail(LotNo, TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}',getdate(),'{5}' )",
LotNo, ODNCode, Sequence, MUSER, MUSERNAME, WorkPoints); //if (SqlHelper.ExecuteNonQuery(sqls) > 0)
//{
sql += string.Format(@"
insert into ICSInventoryLot (ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount) select newid(),'{0}',InvCode,'{1}','{10}','{2}','{8}','11','{3}','{4}', getdate(),'{5}','{9}' from ICSODeliveryNotice where ODNCode='{6}' and Sequence='{7}' and WorkPoint='{5}'",
LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, ODNCode, Sequence, ExtensionID, Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString()); sql += "\r\n"; //}
} int count = SqlHelper.CmdExecuteNonQueryLi(sql); return count; }
/// <summary>
/// 点击审核到货单生成条码(审核到货单)
/// </summary>
public DataTable GetSubGridJsonJSDByCreate(string DNCode, string Sequence, string WorkPoint) {
DataTable dt = new DataTable(); object Figure = GetDecimalDigits(); List<DbParameter> parameter = new List<DbParameter>(); string sql = @"select a.InvCode,b.InvName,b.InvStd,b.InvUnit, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST( a.Amount as DECIMAL(18,{0})) as Amount, CAST( isnull(c.LOTQTY,0) as DECIMAL(18,{0})) as CreatedQty,
CAST( (a.Quantity-ISNULL(c.LOTQTY,0)) as DECIMAL(18,{0})) as thisCreateQty,isnull(b.EffectiveEnable,0) as EffectiveEnable, CAST( isnull(b.EffectiveDays,0) as DECIMAL(18,{0})) as EffectiveDays from ICSDeliveryNotice a left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join (select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a left join ICSInventoryLotDetail b on a.LotNo=b.LotNo group by b.TransCode,b.TransSequence ) c on a.DNCode=c.TransCode and a.Sequence=c.TransSequence
WHERE a.DNType='3' and a.DNCode='" + DNCode + "' and a.Sequence='" + Sequence + "'";
sql += " and a.WorkPoint='" + WorkPoint + "'"; sql = string.Format(sql, Figure); return Repository().FindTableBySql(sql.ToString()); }
/// <summary>
/// 点击审核委外到货单生成条码(审核委外到货单)
/// </summary>
public DataTable GetSubGridJsonWWJSDByCreate(string ODNCode, string Sequence, string WorkPoint) {
DataTable dt = new DataTable(); object Figure = GetDecimalDigits(); List<DbParameter> parameter = new List<DbParameter>(); string sql = @"select a.InvCode,b.InvName,b.InvStd,b.InvUnit, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST( a.Amount as DECIMAL(18,{0})) as Amount, CAST( isnull(c.LOTQTY,0) as DECIMAL(18,{0})) as CreatedQty,
CAST( (a.Quantity-ISNULL(c.LOTQTY,0)) as DECIMAL(18,{0})) as thisCreateQty,isnull(b.EffectiveEnable,0) as EffectiveEnable, CAST( isnull(b.EffectiveDays,0) as DECIMAL(18,{0})) as EffectiveDays from ICSODeliveryNotice a left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join (select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a left join ICSInventoryLotDetail b on a.LotNo=b.LotNo group by b.TransCode,b.TransSequence ) c on a.ODNCode=c.TransCode and a.Sequence=c.TransSequence
WHERE a.ODNType='3' and a.ODNCode='" + ODNCode + "' and a.Sequence='" + Sequence + "'";
sql += " and a.WorkPoint='" + WorkPoint + "'"; sql = string.Format(sql, Figure); return Repository().FindTableBySql(sql.ToString()); }
public DataTable GetSubGridJsonLLSQDByCreate(string ApplyNegCode, string Sequence, string WorkPoint) { DataTable dt = new DataTable(); object Figure = GetDecimalDigits(); List<DbParameter> parameter = new List<DbParameter>(); string sql = @"select a.InvCode,b.InvName,b.InvStd,b.InvUnit, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST( a.Amount as DECIMAL(18,{0})) as Amount, CAST( isnull(c.LOTQTY,0) as DECIMAL(18,{0})) as CreatedQty,
CAST( (a.Quantity-ISNULL(c.LOTQTY,0)) as DECIMAL(18,{0})) as thisCreateQty,isnull(b.EffectiveEnable,0) as EffectiveEnable, CAST( isnull(b.EffectiveDays,0) as DECIMAL(18,{0})) as EffectiveDays from ICSMOApplyNegDetail a left join ICSMOApplyNeg d on a.ApplyNegCode=d.ApplyNegCode and a.WorkPoint=d.WorkPoint left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a left join ICSInventoryLotDetail b on a.LotNo=b.LotNo group by b.TransCode,b.TransSequence ) c on a.ApplyNegCode=c.TransCode and a.Sequence=c.TransSequence WHERE d.Type='2' and a.ApplyNegCode='" + ApplyNegCode + "' and a.Sequence='" + Sequence + "'";
sql += " and a.WorkPoint='" + WorkPoint + "'"; sql = string.Format(sql, Figure); return Repository().FindTableBySql(sql.ToString()); }
//领料申请退料生成条码
public int SubmitFormLLSQTL(string ApplyNegCode, string Sequence, string keyValue, string WorkPoint) { var queryParam = keyValue.ToJObject(); string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString()); decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString()); decimal thisCreateQty = Convert.ToDecimal(queryParam["thisCreateQty"].ToString()); decimal LOTQTY = minPackQty; //string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
//string VenCode = GetVendorCode(ApplyNegCode, Sequence, WorkPoint);
string Pre = "MA" + ApplyNegCode + Sequence; string sql = string.Empty; //string VendorLot = queryParam["VendorLot"].ToString();
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString(); string sqls = string.Empty; string Colspan = ""; for (int i = 0; i < createPageCount; i++) { if (i + 1 == createPageCount) { if (minPackQty * createPageCount > thisCreateQty) { LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1)); } }
Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString(); sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}'", Colspan); object ExtensionID = SqlHelper.ExecuteScalar(sqls); if (ExtensionID == null) { ExtensionID = Guid.NewGuid(); sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
ExtensionID, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(), MUSER, MUSERNAME, WorkPoints); }
string LotNo = GetSerialCode(WorkPoint, "ICSInventoryLot", "LotNO", Pre, 5); sql += string.Format(@"Insert into ICSInventoryLotDetail(LotNo, TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}',getdate(),'{5}' )",
LotNo, ApplyNegCode, Sequence, MUSER, MUSERNAME, WorkPoints); //if (SqlHelper.ExecuteNonQuery(sqls) > 0)
//{
sql += string.Format(@"insert into ICSInventoryLot
(ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount) select newid(),'{0}',InvCode,'{1}','{10}','{2}','{8}','12','{3}','{4}', getdate(),'{5}','{9}' from ICSMOApplyNegDetail where ApplyNegCode='{6}' and Sequence='{7}' and WorkPoint='{5}' ",
LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, ApplyNegCode, Sequence, ExtensionID, Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString()); sql += "\r\n"; //}
} int count = SqlHelper.CmdExecuteNonQueryLi(sql); return count; }
//材料出库退料
public DataTable GetGridJsonCLCK(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.ID,a.ApplyNegCode,a.Sequence,a.SourceDetailID,a.InvCode,b.InvName,b.InvDesc,b.InvStd,b.InvUnit, CAST(a.Quantity AS DECIMAL(18,{0})) as Quantity, CAST(a.Amount AS DECIMAL(18,{0})) as Amount,CAST(a.IssueNegQuantity AS DECIMAL(18,{0})) as IssueNegQuantity ,a.ExtensionID,a.MUSERName,a.MTIME ,CAST(c.LOTQTY AS DECIMAL(18,{0})) as LOTQTY ,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 ICSMOApplyNegDetail a left join ICSMOApplyNeg d on a.ApplyNegCode=d.ApplyNegCode and a.WorkPoint=d.WorkPoint left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select mm.TransCode,mm.TransSequence,sum(isnull(ee.Quantity,0)) LOTQTY,ee.WorkPoint from ICSInventoryLot ee left join ICSInventoryLotDetail mm on ee.LotNo=mm.LotNo and ee.type='13' group by mm.TransCode,mm.TransSequence,ee.WorkPoint )c on a.ApplyNegCode=c.TransCode and a.Sequence=c.TransSequence and a.WorkPoint=c.WorkPoint left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint WHERE d.Type='3'";
sql = string.Format(sql, Figure); sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); #endregion
if (!string.IsNullOrWhiteSpace(queryJson)) { if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString())) { sql += " and a.ApplyNegCode like '%" + queryParam["POCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString())) { sql += " and a.InvCode like '%" + queryParam["InvCode"].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 (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin") { sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'"; } 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 DataTable GetSubGridJsonCLCKByCreate(string ApplyNegCode, string Sequence, string WorkPoint) { DataTable dt = new DataTable(); object Figure = GetDecimalDigits(); List<DbParameter> parameter = new List<DbParameter>(); string sql = @"select a.InvCode,b.InvName,b.InvStd,b.InvUnit, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST( a.Amount as DECIMAL(18,{0})) as Amount, CAST( isnull(c.LOTQTY,0) as DECIMAL(18,{0})) as CreatedQty,
CAST( (a.Quantity-ISNULL(c.LOTQTY,0)) as DECIMAL(18,{0})) as thisCreateQty,isnull(b.EffectiveEnable,0) as EffectiveEnable, CAST( isnull(b.EffectiveDays,0) as DECIMAL(18,{0})) as EffectiveDays from ICSMOApplyNegDetail a left join ICSMOApplyNeg d on a.ApplyNegCode=d.ApplyNegCode and a.WorkPoint=d.WorkPoint left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a left join ICSInventoryLotDetail b on a.LotNo=b.LotNo group by b.TransCode,b.TransSequence ) c on a.ApplyNegCode=c.TransCode and a.Sequence=c.TransSequence WHERE d.Type='3' and a.ApplyNegCode='" + ApplyNegCode + "' and a.Sequence='" + Sequence + "'";
sql += " and a.WorkPoint='" + WorkPoint + "'"; sql = string.Format(sql, Figure); return Repository().FindTableBySql(sql.ToString()); }
//材料出库退料生成条码
public int SubmitFormCLCKT(string ApplyNegCode, string Sequence, string keyValue, string WorkPoint) { var queryParam = keyValue.ToJObject(); string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString()); decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString()); decimal thisCreateQty = Convert.ToDecimal(queryParam["thisCreateQty"].ToString()); decimal LOTQTY = minPackQty; string Pre = "MD" + ApplyNegCode + Sequence; string sql = string.Empty; string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString(); string sqls = string.Empty; string Colspan = ""; for (int i = 0; i < createPageCount; i++) { if (i + 1 == createPageCount) { if (minPackQty * createPageCount > thisCreateQty) { LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1)); } }
Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString(); sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}'", Colspan); object ExtensionID = SqlHelper.ExecuteScalar(sqls); if (ExtensionID == null) { ExtensionID = Guid.NewGuid(); sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
ExtensionID, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(), MUSER, MUSERNAME, WorkPoints); }
string LotNo = GetSerialCode(WorkPoint, "ICSInventoryLot", "LotNO", Pre, 5); sql += string.Format(@"Insert into ICSInventoryLotDetail(LotNo, TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}',getdate(),'{5}' )",
LotNo, ApplyNegCode, Sequence, MUSER, MUSERNAME, WorkPoints); sql += string.Format(@"insert into ICSInventoryLot
(ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount) select newid(),'{0}',InvCode,'{1}','{10}','{2}','{8}','13','{3}','{4}', getdate(),'{5}','{9}' from ICSMOApplyNegDetail where ApplyNegCode='{6}' and Sequence='{7}' and WorkPoint='{5}' ",
LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, ApplyNegCode, Sequence, ExtensionID, Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString()); sql += "\r\n"; } int count = SqlHelper.CmdExecuteNonQueryLi(sql); return count; }
public DataTable GetGridJsonWWLLTL(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.ID,a.OApplyNegCode,a.Sequence,a.SourceDetailID,a.InvCode,b.InvName,b.InvDesc,b.InvStd,b.InvUnit,
CAST(a.Quantity AS DECIMAL(18,{0})) as Quantity ,CAST(a.Amount AS DECIMAL(18,{0})) as Amount,CAST(a.IssueNegQuantity AS DECIMAL(18,{0})) as IssueNegQuantity ,a.ExtensionID,a.MUSERName,a.MTIME ,CAST(c.LOTQTY AS DECIMAL(18,{0})) as LOTQTY ,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 ICSOApplyNegDetail a left join ICSOApplyNeg d on a.OApplyNegCode=d.OApplyNegCode AND a.WorkPoint=d.WorkPoint left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select mm.TransCode,mm.TransSequence,sum(isnull(ee.Quantity,0)) LOTQTY,ee.WorkPoint from ICSInventoryLot ee left join ICSInventoryLotDetail mm on ee.LotNo=mm.LotNo and ee.type='14' group by mm.TransCode,mm.TransSequence,ee.WorkPoint )c on a.OApplyNegCode=c.TransCode and a.Sequence=c.TransSequence and a.WorkPoint=c.WorkPoint left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint WHERE d.Type='2'";
sql = string.Format(sql, Figure); sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); #endregion
if (!string.IsNullOrWhiteSpace(queryJson)) { if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString())) { sql += " and a.OApplyNegCode like '%" + queryParam["POCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString())) { sql += " and a.InvCode like '%" + queryParam["InvCode"].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 (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin") { sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'"; } 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); }
/// <summary>
/// 点击委外领料退料生成条码
/// </summary>
public DataTable GetSubGridJsonWWLLByCreate(string OApplyNegCode, string Sequence, string WorkPoint) { DataTable dt = new DataTable(); object Figure = GetDecimalDigits(); List<DbParameter> parameter = new List<DbParameter>(); string sql = @"
select a.InvCode,b.InvName,b.InvStd,b.InvUnit, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST( a.Amount as DECIMAL(18,{0})) as Amount, CAST( isnull(c.LOTQTY,0) as DECIMAL(18,{0})) as CreatedQty, CAST( (a.Quantity-ISNULL(c.LOTQTY,0)) as DECIMAL(18,{0})) as thisCreateQty,isnull(b.EffectiveEnable,0) as EffectiveEnable, CAST( isnull(b.EffectiveDays,0) as DECIMAL(18,{0})) as EffectiveDays
from ICSOApplyNegDetail a left join ICSOApplyNeg d on a.OApplyNegCode=d.OApplyNegCode AND a.WorkPoint=d.WorkPoint left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a left join ICSInventoryLotDetail b on a.LotNo=b.LotNo group by b.TransCode,b.TransSequence ) c on a.OApplyNegCode=c.TransCode and a.Sequence=c.TransSequence WHERE d.Type='2' and a.OApplyNegCode='" + OApplyNegCode + "' and a.Sequence='" + Sequence + "'";
sql += " and a.WorkPoint='" + WorkPoint + "'"; sql = string.Format(sql, Figure); return Repository().FindTableBySql(sql.ToString()); }
//委外领料申请退料
public int SubmitFormWWLL(string OApplyNegCode, string Sequence, string keyValue, string WorkPoint) { var queryParam = keyValue.ToJObject(); string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString()); decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString()); decimal thisCreateQty = Convert.ToDecimal(queryParam["thisCreateQty"].ToString()); decimal LOTQTY = minPackQty; string Pre = "OMA" + OApplyNegCode + Sequence; string sql = string.Empty; string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString(); string sqls = string.Empty; string Colspan = ""; for (int i = 0; i < createPageCount; i++) { if (i + 1 == createPageCount) { if (minPackQty * createPageCount > thisCreateQty) { LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1)); } }
Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString(); sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}'", Colspan); object ExtensionID = SqlHelper.ExecuteScalar(sqls); if (ExtensionID == null) { ExtensionID = Guid.NewGuid(); sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
ExtensionID, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(), MUSER, MUSERNAME, WorkPoints); }
string LotNo = GetSerialCode(WorkPoint, "ICSInventoryLot", "LotNO", Pre, 5); sql += string.Format(@"Insert into ICSInventoryLotDetail(LotNo, TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}',getdate(),'{5}' )",
LotNo, OApplyNegCode, Sequence, MUSER, MUSERNAME, WorkPoints); sql += string.Format(@"insert into ICSInventoryLot
(ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount) select newid(),'{0}',InvCode,'{1}','{10}','{2}','{8}','14','{3}','{4}', getdate(),'{5}','{9}' from ICSOApplyNegDetail where OApplyNegCode='{6}' and Sequence='{7}' and WorkPoint='{5}' ",
LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, OApplyNegCode, Sequence, ExtensionID, Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString()); sql += "\r\n"; } int count = SqlHelper.CmdExecuteNonQueryLi(sql); return count; }
//委外材料出库
public DataTable GetGridJsonWWCLCK(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.ID,a.OApplyNegCode,a.Sequence,a.SourceDetailID,a.InvCode,b.InvName,b.InvDesc,b.InvStd,b.InvUnit,
CAST(a.Quantity AS DECIMAL(18,{0})) as Quantity ,CAST(a.Amount AS DECIMAL(18,{0})) as Amount,CAST(a.IssueNegQuantity AS DECIMAL(18,{0})) as IssueNegQuantity ,a.ExtensionID,a.MUSERName,a.MTIME ,CAST(c.LOTQTY AS DECIMAL(18,{0})) as LOTQTY ,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 ICSOApplyNegDetail a left join ICSOApplyNeg d on a.OApplyNegCode=d.OApplyNegCode AND a.WorkPoint=d.WorkPoint left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select mm.TransCode,mm.TransSequence,sum(isnull(ee.Quantity,0)) LOTQTY,ee.WorkPoint from ICSInventoryLot ee left join ICSInventoryLotDetail mm on ee.LotNo=mm.LotNo and ee.type='15' group by mm.TransCode,mm.TransSequence,ee.WorkPoint )c on a.OApplyNegCode=c.TransCode and a.Sequence=c.TransSequence and a.WorkPoint=c.WorkPoint left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint WHERE d.Type='3'";
sql = string.Format(sql, Figure); sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); #endregion
if (!string.IsNullOrWhiteSpace(queryJson)) { if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString())) { sql += " and a.OApplyNegCode like '%" + queryParam["POCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString())) { sql += " and a.InvCode like '%" + queryParam["InvCode"].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 (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin") { sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'"; } 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 DataTable GetSubGridJsonWWCLByCreate(string OApplyNegCode, string Sequence, string WorkPoint) { DataTable dt = new DataTable(); object Figure = GetDecimalDigits(); List<DbParameter> parameter = new List<DbParameter>(); string sql = @"
select a.InvCode,b.InvName,b.InvStd,b.InvUnit, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST( a.Amount as DECIMAL(18,{0})) as Amount, CAST( isnull(c.LOTQTY,0) as DECIMAL(18,{0})) as CreatedQty, CAST( (a.Quantity-ISNULL(c.LOTQTY,0)) as DECIMAL(18,{0})) as thisCreateQty,isnull(b.EffectiveEnable,0) as EffectiveEnable, CAST( isnull(b.EffectiveDays,0) as DECIMAL(18,{0})) as EffectiveDays from ICSOApplyNegDetail a left join ICSOApplyNeg d on a.OApplyNegCode=d.OApplyNegCode AND a.WorkPoint=d.WorkPoint left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a left join ICSInventoryLotDetail b on a.LotNo=b.LotNo group by b.TransCode,b.TransSequence ) c on a.OApplyNegCode=c.TransCode and a.Sequence=c.TransSequence WHERE d.Type='3' and a.OApplyNegCode='" + OApplyNegCode + "' and a.Sequence='" + Sequence + "'";
sql += " and a.WorkPoint='" + WorkPoint + "'"; sql = string.Format(sql, Figure); return Repository().FindTableBySql(sql.ToString()); } //委外材料出库
public int SubmitFormWWCL(string OApplyNegCode, string Sequence, string keyValue, string WorkPoint) { var queryParam = keyValue.ToJObject(); string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString()); decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString()); decimal thisCreateQty = Convert.ToDecimal(queryParam["thisCreateQty"].ToString()); decimal LOTQTY = minPackQty; //string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
//string VenCode = GetVendorCode(ApplyNegCode, Sequence, WorkPoint);
string Pre = "OMD" + OApplyNegCode + Sequence; string sql = string.Empty; //string VendorLot = queryParam["VendorLot"].ToString();
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString(); string sqls = string.Empty; string Colspan = ""; for (int i = 0; i < createPageCount; i++) { if (i + 1 == createPageCount) { if (minPackQty * createPageCount > thisCreateQty) { LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1)); } }
Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString(); sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}'", Colspan); object ExtensionID = SqlHelper.ExecuteScalar(sqls); if (ExtensionID == null) { ExtensionID = Guid.NewGuid(); sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
ExtensionID, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(), MUSER, MUSERNAME, WorkPoints); }
string LotNo = GetSerialCode(WorkPoint, "ICSInventoryLot", "LotNO", Pre, 5); sql += string.Format(@"Insert into ICSInventoryLotDetail(LotNo, TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}',getdate(),'{5}' )",
LotNo, OApplyNegCode, Sequence, MUSER, MUSERNAME, WorkPoints); //if (SqlHelper.ExecuteNonQuery(sqls) > 0)
//{
sql += string.Format(@"insert into ICSInventoryLot
(ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount) select newid(),'{0}',InvCode,'{1}','{10}','{2}','{8}','15','{3}','{4}', getdate(),'{5}','{9}' from ICSOApplyNegDetail where OApplyNegCode='{6}' and Sequence='{7}' and WorkPoint='{5}' ",
LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, OApplyNegCode, Sequence, ExtensionID, Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString()); sql += "\r\n"; //}
} int count = SqlHelper.CmdExecuteNonQueryLi(sql); return count; }
public DataTable SelectICSExtensionEnable(string BeginTime, string EndTime) { string sql = @"select ColCode from ICSExtensionEnable
where Enable=0 order by cast(EATTRIBUTE1 as int)";
DataTable dt = SqlHelper.GetDataTableBySql(sql); return dt; }
//返工工单
public DataTable GetGridJsonFGGD(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.ID,d.MOCode,d.Sequence+'-'+ a.Sequence as Sequence,a.PickID,a.InvCode,b.InvName,b.InvDesc,b.InvStd,b.InvUnit,
CAST(a.Quantity AS DECIMAL(18,{0})) as Quantity CAST(a.Amount AS DECIMAL(18,{0})) as Amount,CAST(a.IssueQuantity AS DECIMAL(18,{0})) as IssueQuantity ,a.ExtensionID,a.MUSERName,a.MTIME ,CAST(c.LOTQTY AS DECIMAL(18,{0})) as LOTQTY ,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 ICSMOPick a left join ICSMO d on a.MODetailID=d.MODetailID and a.WorkPoint=d.WorkPoint left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select mm.TransCode,mm.TransSequence,sum(isnull(ee.Quantity,0)) LOTQTY,ee.WorkPoint from ICSInventoryLot ee left join ICSInventoryLotDetail mm on ee.LotNo=mm.LotNo and ee.type='16' group by mm.TransCode,mm.TransSequence,ee.WorkPoint )c on d.MOCode=c.TransCode and d.Sequence+'-'+a.Sequence=c.TransSequence and a.WorkPoint=c.WorkPoint left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint where a.EATTRIBUTE1='1' and d.EATTRIBUTE1='1'";
sql = string.Format(sql, Figure); sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); #endregion
if (!string.IsNullOrWhiteSpace(queryJson)) { if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString())) { sql += " and d.MOCode like '%" + queryParam["POCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString())) { sql += " and a.InvCode like '%" + queryParam["InvCode"].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 (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin") { sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'"; } 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 DataTable GetSubGridJsonFGGDCreate(string FGGDMOCode, string Sequence, string WorkPoint) { DataTable dt = new DataTable(); object Figure = GetDecimalDigits(); List<DbParameter> parameter = new List<DbParameter>(); string sql = @"
select a.InvCode,b.InvName,b.InvStd,b.InvUnit, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST( a.Amount as DECIMAL(18,{0})) as Amount, CAST( isnull(c.LOTQTY,0) as DECIMAL(18,{0})) as CreatedQty, CAST( (a.Quantity-ISNULL(c.LOTQTY,0)) as DECIMAL(18,{0})) as thisCreateQty,isnull(b.EffectiveEnable,0) as EffectiveEnable, CAST( isnull(b.EffectiveDays,0) as DECIMAL(18,{0})) as EffectiveDays from ICSMOPick a left join ICSMO d on a.MODetailID=d.MODetailID and a.WorkPoint=d.WorkPoint left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ( select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a left join ICSInventoryLotDetail b on a.LotNo=b.LotNo group by b.TransCode,b.TransSequence ) c on d.MOCode=c.TransCode and d.Sequence+'-'+a.Sequence=c.TransSequence WHERE 1=1 and d.MOCode='" + FGGDMOCode + "' and d.Sequence+'-'+a.Sequence='" + Sequence + "'";
sql += " and a.WorkPoint='" + WorkPoint + "'"; sql = string.Format(sql, Figure); return Repository().FindTableBySql(sql.ToString()); }
//返工工单
public int SubmitFormFGGD(string FGGDMOCode, string Sequence, string keyValue, string WorkPoint) { var queryParam = keyValue.ToJObject(); string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString()); decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString()); decimal thisCreateQty = Convert.ToDecimal(queryParam["thisCreateQty"].ToString()); decimal LOTQTY = minPackQty; string Pre = "FG" + FGGDMOCode + Sequence; string sql = string.Empty; string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString(); string sqls = string.Empty; string Colspan = ""; for (int i = 0; i < createPageCount; i++) { if (i + 1 == createPageCount) { if (minPackQty * createPageCount > thisCreateQty) { LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1)); } }
Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString(); sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}'", Colspan); object ExtensionID = SqlHelper.ExecuteScalar(sqls); if (ExtensionID == null) { ExtensionID = Guid.NewGuid(); sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
ExtensionID, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(), MUSER, MUSERNAME, WorkPoints); }
string LotNo = GetSerialCode(WorkPoint, "ICSInventoryLot", "LotNO", Pre, 5); sql += string.Format(@"Insert into ICSInventoryLotDetail(LotNo, TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
Values('{0}','{1}','{2}','{3}','{4}',getdate(),'{5}' )",
LotNo, FGGDMOCode, Sequence, MUSER, MUSERNAME, WorkPoints); sql += string.Format(@"insert into ICSInventoryLot
(ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount) select newid(),'{0}',a.InvCode,'{1}','{10}','{2}','{8}','16','{3}','{4}', getdate(),'{5}','{9}' from ICSMOPick a left join ICSMO d on a.MODetailID=d.MODetailID and a.WorkPoint=d.WorkPoint where d.MOCode='{6}' and d.Sequence+'-'+a.Sequence='{7}' and a.WorkPoint='{5}' ",
LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, FGGDMOCode, Sequence, ExtensionID, Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString()); sql += "\r\n"; } int count = SqlHelper.CmdExecuteNonQueryLi(sql); return count; }
public object GetDecimalDigits() { try { string sql = string.Empty; sql = @"select Figure from ICSConfiguration where Code='Figure001' and Enable='1'"; object Figure = SqlHelper.ExecuteScalar(sql); return Figure; } catch (Exception ex) { throw new Exception(ex.Message.ToString()); } }
public object GetQiSetNum(string keyValue) { int Num = 0; string msg = ""; string APIURL = ConfigurationManager.ConnectionStrings["ERPAPIURL"].ConnectionString + "Complete/Approve"; string result = HttpPost(APIURL, keyValue); JObject Obj = (JObject)JsonConvert.DeserializeObject(result);//或者JObject jo = JObject.Parse(jsonText);
string MessAge = Obj["Message"].ToString(); string Success = Obj["Success"].ToString(); if (Success.ToUpper() == "FALSE") { msg = MessAge; }
if (msg == "") { JArray res = (JArray)JsonConvert.DeserializeObject(Obj["Data"].ToString()); foreach (var item in res) { JObject jo = (JObject)item; Num = Convert.ToInt32(jo["min_lotqty"].ToString()); }
} var Header = new { msg = msg, Num = Num, }; return Header; }
//接口api解析
public static string HttpPost(string url, string body)
{ try { Encoding encoding = Encoding.UTF8; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.Accept = "application/json, text/javascript, */*"; //"text/html, application/xhtml+xml, */*";
request.ContentType = "application/json; charset=utf-8";
byte[] buffer = encoding.GetBytes(body); request.ContentLength = buffer.Length; request.GetRequestStream().Write(buffer, 0, buffer.Length); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); using (StreamReader reader = new StreamReader(response.GetResponseStream(), encoding)) { return reader.ReadToEnd(); } } catch (WebException ex) { throw new Exception(ex.Message); } }
} }
|