123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405 |
- <!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(${path}/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(${path}/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">软件版本:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <span class="select-box">
- <select class="select" size="1" name="batchSoftwareVersionId" id="batchSoftwareVersionId" >
- <#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"><#if ptsBatch.batchDesc??>${ptsBatch.batchDesc?length} <#else>0</#if></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) {
- //判断颜色数量
- if(getColorNumber() >= 9){
- layer.msg("添加的颜色不能超过9个", {icon: 5, time: 3000});
- return false;
- }
- 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);
- }
- /*获取颜色数量*/
- function getColorNumber(){
- var number = $("#batchColorAll").find("tr").length;
- return number;
- }
- /*删除颜色 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>
|