|
|
@@ -458,7 +458,7 @@ public function getList()
|
|
|
$mongodb = Db::connect(config('database.mongodb'));
|
|
|
$this->saveFinishStock($data, $mongodb);
|
|
|
|
|
|
- // Y2608001 及以后工单才同步中间表,更早工单不同步
|
|
|
+ // 接单日期在 2026-08-01 及以后,且中间库 U8_06工单资料存在该工单时才同步
|
|
|
if ($this->shouldSyncFinishStockMiddle($data['jjcp_gdbh'])) {
|
|
|
try {
|
|
|
$synchronization = new \app\api\controller\Synchronization();
|
|
|
@@ -569,7 +569,7 @@ public function getList()
|
|
|
if($bool===false) $this->error('失败');
|
|
|
|
|
|
$gdbh = isset($data['jjcp_gdbh']) ? $data['jjcp_gdbh'] : db('成品入仓')->where('UniqId', $req['UniqId'])->value('jjcp_gdbh');
|
|
|
- // Y2608001 及以后工单才同步中间表,更早工单不同步
|
|
|
+ // 接单日期在 2026-08-01 及以后,且中间库 U8_06工单资料存在该工单时才同步
|
|
|
if ($this->shouldSyncFinishStockMiddle($gdbh)) {
|
|
|
try {
|
|
|
$synchronization = new \app\api\controller\Synchronization();
|
|
|
@@ -600,7 +600,7 @@ public function getList()
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 修改
|
|
|
+ * 删除
|
|
|
* @ApiMethod (POST)
|
|
|
* @param string 'UniqId'
|
|
|
*/
|
|
|
@@ -1484,7 +1484,10 @@ public function getList()
|
|
|
|
|
|
/**
|
|
|
* 是否需要同步成品入仓中间表
|
|
|
- * 规则:工单编号以 Y 开头,格式为 Y + 年月(YYMM) + 流水号;仅 Y2608001 及以后同步
|
|
|
+ * 规则:
|
|
|
+ * 1. 工单编号以 Y 开头,且 >= Y2608001
|
|
|
+ * 2. 工单_基本资料.接单日期 >= 2026-08-01
|
|
|
+ * 3. 中间库 U8_06工单资料 中存在该工单编号
|
|
|
* @param string $gdbh
|
|
|
* @return bool
|
|
|
*/
|
|
|
@@ -1494,7 +1497,22 @@ public function getList()
|
|
|
if ($gdbh === '' || $gdbh[0] !== 'Y') {
|
|
|
return false;
|
|
|
}
|
|
|
- return (int)substr($gdbh, 1) >= 2608001;
|
|
|
+ if ((int)substr($gdbh, 1) < 2608001) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ $orderDate = db('工单_基本资料')->where('Gd_gdbh', $gdbh)->value('接单日期');
|
|
|
+ if (empty($orderDate)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (strtotime(trim((string)$orderDate)) < strtotime('2026-08-01')) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 与 syncFinishStockMiddle 一致:测试库 database.db8;正式库可改为 database.db3
|
|
|
+ $middleDb = Db::connect(config('database.db8'));
|
|
|
+ $exists = $middleDb->name('U8_06工单资料')->where('工单编号', $gdbh)->count();
|
|
|
+ return $exists > 0;
|
|
|
}
|
|
|
|
|
|
/**
|