Browse Source

Merge branch 'zzd'

zhouzhendong 4 years ago
parent
commit
a3d782f0c3

+ 0 - 1
app/Commodity.php

@@ -15,7 +15,6 @@ class Commodity extends Model
     use ModelTimeFormat;
     protected $fillable=['name','sku','owner_id','created_at','length',
         'width','height','volumn',"type","pack_spec",'updated_at',"remark"];
-    //protected $appends=['barcode']; N+1隐患 暂时干掉
 
     public function model():HasOne
     {

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

@@ -136,10 +136,11 @@ sql;
 
     public function test()
     {
-        dd(app("MenuService")->getVisibleFunctionList());
-        $url = 'denied';
-        header('Location: /'.$url,true,302);
-        die();
+        /** @var OwnerPriceOperationService $service */
+        $service = app("OwnerPriceOperationService");
+        $GLOBALS["FEE_INFO"] = [];
+        $store = Store::query()->where('asn_code',"ASN2108271548")->first();
+        dd($service->matching($store, Feature::MAPPING["store"], $store->owner_id, "入库"),$store->toArray());
         TaskTransaction::query()->where("id",">=",280)->delete();
         /*$a= new StorageService();
         $a->clearTask(["HAIB1-01-01"]);

+ 1 - 0
app/OracleIdxAsrsReceive.php

@@ -38,6 +38,7 @@ class OracleIdxAsrsReceive extends Model
             $inserts='';
             $values=[];
             foreach($logisticNumbers_toInsert as $logisticNumber){
+                if (!$logisticNumber)continue;
                 $inserts .= " into idx_asrs_receive (grouptaskid,grouptasksequence,userdefine1,userdefine2,addwho,addtime)values(?,?,?,?,?,?) ";
                 $values[] = $logisticNumber??'';
                 $values[] = 1;

+ 1 - 0
app/Services/OwnerPriceOperationService.php

@@ -546,6 +546,7 @@ class OwnerPriceOperationService
                 $package["price"] = $rule->unit_price;
                 $package["unitId"] = $rule->unit_id;
                 $package["fee_info"] = [];
+                //单位转换 数量匹配
                 switch ($units[$rule->unit_id]){
                     case "箱"://为箱时同步商品寻找箱规并改变商品数量
                         $pack = $this->changeUnit($ownerId,$package[$columnMapping[9]]);

+ 1 - 1
app/Services/StoreItemService.php

@@ -190,7 +190,7 @@ class StoreItemService
         foreach ($storeItems as $storeItem) {
             $commodity= $dataHandlerService->getKeyValue(['id'=>$storeItem->commodity_id],$commodities_map);if (!$commodity) continue;
             $asnDetail = $dataHandlerService
-                ->getKeyValue(['asnno' => $storeItem->store_asn_code, 'asnlineno' => $storeItem->asn_line_code,'customerid'=>$owner_map[$commodity->owner_id],'sku' => $commodity->sku], $asnDetails_map);
+                ->getKeyValue(['asnno' => $storeItem->store->asn_code ?? '', 'asnlineno' => $storeItem->asn_line_code,'customerid'=>$owner_map[$commodity->owner_id],'sku' => $commodity->sku], $asnDetails_map);
             if (!$asnDetail) {
                 array_push($delete_storeItems, $storeItem);
                 continue;

+ 3 - 3
app/Services/StoreService.php

@@ -319,12 +319,14 @@ class StoreService
         $GLOBALS["FEE_INFO"] = [];
         list($id,$money,$taxFee) = $service->matching($store, Feature::MAPPING["store"], $store->owner_id, "入库");
 
+        $amount = 0;
+        if ($store->storeItems)foreach ($store->storeItems as $item)$amount += $item->amount;
         if (!app("OwnerFeeDetailService")->create([
             "owner_id" => $store->owner_id,
             "worked_at" => $store->updated_at,
             "type" => "收货",
             "operation_bill" => $store->asn_code,
-            "commodity_amount" => array_sum(array_column($store->storeItems->toArray(), "amount")),
+            "commodity_amount" => $amount,
             "work_fee" => $money,
             "owner_price_operation_id" => $id,
             "created_at" => date('Y-m-d H:i:s'),
@@ -332,8 +334,6 @@ class StoreService
             "outer_table_name" => "stores",
             "work_tax_fee" => $taxFee,
         ])) return false;
-        $amount = 0;
-        if ($store->storeItems)foreach ($store->storeItems as $item)$amount += $item->amount;
         $this->setStoreAmount($store->owner_id,$amount);
         Cache::put("owner_fee_details:stores_".$store->id,1,86400);
         if ($money>0)$this->constructFeeInfo([

+ 0 - 14
app/StoreItem.php

@@ -16,10 +16,6 @@ class StoreItem extends Model
         'store_id','asn_line_code','name',
         'sku','barcode','depository_id','amount','quality','status','commodity_id','expected_amount'
     ];
-    protected $appends=[
-        'store_asn_code',
-        'depository_name'
-    ];
 
     public function depository(){
         return $this->belongsTo('App\Depository','depository_id','id');
@@ -30,14 +26,4 @@ class StoreItem extends Model
     public function commodity(){
         return $this->hasOne('App\Commodity','id','commodity_id');
     }
-
-
-    public function getStoreASNCodeAttribute()
-    {
-        return $this['store']?$this['store']['asn_code']:null;
-    }
-    public function getDepositoryNameAttribute()
-    {
-        return $this['depository']?$this['depository']['name']:null;
-    }
 }

+ 2 - 2
resources/views/store/inStorage/storeItem.blade.php

@@ -10,12 +10,12 @@
                         <input class="checkItem" type="checkbox" :value="storeItem.id">
                     </td>
                     <td><span>@{{ i+1  }}</span></td>
-                    <td><span>@{{storeItem.store_asn_code}}</span></td>
+                    <td><span>@{{storeItem.store ? storeItem.store.asn_code : ''}}</span></td>
                     <td><span>@{{storeItem.asn_line_code}}</span></td>
                     <td class="text-muted"><span>@{{storeItem.name}}</span></td>
                     <td class="text-muted"><span>@{{storeItem.sku}}</span></td>
                     <td class="text-muted"><span>@{{storeItem.barcode}}</span></td>
-                    <td><span>@{{storeItem.depository_name}}</span></td>
+                    <td><span>@{{  storeItem.depository ? storeItem.depository.name : ''}}</span></td>
                     <td class="text-muted"><span>@{{storeItem.amount}}</span></td>
                     <td class="text-muted"><span>@{{storeItem.quality}}</span></td>
                     <td class="text-muted"><span>@{{storeItem.status}}</span></td>