切换到jsh的版本
This commit is contained in:
32
README.md
32
README.md
@@ -1,22 +1,16 @@
|
|||||||
# 项目总述
|
# 项目总述
|
||||||
* 很多人说华夏ERP(英文名:jshERP)是目前唯一完整开源的进销存系统
|
* 很多人说华夏ERP(英文名:jshERP)是目前唯一完整开源的进销存系统
|
||||||
* 虽然目前只有进销存+财务的功能,但后面将会推出ERP的全部功能,大家一起努力吧
|
* 虽然目前只有进销存+财务的功能,但后面将会推出ERP的全部功能,大家一起努力吧
|
||||||
* 部署如有问题请联系QQ:960596000,
|
|
||||||
* 欢迎加入乾坤平台-华夏ERP群,群号码:693725296
|
|
||||||
扫码加群:
|
|
||||||

|
|
||||||
* [交流社区](https://qiankunpingtai.cn/domain/%E8%BF%9B%E9%94%80%E5%AD%98)
|
|
||||||
* 联系方式二:QQ:752718920,交流群二,群号码:120725710
|
|
||||||
* 商务合作-请联系QQ:514869858,技术交流-请联系QQ:752718920
|
* 商务合作-请联系QQ:514869858,技术交流-请联系QQ:752718920
|
||||||
* 欢迎加入华夏ERP交流QQ群,群1:120725710(满)、群2:732152262
|
* 欢迎加入华夏ERP交流QQ群,群1:120725710(满)、群2:732152262
|
||||||
* 系统的默认超管账户:admin,默认租户账号:jsh,默认密码均为:123456
|
* 系统的默认超管账户:admin,默认租户账号:jsh,默认密码均为:123456
|
||||||
* 部署如遇到困难请参考Wiki文档 **https://gitee.com/jishenghua/JSH_ERP/wikis/pages**
|
* 部署如遇到困难请参考Wiki文档 **https://gitee.com/jishenghua/JSH_ERP/wikis/pages**
|
||||||
* **[本系统演示地址一](http://erp.qkpt.top/login.html) 账号:jsh,密码:123456,欢迎登录(如需试用,欢迎注册)**
|
* 官网地址:[http://www.huaxiaerp.com](https://www.huaxiaerp.com),测试账号:jsh,密码:123456,**(如需长期使用,欢迎注册)**
|
||||||
* **[本系统演示地址二](http://www.huaxiaerp.com)**
|
|
||||||
# 定制服务
|
# 定制服务
|
||||||
* 如有ERP **私人定制** 需求,请将需求整理成文档,发给邮箱: **514869858@qq.com** ,我会及时回复哒
|
* 如有ERP **私人定制** 需求,请将需求整理成文档,发给邮箱: **514869858@qq.com** ,我会及时回复哒
|
||||||
# 开发初衷
|
|
||||||
|
|
||||||
|
# 开发初衷
|
||||||
* 华夏ERP立志为中小企业提供开源好用的ERP软件,降低企业的信息化成本
|
* 华夏ERP立志为中小企业提供开源好用的ERP软件,降低企业的信息化成本
|
||||||
* 个人开发者也可以使用华夏ERP进行二次开发,加快完成开发任务
|
* 个人开发者也可以使用华夏ERP进行二次开发,加快完成开发任务
|
||||||
* 初学JAVA的小伙伴可以下载源代码来进行学习交流
|
* 初学JAVA的小伙伴可以下载源代码来进行学习交流
|
||||||
@@ -48,22 +42,22 @@
|
|||||||
|
|
||||||
# 系统美图
|
# 系统美图
|
||||||
* 首页
|
* 首页
|
||||||

|

|
||||||
* 零售管理
|
* 零售管理
|
||||||

|

|
||||||
* 采购管理
|
* 采购管理
|
||||||

|

|
||||||
* 销售管理
|
* 销售管理
|
||||||

|

|
||||||
* 仓库管理
|
* 仓库管理
|
||||||

|

|
||||||
* 财务管理
|
* 财务管理
|
||||||

|

|
||||||
* 报表查询
|
* 报表查询
|
||||||

|

|
||||||
* 商品管理
|
* 商品管理
|
||||||

|

|
||||||
* 基本资料
|
* 基本资料
|
||||||

|

|
||||||
* 系统管理
|
* 系统管理
|
||||||

|

|
||||||
@@ -1,955 +0,0 @@
|
|||||||
//初始化界面
|
|
||||||
var listType = "收预付款";
|
|
||||||
var itemType = true; //隐藏当前列
|
|
||||||
var moneyType = false; //显示当前列
|
|
||||||
var payTypeTitle = "无标题";
|
|
||||||
var inOrOut = "";
|
|
||||||
var amountNum = "SYF";
|
|
||||||
var organUrl = "/supplier/findBySelect_retail"; //散户接口
|
|
||||||
var listTitle='收预付款列表';
|
|
||||||
$(function(){
|
|
||||||
initSystemData_person(); //经手人数据
|
|
||||||
initSelectInfo_person(); //经手人信息
|
|
||||||
initSystemData_account(); //账户数据
|
|
||||||
initSelectInfo_account(); //账户信息
|
|
||||||
initSupplier(); //供应商
|
|
||||||
initTableData();
|
|
||||||
ininPager();
|
|
||||||
initForm();
|
|
||||||
bindEvent();//绑定操作事件
|
|
||||||
$("#searchBtn").click();
|
|
||||||
});
|
|
||||||
//获取账户信息
|
|
||||||
function initSystemData_account(){
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/account/getAccount",
|
|
||||||
//设置为同步
|
|
||||||
async:false,
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
if(res.data) {
|
|
||||||
accountList = res.data.accountList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//获取账户信息
|
|
||||||
function initSelectInfo_account(){
|
|
||||||
var options = "";
|
|
||||||
if(accountList !=null)
|
|
||||||
{
|
|
||||||
options = "";
|
|
||||||
for(var i = 0 ;i < accountList.length; i++)
|
|
||||||
{
|
|
||||||
var account = accountList[i];
|
|
||||||
options += '<option value="' + account.id + '">' + account.name + '</option>';
|
|
||||||
}
|
|
||||||
$("#AccountId").empty().append(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化单位信息
|
|
||||||
function initSupplier(){
|
|
||||||
$('#OrganId').combobox({
|
|
||||||
url: organUrl,
|
|
||||||
valueField:'id',
|
|
||||||
textField:'supplier',
|
|
||||||
formatter: function(row){
|
|
||||||
var opts = $(this).combobox('options');
|
|
||||||
if(row[opts.textField]!=="非会员") {
|
|
||||||
return row[opts.textField];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取财务员
|
|
||||||
function initSystemData_person(){
|
|
||||||
var type = "财务员";
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/person/getPersonByType",
|
|
||||||
data: {
|
|
||||||
type: type
|
|
||||||
},
|
|
||||||
//设置为同步
|
|
||||||
async:false,
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
personList = res.data.personList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//获取财务员
|
|
||||||
function initSelectInfo_person(){
|
|
||||||
var options = "";
|
|
||||||
|
|
||||||
if(personList !=null)
|
|
||||||
{
|
|
||||||
for(var i = 0 ;i < personList.length;i++)
|
|
||||||
{
|
|
||||||
var person = personList[i];
|
|
||||||
if(0 == i)
|
|
||||||
{
|
|
||||||
personID = person.id;
|
|
||||||
}
|
|
||||||
if(person.type=="财务员")
|
|
||||||
{
|
|
||||||
options += '<option value="' + person.id + '">' + person.name + '</option>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$("#HandsPersonId").empty().append(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//防止表单提交重复
|
|
||||||
function initForm(){
|
|
||||||
$('#accountHeadFM').form({
|
|
||||||
onSubmit: function(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化表格数据
|
|
||||||
function initTableData(){
|
|
||||||
var organNameTitle = "付款会员";
|
|
||||||
var organNameHidden = false;
|
|
||||||
$('#tableData').datagrid({
|
|
||||||
//width:700,
|
|
||||||
height:heightInfo,
|
|
||||||
rownumbers: false,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//fitColumns:true,
|
|
||||||
//单击行是否选中
|
|
||||||
//checkOnSelect : false,
|
|
||||||
pagination: true,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
pageSize: 5,
|
|
||||||
pageList: initPageNum,
|
|
||||||
columns:[[
|
|
||||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
|
||||||
{ title: '操作',field: 'op',align:"center",width:90,formatter:function(value, rec,index) {
|
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/7 10:48
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js
|
|
||||||
*/
|
|
||||||
var str = '';
|
|
||||||
var orgId = rec.organid ? rec.organid : 0;
|
|
||||||
str += '<img title="查看" src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountHead(\'' + index + '\');"/> ';
|
|
||||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccountHead(\'' + index + '\');"/> ';
|
|
||||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccountHead('+ rec.id +',' + orgId +',' + rec.totalprice + ');"/>';
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ field: 'organid',width:5, hidden:true},
|
|
||||||
{ title: organNameTitle,field: 'organname',width:140,hidden:organNameHidden},
|
|
||||||
{ title: '单据编号',field: 'billno',width:140},
|
|
||||||
{ title: '经手人',field: 'handspersonname',width:80},
|
|
||||||
{ title: '单据时间 ',field: 'billtime',width:140},
|
|
||||||
{ title: '合计',field: 'totalprice',width:80},
|
|
||||||
{ title: '备注',field: 'remark',width:100}
|
|
||||||
]],
|
|
||||||
toolbar:[
|
|
||||||
{
|
|
||||||
id:'addAccountHead',
|
|
||||||
text:'增加',
|
|
||||||
iconCls:'icon-add',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
addAccountHead();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:'deleteAccountHead',
|
|
||||||
text:'删除',
|
|
||||||
iconCls:'icon-remove',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
batDeleteAccountHead();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
onLoadError:function()
|
|
||||||
{
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化表格数据-明细列表-编辑状态
|
|
||||||
function initTableData_account(type,TotalPrice){
|
|
||||||
$('#accountData').datagrid({
|
|
||||||
height:280,
|
|
||||||
rownumbers: false,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//单击行是否选中
|
|
||||||
checkOnSelect : false,
|
|
||||||
pagination: false,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
showFooter: true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
|
||||||
{ title: payTypeTitle,field: 'InOutItemId',width:230,hidden:itemType,
|
|
||||||
formatter:function(value,row,index){
|
|
||||||
return row.InOutItemName;
|
|
||||||
},
|
|
||||||
editor:{
|
|
||||||
type:'combobox',
|
|
||||||
options:{
|
|
||||||
valueField:'Id',
|
|
||||||
textField:'InOutItemName',
|
|
||||||
method:'get',
|
|
||||||
url: "/inOutItem/findBySelect?type=" + inOrOut
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ title: '账户名称',field: 'AccountId',width:230,hidden:moneyType,
|
|
||||||
formatter:function(value,row,index){
|
|
||||||
return row.AccountName;
|
|
||||||
},
|
|
||||||
editor:{
|
|
||||||
type:'combobox',
|
|
||||||
options:{
|
|
||||||
valueField:'Id',
|
|
||||||
textField:'AccountName',
|
|
||||||
method:'get',
|
|
||||||
url: "/account/findBySelect"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ title: '金额',field: 'EachAmount',editor:'validatebox',width:70},
|
|
||||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:150}
|
|
||||||
]],
|
|
||||||
toolbar:[
|
|
||||||
{
|
|
||||||
id:'append',
|
|
||||||
text:'新增',
|
|
||||||
iconCls:'icon-add',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
append(); //新增
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:'delete',
|
|
||||||
text:'删除',
|
|
||||||
iconCls:'icon-remove',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
removeit(); //删除
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:'reject',
|
|
||||||
text:'撤销',
|
|
||||||
iconCls:'icon-undo',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
reject(); //撤销
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
onLoadError:function()
|
|
||||||
{
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: '/accountItem/getDetailList',
|
|
||||||
data: {
|
|
||||||
headerId: accountHeadID
|
|
||||||
},
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
var data = res.data;
|
|
||||||
var EachAmount = 0;
|
|
||||||
if(type === "edit") {
|
|
||||||
EachAmount = TotalPrice;
|
|
||||||
}
|
|
||||||
var array = [];
|
|
||||||
array.push({
|
|
||||||
"EachAmount": EachAmount
|
|
||||||
});
|
|
||||||
data.footer = array;
|
|
||||||
$("#accountData").datagrid('loadData',data);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//初始化表格数据-明细列表-查看状态
|
|
||||||
function initTableData_account_show(TotalPrice){
|
|
||||||
$('#accountDataShow').datagrid({
|
|
||||||
height:280,
|
|
||||||
rownumbers: true,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//单击行是否选中
|
|
||||||
checkOnSelect : false,
|
|
||||||
pagination: false,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
showFooter: true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
|
||||||
{ title: payTypeTitle, field: 'InOutItemName', width:230, hidden:itemType},
|
|
||||||
{ title: '账户名称', field: 'AccountName', width:230, hidden:moneyType},
|
|
||||||
{ title: '金额',field: 'EachAmount',width:70},
|
|
||||||
{ title: '备注',field: 'Remark',width:150}
|
|
||||||
]],
|
|
||||||
onLoadError:function()
|
|
||||||
{
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: '/accountItem/getDetailList',
|
|
||||||
data: {
|
|
||||||
headerId: accountHeadID
|
|
||||||
},
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
var data = res.data;
|
|
||||||
var EachAmount = TotalPrice;
|
|
||||||
var array = [];
|
|
||||||
array.push({
|
|
||||||
"EachAmount": EachAmount
|
|
||||||
});
|
|
||||||
data.footer = array;
|
|
||||||
$("#accountDataShow").datagrid('loadData', data);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//分页信息处理
|
|
||||||
function ininPager(){
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
|
||||||
pager.pagination({
|
|
||||||
onSelectPage:function(pageNum, pageSize)
|
|
||||||
{
|
|
||||||
opts.pageNumber = pageNum;
|
|
||||||
opts.pageSize = pageSize;
|
|
||||||
pager.pagination('refresh',
|
|
||||||
{
|
|
||||||
pageNumber:pageNum,
|
|
||||||
pageSize:pageSize
|
|
||||||
});
|
|
||||||
showAccountHeadDetails(pageNum,pageSize);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (e)
|
|
||||||
{
|
|
||||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//删除财务信息
|
|
||||||
function deleteAccountHead(accountHeadID, thisOrganId, totalPrice){
|
|
||||||
$.messager.confirm('删除确认','确定要删除此财务信息吗?',function(r)
|
|
||||||
{
|
|
||||||
if (r)
|
|
||||||
{
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
|
||||||
dataType: "json",
|
|
||||||
data:{
|
|
||||||
ids: accountHeadID
|
|
||||||
},
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code == 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
} else {
|
|
||||||
if(res && res.code == 601){
|
|
||||||
var jsondata={};
|
|
||||||
jsondata.ids=accountHeadID;
|
|
||||||
jsondata.deleteType='2';
|
|
||||||
var type='single';
|
|
||||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
return;
|
|
||||||
}else{
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//更新会员的预收款信息
|
|
||||||
if(listType === "收预付款"){
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/supplier/updateAdvanceIn",
|
|
||||||
dataType: "json",
|
|
||||||
data:{
|
|
||||||
supplierId: thisOrganId, //会员id
|
|
||||||
advanceIn: 0-totalPrice //删除时同时删除用户的预付款信息
|
|
||||||
},
|
|
||||||
success: function(res){
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
//保存会员预收款成功
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(){
|
|
||||||
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量删除财务信息
|
|
||||||
function batDeleteAccountHead(){
|
|
||||||
var row = $('#tableData').datagrid('getChecked');
|
|
||||||
if(row.length == 0)
|
|
||||||
{
|
|
||||||
$.messager.alert('删除提示','没有记录被选中!','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(row.length > 0)
|
|
||||||
{
|
|
||||||
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条财务信息吗?',function(r)
|
|
||||||
{
|
|
||||||
if (r)
|
|
||||||
{
|
|
||||||
var ids = "";
|
|
||||||
for(var i = 0;i < row.length; i ++) {
|
|
||||||
if(i == row.length-1)
|
|
||||||
{
|
|
||||||
ids += row[i].id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ids += row[i].id + ",";
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量删除
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
|
||||||
dataType: "json",
|
|
||||||
async : false,
|
|
||||||
data: ({
|
|
||||||
ids : ids
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
} else {
|
|
||||||
if(res && res.code == 601){
|
|
||||||
var jsondata={};
|
|
||||||
jsondata.ids=ids;
|
|
||||||
jsondata.deleteType='2';
|
|
||||||
var type='batch';
|
|
||||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
return;
|
|
||||||
}else{
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//批量更新会员的预收款信息
|
|
||||||
for(var i = 0;i < row.length; i ++) {
|
|
||||||
if(listType === "收预付款"){
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/supplier/updateAdvanceIn",
|
|
||||||
dataType: "json",
|
|
||||||
data:{
|
|
||||||
supplierId: row[i].organid, //会员id
|
|
||||||
advanceIn: 0 - row[i].totalprice //删除时同时删除用户的预付款信息
|
|
||||||
},
|
|
||||||
success: function(res){
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
//保存会员预收款成功
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(){
|
|
||||||
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 确认强制删除
|
|
||||||
* */
|
|
||||||
function batDeleteAccountHeadForceConfirm(res,url,jsondata) {
|
|
||||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
|
||||||
if (r) {
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: url,
|
|
||||||
dataType: "json",
|
|
||||||
data: (jsondata),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code == 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
if(type=='batch'){
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
}
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
return;
|
|
||||||
}else {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error: function () {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//增加
|
|
||||||
function addAccountHead(){
|
|
||||||
$('#accountHeadFM').form('clear');
|
|
||||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
|
||||||
$("#BillTime").val(thisDateTime);
|
|
||||||
var thisNumber = getNowFormatDateNum(); //根据时间生成编号
|
|
||||||
$("#BillNo").val(amountNum + thisNumber).focus();
|
|
||||||
var addTitle = listTitle.replace("列表","信息");
|
|
||||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加' + addTitle);
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
|
|
||||||
orgAccountHead = "";
|
|
||||||
accountHeadID = 0;
|
|
||||||
initTableData_account("add"); //明细列表
|
|
||||||
reject(); //撤销下、刷新材料列表
|
|
||||||
url = '/accountHead/addAccountHeadAndDetail';
|
|
||||||
|
|
||||||
//收预付款单据支持刷卡功能
|
|
||||||
if(listType == "收预付款") {
|
|
||||||
//当会员卡号长度超过10位后,自动点击下拉框,用于兼容刷卡器
|
|
||||||
$("#OrganId").next().find("input").off("keyup").on("keyup",function(){
|
|
||||||
if($(this).val().length === 10){
|
|
||||||
setTimeout(function(){
|
|
||||||
$(".combo-panel .combobox-item-selected").click();
|
|
||||||
},500);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//编辑信息
|
|
||||||
function editAccountHead(index){
|
|
||||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
$("#BillNo").val(rowsdata.billno);
|
|
||||||
$("#BillTime").val(rowsdata.billtime);
|
|
||||||
$("#Remark").val(rowsdata.remark);
|
|
||||||
$("#AccountId").val(rowsdata.accountid);
|
|
||||||
$('#OrganId').combobox('setValue', rowsdata.organid);
|
|
||||||
$("#HandsPersonId").val(rowsdata.handspersonid);
|
|
||||||
$("#ChangeAmount").val(rowsdata.changeamount);
|
|
||||||
var TotalPrice = rowsdata.totalprice;
|
|
||||||
preTotalPrice = rowsdata.totalprice; //记录前一次合计金额,用于收预付款
|
|
||||||
var editTitle = listTitle.replace("列表","信息");
|
|
||||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="' + '/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑' + editTitle);
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
accountHeadID = rowsdata.id;
|
|
||||||
|
|
||||||
initTableData_account("edit",TotalPrice); //明细列表
|
|
||||||
reject(); //撤销下、刷新列表
|
|
||||||
url = '/accountHead/updateAccountHeadAndDetail?id=' + rowsdata.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
//查看信息
|
|
||||||
function showAccountHead(index){
|
|
||||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
$("#BillNoShow").text(rowsdata.billno);
|
|
||||||
$("#BillTimeShow").text(rowsdata.billtime);
|
|
||||||
$("#RemarkShow").text(rowsdata.remark);
|
|
||||||
$("#AccountIdShow").text(rowsdata.accountname);
|
|
||||||
$('#OrganIdShow').text(rowsdata.organname);
|
|
||||||
$("#HandsPersonIdShow").text(rowsdata.handspersonname);
|
|
||||||
$("#ChangeAmountShow").text(rowsdata.rowsdata==undefined?'0':rowsdata.rowsdata);
|
|
||||||
var TotalPrice = rowsdata.totalprice;
|
|
||||||
var showTitle = listTitle.replace("列表","信息");
|
|
||||||
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/list.png"/> 查看' + showTitle);
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
|
|
||||||
accountHeadID = rowsdata.id;
|
|
||||||
initTableData_account_show(TotalPrice); //明细列表-查看状态
|
|
||||||
}
|
|
||||||
|
|
||||||
//绑定操作事件
|
|
||||||
function bindEvent(){
|
|
||||||
//搜索处理
|
|
||||||
$("#searchBtn").unbind().bind({
|
|
||||||
click:function()
|
|
||||||
{
|
|
||||||
showAccountHeadDetails(1,initPageSize);
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
|
||||||
opts.pageNumber = 1;
|
|
||||||
opts.pageSize = initPageSize;
|
|
||||||
pager.pagination('refresh', {
|
|
||||||
pageNumber:1,
|
|
||||||
pageSize:initPageSize
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//重置按钮
|
|
||||||
$("#searchResetBtn").unbind().bind({
|
|
||||||
click:function(){
|
|
||||||
$("#searchBillNo").val("");
|
|
||||||
$("#searchBeginTime").val("");
|
|
||||||
$("#searchEndTime").val("");
|
|
||||||
//加载完以后重新初始化
|
|
||||||
$("#searchBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//保存信息
|
|
||||||
$("#saveAccountHead").off("click").on("click", function () {
|
|
||||||
if(!$('#accountHeadFM').form('validate')){
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
if (!$('#HandsPersonId').val()) {
|
|
||||||
$.messager.alert('提示', '请选择经手人!', 'warning');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!$('#OrganId').combobox('getValue')) {
|
|
||||||
$.messager.alert('提示', '请选择付款会员!', 'warning');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var OrganId = null;
|
|
||||||
var ChangeAmount = $.trim($("#ChangeAmount").val());
|
|
||||||
var TotalPrice = $("#accountHeadFM .datagrid-footer [field='EachAmount'] div").text();
|
|
||||||
OrganId = $('#OrganId').combobox('getValue');
|
|
||||||
//更新会员的预收款信息
|
|
||||||
var advanceIn = 0; //预付款金额
|
|
||||||
if (accountHeadID) {
|
|
||||||
advanceIn = TotalPrice - preTotalPrice; //修改时,预付款=合计金额-加载金额
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
advanceIn = TotalPrice; //新增时,预付款=合计金额
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: "/supplier/updateAdvanceIn",
|
|
||||||
dataType: "json",
|
|
||||||
data: {
|
|
||||||
supplierId: OrganId,
|
|
||||||
advanceIn: advanceIn
|
|
||||||
},
|
|
||||||
success: function (res) {
|
|
||||||
if (res && res.code === 200) {
|
|
||||||
//保存会员预收款成功
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function () {
|
|
||||||
$.messager.alert('提示', '保存信息异常,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//打印单据
|
|
||||||
$("#printAccountHeadShow").off("click").on("click",function(){
|
|
||||||
var tableString = $("#accountHeadDlgShow").html();
|
|
||||||
localStorage.setItem("tableString",tableString);
|
|
||||||
window.open("../../js/print/print_form.html","location:No;status:No;help:No;dialogWidth:800px;dialogHeight:600px;scroll:auto;");
|
|
||||||
});
|
|
||||||
|
|
||||||
//初始化键盘enter事件
|
|
||||||
$(document).keydown(function(event)
|
|
||||||
{
|
|
||||||
//兼容 IE和firefox 事件
|
|
||||||
var e = window.event || event;
|
|
||||||
var k = e.keyCode||e.which||e.charCode;
|
|
||||||
//兼容 IE,firefox 兼容
|
|
||||||
var obj = e.srcElement ? e.srcElement : e.target;
|
|
||||||
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
|
|
||||||
if(k == "13"&&(obj.id=="BillNo"||obj.id=="BillTime"))
|
|
||||||
{
|
|
||||||
$("#saveAccountHead").click();
|
|
||||||
}
|
|
||||||
//搜索按钮添加快捷键
|
|
||||||
if(k == "13"&&(obj.id=="searchBillNo"))
|
|
||||||
{
|
|
||||||
$("#searchBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showAccountHeadDetails(pageNo,pageSize){
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/accountHead/list",
|
|
||||||
dataType: "json",
|
|
||||||
data: ({
|
|
||||||
search: JSON.stringify({
|
|
||||||
type: listType,
|
|
||||||
billNo: $.trim($("#searchBillNo").val()),
|
|
||||||
beginTime: $("#searchBeginTime").val(),
|
|
||||||
endTime: $("#searchEndTime").val()
|
|
||||||
}),
|
|
||||||
currentPage: pageNo,
|
|
||||||
pageSize: pageSize
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200){
|
|
||||||
if(res.data && res.data.page) {
|
|
||||||
$("#tableData").datagrid('loadData', res.data.page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//自动计算事件
|
|
||||||
function autoReckon() {
|
|
||||||
//延时绑定事件
|
|
||||||
setTimeout(function(){
|
|
||||||
var body =$("#accountHeadFM .datagrid-body");
|
|
||||||
var footer =$("#accountHeadFM .datagrid-footer");
|
|
||||||
var input = ".datagrid-editable-input";
|
|
||||||
|
|
||||||
//修改金额,自动计算单价和合计
|
|
||||||
body.find("[field='EachAmount']").find(input).off("keyup").on("keyup",function(){
|
|
||||||
var TotalPrice = 0;
|
|
||||||
var EachAmount =$(this).val()-0; //金额
|
|
||||||
body.find("[field='EachAmount']").each(function(){
|
|
||||||
if($(this).find("div").text()!==""){
|
|
||||||
TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
TotalPrice = TotalPrice + EachAmount;
|
|
||||||
footer.find("[field='EachAmount']").find("div").text((TotalPrice).toFixed(2));
|
|
||||||
});
|
|
||||||
},500);
|
|
||||||
}
|
|
||||||
|
|
||||||
//结束编辑
|
|
||||||
function endEditing() {
|
|
||||||
var edField = "";
|
|
||||||
if(!itemType){
|
|
||||||
edField = "InOutItemId";
|
|
||||||
edName = "InOutItemName";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
edField = "AccountId";
|
|
||||||
edName = "AccountName";
|
|
||||||
}
|
|
||||||
if (editIndex == undefined) { return true }
|
|
||||||
if ($('#accountData').datagrid('validateRow', editIndex)) {
|
|
||||||
var ed = $('#accountData').datagrid('getEditor', {index: editIndex, field: edField});
|
|
||||||
var textName =null;
|
|
||||||
if($(ed.target)){
|
|
||||||
textName = $(ed.target).combobox('getText');
|
|
||||||
}
|
|
||||||
$('#accountData').datagrid('getRows')[editIndex][edName] = textName;
|
|
||||||
$('#accountData').datagrid('endEdit', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//单击
|
|
||||||
function onClickRow(index) {
|
|
||||||
if (editIndex != index) {
|
|
||||||
if (endEditing()) {
|
|
||||||
$('#accountData').datagrid('selectRow', index)
|
|
||||||
.datagrid('beginEdit', index);
|
|
||||||
editIndex = index;
|
|
||||||
autoReckon();
|
|
||||||
} else {
|
|
||||||
$('#accountData').datagrid('selectRow', editIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//新增
|
|
||||||
function append() {
|
|
||||||
if (endEditing()) {
|
|
||||||
$('#accountData').datagrid('appendRow', {});
|
|
||||||
editIndex = $('#accountData').datagrid('getRows').length - 1;
|
|
||||||
$('#accountData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
|
||||||
autoReckon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//删除
|
|
||||||
function removeit() {
|
|
||||||
if (editIndex == undefined) { return }
|
|
||||||
$('#accountData').datagrid('cancelEdit', editIndex)
|
|
||||||
.datagrid('deleteRow', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
}
|
|
||||||
//撤销
|
|
||||||
function reject() {
|
|
||||||
$('#accountData').datagrid('rejectChanges');
|
|
||||||
editIndex = undefined;
|
|
||||||
}
|
|
||||||
//判断
|
|
||||||
function CheckData() {
|
|
||||||
var row = $('#accountData').datagrid('getRows');
|
|
||||||
var totalRowNum = "";
|
|
||||||
for (var i = 0; i < row.length; i++) {
|
|
||||||
if(!itemType){
|
|
||||||
if (row[i].InOutItemId == "") {
|
|
||||||
totalRowNum += (i + 1) + "、";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if (row[i].AccountId == "") {
|
|
||||||
totalRowNum += (i + 1) + "、";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (totalRowNum != "") {
|
|
||||||
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
|
|
||||||
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) {
|
|
||||||
if (editIndex != undefined) {
|
|
||||||
$('#accountData').datagrid('endEdit', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
}
|
|
||||||
if (!CheckData())
|
|
||||||
return false;
|
|
||||||
var inserted = $("#accountData").datagrid('getChanges', "inserted");
|
|
||||||
var deleted = $("#accountData").datagrid('getChanges', "deleted");
|
|
||||||
var updated = $("#accountData").datagrid('getChanges', "updated");
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: url,
|
|
||||||
dataType: "json",
|
|
||||||
data: {
|
|
||||||
inserted: JSON.stringify(inserted),
|
|
||||||
deleted: JSON.stringify(deleted),
|
|
||||||
updated: JSON.stringify(updated),
|
|
||||||
info : JSON.stringify({
|
|
||||||
Type: listType,
|
|
||||||
BillNo: $.trim($("#BillNo").val()),
|
|
||||||
BillTime: $.trim($("#BillTime").val()),
|
|
||||||
AccountId: $.trim($("#AccountId").val()),
|
|
||||||
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付
|
|
||||||
TotalPrice: TotalPrice, //合计
|
|
||||||
OrganId: OrganId,
|
|
||||||
HandsPersonId: $.trim($("#HandsPersonId").val()),
|
|
||||||
Remark: $.trim($("#Remark").val())
|
|
||||||
}),
|
|
||||||
listType: listType
|
|
||||||
},
|
|
||||||
success: function (tipInfo)
|
|
||||||
{
|
|
||||||
if (tipInfo) {
|
|
||||||
$.messager.alert('提示','保存成功!','info');
|
|
||||||
$('#accountHeadDlg').dialog('close');
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
showAccountHeadDetails(opts.pageNumber, opts.pageSize);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
|
|
||||||
$.messager.show({
|
|
||||||
title: '错误提示',
|
|
||||||
msg: '保存信息失败,请稍后重试!'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
error: function (XmlHttpRequest, textStatus, errorThrown)
|
|
||||||
{
|
|
||||||
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,856 +0,0 @@
|
|||||||
//初始化界面
|
|
||||||
var listTitle="转账单列表";
|
|
||||||
var listType = "转账";
|
|
||||||
var itemType = true; //隐藏当前列
|
|
||||||
var moneyType = false; //显示当前列
|
|
||||||
var payTypeTitle = "无标题";
|
|
||||||
var inOrOut = "";
|
|
||||||
var organUrl = "/supplier/findBySelect_cus"; //客户接口
|
|
||||||
var amountNum = "ZZ";
|
|
||||||
$(function(){
|
|
||||||
initSystemData_person(); //经手人数据
|
|
||||||
initSelectInfo_person(); //经手人信息
|
|
||||||
initSystemData_account(); //账户数据
|
|
||||||
initSelectInfo_account(); //账户信息
|
|
||||||
initTableData();
|
|
||||||
ininPager();
|
|
||||||
initForm();
|
|
||||||
bindEvent();//绑定操作事件
|
|
||||||
$("#searchBtn").click();
|
|
||||||
});
|
|
||||||
//获取账户信息
|
|
||||||
function initSystemData_account(){
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/account/getAccount",
|
|
||||||
//设置为同步
|
|
||||||
async:false,
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
if(res.data) {
|
|
||||||
accountList = res.data.accountList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//获取账户信息
|
|
||||||
function initSelectInfo_account(){
|
|
||||||
var options = "";
|
|
||||||
if(accountList !=null)
|
|
||||||
{
|
|
||||||
options = "";
|
|
||||||
for(var i = 0 ;i < accountList.length; i++)
|
|
||||||
{
|
|
||||||
var account = accountList[i];
|
|
||||||
options += '<option value="' + account.id + '">' + account.name + '</option>';
|
|
||||||
}
|
|
||||||
$("#AccountId").empty().append(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//获取财务员
|
|
||||||
function initSystemData_person(){
|
|
||||||
var type = "财务员";
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/person/getPersonByType",
|
|
||||||
data: {
|
|
||||||
type: type
|
|
||||||
},
|
|
||||||
//设置为同步
|
|
||||||
async:false,
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
personList = res.data.personList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//获取财务员
|
|
||||||
function initSelectInfo_person(){
|
|
||||||
var options = "";
|
|
||||||
|
|
||||||
if(personList !=null)
|
|
||||||
{
|
|
||||||
for(var i = 0 ;i < personList.length;i++)
|
|
||||||
{
|
|
||||||
var person = personList[i];
|
|
||||||
if(0 == i)
|
|
||||||
{
|
|
||||||
personID = person.id;
|
|
||||||
}
|
|
||||||
if(person.type=="财务员")
|
|
||||||
{
|
|
||||||
options += '<option value="' + person.id + '">' + person.name + '</option>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$("#HandsPersonId").empty().append(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//防止表单提交重复
|
|
||||||
function initForm(){
|
|
||||||
$('#accountHeadFM').form({
|
|
||||||
onSubmit: function(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化表格数据
|
|
||||||
function initTableData(){
|
|
||||||
var organNameTitle = "";
|
|
||||||
var organNameHidden = true;
|
|
||||||
$('#tableData').datagrid({
|
|
||||||
//width:700,
|
|
||||||
height:heightInfo,
|
|
||||||
rownumbers: false,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//fitColumns:true,
|
|
||||||
//单击行是否选中
|
|
||||||
//checkOnSelect : false,
|
|
||||||
pagination: true,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
pageSize: 5,
|
|
||||||
pageList: initPageNum,
|
|
||||||
columns:[[
|
|
||||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
|
||||||
{ title: '操作',field: 'op',align:"center",width:90,formatter:function(value, rec,index) {
|
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/7 10:48
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js
|
|
||||||
*/
|
|
||||||
var str = '';
|
|
||||||
var orgId = rec.organid ? rec.organid : 0;
|
|
||||||
str += '<img title="查看" src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountHead(\'' + index + '\');"/> ';
|
|
||||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccountHead(\'' + index + '\');"/> ';
|
|
||||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccountHead('+ rec.id +',' + orgId +',' + rec.totalprice + ');"/>';
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ field: 'organid',width:5, hidden:true},
|
|
||||||
{ title: organNameTitle,field: 'organname',width:140,hidden:organNameHidden},
|
|
||||||
{ title: '单据编号',field: 'billno',width:140},
|
|
||||||
{ title: '经手人',field: 'handspersonname',width:80},
|
|
||||||
{ title: '单据时间 ',field: 'billtime',width:140},
|
|
||||||
{ title: '合计',field: 'totalprice',width:80},
|
|
||||||
{ title: '备注',field: 'remark',width:100}
|
|
||||||
]],
|
|
||||||
toolbar:[
|
|
||||||
{
|
|
||||||
id:'addAccountHead',
|
|
||||||
text:'增加',
|
|
||||||
iconCls:'icon-add',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
addAccountHead();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:'deleteAccountHead',
|
|
||||||
text:'删除',
|
|
||||||
iconCls:'icon-remove',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
batDeleteAccountHead();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
onLoadError:function()
|
|
||||||
{
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化表格数据-明细列表-编辑状态
|
|
||||||
function initTableData_account(type,TotalPrice){
|
|
||||||
$('#accountData').datagrid({
|
|
||||||
height:280,
|
|
||||||
rownumbers: false,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//单击行是否选中
|
|
||||||
checkOnSelect : false,
|
|
||||||
pagination: false,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
showFooter: true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
|
||||||
{ title: payTypeTitle,field: 'InOutItemId',width:230,hidden:itemType,
|
|
||||||
formatter:function(value,row,index){
|
|
||||||
return row.InOutItemName;
|
|
||||||
},
|
|
||||||
editor:{
|
|
||||||
type:'combobox',
|
|
||||||
options:{
|
|
||||||
valueField:'Id',
|
|
||||||
textField:'InOutItemName',
|
|
||||||
method:'get',
|
|
||||||
url: "/inOutItem/findBySelect?type=" + inOrOut
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ title: '账户名称',field: 'AccountId',width:230,hidden:moneyType,
|
|
||||||
formatter:function(value,row,index){
|
|
||||||
return row.AccountName;
|
|
||||||
},
|
|
||||||
editor:{
|
|
||||||
type:'combobox',
|
|
||||||
options:{
|
|
||||||
valueField:'Id',
|
|
||||||
textField:'AccountName',
|
|
||||||
method:'get',
|
|
||||||
url: "/account/findBySelect"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ title: '金额',field: 'EachAmount',editor:'validatebox',width:70},
|
|
||||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:150}
|
|
||||||
]],
|
|
||||||
toolbar:[
|
|
||||||
{
|
|
||||||
id:'append',
|
|
||||||
text:'新增',
|
|
||||||
iconCls:'icon-add',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
append(); //新增
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:'delete',
|
|
||||||
text:'删除',
|
|
||||||
iconCls:'icon-remove',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
removeit(); //删除
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:'reject',
|
|
||||||
text:'撤销',
|
|
||||||
iconCls:'icon-undo',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
reject(); //撤销
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
onLoadError:function()
|
|
||||||
{
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: '/accountItem/getDetailList',
|
|
||||||
data: {
|
|
||||||
headerId: accountHeadID
|
|
||||||
},
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
var data = res.data;
|
|
||||||
var EachAmount = 0;
|
|
||||||
if(type === "edit") {
|
|
||||||
EachAmount = TotalPrice;
|
|
||||||
}
|
|
||||||
var array = [];
|
|
||||||
array.push({
|
|
||||||
"EachAmount": EachAmount
|
|
||||||
});
|
|
||||||
data.footer = array;
|
|
||||||
$("#accountData").datagrid('loadData',data);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//初始化表格数据-明细列表-查看状态
|
|
||||||
function initTableData_account_show(TotalPrice){
|
|
||||||
$('#accountDataShow').datagrid({
|
|
||||||
height:280,
|
|
||||||
rownumbers: true,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//单击行是否选中
|
|
||||||
checkOnSelect : false,
|
|
||||||
pagination: false,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
showFooter: true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
|
||||||
{ title: payTypeTitle, field: 'InOutItemName', width:230, hidden:itemType},
|
|
||||||
{ title: '账户名称', field: 'AccountName', width:230, hidden:moneyType},
|
|
||||||
{ title: '金额',field: 'EachAmount',width:70},
|
|
||||||
{ title: '备注',field: 'Remark',width:150}
|
|
||||||
]],
|
|
||||||
onLoadError:function()
|
|
||||||
{
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: '/accountItem/getDetailList',
|
|
||||||
data: {
|
|
||||||
headerId: accountHeadID
|
|
||||||
},
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
var data = res.data;
|
|
||||||
var EachAmount = TotalPrice;
|
|
||||||
var array = [];
|
|
||||||
array.push({
|
|
||||||
"EachAmount": EachAmount
|
|
||||||
});
|
|
||||||
data.footer = array;
|
|
||||||
$("#accountDataShow").datagrid('loadData', data);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//分页信息处理
|
|
||||||
function ininPager(){
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
|
||||||
pager.pagination({
|
|
||||||
onSelectPage:function(pageNum, pageSize)
|
|
||||||
{
|
|
||||||
opts.pageNumber = pageNum;
|
|
||||||
opts.pageSize = pageSize;
|
|
||||||
pager.pagination('refresh',
|
|
||||||
{
|
|
||||||
pageNumber:pageNum,
|
|
||||||
pageSize:pageSize
|
|
||||||
});
|
|
||||||
showAccountHeadDetails(pageNum,pageSize);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (e)
|
|
||||||
{
|
|
||||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//删除财务信息
|
|
||||||
function deleteAccountHead(accountHeadID, thisOrganId, totalPrice){
|
|
||||||
$.messager.confirm('删除确认','确定要删除此财务信息吗?',function(r)
|
|
||||||
{
|
|
||||||
if (r)
|
|
||||||
{
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
|
||||||
dataType: "json",
|
|
||||||
data:{
|
|
||||||
ids: accountHeadID
|
|
||||||
},
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code == 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
} else {
|
|
||||||
if(res && res.code == 601){
|
|
||||||
var jsondata={};
|
|
||||||
jsondata.ids=accountHeadID;
|
|
||||||
jsondata.deleteType='2';
|
|
||||||
var type='single';
|
|
||||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
return;
|
|
||||||
}else{
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量删除财务信息
|
|
||||||
function batDeleteAccountHead(){
|
|
||||||
var row = $('#tableData').datagrid('getChecked');
|
|
||||||
if(row.length == 0)
|
|
||||||
{
|
|
||||||
$.messager.alert('删除提示','没有记录被选中!','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(row.length > 0)
|
|
||||||
{
|
|
||||||
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条财务信息吗?',function(r)
|
|
||||||
{
|
|
||||||
if (r)
|
|
||||||
{
|
|
||||||
var ids = "";
|
|
||||||
for(var i = 0;i < row.length; i ++) {
|
|
||||||
if(i == row.length-1)
|
|
||||||
{
|
|
||||||
ids += row[i].id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ids += row[i].id + ",";
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量删除
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
|
||||||
dataType: "json",
|
|
||||||
async : false,
|
|
||||||
data: ({
|
|
||||||
ids : ids
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
} else {
|
|
||||||
if(res && res.code == 601){
|
|
||||||
var jsondata={};
|
|
||||||
jsondata.ids=ids;
|
|
||||||
jsondata.deleteType='2';
|
|
||||||
var type='batch';
|
|
||||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
return;
|
|
||||||
}else{
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 确认强制删除
|
|
||||||
* */
|
|
||||||
function batDeleteAccountHeadForceConfirm(res,url,jsondata) {
|
|
||||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
|
||||||
if (r) {
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: url,
|
|
||||||
dataType: "json",
|
|
||||||
data: (jsondata),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code == 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
if(type=='batch'){
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
}
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
return;
|
|
||||||
}else {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error: function () {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//增加
|
|
||||||
function addAccountHead(){
|
|
||||||
$('#accountHeadFM').form('clear');
|
|
||||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
|
||||||
$("#BillTime").val(thisDateTime);
|
|
||||||
var thisNumber = getNowFormatDateNum(); //根据时间生成编号
|
|
||||||
$("#BillNo").val(amountNum + thisNumber).focus();
|
|
||||||
var addTitle = listTitle.replace("列表","信息");
|
|
||||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加' + addTitle);
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
|
|
||||||
orgAccountHead = "";
|
|
||||||
accountHeadID = 0;
|
|
||||||
initTableData_account("add"); //明细列表
|
|
||||||
reject(); //撤销下、刷新材料列表
|
|
||||||
url = '/accountHead/addAccountHeadAndDetail';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//编辑信息
|
|
||||||
function editAccountHead(index){
|
|
||||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
$("#BillNo").val(rowsdata.billno);
|
|
||||||
$("#BillTime").val(rowsdata.billtime);
|
|
||||||
$("#Remark").val(rowsdata.remark);
|
|
||||||
$("#AccountId").val(rowsdata.accountid);
|
|
||||||
// $('#OrganId').combobox('setValue', rowsdata.organid);
|
|
||||||
$("#HandsPersonId").val(rowsdata.handspersonid);
|
|
||||||
$("#ChangeAmount").val(rowsdata.changeamount);
|
|
||||||
var TotalPrice = rowsdata.totalprice;
|
|
||||||
preTotalPrice = rowsdata.totalprice; //记录前一次合计金额,用于收预付款
|
|
||||||
var editTitle = listTitle.replace("列表","信息");
|
|
||||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="' + '/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑' + editTitle);
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
accountHeadID = rowsdata.id;
|
|
||||||
|
|
||||||
initTableData_account("edit",TotalPrice); //明细列表
|
|
||||||
reject(); //撤销下、刷新列表
|
|
||||||
url = '/accountHead/updateAccountHeadAndDetail?id=' + rowsdata.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
//查看信息
|
|
||||||
function showAccountHead(index){
|
|
||||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
$("#BillNoShow").text(rowsdata.billno);
|
|
||||||
$("#BillTimeShow").text(rowsdata.billtime);
|
|
||||||
$("#RemarkShow").text(rowsdata.remark);
|
|
||||||
$("#AccountIdShow").text(rowsdata.accountname);
|
|
||||||
$('#OrganIdShow').text(rowsdata.organname);
|
|
||||||
$("#HandsPersonIdShow").text(rowsdata.handspersonname);
|
|
||||||
$("#ChangeAmountShow").text(rowsdata.rowsdata==undefined?'0':rowsdata.rowsdata);
|
|
||||||
var TotalPrice = rowsdata.totalprice;
|
|
||||||
var showTitle = listTitle.replace("列表","信息");
|
|
||||||
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/list.png"/> 查看' + showTitle);
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
|
|
||||||
accountHeadID = rowsdata.id;
|
|
||||||
initTableData_account_show(TotalPrice); //明细列表-查看状态
|
|
||||||
}
|
|
||||||
|
|
||||||
//绑定操作事件
|
|
||||||
function bindEvent(){
|
|
||||||
//搜索处理
|
|
||||||
$("#searchBtn").unbind().bind({
|
|
||||||
click:function()
|
|
||||||
{
|
|
||||||
showAccountHeadDetails(1,initPageSize);
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
|
||||||
opts.pageNumber = 1;
|
|
||||||
opts.pageSize = initPageSize;
|
|
||||||
pager.pagination('refresh', {
|
|
||||||
pageNumber:1,
|
|
||||||
pageSize:initPageSize
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//重置按钮
|
|
||||||
$("#searchResetBtn").unbind().bind({
|
|
||||||
click:function(){
|
|
||||||
$("#searchBillNo").val("");
|
|
||||||
$("#searchBeginTime").val("");
|
|
||||||
$("#searchEndTime").val("");
|
|
||||||
//加载完以后重新初始化
|
|
||||||
$("#searchBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//保存信息
|
|
||||||
$("#saveAccountHead").off("click").on("click", function () {
|
|
||||||
if(!$('#accountHeadFM').form('validate')){
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
if (!$('#HandsPersonId').val()) {
|
|
||||||
$.messager.alert('提示', '请选择经手人!', 'warning');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!$('#AccountId').val()) {
|
|
||||||
$.messager.alert('提示', '请选择付款账户!', 'warning');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var OrganId = null;
|
|
||||||
var ChangeAmount = $.trim($("#ChangeAmount").val());
|
|
||||||
var TotalPrice = $("#accountHeadFM .datagrid-footer [field='EachAmount'] div").text();
|
|
||||||
//支出为负数
|
|
||||||
ChangeAmount = 0 - ChangeAmount;
|
|
||||||
//支出和付款为负数
|
|
||||||
TotalPrice = 0 - TotalPrice;
|
|
||||||
saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//打印单据
|
|
||||||
$("#printAccountHeadShow").off("click").on("click",function(){
|
|
||||||
var tableString = $("#accountHeadDlgShow").html();
|
|
||||||
localStorage.setItem("tableString",tableString);
|
|
||||||
window.open("../../js/print/print_form.html","location:No;status:No;help:No;dialogWidth:800px;dialogHeight:600px;scroll:auto;");
|
|
||||||
});
|
|
||||||
|
|
||||||
//初始化键盘enter事件
|
|
||||||
$(document).keydown(function(event)
|
|
||||||
{
|
|
||||||
//兼容 IE和firefox 事件
|
|
||||||
var e = window.event || event;
|
|
||||||
var k = e.keyCode||e.which||e.charCode;
|
|
||||||
//兼容 IE,firefox 兼容
|
|
||||||
var obj = e.srcElement ? e.srcElement : e.target;
|
|
||||||
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
|
|
||||||
if(k == "13"&&(obj.id=="BillNo"||obj.id=="BillTime"))
|
|
||||||
{
|
|
||||||
$("#saveAccountHead").click();
|
|
||||||
}
|
|
||||||
//搜索按钮添加快捷键
|
|
||||||
if(k == "13"&&(obj.id=="searchBillNo"))
|
|
||||||
{
|
|
||||||
$("#searchBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showAccountHeadDetails(pageNo,pageSize){
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/accountHead/list",
|
|
||||||
dataType: "json",
|
|
||||||
data: ({
|
|
||||||
search: JSON.stringify({
|
|
||||||
type: listType,
|
|
||||||
billNo: $.trim($("#searchBillNo").val()),
|
|
||||||
beginTime: $("#searchBeginTime").val(),
|
|
||||||
endTime: $("#searchEndTime").val()
|
|
||||||
}),
|
|
||||||
currentPage: pageNo,
|
|
||||||
pageSize: pageSize
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200){
|
|
||||||
if(res.data && res.data.page) {
|
|
||||||
$("#tableData").datagrid('loadData', res.data.page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//自动计算事件
|
|
||||||
function autoReckon() {
|
|
||||||
//延时绑定事件
|
|
||||||
setTimeout(function(){
|
|
||||||
var body =$("#accountHeadFM .datagrid-body");
|
|
||||||
var footer =$("#accountHeadFM .datagrid-footer");
|
|
||||||
var input = ".datagrid-editable-input";
|
|
||||||
|
|
||||||
//修改金额,自动计算单价和合计
|
|
||||||
body.find("[field='EachAmount']").find(input).off("keyup").on("keyup",function(){
|
|
||||||
var TotalPrice = 0;
|
|
||||||
var EachAmount =$(this).val()-0; //金额
|
|
||||||
body.find("[field='EachAmount']").each(function(){
|
|
||||||
if($(this).find("div").text()!==""){
|
|
||||||
TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
TotalPrice = TotalPrice + EachAmount;
|
|
||||||
footer.find("[field='EachAmount']").find("div").text((TotalPrice).toFixed(2));
|
|
||||||
});
|
|
||||||
},500);
|
|
||||||
}
|
|
||||||
|
|
||||||
//结束编辑
|
|
||||||
function endEditing() {
|
|
||||||
var edField = "";
|
|
||||||
if(!itemType){
|
|
||||||
edField = "InOutItemId";
|
|
||||||
edName = "InOutItemName";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
edField = "AccountId";
|
|
||||||
edName = "AccountName";
|
|
||||||
}
|
|
||||||
if (editIndex == undefined) { return true }
|
|
||||||
if ($('#accountData').datagrid('validateRow', editIndex)) {
|
|
||||||
var ed = $('#accountData').datagrid('getEditor', {index: editIndex, field: edField});
|
|
||||||
var textName =null;
|
|
||||||
if($(ed.target)){
|
|
||||||
textName = $(ed.target).combobox('getText');
|
|
||||||
}
|
|
||||||
$('#accountData').datagrid('getRows')[editIndex][edName] = textName;
|
|
||||||
$('#accountData').datagrid('endEdit', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//单击
|
|
||||||
function onClickRow(index) {
|
|
||||||
if (editIndex != index) {
|
|
||||||
if (endEditing()) {
|
|
||||||
$('#accountData').datagrid('selectRow', index)
|
|
||||||
.datagrid('beginEdit', index);
|
|
||||||
editIndex = index;
|
|
||||||
autoReckon();
|
|
||||||
} else {
|
|
||||||
$('#accountData').datagrid('selectRow', editIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//新增
|
|
||||||
function append() {
|
|
||||||
if (endEditing()) {
|
|
||||||
$('#accountData').datagrid('appendRow', {});
|
|
||||||
editIndex = $('#accountData').datagrid('getRows').length - 1;
|
|
||||||
$('#accountData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
|
||||||
autoReckon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//删除
|
|
||||||
function removeit() {
|
|
||||||
if (editIndex == undefined) { return }
|
|
||||||
$('#accountData').datagrid('cancelEdit', editIndex)
|
|
||||||
.datagrid('deleteRow', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
}
|
|
||||||
//撤销
|
|
||||||
function reject() {
|
|
||||||
$('#accountData').datagrid('rejectChanges');
|
|
||||||
editIndex = undefined;
|
|
||||||
}
|
|
||||||
//判断
|
|
||||||
function CheckData() {
|
|
||||||
var row = $('#accountData').datagrid('getRows');
|
|
||||||
var totalRowNum = "";
|
|
||||||
for (var i = 0; i < row.length; i++) {
|
|
||||||
if(!itemType){
|
|
||||||
if (row[i].InOutItemId == "") {
|
|
||||||
totalRowNum += (i + 1) + "、";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if (row[i].AccountId == "") {
|
|
||||||
totalRowNum += (i + 1) + "、";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (totalRowNum != "") {
|
|
||||||
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
|
|
||||||
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) {
|
|
||||||
if (editIndex != undefined) {
|
|
||||||
$('#accountData').datagrid('endEdit', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
}
|
|
||||||
if (!CheckData())
|
|
||||||
return false;
|
|
||||||
var inserted = $("#accountData").datagrid('getChanges', "inserted");
|
|
||||||
var deleted = $("#accountData").datagrid('getChanges', "deleted");
|
|
||||||
var updated = $("#accountData").datagrid('getChanges', "updated");
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: url,
|
|
||||||
dataType: "json",
|
|
||||||
data: {
|
|
||||||
inserted: JSON.stringify(inserted),
|
|
||||||
deleted: JSON.stringify(deleted),
|
|
||||||
updated: JSON.stringify(updated),
|
|
||||||
info : JSON.stringify({
|
|
||||||
Type: listType,
|
|
||||||
BillNo: $.trim($("#BillNo").val()),
|
|
||||||
BillTime: $.trim($("#BillTime").val()),
|
|
||||||
AccountId: $.trim($("#AccountId").val()),
|
|
||||||
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付
|
|
||||||
TotalPrice: TotalPrice, //合计
|
|
||||||
OrganId: OrganId,
|
|
||||||
HandsPersonId: $.trim($("#HandsPersonId").val()),
|
|
||||||
Remark: $.trim($("#Remark").val())
|
|
||||||
}),
|
|
||||||
listType: listType
|
|
||||||
},
|
|
||||||
success: function (tipInfo)
|
|
||||||
{
|
|
||||||
if (tipInfo) {
|
|
||||||
$.messager.alert('提示','保存成功!','info');
|
|
||||||
$('#accountHeadDlg').dialog('close');
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
showAccountHeadDetails(opts.pageNumber, opts.pageSize);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
|
|
||||||
$.messager.show({
|
|
||||||
title: '错误提示',
|
|
||||||
msg: '保存信息失败,请稍后重试!'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
error: function (XmlHttpRequest, textStatus, errorThrown)
|
|
||||||
{
|
|
||||||
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,872 +0,0 @@
|
|||||||
//初始化界面
|
|
||||||
var listTitle ="收入单列表"
|
|
||||||
var listType = "收入";
|
|
||||||
var itemType = false; //显示当前列
|
|
||||||
var moneyType = true; //隐藏当前列
|
|
||||||
var payTypeTitle = "收入项目";
|
|
||||||
var inOrOut = "in";
|
|
||||||
var organUrl = "/supplier/findBySelect_cus"; //客户接口
|
|
||||||
var amountNum = "SR";
|
|
||||||
$(function(){
|
|
||||||
initSystemData_person(); //经手人数据
|
|
||||||
initSelectInfo_person(); //经手人信息
|
|
||||||
initSystemData_account(); //账户数据
|
|
||||||
initSelectInfo_account(); //账户信息
|
|
||||||
initSupplier(); //供应商
|
|
||||||
initTableData();
|
|
||||||
ininPager();
|
|
||||||
initForm();
|
|
||||||
bindEvent();//绑定操作事件
|
|
||||||
$("#searchBtn").click();
|
|
||||||
});
|
|
||||||
//获取账户信息
|
|
||||||
function initSystemData_account(){
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/account/getAccount",
|
|
||||||
//设置为同步
|
|
||||||
async:false,
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
if(res.data) {
|
|
||||||
accountList = res.data.accountList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//获取账户信息
|
|
||||||
function initSelectInfo_account(){
|
|
||||||
var options = "";
|
|
||||||
if(accountList !=null)
|
|
||||||
{
|
|
||||||
options = "";
|
|
||||||
for(var i = 0 ;i < accountList.length; i++)
|
|
||||||
{
|
|
||||||
var account = accountList[i];
|
|
||||||
options += '<option value="' + account.id + '">' + account.name + '</option>';
|
|
||||||
}
|
|
||||||
$("#AccountId").empty().append(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化单位信息
|
|
||||||
function initSupplier(){
|
|
||||||
$('#OrganId').combobox({
|
|
||||||
url: organUrl,
|
|
||||||
valueField:'id',
|
|
||||||
textField:'supplier',
|
|
||||||
formatter: function(row){
|
|
||||||
var opts = $(this).combobox('options');
|
|
||||||
if(row[opts.textField]!=="非会员") {
|
|
||||||
return row[opts.textField];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取财务员
|
|
||||||
function initSystemData_person(){
|
|
||||||
var type = "财务员";
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/person/getPersonByType",
|
|
||||||
data: {
|
|
||||||
type: type
|
|
||||||
},
|
|
||||||
//设置为同步
|
|
||||||
async:false,
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
personList = res.data.personList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//获取财务员
|
|
||||||
function initSelectInfo_person(){
|
|
||||||
var options = "";
|
|
||||||
|
|
||||||
if(personList !=null)
|
|
||||||
{
|
|
||||||
for(var i = 0 ;i < personList.length;i++)
|
|
||||||
{
|
|
||||||
var person = personList[i];
|
|
||||||
if(0 == i)
|
|
||||||
{
|
|
||||||
personID = person.id;
|
|
||||||
}
|
|
||||||
if(person.type=="财务员")
|
|
||||||
{
|
|
||||||
options += '<option value="' + person.id + '">' + person.name + '</option>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$("#HandsPersonId").empty().append(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//防止表单提交重复
|
|
||||||
function initForm(){
|
|
||||||
$('#accountHeadFM').form({
|
|
||||||
onSubmit: function(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化表格数据
|
|
||||||
function initTableData(){
|
|
||||||
var organNameTitle = "往来单位";
|
|
||||||
var organNameHidden = false;
|
|
||||||
$('#tableData').datagrid({
|
|
||||||
//width:700,
|
|
||||||
height:heightInfo,
|
|
||||||
rownumbers: false,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//fitColumns:true,
|
|
||||||
//单击行是否选中
|
|
||||||
//checkOnSelect : false,
|
|
||||||
pagination: true,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
pageSize: 5,
|
|
||||||
pageList: initPageNum,
|
|
||||||
columns:[[
|
|
||||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
|
||||||
{ title: '操作',field: 'op',align:"center",width:90,formatter:function(value, rec,index) {
|
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/7 10:48
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js
|
|
||||||
*/
|
|
||||||
var str = '';
|
|
||||||
var orgId = rec.organid ? rec.organid : 0;
|
|
||||||
str += '<img title="查看" src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountHead(\'' + index + '\');"/> ';
|
|
||||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccountHead(\'' + index + '\');"/> ';
|
|
||||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccountHead('+ rec.id +',' + orgId +',' + rec.totalprice + ');"/>';
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ field: 'organid',width:5, hidden:true},
|
|
||||||
{ title: organNameTitle,field: 'organname',width:140,hidden:organNameHidden},
|
|
||||||
{ title: '单据编号',field: 'billno',width:140},
|
|
||||||
{ title: '经手人',field: 'handspersonname',width:80},
|
|
||||||
{ title: '单据时间 ',field: 'billtime',width:140},
|
|
||||||
{ title: '合计',field: 'totalprice',width:80},
|
|
||||||
{ title: '备注',field: 'remark',width:100}
|
|
||||||
]],
|
|
||||||
toolbar:[
|
|
||||||
{
|
|
||||||
id:'addAccountHead',
|
|
||||||
text:'增加',
|
|
||||||
iconCls:'icon-add',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
addAccountHead();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:'deleteAccountHead',
|
|
||||||
text:'删除',
|
|
||||||
iconCls:'icon-remove',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
batDeleteAccountHead();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
onLoadError:function()
|
|
||||||
{
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化表格数据-明细列表-编辑状态
|
|
||||||
function initTableData_account(type,TotalPrice){
|
|
||||||
$('#accountData').datagrid({
|
|
||||||
height:280,
|
|
||||||
rownumbers: false,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//单击行是否选中
|
|
||||||
checkOnSelect : false,
|
|
||||||
pagination: false,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
showFooter: true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
|
||||||
{ title: payTypeTitle,field: 'InOutItemId',width:230,hidden:itemType,
|
|
||||||
formatter:function(value,row,index){
|
|
||||||
return row.InOutItemName;
|
|
||||||
},
|
|
||||||
editor:{
|
|
||||||
type:'combobox',
|
|
||||||
options:{
|
|
||||||
valueField:'Id',
|
|
||||||
textField:'InOutItemName',
|
|
||||||
method:'get',
|
|
||||||
url: "/inOutItem/findBySelect?type=" + inOrOut
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ title: '账户名称',field: 'AccountId',width:230,hidden:moneyType,
|
|
||||||
formatter:function(value,row,index){
|
|
||||||
return row.AccountName;
|
|
||||||
},
|
|
||||||
editor:{
|
|
||||||
type:'combobox',
|
|
||||||
options:{
|
|
||||||
valueField:'Id',
|
|
||||||
textField:'AccountName',
|
|
||||||
method:'get',
|
|
||||||
url: "/account/findBySelect"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ title: '金额',field: 'EachAmount',editor:'validatebox',width:70},
|
|
||||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:150}
|
|
||||||
]],
|
|
||||||
toolbar:[
|
|
||||||
{
|
|
||||||
id:'append',
|
|
||||||
text:'新增',
|
|
||||||
iconCls:'icon-add',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
append(); //新增
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:'delete',
|
|
||||||
text:'删除',
|
|
||||||
iconCls:'icon-remove',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
removeit(); //删除
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:'reject',
|
|
||||||
text:'撤销',
|
|
||||||
iconCls:'icon-undo',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
reject(); //撤销
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
onLoadError:function()
|
|
||||||
{
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: '/accountItem/getDetailList',
|
|
||||||
data: {
|
|
||||||
headerId: accountHeadID
|
|
||||||
},
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
var data = res.data;
|
|
||||||
var EachAmount = 0;
|
|
||||||
if(type === "edit") {
|
|
||||||
EachAmount = TotalPrice;
|
|
||||||
}
|
|
||||||
var array = [];
|
|
||||||
array.push({
|
|
||||||
"EachAmount": EachAmount
|
|
||||||
});
|
|
||||||
data.footer = array;
|
|
||||||
$("#accountData").datagrid('loadData',data);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//初始化表格数据-明细列表-查看状态
|
|
||||||
function initTableData_account_show(TotalPrice){
|
|
||||||
$('#accountDataShow').datagrid({
|
|
||||||
height:280,
|
|
||||||
rownumbers: true,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//单击行是否选中
|
|
||||||
checkOnSelect : false,
|
|
||||||
pagination: false,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
showFooter: true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
|
||||||
{ title: payTypeTitle, field: 'InOutItemName', width:230, hidden:itemType},
|
|
||||||
{ title: '账户名称', field: 'AccountName', width:230, hidden:moneyType},
|
|
||||||
{ title: '金额',field: 'EachAmount',width:70},
|
|
||||||
{ title: '备注',field: 'Remark',width:150}
|
|
||||||
]],
|
|
||||||
onLoadError:function()
|
|
||||||
{
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: '/accountItem/getDetailList',
|
|
||||||
data: {
|
|
||||||
headerId: accountHeadID
|
|
||||||
},
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
var data = res.data;
|
|
||||||
var EachAmount = TotalPrice;
|
|
||||||
var array = [];
|
|
||||||
array.push({
|
|
||||||
"EachAmount": EachAmount
|
|
||||||
});
|
|
||||||
data.footer = array;
|
|
||||||
$("#accountDataShow").datagrid('loadData', data);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//分页信息处理
|
|
||||||
function ininPager(){
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
|
||||||
pager.pagination({
|
|
||||||
onSelectPage:function(pageNum, pageSize)
|
|
||||||
{
|
|
||||||
opts.pageNumber = pageNum;
|
|
||||||
opts.pageSize = pageSize;
|
|
||||||
pager.pagination('refresh',
|
|
||||||
{
|
|
||||||
pageNumber:pageNum,
|
|
||||||
pageSize:pageSize
|
|
||||||
});
|
|
||||||
showAccountHeadDetails(pageNum,pageSize);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (e)
|
|
||||||
{
|
|
||||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//删除财务信息
|
|
||||||
function deleteAccountHead(accountHeadID, thisOrganId, totalPrice){
|
|
||||||
$.messager.confirm('删除确认','确定要删除此财务信息吗?',function(r)
|
|
||||||
{
|
|
||||||
if (r)
|
|
||||||
{
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
|
||||||
dataType: "json",
|
|
||||||
data:{
|
|
||||||
ids: accountHeadID
|
|
||||||
},
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code == 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
} else {
|
|
||||||
if(res && res.code == 601){
|
|
||||||
var jsondata={};
|
|
||||||
jsondata.ids=accountHeadID;
|
|
||||||
jsondata.deleteType='2';
|
|
||||||
var type='single';
|
|
||||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
return;
|
|
||||||
}else{
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量删除财务信息
|
|
||||||
function batDeleteAccountHead(){
|
|
||||||
var row = $('#tableData').datagrid('getChecked');
|
|
||||||
if(row.length == 0)
|
|
||||||
{
|
|
||||||
$.messager.alert('删除提示','没有记录被选中!','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(row.length > 0)
|
|
||||||
{
|
|
||||||
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条财务信息吗?',function(r)
|
|
||||||
{
|
|
||||||
if (r)
|
|
||||||
{
|
|
||||||
var ids = "";
|
|
||||||
for(var i = 0;i < row.length; i ++) {
|
|
||||||
if(i == row.length-1)
|
|
||||||
{
|
|
||||||
ids += row[i].id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ids += row[i].id + ",";
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量删除
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
|
||||||
dataType: "json",
|
|
||||||
async : false,
|
|
||||||
data: ({
|
|
||||||
ids : ids
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
} else {
|
|
||||||
if(res && res.code == 601){
|
|
||||||
var jsondata={};
|
|
||||||
jsondata.ids=ids;
|
|
||||||
jsondata.deleteType='2';
|
|
||||||
var type='batch';
|
|
||||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
return;
|
|
||||||
}else{
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 确认强制删除
|
|
||||||
* */
|
|
||||||
function batDeleteAccountHeadForceConfirm(res,url,jsondata) {
|
|
||||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
|
||||||
if (r) {
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: url,
|
|
||||||
dataType: "json",
|
|
||||||
data: (jsondata),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code == 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
if(type=='batch'){
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
}
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
return;
|
|
||||||
}else {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error: function () {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//增加
|
|
||||||
function addAccountHead(){
|
|
||||||
$('#accountHeadFM').form('clear');
|
|
||||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
|
||||||
$("#BillTime").val(thisDateTime);
|
|
||||||
var thisNumber = getNowFormatDateNum(); //根据时间生成编号
|
|
||||||
$("#BillNo").val(amountNum + thisNumber).focus();
|
|
||||||
var addTitle = listTitle.replace("列表","信息");
|
|
||||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加' + addTitle);
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
|
|
||||||
orgAccountHead = "";
|
|
||||||
accountHeadID = 0;
|
|
||||||
initTableData_account("add"); //明细列表
|
|
||||||
reject(); //撤销下、刷新材料列表
|
|
||||||
url = '/accountHead/addAccountHeadAndDetail';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//编辑信息
|
|
||||||
function editAccountHead(index){
|
|
||||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
$("#BillNo").val(rowsdata.billno);
|
|
||||||
$("#BillTime").val(rowsdata.billtime);
|
|
||||||
$("#Remark").val(rowsdata.remark);
|
|
||||||
$("#AccountId").val(rowsdata.accountid);
|
|
||||||
$('#OrganId').combobox('setValue', rowsdata.organid);
|
|
||||||
$("#HandsPersonId").val(rowsdata.handspersonid);
|
|
||||||
$("#ChangeAmount").val(rowsdata.changeamount);
|
|
||||||
var TotalPrice = rowsdata.totalprice;
|
|
||||||
preTotalPrice = rowsdata.totalprice; //记录前一次合计金额,用于收预付款
|
|
||||||
var editTitle = listTitle.replace("列表","信息");
|
|
||||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="' + '/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑' + editTitle);
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
accountHeadID = rowsdata.id;
|
|
||||||
|
|
||||||
initTableData_account("edit",TotalPrice); //明细列表
|
|
||||||
reject(); //撤销下、刷新列表
|
|
||||||
url = '/accountHead/updateAccountHeadAndDetail?id=' + rowsdata.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
//查看信息
|
|
||||||
function showAccountHead(index){
|
|
||||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
$("#BillNoShow").text(rowsdata.billno);
|
|
||||||
$("#BillTimeShow").text(rowsdata.billtime);
|
|
||||||
$("#RemarkShow").text(rowsdata.remark);
|
|
||||||
$("#AccountIdShow").text(rowsdata.accountname);
|
|
||||||
$('#OrganIdShow').text(rowsdata.organname);
|
|
||||||
$("#HandsPersonIdShow").text(rowsdata.handspersonname);
|
|
||||||
$("#ChangeAmountShow").text(rowsdata.rowsdata==undefined?'0':rowsdata.rowsdata);
|
|
||||||
var TotalPrice = rowsdata.totalprice;
|
|
||||||
var showTitle = listTitle.replace("列表","信息");
|
|
||||||
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/list.png"/> 查看' + showTitle);
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
|
|
||||||
accountHeadID = rowsdata.id;
|
|
||||||
initTableData_account_show(TotalPrice); //明细列表-查看状态
|
|
||||||
}
|
|
||||||
|
|
||||||
//绑定操作事件
|
|
||||||
function bindEvent(){
|
|
||||||
//搜索处理
|
|
||||||
$("#searchBtn").unbind().bind({
|
|
||||||
click:function()
|
|
||||||
{
|
|
||||||
showAccountHeadDetails(1,initPageSize);
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
|
||||||
opts.pageNumber = 1;
|
|
||||||
opts.pageSize = initPageSize;
|
|
||||||
pager.pagination('refresh', {
|
|
||||||
pageNumber:1,
|
|
||||||
pageSize:initPageSize
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//重置按钮
|
|
||||||
$("#searchResetBtn").unbind().bind({
|
|
||||||
click:function(){
|
|
||||||
$("#searchBillNo").val("");
|
|
||||||
$("#searchBeginTime").val("");
|
|
||||||
$("#searchEndTime").val("");
|
|
||||||
//加载完以后重新初始化
|
|
||||||
$("#searchBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//保存信息
|
|
||||||
$("#saveAccountHead").off("click").on("click", function () {
|
|
||||||
if(!$('#accountHeadFM').form('validate')){
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
if (!$('#AccountId').val()) {
|
|
||||||
$.messager.alert('提示', '请选择收款账户!', 'warning');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!$('#OrganId').combobox('getValue')) {
|
|
||||||
$.messager.alert('提示', '请选择往来单位!', 'warning');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!$('#HandsPersonId').val()) {
|
|
||||||
$.messager.alert('提示', '请选择经手人!', 'warning');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var ChangeAmount = $.trim($("#ChangeAmount").val());
|
|
||||||
var TotalPrice = $("#accountHeadFM .datagrid-footer [field='EachAmount'] div").text();
|
|
||||||
var OrganId = $('#OrganId').combobox('getValue');
|
|
||||||
|
|
||||||
saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//打印单据
|
|
||||||
$("#printAccountHeadShow").off("click").on("click",function(){
|
|
||||||
var tableString = $("#accountHeadDlgShow").html();
|
|
||||||
localStorage.setItem("tableString",tableString);
|
|
||||||
window.open("../../js/print/print_form.html","location:No;status:No;help:No;dialogWidth:800px;dialogHeight:600px;scroll:auto;");
|
|
||||||
});
|
|
||||||
|
|
||||||
//初始化键盘enter事件
|
|
||||||
$(document).keydown(function(event)
|
|
||||||
{
|
|
||||||
//兼容 IE和firefox 事件
|
|
||||||
var e = window.event || event;
|
|
||||||
var k = e.keyCode||e.which||e.charCode;
|
|
||||||
//兼容 IE,firefox 兼容
|
|
||||||
var obj = e.srcElement ? e.srcElement : e.target;
|
|
||||||
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
|
|
||||||
if(k == "13"&&(obj.id=="BillNo"||obj.id=="BillTime"))
|
|
||||||
{
|
|
||||||
$("#saveAccountHead").click();
|
|
||||||
}
|
|
||||||
//搜索按钮添加快捷键
|
|
||||||
if(k == "13"&&(obj.id=="searchBillNo"))
|
|
||||||
{
|
|
||||||
$("#searchBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showAccountHeadDetails(pageNo,pageSize){
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/accountHead/list",
|
|
||||||
dataType: "json",
|
|
||||||
data: ({
|
|
||||||
search: JSON.stringify({
|
|
||||||
type: listType,
|
|
||||||
billNo: $.trim($("#searchBillNo").val()),
|
|
||||||
beginTime: $("#searchBeginTime").val(),
|
|
||||||
endTime: $("#searchEndTime").val()
|
|
||||||
}),
|
|
||||||
currentPage: pageNo,
|
|
||||||
pageSize: pageSize
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200){
|
|
||||||
if(res.data && res.data.page) {
|
|
||||||
$("#tableData").datagrid('loadData', res.data.page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//自动计算事件
|
|
||||||
function autoReckon() {
|
|
||||||
//延时绑定事件
|
|
||||||
setTimeout(function(){
|
|
||||||
var body =$("#accountHeadFM .datagrid-body");
|
|
||||||
var footer =$("#accountHeadFM .datagrid-footer");
|
|
||||||
var input = ".datagrid-editable-input";
|
|
||||||
|
|
||||||
//修改金额,自动计算单价和合计
|
|
||||||
body.find("[field='EachAmount']").find(input).off("keyup").on("keyup",function(){
|
|
||||||
var TotalPrice = 0;
|
|
||||||
var EachAmount =$(this).val()-0; //金额
|
|
||||||
body.find("[field='EachAmount']").each(function(){
|
|
||||||
if($(this).find("div").text()!==""){
|
|
||||||
TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
TotalPrice = TotalPrice + EachAmount;
|
|
||||||
footer.find("[field='EachAmount']").find("div").text((TotalPrice).toFixed(2));
|
|
||||||
});
|
|
||||||
},500);
|
|
||||||
}
|
|
||||||
|
|
||||||
//结束编辑
|
|
||||||
function endEditing() {
|
|
||||||
var edField = "";
|
|
||||||
if(!itemType){
|
|
||||||
edField = "InOutItemId";
|
|
||||||
edName = "InOutItemName";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
edField = "AccountId";
|
|
||||||
edName = "AccountName";
|
|
||||||
}
|
|
||||||
if (editIndex == undefined) { return true }
|
|
||||||
if ($('#accountData').datagrid('validateRow', editIndex)) {
|
|
||||||
var ed = $('#accountData').datagrid('getEditor', {index: editIndex, field: edField});
|
|
||||||
var textName =null;
|
|
||||||
if($(ed.target)){
|
|
||||||
textName = $(ed.target).combobox('getText');
|
|
||||||
}
|
|
||||||
$('#accountData').datagrid('getRows')[editIndex][edName] = textName;
|
|
||||||
$('#accountData').datagrid('endEdit', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//单击
|
|
||||||
function onClickRow(index) {
|
|
||||||
if (editIndex != index) {
|
|
||||||
if (endEditing()) {
|
|
||||||
$('#accountData').datagrid('selectRow', index)
|
|
||||||
.datagrid('beginEdit', index);
|
|
||||||
editIndex = index;
|
|
||||||
autoReckon();
|
|
||||||
} else {
|
|
||||||
$('#accountData').datagrid('selectRow', editIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//新增
|
|
||||||
function append() {
|
|
||||||
if (endEditing()) {
|
|
||||||
$('#accountData').datagrid('appendRow', {});
|
|
||||||
editIndex = $('#accountData').datagrid('getRows').length - 1;
|
|
||||||
$('#accountData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
|
||||||
autoReckon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//删除
|
|
||||||
function removeit() {
|
|
||||||
if (editIndex == undefined) { return }
|
|
||||||
$('#accountData').datagrid('cancelEdit', editIndex)
|
|
||||||
.datagrid('deleteRow', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
}
|
|
||||||
//撤销
|
|
||||||
function reject() {
|
|
||||||
$('#accountData').datagrid('rejectChanges');
|
|
||||||
editIndex = undefined;
|
|
||||||
}
|
|
||||||
//判断
|
|
||||||
function CheckData() {
|
|
||||||
var row = $('#accountData').datagrid('getRows');
|
|
||||||
var totalRowNum = "";
|
|
||||||
for (var i = 0; i < row.length; i++) {
|
|
||||||
if(!itemType){
|
|
||||||
if (row[i].InOutItemId == "") {
|
|
||||||
totalRowNum += (i + 1) + "、";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if (row[i].AccountId == "") {
|
|
||||||
totalRowNum += (i + 1) + "、";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (totalRowNum != "") {
|
|
||||||
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
|
|
||||||
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) {
|
|
||||||
if (editIndex != undefined) {
|
|
||||||
$('#accountData').datagrid('endEdit', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
}
|
|
||||||
if (!CheckData())
|
|
||||||
return false;
|
|
||||||
var inserted = $("#accountData").datagrid('getChanges', "inserted");
|
|
||||||
var deleted = $("#accountData").datagrid('getChanges', "deleted");
|
|
||||||
var updated = $("#accountData").datagrid('getChanges', "updated");
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: url,
|
|
||||||
dataType: "json",
|
|
||||||
data: {
|
|
||||||
inserted: JSON.stringify(inserted),
|
|
||||||
deleted: JSON.stringify(deleted),
|
|
||||||
updated: JSON.stringify(updated),
|
|
||||||
info : JSON.stringify({
|
|
||||||
Type: listType,
|
|
||||||
BillNo: $.trim($("#BillNo").val()),
|
|
||||||
BillTime: $.trim($("#BillTime").val()),
|
|
||||||
AccountId: $.trim($("#AccountId").val()),
|
|
||||||
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付
|
|
||||||
TotalPrice: TotalPrice, //合计
|
|
||||||
OrganId: OrganId,
|
|
||||||
HandsPersonId: $.trim($("#HandsPersonId").val()),
|
|
||||||
Remark: $.trim($("#Remark").val())
|
|
||||||
}),
|
|
||||||
listType: listType
|
|
||||||
},
|
|
||||||
success: function (tipInfo)
|
|
||||||
{
|
|
||||||
if (tipInfo) {
|
|
||||||
$.messager.alert('提示','保存成功!','info');
|
|
||||||
$('#accountHeadDlg').dialog('close');
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
showAccountHeadDetails(opts.pageNumber, opts.pageSize);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
|
|
||||||
$.messager.show({
|
|
||||||
title: '错误提示',
|
|
||||||
msg: '保存信息失败,请稍后重试!'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
error: function (XmlHttpRequest, textStatus, errorThrown)
|
|
||||||
{
|
|
||||||
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,878 +0,0 @@
|
|||||||
//初始化界面
|
|
||||||
var listTitle ="支出单列表";
|
|
||||||
var listType = "支出";
|
|
||||||
var itemType = false; //显示当前列
|
|
||||||
var moneyType = true; //隐藏当前列
|
|
||||||
var payTypeTitle = "支出项目";
|
|
||||||
var inOrOut = "out";
|
|
||||||
var organUrl = "/supplier/findBySelect_sup"; //供应商接口
|
|
||||||
var amountNum = "ZC";
|
|
||||||
$(function(){
|
|
||||||
initSystemData_person(); //经手人数据
|
|
||||||
initSelectInfo_person(); //经手人信息
|
|
||||||
initSystemData_account(); //账户数据
|
|
||||||
initSelectInfo_account(); //账户信息
|
|
||||||
initSupplier(); //供应商
|
|
||||||
initTableData();
|
|
||||||
ininPager();
|
|
||||||
initForm();
|
|
||||||
bindEvent();//绑定操作事件
|
|
||||||
$("#searchBtn").click();
|
|
||||||
});
|
|
||||||
|
|
||||||
//获取账户信息
|
|
||||||
function initSystemData_account(){
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/account/getAccount",
|
|
||||||
//设置为同步
|
|
||||||
async:false,
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
if(res.data) {
|
|
||||||
accountList = res.data.accountList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//获取账户信息
|
|
||||||
function initSelectInfo_account(){
|
|
||||||
var options = "";
|
|
||||||
if(accountList !=null)
|
|
||||||
{
|
|
||||||
options = "";
|
|
||||||
for(var i = 0 ;i < accountList.length; i++)
|
|
||||||
{
|
|
||||||
var account = accountList[i];
|
|
||||||
options += '<option value="' + account.id + '">' + account.name + '</option>';
|
|
||||||
}
|
|
||||||
$("#AccountId").empty().append(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化单位信息
|
|
||||||
function initSupplier(){
|
|
||||||
$('#OrganId').combobox({
|
|
||||||
url: organUrl,
|
|
||||||
valueField:'id',
|
|
||||||
textField:'supplier',
|
|
||||||
formatter: function(row){
|
|
||||||
var opts = $(this).combobox('options');
|
|
||||||
if(row[opts.textField]!=="非会员") {
|
|
||||||
return row[opts.textField];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取财务员
|
|
||||||
function initSystemData_person(){
|
|
||||||
var type = "财务员";
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/person/getPersonByType",
|
|
||||||
data: {
|
|
||||||
type: type
|
|
||||||
},
|
|
||||||
//设置为同步
|
|
||||||
async:false,
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
personList = res.data.personList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//获取财务员
|
|
||||||
function initSelectInfo_person(){
|
|
||||||
var options = "";
|
|
||||||
|
|
||||||
if(personList !=null)
|
|
||||||
{
|
|
||||||
for(var i = 0 ;i < personList.length;i++)
|
|
||||||
{
|
|
||||||
var person = personList[i];
|
|
||||||
if(0 == i)
|
|
||||||
{
|
|
||||||
personID = person.id;
|
|
||||||
}
|
|
||||||
if(person.type=="财务员")
|
|
||||||
{
|
|
||||||
options += '<option value="' + person.id + '">' + person.name + '</option>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$("#HandsPersonId").empty().append(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//防止表单提交重复
|
|
||||||
function initForm(){
|
|
||||||
$('#accountHeadFM').form({
|
|
||||||
onSubmit: function(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化表格数据
|
|
||||||
function initTableData(){
|
|
||||||
var organNameTitle = "往来单位";
|
|
||||||
var organNameHidden = false;
|
|
||||||
$('#tableData').datagrid({
|
|
||||||
//width:700,
|
|
||||||
height:heightInfo,
|
|
||||||
rownumbers: false,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//fitColumns:true,
|
|
||||||
//单击行是否选中
|
|
||||||
//checkOnSelect : false,
|
|
||||||
pagination: true,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
pageSize: 5,
|
|
||||||
pageList: initPageNum,
|
|
||||||
columns:[[
|
|
||||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
|
||||||
{ title: '操作',field: 'op',align:"center",width:90,formatter:function(value, rec,index) {
|
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/7 10:48
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js
|
|
||||||
*/
|
|
||||||
var str = '';
|
|
||||||
var orgId = rec.organid ? rec.organid : 0;
|
|
||||||
str += '<img title="查看" src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountHead(\'' + index + '\');"/> ';
|
|
||||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccountHead(\'' + index + '\');"/> ';
|
|
||||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccountHead('+ rec.id +',' + orgId +',' + rec.totalprice + ');"/>';
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ field: 'organid',width:5, hidden:true},
|
|
||||||
{ title: organNameTitle,field: 'organname',width:140,hidden:organNameHidden},
|
|
||||||
{ title: '单据编号',field: 'billno',width:140},
|
|
||||||
{ title: '经手人',field: 'handspersonname',width:80},
|
|
||||||
{ title: '单据时间 ',field: 'billtime',width:140},
|
|
||||||
{ title: '合计',field: 'totalprice',width:80},
|
|
||||||
{ title: '备注',field: 'remark',width:100}
|
|
||||||
]],
|
|
||||||
toolbar:[
|
|
||||||
{
|
|
||||||
id:'addAccountHead',
|
|
||||||
text:'增加',
|
|
||||||
iconCls:'icon-add',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
addAccountHead();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:'deleteAccountHead',
|
|
||||||
text:'删除',
|
|
||||||
iconCls:'icon-remove',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
batDeleteAccountHead();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
onLoadError:function()
|
|
||||||
{
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化表格数据-明细列表-编辑状态
|
|
||||||
function initTableData_account(type,TotalPrice){
|
|
||||||
$('#accountData').datagrid({
|
|
||||||
height:280,
|
|
||||||
rownumbers: false,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//单击行是否选中
|
|
||||||
checkOnSelect : false,
|
|
||||||
pagination: false,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
showFooter: true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
|
||||||
{ title: payTypeTitle,field: 'InOutItemId',width:230,hidden:itemType,
|
|
||||||
formatter:function(value,row,index){
|
|
||||||
return row.InOutItemName;
|
|
||||||
},
|
|
||||||
editor:{
|
|
||||||
type:'combobox',
|
|
||||||
options:{
|
|
||||||
valueField:'Id',
|
|
||||||
textField:'InOutItemName',
|
|
||||||
method:'get',
|
|
||||||
url: "/inOutItem/findBySelect?type=" + inOrOut
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ title: '账户名称',field: 'AccountId',width:230,hidden:moneyType,
|
|
||||||
formatter:function(value,row,index){
|
|
||||||
return row.AccountName;
|
|
||||||
},
|
|
||||||
editor:{
|
|
||||||
type:'combobox',
|
|
||||||
options:{
|
|
||||||
valueField:'Id',
|
|
||||||
textField:'AccountName',
|
|
||||||
method:'get',
|
|
||||||
url: "/account/findBySelect"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ title: '金额',field: 'EachAmount',editor:'validatebox',width:70},
|
|
||||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:150}
|
|
||||||
]],
|
|
||||||
toolbar:[
|
|
||||||
{
|
|
||||||
id:'append',
|
|
||||||
text:'新增',
|
|
||||||
iconCls:'icon-add',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
append(); //新增
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:'delete',
|
|
||||||
text:'删除',
|
|
||||||
iconCls:'icon-remove',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
removeit(); //删除
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:'reject',
|
|
||||||
text:'撤销',
|
|
||||||
iconCls:'icon-undo',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
reject(); //撤销
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
onLoadError:function()
|
|
||||||
{
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: '/accountItem/getDetailList',
|
|
||||||
data: {
|
|
||||||
headerId: accountHeadID
|
|
||||||
},
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
var data = res.data;
|
|
||||||
var EachAmount = 0;
|
|
||||||
if(type === "edit") {
|
|
||||||
EachAmount = TotalPrice;
|
|
||||||
}
|
|
||||||
var array = [];
|
|
||||||
array.push({
|
|
||||||
"EachAmount": EachAmount
|
|
||||||
});
|
|
||||||
data.footer = array;
|
|
||||||
$("#accountData").datagrid('loadData',data);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//初始化表格数据-明细列表-查看状态
|
|
||||||
function initTableData_account_show(TotalPrice){
|
|
||||||
$('#accountDataShow').datagrid({
|
|
||||||
height:280,
|
|
||||||
rownumbers: true,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//单击行是否选中
|
|
||||||
checkOnSelect : false,
|
|
||||||
pagination: false,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
showFooter: true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
|
||||||
{ title: payTypeTitle, field: 'InOutItemName', width:230, hidden:itemType},
|
|
||||||
{ title: '账户名称', field: 'AccountName', width:230, hidden:moneyType},
|
|
||||||
{ title: '金额',field: 'EachAmount',width:70},
|
|
||||||
{ title: '备注',field: 'Remark',width:150}
|
|
||||||
]],
|
|
||||||
onLoadError:function()
|
|
||||||
{
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: '/accountItem/getDetailList',
|
|
||||||
data: {
|
|
||||||
headerId: accountHeadID
|
|
||||||
},
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
var data = res.data;
|
|
||||||
var EachAmount = TotalPrice;
|
|
||||||
var array = [];
|
|
||||||
array.push({
|
|
||||||
"EachAmount": EachAmount
|
|
||||||
});
|
|
||||||
data.footer = array;
|
|
||||||
$("#accountDataShow").datagrid('loadData', data);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//分页信息处理
|
|
||||||
function ininPager(){
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
|
||||||
pager.pagination({
|
|
||||||
onSelectPage:function(pageNum, pageSize)
|
|
||||||
{
|
|
||||||
opts.pageNumber = pageNum;
|
|
||||||
opts.pageSize = pageSize;
|
|
||||||
pager.pagination('refresh',
|
|
||||||
{
|
|
||||||
pageNumber:pageNum,
|
|
||||||
pageSize:pageSize
|
|
||||||
});
|
|
||||||
showAccountHeadDetails(pageNum,pageSize);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (e)
|
|
||||||
{
|
|
||||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//删除财务信息
|
|
||||||
function deleteAccountHead(accountHeadID, thisOrganId, totalPrice){
|
|
||||||
$.messager.confirm('删除确认','确定要删除此财务信息吗?',function(r)
|
|
||||||
{
|
|
||||||
if (r)
|
|
||||||
{
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
|
||||||
dataType: "json",
|
|
||||||
data:{
|
|
||||||
ids: accountHeadID
|
|
||||||
},
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code == 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
} else {
|
|
||||||
if(res && res.code == 601){
|
|
||||||
var jsondata={};
|
|
||||||
jsondata.ids=accountHeadID;
|
|
||||||
jsondata.deleteType='2';
|
|
||||||
var type='single';
|
|
||||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
return;
|
|
||||||
}else{
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量删除财务信息
|
|
||||||
function batDeleteAccountHead(){
|
|
||||||
var row = $('#tableData').datagrid('getChecked');
|
|
||||||
if(row.length == 0)
|
|
||||||
{
|
|
||||||
$.messager.alert('删除提示','没有记录被选中!','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(row.length > 0)
|
|
||||||
{
|
|
||||||
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条财务信息吗?',function(r)
|
|
||||||
{
|
|
||||||
if (r)
|
|
||||||
{
|
|
||||||
var ids = "";
|
|
||||||
for(var i = 0;i < row.length; i ++) {
|
|
||||||
if(i == row.length-1)
|
|
||||||
{
|
|
||||||
ids += row[i].id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ids += row[i].id + ",";
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量删除
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
|
||||||
dataType: "json",
|
|
||||||
async : false,
|
|
||||||
data: ({
|
|
||||||
ids : ids
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
} else {
|
|
||||||
if(res && res.code == 601){
|
|
||||||
var jsondata={};
|
|
||||||
jsondata.ids=ids;
|
|
||||||
jsondata.deleteType='2';
|
|
||||||
var type='batch';
|
|
||||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
return;
|
|
||||||
}else{
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 确认强制删除
|
|
||||||
* */
|
|
||||||
function batDeleteAccountHeadForceConfirm(res,url,jsondata) {
|
|
||||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
|
||||||
if (r) {
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: url,
|
|
||||||
dataType: "json",
|
|
||||||
data: (jsondata),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code == 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
if(type=='batch'){
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
}
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
return;
|
|
||||||
}else {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error: function () {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//增加
|
|
||||||
function addAccountHead(){
|
|
||||||
$('#accountHeadFM').form('clear');
|
|
||||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
|
||||||
$("#BillTime").val(thisDateTime);
|
|
||||||
var thisNumber = getNowFormatDateNum(); //根据时间生成编号
|
|
||||||
$("#BillNo").val(amountNum + thisNumber).focus();
|
|
||||||
var addTitle = listTitle.replace("列表","信息");
|
|
||||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加' + addTitle);
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
|
|
||||||
orgAccountHead = "";
|
|
||||||
accountHeadID = 0;
|
|
||||||
initTableData_account("add"); //明细列表
|
|
||||||
reject(); //撤销下、刷新材料列表
|
|
||||||
url = '/accountHead/addAccountHeadAndDetail';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//编辑信息
|
|
||||||
function editAccountHead(index){
|
|
||||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
$("#BillNo").val(rowsdata.billno);
|
|
||||||
$("#BillTime").val(rowsdata.billtime);
|
|
||||||
$("#Remark").val(rowsdata.remark);
|
|
||||||
$("#AccountId").val(rowsdata.accountid);
|
|
||||||
$('#OrganId').combobox('setValue', rowsdata.organid);
|
|
||||||
$("#HandsPersonId").val(rowsdata.handspersonid);
|
|
||||||
$("#ChangeAmount").val(rowsdata.changeamount);
|
|
||||||
var TotalPrice = rowsdata.totalprice;
|
|
||||||
preTotalPrice = rowsdata.totalprice; //记录前一次合计金额,用于收预付款
|
|
||||||
var editTitle = listTitle.replace("列表","信息");
|
|
||||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="' + '/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑' + editTitle);
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
accountHeadID = rowsdata.id;
|
|
||||||
|
|
||||||
initTableData_account("edit",TotalPrice); //明细列表
|
|
||||||
reject(); //撤销下、刷新列表
|
|
||||||
url = '/accountHead/updateAccountHeadAndDetail?id=' + rowsdata.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
//查看信息
|
|
||||||
function showAccountHead(index){
|
|
||||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
$("#BillNoShow").text(rowsdata.billno);
|
|
||||||
$("#BillTimeShow").text(rowsdata.billtime);
|
|
||||||
$("#RemarkShow").text(rowsdata.remark);
|
|
||||||
$("#AccountIdShow").text(rowsdata.accountname);
|
|
||||||
$('#OrganIdShow').text(rowsdata.organname);
|
|
||||||
$("#HandsPersonIdShow").text(rowsdata.handspersonname);
|
|
||||||
$("#ChangeAmountShow").text(rowsdata.rowsdata==undefined?'0':rowsdata.rowsdata);
|
|
||||||
var TotalPrice = rowsdata.totalprice;
|
|
||||||
var showTitle = listTitle.replace("列表","信息");
|
|
||||||
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/list.png"/> 查看' + showTitle);
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
|
|
||||||
accountHeadID = rowsdata.id;
|
|
||||||
initTableData_account_show(TotalPrice); //明细列表-查看状态
|
|
||||||
}
|
|
||||||
|
|
||||||
//绑定操作事件
|
|
||||||
function bindEvent(){
|
|
||||||
//搜索处理
|
|
||||||
$("#searchBtn").unbind().bind({
|
|
||||||
click:function()
|
|
||||||
{
|
|
||||||
showAccountHeadDetails(1,initPageSize);
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
|
||||||
opts.pageNumber = 1;
|
|
||||||
opts.pageSize = initPageSize;
|
|
||||||
pager.pagination('refresh', {
|
|
||||||
pageNumber:1,
|
|
||||||
pageSize:initPageSize
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//重置按钮
|
|
||||||
$("#searchResetBtn").unbind().bind({
|
|
||||||
click:function(){
|
|
||||||
$("#searchBillNo").val("");
|
|
||||||
$("#searchBeginTime").val("");
|
|
||||||
$("#searchEndTime").val("");
|
|
||||||
//加载完以后重新初始化
|
|
||||||
$("#searchBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//保存信息
|
|
||||||
$("#saveAccountHead").off("click").on("click", function () {
|
|
||||||
if(!$('#accountHeadFM').form('validate')){
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
if (!$('#AccountId').val()) {
|
|
||||||
$.messager.alert('提示', '请选择付款账户!', 'warning');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!$('#OrganId').combobox('getValue')) {
|
|
||||||
$.messager.alert('提示', '请选择往来单位!', 'warning');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!$('#HandsPersonId').val()) {
|
|
||||||
$.messager.alert('提示', '请选择经手人!', 'warning');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var OrganId = null;
|
|
||||||
var ChangeAmount = $.trim($("#ChangeAmount").val());
|
|
||||||
var TotalPrice = $("#accountHeadFM .datagrid-footer [field='EachAmount'] div").text();
|
|
||||||
OrganId = $('#OrganId').combobox('getValue');
|
|
||||||
//支出为负数
|
|
||||||
ChangeAmount = 0 - ChangeAmount;
|
|
||||||
//支出和付款为负数
|
|
||||||
TotalPrice = 0 - TotalPrice;
|
|
||||||
|
|
||||||
saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//打印单据
|
|
||||||
$("#printAccountHeadShow").off("click").on("click",function(){
|
|
||||||
var tableString = $("#accountHeadDlgShow").html();
|
|
||||||
localStorage.setItem("tableString",tableString);
|
|
||||||
window.open("../../js/print/print_form.html","location:No;status:No;help:No;dialogWidth:800px;dialogHeight:600px;scroll:auto;");
|
|
||||||
});
|
|
||||||
|
|
||||||
//初始化键盘enter事件
|
|
||||||
$(document).keydown(function(event)
|
|
||||||
{
|
|
||||||
//兼容 IE和firefox 事件
|
|
||||||
var e = window.event || event;
|
|
||||||
var k = e.keyCode||e.which||e.charCode;
|
|
||||||
//兼容 IE,firefox 兼容
|
|
||||||
var obj = e.srcElement ? e.srcElement : e.target;
|
|
||||||
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
|
|
||||||
if(k == "13"&&(obj.id=="BillNo"||obj.id=="BillTime"))
|
|
||||||
{
|
|
||||||
$("#saveAccountHead").click();
|
|
||||||
}
|
|
||||||
//搜索按钮添加快捷键
|
|
||||||
if(k == "13"&&(obj.id=="searchBillNo"))
|
|
||||||
{
|
|
||||||
$("#searchBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showAccountHeadDetails(pageNo,pageSize){
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/accountHead/list",
|
|
||||||
dataType: "json",
|
|
||||||
data: ({
|
|
||||||
search: JSON.stringify({
|
|
||||||
type: listType,
|
|
||||||
billNo: $.trim($("#searchBillNo").val()),
|
|
||||||
beginTime: $("#searchBeginTime").val(),
|
|
||||||
endTime: $("#searchEndTime").val()
|
|
||||||
}),
|
|
||||||
currentPage: pageNo,
|
|
||||||
pageSize: pageSize
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200){
|
|
||||||
if(res.data && res.data.page) {
|
|
||||||
$("#tableData").datagrid('loadData', res.data.page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//自动计算事件
|
|
||||||
function autoReckon() {
|
|
||||||
//延时绑定事件
|
|
||||||
setTimeout(function(){
|
|
||||||
var body =$("#accountHeadFM .datagrid-body");
|
|
||||||
var footer =$("#accountHeadFM .datagrid-footer");
|
|
||||||
var input = ".datagrid-editable-input";
|
|
||||||
|
|
||||||
//修改金额,自动计算单价和合计
|
|
||||||
body.find("[field='EachAmount']").find(input).off("keyup").on("keyup",function(){
|
|
||||||
var TotalPrice = 0;
|
|
||||||
var EachAmount =$(this).val()-0; //金额
|
|
||||||
body.find("[field='EachAmount']").each(function(){
|
|
||||||
if($(this).find("div").text()!==""){
|
|
||||||
TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
TotalPrice = TotalPrice + EachAmount;
|
|
||||||
footer.find("[field='EachAmount']").find("div").text((TotalPrice).toFixed(2));
|
|
||||||
});
|
|
||||||
},500);
|
|
||||||
}
|
|
||||||
|
|
||||||
//结束编辑
|
|
||||||
function endEditing() {
|
|
||||||
var edField = "";
|
|
||||||
if(!itemType){
|
|
||||||
edField = "InOutItemId";
|
|
||||||
edName = "InOutItemName";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
edField = "AccountId";
|
|
||||||
edName = "AccountName";
|
|
||||||
}
|
|
||||||
if (editIndex == undefined) { return true }
|
|
||||||
if ($('#accountData').datagrid('validateRow', editIndex)) {
|
|
||||||
var ed = $('#accountData').datagrid('getEditor', {index: editIndex, field: edField});
|
|
||||||
var textName =null;
|
|
||||||
if($(ed.target)){
|
|
||||||
textName = $(ed.target).combobox('getText');
|
|
||||||
}
|
|
||||||
$('#accountData').datagrid('getRows')[editIndex][edName] = textName;
|
|
||||||
$('#accountData').datagrid('endEdit', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//单击
|
|
||||||
function onClickRow(index) {
|
|
||||||
if (editIndex != index) {
|
|
||||||
if (endEditing()) {
|
|
||||||
$('#accountData').datagrid('selectRow', index)
|
|
||||||
.datagrid('beginEdit', index);
|
|
||||||
editIndex = index;
|
|
||||||
autoReckon();
|
|
||||||
} else {
|
|
||||||
$('#accountData').datagrid('selectRow', editIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//新增
|
|
||||||
function append() {
|
|
||||||
if (endEditing()) {
|
|
||||||
$('#accountData').datagrid('appendRow', {});
|
|
||||||
editIndex = $('#accountData').datagrid('getRows').length - 1;
|
|
||||||
$('#accountData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
|
||||||
autoReckon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//删除
|
|
||||||
function removeit() {
|
|
||||||
if (editIndex == undefined) { return }
|
|
||||||
$('#accountData').datagrid('cancelEdit', editIndex)
|
|
||||||
.datagrid('deleteRow', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
}
|
|
||||||
//撤销
|
|
||||||
function reject() {
|
|
||||||
$('#accountData').datagrid('rejectChanges');
|
|
||||||
editIndex = undefined;
|
|
||||||
}
|
|
||||||
//判断
|
|
||||||
function CheckData() {
|
|
||||||
var row = $('#accountData').datagrid('getRows');
|
|
||||||
var totalRowNum = "";
|
|
||||||
for (var i = 0; i < row.length; i++) {
|
|
||||||
if(!itemType){
|
|
||||||
if (row[i].InOutItemId == "") {
|
|
||||||
totalRowNum += (i + 1) + "、";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if (row[i].AccountId == "") {
|
|
||||||
totalRowNum += (i + 1) + "、";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (totalRowNum != "") {
|
|
||||||
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
|
|
||||||
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) {
|
|
||||||
if (editIndex != undefined) {
|
|
||||||
$('#accountData').datagrid('endEdit', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
}
|
|
||||||
if (!CheckData())
|
|
||||||
return false;
|
|
||||||
var inserted = $("#accountData").datagrid('getChanges', "inserted");
|
|
||||||
var deleted = $("#accountData").datagrid('getChanges', "deleted");
|
|
||||||
var updated = $("#accountData").datagrid('getChanges', "updated");
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: url,
|
|
||||||
dataType: "json",
|
|
||||||
data: {
|
|
||||||
inserted: JSON.stringify(inserted),
|
|
||||||
deleted: JSON.stringify(deleted),
|
|
||||||
updated: JSON.stringify(updated),
|
|
||||||
info : JSON.stringify({
|
|
||||||
Type: listType,
|
|
||||||
BillNo: $.trim($("#BillNo").val()),
|
|
||||||
BillTime: $.trim($("#BillTime").val()),
|
|
||||||
AccountId: $.trim($("#AccountId").val()),
|
|
||||||
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付
|
|
||||||
TotalPrice: TotalPrice, //合计
|
|
||||||
OrganId: OrganId,
|
|
||||||
HandsPersonId: $.trim($("#HandsPersonId").val()),
|
|
||||||
Remark: $.trim($("#Remark").val())
|
|
||||||
}),
|
|
||||||
listType: listType
|
|
||||||
},
|
|
||||||
success: function (tipInfo)
|
|
||||||
{
|
|
||||||
if (tipInfo) {
|
|
||||||
$.messager.alert('提示','保存成功!','info');
|
|
||||||
$('#accountHeadDlg').dialog('close');
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
showAccountHeadDetails(opts.pageNumber, opts.pageSize);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
|
|
||||||
$.messager.show({
|
|
||||||
title: '错误提示',
|
|
||||||
msg: '保存信息失败,请稍后重试!'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
error: function (XmlHttpRequest, textStatus, errorThrown)
|
|
||||||
{
|
|
||||||
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,868 +0,0 @@
|
|||||||
//初始化界面
|
|
||||||
var listTitle ="收款单列表";
|
|
||||||
var listType = "收款";
|
|
||||||
var itemType = true; //隐藏当前列
|
|
||||||
var moneyType = false; //显示当前列
|
|
||||||
var payTypeTitle = "无标题";
|
|
||||||
var inOrOut = "";
|
|
||||||
var organUrl = "/supplier/findBySelect_cus"; //客户接口
|
|
||||||
var amountNum = "SK";
|
|
||||||
$(function(){
|
|
||||||
initSystemData_person(); //经手人数据
|
|
||||||
initSelectInfo_person(); //经手人信息
|
|
||||||
initSystemData_account(); //账户数据
|
|
||||||
initSelectInfo_account(); //账户信息
|
|
||||||
initSupplier(); //供应商
|
|
||||||
initTableData();
|
|
||||||
ininPager();
|
|
||||||
initForm();
|
|
||||||
bindEvent();//绑定操作事件
|
|
||||||
$("#searchBtn").click();
|
|
||||||
});
|
|
||||||
//获取账户信息
|
|
||||||
function initSystemData_account(){
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/account/getAccount",
|
|
||||||
//设置为同步
|
|
||||||
async:false,
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
if(res.data) {
|
|
||||||
accountList = res.data.accountList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//获取账户信息
|
|
||||||
function initSelectInfo_account(){
|
|
||||||
var options = "";
|
|
||||||
if(accountList !=null)
|
|
||||||
{
|
|
||||||
options = "";
|
|
||||||
for(var i = 0 ;i < accountList.length; i++)
|
|
||||||
{
|
|
||||||
var account = accountList[i];
|
|
||||||
options += '<option value="' + account.id + '">' + account.name + '</option>';
|
|
||||||
}
|
|
||||||
$("#AccountId").empty().append(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化单位信息
|
|
||||||
function initSupplier(){
|
|
||||||
$('#OrganId').combobox({
|
|
||||||
url: organUrl,
|
|
||||||
valueField:'id',
|
|
||||||
textField:'supplier',
|
|
||||||
formatter: function(row){
|
|
||||||
var opts = $(this).combobox('options');
|
|
||||||
if(row[opts.textField]!=="非会员") {
|
|
||||||
return row[opts.textField];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取财务员
|
|
||||||
function initSystemData_person(){
|
|
||||||
var type = "财务员";
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/person/getPersonByType",
|
|
||||||
data: {
|
|
||||||
type: type
|
|
||||||
},
|
|
||||||
//设置为同步
|
|
||||||
async:false,
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
personList = res.data.personList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//获取财务员
|
|
||||||
function initSelectInfo_person(){
|
|
||||||
var options = "";
|
|
||||||
|
|
||||||
if(personList !=null)
|
|
||||||
{
|
|
||||||
for(var i = 0 ;i < personList.length;i++)
|
|
||||||
{
|
|
||||||
var person = personList[i];
|
|
||||||
if(0 == i)
|
|
||||||
{
|
|
||||||
personID = person.id;
|
|
||||||
}
|
|
||||||
if(person.type=="财务员")
|
|
||||||
{
|
|
||||||
options += '<option value="' + person.id + '">' + person.name + '</option>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$("#HandsPersonId").empty().append(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//防止表单提交重复
|
|
||||||
function initForm(){
|
|
||||||
$('#accountHeadFM').form({
|
|
||||||
onSubmit: function(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化表格数据
|
|
||||||
function initTableData(){
|
|
||||||
var organNameTitle ="付款单位";
|
|
||||||
var organNameHidden = false;
|
|
||||||
$('#tableData').datagrid({
|
|
||||||
//width:700,
|
|
||||||
height:heightInfo,
|
|
||||||
rownumbers: false,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//fitColumns:true,
|
|
||||||
//单击行是否选中
|
|
||||||
//checkOnSelect : false,
|
|
||||||
pagination: true,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
pageSize: 5,
|
|
||||||
pageList: initPageNum,
|
|
||||||
columns:[[
|
|
||||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
|
||||||
{ title: '操作',field: 'op',align:"center",width:90,formatter:function(value, rec,index) {
|
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/7 10:48
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js
|
|
||||||
*/
|
|
||||||
var str = '';
|
|
||||||
var orgId = rec.organid ? rec.organid : 0;
|
|
||||||
str += '<img title="查看" src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountHead(\'' + index + '\');"/> ';
|
|
||||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccountHead(\'' + index + '\');"/> ';
|
|
||||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccountHead('+ rec.id +',' + orgId +',' + rec.totalprice + ');"/>';
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ field: 'organid',width:5, hidden:true},
|
|
||||||
{ title: organNameTitle,field: 'organname',width:140,hidden:organNameHidden},
|
|
||||||
{ title: '单据编号',field: 'billno',width:140},
|
|
||||||
{ title: '经手人',field: 'handspersonname',width:80},
|
|
||||||
{ title: '单据时间 ',field: 'billtime',width:140},
|
|
||||||
{ title: '合计',field: 'totalprice',width:80},
|
|
||||||
{ title: '备注',field: 'remark',width:100}
|
|
||||||
]],
|
|
||||||
toolbar:[
|
|
||||||
{
|
|
||||||
id:'addAccountHead',
|
|
||||||
text:'增加',
|
|
||||||
iconCls:'icon-add',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
addAccountHead();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:'deleteAccountHead',
|
|
||||||
text:'删除',
|
|
||||||
iconCls:'icon-remove',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
batDeleteAccountHead();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
onLoadError:function()
|
|
||||||
{
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化表格数据-明细列表-编辑状态
|
|
||||||
function initTableData_account(type,TotalPrice){
|
|
||||||
$('#accountData').datagrid({
|
|
||||||
height:280,
|
|
||||||
rownumbers: false,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//单击行是否选中
|
|
||||||
checkOnSelect : false,
|
|
||||||
pagination: false,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
showFooter: true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
|
||||||
{ title: payTypeTitle,field: 'InOutItemId',width:230,hidden:itemType,
|
|
||||||
formatter:function(value,row,index){
|
|
||||||
return row.InOutItemName;
|
|
||||||
},
|
|
||||||
editor:{
|
|
||||||
type:'combobox',
|
|
||||||
options:{
|
|
||||||
valueField:'Id',
|
|
||||||
textField:'InOutItemName',
|
|
||||||
method:'get',
|
|
||||||
url: "/inOutItem/findBySelect?type=" + inOrOut
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ title: '账户名称',field: 'AccountId',width:230,hidden:moneyType,
|
|
||||||
formatter:function(value,row,index){
|
|
||||||
return row.AccountName;
|
|
||||||
},
|
|
||||||
editor:{
|
|
||||||
type:'combobox',
|
|
||||||
options:{
|
|
||||||
valueField:'Id',
|
|
||||||
textField:'AccountName',
|
|
||||||
method:'get',
|
|
||||||
url: "/account/findBySelect"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ title: '金额',field: 'EachAmount',editor:'validatebox',width:70},
|
|
||||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:150}
|
|
||||||
]],
|
|
||||||
toolbar:[
|
|
||||||
{
|
|
||||||
id:'append',
|
|
||||||
text:'新增',
|
|
||||||
iconCls:'icon-add',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
append(); //新增
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:'delete',
|
|
||||||
text:'删除',
|
|
||||||
iconCls:'icon-remove',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
removeit(); //删除
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:'reject',
|
|
||||||
text:'撤销',
|
|
||||||
iconCls:'icon-undo',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
reject(); //撤销
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
onLoadError:function()
|
|
||||||
{
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: '/accountItem/getDetailList',
|
|
||||||
data: {
|
|
||||||
headerId: accountHeadID
|
|
||||||
},
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
var data = res.data;
|
|
||||||
var EachAmount = 0;
|
|
||||||
if(type === "edit") {
|
|
||||||
EachAmount = TotalPrice;
|
|
||||||
}
|
|
||||||
var array = [];
|
|
||||||
array.push({
|
|
||||||
"EachAmount": EachAmount
|
|
||||||
});
|
|
||||||
data.footer = array;
|
|
||||||
$("#accountData").datagrid('loadData',data);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//初始化表格数据-明细列表-查看状态
|
|
||||||
function initTableData_account_show(TotalPrice){
|
|
||||||
$('#accountDataShow').datagrid({
|
|
||||||
height:280,
|
|
||||||
rownumbers: true,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//单击行是否选中
|
|
||||||
checkOnSelect : false,
|
|
||||||
pagination: false,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
showFooter: true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
|
||||||
{ title: payTypeTitle, field: 'InOutItemName', width:230, hidden:itemType},
|
|
||||||
{ title: '账户名称', field: 'AccountName', width:230, hidden:moneyType},
|
|
||||||
{ title: '金额',field: 'EachAmount',width:70},
|
|
||||||
{ title: '备注',field: 'Remark',width:150}
|
|
||||||
]],
|
|
||||||
onLoadError:function()
|
|
||||||
{
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: '/accountItem/getDetailList',
|
|
||||||
data: {
|
|
||||||
headerId: accountHeadID
|
|
||||||
},
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
var data = res.data;
|
|
||||||
var EachAmount = TotalPrice;
|
|
||||||
var array = [];
|
|
||||||
array.push({
|
|
||||||
"EachAmount": EachAmount
|
|
||||||
});
|
|
||||||
data.footer = array;
|
|
||||||
$("#accountDataShow").datagrid('loadData', data);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//分页信息处理
|
|
||||||
function ininPager(){
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
|
||||||
pager.pagination({
|
|
||||||
onSelectPage:function(pageNum, pageSize)
|
|
||||||
{
|
|
||||||
opts.pageNumber = pageNum;
|
|
||||||
opts.pageSize = pageSize;
|
|
||||||
pager.pagination('refresh',
|
|
||||||
{
|
|
||||||
pageNumber:pageNum,
|
|
||||||
pageSize:pageSize
|
|
||||||
});
|
|
||||||
showAccountHeadDetails(pageNum,pageSize);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (e)
|
|
||||||
{
|
|
||||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//删除财务信息
|
|
||||||
function deleteAccountHead(accountHeadID, thisOrganId, totalPrice){
|
|
||||||
$.messager.confirm('删除确认','确定要删除此财务信息吗?',function(r)
|
|
||||||
{
|
|
||||||
if (r)
|
|
||||||
{
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
|
||||||
dataType: "json",
|
|
||||||
data:{
|
|
||||||
ids: accountHeadID
|
|
||||||
},
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code == 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
} else {
|
|
||||||
if(res && res.code == 601){
|
|
||||||
var jsondata={};
|
|
||||||
jsondata.ids=accountHeadID;
|
|
||||||
jsondata.deleteType='2';
|
|
||||||
var type='single';
|
|
||||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
return;
|
|
||||||
}else{
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量删除财务信息
|
|
||||||
function batDeleteAccountHead(){
|
|
||||||
var row = $('#tableData').datagrid('getChecked');
|
|
||||||
if(row.length == 0)
|
|
||||||
{
|
|
||||||
$.messager.alert('删除提示','没有记录被选中!','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(row.length > 0)
|
|
||||||
{
|
|
||||||
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条财务信息吗?',function(r)
|
|
||||||
{
|
|
||||||
if (r)
|
|
||||||
{
|
|
||||||
var ids = "";
|
|
||||||
for(var i = 0;i < row.length; i ++) {
|
|
||||||
if(i == row.length-1)
|
|
||||||
{
|
|
||||||
ids += row[i].id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ids += row[i].id + ",";
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量删除
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
|
||||||
dataType: "json",
|
|
||||||
async : false,
|
|
||||||
data: ({
|
|
||||||
ids : ids
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
} else {
|
|
||||||
if(res && res.code == 601){
|
|
||||||
var jsondata={};
|
|
||||||
jsondata.ids=ids;
|
|
||||||
jsondata.deleteType='2';
|
|
||||||
var type='batch';
|
|
||||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
return;
|
|
||||||
}else{
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 确认强制删除
|
|
||||||
* */
|
|
||||||
function batDeleteAccountHeadForceConfirm(res,url,jsondata) {
|
|
||||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
|
||||||
if (r) {
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: url,
|
|
||||||
dataType: "json",
|
|
||||||
data: (jsondata),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code == 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
if(type=='batch'){
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
}
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
return;
|
|
||||||
}else {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error: function () {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//增加
|
|
||||||
function addAccountHead(){
|
|
||||||
$('#accountHeadFM').form('clear');
|
|
||||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
|
||||||
$("#BillTime").val(thisDateTime);
|
|
||||||
var thisNumber = getNowFormatDateNum(); //根据时间生成编号
|
|
||||||
$("#BillNo").val(amountNum + thisNumber).focus();
|
|
||||||
var addTitle = listTitle.replace("列表","信息");
|
|
||||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加' + addTitle);
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
|
|
||||||
orgAccountHead = "";
|
|
||||||
accountHeadID = 0;
|
|
||||||
initTableData_account("add"); //明细列表
|
|
||||||
reject(); //撤销下、刷新材料列表
|
|
||||||
url = '/accountHead/addAccountHeadAndDetail';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//编辑信息
|
|
||||||
function editAccountHead(index){
|
|
||||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
$("#BillNo").val(rowsdata.billno);
|
|
||||||
$("#BillTime").val(rowsdata.billtime);
|
|
||||||
$("#Remark").val(rowsdata.remark);
|
|
||||||
$("#AccountId").val(rowsdata.accountid);
|
|
||||||
$('#OrganId').combobox('setValue', rowsdata.organid);
|
|
||||||
$("#HandsPersonId").val(rowsdata.handspersonid);
|
|
||||||
$("#ChangeAmount").val(rowsdata.changeamount);
|
|
||||||
var TotalPrice = rowsdata.totalprice;
|
|
||||||
preTotalPrice = rowsdata.totalprice; //记录前一次合计金额,用于收预付款
|
|
||||||
var editTitle = listTitle.replace("列表","信息");
|
|
||||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="' + '/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑' + editTitle);
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
accountHeadID = rowsdata.id;
|
|
||||||
|
|
||||||
initTableData_account("edit",TotalPrice); //明细列表
|
|
||||||
reject(); //撤销下、刷新列表
|
|
||||||
url = '/accountHead/updateAccountHeadAndDetail?id=' + rowsdata.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
//查看信息
|
|
||||||
function showAccountHead(index){
|
|
||||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
$("#BillNoShow").text(rowsdata.billno);
|
|
||||||
$("#BillTimeShow").text(rowsdata.billtime);
|
|
||||||
$("#RemarkShow").text(rowsdata.remark);
|
|
||||||
$("#AccountIdShow").text(rowsdata.accountname);
|
|
||||||
$('#OrganIdShow').text(rowsdata.organname);
|
|
||||||
$("#HandsPersonIdShow").text(rowsdata.handspersonname);
|
|
||||||
$("#ChangeAmountShow").text(rowsdata.rowsdata==undefined?'0':rowsdata.rowsdata);
|
|
||||||
var TotalPrice = rowsdata.totalprice;
|
|
||||||
var showTitle = listTitle.replace("列表","信息");
|
|
||||||
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/list.png"/> 查看' + showTitle);
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
|
|
||||||
accountHeadID = rowsdata.id;
|
|
||||||
initTableData_account_show(TotalPrice); //明细列表-查看状态
|
|
||||||
}
|
|
||||||
|
|
||||||
//绑定操作事件
|
|
||||||
function bindEvent(){
|
|
||||||
//搜索处理
|
|
||||||
$("#searchBtn").unbind().bind({
|
|
||||||
click:function()
|
|
||||||
{
|
|
||||||
showAccountHeadDetails(1,initPageSize);
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
|
||||||
opts.pageNumber = 1;
|
|
||||||
opts.pageSize = initPageSize;
|
|
||||||
pager.pagination('refresh', {
|
|
||||||
pageNumber:1,
|
|
||||||
pageSize:initPageSize
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//重置按钮
|
|
||||||
$("#searchResetBtn").unbind().bind({
|
|
||||||
click:function(){
|
|
||||||
$("#searchBillNo").val("");
|
|
||||||
$("#searchBeginTime").val("");
|
|
||||||
$("#searchEndTime").val("");
|
|
||||||
//加载完以后重新初始化
|
|
||||||
$("#searchBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//保存信息
|
|
||||||
$("#saveAccountHead").off("click").on("click", function () {
|
|
||||||
if(!$('#accountHeadFM').form('validate')){
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
if (!$('#OrganId').combobox('getValue')) {
|
|
||||||
$.messager.alert('提示', '请选择付款单位!', 'warning');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!$('#HandsPersonId').val()) {
|
|
||||||
$.messager.alert('提示', '请选择经手人!', 'warning');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var OrganId = null;
|
|
||||||
var ChangeAmount = $.trim($("#ChangeAmount").val());
|
|
||||||
var TotalPrice = $("#accountHeadFM .datagrid-footer [field='EachAmount'] div").text();
|
|
||||||
OrganId = $('#OrganId').combobox('getValue');
|
|
||||||
saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//打印单据
|
|
||||||
$("#printAccountHeadShow").off("click").on("click",function(){
|
|
||||||
var tableString = $("#accountHeadDlgShow").html();
|
|
||||||
localStorage.setItem("tableString",tableString);
|
|
||||||
window.open("../../js/print/print_form.html","location:No;status:No;help:No;dialogWidth:800px;dialogHeight:600px;scroll:auto;");
|
|
||||||
});
|
|
||||||
|
|
||||||
//初始化键盘enter事件
|
|
||||||
$(document).keydown(function(event)
|
|
||||||
{
|
|
||||||
//兼容 IE和firefox 事件
|
|
||||||
var e = window.event || event;
|
|
||||||
var k = e.keyCode||e.which||e.charCode;
|
|
||||||
//兼容 IE,firefox 兼容
|
|
||||||
var obj = e.srcElement ? e.srcElement : e.target;
|
|
||||||
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
|
|
||||||
if(k == "13"&&(obj.id=="BillNo"||obj.id=="BillTime"))
|
|
||||||
{
|
|
||||||
$("#saveAccountHead").click();
|
|
||||||
}
|
|
||||||
//搜索按钮添加快捷键
|
|
||||||
if(k == "13"&&(obj.id=="searchBillNo"))
|
|
||||||
{
|
|
||||||
$("#searchBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showAccountHeadDetails(pageNo,pageSize){
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/accountHead/list",
|
|
||||||
dataType: "json",
|
|
||||||
data: ({
|
|
||||||
search: JSON.stringify({
|
|
||||||
type: listType,
|
|
||||||
billNo: $.trim($("#searchBillNo").val()),
|
|
||||||
beginTime: $("#searchBeginTime").val(),
|
|
||||||
endTime: $("#searchEndTime").val()
|
|
||||||
}),
|
|
||||||
currentPage: pageNo,
|
|
||||||
pageSize: pageSize
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200){
|
|
||||||
if(res.data && res.data.page) {
|
|
||||||
$("#tableData").datagrid('loadData', res.data.page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//自动计算事件
|
|
||||||
function autoReckon() {
|
|
||||||
//延时绑定事件
|
|
||||||
setTimeout(function(){
|
|
||||||
var body =$("#accountHeadFM .datagrid-body");
|
|
||||||
var footer =$("#accountHeadFM .datagrid-footer");
|
|
||||||
var input = ".datagrid-editable-input";
|
|
||||||
|
|
||||||
//修改金额,自动计算单价和合计
|
|
||||||
body.find("[field='EachAmount']").find(input).off("keyup").on("keyup",function(){
|
|
||||||
var TotalPrice = 0;
|
|
||||||
var EachAmount =$(this).val()-0; //金额
|
|
||||||
body.find("[field='EachAmount']").each(function(){
|
|
||||||
if($(this).find("div").text()!==""){
|
|
||||||
TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
TotalPrice = TotalPrice + EachAmount;
|
|
||||||
footer.find("[field='EachAmount']").find("div").text((TotalPrice).toFixed(2));
|
|
||||||
});
|
|
||||||
},500);
|
|
||||||
}
|
|
||||||
|
|
||||||
//结束编辑
|
|
||||||
function endEditing() {
|
|
||||||
var edField = "";
|
|
||||||
if(!itemType){
|
|
||||||
edField = "InOutItemId";
|
|
||||||
edName = "InOutItemName";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
edField = "AccountId";
|
|
||||||
edName = "AccountName";
|
|
||||||
}
|
|
||||||
if (editIndex == undefined) { return true }
|
|
||||||
if ($('#accountData').datagrid('validateRow', editIndex)) {
|
|
||||||
var ed = $('#accountData').datagrid('getEditor', {index: editIndex, field: edField});
|
|
||||||
var textName =null;
|
|
||||||
if($(ed.target)){
|
|
||||||
textName = $(ed.target).combobox('getText');
|
|
||||||
}
|
|
||||||
$('#accountData').datagrid('getRows')[editIndex][edName] = textName;
|
|
||||||
$('#accountData').datagrid('endEdit', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//单击
|
|
||||||
function onClickRow(index) {
|
|
||||||
if (editIndex != index) {
|
|
||||||
if (endEditing()) {
|
|
||||||
$('#accountData').datagrid('selectRow', index)
|
|
||||||
.datagrid('beginEdit', index);
|
|
||||||
editIndex = index;
|
|
||||||
autoReckon();
|
|
||||||
} else {
|
|
||||||
$('#accountData').datagrid('selectRow', editIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//新增
|
|
||||||
function append() {
|
|
||||||
if (endEditing()) {
|
|
||||||
$('#accountData').datagrid('appendRow', {});
|
|
||||||
editIndex = $('#accountData').datagrid('getRows').length - 1;
|
|
||||||
$('#accountData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
|
||||||
autoReckon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//删除
|
|
||||||
function removeit() {
|
|
||||||
if (editIndex == undefined) { return }
|
|
||||||
$('#accountData').datagrid('cancelEdit', editIndex)
|
|
||||||
.datagrid('deleteRow', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
}
|
|
||||||
//撤销
|
|
||||||
function reject() {
|
|
||||||
$('#accountData').datagrid('rejectChanges');
|
|
||||||
editIndex = undefined;
|
|
||||||
}
|
|
||||||
//判断
|
|
||||||
function CheckData() {
|
|
||||||
var row = $('#accountData').datagrid('getRows');
|
|
||||||
var totalRowNum = "";
|
|
||||||
for (var i = 0; i < row.length; i++) {
|
|
||||||
if(!itemType){
|
|
||||||
if (row[i].InOutItemId == "") {
|
|
||||||
totalRowNum += (i + 1) + "、";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if (row[i].AccountId == "") {
|
|
||||||
totalRowNum += (i + 1) + "、";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (totalRowNum != "") {
|
|
||||||
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
|
|
||||||
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) {
|
|
||||||
if (editIndex != undefined) {
|
|
||||||
$('#accountData').datagrid('endEdit', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
}
|
|
||||||
if (!CheckData())
|
|
||||||
return false;
|
|
||||||
var inserted = $("#accountData").datagrid('getChanges', "inserted");
|
|
||||||
var deleted = $("#accountData").datagrid('getChanges', "deleted");
|
|
||||||
var updated = $("#accountData").datagrid('getChanges', "updated");
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: url,
|
|
||||||
dataType: "json",
|
|
||||||
data: {
|
|
||||||
inserted: JSON.stringify(inserted),
|
|
||||||
deleted: JSON.stringify(deleted),
|
|
||||||
updated: JSON.stringify(updated),
|
|
||||||
info : JSON.stringify({
|
|
||||||
Type: listType,
|
|
||||||
BillNo: $.trim($("#BillNo").val()),
|
|
||||||
BillTime: $.trim($("#BillTime").val()),
|
|
||||||
AccountId: $.trim($("#AccountId").val()),
|
|
||||||
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付
|
|
||||||
TotalPrice: TotalPrice, //合计
|
|
||||||
OrganId: OrganId,
|
|
||||||
HandsPersonId: $.trim($("#HandsPersonId").val()),
|
|
||||||
Remark: $.trim($("#Remark").val())
|
|
||||||
}),
|
|
||||||
listType: listType
|
|
||||||
},
|
|
||||||
success: function (tipInfo)
|
|
||||||
{
|
|
||||||
if (tipInfo) {
|
|
||||||
$.messager.alert('提示','保存成功!','info');
|
|
||||||
$('#accountHeadDlg').dialog('close');
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
showAccountHeadDetails(opts.pageNumber, opts.pageSize);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
|
|
||||||
$.messager.show({
|
|
||||||
title: '错误提示',
|
|
||||||
msg: '保存信息失败,请稍后重试!'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
error: function (XmlHttpRequest, textStatus, errorThrown)
|
|
||||||
{
|
|
||||||
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,890 +0,0 @@
|
|||||||
//初始化界面
|
|
||||||
var listTitle ="付款单列表";
|
|
||||||
var listType = "付款";
|
|
||||||
var itemType = true; //隐藏当前列
|
|
||||||
var moneyType = false; //显示当前列
|
|
||||||
var payTypeTitle = "无标题";
|
|
||||||
var inOrOut = "";
|
|
||||||
var organUrl = "/supplier/findBySelect_sup"; //供应商接口
|
|
||||||
var amountNum = "FK";
|
|
||||||
$(function(){
|
|
||||||
initSystemData_person(); //经手人数据
|
|
||||||
initSelectInfo_person(); //经手人信息
|
|
||||||
initSystemData_account(); //账户数据
|
|
||||||
initSelectInfo_account(); //账户信息
|
|
||||||
initSupplier(); //供应商
|
|
||||||
initTableData();
|
|
||||||
ininPager();
|
|
||||||
initForm();
|
|
||||||
bindEvent();//绑定操作事件
|
|
||||||
$("#searchBtn").click();
|
|
||||||
});
|
|
||||||
//获取账户信息
|
|
||||||
function initSystemData_account(){
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/account/getAccount",
|
|
||||||
//设置为同步
|
|
||||||
async:false,
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
if(res.data) {
|
|
||||||
accountList = res.data.accountList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//获取账户信息
|
|
||||||
function initSelectInfo_account(){
|
|
||||||
var options = "";
|
|
||||||
if(accountList !=null)
|
|
||||||
{
|
|
||||||
options = "";
|
|
||||||
for(var i = 0 ;i < accountList.length; i++)
|
|
||||||
{
|
|
||||||
var account = accountList[i];
|
|
||||||
options += '<option value="' + account.id + '">' + account.name + '</option>';
|
|
||||||
}
|
|
||||||
$("#AccountId").empty().append(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化单位信息
|
|
||||||
function initSupplier(){
|
|
||||||
$('#OrganId').combobox({
|
|
||||||
url: organUrl,
|
|
||||||
valueField:'id',
|
|
||||||
textField:'supplier',
|
|
||||||
formatter: function(row){
|
|
||||||
var opts = $(this).combobox('options');
|
|
||||||
if(row[opts.textField]!=="非会员") {
|
|
||||||
return row[opts.textField];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取财务员
|
|
||||||
function initSystemData_person(){
|
|
||||||
var type = "财务员";
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/person/getPersonByType",
|
|
||||||
data: {
|
|
||||||
type: type
|
|
||||||
},
|
|
||||||
//设置为同步
|
|
||||||
async:false,
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
personList = res.data.personList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//获取财务员
|
|
||||||
function initSelectInfo_person(){
|
|
||||||
var options = "";
|
|
||||||
|
|
||||||
if(personList !=null)
|
|
||||||
{
|
|
||||||
for(var i = 0 ;i < personList.length;i++)
|
|
||||||
{
|
|
||||||
var person = personList[i];
|
|
||||||
if(0 == i)
|
|
||||||
{
|
|
||||||
personID = person.id;
|
|
||||||
}
|
|
||||||
if(person.type=="财务员")
|
|
||||||
{
|
|
||||||
options += '<option value="' + person.id + '">' + person.name + '</option>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$("#HandsPersonId").empty().append(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//防止表单提交重复
|
|
||||||
function initForm(){
|
|
||||||
$('#accountHeadFM').form({
|
|
||||||
onSubmit: function(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化表格数据
|
|
||||||
function initTableData(){
|
|
||||||
var organNameTitle = "收款单位";
|
|
||||||
var organNameHidden = false;
|
|
||||||
$('#tableData').datagrid({
|
|
||||||
//width:700,
|
|
||||||
height:heightInfo,
|
|
||||||
rownumbers: false,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//fitColumns:true,
|
|
||||||
//单击行是否选中
|
|
||||||
//checkOnSelect : false,
|
|
||||||
pagination: true,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
pageSize: 5,
|
|
||||||
pageList: initPageNum,
|
|
||||||
columns:[[
|
|
||||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
|
||||||
{ title: '操作',field: 'op',align:"center",width:90,formatter:function(value, rec,index) {
|
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/7 10:48
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js
|
|
||||||
*/
|
|
||||||
var str = '';
|
|
||||||
var orgId = rec.organid ? rec.organid : 0;
|
|
||||||
str += '<img title="查看" src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountHead(\'' + index + '\');"/> ';
|
|
||||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccountHead(\'' + index + '\');"/> ';
|
|
||||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccountHead('+ rec.id +',' + orgId +',' + rec.totalprice + ');"/>';
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ field: 'organid',width:5, hidden:true},
|
|
||||||
{ title: organNameTitle,field: 'organname',width:140,hidden:organNameHidden},
|
|
||||||
{ title: '单据编号',field: 'billno',width:140},
|
|
||||||
{ title: '经手人',field: 'handspersonname',width:80},
|
|
||||||
{ title: '单据时间 ',field: 'billtime',width:140},
|
|
||||||
{ title: '合计',field: 'totalprice',width:80},
|
|
||||||
{ title: '备注',field: 'remark',width:100}
|
|
||||||
]],
|
|
||||||
toolbar:[
|
|
||||||
{
|
|
||||||
id:'addAccountHead',
|
|
||||||
text:'增加',
|
|
||||||
iconCls:'icon-add',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
addAccountHead();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:'deleteAccountHead',
|
|
||||||
text:'删除',
|
|
||||||
iconCls:'icon-remove',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
batDeleteAccountHead();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
onLoadError:function()
|
|
||||||
{
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化表格数据-明细列表-编辑状态
|
|
||||||
function initTableData_account(type,TotalPrice){
|
|
||||||
$('#accountData').datagrid({
|
|
||||||
height:280,
|
|
||||||
rownumbers: false,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//单击行是否选中
|
|
||||||
checkOnSelect : false,
|
|
||||||
pagination: false,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
showFooter: true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
|
||||||
{ title: payTypeTitle,field: 'InOutItemId',width:230,hidden:itemType,
|
|
||||||
formatter:function(value,row,index){
|
|
||||||
return row.InOutItemName;
|
|
||||||
},
|
|
||||||
editor:{
|
|
||||||
type:'combobox',
|
|
||||||
options:{
|
|
||||||
valueField:'Id',
|
|
||||||
textField:'InOutItemName',
|
|
||||||
method:'get',
|
|
||||||
url: "/inOutItem/findBySelect?type=" + inOrOut
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ title: '账户名称',field: 'AccountId',width:230,hidden:moneyType,
|
|
||||||
formatter:function(value,row,index){
|
|
||||||
return row.AccountName;
|
|
||||||
},
|
|
||||||
editor:{
|
|
||||||
type:'combobox',
|
|
||||||
options:{
|
|
||||||
valueField:'Id',
|
|
||||||
textField:'AccountName',
|
|
||||||
method:'get',
|
|
||||||
url: "/account/findBySelect"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ title: '金额',field: 'EachAmount',editor:'validatebox',width:70},
|
|
||||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:150}
|
|
||||||
]],
|
|
||||||
toolbar:[
|
|
||||||
{
|
|
||||||
id:'append',
|
|
||||||
text:'新增',
|
|
||||||
iconCls:'icon-add',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
append(); //新增
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:'delete',
|
|
||||||
text:'删除',
|
|
||||||
iconCls:'icon-remove',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
removeit(); //删除
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:'reject',
|
|
||||||
text:'撤销',
|
|
||||||
iconCls:'icon-undo',
|
|
||||||
handler:function()
|
|
||||||
{
|
|
||||||
reject(); //撤销
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
onLoadError:function()
|
|
||||||
{
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: '/accountItem/getDetailList',
|
|
||||||
data: {
|
|
||||||
headerId: accountHeadID
|
|
||||||
},
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
var data = res.data;
|
|
||||||
var EachAmount = 0;
|
|
||||||
if(type === "edit") {
|
|
||||||
EachAmount = TotalPrice;
|
|
||||||
}
|
|
||||||
var array = [];
|
|
||||||
array.push({
|
|
||||||
"EachAmount": EachAmount
|
|
||||||
});
|
|
||||||
data.footer = array;
|
|
||||||
$("#accountData").datagrid('loadData',data);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//初始化表格数据-明细列表-查看状态
|
|
||||||
function initTableData_account_show(TotalPrice){
|
|
||||||
$('#accountDataShow').datagrid({
|
|
||||||
height:280,
|
|
||||||
rownumbers: true,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//单击行是否选中
|
|
||||||
checkOnSelect : false,
|
|
||||||
pagination: false,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
showFooter: true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
|
||||||
{ title: payTypeTitle, field: 'InOutItemName', width:230, hidden:itemType},
|
|
||||||
{ title: '账户名称', field: 'AccountName', width:230, hidden:moneyType},
|
|
||||||
{ title: '金额',field: 'EachAmount',width:70},
|
|
||||||
{ title: '备注',field: 'Remark',width:150}
|
|
||||||
]],
|
|
||||||
onLoadError:function()
|
|
||||||
{
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: '/accountItem/getDetailList',
|
|
||||||
data: {
|
|
||||||
headerId: accountHeadID
|
|
||||||
},
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
var data = res.data;
|
|
||||||
var EachAmount = TotalPrice;
|
|
||||||
var array = [];
|
|
||||||
array.push({
|
|
||||||
"EachAmount": EachAmount
|
|
||||||
});
|
|
||||||
data.footer = array;
|
|
||||||
$("#accountDataShow").datagrid('loadData', data);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//分页信息处理
|
|
||||||
function ininPager(){
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
|
||||||
pager.pagination({
|
|
||||||
onSelectPage:function(pageNum, pageSize)
|
|
||||||
{
|
|
||||||
opts.pageNumber = pageNum;
|
|
||||||
opts.pageSize = pageSize;
|
|
||||||
pager.pagination('refresh',
|
|
||||||
{
|
|
||||||
pageNumber:pageNum,
|
|
||||||
pageSize:pageSize
|
|
||||||
});
|
|
||||||
showAccountHeadDetails(pageNum,pageSize);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (e)
|
|
||||||
{
|
|
||||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//删除财务信息
|
|
||||||
function deleteAccountHead(accountHeadID, thisOrganId, totalPrice){
|
|
||||||
$.messager.confirm('删除确认','确定要删除此财务信息吗?',function(r)
|
|
||||||
{
|
|
||||||
if (r)
|
|
||||||
{
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
|
||||||
dataType: "json",
|
|
||||||
data:{
|
|
||||||
ids: accountHeadID
|
|
||||||
},
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code == 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
} else {
|
|
||||||
if(res && res.code == 601){
|
|
||||||
var jsondata={};
|
|
||||||
jsondata.ids=accountHeadID;
|
|
||||||
jsondata.deleteType='2';
|
|
||||||
var type='single';
|
|
||||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
return;
|
|
||||||
}else{
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量删除财务信息
|
|
||||||
function batDeleteAccountHead(){
|
|
||||||
var row = $('#tableData').datagrid('getChecked');
|
|
||||||
if(row.length == 0)
|
|
||||||
{
|
|
||||||
$.messager.alert('删除提示','没有记录被选中!','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(row.length > 0)
|
|
||||||
{
|
|
||||||
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条财务信息吗?',function(r)
|
|
||||||
{
|
|
||||||
if (r)
|
|
||||||
{
|
|
||||||
var ids = "";
|
|
||||||
for(var i = 0;i < row.length; i ++) {
|
|
||||||
if(i == row.length-1)
|
|
||||||
{
|
|
||||||
ids += row[i].id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ids += row[i].id + ",";
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量删除
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
|
||||||
dataType: "json",
|
|
||||||
async : false,
|
|
||||||
data: ({
|
|
||||||
ids : ids
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
} else {
|
|
||||||
if(res && res.code == 601){
|
|
||||||
var jsondata={};
|
|
||||||
jsondata.ids=ids;
|
|
||||||
jsondata.deleteType='2';
|
|
||||||
var type='batch';
|
|
||||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
return;
|
|
||||||
}else{
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 确认强制删除
|
|
||||||
* */
|
|
||||||
function batDeleteAccountHeadForceConfirm(res,url,jsondata) {
|
|
||||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
|
||||||
if (r) {
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: url,
|
|
||||||
dataType: "json",
|
|
||||||
data: (jsondata),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code == 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
if(type=='batch'){
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
}
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
return;
|
|
||||||
}else {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error: function () {
|
|
||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//增加
|
|
||||||
function addAccountHead(){
|
|
||||||
$('#accountHeadFM').form('clear');
|
|
||||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
|
||||||
$("#BillTime").val(thisDateTime);
|
|
||||||
var thisNumber = getNowFormatDateNum(); //根据时间生成编号
|
|
||||||
$("#BillNo").val(amountNum + thisNumber).focus();
|
|
||||||
var addTitle = listTitle.replace("列表","信息");
|
|
||||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加' + addTitle);
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
|
|
||||||
orgAccountHead = "";
|
|
||||||
accountHeadID = 0;
|
|
||||||
initTableData_account("add"); //明细列表
|
|
||||||
reject(); //撤销下、刷新材料列表
|
|
||||||
url = '/accountHead/addAccountHeadAndDetail';
|
|
||||||
|
|
||||||
//收预付款单据支持刷卡功能
|
|
||||||
if(listType == "收预付款") {
|
|
||||||
//当会员卡号长度超过10位后,自动点击下拉框,用于兼容刷卡器
|
|
||||||
$("#OrganId").next().find("input").off("keyup").on("keyup",function(){
|
|
||||||
if($(this).val().length === 10){
|
|
||||||
setTimeout(function(){
|
|
||||||
$(".combo-panel .combobox-item-selected").click();
|
|
||||||
},500);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//编辑信息
|
|
||||||
function editAccountHead(index){
|
|
||||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
$("#BillNo").val(rowsdata.billno);
|
|
||||||
$("#BillTime").val(rowsdata.billtime);
|
|
||||||
$("#Remark").val(rowsdata.remark);
|
|
||||||
$("#AccountId").val(rowsdata.accountid);
|
|
||||||
$('#OrganId').combobox('setValue', rowsdata.organid);
|
|
||||||
$("#HandsPersonId").val(rowsdata.handspersonid);
|
|
||||||
$("#ChangeAmount").val(rowsdata.changeamount);
|
|
||||||
var TotalPrice = rowsdata.totalprice;
|
|
||||||
preTotalPrice = rowsdata.totalprice; //记录前一次合计金额,用于收预付款
|
|
||||||
var editTitle = listTitle.replace("列表","信息");
|
|
||||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="' + '/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑' + editTitle);
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
accountHeadID = rowsdata.id;
|
|
||||||
|
|
||||||
initTableData_account("edit",TotalPrice); //明细列表
|
|
||||||
reject(); //撤销下、刷新列表
|
|
||||||
url = '/accountHead/updateAccountHeadAndDetail?id=' + rowsdata.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
//查看信息
|
|
||||||
function showAccountHead(index){
|
|
||||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
$("#BillNoShow").text(rowsdata.billno);
|
|
||||||
$("#BillTimeShow").text(rowsdata.billtime);
|
|
||||||
$("#RemarkShow").text(rowsdata.remark);
|
|
||||||
$("#AccountIdShow").text(rowsdata.accountname);
|
|
||||||
$('#OrganIdShow').text(rowsdata.organname);
|
|
||||||
$("#HandsPersonIdShow").text(rowsdata.handspersonname);
|
|
||||||
$("#ChangeAmountShow").text(rowsdata.rowsdata==undefined?'0':rowsdata.rowsdata);
|
|
||||||
var TotalPrice = rowsdata.totalprice;
|
|
||||||
var showTitle = listTitle.replace("列表","信息");
|
|
||||||
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/list.png"/> 查看' + showTitle);
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
|
|
||||||
accountHeadID = rowsdata.id;
|
|
||||||
initTableData_account_show(TotalPrice); //明细列表-查看状态
|
|
||||||
}
|
|
||||||
|
|
||||||
//绑定操作事件
|
|
||||||
function bindEvent(){
|
|
||||||
//搜索处理
|
|
||||||
$("#searchBtn").unbind().bind({
|
|
||||||
click:function()
|
|
||||||
{
|
|
||||||
showAccountHeadDetails(1,initPageSize);
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
|
||||||
opts.pageNumber = 1;
|
|
||||||
opts.pageSize = initPageSize;
|
|
||||||
pager.pagination('refresh', {
|
|
||||||
pageNumber:1,
|
|
||||||
pageSize:initPageSize
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//重置按钮
|
|
||||||
$("#searchResetBtn").unbind().bind({
|
|
||||||
click:function(){
|
|
||||||
$("#searchBillNo").val("");
|
|
||||||
$("#searchBeginTime").val("");
|
|
||||||
$("#searchEndTime").val("");
|
|
||||||
//加载完以后重新初始化
|
|
||||||
$("#searchBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//保存信息
|
|
||||||
$("#saveAccountHead").off("click").on("click", function () {
|
|
||||||
if(!$('#accountHeadFM').form('validate')){
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
if (!$('#OrganId').combobox('getValue')) {
|
|
||||||
$.messager.alert('提示', '请选择收款单位!', 'warning');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!$('#HandsPersonId').val()) {
|
|
||||||
$.messager.alert('提示', '请选择经手人!', 'warning');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var OrganId = null;
|
|
||||||
var ChangeAmount = $.trim($("#ChangeAmount").val());
|
|
||||||
var TotalPrice = $("#accountHeadFM .datagrid-footer [field='EachAmount'] div").text();
|
|
||||||
if (listType !== "转账") {
|
|
||||||
OrganId = $('#OrganId').combobox('getValue');
|
|
||||||
}
|
|
||||||
if (listType === "支出" || listType === "转账") {
|
|
||||||
//支出为负数
|
|
||||||
ChangeAmount = 0 - ChangeAmount;
|
|
||||||
}
|
|
||||||
if (listType === "支出" || listType === "付款" || listType === "转账") {
|
|
||||||
//支出和付款为负数
|
|
||||||
TotalPrice = 0 - TotalPrice;
|
|
||||||
}
|
|
||||||
|
|
||||||
saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//打印单据
|
|
||||||
$("#printAccountHeadShow").off("click").on("click",function(){
|
|
||||||
var tableString = $("#accountHeadDlgShow").html();
|
|
||||||
localStorage.setItem("tableString",tableString);
|
|
||||||
window.open("../../js/print/print_form.html","location:No;status:No;help:No;dialogWidth:800px;dialogHeight:600px;scroll:auto;");
|
|
||||||
});
|
|
||||||
|
|
||||||
//初始化键盘enter事件
|
|
||||||
$(document).keydown(function(event)
|
|
||||||
{
|
|
||||||
//兼容 IE和firefox 事件
|
|
||||||
var e = window.event || event;
|
|
||||||
var k = e.keyCode||e.which||e.charCode;
|
|
||||||
//兼容 IE,firefox 兼容
|
|
||||||
var obj = e.srcElement ? e.srcElement : e.target;
|
|
||||||
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
|
|
||||||
if(k == "13"&&(obj.id=="BillNo"||obj.id=="BillTime"))
|
|
||||||
{
|
|
||||||
$("#saveAccountHead").click();
|
|
||||||
}
|
|
||||||
//搜索按钮添加快捷键
|
|
||||||
if(k == "13"&&(obj.id=="searchBillNo"))
|
|
||||||
{
|
|
||||||
$("#searchBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showAccountHeadDetails(pageNo,pageSize){
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/accountHead/list",
|
|
||||||
dataType: "json",
|
|
||||||
data: ({
|
|
||||||
search: JSON.stringify({
|
|
||||||
type: listType,
|
|
||||||
billNo: $.trim($("#searchBillNo").val()),
|
|
||||||
beginTime: $("#searchBeginTime").val(),
|
|
||||||
endTime: $("#searchEndTime").val()
|
|
||||||
}),
|
|
||||||
currentPage: pageNo,
|
|
||||||
pageSize: pageSize
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200){
|
|
||||||
if(res.data && res.data.page) {
|
|
||||||
$("#tableData").datagrid('loadData', res.data.page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//自动计算事件
|
|
||||||
function autoReckon() {
|
|
||||||
//延时绑定事件
|
|
||||||
setTimeout(function(){
|
|
||||||
var body =$("#accountHeadFM .datagrid-body");
|
|
||||||
var footer =$("#accountHeadFM .datagrid-footer");
|
|
||||||
var input = ".datagrid-editable-input";
|
|
||||||
|
|
||||||
//修改金额,自动计算单价和合计
|
|
||||||
body.find("[field='EachAmount']").find(input).off("keyup").on("keyup",function(){
|
|
||||||
var TotalPrice = 0;
|
|
||||||
var EachAmount =$(this).val()-0; //金额
|
|
||||||
body.find("[field='EachAmount']").each(function(){
|
|
||||||
if($(this).find("div").text()!==""){
|
|
||||||
TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
TotalPrice = TotalPrice + EachAmount;
|
|
||||||
footer.find("[field='EachAmount']").find("div").text((TotalPrice).toFixed(2));
|
|
||||||
});
|
|
||||||
},500);
|
|
||||||
}
|
|
||||||
|
|
||||||
//结束编辑
|
|
||||||
function endEditing() {
|
|
||||||
var edField = "";
|
|
||||||
if(!itemType){
|
|
||||||
edField = "InOutItemId";
|
|
||||||
edName = "InOutItemName";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
edField = "AccountId";
|
|
||||||
edName = "AccountName";
|
|
||||||
}
|
|
||||||
if (editIndex == undefined) { return true }
|
|
||||||
if ($('#accountData').datagrid('validateRow', editIndex)) {
|
|
||||||
var ed = $('#accountData').datagrid('getEditor', {index: editIndex, field: edField});
|
|
||||||
var textName =null;
|
|
||||||
if($(ed.target)){
|
|
||||||
textName = $(ed.target).combobox('getText');
|
|
||||||
}
|
|
||||||
$('#accountData').datagrid('getRows')[editIndex][edName] = textName;
|
|
||||||
$('#accountData').datagrid('endEdit', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//单击
|
|
||||||
function onClickRow(index) {
|
|
||||||
if (editIndex != index) {
|
|
||||||
if (endEditing()) {
|
|
||||||
$('#accountData').datagrid('selectRow', index)
|
|
||||||
.datagrid('beginEdit', index);
|
|
||||||
editIndex = index;
|
|
||||||
autoReckon();
|
|
||||||
} else {
|
|
||||||
$('#accountData').datagrid('selectRow', editIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//新增
|
|
||||||
function append() {
|
|
||||||
if (endEditing()) {
|
|
||||||
$('#accountData').datagrid('appendRow', {});
|
|
||||||
editIndex = $('#accountData').datagrid('getRows').length - 1;
|
|
||||||
$('#accountData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
|
||||||
autoReckon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//删除
|
|
||||||
function removeit() {
|
|
||||||
if (editIndex == undefined) { return }
|
|
||||||
$('#accountData').datagrid('cancelEdit', editIndex)
|
|
||||||
.datagrid('deleteRow', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
}
|
|
||||||
//撤销
|
|
||||||
function reject() {
|
|
||||||
$('#accountData').datagrid('rejectChanges');
|
|
||||||
editIndex = undefined;
|
|
||||||
}
|
|
||||||
//判断
|
|
||||||
function CheckData() {
|
|
||||||
var row = $('#accountData').datagrid('getRows');
|
|
||||||
var totalRowNum = "";
|
|
||||||
for (var i = 0; i < row.length; i++) {
|
|
||||||
if(!itemType){
|
|
||||||
if (row[i].InOutItemId == "") {
|
|
||||||
totalRowNum += (i + 1) + "、";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if (row[i].AccountId == "") {
|
|
||||||
totalRowNum += (i + 1) + "、";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (totalRowNum != "") {
|
|
||||||
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
|
|
||||||
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) {
|
|
||||||
if (editIndex != undefined) {
|
|
||||||
$('#accountData').datagrid('endEdit', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
}
|
|
||||||
if (!CheckData())
|
|
||||||
return false;
|
|
||||||
var inserted = $("#accountData").datagrid('getChanges', "inserted");
|
|
||||||
var deleted = $("#accountData").datagrid('getChanges', "deleted");
|
|
||||||
var updated = $("#accountData").datagrid('getChanges', "updated");
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: url,
|
|
||||||
dataType: "json",
|
|
||||||
data: {
|
|
||||||
inserted: JSON.stringify(inserted),
|
|
||||||
deleted: JSON.stringify(deleted),
|
|
||||||
updated: JSON.stringify(updated),
|
|
||||||
info : JSON.stringify({
|
|
||||||
Type: listType,
|
|
||||||
BillNo: $.trim($("#BillNo").val()),
|
|
||||||
BillTime: $.trim($("#BillTime").val()),
|
|
||||||
AccountId: $.trim($("#AccountId").val()),
|
|
||||||
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付
|
|
||||||
TotalPrice: TotalPrice, //合计
|
|
||||||
OrganId: OrganId,
|
|
||||||
HandsPersonId: $.trim($("#HandsPersonId").val()),
|
|
||||||
Remark: $.trim($("#Remark").val())
|
|
||||||
}),
|
|
||||||
listType: listType
|
|
||||||
},
|
|
||||||
success: function (tipInfo)
|
|
||||||
{
|
|
||||||
if (tipInfo) {
|
|
||||||
$.messager.alert('提示','保存成功!','info');
|
|
||||||
$('#accountHeadDlg').dialog('close');
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
showAccountHeadDetails(opts.pageNumber, opts.pageSize);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
|
|
||||||
$.messager.show({
|
|
||||||
title: '错误提示',
|
|
||||||
msg: '保存信息失败,请稍后重试!'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
error: function (XmlHttpRequest, textStatus, errorThrown)
|
|
||||||
{
|
|
||||||
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,706 +0,0 @@
|
|||||||
var listType = "客户"; //类型
|
|
||||||
var listTypeEn ="Customer"; //英文类型
|
|
||||||
//初始化界面
|
|
||||||
$(function() {
|
|
||||||
initTableData();
|
|
||||||
ininPager();
|
|
||||||
bindEvent();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//初始化表格数据
|
|
||||||
function initTableData() {
|
|
||||||
//改变宽度和高度
|
|
||||||
$("#searchPanel").panel({width:webW-2});
|
|
||||||
$("#tablePanel").panel({width:webW-2});
|
|
||||||
$('#tableData').datagrid({
|
|
||||||
//title:'单位列表',
|
|
||||||
//iconCls:'icon-save',
|
|
||||||
//width:700,
|
|
||||||
height:heightInfo,
|
|
||||||
nowrap: false,
|
|
||||||
rownumbers: false,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//fitColumns:true,
|
|
||||||
//单击行是否选中
|
|
||||||
checkOnSelect : false,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
pagination: true,
|
|
||||||
//自动截取数据
|
|
||||||
//nowrap : true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
pageSize: initPageSize,
|
|
||||||
pageList: initPageNum,
|
|
||||||
columns:[[
|
|
||||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
|
||||||
{ title: '操作',field: 'op',align:"center",width:60,formatter:function(value, rec,index)
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/6 9:33
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js实现
|
|
||||||
*/
|
|
||||||
var str = '';
|
|
||||||
// var rowInfo = rec.id + 'AaBb' + rec.supplier +'AaBb' + rec.contacts + 'AaBb'+ rec.phonenum + 'AaBb'+ rec.email + 'AaBb'+ rec.beginneedget + 'AaBb'+ rec.beginneedpay + 'AaBb' + rec.isystem + 'AaBb' + rec.description+ 'AaBb' + rec.type
|
|
||||||
// + 'AaBb' + rec.fax + 'AaBb' + rec.telephone + 'AaBb' + rec.address + 'AaBb' + rec.taxnum + 'AaBb' + rec.bankname + 'AaBb' + rec.accountnumber + 'AaBb' + rec.taxrate;
|
|
||||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editSupplier(\'' + index + '\');"/> ';
|
|
||||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteSupplier(\'' + rec.id + '\');"/>';
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ title: '名称',field: 'supplier',width:150},
|
|
||||||
{ title: '联系人', field: 'contacts',width:50,align:"center"},
|
|
||||||
{ title: '手机号码', field: 'telephone',width:100,align:"center"},
|
|
||||||
{ title: '电子邮箱',field: 'email',width:80,align:"center"},
|
|
||||||
{ title: '联系电话', field: 'phonenum',width:100,align:"center"},
|
|
||||||
{ title: '传真', field: 'fax',width:100,align:"center"},
|
|
||||||
{ title: '预付款',field: 'advancein',width:70,align:"center"},
|
|
||||||
{ title: '期初应收',field: 'beginneedget',width:70,align:"center"},
|
|
||||||
{ title: '期初应付',field: 'beginneedpay',width:70,align:"center"},
|
|
||||||
{ title: '税率(%)', field: 'taxrate',width:50,align:"center"},
|
|
||||||
{ title: '状态',field: 'enabled',width:70,align:"center",formatter:function(value){
|
|
||||||
return value? "启用":"禁用";
|
|
||||||
}}
|
|
||||||
]],
|
|
||||||
toolbar:[
|
|
||||||
{
|
|
||||||
id:'addSupplier',
|
|
||||||
text:'增加',
|
|
||||||
iconCls:'icon-add',
|
|
||||||
handler:function() {
|
|
||||||
addSuppler();
|
|
||||||
}
|
|
||||||
},'-',
|
|
||||||
{
|
|
||||||
id:'deleteSupplier',
|
|
||||||
text:'删除',
|
|
||||||
iconCls:'icon-remove',
|
|
||||||
handler:function() {
|
|
||||||
batDeleteSupplier();
|
|
||||||
}
|
|
||||||
},'-',
|
|
||||||
{
|
|
||||||
id:'setEnable',
|
|
||||||
text:'启用',
|
|
||||||
iconCls:'icon-ok',
|
|
||||||
handler:function() {
|
|
||||||
setEnableFun();
|
|
||||||
}
|
|
||||||
},'-',
|
|
||||||
{
|
|
||||||
id:'setDisEnable',
|
|
||||||
text:'禁用',
|
|
||||||
iconCls:'icon-no',
|
|
||||||
handler:function() {
|
|
||||||
setDisEnableFun();
|
|
||||||
}
|
|
||||||
},'-',
|
|
||||||
{
|
|
||||||
id:'setInput',
|
|
||||||
text:'导入',
|
|
||||||
iconCls:'icon-excel',
|
|
||||||
handler:function() {
|
|
||||||
setInputFun();
|
|
||||||
}
|
|
||||||
},'-',
|
|
||||||
{
|
|
||||||
id:'setOutput',
|
|
||||||
text:'导出',
|
|
||||||
iconCls:'icon-excel',
|
|
||||||
handler:function() {
|
|
||||||
setOutputFun();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
onLoadError:function() {
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
showSupplierDetails(1,initPageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//分页信息处理
|
|
||||||
function ininPager() {
|
|
||||||
try {
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
|
||||||
pager.pagination({
|
|
||||||
onSelectPage:function(pageNum, pageSize)
|
|
||||||
{
|
|
||||||
opts.pageNumber = pageNum;
|
|
||||||
opts.pageSize = pageSize;
|
|
||||||
pager.pagination('refresh', {
|
|
||||||
pageNumber:pageNum,
|
|
||||||
pageSize:pageSize
|
|
||||||
});
|
|
||||||
showSupplierDetails(pageNum,pageSize);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//删除信息
|
|
||||||
function deleteSupplier(id) {
|
|
||||||
$.messager.confirm('删除确认','确定要删除此条信息吗?',function(r) {
|
|
||||||
if (r) {
|
|
||||||
// var supplierTotalInfo = supplierInfo.split("AaBb");
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/supplier/batchDeleteSupplierByIds",
|
|
||||||
dataType: "json",
|
|
||||||
data: ({
|
|
||||||
ids : id
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code == 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
} else {
|
|
||||||
if(res && res.code == 601){
|
|
||||||
var jsondata={};
|
|
||||||
jsondata.ids=id;
|
|
||||||
jsondata.deleteType='2';
|
|
||||||
var type='single';
|
|
||||||
batDeleteSupplierForceConfirm(res,"/supplier/batchDeleteSupplierByIds",jsondata,type);
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
}else{
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('删除提示','删除信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量删除单位
|
|
||||||
function batDeleteSupplier() {
|
|
||||||
var row = $('#tableData').datagrid('getChecked');
|
|
||||||
if(row.length == 0) {
|
|
||||||
$.messager.alert('删除提示','没有记录被选中!','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(row.length > 0) {
|
|
||||||
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条信息吗?',function(r) {
|
|
||||||
if (r) {
|
|
||||||
var ids = "";
|
|
||||||
for(var i = 0;i < row.length; i ++) {
|
|
||||||
if(i == row.length-1)
|
|
||||||
{
|
|
||||||
ids += row[i].id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ids += row[i].id + ",";
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/supplier/batchDeleteSupplierByIds",
|
|
||||||
dataType: "json",
|
|
||||||
async : false,
|
|
||||||
data: ({
|
|
||||||
ids : ids
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
} else {
|
|
||||||
if(res && res.code == 601){
|
|
||||||
var jsondata={};
|
|
||||||
jsondata.ids=ids;
|
|
||||||
jsondata.deleteType='2';
|
|
||||||
var type='batch';
|
|
||||||
batDeleteSupplierForceConfirm(res,"/supplier/batchDeleteSupplierByIds",jsondata,type);
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
}else{
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('删除提示','删除信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 确认强制删除
|
|
||||||
* */
|
|
||||||
function batDeleteSupplierForceConfirm(res,url,jsondata) {
|
|
||||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
|
||||||
if (r) {
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: url,
|
|
||||||
dataType: "json",
|
|
||||||
data: (jsondata),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code == 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
if(type=='batch'){
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
}
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
}else {
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error: function () {
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量启用
|
|
||||||
function setEnableFun() {
|
|
||||||
var row = $('#tableData').datagrid('getChecked');
|
|
||||||
if(row.length == 0) {
|
|
||||||
$.messager.alert('启用提示','没有记录被选中!','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(row.length > 0) {
|
|
||||||
$.messager.confirm('启用确认','确定要启用选中的' + row.length + '条信息吗?',function(r) {
|
|
||||||
if (r) {
|
|
||||||
var ids = "";
|
|
||||||
for(var i = 0;i < row.length; i ++) {
|
|
||||||
if(i == row.length-1) {
|
|
||||||
ids += row[i].id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ids += row[i].id + ",";
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/supplier/batchSetEnable",
|
|
||||||
dataType: "json",
|
|
||||||
async : false,
|
|
||||||
data: ({
|
|
||||||
enabled: true,
|
|
||||||
supplierIDs : ids
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
} else {
|
|
||||||
$.messager.alert('启用提示', '启用信息失败,请稍后再试!', 'error');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('启用提示','启用信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量禁用
|
|
||||||
function setDisEnableFun() {
|
|
||||||
var row = $('#tableData').datagrid('getChecked');
|
|
||||||
if(row.length == 0) {
|
|
||||||
$.messager.alert('禁用提示','没有记录被选中!','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(row.length > 0) {
|
|
||||||
$.messager.confirm('禁用确认','确定要禁用选中的' + row.length + '条信息吗?',function(r) {
|
|
||||||
if (r) {
|
|
||||||
var ids = "";
|
|
||||||
for(var i = 0;i < row.length; i ++) {
|
|
||||||
if(i == row.length-1) {
|
|
||||||
ids += row[i].id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ids += row[i].id + ",";
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/supplier/batchSetEnable",
|
|
||||||
dataType: "json",
|
|
||||||
async : false,
|
|
||||||
data: ({
|
|
||||||
enabled: false,
|
|
||||||
supplierIDs : ids
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
} else {
|
|
||||||
$.messager.alert('禁用提示', '禁用信息失败,请稍后再试!', 'error');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('禁用提示','禁用信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//导入数据
|
|
||||||
function setInputFun(){
|
|
||||||
//IE下不允许编辑 input=file的值 解决思路:重新克隆input=file,把这个input元素复制一个,然后将原来的删除。
|
|
||||||
//在IE下复制元素的时候,其中的值是不会被复制的,所以就达到了清空文件域的目的了。
|
|
||||||
//而在Firefox下,其中的值也会被一同复制,清空一下就做到兼容
|
|
||||||
var fileUploadInput = $("#supplierFile");
|
|
||||||
fileUploadInput.after(fileUploadInput.clone().val(""));
|
|
||||||
fileUploadInput.remove();
|
|
||||||
$("#isCheck").val(1);
|
|
||||||
$('#importExcelDlg').dialog('open').dialog('setTitle','导入' + listType + '信息');
|
|
||||||
$(".window-mask").css({ width: webW-20 ,height: webH});
|
|
||||||
$("#supplierFile").focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
//导出数据
|
|
||||||
function setOutputFun(){
|
|
||||||
var supplier = $.trim($("#searchSupplier").val());
|
|
||||||
var phonenum = $.trim($("#searchPhonenum").val());
|
|
||||||
var telephone = $.trim($("#searchTelephone").val());
|
|
||||||
var description = $.trim($("#searchDesc").val());
|
|
||||||
var browserType=getOs();
|
|
||||||
window.location.href = "/supplier/exportExcel?browserType=" + browserType
|
|
||||||
+ "&supplier=" + supplier + "&type=" + listType + "&phonenum=" + phonenum + "&telephone=" + telephone + "&description=" + description;
|
|
||||||
}
|
|
||||||
|
|
||||||
//增加单位
|
|
||||||
var url;
|
|
||||||
var supplierID = 0;
|
|
||||||
//保存编辑前的名称
|
|
||||||
var oldSupplier = "";
|
|
||||||
|
|
||||||
function addSuppler() {
|
|
||||||
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加'+listType+"信息");
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
$("#supplier").focus();
|
|
||||||
$('#supplierFM').form('clear');
|
|
||||||
oldSupplier = "";
|
|
||||||
supplierID = 0;
|
|
||||||
url = '/supplier/add';
|
|
||||||
}
|
|
||||||
|
|
||||||
function bindEvent(){
|
|
||||||
//导入excel对话框
|
|
||||||
$('#importExcelDlg').dialog({
|
|
||||||
width: 400,
|
|
||||||
closed: true,
|
|
||||||
cache: false,
|
|
||||||
modal: true,
|
|
||||||
collapsible:false,
|
|
||||||
closable: true,
|
|
||||||
buttons:'#dlg-buttons5'
|
|
||||||
});
|
|
||||||
//导入excel表格
|
|
||||||
$("#saveimport").unbind().bind({
|
|
||||||
click:function() {
|
|
||||||
if($("#supplierFile").val().length == 0)
|
|
||||||
{
|
|
||||||
$.messager.alert('提示','请选择文件!','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$("#importExcelFM").submit();
|
|
||||||
$('#importExcelDlg').dialog('close');
|
|
||||||
|
|
||||||
$.messager.progress({
|
|
||||||
title:'请稍候',
|
|
||||||
msg:'数据处理ing...'
|
|
||||||
});
|
|
||||||
setTimeout(function(){
|
|
||||||
$.messager.progress('close');
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
showSupplierDetails(opts.pageNumber,opts.pageSize);
|
|
||||||
},3300);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//保存信息
|
|
||||||
$("#saveSupplier").off("click").on("click", function () {
|
|
||||||
if(validateForm("supplierFM")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (checkSupplierName()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var reg = /^([0-9])+$/;
|
|
||||||
var phonenum = $.trim($("#phonenum").val());
|
|
||||||
if(phonenum.length>0 && !reg.test(phonenum)) {
|
|
||||||
$.messager.alert('提示','电话号码只能是数字','info');
|
|
||||||
$("#phonenum").val("").focus();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var beginNeedGet = $.trim($("#BeginNeedGet").val());
|
|
||||||
var beginNeedPay = $.trim($("#BeginNeedPay").val());
|
|
||||||
if(beginNeedGet && beginNeedPay) {
|
|
||||||
$.messager.alert('提示','期初应收和期初应付不能同时输入','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var obj = $("#supplierFM").serializeObject();
|
|
||||||
obj.type = listType;
|
|
||||||
obj.enabled = 1;
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type:"post",
|
|
||||||
dataType: "json",
|
|
||||||
data:{
|
|
||||||
info: JSON.stringify(obj)
|
|
||||||
},
|
|
||||||
success: function(res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
$('#supplierDlg').dialog('close');
|
|
||||||
//加载完以后重新初始化
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
showSupplierDetails(opts.pageNumber, opts.pageSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//初始化键盘enter事件
|
|
||||||
$(document).keydown(function(event) {
|
|
||||||
//兼容 IE和firefox 事件
|
|
||||||
var e = window.event || event;
|
|
||||||
var k = e.keyCode||e.which||e.charCode;
|
|
||||||
//兼容 IE,firefox 兼容
|
|
||||||
var obj = e.srcElement ? e.srcElement : e.target;
|
|
||||||
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件
|
|
||||||
if(k == "13"&&(obj.id=="supplier" || obj.id=="contacts"|| obj.id=="phonenum"
|
|
||||||
|| obj.id=="email" || obj.id=="description" ))
|
|
||||||
{
|
|
||||||
$("#saveSupplier").click();
|
|
||||||
}
|
|
||||||
|
|
||||||
//搜索按钮添加快捷键
|
|
||||||
if(k == "13"&&(obj.id=="searchSupplier" || obj.id=="searchContacts"|| obj.id=="searchPhonenum"
|
|
||||||
|| obj.id=="searchEmail" || obj.id=="searchDesc" ))
|
|
||||||
{
|
|
||||||
$("#searchBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//搜索处理
|
|
||||||
$("#searchBtn").unbind().bind({
|
|
||||||
click:function() {
|
|
||||||
showSupplierDetails(1,initPageSize);
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
|
||||||
opts.pageNumber = 1;
|
|
||||||
opts.pageSize = initPageSize;
|
|
||||||
pager.pagination('refresh', {
|
|
||||||
pageNumber:1,
|
|
||||||
pageSize:initPageSize
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#searchBtn").click();
|
|
||||||
|
|
||||||
//重置按钮
|
|
||||||
$("#searchResetBtn").unbind().bind({
|
|
||||||
click:function(){
|
|
||||||
$("#searchSupplier").val("");
|
|
||||||
$("#searchType").val("");
|
|
||||||
$("#searchPhonenum").val("");
|
|
||||||
$("#searchTelephone").val("");
|
|
||||||
$("#searchDesc").val("");
|
|
||||||
|
|
||||||
//加载完以后重新初始化
|
|
||||||
$("#searchBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//编辑信息
|
|
||||||
function editSupplier(index) {
|
|
||||||
// var supplierInfo = supplierTotalInfo.split("AaBb");
|
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
var beginNeedGet = rowsdata.beginneedget;
|
|
||||||
var beginNeedPay = rowsdata.beginneedpay;
|
|
||||||
var row = {
|
|
||||||
supplier : rowsdata.supplier,
|
|
||||||
contacts : (rowsdata.contacts).replace("undefined",""),
|
|
||||||
phonenum : (rowsdata.phonenum).replace("undefined",""),
|
|
||||||
email : (rowsdata.email).replace("undefined",""),
|
|
||||||
BeginNeedGet : beginNeedGet == "0"? "":beginNeedGet,
|
|
||||||
BeginNeedPay : beginNeedPay == "0"? "":beginNeedPay,
|
|
||||||
AllNeedGet: "",
|
|
||||||
AllNeedPay: "",
|
|
||||||
description : (rowsdata.description).replace("undefined",""),
|
|
||||||
type : rowsdata.type,
|
|
||||||
fax : (rowsdata.fax).replace("undefined",""),
|
|
||||||
telephone : (rowsdata.telephone).replace("undefined",""),
|
|
||||||
address : (rowsdata.address).replace("undefined",""),
|
|
||||||
taxNum : (rowsdata.taxnum).replace("undefined",""),
|
|
||||||
bankName : (rowsdata.bankname).replace("undefined",""),
|
|
||||||
accountNumber : (rowsdata.accountnumber).replace("undefined",""),
|
|
||||||
taxRate : rowsdata.taxrate==undefined?"":rowsdata.taxrate
|
|
||||||
};
|
|
||||||
oldSupplier = rowsdata.supplier;
|
|
||||||
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑'+listType +"信息");
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
$('#supplierFM').form('load',row);
|
|
||||||
supplierID = rowsdata.id;
|
|
||||||
//焦点在名称输入框==定焦在输入文字后面
|
|
||||||
$("#supplier").val("").focus().val(rowsdata.supplier);
|
|
||||||
url = '/supplier/update?id=' + rowsdata.id;
|
|
||||||
|
|
||||||
//显示累计应收和累计应付
|
|
||||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
|
||||||
var supType = "customer";
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/depotHead/findTotalPay",
|
|
||||||
dataType: "json",
|
|
||||||
async: false,
|
|
||||||
data: ({
|
|
||||||
supplierId: rowsdata.id,
|
|
||||||
endTime:thisDateTime,
|
|
||||||
supType: supType
|
|
||||||
}),
|
|
||||||
success: function(res){
|
|
||||||
if (res && res.code === 200 && res.data && res.data.rows && res.data.rows.getAllMoney !== "") {
|
|
||||||
var moneyA = res.data.rows.getAllMoney.toFixed(2)-0;
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/accountHead/findTotalPay",
|
|
||||||
dataType: "json",
|
|
||||||
async: false,
|
|
||||||
data: ({
|
|
||||||
supplierId: rowsdata.id,
|
|
||||||
endTime:thisDateTime,
|
|
||||||
supType: supType
|
|
||||||
}),
|
|
||||||
success: function(res){
|
|
||||||
if (res && res.code === 200 && res.data && res.data.rows && res.data.rows.getAllMoney !== "") {
|
|
||||||
var moneyB = res.data.rows.getAllMoney.toFixed(2)-0;
|
|
||||||
var money = moneyA+moneyB;
|
|
||||||
var moneyBeginNeedGet = $("#BeginNeedGet").val()-0; //期初应收
|
|
||||||
var moneyBeginNeedPay = $("#BeginNeedPay").val()-0; //期初应付
|
|
||||||
money = (money + moneyBeginNeedGet - moneyBeginNeedPay).toFixed(2);
|
|
||||||
$("#AllNeedGet").val(money); //累计应收
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(){
|
|
||||||
$.messager.alert('提示','网络异常请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(){
|
|
||||||
$.messager.alert('提示','网络异常请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//检查单位名称是否存在 ++ 重名无法提示问题需要跟进
|
|
||||||
function checkSupplierName() {
|
|
||||||
var supplierName = $.trim($("#supplier").val());
|
|
||||||
//表示是否存在 true == 存在 false = 不存在
|
|
||||||
var flag = false;
|
|
||||||
//开始ajax名称检验,不能重名
|
|
||||||
if(supplierName.length > 0 &&( oldSupplier.length ==0 || supplierName != oldSupplier)) {
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/supplier/checkIsNameExist",
|
|
||||||
dataType: "json",
|
|
||||||
async : false,
|
|
||||||
data: ({
|
|
||||||
id : supplierID,
|
|
||||||
name : supplierName
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
if(res.data && res.data.status) {
|
|
||||||
flag = res.data.status;
|
|
||||||
if (flag) {
|
|
||||||
$.messager.alert('提示', '单位名称已经存在', 'info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('提示','检查单位名称是否存在异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function showSupplierDetails(pageNo,pageSize) {
|
|
||||||
var supplier = $.trim($("#searchSupplier").val());
|
|
||||||
var phonenum = $.trim($("#searchPhonenum").val());
|
|
||||||
var telephone = $.trim($("#searchTelephone").val());
|
|
||||||
var description = $.trim($("#searchDesc").val());
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/supplier/list",
|
|
||||||
dataType: "json",
|
|
||||||
data: ({
|
|
||||||
search: JSON.stringify({
|
|
||||||
supplier: supplier,
|
|
||||||
type: listType,
|
|
||||||
phonenum: phonenum,
|
|
||||||
telephone: telephone,
|
|
||||||
description: description
|
|
||||||
}),
|
|
||||||
currentPage: pageNo,
|
|
||||||
pageSize: pageSize
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200){
|
|
||||||
if(res.data && res.data.page) {
|
|
||||||
$("#tableData").datagrid('loadData', res.data.page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,715 +0,0 @@
|
|||||||
var listType = "会员"; //类型
|
|
||||||
var listTypeEn = "Member"; //英文类型
|
|
||||||
//初始化界面
|
|
||||||
$(function() {
|
|
||||||
initTableData();
|
|
||||||
ininPager();
|
|
||||||
bindEvent();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
//初始化表格数据
|
|
||||||
function initTableData() {
|
|
||||||
//改变宽度和高度
|
|
||||||
$("#searchPanel").panel({width:webW-2});
|
|
||||||
$("#tablePanel").panel({width:webW-2});
|
|
||||||
$('#tableData').datagrid({
|
|
||||||
//title:'单位列表',
|
|
||||||
//iconCls:'icon-save',
|
|
||||||
//width:700,
|
|
||||||
height:heightInfo,
|
|
||||||
nowrap: false,
|
|
||||||
rownumbers: false,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//fitColumns:true,
|
|
||||||
//单击行是否选中
|
|
||||||
checkOnSelect : false,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
pagination: true,
|
|
||||||
//自动截取数据
|
|
||||||
//nowrap : true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
pageSize: initPageSize,
|
|
||||||
pageList: initPageNum,
|
|
||||||
columns:[[
|
|
||||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
|
||||||
{ title: '操作',field: 'op',align:"center",width:60,formatter:function(value, rec,index)
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/6 9:33
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js实现
|
|
||||||
*/
|
|
||||||
var str = '';
|
|
||||||
// var rowInfo = rec.id + 'AaBb' + rec.supplier +'AaBb' + rec.contacts + 'AaBb'+ rec.phonenum + 'AaBb'+ rec.email + 'AaBb'+ rec.beginneedget + 'AaBb'+ rec.beginneedpay + 'AaBb' + rec.isystem + 'AaBb' + rec.description+ 'AaBb' + rec.type
|
|
||||||
// + 'AaBb' + rec.fax + 'AaBb' + rec.telephone + 'AaBb' + rec.address + 'AaBb' + rec.taxnum + 'AaBb' + rec.bankname + 'AaBb' + rec.accountnumber + 'AaBb' + rec.taxrate;
|
|
||||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editSupplier(\'' + index + '\');"/> ';
|
|
||||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteSupplier(\'' + rec.id + '\');"/>';
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ title: '名称',field: 'supplier',width:150},
|
|
||||||
{ title: '联系人', field: 'contacts',width:50,align:"center"},
|
|
||||||
{ title: '手机号码', field: 'telephone',width:100,align:"center"},
|
|
||||||
{ title: '电子邮箱',field: 'email',width:80,align:"center"},
|
|
||||||
{ title: '联系电话', field: 'phonenum',width:100,align:"center"},
|
|
||||||
{ title: '传真', field: 'fax',width:100,align:"center"},
|
|
||||||
{ title: '预付款',field: 'advancein',width:70,align:"center"},
|
|
||||||
{ title: '期初应收',field: 'beginneedget',width:70,align:"center"},
|
|
||||||
{ title: '期初应付',field: 'beginneedpay',width:70,align:"center"},
|
|
||||||
{ title: '税率(%)', field: 'taxrate',width:50,align:"center"},
|
|
||||||
{ title: '状态',field: 'enabled',width:70,align:"center",formatter:function(value){
|
|
||||||
return value? "启用":"禁用";
|
|
||||||
}}
|
|
||||||
]],
|
|
||||||
toolbar:[
|
|
||||||
{
|
|
||||||
id:'addSupplier',
|
|
||||||
text:'增加',
|
|
||||||
iconCls:'icon-add',
|
|
||||||
handler:function() {
|
|
||||||
addSuppler();
|
|
||||||
}
|
|
||||||
},'-',
|
|
||||||
{
|
|
||||||
id:'deleteSupplier',
|
|
||||||
text:'删除',
|
|
||||||
iconCls:'icon-remove',
|
|
||||||
handler:function() {
|
|
||||||
batDeleteSupplier();
|
|
||||||
}
|
|
||||||
},'-',
|
|
||||||
{
|
|
||||||
id:'setEnable',
|
|
||||||
text:'启用',
|
|
||||||
iconCls:'icon-ok',
|
|
||||||
handler:function() {
|
|
||||||
setEnableFun();
|
|
||||||
}
|
|
||||||
},'-',
|
|
||||||
{
|
|
||||||
id:'setDisEnable',
|
|
||||||
text:'禁用',
|
|
||||||
iconCls:'icon-no',
|
|
||||||
handler:function() {
|
|
||||||
setDisEnableFun();
|
|
||||||
}
|
|
||||||
},'-',
|
|
||||||
{
|
|
||||||
id:'setInput',
|
|
||||||
text:'导入',
|
|
||||||
iconCls:'icon-excel',
|
|
||||||
handler:function() {
|
|
||||||
setInputFun();
|
|
||||||
}
|
|
||||||
},'-',
|
|
||||||
{
|
|
||||||
id:'setOutput',
|
|
||||||
text:'导出',
|
|
||||||
iconCls:'icon-excel',
|
|
||||||
handler:function() {
|
|
||||||
setOutputFun();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
onLoadError:function() {
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
showSupplierDetails(1,initPageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//分页信息处理
|
|
||||||
function ininPager() {
|
|
||||||
try {
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
|
||||||
pager.pagination({
|
|
||||||
onSelectPage:function(pageNum, pageSize)
|
|
||||||
{
|
|
||||||
opts.pageNumber = pageNum;
|
|
||||||
opts.pageSize = pageSize;
|
|
||||||
pager.pagination('refresh', {
|
|
||||||
pageNumber:pageNum,
|
|
||||||
pageSize:pageSize
|
|
||||||
});
|
|
||||||
showSupplierDetails(pageNum,pageSize);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//删除信息
|
|
||||||
function deleteSupplier(id) {
|
|
||||||
$.messager.confirm('删除确认','确定要删除此条信息吗?',function(r) {
|
|
||||||
if (r) {
|
|
||||||
// var supplierTotalInfo = supplierInfo.split("AaBb");
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/supplier/batchDeleteSupplierByIds",
|
|
||||||
dataType: "json",
|
|
||||||
data: ({
|
|
||||||
ids : id
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code == 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
} else {
|
|
||||||
if(res && res.code == 601){
|
|
||||||
var jsondata={};
|
|
||||||
jsondata.ids=id;
|
|
||||||
jsondata.deleteType='2';
|
|
||||||
var type='single';
|
|
||||||
batDeleteSupplierForceConfirm(res,"/supplier/batchDeleteSupplierByIds",jsondata,type);
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
}else{
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('删除提示','删除信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量删除单位
|
|
||||||
function batDeleteSupplier() {
|
|
||||||
var row = $('#tableData').datagrid('getChecked');
|
|
||||||
if(row.length == 0) {
|
|
||||||
$.messager.alert('删除提示','没有记录被选中!','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(row.length > 0) {
|
|
||||||
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条信息吗?',function(r) {
|
|
||||||
if (r) {
|
|
||||||
var ids = "";
|
|
||||||
for(var i = 0;i < row.length; i ++) {
|
|
||||||
if(i == row.length-1)
|
|
||||||
{
|
|
||||||
ids += row[i].id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ids += row[i].id + ",";
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/supplier/batchDeleteSupplierByIds",
|
|
||||||
dataType: "json",
|
|
||||||
async : false,
|
|
||||||
data: ({
|
|
||||||
ids : ids
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
} else {
|
|
||||||
if(res && res.code == 601){
|
|
||||||
var jsondata={};
|
|
||||||
jsondata.ids=ids;
|
|
||||||
jsondata.deleteType='2';
|
|
||||||
var type='batch';
|
|
||||||
batDeleteSupplierForceConfirm(res,"/supplier/batchDeleteSupplierByIds",jsondata,type);
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
}else{
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('删除提示','删除信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 确认强制删除
|
|
||||||
* */
|
|
||||||
function batDeleteSupplierForceConfirm(res,url,jsondata) {
|
|
||||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
|
||||||
if (r) {
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: url,
|
|
||||||
dataType: "json",
|
|
||||||
data: (jsondata),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code == 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
if(type=='batch'){
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
}
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
}else {
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error: function () {
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量启用
|
|
||||||
function setEnableFun() {
|
|
||||||
var row = $('#tableData').datagrid('getChecked');
|
|
||||||
if(row.length == 0) {
|
|
||||||
$.messager.alert('启用提示','没有记录被选中!','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(row.length > 0) {
|
|
||||||
$.messager.confirm('启用确认','确定要启用选中的' + row.length + '条信息吗?',function(r) {
|
|
||||||
if (r) {
|
|
||||||
var ids = "";
|
|
||||||
for(var i = 0;i < row.length; i ++) {
|
|
||||||
if(i == row.length-1) {
|
|
||||||
ids += row[i].id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ids += row[i].id + ",";
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/supplier/batchSetEnable",
|
|
||||||
dataType: "json",
|
|
||||||
async : false,
|
|
||||||
data: ({
|
|
||||||
enabled: true,
|
|
||||||
supplierIDs : ids
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
} else {
|
|
||||||
$.messager.alert('启用提示', '启用信息失败,请稍后再试!', 'error');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('启用提示','启用信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量禁用
|
|
||||||
function setDisEnableFun() {
|
|
||||||
var row = $('#tableData').datagrid('getChecked');
|
|
||||||
if(row.length == 0) {
|
|
||||||
$.messager.alert('禁用提示','没有记录被选中!','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(row.length > 0) {
|
|
||||||
$.messager.confirm('禁用确认','确定要禁用选中的' + row.length + '条信息吗?',function(r) {
|
|
||||||
if (r) {
|
|
||||||
var ids = "";
|
|
||||||
for(var i = 0;i < row.length; i ++) {
|
|
||||||
if(i == row.length-1) {
|
|
||||||
ids += row[i].id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ids += row[i].id + ",";
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/supplier/batchSetEnable",
|
|
||||||
dataType: "json",
|
|
||||||
async : false,
|
|
||||||
data: ({
|
|
||||||
enabled: false,
|
|
||||||
supplierIDs : ids
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
} else {
|
|
||||||
$.messager.alert('禁用提示', '禁用信息失败,请稍后再试!', 'error');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('禁用提示','禁用信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//导入数据
|
|
||||||
function setInputFun(){
|
|
||||||
//IE下不允许编辑 input=file的值 解决思路:重新克隆input=file,把这个input元素复制一个,然后将原来的删除。
|
|
||||||
//在IE下复制元素的时候,其中的值是不会被复制的,所以就达到了清空文件域的目的了。
|
|
||||||
//而在Firefox下,其中的值也会被一同复制,清空一下就做到兼容
|
|
||||||
var fileUploadInput = $("#supplierFile");
|
|
||||||
fileUploadInput.after(fileUploadInput.clone().val(""));
|
|
||||||
fileUploadInput.remove();
|
|
||||||
$("#isCheck").val(1);
|
|
||||||
$('#importExcelDlg').dialog('open').dialog('setTitle','导入' + listType + '信息');
|
|
||||||
$(".window-mask").css({ width: webW-20 ,height: webH});
|
|
||||||
$("#supplierFile").focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
//导出数据
|
|
||||||
function setOutputFun(){
|
|
||||||
var supplier = $.trim($("#searchSupplier").val());
|
|
||||||
var phonenum = $.trim($("#searchPhonenum").val());
|
|
||||||
var telephone = $.trim($("#searchTelephone").val());
|
|
||||||
var description = $.trim($("#searchDesc").val());
|
|
||||||
var browserType=getOs();
|
|
||||||
window.location.href = "/supplier/exportExcel?browserType=" + browserType
|
|
||||||
+ "&supplier=" + supplier + "&type=" + listType + "&phonenum=" + phonenum + "&telephone=" + telephone + "&description=" + description;
|
|
||||||
}
|
|
||||||
|
|
||||||
//增加单位
|
|
||||||
var url;
|
|
||||||
var supplierID = 0;
|
|
||||||
//保存编辑前的名称
|
|
||||||
var oldSupplier = "";
|
|
||||||
|
|
||||||
function addSuppler() {
|
|
||||||
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加'+listType+"信息");
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
$("#supplier").focus();
|
|
||||||
$('#supplierFM').form('clear');
|
|
||||||
oldSupplier = "";
|
|
||||||
supplierID = 0;
|
|
||||||
url = '/supplier/add';
|
|
||||||
}
|
|
||||||
|
|
||||||
function bindEvent(){
|
|
||||||
//导入excel对话框
|
|
||||||
$('#importExcelDlg').dialog({
|
|
||||||
width: 400,
|
|
||||||
closed: true,
|
|
||||||
cache: false,
|
|
||||||
modal: true,
|
|
||||||
collapsible:false,
|
|
||||||
closable: true,
|
|
||||||
buttons:'#dlg-buttons5'
|
|
||||||
});
|
|
||||||
//导入excel表格
|
|
||||||
$("#saveimport").unbind().bind({
|
|
||||||
click:function() {
|
|
||||||
if($("#supplierFile").val().length == 0)
|
|
||||||
{
|
|
||||||
$.messager.alert('提示','请选择文件!','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$("#importExcelFM").submit();
|
|
||||||
$('#importExcelDlg').dialog('close');
|
|
||||||
|
|
||||||
$.messager.progress({
|
|
||||||
title:'请稍候',
|
|
||||||
msg:'数据处理ing...'
|
|
||||||
});
|
|
||||||
setTimeout(function(){
|
|
||||||
$.messager.progress('close');
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
showSupplierDetails(opts.pageNumber,opts.pageSize);
|
|
||||||
},3300);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//保存信息
|
|
||||||
$("#saveSupplier").off("click").on("click", function () {
|
|
||||||
if(validateForm("supplierFM")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (checkSupplierName()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var reg = /^([0-9])+$/;
|
|
||||||
var phonenum = $.trim($("#phonenum").val());
|
|
||||||
if(phonenum.length>0 && !reg.test(phonenum)) {
|
|
||||||
$.messager.alert('提示','电话号码只能是数字','info');
|
|
||||||
$("#phonenum").val("").focus();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var beginNeedGet = $.trim($("#BeginNeedGet").val());
|
|
||||||
var beginNeedPay = $.trim($("#BeginNeedPay").val());
|
|
||||||
if(beginNeedGet && beginNeedPay) {
|
|
||||||
$.messager.alert('提示','期初应收和期初应付不能同时输入','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var obj = $("#supplierFM").serializeObject();
|
|
||||||
obj.type = listType;
|
|
||||||
obj.enabled = 1;
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type:"post",
|
|
||||||
dataType: "json",
|
|
||||||
data:{
|
|
||||||
info: JSON.stringify(obj)
|
|
||||||
},
|
|
||||||
success: function(res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
$('#supplierDlg').dialog('close');
|
|
||||||
//加载完以后重新初始化
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
showSupplierDetails(opts.pageNumber, opts.pageSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//初始化键盘enter事件
|
|
||||||
$(document).keydown(function(event) {
|
|
||||||
//兼容 IE和firefox 事件
|
|
||||||
var e = window.event || event;
|
|
||||||
var k = e.keyCode||e.which||e.charCode;
|
|
||||||
//兼容 IE,firefox 兼容
|
|
||||||
var obj = e.srcElement ? e.srcElement : e.target;
|
|
||||||
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件
|
|
||||||
if(k == "13"&&(obj.id=="supplier" || obj.id=="contacts"|| obj.id=="phonenum"
|
|
||||||
|| obj.id=="email" || obj.id=="description" ))
|
|
||||||
{
|
|
||||||
$("#saveSupplier").click();
|
|
||||||
}
|
|
||||||
|
|
||||||
//搜索按钮添加快捷键
|
|
||||||
if(k == "13"&&(obj.id=="searchSupplier" || obj.id=="searchContacts"|| obj.id=="searchPhonenum"
|
|
||||||
|| obj.id=="searchEmail" || obj.id=="searchDesc" ))
|
|
||||||
{
|
|
||||||
$("#searchBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//搜索处理
|
|
||||||
$("#searchBtn").unbind().bind({
|
|
||||||
click:function() {
|
|
||||||
showSupplierDetails(1,initPageSize);
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
|
||||||
opts.pageNumber = 1;
|
|
||||||
opts.pageSize = initPageSize;
|
|
||||||
pager.pagination('refresh', {
|
|
||||||
pageNumber:1,
|
|
||||||
pageSize:initPageSize
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#searchBtn").click();
|
|
||||||
|
|
||||||
//重置按钮
|
|
||||||
$("#searchResetBtn").unbind().bind({
|
|
||||||
click:function(){
|
|
||||||
$("#searchSupplier").val("");
|
|
||||||
$("#searchType").val("");
|
|
||||||
$("#searchPhonenum").val("");
|
|
||||||
$("#searchTelephone").val("");
|
|
||||||
$("#searchDesc").val("");
|
|
||||||
|
|
||||||
//加载完以后重新初始化
|
|
||||||
$("#searchBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//编辑信息
|
|
||||||
function editSupplier(index) {
|
|
||||||
// var supplierInfo = supplierTotalInfo.split("AaBb");
|
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
var beginNeedGet = rowsdata.beginneedget;
|
|
||||||
var beginNeedPay = rowsdata.beginneedpay;
|
|
||||||
var row = {
|
|
||||||
supplier : rowsdata.supplier,
|
|
||||||
contacts : (rowsdata.contacts).replace("undefined",""),
|
|
||||||
phonenum : (rowsdata.phonenum).replace("undefined",""),
|
|
||||||
email : (rowsdata.email).replace("undefined",""),
|
|
||||||
BeginNeedGet : beginNeedGet == "0"? "":beginNeedGet,
|
|
||||||
BeginNeedPay : beginNeedPay == "0"? "":beginNeedPay,
|
|
||||||
AllNeedGet: "",
|
|
||||||
AllNeedPay: "",
|
|
||||||
description : (rowsdata.description).replace("undefined",""),
|
|
||||||
type : rowsdata.type,
|
|
||||||
fax : (rowsdata.fax).replace("undefined",""),
|
|
||||||
telephone : (rowsdata.telephone).replace("undefined",""),
|
|
||||||
address : (rowsdata.address).replace("undefined",""),
|
|
||||||
taxNum : (rowsdata.taxnum).replace("undefined",""),
|
|
||||||
bankName : (rowsdata.bankname).replace("undefined",""),
|
|
||||||
accountNumber : (rowsdata.accountnumber).replace("undefined",""),
|
|
||||||
taxRate : rowsdata.taxrate==undefined?"":rowsdata.taxrate
|
|
||||||
};
|
|
||||||
oldSupplier = rowsdata.supplier;
|
|
||||||
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑'+listType +"信息");
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
$('#supplierFM').form('load',row);
|
|
||||||
supplierID = rowsdata.id;
|
|
||||||
//焦点在名称输入框==定焦在输入文字后面
|
|
||||||
$("#supplier").val("").focus().val(rowsdata.supplier);
|
|
||||||
url = '/supplier/update?id=' + rowsdata.id;
|
|
||||||
|
|
||||||
//显示累计应收和累计应付
|
|
||||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
|
||||||
var supType = "customer";
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/depotHead/findTotalPay",
|
|
||||||
dataType: "json",
|
|
||||||
async: false,
|
|
||||||
data: ({
|
|
||||||
supplierId: rowsdata.id,
|
|
||||||
endTime:thisDateTime,
|
|
||||||
supType: supType
|
|
||||||
}),
|
|
||||||
success: function(res){
|
|
||||||
if (res && res.code === 200 && res.data && res.data.rows && res.data.rows.getAllMoney !== "") {
|
|
||||||
var moneyA = res.data.rows.getAllMoney.toFixed(2)-0;
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/accountHead/findTotalPay",
|
|
||||||
dataType: "json",
|
|
||||||
async: false,
|
|
||||||
data: ({
|
|
||||||
supplierId: rowsdata.id,
|
|
||||||
endTime:thisDateTime,
|
|
||||||
supType: supType
|
|
||||||
}),
|
|
||||||
success: function(res){
|
|
||||||
if (res && res.code === 200 && res.data && res.data.rows && res.data.rows.getAllMoney !== "") {
|
|
||||||
var moneyB = res.data.rows.getAllMoney.toFixed(2)-0;
|
|
||||||
var money = moneyA+moneyB;
|
|
||||||
var moneyBeginNeedGet = $("#BeginNeedGet").val()-0; //期初应收
|
|
||||||
var moneyBeginNeedPay = $("#BeginNeedPay").val()-0; //期初应付
|
|
||||||
/**
|
|
||||||
* 会员该做什么操作呢?
|
|
||||||
*
|
|
||||||
* */
|
|
||||||
if(listType === "客户"){
|
|
||||||
money = (money + moneyBeginNeedGet - moneyBeginNeedPay).toFixed(2);
|
|
||||||
$("#AllNeedGet").val(money); //累计应收
|
|
||||||
}
|
|
||||||
else if(listType === "供应商"){
|
|
||||||
money = (money + moneyBeginNeedPay - moneyBeginNeedGet).toFixed(2);
|
|
||||||
$("#AllNeedPay").val(money); //累计应付
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(){
|
|
||||||
$.messager.alert('提示','网络异常请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(){
|
|
||||||
$.messager.alert('提示','网络异常请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//检查单位名称是否存在 ++ 重名无法提示问题需要跟进
|
|
||||||
function checkSupplierName() {
|
|
||||||
var supplierName = $.trim($("#supplier").val());
|
|
||||||
//表示是否存在 true == 存在 false = 不存在
|
|
||||||
var flag = false;
|
|
||||||
//开始ajax名称检验,不能重名
|
|
||||||
if(supplierName.length > 0 &&( oldSupplier.length ==0 || supplierName != oldSupplier)) {
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/supplier/checkIsNameExist",
|
|
||||||
dataType: "json",
|
|
||||||
async : false,
|
|
||||||
data: ({
|
|
||||||
id : supplierID,
|
|
||||||
name : supplierName
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
if(res.data && res.data.status) {
|
|
||||||
flag = res.data.status;
|
|
||||||
if (flag) {
|
|
||||||
$.messager.alert('提示', '单位名称已经存在', 'info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('提示','检查单位名称是否存在异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function showSupplierDetails(pageNo,pageSize) {
|
|
||||||
var supplier = $.trim($("#searchSupplier").val());
|
|
||||||
var phonenum = $.trim($("#searchPhonenum").val());
|
|
||||||
var telephone = $.trim($("#searchTelephone").val());
|
|
||||||
var description = $.trim($("#searchDesc").val());
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/supplier/list",
|
|
||||||
dataType: "json",
|
|
||||||
data: ({
|
|
||||||
search: JSON.stringify({
|
|
||||||
supplier: supplier,
|
|
||||||
type: listType,
|
|
||||||
phonenum: phonenum,
|
|
||||||
telephone: telephone,
|
|
||||||
description: description
|
|
||||||
}),
|
|
||||||
currentPage: pageNo,
|
|
||||||
pageSize: pageSize
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200){
|
|
||||||
if(res.data && res.data.page) {
|
|
||||||
$("#tableData").datagrid('loadData', res.data.page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,705 +0,0 @@
|
|||||||
//初始化界面
|
|
||||||
var listType = "供应商"; //类型
|
|
||||||
var listTypeEn = "Vendor"; //英文类型
|
|
||||||
$(function() {
|
|
||||||
initTableData();
|
|
||||||
ininPager();
|
|
||||||
bindEvent();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
//初始化表格数据
|
|
||||||
function initTableData() {
|
|
||||||
//改变宽度和高度
|
|
||||||
$("#searchPanel").panel({width:webW-2});
|
|
||||||
$("#tablePanel").panel({width:webW-2});
|
|
||||||
$('#tableData').datagrid({
|
|
||||||
//title:'单位列表',
|
|
||||||
//iconCls:'icon-save',
|
|
||||||
//width:700,
|
|
||||||
height:heightInfo,
|
|
||||||
nowrap: false,
|
|
||||||
rownumbers: false,
|
|
||||||
//动画效果
|
|
||||||
animate:false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect : true,
|
|
||||||
collapsible:false,
|
|
||||||
selectOnCheck:false,
|
|
||||||
//fitColumns:true,
|
|
||||||
//单击行是否选中
|
|
||||||
checkOnSelect : false,
|
|
||||||
//交替出现背景
|
|
||||||
striped : true,
|
|
||||||
pagination: true,
|
|
||||||
//自动截取数据
|
|
||||||
//nowrap : true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
pageSize: initPageSize,
|
|
||||||
pageList: initPageNum,
|
|
||||||
columns:[[
|
|
||||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
|
||||||
{ title: '操作',field: 'op',align:"center",width:60,formatter:function(value, rec,index)
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/6 9:33
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js实现
|
|
||||||
*/
|
|
||||||
var str = '';
|
|
||||||
// var rowInfo = rec.id + 'AaBb' + rec.supplier +'AaBb' + rec.contacts + 'AaBb'+ rec.phonenum + 'AaBb'+ rec.email + 'AaBb'+ rec.beginneedget + 'AaBb'+ rec.beginneedpay + 'AaBb' + rec.isystem + 'AaBb' + rec.description+ 'AaBb' + rec.type
|
|
||||||
// + 'AaBb' + rec.fax + 'AaBb' + rec.telephone + 'AaBb' + rec.address + 'AaBb' + rec.taxnum + 'AaBb' + rec.bankname + 'AaBb' + rec.accountnumber + 'AaBb' + rec.taxrate;
|
|
||||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editSupplier(\'' + index + '\');"/> ';
|
|
||||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteSupplier(\'' + rec.id + '\');"/>';
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ title: '名称',field: 'supplier',width:150},
|
|
||||||
{ title: '联系人', field: 'contacts',width:50,align:"center"},
|
|
||||||
{ title: '手机号码', field: 'telephone',width:100,align:"center"},
|
|
||||||
{ title: '电子邮箱',field: 'email',width:80,align:"center"},
|
|
||||||
{ title: '联系电话', field: 'phonenum',width:100,align:"center"},
|
|
||||||
{ title: '传真', field: 'fax',width:100,align:"center"},
|
|
||||||
{ title: '预付款',field: 'advancein',width:70,align:"center"},
|
|
||||||
{ title: '期初应收',field: 'beginneedget',width:70,align:"center"},
|
|
||||||
{ title: '期初应付',field: 'beginneedpay',width:70,align:"center"},
|
|
||||||
{ title: '税率(%)', field: 'taxrate',width:50,align:"center"},
|
|
||||||
{ title: '状态',field: 'enabled',width:70,align:"center",formatter:function(value){
|
|
||||||
return value? "启用":"禁用";
|
|
||||||
}}
|
|
||||||
]],
|
|
||||||
toolbar:[
|
|
||||||
{
|
|
||||||
id:'addSupplier',
|
|
||||||
text:'增加',
|
|
||||||
iconCls:'icon-add',
|
|
||||||
handler:function() {
|
|
||||||
addSuppler();
|
|
||||||
}
|
|
||||||
},'-',
|
|
||||||
{
|
|
||||||
id:'deleteSupplier',
|
|
||||||
text:'删除',
|
|
||||||
iconCls:'icon-remove',
|
|
||||||
handler:function() {
|
|
||||||
batDeleteSupplier();
|
|
||||||
}
|
|
||||||
},'-',
|
|
||||||
{
|
|
||||||
id:'setEnable',
|
|
||||||
text:'启用',
|
|
||||||
iconCls:'icon-ok',
|
|
||||||
handler:function() {
|
|
||||||
setEnableFun();
|
|
||||||
}
|
|
||||||
},'-',
|
|
||||||
{
|
|
||||||
id:'setDisEnable',
|
|
||||||
text:'禁用',
|
|
||||||
iconCls:'icon-no',
|
|
||||||
handler:function() {
|
|
||||||
setDisEnableFun();
|
|
||||||
}
|
|
||||||
},'-',
|
|
||||||
{
|
|
||||||
id:'setInput',
|
|
||||||
text:'导入',
|
|
||||||
iconCls:'icon-excel',
|
|
||||||
handler:function() {
|
|
||||||
setInputFun();
|
|
||||||
}
|
|
||||||
},'-',
|
|
||||||
{
|
|
||||||
id:'setOutput',
|
|
||||||
text:'导出',
|
|
||||||
iconCls:'icon-excel',
|
|
||||||
handler:function() {
|
|
||||||
setOutputFun();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
onLoadError:function() {
|
|
||||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
showSupplierDetails(1,initPageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//分页信息处理
|
|
||||||
function ininPager() {
|
|
||||||
try {
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
|
||||||
pager.pagination({
|
|
||||||
onSelectPage:function(pageNum, pageSize)
|
|
||||||
{
|
|
||||||
opts.pageNumber = pageNum;
|
|
||||||
opts.pageSize = pageSize;
|
|
||||||
pager.pagination('refresh', {
|
|
||||||
pageNumber:pageNum,
|
|
||||||
pageSize:pageSize
|
|
||||||
});
|
|
||||||
showSupplierDetails(pageNum,pageSize);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//删除信息
|
|
||||||
function deleteSupplier(id) {
|
|
||||||
$.messager.confirm('删除确认','确定要删除此条信息吗?',function(r) {
|
|
||||||
if (r) {
|
|
||||||
// var supplierTotalInfo = supplierInfo.split("AaBb");
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/supplier/batchDeleteSupplierByIds",
|
|
||||||
dataType: "json",
|
|
||||||
data: ({
|
|
||||||
ids : id
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code == 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
} else {
|
|
||||||
if(res && res.code == 601){
|
|
||||||
var jsondata={};
|
|
||||||
jsondata.ids=id;
|
|
||||||
jsondata.deleteType='2';
|
|
||||||
var type='single';
|
|
||||||
batDeleteSupplierForceConfirm(res,"/supplier/batchDeleteSupplierByIds",jsondata,type);
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
}else{
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('删除提示','删除信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量删除单位
|
|
||||||
function batDeleteSupplier() {
|
|
||||||
var row = $('#tableData').datagrid('getChecked');
|
|
||||||
if(row.length == 0) {
|
|
||||||
$.messager.alert('删除提示','没有记录被选中!','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(row.length > 0) {
|
|
||||||
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条信息吗?',function(r) {
|
|
||||||
if (r) {
|
|
||||||
var ids = "";
|
|
||||||
for(var i = 0;i < row.length; i ++) {
|
|
||||||
if(i == row.length-1)
|
|
||||||
{
|
|
||||||
ids += row[i].id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ids += row[i].id + ",";
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/supplier/batchDeleteSupplierByIds",
|
|
||||||
dataType: "json",
|
|
||||||
async : false,
|
|
||||||
data: ({
|
|
||||||
ids : ids
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
} else {
|
|
||||||
if(res && res.code == 601){
|
|
||||||
var jsondata={};
|
|
||||||
jsondata.ids=ids;
|
|
||||||
jsondata.deleteType='2';
|
|
||||||
var type='batch';
|
|
||||||
batDeleteSupplierForceConfirm(res,"/supplier/batchDeleteSupplierByIds",jsondata,type);
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
}else{
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('删除提示','删除信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 确认强制删除
|
|
||||||
* */
|
|
||||||
function batDeleteSupplierForceConfirm(res,url,jsondata) {
|
|
||||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
|
||||||
if (r) {
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: url,
|
|
||||||
dataType: "json",
|
|
||||||
data: (jsondata),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code == 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
if(type=='batch'){
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
}
|
|
||||||
}else if(res && res.code == 600){
|
|
||||||
$.messager.alert('删除提示', res.msg, 'error');
|
|
||||||
}else {
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error: function () {
|
|
||||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量启用
|
|
||||||
function setEnableFun() {
|
|
||||||
var row = $('#tableData').datagrid('getChecked');
|
|
||||||
if(row.length == 0) {
|
|
||||||
$.messager.alert('启用提示','没有记录被选中!','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(row.length > 0) {
|
|
||||||
$.messager.confirm('启用确认','确定要启用选中的' + row.length + '条信息吗?',function(r) {
|
|
||||||
if (r) {
|
|
||||||
var ids = "";
|
|
||||||
for(var i = 0;i < row.length; i ++) {
|
|
||||||
if(i == row.length-1) {
|
|
||||||
ids += row[i].id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ids += row[i].id + ",";
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/supplier/batchSetEnable",
|
|
||||||
dataType: "json",
|
|
||||||
async : false,
|
|
||||||
data: ({
|
|
||||||
enabled: true,
|
|
||||||
supplierIDs : ids
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
} else {
|
|
||||||
$.messager.alert('启用提示', '启用信息失败,请稍后再试!', 'error');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('启用提示','启用信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量禁用
|
|
||||||
function setDisEnableFun() {
|
|
||||||
var row = $('#tableData').datagrid('getChecked');
|
|
||||||
if(row.length == 0) {
|
|
||||||
$.messager.alert('禁用提示','没有记录被选中!','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(row.length > 0) {
|
|
||||||
$.messager.confirm('禁用确认','确定要禁用选中的' + row.length + '条信息吗?',function(r) {
|
|
||||||
if (r) {
|
|
||||||
var ids = "";
|
|
||||||
for(var i = 0;i < row.length; i ++) {
|
|
||||||
if(i == row.length-1) {
|
|
||||||
ids += row[i].id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ids += row[i].id + ",";
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/supplier/batchSetEnable",
|
|
||||||
dataType: "json",
|
|
||||||
async : false,
|
|
||||||
data: ({
|
|
||||||
enabled: false,
|
|
||||||
supplierIDs : ids
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
$("#searchBtn").click();
|
|
||||||
$(":checkbox").attr("checked", false);
|
|
||||||
} else {
|
|
||||||
$.messager.alert('禁用提示', '禁用信息失败,请稍后再试!', 'error');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('禁用提示','禁用信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//导入数据
|
|
||||||
function setInputFun(){
|
|
||||||
//IE下不允许编辑 input=file的值 解决思路:重新克隆input=file,把这个input元素复制一个,然后将原来的删除。
|
|
||||||
//在IE下复制元素的时候,其中的值是不会被复制的,所以就达到了清空文件域的目的了。
|
|
||||||
//而在Firefox下,其中的值也会被一同复制,清空一下就做到兼容
|
|
||||||
var fileUploadInput = $("#supplierFile");
|
|
||||||
fileUploadInput.after(fileUploadInput.clone().val(""));
|
|
||||||
fileUploadInput.remove();
|
|
||||||
$("#isCheck").val(1);
|
|
||||||
$('#importExcelDlg').dialog('open').dialog('setTitle','导入' + listType + '信息');
|
|
||||||
$(".window-mask").css({ width: webW-20 ,height: webH});
|
|
||||||
$("#supplierFile").focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
//导出数据
|
|
||||||
function setOutputFun(){
|
|
||||||
var supplier = $.trim($("#searchSupplier").val());
|
|
||||||
var phonenum = $.trim($("#searchPhonenum").val());
|
|
||||||
var telephone = $.trim($("#searchTelephone").val());
|
|
||||||
var description = $.trim($("#searchDesc").val());
|
|
||||||
var browserType=getOs();
|
|
||||||
window.location.href = "/supplier/exportExcel?browserType=" + browserType
|
|
||||||
+ "&supplier=" + supplier + "&type=" + listType + "&phonenum=" + phonenum + "&telephone=" + telephone + "&description=" + description;
|
|
||||||
}
|
|
||||||
|
|
||||||
//增加单位
|
|
||||||
var url;
|
|
||||||
var supplierID = 0;
|
|
||||||
//保存编辑前的名称
|
|
||||||
var oldSupplier = "";
|
|
||||||
|
|
||||||
function addSuppler() {
|
|
||||||
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加'+listType+"信息");
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
$("#supplier").focus();
|
|
||||||
$('#supplierFM').form('clear');
|
|
||||||
oldSupplier = "";
|
|
||||||
supplierID = 0;
|
|
||||||
url = '/supplier/add';
|
|
||||||
}
|
|
||||||
|
|
||||||
function bindEvent(){
|
|
||||||
//导入excel对话框
|
|
||||||
$('#importExcelDlg').dialog({
|
|
||||||
width: 400,
|
|
||||||
closed: true,
|
|
||||||
cache: false,
|
|
||||||
modal: true,
|
|
||||||
collapsible:false,
|
|
||||||
closable: true,
|
|
||||||
buttons:'#dlg-buttons5'
|
|
||||||
});
|
|
||||||
//导入excel表格
|
|
||||||
$("#saveimport").unbind().bind({
|
|
||||||
click:function() {
|
|
||||||
if($("#supplierFile").val().length == 0)
|
|
||||||
{
|
|
||||||
$.messager.alert('提示','请选择文件!','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$("#importExcelFM").submit();
|
|
||||||
$('#importExcelDlg').dialog('close');
|
|
||||||
|
|
||||||
$.messager.progress({
|
|
||||||
title:'请稍候',
|
|
||||||
msg:'数据处理ing...'
|
|
||||||
});
|
|
||||||
setTimeout(function(){
|
|
||||||
$.messager.progress('close');
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
showSupplierDetails(opts.pageNumber,opts.pageSize);
|
|
||||||
},3300);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//保存信息
|
|
||||||
$("#saveSupplier").off("click").on("click", function () {
|
|
||||||
if(validateForm("supplierFM")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (checkSupplierName()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var reg = /^([0-9])+$/;
|
|
||||||
var phonenum = $.trim($("#phonenum").val());
|
|
||||||
if(phonenum.length>0 && !reg.test(phonenum)) {
|
|
||||||
$.messager.alert('提示','电话号码只能是数字','info');
|
|
||||||
$("#phonenum").val("").focus();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var beginNeedGet = $.trim($("#BeginNeedGet").val());
|
|
||||||
var beginNeedPay = $.trim($("#BeginNeedPay").val());
|
|
||||||
if(beginNeedGet && beginNeedPay) {
|
|
||||||
$.messager.alert('提示','期初应收和期初应付不能同时输入','info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var obj = $("#supplierFM").serializeObject();
|
|
||||||
obj.type = listType;
|
|
||||||
obj.enabled = 1;
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
type:"post",
|
|
||||||
dataType: "json",
|
|
||||||
data:{
|
|
||||||
info: JSON.stringify(obj)
|
|
||||||
},
|
|
||||||
success: function(res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
$('#supplierDlg').dialog('close');
|
|
||||||
//加载完以后重新初始化
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
showSupplierDetails(opts.pageNumber, opts.pageSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//初始化键盘enter事件
|
|
||||||
$(document).keydown(function(event) {
|
|
||||||
//兼容 IE和firefox 事件
|
|
||||||
var e = window.event || event;
|
|
||||||
var k = e.keyCode||e.which||e.charCode;
|
|
||||||
//兼容 IE,firefox 兼容
|
|
||||||
var obj = e.srcElement ? e.srcElement : e.target;
|
|
||||||
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件
|
|
||||||
if(k == "13"&&(obj.id=="supplier" || obj.id=="contacts"|| obj.id=="phonenum"
|
|
||||||
|| obj.id=="email" || obj.id=="description" ))
|
|
||||||
{
|
|
||||||
$("#saveSupplier").click();
|
|
||||||
}
|
|
||||||
|
|
||||||
//搜索按钮添加快捷键
|
|
||||||
if(k == "13"&&(obj.id=="searchSupplier" || obj.id=="searchContacts"|| obj.id=="searchPhonenum"
|
|
||||||
|| obj.id=="searchEmail" || obj.id=="searchDesc" ))
|
|
||||||
{
|
|
||||||
$("#searchBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//搜索处理
|
|
||||||
$("#searchBtn").unbind().bind({
|
|
||||||
click:function() {
|
|
||||||
showSupplierDetails(1,initPageSize);
|
|
||||||
var opts = $("#tableData").datagrid('options');
|
|
||||||
var pager = $("#tableData").datagrid('getPager');
|
|
||||||
opts.pageNumber = 1;
|
|
||||||
opts.pageSize = initPageSize;
|
|
||||||
pager.pagination('refresh', {
|
|
||||||
pageNumber:1,
|
|
||||||
pageSize:initPageSize
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#searchBtn").click();
|
|
||||||
|
|
||||||
//重置按钮
|
|
||||||
$("#searchResetBtn").unbind().bind({
|
|
||||||
click:function(){
|
|
||||||
$("#searchSupplier").val("");
|
|
||||||
$("#searchType").val("");
|
|
||||||
$("#searchPhonenum").val("");
|
|
||||||
$("#searchTelephone").val("");
|
|
||||||
$("#searchDesc").val("");
|
|
||||||
|
|
||||||
//加载完以后重新初始化
|
|
||||||
$("#searchBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//编辑信息
|
|
||||||
function editSupplier(index) {
|
|
||||||
// var supplierInfo = supplierTotalInfo.split("AaBb");
|
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
var beginNeedGet = rowsdata.beginneedget;
|
|
||||||
var beginNeedPay = rowsdata.beginneedpay;
|
|
||||||
var row = {
|
|
||||||
supplier : rowsdata.supplier,
|
|
||||||
contacts : (rowsdata.contacts).replace("undefined",""),
|
|
||||||
phonenum : (rowsdata.phonenum).replace("undefined",""),
|
|
||||||
email : (rowsdata.email).replace("undefined",""),
|
|
||||||
BeginNeedGet : beginNeedGet == "0"? "":beginNeedGet,
|
|
||||||
BeginNeedPay : beginNeedPay == "0"? "":beginNeedPay,
|
|
||||||
AllNeedGet: "",
|
|
||||||
AllNeedPay: "",
|
|
||||||
description : (rowsdata.description).replace("undefined",""),
|
|
||||||
type : rowsdata.type,
|
|
||||||
fax : (rowsdata.fax).replace("undefined",""),
|
|
||||||
telephone : (rowsdata.telephone).replace("undefined",""),
|
|
||||||
address : (rowsdata.address).replace("undefined",""),
|
|
||||||
taxNum : (rowsdata.taxnum).replace("undefined",""),
|
|
||||||
bankName : (rowsdata.bankname).replace("undefined",""),
|
|
||||||
accountNumber : (rowsdata.accountnumber).replace("undefined",""),
|
|
||||||
taxRate : rowsdata.taxrate==undefined?"":rowsdata.taxrate
|
|
||||||
};
|
|
||||||
oldSupplier = rowsdata.supplier;
|
|
||||||
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑'+listType +"信息");
|
|
||||||
$(".window-mask").css({ width: webW ,height: webH});
|
|
||||||
$('#supplierFM').form('load',row);
|
|
||||||
supplierID = rowsdata.id;
|
|
||||||
//焦点在名称输入框==定焦在输入文字后面
|
|
||||||
$("#supplier").val("").focus().val(rowsdata.supplier);
|
|
||||||
url = '/supplier/update?id=' + rowsdata.id;
|
|
||||||
|
|
||||||
//显示累计应收和累计应付
|
|
||||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
|
||||||
var supType = "vendor";
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/depotHead/findTotalPay",
|
|
||||||
dataType: "json",
|
|
||||||
async: false,
|
|
||||||
data: ({
|
|
||||||
supplierId: rowsdata.id,
|
|
||||||
endTime:thisDateTime,
|
|
||||||
supType: supType
|
|
||||||
}),
|
|
||||||
success: function(res){
|
|
||||||
if (res && res.code === 200 && res.data && res.data.rows && res.data.rows.getAllMoney !== "") {
|
|
||||||
var moneyA = res.data.rows.getAllMoney.toFixed(2)-0;
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/accountHead/findTotalPay",
|
|
||||||
dataType: "json",
|
|
||||||
async: false,
|
|
||||||
data: ({
|
|
||||||
supplierId: rowsdata.id,
|
|
||||||
endTime:thisDateTime,
|
|
||||||
supType: supType
|
|
||||||
}),
|
|
||||||
success: function(res){
|
|
||||||
if (res && res.code === 200 && res.data && res.data.rows && res.data.rows.getAllMoney !== "") {
|
|
||||||
var moneyB = res.data.rows.getAllMoney.toFixed(2)-0;
|
|
||||||
var money = moneyA+moneyB;
|
|
||||||
var moneyBeginNeedGet = $("#BeginNeedGet").val()-0; //期初应收
|
|
||||||
var moneyBeginNeedPay = $("#BeginNeedPay").val()-0; //期初应付
|
|
||||||
money = (money + moneyBeginNeedPay - moneyBeginNeedGet).toFixed(2);
|
|
||||||
$("#AllNeedPay").val(money); //累计应付
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(){
|
|
||||||
$.messager.alert('提示','网络异常请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(){
|
|
||||||
$.messager.alert('提示','网络异常请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//检查单位名称是否存在 ++ 重名无法提示问题需要跟进
|
|
||||||
function checkSupplierName() {
|
|
||||||
var supplierName = $.trim($("#supplier").val());
|
|
||||||
//表示是否存在 true == 存在 false = 不存在
|
|
||||||
var flag = false;
|
|
||||||
//开始ajax名称检验,不能重名
|
|
||||||
if(supplierName.length > 0 &&( oldSupplier.length ==0 || supplierName != oldSupplier)) {
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/supplier/checkIsNameExist",
|
|
||||||
dataType: "json",
|
|
||||||
async : false,
|
|
||||||
data: ({
|
|
||||||
id : supplierID,
|
|
||||||
name : supplierName
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
if(res.data && res.data.status) {
|
|
||||||
flag = res.data.status;
|
|
||||||
if (flag) {
|
|
||||||
$.messager.alert('提示', '单位名称已经存在', 'info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('提示','检查单位名称是否存在异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function showSupplierDetails(pageNo,pageSize) {
|
|
||||||
var supplier = $.trim($("#searchSupplier").val());
|
|
||||||
var phonenum = $.trim($("#searchPhonenum").val());
|
|
||||||
var telephone = $.trim($("#searchTelephone").val());
|
|
||||||
var description = $.trim($("#searchDesc").val());
|
|
||||||
$.ajax({
|
|
||||||
type:"get",
|
|
||||||
url: "/supplier/list",
|
|
||||||
dataType: "json",
|
|
||||||
data: ({
|
|
||||||
search: JSON.stringify({
|
|
||||||
supplier: supplier,
|
|
||||||
type: listType,
|
|
||||||
phonenum: phonenum,
|
|
||||||
telephone: telephone,
|
|
||||||
description: description
|
|
||||||
}),
|
|
||||||
currentPage: pageNo,
|
|
||||||
pageSize: pageSize
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200){
|
|
||||||
if(res.data && res.data.page) {
|
|
||||||
$("#tableData").datagrid('loadData', res.data.page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//此处添加错误处理
|
|
||||||
error:function() {
|
|
||||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@
|
|||||||
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<script src="/js/pages/financial/advance_in.js"></script>
|
<script src="/js/pages/financial/financial_base.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- 数据显示table -->
|
<!-- 数据显示table -->
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<script src="/js/pages/financial/giro.js"></script>
|
<script src="/js/pages/financial/financial_base.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- 数据显示table -->
|
<!-- 数据显示table -->
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<script src="/js/pages/financial/item_in.js"></script>
|
<script src="/js/pages/financial/financial_base.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- 数据显示table -->
|
<!-- 数据显示table -->
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<script src="/js/pages/financial/item_out.js"></script>
|
<script src="/js/pages/financial/financial_base.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- 数据显示table -->
|
<!-- 数据显示table -->
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<script src="/js/pages/financial/money_in.js"></script>
|
<script src="/js/pages/financial/financial_base.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- 数据显示table -->
|
<!-- 数据显示table -->
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<script src="/js/pages/financial/money_out.js"></script>
|
<script src="/js/pages/financial/financial_base.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- 数据显示table -->
|
<!-- 数据显示table -->
|
||||||
|
|||||||
@@ -129,18 +129,12 @@
|
|||||||
},
|
},
|
||||||
{title: '备注', field: 'remark', width: 100},
|
{title: '备注', field: 'remark', width: 100},
|
||||||
{
|
{
|
||||||
title: '操作', field: 'op', align: "center", width: 210, formatter: function (value, rec,index) {
|
title: '操作', field: 'op', align: "center", width: 210, formatter: function (value, rec) {
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/5 10:30
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js实现
|
|
||||||
*/
|
|
||||||
var str = '';
|
var str = '';
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountInOutList(\'' + index + '\');"/> <a onclick="showAccountInOutList(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">流水</a> ';
|
var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.serialno + 'AaBb' + rec.initialamount + 'AaBb' + rec.currentamount + 'AaBb' + rec.remark;
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccount(\'' + index + '\');"/> <a onclick="editAccount(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountInOutList(\'' + rowInfo + '\');"/> <a onclick="showAccountInOutList(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">流水</a> ';
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccount(\'' + rec.id + '\');"/> <a onclick="deleteAccount(\'' + rec.id + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccount(\'' + rowInfo + '\');"/> <a onclick="editAccount(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||||
|
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccount(\'' + rowInfo + '\');"/> <a onclick="deleteAccount(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -221,16 +215,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//删除结算账户
|
//删除结算账户
|
||||||
function deleteAccount(id) {
|
function deleteAccount(accountInfo) {
|
||||||
$.messager.confirm('删除确认', '确定要删除此结算账户吗?', function (r) {
|
$.messager.confirm('删除确认', '确定要删除此结算账户吗?', function (r) {
|
||||||
if (r) {
|
if (r) {
|
||||||
// var accountTotalInfo = accountInfo.split("AaBb");
|
var accountTotalInfo = accountInfo.split("AaBb");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
url: "/account/batchDeleteAccountByIds",
|
url: "/account/batchDeleteAccountByIds",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: ({
|
data: ({
|
||||||
ids: id
|
ids: accountTotalInfo[0]
|
||||||
}),
|
}),
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
if(res && res.code == 200) {
|
if(res && res.code == 200) {
|
||||||
@@ -238,7 +232,7 @@
|
|||||||
} else {
|
} else {
|
||||||
if(res && res.code == 601){
|
if(res && res.code == 601){
|
||||||
var jsondata={};
|
var jsondata={};
|
||||||
jsondata.ids=id;
|
jsondata.ids=accountTotalInfo[0];
|
||||||
jsondata.deleteType='2';
|
jsondata.deleteType='2';
|
||||||
var type='single';
|
var type='single';
|
||||||
batDeleteAccountForceConfirm(res,"/account/batchDeleteAccountByIds",jsondata,type);
|
batDeleteAccountForceConfirm(res,"/account/batchDeleteAccountByIds",jsondata,type);
|
||||||
@@ -443,22 +437,23 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//编辑结算账户
|
//编辑结算账户
|
||||||
function editAccount(index) {
|
function editAccount(accountTotalInfo) {
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
var accountInfo = accountTotalInfo.split("AaBb");
|
||||||
var row = {
|
var row = {
|
||||||
name: rowsdata.name,
|
name: accountInfo[1],
|
||||||
serialNo: rowsdata.serialNo,
|
serialNo: accountInfo[2],
|
||||||
initialAmount: rowsdata.initialamount,
|
initialAmount: accountInfo[3],
|
||||||
currentAmount: rowsdata.currentamount,
|
currentAmount: accountInfo[4],
|
||||||
remark: rowsdata.remark
|
remark: accountInfo[5]
|
||||||
};
|
};
|
||||||
oldAccount = rowsdata.name;
|
oldAccount = accountInfo[1];
|
||||||
$('#accountDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑结算账户');
|
$('#accountDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑结算账户');
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
$('#accountFM').form('load', row);
|
$('#accountFM').form('load', row);
|
||||||
|
accountID = accountInfo[0];
|
||||||
//焦点在名称输入框==定焦在输入文字后面
|
//焦点在名称输入框==定焦在输入文字后面
|
||||||
$("#account").val("").focus().val(rowsdata.name);
|
$("#account").val("").focus().val(accountInfo[1]);
|
||||||
url = '/account/update?id=' + rowsdata.id;
|
url = '/account/update?id=' + accountInfo[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
//检查结算账户 名称是否存在 ++ 重名无法提示问题需要跟进
|
//检查结算账户 名称是否存在 ++ 重名无法提示问题需要跟进
|
||||||
@@ -545,11 +540,10 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function showAccountInOutList(index) {
|
function showAccountInOutList(accountInfo) {
|
||||||
//获取当前行
|
var info = accountInfo.split("AaBb");
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
var accountId = info[0];
|
||||||
var accountId = rowsdata.id;
|
var initialAmount = info[3];
|
||||||
var initialAmount = rowsdata.serialno;
|
|
||||||
$('#accountDetailListDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 查看账户流水');
|
$('#accountDetailListDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 查看账户流水');
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
initAccountDetailData(accountId);
|
initAccountDetailData(accountId);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<script type="text/javascript" src="/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
<script type="text/javascript" src="/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
||||||
<script type="text/javascript" src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
<script type="text/javascript" src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||||
<script type="text/javascript" src="/js/common/common.js"></script>
|
<script type="text/javascript" src="/js/common/common.js"></script>
|
||||||
<script src="/js/pages/manage/customer.js"></script>
|
<script src="/js/pages/manage/supplier.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- 数据显示table -->
|
<!-- 数据显示table -->
|
||||||
|
|||||||
@@ -483,26 +483,25 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//编辑信息
|
//编辑信息
|
||||||
function editDepot(index) {
|
function editDepot(depotTotalInfo) {
|
||||||
// var depotInfo = depotTotalInfo.split("AaBb");
|
var depotInfo = depotTotalInfo.split("AaBb");
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
|
|
||||||
$("#name").focus().val(rowsdata.name);
|
$("#name").focus().val(depotInfo[1]);
|
||||||
$("#sort").val(rowsdata.sort);
|
$("#sort").val(depotInfo[2]);
|
||||||
$("#remark").val(rowsdata.remark);
|
$("#remark").val(depotInfo[3]);
|
||||||
$("#address").val(rowsdata.address);
|
$("#address").val(depotInfo[4]);
|
||||||
$("#warehousing").val(rowsdata.warehousing);
|
$("#warehousing").val(depotInfo[5].replace("undefined",""));
|
||||||
$("#truckage").val(rowsdata.truckage);
|
$("#truckage").val(depotInfo[6].replace("undefined",""));
|
||||||
$("#principalName").val(transferUndefined(rowsdata.principalName));
|
$("#principalName").val(depotInfo[7]);
|
||||||
$("#principal").val(transferUndefined(rowsdata.principal));
|
$("#principal").val(depotInfo[8]);
|
||||||
$("#selectType").val("principal");
|
$("#selectType").val("principal");
|
||||||
oldDepot = rowsdata.name;
|
oldDepot = depotInfo[1];
|
||||||
$('#depotDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑仓库信息');
|
$('#depotDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑仓库信息');
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
depotID = rowsdata.id;
|
depotID = depotInfo[0];
|
||||||
//焦点在名称输入框==定焦在输入文字后面
|
//焦点在名称输入框==定焦在输入文字后面
|
||||||
$("#name").val("").focus().val(rowsdata.name);
|
$("#name").val("").focus().val(depotInfo[1]);
|
||||||
url = '/depot/update?id=' + rowsdata.id;
|
url = '/depot/update?id=' + depotInfo[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
//检查名称是否存在 ++ 重名无法提示问题需要跟进
|
//检查名称是否存在 ++ 重名无法提示问题需要跟进
|
||||||
|
|||||||
@@ -167,11 +167,11 @@
|
|||||||
},
|
},
|
||||||
{title: '类型', field: 'type', width: 50},
|
{title: '类型', field: 'type', width: 50},
|
||||||
{
|
{
|
||||||
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec,index) {
|
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec) {
|
||||||
var str = '';
|
var str = '';
|
||||||
// var rowInfo = rec.id + 'AaBb' + rec.number + 'AaBb' + rec.name + 'AaBb' + rec.pnumber + 'AaBb' + rec.url
|
var rowInfo = rec.id + 'AaBb' + rec.number + 'AaBb' + rec.name + 'AaBb' + rec.pnumber + 'AaBb' + rec.url
|
||||||
// + 'AaBb' + rec.state + 'AaBb' + rec.sort + 'AaBb' + rec.enabled + 'AaBb' + rec.type + 'AaBb' + rec.pushbtn;
|
+ 'AaBb' + rec.state + 'AaBb' + rec.sort + 'AaBb' + rec.enabled + 'AaBb' + rec.type + 'AaBb' + rec.pushbtn;
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editFunctions(\'' + index + '\');"/> <a onclick="editFunctions(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editFunctions(\'' + rowInfo + '\');"/> <a onclick="editFunctions(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteFunctions(' + rec.id + ');"/> <a onclick="deleteFunctions(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteFunctions(' + rec.id + ');"/> <a onclick="deleteFunctions(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@@ -381,20 +381,19 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//编辑信息
|
//编辑信息
|
||||||
function editFunctions(index) {
|
function editFunctions(functionsTotalInfo) {
|
||||||
// var functionsInfo = functionsTotalInfo.split("AaBb");
|
var functionsInfo = functionsTotalInfo.split("AaBb");
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
$("#Number").focus().val(rowsdata.number);
|
$("#Number").focus().val(functionsInfo[1]);
|
||||||
$("#Name").focus().val(rowsdata.name);
|
$("#Name").focus().val(functionsInfo[2]);
|
||||||
$("#PNumber").focus().val(rowsdata.pnumber);
|
$("#PNumber").focus().val(functionsInfo[3]);
|
||||||
$("#URL").focus().val(rowsdata.url);
|
$("#URL").focus().val(functionsInfo[4]);
|
||||||
$("#State").attr("checked", rowsdata.state === true ? true : false);
|
$("#State").attr("checked", functionsInfo[5] == 'true' ? true : false);
|
||||||
$("#Sort").focus().val(rowsdata.sort);
|
$("#Sort").focus().val(functionsInfo[6]);
|
||||||
$("#Enabled").attr("checked", rowsdata.enabled === true ? true : false);
|
$("#Enabled").attr("checked", functionsInfo[7] == 'true' ? true : false);
|
||||||
$("#Type").focus().val(rowsdata.type);
|
$("#Type").focus().val(functionsInfo[8]);
|
||||||
var pushbtn=rowsdata.pushbtn;
|
if (functionsInfo[9] !== "undefined" && functionsInfo[9] !== "") {
|
||||||
if (pushbtn) {
|
var arr = functionsInfo[9].split(",");
|
||||||
var arr = pushbtn.split(",");
|
|
||||||
var pushBtnArray = [];
|
var pushBtnArray = [];
|
||||||
for (var i = 0; i < arr.length; i++) {
|
for (var i = 0; i < arr.length; i++) {
|
||||||
if (arr[i]) {
|
if (arr[i]) {
|
||||||
@@ -409,13 +408,13 @@
|
|||||||
$("#PushBtn").combobox('setValues', '');
|
$("#PushBtn").combobox('setValues', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
oldFunctions = rowsdata.name;
|
oldFunctions = functionsInfo[2];
|
||||||
$('#functionsDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑功能信息');
|
$('#functionsDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑功能信息');
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
functionsID = rowsdata.id;
|
functionsID = functionsInfo[0];
|
||||||
//焦点在名称输入框==定焦在输入文字后面
|
//焦点在名称输入框==定焦在输入文字后面
|
||||||
$("#Name").val("").focus().val(rowsdata.name);
|
$("#Name").val("").focus().val(functionsInfo[2]);
|
||||||
url = '/functions/update?id=' + rowsdata.id;
|
url = '/functions/update?id=' + functionsInfo[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
//检查名称是否存在 ++ 重名无法提示问题需要跟进
|
//检查名称是否存在 ++ 重名无法提示问题需要跟进
|
||||||
|
|||||||
@@ -136,18 +136,11 @@
|
|||||||
{title: '类型', field: 'type', width: 100, align: "center"},
|
{title: '类型', field: 'type', width: 100, align: "center"},
|
||||||
{title: '描述', field: 'remark', width: 200},
|
{title: '描述', field: 'remark', width: 200},
|
||||||
{
|
{
|
||||||
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec,index) {
|
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec) {
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/5 10:30
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js实现
|
|
||||||
*/
|
|
||||||
var str = '';
|
var str = '';
|
||||||
// var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.type + 'AaBb' + rec.remark;
|
var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.type + 'AaBb' + rec.remark;
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editInOutItem(\'' + index + '\');"/> <a onclick="editInOutItem(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editInOutItem(\'' + rowInfo + '\');"/> <a onclick="editInOutItem(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteInOutItem(\'' + rec.id + '\');"/> <a onclick="deleteInOutItem(\'' + rec.id + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteInOutItem(\'' + rowInfo + '\');"/> <a onclick="deleteInOutItem(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -221,16 +214,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//删除收支项目
|
//删除收支项目
|
||||||
function deleteInOutItem(id) {
|
function deleteInOutItem(inOutItemInfo) {
|
||||||
$.messager.confirm('删除确认', '确定要删除此收支项目吗?', function (r) {
|
$.messager.confirm('删除确认', '确定要删除此收支项目吗?', function (r) {
|
||||||
if (r) {
|
if (r) {
|
||||||
// var inOutItemTotalInfo = inOutItemInfo.split("AaBb");
|
var inOutItemTotalInfo = inOutItemInfo.split("AaBb");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
url: "/inOutItem/batchDeleteInOutItemByIds",
|
url: "/inOutItem/batchDeleteInOutItemByIds",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: ({
|
data: ({
|
||||||
ids: id
|
ids: inOutItemTotalInfo[0]
|
||||||
}),
|
}),
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
if(res && res.code == 200) {
|
if(res && res.code == 200) {
|
||||||
@@ -238,7 +231,7 @@
|
|||||||
} else {
|
} else {
|
||||||
if(res && res.code == 601){
|
if(res && res.code == 601){
|
||||||
var jsondata={};
|
var jsondata={};
|
||||||
jsondata.ids=id;
|
jsondata.ids=inOutItemTotalInfo[0];
|
||||||
jsondata.deleteType='2';
|
jsondata.deleteType='2';
|
||||||
var type='single';
|
var type='single';
|
||||||
batDeleteInOutItemForceConfirm(res,"/inOutItem/batchDeleteInOutItemByIds",jsondata,type);
|
batDeleteInOutItemForceConfirm(res,"/inOutItem/batchDeleteInOutItemByIds",jsondata,type);
|
||||||
@@ -400,23 +393,21 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//编辑收支项目
|
//编辑收支项目
|
||||||
function editInOutItem(index) {
|
function editInOutItem(inOutItemTotalInfo) {
|
||||||
// var inOutItemInfo = inOutItemTotalInfo.split("AaBb");
|
var inOutItemInfo = inOutItemTotalInfo.split("AaBb");
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
var row = {
|
var row = {
|
||||||
name: rowsdata.name,
|
name: inOutItemInfo[1],
|
||||||
type: rowsdata.type,
|
type: inOutItemInfo[2],
|
||||||
remark: rowsdata.remark
|
remark: inOutItemInfo[3]
|
||||||
};
|
};
|
||||||
oldInOutItem = rowsdata.name;
|
oldInOutItem = inOutItemInfo[1];
|
||||||
$('#inOutItemDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑收支项目');
|
$('#inOutItemDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑收支项目');
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
$('#inOutItemFM').form('load', row);
|
$('#inOutItemFM').form('load', row);
|
||||||
inOutItemID = rowsdata.id;
|
inOutItemID = inOutItemInfo[0];
|
||||||
//焦点在名称输入框==定焦在输入文字后面
|
//焦点在名称输入框==定焦在输入文字后面
|
||||||
$("#inOutItem").val("").focus().val(rowsdata.name);
|
$("#inOutItem").val("").focus().val(inOutItemInfo[1]);
|
||||||
url = '/inOutItem/update?id=' + rowsdata.id;
|
url = '/inOutItem/update?id=' + inOutItemInfo[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
//检查收支项目 名称是否存在 ++ 重名无法提示问题需要跟进
|
//检查收支项目 名称是否存在 ++ 重名无法提示问题需要跟进
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<script type="text/javascript" src="/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
<script type="text/javascript" src="/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
||||||
<script type="text/javascript" src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
<script type="text/javascript" src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||||
<script type="text/javascript" src="/js/common/common.js"></script>
|
<script type="text/javascript" src="/js/common/common.js"></script>
|
||||||
<script src="/js/pages/manage/member.js"></script>
|
<script src="/js/pages/manage/supplier.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- 数据显示table -->
|
<!-- 数据显示table -->
|
||||||
|
|||||||
@@ -117,17 +117,10 @@
|
|||||||
{field: 'id', width: 35, align: "center", checkbox: true},
|
{field: 'id', width: 35, align: "center", checkbox: true},
|
||||||
{title: '角色名称', field: 'name', width: 200},
|
{title: '角色名称', field: 'name', width: 200},
|
||||||
{
|
{
|
||||||
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec,index) {
|
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec) {
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/5 10:30
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js实现
|
|
||||||
*/
|
|
||||||
var str = '';
|
var str = '';
|
||||||
// var rowInfo = rec.id + 'AaBb' + rec.name;
|
var rowInfo = rec.id + 'AaBb' + rec.name;
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editRole(\'' + index + '\');"/> <a onclick="editRole(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editRole(\'' + rowInfo + '\');"/> <a onclick="editRole(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteRole(' + rec.id + ');"/> <a onclick="deleteRole(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteRole(' + rec.id + ');"/> <a onclick="deleteRole(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@@ -320,18 +313,18 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//编辑信息
|
//编辑信息
|
||||||
function editRole(index) {
|
function editRole(roleTotalInfo) {
|
||||||
// var roleInfo = roleTotalInfo.split("AaBb");
|
var roleInfo = roleTotalInfo.split("AaBb");
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
$("#name").focus().val(rowsdata.name);
|
|
||||||
|
|
||||||
oldName = rowsdata.name;
|
$("#name").focus().val(roleInfo[1]);
|
||||||
|
|
||||||
|
oldName = roleInfo[1];
|
||||||
$('#roleDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑角色信息');
|
$('#roleDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑角色信息');
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
roleID = rowsdata.id;
|
roleID = roleInfo[0];
|
||||||
//焦点在名称输入框==定焦在输入文字后面
|
//焦点在名称输入框==定焦在输入文字后面
|
||||||
$("#name").val("").focus().val(rowsdata.name);
|
$("#name").val("").focus().val(roleInfo[1]);
|
||||||
url = '/role/update?id=' + rowsdata.id;
|
url = '/role/update?id=' + roleInfo[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
//检查名称是否存在 ++ 重名无法提示问题需要跟进
|
//检查名称是否存在 ++ 重名无法提示问题需要跟进
|
||||||
@@ -393,7 +386,9 @@
|
|||||||
url: "/role/list",
|
url: "/role/list",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: ({
|
data: ({
|
||||||
name: searchName,
|
search: JSON.stringify({
|
||||||
|
name: searchName
|
||||||
|
}),
|
||||||
currentPage: pageNo,
|
currentPage: pageNo,
|
||||||
pageSize: pageSize
|
pageSize: pageSize
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -48,17 +48,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//cnodes = cnodes.substring(0, cnodes.length - 1);
|
//cnodes = cnodes.substring(0, cnodes.length - 1);
|
||||||
// pnodes = pnodes.substring(0, pnodes.length - 1);
|
pnodes = pnodes.substring(0, pnodes.length - 1);
|
||||||
|
|
||||||
if (ctype == 'child') {
|
if (ctype == 'child') {
|
||||||
return cnodes;
|
return cnodes;
|
||||||
}
|
}
|
||||||
else if("all"){
|
else {
|
||||||
return cnodes+pnodes;
|
return pnodes
|
||||||
}else{
|
|
||||||
return pnodes;
|
|
||||||
}
|
}
|
||||||
}
|
;
|
||||||
|
};
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|
||||||
@@ -85,7 +84,7 @@
|
|||||||
info: JSON.stringify({
|
info: JSON.stringify({
|
||||||
type: type,
|
type: type,
|
||||||
keyid: url_id,
|
keyid: url_id,
|
||||||
value: GetNode('all')
|
value: GetNode('child')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
|
|||||||
@@ -133,18 +133,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作', field: 'op', width: 160, formatter: function (value, rec,index) {
|
title: '操作', field: 'op', width: 160, formatter: function (value, rec) {
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/6 9:33
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js实现
|
|
||||||
*/
|
|
||||||
var str = '';
|
var str = '';
|
||||||
// var rowInfo = rec.id + 'AaBb' + rec.companyName + 'AaBb' + rec.companyContacts + 'AaBb' + rec.companyAddress
|
var rowInfo = rec.id + 'AaBb' + rec.companyName + 'AaBb' + rec.companyContacts + 'AaBb' + rec.companyAddress
|
||||||
// + 'AaBb' + rec.companyTel + 'AaBb' + rec.companyFax + 'AaBb' + rec.companyPostCode;
|
+ 'AaBb' + rec.companyTel + 'AaBb' + rec.companyFax + 'AaBb' + rec.companyPostCode
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editSystemConfig(\'' + index + '\');"/> <a onclick="editSystemConfig(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
+ 'AaBb' + rec.depotFlag + 'AaBb' + rec.customerFlag;
|
||||||
|
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editSystemConfig(\'' + rowInfo + '\');"/> <a onclick="editSystemConfig(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteSystemConfig(' + rec.id + ');"/> <a onclick="deleteSystemConfig(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteSystemConfig(' + rec.id + ');"/> <a onclick="deleteSystemConfig(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@@ -357,26 +351,26 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//编辑系统配置信息
|
//编辑系统配置信息
|
||||||
function editSystemConfig(index) {
|
function editSystemConfig(systemConfigTotalInfo) {
|
||||||
// var systemConfigInfo = systemConfigTotalInfo.split("AaBb");
|
var systemConfigInfo = systemConfigTotalInfo.split("AaBb");
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
var row = {
|
var row = {
|
||||||
companyName: rowsdata.companyName,
|
companyName: systemConfigInfo[1],
|
||||||
companyContacts: rowsdata.companyContacts,
|
companyContacts: systemConfigInfo[2],
|
||||||
companyAddress: rowsdata.companyAddress,
|
companyAddress: systemConfigInfo[3],
|
||||||
companyTel: rowsdata.companyTel,
|
companyTel: systemConfigInfo[4],
|
||||||
companyFax: rowsdata.companyFax,
|
companyFax: systemConfigInfo[5],
|
||||||
companyPostCode: rowsdata.companyPostCode
|
companyPostCode: systemConfigInfo[6]
|
||||||
};
|
};
|
||||||
oldCompanyName = rowsdata.companyName;
|
oldCompanyName = systemConfigInfo[1];
|
||||||
$('#systemConfigDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑系统配置信息');
|
$('#systemConfigDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑系统配置信息');
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
$('#systemConfigFM').form('load', row);
|
$('#systemConfigFM').form('load', row);
|
||||||
systemConfigId = rowsdata.id;
|
systemConfigId = systemConfigInfo[0];
|
||||||
//焦点在名称输入框==定焦在输入文字后面
|
//焦点在名称输入框==定焦在输入文字后面
|
||||||
$("#companyName").val("").focus().val(rowsdata.companyName);
|
$("#companyName").val("").focus().val(systemConfigInfo[1]);
|
||||||
url = '/systemConfig/update?id=' + rowsdata.id;
|
$("#depotFlag").attr("checked", systemConfigInfo[7] == '1' ? true : false);
|
||||||
|
$("#customerFlag").attr("checked", systemConfigInfo[8] == '1' ? true : false);
|
||||||
|
url = '/systemConfig/update?id=' + systemConfigInfo[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
//检查系统配置 名称是否存在 ++ 重名无法提示问题需要跟进
|
//检查系统配置 名称是否存在 ++ 重名无法提示问题需要跟进
|
||||||
|
|||||||
@@ -110,17 +110,10 @@
|
|||||||
{field: 'id', width: 35, align: "center", checkbox: true},
|
{field: 'id', width: 35, align: "center", checkbox: true},
|
||||||
{
|
{
|
||||||
title: '操作', field: 'op', align: "center", width: 60,
|
title: '操作', field: 'op', align: "center", width: 60,
|
||||||
formatter: function (value, rec,index) {
|
formatter: function (value, rec) {
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/6 9:33
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js实现
|
|
||||||
*/
|
|
||||||
var str = '';
|
var str = '';
|
||||||
// var rowInfo = rec.id + 'AaBb' + rec.uname;
|
var rowInfo = rec.id + 'AaBb' + rec.uname;
|
||||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editUnit(\'' + index + '\');"/> ';
|
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editUnit(\'' + rowInfo + '\');"/> ';
|
||||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteUnit(' + rec.id + ');"/>';
|
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteUnit(' + rec.id + ');"/>';
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@@ -372,16 +365,15 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//编辑信息
|
//编辑信息
|
||||||
function editUnit(index) {
|
function editUnit(unitTotalInfo) {
|
||||||
// var unitInfo = unitTotalInfo.split("AaBb");
|
var unitInfo = unitTotalInfo.split("AaBb");
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
oldUnit = unitInfo[1];
|
||||||
oldUnit = rowsdata.uname;
|
|
||||||
$('#unitDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑计量单位');
|
$('#unitDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑计量单位');
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
unitID = rowsdata.id;
|
unitID = unitInfo[0];
|
||||||
//焦点在名称输入框==定焦在输入文字后面
|
//焦点在名称输入框==定焦在输入文字后面
|
||||||
var name = rowsdata.uname;
|
var name = unitInfo[1];
|
||||||
var basicName = name.substring(0, name.indexOf(",")); //基础单位
|
var basicName = name.substring(0, name.indexOf(",")); //基础单位
|
||||||
$("#basicName").val(basicName);
|
$("#basicName").val(basicName);
|
||||||
var otherItem = name.substring(name.indexOf(",") + 1);
|
var otherItem = name.substring(name.indexOf(",") + 1);
|
||||||
@@ -391,7 +383,7 @@
|
|||||||
lastNum = lastNum.replace(")", "");
|
lastNum = lastNum.replace(")", "");
|
||||||
$("#otherNum").val(lastNum);
|
$("#otherNum").val(lastNum);
|
||||||
$("#unitName").text(basicName);
|
$("#unitName").text(basicName);
|
||||||
url = '/unit/update?id=' + rowsdata.id;
|
url = '/unit/update?id=' + unitInfo[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
//检查名称是否存在 ++ 重名无法提示问题需要跟进
|
//检查名称是否存在 ++ 重名无法提示问题需要跟进
|
||||||
|
|||||||
@@ -186,20 +186,13 @@
|
|||||||
{title: '描述', field: 'description', width: 130},
|
{title: '描述', field: 'description', width: 130},
|
||||||
{field: 'orgaId',hidden:true, width: 10},
|
{field: 'orgaId',hidden:true, width: 10},
|
||||||
{
|
{
|
||||||
title: '操作', field: 'isystem', width: 150, formatter: function (value, rec,index) {
|
title: '操作', field: 'isystem', width: 150, formatter: function (value, rec) {
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/6 9:33
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js实现
|
|
||||||
*/
|
|
||||||
var str = '';
|
var str = '';
|
||||||
// var rowInfo = rec.id + 'AaBb' + rec.username + 'AaBb' + rec.loginame + 'AaBb' + rec.position
|
var rowInfo = rec.id + 'AaBb' + rec.username + 'AaBb' + rec.loginame + 'AaBb' + rec.position
|
||||||
// + 'AaBb' + rec.orgAbr + 'AaBb' + rec.email + 'AaBb' + rec.phonenum + 'AaBb' + rec.ismanager
|
+ 'AaBb' + rec.orgAbr + 'AaBb' + rec.email + 'AaBb' + rec.phonenum + 'AaBb' + rec.ismanager
|
||||||
// + 'AaBb' + rec.isystem + 'AaBb' + rec.description+'AaBb'+rec.orgaId+'AaBb'+rec.orgaUserRelId
|
+ 'AaBb' + rec.isystem + 'AaBb' + rec.description+'AaBb'+rec.orgaId+'AaBb'+rec.orgaUserRelId
|
||||||
// +'AaBb' + rec.userBlngOrgaDsplSeq ;
|
+'AaBb' + rec.userBlngOrgaDsplSeq ;
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editUser(\'' + index + '\');"/> <a onclick="editUser(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editUser(\'' + rowInfo + '\');"/> <a onclick="editUser(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||||
if (rec.id != rec.tenantId) {
|
if (rec.id != rec.tenantId) {
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteUser(' + rec.id + ');"/> <a onclick="deleteUser(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteUser(' + rec.id + ');"/> <a onclick="deleteUser(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||||
}
|
}
|
||||||
@@ -449,34 +442,32 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//编辑用户信息
|
//编辑用户信息
|
||||||
function editUser(index) {
|
function editUser(usernameTotalInfo) {
|
||||||
// var usernameInfo = usernameTotalInfo.split("AaBb");
|
var usernameInfo = usernameTotalInfo.split("AaBb");
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
var row = {
|
var row = {
|
||||||
username: rowsdata.username,
|
username: usernameInfo[1],
|
||||||
loginame: rowsdata.loginame,
|
loginame: usernameInfo[2],
|
||||||
position: rowsdata.position,
|
position: usernameInfo[3],
|
||||||
email: rowsdata.email,
|
email: usernameInfo[5],
|
||||||
phonenum: rowsdata.phonenum,
|
phonenum: usernameInfo[6],
|
||||||
description: rowsdata.description,
|
description: usernameInfo[9],
|
||||||
orgAbr: rowsdata.orgAbr===undefined?'':rowsdata.orgAbr,
|
orgAbr: usernameInfo[4]=='undefined'?'':usernameInfo[4],
|
||||||
orgaId: rowsdata.orgaId===undefined?'':rowsdata.orgaId,
|
orgaId: usernameInfo[10]=='undefined'?'':usernameInfo[10],
|
||||||
orgaUserRelId:rowsdata.orgaUserRelId===undefined?'':rowsdata.orgaUserRelId,
|
orgaUserRelId:usernameInfo[11]=='undefined'?'':usernameInfo[11],
|
||||||
userBlngOrgaDsplSeq:rowsdata.userBlngOrgaDsplSeq===undefined?'':rowsdata.userBlngOrgaDsplSeq
|
userBlngOrgaDsplSeq:usernameInfo[12]=='undefined'?'':usernameInfo[12]
|
||||||
|
|
||||||
};
|
};
|
||||||
oldLoginName = rowsdata.username;
|
oldLoginName = usernameInfo[1];
|
||||||
$('#userDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑用户信息');
|
$('#userDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑用户信息');
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
$('#usernameFM').form('load', row);
|
$('#usernameFM').form('load', row);
|
||||||
userID = rowsdata.id;
|
userID = usernameInfo[0];
|
||||||
//焦点在名称输入框==定焦在输入文字后面
|
//焦点在名称输入框==定焦在输入文字后面
|
||||||
$("#username").val("").focus().val(rowsdata.username);
|
$("#username").val("").focus().val(usernameInfo[1]);
|
||||||
$("#loginame").attr("readonly","readonly");
|
$("#loginame").attr("readonly","readonly");
|
||||||
/**机构选择*/
|
/**机构选择*/
|
||||||
$("#selectType").val("org");
|
$("#selectType").val("org");
|
||||||
url = '/user/updateUser?id=' + rowsdata.id;
|
url = '/user/updateUser?id=' + usernameInfo[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<script type="text/javascript" src="/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
<script type="text/javascript" src="/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
||||||
<script type="text/javascript" src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
<script type="text/javascript" src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||||
<script type="text/javascript" src="/js/common/common.js"></script>
|
<script type="text/javascript" src="/js/common/common.js"></script>
|
||||||
<script src="/js/pages/manage/vendor.js"></script>
|
<script src="/js/pages/manage/supplier.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- 数据显示table -->
|
<!-- 数据显示table -->
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
<script src="/js/handlebars.js"></script>
|
<script src="/js/handlebars.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<!--<script src="/js/pages/materials/allocation_out_list.js"></script>-->
|
|
||||||
<script src="/js/common/jsherp.js"></script>
|
<script src="/js/common/jsherp.js"></script>
|
||||||
<script src="/js/pages/materials/add_temp.js"></script>
|
<script src="/js/pages/materials/add_temp.js"></script>
|
||||||
<script src="/js/pages/materials/in_out.js"></script>
|
<script src="/js/pages/materials/in_out.js"></script>
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
<script src="/js/handlebars.js"></script>
|
<script src="/js/handlebars.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<!--<script src="/js/pages/materials/assemble_list.js"></script>-->
|
|
||||||
<script src="/js/common/jsherp.js"></script>
|
<script src="/js/common/jsherp.js"></script>
|
||||||
<script src="/js/pages/materials/add_temp.js"></script>
|
<script src="/js/pages/materials/add_temp.js"></script>
|
||||||
<script src="/js/pages/materials/in_out.js"></script>
|
<script src="/js/pages/materials/in_out.js"></script>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<script src="/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
<script src="/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
||||||
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<!--<script src="/js/pages/materials/bill_detail.js"></script>-->
|
<script src="/js/pages/materials/bill_detail.js"></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -16,12 +16,6 @@
|
|||||||
<script src="/js/handlebars.js"></script>
|
<script src="/js/handlebars.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<!--<script src="/js/pages/materials/disassemble_list.js"></script>-->
|
|
||||||
<script>
|
|
||||||
var kid = sessionStorage.getItem("userId");
|
|
||||||
var path = "<%=path%>";
|
|
||||||
var clientIp = "<%=clientIp%>";
|
|
||||||
</script>
|
|
||||||
<script src="/js/pages/materials/add_temp.js"></script>
|
<script src="/js/pages/materials/add_temp.js"></script>
|
||||||
<script src="/js/pages/materials/in_out.js"></script>
|
<script src="/js/pages/materials/in_out.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
<td style="height:30px;">类别</td>
|
<td style="height:30px;">类别</td>
|
||||||
<td style="padding:5px" colspan="3">
|
<td style="padding:5px" colspan="3">
|
||||||
<input name="parentName" id="parentName" style="width: 180px;height: 20px" readonly="readonly"/>
|
<input name="parentName" id="parentName" style="width: 180px;height: 20px" readonly="readonly"/>
|
||||||
<a href="javascript:void(0)" class="l-btn l-btn-plain" group="" id="lookForSelectMaterialCategory">
|
<a href="javascript:void(0)" class="l-btn l-btn-plain" group="" id="lookForMaterialCategory">
|
||||||
<span class="l-btn-left"><span class="l-btn-text icon-search l-btn-icon-left"></span></span></a>
|
<span class="l-btn-left"><span class="l-btn-text icon-search l-btn-icon-left"></span></span></a>
|
||||||
<input name="parentid" id="parentid" type="hidden"/>
|
<input name="parentid" id="parentid" type="hidden"/>
|
||||||
</td>
|
</td>
|
||||||
@@ -277,18 +277,14 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var materialCategoryList = null;
|
var materialCategoryList = null;
|
||||||
var types = "";
|
var types = "";
|
||||||
var setCategoryId = "1";
|
|
||||||
var cid = 1;
|
|
||||||
var multiple = 0; //倍数
|
var multiple = 0; //倍数
|
||||||
var mPropertyList = null; //商品属性列表
|
var mPropertyList = null; //商品属性列表
|
||||||
var mPropertyListShort = ""; //商品属性列表-传值
|
var mPropertyListShort = ""; //商品属性列表-传值
|
||||||
|
var clickType = ""; //记录从哪里点击的类别弹窗
|
||||||
//初始化界面
|
//初始化界面
|
||||||
$(function () {
|
$(function () {
|
||||||
//初始化系统基础信息
|
//初始化系统基础信息
|
||||||
initMProperty();
|
initMProperty();
|
||||||
initSystemData(1);
|
|
||||||
initSelectInfo("search_first");
|
|
||||||
initSelectInfo("edit_first");
|
|
||||||
manyUnitFun();
|
manyUnitFun();
|
||||||
priceKeyUp();//价格触发事件
|
priceKeyUp();//价格触发事件
|
||||||
initMPropertyShort(); //初始化商品属性
|
initMPropertyShort(); //初始化商品属性
|
||||||
@@ -323,7 +319,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initSystemData(parentid_search) {
|
function initMCData(parentid_search) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "get",
|
type: "get",
|
||||||
url: "/materialCategory/getAllList",
|
url: "/materialCategory/getAllList",
|
||||||
@@ -336,6 +332,16 @@
|
|||||||
success: function (res) {
|
success: function (res) {
|
||||||
if(res && res.code === 200){
|
if(res && res.code === 200){
|
||||||
materialCategoryList = res.data;
|
materialCategoryList = res.data;
|
||||||
|
if (materialCategoryList != null) {
|
||||||
|
options = "";
|
||||||
|
for (var i = 0; i < materialCategoryList.length; i++) {
|
||||||
|
var materialCategory = materialCategoryList[i];
|
||||||
|
types += materialCategory.id + ',';
|
||||||
|
}
|
||||||
|
types += parentid_search;
|
||||||
|
} else {
|
||||||
|
types = parentid_search;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$.messager.alert('提示', '查找系统基础信息异常,请与管理员联系!', 'error');
|
$.messager.alert('提示', '查找系统基础信息异常,请与管理员联系!', 'error');
|
||||||
return;
|
return;
|
||||||
@@ -344,26 +350,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//初始化页面选项卡
|
|
||||||
function initSelectInfo(lei) {
|
|
||||||
var options = "";
|
|
||||||
|
|
||||||
if (materialCategoryList != null) {
|
|
||||||
options = "";
|
|
||||||
for (var i = 0; i < materialCategoryList.length; i++) {
|
|
||||||
var materialCategory = materialCategoryList[i];
|
|
||||||
if (0 == i) {
|
|
||||||
mcId = materialCategory.id;
|
|
||||||
}
|
|
||||||
options += '<option value="' + materialCategory.id + '">' + materialCategory.name + '</option>';
|
|
||||||
if (lei == "search_second" || lei == "type_second" || lei == "search_three") {
|
|
||||||
types += materialCategory.id + ',';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//防止表单提交重复
|
//防止表单提交重复
|
||||||
function initForm() {
|
function initForm() {
|
||||||
$('#materialFM').form({
|
$('#materialFM').form({
|
||||||
@@ -531,21 +517,14 @@
|
|||||||
columns: [[
|
columns: [[
|
||||||
{field: 'id', width: 35, align: "center", checkbox: true},
|
{field: 'id', width: 35, align: "center", checkbox: true},
|
||||||
{
|
{
|
||||||
title: '操作', field: 'op', align: "center", width: 60, formatter: function (value, rec,index) {
|
title: '操作', field: 'op', align: "center", width: 60, formatter: function (value, rec) {
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/6 9:33
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js实现
|
|
||||||
*/
|
|
||||||
var str = '';
|
var str = '';
|
||||||
// var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.model + 'AaBb' + rec.color + 'AaBb' + rec.unit + 'AaBb' + rec.retailprice
|
var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.model + 'AaBb' + rec.color + 'AaBb' + rec.unit + 'AaBb' + rec.retailprice
|
||||||
// + 'AaBb' + rec.lowprice + 'AaBb' + rec.presetpriceone + 'AaBb' + rec.presetpricetwo + 'AaBb' + rec.remark + 'AaBb' + rec.standard
|
+ 'AaBb' + rec.lowprice + 'AaBb' + rec.presetpriceone + 'AaBb' + rec.presetpricetwo + 'AaBb' + rec.remark + 'AaBb' + rec.standard
|
||||||
// + 'AaBb' + rec.color + 'AaBb' + rec.packing + 'AaBb' + rec.safetystock + 'AaBb' + rec.categoryid + 'AaBb' + rec.categoryName
|
+ 'AaBb' + rec.color + 'AaBb' + rec.packing + 'AaBb' + rec.safetystock + 'AaBb' + rec.categoryid + 'AaBb' + rec.categoryName
|
||||||
// + 'AaBb' + rec.unitid + 'AaBb' + rec.unitName + 'AaBb' + rec.firstoutunit + 'AaBb' + rec.firstinunit
|
+ 'AaBb' + rec.unitid + 'AaBb' + rec.unitName + 'AaBb' + rec.firstoutunit + 'AaBb' + rec.firstinunit
|
||||||
// + 'AaBb' + rec.mfrs + 'AaBb' + rec.otherfield1 + 'AaBb' + rec.otherfield2 + 'AaBb' + rec.otherfield3+ 'AaBb' + rec.enableserialnumber;
|
+ 'AaBb' + rec.mfrs + 'AaBb' + rec.otherfield1 + 'AaBb' + rec.otherfield2 + 'AaBb' + rec.otherfield3+ 'AaBb' + rec.enableserialnumber;
|
||||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editMaterial(\'' + index + '\');"/> ';
|
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editMaterial(\'' + rowInfo + '\');"/> ';
|
||||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteMaterial(' + rec.id + ');"/>';
|
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteMaterial(' + rec.id + ');"/>';
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@@ -565,41 +544,10 @@
|
|||||||
},
|
},
|
||||||
{title: '安全存量', field: 'safetystock', width: 70},
|
{title: '安全存量', field: 'safetystock', width: 70},
|
||||||
{
|
{
|
||||||
title: '库存', field: 'abc', width: 70, formatter: function (value, rec) {
|
title: '库存', field: 'stock', width: 70, formatter: function (value, rec) {
|
||||||
var monthTime = getNowFormatMonth();
|
var str = '';
|
||||||
var mId = rec.id; //商品id
|
str += '<span title="查看出入库明细" class="n-link" onclick="findStockList(' + rec.id + ');">' + rec.stock + '</span>';
|
||||||
var thisStock = 0;
|
return str;
|
||||||
//查询库存
|
|
||||||
$.ajax({
|
|
||||||
type: "get",
|
|
||||||
url: '/depotItem/findStockNumByMaterialId',
|
|
||||||
data: {
|
|
||||||
materialId: mId
|
|
||||||
},
|
|
||||||
dataType: "json",
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
if (res.data && res.data.page && res.data.page[0]) {
|
|
||||||
thisStock = res.data.page[0].thisSum - 0;
|
|
||||||
if (thisStock > 0) {
|
|
||||||
$("#tablePanel .class-" + rec.id).text(thisStock); //延迟加载库存数据
|
|
||||||
$("#tablePanel .class-" + rec.id).css("color", "blue").css("text-decoration", "underline").css("cursor", "pointer");
|
|
||||||
$("#tablePanel .class-" + rec.id).off("click").on("click", function () {
|
|
||||||
$('#materialDetailListDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 查看出入库明细');
|
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
|
||||||
initMaterialDetailData(mId);
|
|
||||||
getMaterialInOutList(mId, 1, initPageSize);
|
|
||||||
ininMaterialDetailPager(mId);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function () {
|
|
||||||
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return "<span class='class-" + rec.id + "'>" + thisStock + "</span>";
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{title: '零售价', field: 'retailprice', width: 60,
|
{title: '零售价', field: 'retailprice', width: 60,
|
||||||
@@ -717,7 +665,6 @@
|
|||||||
pageSize: initPageSize,
|
pageSize: initPageSize,
|
||||||
pageList: initPageNum,
|
pageList: initPageNum,
|
||||||
columns: [[
|
columns: [[
|
||||||
|
|
||||||
{
|
{
|
||||||
title: '单据编号', field: 'Number', width: 150,
|
title: '单据编号', field: 'Number', width: 150,
|
||||||
formatter: function (value, row) {
|
formatter: function (value, row) {
|
||||||
@@ -726,10 +673,7 @@
|
|||||||
},
|
},
|
||||||
{title: '类型', field: 'Type', width: 100},
|
{title: '类型', field: 'Type', width: 100},
|
||||||
{title: '数量', field: 'BasicNumber', width: 80},
|
{title: '数量', field: 'BasicNumber', width: 80},
|
||||||
{title: '仓库', field: 'depotName', width: 180},
|
{title: '日期', field: 'OperTime', width: 180}
|
||||||
{title: '日期', field: 'OperTime', width: 180},
|
|
||||||
{title: '调入仓库', field: 'depotInName', width: 180}
|
|
||||||
|
|
||||||
]],
|
]],
|
||||||
onLoadError: function () {
|
onLoadError: function () {
|
||||||
$.messager.alert('页面加载提示', '页面加载异常,请稍后再试!', 'error');
|
$.messager.alert('页面加载提示', '页面加载异常,请稍后再试!', 'error');
|
||||||
@@ -825,6 +769,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function findStockList(mId) {
|
||||||
|
$('#materialDetailListDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 查看出入库明细');
|
||||||
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
|
initMaterialDetailData(mId);
|
||||||
|
getMaterialInOutList(mId, 1, initPageSize);
|
||||||
|
ininMaterialDetailPager(mId);
|
||||||
|
}
|
||||||
|
|
||||||
//删除商品信息
|
//删除商品信息
|
||||||
function deleteMaterial(materialID) {
|
function deleteMaterial(materialID) {
|
||||||
$.messager.confirm('删除确认', '确定要删除此商品信息吗?', function (r) {
|
$.messager.confirm('删除确认', '确定要删除此商品信息吗?', function (r) {
|
||||||
@@ -1061,13 +1013,8 @@
|
|||||||
function setOutputFun() {
|
function setOutputFun() {
|
||||||
var name = $.trim($("#searchName").val());
|
var name = $.trim($("#searchName").val());
|
||||||
var model = $.trim($("#searchModel").val());
|
var model = $.trim($("#searchModel").val());
|
||||||
if (setCategoryId != "1") {
|
|
||||||
cid = 2;
|
|
||||||
} else {
|
|
||||||
cid = 1;
|
|
||||||
}
|
|
||||||
window.location.href = "/material/exportExcel?browserType=" + getOs()
|
window.location.href = "/material/exportExcel?browserType=" + getOs()
|
||||||
+ "&name=" + name + "&model=" + model + "&categoryId=" + cid + "&categoryIds=" + setCategoryId;
|
+ "&name=" + name + "&model=" + model + "&categoryIds=" + types;
|
||||||
}
|
}
|
||||||
//增加
|
//增加
|
||||||
var url;
|
var url;
|
||||||
@@ -1341,37 +1288,35 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//编辑信息
|
//编辑信息
|
||||||
function editMaterial(index) {
|
function editMaterial(materialTotalInfo) {
|
||||||
// var materialInfo = materialTotalInfo.split("AaBb");
|
var materialInfo = materialTotalInfo.split("AaBb");
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
|
||||||
bindMProperty(); //根据商品属性绑定
|
bindMProperty(); //根据商品属性绑定
|
||||||
$("#Name").focus().val(rowsdata.name);
|
$("#Name").focus().val(materialInfo[1]);
|
||||||
$("#Color").focus().val(rowsdata.color);
|
$("#Color").focus().val(materialInfo[11]);
|
||||||
$("#EnableSerialNumber").val(rowsdata.enableserialnumber=='1'?'1':'0');
|
$("#EnableSerialNumber").val(materialInfo[24]=='1'?'1':'0');
|
||||||
//商品类别id
|
//商品类别id
|
||||||
$("#parentid").val(rowsdata.categoryid == undefined ? "" : rowsdata.categoryid );
|
$("#parentid").val(materialInfo[14] == "undefined" ? "" : materialInfo[14]);
|
||||||
//商品类别名称
|
//商品类别名称
|
||||||
$("#parentName").val(rowsdata.categoryName == undefined ? "" : rowsdata.categoryName );
|
$("#parentName").val(materialInfo[15] == "undefined" ? "" : materialInfo[15]);
|
||||||
mId = rowsdata.categoryid;
|
mId = materialInfo[14];
|
||||||
mName =rowsdata.categoryName;
|
mName = materialInfo[15];
|
||||||
$("#Packing").focus().val(rowsdata.packing);
|
$("#Packing").focus().val(materialInfo[12]);
|
||||||
$("#SafetyStock").focus().val(rowsdata.safetystock==undefined ? "" : rowsdata.safetystock);
|
$("#SafetyStock").focus().val(materialInfo[13]=="undefined" ? "" : materialInfo[13]);
|
||||||
$("#Model").val(rowsdata.model);
|
$("#Model").val(materialInfo[2]);
|
||||||
$("#Standard").val(rowsdata.standard == "undefined" ? "" : rowsdata.standard );
|
$("#Standard").val(materialInfo[10] == "undefined" ? "" : materialInfo[10]);
|
||||||
$("#Color").val(rowsdata.color == "undefined" ? "" : rowsdata.color );
|
$("#Color").val(materialInfo[3] == "undefined" ? "" : materialInfo[3]);
|
||||||
$("#Mfrs").val(rowsdata.mfrs == "undefined" ? "" : rowsdata.mfrs );
|
$("#Mfrs").val(materialInfo[20] == "undefined" ? "" : materialInfo[20]);
|
||||||
$("#OtherField1").val(rowsdata.otherfield1 == "undefined" ? "" : rowsdata.otherfield1);
|
$("#OtherField1").val(materialInfo[21] == "undefined" ? "" : materialInfo[21]);
|
||||||
$("#OtherField2").val(rowsdata.otherfield2 == "undefined" ? "" : rowsdata.otherfield2 );
|
$("#OtherField2").val(materialInfo[22] == "undefined" ? "" : materialInfo[22]);
|
||||||
$("#OtherField3").val(rowsdata.otherfield3 == "undefined" ? "" : rowsdata.otherfield3);
|
$("#OtherField3").val(materialInfo[23] == "undefined" ? "" : materialInfo[23]);
|
||||||
$("#Unit").val(rowsdata.unit == "undefined" ? "" : rowsdata.unit);
|
$("#Unit").val(materialInfo[4] == "undefined" ? "" : materialInfo[4]);
|
||||||
$("#RetailPrice").val(rowsdata.retailprice == "undefined" ? "" : rowsdata.retailprice);
|
$("#RetailPrice").val(materialInfo[5] == "undefined" ? "" : materialInfo[5]);
|
||||||
$("#LowPrice").val(rowsdata.lowprice == "undefined" ? "" : rowsdata.lowprice);
|
$("#LowPrice").val(materialInfo[6] == "undefined" ? "" : materialInfo[6]);
|
||||||
$("#PresetPriceOne").val(rowsdata.presetpriceone == "undefined" ? "" : rowsdata.presetpriceone);
|
$("#PresetPriceOne").val(materialInfo[7] == "undefined" ? "" : materialInfo[7]);
|
||||||
$("#PresetPriceTwo").val(rowsdata.presetpricetwo == "undefined" ? "" :rowsdata.presetpricetwo);
|
$("#PresetPriceTwo").val(materialInfo[8] == "undefined" ? "" : materialInfo[8]);
|
||||||
$("#Remark").val(rowsdata.remark);
|
$("#Remark").val(materialInfo[9]);
|
||||||
$("#manyUnit").val(rowsdata.unitid);
|
$("#manyUnit").val(materialInfo[16]);
|
||||||
if (rowsdata.unitid != "undefined") {
|
if (materialInfo[16] != "undefined") {
|
||||||
$("#manyUnitCheck").prop("checked", true);
|
$("#manyUnitCheck").prop("checked", true);
|
||||||
//当前为选中状态
|
//当前为选中状态
|
||||||
$("#Unit").hide();
|
$("#Unit").hide();
|
||||||
@@ -1390,8 +1335,8 @@
|
|||||||
firstOptions = firstOptions + basic + other;
|
firstOptions = firstOptions + basic + other;
|
||||||
$("#FirstOutUnit").empty().append('<option value="">(空)</option>').append(firstOptions); //首选出库单位
|
$("#FirstOutUnit").empty().append('<option value="">(空)</option>').append(firstOptions); //首选出库单位
|
||||||
$("#FirstInUnit").empty().append('<option value="">(空)</option>').append(firstOptions); //首选入库单位
|
$("#FirstInUnit").empty().append('<option value="">(空)</option>').append(firstOptions); //首选入库单位
|
||||||
$("#FirstOutUnit").val(rowsdata.firstoutunit);//首选出库单位
|
$("#FirstOutUnit").val(materialInfo[18]);//首选出库单位
|
||||||
$("#FirstInUnit").val(rowsdata.firstinunit);//首选入库单位
|
$("#FirstInUnit").val(materialInfo[19]);//首选入库单位
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1408,7 +1353,7 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/material/findById',
|
url: '/material/findById',
|
||||||
data: {
|
data: {
|
||||||
id: rowsdata.id
|
id: materialInfo[0]
|
||||||
},
|
},
|
||||||
type: "get",
|
type: "get",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
@@ -1437,24 +1382,24 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
oldName = rowsdata.name;
|
oldName = materialInfo[1];
|
||||||
oldModel = rowsdata.model;
|
oldModel = materialInfo[2];
|
||||||
oldColor = rowsdata.color;
|
oldColor = materialInfo[11];
|
||||||
oldStandard = rowsdata.standard;
|
oldStandard = materialInfo[10];
|
||||||
oldMfrs = rowsdata.mfrs;
|
oldMfrs = materialInfo[20];
|
||||||
oldOtherField1 = rowsdata.otherfield1;
|
oldOtherField1 = materialInfo[21];
|
||||||
oldOtherField2 = rowsdata.otherfield2;
|
oldOtherField2 = materialInfo[22];
|
||||||
oldOtherField3 = rowsdata.otherfield3;
|
oldOtherField3 = materialInfo[23];
|
||||||
oldUnit = rowsdata.unit;
|
oldUnit = materialInfo[4];
|
||||||
oldManyUnit = rowsdata.unitid;
|
oldManyUnit = materialInfo[16];
|
||||||
$('#materialDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑商品信息');
|
$('#materialDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑商品信息');
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
materialID = rowsdata.id;
|
materialID = materialInfo[0];
|
||||||
//焦点在名称输入框==定焦在输入文字后面
|
//焦点在名称输入框==定焦在输入文字后面
|
||||||
$("#Name").val("").focus().val(rowsdata.name);
|
$("#Name").val("").focus().val(materialInfo[1]);
|
||||||
//选中基本资料tab
|
//选中基本资料tab
|
||||||
$("#materialFM #tt .tabs li").first().click();
|
$("#materialFM #tt .tabs li").first().click();
|
||||||
url = '/material/update?id=' + rowsdata.id;
|
url = '/material/update?id=' + materialInfo[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1477,12 +1422,6 @@
|
|||||||
function showMaterialDetails(pageNo, pageSize) {
|
function showMaterialDetails(pageNo, pageSize) {
|
||||||
var name = $.trim($("#searchName").val());
|
var name = $.trim($("#searchName").val());
|
||||||
var model = $.trim($("#searchModel").val());
|
var model = $.trim($("#searchModel").val());
|
||||||
if (setCategoryId != "1") {
|
|
||||||
cid = 2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cid = 1;
|
|
||||||
}
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "get",
|
type: "get",
|
||||||
url: "/material/list",
|
url: "/material/list",
|
||||||
@@ -1491,8 +1430,7 @@
|
|||||||
search: JSON.stringify({
|
search: JSON.stringify({
|
||||||
name: name,
|
name: name,
|
||||||
model: model,
|
model: model,
|
||||||
categoryId: cid,
|
categoryIds: types,
|
||||||
categoryIds: setCategoryId,
|
|
||||||
mpList: mPropertyListShort
|
mpList: mPropertyListShort
|
||||||
}),
|
}),
|
||||||
currentPage: pageNo,
|
currentPage: pageNo,
|
||||||
@@ -1516,8 +1454,9 @@
|
|||||||
//重置按钮
|
//重置按钮
|
||||||
$("#searchResetBtn").unbind().bind({
|
$("#searchResetBtn").unbind().bind({
|
||||||
click: function () {
|
click: function () {
|
||||||
|
$("#searchParentName").val("");
|
||||||
|
$("#searchParentId").val("");
|
||||||
$("#searchName").val("");
|
$("#searchName").val("");
|
||||||
setCategoryId = "1";
|
|
||||||
$("#searchModel").val("");
|
$("#searchModel").val("");
|
||||||
types = ""; //清空类别
|
types = ""; //清空类别
|
||||||
//加载完以后重新初始化
|
//加载完以后重新初始化
|
||||||
@@ -1595,8 +1534,9 @@
|
|||||||
}, 3300);
|
}, 3300);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//查询父级商品类别
|
|
||||||
$("#lookForSelectMaterialCategory").on("click", function () {
|
//商品类别选择
|
||||||
|
function materialCategoryDlgFun() {
|
||||||
$('#forSelectMaterialCategoryDlg').dialog({
|
$('#forSelectMaterialCategoryDlg').dialog({
|
||||||
title: '商品类别选择',
|
title: '商品类别选择',
|
||||||
width: webW/2,
|
width: webW/2,
|
||||||
@@ -1607,6 +1547,16 @@
|
|||||||
modal: true,
|
modal: true,
|
||||||
resizable:true
|
resizable:true
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询父级商品类别
|
||||||
|
$("#lookForSelectMaterialCategory").on("click", function () {
|
||||||
|
clickType = "selectBtn";
|
||||||
|
materialCategoryDlgFun();
|
||||||
|
});
|
||||||
|
$("#lookForMaterialCategory").on("click", function () {
|
||||||
|
clickType = "editBtn";
|
||||||
|
materialCategoryDlgFun();
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -124,17 +124,10 @@
|
|||||||
{title: '排序', field: 'sort', width: 100},
|
{title: '排序', field: 'sort', width: 100},
|
||||||
{title: '别名', field: 'anothername', width: 100},
|
{title: '别名', field: 'anothername', width: 100},
|
||||||
{
|
{
|
||||||
title: '操作', field: 'op', align: "center", width: 80, formatter: function (value, rec,index) {
|
title: '操作', field: 'op', align: "center", width: 80, formatter: function (value, rec) {
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/6 9:33
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js实现
|
|
||||||
*/
|
|
||||||
var str = '';
|
var str = '';
|
||||||
// var rowInfo = rec.id + 'AaBb' + rec.nativename + 'AaBb' + rec.enabled + 'AaBb' + rec.sort + 'AaBb' + rec.anothername;
|
var rowInfo = rec.id + 'AaBb' + rec.nativename + 'AaBb' + rec.enabled + 'AaBb' + rec.sort + 'AaBb' + rec.anothername;
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editMaterialProperty(\'' + index + '\');"/> <a onclick="editMaterialProperty(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editMaterialProperty(\'' + rowInfo + '\');"/> <a onclick="editMaterialProperty(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -218,20 +211,19 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//编辑信息
|
//编辑信息
|
||||||
function editMaterialProperty(index) {
|
function editMaterialProperty(totalInfo) {
|
||||||
// var materialPropertyInfo = totalInfo.split("AaBb");
|
var materialPropertyInfo = totalInfo.split("AaBb");
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
$("#nativeName").text(materialPropertyInfo[1]);
|
||||||
$("#nativeName").text(rowsdata.nativename);
|
$("#enabled").attr("checked", materialPropertyInfo[2] == 'true' ? true : false);
|
||||||
$("#enabled").attr("checked", rowsdata.enabled == true ? true : false);
|
$("#sort").val(materialPropertyInfo[3]);
|
||||||
$("#sort").val(rowsdata.sort);
|
$("#anotherName").val(materialPropertyInfo[4]);
|
||||||
$("#anotherName").val(rowsdata.anothername);
|
|
||||||
|
|
||||||
$('#materialPropertyDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑商品属性');
|
$('#materialPropertyDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑商品属性');
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
//焦点在名称输入框==定焦在输入文字后面
|
//焦点在名称输入框==定焦在输入文字后面
|
||||||
$("#nativeName").val("").focus().val(rowsdata.nativename);
|
$("#nativeName").val("").focus().val(materialPropertyInfo[1]);
|
||||||
url = '/materialProperty/update?id=' + rowsdata.id;
|
url = '/materialProperty/update?id=' + materialPropertyInfo[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
//搜索处理
|
//搜索处理
|
||||||
|
|||||||
@@ -40,188 +40,186 @@
|
|||||||
</table>
|
</table>
|
||||||
<table id="tableForSelectData" style="top:300px;border-bottom-color:#FFFFFF"></table>
|
<table id="tableForSelectData" style="top:300px;border-bottom-color:#FFFFFF"></table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="materialDetailListDlg" class="easyui-dialog" style="width:900px;height:500px;padding:10px 20px" closed="true"
|
<div id="materialDetailListDlg" class="easyui-dialog" style="width:900px;height:500px;padding:10px 20px" closed="true"
|
||||||
modal="true" collapsible="false" closable="true">
|
modal="true" collapsible="false" closable="true">
|
||||||
<table id="materialTableData" style="top:50px;border-bottom-color:#FFFFFF"></table>
|
<table id="materialTableData" style="top:50px;border-bottom-color:#FFFFFF"></table>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
|
||||||
var setCategoryId = "1";
|
|
||||||
var cid = 1;
|
|
||||||
//初始化界面
|
|
||||||
$(function () {
|
|
||||||
//初始化系统基础信息
|
|
||||||
initTableData();
|
|
||||||
ininPager();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
//初始化表格数据
|
var setCategoryId = "1";
|
||||||
function initTableData() {
|
var cid = 1;
|
||||||
//改变宽度和高度
|
//初始化界面
|
||||||
$("#searchForSelectPanel").panel({width: webW/2-70});
|
$(function () {
|
||||||
$("#tableForSelectPanel").panel({width: webW/2-70});
|
//初始化系统基础信息
|
||||||
$('#tableForSelectData').datagrid({
|
initTableData();
|
||||||
//title:'商品列表',
|
ininPager();
|
||||||
//iconCls:'icon-save',
|
|
||||||
//width:700,
|
|
||||||
height: heightInfo,
|
|
||||||
nowrap: false,
|
|
||||||
rownumbers: false,
|
|
||||||
//动画效果
|
|
||||||
animate: false,
|
|
||||||
//选中单行
|
|
||||||
singleSelect: true,
|
|
||||||
collapsible: false,
|
|
||||||
selectOnCheck: false,
|
|
||||||
//fitColumns:true,
|
|
||||||
//单击行是否选中
|
|
||||||
//checkOnSelect : false,
|
|
||||||
pagination: true,
|
|
||||||
//交替出现背景
|
|
||||||
striped: true,
|
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
pageSize: initPageSize,
|
|
||||||
pageList: initPageNum,
|
|
||||||
columns: [[
|
|
||||||
{field: 'id', width: 35, align: "center", hidden: true},
|
|
||||||
{title: '品名', field: 'name', width: 150},
|
|
||||||
{title: '型号', field: 'model', width: 100},
|
|
||||||
{title: '类别', field: 'categoryName', width: 130},
|
|
||||||
{title: '单位', field: 'unit', width: 60}
|
|
||||||
]],
|
|
||||||
toolbar: [
|
|
||||||
],
|
|
||||||
onLoadError: function () {
|
|
||||||
$.messager.alert('页面加载提示', '页面加载异常,请稍后再试!', 'error');
|
|
||||||
return;
|
|
||||||
},
|
|
||||||
onDblClickRow : function(rowIndex, rowData){
|
|
||||||
var selectType=$("#selectType").val();
|
|
||||||
console.log(rowData);
|
|
||||||
if(selectType=="lookForSelectMaterial"){
|
|
||||||
//单个添加序列号时选择
|
|
||||||
$("#materialId").val(rowData.id);
|
|
||||||
$("#materialName").val(rowData.name);
|
|
||||||
}else if(selectType=="batLookForSelectMaterial"){
|
|
||||||
//批量添加序列号时选择
|
|
||||||
$("#batAddMaterialName").val(rowData.name);
|
|
||||||
|
|
||||||
}
|
|
||||||
//关闭掉dialog
|
|
||||||
$("#forSelectMaterialDlg").dialog('close');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
dgResize();
|
|
||||||
showMaterialDetails(1, initPageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
//初始化表格数据
|
||||||
|
function initTableData() {
|
||||||
|
//改变宽度和高度
|
||||||
|
$("#searchForSelectPanel").panel({width: webW/2-70});
|
||||||
|
$("#tableForSelectPanel").panel({width: webW/2-70});
|
||||||
|
$('#tableForSelectData').datagrid({
|
||||||
|
//title:'商品列表',
|
||||||
|
//iconCls:'icon-save',
|
||||||
|
//width:700,
|
||||||
|
height: heightInfo,
|
||||||
|
nowrap: false,
|
||||||
|
rownumbers: false,
|
||||||
|
//动画效果
|
||||||
|
animate: false,
|
||||||
|
//选中单行
|
||||||
|
singleSelect: true,
|
||||||
|
collapsible: false,
|
||||||
|
selectOnCheck: false,
|
||||||
|
//fitColumns:true,
|
||||||
|
//单击行是否选中
|
||||||
|
//checkOnSelect : false,
|
||||||
|
pagination: true,
|
||||||
|
//交替出现背景
|
||||||
|
striped: true,
|
||||||
|
//loadFilter: pagerFilter,
|
||||||
|
pageSize: initPageSize,
|
||||||
|
pageList: initPageNum,
|
||||||
|
columns: [[
|
||||||
|
{field: 'id', width: 35, align: "center", hidden: true},
|
||||||
|
{title: '品名', field: 'name', width: 150},
|
||||||
|
{title: '型号', field: 'model', width: 100},
|
||||||
|
{title: '类别', field: 'categoryName', width: 130},
|
||||||
|
{title: '单位', field: 'unit', width: 60}
|
||||||
|
]],
|
||||||
|
toolbar: [
|
||||||
|
],
|
||||||
|
onLoadError: function () {
|
||||||
|
$.messager.alert('页面加载提示', '页面加载异常,请稍后再试!', 'error');
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
onDblClickRow : function(rowIndex, rowData){
|
||||||
|
var selectType=$("#selectType").val();
|
||||||
|
console.log(rowData);
|
||||||
|
if(selectType=="lookForSelectMaterial"){
|
||||||
|
//单个添加序列号时选择
|
||||||
|
$("#materialId").val(rowData.id);
|
||||||
|
$("#materialName").val(rowData.name);
|
||||||
|
}else if(selectType=="batLookForSelectMaterial"){
|
||||||
|
//批量添加序列号时选择
|
||||||
|
$("#batAddMaterialName").val(rowData.name);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//初始化键盘enter事件
|
|
||||||
$(document).keydown(function (event) {
|
|
||||||
//兼容 IE和firefox 事件
|
|
||||||
var e = window.event || event;
|
|
||||||
var k = e.keyCode || e.which || e.charCode;
|
|
||||||
//兼容 IE,firefox 兼容
|
|
||||||
var obj = e.srcElement ? e.srcElement : e.target;
|
|
||||||
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
|
|
||||||
if (k == "13" && (obj.id == "CategoryLevel" || obj.id == "Name")) {
|
|
||||||
$("#saveMaterial").click();
|
|
||||||
}
|
|
||||||
//搜索按钮添加快捷键
|
|
||||||
if (k == "13" && (obj.id == "searchCategoryId" || (obj.id == "searchName"))) {
|
|
||||||
$("#searchForSelectBtn").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//分页信息处理
|
|
||||||
function ininPager() {
|
|
||||||
try {
|
|
||||||
var opts = $("#tableForSelectData").datagrid('options');
|
|
||||||
var pager = $("#tableForSelectData").datagrid('getPager');
|
|
||||||
pager.pagination({
|
|
||||||
onSelectPage: function (pageNum, pageSize) {
|
|
||||||
opts.pageNumber = pageNum;
|
|
||||||
opts.pageSize = pageSize;
|
|
||||||
pager.pagination('refresh',
|
|
||||||
{
|
|
||||||
pageNumber: pageNum,
|
|
||||||
pageSize: pageSize
|
|
||||||
});
|
|
||||||
showMaterialDetails(pageNum, pageSize);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
$.messager.alert('异常处理提示', "分页信息异常 : " + e.name + ": " + e.message, 'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//搜索处理
|
|
||||||
$("#searchForSelectBtn").unbind().bind({
|
|
||||||
click: function () {
|
|
||||||
showMaterialDetails(1, initPageSize);
|
|
||||||
var opts = $("#tableForSelectData").datagrid('options');
|
|
||||||
var pager = $("#tableForSelectData").datagrid('getPager');
|
|
||||||
opts.pageNumber = 1;
|
|
||||||
opts.pageSize = initPageSize;
|
|
||||||
pager.pagination('refresh', {
|
|
||||||
pageNumber: 1,
|
|
||||||
pageSize: initPageSize
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
function showMaterialDetails(pageNo, pageSize) {
|
|
||||||
var name = $.trim($("#searchForSelectName").val());
|
|
||||||
var model = $.trim($("#searchForSelectModel").val());
|
|
||||||
if (setCategoryId != "1") {
|
|
||||||
cid = 2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cid = 1;
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
type: "get",
|
|
||||||
url: "/material/getMaterialEnableSerialNumberList",
|
|
||||||
dataType: "json",
|
|
||||||
data: ({
|
|
||||||
search: JSON.stringify({
|
|
||||||
name: name,
|
|
||||||
model: model
|
|
||||||
}),
|
|
||||||
currentPage: pageNo,
|
|
||||||
pageSize: pageSize
|
|
||||||
}),
|
|
||||||
success: function (res) {
|
|
||||||
if(res && res.code === 200){
|
|
||||||
if(res.data && res.data.page) {
|
|
||||||
$("#tableForSelectData").datagrid('loadData', res.data.page);
|
|
||||||
}
|
}
|
||||||
|
//关闭掉dialog
|
||||||
|
$("#forSelectMaterialDlg").dialog('close');
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
//此处添加错误处理
|
dgResize();
|
||||||
error: function () {
|
showMaterialDetails(1, initPageSize);
|
||||||
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
|
}
|
||||||
return;
|
|
||||||
|
//初始化键盘enter事件
|
||||||
|
$(document).keydown(function (event) {
|
||||||
|
//兼容 IE和firefox 事件
|
||||||
|
var e = window.event || event;
|
||||||
|
var k = e.keyCode || e.which || e.charCode;
|
||||||
|
//兼容 IE,firefox 兼容
|
||||||
|
var obj = e.srcElement ? e.srcElement : e.target;
|
||||||
|
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
|
||||||
|
if (k == "13" && (obj.id == "CategoryLevel" || obj.id == "Name")) {
|
||||||
|
$("#saveMaterial").click();
|
||||||
|
}
|
||||||
|
//搜索按钮添加快捷键
|
||||||
|
if (k == "13" && (obj.id == "searchCategoryId" || (obj.id == "searchName"))) {
|
||||||
|
$("#searchForSelectBtn").click();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
//重置按钮
|
//分页信息处理
|
||||||
$("#searchForSelectResetBtn").unbind().bind({
|
function ininPager() {
|
||||||
click: function () {
|
try {
|
||||||
$("#searchForSelectName").val("");
|
var opts = $("#tableForSelectData").datagrid('options');
|
||||||
setCategoryId = "1";
|
var pager = $("#tableForSelectData").datagrid('getPager');
|
||||||
//加载完以后重新初始化
|
pager.pagination({
|
||||||
$("#searchForSelectBtn").click();
|
onSelectPage: function (pageNum, pageSize) {
|
||||||
|
opts.pageNumber = pageNum;
|
||||||
|
opts.pageSize = pageSize;
|
||||||
|
pager.pagination('refresh',
|
||||||
|
{
|
||||||
|
pageNumber: pageNum,
|
||||||
|
pageSize: pageSize
|
||||||
|
});
|
||||||
|
showMaterialDetails(pageNum, pageSize);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
$.messager.alert('异常处理提示', "分页信息异常 : " + e.name + ": " + e.message, 'error');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
//搜索处理
|
||||||
|
$("#searchForSelectBtn").unbind().bind({
|
||||||
|
click: function () {
|
||||||
|
showMaterialDetails(1, initPageSize);
|
||||||
|
var opts = $("#tableForSelectData").datagrid('options');
|
||||||
|
var pager = $("#tableForSelectData").datagrid('getPager');
|
||||||
|
opts.pageNumber = 1;
|
||||||
|
opts.pageSize = initPageSize;
|
||||||
|
pager.pagination('refresh', {
|
||||||
|
pageNumber: 1,
|
||||||
|
pageSize: initPageSize
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function showMaterialDetails(pageNo, pageSize) {
|
||||||
|
var name = $.trim($("#searchForSelectName").val());
|
||||||
|
var model = $.trim($("#searchForSelectModel").val());
|
||||||
|
if (setCategoryId != "1") {
|
||||||
|
cid = 2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cid = 1;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
type: "get",
|
||||||
|
url: "/material/getMaterialEnableSerialNumberList",
|
||||||
|
dataType: "json",
|
||||||
|
data: ({
|
||||||
|
search: JSON.stringify({
|
||||||
|
name: name,
|
||||||
|
model: model
|
||||||
|
}),
|
||||||
|
currentPage: pageNo,
|
||||||
|
pageSize: pageSize
|
||||||
|
}),
|
||||||
|
success: function (res) {
|
||||||
|
if(res && res.code === 200){
|
||||||
|
if(res.data && res.data.page) {
|
||||||
|
$("#tableForSelectData").datagrid('loadData', res.data.page);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//此处添加错误处理
|
||||||
|
error: function () {
|
||||||
|
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//重置按钮
|
||||||
|
$("#searchForSelectResetBtn").unbind().bind({
|
||||||
|
click: function () {
|
||||||
|
$("#searchForSelectName").val("");
|
||||||
|
setCategoryId = "1";
|
||||||
|
//加载完以后重新初始化
|
||||||
|
$("#searchForSelectBtn").click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -46,8 +46,21 @@
|
|||||||
|
|
||||||
function forSelectMaterialCategory(node) {
|
function forSelectMaterialCategory(node) {
|
||||||
console.log(node);
|
console.log(node);
|
||||||
$("#parentName").val(node.text);
|
if(clickType) {
|
||||||
$("#parentid").val(node.id);
|
if(clickType == "selectBtn") {
|
||||||
|
$("#searchParentName").val(node.text);
|
||||||
|
$("#searchParentId").val(node.id);
|
||||||
|
types = "";
|
||||||
|
initMCData(node.id);
|
||||||
|
} else if(clickType == "editBtn") {
|
||||||
|
$("#parentName").val(node.text);
|
||||||
|
$("#parentid").val(node.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$("#parentName").val(node.text);
|
||||||
|
$("#parentid").val(node.id);
|
||||||
|
}
|
||||||
$('#forSelectMaterialCategoryDlg').dialog('close');
|
$('#forSelectMaterialCategoryDlg').dialog('close');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
<script src="/js/handlebars.js"></script>
|
<script src="/js/handlebars.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<!--<script src="/js/pages/materials/other_in_list.js"></script>-->
|
|
||||||
<script src="/js/common/jsherp.js"></script>
|
<script src="/js/common/jsherp.js"></script>
|
||||||
<script src="/js/pages/materials/add_temp.js"></script>
|
<script src="/js/pages/materials/add_temp.js"></script>
|
||||||
<script src="/js/pages/materials/in_out.js"></script>
|
<script src="/js/pages/materials/in_out.js"></script>
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
<script src="/js/handlebars.js"></script>
|
<script src="/js/handlebars.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<!--<script src="/js/pages/materials/other_out_list.js"></script>-->
|
|
||||||
<script src="/js/common/jsherp.js"></script>
|
<script src="/js/common/jsherp.js"></script>
|
||||||
<script src="/js/pages/materials/add_temp.js"></script>
|
<script src="/js/pages/materials/add_temp.js"></script>
|
||||||
<script src="/js/pages/materials/in_out.js"></script>
|
<script src="/js/pages/materials/in_out.js"></script>
|
||||||
|
|||||||
@@ -121,17 +121,10 @@
|
|||||||
{title: '姓名', field: 'name', width: 180},
|
{title: '姓名', field: 'name', width: 180},
|
||||||
{title: '类型', field: 'type', width: 180},
|
{title: '类型', field: 'type', width: 180},
|
||||||
{
|
{
|
||||||
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec,index) {
|
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec) {
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/6 9:33
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js实现
|
|
||||||
*/
|
|
||||||
var str = '';
|
var str = '';
|
||||||
// var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.type;
|
var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.type;
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editPerson(\'' + index + '\');"/> <a onclick="editPerson(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editPerson(\'' + rowInfo + '\');"/> <a onclick="editPerson(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deletePerson(' + rec.id + ');"/> <a onclick="deletePerson(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deletePerson(' + rec.id + ');"/> <a onclick="deletePerson(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@@ -377,20 +370,19 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//编辑信息
|
//编辑信息
|
||||||
function editPerson(index) {
|
function editPerson(personTotalInfo) {
|
||||||
// var personInfo = personTotalInfo.split("AaBb");
|
var personInfo = personTotalInfo.split("AaBb");
|
||||||
//获取当前行
|
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
$("#Name").val(personInfo[1]);
|
||||||
$("#Name").val(rowsdata.name);
|
$("#Type").val(personInfo[2]);
|
||||||
$("#Type").val(rowsdata.type);
|
|
||||||
|
|
||||||
//oldPerson = personInfo[1];
|
//oldPerson = personInfo[1];
|
||||||
$('#personDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑经手人信息');
|
$('#personDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑经手人信息');
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
personID = rowsdata.id;
|
personID = personInfo[0];
|
||||||
//焦点在名称输入框==定焦在输入文字后面
|
//焦点在名称输入框==定焦在输入文字后面
|
||||||
$("#Name").val("").focus().val(rowsdata.name);
|
$("#Name").val("").focus().val(personInfo[1]);
|
||||||
url = '/person/update?id=' + rowsdata.id;
|
url = '/person/update?id=' + personInfo[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
//搜索处理
|
//搜索处理
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
<script src="/js/handlebars.js"></script>
|
<script src="/js/handlebars.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<!--<script src="/js/pages/materials/purchase_back_list.js"></script>-->
|
|
||||||
<script src="/js/common/jsherp.js"></script>
|
<script src="/js/common/jsherp.js"></script>
|
||||||
<script src="/js/pages/materials/add_temp.js"></script>
|
<script src="/js/pages/materials/add_temp.js"></script>
|
||||||
<script src="/js/pages/materials/in_out.js"></script>
|
<script src="/js/pages/materials/in_out.js"></script>
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
<script src="/js/handlebars.js"></script>
|
<script src="/js/handlebars.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<!--<script src="/js/pages/materials/purchase_in_list.js"></script>-->
|
|
||||||
<script src="/js/common/jsherp.js"></script>
|
<script src="/js/common/jsherp.js"></script>
|
||||||
<script src="/js/pages/materials/add_temp.js"></script>
|
<script src="/js/pages/materials/add_temp.js"></script>
|
||||||
<script src="/js/pages/materials/in_out.js"></script>
|
<script src="/js/pages/materials/in_out.js"></script>
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
<script src="/js/handlebars.js"></script>
|
<script src="/js/handlebars.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<!--<script src="/js/pages/materials/purchase_orders_list.js"></script>-->
|
|
||||||
<script src="/js/common/jsherp.js"></script>
|
<script src="/js/common/jsherp.js"></script>
|
||||||
<script src="/js/pages/materials/add_temp.js"></script>
|
<script src="/js/pages/materials/add_temp.js"></script>
|
||||||
<script src="/js/pages/materials/in_out.js"></script>
|
<script src="/js/pages/materials/in_out.js"></script>
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
<script src="/js/handlebars.js"></script>
|
<script src="/js/handlebars.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<!--<script src="/js/pages/materials/retail_back_list.js"></script>-->
|
|
||||||
<script src="/js/common/jsherp.js"></script>
|
<script src="/js/common/jsherp.js"></script>
|
||||||
<script src="/js/pages/materials/add_temp.js"></script>
|
<script src="/js/pages/materials/add_temp.js"></script>
|
||||||
<script src="/js/pages/materials/in_out.js"></script>
|
<script src="/js/pages/materials/in_out.js"></script>
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
<script src="/js/handlebars.js"></script>
|
<script src="/js/handlebars.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<!--<script src="/js/pages/materials/retail_out_list.js"></script>-->
|
|
||||||
<script src="/js/common/jsherp.js"></script>
|
<script src="/js/common/jsherp.js"></script>
|
||||||
<script src="/js/pages/materials/add_temp.js"></script>
|
<script src="/js/pages/materials/add_temp.js"></script>
|
||||||
<script src="/js/pages/materials/in_out.js"></script>
|
<script src="/js/pages/materials/in_out.js"></script>
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
<script src="/js/handlebars.js"></script>
|
<script src="/js/handlebars.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<!--<script src="/js/pages/materials/sale_back_list.js"></script>-->
|
|
||||||
<script src="/js/common/jsherp.js"></script>
|
<script src="/js/common/jsherp.js"></script>
|
||||||
<script src="/js/pages/materials/add_temp.js"></script>
|
<script src="/js/pages/materials/add_temp.js"></script>
|
||||||
<script src="/js/pages/materials/in_out.js"></script>
|
<script src="/js/pages/materials/in_out.js"></script>
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
<script src="/js/handlebars.js"></script>
|
<script src="/js/handlebars.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<!--<script src="/js/pages/materials/sale_orders_list.js"></script>-->
|
|
||||||
<script src="/js/common/jsherp.js"></script>
|
<script src="/js/common/jsherp.js"></script>
|
||||||
<script src="/js/pages/materials/add_temp.js"></script>
|
<script src="/js/pages/materials/add_temp.js"></script>
|
||||||
<script src="/js/pages/materials/in_out.js"></script>
|
<script src="/js/pages/materials/in_out.js"></script>
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
<script src="/js/handlebars.js"></script>
|
<script src="/js/handlebars.js"></script>
|
||||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||||
<script src="/js/common/common.js"></script>
|
<script src="/js/common/common.js"></script>
|
||||||
<!--<script src="/js/pages/materials/sale_out_list.js"></script>-->
|
|
||||||
<script src="/js/common/jsherp.js"></script>
|
<script src="/js/common/jsherp.js"></script>
|
||||||
<script src="/js/pages/materials/add_temp.js"></script>
|
<script src="/js/pages/materials/add_temp.js"></script>
|
||||||
<script src="/js/pages/materials/in_out.js"></script>
|
<script src="/js/pages/materials/in_out.js"></script>
|
||||||
|
|||||||
@@ -93,17 +93,10 @@
|
|||||||
{title: '本月发生额', field: 'thismonthamount', width: 100, align: "center"},
|
{title: '本月发生额', field: 'thismonthamount', width: 100, align: "center"},
|
||||||
{title: '当前余额', field: 'currentamount', width: 100, align: "center"},
|
{title: '当前余额', field: 'currentamount', width: 100, align: "center"},
|
||||||
{
|
{
|
||||||
title: '操作', field: 'op', width: 100, align: "center", formatter: function (value, rec,index) {
|
title: '操作', field: 'op', width: 100, align: "center", formatter: function (value, rec) {
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/6 9:33
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改效率低下的js实现
|
|
||||||
*/
|
|
||||||
var str = '';
|
var str = '';
|
||||||
// var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.serialno + 'AaBb' + rec.initialamount + 'AaBb' + rec.currentamount;
|
var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.serialno + 'AaBb' + rec.initialamount + 'AaBb' + rec.currentamount;
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountInOutList(\'' + index + '\');"/> <a onclick="showAccountInOutList(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">流水</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountInOutList(\'' + rowInfo + '\');"/> <a onclick="showAccountInOutList(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">流水</a> ';
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,12 +200,10 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function showAccountInOutList(index) {
|
function showAccountInOutList(accountInfo) {
|
||||||
// var info = accountInfo.split("AaBb");
|
var info = accountInfo.split("AaBb");
|
||||||
//获取当前行
|
var accountId = info[0];
|
||||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
var initialAmount = info[3];
|
||||||
var accountId = rowsdata.id;
|
|
||||||
var initialAmount = rowsdata.initialamount;
|
|
||||||
$('#accountDetailListDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 查看账户流水');
|
$('#accountDetailListDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 查看账户流水');
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
initAccountDetailData(accountId);
|
initAccountDetailData(accountId);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
<div class="register-logo">
|
<div class="register-logo">
|
||||||
<a href="/">
|
<a href="/">
|
||||||
<b>华夏ERP</b>
|
<b>华夏ERP</b>
|
||||||
<small>V2.1</small>
|
<small>V1.0</small>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="register-box-body">
|
<div class="register-box-body">
|
||||||
@@ -141,20 +141,13 @@
|
|||||||
alert("确认密码不一致!");
|
alert("确认密码不一致!");
|
||||||
} else {
|
} else {
|
||||||
//执行注册
|
//执行注册
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/4/24 15:01
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 密码加密后发送到后台
|
|
||||||
*/
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
url: "/user/registerUser",
|
url: "/user/registerUser",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: ({
|
data: ({
|
||||||
loginame: $("#username").val(),
|
loginame: $("#username").val(),
|
||||||
password: hex_md5($.trim($("#password").val()))
|
password: $("#password").val()
|
||||||
}),
|
}),
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
if (res && res.code === 200) {
|
if (res && res.code === 200) {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -1,10 +1,17 @@
|
|||||||
package com.jsh.erp;
|
package com.jsh.erp;
|
||||||
|
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration;
|
||||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
import org.springframework.web.servlet.DispatcherServlet;
|
||||||
|
|
||||||
|
import javax.servlet.http.Cookie;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@MapperScan(basePackages = {"com.jsh.erp.datasource.mappers"})
|
@MapperScan(basePackages = {"com.jsh.erp.datasource.mappers"})
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantHandler;
|
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantHandler;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser;
|
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser;
|
||||||
|
import com.jsh.erp.datasource.entities.User;
|
||||||
import net.sf.jsqlparser.expression.Expression;
|
import net.sf.jsqlparser.expression.Expression;
|
||||||
import net.sf.jsqlparser.expression.LongValue;
|
import net.sf.jsqlparser.expression.LongValue;
|
||||||
import org.apache.ibatis.mapping.MappedStatement;
|
import org.apache.ibatis.mapping.MappedStatement;
|
||||||
@@ -21,15 +22,7 @@ import java.util.List;
|
|||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class TenantConfig {
|
public class TenantConfig {
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/4/28 14:28
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 实现多租户和无租户模式数据可以兼容在一个数据库中
|
|
||||||
* 多租户模式:根据tenant_id=租户id来筛选个人数据
|
|
||||||
* 无租户模式:根据tenant_id=-1来筛选数据
|
|
||||||
*/
|
|
||||||
@Bean
|
@Bean
|
||||||
public PaginationInterceptor paginationInterceptor(HttpServletRequest request) {
|
public PaginationInterceptor paginationInterceptor(HttpServletRequest request) {
|
||||||
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
|
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
|
||||||
@@ -41,11 +34,9 @@ public class TenantConfig {
|
|||||||
//从session中获取租户id
|
//从session中获取租户id
|
||||||
Object tenantId = request.getSession().getAttribute("tenantId");
|
Object tenantId = request.getSession().getAttribute("tenantId");
|
||||||
if(tenantId!=null){
|
if(tenantId!=null){
|
||||||
//多租户模式,租户id从当前用户获取
|
|
||||||
return new LongValue(Long.parseLong(tenantId.toString()));
|
return new LongValue(Long.parseLong(tenantId.toString()));
|
||||||
} else {
|
} else {
|
||||||
//无租户模式,租户id为-1
|
return null;
|
||||||
return new LongValue(Long.valueOf(-1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,11 +47,30 @@ public class TenantConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doTableFilter(String tableName) {
|
public boolean doTableFilter(String tableName) {
|
||||||
// 这里可以判断是否过滤表
|
//获取开启状态
|
||||||
if ("tbl_sequence".equals(tableName) || "dual".equals(tableName)|| "jsh_tenant".equals(tableName)) {
|
Object tenantId = request.getSession().getAttribute("tenantId");
|
||||||
return true;
|
if(tenantId!=null) {
|
||||||
|
//从session中获取租户id
|
||||||
|
String loginName = null;
|
||||||
|
Object userInfo = request.getSession().getAttribute("user");
|
||||||
|
if(userInfo != null) {
|
||||||
|
User user = (User) userInfo;
|
||||||
|
loginName = user.getLoginame();
|
||||||
|
}
|
||||||
|
if(("admin").equals(loginName)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
// 这里可以判断是否过滤表
|
||||||
|
if ("jsh_materialproperty".equals(tableName) || "tbl_sequence".equals(tableName)
|
||||||
|
|| "jsh_userbusiness".equals(tableName) || "jsh_functions".equals(tableName)
|
||||||
|
|| "jsh_tenant".equals(tableName)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -71,14 +81,12 @@ public class TenantConfig {
|
|||||||
@Override
|
@Override
|
||||||
public boolean doFilter(MetaObject metaObject) {
|
public boolean doFilter(MetaObject metaObject) {
|
||||||
MappedStatement ms = SqlParserHelper.getMappedStatement(metaObject);
|
MappedStatement ms = SqlParserHelper.getMappedStatement(metaObject);
|
||||||
// 过滤自定义查询,此处跳过指定id的查询(不追加租户id过滤条件)
|
// 过滤自定义查询此时无租户信息约束出现
|
||||||
if ("com.jsh.erp.datasource.mappers.UserMapperEx.getUserListByLoginName".equals(ms.getId())||
|
if ("com.jsh.erp.datasource.mappers.UserMapperEx.getUserListByUserNameOrLoginName".equals(ms.getId())||
|
||||||
"com.jsh.erp.datasource.mappers.UserMapperEx.getUserListByloginNameAndPassword".equals(ms.getId())||
|
"com.jsh.erp.datasource.mappers.DepotItemMapperEx.getStockByParam".equals(ms.getId())) {
|
||||||
"com.jsh.erp.datasource.mappers.DepotItemMapperEx.getCurrentRepByMaterialIdAndDepotId".equals(ms.getId())) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return paginationInterceptor;
|
return paginationInterceptor;
|
||||||
|
|||||||
@@ -213,11 +213,7 @@ public class BusinessConstants {
|
|||||||
* 默认管理员账号
|
* 默认管理员账号
|
||||||
*/
|
*/
|
||||||
public static final String DEFAULT_MANAGER = "admin";
|
public static final String DEFAULT_MANAGER = "admin";
|
||||||
/**
|
|
||||||
* 测试用户的基础数据设定
|
|
||||||
* */
|
|
||||||
public static final String TEST_USER_NUM_LIMIT="2000";
|
|
||||||
public static final String TEST_BILLS_NUM_LIMIT="200000";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -278,9 +278,6 @@ public class ExceptionConstants {
|
|||||||
//商品库存不足
|
//商品库存不足
|
||||||
public static final int MATERIAL_STOCK_NOT_ENOUGH_CODE = 8000004;
|
public static final int MATERIAL_STOCK_NOT_ENOUGH_CODE = 8000004;
|
||||||
public static final String MATERIAL_STOCK_NOT_ENOUGH_MSG = "商品:%s库存不足";
|
public static final String MATERIAL_STOCK_NOT_ENOUGH_MSG = "商品:%s库存不足";
|
||||||
//商品单位不正确
|
|
||||||
public static final int MATERIAL_UNIT_NOT_RIGHT_CODE = 8000005;
|
|
||||||
public static final String MATERIAL_UNIT_NOT_RIGHT_MSG = "商品:%s单位不正确,使用单位:%s,基础单位:%s,副单位:%s";
|
|
||||||
/**
|
/**
|
||||||
* 单据信息
|
* 单据信息
|
||||||
* type = 85
|
* type = 85
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.jsh.erp.constants.BusinessConstants;
|
|||||||
import com.jsh.erp.constants.ExceptionConstants;
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
import com.jsh.erp.datasource.entities.AccountHead;
|
import com.jsh.erp.datasource.entities.AccountHead;
|
||||||
import com.jsh.erp.datasource.entities.AccountHeadVo4ListEx;
|
import com.jsh.erp.datasource.entities.AccountHeadVo4ListEx;
|
||||||
import com.jsh.erp.exception.BusinessParamCheckingException;
|
|
||||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.service.accountHead.AccountHeadService;
|
import com.jsh.erp.service.accountHead.AccountHeadService;
|
||||||
import com.jsh.erp.utils.BaseResponseInfo;
|
import com.jsh.erp.utils.BaseResponseInfo;
|
||||||
@@ -35,6 +34,27 @@ public class AccountHeadController {
|
|||||||
@Resource
|
@Resource
|
||||||
private AccountHeadService accountHeadService;
|
private AccountHeadService accountHeadService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取最大的id
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/getMaxId")
|
||||||
|
public BaseResponseInfo getMaxId(HttpServletRequest request)throws Exception {
|
||||||
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
Long maxId = accountHeadService.getMaxId();
|
||||||
|
map.put("maxId", maxId);
|
||||||
|
res.code = 200;
|
||||||
|
res.data = map;
|
||||||
|
} catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
res.code = 500;
|
||||||
|
res.data = "获取数据失败";
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询单位的累计应收和累计应付,收预付款不计入此处
|
* 查询单位的累计应收和累计应付,收预付款不计入此处
|
||||||
@@ -125,38 +145,5 @@ public class AccountHeadController {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 新增财务信息和财务明细信息
|
|
||||||
* create time: 2019/5/21 15:50
|
|
||||||
* @Param: beanJson
|
|
||||||
* @Param: inserted
|
|
||||||
* @Param: deleted
|
|
||||||
* @Param: updated
|
|
||||||
* @Param: request
|
|
||||||
* @return java.lang.Object
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/addAccountHeadAndDetail")
|
|
||||||
public Object addAccountHeadAndDetail(@RequestParam("info") String beanJson,
|
|
||||||
@RequestParam("inserted") String inserted,
|
|
||||||
@RequestParam("deleted") String deleted,
|
|
||||||
@RequestParam("updated") String updated,
|
|
||||||
@RequestParam("listType") String listType,HttpServletRequest request) throws Exception{
|
|
||||||
|
|
||||||
JSONObject result = ExceptionConstants.standardSuccess();
|
|
||||||
accountHeadService.addAccountHeadAndDetail(beanJson,inserted,deleted,updated,listType);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value = "/updateAccountHeadAndDetail")
|
|
||||||
public Object updateAccountHeadAndDetail(@RequestParam("id") Long id,@RequestParam("info") String beanJson,@RequestParam("inserted") String inserted,
|
|
||||||
@RequestParam("deleted") String deleted,
|
|
||||||
@RequestParam("updated") String updated,@RequestParam("listType") String listType) throws Exception{
|
|
||||||
|
|
||||||
JSONObject result = ExceptionConstants.standardSuccess();
|
|
||||||
accountHeadService.updateAccountHeadAndDetail(id,beanJson,inserted,deleted,updated,listType);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,6 +86,27 @@ public class DepotHeadController {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取最大的id
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/getMaxId")
|
||||||
|
public BaseResponseInfo getMaxId(HttpServletRequest request)throws Exception {
|
||||||
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
Long maxId = depotHeadService.getMaxId();
|
||||||
|
map.put("maxId", maxId);
|
||||||
|
res.code = 200;
|
||||||
|
res.data = map;
|
||||||
|
} catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
res.code = 500;
|
||||||
|
res.data = "获取数据失败";
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找单据_根据月份(报表)
|
* 查找单据_根据月份(报表)
|
||||||
@@ -383,7 +404,7 @@ public class DepotHeadController {
|
|||||||
throw new BusinessParamCheckingException(ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_CODE,
|
throw new BusinessParamCheckingException(ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_CODE,
|
||||||
ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_MSG);
|
ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_MSG);
|
||||||
} else {
|
} else {
|
||||||
depotHeadService.addDepotHeadAndDetail(beanJson,inserted,deleted,updated);
|
depotHeadService.addDepotHeadAndDetail(beanJson,inserted,deleted,updated,tenantId);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ import com.alibaba.fastjson.JSONArray;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
import com.jsh.erp.constants.ExceptionConstants;
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
import com.jsh.erp.datasource.entities.DepotItemVo4DetailByTypeAndMId;
|
import com.jsh.erp.datasource.entities.*;
|
||||||
import com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx;
|
|
||||||
import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
|
import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
|
||||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.service.depotItem.DepotItemService;
|
import com.jsh.erp.service.depotItem.DepotItemService;
|
||||||
@@ -13,10 +12,8 @@ import com.jsh.erp.service.material.MaterialService;
|
|||||||
import com.jsh.erp.utils.*;
|
import com.jsh.erp.utils.*;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.dao.DataAccessException;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -74,8 +71,6 @@ public class DepotItemController {
|
|||||||
item.put("Type", d.getNewtype()); //进出类型
|
item.put("Type", d.getNewtype()); //进出类型
|
||||||
item.put("BasicNumber", d.getBnum()); //数量
|
item.put("BasicNumber", d.getBnum()); //数量
|
||||||
item.put("OperTime", d.getOtime()); //时间
|
item.put("OperTime", d.getOtime()); //时间
|
||||||
item.put("depotName", d.getDepotName()); //仓库名称
|
|
||||||
item.put("depotInName", d.getDepotInName()); //调入仓库名称
|
|
||||||
dataArray.add(item);
|
dataArray.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,27 +87,32 @@ public class DepotItemController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据商品id和仓库id查询库存数量
|
* 根据商品id和仓库id查询库存数量
|
||||||
|
* @param depotId
|
||||||
* @param mId
|
* @param mId
|
||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/findStockNumByMaterialId")
|
@GetMapping(value = "/findStockNumById")
|
||||||
public String findStockNumByMaterialId(
|
public BaseResponseInfo findStockNumById(
|
||||||
@RequestParam("materialId") String mId,
|
@RequestParam("depotId") Long depotId,
|
||||||
HttpServletRequest request) throws Exception{
|
@RequestParam("mId") Long mId,
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
HttpServletRequest request) throws Exception{
|
||||||
//存放数据json数组
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
JSONArray dataArray = new JSONArray();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
JSONObject item = new JSONObject();
|
try {
|
||||||
item.put("thisSum", depotItemService.getCurrentRepByMaterialIdAndDepotId(Long.valueOf(mId),null));
|
Long tenantId = Long.parseLong(request.getSession().getAttribute("tenantId").toString());
|
||||||
dataArray.add(item);
|
map.put("stock", depotItemService.getStockByParam(depotId,mId,null,null,tenantId));
|
||||||
objectMap.put("page", dataArray);
|
res.code = 200;
|
||||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
res.data = map;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
res.code = 500;
|
||||||
|
res.data = "获取数据失败";
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询计量单位信息
|
* 查询计量单位信息
|
||||||
*
|
*
|
||||||
@@ -144,7 +144,7 @@ public class DepotItemController {
|
|||||||
try {
|
try {
|
||||||
List<DepotItemVo4WithInfoEx> dataList = new ArrayList<DepotItemVo4WithInfoEx>();
|
List<DepotItemVo4WithInfoEx> dataList = new ArrayList<DepotItemVo4WithInfoEx>();
|
||||||
if(headerId != 0) {
|
if(headerId != 0) {
|
||||||
dataList = depotItemService.getDetailList(headerId);
|
dataList = depotItemService.getDetailList(headerId);
|
||||||
}
|
}
|
||||||
String[] mpArr = mpList.split(",");
|
String[] mpArr = mpList.split(",");
|
||||||
JSONObject outer = new JSONObject();
|
JSONObject outer = new JSONObject();
|
||||||
@@ -164,13 +164,17 @@ public class DepotItemController {
|
|||||||
ratio = ratio.substring(ratio.indexOf("("));
|
ratio = ratio.substring(ratio.indexOf("("));
|
||||||
}
|
}
|
||||||
//品名/型号/扩展信息/包装
|
//品名/型号/扩展信息/包装
|
||||||
String MaterialName = diEx.getMName() + ((diEx.getMModel() == null || diEx.getMModel().equals("")) ? "" : "(" + diEx.getMModel() + ")");
|
String MaterialName = (diEx.getMName() == null || diEx.getMName().equals("")) ? "" : diEx.getMName()
|
||||||
|
+ ((diEx.getMModel() == null || diEx.getMModel().equals("")) ? "" : "(" + diEx.getMModel() + ")");
|
||||||
String materialOther = getOtherInfo(mpArr, diEx);
|
String materialOther = getOtherInfo(mpArr, diEx);
|
||||||
MaterialName = MaterialName + materialOther + ((diEx.getUName() == null || diEx.getUName().equals("")) ? "" : "(" + diEx.getUName() + ")") + ratio;
|
MaterialName = MaterialName + materialOther + ((diEx.getUName() == null || diEx.getUName().equals("")) ? "" : "(" + diEx.getUName() + ")") + ratio;
|
||||||
item.put("MaterialName", MaterialName);
|
item.put("MaterialName", MaterialName == null ? "" : MaterialName);
|
||||||
|
item.put("Stock", depotItemService.getStockByParam(diEx.getDepotid(),diEx.getMaterialid(),null,null,tenantId));
|
||||||
item.put("Unit", diEx.getMunit());
|
item.put("Unit", diEx.getMunit());
|
||||||
item.put("OperNumber", diEx.getOpernumber());
|
item.put("OperNumber", diEx.getOpernumber());
|
||||||
item.put("BasicNumber", diEx.getBasicnumber());
|
item.put("BasicNumber", diEx.getBasicnumber());
|
||||||
|
//统计该商品已分批出库的总数量-用于订单
|
||||||
|
item.put("finishNumber", depotItemService.getFinishNumber(diEx.getMaterialid(),diEx.getHeaderid()));
|
||||||
item.put("UnitPrice", diEx.getUnitprice());
|
item.put("UnitPrice", diEx.getUnitprice());
|
||||||
item.put("TaxUnitPrice", diEx.getTaxunitprice());
|
item.put("TaxUnitPrice", diEx.getTaxunitprice());
|
||||||
item.put("AllPrice", diEx.getAllprice());
|
item.put("AllPrice", diEx.getAllprice());
|
||||||
@@ -235,11 +239,11 @@ public class DepotItemController {
|
|||||||
return materialOther;
|
return materialOther;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找所有的明细
|
* 查找所有的明细
|
||||||
* @param currentPage
|
* @param currentPage
|
||||||
* @param pageSize
|
* @param pageSize
|
||||||
|
* @param projectId
|
||||||
* @param monthTime
|
* @param monthTime
|
||||||
* @param headIds
|
* @param headIds
|
||||||
* @param materialIds
|
* @param materialIds
|
||||||
@@ -247,7 +251,7 @@ public class DepotItemController {
|
|||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/findByAll")
|
@PostMapping(value = "/findByAll")
|
||||||
public BaseResponseInfo findByAll(@RequestParam("currentPage") Integer currentPage,
|
public BaseResponseInfo findByAll(@RequestParam("currentPage") Integer currentPage,
|
||||||
@RequestParam("pageSize") Integer pageSize,
|
@RequestParam("pageSize") Integer pageSize,
|
||||||
@RequestParam("depotId") Long depotId,
|
@RequestParam("depotId") Long depotId,
|
||||||
@@ -301,12 +305,11 @@ public class DepotItemController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出excel表格
|
* 导出excel表格
|
||||||
* @param currentPage
|
* @param currentPage
|
||||||
* @param pageSize
|
* @param pageSize
|
||||||
|
* @param projectId
|
||||||
* @param monthTime
|
* @param monthTime
|
||||||
* @param headIds
|
* @param headIds
|
||||||
* @param materialIds
|
* @param materialIds
|
||||||
@@ -357,18 +360,19 @@ public class DepotItemController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计总计金额
|
* 统计总计金额
|
||||||
|
* @param pid
|
||||||
* @param monthTime
|
* @param monthTime
|
||||||
* @param headIds
|
* @param headIds
|
||||||
* @param materialIds
|
* @param materialIds
|
||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/totalCountMoney")
|
@PostMapping(value = "/totalCountMoney")
|
||||||
public BaseResponseInfo totalCountMoney(@RequestParam("depotId") Long depotId,
|
public BaseResponseInfo totalCountMoney(@RequestParam("depotId") Long depotId,
|
||||||
@RequestParam("monthTime") String monthTime,
|
@RequestParam("monthTime") String monthTime,
|
||||||
@RequestParam("headIds") String headIds,
|
@RequestParam("headIds") String headIds,
|
||||||
@RequestParam("materialIds") String materialIds,
|
@RequestParam("materialIds") String materialIds,
|
||||||
HttpServletRequest request) throws Exception{
|
HttpServletRequest request) throws Exception{
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
Long tenantId = Long.parseLong(request.getSession().getAttribute("tenantId").toString());
|
Long tenantId = Long.parseLong(request.getSession().getAttribute("tenantId").toString());
|
||||||
@@ -394,8 +398,6 @@ public class DepotItemController {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 进货统计
|
* 进货统计
|
||||||
* @param currentPage
|
* @param currentPage
|
||||||
@@ -407,7 +409,7 @@ public class DepotItemController {
|
|||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/buyIn")
|
@PostMapping(value = "/buyIn")
|
||||||
public BaseResponseInfo buyIn(@RequestParam("currentPage") Integer currentPage,
|
public BaseResponseInfo buyIn(@RequestParam("currentPage") Integer currentPage,
|
||||||
@RequestParam("pageSize") Integer pageSize,
|
@RequestParam("pageSize") Integer pageSize,
|
||||||
@RequestParam("monthTime") String monthTime,
|
@RequestParam("monthTime") String monthTime,
|
||||||
@@ -427,10 +429,10 @@ public class DepotItemController {
|
|||||||
if (null != dataList) {
|
if (null != dataList) {
|
||||||
for (DepotItemVo4WithInfoEx diEx : dataList) {
|
for (DepotItemVo4WithInfoEx diEx : dataList) {
|
||||||
JSONObject item = new JSONObject();
|
JSONObject item = new JSONObject();
|
||||||
BigDecimal InSum = sumNumberBuyOrSale("入库", "采购", diEx.getMId(), monthTime);
|
BigDecimal InSum = depotItemService.buyOrSale("入库", "采购", diEx.getMId(), monthTime, "number");
|
||||||
BigDecimal OutSum = sumNumberBuyOrSale("出库", "采购退货", diEx.getMId(), monthTime);
|
BigDecimal OutSum = depotItemService.buyOrSale("出库", "采购退货", diEx.getMId(), monthTime, "number");
|
||||||
BigDecimal InSumPrice = sumPriceBuyOrSale("入库", "采购", diEx.getMId(), monthTime);
|
BigDecimal InSumPrice = depotItemService.buyOrSale("入库", "采购", diEx.getMId(), monthTime, "price");
|
||||||
BigDecimal OutSumPrice = sumPriceBuyOrSale("出库", "采购退货", diEx.getMId(), monthTime);
|
BigDecimal OutSumPrice = depotItemService.buyOrSale("出库", "采购退货", diEx.getMId(), monthTime, "price");
|
||||||
item.put("MaterialName", diEx.getMName());
|
item.put("MaterialName", diEx.getMName());
|
||||||
item.put("MaterialModel", diEx.getMModel());
|
item.put("MaterialModel", diEx.getMModel());
|
||||||
//扩展信息
|
//扩展信息
|
||||||
@@ -438,6 +440,7 @@ public class DepotItemController {
|
|||||||
item.put("MaterialOther", materialOther);
|
item.put("MaterialOther", materialOther);
|
||||||
item.put("MaterialColor", diEx.getMColor());
|
item.put("MaterialColor", diEx.getMColor());
|
||||||
item.put("MaterialUnit", diEx.getMaterialUnit());
|
item.put("MaterialUnit", diEx.getMaterialUnit());
|
||||||
|
item.put("UName", diEx.getUName());
|
||||||
item.put("InSum", InSum);
|
item.put("InSum", InSum);
|
||||||
item.put("OutSum", OutSum);
|
item.put("OutSum", OutSum);
|
||||||
item.put("InSumPrice", InSumPrice);
|
item.put("InSumPrice", InSumPrice);
|
||||||
@@ -467,7 +470,7 @@ public class DepotItemController {
|
|||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/saleOut")
|
@PostMapping(value = "/saleOut")
|
||||||
public BaseResponseInfo saleOut(@RequestParam("currentPage") Integer currentPage,
|
public BaseResponseInfo saleOut(@RequestParam("currentPage") Integer currentPage,
|
||||||
@RequestParam("pageSize") Integer pageSize,
|
@RequestParam("pageSize") Integer pageSize,
|
||||||
@RequestParam("monthTime") String monthTime,
|
@RequestParam("monthTime") String monthTime,
|
||||||
@@ -487,14 +490,15 @@ public class DepotItemController {
|
|||||||
if (null != dataList) {
|
if (null != dataList) {
|
||||||
for (DepotItemVo4WithInfoEx diEx : dataList) {
|
for (DepotItemVo4WithInfoEx diEx : dataList) {
|
||||||
JSONObject item = new JSONObject();
|
JSONObject item = new JSONObject();
|
||||||
BigDecimal OutSumRetail = sumNumberBuyOrSale("出库", "零售", diEx.getMId(), monthTime);
|
BigDecimal OutSumRetail = depotItemService.buyOrSale("出库", "零售", diEx.getMId(), monthTime,"number");
|
||||||
BigDecimal OutSum = sumNumberBuyOrSale("出库", "销售", diEx.getMId(), monthTime);
|
BigDecimal OutSum = depotItemService.buyOrSale("出库", "销售", diEx.getMId(), monthTime,"number");
|
||||||
BigDecimal InSumRetail = sumNumberBuyOrSale("入库", "零售退货", diEx.getMId(), monthTime);
|
BigDecimal InSumRetail = depotItemService.buyOrSale("入库", "零售退货", diEx.getMId(), monthTime,"number");
|
||||||
BigDecimal InSum = sumNumberBuyOrSale("入库", "销售退货", diEx.getMId(), monthTime);
|
BigDecimal InSum = depotItemService.buyOrSale("入库", "销售退货", diEx.getMId(), monthTime,"number");
|
||||||
BigDecimal OutSumRetailPrice = sumPriceBuyOrSale("出库", "零售", diEx.getMId(), monthTime);
|
BigDecimal OutSumRetailPrice = depotItemService.buyOrSale("出库", "零售", diEx.getMId(), monthTime,"price");
|
||||||
BigDecimal OutSumPrice = sumPriceBuyOrSale("出库", "销售", diEx.getMId(), monthTime);
|
BigDecimal OutSumPrice = depotItemService.buyOrSale("出库", "销售", diEx.getMId(), monthTime,"price");
|
||||||
BigDecimal InSumRetailPrice = sumPriceBuyOrSale("入库", "零售退货", diEx.getMId(), monthTime);
|
BigDecimal InSumRetailPrice = depotItemService.buyOrSale("入库", "零售退货", diEx.getMId(), monthTime,"price");
|
||||||
BigDecimal InSumPrice = sumPriceBuyOrSale("入库", "销售退货", diEx.getMId(), monthTime);
|
BigDecimal InSumPrice = depotItemService.buyOrSale("入库", "销售退货", diEx.getMId(), monthTime,"price");
|
||||||
|
BigDecimal OutInSumPrice = (OutSumRetailPrice.add(OutSumPrice)).subtract(InSumRetailPrice.add(InSumPrice));
|
||||||
item.put("MaterialName", diEx.getMName());
|
item.put("MaterialName", diEx.getMName());
|
||||||
item.put("MaterialModel", diEx.getMModel());
|
item.put("MaterialModel", diEx.getMModel());
|
||||||
//扩展信息
|
//扩展信息
|
||||||
@@ -502,10 +506,12 @@ public class DepotItemController {
|
|||||||
item.put("MaterialOther", materialOther);
|
item.put("MaterialOther", materialOther);
|
||||||
item.put("MaterialColor", diEx.getMColor());
|
item.put("MaterialColor", diEx.getMColor());
|
||||||
item.put("MaterialUnit", diEx.getMaterialUnit());
|
item.put("MaterialUnit", diEx.getMaterialUnit());
|
||||||
|
item.put("UName", diEx.getUName());
|
||||||
item.put("OutSum", OutSumRetail.add(OutSum));
|
item.put("OutSum", OutSumRetail.add(OutSum));
|
||||||
item.put("InSum", InSumRetail.add(InSum));
|
item.put("InSum", InSumRetail.add(InSum));
|
||||||
item.put("OutSumPrice", OutSumRetailPrice.add(OutSumPrice));
|
item.put("OutSumPrice", OutSumRetailPrice.add(OutSumPrice));
|
||||||
item.put("InSumPrice", InSumRetailPrice.add(InSumPrice));
|
item.put("InSumPrice", InSumRetailPrice.add(InSumPrice));
|
||||||
|
item.put("OutInSumPrice",OutInSumPrice);//实际销售金额
|
||||||
dataArray.add(item);
|
dataArray.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -520,34 +526,22 @@ public class DepotItemController {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
public BigDecimal sumNumberBuyOrSale(String type, String subType, Long MId, String MonthTime)throws Exception {
|
* 获取单位
|
||||||
BigDecimal sumNumber = BigDecimal.ZERO;
|
* @param materialUnit
|
||||||
String sumType = "Number";
|
* @param uName
|
||||||
try {
|
* @return
|
||||||
BigDecimal sum = depotItemService.buyOrSale(type, subType, MId, MonthTime, sumType);
|
*/
|
||||||
if(sum != null) {
|
public String getUName(String materialUnit, String uName) {
|
||||||
sumNumber = sum;
|
String unitName = null;
|
||||||
}
|
if(!StringUtil.isEmpty(materialUnit)) {
|
||||||
} catch (Exception e) {
|
unitName = materialUnit;
|
||||||
e.printStackTrace();
|
} else if(!StringUtil.isEmpty(uName)) {
|
||||||
|
unitName = uName.substring(0,uName.indexOf(","));
|
||||||
}
|
}
|
||||||
return sumNumber;
|
return unitName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal sumPriceBuyOrSale(String type, String subType, Long MId, String MonthTime)throws Exception {
|
|
||||||
BigDecimal sumPrice = BigDecimal.ZERO;
|
|
||||||
String sumType = "Price";
|
|
||||||
try {
|
|
||||||
BigDecimal sum = depotItemService.buyOrSale(type, subType, MId, MonthTime, sumType);
|
|
||||||
if(sum != null) {
|
|
||||||
sumPrice = sum;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return sumPrice;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* 获取单价
|
* 获取单价
|
||||||
* @param presetPriceOne
|
* @param presetPriceOne
|
||||||
@@ -624,6 +618,7 @@ public class DepotItemController {
|
|||||||
* @param currentPage
|
* @param currentPage
|
||||||
* @param pageSize
|
* @param pageSize
|
||||||
* @param projectId
|
* @param projectId
|
||||||
|
* @param monthTime
|
||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
* @return
|
* @return
|
||||||
@@ -646,7 +641,6 @@ public class DepotItemController {
|
|||||||
if (null != dataList) {
|
if (null != dataList) {
|
||||||
for (DepotItemStockWarningCount diEx : dataList) {
|
for (DepotItemStockWarningCount diEx : dataList) {
|
||||||
String[] objs = new String[9];
|
String[] objs = new String[9];
|
||||||
|
|
||||||
objs[0] = diEx.getMaterialName().toString();
|
objs[0] = diEx.getMaterialName().toString();
|
||||||
objs[1] = diEx.getMaterialModel().toString();
|
objs[1] = diEx.getMaterialModel().toString();
|
||||||
objs[2] = diEx.getMaterialOther().toString();
|
objs[2] = diEx.getMaterialOther().toString();
|
||||||
@@ -711,20 +705,4 @@ public class DepotItemController {
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 获取单位
|
|
||||||
* @param materialUnit
|
|
||||||
* @param uName
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getUName(String materialUnit, String uName) {
|
|
||||||
String unitName = null;
|
|
||||||
if(!StringUtil.isEmpty(materialUnit)) {
|
|
||||||
unitName = materialUnit;
|
|
||||||
} else if(!StringUtil.isEmpty(uName)) {
|
|
||||||
unitName = uName.substring(0,uName.indexOf(","));
|
|
||||||
}
|
|
||||||
return unitName;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,10 +154,9 @@ public class FunctionsController {
|
|||||||
if(("admin").equals(loginName)) {
|
if(("admin").equals(loginName)) {
|
||||||
dataList.add(fun);
|
dataList.add(fun);
|
||||||
} else {
|
} else {
|
||||||
// if(!("系统管理").equals(fun.getName())) {
|
if(!("系统管理").equals(fun.getName())) {
|
||||||
// dataList.add(fun);
|
dataList.add(fun);
|
||||||
// }
|
}
|
||||||
dataList.add(fun);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,28 +2,19 @@ package com.jsh.erp.controller;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.github.pagehelper.PageHelper;
|
|
||||||
import com.github.pagehelper.PageInfo;
|
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
|
||||||
import com.jsh.erp.constants.ExceptionConstants;
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
import com.jsh.erp.datasource.entities.Role;
|
import com.jsh.erp.datasource.entities.Role;
|
||||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.service.role.RoleService;
|
import com.jsh.erp.service.role.RoleService;
|
||||||
import com.jsh.erp.service.user.UserService;
|
import com.jsh.erp.service.user.UserService;
|
||||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||||
import com.jsh.erp.utils.*;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ji sheng hua 华夏ERP
|
* @author ji sheng hua 华夏ERP
|
||||||
@@ -74,35 +65,11 @@ public class RoleController {
|
|||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/list")
|
@PostMapping(value = "/list")
|
||||||
public String list(@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize,
|
public List<Role> list(HttpServletRequest request)throws Exception {
|
||||||
@RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage,
|
return roleService.getRole();
|
||||||
@RequestParam("name") String name,
|
|
||||||
HttpServletRequest request)throws Exception {
|
|
||||||
Map<String, String> parameterMap = ParamUtils.requestToMap(request);
|
|
||||||
parameterMap.put("name", name);
|
|
||||||
PageQueryInfo queryInfo = new PageQueryInfo();
|
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
|
||||||
if (pageSize == null || pageSize <= 0) {
|
|
||||||
pageSize = BusinessConstants.DEFAULT_PAGINATION_PAGE_SIZE;
|
|
||||||
}
|
|
||||||
if (currentPage == null || currentPage <= 0) {
|
|
||||||
currentPage = BusinessConstants.DEFAULT_PAGINATION_PAGE_NUMBER;
|
|
||||||
}
|
|
||||||
PageHelper.startPage(currentPage,pageSize,true);
|
|
||||||
List<Role> list = roleService.getRoleList(parameterMap);
|
|
||||||
//获取分页查询后的数据
|
|
||||||
PageInfo<Role> pageInfo = new PageInfo<>(list);
|
|
||||||
objectMap.put("page", queryInfo);
|
|
||||||
if (list == null) {
|
|
||||||
queryInfo.setRows(new ArrayList<Object>());
|
|
||||||
queryInfo.setTotal(BusinessConstants.DEFAULT_LIST_NULL_NUMBER);
|
|
||||||
return returnJson(objectMap, "查找不到数据", ErpInfo.OK.code);
|
|
||||||
}
|
|
||||||
queryInfo.setRows(list);
|
|
||||||
queryInfo.setTotal(pageInfo.getTotal());
|
|
||||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create by: qiankunpingtai
|
* create by: qiankunpingtai
|
||||||
* website:https://qiankunpingtai.cn
|
* website:https://qiankunpingtai.cn
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class UserController {
|
|||||||
private Logger logger = LoggerFactory.getLogger(UserController.class);
|
private Logger logger = LoggerFactory.getLogger(UserController.class);
|
||||||
|
|
||||||
@Value("${manage.roleId}")
|
@Value("${manage.roleId}")
|
||||||
private Long manageRoleId;
|
private Integer manageRoleId;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
@@ -103,11 +103,9 @@ public class UserController {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
try {
|
try {
|
||||||
//验证通过 ,可以登录,放入session,记录登录日志
|
|
||||||
user = userService.getUserListByloginNameAndPassword(username,password);
|
|
||||||
// logService.create(new Logdetails(user, "登录系统", model.getClientIp(),
|
|
||||||
// new Timestamp(System.currentTimeMillis()), (short) 0, "管理用户:" + username + " 登录系统", username + " 登录系统"));
|
|
||||||
msgTip = "user can login";
|
msgTip = "user can login";
|
||||||
|
//验证通过 ,可以登录,放入session,记录登录日志
|
||||||
|
user = userService.getUserByUserName(username);
|
||||||
request.getSession().setAttribute("user",user);
|
request.getSession().setAttribute("user",user);
|
||||||
if(user.getTenantId()!=null) {
|
if(user.getTenantId()!=null) {
|
||||||
Tenant tenant = tenantService.getTenantByTenantId(user.getTenantId());
|
Tenant tenant = tenantService.getTenantByTenantId(user.getTenantId());
|
||||||
@@ -345,7 +343,8 @@ public class UserController {
|
|||||||
ue.setUsername(loginame);
|
ue.setUsername(loginame);
|
||||||
ue.setLoginame(loginame);
|
ue.setLoginame(loginame);
|
||||||
ue.setPassword(password);
|
ue.setPassword(password);
|
||||||
ue = userService.registerUser(ue,manageRoleId);
|
userService.checkUserNameAndLoginName(ue); //检查用户名和登录名
|
||||||
|
ue = userService.registerUser(ue,manageRoleId,request);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,692 +0,0 @@
|
|||||||
package com.jsh.erp.datasource.entities;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class AssetCategoryExample {
|
|
||||||
/**
|
|
||||||
* This field was generated by MyBatis Generator.
|
|
||||||
* This field corresponds to the database table jsh_assetcategory
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
protected String orderByClause;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This field was generated by MyBatis Generator.
|
|
||||||
* This field corresponds to the database table jsh_assetcategory
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
protected boolean distinct;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This field was generated by MyBatis Generator.
|
|
||||||
* This field corresponds to the database table jsh_assetcategory
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
protected List<Criteria> oredCriteria;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method was generated by MyBatis Generator.
|
|
||||||
* This method corresponds to the database table jsh_assetcategory
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
public AssetCategoryExample() {
|
|
||||||
oredCriteria = new ArrayList<Criteria>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method was generated by MyBatis Generator.
|
|
||||||
* This method corresponds to the database table jsh_assetcategory
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
public void setOrderByClause(String orderByClause) {
|
|
||||||
this.orderByClause = orderByClause;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method was generated by MyBatis Generator.
|
|
||||||
* This method corresponds to the database table jsh_assetcategory
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
public String getOrderByClause() {
|
|
||||||
return orderByClause;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method was generated by MyBatis Generator.
|
|
||||||
* This method corresponds to the database table jsh_assetcategory
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
public void setDistinct(boolean distinct) {
|
|
||||||
this.distinct = distinct;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method was generated by MyBatis Generator.
|
|
||||||
* This method corresponds to the database table jsh_assetcategory
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
public boolean isDistinct() {
|
|
||||||
return distinct;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method was generated by MyBatis Generator.
|
|
||||||
* This method corresponds to the database table jsh_assetcategory
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
public List<Criteria> getOredCriteria() {
|
|
||||||
return oredCriteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method was generated by MyBatis Generator.
|
|
||||||
* This method corresponds to the database table jsh_assetcategory
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
public void or(Criteria criteria) {
|
|
||||||
oredCriteria.add(criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method was generated by MyBatis Generator.
|
|
||||||
* This method corresponds to the database table jsh_assetcategory
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
public Criteria or() {
|
|
||||||
Criteria criteria = createCriteriaInternal();
|
|
||||||
oredCriteria.add(criteria);
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method was generated by MyBatis Generator.
|
|
||||||
* This method corresponds to the database table jsh_assetcategory
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
public Criteria createCriteria() {
|
|
||||||
Criteria criteria = createCriteriaInternal();
|
|
||||||
if (oredCriteria.size() == 0) {
|
|
||||||
oredCriteria.add(criteria);
|
|
||||||
}
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method was generated by MyBatis Generator.
|
|
||||||
* This method corresponds to the database table jsh_assetcategory
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
protected Criteria createCriteriaInternal() {
|
|
||||||
Criteria criteria = new Criteria();
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method was generated by MyBatis Generator.
|
|
||||||
* This method corresponds to the database table jsh_assetcategory
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
public void clear() {
|
|
||||||
oredCriteria.clear();
|
|
||||||
orderByClause = null;
|
|
||||||
distinct = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class was generated by MyBatis Generator.
|
|
||||||
* This class corresponds to the database table jsh_assetcategory
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
protected abstract static class GeneratedCriteria {
|
|
||||||
protected List<Criterion> criteria;
|
|
||||||
|
|
||||||
protected GeneratedCriteria() {
|
|
||||||
super();
|
|
||||||
criteria = new ArrayList<Criterion>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValid() {
|
|
||||||
return criteria.size() > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Criterion> getAllCriteria() {
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Criterion> getCriteria() {
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addCriterion(String condition) {
|
|
||||||
if (condition == null) {
|
|
||||||
throw new RuntimeException("Value for condition cannot be null");
|
|
||||||
}
|
|
||||||
criteria.add(new Criterion(condition));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addCriterion(String condition, Object value, String property) {
|
|
||||||
if (value == null) {
|
|
||||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
|
||||||
}
|
|
||||||
criteria.add(new Criterion(condition, value));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
|
||||||
if (value1 == null || value2 == null) {
|
|
||||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
|
||||||
}
|
|
||||||
criteria.add(new Criterion(condition, value1, value2));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdIsNull() {
|
|
||||||
addCriterion("id is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdIsNotNull() {
|
|
||||||
addCriterion("id is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdEqualTo(Long value) {
|
|
||||||
addCriterion("id =", value, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdNotEqualTo(Long value) {
|
|
||||||
addCriterion("id <>", value, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdGreaterThan(Long value) {
|
|
||||||
addCriterion("id >", value, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdGreaterThanOrEqualTo(Long value) {
|
|
||||||
addCriterion("id >=", value, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdLessThan(Long value) {
|
|
||||||
addCriterion("id <", value, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdLessThanOrEqualTo(Long value) {
|
|
||||||
addCriterion("id <=", value, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdIn(List<Long> values) {
|
|
||||||
addCriterion("id in", values, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdNotIn(List<Long> values) {
|
|
||||||
addCriterion("id not in", values, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdBetween(Long value1, Long value2) {
|
|
||||||
addCriterion("id between", value1, value2, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIdNotBetween(Long value1, Long value2) {
|
|
||||||
addCriterion("id not between", value1, value2, "id");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andAssetnameIsNull() {
|
|
||||||
addCriterion("assetname is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andAssetnameIsNotNull() {
|
|
||||||
addCriterion("assetname is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andAssetnameEqualTo(String value) {
|
|
||||||
addCriterion("assetname =", value, "assetname");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andAssetnameNotEqualTo(String value) {
|
|
||||||
addCriterion("assetname <>", value, "assetname");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andAssetnameGreaterThan(String value) {
|
|
||||||
addCriterion("assetname >", value, "assetname");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andAssetnameGreaterThanOrEqualTo(String value) {
|
|
||||||
addCriterion("assetname >=", value, "assetname");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andAssetnameLessThan(String value) {
|
|
||||||
addCriterion("assetname <", value, "assetname");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andAssetnameLessThanOrEqualTo(String value) {
|
|
||||||
addCriterion("assetname <=", value, "assetname");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andAssetnameLike(String value) {
|
|
||||||
addCriterion("assetname like", value, "assetname");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andAssetnameNotLike(String value) {
|
|
||||||
addCriterion("assetname not like", value, "assetname");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andAssetnameIn(List<String> values) {
|
|
||||||
addCriterion("assetname in", values, "assetname");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andAssetnameNotIn(List<String> values) {
|
|
||||||
addCriterion("assetname not in", values, "assetname");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andAssetnameBetween(String value1, String value2) {
|
|
||||||
addCriterion("assetname between", value1, value2, "assetname");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andAssetnameNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("assetname not between", value1, value2, "assetname");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIsystemIsNull() {
|
|
||||||
addCriterion("isystem is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIsystemIsNotNull() {
|
|
||||||
addCriterion("isystem is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIsystemEqualTo(Byte value) {
|
|
||||||
addCriterion("isystem =", value, "isystem");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIsystemNotEqualTo(Byte value) {
|
|
||||||
addCriterion("isystem <>", value, "isystem");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIsystemGreaterThan(Byte value) {
|
|
||||||
addCriterion("isystem >", value, "isystem");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIsystemGreaterThanOrEqualTo(Byte value) {
|
|
||||||
addCriterion("isystem >=", value, "isystem");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIsystemLessThan(Byte value) {
|
|
||||||
addCriterion("isystem <", value, "isystem");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIsystemLessThanOrEqualTo(Byte value) {
|
|
||||||
addCriterion("isystem <=", value, "isystem");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIsystemIn(List<Byte> values) {
|
|
||||||
addCriterion("isystem in", values, "isystem");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIsystemNotIn(List<Byte> values) {
|
|
||||||
addCriterion("isystem not in", values, "isystem");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIsystemBetween(Byte value1, Byte value2) {
|
|
||||||
addCriterion("isystem between", value1, value2, "isystem");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andIsystemNotBetween(Byte value1, Byte value2) {
|
|
||||||
addCriterion("isystem not between", value1, value2, "isystem");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionIsNull() {
|
|
||||||
addCriterion("description is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionIsNotNull() {
|
|
||||||
addCriterion("description is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionEqualTo(String value) {
|
|
||||||
addCriterion("description =", value, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionNotEqualTo(String value) {
|
|
||||||
addCriterion("description <>", value, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionGreaterThan(String value) {
|
|
||||||
addCriterion("description >", value, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionGreaterThanOrEqualTo(String value) {
|
|
||||||
addCriterion("description >=", value, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionLessThan(String value) {
|
|
||||||
addCriterion("description <", value, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionLessThanOrEqualTo(String value) {
|
|
||||||
addCriterion("description <=", value, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionLike(String value) {
|
|
||||||
addCriterion("description like", value, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionNotLike(String value) {
|
|
||||||
addCriterion("description not like", value, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionIn(List<String> values) {
|
|
||||||
addCriterion("description in", values, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionNotIn(List<String> values) {
|
|
||||||
addCriterion("description not in", values, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionBetween(String value1, String value2) {
|
|
||||||
addCriterion("description between", value1, value2, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("description not between", value1, value2, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdIsNull() {
|
|
||||||
addCriterion("tenant_id is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdIsNotNull() {
|
|
||||||
addCriterion("tenant_id is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdEqualTo(Long value) {
|
|
||||||
addCriterion("tenant_id =", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdNotEqualTo(Long value) {
|
|
||||||
addCriterion("tenant_id <>", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdGreaterThan(Long value) {
|
|
||||||
addCriterion("tenant_id >", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdGreaterThanOrEqualTo(Long value) {
|
|
||||||
addCriterion("tenant_id >=", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdLessThan(Long value) {
|
|
||||||
addCriterion("tenant_id <", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdLessThanOrEqualTo(Long value) {
|
|
||||||
addCriterion("tenant_id <=", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdIn(List<Long> values) {
|
|
||||||
addCriterion("tenant_id in", values, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdNotIn(List<Long> values) {
|
|
||||||
addCriterion("tenant_id not in", values, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdBetween(Long value1, Long value2) {
|
|
||||||
addCriterion("tenant_id between", value1, value2, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdNotBetween(Long value1, Long value2) {
|
|
||||||
addCriterion("tenant_id not between", value1, value2, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDeleteFlagIsNull() {
|
|
||||||
addCriterion("delete_Flag is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDeleteFlagIsNotNull() {
|
|
||||||
addCriterion("delete_Flag is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDeleteFlagEqualTo(String value) {
|
|
||||||
addCriterion("delete_Flag =", value, "deleteFlag");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDeleteFlagNotEqualTo(String value) {
|
|
||||||
addCriterion("delete_Flag <>", value, "deleteFlag");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDeleteFlagGreaterThan(String value) {
|
|
||||||
addCriterion("delete_Flag >", value, "deleteFlag");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDeleteFlagGreaterThanOrEqualTo(String value) {
|
|
||||||
addCriterion("delete_Flag >=", value, "deleteFlag");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDeleteFlagLessThan(String value) {
|
|
||||||
addCriterion("delete_Flag <", value, "deleteFlag");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDeleteFlagLessThanOrEqualTo(String value) {
|
|
||||||
addCriterion("delete_Flag <=", value, "deleteFlag");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDeleteFlagLike(String value) {
|
|
||||||
addCriterion("delete_Flag like", value, "deleteFlag");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDeleteFlagNotLike(String value) {
|
|
||||||
addCriterion("delete_Flag not like", value, "deleteFlag");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDeleteFlagIn(List<String> values) {
|
|
||||||
addCriterion("delete_Flag in", values, "deleteFlag");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDeleteFlagNotIn(List<String> values) {
|
|
||||||
addCriterion("delete_Flag not in", values, "deleteFlag");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDeleteFlagBetween(String value1, String value2) {
|
|
||||||
addCriterion("delete_Flag between", value1, value2, "deleteFlag");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDeleteFlagNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("delete_Flag not between", value1, value2, "deleteFlag");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class was generated by MyBatis Generator.
|
|
||||||
* This class corresponds to the database table jsh_assetcategory
|
|
||||||
*
|
|
||||||
* @mbggenerated do_not_delete_during_merge
|
|
||||||
*/
|
|
||||||
public static class Criteria extends GeneratedCriteria {
|
|
||||||
|
|
||||||
protected Criteria() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class was generated by MyBatis Generator.
|
|
||||||
* This class corresponds to the database table jsh_assetcategory
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
public static class Criterion {
|
|
||||||
private String condition;
|
|
||||||
|
|
||||||
private Object value;
|
|
||||||
|
|
||||||
private Object secondValue;
|
|
||||||
|
|
||||||
private boolean noValue;
|
|
||||||
|
|
||||||
private boolean singleValue;
|
|
||||||
|
|
||||||
private boolean betweenValue;
|
|
||||||
|
|
||||||
private boolean listValue;
|
|
||||||
|
|
||||||
private String typeHandler;
|
|
||||||
|
|
||||||
public String getCondition() {
|
|
||||||
return condition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getSecondValue() {
|
|
||||||
return secondValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isNoValue() {
|
|
||||||
return noValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSingleValue() {
|
|
||||||
return singleValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBetweenValue() {
|
|
||||||
return betweenValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isListValue() {
|
|
||||||
return listValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTypeHandler() {
|
|
||||||
return typeHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Criterion(String condition) {
|
|
||||||
super();
|
|
||||||
this.condition = condition;
|
|
||||||
this.typeHandler = null;
|
|
||||||
this.noValue = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Criterion(String condition, Object value, String typeHandler) {
|
|
||||||
super();
|
|
||||||
this.condition = condition;
|
|
||||||
this.value = value;
|
|
||||||
this.typeHandler = typeHandler;
|
|
||||||
if (value instanceof List<?>) {
|
|
||||||
this.listValue = true;
|
|
||||||
} else {
|
|
||||||
this.singleValue = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Criterion(String condition, Object value) {
|
|
||||||
this(condition, value, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
|
||||||
super();
|
|
||||||
this.condition = condition;
|
|
||||||
this.value = value;
|
|
||||||
this.secondValue = secondValue;
|
|
||||||
this.typeHandler = typeHandler;
|
|
||||||
this.betweenValue = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Criterion(String condition, Object value, Object secondValue) {
|
|
||||||
this(condition, value, secondValue, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -11,10 +11,6 @@ public class DepotItemVo4DetailByTypeAndMId {
|
|||||||
private Integer bnum;
|
private Integer bnum;
|
||||||
|
|
||||||
private Date otime;
|
private Date otime;
|
||||||
//仓库名称
|
|
||||||
private String depotName;
|
|
||||||
//调入仓库名称
|
|
||||||
private String depotInName;
|
|
||||||
|
|
||||||
public String getNumber() {
|
public String getNumber() {
|
||||||
return number;
|
return number;
|
||||||
@@ -47,20 +43,4 @@ public class DepotItemVo4DetailByTypeAndMId {
|
|||||||
public void setOtime(Date otime) {
|
public void setOtime(Date otime) {
|
||||||
this.otime = otime;
|
this.otime = otime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDepotName() {
|
|
||||||
return depotName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDepotName(String depotName) {
|
|
||||||
this.depotName = depotName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDepotInName() {
|
|
||||||
return depotInName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDepotInName(String depotInName) {
|
|
||||||
this.depotInName = depotInName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -97,14 +97,6 @@ public class Functions {
|
|||||||
*/
|
*/
|
||||||
private String deleteFlag;
|
private String deleteFlag;
|
||||||
|
|
||||||
/**
|
|
||||||
* This field was generated by MyBatis Generator.
|
|
||||||
* This field corresponds to the database column jsh_functions.tenant_id
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
private Long tenantId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method was generated by MyBatis Generator.
|
* This method was generated by MyBatis Generator.
|
||||||
* This method returns the value of the database column jsh_functions.Id
|
* This method returns the value of the database column jsh_functions.Id
|
||||||
@@ -392,28 +384,4 @@ public class Functions {
|
|||||||
public void setDeleteFlag(String deleteFlag) {
|
public void setDeleteFlag(String deleteFlag) {
|
||||||
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
|
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This method was generated by MyBatis Generator.
|
|
||||||
* This method returns the value of the database column jsh_functions.tenant_id
|
|
||||||
*
|
|
||||||
* @return the value of jsh_functions.tenant_id
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
public Long getTenantId() {
|
|
||||||
return tenantId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method was generated by MyBatis Generator.
|
|
||||||
* This method sets the value of the database column jsh_functions.tenant_id
|
|
||||||
*
|
|
||||||
* @param tenantId the value for jsh_functions.tenant_id
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
public void setTenantId(Long tenantId) {
|
|
||||||
this.tenantId = tenantId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1003,66 +1003,6 @@ public class FunctionsExample {
|
|||||||
addCriterion("delete_Flag not between", value1, value2, "deleteFlag");
|
addCriterion("delete_Flag not between", value1, value2, "deleteFlag");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andTenantIdIsNull() {
|
|
||||||
addCriterion("tenant_id is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdIsNotNull() {
|
|
||||||
addCriterion("tenant_id is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdEqualTo(Long value) {
|
|
||||||
addCriterion("tenant_id =", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdNotEqualTo(Long value) {
|
|
||||||
addCriterion("tenant_id <>", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdGreaterThan(Long value) {
|
|
||||||
addCriterion("tenant_id >", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdGreaterThanOrEqualTo(Long value) {
|
|
||||||
addCriterion("tenant_id >=", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdLessThan(Long value) {
|
|
||||||
addCriterion("tenant_id <", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdLessThanOrEqualTo(Long value) {
|
|
||||||
addCriterion("tenant_id <=", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdIn(List<Long> values) {
|
|
||||||
addCriterion("tenant_id in", values, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdNotIn(List<Long> values) {
|
|
||||||
addCriterion("tenant_id not in", values, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdBetween(Long value1, Long value2) {
|
|
||||||
addCriterion("tenant_id between", value1, value2, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdNotBetween(Long value1, Long value2) {
|
|
||||||
addCriterion("tenant_id not between", value1, value2, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -49,14 +49,6 @@ public class MaterialProperty {
|
|||||||
*/
|
*/
|
||||||
private String deleteFlag;
|
private String deleteFlag;
|
||||||
|
|
||||||
/**
|
|
||||||
* This field was generated by MyBatis Generator.
|
|
||||||
* This field corresponds to the database column jsh_materialproperty.tenant_id
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
private Long tenantId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method was generated by MyBatis Generator.
|
* This method was generated by MyBatis Generator.
|
||||||
* This method returns the value of the database column jsh_materialproperty.id
|
* This method returns the value of the database column jsh_materialproperty.id
|
||||||
@@ -200,28 +192,4 @@ public class MaterialProperty {
|
|||||||
public void setDeleteFlag(String deleteFlag) {
|
public void setDeleteFlag(String deleteFlag) {
|
||||||
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
|
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This method was generated by MyBatis Generator.
|
|
||||||
* This method returns the value of the database column jsh_materialproperty.tenant_id
|
|
||||||
*
|
|
||||||
* @return the value of jsh_materialproperty.tenant_id
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
public Long getTenantId() {
|
|
||||||
return tenantId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method was generated by MyBatis Generator.
|
|
||||||
* This method sets the value of the database column jsh_materialproperty.tenant_id
|
|
||||||
*
|
|
||||||
* @param tenantId the value for jsh_materialproperty.tenant_id
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
public void setTenantId(Long tenantId) {
|
|
||||||
this.tenantId = tenantId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -593,66 +593,6 @@ public class MaterialPropertyExample {
|
|||||||
addCriterion("delete_Flag not between", value1, value2, "deleteFlag");
|
addCriterion("delete_Flag not between", value1, value2, "deleteFlag");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andTenantIdIsNull() {
|
|
||||||
addCriterion("tenant_id is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdIsNotNull() {
|
|
||||||
addCriterion("tenant_id is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdEqualTo(Long value) {
|
|
||||||
addCriterion("tenant_id =", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdNotEqualTo(Long value) {
|
|
||||||
addCriterion("tenant_id <>", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdGreaterThan(Long value) {
|
|
||||||
addCriterion("tenant_id >", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdGreaterThanOrEqualTo(Long value) {
|
|
||||||
addCriterion("tenant_id >=", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdLessThan(Long value) {
|
|
||||||
addCriterion("tenant_id <", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdLessThanOrEqualTo(Long value) {
|
|
||||||
addCriterion("tenant_id <=", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdIn(List<Long> values) {
|
|
||||||
addCriterion("tenant_id in", values, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdNotIn(List<Long> values) {
|
|
||||||
addCriterion("tenant_id not in", values, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdBetween(Long value1, Long value2) {
|
|
||||||
addCriterion("tenant_id between", value1, value2, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdNotBetween(Long value1, Long value2) {
|
|
||||||
addCriterion("tenant_id not between", value1, value2, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -49,14 +49,6 @@ public class UserBusiness {
|
|||||||
*/
|
*/
|
||||||
private String deleteFlag;
|
private String deleteFlag;
|
||||||
|
|
||||||
/**
|
|
||||||
* This field was generated by MyBatis Generator.
|
|
||||||
* This field corresponds to the database column jsh_userbusiness.tenant_id
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
private Long tenantId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method was generated by MyBatis Generator.
|
* This method was generated by MyBatis Generator.
|
||||||
* This method returns the value of the database column jsh_userbusiness.Id
|
* This method returns the value of the database column jsh_userbusiness.Id
|
||||||
@@ -200,28 +192,4 @@ public class UserBusiness {
|
|||||||
public void setDeleteFlag(String deleteFlag) {
|
public void setDeleteFlag(String deleteFlag) {
|
||||||
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
|
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This method was generated by MyBatis Generator.
|
|
||||||
* This method returns the value of the database column jsh_userbusiness.tenant_id
|
|
||||||
*
|
|
||||||
* @return the value of jsh_userbusiness.tenant_id
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
public Long getTenantId() {
|
|
||||||
return tenantId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method was generated by MyBatis Generator.
|
|
||||||
* This method sets the value of the database column jsh_userbusiness.tenant_id
|
|
||||||
*
|
|
||||||
* @param tenantId the value for jsh_userbusiness.tenant_id
|
|
||||||
*
|
|
||||||
* @mbggenerated
|
|
||||||
*/
|
|
||||||
public void setTenantId(Long tenantId) {
|
|
||||||
this.tenantId = tenantId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -603,66 +603,6 @@ public class UserBusinessExample {
|
|||||||
addCriterion("delete_Flag not between", value1, value2, "deleteFlag");
|
addCriterion("delete_Flag not between", value1, value2, "deleteFlag");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andTenantIdIsNull() {
|
|
||||||
addCriterion("tenant_id is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdIsNotNull() {
|
|
||||||
addCriterion("tenant_id is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdEqualTo(Long value) {
|
|
||||||
addCriterion("tenant_id =", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdNotEqualTo(Long value) {
|
|
||||||
addCriterion("tenant_id <>", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdGreaterThan(Long value) {
|
|
||||||
addCriterion("tenant_id >", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdGreaterThanOrEqualTo(Long value) {
|
|
||||||
addCriterion("tenant_id >=", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdLessThan(Long value) {
|
|
||||||
addCriterion("tenant_id <", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdLessThanOrEqualTo(Long value) {
|
|
||||||
addCriterion("tenant_id <=", value, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdIn(List<Long> values) {
|
|
||||||
addCriterion("tenant_id in", values, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdNotIn(List<Long> values) {
|
|
||||||
addCriterion("tenant_id not in", values, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdBetween(Long value1, Long value2) {
|
|
||||||
addCriterion("tenant_id between", value1, value2, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTenantIdNotBetween(Long value1, Long value2) {
|
|
||||||
addCriterion("tenant_id not between", value1, value2, "tenantId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public interface AccountHeadMapperEx {
|
|||||||
@Param("beginTime") String beginTime,
|
@Param("beginTime") String beginTime,
|
||||||
@Param("endTime") String endTime);
|
@Param("endTime") String endTime);
|
||||||
|
|
||||||
|
Long getMaxId();
|
||||||
|
|
||||||
BigDecimal findAllMoney(
|
BigDecimal findAllMoney(
|
||||||
@Param("supplierId") Integer supplierId,
|
@Param("supplierId") Integer supplierId,
|
||||||
@@ -42,7 +43,4 @@ public interface AccountHeadMapperEx {
|
|||||||
List<AccountHead> getAccountHeadListByOrganIds(@Param("organIds") String[] organIds);
|
List<AccountHead> getAccountHeadListByOrganIds(@Param("organIds") String[] organIds);
|
||||||
|
|
||||||
List<AccountHead> getAccountHeadListByHandsPersonIds(@Param("handsPersonIds") String[] handsPersonIds);
|
List<AccountHead> getAccountHeadListByHandsPersonIds(@Param("handsPersonIds") String[] handsPersonIds);
|
||||||
|
|
||||||
int addAccountHead(AccountHead accountHead);
|
|
||||||
int updateAccountHead(AccountHead accountHead);
|
|
||||||
}
|
}
|
||||||
@@ -38,6 +38,7 @@ public interface DepotHeadMapperEx {
|
|||||||
@Param("materialParam") String materialParam,
|
@Param("materialParam") String materialParam,
|
||||||
@Param("depotIds") String depotIds);
|
@Param("depotIds") String depotIds);
|
||||||
|
|
||||||
|
Long getMaxId();
|
||||||
|
|
||||||
String findMaterialsListByHeaderId(
|
String findMaterialsListByHeaderId(
|
||||||
@Param("id") Long id);
|
@Param("id") Long id);
|
||||||
@@ -110,6 +111,7 @@ public interface DepotHeadMapperEx {
|
|||||||
* */
|
* */
|
||||||
void updatedepotHead(DepotHead depotHead);
|
void updatedepotHead(DepotHead depotHead);
|
||||||
|
|
||||||
|
void updateBuildOnlyNumber();
|
||||||
/**
|
/**
|
||||||
* 获得一个全局唯一的数作为订单号的追加
|
* 获得一个全局唯一的数作为订单号的追加
|
||||||
* */
|
* */
|
||||||
|
|||||||
@@ -36,15 +36,6 @@ public interface DepotItemMapperEx {
|
|||||||
Long findDetailByTypeAndMaterialIdCounts(
|
Long findDetailByTypeAndMaterialIdCounts(
|
||||||
@Param("mId") Long mId);
|
@Param("mId") Long mId);
|
||||||
|
|
||||||
|
|
||||||
int findByTypeAndDepotIdAndMaterialIdIn(
|
|
||||||
@Param("depotId") Long depotId,
|
|
||||||
@Param("mId") Long mId);
|
|
||||||
|
|
||||||
int findByTypeAndDepotIdAndMaterialIdOut(
|
|
||||||
@Param("depotId") Long depotId,
|
|
||||||
@Param("mId") Long mId);
|
|
||||||
|
|
||||||
List<DepotItemVo4WithInfoEx> getDetailList(
|
List<DepotItemVo4WithInfoEx> getDetailList(
|
||||||
@Param("headerId") Long headerId);
|
@Param("headerId") Long headerId);
|
||||||
|
|
||||||
@@ -115,6 +106,4 @@ public interface DepotItemMapperEx {
|
|||||||
int findStockWarningCountTotal( @Param("pid") Integer pid);
|
int findStockWarningCountTotal( @Param("pid") Integer pid);
|
||||||
|
|
||||||
BigDecimal getFinishNumber(@Param("mid") Long mid, @Param("linkNumber") String linkNumber);
|
BigDecimal getFinishNumber(@Param("mid") Long mid, @Param("linkNumber") String linkNumber);
|
||||||
|
|
||||||
BigDecimal getCurrentRepByMaterialIdAndDepotId(@Param("materialId") Long materialId, @Param("depotId") Long depotId,@Param("tenantId")Long tenantId);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public interface RoleMapperEx {
|
public interface RoleMapperEx {
|
||||||
|
|
||||||
@@ -19,5 +18,4 @@ public interface RoleMapperEx {
|
|||||||
@Param("name") String name);
|
@Param("name") String name);
|
||||||
|
|
||||||
int batchDeleteRoleByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
|
int batchDeleteRoleByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
|
||||||
List<Role> getRoleList(Map<String, String> parameterMap);
|
|
||||||
}
|
}
|
||||||
@@ -93,4 +93,4 @@ public interface TenantMapper {
|
|||||||
* @mbggenerated
|
* @mbggenerated
|
||||||
*/
|
*/
|
||||||
int updateByPrimaryKey(Tenant record);
|
int updateByPrimaryKey(Tenant record);
|
||||||
}
|
}
|
||||||
@@ -14,4 +14,4 @@ public interface TenantMapperEx {
|
|||||||
|
|
||||||
Long countsByTenant(
|
Long countsByTenant(
|
||||||
@Param("loginName") String loginName);
|
@Param("loginName") String loginName);
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.jsh.erp.datasource.mappers;
|
package com.jsh.erp.datasource.mappers;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.SqlParser;
|
|
||||||
import com.jsh.erp.datasource.entities.User;
|
import com.jsh.erp.datasource.entities.User;
|
||||||
import com.jsh.erp.datasource.entities.UserEx;
|
import com.jsh.erp.datasource.entities.UserEx;
|
||||||
import com.jsh.erp.datasource.entities.UserExample;
|
import com.jsh.erp.datasource.entities.UserExample;
|
||||||
@@ -29,18 +28,12 @@ public interface UserMapperEx {
|
|||||||
int addUser(UserEx ue);
|
int addUser(UserEx ue);
|
||||||
|
|
||||||
int updateUser(UserEx ue);
|
int updateUser(UserEx ue);
|
||||||
/**
|
|
||||||
* 这个查询不添加租户id,保证登录名全局唯一
|
List<User> getUserListByUserNameOrLoginName(@Param("userName") String userName,
|
||||||
* */
|
@Param("loginame") String loginame);
|
||||||
List<User> getUserListByLoginName(@Param("loginame") String loginame);
|
|
||||||
|
|
||||||
int batDeleteOrUpdateUser(@Param("ids") String ids[], @Param("status") byte status);
|
int batDeleteOrUpdateUser(@Param("ids") String ids[], @Param("status") byte status);
|
||||||
|
|
||||||
List<TreeNodeEx> getNodeTree();
|
List<TreeNodeEx> getNodeTree();
|
||||||
List<TreeNodeEx> getNextNodeTree(Map<String, Object> parameterMap);
|
List<TreeNodeEx> getNextNodeTree(Map<String, Object> parameterMap);
|
||||||
|
|
||||||
List<User> getUserListByUserNameAndTenantId(@Param("userName")String userName, @Param("tenantId")Long tenantId);
|
|
||||||
|
|
||||||
String addRegisterUserNotInclueUser(@Param("userId") Long userId,@Param("tenantId") Long tenantId,@Param("roleId") Long roleId);
|
|
||||||
List<User> getUserListByloginNameAndPassword(@Param("loginame")String loginame, @Param("password")String password);
|
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,6 @@ import com.jsh.erp.datasource.mappers.AccountHeadMapper;
|
|||||||
import com.jsh.erp.datasource.mappers.AccountHeadMapperEx;
|
import com.jsh.erp.datasource.mappers.AccountHeadMapperEx;
|
||||||
import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
|
import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
|
||||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.service.accountItem.AccountItemService;
|
|
||||||
import com.jsh.erp.exception.JshException;
|
import com.jsh.erp.exception.JshException;
|
||||||
import com.jsh.erp.service.log.LogService;
|
import com.jsh.erp.service.log.LogService;
|
||||||
import com.jsh.erp.service.user.UserService;
|
import com.jsh.erp.service.user.UserService;
|
||||||
@@ -24,7 +23,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.Timestamp;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -44,8 +42,6 @@ public class AccountHeadService {
|
|||||||
private LogService logService;
|
private LogService logService;
|
||||||
@Resource
|
@Resource
|
||||||
private AccountItemMapperEx accountItemMapperEx;
|
private AccountItemMapperEx accountItemMapperEx;
|
||||||
@Resource
|
|
||||||
private AccountItemService accountItemService;
|
|
||||||
|
|
||||||
public AccountHead getAccountHead(long id) throws Exception {
|
public AccountHead getAccountHead(long id) throws Exception {
|
||||||
AccountHead result=null;
|
AccountHead result=null;
|
||||||
@@ -162,6 +158,16 @@ public class AccountHeadService {
|
|||||||
return list==null?0:list.size();
|
return list==null?0:list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getMaxId()throws Exception {
|
||||||
|
Long result = null;
|
||||||
|
try{
|
||||||
|
result = accountHeadMapperEx.getMaxId();
|
||||||
|
}catch(Exception e){
|
||||||
|
JshException.readFail(logger, e);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public BigDecimal findAllMoney(Integer supplierId, String type, String mode, String endTime) {
|
public BigDecimal findAllMoney(Integer supplierId, String type, String mode, String endTime) {
|
||||||
String modeName = "";
|
String modeName = "";
|
||||||
if (mode.equals("实际")) {
|
if (mode.equals("实际")) {
|
||||||
@@ -306,49 +312,4 @@ public class AccountHeadService {
|
|||||||
deleteTotal= batchDeleteAccountHeadByIds(ids);
|
deleteTotal= batchDeleteAccountHeadByIds(ids);
|
||||||
return deleteTotal;
|
return deleteTotal;
|
||||||
}
|
}
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
|
||||||
public void addAccountHeadAndDetail(String beanJson, String inserted, String deleted, String updated, String listType) throws Exception {
|
|
||||||
/**处理财务信息*/
|
|
||||||
AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
|
|
||||||
try{
|
|
||||||
accountHeadMapperEx.addAccountHead(accountHead);
|
|
||||||
}catch(Exception e){
|
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
|
||||||
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
|
||||||
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/22 10:30
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 处理财务明细信息
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
accountItemService.saveDetials(inserted, deleted, updated, accountHead.getId(), listType);
|
|
||||||
|
|
||||||
}
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
|
||||||
public void updateAccountHeadAndDetail(Long id, String beanJson, String inserted, String deleted, String updated, String listType)throws Exception {
|
|
||||||
/**更新财务信息*/
|
|
||||||
AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
|
|
||||||
accountHead.setId(id);
|
|
||||||
try{
|
|
||||||
accountHeadMapperEx.updateAccountHead(accountHead);
|
|
||||||
}catch(Exception e){
|
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
|
||||||
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
|
||||||
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/22 10:30
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 更新财务明细信息
|
|
||||||
*/
|
|
||||||
accountItemService.saveDetials(inserted, deleted, updated, accountHead.getId(), listType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -228,15 +228,16 @@ public class DepotHeadService {
|
|||||||
/**
|
/**
|
||||||
* 创建一个唯一的序列号
|
* 创建一个唯一的序列号
|
||||||
* */
|
* */
|
||||||
public String buildOnlyNumber()throws Exception{
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
|
public String buildOnlyNumber()throws Exception{
|
||||||
Long buildOnlyNumber=null;
|
Long buildOnlyNumber=null;
|
||||||
synchronized (this){
|
synchronized (this){
|
||||||
try{
|
try{
|
||||||
|
depotHeadMapperEx.updateBuildOnlyNumber(); //编号+1
|
||||||
buildOnlyNumber= depotHeadMapperEx.getBuildOnlyNumber(BusinessConstants.DEPOT_NUMBER_SEQ);
|
buildOnlyNumber= depotHeadMapperEx.getBuildOnlyNumber(BusinessConstants.DEPOT_NUMBER_SEQ);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if(buildOnlyNumber<BusinessConstants.SEQ_TO_STRING_MIN_LENGTH){
|
if(buildOnlyNumber<BusinessConstants.SEQ_TO_STRING_MIN_LENGTH){
|
||||||
StringBuffer sb=new StringBuffer(buildOnlyNumber.toString());
|
StringBuffer sb=new StringBuffer(buildOnlyNumber.toString());
|
||||||
@@ -250,7 +251,15 @@ public class DepotHeadService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getMaxId()throws Exception {
|
||||||
|
Long result = null;
|
||||||
|
try{
|
||||||
|
result = depotHeadMapperEx.getMaxId();
|
||||||
|
}catch(Exception e){
|
||||||
|
JshException.readFail(logger, e);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public String findMaterialsListByHeaderId(Long id)throws Exception {
|
public String findMaterialsListByHeaderId(Long id)throws Exception {
|
||||||
String result = null;
|
String result = null;
|
||||||
@@ -460,7 +469,7 @@ public class DepotHeadService {
|
|||||||
* @return java.lang.String
|
* @return java.lang.String
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public void addDepotHeadAndDetail(String beanJson, String inserted, String deleted, String updated) throws Exception {
|
public void addDepotHeadAndDetail(String beanJson, String inserted, String deleted, String updated,Long tenantId) throws Exception {
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD,
|
||||||
BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
@@ -485,7 +494,7 @@ public class DepotHeadService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**入库和出库处理单据子表信息*/
|
/**入库和出库处理单据子表信息*/
|
||||||
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId());
|
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId(),tenantId);
|
||||||
/**如果关联单据号非空则更新订单的状态为2 */
|
/**如果关联单据号非空则更新订单的状态为2 */
|
||||||
if(depotHead.getLinknumber()!=null) {
|
if(depotHead.getLinknumber()!=null) {
|
||||||
DepotHead depotHeadOrders = new DepotHead();
|
DepotHead depotHeadOrders = new DepotHead();
|
||||||
@@ -537,7 +546,7 @@ public class DepotHeadService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**入库和出库处理单据子表信息*/
|
/**入库和出库处理单据子表信息*/
|
||||||
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId());
|
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId(),tenantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import java.math.BigDecimal;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class DepotItemService {
|
public class DepotItemService {
|
||||||
@@ -65,10 +64,7 @@ public class DepotItemService {
|
|||||||
try{
|
try{
|
||||||
result=depotItemMapper.selectByPrimaryKey(id);
|
result=depotItemMapper.selectByPrimaryKey(id);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
JshException.readFail(logger, e);
|
||||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
|
||||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -80,10 +76,7 @@ public class DepotItemService {
|
|||||||
try{
|
try{
|
||||||
list=depotItemMapper.selectByExample(example);
|
list=depotItemMapper.selectByExample(example);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
JshException.readFail(logger, e);
|
||||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
|
||||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@@ -93,10 +86,7 @@ public class DepotItemService {
|
|||||||
try{
|
try{
|
||||||
list=depotItemMapperEx.selectByConditionDepotItem(name, type, remark, offset, rows);
|
list=depotItemMapperEx.selectByConditionDepotItem(name, type, remark, offset, rows);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
JshException.readFail(logger, e);
|
||||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
|
||||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@@ -106,10 +96,7 @@ public class DepotItemService {
|
|||||||
try{
|
try{
|
||||||
result=depotItemMapperEx.countsByDepotItem(name, type, remark);
|
result=depotItemMapperEx.countsByDepotItem(name, type, remark);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
JshException.readFail(logger, e);
|
||||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
|
||||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -121,10 +108,7 @@ public class DepotItemService {
|
|||||||
try{
|
try{
|
||||||
result=depotItemMapper.insertSelective(depotItem);
|
result=depotItemMapper.insertSelective(depotItem);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
JshException.readFail(logger, e);
|
||||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
|
||||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -137,10 +121,7 @@ public class DepotItemService {
|
|||||||
try{
|
try{
|
||||||
result=depotItemMapper.updateByPrimaryKeySelective(depotItem);
|
result=depotItemMapper.updateByPrimaryKeySelective(depotItem);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
JshException.readFail(logger, e);
|
||||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
|
||||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -151,10 +132,7 @@ public class DepotItemService {
|
|||||||
try{
|
try{
|
||||||
result=depotItemMapper.deleteByPrimaryKey(id);
|
result=depotItemMapper.deleteByPrimaryKey(id);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
JshException.writeFail(logger, e);
|
||||||
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
|
||||||
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -168,10 +146,7 @@ public class DepotItemService {
|
|||||||
try{
|
try{
|
||||||
result=depotItemMapper.deleteByExample(example);
|
result=depotItemMapper.deleteByExample(example);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
JshException.writeFail(logger, e);
|
||||||
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
|
||||||
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -183,10 +158,7 @@ public class DepotItemService {
|
|||||||
try{
|
try{
|
||||||
list=depotItemMapper.selectByExample(example);
|
list=depotItemMapper.selectByExample(example);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
JshException.readFail(logger, e);
|
||||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
|
||||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
|
||||||
}
|
}
|
||||||
return list==null?0:list.size();
|
return list==null?0:list.size();
|
||||||
}
|
}
|
||||||
@@ -201,10 +173,7 @@ public class DepotItemService {
|
|||||||
try{
|
try{
|
||||||
list = depotItemMapperEx.findDetailByTypeAndMaterialIdList(mId, QueryUtils.offset(map), QueryUtils.rows(map));
|
list = depotItemMapperEx.findDetailByTypeAndMaterialIdList(mId, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
JshException.readFail(logger, e);
|
||||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
|
||||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@@ -245,13 +214,6 @@ public class DepotItemService {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public int findByTypeAndMaterialIdAndDepotId(String type, Long mId, Long depotId) {
|
|
||||||
if(type.equals(TYPE)) {
|
|
||||||
return depotItemMapperEx.findByTypeAndDepotIdAndMaterialIdIn(depotId, mId);
|
|
||||||
} else {
|
|
||||||
return depotItemMapperEx.findByTypeAndDepotIdAndMaterialIdOut(depotId, mId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DepotItemVo4WithInfoEx> getDetailList(Long headerId)throws Exception {
|
public List<DepotItemVo4WithInfoEx> getDetailList(Long headerId)throws Exception {
|
||||||
List<DepotItemVo4WithInfoEx> list =null;
|
List<DepotItemVo4WithInfoEx> list =null;
|
||||||
@@ -292,13 +254,12 @@ public class DepotItemService {
|
|||||||
result= depotItemMapperEx.buyOrSalePrice(type, subType, MId, MonthTime, sumType);
|
result= depotItemMapperEx.buyOrSalePrice(type, subType, MId, MonthTime, sumType);
|
||||||
}
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
JshException.readFail(logger, e);
|
||||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
|
||||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计采购或销售的总金额
|
* 统计采购或销售的总金额
|
||||||
* @param type
|
* @param type
|
||||||
@@ -317,14 +278,13 @@ public class DepotItemService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 2019-02-02修改
|
* 2019-02-02修改
|
||||||
* 我之前对操作数量的理解有偏差
|
* 我之前对操作数量的理解有偏差
|
||||||
* 这里重点重申一下:BasicNumber=OperNumber*ratio
|
* 这里重点重申一下:BasicNumber=OperNumber*ratio
|
||||||
* */
|
* */
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public String saveDetials(String inserted, String deleted, String updated, Long headerId) throws Exception{
|
public String saveDetials(String inserted, String deleted, String updated, Long headerId, Long tenantId) throws Exception{
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM,
|
||||||
BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
@@ -333,185 +293,183 @@ public class DepotItemService {
|
|||||||
try{
|
try{
|
||||||
depotHead =depotHeadMapper.selectByPrimaryKey(headerId);
|
depotHead =depotHeadMapper.selectByPrimaryKey(headerId);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
JshException.readFail(logger, e);
|
||||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
|
||||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
|
||||||
}
|
}
|
||||||
//获得当前操作人
|
//获得当前操作人
|
||||||
User userInfo=userService.getCurrentUser();
|
User userInfo=userService.getCurrentUser();
|
||||||
//转为json
|
//转为json
|
||||||
JSONArray insertedJson = JSONArray.parseArray(inserted);
|
JSONArray insertedJson = JSONArray.parseArray(inserted);
|
||||||
JSONArray deletedJson = JSONArray.parseArray(deleted);
|
JSONArray deletedJson = JSONArray.parseArray(deleted);
|
||||||
JSONArray updatedJson = JSONArray.parseArray(updated);
|
JSONArray updatedJson = JSONArray.parseArray(updated);
|
||||||
/**
|
/**
|
||||||
* 2019-01-28优先处理删除的
|
* 2019-01-28优先处理删除的
|
||||||
* 删除的可以继续卖,删除的需要将使用的序列号回收
|
* 删除的可以继续卖,删除的需要将使用的序列号回收
|
||||||
* 插入的需要判断当前货源是否充足
|
* 插入的需要判断当前货源是否充足
|
||||||
* 更新的需要判断货源是否充足
|
* 更新的需要判断货源是否充足
|
||||||
* */
|
* */
|
||||||
if (null != deletedJson) {
|
if (null != deletedJson) {
|
||||||
StringBuffer bf=new StringBuffer();
|
StringBuffer bf=new StringBuffer();
|
||||||
for (int i = 0; i < deletedJson.size(); i++) {
|
for (int i = 0; i < deletedJson.size(); i++) {
|
||||||
//首先回收序列号,如果是调拨,不用处理序列号
|
//首先回收序列号,如果是调拨,不用处理序列号
|
||||||
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
|
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
|
||||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
|
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
|
||||||
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){
|
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){
|
||||||
DepotItem depotItem = getDepotItem(tempDeletedJson.getLong("Id"));
|
DepotItem depotItem = getDepotItem(tempDeletedJson.getLong("Id"));
|
||||||
|
if(depotItem==null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||||
|
* */
|
||||||
|
Material material= materialService.getMaterial(depotItem.getMaterialid());
|
||||||
|
if(material==null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())){
|
||||||
|
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
|
||||||
|
userInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.deleteDepotItem(tempDeletedJson.getLong("Id"));
|
||||||
|
bf.append(tempDeletedJson.getLong("Id"));
|
||||||
|
if(i<(deletedJson.size()-1)){
|
||||||
|
bf.append(",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.batchDeleteDepotItemByIds(bf.toString());
|
||||||
|
}
|
||||||
|
if (null != insertedJson) {
|
||||||
|
for (int i = 0; i < insertedJson.size(); i++) {
|
||||||
|
DepotItem depotItem = new DepotItem();
|
||||||
|
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
|
||||||
|
depotItem.setHeaderid(headerId);
|
||||||
|
depotItem.setMaterialid(tempInsertedJson.getLong("MaterialId"));
|
||||||
|
depotItem.setMunit(tempInsertedJson.getString("Unit"));
|
||||||
|
if (!StringUtil.isEmpty(tempInsertedJson.get("OperNumber").toString())) {
|
||||||
|
depotItem.setOpernumber(tempInsertedJson.getBigDecimal("OperNumber"));
|
||||||
|
try {
|
||||||
|
String Unit = tempInsertedJson.get("Unit").toString();
|
||||||
|
BigDecimal oNumber = tempInsertedJson.getBigDecimal("OperNumber");
|
||||||
|
Long mId = Long.parseLong(tempInsertedJson.get("MaterialId").toString());
|
||||||
|
/***
|
||||||
|
* 为什么调用的方法要先把基础单位去掉,去掉之后后续还能获取到?
|
||||||
|
* */
|
||||||
|
//以下进行单位换算
|
||||||
|
// String UnitName = findUnitName(mId); //查询计量单位名称
|
||||||
|
String unitName = materialService.findUnitName(mId);
|
||||||
|
if (!StringUtil.isEmpty(unitName)) {
|
||||||
|
String unitList = unitName.substring(0, unitName.indexOf("("));
|
||||||
|
String ratioList = unitName.substring(unitName.indexOf("("));
|
||||||
|
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
|
||||||
|
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
|
||||||
|
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
|
||||||
|
if (Unit.equals(basicUnit)) { //如果等于基础单位
|
||||||
|
depotItem.setBasicnumber(oNumber); //数量一致
|
||||||
|
} else if (Unit.equals(otherUnit)) { //如果等于副单位
|
||||||
|
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio)) ); //数量乘以比例
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
depotItem.setBasicnumber(oNumber); //其他情况
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(">>>>>>>>>>>>>>>>>>>设置基础数量异常", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!StringUtil.isEmpty(tempInsertedJson.get("UnitPrice").toString())) {
|
||||||
|
depotItem.setUnitprice(tempInsertedJson.getBigDecimal("UnitPrice"));
|
||||||
|
}
|
||||||
|
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxUnitPrice").toString())) {
|
||||||
|
depotItem.setTaxunitprice(tempInsertedJson.getBigDecimal("TaxUnitPrice"));
|
||||||
|
}
|
||||||
|
if (!StringUtil.isEmpty(tempInsertedJson.get("AllPrice").toString())) {
|
||||||
|
depotItem.setAllprice(tempInsertedJson.getBigDecimal("AllPrice"));
|
||||||
|
}
|
||||||
|
depotItem.setRemark(tempInsertedJson.getString("Remark"));
|
||||||
|
if (tempInsertedJson.get("DepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("DepotId").toString())) {
|
||||||
|
depotItem.setDepotid(tempInsertedJson.getLong("DepotId"));
|
||||||
|
}
|
||||||
|
if (tempInsertedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("AnotherDepotId").toString())) {
|
||||||
|
depotItem.setAnotherdepotid(tempInsertedJson.getLong("AnotherDepotId"));
|
||||||
|
}
|
||||||
|
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxRate").toString())) {
|
||||||
|
depotItem.setTaxrate(tempInsertedJson.getBigDecimal("TaxRate"));
|
||||||
|
}
|
||||||
|
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxMoney").toString())) {
|
||||||
|
depotItem.setTaxmoney(tempInsertedJson.getBigDecimal("TaxMoney"));
|
||||||
|
}
|
||||||
|
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxLastMoney").toString())) {
|
||||||
|
depotItem.setTaxlastmoney(tempInsertedJson.getBigDecimal("TaxLastMoney"));
|
||||||
|
}
|
||||||
|
if (tempInsertedJson.get("OtherField1") != null) {
|
||||||
|
depotItem.setOtherfield1(tempInsertedJson.getString("OtherField1"));
|
||||||
|
}
|
||||||
|
if (tempInsertedJson.get("OtherField2") != null) {
|
||||||
|
depotItem.setOtherfield2(tempInsertedJson.getString("OtherField2"));
|
||||||
|
}
|
||||||
|
if (tempInsertedJson.get("OtherField3") != null) {
|
||||||
|
depotItem.setOtherfield3(tempInsertedJson.getString("OtherField3"));
|
||||||
|
}
|
||||||
|
if (tempInsertedJson.get("OtherField4") != null) {
|
||||||
|
depotItem.setOtherfield4(tempInsertedJson.getString("OtherField4"));
|
||||||
|
}
|
||||||
|
if (tempInsertedJson.get("OtherField5") != null) {
|
||||||
|
depotItem.setOtherfield5(tempInsertedJson.getString("OtherField5"));
|
||||||
|
}
|
||||||
|
if (tempInsertedJson.get("MType") != null) {
|
||||||
|
depotItem.setMtype(tempInsertedJson.getString("MType"));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 出库时判断库存是否充足
|
||||||
|
* */
|
||||||
|
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
|
||||||
|
if(depotItem==null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Material material= materialService.getMaterial(depotItem.getMaterialid());
|
||||||
|
if(material==null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
BigDecimal stock = getStockByParam(depotItem.getDepotid(),depotItem.getMaterialid(),null,null,tenantId);
|
||||||
|
BigDecimal thisBasicNumber = depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber();
|
||||||
|
if(stock.compareTo(thisBasicNumber)<0){
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
|
||||||
|
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**出库时处理序列号*/
|
||||||
|
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
|
||||||
|
/**
|
||||||
|
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||||
|
* */
|
||||||
|
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
|
||||||
|
//查询单据子表中开启序列号的数据列表
|
||||||
|
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.insertDepotItemWithObj(depotItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null != updatedJson) {
|
||||||
|
for (int i = 0; i < updatedJson.size(); i++) {
|
||||||
|
JSONObject tempUpdatedJson = JSONObject.parseObject(updatedJson.getString(i));
|
||||||
|
DepotItem depotItem = this.getDepotItem(tempUpdatedJson.getLong("Id"));
|
||||||
if(depotItem==null){
|
if(depotItem==null){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
|
||||||
* */
|
|
||||||
Material material= materialService.getMaterial(depotItem.getMaterialid());
|
Material material= materialService.getMaterial(depotItem.getMaterialid());
|
||||||
if(material==null){
|
if(material==null){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())){
|
//首先回收序列号
|
||||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
|
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
|
||||||
userInfo);
|
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
|
||||||
}
|
|
||||||
}
|
|
||||||
this.deleteDepotItem(tempDeletedJson.getLong("Id"));
|
|
||||||
bf.append(tempDeletedJson.getLong("Id"));
|
|
||||||
if(i<(deletedJson.size()-1)){
|
|
||||||
bf.append(",");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.batchDeleteDepotItemByIds(bf.toString());
|
|
||||||
}
|
|
||||||
if (null != insertedJson) {
|
|
||||||
for (int i = 0; i < insertedJson.size(); i++) {
|
|
||||||
DepotItem depotItem = new DepotItem();
|
|
||||||
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
|
|
||||||
depotItem.setHeaderid(headerId);
|
|
||||||
depotItem.setMaterialid(tempInsertedJson.getLong("MaterialId"));
|
|
||||||
depotItem.setMunit(tempInsertedJson.getString("Unit"));
|
|
||||||
Material material= materialService.getMaterial(depotItem.getMaterialid());
|
|
||||||
if (!StringUtil.isEmpty(tempInsertedJson.get("OperNumber").toString())) {
|
|
||||||
depotItem.setOpernumber(tempInsertedJson.getBigDecimal("OperNumber"));
|
|
||||||
String Unit = tempInsertedJson.get("Unit").toString();
|
|
||||||
BigDecimal oNumber = tempInsertedJson.getBigDecimal("OperNumber");
|
|
||||||
Long mId = Long.parseLong(tempInsertedJson.get("MaterialId").toString());
|
|
||||||
/***
|
|
||||||
* 为什么调用的方法要先把基础单位去掉,去掉之后后续还能获取到?
|
|
||||||
* */
|
|
||||||
//以下进行单位换算
|
|
||||||
// String UnitName = findUnitName(mId); //查询计量单位名称
|
|
||||||
String unitName = materialService.findUnitName(mId);
|
|
||||||
if (!StringUtil.isEmpty(unitName)) {
|
|
||||||
String unitList = unitName.substring(0, unitName.indexOf("("));
|
|
||||||
String ratioList = unitName.substring(unitName.indexOf("("));
|
|
||||||
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
|
|
||||||
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
|
|
||||||
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
|
|
||||||
if (Unit.equals(basicUnit)) { //如果等于基础单位
|
|
||||||
depotItem.setBasicnumber(oNumber); //数量一致
|
|
||||||
} else if (Unit.equals(otherUnit)) { //如果等于副单位
|
|
||||||
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio)) ); //数量乘以比例
|
|
||||||
}else{
|
|
||||||
//不等于基础单位也不等于副单位,单位存在问题
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_CODE,
|
|
||||||
String.format(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_MSG,material==null?"":material.getName(),Unit,basicUnit,otherUnit));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
depotItem.setBasicnumber(oNumber); //其他情况
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!StringUtil.isEmpty(tempInsertedJson.get("UnitPrice").toString())) {
|
|
||||||
depotItem.setUnitprice(tempInsertedJson.getBigDecimal("UnitPrice"));
|
|
||||||
}
|
|
||||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxUnitPrice").toString())) {
|
|
||||||
depotItem.setTaxunitprice(tempInsertedJson.getBigDecimal("TaxUnitPrice"));
|
|
||||||
}
|
|
||||||
if (!StringUtil.isEmpty(tempInsertedJson.get("AllPrice").toString())) {
|
|
||||||
depotItem.setAllprice(tempInsertedJson.getBigDecimal("AllPrice"));
|
|
||||||
}
|
|
||||||
depotItem.setRemark(tempInsertedJson.getString("Remark"));
|
|
||||||
if (tempInsertedJson.get("DepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("DepotId").toString())) {
|
|
||||||
depotItem.setDepotid(tempInsertedJson.getLong("DepotId"));
|
|
||||||
}
|
|
||||||
if (tempInsertedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("AnotherDepotId").toString())) {
|
|
||||||
depotItem.setAnotherdepotid(tempInsertedJson.getLong("AnotherDepotId"));
|
|
||||||
}
|
|
||||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxRate").toString())) {
|
|
||||||
depotItem.setTaxrate(tempInsertedJson.getBigDecimal("TaxRate"));
|
|
||||||
}
|
|
||||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxMoney").toString())) {
|
|
||||||
depotItem.setTaxmoney(tempInsertedJson.getBigDecimal("TaxMoney"));
|
|
||||||
}
|
|
||||||
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxLastMoney").toString())) {
|
|
||||||
depotItem.setTaxlastmoney(tempInsertedJson.getBigDecimal("TaxLastMoney"));
|
|
||||||
}
|
|
||||||
if (tempInsertedJson.get("OtherField1") != null) {
|
|
||||||
depotItem.setOtherfield1(tempInsertedJson.getString("OtherField1"));
|
|
||||||
}
|
|
||||||
if (tempInsertedJson.get("OtherField2") != null) {
|
|
||||||
depotItem.setOtherfield2(tempInsertedJson.getString("OtherField2"));
|
|
||||||
}
|
|
||||||
if (tempInsertedJson.get("OtherField3") != null) {
|
|
||||||
depotItem.setOtherfield3(tempInsertedJson.getString("OtherField3"));
|
|
||||||
}
|
|
||||||
if (tempInsertedJson.get("OtherField4") != null) {
|
|
||||||
depotItem.setOtherfield4(tempInsertedJson.getString("OtherField4"));
|
|
||||||
}
|
|
||||||
if (tempInsertedJson.get("OtherField5") != null) {
|
|
||||||
depotItem.setOtherfield5(tempInsertedJson.getString("OtherField5"));
|
|
||||||
}
|
|
||||||
if (tempInsertedJson.get("MType") != null) {
|
|
||||||
depotItem.setMtype(tempInsertedJson.getString("MType"));
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 出库时判断库存是否充足
|
|
||||||
* */
|
|
||||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
|
|
||||||
if(depotItem==null){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(material==null){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(getCurrentRepByMaterialIdAndDepotId(material.getId(),depotItem.getDepotid()).compareTo(depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber())==-1){
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
|
|
||||||
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**出库时处理序列号*/
|
|
||||||
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
|
|
||||||
/**
|
/**
|
||||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||||
* */
|
* */
|
||||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
|
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
|
||||||
//查询单据子表中开启序列号的数据列表
|
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(), (depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
|
||||||
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.insertDepotItemWithObj(depotItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null != updatedJson) {
|
|
||||||
for (int i = 0; i < updatedJson.size(); i++) {
|
|
||||||
JSONObject tempUpdatedJson = JSONObject.parseObject(updatedJson.getString(i));
|
|
||||||
DepotItem depotItem = this.getDepotItem(tempUpdatedJson.getLong("Id"));
|
|
||||||
if(depotItem==null){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Material material= materialService.getMaterial(depotItem.getMaterialid());
|
|
||||||
if(material==null){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//首先回收序列号
|
|
||||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())) {
|
|
||||||
|
|
||||||
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
|
|
||||||
/**
|
|
||||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
|
||||||
* */
|
|
||||||
if (BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
|
|
||||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(), (depotItem.getBasicnumber() == null ? 0 : depotItem.getBasicnumber()).intValue(),
|
|
||||||
userInfo);
|
userInfo);
|
||||||
}
|
}
|
||||||
/**收回序列号的时候释放库存*/
|
/**收回序列号的时候释放库存*/
|
||||||
@@ -519,104 +477,102 @@ public class DepotItemService {
|
|||||||
depotItem.setBasicnumber(BigDecimal.ZERO);
|
depotItem.setBasicnumber(BigDecimal.ZERO);
|
||||||
this.updateDepotItemWithObj(depotItem);
|
this.updateDepotItemWithObj(depotItem);
|
||||||
}
|
}
|
||||||
}
|
depotItem.setId(tempUpdatedJson.getLong("Id"));
|
||||||
depotItem.setId(tempUpdatedJson.getLong("Id"));
|
depotItem.setMaterialid(tempUpdatedJson.getLong("MaterialId"));
|
||||||
depotItem.setMaterialid(tempUpdatedJson.getLong("MaterialId"));
|
depotItem.setMunit(tempUpdatedJson.getString("Unit"));
|
||||||
depotItem.setMunit(tempUpdatedJson.getString("Unit"));
|
if (!StringUtil.isEmpty(tempUpdatedJson.get("OperNumber").toString())) {
|
||||||
if(!material.getId().equals(depotItem.getMaterialid())){
|
depotItem.setOpernumber(tempUpdatedJson.getBigDecimal("OperNumber"));
|
||||||
material= materialService.getMaterial(depotItem.getMaterialid());
|
try {
|
||||||
}
|
String Unit = tempUpdatedJson.get("Unit").toString();
|
||||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("OperNumber").toString())) {
|
BigDecimal oNumber = tempUpdatedJson.getBigDecimal("OperNumber");
|
||||||
depotItem.setOpernumber(tempUpdatedJson.getBigDecimal("OperNumber"));
|
Long mId = Long.parseLong(tempUpdatedJson.get("MaterialId").toString());
|
||||||
String Unit = tempUpdatedJson.get("Unit").toString();
|
//以下进行单位换算
|
||||||
BigDecimal oNumber = tempUpdatedJson.getBigDecimal("OperNumber");
|
// String UnitName = findUnitName(mId); //查询计量单位名称
|
||||||
Long mId = Long.parseLong(tempUpdatedJson.get("MaterialId").toString());
|
String unitName = materialService.findUnitName(mId);
|
||||||
//以下进行单位换算
|
if (!StringUtil.isEmpty(unitName)) {
|
||||||
// String UnitName = findUnitName(mId); //查询计量单位名称
|
String unitList = unitName.substring(0, unitName.indexOf("("));
|
||||||
String unitName = materialService.findUnitName(mId);
|
String ratioList = unitName.substring(unitName.indexOf("("));
|
||||||
if (!StringUtil.isEmpty(unitName)) {
|
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
|
||||||
String unitList = unitName.substring(0, unitName.indexOf("("));
|
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
|
||||||
String ratioList = unitName.substring(unitName.indexOf("("));
|
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
|
||||||
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
|
if (Unit.equals(basicUnit)) { //如果等于基础单位
|
||||||
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
|
depotItem.setBasicnumber(oNumber); //数量一致
|
||||||
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
|
} else if (Unit.equals(otherUnit)) { //如果等于副单位
|
||||||
if (Unit.equals(basicUnit)) { //如果等于基础单位
|
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio))); //数量乘以比例
|
||||||
depotItem.setBasicnumber(oNumber); //数量一致
|
}
|
||||||
} else if (Unit.equals(otherUnit)) { //如果等于副单位
|
} else {
|
||||||
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio))); //数量乘以比例
|
depotItem.setBasicnumber(oNumber); //其他情况
|
||||||
}else{
|
}
|
||||||
//不等于基础单位也不等于副单位,单位存在问题
|
} catch (Exception e) {
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_CODE,
|
logger.error(">>>>>>>>>>>>>>>>>>>设置基础数量异常", e);
|
||||||
String.format(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_MSG,material==null?"":material.getName(),Unit,basicUnit,otherUnit));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
depotItem.setBasicnumber(oNumber); //其他情况
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("UnitPrice").toString())) {
|
|
||||||
depotItem.setUnitprice(tempUpdatedJson.getBigDecimal("UnitPrice"));
|
|
||||||
}
|
|
||||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxUnitPrice").toString())) {
|
|
||||||
depotItem.setTaxunitprice(tempUpdatedJson.getBigDecimal("TaxUnitPrice"));
|
|
||||||
}
|
|
||||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("AllPrice").toString())) {
|
|
||||||
depotItem.setAllprice(tempUpdatedJson.getBigDecimal("AllPrice"));
|
|
||||||
}
|
|
||||||
depotItem.setRemark(tempUpdatedJson.getString("Remark"));
|
|
||||||
if (tempUpdatedJson.get("DepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("DepotId").toString())) {
|
|
||||||
depotItem.setDepotid(tempUpdatedJson.getLong("DepotId"));
|
|
||||||
}
|
|
||||||
if (tempUpdatedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("AnotherDepotId").toString())) {
|
|
||||||
depotItem.setAnotherdepotid(tempUpdatedJson.getLong("AnotherDepotId"));
|
|
||||||
}
|
|
||||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxRate").toString())) {
|
|
||||||
depotItem.setTaxrate(tempUpdatedJson.getBigDecimal("TaxRate"));
|
|
||||||
}
|
|
||||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxMoney").toString())) {
|
|
||||||
depotItem.setTaxmoney(tempUpdatedJson.getBigDecimal("TaxMoney"));
|
|
||||||
}
|
|
||||||
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxLastMoney").toString())) {
|
|
||||||
depotItem.setTaxlastmoney(tempUpdatedJson.getBigDecimal("TaxLastMoney"));
|
|
||||||
}
|
|
||||||
depotItem.setOtherfield1(tempUpdatedJson.getString("OtherField1"));
|
|
||||||
depotItem.setOtherfield2(tempUpdatedJson.getString("OtherField2"));
|
|
||||||
depotItem.setOtherfield3(tempUpdatedJson.getString("OtherField3"));
|
|
||||||
depotItem.setOtherfield4(tempUpdatedJson.getString("OtherField4"));
|
|
||||||
depotItem.setOtherfield5(tempUpdatedJson.getString("OtherField5"));
|
|
||||||
depotItem.setMtype(tempUpdatedJson.getString("MType"));
|
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/3/25 15:18
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改了商品类型时,库中的商品和页面传递的不同
|
|
||||||
* 这里需要重新获取页面传递的商品信息
|
|
||||||
*/
|
|
||||||
if(!material.getId().equals(depotItem.getMaterialid())){
|
|
||||||
if(material==null){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**出库时处理序列号*/
|
|
||||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
|
|
||||||
if(getCurrentRepByMaterialIdAndDepotId(material.getId(),depotItem.getDepotid())
|
|
||||||
.compareTo(depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber())==-1){
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
|
|
||||||
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
|
||||||
}
|
|
||||||
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
|
|
||||||
/**
|
|
||||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
|
||||||
* */
|
|
||||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
|
|
||||||
//查询单据子表中开启序列号的数据列表
|
|
||||||
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!StringUtil.isEmpty(tempUpdatedJson.get("UnitPrice").toString())) {
|
||||||
|
depotItem.setUnitprice(tempUpdatedJson.getBigDecimal("UnitPrice"));
|
||||||
|
}
|
||||||
|
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxUnitPrice").toString())) {
|
||||||
|
depotItem.setTaxunitprice(tempUpdatedJson.getBigDecimal("TaxUnitPrice"));
|
||||||
|
}
|
||||||
|
if (!StringUtil.isEmpty(tempUpdatedJson.get("AllPrice").toString())) {
|
||||||
|
depotItem.setAllprice(tempUpdatedJson.getBigDecimal("AllPrice"));
|
||||||
|
}
|
||||||
|
depotItem.setRemark(tempUpdatedJson.getString("Remark"));
|
||||||
|
if (tempUpdatedJson.get("DepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("DepotId").toString())) {
|
||||||
|
depotItem.setDepotid(tempUpdatedJson.getLong("DepotId"));
|
||||||
|
}
|
||||||
|
if (tempUpdatedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("AnotherDepotId").toString())) {
|
||||||
|
depotItem.setAnotherdepotid(tempUpdatedJson.getLong("AnotherDepotId"));
|
||||||
|
}
|
||||||
|
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxRate").toString())) {
|
||||||
|
depotItem.setTaxrate(tempUpdatedJson.getBigDecimal("TaxRate"));
|
||||||
|
}
|
||||||
|
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxMoney").toString())) {
|
||||||
|
depotItem.setTaxmoney(tempUpdatedJson.getBigDecimal("TaxMoney"));
|
||||||
|
}
|
||||||
|
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxLastMoney").toString())) {
|
||||||
|
depotItem.setTaxlastmoney(tempUpdatedJson.getBigDecimal("TaxLastMoney"));
|
||||||
|
}
|
||||||
|
depotItem.setOtherfield1(tempUpdatedJson.getString("OtherField1"));
|
||||||
|
depotItem.setOtherfield2(tempUpdatedJson.getString("OtherField2"));
|
||||||
|
depotItem.setOtherfield3(tempUpdatedJson.getString("OtherField3"));
|
||||||
|
depotItem.setOtherfield4(tempUpdatedJson.getString("OtherField4"));
|
||||||
|
depotItem.setOtherfield5(tempUpdatedJson.getString("OtherField5"));
|
||||||
|
depotItem.setMtype(tempUpdatedJson.getString("MType"));
|
||||||
|
/**
|
||||||
|
* create by: qiankunpingtai
|
||||||
|
* create time: 2019/3/25 15:18
|
||||||
|
* website:https://qiankunpingtai.cn
|
||||||
|
* description:
|
||||||
|
* 修改了商品类型时,库中的商品和页面传递的不同
|
||||||
|
* 这里需要重新获取页面传递的商品信息
|
||||||
|
*/
|
||||||
|
if(!material.getId().equals(depotItem.getMaterialid())){
|
||||||
|
material= materialService.getMaterial(depotItem.getMaterialid());
|
||||||
|
if(material==null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**出库时处理序列号*/
|
||||||
|
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
|
||||||
|
BigDecimal stock = getStockByParam(depotItem.getDepotid(),depotItem.getMaterialid(),null,null,tenantId);
|
||||||
|
BigDecimal thisBasicNumber = depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber();
|
||||||
|
if(stock.compareTo(thisBasicNumber)<0){
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
|
||||||
|
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||||
|
}
|
||||||
|
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
|
||||||
|
/**
|
||||||
|
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||||
|
* */
|
||||||
|
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
|
||||||
|
//查询单据子表中开启序列号的数据列表
|
||||||
|
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.updateDepotItemWithObj(depotItem);
|
||||||
}
|
}
|
||||||
this.updateDepotItemWithObj(depotItem);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -639,17 +595,7 @@ public class DepotItemService {
|
|||||||
}
|
}
|
||||||
return unitName;
|
return unitName;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 查询商品当前库存数量是否充足,
|
|
||||||
*
|
|
||||||
* */
|
|
||||||
public int getCurrentInStock(Long materialId, Long depotId){
|
|
||||||
//入库数量
|
|
||||||
int inSum = findByTypeAndMaterialIdAndDepotId(BusinessConstants.DEPOTHEAD_TYPE_STORAGE, materialId, depotId);
|
|
||||||
//出库数量
|
|
||||||
int outSum = findByTypeAndMaterialIdAndDepotId(BusinessConstants.DEPOTHEAD_TYPE_OUT, materialId ,depotId);
|
|
||||||
return (inSum-outSum);
|
|
||||||
}
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeleteDepotItemByIds(String ids)throws Exception {
|
public int batchDeleteDepotItemByIds(String ids)throws Exception {
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM,
|
||||||
@@ -661,10 +607,7 @@ public class DepotItemService {
|
|||||||
try{
|
try{
|
||||||
result =depotItemMapperEx.batchDeleteDepotItemByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
result =depotItemMapperEx.batchDeleteDepotItemByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
JshException.writeFail(logger, e);
|
||||||
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
|
||||||
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -690,35 +633,6 @@ public class DepotItemService {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/5/16 18:15
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 查询指定仓库指定材料的当前库存
|
|
||||||
*/
|
|
||||||
public BigDecimal getCurrentRepByMaterialIdAndDepotId(Long materialId,Long depotId) {
|
|
||||||
BigDecimal result = BigDecimal.ZERO;
|
|
||||||
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
|
||||||
Long tenantId=null;
|
|
||||||
Object tenantIdO = request.getSession().getAttribute("tenantId");
|
|
||||||
if(tenantIdO!=null){
|
|
||||||
//多租户模式,租户id从当前用户获取
|
|
||||||
tenantId=Long.valueOf(tenantIdO.toString());
|
|
||||||
} else {
|
|
||||||
//无租户模式,租户id为-1
|
|
||||||
tenantId=Long.valueOf(-1);
|
|
||||||
}
|
|
||||||
try{
|
|
||||||
result =depotItemMapperEx.getCurrentRepByMaterialIdAndDepotId(materialId,depotId,tenantId);
|
|
||||||
}catch(Exception e){
|
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
|
||||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
|
||||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计该商品已分批出库的总数量-用于订单
|
* 统计该商品已分批出库的总数量-用于订单
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class RoleService {
|
public class RoleService {
|
||||||
@@ -49,10 +48,12 @@ public class RoleService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Role> getRoleList(Map<String, String> parameterMap)throws Exception {
|
public List<Role> getRole()throws Exception {
|
||||||
|
RoleExample example = new RoleExample();
|
||||||
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
List<Role> list=null;
|
List<Role> list=null;
|
||||||
try{
|
try{
|
||||||
list=roleMapperEx.getRoleList(parameterMap);
|
list=roleMapper.selectByExample(example);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.readFail(logger, e);
|
JshException.readFail(logger, e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -379,29 +379,19 @@ public class SerialNumberService {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public void checkAndUpdateSerialNumber(DepotItem depotItem,User userInfo) throws Exception{
|
public void checkAndUpdateSerialNumber(DepotItem depotItem,User userInfo) throws Exception{
|
||||||
if(depotItem!=null){
|
if(depotItem!=null){
|
||||||
//查询商品下已分配的可用序列号数量
|
//查询商品下已分配的可用序列号数量
|
||||||
int serialNumberSum=0;
|
int SerialNumberSum= serialNumberMapperEx.countSerialNumberByMaterialIdAndDepotheadId(depotItem.getMaterialid(),null,BusinessConstants.IS_SELL_HOLD);
|
||||||
try{
|
//BasicNumber=OperNumber*ratio
|
||||||
serialNumberSum= serialNumberMapperEx.countSerialNumberByMaterialIdAndDepotheadId(depotItem.getMaterialid(),null,BusinessConstants.IS_SELL_HOLD);
|
if((depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue()>SerialNumberSum){
|
||||||
//BasicNumber=OperNumber*ratio
|
//获取商品名称
|
||||||
}catch(Exception e){
|
Material material= materialMapper.selectByPrimaryKey(depotItem.getMaterialid());
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_CODE,
|
||||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
String.format(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
}
|
||||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
//商品下序列号充足,分配序列号
|
||||||
}
|
sellSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),userInfo);
|
||||||
if((depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue()>serialNumberSum){
|
}
|
||||||
//获取商品名称
|
|
||||||
Material material= materialMapper.selectByPrimaryKey(depotItem.getMaterialid());
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_CODE,
|
|
||||||
String.format(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
//商品下序列号充足,分配序列号
|
|
||||||
sellSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),userInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -483,30 +473,25 @@ public class SerialNumberService {
|
|||||||
|
|
||||||
int insertNum=0;
|
int insertNum=0;
|
||||||
StringBuffer prefixBuf=new StringBuffer(serialNumberPrefix).append(million);
|
StringBuffer prefixBuf=new StringBuffer(serialNumberPrefix).append(million);
|
||||||
do{
|
list=new ArrayList<SerialNumberEx>();
|
||||||
list=new ArrayList<SerialNumberEx>();
|
int forNum = BusinessConstants.BATCH_INSERT_MAX_NUMBER>=batAddTotal?batAddTotal:BusinessConstants.BATCH_INSERT_MAX_NUMBER;
|
||||||
int forNum = BusinessConstants.BATCH_INSERT_MAX_NUMBER>=batAddTotal?batAddTotal:BusinessConstants.BATCH_INSERT_MAX_NUMBER;
|
for(int i=0;i<forNum;i++){
|
||||||
for(int i=0;i<forNum;i++){
|
insertNum++;
|
||||||
insertNum++;
|
SerialNumberEx each=new SerialNumberEx();
|
||||||
SerialNumberEx each=new SerialNumberEx();
|
each.setMaterialId(materialId);
|
||||||
each.setMaterialId(materialId);
|
each.setCreator(userId);
|
||||||
each.setCreator(userId);
|
each.setCreateTime(date);
|
||||||
each.setCreateTime(date);
|
each.setUpdater(userId);
|
||||||
each.setUpdater(userId);
|
each.setUpdateTime(date);
|
||||||
each.setUpdateTime(date);
|
each.setRemark(remark);
|
||||||
each.setRemark(remark);
|
each.setSerialNumber(new StringBuffer(prefixBuf.toString()).append(insertNum).toString());
|
||||||
each.setSerialNumber(new StringBuffer(prefixBuf.toString()).append(insertNum).toString());
|
list.add(each);
|
||||||
list.add(each);
|
}
|
||||||
}
|
try{
|
||||||
int result=0;
|
|
||||||
try{
|
|
||||||
result = serialNumberMapperEx.batAddSerialNumber(list);
|
|
||||||
}catch(Exception e){
|
|
||||||
JshException.writeFail(logger, e);
|
|
||||||
}
|
|
||||||
serialNumberMapperEx.batAddSerialNumber(list);
|
serialNumberMapperEx.batAddSerialNumber(list);
|
||||||
batAddTotal -= BusinessConstants.BATCH_INSERT_MAX_NUMBER;
|
}catch(Exception e){
|
||||||
}while(batAddTotal>0);
|
JshException.writeFail(logger, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ public class SupplierService {
|
|||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
if(supplier!=null){
|
if(supplier!=null){
|
||||||
supplier.setAdvancein((supplier.getAdvancein()==null?BigDecimal.ZERO:supplier.getAdvancein()).add(advanceIn)); //增加预收款的金额,可能增加的是负值
|
supplier.setAdvancein(supplier.getAdvancein().add(advanceIn)); //增加预收款的金额,可能增加的是负值
|
||||||
result=supplierMapper.updateByPrimaryKeySelective(supplier);
|
result=supplierMapper.updateByPrimaryKeySelective(supplier);
|
||||||
}
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class TenantComponent implements ICommonQuery {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
return tenantService.insertTenant(beanJson);
|
return tenantService.insertTenant(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class TenantService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int insertTenant(String beanJson)throws Exception {
|
public int insertTenant(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
Tenant tenant = JSONObject.parseObject(beanJson, Tenant.class);
|
Tenant tenant = JSONObject.parseObject(beanJson, Tenant.class);
|
||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import com.jsh.erp.service.userBusiness.UserBusinessService;
|
|||||||
import com.jsh.erp.utils.ExceptionCodeConstants;
|
import com.jsh.erp.utils.ExceptionCodeConstants;
|
||||||
import com.jsh.erp.utils.StringUtil;
|
import com.jsh.erp.utils.StringUtil;
|
||||||
import com.jsh.erp.utils.Tools;
|
import com.jsh.erp.utils.Tools;
|
||||||
import org.apache.ibatis.annotations.DeleteProvider;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -219,33 +218,35 @@ public class UserService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int validateUser(String username, String password){
|
public int validateUser(String username, String password) throws Exception {
|
||||||
/**默认是可以登录的*/
|
/**默认是可以登录的*/
|
||||||
List<User> list = null;
|
List<User> list = null;
|
||||||
try {
|
try {
|
||||||
list=this.getUserListByloginName(username);
|
UserExample example = new UserExample();
|
||||||
} catch (Exception e) {
|
example.createCriteria().andLoginameEqualTo(username);
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
list = userMapper.selectByExample(example);
|
||||||
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
} catch (Exception e) {
|
||||||
logger.error(">>>>>>>>访问验证用户姓名是否存在后台信息异常", e);
|
logger.error(">>>>>>>>访问验证用户姓名是否存在后台信息异常", e);
|
||||||
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
|
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null != list && list.size() == 0) {
|
if (null != list && list.size() == 0) {
|
||||||
return ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST;
|
return ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST;
|
||||||
}
|
}
|
||||||
User user=null;
|
|
||||||
try {
|
|
||||||
user = this.getUserListByloginNameAndPassword(username,password);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error(">>>>>>>>>>访问验证用户密码后台信息异常", e);
|
|
||||||
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null == user ) {
|
try {
|
||||||
return ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR;
|
UserExample example = new UserExample();
|
||||||
}
|
example.createCriteria().andLoginameEqualTo(username).andPasswordEqualTo(password);
|
||||||
return ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT;
|
list = userMapper.selectByExample(example);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(">>>>>>>>>>访问验证用户密码后台信息异常", e);
|
||||||
|
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null != list && list.size() == 0) {
|
||||||
|
return ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR;
|
||||||
|
}
|
||||||
|
return ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getUserByUserName(String username)throws Exception {
|
public User getUserByUserName(String username)throws Exception {
|
||||||
@@ -310,8 +311,7 @@ public class UserService {
|
|||||||
BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
//检查用户名和登录名
|
//检查用户名和登录名
|
||||||
checkLoginName(ue);
|
checkUserNameAndLoginName(ue);
|
||||||
checkUserName(ue);
|
|
||||||
//新增用户信息
|
//新增用户信息
|
||||||
ue= this.addUser(ue);
|
ue= this.addUser(ue);
|
||||||
if(ue==null){
|
if(ue==null){
|
||||||
@@ -351,11 +351,7 @@ public class UserService {
|
|||||||
* 3是否管理者默认为员工
|
* 3是否管理者默认为员工
|
||||||
* 4默认用户状态为正常
|
* 4默认用户状态为正常
|
||||||
* */
|
* */
|
||||||
|
ue.setPassword(Tools.md5Encryp(BusinessConstants.USER_DEFAULT_PASSWORD));
|
||||||
//用户没有设置密码时,使用默认密码
|
|
||||||
if(StringUtil.isEmpty(ue.getPassword())){
|
|
||||||
ue.setPassword(Tools.md5Encryp(BusinessConstants.USER_DEFAULT_PASSWORD));
|
|
||||||
}
|
|
||||||
ue.setIsystem(BusinessConstants.USER_NOT_SYSTEM);
|
ue.setIsystem(BusinessConstants.USER_NOT_SYSTEM);
|
||||||
if(ue.getIsmanager()==null){
|
if(ue.getIsmanager()==null){
|
||||||
ue.setIsmanager(BusinessConstants.USER_NOT_MANAGER);
|
ue.setIsmanager(BusinessConstants.USER_NOT_MANAGER);
|
||||||
@@ -374,7 +370,7 @@ public class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public UserEx registerUser(UserEx ue, Long manageRoleId) throws Exception{
|
public UserEx registerUser(UserEx ue, Integer manageRoleId, HttpServletRequest request) throws Exception{
|
||||||
/**
|
/**
|
||||||
* create by: qiankunpingtai
|
* create by: qiankunpingtai
|
||||||
* create time: 2019/4/9 18:00
|
* create time: 2019/4/9 18:00
|
||||||
@@ -386,46 +382,42 @@ public class UserService {
|
|||||||
throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE,
|
throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE,
|
||||||
ExceptionConstants.USER_NAME_LIMIT_USE_MSG);
|
ExceptionConstants.USER_NAME_LIMIT_USE_MSG);
|
||||||
} else {
|
} else {
|
||||||
/**
|
ue.setPassword(Tools.md5Encryp(ue.getPassword()));
|
||||||
* create by: qiankunpingtai
|
ue.setIsystem(BusinessConstants.USER_NOT_SYSTEM);
|
||||||
* create time: 2019/4/24 10:57
|
if (ue.getIsmanager() == null) {
|
||||||
* website:https://qiankunpingtai.cn
|
ue.setIsmanager(BusinessConstants.USER_NOT_MANAGER);
|
||||||
* description:
|
}
|
||||||
* 检查登录名是否已存在
|
ue.setStatus(BusinessConstants.USER_STATUS_NORMAL);
|
||||||
*
|
int result=0;
|
||||||
*/
|
try{
|
||||||
checkLoginName(ue);
|
result= userMapperEx.addUser(ue);
|
||||||
/**
|
}catch(Exception e){
|
||||||
* create by: qiankunpingtai
|
JshException.writeFail(logger, e);
|
||||||
* create time: 2019/4/24 14:47
|
}
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 注册一个新用户需要做如下操作
|
|
||||||
* 1、分配应用
|
|
||||||
* 2、分配功能模块
|
|
||||||
* 3、分配产品扩展字段
|
|
||||||
* 4、分配角色(默认添加超级管理员角色,不可修改)
|
|
||||||
* 5、写入用户信息
|
|
||||||
* 6、写入用户角色应用功能关系
|
|
||||||
*/
|
|
||||||
|
|
||||||
ue=this.addUser(ue);
|
|
||||||
|
|
||||||
//更新租户id
|
//更新租户id
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.setId(ue.getId());
|
user.setId(ue.getId());
|
||||||
user.setTenantId(ue.getId());
|
user.setTenantId(ue.getId());
|
||||||
userService.updateUserTenant(user);
|
userService.updateUserTenant(user);
|
||||||
addRegisterUserNotInclueUser(user.getId(),user.getTenantId(),manageRoleId);
|
//新增用户与角色的关系
|
||||||
// //新增用户与角色的关系
|
JSONObject ubObj = new JSONObject();
|
||||||
// JSONObject ubObj = new JSONObject();
|
ubObj.put("type", "UserRole");
|
||||||
// ubObj.put("type", "UserRole");
|
ubObj.put("keyid", ue.getId());
|
||||||
// ubObj.put("keyid", ue.getId());
|
JSONArray ubArr = new JSONArray();
|
||||||
// JSONArray ubArr = new JSONArray();
|
ubArr.add(manageRoleId);
|
||||||
// ubArr.add(manageRoleId);
|
ubObj.put("value", ubArr.toString());
|
||||||
// ubObj.put("value", ubArr.toString());
|
userBusinessService.insertUserBusiness(ubObj.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
// userBusinessService.insertUserBusiness(ubObj.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
//创建租户信息
|
||||||
return ue;
|
JSONObject tenantObj = new JSONObject();
|
||||||
|
tenantObj.put("tenantId", ue.getId());
|
||||||
|
tenantObj.put("loginName",ue.getLoginame());
|
||||||
|
String param = tenantObj.toJSONString();
|
||||||
|
tenantService.insertTenant(param, request);
|
||||||
|
logger.info("===============创建租户信息完成===============");
|
||||||
|
if (result > 0) {
|
||||||
|
return ue;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,8 +442,7 @@ public class UserService {
|
|||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ue.getId()).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ue.getId()).toString(),
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
//检查用户名和登录名
|
//检查用户名和登录名
|
||||||
checkLoginName(ue);
|
checkUserNameAndLoginName(ue);
|
||||||
checkUserName(ue);
|
|
||||||
//更新用户信息
|
//更新用户信息
|
||||||
ue = this.updateUser(ue);
|
ue = this.updateUser(ue);
|
||||||
if (ue == null) {
|
if (ue == null) {
|
||||||
@@ -503,13 +494,14 @@ public class UserService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* create by: qiankunpingtai
|
* create by: cjl
|
||||||
* create time: 2019/4/24 11:02
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
* description:
|
||||||
* 检查登录名全局唯一
|
* 检查用户名称和登录名不能重复
|
||||||
|
* create time: 2019/3/12 11:36
|
||||||
|
* @Param: userEx
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public void checkLoginName(UserEx userEx)throws Exception{
|
public void checkUserNameAndLoginName(UserEx userEx)throws Exception{
|
||||||
List<User> list=null;
|
List<User> list=null;
|
||||||
if(userEx==null){
|
if(userEx==null){
|
||||||
return;
|
return;
|
||||||
@@ -539,25 +531,10 @@ public class UserService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/4/24 11:02
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 检查用户名同一个租户范围内内唯一
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void checkUserName(UserEx userEx)throws Exception{
|
|
||||||
List<User> list=null;
|
|
||||||
if(userEx==null){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Long userId=userEx.getId();
|
|
||||||
//检查用户名
|
//检查用户名
|
||||||
if(!StringUtils.isEmpty(userEx.getUsername())){
|
if(!StringUtils.isEmpty(userEx.getUsername())){
|
||||||
String userName=userEx.getUsername();
|
String userName=userEx.getUsername();
|
||||||
list=this.getUserListByUserNameAndTenantId(userName,userEx.getTenantId());
|
list=this.getUserListByUserName(userName);
|
||||||
if(list!=null&&list.size()>0){
|
if(list!=null&&list.size()>0){
|
||||||
if(list.size()>1){
|
if(list.size()>1){
|
||||||
//超过一条数据存在,该用户名已存在
|
//超过一条数据存在,该用户名已存在
|
||||||
@@ -578,58 +555,32 @@ public class UserService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* create by: qiankunpingtai
|
* 通过用户名获取用户列表
|
||||||
* website:https://qiankunpingtai.cn
|
* */
|
||||||
* description:
|
public List<User> getUserListByUserName(String userName)throws Exception{
|
||||||
* 通过用户名和租户id获取用户信息
|
|
||||||
* create time: 2019/4/24 11:18
|
|
||||||
* @Param: userName
|
|
||||||
* @Param: tenantId
|
|
||||||
* @return java.util.List<com.jsh.erp.datasource.entities.User>
|
|
||||||
*/
|
|
||||||
private List<User> getUserListByUserNameAndTenantId(String userName, Long tenantId) {
|
|
||||||
|
|
||||||
List<User> list =null;
|
List<User> list =null;
|
||||||
try{
|
try{
|
||||||
list=userMapperEx.getUserListByUserNameAndTenantId(userName,tenantId);
|
list=userMapperEx.getUserListByUserNameOrLoginName(userName,null);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.readFail(logger, e);
|
JshException.readFail(logger, e);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过登录名获取用户列表
|
* 通过登录名获取用户列表
|
||||||
* */
|
* */
|
||||||
public List<User> getUserListByloginName(String loginName){
|
public List<User> getUserListByloginName(String loginName){
|
||||||
List<User> list =null;
|
List<User> list =null;
|
||||||
try{
|
try{
|
||||||
list=userMapperEx.getUserListByLoginName(loginName);
|
list=userMapperEx.getUserListByUserNameOrLoginName(null,loginName);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.readFail(logger, e);
|
JshException.readFail(logger, e);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 通过登录名和密码获取用户列表
|
|
||||||
* */
|
|
||||||
public User getUserListByloginNameAndPassword(String loginName,String password){
|
|
||||||
List<User> list =null;
|
|
||||||
try{
|
|
||||||
list=userMapperEx.getUserListByloginNameAndPassword(loginName,password);
|
|
||||||
}catch(Exception e){
|
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
|
||||||
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
|
||||||
ExceptionConstants.DATA_READ_FAIL_MSG);
|
|
||||||
}
|
|
||||||
if(list!=null&&list.size()>0){
|
|
||||||
return list.get(0);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* 批量删除用户
|
* 批量删除用户
|
||||||
* */
|
* */
|
||||||
@@ -662,34 +613,4 @@ public class UserService {
|
|||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 1、分配应用
|
|
||||||
* 2、分配功能模块
|
|
||||||
* 3、分配产品扩展字段
|
|
||||||
* 4、分配角色(默认添加超级管理员角色,不可修改)
|
|
||||||
* 5、写入用户角色应用功能关系
|
|
||||||
* create time: 2019/4/26 9:37
|
|
||||||
* @Param: userId 用户id
|
|
||||||
* @Param: tenantId 租户id
|
|
||||||
* @Param: roleId 模板角色id
|
|
||||||
* @return java.lang.String
|
|
||||||
*/
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
|
||||||
public String addRegisterUserNotInclueUser(Long userId,Long tenantId,Long roleId)throws Exception {
|
|
||||||
|
|
||||||
String result =null;
|
|
||||||
try{
|
|
||||||
result=userMapperEx.addRegisterUserNotInclueUser(userId,tenantId,roleId);
|
|
||||||
}catch(Exception e){
|
|
||||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
|
||||||
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
|
||||||
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user