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.
879 lines
48 KiB
879 lines
48 KiB
using NFine.Data.Extensions;
|
|
using System;
|
|
using NFine.Repository;
|
|
using NFine.Domain._03_Entity.SRM;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
|
namespace NFine.Application.WMS
|
|
{
|
|
public class RevokeBusinessApp : RepositoryFactory<ICSVendor>
|
|
{
|
|
//采购入库撤销
|
|
public string RevocationPurchase(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
sql += string.Format(@"delete from ICSWareHouseLotInfo where LotNo='{0}' and WorkPoint='{1}' ", jo["LotNo"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSPurchaseOrder set InQuantity =InQuantity-'{0}' where POCode='{1}' and Sequence='{2}' and WorkPoint='{3}'", jo["Quantity"].ToString(), jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", jo["ID"].ToString(), WorkPoint);
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
//采购入库-采购到货单撤销
|
|
public string RevocationDeliveryNotice(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
sql += string.Format(@"delete from ICSWareHouseLotInfo where LotNo='{0}' and WorkPoint='{1}' ", jo["LotNo"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSDeliveryNotice set RCVQuantity =RCVQuantity-'{0}' where DNCode='{1}' and Sequence='{2}' and WorkPoint='{3}' and DNType='1'", jo["Quantity"].ToString(), jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", jo["ID"].ToString(), WorkPoint);
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
|
|
|
|
|
|
public string RevocationWWFLBLB(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
sql += string.Format(@"update ICSWareHouseLotInfo set Quantity=Quantity+'{0}',MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{4}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["LotNo"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update a set IssueQuantity =IssueQuantity-'{0}'
|
|
from ICSOOPick a
|
|
left join ICSOutsourcingOrder b on a.OODetailID=b.OODetailID and a.WorkPoint=b.WorkPoint
|
|
where b.OOCode='{1}' and b.Sequence+'~'+a.Sequence='{2}' and a.WorkPoint='{3}'",
|
|
jo["Quantity"].ToString(), jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' , EATTRIBUTE3=getdate(),EATTRIBUTE4='{0}',EATTRIBUTE5='{1}' where ID='{2}' and WorkPoint='{3}'", MUSER, MUSERNAME, jo["ID"].ToString(), WorkPoint);
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
|
|
//生产订单备料表
|
|
public string RevocationPicking(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
sql += string.Format(@"update ICSWareHouseLotInfo set Quantity=Quantity+'{0}',MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{4}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["LotNo"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update a set IssueQuantity =IssueQuantity-'{0}' from ICSMOPick a left join ICSMO b on a.MODetailID=b.MODetailID and a.WorkPoint=b.WorkPoint
|
|
where b.MOCode='{1}' and b.Sequence+'~'+a.Sequence='{2}' and a.WorkPoint='{3}'", jo["Quantity"].ToString(), jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", jo["ID"].ToString(), WorkPoint);
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
|
|
//领料申请单
|
|
|
|
public string RevocationMOApply(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
sql += string.Format(@"update ICSWareHouseLotInfo set Quantity=Quantity+'{0}',MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{4}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["LotNo"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSMOApply set IssueQuantity =IssueQuantity-'{0}' where ApplyCode='{1}' and Sequence='{2}' and WorkPoint='{3}' ", jo["Quantity"].ToString(), jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", jo["ID"].ToString(), WorkPoint);
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
|
|
//材料出库
|
|
|
|
public string RevocationMOIssue(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
sql += string.Format(@"update ICSWareHouseLotInfo set Quantity=Quantity+'{0}',MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{4}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["LotNo"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSMOIssue set IssueQuantity =IssueQuantity-'{0}' where IssueCode='{1}' and Sequence='{2}' and WorkPoint='{3}' and Type='1' and Status='2'", jo["Quantity"].ToString(), jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", jo["ID"].ToString(), WorkPoint);
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
//产成品入库-生产订单
|
|
public string RevocationFinished(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
sql += string.Format(@"delete from ICSWareHouseLotInfo where LotNo='{0}' and WorkPoint='{1}'", jo["LotNo"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSMO set RCVQuantity =RCVQuantity-'{0}' where MOCode='{1}' and Sequence='{2}' and WorkPoint='{3}'", jo["Quantity"].ToString(), jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", jo["ID"].ToString(), WorkPoint);
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
//产成品入库-产成品入库单
|
|
public string RevocationManufactureReceive(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
sql += string.Format(@"delete from ICSWareHouseLotInfo where LotNo='{0}' and WorkPoint='{1}'", jo["LotNo"].ToString(), WorkPoint);
|
|
sql += string.Format(@" update ICSManufactureReceive set RCVQuantity =RCVQuantity-'{0}' where RCVCode='{1}' and Sequence='{2}' and WorkPoint='{3}' and Type='1' ", jo["Quantity"].ToString(), jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", MUSER, MUSERNAME, jo["ID"].ToString(), WorkPoint);
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
|
|
|
|
//一步调拨
|
|
public string RevocationICSTransfer(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
sql += string.Format(@"update ICSWareHouseLotInfo set Quantity=Quantity+'{0}',MUSER='{1}',MUSERName='{2}',WarehouseCode='{5}',LocationCode='{6}' where LotNo='{3}' and WorkPoint='{4}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["LotNo"].ToString(), WorkPoint, jo["FromWarehouseCode"].ToString(), jo["FromLocationCode"].ToString());
|
|
sql += string.Format(@" update ICSTransfer set TransferQuantity =TransferQuantity-'{0}' where TransferNO='{1}' and Sequence='{2}' and WorkPoint='{3}' and Type='1' ", jo["Quantity"].ToString(), jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", MUSER, MUSERNAME, jo["ID"].ToString(), WorkPoint);
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
|
|
|
|
|
|
//销售出库
|
|
public string RevocationMarket(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
sql += string.Format(@"update ICSWareHouseLotInfo set Quantity=Quantity+'{0}',MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{4}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["LotNo"].ToString(), WorkPoint);
|
|
sql += string.Format(@" update ICSSDN set SDNQuantity =SDNQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where SDNCode='{3}' and Sequence='{4}' and WorkPoint='{5}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", MUSER, MUSERNAME, jo["ID"].ToString(), WorkPoint);
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
//生产退料-生产退料单
|
|
public string RevocationProduceStripping(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
string sqlseach = @"select Type from dbo.ICSInventoryLot where LotNo='"+ jo["LotNo"].ToString() + "'";
|
|
object LotNoType= SqlHelper.ExecuteScalar(sqlseach);
|
|
if (LotNoType.ToString()== "1")
|
|
{
|
|
//新条码退
|
|
sql += string.Format(@"delete from ICSWareHouseLotInfo where LotNo='{0}' and WorkPoint='{1}'", jo["LotNo"].ToString(), WorkPoint);
|
|
sql += string.Format(@" update ICSMOApplyNegDetail set IssueNegQuantity =IssueNegQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where SDNCode='{3}' and Sequence='{4}' and WorkPoint='{5}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", jo["ID"].ToString(), WorkPoint);
|
|
sql += string.Format(@" UPDATE e SET IssueQuantity=ISNULL(IssueQuantity,0)+'{2}'
|
|
FROM ICSInventoryLot a
|
|
INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint
|
|
INNER JOIN ICSMOApplyNegDetail c ON b.TransCode=c.ApplyNegCode AND b.TransSequence=c.Sequence AND b.WorkPoint=c.WorkPoint
|
|
INNER JOIN ICSMOApplyNeg d ON c.ApplyNegCode=d.ApplyNegCode AND c.WorkPoint=d.WorkPoint
|
|
INNER JOIN ICSMOPick e ON c.SourceDetailID=e.PickID AND c.WorkPoint=e.WorkPoint
|
|
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND d.Type='1'", jo["LotNo"].ToString(), WorkPoint, jo["Quantity"].ToString());
|
|
|
|
}
|
|
else
|
|
{
|
|
sql += string.Format(@"update ICSWareHouseLotInfo set Quantity=Quantity-'{0}',MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{4}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["LotNo"].ToString(), WorkPoint);
|
|
// sql += string.Format(@" update ICSMOApplyNegDetail set IssueNegQuantity =IssueNegQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where SDNCode='{3}' and Sequence='{4}' and WorkPoint='{5}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", jo["ID"].ToString(), WorkPoint);
|
|
sql += string.Format(@"UPDATE c SET IssueQuantity=ISNULL(IssueQuantity,0)+'{2}'
|
|
FROM ICSWareHouseLotInfoLog a
|
|
INNER JOIN ICSMO b ON a.TransCode=b.MOCode AND a.WorkPoint=b.WorkPoint
|
|
INNER JOIN ICSMOPick c ON b.MODetailID = c.MODetailID AND b.WorkPoint = c.WorkPoint AND a.TransSequence = b.Sequence + '~' + c.Sequence
|
|
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND a.ID='{3}'", jo["LotNo"].ToString(), WorkPoint, jo["Quantity"].ToString(), jo["ID"].ToString());
|
|
}
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//生产退料-生产退料单-领料申请单
|
|
public string RevocationProduceStrippingLL(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
string sqlseach = @"select Type from dbo.ICSInventoryLot where LotNo='" + jo["LotNo"].ToString() + "'";
|
|
object LotNoType = SqlHelper.ExecuteScalar(sqlseach);
|
|
if (LotNoType.ToString() == "1")
|
|
{
|
|
//新条码退
|
|
sql += string.Format(@"delete from ICSWareHouseLotInfo where LotNo='{0}' and WorkPoint='{1}'", jo["LotNo"].ToString(), WorkPoint);
|
|
sql += string.Format(@" update ICSMOApplyNegDetail set IssueNegQuantity =IssueNegQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where SDNCode='{3}' and Sequence='{4}' and WorkPoint='{5}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", MUSER, MUSERNAME, jo["ID"].ToString(), WorkPoint);
|
|
sql += string.Format(@" UPDATE e SET IssueQuantity=ISNULL(IssueQuantity,0)+'{2}'
|
|
FROM ICSInventoryLot a
|
|
INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint
|
|
INNER JOIN ICSMOApplyNegDetail c ON b.TransCode=c.ApplyNegCode AND b.TransSequence=c.Sequence AND b.WorkPoint=c.WorkPoint
|
|
INNER JOIN ICSMOApplyNeg d ON c.ApplyNegCode=d.ApplyNegCode AND c.WorkPoint=d.WorkPoint
|
|
INNER JOIN ICSMOApply e ON c.SourceDetailID=e.ApplyDetailID AND c.WorkPoint=e.WorkPoint
|
|
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND d.Type='2'", jo["LotNo"].ToString(), WorkPoint, jo["Quantity"].ToString());
|
|
|
|
}
|
|
else
|
|
{
|
|
sql += string.Format(@"update ICSWareHouseLotInfo set Quantity=Quantity-'{0}',MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{4}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["LotNo"].ToString(), WorkPoint);
|
|
// sql += string.Format(@" update ICSMOApplyNegDetail set IssueNegQuantity =IssueNegQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where SDNCode='{3}' and Sequence='{4}' and WorkPoint='{5}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", MUSER, MUSERNAME, jo["ID"].ToString(), WorkPoint);
|
|
sql += string.Format(@"UPDATE c SET IssueQuantity=ISNULL(IssueQuantity,0)+'{2}'
|
|
FROM ICSWareHouseLotInfoLog a
|
|
INNER JOIN ICSMOApply c ON a.TransCode=c.ApplyCode AND a.TransSequence=c.Sequence AND a.WorkPoint=c.WorkPoint
|
|
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND a.ID='{3}'", jo["LotNo"].ToString(), WorkPoint, jo["Quantity"].ToString(), jo["ID"].ToString());
|
|
}
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//生产退料-生产退料单-材料出库单
|
|
public string RevocationProduceStrippingCLCK(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
string sqlseach = @"select Type from dbo.ICSInventoryLot where LotNo='" + jo["LotNo"].ToString() + "'";
|
|
object LotNoType = SqlHelper.ExecuteScalar(sqlseach);
|
|
if (LotNoType.ToString() == "1")
|
|
{
|
|
//新条码退
|
|
sql += string.Format(@"delete from ICSWareHouseLotInfo where LotNo='{0}' and WorkPoint='{1}'", jo["LotNo"].ToString(), WorkPoint);
|
|
sql += string.Format(@" update ICSMOApplyNegDetail set IssueNegQuantity =IssueNegQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where SDNCode='{3}' and Sequence='{4}' and WorkPoint='{5}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", MUSER, MUSERNAME, jo["ID"].ToString(), WorkPoint);
|
|
sql += string.Format(@" UPDATE e SET IssueQuantity=ISNULL(IssueQuantity,0)+'{2}'
|
|
FROM ICSInventoryLot a
|
|
INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint
|
|
INNER JOIN ICSMOApplyNegDetail c ON b.TransCode=c.ApplyNegCode AND b.TransSequence=c.Sequence AND b.WorkPoint=c.WorkPoint
|
|
INNER JOIN ICSMOApplyNeg d ON c.ApplyNegCode=d.ApplyNegCode AND c.WorkPoint=d.WorkPoint
|
|
INNER JOIN ICSMOIssue e ON c.SourceDetailID=e.IssueDetailID AND c.WorkPoint=e.WorkPoint
|
|
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND d.Type='3'", jo["LotNo"].ToString(), WorkPoint, jo["Quantity"].ToString());
|
|
|
|
}
|
|
else
|
|
{
|
|
sql += string.Format(@"update ICSWareHouseLotInfo set Quantity=Quantity-'{0}',MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{4}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["LotNo"].ToString(), WorkPoint);
|
|
// sql += string.Format(@" update ICSMOApplyNegDetail set IssueNegQuantity =IssueNegQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where SDNCode='{3}' and Sequence='{4}' and WorkPoint='{5}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", MUSER, MUSERNAME, jo["ID"].ToString(), WorkPoint);
|
|
sql += string.Format(@"UPDATE c SET IssueQuantity=ISNULL(IssueQuantity,0)+'{2}'
|
|
FROM ICSWareHouseLotInfoLog a
|
|
INNER JOIN ICSMOIssue c ON a.TransCode=c.IssueCode AND a.TransSequence=c.Sequence AND a.WorkPoint=c.WorkPoint
|
|
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND a.ID='{3}'", jo["LotNo"].ToString(), WorkPoint, jo["Quantity"].ToString(), jo["ID"].ToString());
|
|
}
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//其他出库(杂发)
|
|
public string RevocationOtheOutboundr(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
sql += string.Format(@"update ICSWareHouseLotInfo set Quantity=Quantity+'{0}',MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{4}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["LotNo"].ToString(), WorkPoint);
|
|
sql += string.Format(@" update ICSOtherOut set OutQuantity =OutQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where OutCode='{3}' and Sequence='{4}' and WorkPoint='{5}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' , MTIME=getdate(),MUSER='{0}',MUSERName='{1}' where ID='{2}' and WorkPoint='{3}'", MUSER, MUSERNAME, jo["ID"].ToString(), WorkPoint);
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
|
|
|
|
//其他入库(杂收)
|
|
public string RevocationOtheWarehousing(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
sql += string.Format(@"delete from ICSWareHouseLotInfo where LotNo='{0}' and WorkPoint='{1}'", jo["LotNo"].ToString(), WorkPoint);
|
|
sql += string.Format(@" update ICSOtherIn set InQuantity =InQuantity-'{0}' where InCode='{1}' and Sequence='{2}' and WorkPoint='{3}' and Type='1' ", jo["Quantity"].ToString(), jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' , MTIME=getdate(),MUSER='{0}',MUSERName='{1}' where ID='{2}' and WorkPoint='{3}'", MUSER, MUSERNAME, jo["ID"].ToString(), WorkPoint);
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
|
|
|
|
//无源头调拨
|
|
public string RevocationICSTransfer2(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
sql += string.Format(@"update ICSWareHouseLotInfo set WarehouseCode='{5}',LocationCode='{6}',MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{4}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["LotNo"].ToString(), WorkPoint, jo["FromWarehouseCode"].ToString(), jo["FromLocationCode"].ToString());
|
|
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' , MTIME=getdate(),MUSER='{0}',MUSERName='{1}' where ID='{2}' and WorkPoint='{3}'", MUSER, MUSERNAME, jo["ID"].ToString(), WorkPoint);
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
|
|
//撤销事件
|
|
public string RevocationAll(string keyValue, string tableName, string columnCode, string columnQuantity, string opration)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
sql += $@"update ICSWareHouseLotInfo set Quantity=Quantity {opration} '{jo["Quantity"]}',MTIME=getdate(),MUSER='{MUSER}',MUSERName='{MUSERNAME}' where LotNo='{jo["LotNo"]}' and WorkPoint='{WorkPoint}'; update {tableName} set {columnQuantity} ={columnQuantity} - '{jo["Quantity"]}' , MTIME=getdate(),MUSER='{MUSER}',MUSERName='{MUSERNAME}' where {columnCode}='{jo["TransCode"]}' and Sequence='{jo["TransSequence"]}' and WorkPoint='{WorkPoint}';
|
|
update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' , MTIME=getdate(),MUSER='{MUSER}',MUSERName='{MUSERNAME}' where ID='{jo["ID"]}' and WorkPoint='{WorkPoint}'; ";
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
|
|
|
|
//物料调拨(开立调拨申请单)
|
|
public string RevocationICSTransferApplication(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
sql += string.Format(@"update ICSWareHouseLotInfo set Quantity=Quantity+'{0}',WarehouseCode='{5}',LocationCode='{6}',MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{4}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["LotNo"].ToString(), WorkPoint, jo["LotNo"].ToString(), jo["LotNo"].ToString(), jo["FromWarehouseCode"].ToString(), jo["FromLocationCode"].ToString());
|
|
sql += string.Format(@" update ICSTransferApplication set TransferQuantity =TransferQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where TransferNO='{3}' and Sequence='{4}' and WorkPoint='{5}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", MUSER, MUSERNAME, jo["ID"].ToString(), WorkPoint);
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
|
|
|
|
//委外退料-委外退料单
|
|
public string RevocationWWProduceStripping(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
string sqlseach = @"select Type from dbo.ICSInventoryLot where LotNo='" + jo["LotNo"].ToString() + "'";
|
|
object LotNoType = SqlHelper.ExecuteScalar(sqlseach);
|
|
if (LotNoType.ToString() == "1")
|
|
{
|
|
//新条码退
|
|
sql += string.Format(@"delete from ICSWareHouseLotInfo where LotNo='{0}' and WorkPoint='{1}'", jo["LotNo"].ToString(), WorkPoint);
|
|
sql += string.Format(@" update ICSOApplyNegDetail set IssueNegQuantity =IssueNegQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where SDNCode='{3}' and Sequence='{4}' and WorkPoint='{5}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", jo["ID"].ToString(), WorkPoint);
|
|
sql += string.Format(@" UPDATE e SET IssueQuantity=ISNULL(IssueQuantity,0)+'{2}'
|
|
FROM ICSInventoryLot a
|
|
INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint
|
|
INNER JOIN ICSOApplyNegDetail c ON b.TransCode=c.OApplyNegCode AND b.TransSequence=c.Sequence AND b.WorkPoint=c.WorkPoint
|
|
INNER JOIN ICSOApplyNeg d ON c.OApplyNegCode=d.OApplyNegCode AND c.WorkPoint=d.WorkPoint
|
|
INNER JOIN ICSOOPick e ON c.SourceDetailID=e.PickID AND c.WorkPoint=e.WorkPoint
|
|
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND d.Type='1'", jo["LotNo"].ToString(), WorkPoint, jo["Quantity"].ToString());
|
|
|
|
}
|
|
else
|
|
{
|
|
sql += string.Format(@"update ICSWareHouseLotInfo set Quantity=Quantity-'{0}',MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{4}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["LotNo"].ToString(), WorkPoint);
|
|
// sql += string.Format(@" update ICSMOApplyNegDetail set IssueNegQuantity =IssueNegQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where SDNCode='{3}' and Sequence='{4}' and WorkPoint='{5}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", jo["ID"].ToString(), WorkPoint);
|
|
sql += string.Format(@"UPDATE c SET IssueQuantity=ISNULL(IssueQuantity,0)+'{2}'
|
|
FROM ICSWareHouseLotInfoLog a
|
|
INNER JOIN ICSOutsourcingOrder b ON a.TransCode=b.OOCode AND a.WorkPoint=b.WorkPoint
|
|
INNER JOIN ICSMOPick c ON b.OODetailID = c.OODetailID AND b.WorkPoint = c.WorkPoint AND a.TransSequence = b.Sequence + '~' + c.Sequence
|
|
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND a.ID='{3}'", jo["LotNo"].ToString(), WorkPoint, jo["Quantity"].ToString(), jo["ID"].ToString());
|
|
}
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
|
|
//委外退料-委外退料单-委外申请单
|
|
public string RevocationWWProduceStrippingLL(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
string sqlseach = @"select Type from dbo.ICSInventoryLot where LotNo='" + jo["LotNo"].ToString() + "'";
|
|
object LotNoType = SqlHelper.ExecuteScalar(sqlseach);
|
|
if (LotNoType.ToString() == "1")
|
|
{
|
|
//新条码退
|
|
sql += string.Format(@"delete from ICSWareHouseLotInfo where LotNo='{0}' and WorkPoint='{1}'", jo["LotNo"].ToString(), WorkPoint);
|
|
sql += string.Format(@" update ICSOApplyNegDetail set IssueNegQuantity =IssueNegQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where SDNCode='{3}' and Sequence='{4}' and WorkPoint='{5}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", MUSER, MUSERNAME, jo["ID"].ToString(), WorkPoint);
|
|
sql += string.Format(@" UPDATE e SET IssueQuantity=ISNULL(IssueQuantity,0)+'{2}'
|
|
FROM ICSInventoryLot a
|
|
INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint
|
|
INNER JOIN ICSOApplyNegDetail c ON b.TransCode=c.OApplyNegCode AND b.TransSequence=c.Sequence AND b.WorkPoint=c.WorkPoint
|
|
INNER JOIN ICSOApplyNeg d ON c.OApplyNegCode=d.OApplyNegCode AND c.WorkPoint=d.WorkPoint
|
|
INNER JOIN ICSOApply e ON c.SourceDetailID=e.ApplyDetailID AND c.WorkPoint=e.WorkPoint
|
|
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND d.Type='2'", jo["LotNo"].ToString(), WorkPoint, jo["Quantity"].ToString());
|
|
|
|
}
|
|
else
|
|
{
|
|
sql += string.Format(@"update ICSWareHouseLotInfo set Quantity=Quantity-'{0}',MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{4}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["LotNo"].ToString(), WorkPoint);
|
|
// sql += string.Format(@" update ICSMOApplyNegDetail set IssueNegQuantity =IssueNegQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where SDNCode='{3}' and Sequence='{4}' and WorkPoint='{5}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", MUSER, MUSERNAME, jo["ID"].ToString(), WorkPoint);
|
|
sql += string.Format(@"UPDATE c SET IssueQuantity=ISNULL(IssueQuantity,0)+'{2}'
|
|
FROM ICSWareHouseLotInfoLog a
|
|
INNER JOIN ICSOApply c ON a.TransCode=c.ApplyCode AND a.TransSequence=c.Sequence AND a.WorkPoint=c.WorkPoint
|
|
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND a.ID='{3}'", jo["LotNo"].ToString(), WorkPoint, jo["Quantity"].ToString(), jo["ID"].ToString());
|
|
}
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
|
|
|
|
|
|
//委外退料-委外退料单-委外材料出库单
|
|
public string RevocationWWProduceStrippingCLCK(string keyValue)
|
|
{
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
|
|
string msg = "";
|
|
string sql = string.Empty;
|
|
JArray res = (JArray)JsonConvert.DeserializeObject(keyValue);
|
|
foreach (var item in res)
|
|
{
|
|
JObject jo = (JObject)item;
|
|
string sqlseach = @"select Type from dbo.ICSInventoryLot where LotNo='" + jo["LotNo"].ToString() + "'";
|
|
object LotNoType = SqlHelper.ExecuteScalar(sqlseach);
|
|
if (LotNoType.ToString() == "1")
|
|
{
|
|
//新条码退
|
|
sql += string.Format(@"delete from ICSWareHouseLotInfo where LotNo='{0}' and WorkPoint='{1}'", jo["LotNo"].ToString(), WorkPoint);
|
|
sql += string.Format(@" update ICSMOApplyNegDetail set IssueNegQuantity =IssueNegQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where SDNCode='{3}' and Sequence='{4}' and WorkPoint='{5}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", MUSER, MUSERNAME, jo["ID"].ToString(), WorkPoint);
|
|
sql += string.Format(@" UPDATE e SET IssueQuantity=ISNULL(IssueQuantity,0)+'{2}'
|
|
FROM ICSInventoryLot a
|
|
INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint
|
|
INNER JOIN ICSOApplyNegDetail c ON b.TransCode=c.OApplyNegCode AND b.TransSequence=c.Sequence AND b.WorkPoint=c.WorkPoint
|
|
INNER JOIN ICSOApplyNeg d ON c.OApplyNegCode=d.OApplyNegCode AND c.WorkPoint=d.WorkPoint
|
|
INNER JOIN ICSOIssue e ON c.SourceDetailID=e.IssueDetailID AND c.WorkPoint=e.WorkPoint
|
|
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND d.Type='3'", jo["LotNo"].ToString(), WorkPoint, jo["Quantity"].ToString());
|
|
|
|
}
|
|
else
|
|
{
|
|
sql += string.Format(@"update ICSWareHouseLotInfo set Quantity=Quantity-'{0}',MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{4}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["LotNo"].ToString(), WorkPoint);
|
|
// sql += string.Format(@" update ICSMOApplyNegDetail set IssueNegQuantity =IssueNegQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where SDNCode='{3}' and Sequence='{4}' and WorkPoint='{5}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["TransCode"].ToString(), jo["TransSequence"].ToString(), WorkPoint);
|
|
sql += string.Format(@"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' where ID='{0}' and WorkPoint='{1}'", MUSER, MUSERNAME, jo["ID"].ToString(), WorkPoint);
|
|
sql += string.Format(@"UPDATE c SET IssueQuantity=ISNULL(IssueQuantity,0)+'{2}'
|
|
FROM ICSWareHouseLotInfoLog a
|
|
INNER JOIN ICSOIssue c ON a.TransCode=c.IssueCode AND a.TransSequence=c.Sequence AND a.WorkPoint=c.WorkPoint
|
|
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND a.ID='{3}'", jo["LotNo"].ToString(), WorkPoint, jo["Quantity"].ToString(), jo["ID"].ToString());
|
|
}
|
|
|
|
}
|
|
try
|
|
{
|
|
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
msg = ex.Message;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|