K3系统提示调用中间层失败,导致所有客户端不能正常登陆,重启服务器之后可以正常使用。
报错截图
报错代码:
--Declare @FSouceTrantype as int
Declare @bWriteMethod as Int --是否按标准数量
Declare @dRate as Decimal(28,10) --换算率
Declare @FWIPQty as Decimal(28,10) --在制品数量
Declare @FICMOInterID as int
Declare @#DataF59BB34EA6414753B8C3E16DF7E3755A table(FICMOinteriD int ,FStockQty Decimal(28,10),FChkPassItem INT)
Insert into @#DataF59BB34EA6414753B8C3E16DF7E3755A
SELECT u2.FICMOinteriD,SUM(ISNULL(u2.FQty,0)) as FStockQty,u2.FChkPassItem FROM ICStockBillEntry u2
WHERE u2.FPPBOMEntryID=0 and u2.FSourceTrantype>0 and u2.FInterID= 453166
AND NOT EXISTS(SELECT 1 FROM ICMORptEntry
WHERE FInterID=u2.FSourceInterID AND FEntryID=u2.FSourceEntryID
AND u2.FSourceTrantype =551 AND FMaterielType>0)
Group by u2.FICMOInterID,u2.FChkPassItem
Declare @FSourceTrantype as int
Declare @FROB as int
select @FROB=u1.FROB,@FSourceTrantype=t1.FSourceTrantype --(select fsourcetrantype from icstockbillentry m1 where m1.finterid=t1.fsourceinterid) end)
from ICStockBillEntry t1 join ICStockBill u1 on t1.finterid=u1.finterid where t1.finterid=453166
if @FROB=1 or (@FROB=-1 And @FSourceTrantype in (551,581))
Begin
IF (Select Count(*) From ICStockBillEntry Where FSourceTrantype =581 And FInterID=453166)>0
Update src Set src.FQtyStock = src.FQtyStock+dest.FQty
,src.FAuxQtyStock = (src.FQtyStock+dest.FQty)/CAST(t1.FCoefficient as Decimal(23,10))
From ICOperShift src INNER JOIN
(Select u1.FSourceInterID as FSourceInterID,u1.FSourceEntryID,u1.FItemID,SUM(u1.FQty) as FQty
From ICStockBillEntry u1
Where u1.FSourceTrantype=581 And u1.FInterID=453166
GROUP BY u1.FSourceInterID,u1.FSourceEntryID,u1.FItemID) dest
ON dest.FSourceInterID = src.FInterID
AND dest.FItemID = src.FItemID
INNER JOIN t_MeasureUnit t1 ON src.FUnitID=t1.FItemID
IF (Select Count(*) From ICStockBillEntry Where FSourceTrantype =551 And FInterID=453166)>0
Update src Set src.FQtyStock = src.FQtyStock+dest.FQty
,src.FAuxQtyStock = (src.FQtyStock+dest.FQty)/CAST(t1.FCoefficient as Decimal(23,10))
From ICMORptEntry src INNER JOIN
(Select u1.FSourceInterID as FSourceInterID,u1.FSourceEntryID,u1.FItemID,SUM(u1.FQty) as FQty
From ICStockBillEntry u1
INNER JOIN ICMORptEntry u2 ON u2.FInterID=u1.FSourceInterID AND u2.FEntryID=u1.FSourceEntryID
Where u1.FSourceTrantype=551 /*AND u2.FMaterielType=0*/ AND u1.FChkPassItem =1058 And u1.FInterID=453166
GROUP BY u1.FSourceInterID,u1.FSourceEntryID,u1.FItemID) dest
ON dest.FSourceInterID = src.FInterID
AND dest.FItemID = src.FItemID and dest.FSourceEntryID=src.FEntryID
INNER JOIN t_MeasureUnit t1 ON src.FUnitID=t1.FItemID
Update src Set src.FDiscardStockInQty = src.FDiscardStockInQty+dest.FQty
,src.FDiscardStockInAuxQty = (src.FDiscardStockInQty+dest.FQty)/CAST(t1.FCoefficient as Decimal(23,10))
From ICMORptEntry src INNER JOIN
(Select u1.FSourceInterID as FSourceInterID,u1.FSourceEntryID,u1.FItemID,SUM(u1.FQty) as FQty
From ICStockBillEntry u1
INNER JOIN ICMORptEntry u2 ON u2.FInterID=u1.FSourceInterID AND u2.FEntryID=u1.FSourceEntryID
Where u1.FSourceTrantype=551 /*AND u2.FMaterielType=0*/ AND u1.FChkPassItem =1059 And u1.FInterID=453166
GROUP BY u1.FSourceInterID,u1.FSourceEntryID,u1.FItemID) dest
ON dest.FSourceInterID = src.FInterID
AND dest.FItemID = src.FItemID and dest.FSourceEntryID=src.FEntryID
INNER JOIN t_MeasureUnit t1 ON src.FUnitID=t1.FItemID
Update src Set src.FQtyStock = src.FQtyStock+dest.FQty
,src.FAuxQtyStock = (src.FQtyStock+dest.FQty)/CAST(t1.FCoefficient as Decimal(23,10))
From ICMORptEntry src INNER JOIN
QMSourceInfo tmp ON src.FInterID = tmp.FQCReqInterID AND src.FEntryID = FQCReqEntryID
INNER JOIN ICQCBill tmpHead ON tmpHead.FInterID = tmp.FInterID INNER JOIN
(Select u1.FSourceInterID as FSourceInterID,u
推荐阅读