优化采购入库单据,改为选择关联单据的方式

This commit is contained in:
季圣华
2020-10-22 00:27:18 +08:00
parent 247dfb3cbf
commit cc7df2b44d
8 changed files with 124 additions and 32 deletions

View File

@@ -635,7 +635,7 @@
$("#saveDepotHead").click();
}
//搜索按钮添加快捷键
if(k == "13"&&(obj.id=="searchState"||obj.id=="searchNumber"||obj.id=="searchMaterial"))
if(k == "13"&&(obj.id=="searchNumber"||obj.id=="searchMaterial"))
{
$("#searchBtn").click();
}
@@ -1003,7 +1003,7 @@
type: listType,
subType: listSubType,
roleType: roleType,
state: $.trim($("#searchState").val()),
status: "",
number: $.trim($("#searchNumber").val()),
beginTime: beginTime,
endTime: endTime,

View File

@@ -82,7 +82,7 @@
</td>
<td style="width:70px;">关联订单</td>
<td style="padding:5px">
<input name="LinkNumber" id="LinkNumber" class="easyui-validatebox radius-ui" style="width: 150px;" readonly/>
<input name="LinkNumber" id="LinkNumber" class="easyui-textbox" data-options="buttonText:'选择',editable:false" style="width: 185px;"/>
</td>
<td style="width:100px;"></td>
</tr>
@@ -286,6 +286,15 @@
<a href="javascript:void(0)" id="saveOtherMoneyDlg" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
<a href="javascript:void(0)" id="cancelOtherMoneyDlg" class="easyui-linkbutton" iconCls="icon-cancel">取消</a>
</div>
<div id="linkBillDlg" class="easyui-dialog" style="width:880px;padding:10px 20px;"
closed="true" modal="true" buttons="#linkBillDlgBtn" cache="false" collapsible="false" closable="true">
<table id="linkBillData" style="top:100px;border-bottom-color:#FFFFFF"></table>
</div>
<div id="linkBillDlgBtn">
<a href="javascript:void(0)" id="saveLinkBill" class="easyui-linkbutton" iconCls="icon-ok">选择</a>
<a href="javascript:void(0)" id="cancelLinkBill" class="easyui-linkbutton" iconCls="icon-cancel"
onclick="javascript:$('#linkBillDlg').dialog('close')">取消</a>
</div>
<div id="supplier"></div>
<div id="depot"></div>
<div id="account"></div>
@@ -425,17 +434,7 @@
$(".window-mask").css({ width: webW ,height: webH});
depotHeadID = 0;
var res = sessionStorage.getItem("rowInfo");
if(pageType == "skip" && res) { //从订单跳转过来
res = JSON.parse(res);
$('#OrganId').combobox('setValue', res.organId);
$("#LinkNumber").val(res.number); //关联订单号
$("#DiscountLastMoney").val(res.totalPrice); //优惠后金额
$("#ChangeAmount").val(res.totalPrice).attr("data-changeamount", res.totalPrice);
depotHeadID = res.id;
initTableData_material("edit",res.totalPrice); //商品列表
} else {
initTableData_material("add"); //商品列表
}
initTableData_material("add"); //商品列表
function supplierDlgFun(type) {
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/>&nbsp;增加' + type + '信息');
$('#supplierFM').form('clear');
@@ -455,8 +454,92 @@
$('#accountFM').form('clear');
bindAccountEvent();
});
//关联订单的选择事件
$('#LinkNumber').textbox({
onClickButton:function(){
$('#linkBillDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui/themes/icons/edit_add.png"/>&nbsp;选择关联单据');
$("#linkBillDlg").panel("move",{top:$(document).scrollTop() + ($(window).height()-400) * 0.5});
initLinkBillTableData();
}
});
url = '/depotHead/addDepotHeadAndDetail';
}
function initLinkBillTableData() {
$('#linkBillData').datagrid({
height:300,
rownumbers: false,
//动画效果
animate:false,
//选中单行
singleSelect: true,
collapsible: false,
pagination: true,
//交替出现背景
striped : true,
pageSize: 10,
pageList: initPageNum,
columns:[[
{ field: 'id',width:35,align:"center",checkbox:true},
{ title: '供应商名称', field: 'organName',width:120},
{ title: '单据编号',field: 'number',width:155},
{ title: '商品信息',field: 'materialsList',width:200,formatter:function(value){
if(value) {
return value.replace(",","");
}
}
},
{ title: '单据日期',field: 'operTimeStr',width:145},
{ title: '操作员',field: 'userName',width:60},
{ title: '金额合计',field: 'totalPrice',width:70}
]],
onLoadError:function() {
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
$.ajax({
type: "get",
url: "/depotHead/list",
dataType: "json",
data: ({
search: JSON.stringify({
type: "其它",
subType: "采购订单",
roleType: roleType,
status: "1",
number: "",
beginTime: "",
endTime: "",
materialParam: "",
depotIds: depotString
}),
currentPage: 1,
pageSize: initPageSize
}),
success: function (res) {
if(res && res.code === 200){
if(res.data && res.data.page) {
$("#linkBillData").datagrid('loadData', res.data.page);
$("#saveLinkBill").off("click").on("click", function(){
var res = $('#linkBillData').datagrid('getChecked')[0];
$('#OrganId').combobox('setValue', res.organId);
$("#LinkNumber").textbox("setValue",res.number); //关联订单号
$("#DiscountLastMoney").val(res.totalPrice); //优惠后金额
$("#ChangeAmount").val(res.totalPrice).attr("data-changeamount", res.totalPrice);
depotHeadID = res.id;
initTableData_material("edit",res.totalPrice); //商品列表
$('#linkBillDlg').dialog('close');
});
}
}
},
//此处添加错误处理
error: function () {
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
return;
}
});
}
//编辑信息
function editDepotHead(index) {
var res = $("#tableData").datagrid("getRows")[index];

View File

@@ -291,7 +291,7 @@
pageList: initPageNum,
columns:[[
{ field: 'id',width:35,align:"center",checkbox:true},
{ title: '操作',field: 'op',align:"center", width:120,
{ title: '操作',field: 'op',align:"center", width:90,
formatter:function(value,rec,index) {
var str = '';
var orgId = rec.organId? rec.organId:0;
@@ -300,7 +300,6 @@
str += '<img title="编辑" src="/js/easyui/themes/icons/pencil.png" style="cursor: pointer;" onclick="editDepotHead(\'' + index + '\');"/>&nbsp;&nbsp;&nbsp;';
str += '<img title="删除" src="/js/easyui/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="inOutService.deleteDepotHead('+ rec.id +',' + orgId +',' + rec.totalPrice+',' + rec.status + ');"/>';
}
str += '&nbsp;&nbsp;&nbsp;<img title="转采购入库" src="/js/easyui/themes/icons/redo.png" style="cursor: pointer;" onclick="skipDepotHead(\'' + index + '\');"/>';
return str;
}
},

View File

@@ -344,7 +344,7 @@ public class DepotHeadController {
String rows = body.getRows();
Long billsNumLimit = Long.parseLong(request.getSession().getAttribute("billsNumLimit").toString());
Long tenantId = Long.parseLong(request.getSession().getAttribute("tenantId").toString());
Long count = depotHeadService.countDepotHead(null,null,null,null,null,null,null,null);
Long count = depotHeadService.countDepotHead(null,null,null,null,null,null,null,null,null);
if(count>= billsNumLimit) {
throw new BusinessParamCheckingException(ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_CODE,
ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_MSG);

View File

@@ -22,6 +22,7 @@ public interface DepotHeadMapperEx {
@Param("type") String type,
@Param("subType") String subType,
@Param("creatorArray") String[] creatorArray,
@Param("status") String status,
@Param("number") String number,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@@ -34,6 +35,7 @@ public interface DepotHeadMapperEx {
@Param("type") String type,
@Param("subType") String subType,
@Param("creatorArray") String[] creatorArray,
@Param("status") String status,
@Param("number") String number,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,

View File

@@ -33,12 +33,13 @@ public class DepotHeadComponent implements ICommonQuery {
String type = StringUtil.getInfo(search, "type");
String subType = StringUtil.getInfo(search, "subType");
String roleType = StringUtil.getInfo(search, "roleType");
String status = StringUtil.getInfo(search, "status");
String number = StringUtil.getInfo(search, "number");
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
String materialParam = StringUtil.getInfo(search, "materialParam");
String depotIds = StringUtil.getInfo(search, "depotIds");
return depotHeadService.select(type, subType, roleType, number, beginTime, endTime, materialParam, depotIds, QueryUtils.offset(map), QueryUtils.rows(map));
return depotHeadService.select(type, subType, roleType, status, number, beginTime, endTime, materialParam, depotIds, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
@@ -47,12 +48,13 @@ public class DepotHeadComponent implements ICommonQuery {
String type = StringUtil.getInfo(search, "type");
String subType = StringUtil.getInfo(search, "subType");
String roleType = StringUtil.getInfo(search, "roleType");
String status = StringUtil.getInfo(search, "status");
String number = StringUtil.getInfo(search, "number");
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
String materialParam = StringUtil.getInfo(search, "materialParam");
String depotIds = StringUtil.getInfo(search, "depotIds");
return depotHeadService.countDepotHead(type, subType, roleType, number, beginTime, endTime, materialParam, depotIds);
return depotHeadService.countDepotHead(type, subType, roleType, status, number, beginTime, endTime, materialParam, depotIds);
}
@Override

View File

@@ -82,13 +82,13 @@ public class DepotHeadService {
return list;
}
public List<DepotHeadVo4List> select(String type, String subType, String roleType, String number, String beginTime, String endTime,
public List<DepotHeadVo4List> select(String type, String subType, String roleType, String status, String number, String beginTime, String endTime,
String materialParam, String depotIds, int offset, int rows)throws Exception {
List<DepotHeadVo4List> resList = new ArrayList<DepotHeadVo4List>();
List<DepotHeadVo4List> list=null;
try{
String [] creatorArray = getCreatorArray(roleType);
list=depotHeadMapperEx.selectByConditionDepotHead(type, subType, creatorArray, number, beginTime, endTime, materialParam, depotIds, offset, rows);
list=depotHeadMapperEx.selectByConditionDepotHead(type, subType, creatorArray, status, number, beginTime, endTime, materialParam, depotIds, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
@@ -122,12 +122,12 @@ public class DepotHeadService {
return resList;
}
public Long countDepotHead(String type, String subType, String roleType,String number, String beginTime, String endTime,
public Long countDepotHead(String type, String subType, String roleType, String status, String number, String beginTime, String endTime,
String materialParam, String depotIds) throws Exception{
Long result=null;
try{
String [] creatorArray = getCreatorArray(roleType);
result=depotHeadMapperEx.countsByDepotHead(type, subType, creatorArray, number, beginTime, endTime, materialParam, depotIds);
result=depotHeadMapperEx.countsByDepotHead(type, subType, creatorArray, status, number, beginTime, endTime, materialParam, depotIds);
}catch(Exception e){
JshException.readFail(logger, e);
}

View File

@@ -55,6 +55,9 @@
<if test="subType != null">
and dh.sub_type='${subType}'
</if>
<if test="status != null">
and dh.status ='${status}'
</if>
<if test="number != null">
and dh.number like '%${number}%'
</if>
@@ -86,24 +89,27 @@
<select id="countsByDepotHead" resultType="java.lang.Long">
SELECT
COUNT(1) from
(select distinct jsh_depot_head.* FROM jsh_depot_head
left join jsh_depot_item di on jsh_depot_head.Id = di.header_id and ifnull(di.delete_flag,'0') !='1'
(select distinct dh.* FROM jsh_depot_head dh
left join jsh_depot_item di on dh.Id = di.header_id and ifnull(di.delete_flag,'0') !='1'
left join jsh_material m on di.material_id = m.Id and ifnull(m.delete_Flag,'0') !='1'
WHERE 1=1
<if test="type != null">
and type='${type}'
and dh.type='${type}'
</if>
<if test="subType != null">
and sub_type='${subType}'
and dh.sub_type='${subType}'
</if>
<if test="status != null">
and dh.status ='${status}'
</if>
<if test="number != null">
and number like '%${number}%'
and dh.number like '%${number}%'
</if>
<if test="beginTime != null">
and oper_time >= '${beginTime}'
and dh.oper_time >= '${beginTime}'
</if>
<if test="endTime != null">
and oper_time &lt;= '${endTime}'
and dh.oper_time &lt;= '${endTime}'
</if>
<if test="materialParam != null">
and (m.`Name` like '%${materialParam}%' or m.Model like '%${materialParam}%')
@@ -112,13 +118,13 @@
and di.depot_id in (${depotIds})
</if>
<if test="creatorArray != null">
and creator in (
and dh.creator in (
<foreach collection="creatorArray" item="creator" separator=",">
#{creator}
</foreach>
)
</if>
and ifnull(jsh_depot_head.delete_Flag,'0') !='1') tb
and ifnull(dh.delete_Flag,'0') !='1') tb
</select>
<select id="findMaterialsListByHeaderId" resultType="java.lang.String">