|
@@ -15,11 +15,15 @@ use think\console\input\Option;
|
|
|
use think\console\Output;
|
|
|
use think\Exception;
|
|
|
use think\facade\Cache;
|
|
|
+use think\facade\Config;
|
|
|
use think\facade\Db;
|
|
|
|
|
|
//C端订单导入-处理
|
|
|
class ImportOrderFromCHandleData extends Command
|
|
|
{
|
|
|
+
|
|
|
+ private $cgd_data = [];//存储采购单的数据,目前是为了做供应商api推送而准备的
|
|
|
+
|
|
|
protected function configure()
|
|
|
{
|
|
|
// 指令配置
|
|
@@ -201,7 +205,7 @@ class ImportOrderFromCHandleData extends Command
|
|
|
'gold_price' => $ct['cgd_gold_price'],
|
|
|
'good_createrid' => $goodinfo['createrid'],
|
|
|
'good_creater' => $goodinfo['creater'],//商品创建人
|
|
|
- 'weight'=>$ct['weight']
|
|
|
+ 'weight' => $ct['weight']
|
|
|
];
|
|
|
|
|
|
$send_num = $extend_data['num'];
|
|
@@ -211,7 +215,7 @@ class ImportOrderFromCHandleData extends Command
|
|
|
|
|
|
$supplier_temp_info = Db::name('supplier')
|
|
|
->field('id,person,personid')
|
|
|
- ->where('code',$ct['supplierNo'])
|
|
|
+ ->where('code', $ct['supplierNo'])
|
|
|
->findOrEmpty();
|
|
|
|
|
|
$data = [
|
|
@@ -293,7 +297,7 @@ class ImportOrderFromCHandleData extends Command
|
|
|
|
|
|
} else {
|
|
|
//库存品
|
|
|
- $bol = $this->RelaCgd(['orderCode' => $orderCode, "good_num" => $good_num, "spuCode" => $spuCode, "companyNo" => $supplierNo, 'order_type' => $order_type, 'order_source' => $order_source,'good_createrid'=>$ct['createrid'],'good_creater'=>$ct['creater']], $standing_book_data);
|
|
|
+ $bol = $this->RelaCgd(['orderCode' => $orderCode, "good_num" => $good_num, "spuCode" => $spuCode, "companyNo" => $supplierNo, 'order_type' => $order_type, 'order_source' => $order_source, 'good_createrid' => $ct['createrid'], 'good_creater' => $ct['creater']], $standing_book_data);
|
|
|
if ($bol == false) throw new Exception('库存商品关联采购单失败');
|
|
|
|
|
|
if (isset($stock)) {
|
|
@@ -422,6 +426,25 @@ class ImportOrderFromCHandleData extends Command
|
|
|
//维护台账记录
|
|
|
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")]));
|
|
|
|
|
|
+ //将采购单数据塞入到队列中
|
|
|
+ if ($this->cgd_data) {
|
|
|
+ $push_data = json_encode([
|
|
|
+ 'supplierNo' => $this->cgd_data['supplierNo'],
|
|
|
+ 'type' => 1,//1销售订单(采销的采购单),2上线结果
|
|
|
+ 'data' => [
|
|
|
+ 'cgdNo' => $this->cgd_data['cgdNo'],
|
|
|
+ 'spuCode' => $this->cgd_data['spuCode'],
|
|
|
+ 'good_name' => $this->cgd_data['good_name'],
|
|
|
+ 'good_num' => $this->cgd_data['good_num'],
|
|
|
+ 'good_price' => $this->cgd_data['good_price'],
|
|
|
+ 'total_fee' => $this->cgd_data['total_fee'],
|
|
|
+ 'weight' => $this->cgd_data['weight'],
|
|
|
+ 'addtime' => $this->cgd_data['addtime'],
|
|
|
+ ],
|
|
|
+ ], JSON_UNESCAPED_UNICODE);
|
|
|
+ Cache::store("redis")->handler()->lPush(Config::get('app.abutment_queue'), $push_data);
|
|
|
+ }
|
|
|
+
|
|
|
Db::commit();
|
|
|
|
|
|
$output->writeln(date('Y-m-d H:i:s') . '|处理成功');
|
|
@@ -502,7 +525,7 @@ class ImportOrderFromCHandleData extends Command
|
|
|
"demo_fee" => $data['demo_fee'],
|
|
|
"nake_fee" => $data['nake_fee'],
|
|
|
"delivery_fee" => $data['delivery_fee'],
|
|
|
- "weight"=>$data['weight'],
|
|
|
+ "weight" => $data['weight'],
|
|
|
"diff_weight" => "0",
|
|
|
"diff_fee" => "0",
|
|
|
"gold_price" => $data['gold_price'],
|
|
@@ -586,6 +609,8 @@ class ImportOrderFromCHandleData extends Command
|
|
|
$good_data[] = ['good_log_code' => $cgdCode, "stock_id" => isset($stoc['id']) ? $stoc['id'] : Db::name("good_stock")->getLastInsID(), "type" => 1, 'stock' => $data['good_num'], "stock_name" => "wait_in_stock"];
|
|
|
GoodLog::LogAdd(['id' => 0, 'nickname' => 'system'], $good_data, "CGD");
|
|
|
|
|
|
+ $this->cgd_data = $cg;
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
} else return false;
|
|
@@ -689,6 +714,7 @@ class ImportOrderFromCHandleData extends Command
|
|
|
$order = Db::name("order_num")->save($data);
|
|
|
if ($order == false) return false;
|
|
|
|
|
|
+ $this->cgd_data = $QrdCgd;
|
|
|
return true;
|
|
|
}
|
|
|
|