药易通882588常问题语句归档.docx
- 文档编号:30253624
- 上传时间:2023-08-13
- 格式:DOCX
- 页数:143
- 大小:35.35KB
药易通882588常问题语句归档.docx
《药易通882588常问题语句归档.docx》由会员分享,可在线阅读,更多相关《药易通882588常问题语句归档.docx(143页珍藏版)》请在冰豆网上搜索。
药易通882588常问题语句归档
药易通软件常见BUG语句归档
SQL2000mdf无法附加或置疑恢复数据的修复方法
1.找到备份出来的mdf。
2.在企业管理器里新建一个同样名字的数据库。
注意:
我们软件创建的数据库名称为:
abc.mdf,在企业管理器里创建的名字会默认为:
abc_data.mdf,在企业管理器里创建时一定要把_data去掉,不然不会成功,要报错。
3.停掉sql服务器,然后把新建的mdf和log文件删除掉,用原来文件替换新建的数
据库文件,log文件不要。
4.启动数据库,并在企业管理器的数据库服务器上点右键找到属性,把其中服务器设置中允许对系统目
录直接进行修改选中。
5.把数据库改成紧急模式,查询分析器中执行:
sp_configure'allow',1
reconfigurewithoverride
updatesysdatabasessetstatus=32768wherename='数据库名'
6.重建log文件:
DBCCREBUILD_LOG('数据库名','D:
\TeenySoft\TSMed\Data\数据库名_Log.LDF')
7.恢复数据库紧急模式
updatesysdatabasessetstatus=0wherename='数据库名'
8.把服务器设置中允许对系统目录直接进行修改取消。
至此已完成。
9.然后用DBCCCHECKDB('数据库名')看看有没有错误
sql2000数据损坏表损坏修复
--首先打开我们软件的数据服务器.重建表索引,收缩数据库,只要能重建成功的数据一般都可以修复好.
sp_dboption@DBNAME='数据库名',@OPTNAME='SINGLEUSER',@OPTVALUE='TRUE'
--@OPTVALUETRUE单一用户独占模式FALSE单一用户独占模式释放
DBCCCHECKDB('数据库名',REPAIR_ALLOW_DATA_LOSS)
sp_dboption@DBNAME='数据库名',@OPTNAME='SINGLEUSER',@OPTVALUE='False'
--总共三句,一句一句运行,在master数据库中运行,运行完第三条后,在药易通数据服务器的工具下重建一下表索引后,检测一下看有没有错误,如果没有错误后即可.
常用查询
查看已删除商品
select*
fromproducts
wheredeleted=1
超级用户口令管理_clear.sql
updateusers
setloginpass=0
wheree_id=1
超级用户口令管理_look.sql
selectcast(loginpassasvarchar)
fromusers
wheree_id=1
恢复已删除商品.sql
Updateproductssetdeleted=0
wheredeleted=1
门店物价批量复制.sql
declare@fromPosidint,@toPOSidint
---select*fromshopwhereposName=''
--从门店信息表里找到门店的POSID,记下从哪个门店,到哪个门店
---
---
set@fromposid=1--从哪个门店价格
set@toPosid=2--到哪个门店价格
deletefrompospricewherepos_id=@toPosid
insertintoposprice
select@toPosid,p_id,u_id,retailprice,recprice,price1,
price2,price3,price4,gpPrice,glprice,specialprice,unittype,lowprice
fromposprice
wherepos_id=@fromposid
删除红字单据.sql
deletefromsalemanagebillwherebill_idin
(selectbillidfrombillidxwherebillstates='1'orbillstates='4')
deletefrombuymanagebillwherebill_idin
(selectbillidfrombillidxwherebillstates='1'orbillstates='4')
deletefromstoremanagebillwherebill_idin
(selectbillidfrombillidxwherebillstates='1'orbillstates='4')
deletefromproductdetailwherebillidin
(selectbillidfrombillidxwherebillstates='1'orbillstates='4')
deletefromaccountdetailwherebillidin
(selectbillidfrombillidxwherebillstates='1'orbillstates='4')
deletefrombillidxwherebillstates='1'orbillstates='4'
显示红字单据.sql
select*frombillidxwherebillstates='1'orbillstates='4'
用序号联查(商品及编码).sql
declare@w1int
set@w1=312
select*
fromproducts
whereproduct_id=@w1
select*
frombarcode
wherep_id=@w1
重建商品库索引.sql
DBCCDBREINDEX(products,'',70)
转换国零价.sql
declare@posidint
set@posid=1--要填写的门店ID
updatepospricesetretailPrice=t.glprice
from(selectp_id,glpricefromprice)ast
wherepos_id=@posidandposprice.P_id=t.p_id
自动编号
(2).sql
deletefrombarcode
wherelen(barcode)<=6--删除编码库中小于6位的编码
insertbarcode(p_id,barcode)selectproduct_id,''fromproductswhereproduct_id<>1anddeleted=0
updatebarcodesetbarcode=right(cast(10000+p_idasvarchar),4)wherelen(barcode)<6
--重新对新入编短码_码不变
自动编号(全).sql
--truncatetablebarcode--直接删除编码库
deletefrombarcode
wherelen(barcode)<=6--删除编码库中小于6位的编码
insertbarcode(p_id,barcode)selectproduct_id,''fromproductswhereproduct_id<>1anddeleted=0
updatebarcodesetbarcode=right(cast(10000+p_idasvarchar),4)wherelen(barcode)<6
--重新对新入编短码_码不变
--insertbarcode(p_id,barcode)selectproduct_id,''fromproductswhereproduct_id<>1anddeleted=0
--updatebarcodesetbarcode=right(cast(10000+barcode_idasvarchar),4)wherelen(barcode)<6
--重新对新入编短码_码要变换
无库存过账产生负库存记录
SETQUOTED_IDENTIFIERON
GO
SETANSI_NULLSON
GO
ifexists(select*fromdbo.sysobjectswhereid=object_id(N'[dbo].[ts_c_ModifyP]')andOBJECTPROPERTY(id,N'IsProcedure')=1)
dropprocedure[dbo].[ts_c_ModifyP]
GO
/*
--------Returnvalues--------
0:
成功
-1:
负库存
-2:
-3:
数量为零
-4:
期初不能修改
-5:
无成本价
-6:
异常错误
-7:
已经开帐,数据不能修改
-22:
未设置当前机构,不允许单据过账
-----------------------------
*/
createPROCEDUREts_c_ModifyP
(
@nBillTypenumeric(4,0),--单据类型号
@nCostTypeint,--成本核算法
@nP_idint,--商品id
@nS_idint,--仓库id
@nL_idintoutput,--货位id
@nStoreTypeint,--库存余量库类型0:
Normal1:
dx2:
Br
@nPriceIdint,--Price库Id
@szBatchNovarchar(20)output,--批号
@szPeriodvarchar
(2),--会计期号
@dQtyInnumeric(18,4),--数量
@dCostTotalInnumeric(18,4),--总金额
@dCostPriceInnumeric(18,4)output,--传入成本单价
@MakeDatedatetime=nulloutput,--生产日期
@ValidDatedatetime=nulloutput,--效期
@nSupplier_idInintoutput,--供应商id
@nCommissionflagInintoutput,--代销商品标记
@dCostTotalOutnumeric(18,4)output,--返回成本金额
@ReturnNumberintoutput,--返回代码
@nBillidnumeric(10,0),
@OldCommissionflagint=0,
@tInstoretimedatetime=nulloutput,--入库时间
@nY_IDint,
@batchbarcodevarchar(80)='',
@scommentvarchar(80)='',
@batchpricefloat=0
)
--withencryption
AS
--ParamsInibegin
if@MakeDateisnullSET@MakeDate=null
if@ValidDateisnullSET@ValidDate=null
if@OldCommissionflagisnullSET@OldCommissionflag=0
if@tInstoretimeisnullSET@tInstoretime=null
if@batchbarcodeisnullSET@batchbarcode=''
if@scommentisnullSET@scomment=''
if@batchpriceisnullSET@batchprice=0
--ParamsIniend
setnocounton
if@makedate<10set@makedate=0
if@validdate<10set@validdate=0
--------Someaccountid
declare
@Asset_Idint,--2【资产合计】
@Products_Idint,--3『库存商品总值合计』
@FixedAsset_idint,--4『固定资产合计』
@FixedAsset1_idint,--5固定资产__甲
@Cash_idint,--6现金
--7『全部银行存款合计』
--8银行户头_1
@ArTotal_Idint,--9『应收款合计』
@Lendout_Idint,--10『借出商品』
@Dt_Expens_Idint,--11待摊费用
@Wt_Comm_Idint,--12委托代销商品
@St_Comm_Idint,--13受托代销商品
--14【负债合计】
@ApTotal_Idint,--15『应付帐款合计』
@Brrowin_Idint,--16『借入商品』
@DxTotal_Idint,--17代销商品款
--18应交税金
--19【收入类】
@SaleIncome_Idint--20『销售收入』
--21『商品类收入』
/*Product_22商品报溢收入
23商品获赠收入
24成本调价收入
25进货退货差价
26变价调拨差价
27商品拆装差价
28借转进货结算与成本差
29受托代销结算差价
30『其它收入』
31调帐收入
32利息收入
33其它....
34【支出类】
35『销售成本』
36『商品类支出』
37商品报损
38商品赠出
39『费用合计』
40调帐亏损
41固定资产折旧
42其它....
43【所有者权益】
44实收资本
45资本公积
46盈余公积
47本年利润
48利润分配
49【利润】
54进项税
55销项税
*/
select@Asset_Id=2--【资产合计】
select@Products_Id=3--『库存商品总值合计』
select@FixedAsset_id=4--『固定资产合计』
select@Cash_id=6--现金
--7『全部银行存款合计』
--8银行户头_1
select@ArTotal_Id=9--9『应收款合计』
select@Lendout_Id=10--10『借出商品』
select@Dt_Expens_Id=11--11待摊费用
select@Wt_Comm_Id=12--12委托代销商品
select@St_Comm_Id=13--13受托代销商品
--14【负债合计】
select@ApTotal_Id=15--15『应付帐款合计』
select@Brrowin_Id=16--16『借入商品』
select@DxTotal_Id=17--17代销商品款
--18应交税金
--19【收入类】
select@SaleIncome_Id=20--20『销售收入』
-------成本核算------------
declare@MOVEAVERAGEchar
(1)--移动加权平均
declare@FIFOchar
(1)--先进先出
declare@LIFOchar
(1)--后进先出
declare@SINGLEchar
(1)--个别记价
declare@VALID_DATEchar
(1)--近效期先出
--declare@AVERAGEchar
(1)--加权平均
select@MOVEAVERAGE='0'
select@FIFO='1'
select@LIFO='2'
select@SINGLE='3'
select@VALID_DATE='4'
--select@AVERAGE='5'
---------------------
declare@nSupplier_idint--供应商id
declare@nCommissionflagint--代销商品标记
declare@nLocation_idint
declare@dQuantitynumeric(18,4),@dCosttotalnumeric(18,4),@dCostPricenumeric(18,4)
declare@tMakedatedatetime,@tValiddatedatetime,@szBatchNoTempvarchar(30)
declare@dCostPricetempnumeric(18,4),@dCosttotalTempnumeric(18,4),@dQtyTempnumeric(18,4),@dPricetempnumeric(18,4)
--declare@szY_IDvarchar(10),@nY_IDint--当前机构
declare@cNegativeStockchar
(1)--是否允许负库存
declare@cRecpriceAsCostchar
(1)--是否使用最近进价作为成本价
declare@nStopsaleflagbit--停售标志
declare@nInorderint--入库顺序号
--declare@tInstoretimedatetime--入库时间
declare@tmpInstoretimedatetime--入库时间
declare@tYhDatedatetime--上次养护时间zhh添加
declare@PosLocchar
(1)--是否管理门店仓库货位
declare@StorageTypeint--门店仓库类型
--if@nbillid<>0select@tInstoretime=billdatefrombillidxwherebillid=@nbillid
--elseselect@tInstoretime=convert(varchar(10),getdate(),20)
declare@cUseSameCostMethodvarchar
(2),@nCostMethodvarchar
(2)
declare@nQtyNagtivenumeric(18,4)--处理个别计价负库存出库
declare@AduitByBatchnovarchar
(1)--零售出库只管批号
set@AduitByBatchno='0'
select@AduitByBatchno=sysvaluefromsysconfigtmpwheresysname='AduitByBatchno'
declare@ifOnlinechar
(1)--用于判断是否离线模式
select@ifOnline=posdatamodefromcompanywherecompany_id=@nY_ID
declare@nPubyidint--当前帐套yid用于判断是否总部帐套
select@nPubyid=isnull(sysvalue,'2')fromsysconfigwheresysname='y_id'
set@storagetype=0
select@storagetype=flagfromstorageswherestorage_id=@nS_id
declare@ifNegRetailOutint--离线模式单据是否可以无条件过账
set@ifNegRetailOut=0
if@nPubyid<>@nY_IDand@StorageType=1and@ifOnline=1
begin
set@ifNegRetailOut=1
end
declare@nNegQtynumeric(18,4)--负库存数量
set@nNegQty=0
----------得到成本核算法
--if@bKeepCostMethod<>1
--begin
--exects_getsysvalue'UseSameCostMethod',@cUseSameCostMethodout--是否使用同一成本核算法
--if@cUseSameCostMethod='1'--系统使用统一成本核算
--begin
--exects_getsysvalue'CostMethod',@nCostMethodout
--set@nCostType=cast(@nCostMethodasint)
--endelseif@cUseSameCostMethod='0'--系统不使用统一成本核算,得到该商品成本算法
--begin
--set@nCostType=dbo.GetcostNo(@nP_id)
--end
--end
--当入库时间不做为批次条件时且为入库时处理
if(@nCostType<>0)and(@dQtyIn>0)
begin
ifexists(selec
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 药易通 882588 问题 语句 归档
![提示](https://static.bdocx.com/images/bang_tan.gif)