Kaynağa Gözat

攒单助手

yuang 4 yıl önce
ebeveyn
işleme
ad273985e7

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

@@ -6,6 +6,7 @@ use App\Components\AsyncResponse;
 use App\Components\Database;
 use App\Components\ErrorPush;
 use App\DeliveryAppointment;
+use App\Jobs\RejectedPushJob;
 use App\MaterialBox;
 use App\MaterialBoxModel;
 use App\OracleDOCASNHeader;
@@ -54,16 +55,18 @@ class TestController extends Controller
     {
         try {
             return call_user_func([$this, $method], $request);
-        }catch (\BadMethodCallException $e){
+        } catch (\BadMethodCallException $e) {
             dd("方法不存在");
         }
     }
-    public function test(Request $request){
+
+    public function test(Request $request)
+    {
         $users = User::query()->with(["roles.owners"])->get();
-        foreach ($users as $user){
+        foreach ($users as $user) {
             $owners = [];
-            foreach ($user->roles as $role){
-                foreach ($role->owners as $owner){
+            foreach ($user->roles as $role) {
+                foreach ($role->owners as $owner) {
                     $owners[] = $owner->id;
                 }
             }
@@ -74,8 +77,20 @@ class TestController extends Controller
     public function test123()
     {
         $codes = ['OCGBS202202160032'];
-        $items = OracleDOCASNHeader::query()->select('asnNo')->whereIn('ASNReference1',$codes)->get();
+        $items = OracleDOCASNHeader::query()->select('asnNo')->whereIn('ASNReference1', $codes)->get();
         dd($items);
     }
+
+    public function testRejectedPushJob()
+    {
+        $arr = [
+            ['logisticNumberReturn' => '9886316269968', 'asnNo' => 'asn0045', 'type' => '上架'],
+            ['logisticNumberReturn' => '9886316269968', 'asnNo' => 'asn0045', 'type' => '上架'],
+            ['logisticNumberReturn' => '9886316269968', 'asnNo' => 'asn0045', 'type' => '上架'],
+            ['logisticNumberReturn' => '75603658035358', 'asnNo' => 'asn0045', 'type' => '上架'],
+        ];
+
+        RejectedPushJob::dispatch($arr);
+    }
 }
 

+ 8 - 2
app/Jobs/RejectedPushJob.php

@@ -18,9 +18,13 @@ class RejectedPushJob implements ShouldQueue
     public $timeout = 120;
 
     /**
-     * [['推单任务号','退回单号','审核号','asn']]
+     * type: 推单,上架
+     *  [
+     * ['logisticNumberReturn' => '75603675975072', 'asnNo' => 'asn002', 'type' => '推单'],
+     * ['logisticNumberReturn' => '75603675975072', 'asnNo' => 'asn002', 'type' => '推单'],
+     * ]
      */
-    private array $pushData;
+    private $pushData;
 
     /**
      * @param array $pushData
@@ -39,6 +43,8 @@ class RejectedPushJob implements ShouldQueue
     public function handle()
     {
         $url = config('api.java.wms.rejectedPushTask.receivePush');
+        dump($url);
         $response = Http::post($url, $this->pushData);
+        dump($response->body());
     }
 }

+ 1 - 1
config/api.php

@@ -97,7 +97,7 @@ return [
     'java'=>[
         'wms'=>[
             'rejectedPushTask'=>[
-                'receivePush'=>'https://swms.baoshi56.com/api/wms/rejectedPushTask/receivePush'
+                'receivePush'=>env('WMS_REJECTED_PUSH_TASK', '10,1'),
             ]
         ]
     ]

+ 36 - 9
resources/views/rejected/rejectedPushTask/index.blade.php

@@ -86,6 +86,10 @@
                                  @click="stopStoreUp(item.id)" type="button"
                                  class="btn btn-success">停止攒单
                          </button>
+                           <button v-if="item.status != '创建'"
+                                   @click="downExcel(item.id)" type="button"
+                                   class="btn btn-success">导出EXCEL
+                         </button>
                     </span></td>
             </tr>
         </table>
@@ -125,8 +129,12 @@
                                     <td class="td-warm text-muted"><span>@{{ item.checkedNumbers }}</span></td>
                                     <td class="td-warm text-muted"><span>@{{ item.ownerName }}</span></td>
                                     <td class="td-warm text-muted"><span>@{{ item.orderNumber }}</span></td>
-                                    <td class="td-warm text-muted"><span>@{{ item.sender }}</span></td>
-                                    <td class="td-warm text-muted"><span>@{{ item.mobileSender }}</span></td>
+                                    <td class="td-warm text-muted  text-truncate"
+                                        style="max-width: 60px;">
+                                        <span>@{{ item.sender }}</span>
+                                    </td>
+                                    <td class="td-warm text-muted  text-truncate"
+                                        style="max-width: 150px;"><span>@{{ item.mobileSender }}</span></td>
                                     <td class="td-warm text-muted"><span>@{{ item.logisticNumber }}</span></td>
                                     <td class="td-warm text-muted"><span>@{{ item.logisticNumberReturn }}</span></td>
                                     <td class="td-warm text-muted"><span>@{{ item.logisticName }}</span></td>
@@ -178,7 +186,6 @@
                                     <td class="td-warm text-muted"><span>@{{ item.rejectedPushTaskHeaderId }}</span>
                                     </td>
                                     <td class="td-warm text-muted"><span>@{{ item.sku }}</span></td>
-                                    <td class="td-warm text-muted"><span>@{{ item.barcodeGoods }}</span></td>
                                     <td class="td-warm text-muted"><span>@{{ item.nameGoods }}</span></td>
                                     <td class="td-warm text-muted"><span>@{{ item.amount }}</span></td>
                                     <td class="td-warm text-muted"><span>@{{ item.idQualityLabel }}</span></td>
@@ -287,6 +294,7 @@
                 }).init();
 
                 let columnPackage = [
+                    {name: 'id', value: '序号'},
                     {name: 'rejectedPushTaskHeaderId', value: '推单任务号'},
                     {name: 'createdAt', value: '日期'},
                     {name: 'checkedNumbers', value: '审核号'},
@@ -318,9 +326,9 @@
                 }).init();
 
                 let columnCommodity = [
+                    {name: 'id', value: '序号'},
                     {name: 'rejectedPushTaskHeaderId', value: '推单任务号'},
                     {name: 'sku', value: 'SKU'},
-                    {name: 'barcodeGoods', value: '商品条码'},
                     {name: 'nameGoods', value: '商品名称'},
                     {name: 'amount', value: '商品数量'},
                     {name: 'idQualityLabel', value: '质量状态'},
@@ -343,7 +351,6 @@
                     } else if (flag === 'next' && this.resData.packageDetail.current < this.resData.packageDetail.pages) {
                         this.resData.packageDetail.current++;
                     }
-                    console.log(flag);
                     this.showPackageDetail(this.resData.packageDetail.data[0].rejectedPushTaskHeaderId);
                 },
                 commodityPagination(flag) {
@@ -353,7 +360,6 @@
                     } else if (flag === 'next' && this.resData.commodityDetail.current < this.resData.commodityDetail.pages) {
                         this.resData.commodityDetail.current++;
                     }
-                    console.log(flag);
                     this.showCommodityDetail(this.resData.commodityDetail.data[0].rejectedPushTaskHeaderId);
                 },
                 showCommodityDetail(id) {
@@ -419,10 +425,9 @@
                     }
                     axios.post(url, {idList}).then(res => {
                         if (res.data.code !== 200) {
-
                             tempTip.show(res.data.message);
                         } else {
-                            tempTip.showSuccess('批量修改状态成功!');
+                            tempTip.showSuccess('修改状态成功!');
                             this.searchData();
                         }
                     });
@@ -430,7 +435,6 @@
                 getPageResult(url) {
                     tempTip.showSuccess('开始查询,请稍后!');
                     axios.post(url, this.getSearch()).then(res => {
-                        tempTip.showSuccess('查询成功!');
                         if (res.data.code !== 200) {
                             tempTip.show('接口异常!');
                             this.details.data = [];
@@ -439,6 +443,7 @@
                             this.details.pages = 0
                             this.details.size = 50;
                         } else {
+                            tempTip.showSuccess('查询成功!');
                             this.details.data = res.data.data.list;
                             this.details.total = res.data.data.page.total;
                             this.details.current = res.data.data.page.pageNum;
@@ -474,6 +479,28 @@
                     let url = this.getBaseUrl() + `/api/wms/rejectedPushTask/list?size=${this.size}&current=${this.current}`;
                     this.getPageResult(url);
                 },
+
+                downExcel(id) {
+                    let url = this.getBaseUrl();
+                    url += `/api/wms/rejectedPushTask/export/create?rejectedPushTaskId=${id}`;
+                    axios.get(url).then(res => {
+                        if (res.data.code === 200) {
+                            let filename = res.data.data;
+                            let downUrl = this.getBaseUrl() + `/api/wms/rejectedPushTask/export/download?filename=${filename}`;
+                            let link = document.createElement('a');
+                            link.style.display = 'none';
+                            link.href = downUrl;
+                            link.download = `${filename}.xlsx`;
+                            document.body.appendChild(link);
+                            link.click();
+                            document.body.removeChild(link);
+                            tempTip.showSuccess('导出成功!');
+                        } else {
+                            tempTip.setDuration(3000);
+                            tempTip.show(res.data.data);
+                        }
+                    })
+                }
             },
 
         });