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

库存盘点--盘点库位,条码,属性仓等相同进行合并

haozi 5 лет назад
Родитель
Сommit
aa93b8c2f6

+ 9 - 9
app/Services/InventoryAccountService.php

@@ -67,7 +67,7 @@ class InventoryAccountService
         $sql='select * from (select result.*,rownum rn from (';
         $sql.=' select customer.Descr_C as 货主,stockLog.客户 客户, 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码1, sku.ALTERNATE_SKU2 产品条码2, sku.ALTERNATE_SKU3 产品条码3, ';
         $sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, ';
-        $sql.=' lot.LotAtt04 批号, lot.LotAtt01 生产日期, lot.LotAtt03 入库日期';
+        $sql.=' lot.LotAtt04 批号, lot.LotAtt01 生产日期';
         $sql.=' , sum(移出数量)移出数量, sum(移入数量)移入数量 ';
         $sql.=' , storeStatus.QTY 在库数量, storeStatus.QtyAllocated 占用数量,count(1) over () as sum from ';
         $sql.=' (select FMLotNum,FMSKU,TOCustomerID 客户,0 as 移出数量, sum(TOQty_Each) as 移入数量, TOLocation as 库位 ';
@@ -96,7 +96,7 @@ class InventoryAccountService
         $sql.=' left join INV_LOT_LOC_ID storeStatus on storeStatus.LOTNUM=stockLog.FMLOTNUM ';;
         $sql.=' and storeStatus.LocationID=stockLog.库位 ';
         $sql.=' group by 库位,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1,sku.ALTERNATE_SKU2,sku.ALTERNATE_SKU3 ';
-        $sql.=' ,sku.Descr_C,FMLotNum,lot.LotAtt05,lot.LotAtt01,lot.LotAtt03,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
+        $sql.=' ,sku.Descr_C,FMLotNum,lot.LotAtt05,lot.LotAtt01,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
         $sql.=' , storeStatus.QTY, storeStatus.QtyAllocated,stockLog.客户  ';
         $sql.=' )result where 1=1 ';
         if ($descr_c){
@@ -114,22 +114,23 @@ class InventoryAccountService
     //全盘查询
     private function conditionTotalStock($ownerId){
         $descr_c=Owner::where('id',$ownerId)->value('name');
-        $sql='select * from (select result.*,rownum rn from (';
+        $sql='select * from (select result.* from (';
         $sql.=' select customer.Descr_C as 货主,storeStatus.CUSTOMERID 客户,storeStatus.LocationID 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码1, sku.ALTERNATE_SKU2 产品条码2, sku.ALTERNATE_SKU3 产品条码3, ';
-        $sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, storeStatus.ADDTIME 创建时间, ';
-        $sql.=' lot.LotAtt04 批号,lot.LotAtt01 生产日期,lot.LotAtt03 入库日期 ';
-        $sql.=' , storeStatus.QTY 在库数量, storeStatus.QtyAllocated 占用数量,count(1) over () as sum from ';
+        $sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, ';
+        $sql.=' lot.LotAtt04 批号,lot.LotAtt01 生产日期 ';
+        $sql.=' , SUM(storeStatus.QTY) 在库数量, SUM(storeStatus.QtyAllocated) 占用数量 from ';
         $sql.=' INV_LOT_LOC_ID storeStatus';
         $sql.=' left join BAS_Customer customer on customer.CustomerID=storeStatus.CUSTOMERID ';
         $sql.=' left join BAS_SKU sku on sku.SKU=storeStatus.SKU and sku.CUSTOMERID=storeStatus.CUSTOMERID ';
         $sql.=' left join INV_LOT_ATT lot on lot.LOTNUM = storeStatus.LOTNUM AND lot.CUSTOMERID = storeStatus.CUSTOMERID ';
         $sql.=' group by storeStatus.LocationID,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1,sku.ALTERNATE_SKU2,sku.ALTERNATE_SKU3 ';
         $sql.=' ,sku.Descr_C,lot.LotAtt05,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
-        $sql.=' , storeStatus.QTY, storeStatus.QtyAllocated,storeStatus.CUSTOMERID,storeStatus.ADDTIME,lot.LotAtt01,lot.LotAtt03  ';
+        $sql.=' ,storeStatus.CUSTOMERID,lot.LotAtt01 ';
         $sql.=' )result where 1=1 ';
         if ($descr_c)$sql.=" and 货主 = '".$descr_c."' ";
         $sql.=' )  ';
         return DB::connection('oracle')->select($sql);
+
     }
     //创建盘点任务
     public function createMission($date_start,$date_end,$ownerId){
@@ -188,7 +189,6 @@ class InventoryAccountService
         LogService::log(__METHOD__,'foreach -- strat','createInventoryAccountMissionRecord');
         foreach ($wmsInventories as $wmsInventory){
             $commodity=$commoditiesArr[$wmsInventory->商品名称.'|'.$wmsInventory->产品编码]??null;
-//            $commodity=$commodities->where('name',$wmsInventory->商品名称)->where('sku',$wmsInventory->产品编码)->first();
             if (!$commodity){
                 $commodity=new Commodity();
                 $commodity->owner_id=$ownerId;
@@ -239,7 +239,7 @@ class InventoryAccountService
                 'location'=>$wmsInventory->库位,
                 'produced_at'=>$wmsInventory->生产日期,
                 'valid_at'=>$wmsInventory->失效日期,
-                'stored_at'=>$wmsInventory->入库日期,
+//                'stored_at'=>$wmsInventory->入库日期,
                 'batch_number'=>$wmsInventory->批号,
                 'erp_type_position'=>$wmsInventory->属性仓,
                 'quality'=>$quality,

+ 14 - 14
resources/views/inventory/stockInventory/inventoryMission.blade.php

@@ -11,8 +11,6 @@
         <div class="mt-3">
 
             <span class="mt-3" >
-{{--                <a :href="'{{url('inventory/stockInventory/enterStockInventory')}}/'+inventory.id+'?listMode=true'"><button class="btn btn-sm btn-outline-dark" v-if="!listMode">切换为列表</button></a>--}}
-                {{--                <a :href="'{{url('inventory/stockInventory/enterStockInventory')}}/'+inventory.id+'?listMode=false'"><button class="btn btn-sm btn-outline-dark" v-if="listMode &&inventory.status!='已完成'">切换为盘点</button></a>--}}
                 <span><button class="btn btn-sm btn-outline-info" v-if="inventory.status==='复盘中' &&!listMode" @click="完结盘点任务(inventory.id,inventory.owner.name,inventory.type)">完结</button></span>
 
                 @can('库存管理-盘点-查看')
@@ -87,10 +85,11 @@
         </span>
                 <span class="form-group ml-4">
             <label for="barcode" class="text-secondary font-weight-bold">请输产品条码</label>
-                <input id="barcode" name="barcode"  @keypress="inputSwitch($event)"
+                <input id="barcode" name="barcode"  @keypress="inputSwitch($event,inventory.owner.code)"
                        type="text" value="@if(old('barcode')){{old('barcode')}}@endif" class="form-control  input" autocomplete="off" @blur="searchBarcode(inventory.owner.code)">
+
         </span>
-{{--                v-if="inventoryAccountMissions.length>=1"--}}
+{{--                v-if="inventoryAccountMissions.length=0"--}}
                 <span class="form-group ml-4" >
                         <label for="count" class="text-secondary font-weight-bold">请输盘点数</label>
                         <input type="text" id="count"  @keypress="inputSwitch($event)"
@@ -117,7 +116,7 @@
                     <table class="table table-sm table-bordered table-info mt-2" v-if="!listMode">
                         <tr>
                             <td>操作</td>
-                            <td class="font-weight-bold">输入盘点数</td>
+{{--                            <td class="font-weight-bold">输入盘点数</td>--}}
                             <td>库位</td>
                             <td>产品名</td>
                             <td>产品条码</td>
@@ -136,10 +135,10 @@
                             <td>
                                 <span class="btn btn-sm btn-outline-primary" @click="盘点选中任务(inventoryMission.id,inventoryMission.produced_at,inventoryMission.valid_at,inventoryMission.batch_number)">选定盘点</span>
                             </td>
-                            <td>
-                                <input type="text" id="count"  @keypress="inputSwitch($event)"
-                                       name="count" class="form-control-sm input" value="@if(old('count')){{old('count')}}@endif"  autocomplete="off">
-                            </td>
+{{--                            <td>--}}
+{{--                                <input type="text" id="count"  @keypress="inputSwitch($event)"--}}
+{{--                                       name="count" class="form-control-sm input" value="@if(old('count')){{old('count')}}@endif"  autocomplete="off" :data_value="inventoryMission.id">--}}
+{{--                            </td>--}}
                             <td>@{{ inventoryMission.location }}</td>
                             <td v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.name }}</td>
                             <td v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.barcode }}</td>
@@ -594,19 +593,20 @@
                 },
                 skuKeyPress(e,owner_code){
                     if(e.key==='Enter') {
-                        this.inputSwitch(e);
                         this.searchBarcode(owner_code);
+                        this.inputSwitch(e);
                     }
                 },
                 inputSwitch(e,owner_code){
+
                     if(e.key==='Enter') {
                         let inputs = $("#form .input");
                         let idx = inputs.index($(e.target));     // 获取当前焦点输入框所处的位置
                         let location=document.getElementById('inventoryInput').value.trim();
-                        // if (idx === 1){
-                        //     this.searchBarcode(owner_code);
-                        // inputs.length - 1}
-                        if (idx === 2) {       // 判断是否是最后一个输入框
+                        if (idx === 1){
+                            this.searchBarcode(owner_code);
+                        }
+                        if (idx === inputs.length - 1) {       // 判断是否是最后一个输入框
                             if (location===''){
                                 document.getElementById('inventoryInput').focus();
                                 return;