|
|
@@ -55,7 +55,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 手机端外发明细首页直达链接(登录后打开对应明细,免搜索)
|
|
|
+ * 手机端协助明细首页直达链接(登录后打开对应明细,免搜索)
|
|
|
* 配置 application/extra/mproc.php:mobile_base_url、mobile_index_path
|
|
|
*
|
|
|
* @param int $purchaseOrderDetailId purchase_order_detail 主键
|
|
|
@@ -115,7 +115,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 解析用于外发邮件/短信的手机端站点根
|
|
|
+ * 解析用于协助邮件/短信的手机端站点根
|
|
|
*/
|
|
|
protected function resolveMprocMobilePublicBaseUrl()
|
|
|
{
|
|
|
@@ -145,7 +145,7 @@ class Procuremen extends Backend
|
|
|
return $reqBase;
|
|
|
}
|
|
|
|
|
|
- Log::write('外发邮件手机链接:配置地址失效', 'warning');
|
|
|
+ Log::write('协助邮件手机链接:配置地址失效', 'warning');
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
@@ -197,7 +197,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 从 ERP 库拉取外发工序池(与 api/procuremen/getprocuremen 一致),并尽力写入 Redis
|
|
|
+ * 从 ERP 库拉取协助工序池(与 api/procuremen/getprocuremen 一致),并尽力写入 Redis
|
|
|
*
|
|
|
* @return array<int, array<string, mixed>>
|
|
|
*/
|
|
|
@@ -237,7 +237,7 @@ class Procuremen extends Backend
|
|
|
|
|
|
return $list;
|
|
|
} catch (\Throwable $e) {
|
|
|
- Log::write('外发列表拉取 ERP 数据失败:' . $e->getMessage(), 'error');
|
|
|
+ Log::write('协助列表拉取 ERP 数据失败:' . $e->getMessage(), 'error');
|
|
|
|
|
|
return [];
|
|
|
}
|
|
|
@@ -338,7 +338,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 左侧菜单(外发初选:Redis/ERP 工序按提交日期分组;与列表月份筛选字段一致)
|
|
|
+ * 左侧菜单(协助初选:Redis/ERP 工序按提交日期分组;与列表月份筛选字段一致)
|
|
|
*/
|
|
|
protected function GetIndexYearMonths()
|
|
|
{
|
|
|
@@ -651,12 +651,12 @@ class Procuremen extends Backend
|
|
|
$this->view->assign('procuremenPageTitle', $pageTitle);
|
|
|
}
|
|
|
|
|
|
- /** 外发下发(选工序+供应商,发短信邮件通知报价) */
|
|
|
+ /** 协助下发(选工序+供应商,发短信邮件通知报价) */
|
|
|
public function pick()
|
|
|
{
|
|
|
$this->request->filter(['strip_tags', 'trim']);
|
|
|
if (!$this->request->isAjax()) {
|
|
|
- $this->assignProcuremenListPage('pick', '外发下发');
|
|
|
+ $this->assignProcuremenListPage('pick', '协助下发');
|
|
|
return $this->view->fetch('procuremen/index');
|
|
|
}
|
|
|
|
|
|
@@ -688,14 +688,14 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 列表页(兼容旧菜单 procuremen/index,等同外发下发)
|
|
|
+ * 列表页(兼容旧菜单 procuremen/index,等同协助下发)
|
|
|
*/
|
|
|
public function index()
|
|
|
{
|
|
|
$this->request->filter(['strip_tags', 'trim']);
|
|
|
|
|
|
if (!$this->request->isAjax()) {
|
|
|
- $this->assignProcuremenListPage('pick', '外发下发');
|
|
|
+ $this->assignProcuremenListPage('pick', '协助下发');
|
|
|
|
|
|
return $this->view->fetch('procuremen/index');
|
|
|
}
|
|
|
@@ -1056,7 +1056,7 @@ class Procuremen extends Backend
|
|
|
'rows' => $rows,
|
|
|
]);
|
|
|
} catch (\Throwable $e) {
|
|
|
- Log::write('外发列表加载异常:' . $e->getMessage(), 'error');
|
|
|
+ Log::write('协助列表加载异常:' . $e->getMessage(), 'error');
|
|
|
|
|
|
return json([
|
|
|
'total' => 0,
|
|
|
@@ -1066,7 +1066,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 已外发/不可再审核判定(与「未发」列表隐藏规则一致,避免仅保存数量却被当成已下发)
|
|
|
+ * 已协助/不可再审核判定(与「未发」列表隐藏规则一致,避免仅保存数量却被当成已下发)
|
|
|
* - purchase_order.status 为 0 或 1:已审核下发或已完结
|
|
|
* - 或存在 purchase_order_detail:已向供应商下过明细
|
|
|
* 仅写入 purchase_order 且 status 为空:视为未发(如只填本次数量、最高限价)
|
|
|
@@ -1109,7 +1109,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 外发下发列表需隐藏的工序 scydgy_id(已下发通知或已进入后续流程)
|
|
|
+ * 协助下发列表需隐藏的工序 scydgy_id(已下发通知或已进入后续流程)
|
|
|
*
|
|
|
* @return array<int, true>
|
|
|
*/
|
|
|
@@ -1167,7 +1167,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 外发下发列表:手工新增工序(purchase_order.scydgy_id 为负数,与 ERP 缓存行区分)
|
|
|
+ * 协助下发列表:手工新增工序(purchase_order.scydgy_id 为负数,与 ERP 缓存行区分)
|
|
|
*
|
|
|
* @return array<int, array<string, mixed>>
|
|
|
*/
|
|
|
@@ -1339,7 +1339,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 外发初选列表软删除(mod_rq 记删除时间;ERP 行无记录则插入 purchase_order)
|
|
|
+ * 协助初选列表软删除(mod_rq 记删除时间;ERP 行无记录则插入 purchase_order)
|
|
|
*/
|
|
|
protected function softDeleteProcuremenPickRow(array $row): void
|
|
|
{
|
|
|
@@ -1387,11 +1387,11 @@ class Procuremen extends Backend
|
|
|
if ($gymcLog !== '') {
|
|
|
$logTail .= ' / ' . $gymcLog;
|
|
|
}
|
|
|
- $this->addOrderLog($sid, 'pick_soft_delete', '外发初选删除:' . $logTail, $poIdLog > 0 ? $poIdLog : null);
|
|
|
+ $this->addOrderLog($sid, 'pick_soft_delete', '协助初选删除:' . $logTail, $poIdLog > 0 ? $poIdLog : null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 手工新增外发工序(写入 purchase_order)
|
|
|
+ * 手工新增协助工序(写入 purchase_order)
|
|
|
*
|
|
|
* @param array<string, mixed> $params
|
|
|
* @return int scydgy_id
|
|
|
@@ -1427,7 +1427,7 @@ class Procuremen extends Backend
|
|
|
];
|
|
|
Db::table('purchase_order')->insert($data);
|
|
|
$poId = (int)Db::getLastInsID();
|
|
|
- $this->addOrderLog($sid, 'manual_add', '手工新增外发工序', $poId > 0 ? $poId : null);
|
|
|
+ $this->addOrderLog($sid, 'manual_add', '手工新增协助工序', $poId > 0 ? $poId : null);
|
|
|
|
|
|
return $sid;
|
|
|
}
|
|
|
@@ -3060,7 +3060,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 外发采购操作日志(表未建时仅写 runtime 日志,不中断业务)
|
|
|
+ * 协助采购操作日志(表未建时仅写 runtime 日志,不中断业务)
|
|
|
*/
|
|
|
protected function addOrderLog(int $scydgyId, string $action, string $content, ?int $purchaseOrderId = null): void
|
|
|
{
|
|
|
@@ -3207,7 +3207,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 是否已向外发/供应商下发(有下发明细、已进入审批流或记录下发时间)
|
|
|
+ * 是否已协助向供应商下发(有下发明细、已进入审批流或记录下发时间)
|
|
|
*/
|
|
|
protected function isProcuremenOrderIssued(array $main, int $detailCount): bool
|
|
|
{
|
|
|
@@ -3550,7 +3550,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 加载并 assign 外发采购「详情」弹窗所需变量(与 {@see details()} 页面一致,供模板 / PDF 共用)。
|
|
|
+ * 加载并 assign 协助采购「详情」弹窗所需变量(与 {@see details()} 页面一致,供模板 / PDF 共用)。
|
|
|
*
|
|
|
* @return array{ok: bool, ccydh: string} ok 表示存在主表或至少一条下发明细(否则 PDF 无可写内容)
|
|
|
*/
|
|
|
@@ -3705,7 +3705,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 解析合并审核工序行(订单号须一致,且均未外发)
|
|
|
+ * 解析合并审核工序行(订单号须一致,且均未协助)
|
|
|
*
|
|
|
* @return array<int, array<string, mixed>>
|
|
|
*/
|
|
|
@@ -4080,7 +4080,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 详情 / PDF:同一外发批次下的全部工序行(与确认供应商弹窗一致)
|
|
|
+ * 详情 / PDF:同一协助批次下的全部工序行(与确认供应商弹窗一致)
|
|
|
*
|
|
|
* @return array<int, array<string, mixed>>
|
|
|
*/
|
|
|
@@ -4788,7 +4788,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 外发下发 — 仅写入 purchase_order_detail(第一步不发通知)
|
|
|
+ * 协助下发 — 仅写入 purchase_order_detail(第一步不发通知)
|
|
|
*
|
|
|
* @return array<int, array{detail_id:int, cgymc:string, url:string}>
|
|
|
*/
|
|
|
@@ -5173,7 +5173,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 外发下发 — 写入下发明细并拼好短信/邮件内容(供第二步发送)
|
|
|
+ * 协助下发 — 写入下发明细并拼好短信/邮件内容(供第二步发送)
|
|
|
*
|
|
|
* @return array<string, mixed>
|
|
|
*/
|
|
|
@@ -5185,7 +5185,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 外发下发 — 发送短信(一家供应商)
|
|
|
+ * 协助下发 — 发送短信(一家供应商)
|
|
|
*
|
|
|
* @param array<string, mixed> $bundle issueBuildSupplierNotifyBundle 返回值
|
|
|
*/
|
|
|
@@ -5216,7 +5216,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 外发下发 — 发送邮件(一家供应商)
|
|
|
+ * 协助下发 — 发送邮件(一家供应商)
|
|
|
*
|
|
|
* @param array<string, mixed> $bundle
|
|
|
* @param array<string, mixed> $mailConfig
|
|
|
@@ -5268,7 +5268,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 外发下发通知上下文(订单号、工序明细等,供短信/邮件共用)
|
|
|
+ * 协助下发通知上下文(订单号、工序明细等,供短信/邮件共用)
|
|
|
*
|
|
|
* @param array<int, array<string, mixed>> $mergeRows
|
|
|
* @return array<string, mixed>
|
|
|
@@ -5299,11 +5299,11 @@ class Procuremen extends Backend
|
|
|
if (!Config::get('app_debug') && !$this->isProcuremenNotifyDryRun()) {
|
|
|
return;
|
|
|
}
|
|
|
- Log::write('[外发下发-' . $type . '] ' . json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), 'notice');
|
|
|
+ Log::write('[协助下发-' . $type . '] ' . json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), 'notice');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 外发下发弹窗(选多家供应商并通知)
|
|
|
+ * 协助下发弹窗(选多家供应商并通知)
|
|
|
*/
|
|
|
public function pickReview()
|
|
|
{
|
|
|
@@ -5316,7 +5316,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 外发新增(独立页面)
|
|
|
+ * 协助新增(独立页面)
|
|
|
*/
|
|
|
public function add()
|
|
|
{
|
|
|
@@ -5345,7 +5345,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 业务员外发新增进度查询(仅手工新增工序;普通用户只看 cywyxm=本人,超管看全部)
|
|
|
+ * 业务员新增进度查询(仅手工新增工序;普通用户只看 cywyxm=本人,超管看全部)
|
|
|
*/
|
|
|
public function rfqlist()
|
|
|
{
|
|
|
@@ -5434,7 +5434,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 手工新增工序详情:业务员只看本人;超管及外发流程岗位可看全部
|
|
|
+ * 手工新增工序详情:业务员只看本人;超管及协助流程岗位可看全部
|
|
|
*/
|
|
|
protected function assertManualOrderDetailsViewable(int $scydgyId): void
|
|
|
{
|
|
|
@@ -5481,7 +5481,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 手工新增外发工序进度文案
|
|
|
+ * 手工新增协助工序进度文案
|
|
|
*/
|
|
|
protected function formatProcuremenRfqProgressText(array $row): string
|
|
|
{
|
|
|
@@ -5510,11 +5510,11 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return '待外发下发';
|
|
|
+ return '待协助下发';
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 外发初选列表 — 批量软删除
|
|
|
+ * 协助初选列表 — 批量软删除
|
|
|
*/
|
|
|
public function pickDelete()
|
|
|
{
|
|
|
@@ -5553,7 +5553,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 外发下发 — 手工新增工序(弹窗)
|
|
|
+ * 协助下发 — 手工新增工序(弹窗)
|
|
|
*/
|
|
|
public function pickAdd()
|
|
|
{
|
|
|
@@ -5576,7 +5576,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 外发下发提交 — 弹窗「确认下发」→ POST procuremen/picksubmit
|
|
|
+ * 协助下发提交 — 弹窗「确认下发」→ POST procuremen/picksubmit
|
|
|
*/
|
|
|
public function pickSubmit()
|
|
|
{
|
|
|
@@ -5615,7 +5615,7 @@ class Procuremen extends Backend
|
|
|
$sysRqDb = date('Y-m-d H:i:s', $sysRqTs);
|
|
|
|
|
|
$isMerge = count($mergeRows) > 1;
|
|
|
- $logMsg = ($isMerge ? '合并外发初选(' . count($mergeRows) . ' 道工序)' : '外发初选')
|
|
|
+ $logMsg = ($isMerge ? '合并协助初选(' . count($mergeRows) . ' 道工序)' : '协助初选')
|
|
|
. ',通知供应商(' . count($issueCompanies) . ' 家):' . $issueNamesSummary;
|
|
|
|
|
|
$issueTime = date('Y-m-d H:i:s');
|
|
|
@@ -5795,7 +5795,7 @@ class Procuremen extends Backend
|
|
|
'notify_preview' => $this->notifyDryRunPreview,
|
|
|
]);
|
|
|
}
|
|
|
- $this->success('已向 ' . count($issueCompanies) . ' 家供应商发送短信与邮件,请至「外发审批下发」确认供应商');
|
|
|
+ $this->success('已向 ' . count($issueCompanies) . ' 家供应商发送短信与邮件,请至「协助审批下发」确认供应商');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -5822,7 +5822,7 @@ class Procuremen extends Backend
|
|
|
$po = $pos[0];
|
|
|
$quoteGroups = $this->loadAuditSupplierQuoteGroups($bundle);
|
|
|
if ($quoteGroups === []) {
|
|
|
- $this->error('暂无下发明细,请确认该订单已在「外发初选」完成下发');
|
|
|
+ $this->error('暂无下发明细,请确认该订单已在「协助初选」完成下发');
|
|
|
}
|
|
|
$pickedName = '';
|
|
|
foreach ($pos as $poRow) {
|
|
|
@@ -5870,7 +5870,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
$quoteGroups = $this->loadAuditSupplierQuoteGroups($bundle);
|
|
|
if ($quoteGroups === []) {
|
|
|
- $this->error('暂无供应商报价,请确认已完成外发初选通知');
|
|
|
+ $this->error('暂无供应商报价,请确认已完成协助初选通知');
|
|
|
}
|
|
|
|
|
|
$companyName = trim((string)$this->request->post('selected_company', ''));
|
|
|
@@ -5995,12 +5995,12 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 废弃单个订单 bundle(退回外发初选,明细归档留痕)
|
|
|
+ * 废弃单个订单 bundle(退回协助初选,明细归档留痕)
|
|
|
*
|
|
|
* @param array{ccydh:string, pos:array, merge_rows:array} $bundle
|
|
|
* @return array<int, true> 已处理的 scydgy_id 集合
|
|
|
*/
|
|
|
- protected function abandonOrderBundleToPick(array $bundle, string $logAction, string $logSuffix = ',退回外发初选'): array
|
|
|
+ protected function abandonOrderBundleToPick(array $bundle, string $logAction, string $logSuffix = ',退回协助初选'): array
|
|
|
{
|
|
|
$pos = $bundle['pos'] ?? [];
|
|
|
if (!is_array($pos) || $pos === []) {
|
|
|
@@ -6043,7 +6043,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 废弃单个审批订单 bundle(退回外发初选,明细归档留痕)
|
|
|
+ * 废弃单个审批订单 bundle(退回协助初选,明细归档留痕)
|
|
|
*
|
|
|
* @param array{ccydh:string, pos:array, merge_rows:array} $bundle
|
|
|
* @return array<int, true> 已处理的 scydgy_id 集合
|
|
|
@@ -6109,7 +6109,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 废弃订单 — 退回外发初选重新询价(支持单条或批量)
|
|
|
+ * 废弃订单 — 退回协助初选重新询价(支持单条或批量)
|
|
|
*/
|
|
|
public function auditAbandon()
|
|
|
{
|
|
|
@@ -6178,13 +6178,13 @@ class Procuremen extends Backend
|
|
|
$this->pickHiddenScydgySetCache = null;
|
|
|
|
|
|
$msg = $doneOrders > 1
|
|
|
- ? ('已重新下发 ' . $doneOrders . ' 个订单并退回外发初选,历史下发与操作记录已保留')
|
|
|
- : '已退回外发初选,请重新选择供应商下发(历史记录已保留)';
|
|
|
+ ? ('已重新下发 ' . $doneOrders . ' 个订单并退回协助初选,历史下发与操作记录已保留')
|
|
|
+ : '已退回协助初选,请重新选择供应商下发(历史记录已保留)';
|
|
|
$this->success($msg);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 历史存证 — 已完结订单重新下发,退回外发初选(支持单条或批量)
|
|
|
+ * 历史存证 — 已完结订单重新下发,退回协助初选(支持单条或批量)
|
|
|
*/
|
|
|
public function archiveAbandon()
|
|
|
{
|
|
|
@@ -6234,7 +6234,7 @@ class Procuremen extends Backend
|
|
|
$sids = $this->abandonOrderBundleToPick(
|
|
|
$bundle,
|
|
|
'archive_abandon',
|
|
|
- ',从历史存证退回外发初选'
|
|
|
+ ',从历史存证退回协助初选'
|
|
|
);
|
|
|
if ($sids === []) {
|
|
|
continue;
|
|
|
@@ -6253,13 +6253,13 @@ class Procuremen extends Backend
|
|
|
$this->pickHiddenScydgySetCache = null;
|
|
|
|
|
|
$msg = $doneOrders > 1
|
|
|
- ? ('已重新下发 ' . $doneOrders . ' 个订单并退回外发初选,历史记录已保留')
|
|
|
- : '已退回外发初选,请重新选择供应商下发(历史记录已保留)';
|
|
|
+ ? ('已重新下发 ' . $doneOrders . ' 个订单并退回协助初选,历史记录已保留')
|
|
|
+ : '已退回协助初选,请重新选择供应商下发(历史记录已保留)';
|
|
|
$this->success($msg);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 采购终审 — 审批驳回(退回外发审批下发,不发送短信)
|
|
|
+ * 采购终审 — 审批驳回(退回协助审批下发,不发送短信)
|
|
|
*/
|
|
|
public function purchaseApprovalReject()
|
|
|
{
|
|
|
@@ -6291,7 +6291,7 @@ class Procuremen extends Backend
|
|
|
$this->error($e->getMessage() !== '' ? $e->getMessage() : '驳回失败');
|
|
|
}
|
|
|
|
|
|
- $this->success('已驳回并退回「外发审批下发」');
|
|
|
+ $this->success('已驳回并退回「协助审批下发」');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -6320,7 +6320,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
} catch (\Throwable $e) {
|
|
|
}
|
|
|
- $this->addOrderLog($sid, 'purchase_reject', '采购终审驳回,退回外发审批下发', $poId > 0 ? $poId : null);
|
|
|
+ $this->addOrderLog($sid, 'purchase_reject', '采购终审驳回,退回协助审批下发', $poId > 0 ? $poId : null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -6329,7 +6329,7 @@ class Procuremen extends Backend
|
|
|
public function review()
|
|
|
{
|
|
|
if ($this->request->isPost()) {
|
|
|
- $this->error('请使用第一步「外发下发」通知供应商,再在「确认供应商」中选定一家');
|
|
|
+ $this->error('请使用第一步「协助下发」通知供应商,再在「确认供应商」中选定一家');
|
|
|
}
|
|
|
$this->view->assign('pickMode', 0);
|
|
|
|
|
|
@@ -6635,14 +6635,38 @@ class Procuremen extends Backend
|
|
|
PRIMARY KEY (`id`),
|
|
|
KEY `idx_ym` (`ym`),
|
|
|
KEY `idx_ct` (`createtime`)
|
|
|
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='月度外发明细导出记录'"
|
|
|
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='月度协助明细导出记录'"
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 按月份导出:已完结且采购确认已选定供应商(明细 status=1),与列表「已完结」∩「已选中」一致。
|
|
|
- * 表头固定 8 列(与历史「外发明细」模板一致):序号、传票号、传票名称、外加工单位、订法、客户名称、工序、加工金额。
|
|
|
+ * 已完结订单归属月份(与历史存证、月度列表一致)
|
|
|
+ *
|
|
|
+ * @param array<string, mixed> $row purchase_order 行
|
|
|
+ */
|
|
|
+ protected function resolveCompletedPurchaseOrderYm(array $row): string
|
|
|
+ {
|
|
|
+ foreach (['createtime', 'dStamp', 'updatetime'] as $key) {
|
|
|
+ $raw = $row[$key] ?? null;
|
|
|
+ if ($raw === null || $raw === '') {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (is_numeric($raw) && (int)$raw > 946684800) {
|
|
|
+ return date('Y-m', (int)$raw);
|
|
|
+ }
|
|
|
+ $t = trim((string)$raw);
|
|
|
+ if ($t !== '' && preg_match('/^(\d{4}-\d{2})/', $t, $m)) {
|
|
|
+ return $m[1];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 按月份导出:已完结订单(与历史存证、月度列表一致),按完结月份筛选。
|
|
|
+ * 表头固定 8 列(与历史「协助明细」模板一致):序号、传票号、传票名称、外加工单位、订法、客户名称、工序、加工金额。
|
|
|
*/
|
|
|
public function export_month_outward()
|
|
|
{
|
|
|
@@ -6651,8 +6675,6 @@ class Procuremen extends Backend
|
|
|
if (!preg_match('/^\d{4}-\d{2}$/', $ym)) {
|
|
|
$ym = date('Y-m');
|
|
|
}
|
|
|
- $monthStart = $ym . '-01 00:00:00';
|
|
|
- $monthEnd = date('Y-m-t 23:59:59', strtotime($monthStart));
|
|
|
|
|
|
$dbRows = [];
|
|
|
try {
|
|
|
@@ -6665,21 +6687,16 @@ class Procuremen extends Backend
|
|
|
if (!is_array($dbRows)) {
|
|
|
$dbRows = [];
|
|
|
}
|
|
|
- $pickedSidSet = $this->loadScydgyIdsWithPickedSupplierDetail();
|
|
|
- $dbRows = array_values(array_filter($dbRows, function ($dbRow) use ($pickedSidSet) {
|
|
|
+ $dbRows = array_values(array_filter($dbRows, function ($dbRow) use ($ym) {
|
|
|
if (!is_array($dbRow)) {
|
|
|
return false;
|
|
|
}
|
|
|
- $sid = (int)($dbRow['scydgy_id'] ?? 0);
|
|
|
- if ($sid <= 0 && isset($dbRow['SCYDGY_ID'])) {
|
|
|
- $sid = (int)$dbRow['SCYDGY_ID'];
|
|
|
- }
|
|
|
|
|
|
- return $sid > 0 && isset($pickedSidSet[$sid]);
|
|
|
+ return $this->resolveCompletedPurchaseOrderYm($dbRow) === $ym;
|
|
|
}));
|
|
|
|
|
|
$pool = $this->procuremenPoolFromPurchaseOrderDbRows($dbRows);
|
|
|
- $filtered = $this->filterProcuremenIndexPool($pool, $monthStart, $monthEnd, true, '', [], [], 'pick_time');
|
|
|
+ $filtered = $pool;
|
|
|
|
|
|
$mainBySid = [];
|
|
|
foreach ($filtered as $rw) {
|
|
|
@@ -6697,7 +6714,8 @@ class Procuremen extends Backend
|
|
|
try {
|
|
|
$detailRows = Db::table('purchase_order_detail')
|
|
|
->where('scydgy_id', 'in', array_keys($mainBySid))
|
|
|
- ->where('status', 1)
|
|
|
+ ->where('status', '<>', self::PURCHASE_DETAIL_STATUS_VOID)
|
|
|
+ ->order('status', 'desc')
|
|
|
->order('CCYDH', 'asc')
|
|
|
->order('company_name', 'asc')
|
|
|
->order('id', 'asc')
|
|
|
@@ -6706,7 +6724,8 @@ class Procuremen extends Backend
|
|
|
try {
|
|
|
$detailRows = Db::table('purchase_order_detail')
|
|
|
->where('scydgy_id', 'in', array_keys($mainBySid))
|
|
|
- ->where('status', 1)
|
|
|
+ ->where('status', '<>', self::PURCHASE_DETAIL_STATUS_VOID)
|
|
|
+ ->order('status', 'desc')
|
|
|
->order('CCYDH', 'asc')
|
|
|
->order('company_name', 'asc')
|
|
|
->order('ID', 'asc')
|
|
|
@@ -6721,6 +6740,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
$exportLines = [];
|
|
|
+ $detailSidSeen = [];
|
|
|
foreach ($detailRows as $dr) {
|
|
|
if (!is_array($dr)) {
|
|
|
continue;
|
|
|
@@ -6729,6 +6749,33 @@ class Procuremen extends Backend
|
|
|
if ($sid <= 0 || !isset($mainBySid[$sid])) {
|
|
|
continue;
|
|
|
}
|
|
|
+ if (isset($detailSidSeen[$sid])) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if ((int)($dr['status'] ?? 0) !== 1) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $detailSidSeen[$sid] = true;
|
|
|
+ $m = $mainBySid[$sid];
|
|
|
+ $exportLines[] = [
|
|
|
+ 'CCYDH' => (string)($dr['CCYDH'] ?? $m['CCYDH'] ?? ''),
|
|
|
+ 'CYJMC' => (string)($dr['CYJMC'] ?? $m['CYJMC'] ?? ''),
|
|
|
+ 'company_name' => (string)($dr['company_name'] ?? ''),
|
|
|
+ 'CDF' => (string)($m['CDF'] ?? ''),
|
|
|
+ 'cGzzxMc' => (string)($m['cGzzxMc'] ?? ''),
|
|
|
+ 'gx' => $this->procuremenExportGxText($m),
|
|
|
+ 'detail' => $dr,
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ foreach ($detailRows as $dr) {
|
|
|
+ if (!is_array($dr)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $sid = (int)($dr['scydgy_id'] ?? $dr['SCYDGY_ID'] ?? 0);
|
|
|
+ if ($sid <= 0 || !isset($mainBySid[$sid]) || isset($detailSidSeen[$sid])) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $detailSidSeen[$sid] = true;
|
|
|
$m = $mainBySid[$sid];
|
|
|
$exportLines[] = [
|
|
|
'CCYDH' => (string)($dr['CCYDH'] ?? $m['CCYDH'] ?? ''),
|
|
|
@@ -6740,6 +6787,21 @@ class Procuremen extends Backend
|
|
|
'detail' => $dr,
|
|
|
];
|
|
|
}
|
|
|
+ foreach ($mainBySid as $sid => $m) {
|
|
|
+ if (isset($detailSidSeen[$sid])) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $company = trim((string)($m['pick_company_name'] ?? ''));
|
|
|
+ $exportLines[] = [
|
|
|
+ 'CCYDH' => (string)($m['CCYDH'] ?? ''),
|
|
|
+ 'CYJMC' => (string)($m['CYJMC'] ?? ''),
|
|
|
+ 'company_name' => $company,
|
|
|
+ 'CDF' => (string)($m['CDF'] ?? ''),
|
|
|
+ 'cGzzxMc' => (string)($m['cGzzxMc'] ?? ''),
|
|
|
+ 'gx' => $this->procuremenExportGxText($m),
|
|
|
+ 'detail' => [],
|
|
|
+ ];
|
|
|
+ }
|
|
|
|
|
|
$groups = [];
|
|
|
foreach ($exportLines as $line) {
|
|
|
@@ -6753,11 +6815,11 @@ class Procuremen extends Backend
|
|
|
|
|
|
$spreadsheet = new Spreadsheet();
|
|
|
$sheet = $spreadsheet->getActiveSheet();
|
|
|
- $sheet->setTitle('外发明细');
|
|
|
+ $sheet->setTitle('协助明细');
|
|
|
|
|
|
$mon = (int)substr($ym, 5, 2);
|
|
|
$sheet->mergeCells('A1:H1');
|
|
|
- $sheet->setCellValue('A1', $mon . '月外发明细');
|
|
|
+ $sheet->setCellValue('A1', $mon . '月协助明细');
|
|
|
$sheet->getStyle('A1')->getFont()->setBold(true)->setSize(14);
|
|
|
$sheet->getStyle('A1')->getAlignment()
|
|
|
->setHorizontal(Alignment::HORIZONTAL_CENTER)
|
|
|
@@ -6778,7 +6840,7 @@ class Procuremen extends Backend
|
|
|
|
|
|
if ($groups === []) {
|
|
|
$sheet->mergeCells('A3:H3');
|
|
|
- $sheet->setCellValue('A3', '(当月暂无符合条件的外发明细)');
|
|
|
+ $sheet->setCellValue('A3', '(当月暂无符合条件的协助明细)');
|
|
|
$sheet->getStyle('A3')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
|
|
|
$rowNum = 4;
|
|
|
} else {
|
|
|
@@ -6853,7 +6915,7 @@ class Procuremen extends Backend
|
|
|
$sheet->getColumnDimension('H')->setWidth(13);
|
|
|
$sheet->getRowDimension(1)->setRowHeight(28);
|
|
|
|
|
|
- $fileBase = '外发明细_' . str_replace('-', '', $ym);
|
|
|
+ $fileBase = '协助明细_' . str_replace('-', '', $ym);
|
|
|
$filename = $fileBase . '.xlsx';
|
|
|
|
|
|
try {
|
|
|
@@ -7211,7 +7273,7 @@ class Procuremen extends Backend
|
|
|
protected function resolveProcuremenEmailSubject(string $scene): string
|
|
|
{
|
|
|
$map = [
|
|
|
- 'review_email' => '您有新的外发加工订单',
|
|
|
+ 'review_email' => '您有新的协助加工订单',
|
|
|
];
|
|
|
$subject = trim((string)($map[$scene] ?? ''));
|
|
|
if ($subject === '') {
|
|
|
@@ -7224,8 +7286,8 @@ class Procuremen extends Backend
|
|
|
protected function notifyTemplateMissingMessage(string $scene, bool $titleRequired = false): string
|
|
|
{
|
|
|
$map = [
|
|
|
- 'review_email' => '外发下发-邮箱',
|
|
|
- 'review_sms' => '外发下发-短信',
|
|
|
+ 'review_email' => '协助下发-邮箱',
|
|
|
+ 'review_sms' => '协助下发-短信',
|
|
|
'confirm_ok' => '采购确认-通过',
|
|
|
'confirm_fail' => '采购确认-未通过',
|
|
|
];
|
|
|
@@ -7244,7 +7306,7 @@ class Procuremen extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 是否开启外发通知演练(不发真实短信/邮件)
|
|
|
+ * 是否开启协助通知演练(不发真实短信/邮件)
|
|
|
*/
|
|
|
protected function isProcuremenNotifyDryRun(): bool
|
|
|
{
|
|
|
@@ -7257,7 +7319,7 @@ class Procuremen extends Backend
|
|
|
protected function recordNotifyDryRunPreview(array $payload): void
|
|
|
{
|
|
|
$this->notifyDryRunPreview[] = $payload;
|
|
|
- Log::write('[外发通知演练] ' . json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), 'notice');
|
|
|
+ Log::write('[协助通知演练] ' . json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), 'notice');
|
|
|
}
|
|
|
|
|
|
/**
|