Parcourir la source

Merge branch 'version1.5' of wugg/phpstock into master-online

wugg il y a 2 ans
Parent
commit
66b8f29277

+ 8 - 1
app/admin/controller/Filing.php

@@ -54,6 +54,7 @@ class Filing extends Base
 	 		"tax"=>"",
 	 		"goodNum"=>"",
 	 		"goodPrice"=>"",
+	 		"goodUnit"=>"",
 	 		"mobile"=>"",
 	 		"addr"=>"",
 	 		"addr_code"=>"",
@@ -76,6 +77,7 @@ class Filing extends Base
 	 		"khNo|客户公司编号"=>"require|max:255|min:1",
 	 		"qrdType|订单类型"=>"require|number|in:1,2,3",
 	 		"goodName|商品名称"=>"require|max:255|min:1",
+	 		"goodUnit|商品单位"=>"require|number|gt:0",
 	 		"tax|税率"=>"require|number|gt:0",
 	 		"goodNum|商品数量"=>"require|number|gt:0",
 	 		"goodPrice|商品单价"=>"require|float|gt:0",
@@ -188,7 +190,7 @@ class Filing extends Base
 			"good_name"=>$param['goodName'],
 			"brand_id"=>0,
 			"cat_id"=>$param['cat_id'],
-			"good_unit"=>'',
+			"good_unit"=>$param['goodUnit'],
 			"good_type"=>1,
 			"moq"=>1,
 			"customized"=>0,
@@ -285,6 +287,8 @@ class Filing extends Base
     		"qrdType"=>$saleinfo['order_type'],
     		"goodName"=>$saleinfo['good_name'],
 	 		"tax"=>$goodinfo['tax'],
+	 		"goodUnit"=>$goodinfo['good_unit'],
+	 		"unitName"=>Db::name("unit")->where(["id"=>$goodinfo['good_unit']])->value("unit",""),
 	 		"goodNum"=>$saleinfo['good_num'],
 	 		"goodPrice"=>$saleinfo['sale_price'],
 	 		"mobile"=>$addr['mobile'],
@@ -314,6 +318,7 @@ class Filing extends Base
     		"workCode"=>"",
     		"khNo"=>"",
 	 		"tax"=>"",
+	 		"goodUnit"=>"",
 	 		"mobile"=>"",
 	 		"addr"=>"",
 	 		"addr_code"=>"",
@@ -333,6 +338,7 @@ class Filing extends Base
 //	 		"workCode|业务编号"=>"require|max:255|min:1",
 //	 		"khNo|客户公司编号"=>"require|max:255|min:1",
 	 		"mobile|联系人电话"=>"require|number|mobile",
+	 		"goodUnit|商品单位"=>"require|number|gt:0",
 	 		"contactor|联系人"=>"require|max:255|min:1",
 	 		"addr|收货地址"=>"require|max:255|min:1",
 	 		"addr_code|收货省市区"=>"require|max:255|min:1",
@@ -391,6 +397,7 @@ class Filing extends Base
 			"updatetime"=>date("Y-m-d H:i:s"),
 			];
 		$goodinfo =[
+			"good_unit"=>$param['goodUnit'],
 			"tax"=>$param['tax'],
 			"supplierNo"=>$param['supplierNo'],
 			"companyNo"=>$param['companyNo'],

+ 1 - 4
app/command/ImportOrderFromCAnalysisData.php

@@ -322,11 +322,8 @@ class ImportOrderFromCAnalysisData extends Command
                     'is_del' => OIFCModel::$is_del_normal,
                     'status' => OIFCModel::$status_wait_validate
                 ])->update($update_c_data);
-
+			Db::commit();
             if ($is && $res) Cache::store("redis")->handler()->lPush('import_order_from_c_key', $rs['id']);//校验无误,入队列
-
-            Db::commit();
-
             // 指令输出
             $output->writeln(date('Y-m-d H:i:s') . '|解析成功');
 

+ 1 - 1
app/command/ImportOrderFromCHandleData.php

@@ -51,7 +51,7 @@ class ImportOrderFromCHandleData extends Command
                 ->field('id,createrid,creater')
                 ->find();
 
-            if (empty($c_data)) $output->writeln('未查询到该记录');
+            if (empty($c_data)) $output->writeln(date('Y-m-d H:i:s') . '未查询到该记录');
             else {
 
                 Db::startTrans();

+ 7 - 7
app/command/SplitSale.php

@@ -128,7 +128,7 @@ class SplitSale extends Command
                         $this->i++;
 
                         $sale_total = $cgd_total;
-                        $cgd_total = bcsub($cgd_total, bcmul($sale['total_price'] ?? 0, $pay_rate['rate'], 5), 5);
+                        $cgd_total = bcsub($cgd_total, bcmul($sale['total_price'] ?? 0, $pay_rate['rate'], 3), 2);
 
                         //只处理采购单
                         if (strtoupper($pay_rate['companyNo']) == 'KH') {
@@ -197,17 +197,17 @@ class SplitSale extends Command
 
                 Db::commit();
 
-                $output->writeln('处理完成');
+                $output->writeln(date('Y-m-d H:i:s') . '处理完成');
 
             } catch (Exception $e) {
                 Db::rollback();
-                $output->writeln('事务回滚:' . $e->getMessage() . '||' . $e->getFile() . '||' . $e->getLine());
+                $output->writeln(date('Y-m-d H:i:s') . '事务回滚:' . $e->getMessage() . '||' . $e->getFile() . '||' . $e->getLine());
             }
 
             Cache::store('redis')->set($key, 0);
 
         } catch (Exception $exception) {
-            $output->writeln('脚本执行出错,' . $exception->getMessage() . '||' . $exception->getFile() . '||' . $exception->getLine());
+            $output->writeln(date('Y-m-d H:i:s') . '脚本执行出错,' . $exception->getMessage() . '||' . $exception->getFile() . '||' . $exception->getLine());
         }
 
     }
@@ -215,7 +215,7 @@ class SplitSale extends Command
     //构建销售单
     private function _handle_sale_caixiao(array $sale = [], string $orderCode = '', string $cgdNo = '', float $sale_total = 0.00, array $customer = [], array $supplier = [])
     {
-        $sale_price = $sale['good_num'] > 0 ? bcdiv($sale_total, $sale['good_num'], 5) : 0;
+        $sale_price = $sale['good_num'] > 0 ? bcdiv($sale_total, $sale['good_num'], 3) : 0;
         $tmp_sale = [
             'origin_price' => $sale['origin_price'] ?? 0,
             'sale_price' => round($sale_price, 2),
@@ -304,12 +304,12 @@ class SplitSale extends Command
     private function _handle_cgd_caixiao(array $cgd = [], array $sale = [], array $pay_rate = [], string $cgdNo = '', string $orderCode = '', float $cgd_total = 0.00)
     {
 
-        $good_price = $sale['good_num'] > 0 ? bcdiv($cgd_total, $sale['good_num'], 5) : 0;
+        $good_price = $sale['good_num'] > 0 ? bcdiv($cgd_total, $sale['good_num'], 3) : 0;
 
         $tmp_cgd = [
         	'cgder' => $sale['cgder'] ?? '',
             'cgder_id' => $sale['cgderid'] ?? 0,
-            'good_price' => round($good_price, 2),
+            'good_price' =>round($good_price,2),
             'total_fee' => $cgd_total,
             'pakage_fee' => $cgd['pakge_fee'] ?? 0,
             'open_fee' => $cgd['open_fee'] ?? 0,