资源描述:
《委外加工入库审核未成功解决办法.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、---委外加工审核未成功的问题解决办法,---可能原因是表ICShop_ItemConsume中FinterID的最大值问题,由于中间有表删除,一些流水号丢失,所以更新下最大值selecttop1*fromICShop_ItemConsumeorderbyFInterIDdescselect*fromICMaxNumwhereFTableNamelike'ICShop_ItemConsume'---保证最大值一致,如不是则更新updateICMaxNumsetFMaxNum=(selectmax(finterid)fromI
2、CShop_ItemConsume)whereFTableNamelike'ICShop_ItemConsume'以下代码为其中一列报错中抓取的过程--Declare@FSouceTrantypeasintDeclare@WIPDeductModeasDecimal(28,10)--在制品扣减方式Declare@bWriteMethodasInt--是否按标准数量Declare@dRateasDecimal(28,10)--换算率Declare@FWIPQtyasDecimal(28,10)--在制品数量Declare@FI
3、CMOInterIDasintDeclare@#Data797A90FE46DE4D3DB0887B4794F98159table(FOrderInterIDint,FOrderEntryIDINT,FItemIDINT,FStockQtyDecimal(28,10),FSecStockQtyDECIMAL(28,10))Insertinto@#Data797A90FE46DE4D3DB0887B4794F98159SELECTFOrderInterID,FOrderEntryID,FItemID,SUM(ISNULL(u2
4、.FQty,0))asFStockQty,SUM(ISNULL(u2.FSecQty,0))ASFSecStockQtyFROMICStockBillEntryu2WHEREu2.FICMoInterID=0ANDu2.FOrderInterID>0ANDu2.FInterID=213494GROUPBYFOrderInterID,FOrderEntryID,FItemIDIF(selectcount(*)from@#Data797A90FE46DE4D3DB0887B4794F98159)>0UPDATEu1SETu1.F
5、StockQty=ISNULL(u1.FStockQty,0)+m2.FStockQty,u1.FAuxStockQty=ISNULL(u1.FAuxStockQty,0)+m2.FStockQty/cast(t2.FCoEfficientasfloat),u1.FSecStockQty=ISNULL(u1.FSecStockQty,0)+m2.FSecStockQtyFROMICSubContractEntryu1INNERJOIN@#Data797A90FE46DE4D3DB0887B4794F98159m2onu1.F
6、InterID=m2.FOrderInterIDANDu1.FEntryID=m2.FOrderEntryIDANDu1.FItemID=m2.FItemIDINNERJOINt_MeasureUnitt2ONu1.FUnitID=t2.FMeasureUnitIDUPDATEu1SETu1.FBCommitQty=ISNULL(u1.FBCommitQty,0)+m2.FBackQty,u1.FAuxBCommitQty=(ISNULL(u1.FBCommitQty,0)+m2.FBackQty)/cast(t2.FCoE
7、fficientasfloat),u1.FSecBCommitQty=ISNULL(u1.FSecBCommitQty,0)+m2.FSecBackQtyFROMICSubContractEntryu1INNERJOIN(SELECTFOrderInterID,FOrderEntryID,FItemID,SUM(ISNULL(u2.FQty,0))ASFBackQty,SUM(ISNULL(u2.FAuxQty,0))ASFAuxBackQty,SUM(ISNULL(u2.FSecQty,0))ASFSecBackQtyFR
8、OMICStockBillEntryu2WHEREu2.FICMoInterID=0ANDu2.FOrderInterID>0ANDu2.FSourceTranType=73ANDu2.FQty<0ANDu2.FInterID=213494GROUPBYFOrderInterID,FOrd