SqlServer教程

ERP SQL Server

本文主要是介绍ERP SQL Server,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1、 表头:单据编号;日期;审核日期;制单人;审核人 表体:物料代码;物料名称;规格型号;订单数量;入库关联数量;出库关联数量 审核人(用户),审核时间在审核时自动更新 发布到前台供应链,仓储管理下
审核日期关联添加锁定,多级审核关联审核日期
在这里插入图片描述在这里插入图片描述完成截图
在这里插入图片描述

2、 打印功能点:原材料打印 按k3物料打印,只显示启用批次管理和保质期管理的物料; 打印样式:100*85;二维码包含条码信息;一维码包含物料代码;明文显示物料代码,物料名称,打印数量,批次号,保质期,条码信息;排版随意
原材料打印 数据源sql

Select 
t.FNumber as '物料代码', t.FName as '物料名称', t.FModel as '规格型号',t.Fhelpcode '助记码',
case when isnull(t.FBatchManager,0)=0 then null else Right(Convert(varchar(10),getdate(),112),6) end as '批次号',
case when isnull(t.FISKFPeriod,0)=0 then null else Convert(datetime, Convert(varchar(10),getdate(),23)) end as '生产日期',
Cast(t.FBatchAppendQty As Decimal(28,4)) as '包装数量', t1.FName as '计量单位',t.FSecCoefficient '换算率',
getdate() as '当前日期',Right(Convert(varchar(10),getdate(),112),6) as '日期',
t.FItemID as '物料内码',case when isnull(t.FISKFPeriod,0)=0 then 0 else cast( t.FKFPeriod as int)  end  as '有效期',
cast(0 as bit) as '是否VMI',
'' as '辅助属性',0 as '辅助属性内码',t1.FMeasureUnitID as '计量单位内码',
t3.fitemid as'仓库内码',t4.FSPID as '仓位内码',cast(0 as int) as '是否在库',
'' as '名称',0 as '内码',t.FAuxClassID '辅助属性类别','0' 文本
from t_icitem t
left join t_MeasureUnit t1 on t1.FItemID=t.FUnitID
left join t_stock t3 (nolock) on t.FDefaultLoc=t3.fitemid 
left join t_StockPlace t4 (nolock)on t4.FSPID =t.FSPID
where t.FDeleted=0 and t.FBatchManager=1 and t.FISKFPeriod=1

出现fcode冲突 是因为自定义格式重复了
在这里插入图片描述
完成截图
在这里插入图片描述

(按行订单分录匹配)

Select 
u.FBillNo '订单号',Convert(varchar(10),u.fdate,112) '订单日期',v.FIndex As '订单分录',v.fid '订单内码',
t.FNumber '物料代码',t.FName '物料名称',FModel '规格型号',
case when isnull(t.FBatchManager,0)=0 then null else Right(Convert(varchar(10),getdate(),112),6) end As  '批次号',
case when isnull(t.FISKFPeriod,0)=0 then null else Convert(datetime , Convert(varchar(10),getdate(),23)) end as '生产日期',
v.FQty-v.SQty '应收数量',t1.FName '计量单位',t.FSecCoefficient '换算率',
Cast(t.FBatchAppendQty As Decimal(28,4)) '包装数量', 
isnull(t5.fydqty,0) as '已打数量',v.FQty-isnull(t5.fydqty,0)'可打数量',
case when isnull(t.FISKFPeriod,0)=0 then 0 else cast(FKFPeriod as int) end  as '有效期',
'' as '辅助属性',t.FAuxClassID '辅助属性类别',cast(0 as int) as '是否在库',
getdate() As '当前日期',Right(Convert(varchar(10),getdate(),112),6) As '日期',
u.FiD '单据内码',v.Fbase '物料内码',0 '源单分录',0 '源单内码',
cast(t2.FItemID as varchar(50)) '供应商内码', 0 as '辅助属性内码',t1.FMeasureUnitID as '计量单位内码',
t3.fitemid as'仓库内码',t4.FSPID as '仓位内码',0 as'内码',u.fdate GYS订单日期
From t_BOS200000001 u (nolock)
Inner Join t_BOS200000001Entry2 v  (nolock) On u.FID = v.FID 
Left Join t_icitem t (nolock)On t.FItemID = v.fbase
Left Join t_MeasureUnit t1 (nolock) On t.FUnitID = t1.FMeasureUnitID
Left Join t_supplier t2 (nolock) On v.fbase  = t2.FItemID
left join t_stock t3 (nolock) on t.FDefaultLoc=t3.fitemid 
left join t_StockPlace t4 (nolock)on t4.FSPID =t.FSPID 
left join (SELECT  FInterID,FEntryID, SUM(flabelqty) AS fydqty
			FROM   BR_CodeInfo (nolock)
			WHERE ISNULL(FStatus,0) = 0 and FNumber='089'
			GROUP BY FInterID, FEntryID) t5 on  t5.finterid=v.fid and  t5.fentryid=v.fentryid  
where 1=1 and t.FBatchManager=1 and t.FISKFPeriod=1 and v.FQty-v.SQty>0

打印样式
原材料打印在这里插入图片描述

这篇关于ERP SQL Server的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!