|
|
@@ -53,6 +53,10 @@ class PrintPlanner
|
|
|
$processes = self::resolveProcesses($workorder['processes'], $product ? $product['processes'] : [], $options);
|
|
|
$qtyDefault = $workorder['qty'];
|
|
|
$sheetQtyDefault = $workorder['sheet_qty'];
|
|
|
+ $storedSpec = trim((string)($workorder['spec'] ?? ''));
|
|
|
+ if ($storedSpec === '' && $product) {
|
|
|
+ $storedSpec = trim((string)$product['spec']);
|
|
|
+ }
|
|
|
$header = [
|
|
|
'workorder_id' => (int)$workorder['id'],
|
|
|
'workorder_no' => self::pickText($options, 'no', (string)$workorder['no']),
|
|
|
@@ -60,6 +64,7 @@ class PrintPlanner
|
|
|
'plan_date' => (string)$workorder['plan_date'],
|
|
|
'customer' => (string)$workorder['customer'],
|
|
|
'remark' => (string)$workorder['remark'],
|
|
|
+ 'spec' => $storedSpec,
|
|
|
];
|
|
|
$storedName = trim((string)($workorder['product_name'] ?? ''));
|
|
|
$nameOverride = self::pickText($options, 'name', $storedName);
|
|
|
@@ -68,8 +73,11 @@ class PrintPlanner
|
|
|
}
|
|
|
if ($nameOverride !== '' && $product) {
|
|
|
$product['name'] = $nameOverride;
|
|
|
+ if ($storedSpec !== '') {
|
|
|
+ $product['spec'] = $storedSpec;
|
|
|
+ }
|
|
|
} elseif ($nameOverride !== '') {
|
|
|
- $product = ['id' => 0, 'code' => '', 'name' => $nameOverride, 'spec' => '', 'unit' => ''];
|
|
|
+ $product = ['id' => 0, 'code' => '', 'name' => $nameOverride, 'spec' => $storedSpec, 'unit' => ''];
|
|
|
}
|
|
|
} elseif ($bizId > 0) {
|
|
|
$product = Product::with('processes')->find($bizId);
|
|
|
@@ -131,6 +139,12 @@ class PrintPlanner
|
|
|
$processNames[] = $item['name'];
|
|
|
}
|
|
|
|
|
|
+ $specText = isset($header['spec'])
|
|
|
+ ? (string)$header['spec']
|
|
|
+ : ($product ? (string)$product['spec'] : '');
|
|
|
+ if ($specText === '' && $product) {
|
|
|
+ $specText = (string)$product['spec'];
|
|
|
+ }
|
|
|
$fill = [
|
|
|
'factory.name' => (string)$factory['name'],
|
|
|
'factory.code' => (string)$factory['code'],
|
|
|
@@ -139,7 +153,7 @@ class PrintPlanner
|
|
|
'product.id' => $product ? (int)$product['id'] : 0,
|
|
|
'product.code' => $product ? (string)$product['code'] : '',
|
|
|
'product.name' => $product ? (string)$product['name'] : '',
|
|
|
- 'product.spec' => $product ? (string)$product['spec'] : '',
|
|
|
+ 'product.spec' => $specText,
|
|
|
'product.unit' => $product ? (string)$product['unit'] : '',
|
|
|
'workorder.no' => $header['workorder_no'],
|
|
|
'workorder.qty' => self::formatQty($qty),
|
|
|
@@ -150,6 +164,7 @@ class PrintPlanner
|
|
|
'workorder.plan_date' => $header['plan_date'],
|
|
|
'workorder.customer' => $header['customer'],
|
|
|
'workorder.remark' => $header['remark'],
|
|
|
+ 'workorder.spec' => $specText,
|
|
|
'process_names' => implode('、', $processNames),
|
|
|
'sheet_qty' => self::formatQty($sheetQty),
|
|
|
'operator' => $operator ? (string)($operator['nickname'] ?: $operator['username']) : '',
|
|
|
@@ -979,6 +994,7 @@ class PrintPlanner
|
|
|
['key' => 'qr', 'label' => '二维码区域'],
|
|
|
['key' => 'workorder.plan_date', 'label' => '计划日期'],
|
|
|
['key' => 'workorder.customer', 'label' => '客户'],
|
|
|
+ ['key' => 'workorder.spec', 'label' => '工单规格'],
|
|
|
['key' => 'workorder.remark', 'label' => '备注'],
|
|
|
['key' => 'sheet.qty', 'label' => '本张数量'],
|
|
|
['key' => 'sheet.no_text', 'label' => '页码'],
|
|
|
@@ -1064,7 +1080,7 @@ class PrintPlanner
|
|
|
'码包号' => 'workorder.pack_no', '包号' => 'workorder.pack_no',
|
|
|
'客户' => 'workorder.customer',
|
|
|
'日期' => 'workorder.plan_date', '计划日' => 'workorder.plan_date',
|
|
|
- '备注' => 'workorder.remark', '操作员' => 'operator', '时间' => 'print_time',
|
|
|
+ '备注' => 'workorder.remark', '工单规格' => 'workorder.spec', '操作员' => 'operator', '时间' => 'print_time',
|
|
|
'页码' => 'sheet.no_text', '工序' => 'process_names',
|
|
|
];
|
|
|
if (preg_match('/^二维码/', $name) || $name === 'QR' || $name === 'qr') {
|