|
|
@ -26,8 +26,8 @@ |
|
|
|
</div> |
|
|
|
</form> |
|
|
|
<div class="container"> |
|
|
|
<div class="form-row"> |
|
|
|
<div class="btn-group-sm" role="group"> |
|
|
|
<div class="form-row my-5"> <!-- 添加my-4类 --> |
|
|
|
<div class="btn-group-sm" role="group"> |
|
|
|
<span>选择开发修改单物料</span> |
|
|
|
<a class="btn btn-success" onclick="insertDevelopModify()"> |
|
|
|
<i class="fa fa-plus"></i> 添加修改物料 |
|
|
@ -39,6 +39,18 @@ |
|
|
|
<table id="bootstrap-table-developModify"></table> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group my-5"> <!-- 添加my-4类 --> |
|
|
|
<label class="col-sm-4 control-label is-required">修改前说明:</label> |
|
|
|
<div class="col-sm-6"> |
|
|
|
<textarea name="beforeUpdateRemark" class="form-control" required>[[*{beforeUpdateRemark}]]</textarea> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group my-5"> <!-- 添加my-4类 --> |
|
|
|
<label class="col-sm-4 control-label is-required">修改后说明:</label> |
|
|
|
<div class="col-sm-6"> |
|
|
|
<textarea name="afterUpdateRemark" class="form-control" required>[[*{afterUpdateRemark}]]</textarea> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="container"> |
|
|
|
<div class="form-row"> |
|
|
@ -191,18 +203,33 @@ |
|
|
|
console.log(uniqueId); |
|
|
|
var iframeWin = window[layero.find('iframe')[0]['name']]; |
|
|
|
var rowData = iframeWin.$('#bootstrap-developModifyMaterialSelect-table').bootstrapTable('getSelections')[0]; |
|
|
|
|
|
|
|
//判断是否重复 |
|
|
|
var rows = $("#bootstrap-table-developModify").bootstrapTable('getData').length; |
|
|
|
|
|
|
|
if (rows > 0){ |
|
|
|
$.modal.alertError("每次只能修改一条物料!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
// for(var i=0;i<rows;i++){ |
|
|
|
// var data = $("#bootstrap-table-developModify").bootstrapTable('getData')[i]; |
|
|
|
// if(data.materialNo==rowData.materialNo){ |
|
|
|
// $.modal.alertError("不能选择已添加过的相同物料"); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
console.log("rowData: "+rowData); |
|
|
|
$("#bootstrap-table-developModify").bootstrapTable('insertRow', { |
|
|
|
index:1, |
|
|
|
row: { |
|
|
|
materialNo:rowData.materialNo, |
|
|
|
materialPhotourl:rowData.materialPhotourl, |
|
|
|
materialNo:rowData.materialCode, |
|
|
|
materialPhotourl:rowData.photoUrl, |
|
|
|
materialName: rowData.materialName, |
|
|
|
materialType: rowData.materialType, |
|
|
|
materialDescribe: rowData.materialDescribe, |
|
|
|
materialBrand: rowData.materialBrand, |
|
|
|
materialUnit: rowData.materialUnit, |
|
|
|
materialProcessMethod: rowData.materialProcessMethod, |
|
|
|
materialDescribe: rowData.describe, |
|
|
|
materialBrand: rowData.brand, |
|
|
|
materialUnit: rowData.unit, |
|
|
|
} |
|
|
|
}) |
|
|
|
layer.close(index); |
|
|
@ -217,6 +244,323 @@ |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 点击选择采购物料按钮 |
|
|
|
function insertPurchase() { |
|
|
|
var url = prefix + '/purchaseMaterialSelect'; |
|
|
|
var options = { |
|
|
|
title: '选择物料', |
|
|
|
url: url, |
|
|
|
callBack: purchaseDoSubmit |
|
|
|
}; |
|
|
|
$.modal.openOptions(options); |
|
|
|
} |
|
|
|
|
|
|
|
// 选择采购物料 |
|
|
|
$(function(){ |
|
|
|
var options = { |
|
|
|
id: 'bootstrap-table-purchase', |
|
|
|
showSearch: false, |
|
|
|
showRefresh: false, |
|
|
|
showToggle: false, |
|
|
|
showColumns: false, |
|
|
|
uniqueId: "id", |
|
|
|
pagination: false, // 设置不分页 |
|
|
|
sidePagination: "client", |
|
|
|
detailView: true, |
|
|
|
onExpandRow : function(index, row, $detail) { |
|
|
|
initChildTable(index, row, $detail); |
|
|
|
}, |
|
|
|
/*onCollapseRow: function(index, row){ |
|
|
|
var childTableFormId = 'child_table_form_'+index; |
|
|
|
var formData = $('#'+childTableFormId).serialize(); |
|
|
|
var formObj = $.common.formDataToObj(formData); |
|
|
|
subTableFormArray.push(formObj); |
|
|
|
},*/ |
|
|
|
columns: [ |
|
|
|
{ |
|
|
|
field: 'id', |
|
|
|
title: '主键id', |
|
|
|
visible: false |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'quoteId', |
|
|
|
title: '关联销售订单编号', |
|
|
|
visible: false |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'bomId', |
|
|
|
title: 'bom主键Id', |
|
|
|
visible: false |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialNo', |
|
|
|
align: 'center', |
|
|
|
title: '料号' |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialName', |
|
|
|
align: 'center', |
|
|
|
title: '物料名称', |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialType', |
|
|
|
align: 'center', |
|
|
|
title: '物料类型', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.selectCategoryLabel(materialTypeDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialUnit', |
|
|
|
align: 'center', |
|
|
|
title: '单位', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.selectDictLabel(sysUnitClassDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialBrand', |
|
|
|
align: 'center', |
|
|
|
title: '品牌' |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialDescribe', |
|
|
|
align: 'center', |
|
|
|
title: '描述' |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialProcessMethod', |
|
|
|
align: 'center', |
|
|
|
title: '物料加工方式', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.selectDictLabel(processMethodDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialNum', |
|
|
|
align: 'center', |
|
|
|
title: '订单数量' |
|
|
|
}, |
|
|
|
] |
|
|
|
}; |
|
|
|
$.table.init(options); |
|
|
|
}) |
|
|
|
|
|
|
|
initChildTable = function(index, row, $detail) { |
|
|
|
var parentRow = row; |
|
|
|
var parentRowIndex = index; |
|
|
|
var childTableId = 'child_table_'+index; |
|
|
|
var childFormTableId = 'child_form_table_'+index; |
|
|
|
var childTableFormId = 'child_table_form_'+index; |
|
|
|
// $detail.html('<form id="'+childTableFormId+'"><table id="'+childTableId+'"></table><table id="'+childFormTableId+'"></table></form>'); |
|
|
|
$detail.html('<table id="'+childTableId+'"></table>'); |
|
|
|
// BOM展示 |
|
|
|
$('#'+childTableId).bootstrapTable({ |
|
|
|
// url: ctx + "system/makeorderbom/list", |
|
|
|
method: 'post', |
|
|
|
sidePagination: "server", |
|
|
|
contentType: "application/x-www-form-urlencoded", |
|
|
|
// queryParams : { |
|
|
|
// makeNo: $("#makeNo").val(), |
|
|
|
// salesOrderCode: $("#saleNo").val(), |
|
|
|
// salesOrderMaterialNo: parentRow.materialCode |
|
|
|
// }, |
|
|
|
columns: [{ |
|
|
|
field: 'id', |
|
|
|
title: '主键id', |
|
|
|
visible: false |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'level', |
|
|
|
title: '阶层', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.selectDictLabel(levelDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'bomNo', |
|
|
|
title: 'BOM号', |
|
|
|
formatter:function (value,row,index){ |
|
|
|
if (value == null || value == ''){ |
|
|
|
return '/'; |
|
|
|
}else{ |
|
|
|
return value |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialNo', |
|
|
|
title: '料号', |
|
|
|
formatter: function (value,row,index){ |
|
|
|
var curIndex = row.sortNo-1; |
|
|
|
return '<input readonly class = "form-control" data-id = "materialNo_'+curIndex+'" name="pickDetails['+curIndex+'].materialNo" value="'+value+'"><input class = "hidden form-control" data-id = "makeorderBomId_'+curIndex+'" name="pickDetails['+curIndex+'].makeorderBomId" value="'+row.id+'">'; |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'photoUrl', |
|
|
|
title: '图片', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.imageView(value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialName', |
|
|
|
title: '物料名称', |
|
|
|
formatter: function (value,row,index){ |
|
|
|
if (value == null || value == ''){ |
|
|
|
return '/'; |
|
|
|
}else{ |
|
|
|
return value |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialType', |
|
|
|
title: '物料类型', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.selectCategoryLabel(materialTypeDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'describe', |
|
|
|
title: '描述', |
|
|
|
formatter: function (value,row,index){ |
|
|
|
if (value == null || value == ''){ |
|
|
|
return '/'; |
|
|
|
}else{ |
|
|
|
return value |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'brand', |
|
|
|
title: '品牌', |
|
|
|
formatter: function (value,row,index){ |
|
|
|
if (value == null || value == ''){ |
|
|
|
return '/'; |
|
|
|
}else{ |
|
|
|
return value |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'unit', |
|
|
|
title: '单位', |
|
|
|
formatter: function (value,row,index){ |
|
|
|
if (value == null || value == ''){ |
|
|
|
return '/'; |
|
|
|
}else{ |
|
|
|
return value |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
field: 'processMethod', |
|
|
|
title: '半成品类型', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.selectDictLabel(processMethodDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'useNum', |
|
|
|
title: '用量', |
|
|
|
formatter: function (value,row,index){ |
|
|
|
if (value == null || value == ''){ |
|
|
|
return '/'; |
|
|
|
}else{ |
|
|
|
return value |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'lossRate', |
|
|
|
title: '损耗率', |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialNum', |
|
|
|
title: '订单用量', |
|
|
|
formatter: function (value,row,index){ |
|
|
|
return parentRow.materialNum * row.useNum; |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'hasPickNum', |
|
|
|
title: '已领料数量', |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'pickNum', |
|
|
|
title: '本次领料数量', |
|
|
|
formatter: function (value,row,index){ |
|
|
|
var curIndex = row.sortNo-1; |
|
|
|
return '<input class = "form-control" data-id = "pickNum_'+curIndex+'" name="pickDetails['+curIndex+'].pickNum">'; |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'makeNo', |
|
|
|
title: '生产订单号', |
|
|
|
visible: false, |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'salesOrderCode', |
|
|
|
title: '销售订单号', |
|
|
|
visible: false, |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'salesOrderMaterialNo', |
|
|
|
title: '销售订单料号', |
|
|
|
visible: false, |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'sortNo', |
|
|
|
title: '排序', |
|
|
|
visible: false |
|
|
|
}], |
|
|
|
// 当所有数据被加载时触发 |
|
|
|
onLoadSuccess: function(data) { |
|
|
|
|
|
|
|
}, |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
function purchaseDoSubmit(index, layero,uniqueId){ |
|
|
|
console.log(uniqueId); |
|
|
|
var iframeWin = window[layero.find('iframe')[0]['name']]; |
|
|
|
var rowData = iframeWin.$('#bootstrap-purchaseMaterialSelect-table').bootstrapTable('getSelections')[0]; |
|
|
|
|
|
|
|
//判断是否重复 |
|
|
|
var rows = $("#bootstrap-table-purchase").bootstrapTable('getData').length; |
|
|
|
|
|
|
|
if (rows > 0){ |
|
|
|
$.modal.alertError("每次只能修改一条物料!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
// for(var i=0;i<rows;i++){ |
|
|
|
// var data = $("#bootstrap-table-developModify").bootstrapTable('getData')[i]; |
|
|
|
// if(data.materialNo==rowData.materialNo){ |
|
|
|
// $.modal.alertError("不能选择已添加过的相同物料"); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
console.log("rowData: "+rowData); |
|
|
|
$("#bootstrap-table-purchase").bootstrapTable('insertRow', { |
|
|
|
index:1, |
|
|
|
row: { |
|
|
|
materialNo:rowData.materialNo, |
|
|
|
materialPhotourl:rowData.materialPhotourl, |
|
|
|
materialName: rowData.materialName, |
|
|
|
materialType: rowData.materialType, |
|
|
|
materialDescribe: rowData.describe, |
|
|
|
materialBrand: rowData.brand, |
|
|
|
materialUnit: rowData.unit, |
|
|
|
materialProcessMethod:rowData.processMethod |
|
|
|
} |
|
|
|
}) |
|
|
|
layer.close(index); |
|
|
|
} |
|
|
|
|
|
|
|
</script> |
|
|
|
</body> |
|
|
|
</html> |