Sfoglia il codice sorgente

手持上架页面添加货主,asn,等筛选上架任务

haozi 4 anni fa
parent
commit
c834ceaac0

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

@@ -100,7 +100,7 @@ class CommodityController extends Controller
     {
         if(!Gate::allows('商品信息-编辑')){ return redirect(url('denied'));  }
         $ownerService=app(OwnerService::class);
-        $owners = $ownerService->getIntersectPermitting();
+
         return view('maintenance.commodity.edit',['commodity'=>$commodity,'owners'=>$owners]);
     }
 

+ 10 - 3
app/Http/Controllers/HandInStorageController.php

@@ -136,11 +136,18 @@ class HandInStorageController extends Controller
         $barCode=$request->input('barCode');
         $trackNumber=$request->input('trackNumber');
         if(!$barCode)$this->error('条码不能为空');
-        if(!$trackNumber)$this->error('容器号不能为空');
         /** @var HandInStorageService $handInStorageService  */
         $handInStorageService=app('HandInStorageService');
         $tasks=$handInStorageService->getTsk($trackNumber,$barCode);
-        if (count($tasks)>0)$this->success($tasks);
+        if (count($tasks)>0){
+            $invLots=$handInStorageService->getInvotlocid($barCode);
+            $collect= collect();
+            foreach ($invLots as $invLot){
+                if ($invLot->locationid=='STAGEWH01'||$invLot->locationid=='STAGEWH02')continue;
+                $collect->push($invLot);
+            }
+            return json_encode(["success"=>true,'data'=>$tasks,'inv'=>$collect]);
+        }
         else $this->error("该商品暂无上架任务");
     }
 
@@ -152,7 +159,7 @@ class HandInStorageController extends Controller
     {
         $this->gate("入库管理-手持入库-上架");
         $info=$request->input('info');
-        if (!$info['location']||!$info['amount']||!$info['trackNumber']||!$info['barCode']) $this->error('参数错误');
+        if (!$info['location']||!$info['amount']||!$info['barCode']) $this->error('参数错误');
         if (count($request->input('checkData'))==0) $this->error('请勾选要上架任务');
         $checkData=$request->input('checkData')[0];
         /** @var HandInStorageService $handInStorageService  */

+ 6 - 6
app/Http/Controllers/TestController.php

@@ -256,12 +256,12 @@ sql;
 
     public function testZC()
     {
-        $batch=Batch::query()
-            ->with('orders.orderCommodities.commodity.barcodes')
-            ->where('code','W210814000158')
-            ->first();
+//        $batch=Batch::query()
+//            ->with('orders.orderCommodities.commodity.barcodes')
+//            ->where('code','W210814000158')
+//            ->first();
 //        dd($batch);
-        app(ForeignZhenCangService::class)->broadcastBatch($batch);
-        dd('上传成功');
+//        app(ForeignZhenCangService::class)->broadcastBatch($batch);
+//        dd('上传成功');
     }
 }

+ 70 - 10
app/Services/HandInStorageService.php

@@ -185,28 +185,28 @@ class HandInStorageService
      */
     public function selectAsn($asn)
     {
-        if (!$asn) return OracleDOCASNHeader::query()
+        if (!$asn) return OracleDOCASNHeader::query()  //空扫
             ->select(['asnno', 'asnreference1', 'asnstatus', 'addtime', 'customerid', 'asntype'])
             ->where('asnstatus', '00')
             ->orderByDesc('addtime')
             ->limit(50)
             ->get();
 
-        if (strpos(strtoupper($asn), 'ASN') !== false) {
+        if (strpos(strtoupper($asn), 'ASN') !== false) {  //asn 单号
             return OracleDOCASNHeader::query()
                 ->select(['asnno', 'asnreference1', 'asnstatus', 'addtime', 'customerid', 'asntype'])
                 ->where('asnno', $asn)
                 ->whereIn('asnstatus', ['00', '30'])
                 ->get();
         } else {
-            $asns = OracleDOCASNHeader::query()
+            $asns = OracleDOCASNHeader::query()  //货主
                 ->select(['asnno', 'asnreference1', 'asnstatus', 'addtime', 'customerid', 'asntype'])
                 ->where('customerid', strtoupper($asn))
                 ->whereIn('asnstatus', ['00', '30'])
                 ->get();
             if ($asns->count() > 0) {
                 return $asns;
-            } else {
+            } else {  //商品条码
                 $sql = <<<SQL
  SELECT DOC_ASN_HEADER.ASNNO,DOC_ASN_HEADER.addtime,DOC_ASN_HEADER.asnreference1,DOC_ASN_HEADER.customerid,DOC_ASN_HEADER.asnstatus,DOC_ASN_HEADER.asntype FROM DOC_ASN_HEADER
                   LEFT JOIN DOC_ASN_DETAILS ON DOC_ASN_HEADER.ASNNO = DOC_ASN_DETAILS.ASNNO
@@ -309,14 +309,34 @@ sql;
     }
 
     /**
-     * @param string $barCode
+     * @param $barcode
      * @return array
+     * 根据条码获取 库存
+     */
+    public function getInvotlocid($barcode): array
+    {
+        $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,
+       sum(INV_LOT_LOC_ID.QTY) AS QTY from INV_LOT_LOC_ID
+    left join BAS_SKU on INV_LOT_LOC_ID.CUSTOMERID=BAS_SKU.CUSTOMERID and INV_LOT_LOC_ID.SKU =BAS_SKU.SKU
+    left join INV_LOT_ATT on INV_LOT_ATT.LOTNUM=INV_LOT_LOC_ID.LOTNUM
+    where (BAS_SKU.ALTERNATE_SKU1 = ? OR BAS_SKU.ALTERNATE_SKU2 = ?  OR BAS_SKU.ALTERNATE_SKU3 = ?)
+group by INV_LOT_LOC_ID.CUSTOMERID,BAS_SKU.ALTERNATE_SKU1,INV_LOT_LOC_ID.LOCATIONID,INV_LOT_ATT.LOTATT05,INV_LOT_ATT.LOTATT08
+sql;
+        $invLots = DB::connection("oracle")->select(DB::raw($sql), [$barcode, $barcode, $barcode]);
+        if (!$invLots)return [];
+        else return $invLots;
+    }
+
+    /**
+     * @param string $barCode
+     * @return array|int
      * 根据商品条码  获取完全收货状态  部分收货状态的 PA任务
      */
-    public function getTsk(string $trackNumber, string $barCode): array
+    public function getTsk($trackNumber, string $barCode): array
     {
         $sql = <<<sql
-SELECT TSK_TASKLISTS.CustomerID,TSK_TASKLISTS.Sku,TSK_TASKLISTS.PlanToLotNum,TSK_TASKLISTS.PlanToID,DOC_ASN_DETAILS.SKUDESCRC,sum(TSK_TASKLISTS.PlanToQty) AS QTY
+SELECT TSK_TASKLISTS.CustomerID,TSK_TASKLISTS.DOCNO,TSK_TASKLISTS.Sku,TSK_TASKLISTS.PlanToLotNum,TSK_TASKLISTS.PlanToID,DOC_ASN_DETAILS.SKUDESCRC,sum(TSK_TASKLISTS.PlanToQty) AS QTY
 FROM DOC_ASN_DETAILS
          LEFT JOIN TSK_TASKLISTS ON DOC_ASN_DETAILS.ASNNO = TSK_TASKLISTS.DOCNO AND
                                     DOC_ASN_DETAILS.ASNLINENO = TSK_TASKLISTS.DOCLINENO
@@ -326,14 +346,54 @@ WHERE
                 WHERE LINESTATUS in ('30','40') and (ALTERNATE_SKU1 = ? OR ALTERNATE_SKU2 = ?  OR ALTERNATE_SKU3 = ?))
   AND TSK_TASKLISTS.TASKPROCESS = '00'
   AND TSK_TASKLISTS.TASKTYPE = 'PA'
-  AND TSK_TASKLISTS.PlanToID= ?
-  group by TSK_TASKLISTS.CustomerID,TSK_TASKLISTS.Sku,TSK_TASKLISTS.PlanToLotNum,TSK_TASKLISTS.PlanToID,DOC_ASN_DETAILS.SKUDESCRC
 sql;
-        $tasks = DB::connection("oracle")->select(DB::raw($sql), [$barCode, $barCode, $barCode, $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."'";
+                        continue;
+                    }
+                    $sql.=",'".$no->code."'";
+                }
+                $sql.=')';
+            }else{
+                $sql .= 'AND TSK_TASKLISTS.CustomerID IS NULL ';
+            }
+
+        }else{
+            if (strpos(strtoupper($trackNumber), 'ASN') !== false) $sql.='AND TSK_TASKLISTS.DOCNO= ?'; //输入条件为asn单号
+            if ($this->checkUserOwnerAuth($trackNumber)){ //输入条件为货主
+                $sql.='AND TSK_TASKLISTS.CustomerID= ?';
+            }else{
+                $sql.='AND TSK_TASKLISTS.PlanToID= ?';  //不是货主 判断是否为跟踪号
+            }
+        }
+
+        $sql.=' group by TSK_TASKLISTS.CustomerID,TSK_TASKLISTS.DOCNO,TSK_TASKLISTS.Sku,TSK_TASKLISTS.PlanToLotNum,TSK_TASKLISTS.PlanToID,DOC_ASN_DETAILS.SKUDESCRC';
+        if ($trackNumber){
+            if ($this->checkUserOwnerAuth($trackNumber))$tasks = DB::connection("oracle")->select(DB::raw($sql), [$barCode, $barCode, $barCode, strtoupper($trackNumber)]);
+            else $tasks = DB::connection("oracle")->select(DB::raw($sql), [$barCode, $barCode, $barCode, $trackNumber]);
+        }else {$tasks = DB::connection("oracle")->select(DB::raw($sql), [$barCode, $barCode, $barCode]);}
         if (!$tasks) return [];
         else return $tasks;
     }
 
+    /**
+     * @param $owner_code
+     * @return bool
+     * 判断当前用户货主权限
+     */
+    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;
+        else return false;
+    }
+
     /**
      * @throws \Throwable
      * flux手持端 上架

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

@@ -13,6 +13,7 @@
                             <label for="trackNumber" class="text-right font-weight-bold">容器号:</label>
                         </span>
                     <input type="text" class="form-control form-control-sm col-8" id="trackNumber" autocomplete="off"
+                           placeholder="支持货主,asn,跟踪号或不填"
                            :class="errors.trackNumber ? 'is-invalid' : ''" @keydown.enter="enterVal($event)"
                            v-model="info.trackNumber">
                     <span class="invalid-feedback offset-3" role="alert" v-if="errors.trackNumber">
@@ -78,6 +79,31 @@
                                                 class="text-lowercase">@{{ task.qty }} </span></span>
                                         <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
                                         <span><span class="text-black">商品名:</span><span class="text-black">@{{ task.skudescrc }}</span></span>
+                                        <span><span class="text-black">ASN:</span><span class="text-black font-weight-bold">@{{ task.docno }}</span></span>
+                                    </div>
+                                </div>
+                            </td>
+                        </tr>
+                    </table>
+                </div>
+                <div style="overflow: auto;overflow-x: hidden" id="cardTable" class="bg-secondary" v-if="invLots.length>0">
+                    <span class="font-weight-bold ml-1 text-white">库存余量</span>
+                    <table class="table-sm table-striped table-bordered table-hover mb-3"
+                           style="background: rgb(255, 255, 255);">
+                        <tr v-for="(invLot,i) in invLots">
+                            <td style="filter:grayscale(30%);">
+                                <div>
+                                    <div style="transform:scale(1)" class="pl-0">
+                                        <span><span class="text-black">货主:</span><span
+                                                class="text-black font-weight-bold">@{{ invLot.customerid }}</span></span>
+                                        <span><span class="text-black">条码:</span><span
+                                                class="text-danger">@{{ invLot.alternate_sku1 }}</span></span>
+                                        <span><span>库位:</span><span class="font-weight-bold">@{{ invLot.locationid }} </span></span>
+                                        <span><span class="text-lowercase">数量:</span><span
+                                                class="text-lowercase">@{{ invLot.qty }} </span></span>
+                                        <span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
+                                        <span><span class="text-black">属性仓:</span><span class="text-black">@{{ invLot.lotatt05 }}</span></span>
+                                        <span><span class="text-black">质量状态:</span><span class="text-black font-weight-bold">@{{ invLot.lotatt08 }}</span></span>
                                     </div>
                                 </div>
                             </td>
@@ -106,6 +132,7 @@
                         info: {},
                         errors: {},
                         tasks: [],
+                        invLots: [],
                         checkData: [],
                         selectTr: '',
                         isAndroid: false,
@@ -186,6 +213,7 @@
                                 .then(res => {
                                     if (res.data.success) {
                                         this.tasks = res.data.data;
+                                        this.invLots = res.data.inv;
                                         this.$forceUpdate();
                                         setTimeout(function () {
                                             document.getElementById("task_0").checked=true;
@@ -195,9 +223,11 @@
                                         }, 100);
                                         return;
                                     }
+                                    this.tasks=[];
                                     window.tempTip.setDuration(3000);
                                     window.tempTip.show(res.data.data);
                                 }).catch(err => {
+                                this.tasks=[];
                                 window.tempTip.setDuration(3000);
                                 window.tempTip.show("网络错误:" + err);
                             })
@@ -222,6 +252,7 @@
                                         this.info={};
                                         this.checkData=[];
                                         this.tasks=[];
+                                        this.invLots=[];
                                         this.$forceUpdate()
                                         document.getElementById("trackNumber").focus();
                                         return;
@@ -249,7 +280,7 @@
                         },
                         verifyInfoAndCheckData(){
                             let error = {};
-                            if (!this.info.trackNumber) error.trackNumber = ["容器号必填"];
+                            // if (!this.info.trackNumber) error.trackNumber = ["容器号必填"];
                             if (!this.info.barCode) error.barCode = ["条码必填"];
                             if (!this.info.amount) error.amount = ["上架数量必填"];
                             if (Number(this.info.paTotal)!==0 && Number(this.info.amount)>Number(this.info.paTotal)) error.amount = ["上架数量不能超过上架总数必填"];

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

@@ -6,6 +6,7 @@ namespace Tests\Services\LogisticAliJiSuApiService;
 use App\OrderPackage;
 use App\Services\LogisticYDService;
 use App\Services\LogisticYTOService;
+use Doctrine\DBAL\Exception;
 use Illuminate\Support\Facades\Http;
 use Tests\TestCase;
 
@@ -28,7 +29,8 @@ class QueryTest extends TestCase
      */
     public function prod_test()
     {
-//       $response = $this->service->query('4280174475389');
+//       $response = $this->service->query('KYE700000006097');
+//       dd($response);
 //       if ($response->status==0){
 //           $this->assertNotEmpty($response->result);
 //           $this->assertEquals($response->result->number,'4280174475389');