電子商取引プラットフォーム実戦の在庫とERPドッキングソリューション
7247 ワード
需要分析
現在のシステムの在庫は商品と商品のためで、店舗に細分化されていないが、最近のいくつかのプロジェクトの顧客の需要に基づいて、一部の顧客の需要在庫は店舗に詳しく、ERPシステムの在庫とのドッキングに関連している.そのため、これらのニーズに適応するためにシステムを改善するとともに、店舗に細分化する必要のないシステムと互換性を維持することを保証する必要がある.
現在の解決策は、在庫情報を独立して商品、品物、店舗に関連し、商品が店舗を必要としない場合、本店に属することである.
また、在庫にはロック在庫が追加されており、出荷時にのみ実際の在庫を差し引くことになります.
テーブルの構造変更表:ZtdGoodsStock フィールド名
を選択します.
長さ
空の許可
コメント
ID
Int
いいえ
オートインクリメントID
ProductID
Int
いいえ
商品ID
GoodsID
Int
いいえ
商品ID
GoodsNo
Varchar
20
いいえ
品番
ZtdNo
Varchar
50
いいえ
店舗番号
Stock
Int
いいえ
在庫品
LockStock
Int
いいえ
在庫ロック
プロセスの記録
1、商品情報処理 1.1商品追加修正時の処理商品を追加する場合は、まず商品情報と商品情報を追加し、その後、店舗在庫表に記録(デフォルトで本店に追加)を挿入し、その後、商品と商品のすべての店舗での在庫を統計し、商品と商品の在庫を更新する.ストレージ・プロシージャの制御は、 です.
品目ID集合仮表を構築し、品目在庫情報を店舗在庫表(本店)に追加する
すべての店舗の在庫を統計し、商品と商品表の在庫を更新する
商品を修正する場合は、まず商品と商品情報(店舗在庫表を更新する必要がある場合があります)を修正し、ここで商品と商品のすべての店舗での在庫を統計し、商品表と商品表に更新します.
多規格の場合
存在しない品目の削除
品物を更新する.
新製品の挿入
すべての店舗の在庫を統計し、商品と商品表の在庫を更新する
多規格がない場合
マルチスペックキャンセル時のデータの削除
店舗在庫の更新
すべての店舗の在庫を統計し、商品と商品表の在庫を更新する
商品を削除する場合、同時に店舗対応の在庫を削除します. 1.2店舗バックグラウンド更新在庫 1.3 erp同期在庫 2、注文プロセスの処理 2.1詳細ページカート判定 に加わる 2.2カートページ更新カート 2.3注文生成時の判断 2.4バックグラウンドキャンセル 2.5出荷 未完待续(笔者は仕事が忙しくて更新できないので、辛抱強く待ってください...、问题があればメッセージ)
転載は明記してください:特維のブログ»電子商取引プラットフォーム実戦の在庫とERPドッキングソリューション
現在のシステムの在庫は商品と商品のためで、店舗に細分化されていないが、最近のいくつかのプロジェクトの顧客の需要に基づいて、一部の顧客の需要在庫は店舗に詳しく、ERPシステムの在庫とのドッキングに関連している.そのため、これらのニーズに適応するためにシステムを改善するとともに、店舗に細分化する必要のないシステムと互換性を維持することを保証する必要がある.
現在の解決策は、在庫情報を独立して商品、品物、店舗に関連し、商品が店舗を必要としない場合、本店に属することである.
また、在庫にはロック在庫が追加されており、出荷時にのみ実際の在庫を差し引くことになります.
テーブルの構造変更
を選択します.
長さ
空の許可
コメント
ID
Int
いいえ
オートインクリメントID
ProductID
Int
いいえ
商品ID
GoodsID
Int
いいえ
商品ID
GoodsNo
Varchar
20
いいえ
品番
ZtdNo
Varchar
50
いいえ
店舗番号
Stock
Int
いいえ
在庫品
LockStock
Int
いいえ
在庫ロック
プロセスの記録
1、商品情報処理
品目ID集合仮表を構築し、品目在庫情報を店舗在庫表(本店)に追加する
...
-- :#g
insert into goods(productid,goodsno,marketprice,memberprice,weight,volume,score,storage,goodsname,supplierid,props,propsdesc,propsname,costprice) select * from #g
-- ID
select props,g.goodsid into #goodsids from goods g(nolock)
where g.productid=@productid --and g.goodsid not in(select goodsid from #g) by liwenhai 20130717
-- ( )
select g.ProductID,g.GoodsID,g.GoodsNo,'0' as ZtdNo,g.Storage as stock,0 as LockStock into #zgs from #goodsids gt,goods g(nolock)
where gt.goodsid=g.goodsid
insert into ZtdGoodsStock(ProductID,GoodsID,GoodsNo,ZtdNo,Stock,LockStock)
select * from #zgs
...
すべての店舗の在庫を統計し、商品と商品表の在庫を更新する
...
------------------------------------------------------------------------
-- --------------------------------------------------------
-------------------------------------------------------------------------
--
--
--
update goods set storage=isnull((select sum(zgs.stock) from ztdgoodsstock zgs where g.goodsid=zgs.goodsid),0)
from #goodsids g
--
update product set storage=isnull((select sum(g.storage) from goods g(nolock) where g.productid=@productid),0)
...
-------------------------------------------------------------
-- --------------------------------------------
--------------------------------------------------------------
...
-- id
select @gid=@@identity
-- ( )
insert into ZtdGoodsStock(ProductID,GoodsID,GoodsNo,ZtdNo,Stock) values (@productid,@gid,@productno,'0',@storage)
--
--
--
update goods set storage=(select sum(zgs.Stock) from ZtdGoodsStock as zgs where GoodsID=@gid group by zgs.GoodsId) where GoodsID=@gid
--
update Product set Storage =(select sum(storage) FROM Goods as g where g.ProductID=@productid) where ProductID=@productid
...
商品を修正する場合は、まず商品と商品情報(店舗在庫表を更新する必要がある場合があります)を修正し、ここで商品と商品のすべての店舗での在庫を統計し、商品表と商品表に更新します.
多規格の場合
存在しない品目の削除
--
delete from goods where goods.productid=@productid and goods.goodsid not in (select goodsid from #g where #g.goodsid'')
--
delete from ztdgoodsstock where productid=@productid and ztdgoodsstock.goodsid not in(select goodsid from #g where #g.goodsid'')
品物を更新する.
--
update g
set g.goodsno=gt.goodsno,g.marketprice=gt.marketprice,g.memberprice=gt.memberprice,g.weight=gt.weight,g.score=gt.score,/*g.storage=gt.storage,*/g.goodsname=gt.goodsname,g.props=gt.props,g.propsdesc=gt.propsdesc,g.propsname=gt.propsname,costprice=gt.costprice
from goods g(nolock),#g gt
where g.goodsid=gt.goodsid
--
update zgs
set zgs.goodsno=gt.goodsno,zgs.stock=gt.storage
from ztdgoodsstock zgs,#g gt
where zgs.goodsid=gt.goodsid and zgs.ztdno='0'
新製品の挿入
--
insert into goods(productid,goodsno,marketprice,memberprice,weight,volume,score,storage,goodsname,supplierid,props,propsdesc,propsname,costprice)
select productid,goodsno,marketprice,memberprice,weight,volume,score,storage,goodsname,supplierid,props,propsdesc,propsname,costprice
from #g where #g.goodsid=''
--
select g.ProductID,g.GoodsID,g.GoodsNo,'0' as ZtdNo,g.Storage as stock,0 as LockStock into #zgs from #g gt
left join Goods g(nolock) on gt.goodsno=g.goodsno
where gt.goodsid not in(select GoodsID from goods g where g.productid=@productid)
--
insert into ZtdGoodsStock(ProductID,GoodsID,GoodsNo,ZtdNo,Stock,LockStock)
select * from #zgs
すべての店舗の在庫を統計し、商品と商品表の在庫を更新する
--
--
--
update goods set storage= tb.stock
from
(
select goodsid,sum(zgs.stock) as stock
from ztdgoodsstock zgs(nolock)
where zgs.productid=@productid
group by zgs.goodsid
) as tb
where goods.goodsid=tb.goodsid
--update goods set storage=isnull((select sum(zgs.stock) from ztdgoodsstock zgs(nolock),#g g(nolock) where zgs.goodsid=g.goodsid group by zgs.goodsid),0)
--
update product set storage=isnull((select sum(g.storage) from goods g(nolock) where g.productid=@productid),0)
多規格がない場合
マルチスペックキャンセル時のデータの削除
update top (1) goods
set goodsno=@productno,marketprice=@marketprice,memberprice=@memberprice,weight=@weight,volume=@Volume,score=@score,/*storage=@storage,*/goodsname=@productname,props=null,propsdesc=null,costprice=@costprice
where productid=@productid
--
delete from goods where isnull(props,'')'' and isnull(propsdesc,'')'' and productid=@productid
-- goodsid, groupprice
declare @gid int
select @gid=goodsid from goods g(nolock)where productid=@productid
--
delete from ztdgoodsstock where goodsid@gid and productid=@productid
店舗在庫の更新
-- ( )
update top(1) ztdgoodsstock
set stock=@storage
where productid=@productid
すべての店舗の在庫を統計し、商品と商品表の在庫を更新する
--
--
--
update goods set storage=(select sum(zgs.Stock) from ZtdGoodsStock as zgs where zgs.productid=@productid group by zgs.GoodsId) where productid=@productid
--
update Product set Storage =(select sum(storage) FROM Goods as g where g.ProductID=@productid) where ProductID=@productid
商品を削除する場合、同時に店舗対応の在庫を削除します.
--
delete ztdgoodsstock from ztdgoodsstock,#temp where ztdgoodsstock.productid=#temp.[value]
--
delete goods from goods,#temp where goods.productid=#temp.[value]
--
delete product from product,#temp where product.productid=#temp.[value]
転載は明記してください:特維のブログ»電子商取引プラットフォーム実戦の在庫とERPドッキングソリューション