|
@@ -231,7 +231,7 @@ class ReportingWork extends Api
|
|
|
$standardMinutes = floatval($item['standard_minutes']);
|
|
$standardMinutes = floatval($item['standard_minutes']);
|
|
|
$productionHour = $standardHour * $number;
|
|
$productionHour = $standardHour * $number;
|
|
|
$productionScore = $standardScore * $number;
|
|
$productionScore = $standardScore * $number;
|
|
|
- $productionMoney = $money * $number;
|
|
|
|
|
|
|
+ $salary = $this->calcReportSalary($number, $standardScore);
|
|
|
$partCode = null;
|
|
$partCode = null;
|
|
|
if (isset($item['part_code']) && $item['part_code'] !== '') {
|
|
if (isset($item['part_code']) && $item['part_code'] !== '') {
|
|
|
$partCode = intval($item['part_code']);
|
|
$partCode = intval($item['part_code']);
|
|
@@ -254,7 +254,7 @@ class ReportingWork extends Api
|
|
|
'number' => $number,
|
|
'number' => $number,
|
|
|
'production_hour' => round($productionHour, 4),
|
|
'production_hour' => round($productionHour, 4),
|
|
|
'production_score' => round($productionScore, 4),
|
|
'production_score' => round($productionScore, 4),
|
|
|
- 'salary' => round($productionMoney, 4),
|
|
|
|
|
|
|
+ 'salary' => $salary,
|
|
|
'machine' => isset($item['machine']) ? $item['machine'] : '',
|
|
'machine' => isset($item['machine']) ? $item['machine'] : '',
|
|
|
'sys_id' => isset($item['sys_id']) ? $item['sys_id'] : '',
|
|
'sys_id' => isset($item['sys_id']) ? $item['sys_id'] : '',
|
|
|
'sys_rq' => $now,
|
|
'sys_rq' => $now,
|
|
@@ -418,14 +418,33 @@ class ReportingWork extends Api
|
|
|
if (empty($params['mod_id'])) {
|
|
if (empty($params['mod_id'])) {
|
|
|
$this->error('修改人不能为空');
|
|
$this->error('修改人不能为空');
|
|
|
}
|
|
}
|
|
|
|
|
+ if (!isset($params['number']) || $params['number'] === '') {
|
|
|
|
|
+ $this->error('产量不能为空');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $number = floatval($params['number']);
|
|
|
|
|
+ $standardScore = (isset($params['standard_score']) && $params['standard_score'] !== '')
|
|
|
|
|
+ ? floatval($params['standard_score']) : null;
|
|
|
|
|
+ $productionScore = isset($params['production_score']) && $params['production_score'] !== ''
|
|
|
|
|
+ ? floatval($params['production_score']) : null;
|
|
|
|
|
+
|
|
|
|
|
+ if ($standardScore !== null) {
|
|
|
|
|
+ $productionScore = round($standardScore * $number, 4);
|
|
|
|
|
+ $salary = $this->calcReportSalary($number, $standardScore);
|
|
|
|
|
+ } elseif ($productionScore !== null) {
|
|
|
|
|
+ $salary = round($productionScore * 0.067, 4);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $this->error('标准工分不能为空');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$data = [
|
|
$data = [
|
|
|
'mod_id' => $params['mod_id'],
|
|
'mod_id' => $params['mod_id'],
|
|
|
'mod_rq' => date('Y-m-d H:i:s'),
|
|
'mod_rq' => date('Y-m-d H:i:s'),
|
|
|
- 'number' => $params['number'],
|
|
|
|
|
|
|
+ 'number' => $number,
|
|
|
'production_hour' => $params['production_hour'],
|
|
'production_hour' => $params['production_hour'],
|
|
|
- 'production_score' => $params['production_score'],
|
|
|
|
|
- 'money' => $params['money'],
|
|
|
|
|
- 'salary' => $params['money'] * $params['number'],
|
|
|
|
|
|
|
+ 'production_score' => $productionScore,
|
|
|
|
|
+ 'money' => isset($params['money']) ? $params['money'] : 0,
|
|
|
|
|
+ 'salary' => $salary,
|
|
|
];
|
|
];
|
|
|
$result = db('设备_工分计酬')
|
|
$result = db('设备_工分计酬')
|
|
|
->where('id', $params['id'])
|
|
->where('id', $params['id'])
|
|
@@ -500,4 +519,15 @@ class ReportingWork extends Api
|
|
|
->select();
|
|
->select();
|
|
|
$this->success('成功', $rows);
|
|
$this->success('成功', $rows);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 报工工资:数量 × 工分 × 0.067
|
|
|
|
|
+ * @param mixed $number
|
|
|
|
|
+ * @param mixed $standardScore
|
|
|
|
|
+ * @return float
|
|
|
|
|
+ */
|
|
|
|
|
+ private function calcReportSalary($number, $standardScore)
|
|
|
|
|
+ {
|
|
|
|
|
+ return round(floatval($number) * floatval($standardScore) * 0.067, 4);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|