<!DOCTYPE html>
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<title>条码档案</title>
|
<meta name="renderer" content="webkit">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
|
<link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
|
<script src="../../../layuiadmin/layui/layui.js"></script>
|
<script src="../../../layuiadmin/Scripts/json2.js"></script>
|
<script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
|
<script src="../../../layuiadmin/Scripts/webConfig.js"></script>
|
<script src="../../../layuiadmin/PubCustom.js"></script>
|
<script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
|
<script src="../../../layuiadmin/HideButton.js"></script>
|
<script src="../../../layuiadmin/soulTable.slim.js"></script>
|
<script src="../../../layuiadmin/MESLanguage.js"></script>
|
<style type="text/css">
|
input.layui-input.layui-unselect {
|
padding-right: 0;
|
}
|
|
.disabled-filter {
|
background-color: #f5f5f5 !important;
|
cursor: not-allowed !important;
|
}
|
</style>
|
</head>
|
|
<body>
|
<div class="layui-fluid">
|
<div class="layui-col-md12">
|
<div class="layui-card" style="padding: 1px">
|
<div class="layui-card-body" style="padding: 1px;">
|
<form class="layui-form" action="" lay-filter="component-form-group">
|
<div class="layui-collapse">
|
<div class="layui-colla-item">
|
<div class="layui-colla-title layui-inline">
|
<div class="layui-inline">
|
<span id="BT_GD">更多</span>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" id="BT_HBeginDate">开始日期</label>
|
<div class="layui-input-block">
|
<input type="date" class="layui-input ForFilteringSchemes" id="HBeginDate"
|
style="width:190px;">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" id="BT_HEndDate">结束日期</label>
|
<div class="layui-input-block">
|
<input type="date" class="layui-input ForFilteringSchemes" id="HEndDate"
|
style="width:190px;">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" id="BT_HBarCode">条码编号</label>
|
<div class="layui-input-block">
|
<input type="text" class="layui-input ForFilteringSchemes" name="HBarCode"
|
id="HBarCode">
|
</div>
|
</div>
|
<div class="layui-row" style="margin-top: 5px; margin-left: 70px;">
|
<div class="layui-inline">
|
<label class="layui-form-label" id="BT_HSourceBillNo">源单单号</label>
|
<div class="layui-input-block">
|
<input type="text" class="layui-input ForFilteringSchemes"
|
name="HSourceBillNo" id="HSourceBillNo" readonly>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" id="BT_HMaterName">物料名称</label>
|
<div class="layui-input-block">
|
<input type="text" class="layui-input ForFilteringSchemes" name="HMaterName"
|
id="HMaterName">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" id="BT_HMaterNumber">物料代码</label>
|
<div class="layui-input-block">
|
<input type="text" class="layui-input ForFilteringSchemes"
|
name="HMaterNumber" id="HMaterNumber">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">组织名称</label>
|
<div class="layui-input-block" style="margin-left: 120px; width: 185px;">
|
<select name="HUSEORGID" id="HUSEORGID" class="ForFilteringSchemes"
|
lay-verify="HUSEORGID" disabled>
|
<!--动态渲染组织-->
|
</select>
|
</div>
|
</div>
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit=""
|
lay-filter="btnSearch" id="btnSearch">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
|
</button>
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit=""
|
lay-filter="btnReSearch" id="btnReSearch" style="padding:0 5px">
|
重置筛选条件
|
</button>
|
<!--显示当前查询来源-->
|
|
</div>
|
|
<div class="layui-colla-content" style="padding: 0px; margin-left: 6%;">
|
<div class="layui-row" style="margin-top:10px;">
|
<div class="layui-inline">
|
<label class="layui-form-label" id="BT_ColName">过滤</label>
|
<div class="layui-input-block">
|
<select name="ColName" class="ForFilteringSchemes" id="ColName" lay-filter="ColName"
|
style="width:190px;">
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<select name="Comparator" class="ForFilteringSchemes" id="Comparator" lay-filter="Comparator"
|
style="width:190px;">
|
<option value="0" selected="selected"></option>
|
<option value="=">=</option>
|
<option value=">=">>=</option>
|
<option value=">">></option>
|
<option value="<=">
|
<=< /option>
|
<option value="<">
|
<< /option>
|
<option value="<>">
|
<>
|
</option>
|
<option value="7">包含</option>
|
<option value="8">左包含</option>
|
<option value="9">右包含</option>
|
<option value="10">不包含</option>
|
</select>
|
</div>
|
<div class="layui-inline">
|
<input type="text" class="layui-input ForFilteringSchemes" value="" name="ColContent"
|
id="ColContent">
|
</div>
|
</div>
|
<div class="layui-row" style=" margin-top: 10px;">
|
<div class="layui-inline">
|
<label class="layui-form-label" id="BT_ColName1">过滤</label>
|
<div class="layui-input-block">
|
<select class="ForFilteringSchemes" name="ColName1" id="ColName1" class="ForFilteringSchemes"
|
lay-filter="ColName1" style="width:190px;">
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<select name="Comparator1" class="ForFilteringSchemes" id="Comparator1" class="ForFilteringSchemes"
|
lay-filter="Comparator1" style="width:190px;">
|
<option value="0" selected="selected"></option>
|
<option value="=">=</option>
|
<option value=">=">>=</option>
|
<option value=">">></option>
|
<option value="<=">
|
<=< /option>
|
<option value="<">
|
<< /option>
|
<option value="<>">
|
<>
|
</option>
|
<option value="7">包含</option>
|
<option value="8">左包含</option>
|
<option value="9">右包含</option>
|
<option value="10">不包含</option>
|
</select>
|
</div>
|
<div class="layui-inline">
|
<input type="text" class="layui-input ForFilteringSchemes" value=""
|
name="ColContent1" id="ColContent1">
|
</div>
|
</div>
|
<div class="layui-row" style=" margin-top: 10px;">
|
<div class="layui-inline">
|
<label class="layui-form-label" id="BT_ColName2">过滤</label>
|
<div class="layui-input-block">
|
<select name="ColName2" id="ColName2" class="ForFilteringSchemes"
|
lay-filter="ColName2" style="width:190px;">
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<select name="Comparator2" id="Comparator2" class="ForFilteringSchemes"
|
lay-filter="Comparator2" style="width:190px;">
|
<option value="0" selected="selected"></option>
|
<option value="=">=</option>
|
<option value=">=">>=</option>
|
<option value=">">></option>
|
<option value="<=">
|
<=< /option>
|
<option value="<">
|
<< /option>
|
<option value="<>">
|
<>
|
</option>
|
<option value="7">包含</option>
|
<option value="8">左包含</option>
|
<option value="9">右包含</option>
|
<option value="10">不包含</option>
|
</select>
|
</div>
|
<div class="layui-inline">
|
<input type="text" class="layui-input ForFilteringSchemes" value=""
|
name="ColContent2" id="ColContent2">
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<table class="" id="mainTable" lay-filter="mainTable"></table>
|
|
<div id="page" style="position:relative;bottom:0;"></div>
|
<script type="text/html" id="toolbarDemo">
|
<div class="layui-btn-container">
|
<button type="button" class="layui-btn layui-btn-sm" style="display:none;" id="btn-reload" lay-event="btn-reload"><i class="layui-icon layui-icon-refresh"></i>刷新</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display:none;" id="btn-view" lay-event="btn-view"><i class="layui-icon layui-icon-tips"></i>预览</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="display:none;" id="btn-print" lay-event="btn-print"><i class="layui-icon layui-icon-print"></i>打印</button>
|
<button type="button" class="layui-btn layui-btn-sm" style="" id="set_HideColumn" lay-event="set_HideColumn"><i class="layui-icon layui-icon-form"></i>列设置</button>
|
|
</div>
|
</script>
|
</form>
|
</div>
|
</div>
|
</div>
|
</div>
|
<script>
|
layui.config({
|
base: '../../../layuiadmin/' //静态资源所在路径
|
}).extend({
|
index: 'lib/index', //主入口模块
|
}).use(['index', 'form', 'table', 'element', 'laypage', 'laydate', 'soulTable'], function () {
|
var $ = layui.$
|
, admin = layui.admin
|
, layer = layui.layer
|
, table = layui.table
|
, form = layui.form
|
, element = layui.element
|
, laypage = layui.laypage
|
, laydate = layui.laydate
|
, util = layui.util
|
, soulTable = layui.soulTable
|
|
//查询条件
|
var HTranSlate = "zh-CN";
|
var sWhere = "";
|
var option = [];
|
var ins;
|
var titleData = ["单据ID", "HMaterID", "HDeptID", "HSupID", "HItemID", "hmainid", "hsubid", "HInterID", "HUnitID", "HAuxPropID", "HSTOCKORGID"];
|
var page = 1;
|
var size = 50;
|
|
// 全局变量:存储URL传入的参数
|
var urlParams = {
|
docNoParam: null,
|
orgIdParam: null,
|
cardNoParam: null, // 添加卡号参数
|
docNos: [],
|
baseWhere: ""
|
};
|
|
// 获取URL参数函数
|
function getUrlParams() {
|
var params = {};
|
var queryString = window.location.search.substring(1);
|
var pairs = queryString.split('&');
|
|
for (var i = 0; i < pairs.length; i++) {
|
var pair = pairs[i].split('=');
|
if (pair.length === 2) {
|
params[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
|
}
|
}
|
return params;
|
}
|
|
// 检查是否满足查询条件(必须有单据号和组织ID)
|
function hasRequiredQueryParams() {
|
var params = getUrlParams();
|
urlParams.docNoParam = params['docNo'] || params['billNo'] || params['sourceBillNo'];
|
urlParams.orgIdParam = params['org'] || params['organ'] || params['orgId'] || params['organization'];
|
urlParams.cardNoParam = params['cardNo'] || params['card'] || params['icCard'] || params['iccard']; // 获取卡号参数
|
|
return (urlParams.docNoParam && urlParams.docNoParam.trim() !== '') &&
|
(urlParams.orgIdParam && urlParams.orgIdParam.trim() !== '') &&
|
(urlParams.cardNoParam && urlParams.cardNoParam.trim() !== ''); // 要求必须有卡号
|
}
|
|
// 构建基础查询条件(基于URL参数)
|
function buildBaseWhere() {
|
if (!urlParams.docNoParam || !urlParams.orgIdParam) {
|
return "";
|
}
|
|
var baseWhere = "";
|
|
// 1. 处理组织ID
|
baseWhere += " and HSTOCKORGID = ''" + urlParams.orgIdParam.trim() + "''";
|
|
// 2. 处理单据号
|
if (urlParams.docNoParam) {
|
var docNos = urlParams.docNoParam.split('@');
|
var docNoCondition = "";
|
urlParams.docNos = [];
|
|
for (var i = 0; i < docNos.length; i++) {
|
if (docNos[i].trim() !== '') {
|
urlParams.docNos.push(docNos[i].trim());
|
if (docNoCondition !== "") {
|
docNoCondition += " or ";
|
}
|
docNoCondition += "源单单号 = ''" + docNos[i].trim() + "''";
|
}
|
}
|
|
if (docNoCondition !== "") {
|
baseWhere += " and (" + docNoCondition + ")";
|
}
|
}
|
|
urlParams.baseWhere = baseWhere;
|
return baseWhere;
|
}
|
// 显示基本按钮
|
$("#btn-reload").show();
|
$("#btn-view").show();
|
$("#btn-print").show();
|
|
// 禁用/启用过滤控件
|
function setFilterControlsState(enabled) {
|
if (enabled) {
|
// 启用过滤控件(除了组织下拉框和源单单号输入框)
|
$("#HBarCode").prop('disabled', false).removeClass('disabled-filter');
|
$("#HMaterName").prop('disabled', false).removeClass('disabled-filter');
|
$("#HMaterNumber").prop('disabled', false).removeClass('disabled-filter');
|
$("#HBeginDate").prop('disabled', false);
|
$("#HEndDate").prop('disabled', false);
|
$("#HInitTimeCycle").prop('disabled', false);
|
$("#ColName").prop('disabled', false);
|
$("#Comparator").prop('disabled', false);
|
$("#ColContent").prop('disabled', false);
|
$("#ColName1").prop('disabled', false);
|
$("#Comparator1").prop('disabled', false);
|
$("#ColContent1").prop('disabled', false);
|
$("#ColName2").prop('disabled', false);
|
$("#Comparator2").prop('disabled', false);
|
$("#ColContent2").prop('disabled', false);
|
$("#btnSearch").prop('disabled', false).removeClass('disabled-filter');
|
$("#btnReSearch").prop('disabled', false).removeClass('disabled-filter');
|
|
// 禁用组织下拉框和源单单号输入框
|
$("#HUSEORGID").prop('disabled', true).addClass('disabled-filter');
|
$("#HSourceBillNo").prop('readonly', true).addClass('disabled-filter');
|
} else {
|
// 禁用所有过滤控件
|
$(".ForFilteringSchemes").prop('disabled', true).addClass('disabled-filter');
|
$("#btnSearch").prop('disabled', true).addClass('disabled-filter');
|
$("#btnReSearch").prop('disabled', true).addClass('disabled-filter');
|
}
|
|
form.render('select');
|
}
|
|
Organ1();
|
var HModName = "Gy_BarCodeBillList";
|
set_ClearBill();
|
|
//#region 头工具栏事件
|
table.on('toolbar(mainTable)', function (obj) {
|
switch (obj.event) {
|
//列设置
|
case 'set_HideColumn': get_HideColumn();
|
break;
|
case 'btn-Delete':
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
if (checkStatus.data.length == 0 || checkStatus.data.length > 300) {
|
layer.msg(get_MessageError('[0000-1-014]请选择要删除的数据,且选中行数不能超过300行!', sessionStorage["HTranSlate"]));
|
return;
|
}
|
var mainid = "";
|
var BarCode = "";
|
for (i = 0; i < data.length; i++) {
|
mainid += data[i].hmainid.toString() + ",";
|
BarCode += data[i].条码编号.toString() + ",";
|
}
|
|
mainid = mainid.substring(0, mainid.length - 1)
|
BarCode = BarCode.substring(0, BarCode.length - 1)
|
|
var oData = JSON.stringify(mainid) + ";" + sessionStorage["HUserName"] + ";" + JSON.stringify(BarCode);
|
|
//逻辑删除方法
|
layer.confirm(get_MessageError("[0000-1-003]确认要删除吗,删除后不能恢复", sessionStorage["HTranSlate"]), { title: get_MessageError("[0000-2-009]删除确认", sessionStorage["HTranSlate"]) }, function (index) {
|
$.ajax({
|
type: "POST",
|
url: GetWEBURL() + "Gy_MaterialController/DeltetBarCodeBill", //方法所在页面和方法名
|
async: false,
|
data: { "oData": oData },
|
success: function (result) {
|
if (result.count == 1) {
|
layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
|
// 得到frame索引
|
var index = layer.getFrameIndex(window.name);
|
//关闭当前frame
|
layer.close(index);
|
//修改为功后刷新界面
|
window.location.reload();
|
});
|
|
} else {
|
layer.alert(get_MessageError(result.code + result.Message, sessionStorage["HTranSlate"]), { icon: 5 });
|
}
|
}, error: function () {
|
layer.alert(get_MessageError("[0000-1-002]接口请求失败!", sessionStorage["HTranSlate"]), { icon: 5 });
|
}
|
});
|
})
|
break;
|
case 'btn-print':
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
|
if (checkStatus.data.length > 0) {
|
var rows = '';
|
for (var i = 0; i < data.length; i++) {
|
rows += data[i].HItemID.toString() + ',';
|
}
|
rows = rows.substring(rows.length - 1, 0);
|
layer.open({
|
type: 2
|
, area: ['40%', '80%']
|
, title: '打印模版选择'
|
, shade: 0.6 //遮罩透明度
|
, maxmin: false //允许全屏最小化
|
, anim: 0 //0-6的动画形式,-1不开启
|
, content: ['../../BaseSet/SRM_OpenTmpList.html?linterid=' + rows + '&MyMsg=' + rows + '&Type=HGy_BarCodeBill', 'yes']
|
, resize: false
|
})
|
}
|
else {
|
layer.msg(get_MessageError('[0000-1-016]请选择数据打印!', sessionStorage["HTranSlate"]));
|
}
|
|
|
|
break;
|
case 'btn-print-zx':
|
PrintZX();
|
break;
|
//刷新
|
case 'btn-reload':
|
$("#HBarCode").val("");
|
$("#HMaterName").val("");
|
$("#HSourceBillNo").val("");
|
$("#HMaterNumber").val("");
|
sWhere = "";
|
get_DisplayPage(sWhere);
|
|
break;
|
//作废按钮
|
|
break;
|
//按钮设置
|
case 'set_HideButton':
|
var btns = document.getElementsByTagName("button"); //获取本页所有按钮对象
|
var HBillType = "条码主档";
|
get_HideButton(btns, HBillType, HModName, sessionStorage["HUserName"]);
|
break;
|
|
};
|
});
|
|
//#region 重置按钮 - 只重置筛选条件,不改变基础查询
|
form.on('submit(btnReSearch)', function (data) {
|
// 重置筛选条件
|
var HInitTimeCycle = $("#HInitTimeCycle").val() * 1;
|
$("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * HInitTimeCycle), "yyyy-MM-dd"));
|
$("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
|
$("#HBarCode").val("");
|
$("#HMaterName").val("");
|
$("#HMaterNumber").val("");
|
$("#ColContent").val("");
|
$("#ColName").val("0");
|
$("#Comparator").val("0");
|
$("#ColContent1").val("");
|
$("#ColName1").val("0");
|
$("#Comparator1").val("0");
|
$("#ColContent2").val("");
|
$("#ColName2").val("0");
|
$("#Comparator2").val("0");
|
form.render('select');
|
|
// 重置后重新查询基础数据
|
page = 1;
|
optionPage.curr = 1;
|
get_DisplayPage(urlParams.baseWhere);
|
});
|
|
//#region 查询按钮 - 在基础查询上添加筛选条件
|
form.on('submit(btnSearch)', function (data) {
|
page = 1;
|
optionPage.curr = 1;
|
get_FastQuery();
|
});
|
|
// 修改 set_ClearBill 函数
|
function set_ClearBill() {
|
set_InitGrid();
|
setSelect_HInitTimeCycle();
|
|
var HInitTimeCycle = $("#HInitTimeCycle").val() * 1;
|
if (HInitTimeCycle != -1) {
|
$('#HBeginDate').prop('disabled', true);
|
$('#HEndDate').prop('disabled', true);
|
} else {
|
$('#HBeginDate').prop('disabled', false);
|
$('#HEndDate').prop('disabled', false);
|
}
|
|
$("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * HInitTimeCycle), "yyyy-MM-dd"));
|
$("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
|
|
Organ1();
|
ColFilter();
|
|
// 延迟执行URL参数检查
|
setTimeout(function () {
|
handleUrlParamsAndQuery();
|
}, 300);
|
}
|
|
function handleUrlParamsAndQuery() {
|
// 检查是否满足查询条件
|
if (!hasRequiredQueryParams()) {
|
console.log('未提供必需的查询参数(单据号、组织ID和卡号),页面保持空白');
|
layer.msg('请通过URL提供单据号、组织ID和卡号进行查询', { time: 3000, icon: 2 });
|
// 初始化空表格
|
get_DisplayPageListStruct(" and 1 = 0");
|
// 禁用所有过滤控件
|
setFilterControlsState(false);
|
return;
|
}
|
|
// 满足条件,首先使用卡号登录获取用户信息
|
if (urlParams.cardNoParam) {
|
|
// 调用loginByICCard方法,这里需要传递组织ID作为参数
|
var loginSuccess = loginByICCard(urlParams.cardNoParam, urlParams.orgIdParam);
|
|
if (!loginSuccess) {
|
layer.msg('卡号登录失败,请检查卡号或联系管理员', { time: 3000, icon: 2 });
|
// 初始化空表格
|
get_DisplayPageListStruct(" and 1 = 0");
|
// 禁用所有过滤控件
|
setFilterControlsState(false);
|
return;
|
}
|
|
}
|
|
// 构建基础查询条件
|
var baseWhere = buildBaseWhere();
|
if (baseWhere !== "") {
|
console.log('执行基础查询:', baseWhere);
|
|
// 设置UI显示
|
$("#HUSEORGID").val(urlParams.orgIdParam.trim());
|
if (urlParams.docNos.length > 0) {
|
$("#HSourceBillNo").val(urlParams.docNos.join(', '));
|
}
|
|
// 显示查询来源
|
var sourceInfo = "查询来源: 组织=" + urlParams.orgIdParam + ", 单据数=" + urlParams.docNos.length + ", 卡号=" + urlParams.cardNoParam;
|
$("#HFilterScheme_Now").text(sourceInfo);
|
|
// 启用过滤控件(除了组织下拉框和源单单号输入框)
|
setFilterControlsState(true);
|
|
// 执行查询
|
page = 1;
|
optionPage.curr = 1;
|
get_DisplayPage(baseWhere);
|
}
|
}
|
|
function set_InitGrid() {
|
option = {
|
elem: '#mainTable'
|
, toolbar: '#toolbarDemo'
|
, height: 'full-150'
|
, page: false
|
, limit: 50
|
, done: function (res, curr, count) {
|
soulTable.render(this);
|
}
|
, cols: [[
|
{ type: 'checkbox', fixed: 'left' }
|
, { field: 'hmainid', title: '单据ID', hide: true, sort: true }
|
, { field: '条码类型', title: '条码类型', width: 160, sort: true }
|
, { field: '条码编号', title: '条码编号', width: 160, sort: true }
|
, { field: 'HMaterID', title: 'HMaterID', width: 160, hide: true, sort: true }
|
, { field: '物料代码', title: '物料代码', width: 200, sort: true }
|
, { field: '物料名称', title: '物料名称', width: 250, sort: true }
|
, { field: '规格型号', title: '规格型号', width: 250, sort: true }
|
, { field: '计量单位代码', title: '计量单位代码', width: 200, sort: true }
|
, { field: '计量单位', title: '计量单位', width: 200, sort: true }
|
, { field: '炉号', title: '炉号', width: 200, sort: true }
|
, { field: '钢卷号', title: '钢卷号', width: 200, sort: true }
|
, { field: '条码状态', title: '条码状态', width: 200, sort: true }
|
, { field: '厂商', title: '厂商', width: 200, sort: true }
|
, { field: '捆包号', title: '捆包号', width: 200, sort: true }
|
, { field: '生产日期', title: '生产日期', width: 200, templet: "<div>{{d.生产日期 ==null ?'':layui.util.toDateString(d.生产日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
|
, { field: '保质期至', title: '保质期至', width: 200, templet: "<div>{{d.保质期至 ==null ?'':layui.util.toDateString(d.保质期至, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
|
, { field: 'HAuxPropID', title: 'HAuxPropID', width: 200, sort: true }
|
, { field: '辅助属性代码', title: '辅助属性代码', width: 160, sort: true }
|
, { field: '辅助属性', title: '辅助属性', width: 160, sort: true }
|
, { field: '批号', title: '批号', width: 160, sort: true }
|
, { field: '数量', title: '数量', width: 200, sort: true, totalRow: true }
|
, { field: '计划跟踪号', title: '计划跟踪号', width: 200, sort: true }
|
, { field: '源单单号', title: '源单单号', width: 200, sort: true }
|
, { field: 'HSupID', title: 'HSupID', width: 200, hide: true, sort: true }
|
, { field: '供应商代码', title: '供应商代码', width: 200, sort: true }
|
, { field: '供应商', title: '供应商', width: 200, sort: true }
|
, { field: '进料日期', title: '进料日期', width: 200, sort: true }
|
, { field: '进料日期周', title: '进料日期周', width: 115, sort: true }
|
, { field: '客户型号', title: '客户型号', width: 115, sort: true }
|
, { field: '往来单位', title: '往来单位', width: 200, sort: true }
|
, { field: 'HDeptID', title: 'HDeptID', width: 200, hide: true, sort: true }
|
, { field: '车间', title: '车间', width: 115, sort: true }
|
, { field: '计划完工日期', title: '计划完工日期', width: 200, sort: true }
|
, { field: '拖号', title: '拖号', width: 200, sort: true }
|
, { field: '总托数', title: '总托数', width: 200, sort: true, totalRow: true }
|
, { field: '备注', title: '备注', width: 200, sort: true }
|
, { field: '制作人', title: '制作人', width: 115, sort: true }
|
, { field: '日期', title: '日期', width: 200, templet: "<div>{{d.日期 ==null ?'':layui.util.toDateString(d.日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
|
, { field: '打印次数', title: '打印次数', width: 200, sort: true }
|
, { field: '作废标记', title: '作废标记', width: 200, sort: true }
|
, { field: '作废人', title: '作废人', width: 115, sort: true }
|
, { field: '生产入库日期', title: '生产入库日期', width: 200, templet: "<div>{{d.生产入库日期 ==null ?'':layui.util.toDateString(d.生产入库日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
|
, { field: '销售出库日期', title: '销售出库日期', width: 200, templet: "<div>{{d.销售出库日期 ==null ?'':layui.util.toDateString(d.销售出库日期, 'yyyy-MM-dd HH:mm:ss')}}</div>", sort: true }
|
]]
|
};
|
optionPage = {
|
elem: 'page',
|
count: 0,
|
limit: 50,
|
limits: [50, 500, 5000, 50000],
|
layout: ['count', 'prev', 'page', 'next', 'limit', 'skip'],
|
jump: function (obj, first) {
|
if (!first) {
|
page = obj.curr;
|
size = obj.limit;
|
get_FastQuery();
|
}
|
}
|
}
|
laypage.render(optionPage);
|
}
|
|
function loginByICCard(HBarCode, HOrgID) {
|
var login_result = false;
|
var index = layer.load();
|
|
// 获取默认组织名称
|
$.ajax({
|
type: "get",
|
async: false,
|
url: GetWEBURL() + "/Web/GetOrganizations",
|
success: function (result) {
|
if (result.count == 1) {
|
var data = result.data;
|
for (let element of data) {
|
if (element.ID == HOrgID) {
|
sessionStorage["Organization"] = element.Name;
|
}
|
}
|
}
|
},
|
error: function (err) {
|
login_result = false;
|
layer.close(index);
|
layer.msg("获取组织信息失败!" + err, { icon: 5 });
|
return login_result;
|
}
|
});
|
|
// 获取登录信息
|
$.ajax({
|
url: GetWEBURL() + "/Web/GetUserByICCard",
|
type: "GET",
|
async: false,
|
data: { "HBarCode": HBarCode },
|
success: function (result) {
|
if (result.count == 1) {
|
layer.close(index);
|
// 缓存用户信息
|
sessionStorage["HCloudUserName"] = result.data[0].HCloudUserName; // 金蝶云账号
|
sessionStorage["HCloudUserPsd"] = result.data[0].HCloudUserPsd;
|
sessionStorage["HMaker"] = result.data[0].Czymc;
|
sessionStorage["HUserName"] = result.data[0].Czymc;
|
sessionStorage["HBillerID"] = result.data[0].HK3UserID;
|
sessionStorage["SourceFlag"] = false;
|
sessionStorage["HKeeperID"] = result.data[0].HKeeperID;
|
sessionStorage["HKeeper"] = result.data[0].HKeeper;
|
sessionStorage["HSecManagerID"] = result.data[0].HSecManagerID;
|
sessionStorage["HSecManager"] = result.data[0].HSecManager;
|
sessionStorage["HSellManID"] = result.data[0].HSellManID;
|
sessionStorage["HSellMan"] = result.data[0].HSellMan;
|
sessionStorage["HDeptID"] = result.data[0].HDeptID;
|
sessionStorage["HDept"] = result.data[0].HDept;
|
sessionStorage["HWHID"] = result.data[0].HWhID;
|
sessionStorage["HWHName"] = result.data[0].HWHName;
|
sessionStorage["HSPID"] = result.data[0].HSPID;
|
sessionStorage["HSPName"] = result.data[0].HSPName;
|
sessionStorage["HSupID"] = result.data[0].HSupID;
|
sessionStorage["HSupName"] = result.data[0].HSupName;
|
sessionStorage["Czmm"] = result.data[0].Czmm;
|
sessionStorage["Czybm"] = result.data[0].Czybm;
|
sessionStorage["HEmpID"] = result.data[0].HEmpID;
|
sessionStorage["HEmpNumber"] = result.data[0].HEmpNumber;
|
sessionStorage["HEmpName"] = result.data[0].HEmpName;
|
sessionStorage["HGroup"] = result.data[0].HGroup;
|
sessionStorage["HGroupID"] = result.data[0].HGroupID;
|
sessionStorage["HProc"] = result.data[0].HProc;
|
sessionStorage["HProcNo"] = result.data[0].HProcNo;
|
sessionStorage["HSource"] = result.data[0].HSource;
|
sessionStorage["HSourceID"] = result.data[0].HSourceID;
|
sessionStorage["HWorkCenter"] = result.data[0].HWorkCenter;
|
sessionStorage["HWorkCenterID"] = result.data[0].HWorkCenterID;
|
sessionStorage["HProcName"] = result.data[0].HProcName;
|
sessionStorage["HProcID"] = result.data[0].HProcID;
|
sessionStorage["HCheckEmpID"] = result.data[0].HCheckEmpID;
|
sessionStorage["HCheckEmpName"] = result.data[0].HCheckEmpName;
|
sessionStorage["login"] = "login";
|
sessionStorage["OrganizationID"] = HOrgID;
|
sessionStorage["HTranSlate"] = HTranSlate || "zh-CN";
|
|
login_result = true;
|
|
} else {
|
layer.close(index);
|
login_result = false;
|
layer.msg("卡号登录失败!" + result.Message, { icon: 5 });
|
}
|
},
|
error: function (err) {
|
layer.close(index);
|
login_result = false;
|
layer.msg("接口请求失败!" + err, { icon: 5 });
|
}
|
});
|
|
return login_result;
|
}
|
// 修改 get_FastQuery 函数,在基础查询上添加筛选条件
|
function get_FastQuery() {
|
// 如果没有基础查询条件,不执行
|
if (!urlParams.baseWhere) {
|
layer.msg('请先通过URL提供单据号和组织ID', { time: 3000, icon: 2 });
|
return;
|
}
|
|
|
|
//#endregion
|
// 获取筛选条件
|
var HBeginDate = $("#HBeginDate").val();
|
var HEndDate = $("#HEndDate").val();
|
var HBarCode = $("#HBarCode").val();
|
var HMaterName = $("#HMaterName").val();
|
var HMaterNumber = $("#HMaterNumber").val();
|
var ColName = $("#ColName").val();
|
var Comparator = $("#Comparator").val();
|
var ColContent = $("#ColContent").val();
|
var ColName1 = $("#ColName1").val();
|
var Comparator1 = $("#Comparator1").val();
|
var ColContent1 = $("#ColContent1").val();
|
var ColName2 = $("#ColName2").val();
|
var Comparator2 = $("#Comparator2").val();
|
var ColContent2 = $("#ColContent2").val();
|
|
// 从基础查询条件开始
|
var sWhere = urlParams.baseWhere;
|
|
// 添加日期范围筛选
|
if (HBeginDate) {
|
sWhere += " and CONVERT(varchar(100), 日期, 23) >= ''" + HBeginDate + "''";
|
}
|
if (HEndDate) {
|
sWhere += " and CONVERT(varchar(100), 日期, 23) <= ''" + HEndDate + "''";
|
}
|
|
// 添加其他条件筛选
|
if (HBarCode) {
|
sWhere += " and 条码编号 like ''%" + HBarCode + "%''";
|
}
|
if (HMaterName) {
|
sWhere += " and 物料名称 like ''%" + HMaterName + "%''";
|
}
|
if (HMaterNumber) {
|
sWhere += " and 物料代码 like ''%" + HMaterNumber + "%''";
|
}
|
|
// 添加自定义过滤器
|
if (ColName != 0 && Comparator != 0 && ColContent) {
|
var com = getComparatorSql(Comparator, ColContent);
|
sWhere += " and " + ColName + " " + com;
|
}
|
|
if (ColName1 != 0 && Comparator1 != 0 && ColContent1) {
|
var com1 = getComparatorSql(Comparator1, ColContent1);
|
sWhere += " and " + ColName1 + " " + com1;
|
}
|
|
if (ColName2 != 0 && Comparator2 != 0 && ColContent2) {
|
var com2 = getComparatorSql(Comparator2, ColContent2);
|
sWhere += " and " + ColName2 + " " + com2;
|
}
|
|
console.log('完整查询条件:', sWhere);
|
get_DisplayPage(sWhere);
|
}
|
|
function getComparatorSql(comparator, content) {
|
switch (comparator) {
|
case "7": return "like ''%" + content + "%''";
|
case "8": return "like ''%" + content + "''";
|
case "9": return "like ''" + content + "%''";
|
case "10": return "not like ''%" + content + "%''";
|
default: return comparator + " ''" + content + "''";
|
}
|
}
|
|
//#region 分页查询
|
function get_DisplayPage(sWhere) {
|
var wait = layer.load();
|
var ajaxLoad = layer.load();
|
$.ajax({
|
url: GetWEBURL() + 'Gy_BarCodeBillList/page',
|
type: "GET",
|
async: false,
|
data: { "sWhere": sWhere, "user": sessionStorage["HUserName"], "page": page, "size": size },
|
success: function (data1) {
|
option.limit = size;
|
if (data1.code == 1) {
|
optionPage.count = data1.count;
|
var data = [];
|
var col = [];
|
for (var key in data1.list) {
|
data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
|
}
|
col.push({ type: 'checkbox', fixed: 'left' });
|
for (var i = 0; i < data.length; i++) {
|
if ($.inArray(data[i].name, titleData) > -1) {
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true });
|
}
|
else {
|
switch (data[i].Type) {
|
case 'DateTime':
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 120 });
|
break;
|
default:
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 120 });
|
}
|
}
|
}
|
|
option.cols = [col];
|
option.data = data1.data;
|
ins = table.render(option);
|
laypage.render(optionPage);
|
layer.close(ajaxLoad);
|
} else {
|
option.data = [[]]
|
table.render(option);
|
layer.close(ajaxLoad);
|
}
|
}, error: function () {
|
layer.close(ajaxLoad);
|
layer.alert(get_MessageError("[0000-1-002]接口请求失败!", sessionStorage["HTranSlate"]), { icon: 5 });
|
}, complete: function () {
|
DisPlay_HideColumn();
|
}
|
});
|
}
|
//#endregion
|
//隐藏列设置
|
function get_HideColumn() {
|
var colName = "";
|
for (var i = 1; i < option.cols[0].length; i++) {
|
colName += option.cols[0][i]["field"] + ",";
|
}
|
|
colName = encodeURI(colName.substring(0, colName.length - 1));//对 URI 进行编码
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "隐藏列设置" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["50%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../基础资料/隐藏列设置/Gy_GridView_Hide_New.html?HModName=' + HModName + '&colName=' + colName, "yes"]
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//刷新表格数据
|
DisPlay_HideColumn();
|
//更新表格缓存的数据
|
layer.close(index);//关闭弹窗
|
}
|
})
|
}
|
|
// 初始化空表格结构(不查询数据)
|
function get_DisplayPageListStruct(sWhere) {
|
var ajaxLoad = layer.load();
|
$.ajax({
|
url: GetWEBURL() + 'Gy_BarCodeBillList/page',
|
type: "GET",
|
async: false,
|
data: { "sWhere": sWhere, "user": sessionStorage["HUserName"], "page": 1, "size": 50 },
|
success: function (data1) {
|
option.limit = 50;
|
if (data1.code == 1) {
|
optionPage.count = 0;
|
var data = [];
|
var col = [];
|
for (var key in data1.list) {
|
data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
|
}
|
col.push({ type: 'checkbox', fixed: 'left' });
|
for (var i = 0; i < data.length; i++) {
|
if ($.inArray(data[i].name, titleData) > -1) {
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true });
|
}
|
else {
|
switch (data[i].Type) {
|
case 'DateTime':
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 120 });
|
break;
|
default:
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 120 });
|
}
|
}
|
}
|
|
option.cols = [col];
|
option.data = [];
|
ins = table.render(option);
|
laypage.render(optionPage);
|
layer.close(ajaxLoad);
|
} else {
|
option.data = [[]]
|
table.render(option);
|
layer.close(ajaxLoad);
|
}
|
}, error: function () {
|
layer.close(ajaxLoad);
|
}
|
});
|
}
|
|
function DisPlay_HideColumn() {
|
|
|
$.ajax({
|
url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
|
type: "GET",
|
async: false,
|
data: {
|
"HModName": HModName,
|
"user": sessionStorage["HUserName"]
|
},
|
success: function (data1) {
|
// 检查返回数据是否有效
|
if (data1 && data1.data && data1.data.length > 0) {
|
var dataCol = [];
|
var newCols = [[]];
|
|
// 放入第一个checkbox列
|
if (option.cols && option.cols[0] && option.cols[0][0]) {
|
newCols[0].push(option.cols[0][0]);
|
}
|
|
// 确保有HGridString数据
|
if (data1.data[0].HGridString) {
|
dataCol = data1.data[0].HGridString.split(',');
|
}
|
|
// 列设置列数与页面列数是否一致
|
if (dataCol.length > 0 && option.cols && option.cols[0] &&
|
dataCol.length == option.cols[0].length - 1) {
|
|
// 遍历寻找列设置对应列按顺序插入
|
for (var j = 0; j < option.cols[0].length - 1; j++) {
|
for (var i = 0; i < option.cols[0].length - 1; i++) {
|
if (dataCol[j]) {
|
var dataCols = dataCol[j].split('|');
|
// 选择与datacols相应列进行修改
|
if (option.cols[0][i + 1] &&
|
option.cols[0][i + 1]["field"] == dataCols[5]) {
|
|
// 隐藏列
|
if (dataCols[1] == 1) {
|
option.cols[0][i + 1]["hide"] = true;
|
}
|
|
// 设置列宽
|
if (dataCols[3] > 0) {
|
option.cols[0][i + 1]["width"] = parseInt(dataCols[3]);
|
}
|
|
// 设置内容字体大小
|
if (data1.data[0].HFontSize != 0) {
|
option.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;";
|
} else {
|
option.cols[0][i + 1]["style"] = "font-size:100%";
|
}
|
|
// 显示列
|
if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
|
option.cols[0][i + 1]["hide"] = false;
|
}
|
|
// 统计列
|
if (dataCols[6] == 1) {
|
option.cols[0][i + 1]["totalRow"] = true;
|
}
|
|
// 字体所在位置(左 居中 右)
|
switch (dataCols[2]) {
|
case "L":
|
option.cols[0][i + 1]["align"] = "left";
|
break;
|
case "M":
|
option.cols[0][i + 1]["align"] = "center";
|
break;
|
case "R":
|
option.cols[0][i + 1]["align"] = "right";
|
break;
|
}
|
|
// 设置表格title属性显示别名
|
if (dataCols[4] && dataCols[4] != "") {
|
option.cols[0][i + 1]["title"] = dataCols[4];
|
}
|
|
newCols[0].push(option.cols[0][i + 1]);
|
}
|
}
|
}
|
}
|
|
// 遍历循环后判断对应列数是否一致
|
if (dataCol.length == newCols[0].length - 1) {
|
option.cols = newCols;
|
|
// 取消冻结列
|
for (var i = 1; i < option.cols[0].length - 1; i++) {
|
if (option.cols[0][i]["fixed"] != null) {
|
option.cols[0][i]["fixed"] = null;
|
} else {
|
break;
|
}
|
}
|
|
// 冻结列
|
if (data1.data[0].HFixCols != 0) {
|
for (var i = 0; i < data1.data[0].HFixCols; i++) {
|
if ($.inArray(option.cols[0][i + 1]["title"], titleData) != -1) {
|
data1.data[0].HFixCols += 1;
|
}
|
if (option.cols[0][i + 1]) {
|
option.cols[0][i + 1]["fixed"] = "left";
|
}
|
}
|
}
|
}
|
}
|
|
table.render(option);
|
} else {
|
// 没有列设置数据,正常渲染表格
|
console.log('未找到列设置数据,使用默认表格设置');
|
if (option && option.cols) {
|
table.render(option);
|
}
|
}
|
|
// 刷新按钮显示
|
var btns = document.getElementsByTagName("button");
|
var HBillType = "条码主档";
|
|
// 安全地显示按钮
|
try {
|
$("#btn-reload").show();
|
$("#btn-view").show();
|
$("#btn-print").show();
|
|
// 检查Display_HideButton函数是否存在
|
if (typeof Display_HideButton === 'function') {
|
Display_HideButton(btns, HBillType, HModName, sessionStorage["HUserName"]);
|
} else {
|
console.warn('Display_HideButton函数未定义');
|
}
|
} catch (e) {
|
console.error('显示按钮时出错:', e);
|
}
|
},
|
error: function (xhr, status, error) {
|
console.error('获取列设置失败:', error);
|
console.log('请求URL:', GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList');
|
console.log('请求参数:', { "HModName": HModName, "user": sessionStorage["HUserName"] });
|
|
// 即使出错也尝试渲染表格
|
try {
|
if (option && option.cols) {
|
table.render(option);
|
|
// 显示基本按钮
|
$("#btn-reload").show();
|
$("#btn-view").show();
|
$("#btn-print").show();
|
}
|
} catch (e) {
|
console.error('渲染表格失败:', e);
|
}
|
|
|
}
|
});
|
}
|
|
|
function Organ1() {
|
$.ajax({
|
type: "get",
|
async: false,
|
url: GetWEBURL() + "/Web/GetOrganizations",
|
success: function (result) {
|
if (result.count == 1) {
|
var data = result.data;
|
var options = '<option value="">请选择组织</option>';
|
for (var i = 0; i < data.length; i++) {
|
options += '<option value="' + data[i].Name + '">' + data[i].Name + '</option>';
|
}
|
$("#HUSEORGID").html(options);
|
layui.form.render('select');
|
}
|
layer.closeAll("loading");
|
},
|
error: function () {
|
console.error("获取组织信息失败");
|
}
|
});
|
}
|
|
function setSelect_HInitTimeCycle() {
|
var valueList = [0, 1, 2, 3, 4, 5, 6, 29];
|
var titleList = ["今天", "近两天", "近三天", "近四天", "近五天", "近六天", "近七天", "近30天"];
|
var HInitTimeCycle_ArrayList = '<option value="-1" selected="selected" >任意间隔</option>';
|
for (var i = 0; i < valueList.length; i++) {
|
HInitTimeCycle_ArrayList += '<option style="color:blue;" value="' + valueList[i] + '">' + titleList[i] + '</option>';
|
}
|
$("#HInitTimeCycle").empty();
|
$("#HInitTimeCycle").append(HInitTimeCycle_ArrayList);
|
form.render('select');
|
$("#HInitTimeCycle").val("29");
|
}
|
|
table.on('row(mainTable)', function (obj) {
|
var flag = !obj.tr.find(':checkbox:first').prop('checked');
|
obj.tr.find(':checkbox').prop('checked', flag);
|
if (flag) {
|
obj.tr.find('.layui-form-checkbox').addClass('layui-form-checked');
|
$(obj.tr.selector).attr({ "style": "background:#ceedfa;color:black" });
|
} else {
|
obj.tr.find('.layui-form-checkbox').removeClass('layui-form-checked');
|
$(obj.tr.selector).attr({ "style": "background:" });
|
}
|
layui.each(table.cache.mainTable, function (i, l) {
|
if (obj.tr.index() == l.LAY_TABLE_INDEX) {
|
l.LAY_CHECKED = flag;
|
}
|
});
|
})
|
|
function ColFilter() {
|
var Organization = '<option value="0" selected="selected" ></option>';
|
for (var i = 1; i < option.cols[0].length; i++) {
|
if (option.cols[0][i].hide != true) {
|
Organization += '<option style="color:blue;" value="' + option.cols[0][i].field + '">' + option.cols[0][i].title + '</option>';
|
}
|
}
|
$("#ColName").empty();
|
$("#ColName").append(Organization);
|
$("#ColName1").empty();
|
$("#ColName1").append(Organization);
|
$("#ColName2").empty();
|
$("#ColName2").append(Organization);
|
form.render('select');
|
}
|
});
|
</script>
|
</body>
|
</html>
|