Просмотр исходного кода

手持上架,库位校验逻辑调整

haozi 4 лет назад
Родитель
Сommit
4f4467f842

+ 1 - 1
app/Http/Controllers/HandInStorageController.php

@@ -114,7 +114,7 @@ class HandInStorageController extends Controller
             if ($result===1)$this->error('需要维护产品档案');
             if ($result===2)$this->error('需要维护该产品档案中的重量体积');
         }
-        if ($handInStorageService->checkForwardingLoc($info)===1)$this->error('请维护拣货位');
+        if ($info['customerid']=='JIANSHANG'&&$handInStorageService->checkForwardingLoc($info)===1)$this->error('请维护拣货位');
         try {
             $result = $handInStorageService->fluxHandIn($info);
             if ($result){

+ 4 - 0
app/OracleInvLotLocId.php

@@ -24,4 +24,8 @@ class OracleInvLotLocId extends Model
     *         QTY 在库数量
     *         QtyAllocated 占用数量
     * */
+    public function oracleInvLotAtt(): \Illuminate\Database\Eloquent\Relations\BelongsTo
+    {
+       return $this->belongsTo(OracleInvLotAtt::class,'lotnum','lotnum');
+    }
 }

+ 18 - 5
app/Services/HandInStorageService.php

@@ -17,6 +17,7 @@ use App\OracleInvLotLocId;
 use App\Traits\ServiceAppAop;
 use App\ValueStore;
 use Carbon\Carbon;
+use Decimal\Decimal;
 use Doctrine\DBAL\Schema\AbstractAsset;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Collection;
@@ -124,19 +125,26 @@ class HandInStorageService
         if (!$location) return 1;//库位不存在
 
         if ($location['mix_flag'] == 'N' && $location['mix_lotflag'] == 'N') { // 库位:产品和批次都不可混放
-            $inv = OracleInvLotLocId::query()->where('locationid', $info['location'])->first();
+            $inv = OracleInvLotLocId::query()->with('oracleInvLotAtt:lotnum,lotatt01,lotatt02,lotatt03,lotatt04,lotatt05,lotatt08')
+                ->where('locationid', $info['location'])->first();
 
             if (!$inv) return true; //当前库位无库存余量 可直接入库
 
             if ($inv['customerid'] == $param['customerid'] && $inv['sku'] == $param['sku']
-                && $inv['lotnum'] == $param['plantolotnum'])
+                && $inv['oracleInvLotAtt']['lotatt01'] == $param['lotatt01']
+                && $inv['oracleInvLotAtt']['lotatt02'] == $param['lotatt02']
+                && $inv['oracleInvLotAtt']['lotatt04'] == $param['lotatt04']
+                && $inv['oracleInvLotAtt']['lotatt05'] == $param['lotatt05']
+                && $inv['oracleInvLotAtt']['lotatt08'] == $param['lotatt08']
+            )
                 return true;
             else return 2; //库位:产品和批次不可混放
         }
 
 
         if ($location['mix_flag'] == 'Y' && $location['mix_lotflag'] == 'N') {//库位:产品可混放,批次不可
-            $invs = OracleInvLotLocId::query()->where('locationid', $info['location'])->get();
+            $invs = OracleInvLotLocId::query()->with('oracleInvLotAtt:lotnum,lotatt01,lotatt02,lotatt03,lotatt04,lotatt05,lotatt08')
+                ->where('locationid', $info['location'])->get();
 
             if ($invs->count() == 0) return true; //当前库位无库存余量 可直接入库
 
@@ -146,13 +154,18 @@ class HandInStorageService
                     $skuInvs[] = $inv;
                     continue;
                 }
-                if ($inv['lotnum'] == $param['plantolotnum']) return true; // 批次相同
+                if ($inv['oracleInvLotAtt']['lotatt01'] == $param['lotatt01']
+                && $inv['oracleInvLotAtt']['lotatt02'] == $param['lotatt02']
+                && $inv['oracleInvLotAtt']['lotatt04'] == $param['lotatt04']
+                && $inv['oracleInvLotAtt']['lotatt05'] == $param['lotatt05']
+                && $inv['oracleInvLotAtt']['lotatt08'] == $param['lotatt08']) return true; // 批次相同
                 return 3;   //库位:产品相同,不能混放批次
             }
             if (count($skuInvs) == count($invs)) return true;
         }
         if ($location['mix_flag'] == 'N' && $location['mix_lotflag'] == 'Y') {  //库位:产品不可混放,批次可混放
-            $inv = OracleInvLotLocId::query()->where('locationid', $info['location'])->first();
+            $inv = OracleInvLotLocId::query()->with('oracleInvLotAtt:lotnum,lotatt01,lotatt02,lotatt03,lotatt04,lotatt05,lotatt08')
+                ->where('locationid', $info['location'])->first();
             if (!$inv) return true; //当前库位无库存余量 可直接入库
 
             if ($inv['customerid'] == $param['customerid'] && $inv['sku'] == $param['sku']) return true;