Ver código fonte

Merge branch 'master' into zengjun

# Conflicts:
#	app/Order.php
#	app/RejectedBill.php
#	app/Services/WaveService.php
#	resources/views/order/issue/import.blade.php
ajun 5 anos atrás
pai
commit
76df6862a5

+ 4 - 3
app/Commodity.php

@@ -20,13 +20,14 @@ class Commodity extends Model
         return $this->belongsTo('App\Owner','owner_id','id');
     }
     public function getBarcodeAttribute(){
-        return $this->barcodes()->first()['code'];
+//        return $this->barcodes()->first()['code'];
+        return $this->barcodes[0]['code']??'';
     }
     public function getOwnerNameAttribute(){
-        return $this->owner()->first()['name'];
+        return $this->owner['name']??'';
     }
     public function getOwnerCodeAttribute(){
-        return $this['owner'] ? $this['owner']['code'] : null;
+        return $this->owner['code']??'';
     }
 
     static function newCommodityBy_BarcodeOwnerIdNameSku($barcode,$ownerId,$name,$sku){

+ 2 - 2
app/Http/Controllers/InventoryController.php

@@ -94,7 +94,7 @@ class InventoryController extends Controller
     }
     //动库报表
     public function changeInventory(Request $request){
-        if(!Gate::allows("库存管理-动库报表")){ return redirect(url('/'));  }
+        if(!Gate::allows("库存管理-库存")){ return redirect(url('/'));  }
         $page=$request->input('page')??1;
         $paginate=$request->input('paginate')??50;
         $oracleActTransactingLogs=$this->conditionQuery($request,$page,$paginate);
@@ -113,7 +113,7 @@ class InventoryController extends Controller
         return view('inventory.statement.allInventory',compact('oracleActTransactingLogs','page','owners'));
     }
     public function exportData(Request $request){
-        if(!Gate::allows("库存管理-动库报表")){ return redirect(url('/'));  }
+        if(!Gate::allows("库存管理-库存")){ return redirect(url('/'));  }
         if (!$request->checkAllSign){
             $oracleActTransactingLogs=json_decode($request->input('data'),true);
             return $this->export($oracleActTransactingLogs);

+ 9 - 4
app/Http/Controllers/OrderController.php

@@ -11,6 +11,7 @@ use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Http;
 use Maatwebsite\Excel\Facades\Excel;
 
 class OrderController extends Controller
@@ -177,6 +178,10 @@ class OrderController extends Controller
         $orders=DB::connection('oracle')->select(DB::raw($sql));
         $commodities=[];
         $picktotraceids=[];
+        /*
+         * 第二种扁平化方式(节省空间): 使用快慢指针,因拿到数据正常为顺序数据,自下标1开始与上一条对比orderno唯一标识,不同则更新慢指针下标,
+         *  相同则为指定下标map类型数组追加一个键值对属性来记录同类数量,如N条,每次追加属性时先看属性是否存在,存在+1
+         * */
         foreach ($orders as $index=>$order){
             if ($order->picktotraceid){
                 if (array_key_exists($order->orderno,$picktotraceids)){
@@ -200,7 +205,7 @@ class OrderController extends Controller
         $orders = new Collection($orders);
         $commodities=new Collection($commodities);
         if ($checkData || $export)return $this->export($orders,$commodities);
-        $customers=OracleBasCustomer::select('customerid','descr_c')->where('customer_type','OW')->where('active_flag','Y')->get();
+        $customers=OracleBasCustomer::query()->select('customerid','descr_c')->where('customer_type','OW')->where('active_flag','Y')->get();
         $request=$request->input();
         $codes=DB::connection('oracle')->table('BAS_CODES')->select('code','codename_c')->where('codeid','SO_STS')->orderBy('code','asc')->get();
         return view('order/index/delivering',compact('orders','customers','request','codes','commodities','page','picktotraceids'));
@@ -210,15 +215,15 @@ class OrderController extends Controller
         if(!Gate::allows('订单管理-批量备注')){ return redirect(url('/'));  }
         $checkData=$request->input('checkData');
         $content=$request->input('content');
-        $ordersNotNull=OracleDOCOrderHeader::select('OrderNo','Notes')->whereIn('orderno',$checkData)
+        $ordersNotNull=OracleDOCOrderHeader::query()->select('OrderNo','Notes')->whereIn('orderno',$checkData)
             ->whereNotNull('notes')->get();
-        OracleDOCOrderHeader::select('OrderNo','Notes')->whereIn('orderno',$checkData)
+        OracleDOCOrderHeader::query()->select('OrderNo','Notes')->whereIn('orderno',$checkData)
             ->whereNull('notes')->update(['notes'=>$content]);
         $ordersNotNullArr=array_column($ordersNotNull->toArray(),'orderno');
         $ordersNullArr=array_diff($checkData,$ordersNotNullArr);
         $data=[];
         foreach ($ordersNotNull as $order){
-            OracleDOCOrderHeader::where('orderno',$order->orderno)->update(["notes"=>($order->notes).",".$content]);
+            OracleDOCOrderHeader::query()->where('orderno',$order->orderno)->update(["notes"=>($order->notes).",".$content]);
             $this->log(__METHOD__,'批量备注追加修改'.__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
             $order->notes=($order->notes).",".$content;
             array_push($data,$order);

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

@@ -988,7 +988,7 @@ class ProcessController extends Controller
                     }
                     if (!$commodity[$index])array_push($errors[$head],"货主为空");
                 }
-                if ($row == '单据'){
+                if ($row == '单据'){
                     $wmsCode = $commodity[$index] ?? '';
                 }
                 if ($row == 'SKU'){
@@ -1015,7 +1015,7 @@ class ProcessController extends Controller
                 if (!$str) throw new \Exception('未找到货主!');
                 $owner=Owner::query()->where('code',$str)->orWhere('name',$str)->first();
                 if (!$owner){
-                    $owner = Owner::create([
+                    $owner = Owner::query()->create([
                         'code' => $str,
                         'name' => $str
                     ]);
@@ -1025,8 +1025,8 @@ class ProcessController extends Controller
             $commodity = Commodity::query()->with('barcodes')->whereNull('owner_id')
                 ->where('sku',$commodityData['sku'])->first();
             if (!$commodity){
-                $commodity = Commodity::create($commodityData);
-                $commodityBarCode=CommodityBarcode::create([
+                $commodity = Commodity::query()->create($commodityData);
+                $commodityBarCode=CommodityBarcode::query()->create([
                     'code' => $barcode,
                     'commodity_id' => $commodity->id
                 ]);
@@ -1036,7 +1036,7 @@ class ProcessController extends Controller
                 json_encode($commodity)." || ".json_encode($commodity_barcodes),Auth::user()['id']);
             $processContent=['bill_type'=>'入库单','commodity_id'=>$commodity->id,'wms_code'=>$wmsCode,'amount'=>$amount,
                 'commodity_name'=>$commodity->name,'commodity_barcodes'=>$commodity_barcodes,'commodity_sku'=>$commodity->sku,
-                'lineNo'=>1,'owner_id'=>$owner->id,'owner_name'=>$owner->name,'addBtnShow'=>false,'type'=>false];
+                'lineNo'=>1,'owner_id'=>$owner->id,'owner_name'=>$owner->name,'addBtnShow'=>false,'type'=>$request->type];
             array_push($processContents,$processContent);
         }
         return ['success'=>true,'data'=>$processContents,'errors'=>count($errors)>0?$errors:''];
@@ -1132,7 +1132,7 @@ class ProcessController extends Controller
         $validator=Validator::make($processContent,[
             'commodity_id'=>['required','integer'],
             'bill_type'=>['required'],
-            'amount'=>['required','min:0','max:999999','integer']
+            'amount'=>['required','integer']
         ],[
             'required'=>':attribute 不应为空',
             'min'=>':attribute 不得为0或为负',

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

@@ -88,8 +88,8 @@ class TestController extends Controller
     function t2(Request $request)
     { //x        $packagesBatch=Package::where('batch_number',$batch_number)->first();
 
-        $user = factory(User::class)->create();
-        dd($user);
+        $user = User::get();
+        dd($user[1011]['name']??'x');
 
     }
 

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

@@ -25,7 +25,7 @@ class UserLaborController extends Controller
      */
     public function index()
     {
-        $userLabors=UserLabor::with('userDetail')->paginate(50);
+        $userLabors=UserLabor::with('userDetail')->orderBy('user_id','desc')->paginate(50);
 
         foreach ($userLabors as $userLabor){
             if($userLabor->userDetail){

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

@@ -77,6 +77,7 @@ class WaveController extends Controller
         $waveService = app("WaveService");
         $meg = ['success'=>false];
         $ids = $request->input("ids");
+        /** @var WaveService $waveService */
         $meg = $waveService->cancelPrint($ids);
         if($meg['fail_info']){
             return $meg;

+ 1 - 1
app/OperatorLog.php

@@ -24,6 +24,6 @@ class OperatorLog extends Model
     }
     public function getUserNameAttribute()
     {
-        return $this['user'] ? $this['user']['name'] : null;
+        return $this['user']['name'] ??'';
     }
 }

+ 2 - 2
app/OracleDOCOrderHeader.php

@@ -37,10 +37,10 @@ class OracleDOCOrderHeader extends Model
     }
 
     public function getOracleBASCustomerDescrCAttribute(){
-        return $this['oracleBASCustomer']? $this['oracleBASCustomer']['descr_c']:null;
+        return $this['oracleBASCustomer']['descr_c']??'';
     }
     public function getOracleBASCodeCodenameCAttribute(){
-        return $this['oracleBASCode'] ? $this['oracleBASCode']['codename_c'] : null;
+        return $this['oracleBASCode']['codename_c'] ??'';
     }
     public function hasUn(){
         return $this->hasMany('App\OracleDOCOrderDetail','orderno','orderno');

+ 1 - 1
app/OrderIssue.php

@@ -48,6 +48,6 @@ class OrderIssue extends Model
     }
 
     public function getSecondLogisticNumberAttribute(){
-        return $this['secondOrder'] ? $this['secondOrder']['code'] : null;
+        return $this['secondOrder']['code'] ??'';
     }
 }

+ 10 - 0
app/Providers/AppServiceProvider.php

@@ -40,5 +40,15 @@ class AppServiceProvider extends ServiceProvider
             return preg_match('/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}$)/', $value);
         });
         View::share('pageUuid',Uuid::uuid4());
+
+        \Illuminate\Database\Query\Builder::macro('sql', function () {
+            $bindings = $this->getBindings();
+            $sql = str_replace('?','%s',$this->toSql());
+            return vsprintf($sql, $bindings);
+        });
+
+        \Illuminate\Database\Eloquent\Builder::macro('sql', function(){
+            return ($this->getQuery()->sql());
+        });
     }
 }

+ 74 - 113
app/RejectedBill.php

@@ -12,73 +12,58 @@ use Illuminate\Support\Arr;
 use Illuminate\Support\Facades\Auth;
 use Overtrue\LaravelPinyin\Facades\Pinyin;
 
-/*** @method static find(array|string|null $param)
- */
-
-use App\Traits\ModelTimeFormat;
+/**
+ * @method static find(array|string|null $param)
+ */use App\Traits\ModelTimeFormat;
 
 class RejectedBill extends Model
 {
     use ModelTimeFormat;
     use SoftDeletes;
+    protected $fillable=['id_owner','order_number','sender','mobile_sender',
+        'logistic_number','logistic_number_return','id_logistic_return',
+        'is_loaded','fee_collected','remark','id_operator','is_checked'
+        ,'is_finished','checked_numbers','remark','common_01','common_02'];
 
-    protected $fillable = ['id_owner', 'order_number', 'sender', 'mobile_sender',
-        'logistic_number', 'logistic_number_return', 'id_logistic_return',
-        'is_loaded', 'fee_collected', 'remark', 'id_operator', 'is_checked'
-        , 'is_finished', 'checked_numbers', 'remark', 'common_01', 'common_02'];
-
-    protected $appends = ['owner_name', 'logistic_name', 'created_at_short'
-        , 'is_loaded_str', 'goods_amount', 'is_loaded_null', 'operator_name'];
-
-    function owner()
-    {
-        return $this->hasOne('App\Owner', 'id', 'id_owner');
+    protected $appends = ['owner_name','logistic_name','created_at_short'
+        ,'is_loaded_str','goods_amount','is_loaded_null','operator_name'];
+    function owner(){
+        return $this->hasOne('App\Owner','id','id_owner');
     }
-
-    function logistic()
-    {
-        return $this->hasOne('App\Logistic', 'id', 'id_logistic_return');
+    function logistic(){
+        return $this->hasOne('App\Logistic','id','id_logistic_return');
     }
-
-    function items()
-    {
-        return $this->hasMany('App\RejectedBillItem', 'id_rejected_bill', 'id');
+    function items(){
+        return $this->hasMany('App\RejectedBillItem','id_rejected_bill','id');
     }
-
-    function rejectedBillItems()
-    {
+    function user(){
+        return $this->hasOne('App\User','id','id_operator');
+    }
+    function rejectedBillItems(){
         return $this->items();
     }
-
-    function wmsReflectReceive()
-    {
-        return $this->belongsTo('App\WMSReflectReceive', 'id', 'id_rejected_bill');
+    function wmsReflectReceive(){
+        return $this->belongsTo('App\WMSReflectReceive','id','id_rejected_bill');
     }
-
-    function setIsLoaded_toWaitConfirm()
-    {
-        if (config('api.jianshang_rejecteds_log_switch')) Controller::logS(__METHOD__, __FUNCTION__, "将待推单修改为待确认! 退单号:" . $this['logistic_number_return'], Auth::user()['id']);
-        $bill = RejectedBill::find($this['id']);
-        $bill['is_loaded'] = 4;
+    function setIsLoaded_toWaitConfirm(){
+        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"将待推单修改为待确认! 退单号:".$this['logistic_number_return'],Auth::user()['id']);
+        $bill=RejectedBill::find($this['id']);
+        $bill['is_loaded']=4;
         $bill->save();
     }
-
-    function logisticName()
-    {
-        $logistic = $this->hasOne('App\Logistic', 'id', 'id_logistic_return')->first();
-        return $logistic ? $logistic['name'] : '';
+    function logisticName(){
+        $logistic=$this->hasOne('App\Logistic','id','id_logistic_return')->first();
+        return $logistic?$logistic['name']:'';
     }
-
-    function makeCheckedNumbers()
-    {
+    function makeCheckedNumbers(){
         $owner = $this->owner()->first();
-        if (!$owner) return '';
-        $pinyinOwnerName = Pinyin::convert($owner->name);
-        $pinyinArr = array_map(function ($pinyin) {
+        if(!$owner)return '';
+        $pinyinOwnerName=Pinyin::convert($owner->name);
+        $pinyinArr=array_map(function($pinyin){
             return $pinyin[0];
-        }, $pinyinOwnerName);
-        $initials = implode("", $pinyinArr);
-        $this['checked_numbers'] = $initials . Carbon::now()->format('Ymd') . $owner->getIncreasedCheckingCount();
+        },$pinyinOwnerName);
+        $initials=implode("", $pinyinArr);
+        $this['checked_numbers']=$initials.Carbon::now()->format('Ymd').$owner->getIncreasedCheckingCount();
         return $this['checked_numbers'];
     }
 
@@ -89,92 +74,67 @@ class RejectedBill extends Model
 
     function update(array $attributes = [], array $options = [])
     {
-        (new LogisticNumberFeatureController())->createFeatures($this['logistic_number_return'], $this['id_logistic_return']);
+        (new LogisticNumberFeatureController())->createFeatures($this['logistic_number_return'],$this['id_logistic_return']);
         return parent::update($attributes, $options);
     }
-
     function save(array $options = [])
     {
-        (new LogisticNumberFeatureController())->createFeatures($this['logistic_number_return'], $this['id_logistic_return']);
+        (new LogisticNumberFeatureController())->createFeatures($this['logistic_number_return'],$this['id_logistic_return']);
         return parent::save($options);
     }
 
 
-    public function getOwnerNameAttribute()
-    {
-        $id_owner = $this['id_owner'] ?? 0;
-        $owner = Owner::find($id_owner);
-        return $this['owner_name'] = $owner['name'];
+    public function getOwnerNameAttribute(){
+        $id_owner=$this['id_owner']??0;
+        $owner=Owner::find($id_owner);
+        return $this['owner_name']=$owner['name'];
     }
-
-    public function getLogisticNameAttribute()
-    {
-        $id_logistic = $this['id_logistic_return'] ?? 0;
-        $logistic = Logistic::find($id_logistic);
-        return $this['logistic_name'] = $logistic['name'];
+    public function getLogisticNameAttribute(){
+        $id_logistic=$this['id_logistic_return']??0;
+        $logistic=Logistic::find($id_logistic);
+        return $this['logistic_name']=$logistic['name'];
     }
-
-    public function getIsLoadedStrAttribute()
-    {
-        $val = $this['is_loaded'] === null ? 'null' : $this['is_loaded'];
-        $val = $val === 0 ? '0' : $val;
-        switch ($val) {
-            case 'null':
-                return '无需入库';
-            case '0':
-                return '否';
-            case 1:
-                return '是';
-            case 2:
-                return '待推单';
-            case 3:
-                return '上传异常';
+    public function getIsLoadedStrAttribute(){
+        $val=$this['is_loaded']===null?'null':$this['is_loaded'];
+        $val=$val===0?'0':$val;
+        switch ($val){
+            case 'null':return '无需入库';
+            case '0':return '否';
+            case 1:return '是';
+            case 2:return '待推单';
+            case 3:return '上传异常';
         }
         return '';
     }
-
-    public function getCreatedAtShortAttribute()
-    {
-        return $this['created_at'] ? $this['created_at_short'] = $this['created_at']->format('m-d H:i:s') : '';
+    public function getCreatedAtShortAttribute(){
+        return $this['created_at']?$this['created_at_short']=$this['created_at']->format('m-d H:i:s'):'';
     }
-
-    public function getGoodsAmountAttribute()
-    {
-        $amount = 0;
-        $this->items()->get()->each(function (RejectedBillItem $item) use (&$amount) {
-            $amount += $item['amount'];
+    public function getGoodsAmountAttribute(){
+        $amount=0;
+        $this->items()->get()->each(function (RejectedBillItem $item)use(&$amount){
+            $amount+=$item['amount'];
         });
         return $amount;
     }
-
-    public function getOperatorNameAttribute()
-    {
-        if (!$this['id_operator']) {
-            return '';
-        }
-        $user = User::find($this['id_operator']);
-        return $user['name'];
+    public function getOperatorNameAttribute(){
+        return $this['user'] ? $this['user']['name'] : null;
     }
-
-    public function getIsLoadedNullAttribute()
-    {
-        if ($this['is_loaded'] === null) return 'null';
+    public function getIsLoadedNullAttribute(){
+        if($this['is_loaded']===null) return 'null';
         return $this['is_loaded'];
     }
-
-    public function changeIsLoaded_ifItemsAllLoaded()
-    {
-        $allItemsAreLoaded = true;
-        $this->items->each(function (RejectedBillItem $item) use (&$allItemsAreLoaded) {
-            if ($item['is_loaded'] == '未入库') {
-                $allItemsAreLoaded = false;
+    public function changeIsLoaded_ifItemsAllLoaded(){
+        $allItemsAreLoaded=true;
+        $this->items->each(function (RejectedBillItem $item)use(&$allItemsAreLoaded){
+            if($item['is_loaded']=='未入库'){
+                $allItemsAreLoaded=false;
                 return false;
             }
         });
-        if ($allItemsAreLoaded) {
-            $this['is_loaded'] = 1;
-        } else {
-            $this['is_loaded'] = 0;
+        if($allItemsAreLoaded){
+            $this['is_loaded']=1;
+        }else{
+            $this['is_loaded']=0;
         }
         $this->update();
         return $this['is_loaded'];
@@ -227,6 +187,7 @@ class RejectedBill extends Model
                 return;
             }
         }
+
         $rejectedExcess = 0;    // 退回差异
         $rejectedReview = 0;    // 退回复核  $rejectedItems == $orderItems
         foreach ($rejectedItems as $key => $items) {

+ 4 - 2
app/RejectedBillItem.php

@@ -23,6 +23,9 @@ class RejectedBillItem extends Model
     public function rejectedBill(){
         return $this->belongsTo('App\RejectedBill', 'id_rejected_bill', 'id');
     }
+    public function quality(){
+        return $this->belongsTo(QualityLabel::class, 'id_quality_label', 'id');
+    }
     public function wmsReflectSku(){
         $bill=$this->rejectedBill()->first();
         $wmsReflectReceive=$bill->wmsReflectReceive()->first();
@@ -58,7 +61,6 @@ class RejectedBillItem extends Model
         }
     }
     public function getQualityLabelAttribute(){
-        $label=QualityLabel::find($this['id_quality_label']);
-        return $label['name'];
+        return $this['quality']['name'];
     }
 }

+ 18 - 22
app/Services/WaveService.php

@@ -49,8 +49,6 @@ class WaveService
         $sql .= " left join BAS_CODES codes on wave_header.WaveStatus = codes.CODE and codes.codeId = 'SO_STS'";
         return $sql;
     }
-
-    // cancel Print
     public function cancelPrint($ids)
     {
         $meg = ['success' => false, 'fail_info' => null];
@@ -96,7 +94,7 @@ class WaveService
             $childSql .= " and addTime < '" . $end_time . " 23:59:59'";
         }
         if ($wave_num) {
-            $childSql .= " and waveNo like '" . trim($wave_num) . "'";
+            $childSql .= " and waveNo like '" .trim($wave_num). "'";
         }
         if ($wave_status) {
             $childSql .= " and waveStatus = " . $wave_status;
@@ -135,17 +133,17 @@ class WaveService
         if ($request->input('wave_num')) {
             $wave_num = $request->input('wave_num');
             $wave_num = $this->getWaveNoString($wave_num);
-            if (strpos($wave_num, ',')) {
-                $childSql .= " and WaveNo in (" . $wave_num . ") ";
-            } else {
-                $childSql .= " and WaveNo like '" . $wave_num . "' ";
+            if(strpos($wave_num,',')){
+                $childSql .= " and WaveNo in (" .$wave_num . ") ";
+            }else{
+                $childSql .= " and WaveNo like '" .$wave_num . "' ";
             }
         }
         if ($request->input('wave_status')) {
             $childSql .= " and WaveStatus =  '" . $request->input('wave_status') . "' ";
         }
-        $childSql .= ' order by addTime';
-        $childSql = $childSql . ") wave_header ";
+        $childSql.=' order by addTime';
+        $childSql =  $childSql . ") wave_header ";
         $sql = ' select wave_header.WaveNo,' .
             'wave_header.WaveStatus,' .
             'codes.CODENAME_C,' .
@@ -157,7 +155,7 @@ class WaveService
             'wave_header.UserDefine1,' .
             'wave_header.UserDefine2,' .
             'wave_header.WaveDispatchID,' .
-            'wave_header.UdfPrintFlag2 from ';
+            'wave_header.UdfPrintFlag2 from ' ;
         $sql .= $childSql;
         $sql .= " left join BAS_CUSTOMER  customer on  customer.CustomerID  = wave_header.CarrierID and customer.CUSTOMER_TYPE = 'CA'";
         $sql .= " left join BAS_CODES codes on wave_header.WaveStatus = codes.CODE and codes.codeId = 'SO_STS'";
@@ -182,28 +180,26 @@ class WaveService
         ]];
         return $arr;
     }
-
-    public function getWaveNoString($wave_num)
-    {
+    public function getWaveNoString($wave_num){
         $sqlString = '';
-        if (!$wave_num) {
+        if(!$wave_num){
             return $sqlString;
         }
-        if (strpos($wave_num, "%")) {
+        if(strpos($wave_num,"%")){
             return $wave_num;
         }
-        if (strpos($wave_num, ",")) {
+        if(strpos($wave_num,",") ){
 
-            $arr = explode(',', $wave_num);
+            $arr = explode(',',$wave_num);
             $let = count($arr);
-            for ($i = 0; $i < $let; $i++) {
-                $arr[$i] = "'" . $arr[$i] . "'";
+            for($i=0;$i<$let;$i++){
+                $arr[$i] = "'".$arr[$i]."'";
             }
-            $sqlString = implode(",", $arr);
+            $sqlString = implode(",",$arr);
             return $sqlString;
         }
-        if ($wave_num) {
-            $sqlString = "'" . $wave_num . "'";
+        if($wave_num){
+            $sqlString = "'".$wave_num."'";
         }
         return $sqlString;
     }

+ 20 - 0
app/Services/WaybillService.php

@@ -46,6 +46,26 @@ Class WaybillService
         return $waybills->get();
     }
 
+    public function getSql(Request $request){
+        $waybills = $this->conditionQuery($request);
+        return $waybills->leftJoin('owners','owners.id','=','waybills.owner_id')->selectRaw('owners.name owner_name')
+            ->leftJoin('units as warehouse_weight_unit','warehouse_weight_unit.id','=','waybills.warehouse_weight_unit_id')
+                ->selectRaw('warehouse_weight_unit.name warehouse_weight_unit_name')
+            ->leftJoin('units as warehouse_weight_unit_other','warehouse_weight_unit_other.id','=','waybills.warehouse_weight_unit_id_other')
+                ->selectRaw('warehouse_weight_unit_other.name warehouse_weight_unit_other_name')
+            ->leftJoin('units as carrier_weight_unit','carrier_weight_unit.id','=','waybills.carrier_weight_unit_id')
+                ->selectRaw('carrier_weight_unit.name carrier_weight_unit_name')
+            ->leftJoin('units as carrier_weight_unit_other','carrier_weight_unit_other.id','=','waybills.carrier_weight_unit_id_other')
+                ->selectRaw('carrier_weight_unit_other.name carrier_weight_unit_other_name')
+            ->leftJoin('car_types','car_types.id','=','waybills.carType_id')
+                ->selectRaw('car_types.name car_type_name')
+            ->leftJoin('units as amount_unit','amount_unit.id','=','waybills.amount_unit_id')
+                ->selectRaw('amount_unit.name amount_unit_name')
+            ->leftJoin('carriers','carriers.id','=','waybills.carrier_id')
+                ->selectRaw('carriers.name carrier_name')
+            ->sql();
+    }
+
     public function some(Request $request){
         return $waybills = Waybill::filterAuthorities()->with(['owner'])->selectRaw('waybills.* ,waybill_on_tops.id top_id ,waybill_on_tops.remark,waybill_on_tops.updated_at top_update')
             ->leftJoin('waybill_on_tops','waybill_on_tops.waybill_id','=','waybills.id')

+ 10 - 0
app/Validators/UserDutyCheckValidator.php

@@ -0,0 +1,10 @@
+<?php
+
+
+namespace App\Validators;
+
+
+class UserDutyCheckValidator
+{
+
+}

+ 32 - 0
database/migrations/2020_08_25_094642_change_rejected_bills_add_id_operator_index.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeRejectedBillsAddIdOperatorIndex extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('rejected_bills', function (Blueprint $table) {
+            $table->bigInteger('id_operator')->index("rejected_bills_id_operator_index")->change();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('rejected_bills', function (Blueprint $table) {
+            $table->dropIndex('rejected_bills_id_operator_index');
+        });
+    }
+}

+ 6 - 3
resources/views/personnel/laborReport/index.blade.php

@@ -117,7 +117,7 @@
                             {{--                                    <span class="mr-3 text-nowrap"><span class="text-black">进场编号:</span><span style="color:#af7651">@{{ laborReport.enter_number }}</span></span>--}}
                             <span class="mr-3  text-nowrap"><span class="text-black">小组:</span><span class="text-black-50">@{{laborReport.userWorkGroupName  }}</span></span>
                             <span class="mr-3   text-nowrap"><span class="text-black">临时工:</span><span class="text-black-50">@{{ laborReport.name }} </span></span>
-                            {{--                                    <span class="mr-3 text-nowrap"><span class="text-black">电话:</span><span style="color:#af7651" v-if="">@{{ laborReport.mobile_phone }} </span></span>--}}
+                                                                <span class="mr-3 text-nowrap"><span class="text-black">电话:</span><span style="color:#af7651" v-if="">@{{ laborReport.mobile_phone }} </span></span>
                                                                 <span class="text-nowrap"><span class="text-black">身份证号:</span><span style="color:#af7651" v-if="">@{{ laborReport.identity_number }} </span></span>
                             {{--                                    <span class="mr-3 text-nowrap"><span class="text-black">劳务所:</span><span style="color:#af7651" v-if="">@{{ laborReport.labor_company }} </span></span>--}}
                             {{--                                    <span class="mr-3 text-nowrap"><span class="text-black">进组时间:</span><span style="color:#af7651" v-if="">@{{ laborReport.checkInAt }} </span></span>--}}
@@ -230,15 +230,18 @@
         setInterval(reloadOnTomorrow,1000*60*60)
     </script>
     <script>
-        window.onresize=function (){
+        let hideHeaderTitle = function (){
             let $listOnPad = $('#listOnPad');
             let $headerRoll = $('#headerRoll');
             if($listOnPad.css('display')!=='none'){
                 $headerRoll.attr('hidden',true)
             }else{
                 $headerRoll.attr('hidden',false)
+                $headerRoll.find('tr').css('width',$(document).width());
             }
-        }
+        };
+        window.onresize= hideHeaderTitle;
+        window.onscroll=hideHeaderTitle;
         @if(isset($request))
         let request={!! json_encode($request) !!};
         @endif

+ 25 - 7
resources/views/process/create.blade.php

@@ -30,8 +30,8 @@
                                         :data-content="popoverContent" data-html="true">
                                     部分数据导入失败
                                 </button>
-                                <textarea class="w-100" style="height: 400px;" v-model="pasteData"
-                                placeholder="内容必须为EXCEL复制,请注意表头顺序,可拖拽表头字段调整顺序,以该顺序为准"
+                                <textarea class="w-100" style="height: 400px;" id="pasteDataText" v-model="pasteData" @keydown.tab="forbidTab($event)" @keyup.tab="replaceSpacing()"
+                                placeholder="内容可为EXCEL复制,也可手动输入使用“TAB”缩进符区分列,请注意表头顺序,可拖拽表头字段调整顺序,以该顺序为准"
                                 ></textarea>
                             </div>
                             <div class="modal-footer">
@@ -139,8 +139,10 @@
                     <div class="col-6 rounded mb-2 border" style="background: #ccd7dc;">
                         <div class="form-group row mt-2">
                             <label class="col-2 text-right mt-2">成品单据</label>
-                            <input class="form-control col-7" v-model="process.wms_code_full">&nbsp;&nbsp;&nbsp;
+                            <input class="form-control col-6" v-model="process.wms_code_full">&nbsp;&nbsp;&nbsp;
                             <button class="btn btn-info btn-sm col-2"  type="button" @click="addProcessContent(true)"> 新增库单据</button>
+                            <button class="btn btn-sm btn-dark col-1 ml-1"
+                                    @click="showPasteDataModal(true)"><small>外部导入</small></button>
                         </div>
                         <div class="form-group row">
                             <div class="col-10 offset-1 pl-0 pt-2 border rounded bg-light">
@@ -325,6 +327,7 @@
                 is_delBtn:[],
                 sum:0,
                 pasteData:'',
+                pasteDataType:false,
                 rows:['货主','单据号','品名','SKU','条码','数量'],
                 popoverContent:'',
                 is_hide:false,
@@ -574,7 +577,6 @@
                         tempTip.show('请确认您信息输入的完整性!');
                         return;
                     }
-                    _this.processContentError=[];
                     let then = function (response) {
                         if (response.data.error && response.data.data=="process"){
                             _this.error=response.data.error;
@@ -582,7 +584,15 @@
                         }
                         _this.error={wms_code:[],owner_id:[],process_method_id:[],unit_price:[],amount:[]};
                         if (response.data.error){
-                            _this.processContentError=response.data.error;
+                            let err="<small class='text-center text-danger'>部分单据内容错误:<br>";
+                            for (let key in response.data.error){
+                                let obj=response.data.error[key];
+                                for (let k in obj) {
+                                    err += key+':'+obj[k][0]+"<br>";
+                                }
+                            }
+                            err += "</small>";
+                            tempTip.confirm(err);
                             return;
                         }
                         if(response.data.success==false){
@@ -689,17 +699,19 @@
                     if (_this.processContents[(_this.processContents.length)-1].addBtnShow)
                         _this.$delete(_this.processContents,(_this.processContents.length)-1);
                 },
-                showPasteDataModal(){
+                showPasteDataModal(type = false){
+                    this.pasteDataType = type;
                     $("#popover").attr('hidden','hidden');
                     $('#pasteData').modal('show');
                 },
+                //外部导入
                 importPasteData(){
                     let _this=this;
                     if (!this.pasteData){
                         tempTip.setDuration(3000);
                         tempTip.show('文本为空!');
                     }
-                    axios.post('{{url('process/importPasteData')}}',{data:this.pasteData,rows:this.rows})
+                    axios.post('{{url('process/importPasteData')}}',{data:this.pasteData,rows:this.rows,type:this.pasteDataType})
                         .then(res=>{
                             if (res.data.success){
                                 let sum=0;
@@ -748,6 +760,12 @@
                         this.$set(this.rows,index,this.rows[e.dataTransfer.getData('text/html')]);
                         this.$set(this.rows,Number(e.dataTransfer.getData('text/html')),temp);
                     }
+                },
+                replaceSpacing(){
+                    this.pasteData += "\t";
+                },
+                forbidTab(e){
+                    e.preventDefault();
                 }
             },
         });