|
@@ -0,0 +1,394 @@
|
|
|
|
+<!DOCTYPE HTML>
|
|
|
|
+<html>
|
|
|
|
+<head>
|
|
|
|
+ <meta charset="utf-8">
|
|
|
|
+ <meta name="renderer" content="webkit|ie-comp|ie-stand">
|
|
|
|
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
|
|
+ <meta name="viewport"
|
|
|
|
+ content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
|
|
|
|
+ <meta http-equiv="Cache-Control" content="no-siteapp"/>
|
|
|
|
+<#include "/base/add_base.ftl">
|
|
|
|
+ <link href="${path}/common/lib/jquery.ui/jquery-ui.css" rel="stylesheet" type="text/css"/>
|
|
|
|
+ <style>
|
|
|
|
+ .add-list>li{margin: 10px 0;}
|
|
|
|
+ input[type=radio]{-webkit-appearance:none;appearance:none;background: url(/rst/common/images/pts/radio-1.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
|
|
|
|
+ input[type=radio]:checked{-webkit-appearance:none;appearance:none;background: url(/rst/common/images/pts/radio-2.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
|
|
|
|
+ </style>
|
|
|
|
+ <title>修改批次 - 批次管理 - RST</title>
|
|
|
|
+</head>
|
|
|
|
+<body>
|
|
|
|
+<nav class="breadcrumb"><i class="Hui-iconfont"></i> 首页
|
|
|
|
+ <span class="c-gray en">></span> 批次管理
|
|
|
|
+ <span class="c-gray en">></span> 修改批次
|
|
|
|
+ <a class="btn radius r"
|
|
|
|
+ style="line-height:1.6em;margin-top:3px;background: #32a3d8;color: #fff;border:1px solid #32a3d8;"
|
|
|
|
+ href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont"></i></a>
|
|
|
|
+</nav>
|
|
|
|
+<article class="page-container" style="padding: 10px;width: 600px;margin: 0 auto;">
|
|
|
|
+ <form action="${path}/admin/batch/update_batch" method="post" class="form form-horizontal" id="form-batch-update">
|
|
|
|
+
|
|
|
|
+ <input type="hidden" value="${ptsBatch.batchId}" id="batchId" name="batchId">
|
|
|
|
+ <input type="hidden" value="${ptsBatch.produceId}" id="produceId" name="produceId">
|
|
|
|
+
|
|
|
|
+ <div class="row cl">
|
|
|
|
+ <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>所属产品:</label>
|
|
|
|
+ <div class="formControls col-xs-8 col-sm-9"> <span class="select-box">
|
|
|
|
+ <select class="select" size="1" name="produceId" datatype="*" errormsg="请选择产品" disabled="disabled" style="background: #eee;" >
|
|
|
|
+ <#if produceList?? && (produceList?size > 0) >
|
|
|
|
+ <#list produceList as produce>
|
|
|
|
+ <option value="${produce.produceId}" <#if ptsBatch.produceId??><#if ptsBatch.produceId == produce.produceId >selected="selected" </#if></#if>>${produce.produceName}</option>
|
|
|
|
+ </#list>
|
|
|
|
+ </#if>
|
|
|
|
+ </select>
|
|
|
|
+ </span>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div class="row cl">
|
|
|
|
+ <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>批次编号:</label>
|
|
|
|
+ <div class="formControls col-xs-8 col-sm-9">
|
|
|
|
+ <input type="text" class="input-text" value="${ptsBatch.batchNo}" id="batchNo" name="batchNo" placeholder="请输入1-20位的名称,支持字母、数字" datatype="/^[a-zA-Z0-9]{1,20}$/" errormsg="请输入1-20位的名称,支持字母、数字!">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div class="row cl">
|
|
|
|
+ <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>批次数量:</label>
|
|
|
|
+ <div class="formControls col-xs-8 col-sm-9 components">
|
|
|
|
+ <input type="hidden" id="batchColorQuantity" name="batchColorQuantity">
|
|
|
|
+ <table class="table table-border table-bordered table-bg table-hover table-sort">
|
|
|
|
+ <thead>
|
|
|
|
+ <tr class="text-c">
|
|
|
|
+ <th width="150">选择颜色</th>
|
|
|
|
+ <th width="60">批次数量</th>
|
|
|
|
+ <th width="20">操作</th>
|
|
|
|
+ </tr>
|
|
|
|
+ </thead>
|
|
|
|
+ <tbody id="batchColorAll">
|
|
|
|
+ <#if ptsBatch.ptsBatchColorList?? && (ptsBatch.ptsBatchColorList?size > 0) >
|
|
|
|
+ <#list ptsBatch.ptsBatchColorList as ptsBatchColor>
|
|
|
|
+ <tr class="text-c">
|
|
|
|
+ <td>
|
|
|
|
+ <select class="select" size="1" name="colorName" style="height: 30px;">
|
|
|
|
+ <#list batchColor as color>
|
|
|
|
+ <option value="${color}" <#if ptsBatchColor.colorName == color >selected="selected" </#if>>${color}</option>
|
|
|
|
+ </#list>
|
|
|
|
+ </select>
|
|
|
|
+ </td>
|
|
|
|
+ <td>
|
|
|
|
+ <input type="text" class="input-text colorQuantity" value="${ptsBatchColor.colorQuantity}" onblur="calculationQuantity()" name="colorQuantity" placeholder="数量" datatype="n1-5" errormsg="零件数量只能为数字且不能超过99999!"></td>
|
|
|
|
+ <td>
|
|
|
|
+ <a style="" href="javascript:void(0);" title="删除" onclick="delComponent(this,1)"> <i class="Hui-iconfont"></i></a>
|
|
|
|
+ </td>
|
|
|
|
+ </tr>
|
|
|
|
+ </#list>
|
|
|
|
+ </#if>
|
|
|
|
+ </tbody>
|
|
|
|
+ </table>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div class="row cl">
|
|
|
|
+ <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
|
|
|
|
+ <input class="btn btn-primary radius" type="button" value=" 新增零件 " onclick="addBatchColor('','')">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div class="row cl">
|
|
|
|
+ <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>批次总数量:</label>
|
|
|
|
+ <div class="formControls col-xs-8 col-sm-9">
|
|
|
|
+ <input type="text" class="input-text" value="${ptsBatch.batchQuantity}" name="batchQuantity" disabled="disabled" style="background: #eee;" placeholder="该批次的总数量" datatype="n1-6" errormsg="批次数量只能输入数字且不能超过999999!">
|
|
|
|
+ <input type="hidden" class="input-text" value="${ptsBatch.batchQuantity}" name="batchQuantity" >
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div class="row cl">
|
|
|
|
+ <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>软件版本:</label>
|
|
|
|
+ <div class="formControls col-xs-8 col-sm-9">
|
|
|
|
+ <span class="select-box">
|
|
|
|
+ <select class="select" size="1" name="batchSoftwareVersionId" id="batchSoftwareVersionId" datatype="*" errormsg="请选择软件版本">
|
|
|
|
+ <#if ptsMachineVersionList?? && (ptsMachineVersionList?size > 0) >
|
|
|
|
+ <#list ptsMachineVersionList as ptsMachineVersion>
|
|
|
|
+ <option value="${ptsMachineVersion.machineVersionId}" <#if ptsBatch.batchSoftwareVersionId == ptsMachineVersion.machineVersionId >selected="selected" </#if>>${ptsMachineVersion.machineVersionName}(${ptsMachineVersion.machineVersionNo})</option>
|
|
|
|
+ </#list>
|
|
|
|
+ </#if>
|
|
|
|
+ </select>
|
|
|
|
+ </span>
|
|
|
|
+ <span id="batchSoftwareVersionIdMsg" style="color: red;"></span>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div class="row cl">
|
|
|
|
+ <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>Bom单:</label>
|
|
|
|
+ <div class="formControls col-xs-8 col-sm-9">
|
|
|
|
+ <span class="select-box" >
|
|
|
|
+ <select class="select" size="1" name="bomId" id="bomId" datatype="*" errormsg="请选择Bom单">
|
|
|
|
+ <#if ptsBomsList?? && (ptsBomsList?size > 0) >
|
|
|
|
+ <#list ptsBomsList as ptsBom>
|
|
|
|
+ <option value="${ptsBom.bomId}" <#if ptsBatch.bomId == ptsBom.bomId >selected="selected" </#if>>${ptsBom.bomName}</option>
|
|
|
|
+ </#list>
|
|
|
|
+ </#if>
|
|
|
|
+ </select>
|
|
|
|
+ </span>
|
|
|
|
+ <span id="bomIdMsg" style="color: red;"></span>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <div class="row cl">
|
|
|
|
+ <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>批次状态:</label>
|
|
|
|
+ <div class="formControls col-xs-8 col-sm-9">
|
|
|
|
+ <div class="radio-box">
|
|
|
|
+ <input type="radio" id="batchStatus-1" name="batchStatus" value="1" <#if ptsBatch.batchStatus == 1>checked</#if>>
|
|
|
|
+ <label for="batchStatus-1">立即使用</label>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="radio-box">
|
|
|
|
+ <input type="radio" id="batchStatus-2" name="batchStatus" value="0" <#if ptsBatch.batchStatus == 0>checked</#if>>
|
|
|
|
+ <label for="batchStatus-2">暂不使用</label>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div class="row cl">
|
|
|
|
+ <label class="form-label col-xs-4 col-sm-3">批次描述:</label>
|
|
|
|
+ <div class="formControls col-xs-8 col-sm-9">
|
|
|
|
+ <textarea name="batchDesc" id="batchDesc" cols="" rows="" class="textarea"
|
|
|
|
+ placeholder="批次描述,最多支持100字符" onKeyUp="$.Huitextarealength(this,100)" >${ptsBatch.batchDesc}</textarea>
|
|
|
|
+ <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <div class="row cl">
|
|
|
|
+ <label class="form-label col-xs-4 col-sm-3"></label>
|
|
|
|
+ <span class="c-red">*提示</span><span>:如果设置状态为 使用,将停止使用同一个产品的其他批次!</span>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="row cl">
|
|
|
|
+ <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
|
|
|
|
+ <input class="btn btn-primary radius" type="submit" value=" 提交 ">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </form>
|
|
|
|
+</article>
|
|
|
|
+<script type="text/javascript">
|
|
|
|
+ /*颜色枚举值*/
|
|
|
|
+ var colorAll = ['黑色','白色','红色','蓝色','绿色','橙色','黄色','青色','紫色'];
|
|
|
|
+
|
|
|
|
+ /*修改批次时,获取之前的批次编号,添加页面为空*/
|
|
|
|
+ var upBatchNo = '${ptsBatch.batchNo}';
|
|
|
|
+
|
|
|
|
+ $(function(){
|
|
|
|
+ $("#form-batch-update").Validform({
|
|
|
|
+ tiptype: function (msg, o, cssctl) {
|
|
|
|
+ if (o.type == 3) {//失败
|
|
|
|
+ layer.msg(msg, {icon: 5, time: 3000});
|
|
|
|
+ $(window).scrollTop(o.obj.offset().top - 40);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ datatype: {//自定义验证类型
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ ignoreHidden: true,
|
|
|
|
+ tipSweep: true, //若为true,则只在表单提交时验证
|
|
|
|
+ ajaxPost: true, //异步提交
|
|
|
|
+ beforeCheck: function (curform) { //验证通过之前执行的函数
|
|
|
|
+ },
|
|
|
|
+ beforeSubmit: function (curform) { //验证通过之后执行的函数
|
|
|
|
+ //批次编号不能重复 -- 重复为false 不重复(可用)为true
|
|
|
|
+ var batchNo = $("#batchNo").val();
|
|
|
|
+ if(upBatchNo == null || typeof(upBatchNo) == "undefined"){
|
|
|
|
+ if(!isValiBatchNo(batchNo)){
|
|
|
|
+ layer.msg("批次编号重复", {icon: 5, time: 3000});
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ if(upBatchNo != batchNo){
|
|
|
|
+ if(!isValiBatchNo(batchNo)){
|
|
|
|
+ layer.msg("批次编号重复", {icon: 5, time: 3000});
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //合并 批次颜色信息
|
|
|
|
+ var colorList = new Array();
|
|
|
|
+ $("#batchColorAll").find("tr").each(function(){
|
|
|
|
+ var ptsBatchColor = {};
|
|
|
|
+ ptsBatchColor.colorName = $(this).find("[name='colorName']").eq(0).val();
|
|
|
|
+ ptsBatchColor.colorQuantity = $(this).find("[name='colorQuantity']").eq(0).val();
|
|
|
|
+ colorList.push(ptsBatchColor);
|
|
|
|
+ })
|
|
|
|
+ $("#batchColorQuantity").val(JSON.stringify(colorList));
|
|
|
|
+ },
|
|
|
|
+ callback: function (data) {//异步回调函数
|
|
|
|
+ if (data) {
|
|
|
|
+ var index = layer.alert(data.resultMsg, function () {
|
|
|
|
+ if (data.resultCode == 200) {
|
|
|
|
+ location.href = "${path}/admin/batch/_batch_list";
|
|
|
|
+ } else {
|
|
|
|
+ layer.close(index);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ /*判断batch是否重复 重复为false 不重复(可用)为true */
|
|
|
|
+ function isValiBatchNo(batchNo) {
|
|
|
|
+ var boolean = false;
|
|
|
|
+ $.ajax({
|
|
|
|
+ type: "POST",
|
|
|
|
+ data: {
|
|
|
|
+ batchNo : batchNo
|
|
|
|
+ },
|
|
|
|
+ url: "${path}/admin/batch/is_valiBatchNo",
|
|
|
|
+ async: false,
|
|
|
|
+ success: function(data){
|
|
|
|
+ if (data.returnCode == 200 ) {
|
|
|
|
+ if(data.returnMsg.ptsBatch == null ){
|
|
|
|
+ boolean = true
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ layer.msg(data.resultMsg, {icon: 5, time: 3000});
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ error: function(XmlHttpRequest, textStatus, errorThrown){
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return boolean;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /*根据产品id,获取bom集合*/
|
|
|
|
+ function getBomByProduce(produceId){
|
|
|
|
+ $.ajax({
|
|
|
|
+ type: "POST",
|
|
|
|
+ data: {
|
|
|
|
+ produceId : produceId
|
|
|
|
+ },
|
|
|
|
+ url: "${path}/admin/bom/get_listBom",
|
|
|
|
+ async: false,
|
|
|
|
+ success: function(data){
|
|
|
|
+ var html = '';
|
|
|
|
+ if (data.returnCode == 200) {
|
|
|
|
+ var bomList = data.returnMsg.ptsBomsList;
|
|
|
|
+ for(var i=0;i<bomList.length;i++){
|
|
|
|
+ html += '<option value="'+ bomList[i].bomId +'">'+ bomList[i].bomName +'</option>';
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(data.returnCode != 200 || data.returnMsg.ptsBomsList <1){
|
|
|
|
+ $("#bomIdMsg").html("系统没有对应产品的Bom单,请到Bom单管理中添加Bom单");
|
|
|
|
+ }else{
|
|
|
|
+ $("#bomIdMsg").html("");
|
|
|
|
+ }
|
|
|
|
+ $("[name='bomId']").html(html);
|
|
|
|
+ },
|
|
|
|
+ error: function(XmlHttpRequest, textStatus, errorThrown){
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /*根据产品获取软件版本*/
|
|
|
|
+ function getVersionByProduce(produceId) {
|
|
|
|
+ $.ajax({
|
|
|
|
+ type: "POST",
|
|
|
|
+ data: {
|
|
|
|
+ produceId : produceId
|
|
|
|
+ },
|
|
|
|
+ url: "${path}/admin/batch/get_version",
|
|
|
|
+ async: false,
|
|
|
|
+ success: function(data){
|
|
|
|
+ var html = '';
|
|
|
|
+ if (data.returnCode == 200) {
|
|
|
|
+ var versionList = data.returnMsg.ptsMachineVersionList;
|
|
|
|
+ for(var i=0;i<versionList.length;i++){
|
|
|
|
+ html += '<option value="'+ versionList[i].machineVersionId +'">'+ versionList[i].machineVersionName +'('+ versionList[i].machineVersionNo +')</option>';
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(data.returnCode != 200 || data.returnMsg.ptsMachineVersionList <1){
|
|
|
|
+ $("#batchSoftwareVersionIdMsg").html("系统没有对应产品的软件版本,请到版本管理中添加软件版本");
|
|
|
|
+ }else{
|
|
|
|
+ $("#batchSoftwareVersionIdMsg").html("");
|
|
|
|
+ }
|
|
|
|
+ $("[name='batchSoftwareVersionId']").html(html);
|
|
|
|
+ },
|
|
|
|
+ error: function(XmlHttpRequest, textStatus, errorThrown){
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /*添加颜色*/
|
|
|
|
+ function addBatchColor(colorName,colorQuantity) {
|
|
|
|
+ var notAddColor = colorAll
|
|
|
|
+ var opHtml = '';
|
|
|
|
+ for(var i=0;i<notAddColor.length;i++){
|
|
|
|
+ opHtml += '<option value="'+ notAddColor[i] +'" >'+ notAddColor[i] + '</option>'
|
|
|
|
+ }
|
|
|
|
+ var html = '<tr class="text-c">'
|
|
|
|
+ +'<td>'
|
|
|
|
+ +'<select class="select" size="1" name="colorName" style="height: 30px;">'
|
|
|
|
+ + opHtml
|
|
|
|
+ +'</select>'
|
|
|
|
+ +'</td>'
|
|
|
|
+ +'<td>'
|
|
|
|
+ +'<input type="text" class="input-text colorQuantity" value="" onblur="calculationQuantity()" name="colorQuantity" placeholder="数量" datatype="n1-5" errormsg="零件数量只能为数字且不能超过99999!">'
|
|
|
|
+ +'</td>'
|
|
|
|
+ +'<td>'
|
|
|
|
+ +'<a style="" href="javascript:void(0);" title="删除" onclick="delComponent(this,1)"> '
|
|
|
|
+ +'<i class="Hui-iconfont"></i>'
|
|
|
|
+ +'</a>'
|
|
|
|
+ +'</td> '
|
|
|
|
+ +'</tr>';
|
|
|
|
+ $("#batchColorAll").append(html);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /*删除颜色 type=all时删除所有的颜色,但必须要保留一个颜色 */
|
|
|
|
+ function delComponent(node,type) {
|
|
|
|
+ if(type == "all"){
|
|
|
|
+ $("#batchColorAll").find("tr").each(function () {
|
|
|
|
+ $(this).remove();
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
|
|
+ //删除零件必须保证还有一个颜色
|
|
|
|
+ var batchLength = $("#batchColorAll").find("tr").length;
|
|
|
|
+ if(batchLength > 1){
|
|
|
|
+ $(node).parent().parent().remove();
|
|
|
|
+ }else{
|
|
|
|
+ layer.msg('必须要有一个颜色', {icon: 5, time: 3000});
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //删除操作需要计算总数量
|
|
|
|
+ calculationQuantity();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**计算批次总数量*/
|
|
|
|
+ function calculationQuantity(){
|
|
|
|
+ var quantity = 0;
|
|
|
|
+ $("#batchColorAll").find("[name='colorQuantity']").each(function (){
|
|
|
|
+ var colorQuantity = $(this).val();
|
|
|
|
+ var myreg = /^[0-9]*$/;
|
|
|
|
+ if( colorQuantity != null && colorQuantity != "" && typeof(colorQuantity) != "undefined"){
|
|
|
|
+ if(myreg.test(colorQuantity))
|
|
|
|
+ {
|
|
|
|
+ quantity += parseInt(colorQuantity);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ $("[name='batchQuantity']").val(quantity);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /*获取未被添加的颜色*/
|
|
|
|
+// function getNotAddColorAll() {
|
|
|
|
+// if($("#batchColorAll").find("tr") != null && $("#batchColorAll").find("tr").length > 0){
|
|
|
|
+// $("#batchColorAll").find("tr").each(function (){
|
|
|
|
+// for(var i=0; i<colorAll.length;i++){
|
|
|
|
+// colorAll.remove(1);
|
|
|
|
+// }
|
|
|
|
+// })
|
|
|
|
+// }else{
|
|
|
|
+// return colorAll;
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+</script>
|
|
|
|
+<!--/请在上方写此页面业务相关的脚本-->
|
|
|
|
+</body>
|
|
|
|
+</html>
|