|
@@ -41,7 +41,7 @@ class GluSalaryCalculationService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
foreach ($wageList as $wageItem) {
|
|
foreach ($wageList as $wageItem) {
|
|
|
- $pieceData[] = $this->buildSalarySummaryRow([
|
|
|
|
|
|
|
+ $pieceData[] = $this->buildPieceSalarySummaryRow([
|
|
|
'sczl_gdbh' => $v['工单编号'],
|
|
'sczl_gdbh' => $v['工单编号'],
|
|
|
'sczl_gxmc' => $v['工序名称'],
|
|
'sczl_gxmc' => $v['工序名称'],
|
|
|
'sczl_rq' => $v['日期'],
|
|
'sczl_rq' => $v['日期'],
|
|
@@ -71,18 +71,14 @@ class GluSalaryCalculationService
|
|
|
|
|
|
|
|
$timekeepInsert = [];
|
|
$timekeepInsert = [];
|
|
|
foreach ($timekeepData as $item) {
|
|
foreach ($timekeepData as $item) {
|
|
|
- $remark = $item['remark'] ?? '';
|
|
|
|
|
- if (!empty($item['type'])) {
|
|
|
|
|
- $remark = $remark !== '' ? $item['type'] . ',' . $remark : $item['type'];
|
|
|
|
|
- }
|
|
|
|
|
- $timekeepInsert[] = $this->buildSalarySummaryRow([
|
|
|
|
|
|
|
+ $timekeepInsert[] = $this->buildTimekeepSalarySummaryRow([
|
|
|
'sczl_rq' => $item['sczl_rq'] . ' 00:00:00',
|
|
'sczl_rq' => $item['sczl_rq'] . ' 00:00:00',
|
|
|
'bh' => $item['bh'],
|
|
'bh' => $item['bh'],
|
|
|
'name' => $item['姓名'],
|
|
'name' => $item['姓名'],
|
|
|
'time_salary' => $item['salary'],
|
|
'time_salary' => $item['salary'],
|
|
|
'time_price' => $item['price'],
|
|
'time_price' => $item['price'],
|
|
|
'time_duration' => $item['duration'],
|
|
'time_duration' => $item['duration'],
|
|
|
- 'remark' => $remark,
|
|
|
|
|
|
|
+ 'remark' => $item['remark'] ?? '',
|
|
|
'sys_id' => $params['sys_id'] ?? '',
|
|
'sys_id' => $params['sys_id'] ?? '',
|
|
|
]);
|
|
]);
|
|
|
}
|
|
}
|
|
@@ -148,6 +144,17 @@ class GluSalaryCalculationService
|
|
|
return stripos((string)$jtbh, 'SG') !== false;
|
|
return stripos((string)$jtbh, 'SG') !== false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 员工编号是否参与工资计算(仅纯数字编号)
|
|
|
|
|
+ * @param mixed $bh
|
|
|
|
|
+ * @return bool
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function isValidEmployeeBh($bh)
|
|
|
|
|
+ {
|
|
|
|
|
+ $bh = trim((string)$bh);
|
|
|
|
|
+ return $bh !== '' && $bh !== '0000' && ctype_digit($bh);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 普通机台计件工资
|
|
* 普通机台计件工资
|
|
|
* @param array $report
|
|
* @param array $report
|
|
@@ -161,7 +168,7 @@ class GluSalaryCalculationService
|
|
|
|
|
|
|
|
for ($i = 1; $i <= 30; $i++) {
|
|
for ($i = 1; $i <= 30; $i++) {
|
|
|
$bh = trim($classResult['bh' . $i] ?? '');
|
|
$bh = trim($classResult['bh' . $i] ?? '');
|
|
|
- if ($bh === '' || $bh === '0000') {
|
|
|
|
|
|
|
+ if (!$this->isValidEmployeeBh($bh)) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -187,7 +194,7 @@ class GluSalaryCalculationService
|
|
|
$employees = [];
|
|
$employees = [];
|
|
|
for ($i = 1; $i <= 30; $i++) {
|
|
for ($i = 1; $i <= 30; $i++) {
|
|
|
$bh = trim($classResult['bh' . $i] ?? '');
|
|
$bh = trim($classResult['bh' . $i] ?? '');
|
|
|
- if ($bh === '' || $bh === '0000') {
|
|
|
|
|
|
|
+ if (!$this->isValidEmployeeBh($bh)) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
$employees[] = [
|
|
$employees[] = [
|
|
@@ -333,7 +340,7 @@ class GluSalaryCalculationService
|
|
|
foreach ($list as $row) {
|
|
foreach ($list as $row) {
|
|
|
for ($i = 1; $i <= 30; $i++) {
|
|
for ($i = 1; $i <= 30; $i++) {
|
|
|
$bh = isset($row['bh' . $i]) ? trim($row['bh' . $i]) : '';
|
|
$bh = isset($row['bh' . $i]) ? trim($row['bh' . $i]) : '';
|
|
|
- if ($bh !== '' && $bh !== '0000') {
|
|
|
|
|
|
|
+ if ($this->isValidEmployeeBh($bh)) {
|
|
|
$employeeIds[$bh] = true;
|
|
$employeeIds[$bh] = true;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -355,7 +362,7 @@ class GluSalaryCalculationService
|
|
|
$employees = [];
|
|
$employees = [];
|
|
|
for ($i = 1; $i <= 30; $i++) {
|
|
for ($i = 1; $i <= 30; $i++) {
|
|
|
$bh = isset($row['bh' . $i]) ? trim($row['bh' . $i]) : '';
|
|
$bh = isset($row['bh' . $i]) ? trim($row['bh' . $i]) : '';
|
|
|
- if ($bh !== '' && $bh !== '0000') {
|
|
|
|
|
|
|
+ if ($this->isValidEmployeeBh($bh)) {
|
|
|
$employees[] = $bh;
|
|
$employees[] = $bh;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -426,7 +433,7 @@ class GluSalaryCalculationService
|
|
|
foreach ($list as $row) {
|
|
foreach ($list as $row) {
|
|
|
for ($i = 1; $i <= 6; $i++) {
|
|
for ($i = 1; $i <= 6; $i++) {
|
|
|
$bh = isset($row['wgjs_bh' . $i]) ? trim($row['wgjs_bh' . $i]) : '';
|
|
$bh = isset($row['wgjs_bh' . $i]) ? trim($row['wgjs_bh' . $i]) : '';
|
|
|
- if ($bh !== '') {
|
|
|
|
|
|
|
+ if ($this->isValidEmployeeBh($bh)) {
|
|
|
$employeeIds[$bh] = true;
|
|
$employeeIds[$bh] = true;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -450,7 +457,7 @@ class GluSalaryCalculationService
|
|
|
|
|
|
|
|
for ($i = 1; $i <= 6; $i++) {
|
|
for ($i = 1; $i <= 6; $i++) {
|
|
|
$bh = isset($row['wgjs_bh' . $i]) ? trim($row['wgjs_bh' . $i]) : '';
|
|
$bh = isset($row['wgjs_bh' . $i]) ? trim($row['wgjs_bh' . $i]) : '';
|
|
|
- if ($bh === '') {
|
|
|
|
|
|
|
+ if (!$this->isValidEmployeeBh($bh)) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -514,6 +521,47 @@ class GluSalaryCalculationService
|
|
|
return $data;
|
|
return $data;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 构建计件工资汇总行(仅填 price、salary,计时字段为 0)
|
|
|
|
|
+ * @param array $fields
|
|
|
|
|
+ * @return array
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function buildPieceSalarySummaryRow(array $fields = [])
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->buildSalarySummaryRow(array_merge([
|
|
|
|
|
+ 'time_salary' => 0,
|
|
|
|
|
+ 'time_price' => 0,
|
|
|
|
|
+ 'time_duration' => 0,
|
|
|
|
|
+ 'remark' => '',
|
|
|
|
|
+ ], $fields));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 构建计时工资汇总行(仅填 time_price、time_salary、time_duration、remark,计件字段为 0)
|
|
|
|
|
+ * @param array $fields
|
|
|
|
|
+ * @return array
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function buildTimekeepSalarySummaryRow(array $fields = [])
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->buildSalarySummaryRow(array_merge([
|
|
|
|
|
+ 'sczl_gdbh' => '',
|
|
|
|
|
+ 'sczl_gxmc' => '',
|
|
|
|
|
+ 'sczl_dedh' => '',
|
|
|
|
|
+ 'sczl_cl' => 0,
|
|
|
|
|
+ '工价系数' => '',
|
|
|
|
|
+ '保养工时' => '',
|
|
|
|
|
+ '装版工时' => '',
|
|
|
|
|
+ '异常工时' => '',
|
|
|
|
|
+ '设备运行工时' => '',
|
|
|
|
|
+ 'sczl_jtbh' => '',
|
|
|
|
|
+ 'cpdh' => '',
|
|
|
|
|
+ 'cpmc' => '',
|
|
|
|
|
+ 'rate' => '',
|
|
|
|
|
+ 'salary' => 0,
|
|
|
|
|
+ 'price' => 0,
|
|
|
|
|
+ ], $fields));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 构建工资汇总统一字段结构
|
|
* 构建工资汇总统一字段结构
|
|
|
* @param array $fields
|
|
* @param array $fields
|