记录一次金蝶K3 WISE清除部份历史数据

环境背景需求

客户一套金蝶K3 WISE从2019年建账到23年4期,要求保留2023年数据,清除2023年之前的数据。
分析:如果是重新建账,直接用工具就可以直接清掉业务数据,并保留基础数据。看来这项任务并不那么容易完。第一次接手这样的项目,没有经验可谈,于是开始大量测试,记录最后的成功。

注意数据备份!!!注意数据备份!!!注意数据备份!!!

项目思路

旧账套备份及反结账

把旧账套复制一个并注册进金蝶,就是下面的TEST3账套。
将23年所有凭证导出,然后删掉凭证,反结账到23年1月,待所有业务数据导完成后,再导入凭证,这样有个问题就是总账凭证跟业务系统没有关联,但是期末总额对账没有问题就行。(如果要关联可以试一下连总账一块导入)

准备一个含基础数据的账套

借助如下 工具,轻松获取一个没有业务数据的账套
账套维护工具
使用该工具可以只清除业务数据,保留基础数据,以及客户化的二次开发。
清除前开启SQL跟踪,记录工具是清掉了哪些表数据,对于不熟K3表结构的人非常有用

新账套的期初数据

  1. 把系统中所有模块反初始化:总账,现金,应收,应付,存货
  2. 从旧账套查出22年12月的总账期末科目余额,应收,应付,物料收发结存,虚仓结存等做为新账套的期初数据
  3. 引入总账的期初科目余额,之后现金,应收,应付从总账引入。
  4. 引入期初库存,做即时库存校验
  5. 结束初始化:总账,现金,应收,应付,存货
  6. K3不提供虚仓的期初处理,将数据整理后通过语句创建插入单据。

导入业务数据

–用表名查表名称
select * from t_TableDescription where ftablename =‘t_RP_ContactBal’
–用表名称查表名
select * from t_TableDescription where fdescription like ‘%受托%’
t_TableDescription :这张表记录了K3里面所有的表名,不熟的可以在这里查

根据自己的业务范围看要插入哪些业务数据,数据都是从源账套导过来的。
此处做个说明:我是先把源账套反
@@@@@@@@@@以下是SQL语句插入业务数据@@@@@@@@@@
–收付款单明细
set IDENTITY_INSERT t_rp_ARBillOfSH on
insert into t_rp_ARBillOfSH ([FBillID], [FEntryID], [FIndex], [FReceiveCyID], [FReceiveAmount], [FReceiveAmountFor], [FReceiveExchangeRate], [FSettleCyID], [FSettleAmountFor], [FSettleAmount], [FSettleExchangeRate], [FDiscountFor], [FDiscount], [FCheckType], [FReceiveCyName], [FSettleCyName], [FcheckQty], [FRemainQty], [FRemainAmount], [FCheckAmount], [FRemainAmountFor], [FCheckAmountFor], [FLinkCheckAmount], [FLinkCheckAmountFor], [FLinkCheckQty], [FContractNo], [FContractEntryID], [FOrderNo], [FOrderEntryID], [FID_SRC], [FBillNo_SRC], [FEntryID_SRC], [FClassID_SRC], [FAccountID], [FDC], [FItemid], [FAuxPropID], [FUnitID], [FQuantity], [FTaxPrice], [FAmountFor_SRC], [FAmount_SRC], [FAmountFor_Entry], [Famount_Entry], [FRemainAmountFor_SRC], [FRemainAmount_SRC], [FExchangeExpenseFor], [FExchangeExpense], [FSettleQuantity], [FBackAmountFor_Relative], [FBackAmount_Relative], [FGUID], [FOrderInterID], [FOrderType], [FFeeObjID], [FConfirmAdvice], [FPayBillID], [FPayEntryID], [FPayBillNo], [FClassID_SRC_Text])
select * from ais20230419test3.dbo.t_rp_ARBillOfSH where fbillid in (select fbillid from t_RP_NewReceiveBill)
set IDENTITY_INSERT t_rp_ARBillOfSH off
–现金日记账
set IDENTITY_INSERT cn_Xjrjz on
insert into cn_Xjrjz ([FId], [FKmId], [FYear], [FPeriod], [FDate], [FGroup], [FNum], [FExp], [FAccountId2], [FAcctidside], [FDebit], [FCredit], [FDebitB], [FCreditB], [FRate], [FLyr], [FSource], [FRemark], [FVoucherID], [FGenVch], [FVchYear], [FVchPeriod], [FSourceID], [FAttachments], [FID2], [FTableName], [FItemDetailID], [FExchangeRateType], [FOrderID], [FVoucherEntryID], [FHandler])
select * from ais20230419test3.dbo.cn_Xjrjz where fdate>‘2023-01-01’
set IDENTITY_INSERT cn_Xjrjz off
–付款计划
set IDENTITY_INSERT t_RP_Plan_Ap on
insert into t_RP_Plan_Ap ([FDetailID], [FOrgID], [FDate], [FAmount], [FAmountFor], [FRemainAmount], [FRemainAmountFor], [FType], [FExplanation], [FInterID], [FBillID], [FEntryID], [FRP], [FIsInit], [FPlanAmount], [FPlanAmountFor], [FPlanCheckAmount], [FPlanCheckAmountFor])
select * from ais20230419test3.dbo.t_RP_Plan_Ap where fdate>=‘2023-01-01’
set IDENTITY_INSERT t_RP_Plan_Ap off
–应收付往来
select * from t_RP_Contact
insert into t_RP_Contact ([FID], [FYear], [FPeriod], [FRP], [FType], [FDate], [FFincDate], [FNumber], [FCustomer], [FDepartment], [FEmployee], [FCurrencyID], [FExchangeRate], [FAmount], [FAmountFor], [FRemainAmount], [FRemainAmountFor], [FContractNo], [FInvoiceID], [FRPBillID], [FBillID], [FBegID], [FExpenseID], [FBussinessDiscount], [FCashDiscount], [FRPDate], [FSuperDays], [FDirectSale], [FSaleBackAmount], [FSaleBackAmountFor], [FDue], [FIsBad], [FBadReason], [FVoucherID], [FGroupID], [FAccountID], [FIsInit], [FStatus], [FPost], [FToBal], [FPre], [FK3Import], [FInterestRate], [FCheckType], [FBillType], [FInvoiceType], [FItemClassID], [FExplanation], [FSmInvID], [FPreparer], [UUID])
select [FID], [FYear], [FPeriod], [FRP], [FType], [FDate], [FFincDate], [FNumber], [FCustomer], [FDepartment], [FEmployee], [FCurrencyID], [FExchangeRate], [FAmount], [FAmountFor], [FRemainAmount], [FRemainAmountFor], [FContractNo], [FInvoiceID], [FRPBillID], [FBillID], [FBegID], [FExpenseID], [FBussinessDiscount], [FCashDiscount], [FRPDate], [FSuperDays], [FDirectSale], [FSaleBackAmount], [FSaleBackAmountFor], [FDue], [FIsBad], [FBadReason], [FVoucherID], [FGroupID], [FAccountID], [FIsInit], [FStatus], [FPost], [FToBal], [FPre], [FK3Import], [FInterestRate], [FCheckType], [FBillType], [FInvoiceType], [FItemClassID], [FExplanation], [FSmInvID], [FPreparer], [UUID]
from ais20230419test3.dbo.t_RP_Contact where fdate>=‘2023-01-01’

–其他应收单
insert into t_RP_ARPBill ([FBrID], [FTranStatus], [FBillID], [FRP], [FYear], [FPeriod], [FDate], [FNumber], [FBillType], [FCustomer], [FDepartment], [FEmployee], [FAccountID], [FAccountID2], [FCurrencyID], [FExchangeRate], [FCheckAmount], [FCheckAmountFor], [FRemainAmount], [FRemainAMountFor], [FCheckQty], [FRemainQty], [FAmount], [FAmountFor], [FOldBill], [FCashDiscount], [FContractID], [FContractNo], [FExplanation], [FDelete], [FVoucherID], [FGroupID], [FRPDate], [FInterestRate], [FPreparer], [FChecker], [FStatus], [FCheckStatus], [FConnectFlag], [FSource], [FSourceID], [FItemClassID], [FFincDate], [FCheckDate], [FConfirm], [FAdjustExchangeRate], [FAdjustAmount], [FClassTypeID], [FTaskID], [FResourceID], [FOrderID], [FBudgetAmountFor], [FOrderAmountFor], [FGUID], [FDC], [FSubSystemID], [FBankAcctName], [FBankAcct], [FRPBank], [FPayType], [FExchangeRateType], [FObtainRateWay], [FPrintCount], [FPayCondition])
select * from ais20230419test3.dbo.t_RP_ARPBill where fdate>=‘2023-01-01’
set identity_insert t_RP_ARPBillEntry on
insert into t_RP_ARPBillEntry ([FBillID], [FDetailID], [FEntryID], [FContractNo], [FContractEntryID], [FOrderNo], [FOrderEntryID], [FID_SRC], [FBillNo_SRC], [FEntryID_SRC], [FClassID_SRC], [famountFor], [famount], [FCheckAmount], [FCheckAmountFor], [FCheckQty], [FLinkCheckAmount], [FLinkCheckAmountFor], [FLinkCheckQty], [FCheckDate], [FRemainQty], [FPayApplyAmountFor], [FPayApplyAmount], [FAmountFor_Commit], [FAmount_Commit], [FRemainAmountFor_SRC], [FRemainAmount_SRC], [FRemainAmountFor], [FRemainAmount], [FGUID], [FInvoiceAmountFor], [FInvoiceAmount], [FInvLinkCheckAmountFor], [FInvLinkCheckAmount], [FAmountNoTax], [FAmountNoTaxFor], [FTaxRate], [FTaxAmount], [FTaxAmountFor], [FFeeObjID], [FAPAcctID], [FIncomeCode], [FIncomeName], [FPayReqPayAmountFor])
select * from ais20230419test3.dbo.t_RP_ARPBillEntry where fbillid in (select fbillid from ais20230419test3.dbo.t_RP_ARPBill where fdate>=‘2023-01-01’ )
set identity_insert t_RP_ARPBillEntry off

–往来余额表

select * from ais20230419test3.dbo.t_RP_ContactBal
–重算应收付余额,汇总表里面 shift+R调出重算界面

–应收收款单
insert into t_RP_NewReceiveBill ([FBrID], [FTranStatus], [FBillID], [FYear], [FPeriod], [FNumber], [FDate], [FAccountID], [FSettle], [FOrgNumber], [FCurrencyID], [FExchangeRate], [FReceiveCyID], [FAmount], [FAmountFor], [FReceiveAmount], [FReceiveAmountFor], [FDiscountAmount], [FDiscountAmountFor], [FExplanation], [FCustomer], [FDepartment], [FEmployee], [FPre], [FDelete], [FContractID], [FContractNo], [FVoucherID], [FGroupID], [FPreparer], [FChecker], [FRP], [FStatus], [FCheckStatus], [FImport], [FCashDiscount], [FARNumber], [FSettleCyID], [FSettleAmount], [FSettleAmountFor], [FSettleDiscount], [FSettleDiscountFor], [FMulCy], [FAgent], [FAgentCustomer], [FBillType], [FSource], [FSourceID], [FItemClassID], [FFincDate], [FSettleNo], [FRPBank], [FBankAcct], [FRPBank_Pay], [FBankAcct_Pay], [FOrderNo], [FClassTypeID], [FDspAmountFor], [FDspAmount], [FTaskID], [FResourceID], [FOrderID], [FBudgetAmountFor], [FOrderAmountFor], [FPreAmountFor], [FCheckDate], [FConfirm], [FConnectFlag], [FSubSystemID], [FAdjustExchangeRate], [FAdjustAmount], [FCheckAmount], [FCheckAmountFor], [FRemainAmount], [FRemainAmountFor], [FCnSource], [FClassTypeID_cn], [FAccountID_cn], [FTransDate_CN], [FRecClientNumber_cn], [FRecClientName_cn], [FRecProvince_cn], [FRecCity_cn], [FRecCityType_cn], [FPayClientNumber_cn], [FPayClientName_cn], [FPayProvince_cn], [FPayCity_cn], [FPayCityType_cn], [FPurpose_CN], [FPreparerID_cn], [FCheckerID_cn], [FCheckDate_cn], [FReCheckerID_cn], [FReCheckDate_cn], [FToRPDate_cn], [FMakeJournalDate_cn], [FRP_cn], [FPayInside_cn], [FScBillID_cn], [FScDBNumber_cn], [FApplyBillNo_cn], [FSourceBillNo_cn], [FToRPUserID_cn], [FScStatus_CN], [FScSenderID_CN], [FScSendDate_CN], [FScSettleDate_CN], [FAmount_CN], [FAmountFor_CN], [FID_SRC], [FBillNo_SRC], [FClassID_SRC], [UUID], [FTranType_CN], [FProposer_CN], [FBankNoteNo], [FTlxlvl], [FRecBankTypeID], [FRemark], [FPaymentID], [FPostNetBankState], [FImportState], [FPersonal], [FExchangeRateType], [FBMApplyType], [FBMDeptID], [FBMEmpID], [FEntryID_SRC_CN], [FClassType_SRC_CN], [FID_SRC_CN], [FAccountingStatus], [FSendingStatus], [FAmountPaidFor], [FAmountPaidCurr], [FBankAcctName], [FObtainRateWay], [FRecCNAPS], [FConfirmFlag], [FConfirmDate], [FConfirmor], [FConfirmAdvice], [FPrintCount], [FRecCNAPSID], [FPaySettNo], [FMultiCheckStatus], [FMultiCheckStatus_CN], [FTranPackageID], [tas_cg_yingfukuanhx])
select [FBrID], [FTranStatus], [FBillID], [FYear], [FPeriod], [FNumber], [FDate], [FAccountID], [FSettle], [FOrgNumber], [FCurrencyID], [FExchangeRate], [FReceiveCyID], [FAmount], [FAmountFor], [FReceiveAmount], [FReceiveAmountFor], [FDiscountAmount], [FDiscountAmountFor], [FExplanation], [FCustomer], [FDepartment], [FEmployee], [FPre], [FDelete], [FContractID], [FContractNo], [FVoucherID], [FGroupID], [FPreparer], [FChecker], [FRP], [FStatus], [FCheckStatus], [FImport], [FCashDiscount], [FARNumber], [FSettleCyID], [FSettleAmount], [FSettleAmountFor], [FSettleDiscount], [FSettleDiscountFor], [FMulCy], [FAgent], [FAgentCustomer], [FBillType], [FSource], [FSourceID], [FItemClassID], [FFincDate], [FSettleNo], [FRPBank], [FBankAcct], [FRPBank_Pay], [FBankAcct_Pay], [FOrderNo], [FClassTypeID], [FDspAmountFor], [FDspAmount], [FTaskID], [FResourceID], [FOrderID], [FBudgetAmountFor], [FOrderAmountFor], [FPreAmountFor], [FCheckDate], [FConfirm], [FConnectFlag], [FSubSystemID], [FAdjustExchangeRate], [FAdjustAmount], [FCheckAmount], [FCheckAmountFor], [FRemainAmount], [FRemainAmountFor], [FCnSource], [FClassTypeID_cn], [FAccountID_cn], [FTransDate_CN], [FRecClientNumber_cn], [FRecClientName_cn], [FRecProvince_cn], [FRecCity_cn], [FRecCityType_cn], [FPayClientNumber_cn], [FPayClientName_cn], [FPayProvince_cn], [FPayCity_cn], [FPayCityType_cn], [FPurpose_CN], [FPreparerID_cn], [FCheckerID_cn], [FCheckDate_cn], [FReCheckerID_cn], [FReCheckDate_cn], [FToRPDate_cn], [FMakeJournalDate_cn], [FRP_cn], [FPayInside_cn], [FScBillID_cn], [FScDBNumber_cn], [FApplyBillNo_cn], [FSourceBillNo_cn], [FToRPUserID_cn], [FScStatus_CN], [FScSenderID_CN], [FScSendDate_CN], [FScSettleDate_CN], [FAmount_CN], [FAmountFor_CN], [FID_SRC], [FBillNo_SRC], [FClassID_SRC], [UUID], [FTranType_CN], [FProposer_CN], [FBankNoteNo], [FTlxlvl], [FRecBankTypeID], [FRemark], [FPaymentID], [FPostNetBankState], [FImportState], [FPersonal], [FExchangeRateType], [FBMApplyType], [FBMDeptID], [FBMEmpID], [FEntryID_SRC_CN], [FClassType_SRC_CN], [FID_SRC_CN], [FAccountingStatus], [FSendingStatus], [FAmountPaidFor], [FAmountPaidCurr], [FBankAcctName], [FObtainRateWay], [FRecCNAPS], [FConfirmFlag], [FConfirmDate], [FConfirmor], [FConfirmAdvice], [FPrintCount], [FRecCNAPSID], [FPaySettNo], [FMultiCheckStatus], [FMultiCheckStatus_CN], [FTranPackageID], [tas_cg_yingfukuanhx]
from ais20230419test3.dbo.t_RP_NewReceiveBill where fdate>=‘2023-01-01’

–核销明细
insert into t_Rp_CheckDetail
select * from ais20230419test3.dbo.t_Rp_CheckDetail
–存货核销表
set IDENTITY_INSERT t_rp_CheckEntry on
insert into t_rp_CheckEntry ([FDetailID], [FType], [FInvoiceID], [FEntryID], [FID], [FInterID], [FBillID], [FContactID], [FRP], [FItemID], [FUnitID], [FAuxPropID], [FIsinit], [FBillType], [FRemainQuantity], [FRemainAmount], [FRemainAmountFor], [FPrice], [FTaxPrice], [FBillID_SRC], [FEntryID_SRC], [FType_SRC], [FIsinit_SRC], [FQty_SRC], [FAmount_SRC], [FAmountFor_SRC], [FContractNo], [FContractEntryID], [FOrderNo], [FOrderEntryID], [FCheckAmount], [FCheckAmountFor], [FCheckQuantity])
select * from AIS20181217163241.dbo.t_rp_CheckEntry
set IDENTITY_INSERT t_rp_CheckEntry off
–核销日志
insert into t_RP_NewCheckInfo ([FInterID], [FID], [FTransfer], [FTransferID], [FContactID], [FCheckDate], [FChecker], [FCustomer], [FDepartment], [FEmployee], [FBillID], [FCheckType], [FCheckManer], [FType], [FIsinit], [FCheckQuantity], [FRemainQuantity], [FExplanation], [FCheckAmount], [FCheckAmountFor], [FRemainAmount], [FRemainAmountFor], [FDiscount], [FDiscountFor], [FCurrencyID], [FExchangeRate], [FVoucherID], [FRP], [FIsBad], [FBadID], [FARToAR], [FPreToPre], [FZXID], [FItemClassID], [FUnTread], [FUnTreadID], [FUnEndorse], [FAutoCheck], [FExchangeRateType])
select * from AIS20181217163241.dbo.t_RP_NewCheckInfo where fcheckdate>=‘2023-01-01’

–收款计划
set IDENTITY_INSERT t_rp_Plan_Ar on
insert into t_rp_Plan_Ar ([FDetailID], [FOrgID], [FDate], [FAmount], [FAmountFor], [FRemainAmount], [FRemainAmountFor], [FType], [FExplanation], [FInterID], [FBillID], [FEntryID], [FRP], [FIsInit], [FPlanAmount], [FPlanAmountFor], [FPlanCheckAmount], [FPlanCheckAmountFor])
select * from ais20230419test3.dbo.t_rp_Plan_Ar where fdate>=‘2022-06-01’
set IDENTITY_INSERT t_rp_Plan_Ar off
–付款单分录
set IDENTITY_INSERT t_rp_Exchange on
insert into t_rp_Exchange ([FBillID], [FEntryID], [FSettleAmountFor], [FSettleAmount], [FSettleCyID], [FExchangeCyID], [FExchangeRate], [FExchangeAmountFor], [FExchangeExpenseFor], [FExchangeAmount], [FExchangeExpense], [FSum], [FIndex], [FSerial])
select * from AIS20181217163241.dbo.t_rp_Exchange
set IDENTITY_INSERT t_rp_Exchange off

–应收应付票据表
select * from ais20230419test3.dbo.t_RP_Bill

–单据凭证对应表
insert into t_RPVoucherAndBill ([FID], [FVoucherID], [FBillType], [FBillID], [FlistID])
select * from ais20230419test3.dbo.t_RPVoucherAndBill
–费用发票表
select * from ais20230419test3.dbo.ICExpenses
select * from ICExpensesEntry
–采购发票
insert into ICPurchase ([FBrNo], [FInterID], [FBillNo], [FTranType], [FDate], [FVoucherID], [FNote], [FCurrencyID], [FDeptID], [FEmpID], [FHookInterID], [FVchInterID], [FBillerName], [FCheckerID], [FPosterID], [FManagerID], [FPosted], [FSupplyID], [FClosed], [FROB], [FRSCBillNo], [FExchangeRate], [FStatus], [FCompactNo], [FCancellation], [FBillerID], [FPOStyle], [FYearPeriod], [FMultiCheckLevel1], [FMultiCheckLevel2], [FMultiCheckLevel3], [FMultiCheckLevel4], [FMultiCheckLevel5], [FMultiCheckLevel6], [FMultiCheckDate1], [FMultiCheckDate2], [FMultiCheckDate3], [FMultiCheckDate4], [FMultiCheckDate5], [FMultiCheckDate6], [FCurCheckLevel], [FYtdIntRate], [FAcctID], [FOrgBillInterID], [FFincDate], [FArApStatus], [FYear], [FPeriod], [FTotalExpense], [FTotalExpenseFor], [FOffsetTax], [FOffsetTaxFor], [FTotalCost], [FTotalCostFor], [FSubSystemID], [FInvStyle], [FHookerID], [FOuterID], [FClassTypeID], [fitemclassid], [FCOMINVID], [FTaskID], [FOrderID], [FResourceID], [FBudgetAmountFor], [FOrderAmountFor], [FFreeItem1], [FFreeItem2], [FFreeItem3], [FFreeItem4], [FAddress], [FTaxNum], [FAccount], [FBank], [FCheckDate], [FExplanation], [FPayStyle], [FAdjustExchangeRate], [FAdjustAmount], [FSelTranType], [FChildren], [FHookStatus], [FActPriceVchTplID], [FPlanPriceVchTplID], [FActualVchTplID], [FPlanVchTplID], [FBrID], [FTranStatus], [FCussentAcctID], [FCheckStatus], [fconnectflag], [FCheckAmount], [FCheckAmountFor], [FRemainAmount], [FRemainAmountFor], [FDC], [FGUID], [FPOOrdBillNo], [FRelateBrID], [FSettleDate], [FManageType], [FSysStatus], [FPrintCount], [FExchangeRateType], [FObtainRateWay], [FVoucherInterID], [FVoucherInterID_ID], [FLockBill], [FPayCondition], [FJSDate], [FJSBillNo])
select [FBrNo], [FInterID], [FBillNo], [FTranType], [FDate], [FVoucherID], [FNote], [FCurrencyID], [FDeptID], [FEmpID], [FHookInterID], [FVchInterID], [FBillerName], [FCheckerID], [FPosterID], [FManagerID], [FPosted], [FSupplyID], [FClosed], [FROB], [FRSCBillNo], [FExchangeRate], [FStatus], [FCompactNo], [FCancellation], [FBillerID], [FPOStyle], [FYearPeriod], [FMultiCheckLevel1], [FMultiCheckLevel2], [FMultiCheckLevel3], [FMultiCheckLevel4], [FMultiCheckLevel5], [FMultiCheckLevel6], [FMultiCheckDate1], [FMultiCheckDate2], [FMultiCheckDate3], [FMultiCheckDate4], [FMultiCheckDate5], [FMultiCheckDate6], [FCurCheckLevel], [FYtdIntRate], [FAcctID], [FOrgBillInterID], [FFincDate], [FArApStatus], [FYear], [FPeriod], [FTotalExpense], [FTotalExpenseFor], [FOffsetTax], [FOffsetTaxFor], [FTotalCost], [FTotalCostFor], [FSubSystemID], [FInvStyle], [FHookerID], [FOuterID], [FClassTypeID], [fitemclassid], [FCOMINVID], [FTaskID], [FOrderID], [FResourceID], [FBudgetAmountFor], [FOrderAmountFor], [FFreeItem1], [FFreeItem2], [FFreeItem3], [FFreeItem4], [FAddress], [FTaxNum], [FAccount], [FBank], [FCheckDate], [FExplanation], [FPayStyle], [FAdjustExchangeRate], [FAdjustAmount], [FSelTranType], [FChildren], [FHookStatus], [FActPriceVchTplID], [FPlanPriceVchTplID], [FActualVchTplID], [FPlanVchTplID], [FBrID], [FTranStatus], [FCussentAcctID], [FCheckStatus], [fconnectflag], [FCheckAmount], [FCheckAmountFor], [FRemainAmount], [FRemainAmountFor], [FDC], [FGUID], [FPOOrdBillNo], [FRelateBrID], [FSettleDate], [FManageType], [FSysStatus], [FPrintCount], [FExchangeRateType], [FObtainRateWay], [FVoucherInterID], [FVoucherInterID_ID], [FLockBill], [FPayCondition], [FJSDate], [FJSBillNo]
from ais20230419test3.dbo.ICPurchase where fdate>=‘2023-01-01’
set IDENTITY_INSERT ICPurchaseEntry on
insert into ICPurchaseEntry ([FBrNo], [FInterID], [FEntryID], [FDetailID], [FItemID], [FQty], [FPrice], [FAmount], [FTaxRate], [FTax], [FTaxAmount], [FAmountMust], [FAmountEx], [FCommitQty], [FDeductTax], [FUnitID], [FAuxCommitQty], [FAuxPrice], [FAuxQty], [FTaxPrice], [FAuxTaxPrice], [FSourceEntryID], [FMapNumber], [FMapName], [FOrgBillEntryID], [FOrderPrice], [FAuxOrderPrice], [FNote], [FAddCost], [FAddCostFor], [FStdAmount], [FStdTaxAmount], [FDiscountRate], [fauxqty_base], [FBatchNo], [FCOMINVID], [FAmountincludetax], [FStdAmountincludetax], [FEntryID_SRC], [FClassID_SRC], [FFreeItem1], [FFreeItem2], [FFreeItem3], [FFreeItem4], [FAuxPropID], [FAmtDiscount], [FStdAmtDiscount], [FPriceDiscount], [FAuxPriceDiscount], [FsecCoefficient], [FSecQty], [FQuantityReceive_Commit], [FQuantityPayApply_Commit], [FSecUnitID], [FAmountFor_Commit], [FAmount_Commit], [FPayApplyAmountFor], [FPayApplyAmount], [FPayApplyQuantity], [FAllAmount], [FSecCommitQty], [FSourceTranType], [FSourceInterId], [FSourceBillNo], [FContractInterID], [FContractEntryID], [FContractBillNo], [FOrderInterID], [FOrderEntryID], [FOrderBillNo], [FAllHookQTY], [FAllHookAmount], [FCurrentHookQTY], [FCurrentHookAmount], [FStdAllHookAmount], [FStdCurrentHookAmount], [FSplitSecQty], [FNoMust], [FSaleCommitQty], [FSaleSecCommitQty], [FCheckQty], [FRemainQty], [FRemainAmount], [FCheckAmount], [FRemainAmountFor], [FCheckAmountFor], [FGUID], [FLinkCheckAmountFor], [FLinkCheckAmount], [FLinkCheckQty], [FImpHSEntryID], [FHSID], [FSRCCountryID], [FMapID], [FImpHSAmount], [FImpExciseAmount], [FImpHSUnitRate1], [FImpHSUnitRate2], [FVATAmount], [FPackUnitID], [FPackCount], [FPackType], [FGWeight], [FNWeight], [FCubage], [FHSUnit1_I], [FHSUnit2_I], [FInvoiceAmountFor], [FInvoiceAmount], [FInvoiceQty], [FInvLinkCheckAmountFor], [FInvLinkCheckAmount], [FInvLinkCheckQty], [FPlanMode], [FMTONo], [FOrderType], [FItemStatementBillNO], [FItemStatementEntryID], [FItemStatementInterID], [FAmountMustOld], [FDeductTaxOld], [FNoMustOld], [FCommitAmt], [FCommitStdAmt], [FCommitAmtTax], [FCommitStdAmtInTax], [FCommitTax], [FCommitStdTax], [FPayReqPayAmountFor])
select * from ais20230419test3.dbo.ICPurchaseEntry where finterid in (select finterid from ais20230419test3.dbo.ICPurchase where fdate>=‘2023-01-01’)
set IDENTITY_INSERT ICPurchaseEntry off

–销售发票
insert into ICSale ([FBrNo], [FInterID], [FBillNo], [FTranType], [FDate], [FCustID], [FNote], [FCurrencyID], [FPayStyleID], [FTransportStyle], [FDeptID], [FEmpID], [FHookInterID], [FVchInterID], [FBillerID], [FCheckerID], [FPosterID], [FManagerID], [FPosted], [FClosed], [FSettleID], [FROB], [FRSCBillNo], [FExchangeRate], [FStatus], [FCompactNo], [FCancellation], [FSaleStyle], [FAcctID], [FMultiCheckLevel1], [FMultiCheckLevel2], [FMultiCheckLevel3], [FMultiCheckLevel4], [FMultiCheckLevel5], [FMultiCheckLevel6], [FMultiCheckDate1], [FMultiCheckDate2], [FMultiCheckDate3], [FMultiCheckDate4], [FMultiCheckDate5], [FMultiCheckDate6], [FCurCheckLevel], [FYearPeriod], [FYtdIntRate], [FOrgBillInterID], [FUUID], [FImport], [FSystemType], [FArApStatus], [FYear], [FPeriod], [FSubSystemID], [FFincDate], [FInvoicer], [FAccount], [FTaxNum], [FHookerID], [FTranStatus], [FOuterID], [FClassTypeID], [FItemClassID], [finterestrate], [FCOMINVID], [FTaskID], [FOrderID], [FResourceID], [FBudgetAmountFor], [FOrderAmountFor], [FFreeItem1], [FFreeItem2], [FFreeItem3], [FFreeItem4], [FAddress], [FBank], [FCheckDate], [FExplanation], [FPayStyle], [FAdjustExchangeRate], [FAdjustAmount], [FSelTranType], [FChildren], [FHookStatus], [FActPriceVchTplID], [FPlanPriceVchTplID], [FActualVchTplID], [FPlanVchTplID], [FBrID], [FCussentAcctID], [FCheckStatus], [fconnectflag], [FCheckAmount], [FCheckAmountFor], [FRemainAmount], [FRemainAmountFor], [FDC], [FGUID], [FPOOrdBillNo], [FRelateBrID], [FSettleDate], [FJSBillNo], [FJSExported], [FSysStatus], [FPrintCount], [FExchangeRateType], [FObtainRateWay], [FConfirmFlag], [FConfirmDate], [FConfirmor], [FConfirmAdvice], [FDiscountType], [FPayCondition], [FJSDate], [FInvoiceName], [FHeadSelfI0554])
select [FBrNo], [FInterID], [FBillNo], [FTranType], [FDate], [FCustID], [FNote], [FCurrencyID], [FPayStyleID], [FTransportStyle], [FDeptID], [FEmpID], [FHookInterID], [FVchInterID], [FBillerID], [FCheckerID], [FPosterID], [FManagerID], [FPosted], [FClosed], [FSettleID], [FROB], [FRSCBillNo], [FExchangeRate], [FStatus], [FCompactNo], [FCancellation], [FSaleStyle], [FAcctID], [FMultiCheckLevel1], [FMultiCheckLevel2], [FMultiCheckLevel3], [FMultiCheckLevel4], [FMultiCheckLevel5], [FMultiCheckLevel6], [FMultiCheckDate1], [FMultiCheckDate2], [FMultiCheckDate3], [FMultiCheckDate4], [FMultiCheckDate5], [FMultiCheckDate6], [FCurCheckLevel], [FYearPeriod], [FYtdIntRate], [FOrgBillInterID], [FUUID], [FImport], [FSystemType], [FArApStatus], [FYear], [FPeriod], [FSubSystemID], [FFincDate], [FInvoicer], [FAccount], [FTaxNum], [FHookerID], [FTranStatus], [FOuterID], [FClassTypeID], [FItemClassID], [finterestrate], [FCOMINVID], [FTaskID], [FOrderID], [FResourceID], [FBudgetAmountFor], [FOrderAmountFor], [FFreeItem1], [FFreeItem2], [FFreeItem3], [FFreeItem4], [FAddress], [FBank], [FCheckDate], [FExplanation], [FPayStyle], [FAdjustExchangeRate], [FAdjustAmount], [FSelTranType], [FChildren], [FHookStatus], [FActPriceVchTplID], [FPlanPriceVchTplID], [FActualVchTplID], [FPlanVchTplID], [FBrID], [FCussentAcctID], [FCheckStatus], [fconnectflag], [FCheckAmount], [FCheckAmountFor], [FRemainAmount], [FRemainAmountFor], [FDC], [FGUID], [FPOOrdBillNo], [FRelateBrID], [FSettleDate], [FJSBillNo], [FJSExported], [FSysStatus], [FPrintCount], [FExchangeRateType], [FObtainRateWay], [FConfirmFlag], [FConfirmDate], [FConfirmor], [FConfirmAdvice], [FDiscountType], [FPayCondition], [FJSDate], [FInvoiceName], [FHeadSelfI0554]
from ais20230419test3.dbo.ICSale where fdate>=‘2023-01-01’
set IDENTITY_INSERT ICSaleEntry on
insert into ICSaleEntry ([FBrNo], [FInterID], [FEntryID], [FDetailID], [FItemID], [FQty], [FPrice], [FAmount], [FTaxRate], [FTaxAmount], [FCommitQty], [FUnitID], [FAuxCommitQty], [FAuxPrice], [FAuxQty], [FTaxPrice], [FAuxTaxPrice], [FSourceEntryID], [FDiscountRate], [FMapNumber], [FMapName], [FOrgBillEntryID], [FOrderPrice], [FAuxOrderPrice], [FNote], [FStdAmount], [FStdTaxAmount], [FAmountincludetax], [FStdAmountincludetax], [fauxqty_base], [FBatchNo], [FCOMINVID], [FEntryID_SRC], [FClassID_SRC], [FFreeItem1], [FFreeItem2], [FFreeItem3], [FFreeItem4], [FAuxPropID], [FAmtDiscount], [FStdAmtDiscount], [FKFDate], [FKFperiod], [FPeriodDate], [FPriceDiscount], [FAuxPriceDiscount], [FsecCoefficient], [FSecQty], [FQuantityReceive_Commit], [FQuantityPayApply_Commit], [FSecUnitID], [FAmountFor_Commit], [FAmount_Commit], [FAllAmount], [FStdAllAmount], [FSecCommitQty], [FSourceTranType], [FSourceInterId], [FSourceBillNo], [FContractInterID], [FContractEntryID], [FContractBillNo], [FOrderInterID], [FOrderEntryID], [FOrderBillNo], [FAllHookQTY], [FAllHookAmount], [FCurrentHookQTY], [FCurrentHookAmount], [FStdAllHookAmount], [FStdCurrentHookAmount], [FSplitSecQty], [FPurchaseCommitQty], [FPurchaseSecCommitQty], [FCheckQty], [FRemainQty], [FRemainAmount], [FCheckAmount], [FRemainAmountFor], [FCheckAmountFor], [FLinkCheckAmountFor], [FLinkCheckAmount], [FLinkCheckQty], [FGUID], [FInvoiceAmountFor], [FInvoiceAmount], [FInvoiceQty], [FInvLinkCheckAmountFor], [FInvLinkCheckAmount], [FInvLinkCheckQty], [FPlanMode], [FMTONo], [FConfirmAdvice], [FSEOutInterID], [FSEOutEntryID], [FSEOutBillNo], [FUniDiscount], [FCommitAmt], [FCommitStdAmt], [FCommitAmtTax], [FCommitStdAmtTax], [FCommitTax], [FCommitStdTax], [FOnLineOrderNo], [FReturnNoticeBillNO], [FReturnNoticeEntryID], [FReturnNoticeInterID], [FClientOrderNo], [FClientEntryID], [FEntrySelfI0572])
select * from ais20230419test3.dbo.ICSaleEntry where finterid in (select finterid from ais20230419test3.dbo.ICSale where fdate>=‘2023-01-01’)
set IDENTITY_INSERT ICSaleEntry off
–受托加工表主表
insert into ICSTJGBill ([FBrNo], [FInterID], [FTranType], [FROB], [FDate], [FBillNo], [FStatus], [FCustID], [FDCStockID], [FSCStockID], [FINSCBillInterID], [FDeptID], [FUse], [FSManagerID], [FFManagerID], [FCheckerID], [FBillerID], [FMultiCheckLevel1], [FMultiCheckLevel2], [FMultiCheckLevel3], [FMultiCheckLevel4], [FMultiCheckLevel5], [FMultiCheckLevel6], [FMultiCheckDate1], [FMultiCheckDate2], [FMultiCheckDate3], [FMultiCheckDate4], [FMultiCheckDate5], [FMultiCheckDate6], [FCurCheckLevel], [FUpStockWhenSave], [FBackFlushed], [FWBInterID], [FCancellation], [FCheckDate], [FSelTranType], [FChildren], [FManageType], [FRelateBrID], [FPOOrdBillNo], [FBrID], [FPrintCount], [FOrderAffirm], [FHeadSelfA0631], [FHeadSelfA0632])
select [FBrNo], [FInterID], [FTranType], [FROB], [FDate], [FBillNo], [FStatus], [FCustID], [FDCStockID], [FSCStockID], [FINSCBillInterID], [FDeptID], [FUse], [FSManagerID], [FFManagerID], [FCheckerID], [FBillerID], [FMultiCheckLevel1], [FMultiCheckLevel2], [FMultiCheckLevel3], [FMultiCheckLevel4], [FMultiCheckLevel5], [FMultiCheckLevel6], [FMultiCheckDate1], [FMultiCheckDate2], [FMultiCheckDate3], [FMultiCheckDate4], [FMultiCheckDate5], [FMultiCheckDate6], [FCurCheckLevel], [FUpStockWhenSave], [FBackFlushed], [FWBInterID], [FCancellation], [FCheckDate], [FSelTranType], [FChildren], [FManageType], [FRelateBrID], [FPOOrdBillNo], [FBrID], [FPrintCount], [FOrderAffirm], [FHeadSelfA0631], [FHeadSelfA0632]
from ais20230419test3.dbo.ICSTJGBill where fdate>=‘2023-01-01’
–受托加工表明细
set IDENTITY_INSERT ICSTJGBillEntry on
insert into ICSTJGBillEntry ([FBrNo], [FInterID], [FEntryID], [FItemID], [FQty], [FAuxQty], [FQtyMust], [FAuxQtyMust], [FOPerID], [FBatchNo], [FNote], [FUnitID], [FSourceEntryID], [FCommitQty], [FAuxCommitQty], [FKFDate], [FKFPeriod], [FDCSPID], [FSCSPID], [FMapNumber], [FMapName], [FAuxPropID], [FSecCoefficient], [FSecQty], [FSecCommitQty], [FSourceTranType], [FSourceInterId], [FSourceBillNo], [FICMOBillNo], [FICMOInterID], [FPPBomEntryID], [FSCStockID], [FDCStockID], [FPeriodDate], [FOperSN], [FInStockID], [FPlanMode], [FMTONo], [FItemSize], [FItemSuite], [FPositionNo], [FDetailID], [FSelectedProcID])
select * from ais20230419test3.dbo.ICSTJGBillEntry where finterid in(select finterid from ais20230419test3.dbo.ICSTJGBill where fdate>=‘2023-01-01’)
set IDENTITY_INSERT ICSTJGBillEntry off
–发票单据关系表
insert into ICHookRelations ([FGroupNo], [FHookType], [FBrNo], [FIBTag], [FIBInterID], [FIBNo], [FNowCheck], [FPeriod], [FYear], [FEquityHook], [FDate], [FEntryID], [FItemID], [FAuxPropID], [FHookQty], [FCustID], [FSupplyID], [FHookerID], [FPOStyle], [FSaleStyle], [FHookAmount], [FTranType], [FHookOperateType])
select * from ais20230419test3.dbo.ICHookRelations where fyear>=2023
–供应链主表
insert into icstockbill ([FBrNo], [FInterID], [FTranType], [FDate], [FBillNo], [FUse], [FNote], [FDCStockID], [FSCStockID], [FDeptID], [FEmpID], [FSupplyID], [FPosterID], [FCheckerID], [FFManagerID], [FSManagerID], [FBillerID], [FReturnBillInterID], [FSCBillNo], [FHookInterID], [FVchInterID], [FPosted], [FCheckSelect], [FCurrencyID], [FSaleStyle], [FAcctID], [FROB], [FRSCBillNo], [FStatus], [FUpStockWhenSave], [FCancellation], [FOrgBillInterID], [FBillTypeID], [FPOStyle], [FMultiCheckLevel1], [FMultiCheckLevel2], [FMultiCheckLevel3], [FMultiCheckLevel4], [FMultiCheckLevel5], [FMultiCheckLevel6], [FMultiCheckDate1], [FMultiCheckDate2], [FMultiCheckDate3], [FMultiCheckDate4], [FMultiCheckDate5], [FMultiCheckDate6], [FCurCheckLevel], [FTaskID], [FResourceID], [FBackFlushed], [FWBInterID], [FTranStatus], [FZPBillInterID], [FRelateBrID], [FPurposeID], [FUUID], [FRelateInvoiceID], [FImport], [FSystemType], [FMarketingStyle], [FPayBillID], [FCheckDate], [FExplanation], [FFetchAdd], [FFetchDate], [FManagerID], [FRefType], [FSelTranType], [FChildren], [FHookStatus], [FActPriceVchTplID], [FPlanPriceVchTplID], [FProcID], [FActualVchTplID], [FPlanVchTplID], [FBrID], [FVIPCardID], [FVIPScore], [FHolisticDiscountRate], [FPOSName], [FWorkShiftId], [FCussentAcctID], [FZanGuCount], [FPOOrdBillNo], [FLSSrcInterID], [FSettleDate], [FManageType], [FOrderAffirm], [FAutoCreType], [FConsignee], [FDrpRelateTranType], [FPrintCount], [FPOMode], [FInventoryType], [FObjectItem], [FConfirmStatus], [FConfirmMem], [FConfirmDate], [FConfirmer], [FAutoCreatePeriod], [FYearPeriod], [FPayCondition], [FsourceType], [FReceiver], [FInvoiceStatus], [FHeadSelfA0143], [FHeadSelfA0230], [FHeadSelfA0231], [FHeadSelfA9738], [FHeadSelfA9739], [FHeadSelfB0939], [FHeadSelfB0940], [FHeadSelfD0134], [FHeadSelfB0435], [FHeadSelfA9740], [FHeadSelfA0232], [FHeadSelfB0155], [FHeadSelfC0231], [FHeadSelfC0131], [FHeadSelfA9741], [FHeadSelfB0941])
select [FBrNo], [FInterID], [FTranType], [FDate], [FBillNo], [FUse], [FNote], [FDCStockID], [FSCStockID], [FDeptID], [FEmpID], [FSupplyID], [FPosterID], [FCheckerID], [FFManagerID], [FSManagerID], [FBillerID], [FReturnBillInterID], [FSCBillNo], [FHookInterID], [FVchInterID], [FPosted], [FCheckSelect], [FCurrencyID], [FSaleStyle], [FAcctID], [FROB], [FRSCBillNo], [FStatus], [FUpStockWhenSave], [FCancellation], [FOrgBillInterID], [FBillTypeID], [FPOStyle], [FMultiCheckLevel1], [FMultiCheckLevel2], [FMultiCheckLevel3], [FMultiCheckLevel4], [FMultiCheckLevel5], [FMultiCheckLevel6], [FMultiCheckDate1], [FMultiCheckDate2], [FMultiCheckDate3], [FMultiCheckDate4], [FMultiCheckDate5], [FMultiCheckDate6], [FCurCheckLevel], [FTaskID], [FResourceID], [FBackFlushed], [FWBInterID], [FTranStatus], [FZPBillInterID], [FRelateBrID], [FPurposeID], [FUUID], [FRelateInvoiceID], [FImport], [FSystemType], [FMarketingStyle], [FPayBillID], [FCheckDate], [FExplanation], [FFetchAdd], [FFetchDate], [FManagerID], [FRefType], [FSelTranType], [FChildren], [FHookStatus], [FActPriceVchTplID], [FPlanPriceVchTplID], [FProcID], [FActualVchTplID], [FPlanVchTplID], [FBrID], [FVIPCardID], [FVIPScore], [FHolisticDiscountRate], [FPOSName], [FWorkShiftId], [FCussentAcctID], [FZanGuCount], [FPOOrdBillNo], [FLSSrcInterID], [FSettleDate], [FManageType], [FOrderAffirm], [FAutoCreType], [FConsignee], [FDrpRelateTranType], [FPrintCount], [FPOMode], [FInventoryType], [FObjectItem], [FConfirmStatus], [FConfirmMem], [FConfirmDate], [FConfirmer], [FAutoCreatePeriod], [FYearPeriod], [FPayCondition], [FsourceType], [FReceiver], [FInvoiceStatus], [FHeadSelfA0143], [FHeadSelfA0230], [FHeadSelfA0231], [FHeadSelfA9738], [FHeadSelfA9739], [FHeadSelfB0939], [FHeadSelfB0940], [FHeadSelfD0134], [FHeadSelfB0435], [FHeadSelfA9740], [FHeadSelfA0232], [FHeadSelfB0155], [FHeadSelfC0231], [FHeadSelfC0131], [FHeadSelfA9741], [FHeadSelfB0941]
from ais20230419test3.dbo.icstockbill where fdate>=‘2023-01-01’
–供应链明细
set IDENTITY_INSERT icstockbillentry on
insert into icstockbillentry ([FBrNo], [FInterID], [FEntryID], [FItemID], [FQtyMust], [FQty], [FPrice], [FBatchNo], [FAmount], [FNote], [FSCBillInterID], [FSCBillNo], [FUnitID], [FAuxPrice], [FAuxQty], [FAuxQtyMust], [FQtyActual], [FAuxQtyActual], [FPlanPrice], [FAuxPlanPrice], [FSourceEntryID], [FCommitQty], [FAuxCommitQty], [FKFDate], [FKFPeriod], [FDCSPID], [FSCSPID], [FConsignPrice], [FConsignAmount], [FProcessCost], [FMaterialCost], [FTaxAmount], [FMapNumber], [FMapName], [FOrgBillEntryID], [FOperID], [FPlanAmount], [FProcessPrice], [FTaxRate], [FSnListID], [FAmtRef], [FAuxPropID], [FCost], [FPriceRef], [FAuxPriceRef], [FFetchDate], [FQtyInvoice], [FQtyInvoiceBase], [FUnitCost], [FSecCoefficient], [FSecQty], [FSecCommitQty], [FSourceTranType], [FSourceInterId], [FSourceBillNo], [FContractInterID], [FContractEntryID], [FContractBillNo], [FICMOBillNo], [FICMOInterID], [FPPBomEntryID], [FOrderInterID], [FOrderEntryID], [FOrderBillNo], [FAllHookQTY], [FAllHookAmount], [FCurrentHookQTY], [FCurrentHookAmount], [FStdAllHookAmount], [FStdCurrentHookAmount], [FSCStockID], [FDCStockID], [FPeriodDate], [FCostObjGroupID], [FCostOBJID], [FDetailID], [FMaterialCostPrice], [FReProduceType], [FBomInterID], [FDiscountRate], [FDiscountAmount], [FSepcialSaleId], [FOutCommitQty], [FOutSecCommitQty], [FDBCommitQty], [FDBSecCommitQty], [FAuxQtyInvoice], [FOperSN], [FCheckStatus], [FSplitSecQty], [FInStockID], [FSaleCommitQty], [FSaleSecCommitQty], [FSaleAuxCommitQty], [FSelectedProcID], [FVWInStockQty], [FAuxVWInStockQty], [FSecVWInStockQty], [FSecInvoiceQty], [FCostCenterID], [FPlanMode], [FMTONo], [FSecQtyActual], [FSecQtyMust], [FClientOrderNo], [FClientEntryID], [FRowClosed], [FCostPercentage], [FItemSize], [FItemSuite], [FPositionNo], [FAcctCheck], [FClosing], [FDeliveryNoticeEntryID], [FDeliveryNoticeFID], [FIsVMI], [FEntrySupply], [FChkPassItem], [FSEOutInterID], [FSEOutEntryID], [FSEOutBillNo], [FConfirmMemEntry], [FWebReturnQty], [FWebReturnAuxQty], [FItemStatementBillNO], [FItemStatementEntryID], [FItemStatementInterID], [FCommitAmt], [FFatherProductID], [FRealAmount], [FRealPrice], [FDefaultBaseQty], [FDefaultQty], [FRealStockBaseQty], [FRealStockQty], [FDiscardID], [FOLOrderBillNo], [FLockFlag], [FReturnNoticeBillNO], [FReturnNoticeEntryID], [FReturnNoticeInterID], [FProductFileQty], [FServiceRequestNo], [FSplitState], [FQtySplit], [FAuxQtySplit], [FAddQty], [FAuxAddQty], [FPurchasePrice], [FPurchaseAmount], [FCheckAmount], [FEntrySelfB0857], [FEntrySelfA0163], [FEntrySelfA0164])
select * from ais20230419test3.dbo.icstockbillentry where finterid in (select finterid from ais20230419test3.dbo.icstockbill where fdate>=‘2023-01-01’)
set IDENTITY_INSERT icstockbillentry off

–采购订单主表
insert into poorder ([FBrNo], [FTranType], [FInterID], [FBillNo], [FSupplyID], [FDate], [FEmpID], [FDeptID], [FCurrencyID], [FCheckerID], [FBillerID], [FMangerID], [FClosed], [FTranStatus], [FExchangeRate], [FStatus], [FCancellation], [FPOStyle], [FMultiCheckLevel1], [FMultiCheckLevel2], [FMultiCheckLevel3], [FMultiCheckLevel4], [FMultiCheckLevel5], [FMultiCheckLevel6], [FMultiCheckDate1], [FMultiCheckDate2], [FMultiCheckDate3], [FMultiCheckDate4], [FMultiCheckDate5], [FMultiCheckDate6], [FCurCheckLevel], [FRelateBrID], [FOrderAffirm], [FCashDiscount], [FCheckDate], [FExplanation], [FFetchAdd], [FSettleDate], [FSettleID], [FSelTranType], [FChildren], [FBrID], [FPOOrdBillNo], [FAreaPS], [FClassTypeID], [FTotalCostFor], [FlastModyDate], [FManageType], [FSysStatus], [FVersionNo], [FChangeDate], [FChangeCauses], [FChangeMark], [FChangeUser], [FValidaterName], [FConsignee], [FPrintCount], [FExchangeRateType], [FDeliveryPlace], [FAccessoryCount], [FPOMode], [FPlanCategory], [FLastAlterBillNo], [FCloseUser], [FCloseDate], [FCloseCauses], [FHeadSelfP0255])
select [FBrNo], [FTranType], [FInterID], [FBillNo], [FSupplyID], [FDate], [FEmpID], [FDeptID], [FCurrencyID], [FCheckerID], [FBillerID], [FMangerID], [FClosed], [FTranStatus], [FExchangeRate], [FStatus], [FCancellation], [FPOStyle], [FMultiCheckLevel1], [FMultiCheckLevel2], [FMultiCheckLevel3], [FMultiCheckLevel4], [FMultiCheckLevel5], [FMultiCheckLevel6], [FMultiCheckDate1], [FMultiCheckDate2], [FMultiCheckDate3], [FMultiCheckDate4], [FMultiCheckDate5], [FMultiCheckDate6], [FCurCheckLevel], [FRelateBrID], [FOrderAffirm], [FCashDiscount], [FCheckDate], [FExplanation], [FFetchAdd], [FSettleDate], [FSettleID], [FSelTranType], [FChildren], [FBrID], [FPOOrdBillNo], [FAreaPS], [FClassTypeID], [FTotalCostFor], [FlastModyDate], [FManageType], [FSysStatus], [FVersionNo], [FChangeDate], [FChangeCauses], [FChangeMark], [FChangeUser], [FValidaterName], [FConsignee], [FPrintCount], [FExchangeRateType], [FDeliveryPlace], [FAccessoryCount], [FPOMode], [FPlanCategory], [FLastAlterBillNo], [FCloseUser], [FCloseDate], [FCloseCauses], [FHeadSelfP0255]
from ais20230419test3.dbo.POOrder where fdate>=‘2022-06-01’
–采购订单明细
set IDENTITY_INSERT poorderentry on
insert into poorderentry ([FBrNo], [FInterID], [FEntryID], [FItemID], [FQty], [FCommitQty], [FDate], [FPrice], [FAmount], [FTaxRate], [FTax], [FTaxAmount], [FNote], [FUnitID], [FAuxCommitQty], [FAuxPrice], [FAuxQty], [FSourceEntryID], [FCess], [FStockQty], [FAuxStockQty], [FMapNumber], [FMapName], [FAllAmount], [FAuxPropID], [FAuxPriceDiscount], [FPriceDiscount], [FQtyInvoice], [FQtyInvoiceBase], [FAuxTaxPrice], [FTaxPrice], [FReceiveAmountFor_Commit], [FReceiveAmount_Commit], [FSecCoefficient], [FSecQty], [FSecCommitQty], [FSourceTranType], [FSourceInterId], [FSourceBillNo], [FContractInterID], [FContractEntryID], [FContractBillNo], [FMRPLockFlag], [FAuxQtyInvoice], [FMrpClosed], [FDetailID], [FMapID], [FSProducingAreaID], [FAmtDiscount], [FCheckAmount], [FMrpAutoClosed], [FPayApplyAmountFor_Commit], [FPayApplyAmount_Commit], [FSecStockQty], [FSecInvoiceQty], [FPlanMode], [FMTONo], [FDescount], [FSupConfirm], [FSupConDate], [FSupConQty], [FSupConMem], [FSupConFetchDate], [FSupConfirmor], [FQualityRptBillID], [FLockByAlter], [FDeliveryQty], [FAuxDeliveryQty], [FSecDeliveryQty], [FRejectRefuseNote], [FRefuseNote], [FLockBySupplier], [FEntryAccessoryCount], [FPRInterID], [FPREntryID], [FAuxReceiptQty], [FReceiptQty], [FAuxReturnQty], [FReturnQty], [FCheckMethod], [FIsCheck], [FAmountExceptDisCount], [FAllAmountExceptDisCount], [FEntryDisCount], [FCommitAmt], [FCommitAmtTax], [FCommitTax], [FPayReqPayAmountFor], [FCloseEntryUser], [FCloseEntryDate], [FCloseEntryCauses], [fzs], [faddupqty])
select * from ais20230419test3.dbo.poorderentry where finterid in (select finterid from ais20230419test3.dbo.poorder where fdate>=‘2022-06-01’)
set IDENTITY_INSERT poorderentry off

–销售订单主表
insert into seorder (FBrNo, FInterID, FBillNo, FCurrencyID, FCustID, FDate, FPayStyle, FPayDate, FFetchStyle, FFetchDate, FFetchAdd, FSaleStyle, FDeptID, FEmpID, FCheckerID, FBillerID, FNote, FClosed, FTranType, FInvoiceClosed, FBClosed, FMangerID, FSettleID, FExchangeRate, FDiscountType, FStatus, FCancellation, FMultiCheckLevel1, FMultiCheckLevel2, FMultiCheckLevel3, FMultiCheckLevel4, FMultiCheckLevel5, FMultiCheckLevel6, FMultiCheckDate1, FMultiCheckDate2, FMultiCheckDate3, FMultiCheckDate4, FMultiCheckDate5, FMultiCheckDate6, FCurCheckLevel, FTransitAheadTime, FPOOrdBillNo, FRelateBrID, FImport, FOrderAffirm, FTranStatus, FUUID, FSystemType, FCashDiscount, FCheckDate, FExplanation, FSettleDate, FSelTranType, FChildren, FBrID, FAreaPS, FClassTypeID, FManageType, FSysStatus, FVersionNo, FChangeDate, FChangeCauses, FChangeMark, FChangeUser, FValidaterName, FConsignee, FDrpRelateTranType, FPrintCount, FExchangeRateType, FCustAddress, FPlanCategory, FHeadSelfS0152)
select FBrNo, FInterID, FBillNo, FCurrencyID, FCustID, FDate, FPayStyle, FPayDate, FFetchStyle, FFetchDate, FFetchAdd, FSaleStyle, FDeptID, FEmpID, FCheckerID, FBillerID, FNote, FClosed, FTranType, FInvoiceClosed, FBClosed, FMangerID, FSettleID, FExchangeRate, FDiscountType, FStatus, FCancellation, FMultiCheckLevel1, FMultiCheckLevel2, FMultiCheckLevel3, FMultiCheckLevel4, FMultiCheckLevel5, FMultiCheckLevel6, FMultiCheckDate1, FMultiCheckDate2, FMultiCheckDate3, FMultiCheckDate4, FMultiCheckDate5, FMultiCheckDate6, FCurCheckLevel, FTransitAheadTime, FPOOrdBillNo, FRelateBrID, FImport, FOrderAffirm, FTranStatus, FUUID, FSystemType, FCashDiscount, FCheckDate, FExplanation, FSettleDate, FSelTranType, FChildren, FBrID, FAreaPS, FClassTypeID, FManageType, FSysStatus, FVersionNo, FChangeDate, FChangeCauses, FChangeMark, FChangeUser, FValidaterName, FConsignee, FDrpRelateTranType, FPrintCount, FExchangeRateType, FCustAddress, FPlanCategory, FHeadSelfS0152 from ais20230419test3.dbo.seorder
where fdate>=‘2021-10-01’
–销售订单明细
set IDENTITY_INSERT seorderentry on
insert into seorderentry (FBrNO, FInterID, FEntryID, FItemID, FQty, FCommitQty, FPrice, FAmount, FTaxRate, FTaxAmount, FTax, FDiscount, FNote, FDate, FDiscountAmount, FInvoiceQty, FBCommitQty, FTranLeadTime, FATPDeduct, FCostObjectID, FUnitID, FAuxBCommitQty, FAuxCommitQty, FAuxInvoiceQty, FAuxPrice, FAuxQty, FUniDiscount, FFinalAmount, FSourceEntryID, FHaveMrp, FStockQty, FAuxStockQty, FBatchNo, FCESS, FAdviceConsignDate, FBomInterID, FMapNumber, FMapName, FLockFlag, FInForeCast, FAllAmount, FAllStdAmount, FAuxPropID, FAuxPriceDiscount, FPriceDiscount, FQtyInvoice, FQtyInvoiceBase, FTaxAmt, FAuxTaxPrice, FTaxPrice, FReceiveAmountFor_Commit, FReceiveAmount_Commit, FSecCoefficient, FSecQty, FSecCommitQty, FSourceTranType, FSourceInterId, FSourceBillNo, FContractInterID, FContractEntryID, FContractBillNo, FMRPLockFlag, FMRPTrackFlag, FOrderCommitQty, FOrderSecCommitQty, FAuxQtyInvoice, FCommitInstall, FAuxCommitInstall, FMrpClosed, FAuxInCommitQty, FInCommitQty, FSecInCommitQty, FApplyCommitQty, FAuxApplyCommitQty, FSecApplyCommitQty, FEvaluated, FPackUnitID, FPackCount, FPackType, FDetailID, FMapID, FGoodsDesc, FAmountAfterDiscount, FInformCommitQty, FAuxInformCommitQty, FSecInformCommitQty, FPurCommitQty, FAuxPurCommitQty, FSecPurCommitQty, FMrpAutoClosed, FSecStockQty, FSecInvoiceQty, FSecCommitInstall, FPlanMode, FMTONo, FOrderBillNo, FOrderEntryID, FDiffQtyClosed, FBOMCategory, FOrderBOMStatus, FOrderBOMInterID, FIsAltered, FAmountExceptDisCount, FAllAmountExceptDisCount, FEntryDisCount, FCommitAmt, FCommitAmtTax, FCommitTax, FIsAPS, FMeetDelivery, FOrderBOMEntryID, FEntrySelfS0165)
select * from ais20230419test3.dbo.seorderentry where finterid in (select finterid from ais20230419test3.dbo.seorder where fdate>=‘2021-10-01’)
set IDENTITY_INSERT seorderentry off

导入总账凭证

用系统提供的凭证引入,将凭证导入,然后现金,应收付与总账对账。数据正常再逐月结账
有同样需求的哥们欢迎QQ交流:55801172

注意问题

  1. 新账套数据与旧账套对照
  2. 报表的数据
  3. 即时库存的校对
  4. 各系统与总账对账
  • 12
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值