Przeglądaj źródła

库存盘点的绝对值错误和样式修改

LD 5 lat temu
rodzic
commit
ad4a833de9

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

@@ -9,6 +9,7 @@ use App\City;
 use App\Events\CancelOrder;
 use App\Logistic;
 use App\OracleActAllocationDetails;
+use App\OracleBasSKU;
 use App\OracleDOCOrderHeader;
 use App\OracleDocOrderPackingSummary;
 use App\OracleDOCWaveDetails;
@@ -88,8 +89,9 @@ class TestController extends Controller
     function t2(Request $request)
     { //x        $packagesBatch=Package::where('batch_number',$batch_number)->first();
 
-        $user = User::get();
-        dd($user[1011]['name']??'x');
+
+        $hasSku = OracleBasSKU::query()->where('sku', "2140100024")->where('customerid', "ONKYO")->first();
+        dd($hasSku);
 
     }
 

+ 8 - 4
app/Imports/InventoryCompareImport.php

@@ -3,6 +3,7 @@
 namespace App\Imports;
 
 use App\Commodity;
+use App\CommodityBarcode;
 use App\OracleBasSKU;
 use App\Owner;
 use App\Services\InventoryCompareService;
@@ -76,14 +77,17 @@ class InventoryCompareImport implements ToCollection, WithHeadingRow, WithMultip
                     $sum++;
                     continue;
                 }
-                $hasSku=Commodity::where('owner_id',$this->owner_id)->where('sku',$row[$skuName])->first();
-                if(!$hasSku) {
+                $commodityInWMS=Commodity::where('owner_id',$this->owner_id)->where('sku',$row[$skuName])->first();
+                if(!$commodityInWMS) {
                     $owner=Owner::find($this->owner_id);
-                    $hasSku = OracleBasSKU::query()->where('sku', $row[$skuName])->where('customerid', $owner->code)->first();
+                    $commodityInWMS = OracleBasSKU::query()->where('sku', "$row[$skuName]")->where('customerid', "$owner->code")->first();
+                    $commodity=Commodity::query()->firstOrCreate(['owner_id'=>$this->owner_id,'sku'=>$row[$skuName],'name'=>$commodityInWMS['descr_c'],'length'=>$commodityInWMS['skulength'],'width'=>$commodityInWMS['skuwidth'],'height'=>$commodityInWMS['skuhigh'],'volumn'=>$commodityInWMS['skulength']*$commodityInWMS['skuwidth']*$commodityInWMS['skuhigh']]);
+                    $commodity->newBarcode($commodityInWMS['alternate_sku1']);
                 }
-                if (!$hasSku){
+                if (!$commodityInWMS){
                     array_push($exception, ['该货主下不存在产品编号:'.$row[$skuName]]);
                     $sum++;
+                    continue;
                 }
 
                 /** @var InventoryCompareService $service */

+ 1 - 1
app/InventoryAccount.php

@@ -37,7 +37,7 @@ class InventoryAccount extends Model
         return $this['total'] ? $this['total']-$re_checked_amount:null;
     }
     public function getDifferenceAmount(){
-        return $this->inventoryMissions()->where('inventory_account_id',$this['id'])->where('difference_amount','>',0)->count();
+        return $this->inventoryMissions()->where('inventory_account_id',$this['id'])->where('difference_amount','!=',0)->count();
     }
     //复盘归位
     public function getReturnedAmount(){

+ 2 - 2
app/Services/InventoryAccountService.php

@@ -194,11 +194,11 @@ class InventoryAccountService
         $inventory=InventoryAccount::find($inventoryAccountId);
         if ($inventory->surplus!=0){
             $inventoryAccountMission->verified_amount=$count;
-            $inventoryAccountMission->difference_amount=abs($inventoryAccountMission->stored_amount-$count);
+            $inventoryAccountMission->difference_amount=$count-$inventoryAccountMission->stored_amount;
             $inventoryAccountMission->checked='是';
         }else{
             $inventoryAccountMission->re_checked_amount=$count;
-            $inventoryAccountMission->difference_amount=abs($inventoryAccountMission->stored_amount-$count);
+            $inventoryAccountMission->difference_amount=$count-$inventoryAccountMission->stored_amount;
             if ($inventoryAccountMission->difference_amount==0){
                 $inventoryAccountMission->returned='是';
             }else{

Plik diff jest za duży
+ 0 - 61994
public/js/app.js


+ 36 - 32
resources/views/inventory/stockInventory/inventoryMission.blade.php

@@ -16,7 +16,7 @@
                     <span v-if="listMode">切换为盘点</span>
                 </button>
             </span>
-        <span class="form-group  mb-5">
+            <span class="form-group  mb-5">
             <label class="text-muted">货主:</label><span class="font-weight-bold">@{{ inventory.owner.name }}</span>
         </span>
             <span class="form-group  p-2 mb-5" class="text-muted">
@@ -56,29 +56,35 @@
         <form id="form"  class="mt-3 form-inline " v-if="!listMode" :class="inventory.surplus!=0?'row-cols-3':'row-cols-5'">
         <span class="form-group">
             <label for="location" class="text-secondary font-weight-bold">请输库位</label>
-            <input id="inventoryInput" name="location" type="text" class="form-control  input"  autocomplete="off" value="@if(old('location')){{old('location')}}@endif">
+            <input id="inventoryInput" @keypress="inputSwitch($event)"
+                   name="location" type="text" class="form-control  input"  autocomplete="off" value="@if(old('location')){{old('location')}}@endif">
         </span>
-                <span class="form-group ml-4">
+            <span class="form-group ml-4">
             <label for="barcode" class="text-secondary font-weight-bold">请输产品条码</label>
-            <input id="barcode" name="barcode" type="text" value="@if(old('barcode')){{old('barcode')}}@endif" class="form-control  input" autocomplete="off" @blur="searchBarcode">
+            <input id="barcode" name="barcode"  @keypress="inputSwitch($event)"
+                   type="text" value="@if(old('barcode')){{old('barcode')}}@endif" class="form-control  input" autocomplete="off" @blur="searchBarcode">
         </span>
-                <span class="form-group ml-4">
+            <span class="form-group ml-4">
             <label for="count" class="text-secondary font-weight-bold">请输盘点数</label>
-            <input type="text" id="count" name="count" class="form-control input" value="@if(old('count')){{old('count')}}@endif"  autocomplete="off">
+            <input type="text" id="count"  @keypress="inputSwitch($event)"
+                   name="count" class="form-control input" value="@if(old('count')){{old('count')}}@endif"  autocomplete="off">
         </span>
 
-                <span v-if="inventory.surplus==0">
+            <span v-if="inventory.surplus==0">
             <label for="count" class="text-secondary font-weight-bold">上一次盘点数</label>
             <span v-if="!inventoryMissionRecord.re_checked_amount">
-                <input type="text" id="count" name="count" v-model="inventoryMissionRecord.verified_amount" class="form-control  input" readonly>
+                <input type="text" id="count"  @keypress="inputSwitch($event)"
+                       name="count" v-model="inventoryMissionRecord.verified_amount" class="form-control  input" readonly>
             </span>
             <span v-if="inventoryMissionRecord.re_checked_amount">
-                <input type="text" id="count" name="count" v-model="inventoryMissionRecord.re_checked_amount" class="form-control  input" readonly>
+                <input type="text" id="count"  @keypress="inputSwitch($event)"
+                       name="count" v-model="inventoryMissionRecord.re_checked_amount" class="form-control  input" readonly>
             </span>
         </span>
-                <span v-if="inventory.surplus==0">
+            <span v-if="inventory.surplus==0">
             <label for="count" class="text-secondary font-weight-bold">盘点差异数</label>
-            <input type="text" id="count" name="count" v-model="inventoryMissionRecord.difference_amount" class="form-control  input" readonly>
+            <input type="text" id="count"  @keypress="inputSwitch($event)"
+                   name="count" v-model="inventoryMissionRecord.difference_amount" class="form-control  input" readonly>
         </span>
         </form>
 
@@ -176,6 +182,25 @@
                 })();
             },
             methods:{
+                inputSwitch(e){
+                    if(e.key==='Enter') {
+                        let inputs = $("#form .input");
+                        let idx = inputs.index($(e.target));     // 获取当前焦点输入框所处的位置
+                        let location=document.getElementById('inventoryInput').value;
+                        if (idx == 2) {       // 判断是否是最后一个输入框
+                            if (location==''||location==undefined||location==null){
+                                document.getElementById('inventoryInput').focus();
+                                return;
+                            }
+                            listVue.submitStockInventory();
+                            $("#form .input").val(' ');
+                            document.getElementById('inventoryInput').focus();
+                        } else {
+                            inputs[idx + 1].focus(); // 设置焦点
+                            inputs[idx + 1].select(); // 选中文字
+                        }
+                    }
+                },
                 selectedColor(id){
                     if (id==this.selectedStyle){
                         this.selectedStyle='';
@@ -253,27 +278,6 @@
                 },
             }
         });
-        $("#form").on("keydown","input",function(){
-            let _this=this;
-            let e = event || window.event;
-            if(e && e.keyCode==13) {
-                let inputs = $("#form .input");
-                let idx = inputs.index(this);     // 获取当前焦点输入框所处的位置
-                let location=document.getElementById('inventoryInput').value;
-                if (idx == 2) {       // 判断是否是最后一个输入框
-                    if (location==''||location==undefined||location==null){
-                        document.getElementById('inventoryInput').focus();
-                        return;
-                    }
-                    listVue.submitStockInventory();
-                    $("#form .input").val(' ');
-                    document.getElementById('inventoryInput').focus();
-                } else {
-                    inputs[idx + 1].focus(); // 设置焦点
-                    inputs[idx + 1].select(); // 选中文字
-                }
-            }
-        });
     </script>
 @endsection
 

+ 1 - 1
resources/views/inventory/stockInventory/mission.blade.php

@@ -53,7 +53,7 @@
                 </td>
                 <td>
                     <span class="btn  btn-sm btn-outline-info" @click="enterStockInventory(inventory.id)">进入</span>
-                    <button class="btn btn-sm btn-outline-dark" href="{{url('inventory/stockInventory/enterStockInventory')}}/'+id?listMode=true;">查看</button>
+                    <a :href="'{{url('inventory/stockInventory/enterStockInventory')}}/'+inventory.id+'?listMode=true'"><button class="btn btn-sm btn-outline-dark">查看</button></a>
                 </td>
                 <td >@{{ i+1 }}</td>
                 <td >@{{ inventory.id }}</td>

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików