|
@@ -36,11 +36,10 @@ class ImportOrderFromCHandleData extends Command
|
|
|
protected function execute(Input $input, Output $output)
|
|
|
{
|
|
|
|
|
|
-// $key = 'import_order_from_c_key';
|
|
|
-// $c_data_id = Cache::store('redis')->handler()->rpop($key);
|
|
|
-
|
|
|
-// if (!$c_data_id) $output->writeln('没有符合条件的记录');
|
|
|
-// else {
|
|
|
+ $key = 'import_order_from_c_key';
|
|
|
+ $c_data_id = Cache::store('redis')->get($key);
|
|
|
+ if($c_data_id==1)return '';
|
|
|
+ Cache::store('redis')->set($key,1,180);
|
|
|
$order_import_from_c_db = new OIFCModel();
|
|
|
|
|
|
$c_data = $order_import_from_c_db
|
|
@@ -121,38 +120,17 @@ class ImportOrderFromCHandleData extends Command
|
|
|
$is_activity = empty($extend_data['activity_name']) ? 0 : 1;
|
|
|
|
|
|
if ($goodinfo['is_stock'] == 1) {
|
|
|
-// $stock = Db::name("good_stock")
|
|
|
-// ->alias("a")
|
|
|
-// ->leftJoin("warehouse_info b", "a.wsm_code=b.wsm_code")
|
|
|
-// ->where(["spuCode" => $spuCode, "a.is_del" => 0, "a.status" => 1, 'b.wsm_type' => 5, "b.companyNo" => $supplierNo])
|
|
|
-// ->field("a.id,a.usable_stock,a.wait_out_stock,a.wsm_code")
|
|
|
-// ->find();
|
|
|
-//
|
|
|
-// if ($stock == false || $stock['usable_stock'] < $good_num) throw new \Exception('库存数量不足');
|
|
|
-// $stock_num =Db::name("good_stock_info")->where(["stockid"=>$stock['id']])->sum('balance_num');
|
|
|
-// if($stock_num < $good_num){
|
|
|
-// throw new \Exception('bn库存数量不足');
|
|
|
-// }
|
|
|
-// $stock_num = Db::name("good_stock")->alias("a")
|
|
|
-// ->leftJoin("warehouse_info b", "a.wsm_code=b.wsm_code")
|
|
|
-// ->leftJoin("good_stock_info c", "a.id=c.stockid and c.balance_num>0")
|
|
|
-// ->where(["spuCode" => $spuCode, "a.is_del" => 0, "a.status" => 1, "b.wsm_type" => 5, "b.companyNo" =>$supplierNo])
|
|
|
-// ->sum('balance_num');
|
|
|
if ($ct['usable_stock'] < $good_num) {
|
|
|
throw new \Exception('商品库存数量不足');
|
|
|
}
|
|
|
$origin_price = 0;
|
|
|
-
|
|
|
} else {
|
|
|
-
|
|
|
$origin = Db::name("good_nake")
|
|
|
->where([["spuCode", "=", $spuCode], ["min_num", "<=", $good_num], ["is_del", "=", 0]])
|
|
|
->order("min_num desc")
|
|
|
->find();
|
|
|
if ($origin == false) throw new \Exception('未找到相关成本价格');
|
|
|
-
|
|
|
$origin_price = $origin['nake_total'];
|
|
|
-
|
|
|
}
|
|
|
|
|
|
$sale_price = $extend_data['price'];
|
|
@@ -436,18 +414,20 @@ class ImportOrderFromCHandleData extends Command
|
|
|
|
|
|
//复用sale::create()方法 -- end
|
|
|
|
|
|
- //处理完成
|
|
|
- $order_import_from_c_db
|
|
|
- ->where('id', $c_data['id'])
|
|
|
- ->where('is_del', OIFCModel::$is_del_normal)
|
|
|
- ->save([
|
|
|
- 'status' => $order_import_from_c_db::$status_success,
|
|
|
- 'updatetime' => date('Y-m-d H:i:s'),
|
|
|
- 'remark' => '',
|
|
|
- 'updateid' => 0,
|
|
|
- 'updater' => 'system',
|
|
|
- 'orderCode' => $orderCode
|
|
|
- ]);
|
|
|
+
|
|
|
+ //处理完成
|
|
|
+ $up= $order_import_from_c_db
|
|
|
+ ->where('id', $c_data['id'])
|
|
|
+ ->where(['is_del'=> OIFCModel::$is_del_normal,'status' => OIFCModel::$status_wait_relation])
|
|
|
+ ->save([
|
|
|
+ 'status' => $order_import_from_c_db::$status_success,
|
|
|
+ 'updatetime' => date('Y-m-d H:i:s'),
|
|
|
+ 'remark' => '',
|
|
|
+ 'updateid' => 0,
|
|
|
+ 'updater' => 'system',
|
|
|
+ 'orderCode' => $orderCode
|
|
|
+ ]);
|
|
|
+ if($up==false)throw new \Exception($c_data['id'].'处理失败');
|
|
|
|
|
|
//维护台账记录
|
|
|
Db::name('standing_book')->insert(array_merge($standing_book_data, ['addtime' => date('Y-m-d H:i:s'), 'updatetime' => date('Y-m-d H:i:s'), 'standBookNo' => makeNo("IO")]));
|
|
@@ -491,7 +471,7 @@ class ImportOrderFromCHandleData extends Command
|
|
|
}
|
|
|
}
|
|
|
// }
|
|
|
-
|
|
|
+ Cache::store('redis')->set($key,0);
|
|
|
}
|
|
|
|
|
|
|