mirror of
https://gitee.com/ShopeX/OMS
synced 2026-04-20 12:05:43 +08:00
1. 【新增】售后单售后原因类型支持搜索
2. 【新增】手工创建订单折扣可输入正数 3. 【优化】盘点申请单确认 4. 【修复】采购退货单模拟出库失败问题 5. 【新增】订单金额客户实付与结算金额 6. 【优化】仓库发货统计报表物料名称显示 7. 【优化】自有仓储虚拟发货逻辑 8. 【修复】基础物料分类管理问题
This commit is contained in:
137
app/ticket/model/workflow/case.php
Normal file
137
app/ticket/model/workflow/case.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
/**
|
||||
* 审批流实例模型类
|
||||
*
|
||||
* @author shopex开发团队
|
||||
* @version 2025.07.10
|
||||
*/
|
||||
class ticket_mdl_workflow_case extends dbeav_model {
|
||||
// 可根据需要扩展model方法
|
||||
|
||||
/**
|
||||
* 审核状态列表
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getStatusList()
|
||||
{
|
||||
return array(
|
||||
'pending' => '待审批',
|
||||
'processing' => '审批中',
|
||||
'approved' => '同意',
|
||||
'rejected' => '拒绝',
|
||||
'cancelled' => '取消',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 业务类型列表
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBillTypeList()
|
||||
{
|
||||
return array(
|
||||
'order' => ['bill_type'=>'order', 'bill_name'=>'订单'],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取审批场景类型列表
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSceneTypes()
|
||||
{
|
||||
$templateMdl = app::get('ticket')->model('workflow_template');
|
||||
|
||||
$typeList = $templateMdl->getSceneTypes();
|
||||
|
||||
return $typeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取审批人类型列表
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAssigneeTypes()
|
||||
{
|
||||
$nodeMdl = app::get('ticket')->model('workflow_node');
|
||||
|
||||
$typeList = $nodeMdl->getAssigneeTypes();
|
||||
|
||||
return $typeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态获取实例列表
|
||||
*
|
||||
* @param string $status
|
||||
* @return array
|
||||
*/
|
||||
public function getCasesByStatus($status)
|
||||
{
|
||||
return $this->getList('*', array('status' => $status), 0, -1, 'id DESC');
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据审批人获取待审批实例
|
||||
*
|
||||
* @param int $assignee_id
|
||||
* @param string $assignee_type
|
||||
* @return array
|
||||
*/
|
||||
public function getPendingCasesByAssignee($assignee_id, $assignee_type = 'user')
|
||||
{
|
||||
return $this->getList('*', array(
|
||||
'assignee_id' => $assignee_id,
|
||||
'assignee_type' => $assignee_type,
|
||||
'status' => 'pending'
|
||||
), 0, -1, 'id DESC');
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成审批号
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function generateCaseBn()
|
||||
{
|
||||
$prefix = 'WF' . date('Ymd');
|
||||
$maxBn = $this->getList('MAX(case_bn) as max_bn', array('case_bn|like' => $prefix . '%'));
|
||||
$maxNum = 0;
|
||||
|
||||
if(isset($maxBn[0]['max_bn']) && $maxBn[0]['max_bn']){
|
||||
$maxNum = intval(substr($maxBn[0]['max_bn'], -4));
|
||||
}
|
||||
|
||||
return $prefix . str_pad($maxNum + 1, 4, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取审核状态
|
||||
*
|
||||
* @param $col
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function modifier_status($col)
|
||||
{
|
||||
$StatusList = $this->getStatusList();
|
||||
|
||||
return isset($StatusList[$col]) ? $StatusList[$col] : $col;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务类型
|
||||
*
|
||||
* @param $col
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function modifier_bill_type($col)
|
||||
{
|
||||
$typeList = $this->getBillTypeList();
|
||||
|
||||
return isset($typeList[$col]) ? $typeList[$col]['bill_name'] : $col;
|
||||
}
|
||||
}
|
||||
50
app/ticket/model/workflow/node.php
Normal file
50
app/ticket/model/workflow/node.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* 审批流节点模型类
|
||||
*
|
||||
* @author shopex开发团队
|
||||
* @version 2025.07.10
|
||||
*/
|
||||
class ticket_mdl_workflow_node extends dbeav_model {
|
||||
// 可根据需要扩展model方法
|
||||
|
||||
/**
|
||||
* 获取节点类型列表
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getNodeTypes()
|
||||
{
|
||||
return array(
|
||||
'start' => '开始',
|
||||
'approval' => '审批',
|
||||
'end' => '结束',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取审批人类型列表
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAssigneeTypes()
|
||||
{
|
||||
return array(
|
||||
'user' => '用户',
|
||||
//'role' => '角色',
|
||||
//'dept' => '部门',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模板的下一个节点顺序号
|
||||
*
|
||||
* @param int $template_id
|
||||
* @return int
|
||||
*/
|
||||
public function getNextStepOrder($template_id)
|
||||
{
|
||||
$maxOrder = $this->getList('MAX(step_order) as max_order', array('template_id' => $template_id));
|
||||
return isset($maxOrder[0]['max_order']) ? $maxOrder[0]['max_order'] + 1 : 1;
|
||||
}
|
||||
}
|
||||
171
app/ticket/model/workflow/record.php
Normal file
171
app/ticket/model/workflow/record.php
Normal file
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
/**
|
||||
* 审批流记录模型类
|
||||
*
|
||||
* @author shopex开发团队
|
||||
* @version 2025.07.10
|
||||
*/
|
||||
class ticket_mdl_workflow_record extends dbeav_model {
|
||||
// 可根据需要扩展model方法
|
||||
|
||||
/**
|
||||
* 获取操作类型列表
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getActionList()
|
||||
{
|
||||
return array(
|
||||
'approved' => '同意',
|
||||
'rejected' => '拒绝',
|
||||
'forward' => '转发',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取状态列表
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getStatusList()
|
||||
{
|
||||
return array(
|
||||
'pending' => '待审批',
|
||||
'processing' => '审批中',
|
||||
'approved' => '同意',
|
||||
'rejected' => '拒绝',
|
||||
'cancelled' => '取消',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取审批人类型列表
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAssigneeTypes()
|
||||
{
|
||||
$nodeMdl = app::get('ticket')->model('workflow_node');
|
||||
|
||||
$typeList = $nodeMdl->getAssigneeTypes();
|
||||
|
||||
return $typeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据案例ID获取记录列表
|
||||
*
|
||||
* @param int $case_id
|
||||
* @return array
|
||||
*/
|
||||
public function getRecordsByCaseId($case_id)
|
||||
{
|
||||
return $this->getList('*', array('case_id' => $case_id), 0, -1, 'id DESC');
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据节点ID获取记录列表
|
||||
*
|
||||
* @param int $node_id
|
||||
* @return array
|
||||
*/
|
||||
public function getRecordsByNodeId($node_id)
|
||||
{
|
||||
return $this->getList('*', array('node_id' => $node_id), 0, -1, 'id DESC');
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据审批人获取记录列表
|
||||
*
|
||||
* @param int $assignee_id
|
||||
* @param string $assignee_type
|
||||
* @return array
|
||||
*/
|
||||
public function getRecordsByAssignee($assignee_id, $assignee_type = 'user')
|
||||
{
|
||||
return $this->getList('*', array(
|
||||
'assignee_id' => $assignee_id,
|
||||
'assignee_type' => $assignee_type
|
||||
), 0, -1, 'id DESC');
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据操作类型获取记录列表
|
||||
*
|
||||
* @param string $action
|
||||
* @return array
|
||||
*/
|
||||
public function getRecordsByAction($action)
|
||||
{
|
||||
return $this->getList('*', array('action' => $action), 0, -1, 'id DESC');
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态获取记录列表
|
||||
*
|
||||
* @param string $status
|
||||
* @return array
|
||||
*/
|
||||
public function getRecordsByStatus($status)
|
||||
{
|
||||
return $this->getList('*', array('status' => $status), 0, -1, 'id DESC');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取案例的审批历史
|
||||
*
|
||||
* @param int $case_id
|
||||
* @return array
|
||||
*/
|
||||
public function getCaseApprovalHistory($case_id)
|
||||
{
|
||||
return $this->getList('*', array('case_id' => $case_id), 0, -1, 'at_time ASC');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取节点的审批记录
|
||||
*
|
||||
* @param int $node_id
|
||||
* @return array
|
||||
*/
|
||||
public function getNodeApprovalRecords($node_id)
|
||||
{
|
||||
return $this->getList('*', array('node_id' => $node_id), 0, -1, 'at_time ASC');
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建审批记录
|
||||
*
|
||||
* @param array $data
|
||||
* @return int|bool
|
||||
*/
|
||||
public function createApprovalRecord($data)
|
||||
{
|
||||
$recordData = array(
|
||||
'case_id' => $data['case_id'],
|
||||
'node_id' => $data['node_id'],
|
||||
'assignee_type' => $data['assignee_type'],
|
||||
'assignee_id' => $data['assignee_id'],
|
||||
'assignee_name' => $data['assignee_name'],
|
||||
'action' => $data['action'],
|
||||
'remark' => $data['remark'],
|
||||
'status' => $data['status'],
|
||||
'process_time' => time(),
|
||||
);
|
||||
|
||||
return $this->insert($recordData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取审核状态
|
||||
*
|
||||
* @param $col
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function modifier_status($col)
|
||||
{
|
||||
$StatusList = $this->getStatusList();
|
||||
|
||||
return isset($StatusList[$col]) ? $StatusList[$col] : $col;
|
||||
}
|
||||
}
|
||||
21
app/ticket/model/workflow/template.php
Normal file
21
app/ticket/model/workflow/template.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* 审批流模板模型类
|
||||
*
|
||||
* @author shopex开发团队
|
||||
* @version 2025.07.10
|
||||
*/
|
||||
class ticket_mdl_workflow_template extends dbeav_model
|
||||
{
|
||||
/**
|
||||
* 审批场景类型列表
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSceneTypes()
|
||||
{
|
||||
return array(
|
||||
'add_gift' => '加赠',
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user