Bläddra i källkod

Merge branch 'master' into zengjun

ajun 4 år sedan
förälder
incheckning
6aabb138a9

+ 14 - 4
app/Filters/OrderPackageFilters.php

@@ -3,6 +3,7 @@
 
 namespace App\Filters;
 
+use App\OracleDOCOrderHeader;
 use App\Order;
 use App\OrderIssue;
 use App\Services\UserService;
@@ -35,6 +36,7 @@ class OrderPackageFilters
         'is_new_rejecting',
         'result_explain',
         'issue_type_name',
+        'order_notes',//订单备注
     ];
 
     protected $orderIssueQuery;
@@ -177,12 +179,12 @@ class OrderPackageFilters
     {
         if ($is_new_rejecting === '有') {
             $this->queryBuilder->whereIn('logistic_number', function ($query) {
-                $query->from('rejected_bills')->select('logistic_number_return')->where('logistic_number','原单退回')->whereNotNull('logistic_number_return');
+                $query->from('rejected_bills')->select('logistic_number_return')->where('logistic_number', '原单退回')->whereNotNull('logistic_number_return');
             });
         }
         if ($is_new_rejecting === '无') {
             $this->queryBuilder->whereNotIn('logistic_number', function ($query) {
-                $query->from('rejected_bills')->select('logistic_number_return')->where('logistic_number','原单退回')->whereNotNull('logistic_number_return');
+                $query->from('rejected_bills')->select('logistic_number_return')->where('logistic_number', '原单退回')->whereNotNull('logistic_number_return');
             });
         }
     }
@@ -190,7 +192,7 @@ class OrderPackageFilters
     public function issue_type_name($issue_type_name)
     {
         $this->queryBuilder->whereIn('order_id', function ($query) use ($issue_type_name) {
-            $query->from('order_issues')->select('order_id')->where('order_issue_type_id',function ($query) use ($issue_type_name){
+            $query->from('order_issues')->select('order_id')->where('order_issue_type_id', function ($query) use ($issue_type_name) {
                 $query->from('order_issue_types')->select('id')->where('name', $issue_type_name);
             });
         });
@@ -199,7 +201,15 @@ class OrderPackageFilters
     public function result_explain($result_explain)
     {
         $this->queryBuilder->whereIn('order_id', function ($query) use ($result_explain) {
-            $query->from('order_issues')->select('order_id')->where('result_explain','like',$result_explain);
+            $query->from('order_issues')->select('order_id')->where('result_explain', 'like', $result_explain);
+        });
+    }
+
+    public function order_notes($order_notes)
+    {
+        $ordernos = OracleDOCOrderHeader::query()->select('orderno')->where('notes', 'like', $order_notes)->pluck('orderno');
+        $this->queryBuilder->whereIn('order_id', function ($query) use ($ordernos) {
+            $query->from('orders')->select('order_id')->whereIn('code', $ordernos);
         });
     }
 }

+ 3 - 5
app/Http/Controllers/InventoryAccountController.php

@@ -40,9 +40,7 @@ class InventoryAccountController extends Controller
     //创建盘点任务
     public function createStockInventoryMission(Request $request)
     {
-        if (!Gate::allows("库存管理-盘点")) {
-            return redirect(url('/'));
-        }
+        if (!Gate::allows("库存管理-盘点")) {return ['success' => false ,'data' => '没有对应权限'];}
 //        $date_start=$request->input('formData.date_start');
 //        $date_end=$request->input('formData.date_end');
 //        $ownerId=$request->input('formData.owner_id')[0];
@@ -51,8 +49,8 @@ class InventoryAccountController extends Controller
         $ownerId = $request->input('owner_id');
         $location = $request->input('location');
         $barcode = $request->input('barcode');
-        $inventoryAccount = app('inventoryAccountService')->createMission($date_start, $date_end, $ownerId, $location, $barcode);
-        $inventoryAccount = InventoryAccount::with('owner')->find($inventoryAccount->id);
+        $inventory = app('inventoryAccountService')->createMission($date_start, $date_end, $ownerId, $location, $barcode);
+        $inventoryAccount = InventoryAccount::with('owner')->find($inventory->id);
         if (is_null($inventoryAccount)) return ['success' => false, 'data' => '参数错误!'];
         return ['success' => true, 'data' => $inventoryAccount];
     }

+ 1 - 0
app/Http/Controllers/PackageLogisticController.php

@@ -33,6 +33,7 @@ class PackageLogisticController extends Controller
             ->filter($filters)
             ->with([
                 'order.logistic',
+                'order.OracleDOCOrderHeader:orderno,notes',
                 'rejectedBill' => function ($query) {
                     $query->select('id', 'logistic_number', 'logistic_number_return')->where('logistic_number', '原单退回');
                 },

+ 4 - 10
app/Http/Controllers/TestController.php

@@ -88,15 +88,9 @@ class TestController extends Controller
 
     public function test()
     {
-        $a = DB::select(DB::raw("select payload from failed_jobs where id in (356633,356640)"));
-        $o = [];
-        foreach ($a as $b){
-            $c = json_decode($b->payload)->tags;
-            foreach ($c as $d){
-                $o[] = explode(":",$d)[1];
-            }
-        }
-        $orders = Order::query()->whereIn("id",$o)->get();
-        $this->dispatch(new OrderCreateInstantBill($orders));
+        $a = 1;
+        if ($a>2)dd(1);
+        else if($a==0)dd(2);
+        dd(3);
     }
 }

+ 40 - 35
app/Http/Controllers/WaybillController.php

@@ -1174,34 +1174,7 @@ SQL;
                 $query->where("audit_stage","合并运单");
             })->whereIn("id",$ids)->get();
             if ($waybills->count()==0)$this->error("运单不存在或非合并运单");
-            foreach ($waybills as $waybill){
-                $codes = explode(",",$waybill->wms_bill_number);
-                $bills = explode(",",$waybill->source_bill);
-                $remark = explode(",",$waybill->ordering_remark);
-                if (!$codes)continue;
-                /** @var Collection $destroys */
-                foreach (Waybill::onlyTrashed()->whereIn("wms_bill_number",$codes)->get() as $obj){
-                    unset($codes[array_search($obj->wms_bill_number,$codes)]);
-                    unset($bills[array_search($obj->source_bill,$bills)]);
-                    if (array_search($obj->ordering_remark,$remark)===false)unset($bills[array_search($obj->ordering_remark,$remark)]);
-                    $waybill->charge -= (double)$obj->charge;
-                    $waybill->collect_fee -= (double)$obj->collect_fee;
-                    $waybill->other_fee -= (double)$obj->other_fee;
-                    $waybill->warehouse_weight_other -= (double)$obj->warehouse_weight_other;
-                    $waybill->warehouse_weight -= (double)$obj->warehouse_weight;
-                }
-                Waybill::onlyTrashed()->whereIn("wms_bill_number",explode(",",$waybill->wms_bill_number))->restore();
-                $waybill->merge_owner = null;
-                $waybill->source_bill = implode(",",$bills);
-                $waybill->wms_bill_number = implode(",",$codes);
-                $waybill->ordering_remark = implode(",",$remark);
-                $waybill->update();
-                WaybillAuditLog::query()->create([
-                    'waybill_id'=>$waybill->id,
-                    'audit_stage'=>'拆单返回',
-                    'user_id'=>Auth::id(),
-                ]);
-            }
+            foreach ($waybills as $waybill)$this->split($waybill);
             DB::commit();
         }catch (\Exception $e){
             DB::rollBack();
@@ -1210,6 +1183,38 @@ SQL;
         $this->success(count($ids)==$waybills->count() ? '运单拆单完毕' : '部分运单不符合拆单条件');
     }
 
+    private function split($waybill)
+    {
+        $codes = explode(",",$waybill->wms_bill_number);
+        if (!$codes || count($codes)<2)return;
+        $bills = explode(",",$waybill->source_bill);
+        $remark = explode(",",$waybill->ordering_remark);
+        /** @var Collection $waybills */
+        $waybills = Waybill::onlyTrashed()->whereIn("wms_bill_number",$codes)->get();
+        if (!$waybills->count())return;
+        foreach ($waybills as $obj){
+            unset($codes[array_search($obj->wms_bill_number,$codes)]);
+            unset($bills[array_search($obj->source_bill,$bills)]);
+            if (array_search($obj->ordering_remark,$remark)===false)unset($bills[array_search($obj->ordering_remark,$remark)]);
+            $waybill->charge -= (double)$obj->charge;
+            $waybill->collect_fee -= (double)$obj->collect_fee;
+            $waybill->other_fee -= (double)$obj->other_fee;
+            $waybill->warehouse_weight_other -= (double)$obj->warehouse_weight_other;
+            $waybill->warehouse_weight -= (double)$obj->warehouse_weight;
+        }
+        Waybill::onlyTrashed()->whereIn("wms_bill_number",explode(",",$waybill->wms_bill_number))->restore();
+        $waybill->merge_owner = null;
+        $waybill->source_bill = implode(",",$bills);
+        $waybill->wms_bill_number = implode(",",$codes);
+        $waybill->ordering_remark = implode(",",$remark);
+        $waybill->update();
+        WaybillAuditLog::query()->create([
+            'waybill_id'=>$waybill->id,
+            'audit_stage'=>'拆单返回',
+            'user_id'=>Auth::id(),
+        ]);
+    }
+
     /**
      * 快递面单打印 :暂时支持 德邦
      */
@@ -1266,10 +1271,15 @@ SQL;
     {
         $this->gate("运输管理-编辑");
         if (!\request("logistic"))$this->error("未选择承运商");
-        $waybill = Waybill::query()->where("waybill_number",\request("waybill"))->whereNull("deliver_at")
+        $waybill = Waybill::query()->with("waybillAuditLogs:waybill_id,audit_stage")->where("waybill_number",\request("waybill"))
             ->whereNotIn("status",["已完结","无模型"])->first();
         if (!$waybill)$this->error("运单禁止操作");
-        if ($waybill->deliver_at)$this->error("运单已发货,请勿重复调配");
+        if ($waybill->deliver_at){
+            if ($waybill->waybillAuditLogs->where("audit_stage","单独发货")->count())$this->split($waybill);
+            else if(!$waybill->waybillAuditLogs->where("audit_stage","合单发货")->count())
+                $this->error("运单已发货,请勿重复调配");
+        }
+
         $codes = explode("\n",\request("order"));
         $waybills = Waybill::query()->whereIn("wms_bill_number",$codes)
             ->where("id","!=",$waybill->id)
@@ -1306,11 +1316,6 @@ SQL;
             if ($waybill->status=='未审核')$waybill->status = '已审核';
             $waybill->update();
             Waybill::destroy($destroys);
-            WaybillAuditLog::query()->create([
-                'waybill_id'=>$waybill->id,
-                'audit_stage'=>'合并运单',
-                'user_id'=>Auth::id(),
-            ]);
             WaybillAuditLog::query()->create([
                 'waybill_id'=>$waybill->id,
                 'audit_stage'=>'合单发货',

+ 6 - 0
app/Order.php

@@ -5,6 +5,7 @@ namespace App;
 use App\Traits\ModelTimeFormat;
 use Illuminate\Database\Eloquent\Model;
 use App\Traits\ModelLogChanging;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
 
 class Order extends Model
 {
@@ -178,4 +179,9 @@ class Order extends Model
         ];
         return $arr[$string] ?? '否';
     }
+
+    public function OracleDOCOrderHeader(): BelongsTo
+    {
+        return $this->belongsTo(OracleDOCOrderHeader::class,'code','orderno');
+    }
 }

+ 241 - 186
app/Services/HandInStorageService.php

@@ -36,20 +36,31 @@ class HandInStorageService
      * @return object
      * 根据asn单号获取 总预期数量 总已收数量
      */
-    public function getAsnQty($asnno)
+    public function getAsnQty($asnno): object
     {
-        $asnQty=OracleDOCASNDetail::query()
-            ->select('expectedqty','receivedqty')
-            ->where('asnno',$asnno)
+        $asnQty = OracleDOCASNDetail::query()
+            ->select('expectedqty', 'receivedqty','receivedqty_each','expectedqty_each')
+            ->where('asnno', $asnno)
             ->get();
         $expectedqty=0;
         $receivedqty=0;
         foreach ($asnQty as $qty){
-            $expectedqty+=$qty->expectedqty;
-            $receivedqty+=$qty->receivedqty;
+            if ($qty->expectedqty) {
+                $expectedqty+=$qty->expectedqty;
+            }else{
+                $expectedqty+=$qty->expectedqty_each??0;
+            }
+
+            if ($qty->receivedqty){
+                $receivedqty+=$qty->receivedqty;
+            }else{
+                $receivedqty+=$qty->receivedqty_each??0;
+            }
+
         }
-        return (object)array('expectedqty'=>$expectedqty,'receivedqty'=>$receivedqty);
+        return (object)array('expectedqty' => $expectedqty, 'receivedqty' => $receivedqty);
     }
+
     /**
      * @param array $info
      * @return bool|int
@@ -57,19 +68,20 @@ class HandInStorageService
      */
     public function checkForwardingLoc(array $info)
     {
-        $res=OracleBasCustomer::query()
-            ->where('customerid',$info['customerid'])
-            ->where('customer_type','OW')
-            ->where('udf1','Y')->count(); //查询此货主是否必须有拣货位
-        if ($res>0) {
-            $amount=OracleBasForwardingLoc::query()
-                ->where('customerid',$info['customerid'])
-                ->where('sku',$info['sku'])
+        $res = OracleBasCustomer::query()
+            ->where('customerid', $info['customerid'])
+            ->where('customer_type', 'OW')
+            ->where('udf1', 'Y')->count(); //查询此货主是否必须有拣货位
+        if ($res > 0) {
+            $amount = OracleBasForwardingLoc::query()
+                ->where('customerid', $info['customerid'])
+                ->where('sku', $info['sku'])
                 ->count();
-            if ($amount==0)return 1;//请维护拣货位!
+            if ($amount == 0) return 1;//请维护拣货位!
         }
         return true;
     }
+
     /**
      * @param array $info
      * @return bool|int
@@ -77,9 +89,9 @@ class HandInStorageService
      */
     public function checkWidthHeight(array $info)
     {
-        $basSku=OracleBasSKU::query()->where('customerid',$info['customerid'])->where('sku',$info['sku'])->first();
-        if (!$basSku)return 1;//需要维护产品档案
-        if ($basSku->skulength<=0||$basSku->skuwidth<=0||$basSku->skuhigh<=0)return 2;//需要维护该产品档案中的长宽高
+        $basSku = OracleBasSKU::query()->where('customerid', $info['customerid'])->where('sku', $info['sku'])->first();
+        if (!$basSku) return 1;//需要维护产品档案
+        if ($basSku->skulength <= 0 || $basSku->skuwidth <= 0 || $basSku->skuhigh <= 0) return 2;//需要维护该产品档案中的长宽高
         return true;
     }
 
@@ -90,11 +102,12 @@ class HandInStorageService
      */
     public function checkCubicWeight(array $info)
     {
-        $basSku=OracleBasSKU::query()->where('customerid',$info['customerid'])->where('sku',$info['sku'])->first();
-        if (!$basSku)return 1;//需要维护产品档案
-        if ($basSku->grossweight<=0||$basSku->cube<=0)return 2;//需要维护该产品档案中的重量体积
+        $basSku = OracleBasSKU::query()->where('customerid', $info['customerid'])->where('sku', $info['sku'])->first();
+        if (!$basSku) return 1;//需要维护产品档案
+        if ($basSku->grossweight <= 0 || $basSku->cube <= 0) return 2;//需要维护该产品档案中的重量体积
         return true;
     }
+
     /**
      * @param array $info
      * @param array $param
@@ -187,7 +200,7 @@ class HandInStorageService
     public function selectAsn($asn)
     {
         if (!$asn) return OracleDOCASNHeader::query()  //空扫
-            ->select(['asnno', 'asnreference1', 'asnstatus', 'addtime', 'customerid', 'asntype','notes'])
+        ->select(['asnno', 'asnreference1', 'asnstatus', 'addtime', 'customerid', 'asntype', 'notes'])
             ->where('asnstatus', '00')
             ->orderByDesc('addtime')
             ->limit(50)
@@ -195,13 +208,13 @@ class HandInStorageService
 
         if (strpos(strtoupper($asn), 'ASN') !== false) {  //asn 单号
             return OracleDOCASNHeader::query()
-                ->select(['asnno', 'asnreference1', 'asnstatus', 'addtime', 'customerid', 'asntype','notes'])
+                ->select(['asnno', 'asnreference1', 'asnstatus', 'addtime', 'customerid', 'asntype', 'notes'])
                 ->where('asnno', $asn)
                 ->whereIn('asnstatus', ['00', '30'])
                 ->get();
         } else {
             $asns = OracleDOCASNHeader::query()  //货主
-                ->select(['asnno', 'asnreference1', 'asnstatus', 'addtime', 'customerid', 'asntype','notes'])
+            ->select(['asnno', 'asnreference1', 'asnstatus', 'addtime', 'customerid', 'asntype', 'notes'])
                 ->where('customerid', strtoupper($asn))
                 ->whereIn('asnstatus', ['00', '30'])
                 ->get();
@@ -232,7 +245,7 @@ SQL;
     {
         $sql = <<<sql
  SELECT DOC_ASN_DETAILS.sku,DOC_ASN_DETAILS.expectedqty,DOC_ASN_DETAILS.skudescrc,DOC_ASN_DETAILS.asnlineno,DOC_ASN_DETAILS.asnno,
-       DOC_ASN_DETAILS.receivedqty,BAS_SKU.alternate_sku1
+       DOC_ASN_DETAILS.receivedqty,DOC_ASN_DETAILS.receivedqty_each,BAS_SKU.alternate_sku1
 FROM DOC_ASN_DETAILS LEFT JOIN BAS_SKU ON DOC_ASN_DETAILS.CUSTOMERID = BAS_SKU.CUSTOMERID AND DOC_ASN_DETAILS.SKU = BAS_SKU.SKU
 WHERE asnno = ? AND linestatus IN ('00','30')
 sql;
@@ -253,15 +266,15 @@ sql;
 SELECT DOC_ASN_DETAILS.sku,DOC_ASN_DETAILS.expectedqty,DOC_ASN_DETAILS.skudescrc,
        DOC_ASN_DETAILS.lotatt01, DOC_ASN_DETAILS.lotatt02, DOC_ASN_DETAILS.lotatt03, DOC_ASN_DETAILS.lotatt04,
        DOC_ASN_DETAILS.lotatt05, DOC_ASN_DETAILS.lotatt06, DOC_ASN_DETAILS.lotatt07, DOC_ASN_DETAILS.lotatt08,
-       DOC_ASN_DETAILS.asnlineno,DOC_ASN_DETAILS.asnno,DOC_ASN_DETAILS.receivedqty FROM DOC_ASN_DETAILS
+       DOC_ASN_DETAILS.asnlineno,DOC_ASN_DETAILS.asnno,DOC_ASN_DETAILS.receivedqty,DOC_ASN_DETAILS.receivedqty_each FROM DOC_ASN_DETAILS
          LEFT JOIN BAS_SKU ON DOC_ASN_DETAILS.CUSTOMERID = BAS_SKU.CUSTOMERID AND DOC_ASN_DETAILS.SKU = BAS_SKU.SKU
 WHERE ASNNO = ? AND LINESTATUS IN ('00','30') AND (ALTERNATE_SKU1 = ? OR ALTERNATE_SKU2 = ?  OR ALTERNATE_SKU3 = ?)
 sql;
         $asn_detail = DB::connection("oracle")->selectOne(DB::raw($sql), [$asnno, $skuOrBarcode, $skuOrBarcode, $skuOrBarcode]);
         if ($asn_detail) return $asn_detail;
         else return OracleDOCASNDetail::query()
-            ->select(['sku', 'expectedqty', 'skudescrc', 'asnlineno', 'asnno', 'receivedqty',
-                'lotatt01','lotatt02','lotatt03','lotatt04','lotatt05','lotatt06','lotatt07','lotatt08'])
+            ->select(['sku', 'expectedqty', 'skudescrc', 'asnlineno', 'asnno', 'receivedqty','receivedqty_each',
+                'lotatt01', 'lotatt02', 'lotatt03', 'lotatt04', 'lotatt05', 'lotatt06', 'lotatt07', 'lotatt08'])
             ->where('asnno', $asnno)
             ->where('sku', $skuOrBarcode)
             ->whereIn('linestatus', ['00', '30'])
@@ -318,7 +331,7 @@ sql;
      */
     public function getInvotlocid($barcode): array
     {
-        $sql=<<<sql
+        $sql = <<<sql
 select INV_LOT_LOC_ID.CUSTOMERID,BAS_SKU.ALTERNATE_SKU1,INV_LOT_LOC_ID.LOCATIONID,INV_LOT_ATT.LOTATT05,INV_LOT_ATT.LOTATT08,
        INV_LOT_ATT.LOTATT01,INV_LOT_ATT.LOTATT02,INV_LOT_ATT.LOTATT03,INV_LOT_ATT.LOTATT04,
        sum(INV_LOT_LOC_ID.QTY) AS QTY from INV_LOT_LOC_ID
@@ -330,7 +343,7 @@ select INV_LOT_LOC_ID.CUSTOMERID,BAS_SKU.ALTERNATE_SKU1,INV_LOT_LOC_ID.LOCATIONI
 group by INV_LOT_LOC_ID.CUSTOMERID,BAS_SKU.ALTERNATE_SKU1,INV_LOT_LOC_ID.LOCATIONID,INV_LOT_ATT.LOTATT05,INV_LOT_ATT.LOTATT08,INV_LOT_ATT.LOTATT01,INV_LOT_ATT.LOTATT02,INV_LOT_ATT.LOTATT03,INV_LOT_ATT.LOTATT04
 sql;
         $invLots = DB::connection("oracle")->select(DB::raw($sql), [$barcode, $barcode, $barcode]);
-        if (!$invLots)return [];
+        if (!$invLots) return [];
         else return $invLots;
     }
 
@@ -339,10 +352,10 @@ sql;
      * @return array|int
      * 根据商品条码  获取完全收货状态  部分收货状态的 PA任务
      */
-    public function getTsk($trackNumber,$barCode): array
+    public function getTsk($trackNumber, $barCode): array
     {
         $sql = <<<sql
-select t.*, DOC_ASN_DETAILS.RECEIVEDQTY
+select t.*, DOC_ASN_DETAILS.RECEIVEDQTY,DOC_ASN_DETAILS.ReceivedQty_Each
 from (select TSK_TASKLISTS.CustomerID,
              TSK_TASKLISTS.DOCNO,
              TSK_TASKLISTS.Sku,
@@ -350,6 +363,12 @@ from (select TSK_TASKLISTS.CustomerID,
              TSK_TASKLISTS.PlanToID,
              DOC_ASN_DETAILS.SKUDESCRC,
              TSK_TASKLISTS.DOCLINENO,
+             TSK_TASKLISTS.LOTATT01,
+             TSK_TASKLISTS.LOTATT02,
+             TSK_TASKLISTS.LOTATT03,
+             TSK_TASKLISTS.LOTATT04,
+             TSK_TASKLISTS.LOTATT05,
+             TSK_TASKLISTS.LOTATT08,
              sum(TSK_TASKLISTS.PlanToQty) as qty
       from TSK_TASKLISTS
                LEFT JOIN DOC_ASN_DETAILS ON DOC_ASN_DETAILS.ASNNO = TSK_TASKLISTS.DOCNO AND
@@ -357,45 +376,45 @@ from (select TSK_TASKLISTS.CustomerID,
       where TSK_TASKLISTS.TASKTYPE = 'PA'
         AND TSK_TASKLISTS.TASKPROCESS = '00'
 sql;
-        if (!$trackNumber){ //没有输入条件  空扫
+        if (!$trackNumber) { //没有输入条件  空扫
             $owner_codes = app('OwnerService')->getIntersectPermitting(['code']);
-            if (count($owner_codes)>0){
-                $sql.=' AND TSK_TASKLISTS.CustomerID IN (';
-                foreach ($owner_codes as $index => $no){
-                    if ($index==0){
-                        $sql.="'".$no->code."'";
+            if (count($owner_codes) > 0) {
+                $sql .= ' AND TSK_TASKLISTS.CustomerID IN (';
+                foreach ($owner_codes as $index => $no) {
+                    if ($index == 0) {
+                        $sql .= "'" . $no->code . "'";
                         continue;
                     }
-                    $sql.=",'".$no->code."'";
+                    $sql .= ",'" . $no->code . "'";
                 }
-                $sql.=')';
-            }else{
+                $sql .= ')';
+            } else {
                 $sql .= ' AND TSK_TASKLISTS.CustomerID IS NULL ';
             }
 
-        }else{
-            if (strpos(strtoupper($trackNumber), 'ASN') !== false){
-                $sql.='AND TSK_TASKLISTS.DOCNO= ?'; //输入条件为asn单号
-            } else{ //不为asn号时 判断是否为货主
-                if ($this->checkUserOwnerAuth($trackNumber)){ //输入条件为货主
-                    $sql.=' AND TSK_TASKLISTS.CustomerID= ?';
-                }else{
-                    $sql.=' AND TSK_TASKLISTS.PlanToID= ?';  //不是货主 判断是否为跟踪号
+        } else {
+            if (strpos(strtoupper($trackNumber), 'ASN') !== false) {
+                $sql .= 'AND TSK_TASKLISTS.DOCNO= ?'; //输入条件为asn单号
+            } else { //不为asn号时 判断是否为货主
+                if ($this->checkUserOwnerAuth($trackNumber)) { //输入条件为货主
+                    $sql .= ' AND TSK_TASKLISTS.CustomerID= ?';
+                } else {
+                    $sql .= ' AND TSK_TASKLISTS.PlanToID= ?';  //不是货主 判断是否为跟踪号
                 }
             }
         }
 
-        if ($barCode)$sql.=" AND TSK_TASKLISTS.sku in (
-                                    select SKU from BAS_SKU where ALTERNATE_SKU1='".$barCode."' union
-                                    select SKU from BAS_SKU where ALTERNATE_SKU2='".$barCode."' union
-                                    select SKU from BAS_SKU where ALTERNATE_SKU3='".$barCode."' union
-                                    select SKU from BAS_SKU where SKU='".$barCode."' )";
+        if ($barCode) $sql .= " AND TSK_TASKLISTS.sku in (
+                                    select SKU from BAS_SKU where ALTERNATE_SKU1='" . $barCode . "' union
+                                    select SKU from BAS_SKU where ALTERNATE_SKU2='" . $barCode . "' union
+                                    select SKU from BAS_SKU where ALTERNATE_SKU3='" . $barCode . "' union
+                                    select SKU from BAS_SKU where SKU='" . $barCode . "' )";
 
-        $sql.=' group by TSK_TASKLISTS.CustomerID, TSK_TASKLISTS.DOCNO, TSK_TASKLISTS.Sku, TSK_TASKLISTS.PlanToLotNum,
-               TSK_TASKLISTS.PlanToID, DOC_ASN_DETAILS.SKUDESCRC, TSK_TASKLISTS.DOCLINENO) t
+        $sql.=' group by TSK_TASKLISTS.CustomerID, TSK_TASKLISTS.DOCNO, TSK_TASKLISTS.Sku, TSK_TASKLISTS.PlanToLotNum, TSK_TASKLISTS.PlanToID, DOC_ASN_DETAILS.SKUDESCRC,
+         TSK_TASKLISTS.DOCLINENO, TSK_TASKLISTS.LOTATT01, TSK_TASKLISTS.LOTATT02, TSK_TASKLISTS.LOTATT03, TSK_TASKLISTS.LOTATT04, TSK_TASKLISTS.LOTATT05, TSK_TASKLISTS.LOTATT08) t
          left join DOC_ASN_DETAILS on t.DOCLINENO = DOC_ASN_DETAILS.ASNLINENO and t.DOCNO = DOC_ASN_DETAILS.ASNNO';
-        if ($trackNumber){
-            if ($this->checkUserOwnerAuth($trackNumber))$tasks = DB::connection("oracle")->select(DB::raw($sql), [strtoupper($trackNumber)]);
+        if ($trackNumber) {
+            if ($this->checkUserOwnerAuth($trackNumber)) $tasks = DB::connection("oracle")->select(DB::raw($sql), [strtoupper($trackNumber)]);
             else $tasks = DB::connection("oracle")->select(DB::raw($sql), [$trackNumber]);
         }else {$tasks = DB::connection("oracle")->select(DB::raw($sql));}
         if (!$tasks) return [];
@@ -410,8 +429,8 @@ sql;
     public function checkUserOwnerAuth($owner_code): bool
     {
         $owner_codes = app('OwnerService')->getIntersectPermitting(['code']);
-        $owner=$owner_codes->where('code','=',strtoupper($owner_code));
-        if ($owner->count()>0)return true;
+        $owner = $owner_codes->where('code', '=', strtoupper($owner_code));
+        if ($owner->count() > 0) return true;
         else return false;
     }
 
@@ -425,8 +444,8 @@ sql;
         if (!$tasks) return false; //获取任务失败
         return DB::connection("oracle")->transaction(function () use ($tasks, $info) { //单体嵌套事务 回滚FLUX失败任务
             foreach ($tasks as $task) {
-                $res=$this->checkExpiryPa($task,$info['location']);
-                if ($res!==true)return $res;
+                $res = $this->checkExpiryPa($task, $info['location']);
+                if ($res !== true) return $res;
                 if (!app("StorageService")->fluxPA($task, $info['location'])) {
                     DB::connection("oracle")->rollBack();
                     return false; //上架失败
@@ -442,16 +461,16 @@ sql;
      * @return bool|int
      * 上架校验效期
      */
-    public function checkExpiryPa($task,$location)
+    public function checkExpiryPa($task, $location)
     {
-        if (!$task->taskid)return 0;//任务id不存在
-        if (strpos($task->taskid,'MIX') !== false)return true;//合并拣货,不校验
+        if (!$task->taskid) return 0;//任务id不存在
+        if (strpos($task->taskid, 'MIX') !== false) return true;//合并拣货,不校验
 
         $sql = <<<sql
 select instr(DESCR,'拣货') as var_IsPickingArea from BAS_Zone where ZONE=(select PutawayZone from BAS_Location where LocationID = ?)
 sql;
         $basZone = DB::connection("oracle")->selectOne(DB::raw($sql), [$location]);
-        if ($basZone&&$basZone->var_ispickingarea>0) return true; //不是存储区,不校验
+        if ($basZone && $basZone->var_ispickingarea > 0) return true; //不是存储区,不校验
 
         $sql1 = <<<sql
 select SKU,LotAtt02,CustomerID from INV_LOT_ATT WHERE LOTNUM=?
@@ -468,8 +487,8 @@ sql;
       and attres.LotAtt02 > ?
       and zone.DESCR like '%拣货%'
 sql;
-        $invLotLocId=DB::connection("oracle")->selectOne(DB::raw($sql2), [$invLotAtt->sku,$invLotAtt->customerid,$task->fmlotnum,$invLotAtt->lotatt02]);
-        if ($invLotLocId&&$invLotLocId->var_amountofdecaying>0)return 1;//拣货区找到效期更新的同样货品,不能上架至存储区
+        $invLotLocId = DB::connection("oracle")->selectOne(DB::raw($sql2), [$invLotAtt->sku, $invLotAtt->customerid, $task->fmlotnum, $invLotAtt->lotatt02]);
+        if ($invLotLocId && $invLotLocId->var_amountofdecaying > 0) return 1;//拣货区找到效期更新的同样货品,不能上架至存储区
         return true;
     }
 
@@ -507,10 +526,11 @@ sql;
 
 
     /**
-     * @throws \Throwable
+     * @param array $info
+     * @return bool
      * fulx 手持收货
      */
-    public function fluxHandIn(array $info)
+    public function fluxHandIn(array $info): bool
     {
         $lotatt = array_filter($info, function ($key) {
             return strpos($key, 'lotatt') === 0;
@@ -526,27 +546,51 @@ sql;
         }
         $who = 'WAS' . (Auth::user() ? '-' . Auth::user()["name"] : '');
         $time = Carbon::now()->toDateTimeString();
-        return DB::connection("oracle")->transaction(function () use ($info, $invlotatt, $who, $time) {
+        $db = DB::connection("oracle");
+        $db->beginTransaction();
+        try {
+//        return DB::connection("oracle")->transaction(function () use ($info, $invlotatt, $who, $time) {
             //flux 批次号
             $lotNum = $this->getOrCreateLotNum($info, $invlotatt, $who, $time);
-            if (!$lotNum) return false;
+            if (!$lotNum){
+                $db->rollBack();
+                return false;
+            }
 
             //flux 创建入库事务
             $actTransactionLog = $this->setFluxActTransactionLog($info, $lotNum, $who, $time);
-            if (count($actTransactionLog)==0) return false;
-
+            if (count($actTransactionLog) == 0){
+                $db->rollBack();
+                return false;
+            }
             //flux 创建上架任务
             $this->setFluxTskTaskListPA($info, $invlotatt, $actTransactionLog, $who, $time);
             //flux 完善库存余量
             $this->updateFluxInv($info, $lotNum, $who, $time, $actTransactionLog);
             //flux 更新asn_detail 和 asn_header 状态
-            return $this->updateFluxAsn($info, $invlotatt, $time, $who);
-        });
+            $result=$this->updateFluxAsn($info, $invlotatt, $time, $who);
+            if ($result){
+                $db->commit();
+                return true;
+            }else{
+                $db->rollBack();
+                return false;
+            }
+//        });
+        } catch (\Exception $e) {
+            $db->rollBack();
+            return false;
+        }
 
     }
 
     /**
-     * @throws \Throwable
+     * @param array $info
+     * @param array $invlotatt
+     * @param $time
+     * @param $who
+     * @return bool
+     * 更新asn状态
      */
     public function updateFluxAsn(array $info, array $invlotatt, $time, $who): bool
     {
@@ -565,59 +609,64 @@ sql;
                 $asnDetail['customerid'] == $info['customerid'] &&
                 $asnDetail['sku'] == $info['sku']) $receiveAsn = $asnDetail;
         }
-        return $db->transaction(function () use ($db, $info, $receiveAsn, $invlotatt, $time, $who, $asn) {
-            if ($receiveAsn && (int)$receiveAsn['receivedqty'] + (int)$info['amount'] < (int)$receiveAsn['expectedqty']) {
-                //asn_detail 收货数量+已收数量<预期数量
-                $db->update(DB::raw("UPDATE DOC_ASN_DETAILS SET receivedqty = receivedqty + ?,receivedqty_each = receivedqty_each + ?,linestatus = '30',holdrejectcode ='OK',
+//        return $db->transaction(function () use ($db, $info, $receiveAsn, $invlotatt, $time, $who, $asn) {
+        if ($receiveAsn && (int)$receiveAsn['receivedqty'] + (int)$info['amount'] < (int)$receiveAsn['expectedqty']) {
+            //asn_detail 收货数量+已收数量<预期数量
+            $db->update(DB::raw("UPDATE DOC_ASN_DETAILS SET receivedqty = receivedqty + ?,receivedqty_each = receivedqty_each + ?,linestatus = '30',holdrejectcode ='OK',
                 reserve_flag ='Y',edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),receivedtime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ?,
              lotatt01 =?,lotatt02 =?,lotatt03 =?,lotatt04 =?,lotatt05 =?,lotatt06 =?,lotatt07 =?,lotatt08=? WHERE asnno = ? and asnlineno = ?"),
-                    [(int)$info['amount'], (int)$info['amount'], $time, $time, $who, $invlotatt['lotatt01'], $invlotatt['lotatt02'], $invlotatt['lotatt03'], $invlotatt['lotatt04'],
-                        $invlotatt['lotatt05'], $invlotatt['lotatt06'], $invlotatt['lotatt07'], $invlotatt['lotatt08'], $info['asnno'], $info['asnlineno']]);
+                [(int)$info['amount'], (int)$info['amount'], $time, $time, $who, $invlotatt['lotatt01'], $invlotatt['lotatt02'], $invlotatt['lotatt03'], $invlotatt['lotatt04'],
+                    $invlotatt['lotatt05'], $invlotatt['lotatt06'], $invlotatt['lotatt07'], $invlotatt['lotatt08'], $info['asnno'], $info['asnlineno']]);
+            //asn_header 部分收货状态
+            $db->update(DB::raw("UPDATE DOC_ASN_HEADER SET asnstatus = '30',edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ? WHERE asnno = ?"),
+                [$time, $who, $info['asnno']]);
+        } elseif ($receiveAsn && (int)$receiveAsn['receivedqty'] + (int)$info['amount'] == (int)$receiveAsn['expectedqty']) {
+            //asn_detail 收货数量+已收数量=预期数量
+            $db->update(DB::raw("UPDATE DOC_ASN_DETAILS SET receivedqty=receivedqty+?,receivedqty_each=receivedqty_each+?,linestatus = '40',
+                edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),receivedtime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ?,holdrejectcode='OK',
+                reserve_flag='Y',lotatt01=?,lotatt02=?,lotatt03=?,lotatt04=?,lotatt05=?,lotatt06=?,lotatt07=?,lotatt08=? WHERE asnno = ? and asnlineno = ?"),
+                [(int)$info['amount'], (int)$info['amount'], $time, $time, $who, $invlotatt['lotatt01'], $invlotatt['lotatt02'], $invlotatt['lotatt03'], $invlotatt['lotatt04'],
+                    $invlotatt['lotatt05'], $invlotatt['lotatt06'], $invlotatt['lotatt07'], $invlotatt['lotatt08'], $info['asnno'], $info['asnlineno']]);
+            //当asn_detail 所有状态都为完全收货是  asn_header 状态修改为 完全收货(asnstatus=40)
+            if (OracleDOCASNDetail::query()->where('asnno', $info['asnno'])->where('linestatus', 40)->count() == $asn->asn_details_count) {
+                $db->update(DB::raw("UPDATE DOC_ASN_HEADER SET asnstatus = '40',edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ? WHERE asnno = ?"),
+                    [$time, $who, $info['asnno']]);
+            } else {
                 //asn_header 部分收货状态
                 $db->update(DB::raw("UPDATE DOC_ASN_HEADER SET asnstatus = '30',edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ? WHERE asnno = ?"),
                     [$time, $who, $info['asnno']]);
-            } elseif ($receiveAsn && (int)$receiveAsn['receivedqty'] + (int)$info['amount'] == (int)$receiveAsn['expectedqty']) {
-                //asn_detail 收货数量+已收数量=预期数量
-                $db->update(DB::raw("UPDATE DOC_ASN_DETAILS SET receivedqty=receivedqty+?,receivedqty_each=receivedqty_each+?,linestatus = '40',
-                edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),receivedtime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ?,holdrejectcode='OK',
-                reserve_flag='Y',lotatt01=?,lotatt02=?,lotatt03=?,lotatt04=?,lotatt05=?,lotatt06=?,lotatt07=?,lotatt08=? WHERE asnno = ? and asnlineno = ?"),
-                    [(int)$info['amount'], (int)$info['amount'], $time, $time, $who, $invlotatt['lotatt01'], $invlotatt['lotatt02'], $invlotatt['lotatt03'], $invlotatt['lotatt04'],
-                        $invlotatt['lotatt05'], $invlotatt['lotatt06'], $invlotatt['lotatt07'], $invlotatt['lotatt08'], $info['asnno'], $info['asnlineno']]);
-                //当asn_detail 所有状态都为完全收货是  asn_header 状态修改为 完全收货(asnstatus=40)
-                if (OracleDOCASNDetail::query()->where('asnno', $info['asnno'])->where('linestatus', 40)->count() == $asn->asn_details_count) {
-                    $db->update(DB::raw("UPDATE DOC_ASN_HEADER SET asnstatus = '40',edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ? WHERE asnno = ?"),
-                        [$time, $who, $info['asnno']]);
-                } else {
-                    //asn_header 部分收货状态
-                    $db->update(DB::raw("UPDATE DOC_ASN_HEADER SET asnstatus = '30',edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ? WHERE asnno = ?"),
-                        [$time, $who, $info['asnno']]);
-                }
             }
-            return true;
-        });
+        }
+        return true;
+//        });
     }
 
     /**
-     * @throws \Throwable
+     * @param array $info
+     * @param $lotNum
+     * @param $who
+     * @param $time
+     * @param array $actTransactionLog
+     * 更新flux 库存
      */
     public function updateFluxInv(array $info, $lotNum, $who, $time, array $actTransactionLog)
     {
         $db = DB::connection("oracle");
-        $db->transaction(function () use ($db, $info, $lotNum, $actTransactionLog, $who, $time) {
-            //更新 inv_lot 批次 库存表
-            $invLot = $db->selectOne(DB::raw("SELECT * FROM INV_LOT WHERE lotnum = ? AND customerid = ? AND sku = ? "), [
-                $lotNum, $info['customerid'], $info['sku']
-            ]);
-            if ($invLot) $db->update(DB::raw("UPDATE INV_LOT SET qty = qty+?,edittime=?,editwho=? WHERE lotnum = ? AND customerid = ? AND sku = ?"), [
-                (int)$info['amount'], $time, $who, $lotNum, $info['customerid'], $info['sku'],
-            ]);
-            else $db->insert(DB::raw("INSERT INTO INV_LOT VALUES(?,?,?,?,0,0,0,0,0,0,0,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?)"), [
-                $lotNum, $info['customerid'], $info['sku'], $info['amount'], $time, $who, $time, $who
-            ]);
-            //更新 inv_lot_loc_id 批次/库位/跟踪号 库存表
-            $invLotId = $db->selectOne(DB::raw("SELECT * FROM inv_lot_loc_id WHERE lotnum = ? AND locationid = ? AND customerid = ? AND sku = ? AND traceid = ? FOR UPDATE"), [
-                $lotNum, $actTransactionLog['location'], $actTransactionLog['customerid'], $actTransactionLog['sku'], $actTransactionLog['trackid']
-            ]);
+//        $db->transaction(function () use ($db, $info, $lotNum, $actTransactionLog, $who, $time) {
+        //更新 inv_lot 批次 库存表
+        $invLot = $db->selectOne(DB::raw("SELECT * FROM INV_LOT WHERE lotnum = ? AND customerid = ? AND sku = ? "), [
+            $lotNum, $info['customerid'], $info['sku']
+        ]);
+        if ($invLot) $db->update(DB::raw("UPDATE INV_LOT SET qty = qty+?,edittime=?,editwho=? WHERE lotnum = ? AND customerid = ? AND sku = ?"), [
+            (int)$info['amount'], $time, $who, $lotNum, $info['customerid'], $info['sku'],
+        ]);
+        else $db->insert(DB::raw("INSERT INTO INV_LOT VALUES(?,?,?,?,0,0,0,0,0,0,0,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?)"), [
+            $lotNum, $info['customerid'], $info['sku'], $info['amount'], $time, $who, $time, $who
+        ]);
+        //更新 inv_lot_loc_id 批次/库位/跟踪号 库存表
+        $invLotId = $db->selectOne(DB::raw("SELECT * FROM inv_lot_loc_id WHERE lotnum = ? AND locationid = ? AND customerid = ? AND sku = ? AND traceid = ? FOR UPDATE"), [
+            $lotNum, $actTransactionLog['location'], $actTransactionLog['customerid'], $actTransactionLog['sku'], $actTransactionLog['trackid']
+        ]);
 
 //            if ($info['location']) { //存在目标库位
 //                $invLotIdHasPreLocation = $db->selectOne(DB::raw("SELECT * FROM inv_lot_loc_id WHERE lotnum = ? AND locationid = ? AND customerid = ? AND sku = ? AND traceid = ? FOR UPDATE"), [
@@ -643,36 +692,41 @@ sql;
 //                }
 //
 //            }
-                if ($invLotId) $db->update(DB::raw("UPDATE inv_lot_loc_id SET qty = qty+?,qtymvout = qtymvout+?,edittime=?,editwho=? WHERE lotnum = ? AND locationid = ? AND traceid = ?"), [
-                    (int)$info['amount'],(int)$info['amount'], $time, $who, $lotNum, $actTransactionLog['location'], $actTransactionLog['trackid']
-                ]);
-                else $db->insert(DB::raw("INSERT INTO inv_lot_loc_id VALUES(?,?,?,?,?,?,0,0,0,0,?,0,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,0,0,0,0,0,'*',0,null)"), [
-                    $lotNum, $actTransactionLog['location'], $actTransactionLog['trackid'], $actTransactionLog['customerid'], $actTransactionLog['sku'], (int)$info['amount'], (int)$info['amount'], $time, $who, $time, $who,
-                ]);
-        });
+        if ($invLotId) $db->update(DB::raw("UPDATE inv_lot_loc_id SET qty = qty+?,qtymvout = qtymvout+?,edittime=?,editwho=? WHERE lotnum = ? AND locationid = ? AND traceid = ?"), [
+            (int)$info['amount'], (int)$info['amount'], $time, $who, $lotNum, $actTransactionLog['location'], $actTransactionLog['trackid']
+        ]);
+        else $db->insert(DB::raw("INSERT INTO inv_lot_loc_id VALUES(?,?,?,?,?,?,0,0,0,0,?,0,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,0,0,0,0,0,'*',0,null)"), [
+            $lotNum, $actTransactionLog['location'], $actTransactionLog['trackid'], $actTransactionLog['customerid'], $actTransactionLog['sku'], (int)$info['amount'], (int)$info['amount'], $time, $who, $time, $who,
+        ]);
+//        });
     }
 
     /**
-     * @throws \Throwable
+     * @param array $info
+     * @param array $invlotatt
+     * @param $actTransactionLog
+     * @param $who
+     * @param $time
+     * 生成上架任务
      */
     public function setFluxTskTaskListPA(array $info, array $invlotatt, $actTransactionLog, $who, $time)
     {
         $db = DB::connection("oracle");
-        $db->transaction(function () use ($db, $info, $invlotatt, $actTransactionLog, $who, $time) {
-            $sql = <<<sql
+//        $db->transaction(function () use ($db, $info, $invlotatt, $actTransactionLog, $who, $time) {
+        $sql = <<<sql
 INSERT INTO TSK_TASKLISTS VALUES(?,'1','PA',?,?,'ASN',?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,null,null,?,?,?,?,?,?,?,?,null,null,null,null,
     0,0,0,0,null,?,null,null,null,?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),null,null,?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),'N',null,null,
     ?,?,?,'N',null,?,'*',null,null,null,'N',null,null)
 sql;
-            $db->insert(DB::raw($sql), [
-                $actTransactionLog['tsid'], $actTransactionLog['customerid'], $actTransactionLog['sku'], $actTransactionLog['docno'], $actTransactionLog['doclineno'],
-                $actTransactionLog['lotNum'], $actTransactionLog['packid'], 'EA', $info['amount'], $info['amount'], $actTransactionLog['location'], $actTransactionLog['location'],
-                $actTransactionLog['trackid'], $actTransactionLog['lotNum'], $actTransactionLog['packid'], 'EA', $info['amount'], $info['amount'],
-                $info['location'], $info['location'], $actTransactionLog['trackid'], '00', 'Putaway Task', '3', $invlotatt['lotatt01'], $invlotatt['lotatt02'], $invlotatt['lotatt03'], $invlotatt['lotatt04'],
-                $invlotatt['lotatt05'], $invlotatt['lotatt06'], $invlotatt['lotatt07'], $invlotatt['lotatt08'], $actTransactionLog['trid'], $who, $time, null, null, null, null,
-                $actTransactionLog['userdefine1'], $actTransactionLog['userdefine2'], $actTransactionLog['userdefine3'], $actTransactionLog['warehouseid']
-            ]);
-        });
+        $db->insert(DB::raw($sql), [
+            $actTransactionLog['tsid'], $actTransactionLog['customerid'], $actTransactionLog['sku'], $actTransactionLog['docno'], $actTransactionLog['doclineno'],
+            $actTransactionLog['lotNum'], $actTransactionLog['packid'], 'EA', $info['amount'], $info['amount'], $actTransactionLog['location'], $actTransactionLog['location'],
+            $actTransactionLog['trackid'], $actTransactionLog['lotNum'], $actTransactionLog['packid'], 'EA', $info['amount'], $info['amount'],
+            $info['location'], $info['location'], $actTransactionLog['trackid'], '00', 'Putaway Task', '3', $invlotatt['lotatt01'], $invlotatt['lotatt02'], $invlotatt['lotatt03'], $invlotatt['lotatt04'],
+            $invlotatt['lotatt05'], $invlotatt['lotatt06'], $invlotatt['lotatt07'], $invlotatt['lotatt08'], $actTransactionLog['trid'], $who, $time, null, null, null, null,
+            $actTransactionLog['userdefine1'], $actTransactionLog['userdefine2'], $actTransactionLog['userdefine3'], $actTransactionLog['warehouseid']
+        ]);
+//        });
     }
 
     /**
@@ -680,54 +734,55 @@ sql;
      * @param $lotNum
      * @param $who
      * @param $time
-     * @return mixed
-     * @throws \Throwable
+     * @return array
      * 创建入库事务
      */
-    public function setFluxActTransactionLog(array $info, $lotNum, $who, $time)
+    public function setFluxActTransactionLog(array $info, $lotNum, $who, $time): array
     {
         $db = DB::connection("oracle");
-        return $db->transaction(function () use ($db, $info, $lotNum, $time, $who) {
-            if ($info['trackNumber']) $trackNumber = $info['trackNumber'];
-            else $trackNumber = substr(md5($time), 0, 30);
-            $asnHeader = OracleDOCASNHeader::query()->where('asnno', $info['asnno'])->first();
-            $asnDetail = OracleDOCASNDetail::query()->where('asnno', $info['asnno'])
-                ->where('asnlineno',$info['asnlineno'])->where('sku', $info['sku'])->first();
-            //添加超收判断
-            $actTransactionLogQty=OracleActTransactionLog::query()->where('docno',$info['asnno'])
-                ->where('doclineno',$info['asnlineno'])->where('fmsku', $info['sku'])->count('fmqty');
-            if ((int)($info['amount']+$actTransactionLogQty)>(int)$asnDetail['expectedqty'])return [];
-
-            $sql = <<<sql
+//        return $db->transaction(function () use ($db, $info, $lotNum, $time, $who) {
+        if ($info['trackNumber']) $trackNumber = $info['trackNumber'];
+        else $trackNumber = substr(md5($time), 0, 30);
+        $asnHeader = OracleDOCASNHeader::query()->where('asnno', $info['asnno'])->first();
+        $asnDetail = OracleDOCASNDetail::query()->where('asnno', $info['asnno'])
+            ->where('asnlineno', $info['asnlineno'])->where('sku', $info['sku'])->first();
+        //添加超收判断
+        $actTransactionLogQty = OracleActTransactionLog::query()->where('docno', $info['asnno'])
+            ->where('doclineno', $info['asnlineno'])->where('fmsku', $info['sku'])->count('fmqty');
+        if ((int)($info['amount'] + $actTransactionLogQty) > (int)$asnDetail['expectedqty']) return [];
+
+        $sql = <<<sql
 INSERT INTO ACT_TRANSACTION_LOG VALUES(?,'IN',?,?,?,?,'ASN',?,?,?,?,?,?,?,?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,
 TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,0,0,0,0,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,?,null,null,null,?,?,?,?,?,?,?,?,
 ?,?,?,?,'1','Y',null,?,?,?,?,null,null,?,null,null)
 sql;
-            list($trid, $max) = app('StorageService')->getTrNumber();
-            list($tsid, $max) = $this->getTsNum();
-            $db->insert(DB::raw($sql), [
-                $trid, $asnDetail->customerid, $asnDetail->sku,
-                $asnDetail->asnno, $asnDetail->asnlineno, $lotNum, $asnDetail->receivinglocation, '*', $asnDetail->packid, 'EA', $info['amount'], $info['amount'], '99', $time, $who,
-                $time, $who, $time, $asnDetail->customerid, $asnDetail->sku, $trackNumber, $asnDetail->receivinglocation, $who, $asnDetail->packid, 'EA', $info['amount'], $info['amount'], $lotNum,
-                '*', '0', 'N', $tsid, substr($asnDetail->receivinglocation, -4), $asnHeader->userdefine1, $asnHeader->userdefine2,
-                $asnHeader->userdefine3, 'O'
-            ]);
-            app('StorageService')->setTrNumber();
-            $this->setTsNum();
-            $actTransactionLog = [
-                'trid' => $trid, 'docno' => $asnDetail->asnno, 'customerid' => $asnDetail->customerid, 'sku' => $asnDetail->sku, 'doclineno' => $asnDetail->asnlineno, 'lotNum' => $lotNum, 'location' => $asnDetail->receivinglocation,
-                'packid' => $asnDetail->packid, 'tsid' => $tsid, 'warehouseid' => substr($asnDetail->receivinglocation, -4), 'userdefine1' => $asnHeader->userdefine1, 'userdefine2' => $asnHeader->userdefine2,
-                'userdefine3' => $asnHeader->userdefine3, 'trackid' => $trackNumber
-            ];
-            return $actTransactionLog;
-        });
+        list($trid, $max) = app('StorageService')->getTrNumber();
+        list($tsid, $max) = $this->getTsNum();
+        $db->insert(DB::raw($sql), [
+            $trid, $asnDetail->customerid, $asnDetail->sku,
+            $asnDetail->asnno, $asnDetail->asnlineno, $lotNum, $asnDetail->receivinglocation, '*', $asnDetail->packid, 'EA', $info['amount'], $info['amount'], '99', $time, $who,
+            $time, $who, $time, $asnDetail->customerid, $asnDetail->sku, $trackNumber, $asnDetail->receivinglocation, $who, $asnDetail->packid, 'EA', $info['amount'], $info['amount'], $lotNum,
+            '*', '0', 'N', $tsid, substr($asnDetail->receivinglocation, -4), $asnHeader->userdefine1, $asnHeader->userdefine2,
+            $asnHeader->userdefine3, 'O'
+        ]);
+        app('StorageService')->setTrNumber();
+        $this->setTsNum();
+        $actTransactionLog = [
+            'trid' => $trid, 'docno' => $asnDetail->asnno, 'customerid' => $asnDetail->customerid, 'sku' => $asnDetail->sku, 'doclineno' => $asnDetail->asnlineno, 'lotNum' => $lotNum, 'location' => $asnDetail->receivinglocation,
+            'packid' => $asnDetail->packid, 'tsid' => $tsid, 'warehouseid' => substr($asnDetail->receivinglocation, -4), 'userdefine1' => $asnHeader->userdefine1, 'userdefine2' => $asnHeader->userdefine2,
+            'userdefine3' => $asnHeader->userdefine3, 'trackid' => $trackNumber
+        ];
+        return $actTransactionLog;
+//        });
     }
 
     /**
      * @param array $info
+     * @param array $invlotatt
+     * @param $who
+     * @param $time
      * @return mixed
-     * @throws \Throwable
-     * 或去flux 批次号
+     * 获取flux 批次号
      */
     public function getOrCreateLotNum(array $info, array $invlotatt, $who, $time)
     {
@@ -739,18 +794,18 @@ sql;
 
         $db = DB::connection("oracle");
         list($num, $max) = $this->getLtNum();
-        return $db->transaction(function () use ($db, $info, $invlotatt, $num, $who, $time) {
-            $sql = <<<sql
+//        return $db->transaction(function () use ($db, $info, $invlotatt, $num, $who, $time) {
+        $sql = <<<sql
 INSERT INTO INV_LOT_ATT VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,
 TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?)
 sql;
-            $db->insert(DB::raw($sql), [
-                $num, $info['customerid'], $info['sku'], $invlotatt['lotatt01'], $invlotatt['lotatt02'], $invlotatt['lotatt03'], $invlotatt['lotatt04'],
-                $invlotatt['lotatt05'], $invlotatt['lotatt06'], $invlotatt['lotatt07'], $invlotatt['lotatt08'], null, null, null, null, $time, $who, $time, $who, $time, null
-            ]);
-            $this->setLtNum();
-            return $num;
-        });
+        $db->insert(DB::raw($sql), [
+            $num, $info['customerid'], $info['sku'], $invlotatt['lotatt01'], $invlotatt['lotatt02'], $invlotatt['lotatt03'], $invlotatt['lotatt04'],
+            $invlotatt['lotatt05'], $invlotatt['lotatt06'], $invlotatt['lotatt07'], $invlotatt['lotatt08'], null, null, null, null, $time, $who, $time, $who, $time, null
+        ]);
+        $this->setLtNum();
+        return $num;
+//        });
 
     }
 
@@ -818,7 +873,7 @@ select BAS_SKU.SKU,INV_LOT_LOC_ID.CUSTOMERID,BAS_SKU.ALTERNATE_SKU1,INV_LOT_LOC_
 sql;
         if ($this->checkUserOwnerAuth($param)) { //输入条件为货主
             $sql .= ' INV_LOT_LOC_ID.CUSTOMERID= ?';
-        } else if (preg_match('/^[A-Z]{1,3}[0-9]{2,3}[-][0-9]{2,3}[-][0-9]{2,3}$/', $param)) { //判断是否为库位
+        } else if (preg_match('/^[A-Z]{1,3}[0-9]{2,3}[-][0-9]{2,3}[-][0-9]{2,3}$/', $param) ||strpos($param,'IDE') !== false) { //判断是否为库位
             $sql .= ' INV_LOT_LOC_ID.LOCATIONID= ?';
         } else {
             $sql .= " BAS_SKU.SKU in (  select SKU from BAS_SKU where ALTERNATE_SKU1=? union
@@ -829,13 +884,13 @@ sql;
 
         $sql .= ' group by BAS_SKU.SKU,INV_LOT_LOC_ID.CUSTOMERID,BAS_SKU.ALTERNATE_SKU1,INV_LOT_LOC_ID.LOCATIONID,
         INV_LOT_ATT.LOTATT05,INV_LOT_ATT.LOTATT08,INV_LOT_ATT.LOTATT01,INV_LOT_ATT.LOTATT02,INV_LOT_ATT.LOTATT03,INV_LOT_ATT.LOTATT04';
-        if ($this->checkUserOwnerAuth($param)){
+        if ($this->checkUserOwnerAuth($param)) {
             $invLots = DB::connection("oracle")->select(DB::raw($sql), [strtoupper($param)
             ]);
-        }else if(preg_match('/^[A-Z]{1,3}[0-9]{2,3}[-][0-9]{2,3}[-][0-9]{2,3}$/', $param)){
+        }else if(preg_match('/^[A-Z]{1,3}[0-9]{2,3}[-][0-9]{2,3}[-][0-9]{2,3}$/', $param) ||strpos($param,'IDE') !== false){
             $invLots = DB::connection("oracle")->select(DB::raw($sql), [$param]);
-        }else{
-            $invLots = DB::connection("oracle")->select(DB::raw($sql), [$param,$param,$param,$param]);
+        } else {
+            $invLots = DB::connection("oracle")->select(DB::raw($sql), [$param, $param, $param, $param]);
         }
         if (!$invLots) return [];
         else return $invLots;

+ 14 - 0
app/Services/InventoryAccountService.php

@@ -77,21 +77,25 @@ class InventoryAccountService
         $sql.=' , storeStatus.QTY 在库数量, storeStatus.QtyAllocated 占用数量,count(1) over () as sum from ';
         $sql.=' (select FMLotNum,FMSKU,TOCustomerID 客户,0 as 移出数量, sum(TOQty_Each) as 移入数量, TOLocation as 库位 ';
         $sql.=" from ACT_Transaction_Log where TransactionType='PA' ";
+        if ($code)$sql.=" and TOCustomerID = '".$code."' ";
         if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
         if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
         $sql.=' group by TOCustomerID, TOLocation,FMSKU,FMLotNum union all ';
         $sql.=' select FMLotNum,FMSKU,FMCUSTOMERID 客户,sum(FMQty_Each) as 移出数量, 0 as 移入数量, FMLOCATION as 库位 ';
         $sql.=" from ACT_Transaction_Log where TransactionType='SO' ";
+        if ($code)$sql.=" and FMCUSTOMERID = '".$code."' ";
         if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
         if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
         $sql.=' group by FMCustomerID, FMLocation,FMSKU,FMLotNum union all ';
         $sql.=' select FMLotNum,FMSKU,FMCUSTOMERID 客户,sum(FMQty_Each) as 移出数量,0 as 移入数量, FMLocation as 库位 ';
         $sql.=" from ACT_Transaction_Log  where TransactionType='MV' ";
+        if ($code)$sql.=" and FMCUSTOMERID = '".$code."' ";
         if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
         if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
         $sql.=' group by FMLocation,FMCUSTOMERID,FMSKU,FMLotNum union all ';
         $sql.=' select FMLotNum,FMSKU,TOCustomerID 客户,0 as 移出数量,sum(TOQty_Each)as 移入数量, TOLocation as 库位 ';
         $sql.=" from ACT_Transaction_Log where TransactionType='MV' ";
+        if ($code)$sql.=" and TOCustomerID = '".$code."' ";
         if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
         if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
         $sql.=' group by TOLocation,TOCustomerID,FMSKU,FMLotNum)stockLog ';
@@ -211,7 +215,17 @@ class InventoryAccountService
             if ($location||$barcode)$type='局部盘点';
             if (!$location&&!$barcode)$type='动盘';
             $wmsInventories=$this->conditionPortStock($date_start,$date_end,$ownerId,$location,$barcode);
+            //动盘  判断库存为0的ide料想是否放有其他商品
+            foreach ($wmsInventories as $key=>$wmsInventory){
+                if (!$wmsInventory->在库数量 && strpos($wmsInventory->库位,'IDE') !== false){
+                    /** @var HandInStorageService $handInStorageService  */
+                    $handInStorageService=app('HandInStorageService');
+                    $invs=$handInStorageService->getInventoryInfos($wmsInventory->库位);
+                    if (count($invs)>0) unset($wmsInventories[$key]);
+                }
+            }
         }
+
         if (!$date_start&&!$date_end){
             $ownerName=Owner::where('id',$ownerId)->value('code');
             //$ownerName=OracleBasCustomer::where('customer_type','OW')->where('active_flag','Y')->where('descr_c',$name)->value('customerid');

+ 25 - 2
app/Services/StorageService.php

@@ -495,7 +495,7 @@ sql;
                 $ide,'0',$trid,$who,date("Y-m-d H:i:s"),$who,date("Y-m-d H:i:s"),date("Y-m-d H:i:s"),$who,$task->taskid,$task->taskid_sequence
             ]);
             $task->who = $who;
-            $this->checkAsn($task);
+            $this->checkAsn($task,$who);
             $db->commit();
             return true;
         }catch (\Exception $e){
@@ -504,7 +504,7 @@ sql;
         }
     }
 
-    private function checkAsn($task)
+    private function checkAsn($task,$who)
     {
         $sql = <<<SQL
 SELECT 1 FROM DOC_ASN_DETAILS WHERE ASNNO = ? AND LINESTATUS != '40'
@@ -529,6 +529,29 @@ DELETE FROM INV_LOT_LOC_ID WHERE ((LOTNUM,LOCATIONID,TRACEID) IN
 AND QTY = 0 AND QTYPA = 0
 SQL;
         DB::connection("oracle")->delete(DB::raw($sql),[$task->docno,$task->docno]);
+        $this->createCloseTransaction($task,$who);
+    }
+
+    /**
+     * 建立关单事务
+     */
+    private function createCloseTransaction($task,$who)
+    {
+        $date = date("Y-m-d H:i:s");
+        $sql = <<<sql
+INSERT INTO ACT_TRANSACTION_LOG VALUES(?,'99',?,'*',?,'0','ASN','*','*','*','*','*','0','0','99',TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,
+TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,0,0,0,0,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,'*',null,null,null,'*','*',?,'*','*','0','0','*',
+null,null,null,null,null,null,null,?,?,?,?,null,null,?,null,null)
+sql;
+        list($trid,$max) = $this->getTrNumber();
+        DB::connection("oracle")->insert(DB::raw($sql),[
+            $trid, $task->customerid, $task->docno,
+            $date,$who, $date,$who,
+            $date,$task->customerid, $who,
+            $task->warehouseid, $task->userdefine1,
+            $task->userdefine2, $task->userdefine3,'O'
+        ]);
+        $this->setTrNumber();
     }
     /**
      * put cache rack box to warehousing(将缓存架料箱入库)

+ 4 - 0
resources/views/package/logistic/index.blade.php

@@ -157,6 +157,7 @@
                     </td>
                     <!--退件状态-->
                     <td>@{{ package.rejected_bill?'有':'无' }}</td>
+                    <td>@{{ package.order.oracle_d_o_c_order_header.notes??'' }}</td>
                     <td  class="m-0 p-0 order-package-remarks" style="padding-left: 0 !important;padding-right: 0 !important">
                         @can('包裹管理-快递-客服备注')
                         <label :for="'create_remark_'+package.id" class="btn-create-remark" @click="package.input_remark=!package.input_remark">
@@ -417,6 +418,8 @@
                                 {name: '无记录', value: '无记录'},
                             ]
                         },
+                        {name: 'order_notes', type: 'input', tip: '糊模查找需要在右边打上%符号', placeholder: '订单备注'},
+
                     ]
                 ];
                 _this.form = new query({
@@ -437,6 +440,7 @@
                     {name: 'weighed_at', value: '称重日期'},
                     {name: 'transfer_status', value: '快递路由'},
                     {name: 'is_new_rejecting', value: '退件状态'},
+                    {name: 'order_notes', value: '订单备注'},
                     {name: 'remark', value: '客服备注'},
                     {name: 'result_explain', value: '情况说明'},
                     {name: 'issue_type', value: '问题类别'},

+ 15 - 1
resources/views/store/handInStorage/putaway.blade.php

@@ -76,8 +76,22 @@
                                         <span class="text-right float-right" v-show="info.barCode">选中:<input type="checkbox" :id="'task_'+i"
                                                                                        @click="checked($event,task)"></span>
                                         <span><span class="text-lowercase h5">待上架/总量:</span><span
-                                                class="text-lowercase text-info font-weight-bold h5">@{{ task.qty}}/@{{ task.receivedqty }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
+                                                class="text-lowercase text-info font-weight-bold h5">@{{ task.qty}}/@{{ task.receivedqty?task.receivedqty:task.receivedqty_each }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
                                         <span><span class="h5">容器号:</span><span class="h5">@{{ task.plantoid }} </span></span>
+
+                                        <span v-if="task.lotatt01"><span class="text-black h5">生产日期:</span><span
+                                                class="text-black font-weight-bold h5">@{{ task.lotatt01 }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
+                                        <span v-if="task.lotatt02"><span class="text-black h5">失效日期:</span><span
+                                                class="text-black font-weight-bold h5">@{{ task.lotatt02 }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
+                                        <span v-if="task.lotatt03"><span class="text-black h5">入库日期:</span><span
+                                                class="text-black font-weight-bold h5">@{{ task.lotatt03 }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
+                                        <span v-if="task.lotatt04"><span class="text-black h5">批号:</span><span
+                                                class="text-black font-weight-bold h5">@{{ task.lotatt04 }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
+                                        <span v-if="task.lotatt05"><span class="text-black h5">属性仓:</span><span
+                                                class="text-black font-weight-bold h5">@{{ task.lotatt05 }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
+                                        <span v-if="task.lotatt08"><span class="text-black h5">质量状态:</span><span
+                                                class="text-black font-weight-bold h5">@{{ task.lotatt08 }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
+
                                     </div>
                                 </div>
                             </td>

+ 1 - 1
resources/views/store/handInStorage/receive.blade.php

@@ -51,7 +51,7 @@
                                                     <span><span class="small">条码:</span><span class="text-black font-weight-bold small">@{{ asnDetail.alternate_sku1 }}</span></span>
                                                     <span><span class="small">品名:</span><span class="text-black small">@{{ asnDetail.skudescrc }}</span></span>
                                                     <span><span class="small">预期数量:</span><span class="text-black font-weight-bold small">@{{ asnDetail.expectedqty }}</span></span>
-                                                    <span><span class="small">已收数量:</span><span class="text-black font-weight-bold small">@{{ asnDetail.receivedqty }}</span></span>
+                                                    <span><span class="small">已收数量:</span><span class="text-black font-weight-bold small">@{{ asnDetail.receivedqty?asnDetail.receivedqty:asnDetail.receivedqty_each }}</span></span>
                                                 <td/>
                                             </tr>
                                         </table>

+ 2 - 2
resources/views/store/handInStorage/receiveDetailPage.blade.php

@@ -67,7 +67,7 @@
                                         <span class="text-right float-right h5">选中:<input type="checkbox" @click="checked(asnDetail)"></span>
                                         <span><span class="text-lowercase h5">品名:</span><span class="text-lowercase h5">@{{ asnDetail.skudescrc }} </span></span>
                                         <span><span class="text-black h5">预期数量:</span><span class="text-black-50 h5">@{{ asnDetail.expectedqty }}</span></span>
-                                        <span><span class="text-black h5">已收数量:</span><span class="text-black-50 h5">@{{ asnDetail.receivedqty }}</span></span>
+                                        <span><span class="text-black h5">已收数量:</span><span class="text-black-50 h5">@{{ asnDetail.receivedqty?asnDetail.receivedqty:asnDetail.receivedqty_each }}</span></span>
                                     </div>
                                 </div>
                             </td>
@@ -258,7 +258,7 @@
                     this.info.sku=asnDetail.sku;
                     this.info.name=asnDetail.skudescrc;
                     this.info.expectedqty=asnDetail.expectedqty;
-                    this.info.receivedqty=asnDetail.receivedqty;
+                    this.info.receivedqty=asnDetail.receivedqty?asnDetail.receivedqty:asnDetail.receivedqty_each;
                     this.info.amount=Number(this.info.expectedqty)-Number(this.info.receivedqty);
                     this.info.asnlineno=asnDetail.asnlineno;
                 },

+ 1 - 1
tests/Services/LogisticAliJiSuApiService/QueryTest.php

@@ -30,7 +30,7 @@ class QueryTest extends TestCase
      */
     public function prod_test()
     {
-//       $response = $this->service->query('9883840347518');
+//       $response = $this->service->query('KYE900000391232');
 //       dd($response);
 //       if ($response->status==0){
 //           $this->assertNotEmpty($response->result);