用友U8数据库插入存货明细账语句

适用于【库存管理】与【收发存汇总表】结存不一致,且财务账无误,只有数量差异的情况。

INSERT INTO [dbo].[IA_Subsidiary]

( [bRdFlag] ,

[cBusType] ,

[cBusCode] ,

[cVouCode] ,

[ID] ,

[ValueID] ,

[JustID] ,

[dVouDate] ,

[dKeepDate] ,

[iMonth] ,

[iPZID] ,

[iPZDate] ,

[cPZtype] ,

[cPZdigest] ,

[cInvHead] ,

[cDifHead] ,

[cOppHead] ,

[cVouType] ,

[cPTCode] ,

[cSTCode] ,

[cWhCode] ,

[cAccDep] ,

[cInvCode] ,

[cRdCode] ,

[cVenCode] ,

[cCusCode] ,

[cOrderCode] ,

[cARVCode] ,

[cBillCode] ,

[cDLCode] ,

[cPSPCode] ,

[cProCode] ,

[cDepCode] ,

[cPersonCode] ,

[cHandler] ,

[iAInQuantity] ,

[iAOutQuantity] ,

[iInCost] ,

[iOutCost] ,

[iAInPrice] ,

[iAOutPrice] ,

[cBatchCode] ,

[iDebitDifCost] ,

[iCreditDifCost] ,

[cAccounter] ,

[cMaker] ,

[bFlag] ,

[bMoneyFlag] ,

[bSale] ,

[cMemo] ,

[cDefine1] ,

[cDefine2] ,

[cDefine3] ,

[cDefine4] ,

[cDefine5] ,

[cDefine6] ,

[cDefine7] ,

[cDefine8] ,

[cDefine9] ,

[cDefine10] ,

[cFree1] ,

[cFree2] ,

[cPZID] ,

[cDefine22] ,

[cDefine23] ,

[cDefine24] ,

[cDefine25] ,

[cDefine26] ,

[cDefine27] ,

[cItem_class] ,

[cItemCode] ,

[cName] ,

[cItemCName] ,

[noJustQuantity] ,

[cFree3] ,

[cFree4] ,

[cFree5] ,

[cFree6] ,

[cFree7] ,

[cFree8] ,

[cFree9] ,

[cFree10] ,

[cDefine11] ,

[cDefine12] ,

[cDefine13] ,

[cDefine14] ,

[cDefine15] ,

[cDefine16] ,

[cDefine28] ,

[cDefine29] ,

[cDefine30] ,

[cDefine31] ,

[cDefine32] ,

[cDefine33] ,

[cDefine34] ,

[cDefine35] ,

[cDefine36] ,

[cDefine37] ,

[psvsid] ,

[cCXHDcode] ,

[cCXFScode] ,

[cBatchia] ,

[dMadeDateia] ,

[iMassDateia] ,

[cMassUnit] ,

[dVDateia] ,

[cproordercode] ,

[iproorderid] ,

[iproorderids] ,

[cworkprocode] ,

[cworkprocodedis] ,

[cworkcentercode] ,

[cworkcentername] ,

[cendcode] ,

[csaleordercode] ,

[isaleorderid] ,

[isaleordersid] ,

[isaleorderids] ,

[centrustordercode] ,

[ientrustorderid] ,

[ientrustordersid] ,

[cpurordercode] ,

[ipurordersid] ,

[idlsid] ,

[strContractCode] ,

[inum] ,

[cAssUnit] ,

[exoCode] ,

[iExRowno] ,

[consignMentCode] ,

[iconsignmentautoid] ,

[iTrans] ,

[iLevel] ,

[BakID] ,

[iBG_Ctrl] ,

[cIMOrdercode] ,

[imaterialfee] ,

[iProcessFee] ,

[cMaterialHead] ,

[cProcessHead] ,

[cSRcVoutype] ,

[fLaborStdCostE] ,

[fManuFixStdCostE] ,

[fManuVarStdCostE] ,

[fOmCostE] ,

[cdemandcode] ,

[cdemandmemo] ,

[imaterialfeeDif] ,

[fLaborCostEffRateDif] ,

[fLaborCostRateDif] ,

[fManuFixCostEffRateDif] ,

[fManuFixCostRateDif] ,

[fManuVarCostEffRateDif] ,

[fManuVarCostRateDif] ,

[fOmCostEDif] ,

[cbMemo] ,

[msdetailsid] ,

[dtAudit] ,

[iYMonth] ,

[iYear] ,

[dCreateDate] ,

[GUID] ,

[MoneySrc] ,

[costsource] ,

[exorderid]

)

VALUES ( N'1' ,

NULL ,

NULL ,

N'-1050325' ,

N'-1050325' ,

NULL ,

NULL ,

N'2022-12-31 00:00:00.000' ,

N'2023-01-01 00:00:00.000' ,

N'0' ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

N'34' ,

NULL ,

NULL ,

N'334' ,

NULL ,

N'存货编码' ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

N'人名' ,

N'4' ,

NULL ,

N'1769.5125' ,

NULL ,

N'7078.05' ,

NULL ,

NULL ,

NULL ,

NULL ,

N'人名' ,

N'人名' ,

N'0' ,

N'1' ,

N'0' ,

N'调整负库存,只调整数量,不动金额,2023-06-08' ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

N'0' ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

NULL ,

N'2023' ,

N'2023-06-08 00:00:00.000' ,

NULL ,

NULL ,

NULL ,

NULL

);

GO

---UPDATE IA_Subsidiary SET iInCost='1769.5125',iAInPrice='7078.05' WHERE AutoID='1130539'

--DELETE FROM IA_Subsidiary WHERE AutoID='1142407'

SELECT iInCost FROM IA_Subsidiary WHERE AutoID='1130538'

SELECT [AutoID]

,[bRdFlag]

,[cBusType]

,[cBusCode]

,[cVouCode]

,[ID]

,[ValueID]

,[JustID]

,[dVouDate]

,[dKeepDate]

,[iMonth]

,[iPZID]

,[iPZDate]

,[cPZtype]

,[cPZdigest]

,[cInvHead]

,[cDifHead]

,[cOppHead]

,[cVouType]

,[cPTCode]

,[cSTCode]

,[cWhCode]

,[cAccDep]

,[cInvCode]

,[cRdCode]

,[cVenCode]

,[cCusCode]

,[cOrderCode]

,[cARVCode]

,[cBillCode]

,[cDLCode]

,[cPSPCode]

,[cProCode]

,[cDepCode]

,[cPersonCode]

,[cHandler]

,[iAInQuantity]

,[iAOutQuantity]

,[iInCost]

,[iOutCost]

,[iAInPrice]

,[iAOutPrice]

,[cBatchCode]

,[iDebitDifCost]

,[iCreditDifCost]

,[cAccounter]

,[cMaker]

,[bFlag]

,[bMoneyFlag]

,[bSale]

,[cMemo]

,[cDefine1]

,[cDefine2]

,[cDefine3]

,[cDefine4]

,[cDefine5]

,[cDefine6]

,[cDefine7]

,[cDefine8]

,[cDefine9]

,[cDefine10]

,[cFree1]

,[cFree2]

,[cPZID]

,[cDefine22]

,[cDefine23]

,[cDefine24]

,[cDefine25]

,[cDefine26]

,[cDefine27]

,[cItem_class]

,[cItemCode]

,[cName]

,[cItemCName]

,[noJustQuantity]

,[cFree3]

,[cFree4]

,[cFree5]

,[cFree6]

,[cFree7]

,[cFree8]

,[cFree9]

,[cFree10]

,[cDefine11]

,[cDefine12]

,[cDefine13]

,[cDefine14]

,[cDefine15]

,[cDefine16]

,[cDefine28]

,[cDefine29]

,[cDefine30]

,[cDefine31]

,[cDefine32]

,[cDefine33]

,[cDefine34]

,[cDefine35]

,[cDefine36]

,[cDefine37]

,[psvsid]

,[cCXHDcode]

,[cCXFScode]

,[cBatchia]

,[dMadeDateia]

,[iMassDateia]

,[cMassUnit]

,[dVDateia]

,[cproordercode]

,[iproorderid]

,[iproorderids]

,[cworkprocode]

,[cworkprocodedis]

,[cworkcentercode]

,[cworkcentername]

,[cendcode]

,[csaleordercode]

,[isaleorderid]

,[isaleordersid]

,[isaleorderids]

,[centrustordercode]

,[ientrustorderid]

,[ientrustordersid]

,[cpurordercode]

,[ipurordersid]

,[idlsid]

,[strContractCode]

,[inum]

,[cAssUnit]

,[exoCode]

,[iExRowno]

,[consignMentCode]

,[iconsignmentautoid]

,[iTrans]

,[iLevel]

,[BakID]

,[iBG_Ctrl]

,[cIMOrdercode]

,[imaterialfee]

,[iProcessFee]

,[cMaterialHead]

,[cProcessHead]

,[cSRcVoutype]

,[fLaborStdCostE]

,[fManuFixStdCostE]

,[fManuVarStdCostE]

,[fOmCostE]

,[cdemandcode]

,[cdemandmemo]

,[imaterialfeeDif]

,[fLaborCostEffRateDif]

,[fLaborCostRateDif]

,[fManuFixCostEffRateDif]

,[fManuFixCostRateDif]

,[fManuVarCostEffRateDif]

,[fManuVarCostRateDif]

,[fOmCostEDif]

,[cbMemo]

,[msdetailsid]

,[dtAudit]

,[iYMonth]

,[iYear]

,[dCreateDate]

,[GUID]

,[MoneySrc]

,[costsource]

,[exorderid]

FROM [dbo].[IA_Subsidiary]

WHERE (iYear = '2023') AND (iMonth = '0') AND (cVouCode IN ('-1050325', '-1050324'))

GO

SELECT * FROM [dbo].[IA_Subsidiary] WHERE iYear ='2023' AND cVouCode = '-1050325';

SELECT *

FROM IA_Subsidiary

WHERE (iYear = '2023') AND (iMonth = '0') AND (cVouCode IN ('-1050325', '-1050324'))

SELECT [AutoID]

,[bRdFlag]

,[cBusType]

,[cBusCode]

,[cVouCode]

,[ID]

,[ValueID]

,[JustID]

,[dVouDate]

,[dKeepDate]

,[iMonth]

,[iPZID]

,[iPZDate]

,[cPZtype]

,[cPZdigest]

,[cInvHead]

,[cDifHead]

,[cOppHead]

,[cVouType]

,[cPTCode]

,[cSTCode]

,[cWhCode]

,[cAccDep]

,[cInvCode]

,[cRdCode]

,[cVenCode]

,[cCusCode]

,[cOrderCode]

,[cARVCode]

,[cBillCode]

,[cDLCode]

,[cPSPCode]

,[cProCode]

,[cDepCode]

,[cPersonCode]

,[cHandler]

,[iAInQuantity]

,[iAOutQuantity]

,[iInCost]

,[iOutCost]

,[iAInPrice]

,[iAOutPrice]

,[cBatchCode]

,[iDebitDifCost]

,[iCreditDifCost]

,[cAccounter]

,[cMaker]

,[bFlag]

,[bMoneyFlag]

,[bSale]

,[cMemo]

,[cDefine1]

,[cDefine2]

,[cDefine3]

,[cDefine4]

,[cDefine5]

,[cDefine6]

,[cDefine7]

,[cDefine8]

,[cDefine9]

,[cDefine10]

,[cFree1]

,[cFree2]

,[cPZID]

,[cDefine22]

,[cDefine23]

,[cDefine24]

,[cDefine25]

,[cDefine26]

,[cDefine27]

,[cItem_class]

,[cItemCode]

,[cName]

,[cItemCName]

,[noJustQuantity]

,[cFree3]

,[cFree4]

,[cFree5]

,[cFree6]

,[cFree7]

,[cFree8]

,[cFree9]

,[cFree10]

,[cDefine11]

,[cDefine12]

,[cDefine13]

,[cDefine14]

,[cDefine15]

,[cDefine16]

,[cDefine28]

,[cDefine29]

,[cDefine30]

,[cDefine31]

,[cDefine32]

,[cDefine33]

,[cDefine34]

,[cDefine35]

,[cDefine36]

,[cDefine37]

,[psvsid]

,[cCXHDcode]

,[cCXFScode]

,[cBatchia]

,[dMadeDateia]

,[iMassDateia]

,[cMassUnit]

,[dVDateia]

,[cproordercode]

,[iproorderid]

,[iproorderids]

,[cworkprocode]

,[cworkprocodedis]

,[cworkcentercode]

,[cworkcentername]

,[cendcode]

,[csaleordercode]

,[isaleorderid]

,[isaleordersid]

,[isaleorderids]

,[centrustordercode]

,[ientrustorderid]

,[ientrustordersid]

,[cpurordercode]

,[ipurordersid]

,[idlsid]

,[strContractCode]

,[inum]

,[cAssUnit]

,[exoCode]

,[iExRowno]

,[consignMentCode]

,[iconsignmentautoid]

,[iTrans]

,[iLevel]

,[BakID]

,[iBG_Ctrl]

,[cIMOrdercode]

,[imaterialfee]

,[iProcessFee]

,[cMaterialHead]

,[cProcessHead]

,[cSRcVoutype]

,[fLaborStdCostE]

,[fManuFixStdCostE]

,[fManuVarStdCostE]

,[fOmCostE]

,[cdemandcode]

,[cdemandmemo]

,[imaterialfeeDif]

,[fLaborCostEffRateDif]

,[fLaborCostRateDif]

,[fManuFixCostEffRateDif]

,[fManuFixCostRateDif]

,[fManuVarCostEffRateDif]

,[fManuVarCostRateDif]

,[fOmCostEDif]

,[cbMemo]

,[msdetailsid]

,[dtAudit]

,[iYMonth]

,[iYear]

,[dCreateDate]

,[GUID]

,[MoneySrc]

,[costsource]

,[exorderid]

FROM [dbo].[IA_Subsidiary]

-- WHERE (iYear = '2023') AND (iMonth = '0') AND (cVouCode IN ('-1050325', '-1050324'))

--DELETE FROM IA_Subsidiary WHERE AutoID='1142407'

--SELECT iInCost FROM IA_Subsidiary WHERE AutoID='1142407'

WHERE cWhCode='31502' AND cInvCode='8003-0101-000119' AND iYear='2023'

GO

-- UPDATE IA_Subsidiary SET cWhCode='334' WHERE cWhCode='31502' AND cInvCode='存货编码' AND iYear='2023'

你可能感兴趣的:(用友U8前台异常处理,用友U8SQL语句,数据库语句,数据库,mysql,sql)