diff --git a/resources/views/business/pages/posting-data/kuka-reconciliation.blade.php b/resources/views/business/pages/posting-data/kuka-reconciliation.blade.php index abe75b9f..dae6e2de 100644 --- a/resources/views/business/pages/posting-data/kuka-reconciliation.blade.php +++ b/resources/views/business/pages/posting-data/kuka-reconciliation.blade.php @@ -1,40 +1,119 @@ @php + $simpleHeaders = static fn (array $labels): array => array_map( + static fn (string $label): array => ['label' => $label, 'code' => ''], + $labels, + ); + $pairedHeaders = static function (array $labels, array $codes): array { + return array_map( + static function (string $label, int $index) use ($codes): array { + $code = trim((string) ($codes[$index] ?? '')); + + return [ + 'label' => $label, + 'code' => $code === $label ? '' : $code, + ]; + }, + $labels, + array_keys($labels), + ); + }; $tabs = [ [ 'slug' => 'posting-data', 'title' => '顾家过账数据', 'icon' => 'dataset', - 'description' => '顾家过账数据对账页面已建立,待接入订单与过账数据。', + 'description' => '已按工作簿4“顾家过账数据”子表放入表头,数据待接入。', + 'source_sheet' => '顾家过账数据', + 'headers' => $simpleHeaders([ + '年份', '月份', '物料编号', '物料描述', '采购数量', '单价', '供货商金额', + ]), ], [ 'slug' => 'toc-orders', 'title' => 'TOC订单', 'icon' => 'shopping_cart', - 'description' => 'TOC 订单对账页面已建立,待接入订单明细。', + 'description' => '已按工作簿4“TOC订单”子表放入表头,订单明细待接入。', + 'source_sheet' => 'TOC订单', + 'headers' => $simpleHeaders([ + '年份', '月份', '订单号', '物料编号', '物料描述', '发货数量', + ]), ], [ 'slug' => 'lingshan-virtual-posting', 'title' => '灵珊虚拟过账', 'icon' => 'swap_horiz', - 'description' => '灵珊虚拟过账页面已建立,待接入虚拟过账数据。', + 'description' => '已按工作簿4“灵珊虚拟过账”子表放入表头,数据待接入。', + 'source_sheet' => '灵珊虚拟过账', + 'headers' => $simpleHeaders([ + '年份', '月份', '序号', '顾家料号', '品名', '采购数量', '单价', '供货商金额', + '销售单价', '销售金额', '供货商', '供应商编码', '淘宝单号', 'N单号', '装载号', + '导入时间', + ]), ], [ 'slug' => 'erp-product-import', 'title' => '顾家ERP商品导入', 'icon' => 'inventory_2', - 'description' => '顾家 ERP 商品导入页面已建立,待接入商品导入流程。', + 'description' => '已按工作簿4“顾家ERP商品导入”子表的双行表头放入字段和导入编码。', + 'source_sheet' => '顾家ERP商品导入', + 'headers' => $pairedHeaders( + [ + '年份', '月份', '网店编号(必填)', '商城单号(必填)', '商城SKU编号(必填)', + '商品数量(必填)', '商城明细单号', '销售类型(必填)(0-销售,1-赠品)', + '成交单价(必填)', '金额(必填)', '实付金额', '下单时间(必填)', '付款时间(必填)', + '交期时间(必填)', '商品标题', '商品规格', '收货人(必填)', '收货人电话', + '收货人手机(必填)', '买家备注', '邮编', '收货人的所在省份(必填)', + '收货人的所在城市(必填)', '收货人的所在区(县)(必填)', '收货人街道', + '收货地址(必填)', '快递公司', '运费(必填)', '商城状态', '卖家备注', + '订单备注', '买家昵称(必填)', '实际下单店铺', '国补主体', + ], + [ + '', '', 'depotId', 'billsPlatformId', 'clothingId', 'billsNums', + 'billsPlatformSubId', 'saleType', 'accSprice', 'accSums', 'payment', + 'billsCreateDate', 'billsPayDate', 'plannedDeliveryDate', 'clothTitle', + 'clothSpecs', 'clientName', 'clientTel', 'clientMobile', 'billsClientRemark', + 'clientPostCode', 'clientProvince', 'clientCity', 'clientArea', 'clientStreet', + 'clientAddress', 'logisticsId', 'freight', 'billsPlatformState', + 'billsSellerRemark', 'billsRemark', 'buyerNick', 'setdepotId', + 'nationalSubsidySubject', + ], + ), ], [ 'slug' => 'invoice-entry-template', 'title' => '开票填写模板-货物-灵珊', 'icon' => 'description', - 'description' => '灵珊货物开票填写模板页面已建立。', + 'description' => '已按工作簿4“开票填写模板-货物-灵珊”子表放入表头。', + 'source_sheet' => '开票填写模板-货物-灵珊', + 'headers' => $simpleHeaders([ + '年份', '月份', '开票公司', '单据号(订单号)', '备注(没有就空着)', '货物名称', + '规格型号', '税收分类', '单位', '开票数量', '开票金额(含税,两位小数)', '税率', + '开票抬头', '开票税号', '开票地址', '开票电话', '开户银行', '开户账号', + '提交人邮箱', '提交人电话(手机)', + ]), ], [ 'slug' => 'inventory-management-template', 'title' => '库存管理模板', 'icon' => 'warehouse', - 'description' => '库存管理模板页面已建立。', + 'description' => '已按工作簿4“库存管理模版”子表的双行表头放入字段和接口编码。', + 'source_sheet' => '库存管理模版', + 'headers' => $pairedHeaders( + [ + '年份', '月份', '供应商ELS账号', 'SAP编码', '供应商ELS名称', '物料编号(*)', + '物料描述', '库存数量', '可用库存数量(含预生产)', '半成品库存', '3个月内库存', + '6个月以上库存', '3-6个月库存', '在制数量', '入库数量', '出库数量', '物料名称', + '物料规格', '货号', '品名', '库存属性', '采购员', '业务员', '经营部', + '物料批次', '最后修改时间', '预生产数量', '实际可用库存数量', + ], + [ + '年份', '月份', 'fbk6', 'toElsAccount', 'toElsAccountName', 'materialNumber', + 'materialDesc', 'stockQuantity', 'availableStockQuantity', 'fbk2', 'fbk3', + 'fbk5', 'fbk4', 'fbk8', 'stockInQuantity', 'stockOutQuantity', + 'materialName', 'materialSpecifications', 'fbk9', 'fbk10', 'fbk1', 'fbk15', + 'fbk14', 'fbk16', 'fbk7', 'lastUpdateDate', 'fbk18', 'fbk19', + ], + ), ], [ 'slug' => 'lingshan-statement', @@ -55,6 +134,7 @@ ? $requestedSubmenu : 'posting-data'; $placeholder = 'business.pages.posting-data.partials.kuka-posting-placeholder'; + $sourceTable = 'business.pages.posting-data.partials.kuka-reconciliation-source-table'; @endphp
@@ -72,11 +152,21 @@ aria-labelledby="kuka-reconciliation-tab-{{ $tab['slug'] }}" @if ($activeView !== $tab['slug']) hidden @endif > - @include($placeholder, [ - 'title' => $tab['title'], - 'description' => $tab['description'], - 'icon' => $tab['icon'], - ]) + @if (! empty($tab['headers'])) + @include($sourceTable, [ + 'title' => $tab['title'], + 'description' => $tab['description'], + 'icon' => $tab['icon'], + 'sourceSheet' => $tab['source_sheet'], + 'headers' => $tab['headers'], + ]) + @else + @include($placeholder, [ + 'title' => $tab['title'], + 'description' => $tab['description'], + 'icon' => $tab['icon'], + ]) + @endif @endforeach
diff --git a/resources/views/business/pages/posting-data/partials/kuka-reconciliation-source-table.blade.php b/resources/views/business/pages/posting-data/partials/kuka-reconciliation-source-table.blade.php new file mode 100644 index 00000000..c73fc218 --- /dev/null +++ b/resources/views/business/pages/posting-data/partials/kuka-reconciliation-source-table.blade.php @@ -0,0 +1,155 @@ +
+
+ +
+

{{ $title }}

+

{{ $description }}

+
+ + 工作簿4 · {{ $sourceSheet }} · {{ count($headers) }} 列 + +
+ +
+ + + + @foreach ($headers as $header) + + @endforeach + + +
+ {{ $header['label'] }} + @if ($header['code'] !== '') + {{ $header['code'] }} + @endif +
+
+
+ + diff --git a/tests/Feature/Business/KukaReconciliationPageTest.php b/tests/Feature/Business/KukaReconciliationPageTest.php index bffaa81b..f9f299b0 100644 --- a/tests/Feature/Business/KukaReconciliationPageTest.php +++ b/tests/Feature/Business/KukaReconciliationPageTest.php @@ -8,7 +8,7 @@ class KukaReconciliationPageTest extends FeatureTestCase { public function test_renders_all_kuka_reconciliation_tabs_with_the_first_tab_active(): void { - $this->loginAs() + $response = $this->loginAs() ->get(route('business.pages.show', [ 'section' => 'posting-data', 'page' => 'kuka-reconciliation', @@ -27,7 +27,38 @@ class KukaReconciliationPageTest extends FeatureTestCase ->assertSee('data-kuka-reconciliation-panel="posting-data"', false) ->assertSee('data-kuka-reconciliation-panel="oberna-statement"', false) ->assertSee('id="kuka-reconciliation-tab-posting-data"', false) - ->assertSee('class="kuka-reconciliation-subnav__tab is-active"', false); + ->assertSee('class="kuka-reconciliation-subnav__tab is-active"', false) + ->assertSee('data-kuka-reconciliation-template="顾家过账数据"', false) + ->assertSee('data-kuka-reconciliation-template="TOC订单"', false) + ->assertSee('data-kuka-reconciliation-template="灵珊虚拟过账"', false) + ->assertSee('data-kuka-reconciliation-template="顾家ERP商品导入"', false) + ->assertSee('data-kuka-reconciliation-template="开票填写模板-货物-灵珊"', false) + ->assertSee('data-kuka-reconciliation-template="库存管理模版"', false) + ->assertSeeText('供货商金额') + ->assertSeeText('装载号') + ->assertSeeText('nationalSubsidySubject') + ->assertSeeText('提交人电话(手机)') + ->assertSeeText('toElsAccount') + ->assertSeeText('实际可用库存数量') + ->assertSeeText('灵珊对账单页面已建立') + ->assertSeeText('欧伯娜对账单页面已建立'); + + $html = $response->getContent(); + $this->assertSame([ + 'posting-data' => 7, + 'toc-orders' => 6, + 'lingshan-virtual-posting' => 16, + 'erp-product-import' => 34, + 'invoice-entry-template' => 20, + 'inventory-management-template' => 28, + ], [ + 'posting-data' => $this->headerCount($html, 'posting-data'), + 'toc-orders' => $this->headerCount($html, 'toc-orders'), + 'lingshan-virtual-posting' => $this->headerCount($html, 'lingshan-virtual-posting'), + 'erp-product-import' => $this->headerCount($html, 'erp-product-import'), + 'invoice-entry-template' => $this->headerCount($html, 'invoice-entry-template'), + 'inventory-management-template' => $this->headerCount($html, 'inventory-management-template'), + ]); } public function test_kuka_reconciliation_tab_can_open_directly_from_the_url(): void @@ -42,6 +73,21 @@ class KukaReconciliationPageTest extends FeatureTestCase ->assertSee('id="kuka-reconciliation-tab-toc-orders"', false) ->assertSee('class="kuka-reconciliation-subnav__tab is-active"', false) ->assertSee('data-kuka-reconciliation-panel="toc-orders"', false) - ->assertSeeText('TOC 订单对账页面已建立'); + ->assertSee('data-kuka-reconciliation-template="TOC订单"', false) + ->assertSeeText('订单号') + ->assertSeeText('发货数量'); + } + + private function headerCount(string $html, string $slug): int + { + $panelStart = strpos($html, 'data-kuka-reconciliation-panel="'.$slug.'"'); + $this->assertNotFalse($panelStart); + $panelEnd = strpos($html, '', $panelStart); + $this->assertNotFalse($panelEnd); + $panel = substr($html, $panelStart, $panelEnd - $panelStart); + + preg_match_all('//', $panel, $matches); + + return count($matches[0]); } }