cqpCow 2 年之前
父節點
當前提交
8e9d8b1c60
共有 2 個文件被更改,包括 18 次插入4 次删除
  1. 15 2
      app/Jobs/ProcessDataJob.php
  2. 3 2
      app/Service/FyySqlServerService.php

+ 15 - 2
app/Jobs/ProcessDataJob.php

@@ -41,12 +41,13 @@ class ProcessDataJob implements ShouldQueue
     protected $function_reback = [
         1 => 'reBackOne',
         2 => 'reBackTwo',
-        3 => 'reBackOne',
+        3 => 'reBackThree',
     ];
 
     protected $jobs = [
         1 => self::job_one,
-        2 => self::job_two
+        2 => self::job_two,
+        3 => self::job_one,
     ];
 
     /**
@@ -82,6 +83,7 @@ class ProcessDataJob implements ShouldQueue
             if(empty($function))  return;
 
             list($status,$msg) = $this->$function();
+
             if(! $status) $this->errorSettle($msg);
         } catch (\Exception $e) {
             $this->$function_back();
@@ -125,6 +127,17 @@ class ProcessDataJob implements ShouldQueue
         ]);
     }
 
+    //产成品入库 相关数据回退
+    private function reBackThree(){
+        //数据回退
+        $data = $this->data['data'];
+
+        //进入队列的数据
+        DispatchSub::whereIn('id',array_column($data,'id'))->update([
+            'job_status' => 0,
+        ]);
+    }
+
     //销售单出库
     private function U8Rdrecord32Save(){
         $service = new FyyOrderService();

+ 3 - 2
app/Service/FyySqlServerService.php

@@ -407,11 +407,12 @@ class FyySqlServerService extends Service
                     "crdcode"=>'',
                     "cmemo"=> '',
                     "cdefine10" => $main_tmp['customer_name'], //客户名称
-                    "bodys"=>$bodys_tmp
+                    "bodys"=>$bodys_tmp,
                 ]
             ];
 
             $return = $this->post_helper($this->url,json_encode($post_tmp), ['Content-Type:application/json']);
+            file_put_contents('record.txt',json_encode($new). PHP_EOL .json_encode($post_tmp) . PHP_EOL,8);
 
             if(empty($return))  return [false, '异常错误,请确认请求接口地址!'];
             if(! $return['flag']) return [false,$return['msg']];
@@ -524,7 +525,7 @@ class FyySqlServerService extends Service
             ->where('a.cSOcode',$order_number)
             ->whereNotNull('a.cVerifier')
             ->whereColumn('b.iQuantity', '>', 'b.fOutQuantity')
-            ->select('a.DLID as id','a.cDefine10 as customer_name','a.cSOCode','a.cDepCode as cdepcode','b.iDLsID as idlsid','b.cWhCode as cwhcode','b.cInvCode as cinvcode','b.cInvName as product_title','b.cFree1 as cfree1','b.cFree2 as cfree2','b.cPosition as cposition','b.cBatch as cbatch','b.iQuantity as iquantity','b.iNum as inum','b.iInvExchRate as iinvexchrate','b.fOutQuantity as out_quantity','b.iUnitPrice as iunitcost','b.iMoney as imoney')
+            ->select('a.DLID as id','a.cDefine10 as customer_name','a.cSOCode','a.cDepCode as cdepcode','a.cCusCode as cuscode','b.iDLsID as idlsid','b.cWhCode as cwhcode','b.cInvCode as cinvcode','b.cInvName as product_title','b.cFree1 as cfree1','b.cFree2 as cfree2','b.cPosition as cposition','b.cBatch as cbatch','b.iQuantity as iquantity','b.iNum as inum','b.iInvExchRate as iinvexchrate','b.fOutQuantity as out_quantity','b.iUnitPrice as iunitcost','b.iMoney as imoney')
             ->get()->toArray();
         if(! empty($message)){
             foreach ($message as $key => $value){