|
|
@@ -453,8 +453,9 @@ public function getList()
|
|
|
}
|
|
|
|
|
|
$this->validateMaterialReceived($data['jjcp_gdbh'], $data['jjcp_yjno']);
|
|
|
-
|
|
|
+
|
|
|
$data['UniqId'] = $this->generateFinishStockUniqId();
|
|
|
+
|
|
|
$mongodb = Db::connect(config('database.mongodb'));
|
|
|
$this->saveFinishStock($data, $mongodb);
|
|
|
|
|
|
@@ -467,7 +468,7 @@ public function getList()
|
|
|
$this->error('成品入仓已保存,但' . $e->getMessage(), ['UniqId' => $data['UniqId']]);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if ($this->isEndBoard($data['jjcp_smb'])) {
|
|
|
$this->handleEndBoardSuperLoss($data['jjcp_gdbh'], $data['jjcp_yjno']);
|
|
|
}
|
|
|
@@ -1509,13 +1510,17 @@ public function getList()
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 判断是否为末版
|
|
|
+ * 判断是否为末版(仅判断首字符是否为「末」)
|
|
|
* @param string $smb
|
|
|
* @return bool
|
|
|
*/
|
|
|
protected function isEndBoard($smb)
|
|
|
{
|
|
|
- return strpos((string)$smb, '末') !== false;
|
|
|
+ $smb = preg_replace('/^[\s\x{3000}]+|[\s\x{3000}]+$/u', '', (string)$smb);
|
|
|
+ if ($smb === '') {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return mb_substr($smb, 0, 1, 'UTF-8') === '末';
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1545,8 +1550,9 @@ public function getList()
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- // 与 syncFinishStockMiddle 一致:测试库 database.db8;正式库可改为 database.db3
|
|
|
- $middleDb = Db::connect(config('database.db8'));
|
|
|
+ // db3:正式中间库,仅查询 U8_06工单资料是否存在该工单
|
|
|
+ // 实际写入走 syncFinishStockMiddle 中的 database.db8(本地 MySQL 测试库)
|
|
|
+ $middleDb = Db::connect(config('database.db3'));
|
|
|
$exists = $middleDb->name('U8_06工单资料')->where('工单编号', $gdbh)->count();
|
|
|
return $exists > 0;
|
|
|
}
|