You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

549 lines
24 KiB

<#import "../master.ftl" as master>
<@master.layout>
<style>
#fm label {
width: 150px;
}
.page-header {
margin: 20px 0 -10px;
}
.customer-label .textbox-label{
width: 35%;
margin-left: 12%;
}
.customer-label .easyui-fluid{
width: 75% !important;
margin-left: 12%;
}
.panel-header{
width: 870px;
}
.panel{
width: 882px;
}
.input-div {
width: 100%;
}
</style>
<div class="page-header">
<h3>Part Info</h3>
</div>
<!-- 页面表单 -->
<table id="dg" class="easyui-datagrid" style="width:100%; height:400px;display: none;"
data-options="pagination: true, pageSize: 20, singleSelect:true, showFooter: true,
onSelect:onTableRowSelect, url:'/basic/part/getPartList', method:'POST',
toolbar:'#tb'">
<thead>
<tr>
<th data-options="field:'partNo',width:120,editor:'textbox'">Part No</th>
<th data-options="field:'partDesc',width:150">Part Description</th>
<th data-options="field:'customerPartNo',width:120">Customer Part No</th>
<th data-options="field:'customerPartDesc',width:150">客户料号描述</th>
<th data-options="field:'revNo',width:60">物料版本</th>
<th data-options="field:'customerDrawing',width:120">customer drawing</th>
<th data-options="field:'eeeeCode',width:80">EEEEcode</th>
<th data-options="field:'apn',width:100">APN</th>
<th data-options="field:'spec',width:100">SPEC</th>
<th data-options="field:'stage',width:80">stage</th>
<th data-options="field:'config',width:80">config</th>
<th data-options="field:'cross',width:60">码包排位</th>
<th data-options="field:'primaryMaterialNo',width:120">主材料号</th>
<th data-options="field:'packageQty',width:70,align:'right'">标准包数量</th>
<th data-options="field:'boxQty',width:70,align:'right'">标准箱数量</th>
<th data-options="field:'projectCode',width:120">project code</th>
<th data-options="field:'labelType',width:60">标签类型</th>
<th data-options="field:'codeType',width:60">码包类型</th>
<th data-options="field:'productStyle',width:60">款式</th>
<th data-options="field:'bu',width:60">bu</th>
<th data-options="field:'checkProductDateFlag',width:120">允许不同生产日期装箱</th>
<th data-options="field:'serialApn',width:70">serialApn</th>
<th data-options="field:'createBy',width:80">Created By</th>
<th data-options="field:'createDate',width:125,align:'left',formatter:formatDateTime">Created Time</th>
<th data-options="field:'updateBy',width:80">Updated By</th>
<th data-options="field:'updateDate',width:125,align:'left',formatter:formatDateTime">修改日期</th>
</tr>
</thead>
</table>
<!-- 页面的查询框 -->
<div id="tb" style="padding:10px 5px;display: none;">
<div>
料号: <input class="easyui-textbox" id="searchPartNo" style="width:110px">
创建日期: <input class="easyui-datebox" id="createdDateFrom" style="width:100px">
至: <input class="easyui-datebox" id="createdDateTo" style="width:100px">
<a href="#nowhere" id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Query</a>
&nbsp;&nbsp;&nbsp;
<a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newProductPartModal()">New</a>
<a href="javascript:void(0)" id="tbEdit" data-options="disabled:true" class="easyui-linkbutton" iconCls="icon-edit" onclick="editProductPartModal()">Edit</a>
<a href="javascript:void(0)" id="tbMaterial" data-options="disabled:true" class="easyui-linkbutton" iconCls="icon-edit" onclick="editPartMaterialModal()">材料跟踪维护</a>
<a href="javascript:void(0)" id="tbDel" data-options="disabled:true" class="easyui-linkbutton" onclick="deletePart()">Delete</a>
</div>
</div>
<!-- 新增和修改的modal -->
<div id="dlg" class="easyui-dialog" style="width:870px; display: none;"
closed="true" buttons="#dlg-buttons">
<form id="fm" method="post" novalidate style="margin:0;padding:20px 20px; height: 425px;">
<div style="margin-bottom:8px; display: none;" >
<input id="addId" name="addId" class="easyui-textbox" style="display: none;" value="0">
<input id="createBy" name="createBy" class="easyui-textbox" style="display: none;" value="">
<input id="updateBy" name="updateBy" class="easyui-textbox" style="display: none;" value="">
</div>
<div style="width: 400px;">
<div class="input-div" style="margin-bottom:8px">
<input id="partNo" name="partNo" class="easyui-textbox" required="true" label="物料编码:" style="width:98%">
</div>
<div class="input-div" style="margin-bottom:8px">
<input id="partDesc" name="partDesc" class="easyui-textbox" required="true" label="物料描述:" style="width:98%">
</div>
<div class="input-div" style="margin-bottom:8px">
<input id="customerPartNo" name="customerPartNo" class="easyui-textbox" required="true" label="客户料号:" style="width:98%">
</div>
<div class="input-div" style="margin-bottom:8px">
<input id="customerPartDesc" name="customerPartDesc" class="easyui-textbox" required="true" label="客户料号描述:" style="width:98%">
</div>
<div class="input-div" style="margin-bottom:8px">
<input id="revNo" name="revNo" class="easyui-textbox" required="true" label="物料版本:" style="width:98%">
</div>
<div class="input-div" style="margin-bottom:8px">
<input id="customerDrawing" name="customerDrawing" class="easyui-textbox" required="true" label="customer drawing:" style="width:98%">
</div>
<div class="input-div" style="margin-bottom:8px">
<input id="apn" name="apn" class="easyui-textbox" required="true" label="APN:" style="width:98%">
</div>
<div class="input-div" style="margin-bottom:8px">
<input id="eeeeCode" name="eeeeCode" class="easyui-textbox" required="true" label="EEEEcode:" style="width:98%" data-options="buttonText: 'getCode',onClickButton:getCode">
</div>
<div class="input-div" style="margin-bottom:8px">
<input id="spec" name="spec" class="easyui-textbox" required="true" label="SPEC:" style="width:98%">
</div>
<div class="input-div" style="margin-bottom:8px">
<input id="bu" name="bu" class="easyui-textbox" label="bu:" style="width:98%">
</div>
<div class="input-div" style="margin-bottom:8px">
<select id="code_type" class="easyui-combobox" name="codeType" required="true" label="码包类型:" style="width:98%">
<option value="2024" selected>2024</option>
<option value="2025">2025</option>
</select>
</div>
<div class="input-div" style="margin-bottom:8px">
<input id=product_style" name="productStyle" class="easyui-textbox" required="true" label="款式:" style="width:98%">
</div>
</div>
<div style=" margin-left: 430px;width: 400px; margin-top: -408px;">
<div class="input-div" style="margin-bottom:8px">
<input id="stage" name="stage" class="easyui-textbox" required="true" label="stage:" style="width:98%">
</div>
<div class="input-div" style="margin-bottom:8px">
<input id="packageQty" name="packageQty" class="easyui-textbox" type="number" required="true" label="标准包数量:" style="width:98%">
</div>
<div class="input-div" style="margin-bottom:8px">
<input id="boxQty" name="boxQty" class="easyui-textbox" type="number" required="true" label="标准箱数量:" style="width:98%">
</div>
<div class="input-div" style="margin-bottom:8px">
<input id="projectCode" name="projectCode" class="easyui-textbox" required="true" label="project code:" style="width:98%">
</div>
<div class="input-div" style="margin-bottom:8px">
<input id="config" name="config" class="easyui-textbox" required="true" label="config:" style="width:98%">
</div>
<div class="input-div" style="margin-bottom:8px">
<input id="primaryMaterialNo" name="primaryMaterialNo" class="easyui-textbox" required="true" label="主材料号:" style="width:98%">
</div>
<div class="input-div" style="margin-bottom:8px">
<select id="cross" name="cross" required="true" class="easyui-combobox" label="码包排位:" style="width:98%">
</select>
</div>
<div class="input-div" style="margin-bottom:8px">
<select id="column_type" name="columnType" required="true" class="easyui-combobox" label="分切排位:" style="width:98%">
</select>
</div>
<div class="input-div" style="margin-bottom:8px">
<select id="labelType" class="easyui-combobox" name="labelType" required="true" label="标签类型:" style="width:98%">
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="D">D</option>
</select>
</div>
<div style="margin-bottom:8px">
<select id="checkProductDateFlag" class="easyui-combobox" name="checkProductDateFlag" required="true" label="允许不同生产日期装箱:" style="width:98%">
<option value="Y">Y</option>
<option value="N">N</option>
</select>
</div>
<div style="margin-bottom:8px">
<input id="serialApn" name="serialApn" class="easyui-textbox" label="serialApn:" style="width:98%">
</div>
</div>
</form>
</div>
<div id="dlg-buttons" style="display: none; text-align: center;width: 870px;">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveProductPart()" style="width:90px">Save</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">取消</a>
</div>
<!-- 材料跟踪的modal -->
<div id="material_dlg" class="easyui-dialog" style="width: 420px; display: none;"
closed="true" buttons="#material_dlg-buttons">
<form id="material_fm" method="post" class="customer-label" novalidate style="margin:0; height: 265px;">
<div style="">
<div class="input-div" style="margin-bottom:10px">
<input id="show_part_no" name="partNo" class="easyui-textbox" required="true" label="物料编码:" style="width:100%">
</div>
<div class="input-div" style="margin-bottom:10px">
<input id="show_part_desc" name="partDesc" class="easyui-textbox" required="true" label="物料描述:" style="width:100%">
</div>
<div class="input-div" style="margin-bottom:10px">
<input id="indigo_materials" name="indigoMaterials" class="easyui-textbox" label="Indigo Materials:" style="width:100%">
</div>
<div class="input-div" style="margin-bottom:10px">
<input id="abg_materials" name="abgMaterials" class="easyui-textbox" label="ABG Materials:" style="width:75%">
</div>
</div>
</form>
</div>
<div id="material_dlg-buttons" style="display: none; text-align: center;width: 870px;">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="savePartMaterials()" style="width:90px">Save</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#material_dlg').dialog('close')" style="width:90px">取消</a>
</div>
<script>
//临时参数
var currentRow;//当前行
//控制页面的高度
$(window).resize(function () {
$("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 30});
});
//初始化页面的高度
$(function () {
$(window).resize();
//加载数据
initColumnQty();
initColumnType(null);
});
//加载排位数量
function initColumnQty(){
$.ajax({
url: "/base/getPartColumnQtyList",
type:"POST",
data:{},// 你的formid
dataType:"JSON",
success: function (data) {
let currentColumnQtyRows = [];
let tempRows = data.rows;
//初始化
for(var i = 0; i< tempRows.length; i++){
currentColumnQtyRows.push({value:tempRows[i], text:tempRows[i]});
}
$("#cross").combobox('loadData', currentColumnQtyRows);
}
})
}
//添加change事件
$("#cross").combobox({
onChange: function(newValue, oldValue){
//let text = $("#cross").combobox('getText');
initColumnType(newValue);
//清空已经选择的选项
$("#column_type").textbox('setValue', '');
}
})
//获取eeeeCode
function getCode(){
var apn = $("#apn").textbox('getValue');
if (apn && apn != ''){
let currentEEEECode = apn.substring(1, 9).replace('-', '')
$("#eeeeCode").textbox('setValue', currentEEEECode);
}
}
//加载排位数量
function initColumnType(columnQty){
var searchData = {'columnQty': columnQty};
$.ajax({
url: "/base/getPartColumnTypeList",
type:"POST",
contentType: "application/json",
data: JSON.stringify(searchData),// 你的formid
dataType:"JSON",
success: function (data) {
let currentColumnTypeRows = [];
let tempRows = data.rows;
//初始化
for(var i = 0; i< tempRows.length; i++){
currentColumnTypeRows.push({value:tempRows[i].columnType, text:tempRows[i].columnType});
}
$("#column_type").combobox('loadData', currentColumnTypeRows);
}
})
}
//查询功能
$("#queryLink").click(function(){
var dg = $('#dg').datagrid({
queryParams: {
partNo: $("#searchPartNo").val(),
createdDateFrom: $("#createdDateFrom").val(),
createdDateTo: $("#createdDateTo").val(),
}
});
});
//处理菜单的功能
function onTableRowSelect(index, row) {
let noRowSelect = !!!row;
let status = row.status;
$("#tbEdit").linkbutton({"disabled": noRowSelect});
$("#tbDel").linkbutton({"disabled": noRowSelect});
$("#tbMaterial").linkbutton({"disabled": noRowSelect});//新增材料跟踪维护
}
var url;
function newProductPartModal(){
$('#dlg').dialog('open').dialog('center').dialog('setTitle','新增物料');
$('#fm').form('clear');
url = '/basic/part/insertPart';
$('#addId').textbox("setValue", 0);
$('#createBy').textbox("setValue", username);
$('#partNo').textbox('textbox').removeAttr('readonly');
//设置默认值
$('#code_type').combobox('setValue', '2024');
}
//保存工单的信息
function saveProductPart(){
//判断标准中包参数是否符合要求
let partNo = $("#partNo").textbox('getValue');
//判断是否是正数
if(null == partNo || '' == partNo){
$.messager.alert('error', '请维护物料编码!', 'error');
return false;
}
let partDesc = $.trim($("#partDesc").textbox('getValue'));
if(null == partDesc || '' == partDesc){
$.messager.alert('error', '请维护物料描述!', 'error');
return false;
}
let customerPartNo = $.trim($("#customerPartNo").textbox('getValue'));
if(null == customerPartNo || '' == customerPartNo){
$.messager.alert('error', '请维护客户料号!', 'error');
return false;
}
let customerPartDesc = $.trim($("#customerPartDesc").textbox('getValue'));
if(null == customerPartDesc || '' == customerPartDesc){
$.messager.alert('error', '请维护客户料号描述!', 'error');
return false;
}
let revNo = $.trim($("#revNo").textbox('getValue'));
if(null == revNo || '' == revNo){
$.messager.alert('error', '请维护物料版本!', 'error');
return false;
}
let customerDrawing = $.trim($("#customerDrawing").textbox('getValue'));
if(null == customerDrawing || '' == customerDrawing){
$.messager.alert('error', '请维护customer drawing!', 'error');
return false;
}
let eeeeCode = $.trim($("#eeeeCode").textbox('getValue'));
if(null == eeeeCode || '' == eeeeCode){
$.messager.alert('error', '请维护EEEEcode!', 'error');
return false;
}
let apn = $.trim($("#apn").textbox('getValue'));
if(null == apn || '' == apn){
$.messager.alert('error', '请维护APN!', 'error');
return false;
}
let spec = $.trim($("#spec").textbox('getValue'));
if(null == spec || '' == spec){
$.messager.alert('error', '请维护SPEC!', 'error');
return false;
}
let stage = $.trim($("#stage").textbox('getValue'));
if(null == stage || '' == stage){
$.messager.alert('error', '请维护stage!', 'error');
return false;
}
let packageQty = $.trim($("#packageQty").textbox('getValue'));
if(null == packageQty || '' == packageQty){
$.messager.alert('error', '请维护标准包数量!', 'error');
return false;
}
let boxQty = $.trim($("#boxQty").textbox('getValue'));
if(null == boxQty || '' == boxQty){
$.messager.alert('error', '请维护标准箱数量!', 'error');
return false;
}
let projectCode = $.trim($("#projectCode").textbox('getValue'));
if(null == projectCode || '' == projectCode){
$.messager.alert('error', '请维护project code!', 'error');
return false;
}
let config = $.trim($("#config").textbox('getValue'));
if(null == config || '' == config){
$.messager.alert('error', '请维护config', 'error');
return false;
}
let primaryMaterialNo = $.trim($("#primaryMaterialNo").textbox('getValue'));
if(null == primaryMaterialNo || '' == primaryMaterialNo){
$.messager.alert('error', '请维护主材料号', 'error');
return false;
}
/* let cross = $.trim($("#cross").textbox('getValue'));
if(null == cross || '' == cross){
$.messager.alert('error', '请维护码包排位', 'error');
return false;
}
let columnType = $.trim($("#column_type").textbox('getValue'));
if(null == columnType || '' == columnType){
$.messager.alert('error', '请维护分切排位', 'error');
return false;
} */
let labelType = $.trim($("#labelType").textbox('getValue'));
if(null == labelType || '' == labelType){
$.messager.alert('error', '请维护标签类型', 'error');
return false;
}
let checkProductDateFlag = $.trim($("#checkProductDateFlag").textbox('getValue'));
if(null == checkProductDateFlag || '' == checkProductDateFlag){
$.messager.alert('error', '请维护是否允许不同生产日期装箱', 'error');
return false;
}
let codeType = $.trim($("#code_type").textbox('getValue'));
if(null == codeType || '' == codeType){
$.messager.alert('error', '请维护码包类型!', 'error');
return false;
}
let serialApn = $.trim($("#serialApn").textbox('getValue'));
//码包类型是2024时,必须填写serialApn
if(codeType === '2024' && (null == serialApn || '' == serialApn)){
$.messager.alert('error', '请维护serialApn', 'error');
return false;
}
//判断是否存在内容
$('#fm').form('submit', {
url: url,
success: function(result){
var result = eval("("+result+")");
if (result.success){
$('#dlg').dialog('close'); // close the dialog
$('#dg').datagrid('reload');
} else {
$.messager.alert('error',result.msg, 'error');
}
}
});
}
//编辑输入框
function editProductPartModal(){
var row = $('#dg').datagrid('getSelected');
if (row){
$('#dlg').dialog('open').dialog('center').dialog('setTitle','修改物料');
$('#fm').form('load', row);
url = '/basic/part/insertPart';
$('#addId').textbox("setValue", 1);
$('#updateBy').textbox("setValue", username);
$('#partNo').textbox('textbox').attr('readonly','readonly');
}else{
$.messager.alert('Warning','请选择一行!', 'warning');
}
}
//编辑材料跟踪的信息
function editPartMaterialModal(){
var row = $('#dg').datagrid('getSelected');
if (row){
$('#material_dlg').dialog('open').dialog('center').dialog('setTitle','修改材料跟踪');
$('#material_fm').form('load', row);
url = '/basic/part/updatePartMaterials';
$('#show_part_no').textbox('textbox').attr('readonly','readonly');
$('#show_part_desc').textbox('textbox').attr('readonly','readonly');
}else{
$.messager.alert('Warning','请选择一行!', 'warning');
}
}
//保存材料和排位的信息
function savePartMaterials(){
let indigoMaterials = $.trim($("#indigo_materials").textbox('getValue'));
/* if(null == indigoMaterials || '' == indigoMaterials){
$.messager.alert('error', '请维护材料料号!', 'error');
return false;
} */
let abgMaterials = $.trim($("#abg_materials").textbox('getValue'));
/* if(null == abgMaterials || '' == abgMaterials){
$.messager.alert('error', '请维护材料料号!', 'error');
return false;
} */
//判断是否存在内容
$('#material_fm').form('submit', {
url: url,
success: function(result){
var result = eval("("+result+")");
if (result.success){
$('#material_dlg').dialog('close'); // close the dialog
$('#dg').datagrid('reload');
} else {
$.messager.alert('error',result.msg, 'error');
}
}
});
}
function deletePart() {
$.messager.confirm('Confirm', 'Are you sure to delete the data?', function (r) {
if (r) {
// $.post('/base/deleteMachineData', {id: id}, function (result) {
// if (result.success) {
// $('#dg').datagrid('reload');
// $.messager.alert('Success', 'Successfully', 'info');
// } else {
// $.messager.alert('Error', result.errorMsg, 'error');
// }
// }, 'json');
deletePartDoing();
}
});
}
function deletePartDoing(){
var row = $('#dg').datagrid('getSelected');
if (row){
$('#fm').form('load', row);
//判断是否存在内容
$('#fm').form('submit', {
url: '/basic/part/deletePart',
success: function(result){
var result = eval("("+result+")");
if (result.success){
$('#dlg').dialog('close'); // close the dialog
$('#dg').datagrid('reload');
} else {
$.messager.alert('error',result.msg, 'error');
}
}
});
}else{
$.messager.alert('Warning','请选择一行!', 'warning');
}
}
</script>
</@master.layout>