From 45935a675dcf956c1ffd9c8b0a2925850c52b088 Mon Sep 17 00:00:00 2001 From: Juj <1005539536@qq.com> Date: Thu, 11 Apr 2024 15:53:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=92=A4=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WMS-BS/NFine.Application/OMAY/OMAYApp.cs | 120 ++++++---- .../WMS/RevokeBusinessApp.cs | 208 ++++++++++++++++++ .../Controllers/RevokeBusinessController.cs | 20 ++ 3 files changed, 301 insertions(+), 47 deletions(-) diff --git a/WMS-BS/NFine.Application/OMAY/OMAYApp.cs b/WMS-BS/NFine.Application/OMAY/OMAYApp.cs index 7bad2bb..72bdd11 100644 --- a/WMS-BS/NFine.Application/OMAY/OMAYApp.cs +++ b/WMS-BS/NFine.Application/OMAY/OMAYApp.cs @@ -19,27 +19,48 @@ namespace NFine.Application.OMAY { public DataTable GetYLAndPC(string Type ,string Group, string TimeFrom, string TimeArrive) { - string sql = @" - select isnull((b.YLTR-aaa.TL),0) as YLTR,b.PCLRK from( - select -cast( isnull( sum( case when c.BusinessCode='13' and SUBSTRING(b.InvCode, 1, 2) IN ('01','04','05') then isnull(c.Quantity,0) else 0 end ),0)/1000 as decimal(18,2)) as YLTR , -cast(isnull( sum( case when c.BusinessCode='50' and b.EATTRIBUTE1='1' and SUBSTRING(b.InvCode, 1, 2) IN ('05') then isnull(c.Quantity,0) else 0 end) ,0)/1000 as decimal(18,2)) as PCLRK - from dbo.ICSMO a - inner join dbo.ICSMOPick b on a.MODetailID=b.MODetailID and a.WorkPoint=b.WorkPoint - inner join dbo.ICSWareHouseLotInfoLog c on a.MOCode=c.TransCode and a.Sequence+'~'+b.Sequence=c.TransSequence and c.EATTRIBUTE1<>'1' - inner join dbo.ICSDepartment d on a.DepCode=d.DepCode -where 1=1 and isnull(a.EATTRIBUTE7,'')<>'1' {0})b + // string sql = @" + // select isnull((b.YLTR-aaa.TL),0) as YLTR,b.PCLRK from( + // select + //cast( isnull( sum( case when c.BusinessCode='13' and SUBSTRING(b.InvCode, 1, 2) IN ('01','04','05') then isnull(c.Quantity,0) else 0 end ),0)/1000 as decimal(18,2)) as YLTR , + //cast(isnull( sum( case when c.BusinessCode='50' and b.EATTRIBUTE1='1' and SUBSTRING(b.InvCode, 1, 2) IN ('05') then isnull(c.Quantity,0) else 0 end) ,0)/1000 as decimal(18,2)) as PCLRK + // from dbo.ICSMO a + // left join dbo.ICSMOPick b on a.MODetailID=b.MODetailID and a.WorkPoint=b.WorkPoint + // inner join dbo.ICSWareHouseLotInfoLog c on a.MOCode=c.TransCode and a.Sequence+'~'+b.Sequence=c.TransSequence and c.EATTRIBUTE1<>'1' + // inner join dbo.ICSDepartment d on a.DepCode=d.DepCode + //where 1=1 and isnull(a.EATTRIBUTE7,'')<>'1' {0})b + // left join + // (select + //isnull(sum(isnull(c.Quantity,0)),0)/1000 as TL + // from dbo.ICSMO a + // left join dbo.ICSMOPick b on a.MODetailID=b.MODetailID and a.WorkPoint=b.WorkPoint + // inner join dbo.ICSWareHouseLotInfoLog c on a.MOCode=c.TransCode and a.Sequence+'~'+b.Sequence=c.TransSequence and c.EATTRIBUTE1<>'1' and c.BusinessCode='16-1' + // inner join dbo.ICSDepartment d on a.DepCode=d.DepCode + // where SUBSTRING(b.InvCode, 1, 2) IN ('01','04','05') and isnull(a.EATTRIBUTE7,'')<>'1' {0}) aaa on 1=1"; + string sql = @"select isnull((b.YLTR-aaa.TL),0) as YLTR from( +select +cast(sum(isnull(c.Quantity,0)) /1000 as decimal(18,2)) as YLTR +from + ICSWareHouseLotInfoLog c +left JOIN ICSMO a ON c.TransCode=a.MOCode AND SUBSTRING(c.TransSequence, 1, CHARINDEX('~', c.TransSequence) - 1)=a.Sequence and c.WorkPoint=a.WorkPoint +where c.BusinessCode='13' and SUBSTRING(c.InvCode, 1, 2) IN ('01','04','05') +and isnull( a.EATTRIBUTE7,'')<>'1' and c.EATTRIBUTE1<>'1' {0})b left join - (select + (select isnull(sum(isnull(c.Quantity,0)),0)/1000 as TL - from dbo.ICSMO a - inner join dbo.ICSMOPick b on a.MODetailID=b.MODetailID and a.WorkPoint=b.WorkPoint - inner join dbo.ICSWareHouseLotInfoLog c on a.MOCode=c.TransCode and a.Sequence+'~'+b.Sequence=c.TransSequence and c.EATTRIBUTE1<>'1' and c.BusinessCode='16-1' - inner join dbo.ICSDepartment d on a.DepCode=d.DepCode - where SUBSTRING(b.InvCode, 1, 2) IN ('01','04','05') and isnull(a.EATTRIBUTE7,'')<>'1' {0}) aaa on 1=1"; - +from + ICSWareHouseLotInfoLog c +left JOIN ICSMO a ON c.TransCode=a.MOCode and + (case when c.TransSequence like '%~%' + then SUBSTRING(c.TransSequence, 1, CHARINDEX('~', c.TransSequence) - 1) + else c.TransSequence end )=a.Sequence + and c.WorkPoint=a.WorkPoint +where c.BusinessCode='16-1' +and isnull( a.EATTRIBUTE7,'')<>'1' and isnull(c.EATTRIBUTE1,'')<>'1' +and SUBSTRING(c.InvCode, 1, 2) IN ('01','04','05') {0}) aaa on 1=1 +"; - string where = " and d.DepName = '" + Type + "' and c.MUSERName = '" + Type + Group + "'"; + string where = "and LEFT(c.MUSERName,2) = '" + Type + "' and c.MUSERName = '" + Type + Group + "'"; if (!string.IsNullOrWhiteSpace(TimeFrom)) { where += "and left(c.MTIME,7)>='" + TimeFrom + "'"; @@ -56,7 +77,7 @@ isnull(sum(isnull(c.Quantity,0)),0)/1000 as TL public DataTable GetYLAndPCLRK(string Type, string Group, string TimeFrom, string TimeArrive) { - string sql = @" select isnull(sum(a.Quantity),0)/1000 as PCLRK + string sql = @" select cast (isnull(sum(a.Quantity),0)/1000 as decimal(18,2))as PCLRK from dbo.ICSInventoryLot a inner join dbo.ICSWareHouseLotInfo b on a.LotNo=b.LotNo and a.WorkPoint=b.WorkPoint --inner join dbo.ICSWareHouseLotInfoLog c on a.LotNo=b.LotNo and a.WorkPoint=b.WorkPoint @@ -77,26 +98,20 @@ isnull(sum(isnull(c.Quantity,0)),0)/1000 as TL public DataTable GetCC(string Type, string Group, string TimeFrom, string TimeArrive) { - string sql = @" select cast( isnull( sum(isnull(b.Quantity,0)),0)/1000 as decimal(18,2)) as CC - from dbo.ICSMO a - inner join dbo.ICSWareHouseLotInfoLog b on a.MOCode=b.TransCode and a.Sequence=b.TransSequence and b.BusinessCode='17' and b.EATTRIBUTE1<>'1' - inner join dbo.ICSDepartment d on a.DepCode=d.DepCode - inner join dbo.ICSInventoryLot c on b.LotNo=c.LotNo and a.WorkPoint=c.WorkPoint - where isnull(a.EATTRIBUTE7,'')<>'1' and d.DepName = '" + Type + "' and c.MUSERName= '" + Type + Group + "' "; - // string sql = @" select - // cast( isnull( sum(isnull(b.Quantity,0)),0)/1000 as decimal(18,2))-(select cast( isnull( sum(isnull(b.Quantity,0)),0)/1000 as decimal(18,2)) as TL - //from dbo.ICSMO a - //inner join dbo.ICSWareHouseLotInfoLog b on a.MOCode=b.TransCode and a.Sequence=b.TransSequence and b.BusinessCode='16-1' and b.EATTRIBUTE1<>'1' + //string sql = @" select cast( isnull( sum(isnull(b.Quantity,0)),0)/1000 as decimal(18,2)) as CC + // from dbo.ICSMO a + //inner join dbo.ICSWareHouseLotInfoLog b on a.MOCode=b.TransCode and a.Sequence=b.TransSequence and b.BusinessCode='17' and b.EATTRIBUTE1<>'1' // inner join dbo.ICSDepartment d on a.DepCode=d.DepCode - // inner join dbo.ICSInventoryLot c on b.LotNo=c.LotNo and a.WorkPoint=c.WorkPoint - // where d.DepName = '" + Type + "' and c.MUSERName= '" + Type + Group + @"' - // ) as CC - // from dbo.ICSMO a - //inner - // join dbo.ICSWareHouseLotInfoLog b on a.MOCode = b.TransCode and a.Sequence = b.TransSequence and b.BusinessCode = '17' and b.EATTRIBUTE1 <> '1' - // inner join dbo.ICSDepartment d on a.DepCode = d.DepCode - // inner join dbo.ICSInventoryLot c on b.LotNo = c.LotNo and a.WorkPoint = c.WorkPoint - // where d.DepName = '" + Type + "' and c.MUSERName= '" + Type + Group + "' "; + // inner join dbo.ICSInventoryLot c on b.LotNo=c.LotNo and a.WorkPoint=c.WorkPoint + // where isnull(a.EATTRIBUTE7,'')<>'1' and LEFT(c.MUSERName,2)='" + Type + "' and c.MUSERName= '" + Type + Group + "' "; + + string sql = @" select cast( isnull( sum(isnull(b.Quantity,0)),0)/1000 as decimal(18,2)) as CC + from + dbo.ICSWareHouseLotInfoLog b + left JOIN ICSMO a on a.MOCode=b.TransCode and a.Sequence=b.TransSequence + left join dbo.ICSInventoryLot c on b.LotNo=c.LotNo and b.WorkPoint=c.WorkPoint + where isnull(a.EATTRIBUTE7,'')<>'1' and b.BusinessCode='17' and b.EATTRIBUTE1<>'1' and LEFT(c.MUSERName,2)='" + Type + "' and c.MUSERName= '" + Type + Group + "' "; + if (!string.IsNullOrWhiteSpace(TimeFrom)) { sql += "and left(b.MTIME,7)>='" + TimeFrom + "'"; @@ -112,17 +127,28 @@ isnull(sum(isnull(c.Quantity,0)),0)/1000 as TL public DataTable GetCCL7(string Type, string Group, string TimeFrom, string TimeArrive) { string sqlwhere = string.Empty; - string sql = @" select -cast( isnull( sum(isnull(e.RowCC,0)),0) as decimal(18,2)) as CC - from dbo.ICSMO a +// string sql = @" select +//cast( isnull( sum(isnull(e.RowCC,0)),0) as decimal(18,2)) as CC +// from dbo.ICSMO a - inner join dbo.ICSDepartment d on a.DepCode=d.DepCode +// left join dbo.ICSDepartment d on a.DepCode=d.DepCode - inner join ( select a.MOCode,a.Sequence,a.WorkPoint, e.EATTRIBUTE5,e.EATTRIBUTE1,case when e.EATTRIBUTE3='平方' then isnull(b.Quantity,0) /isnull(e.EATTRIBUTE1,1)*e.EATTRIBUTE5/1000 else isnull( isnull(b.Quantity,0),0)/1000 end as RowCC from dbo.ICSMO a -inner join dbo.ICSWareHouseLotInfoLog b on a.MOCode=b.TransCode and a.Sequence=b.TransSequence and b.BusinessCode='17' - inner join dbo.ICSInventory e on a.InvCode=e.InvCode and a.WorkPoint=e.WorkPoint - inner join dbo.ICSInventoryLot c on b.LotNo=c.LotNo and a.WorkPoint=c.WorkPoint - where isnull(a.EATTRIBUTE7,'')<>'1' and c.MUSERName= '" + Type + Group + "' {0} )e on a.MOCode = e.MOCode and a.Sequence = e.Sequence and a.WorkPoint = e.WorkPoint where d.DepName = '" + Type + "' "; +// inner join ( select a.MOCode,a.Sequence,a.WorkPoint, e.EATTRIBUTE5,e.EATTRIBUTE1,case when e.EATTRIBUTE3='平方' then isnull(b.Quantity,0) /isnull(e.EATTRIBUTE1,1)*e.EATTRIBUTE5/1000 else isnull( isnull(b.Quantity,0),0)/1000 end as RowCC from dbo.ICSMO a +//inner join dbo.ICSWareHouseLotInfoLog b on a.MOCode=b.TransCode and a.Sequence=b.TransSequence and b.BusinessCode='17' +// inner join dbo.ICSInventory e on a.InvCode=e.InvCode and a.WorkPoint=e.WorkPoint +// inner join dbo.ICSInventoryLot c on b.LotNo=c.LotNo and a.WorkPoint=c.WorkPoint +// where isnull(a.EATTRIBUTE7,'')<>'1' and c.MUSERName= '" + Type + Group + "' {0} )e on a.MOCode = e.MOCode and a.Sequence = e.Sequence and a.WorkPoint = e.WorkPoint where d.DepName = '" + Type + "' "; + string sql = @" select +cast( isnull( sum(isnull(e.RowCC,0)),0) as decimal(18,2)) as CC + from + + (select a.MOCode,a.Sequence,a.WorkPoint, e.EATTRIBUTE5,e.EATTRIBUTE1, +case when e.EATTRIBUTE3='平方' then isnull(b.Quantity,0) /isnull(e.EATTRIBUTE1,1)*e.EATTRIBUTE5/1000 else isnull( isnull(b.Quantity,0),0)/1000 end as RowCC from + dbo.ICSWareHouseLotInfoLog b +left JOIN ICSMO a on a.MOCode=b.TransCode and a.Sequence=b.TransSequence + left join dbo.ICSInventory e on b.InvCode=e.InvCode and b.WorkPoint=e.WorkPoint + left join dbo.ICSInventoryLot c on b.LotNo=c.LotNo and b.WorkPoint=c.WorkPoint + where isnull(a.EATTRIBUTE7,'')<>'1' and c.MUSERName= '" + Type + Group + "' and b.BusinessCode='17' {0} ) e "; if (!string.IsNullOrWhiteSpace(TimeFrom)) { sqlwhere += "and left(b.MTIME,7)>='" + TimeFrom + "'"; diff --git a/WMS-BS/NFine.Application/WMS/RevokeBusinessApp.cs b/WMS-BS/NFine.Application/WMS/RevokeBusinessApp.cs index c689dfa..574e0e8 100644 --- a/WMS-BS/NFine.Application/WMS/RevokeBusinessApp.cs +++ b/WMS-BS/NFine.Application/WMS/RevokeBusinessApp.cs @@ -630,5 +630,213 @@ namespace NFine.Application.WMS } + + //物料调拨(开立调拨申请单) + 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}',MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{4}'", jo["Quantity"].ToString(), MUSER, MUSERNAME, jo["LotNo"].ToString(), WorkPoint); + sql += string.Format(@" update ICSTransferApplication set TransferQuantity =TransferQuantity-'{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 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; + } + + + + + } } diff --git a/WMS-BS/NFine.Web/Areas/WMS/Controllers/RevokeBusinessController.cs b/WMS-BS/NFine.Web/Areas/WMS/Controllers/RevokeBusinessController.cs index 241e63e..3270b33 100644 --- a/WMS-BS/NFine.Web/Areas/WMS/Controllers/RevokeBusinessController.cs +++ b/WMS-BS/NFine.Web/Areas/WMS/Controllers/RevokeBusinessController.cs @@ -104,6 +104,26 @@ namespace NFine.Web.Areas.WMS.Controllers { msg = App.RevocationAll(keyValue, "ICSSDN", "SDNCode", "SDNQuantity", "-"); } + //46:物料调拨(开立调拨申请单) + else if (BusinessCode == "46") + { + msg = App.RevocationICSTransferApplication(keyValue); + } + //8-1:委外退料-委外退料单 + else if (BusinessCode == "8-1") + { + msg = App.RevocationWWProduceStripping(keyValue); + } + //8-2:委外退料-委外退料单-委外领料申请单 + else if (BusinessCode == "8-2") + { + msg = App.RevocationWWProduceStrippingLL(keyValue); + } + //8-3:委外退料-委外退料单-委外材料出库单 + else if (BusinessCode == "8-3") + { + msg = App.RevocationWWProduceStrippingCLCK(keyValue); + } else { msg = "该类型单据暂不支持撤销,请联系管理员";