|
@@ -1866,6 +1866,70 @@ class Procuremen extends Backend
|
|
|
return implode("\n", $lines);
|
|
return implode("\n", $lines);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 从订单 bundle 取报价截止时间(多工序取首个有效 sys_rq)
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function resolveBundleSysRq(array $bundle): string
|
|
|
|
|
+ {
|
|
|
|
|
+ foreach ($bundle['pos'] ?? [] as $po) {
|
|
|
|
|
+ if (!is_array($po)) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ $sr = trim((string)($po['sys_rq'] ?? ''));
|
|
|
|
|
+ if ($sr !== '' && !preg_match('/^0000-00-00/i', $sr)) {
|
|
|
|
|
+ return $sr;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 报价截止时间是否已到(未设置截止时间则视为可查看报价)
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function isProcuremenQuoteDeadlineReached($sysRq): bool
|
|
|
|
|
+ {
|
|
|
|
|
+ $raw = trim((string)$sysRq);
|
|
|
|
|
+ if ($raw === '' || preg_match('/^0000-00-00/i', $raw)) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ $ts = strtotime(str_replace('T', ' ', $raw));
|
|
|
|
|
+ if ($ts === false || $ts <= 0) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return time() >= $ts;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 截止时间前:隐藏单价/交期真实值,统一展示文案
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param array<string, mixed> $line
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function maskSupplierQuoteLineBeforeDeadline(array &$line): void
|
|
|
|
|
+ {
|
|
|
|
|
+ $text = '未到截止时间';
|
|
|
|
|
+ $line['amount_filled'] = false;
|
|
|
|
|
+ $line['delivery_filled'] = false;
|
|
|
|
|
+ $line['unit_price_text'] = $text;
|
|
|
|
|
+ $line['amount_show'] = '';
|
|
|
|
|
+ if (array_key_exists('amount_text', $line)) {
|
|
|
|
|
+ $line['amount_text'] = $text;
|
|
|
|
|
+ }
|
|
|
|
|
+ $line['delivery_show'] = $text;
|
|
|
|
|
+ if (array_key_exists('delivery_text', $line)) {
|
|
|
|
|
+ $line['delivery_text'] = $text;
|
|
|
|
|
+ }
|
|
|
|
|
+ $line['delivery_ymd'] = '';
|
|
|
|
|
+ $line['subtotal_text'] = '';
|
|
|
|
|
+ $line['subtotal_num'] = null;
|
|
|
|
|
+ $line['is_quoted'] = false;
|
|
|
|
|
+ if (array_key_exists('quote_label', $line)) {
|
|
|
|
|
+ $line['quote_label'] = $text;
|
|
|
|
|
+ }
|
|
|
|
|
+ $line['quote_before_deadline'] = true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 审核弹窗:按供应商汇总报价明细
|
|
* 审核弹窗:按供应商汇总报价明细
|
|
|
*
|
|
*
|
|
@@ -1887,6 +1951,7 @@ class Procuremen extends Backend
|
|
|
if ($sids === []) {
|
|
if ($sids === []) {
|
|
|
return [];
|
|
return [];
|
|
|
}
|
|
}
|
|
|
|
|
+ $deadlineReached = $this->isProcuremenQuoteDeadlineReached($this->resolveBundleSysRq($bundle));
|
|
|
$gymcMap = [];
|
|
$gymcMap = [];
|
|
|
$qtyBySid = [];
|
|
$qtyBySid = [];
|
|
|
foreach ($bundle['merge_rows'] ?? [] as $mr) {
|
|
foreach ($bundle['merge_rows'] ?? [] as $mr) {
|
|
@@ -1978,7 +2043,7 @@ class Procuremen extends Backend
|
|
|
$unitPriceText = $amountFilled
|
|
$unitPriceText = $amountFilled
|
|
|
? ($amountNum !== null ? $this->formatProcuremenMoneyDisplay($amountNum) : $am)
|
|
? ($amountNum !== null ? $this->formatProcuremenMoneyDisplay($amountNum) : $am)
|
|
|
: '未填写';
|
|
: '未填写';
|
|
|
- $byCompany[$cn]['lines'][] = [
|
|
|
|
|
|
|
+ $lineRow = [
|
|
|
'cgymc' => $gymc,
|
|
'cgymc' => $gymc,
|
|
|
'amount' => $am,
|
|
'amount' => $am,
|
|
|
'amount_show' => $amountFilled ? ($amountNum !== null ? $this->formatProcuremenMoneyDisplay($amountNum) : $am) : '',
|
|
'amount_show' => $amountFilled ? ($amountNum !== null ? $this->formatProcuremenMoneyDisplay($amountNum) : $am) : '',
|
|
@@ -1994,26 +2059,32 @@ class Procuremen extends Backend
|
|
|
'is_quoted' => $amountFilled,
|
|
'is_quoted' => $amountFilled,
|
|
|
'quote_label' => $amountFilled ? '已报价' : '未报价',
|
|
'quote_label' => $amountFilled ? '已报价' : '未报价',
|
|
|
];
|
|
];
|
|
|
|
|
+ if (!$deadlineReached) {
|
|
|
|
|
+ $this->maskSupplierQuoteLineBeforeDeadline($lineRow);
|
|
|
|
|
+ }
|
|
|
|
|
+ $byCompany[$cn]['lines'][] = $lineRow;
|
|
|
}
|
|
}
|
|
|
foreach ($byCompany as $cn => $g) {
|
|
foreach ($byCompany as $cn => $g) {
|
|
|
$total = count($g['lines']);
|
|
$total = count($g['lines']);
|
|
|
$quoted = 0;
|
|
$quoted = 0;
|
|
|
$groupTotal = 0.0;
|
|
$groupTotal = 0.0;
|
|
|
$groupHasTotal = false;
|
|
$groupHasTotal = false;
|
|
|
- foreach ($g['lines'] as $ln) {
|
|
|
|
|
- $am = trim((string)($ln['amount'] ?? ''));
|
|
|
|
|
- if ($am !== '' && $am !== '0' && $am !== '0.00') {
|
|
|
|
|
- $quoted++;
|
|
|
|
|
- }
|
|
|
|
|
- if (isset($ln['subtotal_num']) && $ln['subtotal_num'] !== null) {
|
|
|
|
|
- $groupTotal += (float)$ln['subtotal_num'];
|
|
|
|
|
- $groupHasTotal = true;
|
|
|
|
|
|
|
+ if ($deadlineReached) {
|
|
|
|
|
+ foreach ($g['lines'] as $ln) {
|
|
|
|
|
+ $am = trim((string)($ln['amount'] ?? ''));
|
|
|
|
|
+ if ($am !== '' && $am !== '0' && $am !== '0.00') {
|
|
|
|
|
+ $quoted++;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isset($ln['subtotal_num']) && $ln['subtotal_num'] !== null) {
|
|
|
|
|
+ $groupTotal += (float)$ln['subtotal_num'];
|
|
|
|
|
+ $groupHasTotal = true;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- $byCompany[$cn]['has_quote'] = $total > 0 && $quoted === $total;
|
|
|
|
|
|
|
+ $byCompany[$cn]['has_quote'] = $deadlineReached && $total > 0 && $quoted === $total;
|
|
|
$byCompany[$cn]['line_count'] = $total;
|
|
$byCompany[$cn]['line_count'] = $total;
|
|
|
$byCompany[$cn]['has_total'] = $total > 0;
|
|
$byCompany[$cn]['has_total'] = $total > 0;
|
|
|
- $byCompany[$cn]['total_text'] = $groupHasTotal ? $this->formatProcuremenMoneyDisplay($groupTotal) : '';
|
|
|
|
|
|
|
+ $byCompany[$cn]['total_text'] = ($deadlineReached && $groupHasTotal) ? $this->formatProcuremenMoneyDisplay($groupTotal) : '';
|
|
|
$byCompany[$cn]['display_rowspan'] = $total + ($total > 0 ? 1 : 0);
|
|
$byCompany[$cn]['display_rowspan'] = $total + ($total > 0 ? 1 : 0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2043,6 +2114,7 @@ class Procuremen extends Backend
|
|
|
if ($sids === []) {
|
|
if ($sids === []) {
|
|
|
return [];
|
|
return [];
|
|
|
}
|
|
}
|
|
|
|
|
+ $deadlineReached = $this->isProcuremenQuoteDeadlineReached($this->resolveBundleSysRq($bundle));
|
|
|
$gymcMap = [];
|
|
$gymcMap = [];
|
|
|
$qtyBySid = [];
|
|
$qtyBySid = [];
|
|
|
$orderedSids = [];
|
|
$orderedSids = [];
|
|
@@ -2142,7 +2214,7 @@ class Procuremen extends Backend
|
|
|
$unitPriceText = $amountFilled
|
|
$unitPriceText = $amountFilled
|
|
|
? ($amountNum !== null ? $this->formatProcuremenMoneyDisplay($amountNum) : $am)
|
|
? ($amountNum !== null ? $this->formatProcuremenMoneyDisplay($amountNum) : $am)
|
|
|
: '未填写';
|
|
: '未填写';
|
|
|
- $byCompany[$cn]['pick_lines'][$sid] = [
|
|
|
|
|
|
|
+ $pickLine = [
|
|
|
'cgymc' => $gymc,
|
|
'cgymc' => $gymc,
|
|
|
'amount_text' => $amountFilled ? ($amountNum !== null ? $this->formatProcuremenMoneyDisplay($amountNum) : $am) : '未填写',
|
|
'amount_text' => $amountFilled ? ($amountNum !== null ? $this->formatProcuremenMoneyDisplay($amountNum) : $am) : '未填写',
|
|
|
'delivery_text' => $deliveryFilled ? $deliveryShow : '未填写',
|
|
'delivery_text' => $deliveryFilled ? $deliveryShow : '未填写',
|
|
@@ -2153,6 +2225,10 @@ class Procuremen extends Backend
|
|
|
'subtotal_num' => $subtotal,
|
|
'subtotal_num' => $subtotal,
|
|
|
'is_quoted' => $amountFilled,
|
|
'is_quoted' => $amountFilled,
|
|
|
];
|
|
];
|
|
|
|
|
+ if (!$deadlineReached) {
|
|
|
|
|
+ $this->maskSupplierQuoteLineBeforeDeadline($pickLine);
|
|
|
|
|
+ }
|
|
|
|
|
+ $byCompany[$cn]['pick_lines'][$sid] = $pickLine;
|
|
|
$byCompany[$cn]['detail_picks'][$sid] = [
|
|
$byCompany[$cn]['detail_picks'][$sid] = [
|
|
|
'scydgy_id' => $sid,
|
|
'scydgy_id' => $sid,
|
|
|
'detail_id' => $detailId,
|
|
'detail_id' => $detailId,
|
|
@@ -2183,17 +2259,19 @@ class Procuremen extends Backend
|
|
|
}
|
|
}
|
|
|
$groupTotal = 0.0;
|
|
$groupTotal = 0.0;
|
|
|
$groupHasTotal = false;
|
|
$groupHasTotal = false;
|
|
|
- foreach ($pickLines as $ln) {
|
|
|
|
|
- if (isset($ln['subtotal_num']) && $ln['subtotal_num'] !== null) {
|
|
|
|
|
- $groupTotal += (float)$ln['subtotal_num'];
|
|
|
|
|
- $groupHasTotal = true;
|
|
|
|
|
|
|
+ if ($deadlineReached) {
|
|
|
|
|
+ foreach ($pickLines as $ln) {
|
|
|
|
|
+ if (isset($ln['subtotal_num']) && $ln['subtotal_num'] !== null) {
|
|
|
|
|
+ $groupTotal += (float)$ln['subtotal_num'];
|
|
|
|
|
+ $groupHasTotal = true;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
$lineCount = count($pickLines);
|
|
$lineCount = count($pickLines);
|
|
|
$g['pick_lines'] = $pickLines;
|
|
$g['pick_lines'] = $pickLines;
|
|
|
$g['line_count'] = $lineCount;
|
|
$g['line_count'] = $lineCount;
|
|
|
$g['has_total'] = $lineCount > 0;
|
|
$g['has_total'] = $lineCount > 0;
|
|
|
- $g['total_text'] = $groupHasTotal ? $this->formatProcuremenMoneyDisplay($groupTotal) : '';
|
|
|
|
|
|
|
+ $g['total_text'] = ($deadlineReached && $groupHasTotal) ? $this->formatProcuremenMoneyDisplay($groupTotal) : '';
|
|
|
$g['display_rowspan'] = $lineCount + ($lineCount > 0 ? 1 : 0);
|
|
$g['display_rowspan'] = $lineCount + ($lineCount > 0 ? 1 : 0);
|
|
|
$detailPicks = $g['detail_picks'] ?? [];
|
|
$detailPicks = $g['detail_picks'] ?? [];
|
|
|
$g['detail_picks'] = array_values(is_array($detailPicks) ? $detailPicks : []);
|
|
$g['detail_picks'] = array_values(is_array($detailPicks) ? $detailPicks : []);
|
|
@@ -4549,6 +4627,7 @@ class Procuremen extends Backend
|
|
|
protected function buildProcuremenDetailsQuoteView(array $mergeRows, array $details, array $main): array
|
|
protected function buildProcuremenDetailsQuoteView(array $mergeRows, array $details, array $main): array
|
|
|
{
|
|
{
|
|
|
$processRows = $this->buildAuditProcessDisplayRows($mergeRows);
|
|
$processRows = $this->buildAuditProcessDisplayRows($mergeRows);
|
|
|
|
|
+ $deadlineReached = $this->isProcuremenQuoteDeadlineReached($main['sys_rq'] ?? '');
|
|
|
$qtyBySid = [];
|
|
$qtyBySid = [];
|
|
|
$gymcBySid = [];
|
|
$gymcBySid = [];
|
|
|
$orderedSids = [];
|
|
$orderedSids = [];
|
|
@@ -4598,7 +4677,8 @@ class Procuremen extends Backend
|
|
|
&$groupHas,
|
|
&$groupHas,
|
|
|
&$groupVoid,
|
|
&$groupVoid,
|
|
|
$qtyBySid,
|
|
$qtyBySid,
|
|
|
- $gymcBySid
|
|
|
|
|
|
|
+ $gymcBySid,
|
|
|
|
|
+ $deadlineReached
|
|
|
) {
|
|
) {
|
|
|
$isVoid = $this->isPurchaseOrderDetailVoid($d);
|
|
$isVoid = $this->isPurchaseOrderDetailVoid($d);
|
|
|
if (!$isVoid) {
|
|
if (!$isVoid) {
|
|
@@ -4609,13 +4689,9 @@ class Procuremen extends Backend
|
|
|
$sub = null;
|
|
$sub = null;
|
|
|
if (!$isVoid && $amountNum !== null) {
|
|
if (!$isVoid && $amountNum !== null) {
|
|
|
$sub = $this->calcProcuremenDetailSubtotal($d['amount'] ?? null, $qtyStr);
|
|
$sub = $this->calcProcuremenDetailSubtotal($d['amount'] ?? null, $qtyStr);
|
|
|
- if ($sub !== null) {
|
|
|
|
|
- $groupTotal += $sub;
|
|
|
|
|
- $groupHas = true;
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
$ct = $this->resolveDetailSupplierOperTime($d);
|
|
$ct = $this->resolveDetailSupplierOperTime($d);
|
|
|
- $lines[] = [
|
|
|
|
|
|
|
+ $line = [
|
|
|
'cgymc' => $gymcBySid[$sid] ?? trim((string)($d['CGYMC'] ?? '')),
|
|
'cgymc' => $gymcBySid[$sid] ?? trim((string)($d['CGYMC'] ?? '')),
|
|
|
'unit_price_text' => $amountNum !== null ? $this->formatProcuremenMoneyDisplay($amountNum) : trim((string)($d['amount'] ?? '')),
|
|
'unit_price_text' => $amountNum !== null ? $this->formatProcuremenMoneyDisplay($amountNum) : trim((string)($d['amount'] ?? '')),
|
|
|
'subtotal_text' => $sub !== null ? $this->formatProcuremenMoneyDisplay($sub) : '',
|
|
'subtotal_text' => $sub !== null ? $this->formatProcuremenMoneyDisplay($sub) : '',
|
|
@@ -4625,6 +4701,13 @@ class Procuremen extends Backend
|
|
|
'is_void' => $isVoid,
|
|
'is_void' => $isVoid,
|
|
|
'oper_time_text' => $ct,
|
|
'oper_time_text' => $ct,
|
|
|
];
|
|
];
|
|
|
|
|
+ if (!$deadlineReached && !$isVoid) {
|
|
|
|
|
+ $this->maskSupplierQuoteLineBeforeDeadline($line);
|
|
|
|
|
+ } elseif ($sub !== null) {
|
|
|
|
|
+ $groupTotal += $sub;
|
|
|
|
|
+ $groupHas = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ $lines[] = $line;
|
|
|
};
|
|
};
|
|
|
foreach ($orderedSids as $sid) {
|
|
foreach ($orderedSids as $sid) {
|
|
|
if (!isset($bySid[$sid])) {
|
|
if (!isset($bySid[$sid])) {
|
|
@@ -4662,7 +4745,7 @@ class Procuremen extends Backend
|
|
|
'lines' => $lines,
|
|
'lines' => $lines,
|
|
|
'line_count' => $lineCount,
|
|
'line_count' => $lineCount,
|
|
|
'display_rowspan'=> $lineCount + ($lineCount > 0 ? 1 : 0),
|
|
'display_rowspan'=> $lineCount + ($lineCount > 0 ? 1 : 0),
|
|
|
- 'total_text' => $groupHas ? $this->formatProcuremenMoneyDisplay($groupTotal) : '',
|
|
|
|
|
|
|
+ 'total_text' => ($deadlineReached && $groupHas) ? $this->formatProcuremenMoneyDisplay($groupTotal) : '',
|
|
|
'has_total' => $lineCount > 0,
|
|
'has_total' => $lineCount > 0,
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
@@ -6091,6 +6174,7 @@ class Procuremen extends Backend
|
|
|
$this->view->assign('quoteGroupsJson', json_encode($quoteGroups, JSON_UNESCAPED_UNICODE));
|
|
$this->view->assign('quoteGroupsJson', json_encode($quoteGroups, JSON_UNESCAPED_UNICODE));
|
|
|
$this->view->assign('pickedCompanyName', $pickedName);
|
|
$this->view->assign('pickedCompanyName', $pickedName);
|
|
|
$this->view->assign('sysRq', $this->formatProcuremenSysRqForInput($po['sys_rq'] ?? null));
|
|
$this->view->assign('sysRq', $this->formatProcuremenSysRqForInput($po['sys_rq'] ?? null));
|
|
|
|
|
+ $this->view->assign('quoteDeadlineReached', $this->isProcuremenQuoteDeadlineReached($this->resolveBundleSysRq($bundle)) ? 1 : 0);
|
|
|
|
|
|
|
|
return $this->view->fetch('procuremen/audit_issue');
|
|
return $this->view->fetch('procuremen/audit_issue');
|
|
|
}
|
|
}
|
|
@@ -6137,6 +6221,9 @@ class Procuremen extends Backend
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$sysRqDb = $this->parseProcuremenSysRqInput(trim((string)$this->request->post('sys_rq', '')), true);
|
|
$sysRqDb = $this->parseProcuremenSysRqInput(trim((string)$this->request->post('sys_rq', '')), true);
|
|
|
|
|
+ if (!$this->isProcuremenQuoteDeadlineReached($sysRqDb)) {
|
|
|
|
|
+ $this->error('报价截止时间未到,暂不能确认供应商');
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
$ccydhLog = trim((string)($bundle['ccydh'] ?? ''));
|
|
$ccydhLog = trim((string)($bundle['ccydh'] ?? ''));
|
|
|
$procCnt = count($mergeRows);
|
|
$procCnt = count($mergeRows);
|