|
|
@@ -1176,6 +1176,14 @@ class GluingReport extends Api
|
|
|
return $this->resolveManualStripPriceSilent($rows, $gxmc, $count);
|
|
|
}
|
|
|
|
|
|
+ if (strpos($gxmc, '贴磁铁') !== false) {
|
|
|
+ return $this->resolveManualCountPriceFromDb('手工贴磁铁', $count, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (strpos($gxmc, '贴片') !== false) {
|
|
|
+ return $this->resolveManualCountPriceFromDb('手工贴片', $count, false);
|
|
|
+ }
|
|
|
+
|
|
|
$row = db('machine_price')
|
|
|
->where('machine_id', $gxmc)
|
|
|
->whereOr('machine_name', 'like', '%' . $gxmc . '%')
|
|
|
@@ -1366,6 +1374,14 @@ class GluingReport extends Api
|
|
|
return $this->resolveManualStripPrice($rows, $gxmc, $count);
|
|
|
}
|
|
|
|
|
|
+ if (strpos($gxmc, '贴磁铁') !== false) {
|
|
|
+ return $this->resolveManualCountPriceFromDb('手工贴磁铁', $count, true);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (strpos($gxmc, '贴片') !== false) {
|
|
|
+ return $this->resolveManualCountPriceFromDb('手工贴片', $count, true);
|
|
|
+ }
|
|
|
+
|
|
|
// 其他手工工序:按 machine_id 或 machine_name 匹配
|
|
|
$row = db('machine_price')
|
|
|
->where('machine_id', $gxmc)
|
|
|
@@ -1374,6 +1390,30 @@ class GluingReport extends Api
|
|
|
return $row ? (float)$row['price1'] : null;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 按拼数查询手工工序单价(machine_name 存拼数)
|
|
|
+ * @param string $machineId
|
|
|
+ * @param int|null $count
|
|
|
+ * @param bool $errorOnMissingCount
|
|
|
+ * @return float|null
|
|
|
+ */
|
|
|
+ protected function resolveManualCountPriceFromDb($machineId, $count, $errorOnMissingCount = false)
|
|
|
+ {
|
|
|
+ if ($count === null) {
|
|
|
+ if ($errorOnMissingCount) {
|
|
|
+ $this->error('请传入拼数(纯数字)');
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ $row = db('machine_price')
|
|
|
+ ->where('machine_id', $machineId)
|
|
|
+ ->where('machine_name', (string)$count)
|
|
|
+ ->find();
|
|
|
+
|
|
|
+ return $row ? (float)$row['price1'] : null;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 提取孔数/拼数(前端传入纯数字)
|
|
|
* @param array $params
|