|
|
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}' 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 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; var Parameter = keyValue.ToJObject();
sql += @" delete from ICSWareHouseLotInfo where LotNo='{3}' and WorkPoint='{7}' "; sql += @"update ICSDeliveryNotice set RCVQuantity =RCVQuantity-'{0}' where DNCode='{4}' and Sequence='{5}' and WorkPoint='{7}' and DNType='1'"; 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}' from ICSMOPick a left join ICSMO b on a.MODetailID=b.MODetailID and a.WorkPoint=b.WorkPoint
where b.MOCode='{4}' and b.Sequence+'~'+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 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; 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 ICSMOApply set IssueQuantity =IssueQuantity-'{0}' where ApplyCode='{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 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; 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 ICSMOIssue set IssueQuantity =IssueQuantity-'{0}' where IssueCode='{4}' and Sequence='{5}' and WorkPoint='{7}' and Type='1' and Status='2'"; 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}' 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 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; var Parameter = keyValue.ToJObject(); sql += @"delete from ICSWareHouseLotInfo where LotNo='{3}' and WorkPoint='{7}' "; sql += @" update ICSManufactureReceive set RCVQuantity =RCVQuantity-'{0}' where RCVCode='{4}' and Sequence='{5}' and WorkPoint='{7}' and Type='1' and Status='2'"; 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 RevocationSalesReturn(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; }
//销售出库
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; }
} }
|