diff --git a/WMS-BS/NFine.Application/WMS/RevokeBusinessApp.cs b/WMS-BS/NFine.Application/WMS/RevokeBusinessApp.cs index 17d4466..ba4a73d 100644 --- a/WMS-BS/NFine.Application/WMS/RevokeBusinessApp.cs +++ b/WMS-BS/NFine.Application/WMS/RevokeBusinessApp.cs @@ -34,7 +34,7 @@ namespace NFine.Application.WMS 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 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); @@ -57,7 +57,43 @@ namespace NFine.Application.WMS 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; @@ -68,8 +104,44 @@ namespace NFine.Application.WMS 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 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); @@ -92,7 +164,43 @@ namespace NFine.Application.WMS 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; @@ -102,7 +210,7 @@ namespace NFine.Application.WMS 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 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 @@ -124,6 +232,41 @@ namespace NFine.Application.WMS 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 RevocationMarket(string keyValue) { diff --git a/WMS-BS/NFine.Web/Areas/WMS/Controllers/RevokeBusinessController.cs b/WMS-BS/NFine.Web/Areas/WMS/Controllers/RevokeBusinessController.cs index 79e7525..d60d131 100644 --- a/WMS-BS/NFine.Web/Areas/WMS/Controllers/RevokeBusinessController.cs +++ b/WMS-BS/NFine.Web/Areas/WMS/Controllers/RevokeBusinessController.cs @@ -18,6 +18,41 @@ namespace NFine.Web.Areas.WMS.Controllers return View(); } + //[HttpPost] + //[HandlerAjaxOnly] + //[ValidateAntiForgeryToken] + //public ActionResult Revocations(string keyValue) + //{ + // string msg = ""; + // var Parameter = keyValue.ToJObject(); + // if (Parameter["BusinessCode"].ToString() =="1"|| Parameter["BusinessCode"].ToString() == "2") + // { + // msg = App.RevocationPurchase(keyValue); + // } + // else if (Parameter["BusinessCode"].ToString() == "13"|| Parameter["BusinessCode"].ToString() == "14"|| Parameter["BusinessCode"].ToString() == "15") + // { + // msg = App.RevocationPicking(keyValue); + // } + // else if (Parameter["BusinessCode"].ToString() == "17"|| Parameter["BusinessCode"].ToString() == "18") + // { + // msg = App.RevocationFinished(keyValue); + // } + // else + // { + // msg = App.RevocationMarket(keyValue); + // } + + + // if (string.IsNullOrEmpty(msg)) + // { + // return Success("撤销成功!"); + // } + // else + // { + // return Error("" + msg + ""); + // } + //} + [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] @@ -25,23 +60,49 @@ namespace NFine.Web.Areas.WMS.Controllers { string msg = ""; var Parameter = keyValue.ToJObject(); - if (Parameter["BusinessCode"].ToString() =="1"|| Parameter["BusinessCode"].ToString() == "2") + //采购入库-采购订单 + if (Parameter["BusinessCode"].ToString() == "1" ) + { + msg = App.RevocationPurchase(keyValue); + } + //采购入库-采购到货单 + else if (Parameter["BusinessCode"].ToString() == "2") { - msg = App.RevocationPurchase(keyValue); + msg = App.RevocationDeliveryNotice(keyValue); } - else if (Parameter["BusinessCode"].ToString() == "13"|| Parameter["BusinessCode"].ToString() == "14"|| Parameter["BusinessCode"].ToString() == "15") + //生产发料-生产订单备料表 + else if (Parameter["BusinessCode"].ToString() == "13") { msg = App.RevocationPicking(keyValue); } - else if (Parameter["BusinessCode"].ToString() == "17"|| Parameter["BusinessCode"].ToString() == "18") + //生产发料-领料申请单 + else if (Parameter["BusinessCode"].ToString() == "14") + { + msg = App.RevocationMOApply(keyValue); + } + //生产发料-材料出库单 + else if (Parameter["BusinessCode"].ToString() == "15") + { + msg = App.RevocationMOIssue(keyValue); + } + + + //产成品入库-生产订单 + else if (Parameter["BusinessCode"].ToString() == "17") { msg = App.RevocationFinished(keyValue); } + //产成品入库-产成品入库单 + else if (Parameter["BusinessCode"].ToString() == "18") + { + msg = App.RevocationManufactureReceive(keyValue); + } + //销售发货-销售发货单 else { msg = App.RevocationMarket(keyValue); } - + if (string.IsNullOrEmpty(msg)) { @@ -57,6 +118,5 @@ namespace NFine.Web.Areas.WMS.Controllers - } } \ No newline at end of file