Files
OMS/app/ome/controller/admin/branch/flow.php
2026-01-04 19:08:31 +08:00

132 lines
3.4 KiB
PHP

<?php
/**
* Copyright 2012-2026 ShopeX (https://www.shopex.cn)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class ome_ctl_admin_branch_flow extends desktop_controller
{
public $name = "仓业务设置";
public $workground = "goods_manager";
/**
* 货物流转类型
*
* @var string
* */
// private const FLOW_TYPE = [
// 'purchasein' => 'ASN入库',
// 'b2bout' => 'B2B出库',
// ];
/**
* index
* @return mixed 返回值
*/
public function index()
{
$params = [
'title' => '仓业务设置',
'actions' => [
[
'label' => '添加',
'href' => $this->url . '&act=add',
'target' => 'dialog::{width:600,height:300,title:\'仓业务设置\'}',
],
],
'use_buildin_new_dialog' => false,
'use_buildin_export' => false,
'use_buildin_import' => false,
'use_buildin_set_tag' => false,
'use_buildin_recycle' => false,
];
$this->finder('ome_mdl_branch_flow', $params);
}
/**
* 添加货物流转
*
* @return void
* @author
**/
public function add()
{
$columns = app::get('ome')->model('branch_flow')->_columns();
$this->pagedata['flowTypes'] = $columns['flow_type']['type'];
$branchTypes = kernel::single('ome_branch')->getBranchTypes();
$this->pagedata['branchTypes'] = $branchTypes;
$this->display('admin/branch/flow.html');
}
/**
* undocumented function
*
* @return void
* @author
**/
public function edit($id)
{
$this->pagedata['id'] = $id;
$columns = app::get('ome')->model('branch_flow')->_columns();
$this->pagedata['flowTypes'] = $columns['flow_type']['type'];
$flow = app::get('ome')->model('branch_flow')->dump($id);
$this->pagedata['flow'] = $flow;
$this->display('admin/branch/flow.html');
}
/**
* undocumented function
*
* @return void
* @author
**/
public function save()
{
$this->begin();
$flowMdl = app::get('ome')->model('branch_flow');
if(empty($_POST['id']) && $flowMdl->db_dump(['flow_type'=>$_POST['flow_type']])) {
$this->end(false, '已存在该业务');
}
$_POST['content'] = json_encode((array)$_POST['content']);
$rs = $flowMdl->save($_POST);
$this->end($rs, $rs?'保存成功':'保存失败:'.$flowMdl->db->errorinfo());
}
/**
* undocumented function
*
* @return void
* @author
**/
public function loadFlow($id, $type)
{
$res = kernel::single('ome_branch_flow_router',$type)->getContent($id);
echo $res;
}
}