Commit 9c4cf04a by 杨树贤

Merge branch 'ysx-财务信息金蝶同步-20240319'

parents 890bffcd 4909d17f
...@@ -58,6 +58,7 @@ class SupplierReceiptApiController extends Controller ...@@ -58,6 +58,7 @@ class SupplierReceiptApiController extends Controller
'certificate', 'certificate',
'account_name', 'account_name',
'remark', 'remark',
//'international_code'
]); ]);
$receipt['account_adderss'] = empty($receipt['account_adderss']) ? ' ' : $receipt['account_adderss']; $receipt['account_adderss'] = empty($receipt['account_adderss']) ? ' ' : $receipt['account_adderss'];
if ($receipt['receipt_type'] == 1) { if ($receipt['receipt_type'] == 1) {
...@@ -80,12 +81,12 @@ class SupplierReceiptApiController extends Controller ...@@ -80,12 +81,12 @@ class SupplierReceiptApiController extends Controller
//如果修改的只是备注,则不需要转成审核 //如果修改的只是备注,则不需要转成审核
$needAudit = $this->checkNeedAudit($oldReceipt, $newReceipt); $needAudit = $this->checkNeedAudit($oldReceipt, $newReceipt);
if ($needAudit || empty($request->get('receipt_id'))) { if ($needAudit || empty($request->get('receipt_id'))) {
// $supplierModel = new SupplierChannelModel(); $supplierModel = new SupplierChannelModel();
//修改供应商为审核状态 //修改供应商为审核状态
// $supplierModel->where('supplier_id', $supplierId)->update([ $supplierModel->where('supplier_id', $supplierId)->update([
// 'update_time' => time(), 'update_time' => time(),
// 'status' => SupplierChannelModel::STATUS_PENDING, 'status' => SupplierChannelModel::STATUS_PENDING,
// ]); ]);
} }
$logService = new LogService(); $logService = new LogService();
...@@ -95,7 +96,7 @@ class SupplierReceiptApiController extends Controller ...@@ -95,7 +96,7 @@ class SupplierReceiptApiController extends Controller
(new SyncSupplierService())->syncSupplierToErp($supplierId); (new SyncSupplierService())->syncSupplierToErp($supplierId);
$this->response(0, '操作成功'); $this->response(0, '操作成功');
} }
$this->response(-1, '操作失败'); $this->response(-1, '没有内容变更,操作失败');
} }
//判断是否要进入审核中状态,因为部分字段修改是不需要走审核的 //判断是否要进入审核中状态,因为部分字段修改是不需要走审核的
...@@ -127,8 +128,24 @@ class SupplierReceiptApiController extends Controller ...@@ -127,8 +128,24 @@ class SupplierReceiptApiController extends Controller
public function DeleteSupplierReceipt($request) public function DeleteSupplierReceipt($request)
{ {
$receiptId = $request->get('receipt_id'); $receiptId = $request->get('receipt_id');
$receipt = SupplierReceiptModel::where('receipt_id', $receiptId)->first()->toArray();
$model = new SupplierReceiptModel(); $model = new SupplierReceiptModel();
$supplierModel = new SupplierChannelModel();
$supplier = $supplierModel->where('supplier_id', $receipt['supplier_id']);
$supplierId = $supplier['supplier_id'];
//修改供应商为审核状态
$supplierModel->where('supplier_id', $supplierId)->update([
'update_time' => time(),
'status' => SupplierChannelModel::STATUS_PENDING,
]);
$result = $model->where('receipt_id', $receiptId)->delete(); $result = $model->where('receipt_id', $receiptId)->delete();
$logService = new LogService();
$content = '删除银行信息';
$remark = json_encode($receipt);
$logService->AddLog($receipt['supplier_id'], LogModel::UPDATE_OPERATE, '修改供应商基本资料', $content, $remark);
(new SyncSupplierService())->syncSupplierToErp($supplierId);
if ($result) { if ($result) {
$this->response(0, '操作成功'); $this->response(0, '操作成功');
} }
......
...@@ -61,8 +61,7 @@ class SupplierShareApplyApiController extends Controller ...@@ -61,8 +61,7 @@ class SupplierShareApplyApiController extends Controller
$q->orWhere('purchase_uid', $codeId) $q->orWhere('purchase_uid', $codeId)
->orwhere('channel_uid', 'like', "%$codeId%"); ->orwhere('channel_uid', 'like', "%$codeId%");
} }
}) })->where('is_type', 0)->first();
->where('is_type', 0)->first();
if ($isOwn) { if ($isOwn) {
$this->response(-1, '你已经可以管理该供应商,无需申请共用'); $this->response(-1, '你已经可以管理该供应商,无需申请共用');
} }
......
...@@ -41,6 +41,7 @@ class LogController extends Controller ...@@ -41,6 +41,7 @@ class LogController extends Controller
return $this->errhtml('Not', '没有这个页面'); return $this->errhtml('Not', '没有这个页面');
} }
//供应商详情的操作日志
public function SupplierLog($request) public function SupplierLog($request)
{ {
$supplierId = $request->get('supplier_id', 1); $supplierId = $request->get('supplier_id', 1);
......
...@@ -93,11 +93,16 @@ class SyncSupplierService ...@@ -93,11 +93,16 @@ class SyncSupplierService
$message['bankinfo'][] = [ $message['bankinfo'][] = [
"bank" => $receipt['bank_adderss'], "bank" => $receipt['bank_adderss'],
'bankaccount' => $receipt['account_no'], 'bankaccount' => $receipt['account_no'],
'supplier' => $receipt['bank_name'],
'swiftCode' => $receipt['swift_code'],
'beneficiary' => $receipt['account_name'],
'bankAddress' => $receipt['account_adderss'],
'infoEvidence' => $receipt['certificate'],
//'bankaccount' => $receipt['international_code'],
]; ];
} }
} }
//dd($message);
if ($conn) { if ($conn) {
} else { } else {
...@@ -106,7 +111,6 @@ class SyncSupplierService ...@@ -106,7 +111,6 @@ class SyncSupplierService
config('database.connections.rabbitmq.login'), config('database.connections.rabbitmq.login'),
config('database.connections.rabbitmq.password')); config('database.connections.rabbitmq.password'));
} }
$channel = $conn->channel(); $channel = $conn->channel();
$channel->queue_declare('supplier_sync', false, true, false, false); $channel->queue_declare('supplier_sync', false, true, false, false);
......
...@@ -33,12 +33,46 @@ class LogTransformer ...@@ -33,12 +33,46 @@ class LogTransformer
$item['content'] = $content; $item['content'] = $content;
} }
if (!is_array($item['content'])&&strpos($item['content'], '联系') !== false) { //如果是和银行信息有关的,还要把具体的信息展示出来
$item['content'] = $item['content'] .':'.$logService->getContactDesc($item['remark']); if (is_string($item['content'])) {
if (strpos($item['content'], '银行信息') !== FALSE) {
if (!empty($item['remark'])) {
//获取当前的信息
$oldReceipt = json_decode($item['remark'], true);
//新增
if (empty($oldReceipt['receipt_id'])) {
$item['content'] .= ' : ' . "银行名称 : {$oldReceipt['bank_name']} | 账户号码 : {$oldReceipt['account_no']}";
}
}
}
}
if (!is_array($item['content']) && strpos($item['content'], '联系') !== false) {
$item['content'] = $item['content'] . ':' . $logService->getContactDesc($item['remark']);
} }
$item['content'] = $item['content'] ?: '没有内容变化'; $item['content'] = $item['content'] ?: '没有内容变化';
} }
return $item; return $item;
} }
public static function transformReceiptLog($oldReceipt, $receipt)
{
if (empty($oldReceipt['receipt_id'])) {
//新增日志
$content = "银行名称 : {$oldReceipt['bank_name']} | 账户号码 : {$oldReceipt['account_no']}";
}else{
if ($receipt) {
//修改日志
}else{
//删除日志
}
}
}
} }
...@@ -23,6 +23,9 @@ class ReceiptValidator ...@@ -23,6 +23,9 @@ class ReceiptValidator
]; ];
if ($receipt['receipt_type'] == 2) { if ($receipt['receipt_type'] == 2) {
$rules["swift_code"] = 'required'; $rules["swift_code"] = 'required';
$rules["account_adderss"] = 'required';
$rules["account_name"] = 'required';
//$rules["international_code"] = 'required';
} }
$messages = $this->messages(); $messages = $this->messages();
$validator = Validator::make($receipt, $rules, $messages); $validator = Validator::make($receipt, $rules, $messages);
...@@ -47,6 +50,8 @@ class ReceiptValidator ...@@ -47,6 +50,8 @@ class ReceiptValidator
'account_no.required' => '银行账号 不能为空', 'account_no.required' => '银行账号 不能为空',
'account_name.required' => '账户名称 不能为空', 'account_name.required' => '账户名称 不能为空',
'certificate.required' => '银行信息凭证 不能为空', 'certificate.required' => '银行信息凭证 不能为空',
'account_adderss.required' => '银行地址 不能为空',
//'international_code.required' => '国际代码 不能为空',
]; ];
} }
} }
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<script src="/js/jquery-2.2.1.js"></script> <script src="/js/jquery-2.2.1.js"></script>
<script type="text/javascript" src="/plugins/assets/libs/layui/layui.js"></script> <script type="text/javascript" src="/plugins/assets/libs/layui/layui.js"></script>
<script type="text/javascript" src="/plugins/assets/js/common.js?version={{time()}}"></script> <script type="text/javascript" src="/plugins/assets/js/common.js?version={{time()}}"></script>
<script type="text/javascript" src="/plugins/assets/js/alpine.js" defer></script>
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
......
{!! Autograph() !!} {!! Autograph() !!}
<script> <script>
document.addEventListener('alpine:init', () => {
Alpine.data('receiptForm', () => ({
receiptType: $('#receipt_type').val(),
init() {
let g = this;
layui.use(['form', 'upload', 'admin'], function () { layui.use(['form', 'upload', 'admin'], function () {
const form = layui.form const form = layui.form
const upload = layui.upload; const upload = layui.upload;
...@@ -27,11 +32,7 @@ ...@@ -27,11 +32,7 @@
}) })
form.on('radio(receipt_type)', function (data) { form.on('radio(receipt_type)', function (data) {
if (data.value == 1) { g.receiptType = data.value;
$('#swift_code_div').hide();
} else {
$('#swift_code_div').show();
}
}); });
//图片上传 //图片上传
...@@ -81,4 +82,7 @@ ...@@ -81,4 +82,7 @@
} }
}); });
}); });
}
}));
});
</script> </script>
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
{field: 'account_no', title: '<span class="require">* </span>银行账号', align: 'center', width: 130}, {field: 'account_no', title: '<span class="require">* </span>银行账号', align: 'center', width: 130},
{field: 'account_name', title: '账户名称', align: 'center', width: 150}, {field: 'account_name', title: '账户名称', align: 'center', width: 150},
{field: 'swift_code', title: '电汇号码', align: 'center', width: 130}, {field: 'swift_code', title: '电汇号码', align: 'center', width: 130},
// {field: 'international_code', title: '国际代码', align: 'center', width: 130},
{ {
field: 'certificate', field: 'certificate',
title: '<span class="require">* </span>信息凭证', title: '<span class="require">* </span>信息凭证',
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
<!-- js部分 --> <!-- js部分 -->
<script type="text/javascript" src="/plugins/assets/libs/layui/layui.js"></script> <script type="text/javascript" src="/plugins/assets/libs/layui/layui.js"></script>
<script type="text/javascript" src="/plugins/assets/js/common.js?v=317"></script> <script type="text/javascript" src="/plugins/assets/js/common.js?v=317"></script>
<script type="text/javascript" src="/plugins/assets/js/alpine.js"></script>
<script> <script>
layui.use(['index', 'layer', 'admin'], function () { layui.use(['index', 'layer', 'admin'], function () {
var $ = layui.jquery; var $ = layui.jquery;
......
...@@ -5,12 +5,13 @@ ...@@ -5,12 +5,13 @@
</style> </style>
<div class="layui-card"> <div class="layui-card">
<div class="layui-card-body"> <div class="layui-card-body">
<form class="layui-form" action=""> <form class="layui-form" action="" x-data="receiptForm">
<input type="hidden" name="supplier_id" value="{{request()->get('supplier_id')}}"> <input type="hidden" name="supplier_id" value="{{request()->get('supplier_id')}}">
<input type="hidden" name="receipt_id" value="{{request()->get('receipt_id')}}"> <input type="hidden" name="receipt_id" value="{{request()->get('receipt_id')}}">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">银行类型 : </label> <label class="layui-form-label">银行类型 : </label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="hidden" id="receipt_type" value="{{$receipt['receipt_type'] or 1}}">
<input type="radio" name="receipt_type" lay-filter="receipt_type" value="1" title="国内" <input type="radio" name="receipt_type" lay-filter="receipt_type" value="1" title="国内"
@if((!empty($receipt['receipt_type'])&&$receipt['receipt_type']==1)||empty($receipt)) @if((!empty($receipt['receipt_type'])&&$receipt['receipt_type']==1)||empty($receipt))
checked checked
...@@ -48,7 +49,10 @@ ...@@ -48,7 +49,10 @@
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">账户名称 : </label> <label class="layui-form-label">
<span x-show="receiptType === '1'"> 账户名称 : </span>
<span x-show="receiptType === '2'"><span style="color: red">* </span> 国外受益人 : </span>
</label>
<div class="layui-input-block block-42"> <div class="layui-input-block block-42">
<input type="text" name="account_name" id="account_name" <input type="text" name="account_name" id="account_name"
placeholder="请输入账户名称" class="layui-input" placeholder="请输入账户名称" class="layui-input"
...@@ -56,16 +60,26 @@ ...@@ -56,16 +60,26 @@
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">银行地址 : </label> <label class="layui-form-label">
<span style="color: red" x-show="receiptType === '2'">* </span>
银行地址 : </label>
<div class="layui-input-block block-42"> <div class="layui-input-block block-42">
<input type="text" name="account_adderss" id="account_adderss" <input type="text" name="account_adderss" id="account_adderss"
placeholder="请输入银行具体地址,精确到街道" class="layui-input" placeholder="请输入银行具体地址,精确到街道" class="layui-input"
value="{{$receipt['account_adderss'] or ''}}"> value="{{$receipt['account_adderss'] or ''}}">
</div> </div>
</div> </div>
<div class="layui-form-item" id="swift_code_div" {{-- <div class="layui-form-item" x-show="receiptType === '2'">--}}
@if((!empty($receipt['receipt_type'])&&$receipt['receipt_type']==1)||empty($receipt['receipt_type'])) {{-- <label class="layui-form-label">--}}
style="display: none" @endif> {{-- <span style="color: red">* </span>--}}
{{-- 国际代码 : </label>--}}
{{-- <div class="layui-input-block block-42">--}}
{{-- <input type="text" name="international_code" id="international_code"--}}
{{-- placeholder="请输入银行国际代码" class="layui-input"--}}
{{-- value="{{$receipt['international_code'] or ''}}">--}}
{{-- </div>--}}
{{-- </div>--}}
<div class="layui-form-item" id="swift_code_div" x-show="receiptType === '2'">
<label class="layui-form-label"><span class="require">*</span>Swift Code : </label> <label class="layui-form-label"><span class="require">*</span>Swift Code : </label>
<div class="layui-input-block block-42"> <div class="layui-input-block block-42">
<input type="text" name="swift_code" id="Swift Code" <input type="text" name="swift_code" id="Swift Code"
...@@ -84,9 +98,10 @@ ...@@ -84,9 +98,10 @@
<button type="button" class="layui-btn upload-img" preview="preview" data-obj="certificate"> <button type="button" class="layui-btn upload-img" preview="preview" data-obj="certificate">
<i class="layui-icon">&#xe67c;</i>上传文件 <i class="layui-icon">&#xe67c;</i>上传文件
</button> </button>
<a target="_blank" id="certificate_url" href="{{$receipt['certificate'] or ''}}">{{$receipt['certificate'] or ''}}</a> <a target="_blank" id="certificate_url"
{{-- <img @if(!empty($receipt['certificate'])) src="{{$receipt['certificate'] or ''}}"--}} href="{{$receipt['certificate'] or ''}}">{{$receipt['certificate'] or ''}}</a>
{{-- @endif class="layui-upload-img" width="50px" height="50px" id="preview">--}} {{-- <img @if(!empty($receipt['certificate'])) src="{{$receipt['certificate'] or ''}}"--}}
{{-- @endif class="layui-upload-img" width="50px" height="50px" id="preview">--}}
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment