|
|
using NFine.Data.Extensions; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using NFine.Code; using NFine.Repository; using System.Data.Common; using NFine.Domain._03_Entity.SRM; using ICS.Application.Entity; using Newtonsoft.Json; using System.Configuration; using System.Data.SqlClient; using ICS.Data; using Newtonsoft.Json.Linq; using NFine.Domain._03_Entity.WMS; using System.Net; using System.IO;
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; var Parameter = keyValue.ToJObject();
sql += @" delete from ICSWareHouseLotInfo where LotNo='{3}' and WorkPoint='{7}' "; sql += @"update ICSPurchaseOrder set InQuantity =InQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where POCode='{4}' and Sequence='{5}' and WorkPoint='{7}'"; sql += @"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where ID='{6}' and WorkPoint='{7}'"; sql = string.Format(sql, Parameter["Quantity"].ToString(), MUSER, MUSERNAME, Parameter["LotNo"].ToString(), Parameter["TransCode"].ToString(), Parameter["TransSequence"].ToString(), Parameter["ID"].ToString(), WorkPoint);
try { if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0) {
} else { msg = "撤销失败"; } } catch (Exception ex) { throw new Exception(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; var Parameter = keyValue.ToJObject();
sql += @"update ICSWareHouseLotInfo set Quantity=Quantity+'{0}',MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{7}' "; sql += @"update a set IssueQuantity =IssueQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' from ICSMOPick a left join ICSMO b on a.MODetailID=b.MODetailID and a.WorkPoint=b.WorkPoint
where b.MOCode='{4}' and a.Sequence='{5}' and a.WorkPoint='{7}'";
sql += @"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where ID='{6}' and WorkPoint='{7}'"; sql = string.Format(sql, Parameter["Quantity"].ToString(), MUSER, MUSERNAME, Parameter["LotNo"].ToString(), Parameter["TransCode"].ToString(), Parameter["TransSequence"].ToString(), Parameter["ID"].ToString(), WorkPoint);
try { if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0) {
} else { msg = "撤销失败"; } } catch (Exception ex) { throw new Exception(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; var Parameter = keyValue.ToJObject(); sql += @"delete from ICSWareHouseLotInfo where LotNo='{3}' and WorkPoint='{7}' "; sql += @"update ICSMO set RCVQuantity =RCVQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where MOCode='{4}' and Sequence='{5}' and WorkPoint='{7}'"; sql += @"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where ID='{6}' and WorkPoint='{7}'"; sql = string.Format(sql, Parameter["Quantity"].ToString(), MUSER, MUSERNAME, Parameter["LotNo"].ToString(), Parameter["TransCode"].ToString(), Parameter["TransSequence"].ToString(), Parameter["ID"].ToString(), WorkPoint); try { if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0) {
} else { msg = "撤销失败"; } } catch (Exception ex) { throw new Exception(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; var Parameter = keyValue.ToJObject(); sql += @"update ICSWareHouseLotInfo set Quantity=Quantity+'{0}',MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{7}' "; sql += @"update ICSSDN set SDNQuantity =SDNQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where SDNCode='{4}' and Sequence='{5}' and WorkPoint='{7}'"; sql += @"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where ID='{6}' and WorkPoint='{7}'"; sql = string.Format(sql, Parameter["Quantity"].ToString(), MUSER, MUSERNAME, Parameter["LotNo"].ToString(), Parameter["TransCode"].ToString(), Parameter["TransSequence"].ToString(), Parameter["ID"].ToString(), WorkPoint);
try { if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0) {
} else { msg = "撤销失败"; } } catch (Exception ex) { throw new Exception(ex.Message); }
return msg; }
} }
|