feat: 添加门店入库功能

This commit is contained in:
mkm 2024-09-26 17:21:44 +08:00
parent 8a66d91620
commit 4e2fcf669f
8 changed files with 76 additions and 9 deletions

View File

@ -37,6 +37,9 @@ class SystemStoreStorageController extends BaseApiController
return $this->dataLists(new SystemStoreStorageGroupLists());
}
/**
* @notes 门店入库
*/
public function warehousing_add() {
$params = $this->request->post();
$find=SystemStoreStorage::where('id',$params['id'])->find();

View File

@ -41,10 +41,18 @@ class StoreBranchProduct extends BaseModel
{
return $this->hasOne(StoreProduct::class,'id','product_id');
}
public static function onBeforeWrite($data)
{
try {
$where = $data->getWhere();
$find = self::where($where)->field(array_keys($data->toArray()))->find()->toArray();
channelLog(array_merge($find, $where),'branch_product','更新前');
} catch (Throwable $e) {
Log::error('branch_product:' . $e->getMessage());
}
}
public static function onAfterWrite($data){
try{
channelLog($data->getOrigin(),'branch_product','更新前');
channelLog($data->toArray(),'branch_product','更新后');
}catch(Throwable $e){
Log::error('branch_product:'.$e->getMessage());

View File

@ -101,9 +101,19 @@ class StoreOrder extends BaseModel
->group('days')->select()->toArray();
}
public static function onBeforeWrite($data)
{
try {
$where = $data->getWhere();
$find = self::where($where)->field(array_keys($data->toArray()))->find()->toArray();
channelLog(array_merge($find, $where),'store_order','更新前');
} catch (Throwable $e) {
Log::error('store_order:' . $e->getMessage());
}
}
public static function onAfterWrite($data){
try{
channelLog($data->getOrigin(),'store_order','更新前');
channelLog($data->toArray(),'store_order','更新后');
}catch(Throwable $e){
Log::error('store_order:'.$e->getMessage());

View File

@ -21,9 +21,19 @@ class StoreOrderCartInfo extends BaseModel
return $this->hasOne(StoreBranchProduct::class,'id','product_id')->bind(['store_name','image','unit','price']);
}
public static function onBeforeWrite($data)
{
try {
$where = $data->getWhere();
$find = self::where($where)->field(array_keys($data->toArray()))->find()->toArray();
channelLog(array_merge($find, $where),'store_order_cart_info','更新前');
} catch (Throwable $e) {
Log::error('store_order_cart_info:' . $e->getMessage());
}
}
public static function onAfterWrite($data){
try{
channelLog($data->getOrigin(),'store_order_cart_info','更新前');
channelLog($data->toArray(),'store_order_cart_info','更新后');
}catch(Throwable $e){
Log::error('store_order_cart_info:'.$e->getMessage());

View File

@ -33,10 +33,18 @@ class StoreProduct extends BaseModel
return $this->hasOne(StoreCategory::class,'id','cate_id')->bind(['class_name'=>'name']);
}
public static function onBeforeWrite($data)
{
try {
$where = $data->getWhere();
$find = self::where($where)->field(array_keys($data->toArray()))->find()->toArray();
channelLog(array_merge($find, $where),'product','更新前');
} catch (Throwable $e) {
Log::error('product:' . $e->getMessage());
}
}
public static function onAfterWrite($data){
try{
channelLog($data->getOrigin(),'product','更新前');
channelLog($data->toArray(),'product','更新后');
}catch(Throwable $e){
Log::error('product:'.$e->getMessage());

View File

@ -197,9 +197,17 @@ class User extends BaseModel
})->field("FROM_UNIXTIME($create_time,'$timeType') as days,count(id) as num")->group('days')->select()->toArray();
}
public static function onBeforeWrite($data){
try{
$where=$data->getWhere();
$find=self::where($where)->field(array_keys($data->toArray()))->find()->toArray();
channelLog(array_merge($find,$where),'user','更新前');
}catch(Throwable $e){
Log::error('user:'.$e->getMessage());
}
}
public static function onAfterWrite($data){
try{
channelLog($data->getOrigin(),'user','更新前');
channelLog($data->toArray(),'user','更新后');
}catch(Throwable $e){
Log::error('user:'.$e->getMessage());

View File

@ -19,9 +19,19 @@ class WarehouseProduct extends BaseModel
protected $name = 'warehouse_product';
protected $deleteTime = 'delete_time';
public static function onBeforeWrite($data)
{
try {
$where = $data->getWhere();
$find = self::where($where)->field(array_keys($data->toArray()))->find()->toArray();
channelLog(array_merge($find, $where),'warehouse_product','更新前');
} catch (Throwable $e) {
Log::error('warehouse_product:' . $e->getMessage());
}
}
public static function onAfterWrite($data){
try{
channelLog($data->getOrigin(),'warehouse_product','更新前');
channelLog($data->toArray(),'warehouse_product','更新后');
}catch(Throwable $e){
Log::error('warehouse_product:'.$e->getMessage());

View File

@ -18,10 +18,20 @@ class WarehouseProductStorege extends BaseModel
use SoftDelete;
protected $name = 'warehouse_product_storege';
protected $deleteTime = 'delete_time';
public static function onBeforeWrite($data)
{
try {
$where = $data->getWhere();
$find = self::where($where)->field(array_keys($data->toArray()))->find()->toArray();
channelLog(array_merge($find, $where), 'warehouse_product_storege', '更新前');
} catch (Throwable $e) {
Log::error('warehouse_product_storege:' . $e->getMessage());
}
}
public static function onAfterWrite($data)
{
try {
channelLog($data->getOrigin(), 'warehouse_product_storege', '更新前');
channelLog($data->toArray(), 'warehouse_product_storege', '更新后');
} catch (Throwable $e) {
Log::error('warehouse_product_storege:' . $e->getMessage());