You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
483 lines
25 KiB
483 lines
25 KiB
using Newtonsoft.Json;
|
|
using NFine.Application.Entity;
|
|
using NFine.Application.Models;
|
|
using NFine.Code;
|
|
using NFine.Data.Extensions;
|
|
using NFine.Domain._03_Entity.SRM;
|
|
using NFine.Repository;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.Common;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace NFine.Application.WMS
|
|
{
|
|
/// <summary>
|
|
/// 调拨单
|
|
/// </summary>
|
|
public class ICSTransferApp : RepositoryFactory<ICSVendor>
|
|
{
|
|
|
|
public static DataTable Invmes = new DataTable();
|
|
/// <summary>
|
|
/// 删除
|
|
/// </summary>
|
|
/// <param name="keyValue"></param>
|
|
/// <returns></returns>
|
|
/// <exception cref="Exception"></exception>
|
|
public string DeleteTransferApplyNeg(string keyValue)
|
|
{
|
|
//站点信息
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
keyValue = keyValue.Substring(1, keyValue.Length - 2);
|
|
string sql = string.Empty;
|
|
|
|
sql += string.Format(@"DELETE FROM dbo.ICSTransfer WHERE TransferNO IN ({0}) and WorkPoint ='{1}'", keyValue.TrimEnd(','), WorkPoint);
|
|
//sql += string.Format(@"DELETE FROM dbo.ICSMTransferNegDetail WHERE ApplyNegCode IN ({0}) and WorkPoint ='{1}'", keyValue.TrimEnd(','), WorkPoint);
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception(ex.Message);
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="jqgridparam"></param>
|
|
/// <returns></returns>
|
|
public DataTable GetTransferApplyNeg(ref Pagination jqgridparam)
|
|
{
|
|
DataTable dt = new DataTable();
|
|
List<DbParameter> parameter = new List<DbParameter>();
|
|
string sql = @"select a.TransferNO, a.MUSERName,a.MTIME,a.Status,a.Type from ICSTransfer a
|
|
group by a.TransferNO, a.MUSERName,a.MTIME,a.Status,a.Type";
|
|
sql = string.Format(sql);
|
|
DataTable dttest = Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
|
|
return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
|
|
}
|
|
/// <summary>
|
|
/// 查询无条码物料相关调拨单(晶华)
|
|
/// </summary>
|
|
/// <param name="jqgridparam"></param>
|
|
/// <returns></returns>
|
|
public DataTable GetTransferInForJINH(ref Pagination jqgridparam)
|
|
{
|
|
DataTable dt = new DataTable();
|
|
List<DbParameter> parameter = new List<DbParameter>();
|
|
string sql = @" select a.TransferNO, a.MUSERName,a.MTIME,a.Status,a.Type from ICSTransfer a
|
|
WHERE A.Type='1' AND A.InvCode IN
|
|
(SELECT B.F_Define1 FROM Sys_SRM_Items A
|
|
LEFT JOIN Sys_SRM_ItemsDetail B ON B.F_ItemId=A.F_Id
|
|
WHERE A.F_EnCode='InventoryLotWareHouseFixed')
|
|
group by a.TransferNO, a.MUSERName,a.MTIME,a.Status,a.Type";
|
|
sql = string.Format(sql);
|
|
DataTable dttest = Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
|
|
return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 明细查询
|
|
/// </summary>
|
|
/// <param name="jqgridparam"></param>
|
|
/// <returns></returns>
|
|
public DataTable GetTransferApplyNegDetail(string TransferNO, ref Pagination jqgridparam)
|
|
{
|
|
DataTable dt = new DataTable();
|
|
//object Figure = GetDecimalDigits();
|
|
List<DbParameter> parameter = new List<DbParameter>();
|
|
string sql = @"SELECT a.ID,a.TransferNO,a.Sequence,a.InvCode,a.Quantity,a.TransferQuantity,a.Amount,a.FromWarehouseCode as FromWHCode,e.WarehouseName as FromWHName,a.Memo
|
|
,a.ToWarehouseCode as ToWHCode,g.WarehouseName as ToWHName,a.FromLocationCode as FromLotCode,h.LocationName as FromLotName,a.ToLocationCode as ToLotCode,i.LocationName as ToLotName
|
|
,a.ExtensionID,a.MUSER,a.MUSERName,a.MTIME,a.WorkPoint,b.InvName,a.CreateDateTime,a.CreatePerson,a.TransferID,a.TransferDetailID
|
|
,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
|
|
,a.EATTRIBUTE1,a.EATTRIBUTE2,a.EATTRIBUTE3,a.EATTRIBUTE4,a.EATTRIBUTE5,a.EATTRIBUTE6,a.EATTRIBUTE7,a.EATTRIBUTE8,a.EATTRIBUTE9,a.EATTRIBUTE10
|
|
from ICSTransfer a
|
|
left join ICSInventory b on a.InvCode = b.InvCode and a.WorkPoint = b.WorkPoint
|
|
left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint
|
|
left join ICSWarehouse e on a.FromWarehouseCode = e.WarehouseCode and a.WorkPoint=e.WorkPoint
|
|
left join ICSWarehouse g on a.ToWarehouseCode = g.WarehouseCode and g.WorkPoint=e.WorkPoint
|
|
left join ICSLocation h on a.FromLocationCode = h.LocationCode and h.WorkPoint=e.WorkPoint
|
|
left join ICSLocation i on a.ToLocationCode = i.LocationCode and i.WorkPoint=e.WorkPoint
|
|
where a.TransferNO = '" + TransferNO + "' ";
|
|
//sql = string.Format(sql, Figure);
|
|
DataTable dttest = Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
|
|
return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
|
|
}
|
|
/// <summary>
|
|
/// 无条码料调入单明细查询(晶华)
|
|
/// </summary>
|
|
/// <param name="TransferNO"></param>
|
|
/// <param name="jqgridparam"></param>
|
|
/// <returns></returns>
|
|
public DataTable GetTransferInDetailJINH(string TransferNO, ref Pagination jqgridparam)
|
|
{
|
|
DataTable dt = new DataTable();
|
|
//object Figure = GetDecimalDigits();
|
|
List<DbParameter> parameter = new List<DbParameter>();
|
|
string sql = @"SELECT a.ID,a.TransferNO,a.Sequence,a.InvCode,a.Quantity,a.TransferQuantity,a.Amount,a.FromWarehouseCode as FromWHCode,e.WarehouseName as FromWHName,a.Memo
|
|
,a.ToWarehouseCode as ToWHCode,g.WarehouseName as ToWHName,a.FromLocationCode as FromLotCode,h.LocationName as FromLotName,a.ToLocationCode as ToLotCode,i.LocationName as ToLotName
|
|
,a.ExtensionID,a.MUSER,a.MUSERName,a.MTIME,a.WorkPoint,b.InvName,a.CreateDateTime,a.CreatePerson,a.TransferID,a.TransferDetailID
|
|
,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
|
|
,a.EATTRIBUTE1,a.EATTRIBUTE2,a.EATTRIBUTE3,a.EATTRIBUTE4,a.EATTRIBUTE5,a.EATTRIBUTE6,a.EATTRIBUTE7
|
|
,ISNULL(a.EATTRIBUTE8,'') AS OutWorkPoint,ISNULL(a.EATTRIBUTE9,'') AS INWorkPoint,a.EATTRIBUTE10
|
|
from ICSTransfer a
|
|
left join ICSInventory b on a.InvCode = b.InvCode and a.WorkPoint = b.WorkPoint
|
|
left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint
|
|
left join ICSWarehouse e on a.FromWarehouseCode = e.WarehouseCode and a.WorkPoint=e.WorkPoint
|
|
left join ICSWarehouse g on a.ToWarehouseCode = g.WarehouseCode and g.WorkPoint=e.WorkPoint
|
|
left join ICSLocation h on a.FromLocationCode = h.LocationCode and h.WorkPoint=e.WorkPoint
|
|
left join ICSLocation i on a.ToLocationCode = i.LocationCode and i.WorkPoint=e.WorkPoint
|
|
where a.TransferNO = '" + TransferNO + "' ";
|
|
//sql = string.Format(sql, Figure);
|
|
DataTable dttest = Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
|
|
return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
|
|
}
|
|
|
|
public void ClearTemp()
|
|
{
|
|
Invmes.Rows.Clear();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取库位信息
|
|
/// </summary>
|
|
/// <param name="LocationCode"></param>
|
|
/// <param name="jqgridparam"></param>
|
|
/// <returns></returns>
|
|
public DataTable GetLocationCode(string WHCode, ref Pagination jqgridparam)
|
|
{
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
List<DbParameter> parameter = new List<DbParameter>();
|
|
DataTable table = new DataTable();
|
|
string wherestr = "";
|
|
if (!string.IsNullOrEmpty(WHCode))
|
|
{
|
|
wherestr += " and b.WarehouseCode = '" + WHCode + "'";
|
|
|
|
}
|
|
string sql = @"select a.LocationCode as LocationCode ,a.ID,a.LocationName,b.WarehouseCode, b.WarehouseName,a.Musername as 'MUSER',a.MTIME
|
|
from ICSLocation a WITH (NOLOCK)
|
|
inner join ICSWarehouse b WITH (NOLOCK) on a.WHID=b.ID
|
|
where 1=1 and a.WorkPoint = '" + WorkPoint + "'" + wherestr;
|
|
DataTable dt = SqlHelper.GetDataTableBySql(sql);
|
|
return dt;
|
|
|
|
}
|
|
/// <summary>
|
|
/// 新增、修改
|
|
/// </summary>
|
|
/// <param name="ICSASN"></param>
|
|
/// <returns></returns>
|
|
public string SaveICSTransferApplyNeg(string keyValue, string deleteIDs)
|
|
{
|
|
string returnValue = string.Empty;
|
|
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
var Dates = DateTime.Now;
|
|
string Colspan = string.Empty;
|
|
string IDD = string.Empty;
|
|
var sql = string.Empty;
|
|
try
|
|
{
|
|
|
|
var modelList = JsonConvert.DeserializeObject<List<ICSTransferEdit>>(keyValue);
|
|
|
|
if (!string.IsNullOrEmpty(deleteIDs))
|
|
{
|
|
var deleteentityList = deleteIDs.Split(',');
|
|
foreach (var item in deleteentityList)
|
|
{
|
|
if (!string.IsNullOrEmpty(item))
|
|
{
|
|
var deleteEntity = MsSqlData.Get<Entity.ICSTransfer>(item);
|
|
sql += string.Format(@"DELETE FROM dbo.ICSTransfer WHERE ID IN ({0}) and WorkPoint ='{1}'", item, WorkPoint);
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach (var model in modelList)
|
|
{
|
|
|
|
if (string.IsNullOrEmpty(model.ID))
|
|
{
|
|
if (string.IsNullOrEmpty(model.TransferNO))
|
|
{
|
|
throw new Exception("其他调拨单号错误!");
|
|
}
|
|
//新增
|
|
var count = MsSqlData.ExecuteScalar(" select count(1) from ICSTransfer where TransferNO ='" + model.TransferNO + "' and Sequence ='" + model.Sequence + "'").ToInt();
|
|
if (count > 0)
|
|
{
|
|
throw new Exception("当前调拨单号以及行号已存在");
|
|
}
|
|
//检验自由项
|
|
Colspan = model.ProjectCode + "~" + model.BatchCode + "~" + model.Version
|
|
+ "~" + model.Brand + "~" + model.cFree1
|
|
+ "~" + model.cFree2 + "~" + model.cFree3 + "~" + model.cFree4
|
|
+ "~" + model.cFree5 + "~" + model.cFree6 + "~" + model.cFree7
|
|
+ "~" + model.cFree8 + "~" + model.cFree9 + "~" + model.cFree10;
|
|
sql = @"select ID,Colspan from ICSExtension a
|
|
where Colspan='{0}' and WorkPoint='{1}'";
|
|
sql = string.Format(sql, Colspan, model.WorkPoint);
|
|
var dttt = SqlHelper.CmdExecuteDataTable(sql);
|
|
if (dttt.Rows.Count == 0)
|
|
{
|
|
IDD = Guid.NewGuid().ToString();
|
|
sql = @"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
|
|
select '{17}','{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}',GETDATE(),'{15}',f.F_RealName,'{16}'from Sys_SRM_User f where f.F_Account='{15}' and f.F_Location='{16}'";
|
|
sql = string.Format(sql, Colspan, model.ProjectCode, model.BatchCode, model.Version, model.Brand, model.cFree1, model.cFree2, model.cFree3, model.cFree4, model.cFree5, model.cFree6, model.cFree7, model.cFree8, model.cFree9, model.cFree10, model.User, model.WorkPoint, IDD);
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
throw new Exception("自由项添加失败");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
IDD = dttt.Rows[0]["ID"].ToString();
|
|
}
|
|
|
|
var entity = new ICSTransfer();
|
|
ConvertExt.Mapping(model, entity);
|
|
entity.ID = Guid.NewGuid().ToString();
|
|
entity.TransferID = "";
|
|
entity.TransferDetailID = "";
|
|
//entity.TransferID = "";
|
|
//entity.TransferDetailID = "";
|
|
entity.Status = "1";
|
|
entity.CreatePerson = MUSER;
|
|
entity.CreateDateTime = Dates;
|
|
entity.MUSER = MUSER;
|
|
entity.MUSERName = MUSERNAME;
|
|
entity.MTIME = Dates;
|
|
entity.WorkPoint = WorkPoint;
|
|
entity.ExtensionID = IDD;
|
|
|
|
|
|
var result = MsSqlData.Insert<ICSTransfer>(entity);
|
|
if (!result)
|
|
{
|
|
returnValue = "调拨单新增失败";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//修改
|
|
|
|
var entity = MsSqlData.Get<ICSTransfer>(model.ID);
|
|
if (entity == null)
|
|
{
|
|
//新增
|
|
if (string.IsNullOrEmpty(model.TransferNO))
|
|
{
|
|
throw new Exception("调拨单单号错误!");
|
|
}
|
|
var count = MsSqlData.ExecuteScalar(" select count(1) from ICSTransfer where TransferNO ='" + model.TransferNO + "' and Sequence ='" + model.Sequence + "'").ToInt();
|
|
if (count > 0)
|
|
{
|
|
throw new Exception("当前调拨单号以及行号已存在");
|
|
}
|
|
//检验自由项
|
|
Colspan = model.ProjectCode + "~" + model.BatchCode + "~" + model.Version
|
|
+ "~" + model.Brand + "~" + model.cFree1
|
|
+ "~" + model.cFree2 + "~" + model.cFree3 + "~" + model.cFree4
|
|
+ "~" + model.cFree5 + "~" + model.cFree6 + "~" + model.cFree7
|
|
+ "~" + model.cFree8 + "~" + model.cFree9 + "~" + model.cFree10;
|
|
sql = @"select ID,Colspan from ICSExtension a
|
|
where Colspan='{0}' and WorkPoint='{1}'";
|
|
sql = string.Format(sql, Colspan, model.WorkPoint);
|
|
var dttt = SqlHelper.CmdExecuteDataTable(sql);
|
|
if (dttt.Rows.Count == 0)
|
|
{
|
|
IDD = Guid.NewGuid().ToString();
|
|
sql = @"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
|
|
select '{17}','{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}',GETDATE(),'{15}',f.F_RealName,'{16}'from Sys_SRM_User f where f.F_Account='{15}' and f.F_Location='{16}'";
|
|
sql = string.Format(sql, Colspan, model.ProjectCode, model.BatchCode, model.Version, model.Brand, model.cFree1, model.cFree2, model.cFree3, model.cFree4, model.cFree5, model.cFree6, model.cFree7, model.cFree8, model.cFree9, model.cFree10, model.User, model.WorkPoint, IDD);
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
throw new Exception("自由项添加失败");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
IDD = dttt.Rows[0]["ID"].ToString();
|
|
}
|
|
entity = new ICSTransfer();
|
|
ConvertExt.Mapping<ICSTransferEdit, ICSTransfer>(model, entity);
|
|
entity.ID = Guid.NewGuid().ToString();
|
|
entity.TransferID = "";
|
|
entity.TransferDetailID = "";
|
|
//entity.TransferID = "";
|
|
//entity.TransferDetailID = "";
|
|
entity.CreatePerson = MUSER;
|
|
entity.CreateDateTime = Dates;
|
|
entity.Status = "1";
|
|
entity.MUSER = MUSER;
|
|
entity.MUSERName = MUSERNAME;
|
|
entity.MTIME = Dates;
|
|
entity.WorkPoint = WorkPoint;
|
|
entity.ExtensionID = IDD;
|
|
|
|
|
|
var result = MsSqlData.Insert<ICSTransfer>(entity);
|
|
if (!result)
|
|
{
|
|
returnValue = "新增失败";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//检验自由项
|
|
Colspan = model.ProjectCode + "~" + model.BatchCode + "~" + model.Version
|
|
+ "~" + model.Brand + "~" + model.cFree1
|
|
+ "~" + model.cFree2 + "~" + model.cFree3 + "~" + model.cFree4
|
|
+ "~" + model.cFree5 + "~" + model.cFree6 + "~" + model.cFree7
|
|
+ "~" + model.cFree8 + "~" + model.cFree9 + "~" + model.cFree10;
|
|
sql = @"select ID,Colspan from ICSExtension a
|
|
where Colspan='{0}' and WorkPoint='{1}'";
|
|
sql = string.Format(sql, Colspan, model.WorkPoint);
|
|
var dtt = SqlHelper.CmdExecuteDataTable(sql);
|
|
if (dtt.Rows.Count == 0)
|
|
{
|
|
IDD = Guid.NewGuid().ToString();
|
|
sql = @"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
|
|
select '{17}','{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}',GETDATE(),'{15}',f.F_RealName,'{16}'from Sys_SRM_User f where f.F_Account='{15}' and f.F_Location='{16}'";
|
|
sql = string.Format(sql, Colspan, model.ProjectCode, model.BatchCode, model.Version, model.Brand, model.cFree1, model.cFree2, model.cFree3, model.cFree4, model.cFree5, model.cFree6, model.cFree7, model.cFree8, model.cFree9, model.cFree10, model.User, model.WorkPoint, IDD);
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
throw new Exception("自由项添加失败");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
IDD = dtt.Rows[0]["ID"].ToString();
|
|
}
|
|
ConvertExt.Mapping<ICSTransferEdit, ICSTransfer>(model, entity);
|
|
entity.TransferID = "";
|
|
entity.TransferDetailID = "";
|
|
//entity.TransferID = "";
|
|
//entity.TransferDetailID = "";
|
|
entity.CreatePerson = MUSER;
|
|
entity.CreateDateTime = Dates;
|
|
entity.MUSER = MUSER;
|
|
entity.MUSERName = MUSERNAME;
|
|
entity.MTIME = Dates;
|
|
entity.ExtensionID = IDD;
|
|
var result = MsSqlData.Update<ICSTransfer>(entity);
|
|
if (!result)
|
|
{
|
|
returnValue = "修改失败";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
returnValue = ex.Message;
|
|
}
|
|
|
|
return returnValue;
|
|
}
|
|
/// <summary>
|
|
/// 创建自增单号
|
|
/// </summary>
|
|
/// <param name="WorkPoint"></param>
|
|
/// <returns></returns>
|
|
public string GetOOCode(string WorkPoint)
|
|
{
|
|
WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string OOCode = string.Empty;
|
|
if (!string.IsNullOrEmpty(WorkPoint))
|
|
{
|
|
|
|
OOCode = GetSerialCode(WorkPoint, "ICSTransfer", "TransferNO", "00", 8);
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(OOCode))
|
|
{
|
|
string sqlISHave = @"SELECT TransferNO FROM ICSTransfer a
|
|
WHERE a.TransferNO = '{0}'";
|
|
sqlISHave = string.Format(sqlISHave, OOCode);
|
|
DataTable dtIsHave = SqlHelper.GetDataTableBySql(sqlISHave);
|
|
if (dtIsHave.Rows.Count > 0)
|
|
{
|
|
throw new Exception("单号已存在!");
|
|
}
|
|
}
|
|
return OOCode;
|
|
}
|
|
|
|
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 SqlHelper.ExecuteScalar(sql).ToString();
|
|
}
|
|
public void UpdateOutsourcingOrderApplyNegTemp(string json)
|
|
{
|
|
var data = json.ToJObject();
|
|
string usercode = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
var info = Invmes.Select(string.Format("TLZID='{0}'", data["TLZID"]));
|
|
if (info != null && info.Length > 0)
|
|
{
|
|
info[0]["ZJID"] = data["ZJID"];
|
|
info[0]["InvName"] = data["InvName"];
|
|
}
|
|
else
|
|
{
|
|
DataRow newrow = Invmes.NewRow();
|
|
newrow["ZJID"] = data["ZJID"];
|
|
Invmes.Rows.Add(newrow);
|
|
}
|
|
}
|
|
public DataTable GetICSTransferReturnTemporary(string TransferNO)
|
|
{
|
|
string sql = @"SELECT a.ID,a.TransferNO,a.Sequence,a.InvCode,a.Quantity,a.Amount,a.TransferQuantity,a.FromWarehouseCode as FromWHCode,a.FromLocationCode as FromLotCode,a.Type,a.Memo
|
|
,a.ToWarehouseCode as ToWHCode,a.ToLocationCode as ToLotCode,b.InvName,a.ExtensionID,a.MUSER,a.MUSERName,a.MTIME,a.WorkPoint
|
|
from ICSTransfer a
|
|
left join ICSInventory b on a.InvCode = b.InvCode and a.WorkPoint = b.WorkPoint
|
|
left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint
|
|
where a.TransferNO ='" + TransferNO + "' ";
|
|
DataTable table = Repository().FindDataSetBySql(sql).Tables[0];
|
|
DataTable dtCloned = table.Clone();
|
|
foreach (DataColumn col in dtCloned.Columns)
|
|
{
|
|
col.DataType = typeof(string);
|
|
}
|
|
foreach (DataRow row in table.Rows)
|
|
{
|
|
DataRow newrow = dtCloned.NewRow();
|
|
foreach (DataColumn column in dtCloned.Columns)
|
|
{
|
|
newrow[column.ColumnName] = row[column.ColumnName].ToString();
|
|
|
|
}
|
|
dtCloned.Rows.Add(newrow);
|
|
}
|
|
if (Invmes.Rows.Count > 0)
|
|
{
|
|
dtCloned.Merge(Invmes, false);
|
|
}
|
|
return dtCloned;
|
|
}
|
|
}
|
|
}
|