Jelajahi Sumber

采购添加备注字段及小程序修改,采购页面添加采购编号筛选

haozi 4 tahun lalu
induk
melakukan
2a8f6b38b3

+ 5 - 1
app/Filters/ProcurementCheckSheetFilters.php

@@ -20,7 +20,7 @@ class ProcurementCheckSheetFilters
     protected $supplierQuery;
     protected $array_filter;
     protected $filters = [
-        'id','status','signed_at','supplier_id',
+        'id','status','signed_at','supplier_id','code'
     ];
     protected $params = [];
 
@@ -89,6 +89,10 @@ class ProcurementCheckSheetFilters
     {
         $this->queryBuilder->where('status',$status);
     }
+    public function code($code)
+    {
+        $this->searchWay($this->getProcurementQuery(),$code,'code');
+    }
 
     public function supplier_id($supplier_id)
     {

+ 5 - 1
app/Filters/ProcurementFilters.php

@@ -23,7 +23,7 @@ class ProcurementFilters
     protected $customerQuery;
     protected $array_filter;
     protected $filters = [
-        'id','owner_id','material_id','company_name','created_at_start','created_at_end','supplier_id'
+        'id','owner_id','material_id','company_name','created_at_start','created_at_end','supplier_id','code'
     ];
     protected $params = [];
 
@@ -115,6 +115,10 @@ class ProcurementFilters
     {
         $this->queryBuilder->whereIn('id',$id);
     }
+    public function code($code)
+    {
+        $this->searchWay( $this->queryBuilder,$code,'code');
+    }
     public function owner_id($owner_id)
     {
         $this->searchWay($this->getOwnerQuery(),$owner_id,'owner_id');

+ 3 - 2
app/Http/Controllers/ProcurementController.php

@@ -46,6 +46,7 @@ class ProcurementController extends Controller
             'initiator'=>$userId,
             'type'=>$type,
             'status'=>$status,
+            'remark'=>$param['remark'],
         ]);
         $procurement->save();
         $number_id=$procurement['id'];
@@ -112,7 +113,7 @@ class ProcurementController extends Controller
     public function store(Request $request)
     {
         $this->gate('采购管理-采购-新建');
-        $param=$request->all(['owner_material_id','quantity','amount','unit_price']);
+        $param=$request->all(['owner_material_id','quantity','amount','unit_price','remark']);
         $procurement=$this->newProcurement($param,Auth::user()['id']);
         return redirect('procurement/procurement/index')->with('successTip','新采购单“'.$procurement->code.'”添加成功');
     }
@@ -121,7 +122,7 @@ class ProcurementController extends Controller
 
         $this->gate('采购管理-采购-新建');
         $request->validated();
-        $param=$request->all(['owner_material_id','quantity','amount','unit_price']);
+        $param=$request->all(['owner_material_id','quantity','amount','unit_price','remark']);
         $procurement=$this->newProcurement($param,Auth::user()['id']);
         $procurement = $procurement->loadMissing(['initiator','ownerMaterial.material','ownerMaterial.owner.customer','ownerMaterial.file','supplier']);
         if ($procurement) return ['success' => true,'data' => $procurement];

+ 1 - 0
app/Jobs/BroadcastBatchToZhengCangJob.php

@@ -35,6 +35,7 @@ class BroadcastBatchToZhengCangJob implements ShouldQueue
     {
         /** @var ForeignZhenCangService  $foreignZhenCangService */
         $foreignZhenCangService=app('ForeignZhenCangService');
+        //TODO 限定指定货主波次
         foreach ($this->batches as &$batch){
             $batch->loadMissing([
                 'orders.orderCommodities.commodity.barcodes'

+ 1 - 1
app/Procurement.php

@@ -40,7 +40,7 @@ class Procurement extends Model
     ];
 
     protected $fillable=[
-        'code','owner_material_id', 'supplier_id', 'quantity','amount','unit_price','cost_price','status','initiator','type','is_enquiry','deadline'
+        'code','owner_material_id', 'supplier_id', 'quantity','amount','unit_price','cost_price','status','initiator','type','is_enquiry','deadline','remark'
     ];
 
     public  function ownerMaterial(): \Illuminate\Database\Eloquent\Relations\HasOne

+ 1 - 0
app/Services/StoreItemService.php

@@ -43,6 +43,7 @@ class StoreItemService
                 ->whereIn('asnno',$item)
                 ->select('asnno','asnlineno','customerid','sku','skudescrc','linestatus','lotatt08','lotatt05','receivedqty','expectedqty','addtime','edittime')
                 ->get();
+            if ($res->isEmpty())continue;
             array_push($result,...$res);
         }
         return collect($result);

+ 32 - 0
database/migrations/2021_12_14_145724_add_remark_column_to_procurements_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddRemarkColumnToProcurementsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('procurements', function (Blueprint $table) {
+            $table->string("remark")->nullable()->comment("备注");
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('procurements', function (Blueprint $table) {
+            $table->dropColumn("remark");
+        });
+    }
+}

+ 1 - 0
resources/views/procurement/finance/checkBill.blade.php

@@ -106,6 +106,7 @@
                 let data = [
                     [
                         {name: 'signed_at', type: 'dateMonth', tip: '选择显示指定的签收日期'},
+                        {name:'code',type:'input',tip:'可支持多采购编号,模糊搜索可在两侧增加百分号(%)进行',placeholder: '采购编号'},
                         {
                             name: 'supplier_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的供应商'],
                             placeholder: ['供应商', '定位或多选供应商'], data: this.suppliers

+ 1 - 0
resources/views/procurement/finance/procurementBill.blade.php

@@ -92,6 +92,7 @@
                     [
                         {name: 'created_at_start', type: 'dateTime', tip: '选择显示指定日期的起始时间'},
                         {name: 'created_at_end', type: 'dateTime', tip: '选择显示指定日期的结束时间'},
+                        {name:'code',type:'input',tip:'可支持多采购编号,模糊搜索可在两侧增加百分号(%)进行',placeholder: '采购编号'},
                         {
                             name: 'owner_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的项目'],
                             placeholder: ['项目', '定位或多选项目'], data: this.owners

+ 6 - 0
resources/views/procurement/procurement/_addProcurement.blade.php

@@ -95,6 +95,12 @@
                             <input id="total_price" type="text" class="form-control" name="total_price" autocomplete="off" value="{{ old('total_price') }}" v-model="total_price" readonly>
                         </div>
                     </div>
+                    <div class="form-group row" >
+                        <label for="remark" class="col-2 col-form-label text-right">备注</label>
+                        <div class="col-8">
+                            <textarea id="remark" type="text" class="form-control" name="remark" autocomplete="off" value="{{ old('remark') }}" v-model="remark"></textarea>
+                        </div>
+                    </div>
                 </form>
             </div>
             <div class="modal-footer">

+ 6 - 0
resources/views/procurement/procurement/create.blade.php

@@ -92,6 +92,12 @@
                             <input type="text" class="form-control" name="total_price" autocomplete="off" value="{{ old('total_price') }}" v-model="total_price" readonly>
                         </div>
                     </div>
+                    <div class="form-group row" >
+                        <label for="remark" class="col-2 col-form-label text-right">备注</label>
+                        <div class="col-8">
+                            <textarea id="remark" type="text" class="form-control" name="remark" autocomplete="off" value="{{ old('remark') }}" v-model="remark"></textarea>
+                        </div>
+                    </div>
                     <div class="form-group row">
                         <div class="col-8 offset-2">
                             <input type="submit" class="btn btn-success form-control">

+ 6 - 3
resources/views/procurement/procurement/index.blade.php

@@ -185,6 +185,7 @@
                 amount: '{{old('amount')}}',
                 unit_price: '{{old('unit_price')}}',
                 total_price: '{{old('total_price')}}',
+                remark: '{{old('remark')}}',
                 procurement_id:'',supplier:'',offer:'',supplier_id:'',
                 ownerMaterials: [],
                 errors: {},
@@ -200,6 +201,7 @@
                     [
                         {name: 'created_at_start', type: 'dateTime', tip: '选择显示指定日期的起始时间'},
                         {name: 'created_at_end', type: 'dateTime', tip: '选择显示指定日期的结束时间'},
+                        {name:'code',type:'input',tip:'可支持多采购编号,模糊搜索可在两侧增加百分号(%)进行',placeholder: '采购编号'},
                         {
                             name: 'owner_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的项目'],
                             placeholder: ['项目', '定位或多选项目'], data: this.owners
@@ -357,7 +359,8 @@
                         owner_material_id: _this.owner_material_id,
                         quantity: _this.quantity,
                         amount: _this.amount,
-                        unit_price: _this.unit_price
+                        unit_price: _this.unit_price,
+                        remark: _this.remark
                     };
                     window.axios.post(url, params).then(function (res) {
                         if (!res.data.success) {
@@ -377,7 +380,7 @@
                 createEnquiry() {
                     let _this = this;
                     let url = '{{url('procurement/procurement/createEnquiry')}}';
-                    let params = {owner_id: _this.owner_id, owner_material_id: _this.owner_material_id};
+                    let params = {owner_id: _this.owner_id, owner_material_id: _this.owner_material_id,remark: _this.remark};
                     window.axios.post(url, params).then(function (res) {
                         if (!res.data.success) {
                             _this.errors = res.data.errors;
@@ -397,7 +400,7 @@
                 createProof() {
                     let _this = this;
                     let url = '{{url('procurement/procurement/createProof')}}';
-                    let params = {owner_id: _this.owner_id, owner_material_id: _this.owner_material_id};
+                    let params = {owner_id: _this.owner_id, owner_material_id: _this.owner_material_id,remark: _this.remark};
                     window.axios.post(url, params).then(function (res) {
                         if (!res.data.success) {
                             _this.errors = res.data.errors;