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.
1891 lines
67 KiB
1891 lines
67 KiB
2 years ago
|
<!DOCTYPE html>
|
||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||
|
<head>
|
||
|
<th:block th:include="include :: header('新增BOM')"/>
|
||
|
<th:block th:include="include :: datetimepicker-css"/>
|
||
|
<link th:href="@{/ajax/libs/select2/select2.css}" rel="stylesheet">
|
||
|
<link th:href="@{/ajax/libs/select2/select2-bootstrap.css}" rel="stylesheet">
|
||
|
<th:block th:include="include :: bootstrap-editable-css"/>
|
||
|
|
||
|
</head>
|
||
|
<style type="text/css">
|
||
|
.select2-container--open {
|
||
|
z-index: 9999999
|
||
|
}
|
||
|
|
||
|
.other-container {
|
||
|
width: 100%;
|
||
|
height: 500px;
|
||
|
}
|
||
|
|
||
|
.hiddenDetailInfo {
|
||
|
display: none;
|
||
|
}
|
||
|
|
||
|
.search-collapse, .select-table {
|
||
|
box-shadow: none;
|
||
|
}
|
||
|
|
||
|
.btn-group-sm {
|
||
|
padding: 0 40px;
|
||
|
}
|
||
|
|
||
|
.get-finish-product {
|
||
|
width: 100%;
|
||
|
border-bottom: 1px solid #c0c0c0;
|
||
|
padding: 10px 0;
|
||
|
margin-bottom: 30px;
|
||
|
|
||
|
}
|
||
|
|
||
|
.get-finish-product h4 {
|
||
|
padding: 0 40px;
|
||
|
}
|
||
|
.table-responsive{
|
||
|
overflow-x:inherit;
|
||
|
}
|
||
|
.title{
|
||
|
padding: 10px 30px 0;
|
||
|
margin: 0 0 -10px 0;
|
||
|
font-size: 20px;
|
||
|
}
|
||
|
|
||
|
</style>
|
||
|
<body class="white-bg">
|
||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||
|
<form class="form-horizontal m" id="form-bom-add">
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label class="col-sm-3 control-label is-required">清单编号:</label>
|
||
|
<div class="col-sm-8">
|
||
|
<input name="bomCode" class="form-control" type="text" required>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<label class="col-sm-3 control-label is-required">清单名称:</label>
|
||
|
<div class="col-sm-8">
|
||
|
<input name="bomName" class="form-control" type="text" required>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<label class="col-sm-3 control-label">生产费用:</label>
|
||
|
<div class="col-sm-8">
|
||
|
<input name="bomProductionCost" class="form-control" type="text">
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<label class="col-sm-3 control-label">备注:</label>
|
||
|
<div class="col-sm-8">
|
||
|
<textarea name="bomRemarks" class="form-control"></textarea>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<label class="col-sm-3 control-label">创建人:</label>
|
||
|
<div class="col-sm-8">
|
||
|
<input name="bomCreator" class="form-control" type="text">
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="form-group">
|
||
|
<label class="col-sm-3 control-label">创建时间:</label>
|
||
|
<div class="col-sm-8">
|
||
|
<div class="input-group date">
|
||
|
<input name="bomTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
||
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="get-finish-product">
|
||
|
<h4>选择成品信息</h4>
|
||
|
</div>
|
||
|
|
||
|
<div class="form-group" >
|
||
|
<label class="col-sm-3 control-label is-required">成品代码:</label>
|
||
|
<div class="col-sm-8" style="font-size:0px;">
|
||
|
<!-- <select name="finishProductCode" class="form-control m-b" required>-->
|
||
|
<!-- <option value="">请选择成品代码</option>-->
|
||
|
<!-- </select>-->
|
||
|
<input name="finishProductCode" id="finishProductCode" class="form-control" type="text" required style="display: block;"><a class="btn btn-default" onclick="chooseFinishProduct()">选择</a>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<label class="col-sm-3 control-label is-required">成品名称:</label>
|
||
|
<div class="col-sm-8">
|
||
|
<!-- <select name="finishProductName" class="form-control m-b">-->
|
||
|
<!-- <option value="">请选择成品名称</option>-->
|
||
|
<!-- </select>-->
|
||
|
<input name="finishProductName" class="form-control" type="text" required>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<label class="col-sm-3 control-label">客户代码:</label>
|
||
|
<div class="col-sm-8">
|
||
|
<input name="enterpriseCode" class="form-control" type="text" >
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<label class="col-sm-3 control-label">客户名称:</label>
|
||
|
<div class="col-sm-8">
|
||
|
<input name="enterpriseName" class="form-control" type="text" >
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<label class="col-sm-3 control-label">客户料号:</label>
|
||
|
<div class="col-sm-8">
|
||
|
<input name="customerNumber" class="form-control" type="text" >
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<label class="col-sm-3 control-label">版本号:</label>
|
||
|
<div class="col-sm-8">
|
||
|
<input name="versionNumber" class="form-control" type="text" >
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<label class="col-sm-3 control-label">规格型号:</label>
|
||
|
<div class="col-sm-8">
|
||
|
<input name="specificationModel" class="form-control" type="text" >
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<label class="col-sm-3 control-label">单位:</label>
|
||
|
<div class="col-sm-8">
|
||
|
<!-- <input name="inventoryUnit" class="form-control" type="text" >-->
|
||
|
<select name="inventoryUnit" class="form-control m-b" th:with="type=${@dict.getType('sys_unit_class')}">
|
||
|
<option value=""></option>
|
||
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||
|
</select>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<label class="col-sm-3 control-label">当前版本:</label>
|
||
|
<div class="col-sm-8">
|
||
|
<div class="radio-box" th:each="dict : ${@dict.getType('sys_whether')}">
|
||
|
<input type="radio" th:id="${'currentVersion_' + dict.dictCode}" name="currentVersion"
|
||
|
th:value="${dict.dictValue}" th:checked="${dict.default}">
|
||
|
<label th:for="${'currentVersion_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<label class="col-sm-3 control-label">确认否:</label>
|
||
|
<div class="col-sm-8">
|
||
|
<div class="radio-box" th:each="dict : ${@dict.getType('sys_whether')}">
|
||
|
<input type="radio" th:id="${'confirmNo_' + dict.dictCode}" name="confirmNo"
|
||
|
th:value="${dict.dictValue}" th:checked="${dict.default}">
|
||
|
<label th:for="${'confirmNo_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<!-- <div class="form-group"> -->
|
||
|
<!-- <label class="col-sm-3 control-label">备用一:</label>-->
|
||
|
<!-- <div class="col-sm-8">-->
|
||
|
<!-- <input name="standbyOne" class="form-control" type="text">-->
|
||
|
<!-- </div>-->
|
||
|
<!-- </div>-->
|
||
|
<!-- <div class="form-group"> -->
|
||
|
<!-- <label class="col-sm-3 control-label">备用二:</label>-->
|
||
|
<!-- <div class="col-sm-8">-->
|
||
|
<!-- <input name="standbyTwo" class="form-control" type="text">-->
|
||
|
<!-- </div>-->
|
||
|
<!-- </div>-->
|
||
|
</form>
|
||
|
</div>
|
||
|
|
||
|
<div class="other-container">
|
||
|
<div class="other">
|
||
|
<div class="btn-group-sm" id="toraw" role="group">
|
||
|
<a class="btn btn-primary" onclick="addrawLine()">
|
||
|
<i class="fa fa-plus"></i> 新增一行
|
||
|
</a>
|
||
|
<a class="btn btn-primary" onclick="addraw()">
|
||
|
<i class="fa fa-plus"></i> 添加原料
|
||
|
</a>
|
||
|
<!-- <a class="btn btn-success" onclick="confirmraw()">-->
|
||
|
<!-- <i class="fa fa-plus"></i> 确认添加-->
|
||
|
<!-- </a>-->
|
||
|
</div>
|
||
|
<div class="col-sm-12 select-table table-striped">
|
||
|
<table id="addrowbomTable"></table>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="modal inmodal" id="RawModal"
|
||
|
role="dilog" aria-hidden="true">
|
||
|
<div class="modal-dialog" style="width: 1000px;background-color: #FFFFFF">
|
||
|
<div class="modal-content" style="background-color: #FFFFFF">
|
||
|
<div class="title">原料资料</div>
|
||
|
<div class="modal-body">
|
||
|
<div class="search">
|
||
|
<div class="col-sm-12 search-collapse">
|
||
|
<form id="formRawMaterialSearch">
|
||
|
<div class="select-list">
|
||
|
<ul>
|
||
|
<li>
|
||
|
<label>原料代码:</label>
|
||
|
<input type="text" name="rawMaterialCode"/>
|
||
|
</li>
|
||
|
<li>
|
||
|
<label>原料名称:</label>
|
||
|
<input type="text" name="rawMaterialName"/>
|
||
|
</li>
|
||
|
|
||
|
<li>
|
||
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="rawMaterialSearch()"><i class="fa fa-search"></i> 搜索</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="table-responsive">
|
||
|
<table id="rowbomTable" class="table table-striped table-responsive"
|
||
|
style="padding-bottom: 50px; white-space:nowrap">
|
||
|
</table>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="modal-footer">
|
||
|
<button type="button" class="btn btn-default" data-dismiss="modal" onclick="addrowconfirm()">
|
||
|
确定
|
||
|
</button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="other">
|
||
|
<div class="btn-group-sm" id="tosubsidiary" role="group">
|
||
|
<a class="btn btn-primary" onclick="addsubsidiaryLine()">
|
||
|
<i class="fa fa-plus"></i> 新增一行
|
||
|
</a>
|
||
|
<a class="btn btn-primary" onclick="addsubsidiary()">
|
||
|
<i class="fa fa-plus"></i> 添加辅料
|
||
|
</a>
|
||
|
<!-- <a class="btn btn-success" onclick="confirmsubsidiary()">-->
|
||
|
<!-- <i class="fa fa-plus"></i> 确认添加-->
|
||
|
<!-- </a>-->
|
||
|
</div>
|
||
|
<div class="col-sm-12 select-table table-striped">
|
||
|
<table id="addsubsidiarybomTable"></table>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="modal inmodal" id="subsidiaryModal"
|
||
|
role="dilog" aria-hidden="true">
|
||
|
<div class="modal-dialog" style="width: 1000px;background-color: #FFFFFF">
|
||
|
<div class="modal-content" style="background-color: #FFFFFF">
|
||
|
<div class="title">辅料资料</div>
|
||
|
<div class="modal-body">
|
||
|
<div class="search">
|
||
|
<div class="col-sm-12 search-collapse">
|
||
|
<form id="formSubsidiarySearch">
|
||
|
<div class="select-list">
|
||
|
<ul>
|
||
|
<li>
|
||
|
<label>辅料代码:</label>
|
||
|
<input type="text" name="subsidiaryMaterialCode"/>
|
||
|
</li>
|
||
|
<li>
|
||
|
<label>辅料名称:</label>
|
||
|
<input type="text" name="subsidiaryMaterialName"/>
|
||
|
</li>
|
||
|
|
||
|
<li>
|
||
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="subsidiarySearch()"><i class="fa fa-search"></i> 搜索</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="table-responsive">
|
||
|
<table id="subsidiarybomTable" class="table table-striped table-responsive"
|
||
|
style="padding-bottom: 50px; white-space:nowrap">
|
||
|
</table>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="modal-footer">
|
||
|
<button type="button" class="btn btn-default" data-dismiss="modal" onclick="addsubsidiaryconfirm()">
|
||
|
确定
|
||
|
</button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="modal inmodal" id="productInfoModal"
|
||
|
role="dilog" aria-hidden="true">
|
||
|
|
||
|
<!-- 查询成品资料-->
|
||
|
<div class="modal-dialog" style="width: 1000px;background-color: #FFFFFF">
|
||
|
|
||
|
<div class="modal-content" style="background-color: #FFFFFF">
|
||
|
|
||
|
<div class="modal-body">
|
||
|
<div class="container-div">
|
||
|
<div class="row">
|
||
|
<div class="col-sm-12 search-collapse">
|
||
|
<form id="productFormId">
|
||
|
<div class="select-list">
|
||
|
<ul>
|
||
|
<li>
|
||
|
<label>成品代码:</label>
|
||
|
<input type="text" name="finishProductCode"/>
|
||
|
</li>
|
||
|
<li>
|
||
|
<label>成品名称:</label>
|
||
|
<input type="text" name="finishProductName"/>
|
||
|
</li>
|
||
|
<li>
|
||
|
<label>客户代码:</label>
|
||
|
<input type="text" name="enterpriseCode"/>
|
||
|
</li>
|
||
|
<li>
|
||
|
<label>客户名称:</label>
|
||
|
<input type="text" name="enterpriseName"/>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('productFormId','productTable')"><i
|
||
|
class="fa fa-search"></i> 搜索</a>
|
||
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('productFormId','productTable')"><i
|
||
|
class="fa fa-refresh"></i> 重置</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</form>
|
||
|
</div>
|
||
|
<div class="col-sm-12 select-table table-striped">
|
||
|
<table id="productTable" style="white-space:nowrap"></table>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="modal-footer">
|
||
|
<a class="btn btn-warning btn-rounded" onclick="addProductToTable()">确认添加</a>
|
||
|
<a class="btn btn-primary btn-rounded" onclick="closeProductModal()">关闭</a>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<th:block th:include="include :: footer"/>
|
||
|
<th:block th:include="include :: select2-js"/>
|
||
|
<th:block th:include="include :: bootstrap-table-editable-js"/>
|
||
|
|
||
|
<th:block th:include="include :: datetimepicker-js"/>
|
||
|
<script th:inline="javascript">
|
||
|
|
||
|
|
||
|
var inventoryUnitDatas = [[${@dict.getType('sys_unit_class')}]];
|
||
|
|
||
|
var finishProductdata = []
|
||
|
|
||
|
var prefix = ctx + "system/bom"
|
||
|
var prefixfinishproduct = ctx + "system/finishproduct"
|
||
|
|
||
|
var inventoryUnitDatas = [[${@dict.getType('sys_unit_class')}]];
|
||
|
var whetherStopDatas = [[${@dict.getType('sys_whether')}]];
|
||
|
var productionCategoryDatas = [[${@dict.getType('sys_production_category')}]];
|
||
|
var finishProductCategoryDatas = [[${@dict.getType('sys_finish_product_category')}]];
|
||
|
var commonCurrencyDatas = [[${@dict.getType('sys_common_currency')}]];
|
||
|
|
||
|
$("#form-bom-add").validate({
|
||
|
focusCleanup: true
|
||
|
});
|
||
|
|
||
|
function submitHandler() {
|
||
|
|
||
|
let finishProductCode = $("input[name='finishProductCode']").val()
|
||
|
$.ajax({
|
||
|
url: ctx + 'system/bom/list',
|
||
|
type: "POST",
|
||
|
dataType: "json",
|
||
|
data:{
|
||
|
finishProductCode:finishProductCode
|
||
|
},
|
||
|
success: function (resp) {
|
||
|
if(finishProductCode){
|
||
|
if(resp.rows.length>0){
|
||
|
$.modal.alert("该成品已存在物料清单")
|
||
|
}
|
||
|
else {
|
||
|
if ($.validate.form()) {
|
||
|
confirmraw()
|
||
|
confirmsubsidiary()
|
||
|
$.operate.save(prefix + "/add", $('#form-bom-add').serialize());
|
||
|
}
|
||
|
}
|
||
|
}else {
|
||
|
$.modal.alert("请选择成品代码")
|
||
|
|
||
|
}
|
||
|
|
||
|
},
|
||
|
|
||
|
})
|
||
|
|
||
|
}
|
||
|
|
||
|
$("input[name='bomTime']").datetimepicker({
|
||
|
format: "yyyy-mm-dd",
|
||
|
minView: "month",
|
||
|
autoclose: true
|
||
|
});
|
||
|
|
||
|
//成品显示
|
||
|
function chooseFinishProduct () {
|
||
|
$("#productTable").bootstrapTable("destroy")
|
||
|
var options = {
|
||
|
id: 'productTable',
|
||
|
url: prefixfinishproduct + "/list",
|
||
|
pagination: true,
|
||
|
pageNumber: 1,
|
||
|
pageSize: 10,
|
||
|
showRefresh: false,
|
||
|
showToggle: false,
|
||
|
clickToSelect: true,
|
||
|
modalName: "产品资料",
|
||
|
queryParams: function (params) {
|
||
|
var curParams = {
|
||
|
// 传递参数查询参数
|
||
|
pageSize: params.limit,
|
||
|
pageNum: params.offset / params.limit + 1,
|
||
|
// enterpriseCode: data[0].enterpriseCode
|
||
|
|
||
|
};
|
||
|
let json = $.extend(curParams, $.common.formToJSON("productFormId"));
|
||
|
return json;
|
||
|
},
|
||
|
columns: [{
|
||
|
checkbox: true
|
||
|
},
|
||
|
{
|
||
|
field: 'finishProductId',
|
||
|
title: '成品id',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'customerNumber',
|
||
|
title: '客户料号'
|
||
|
},
|
||
|
{
|
||
|
field: 'typeMachine',
|
||
|
title: '机种'
|
||
|
},
|
||
|
{
|
||
|
field: 'finishProductName',
|
||
|
title: '成品名称'
|
||
|
},
|
||
|
{
|
||
|
field: 'enterpriseCode',
|
||
|
title: '客户代码'
|
||
|
},
|
||
|
{
|
||
|
field: 'enterpriseName',
|
||
|
title: '客户名称'
|
||
|
},
|
||
|
{
|
||
|
field: 'inventoryUnit',
|
||
|
title: '库存单位',
|
||
|
formatter: function(value, row, index) {
|
||
|
return $.table.selectDictLabel(inventoryUnitDatas, value);
|
||
|
},
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'versionNumber',
|
||
|
title: '版本号'
|
||
|
},
|
||
|
{
|
||
|
field: 'finishProductCode',
|
||
|
title: '成品代码'
|
||
|
},
|
||
|
{
|
||
|
field: 'safetyStock',
|
||
|
title: '安全库存',
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'stockUnitWeight',
|
||
|
title: '单位重量',
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'gpItemSelection',
|
||
|
title: 'GP项选择',
|
||
|
formatter: function(value, row, index) {
|
||
|
return $.table.selectDictLabel(gpItemSelectionDatas, value);
|
||
|
},
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'inPlantCode',
|
||
|
title: '厂内编码'
|
||
|
},
|
||
|
{
|
||
|
field: 'whetherStop',
|
||
|
title: '料号是否停用',
|
||
|
formatter: function(value, row, index) {
|
||
|
return $.table.selectDictLabel(whetherStopDatas, value);
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'createrName',
|
||
|
title: '创建人',
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'ordinalName',
|
||
|
title: '半成品对应完工工序名',
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'originalNumber',
|
||
|
title: '原成品料号',
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'customsName',
|
||
|
title: '海关名称',
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'defaultWarehouse',
|
||
|
title: '默认仓库'
|
||
|
},
|
||
|
{
|
||
|
field: 'materialCategory',
|
||
|
title: '类别',
|
||
|
formatter: function(value, row, index) {
|
||
|
return $.table.selectDictLabel(materialCategoryDatas, value);
|
||
|
},
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'productionCategory',
|
||
|
title: '生产类别',
|
||
|
formatter: function(value, row, index) {
|
||
|
return $.table.selectDictLabel(productionCategoryDatas, value);
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'finishProductCategory',
|
||
|
title: '所属类别',
|
||
|
formatter: function(value, row, index) {
|
||
|
return $.table.selectDictLabel(finishProductCategoryDatas, value);
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'specificationModel',
|
||
|
title: '规格型号'
|
||
|
},
|
||
|
{
|
||
|
field: 'customerEngineer',
|
||
|
title: '客户工程师'
|
||
|
},
|
||
|
{
|
||
|
field: 'productDescription',
|
||
|
title: '产品描述',
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'maximumInventory',
|
||
|
title: '最高库存',
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'productPrice',
|
||
|
title: '产品售价',
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'componentName',
|
||
|
title: '组件名称',
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'createrTime',
|
||
|
title: '创建日期',
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'ordinalNumber',
|
||
|
title: '半成品对应完工工序号',
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'defaultLocation',
|
||
|
title: '默认位置',
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'hsNumber',
|
||
|
title: 'HS号',
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'kesNumber',
|
||
|
title: '科恩仕料号'
|
||
|
}]
|
||
|
};
|
||
|
$.table.init(options);
|
||
|
$("#productInfoModal").modal("show");
|
||
|
}
|
||
|
|
||
|
//关闭成品
|
||
|
function closeProductModal() {
|
||
|
$("#productInfoModal").modal("hide");
|
||
|
}
|
||
|
//确认成品
|
||
|
function confirmProduct() {
|
||
|
var data = $("#productTable").bootstrapTable("getSelections");
|
||
|
console.log(data)
|
||
|
if (data.length === 1) {
|
||
|
$("#productInfoModal").modal("hide");
|
||
|
$("#form-bom-add input[name='finishProductCode']").val(data[0].finishProductCode)
|
||
|
$("#form-bom-add input[name='finishProductName']").val(data[0].finishProductName)
|
||
|
$("#form-bom-add input[name='enterpriseCode']").val(data[0].enterpriseCode)
|
||
|
$("#form-bom-add input[name='enterpriseName']").val(data[0].enterpriseName)
|
||
|
$("#form-bom-add input[name='customerNumber']").val(data[0].customerNumber)
|
||
|
$("#form-bom-add input[name='versionNumber']").val(data[0].versionNumber)
|
||
|
$("#form-bom-add input[name='specificationModel']").val(data[0].specificationModel)
|
||
|
$("#form-bom-add select[name='inventoryUnit']").val(data[0].inventoryUnit).trigger("change");
|
||
|
} else {
|
||
|
$.modal.msgWarning("请选择一条数据")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
// 获取成品资料
|
||
|
$(document).ready(function () {
|
||
|
$.ajax({
|
||
|
url: ctx + "system/finishproduct/finishList",
|
||
|
type: "POST",
|
||
|
success: function (res) {
|
||
|
|
||
|
if (res.length > 0) {
|
||
|
finishProductdata = res;
|
||
|
for (let i in finishProductdata) {
|
||
|
$("select[name='finishProductCode']").append("<option value='" + finishProductdata[i].finishProductCode + "'>" + finishProductdata[i].finishProductCode + "</option>");
|
||
|
$("select[name='finishProductName']").append("<option value='" + finishProductdata[i].finishProductName + "'>" + finishProductdata[i].finishProductName + "</option>");
|
||
|
|
||
|
}
|
||
|
|
||
|
} else {
|
||
|
$.modal.msgError(res.msg);
|
||
|
}
|
||
|
},
|
||
|
error: function () {
|
||
|
$.modal.msgError("后台出错啦!");
|
||
|
|
||
|
}
|
||
|
|
||
|
})
|
||
|
})
|
||
|
// 成品代码下拉框改变
|
||
|
|
||
|
$("select[name='finishProductCode']").change(function () {
|
||
|
var finishProductCode = $(this).val();
|
||
|
for (i = 0; i < finishProductdata.length; i++) {
|
||
|
if (finishProductdata[i].finishProductCode == finishProductCode) {
|
||
|
$("#form-bom-add input[name='finishProductName']").val(finishProductdata[i].finishProductName)
|
||
|
$("#form-bom-add input[name='enterpriseCode']").val(finishProductdata[i].enterpriseCode)
|
||
|
$("#form-bom-add input[name='enterpriseName']").val(finishProductdata[i].enterpriseName)
|
||
|
$("#form-bom-add input[name='customerNumber']").val(finishProductdata[i].customerNumber)
|
||
|
$("#form-bom-add input[name='versionNumber']").val(finishProductdata[i].versionNumber)
|
||
|
$("#form-bom-add input[name='specificationModel']").val(finishProductdata[i].specificationModel)
|
||
|
$("#form-bom-add input[name='inventoryUnit']").val(finishProductdata[i].inventoryUnit)
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
|
||
|
// 搜索
|
||
|
function rawMaterialSearch(){
|
||
|
$("#rowbomTable").bootstrapTable("refresh");
|
||
|
}
|
||
|
function subsidiarySearch(){
|
||
|
$("#subsidiarybomTable").bootstrapTable("refresh");
|
||
|
}
|
||
|
|
||
|
// 增加原料
|
||
|
function addraw() {
|
||
|
$("#RawModal").modal("show");
|
||
|
}
|
||
|
|
||
|
// 原料表格
|
||
|
$('#rowbomTable').bootstrapTable({
|
||
|
url: ctx + "system/rawmaterial/itemList",
|
||
|
pagination: true,
|
||
|
pageNumber: 1,
|
||
|
pageSize: 10,
|
||
|
pageList: [10, 25, 50, 100],
|
||
|
showRefresh: false,
|
||
|
method: "post",
|
||
|
contentType: "application/x-www-form-urlencoded",
|
||
|
striped: true, // 是否显示行间隔色
|
||
|
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
|
||
|
sidePagination: "server", // 分页方式:client客户端分页,server服务端分页(*)
|
||
|
clickToSelect: true, // 是否启用点击选中行
|
||
|
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
|
||
|
cardView: false, // 是否显示详细视图
|
||
|
detailView: false, // 是否显示父子表
|
||
|
smartDisplay: false, // 加了这个才显示每页显示的行数
|
||
|
showExport: false, // 是否显示导出按钮
|
||
|
// singleSelect: true,
|
||
|
paginationDetailHAlign: ' hiddenDetailInfo',
|
||
|
height: 250,
|
||
|
queryParams: function (params) {
|
||
|
//console.log("123");
|
||
|
var curParams = {
|
||
|
// 传递参数查询参数
|
||
|
pageSize: params.limit,
|
||
|
pageNum: params.offset / params.limit + 1,
|
||
|
// enterpriseCode: data[0].enterpriseCode
|
||
|
|
||
|
};
|
||
|
let json = $.extend(curParams, $.common.formToJSON("formRawMaterialSearch"));
|
||
|
return json;
|
||
|
// return curParams
|
||
|
},
|
||
|
columns: [
|
||
|
{
|
||
|
checkbox: true
|
||
|
},
|
||
|
{
|
||
|
field: 'rawMaterialId',
|
||
|
title: '原料id',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'rawMaterialCode',
|
||
|
title: '原料代码'
|
||
|
},
|
||
|
{
|
||
|
field: 'rawMaterialName',
|
||
|
title: '原料名称'
|
||
|
},
|
||
|
{
|
||
|
field: 'materialCategory',
|
||
|
title: '原料类别',
|
||
|
// formatter: function(value, row, index) {
|
||
|
// return $.table.selectDictLabel(materialCategoryDatas, value);
|
||
|
// }
|
||
|
},
|
||
|
{
|
||
|
field: 'rawMaterialColour',
|
||
|
title: '颜色',
|
||
|
// visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'typeMachine',
|
||
|
title: '机种'
|
||
|
},
|
||
|
|
||
|
{
|
||
|
field: 'specificationModel',
|
||
|
title: '规格型号'
|
||
|
},
|
||
|
{
|
||
|
field: 'inventoryUnit',
|
||
|
title: '库存单位',
|
||
|
// formatter: function(value, row, index) {
|
||
|
// return $.table.selectDictLabel(inventoryUnitDatas, value);
|
||
|
// }
|
||
|
},
|
||
|
{
|
||
|
field: 'exportSales',
|
||
|
title: '内外销',
|
||
|
// formatter: function(value, row, index) {
|
||
|
// return $.table.selectDictLabel(exportSalesDatas, value);
|
||
|
// }
|
||
|
},
|
||
|
{
|
||
|
field: 'purchasingUnit',
|
||
|
title: '采购单位',
|
||
|
// formatter: function(value, row, index) {
|
||
|
// return $.table.selectDictLabel(purchasingUnitDatas, value);
|
||
|
// },
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'purchasePrice',
|
||
|
title: '采购价格'
|
||
|
},
|
||
|
{
|
||
|
field: 'limitCollectionAmount',
|
||
|
title: '限额领用数',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'stockUnitWeight',
|
||
|
title: '库存单位重量',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'safetyStock',
|
||
|
title: '安全库存'
|
||
|
},
|
||
|
{
|
||
|
field: 'purchaseLeadTime',
|
||
|
title: '采购提前期',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'specialUse',
|
||
|
title: '专用部门或人',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'whetherStop',
|
||
|
title: '料号是否停用',
|
||
|
// formatter: function(value, row, index) {
|
||
|
// return $.table.selectDictLabel(whetherStopDatas, value);
|
||
|
// }
|
||
|
},
|
||
|
{
|
||
|
field: 'createrName',
|
||
|
title: '创建人',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'limitWhether',
|
||
|
title: '限额领用否',
|
||
|
// formatter: function(value, row, index) {
|
||
|
// return $.table.selectDictLabel(limitWhetherDatas, value);
|
||
|
// },
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'dedicatedWhether',
|
||
|
title: '是否专用'
|
||
|
},
|
||
|
{
|
||
|
field: 'minimumBatchSize',
|
||
|
title: '最小批量',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'whetherSemiManufactures',
|
||
|
title: '是否半成品',
|
||
|
// formatter: function(value, row, index) {
|
||
|
// return $.table.selectDictLabel(whetherSemiManufacturesDatas, value);
|
||
|
// },
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'customsName',
|
||
|
title: '海关名称',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'supplierNumber',
|
||
|
title: '供应商料号'
|
||
|
},
|
||
|
{
|
||
|
field: 'rawMaterialDiameter',
|
||
|
title: '直径'
|
||
|
},
|
||
|
{
|
||
|
field: 'supplierCode',
|
||
|
title: '供应商代码'
|
||
|
},
|
||
|
{
|
||
|
field: 'supplierName',
|
||
|
title: '供应商名称'
|
||
|
},
|
||
|
{
|
||
|
field: 'warehouseLocation',
|
||
|
title: '库位'
|
||
|
},
|
||
|
{
|
||
|
field: 'purchaseEquivalent',
|
||
|
title: '采购单位对应多少库存单位',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'maximumPurchaseQuantity',
|
||
|
title: '最大采购量',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'costPrice',
|
||
|
title: '成本价'
|
||
|
},
|
||
|
{
|
||
|
field: 'primarySupplier',
|
||
|
title: '主供应商'
|
||
|
},
|
||
|
{
|
||
|
field: 'subSupplier',
|
||
|
title: '次供应商'
|
||
|
},
|
||
|
{
|
||
|
field: 'maximumInventory',
|
||
|
title: '最高库存'
|
||
|
},
|
||
|
{
|
||
|
field: 'detentionDays',
|
||
|
title: '滞留天数'
|
||
|
},
|
||
|
{
|
||
|
field: 'gpItemSelection',
|
||
|
title: 'GP项选择',
|
||
|
// formatter: function(value, row, index) {
|
||
|
// return $.table.selectDictLabel(gpItemSelectionDatas, value);
|
||
|
// },
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'createrTime',
|
||
|
title: '创建日期',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'defaultWarehouse',
|
||
|
title: '默认仓库'
|
||
|
},
|
||
|
{
|
||
|
field: 'hsNumber',
|
||
|
title: '海关HS号',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'standbyOne',
|
||
|
title: '备用一',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'standbyTwo',
|
||
|
title: '备用二',
|
||
|
visible: false
|
||
|
}
|
||
|
]
|
||
|
|
||
|
});
|
||
|
$('#addrowbomTable').bootstrapTable({
|
||
|
// url : ctx + "system/rawmaterial/itemList",
|
||
|
pagination: true,
|
||
|
pageNumber: 1,
|
||
|
pageSize: 10,
|
||
|
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
|
||
|
cardView: false, // 是否显示详细视图
|
||
|
detailView: false, // 是否显示父子表
|
||
|
smartDisplay: false, // 加了这个才显示每页显示的行数
|
||
|
showExport: false, // 是否显示导出按钮
|
||
|
// singleSelect: true,
|
||
|
paginationDetailHAlign: ' hiddenDetailInfo',
|
||
|
height: 250,
|
||
|
uniqueId: 'rawMaterialCode',
|
||
|
queryParams: function (params) {
|
||
|
//console.log("123");
|
||
|
var curParams = {
|
||
|
// 传递参数查询参数
|
||
|
pageSize: params.limit,
|
||
|
pageNum: params.offset / params.limit + 1,
|
||
|
// enterpriseCode: data[0].enterpriseCode
|
||
|
|
||
|
};
|
||
|
return curParams
|
||
|
},
|
||
|
columns: [
|
||
|
{
|
||
|
checkbox: true
|
||
|
},
|
||
|
{
|
||
|
field: 'rawMaterialCode',
|
||
|
title: '原料代码',
|
||
|
editable: {
|
||
|
type: 'text',
|
||
|
title: '原料代码',
|
||
|
emptytext: '原料代码',
|
||
|
validate: function (value) {
|
||
|
if ($.trim(value) == '') {
|
||
|
return '原料代码不能为空!';
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'rawMaterialName',
|
||
|
title: '原料名称',
|
||
|
editable: {
|
||
|
type: 'text',
|
||
|
title: '原料名称',
|
||
|
emptytext: '原料名称',
|
||
|
validate: function (value) {
|
||
|
if ($.trim(value) == '') {
|
||
|
return '原料名称不能为空!';
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'specificationModel',
|
||
|
title: '规格型号',
|
||
|
editable: {
|
||
|
type: 'text',
|
||
|
title: '规格型号',
|
||
|
emptytext: '规格型号',
|
||
|
validate: function (value) {
|
||
|
if ($.trim(value) == '') {
|
||
|
return '规格型号不能为空!';
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'inventoryUnit',
|
||
|
title: '单位',
|
||
|
editable: {
|
||
|
type: 'select',
|
||
|
title: '单位',
|
||
|
emptytext: '单位',
|
||
|
source: function() {
|
||
|
let result = [];
|
||
|
for (let i = 0;i<inventoryUnitDatas.length;i++) {
|
||
|
result.push({value: inventoryUnitDatas[i].dictValue,text: inventoryUnitDatas[i].dictLabel})
|
||
|
}
|
||
|
return result;
|
||
|
},
|
||
|
validate: function (value) {
|
||
|
if ($.trim(value) == '') {
|
||
|
return '单位不能为空!';
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'rawMaterialConsumption',
|
||
|
title: '用量',
|
||
|
editable: {
|
||
|
type: 'text',
|
||
|
title: '使用量',
|
||
|
emptytext: '使用量',
|
||
|
validate: function (value) {
|
||
|
if (isNaN(value)) return '使用量必须是数字';
|
||
|
var price = parseFloat(value);
|
||
|
if (price <= 0) return '使用量必须大于0';
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'rawMaterialLoss',
|
||
|
title: '损耗%',
|
||
|
editable: {
|
||
|
type: 'text',
|
||
|
title: '损耗%',
|
||
|
emptytext: '损耗%',
|
||
|
validate: function (value) {
|
||
|
if (isNaN(value)) return '使用量必须是数字';
|
||
|
var price = parseFloat(value);
|
||
|
if (price <= 0) return '使用量必须大于0';
|
||
|
}
|
||
|
}
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'supplierNumber',
|
||
|
title: '厂商料号',
|
||
|
editable: {
|
||
|
type: 'text',
|
||
|
title: '厂商料号',
|
||
|
emptytext: '厂商料号',
|
||
|
validate: function (value) {
|
||
|
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'finishedProductQuantity',
|
||
|
title: '成品数量',
|
||
|
editable: {
|
||
|
type: 'text',
|
||
|
title: '成品数量',
|
||
|
emptytext: '成品数量',
|
||
|
validate: function (value) {
|
||
|
if (isNaN(value)) return '使用量必须是数字';
|
||
|
var price = parseFloat(value);
|
||
|
if (price <= 0) return '使用量必须大于0';
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'remarks',
|
||
|
title: '备注说明',
|
||
|
editable: {
|
||
|
type: 'text',
|
||
|
title: '备注说明',
|
||
|
emptytext: '备注说明',
|
||
|
validate: function (value) {
|
||
|
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'processingCategory',
|
||
|
title: '加工类别',
|
||
|
editable: {
|
||
|
type: 'text',
|
||
|
title: '加工类别',
|
||
|
emptytext: '加工类别',
|
||
|
validate: function (value) {
|
||
|
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
title: '操作',
|
||
|
align: 'center',
|
||
|
formatter: function (value, row, index) {
|
||
|
var actions = [];
|
||
|
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="remove(\'' + row.rawMaterialCode + '\')" ><i class="fa fa-remove"></i>删除</a>');
|
||
|
return actions.join('');
|
||
|
}
|
||
|
}]
|
||
|
|
||
|
});
|
||
|
|
||
|
// 原料添加
|
||
|
function addrowconfirm() {
|
||
|
var data = $("#rowbomTable").bootstrapTable("getSelections");
|
||
|
var count = $('#addrowbomTable').bootstrapTable('getData').length;
|
||
|
for (i = 0; i < data.length; i++) {
|
||
|
var finishProductCode = $("input[name='finishProductCode']").val()
|
||
|
let bootstrapTable = $('#addrowbomTable').bootstrapTable('getRowByUniqueId', data[i].rawMaterialCode);
|
||
|
if (bootstrapTable != null) {
|
||
|
$.modal.alert(bootstrapTable.rawMaterialName + "已存在,不可重复添加!");
|
||
|
continue;
|
||
|
}
|
||
|
$("#addrowbomTable").bootstrapTable('insertRow', {
|
||
|
index: count + i,
|
||
|
row: {
|
||
|
finishProductcode: finishProductCode,
|
||
|
rawMaterialCode: data[i].rawMaterialCode,
|
||
|
rawMaterialName: data[i].rawMaterialName,
|
||
|
specificationModel: data[i].specificationModel,
|
||
|
inventoryUnit: data[i].inventoryUnit,
|
||
|
supplierNumber: data[i].supplierNumber,
|
||
|
rawMaterialConsumption: '',
|
||
|
rawMaterialLoss: '',
|
||
|
finishedProductQuantity: '',
|
||
|
remarks: '',
|
||
|
processingCategory: ''
|
||
|
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
$("#rowbomTable").bootstrapTable("uncheckAll");
|
||
|
// console.log($('#addrowbomTable').bootstrapTable('getData'))
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
// 确认添加原料
|
||
|
function confirmraw() {
|
||
|
$("#addrowbomTable").bootstrapTable('refresh');
|
||
|
// console.log(data)
|
||
|
let data = $('#addrowbomTable').bootstrapTable('getData', true)
|
||
|
// console.log(data.length)
|
||
|
for (let i=0;i<data.length;i++) {
|
||
|
// console.log(data[i])
|
||
|
//新原料数据添加
|
||
|
$.ajax({
|
||
|
url: ctx + 'system/rawmaterial/list',
|
||
|
type: 'post',
|
||
|
data: {
|
||
|
rawMaterialCode : data[i].rawMaterialCode
|
||
|
},
|
||
|
success: function (res) {
|
||
|
// console.log(res)
|
||
|
if (res.rows.length === 0) {//不存在
|
||
|
// console.log(data[i].rawMaterialCode+"unExist!")
|
||
|
$.ajax({
|
||
|
url: ctx + 'system/rawmaterial/addFromBom',
|
||
|
type: "POST",
|
||
|
data: {
|
||
|
data: JSON.stringify(data[i])
|
||
|
},
|
||
|
dataType: "json",
|
||
|
success: function (resp) {
|
||
|
console.log(resp)
|
||
|
}
|
||
|
})
|
||
|
} else {//存在
|
||
|
// console.log(data[i].rawMaterialCode+"exist!")
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
//bom原料数据添加
|
||
|
$.ajax({
|
||
|
url: ctx + 'system/bomrawmaterial/add',
|
||
|
type: "POST",
|
||
|
data: {
|
||
|
data: JSON.stringify(data)
|
||
|
},
|
||
|
dataType: "json",
|
||
|
success: function (resp) {
|
||
|
console.log(resp)
|
||
|
},
|
||
|
|
||
|
})
|
||
|
|
||
|
}
|
||
|
|
||
|
//原料删除
|
||
|
function remove(rawMaterialCode){
|
||
|
var ids = [];
|
||
|
ids.push(rawMaterialCode);
|
||
|
$('#addrowbomTable').bootstrapTable("remove",{
|
||
|
field:'rawMaterialCode',
|
||
|
values:ids
|
||
|
})
|
||
|
$("#addrowbomTable").bootstrapTable('refresh');
|
||
|
}
|
||
|
|
||
|
// 增加辅料
|
||
|
function addsubsidiary() {
|
||
|
$("#subsidiaryModal").modal("show");
|
||
|
|
||
|
}
|
||
|
|
||
|
// 辅料
|
||
|
$('#subsidiarybomTable').bootstrapTable({
|
||
|
url: ctx + "system/subsidiarymaterial/itemList",
|
||
|
pagination: true,
|
||
|
pageNumber: 1,
|
||
|
pageSize: 10,
|
||
|
pageList: [10, 25, 50, 100],
|
||
|
showRefresh: false,
|
||
|
method: "post",
|
||
|
contentType: "application/x-www-form-urlencoded",
|
||
|
striped: true, // 是否显示行间隔色
|
||
|
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
|
||
|
sidePagination: "server", // 分页方式:client客户端分页,server服务端分页(*)
|
||
|
clickToSelect: true, // 是否启用点击选中行
|
||
|
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
|
||
|
cardView: false, // 是否显示详细视图
|
||
|
detailView: false, // 是否显示父子表
|
||
|
smartDisplay: false, // 加了这个才显示每页显示的行数
|
||
|
showExport: false, // 是否显示导出按钮
|
||
|
// singleSelect: true,
|
||
|
paginationDetailHAlign: ' hiddenDetailInfo',
|
||
|
height: 250,
|
||
|
queryParams: function (params) {
|
||
|
//console.log("123");
|
||
|
var curParams = {
|
||
|
// 传递参数查询参数
|
||
|
pageSize: params.limit,
|
||
|
pageNum: params.offset / params.limit + 1,
|
||
|
// enterpriseCode: data[0].enterpriseCode
|
||
|
|
||
|
};
|
||
|
let json = $.extend(curParams, $.common.formToJSON("formSubsidiarySearch"));
|
||
|
return json;
|
||
|
// return curParams
|
||
|
},
|
||
|
columns: [
|
||
|
{
|
||
|
checkbox: true
|
||
|
},
|
||
|
{
|
||
|
field: 'subsidiaryMaterialId',
|
||
|
title: '辅料id',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'subsidiaryMaterialCode',
|
||
|
title: '辅料代码'
|
||
|
},
|
||
|
{
|
||
|
field: 'hsNumber',
|
||
|
title: '海关HS号',
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'subsidiaryMaterialName',
|
||
|
title: '辅料名称'
|
||
|
},
|
||
|
{
|
||
|
field: 'stockUnitWeight',
|
||
|
title: '单位重量',
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'specificationModel',
|
||
|
title: '规格型号'
|
||
|
},
|
||
|
{
|
||
|
field: 'inventoryUnit',
|
||
|
title: '库存单位',
|
||
|
// formatter: function(value, row, index) {
|
||
|
// return $.table.selectDictLabel(inventoryUnitDatas, value);
|
||
|
// },
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'dedicatedWhether',
|
||
|
title: '是否专用',
|
||
|
// formatter: function(value, row, index) {
|
||
|
// return $.table.selectDictLabel(dedicatedWhetherDatas, value);
|
||
|
// },
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'customsName',
|
||
|
title: '海关名称',
|
||
|
visible: false
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'safetyStock',
|
||
|
title: '安全库存',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'remarks',
|
||
|
title: '备注说明',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'specialUse',
|
||
|
title: '专用部门或人',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'whetherStop',
|
||
|
title: '料号是否停用',
|
||
|
// formatter: function(value, row, index) {
|
||
|
// return $.table.selectDictLabel(whetherStopDatas, value);
|
||
|
// }
|
||
|
},
|
||
|
{
|
||
|
field: 'supplierNumber',
|
||
|
title: '供应商料号'
|
||
|
},
|
||
|
{
|
||
|
field: 'limitCollectionAmount',
|
||
|
title: '限额领用数',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'subsidiaryMaterialCategory',
|
||
|
title: '辅料类别',
|
||
|
// formatter: function(value, row, index) {
|
||
|
// return $.table.selectDictLabel(subsidiaryMaterialCategoryDatas, value);
|
||
|
// },
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'defaultWarehouse',
|
||
|
title: '默认仓库',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'warehouseLocation',
|
||
|
title: '库位',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'purchasePrice',
|
||
|
title: '采购价格',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'purchaseLeadTime',
|
||
|
title: '采购提前期',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'minimumBatchSize',
|
||
|
title: '最小批量',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'supplierCode',
|
||
|
title: '供应商代码'
|
||
|
},
|
||
|
{
|
||
|
field: 'supplierName',
|
||
|
title: '供应商名称'
|
||
|
},
|
||
|
{
|
||
|
field: 'limitWhether',
|
||
|
title: '限额领用否',
|
||
|
// formatter: function(value, row, index) {
|
||
|
// return $.table.selectDictLabel(limitWhetherDatas, value);
|
||
|
// },
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'maximumPurchaseQuantity',
|
||
|
title: '最大采购量',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'costPrice',
|
||
|
title: '成本价',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'primarySupplier',
|
||
|
title: '主供应商'
|
||
|
},
|
||
|
{
|
||
|
field: 'subSupplier',
|
||
|
title: '次供应商',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'maximumInventory',
|
||
|
title: '最高库存',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'detentionDays',
|
||
|
title: '滞留天数'
|
||
|
},
|
||
|
{
|
||
|
field: 'gpItemSelection',
|
||
|
title: 'GP项选择',
|
||
|
// formatter: function(value, row, index) {
|
||
|
// return $.table.selectDictLabel(gpItemSelectionDatas, value);
|
||
|
// },
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'exportSales',
|
||
|
title: '内外销',
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'createrName',
|
||
|
title: '创建人'
|
||
|
},
|
||
|
{
|
||
|
field: 'materialCategory',
|
||
|
title: '类别',
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'kesNumber',
|
||
|
title: '科恩仕料号'
|
||
|
},
|
||
|
{
|
||
|
field: 'typeMachine',
|
||
|
title: '机种'
|
||
|
},
|
||
|
{
|
||
|
field: 'standbyOne',
|
||
|
title: '备用一',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'standbyTwo',
|
||
|
title: '备用二',
|
||
|
visible: false
|
||
|
},
|
||
|
{
|
||
|
field: 'createrTime',
|
||
|
title: '创建时间',
|
||
|
visible: false
|
||
|
},
|
||
|
|
||
|
]
|
||
|
|
||
|
});
|
||
|
$('#addsubsidiarybomTable').bootstrapTable({
|
||
|
// url : ctx + "system/rawmaterial/itemList",
|
||
|
pagination: true,
|
||
|
pageNumber: 1,
|
||
|
pageSize: 10,
|
||
|
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
|
||
|
cardView: false, // 是否显示详细视图
|
||
|
detailView: false, // 是否显示父子表
|
||
|
smartDisplay: false, // 加了这个才显示每页显示的行数
|
||
|
showExport: false, // 是否显示导出按钮
|
||
|
// singleSelect: true,
|
||
|
paginationDetailHAlign: ' hiddenDetailInfo',
|
||
|
height: 250,
|
||
|
uniqueId: 'subsidiaryMaterialCode',
|
||
|
queryParams: function (params) {
|
||
|
//console.log("123");
|
||
|
var curParams = {
|
||
|
// 传递参数查询参数
|
||
|
pageSize: params.limit,
|
||
|
pageNum: params.offset / params.limit + 1,
|
||
|
// enterpriseCode: data[0].enterpriseCode
|
||
|
|
||
|
};
|
||
|
// console.log(data[0].enterpriseCode)
|
||
|
|
||
|
return curParams
|
||
|
},
|
||
|
columns: [
|
||
|
{
|
||
|
checkbox: true
|
||
|
},
|
||
|
{
|
||
|
field: 'subsidiaryMaterialCode',
|
||
|
title: '辅料代码',
|
||
|
editable: {
|
||
|
type: 'text',
|
||
|
title: '辅料代码',
|
||
|
emptytext: '辅料代码',
|
||
|
validate: function (value) {
|
||
|
if ($.trim(value) == '') {
|
||
|
return '辅料代码不能为空!';
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'subsidiaryMaterialName',
|
||
|
title: '辅料名称',
|
||
|
editable: {
|
||
|
type: 'text',
|
||
|
title: '辅料名称',
|
||
|
emptytext: '辅料名称',
|
||
|
validate: function (value) {
|
||
|
if ($.trim(value) == '') {
|
||
|
return '辅料名称不能为空!';
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'specificationModel',
|
||
|
title: '规格型号',
|
||
|
editable: {
|
||
|
type: 'text',
|
||
|
title: '规格型号',
|
||
|
emptytext: '规格型号',
|
||
|
validate: function (value) {
|
||
|
if ($.trim(value) == '') {
|
||
|
return '规格型号不能为空!';
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'inventoryUnit',
|
||
|
title: '单位',
|
||
|
editable: {
|
||
|
type: 'select',
|
||
|
title: '单位',
|
||
|
emptytext: '单位',
|
||
|
source: function() {
|
||
|
let result = [];
|
||
|
for (let i = 0;i<inventoryUnitDatas.length;i++) {
|
||
|
result.push({value: inventoryUnitDatas[i].dictValue,text: inventoryUnitDatas[i].dictLabel})
|
||
|
}
|
||
|
return result;
|
||
|
},
|
||
|
validate: function (value) {
|
||
|
if ($.trim(value) == '') {
|
||
|
return '单位不能为空!';
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'subsidiaryMaterialConsumption',
|
||
|
title: '用量',
|
||
|
editable: {
|
||
|
type: 'text',
|
||
|
title: '使用量',
|
||
|
emptytext: '使用量',
|
||
|
validate: function (value) {
|
||
|
if (isNaN(value)) return '使用量必须是数字';
|
||
|
var price = parseFloat(value);
|
||
|
if (price <= 0) return '使用量必须大于0';
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'subsidiaryMaterialLoss',
|
||
|
title: '损耗%',
|
||
|
editable: {
|
||
|
type: 'text',
|
||
|
title: '损耗%',
|
||
|
emptytext: '损耗%',
|
||
|
validate: function (value) {
|
||
|
if (isNaN(value)) return '使用量必须是数字';
|
||
|
var price = parseFloat(value);
|
||
|
if (price <= 0) return '使用量必须大于0';
|
||
|
}
|
||
|
}
|
||
|
|
||
|
},
|
||
|
{
|
||
|
field: 'supplierNumber',
|
||
|
title: '厂商料号',
|
||
|
editable: {
|
||
|
type: 'text',
|
||
|
title: '厂商料号',
|
||
|
emptytext: '厂商料号',
|
||
|
validate: function (value) {
|
||
|
if ($.trim(value) == '') {
|
||
|
return '厂商料号不能为空!';
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'finishedProductQuantity',
|
||
|
title: '成品数量',
|
||
|
editable: {
|
||
|
type: 'text',
|
||
|
title: '成品数量',
|
||
|
emptytext: '成品数量',
|
||
|
validate: function (value) {
|
||
|
if (isNaN(value)) return '使用量必须是数字';
|
||
|
var price = parseFloat(value);
|
||
|
if (price <= 0) return '使用量必须大于0';
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'remarks',
|
||
|
title: '备注说明',
|
||
|
editable: {
|
||
|
type: 'text',
|
||
|
title: '备注说明',
|
||
|
emptytext: '备注说明',
|
||
|
validate: function (value) {
|
||
|
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
field: 'processingCategory',
|
||
|
title: '加工类别',
|
||
|
editable: {
|
||
|
type: 'text',
|
||
|
title: '加工类别',
|
||
|
emptytext: '加工类别',
|
||
|
validate: function (value) {
|
||
|
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
title: '操作',
|
||
|
align: 'center',
|
||
|
formatter: function (value, row, index) {
|
||
|
var actions = [];
|
||
|
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeSub(\'' + row.subsidiaryMaterialCode + '\')" ><i class="fa fa-remove"></i>删除</a>');
|
||
|
return actions.join('');
|
||
|
}}
|
||
|
]
|
||
|
|
||
|
});
|
||
|
|
||
|
// 辅料添加
|
||
|
function addsubsidiaryconfirm() {
|
||
|
var data = $("#subsidiarybomTable").bootstrapTable("getSelections");
|
||
|
var count = $('#addsubsidiarybomTable').bootstrapTable('getData').length;
|
||
|
|
||
|
for (i = 0; i < data.length; i++) {
|
||
|
var finishProductCode = $("input[name='finishProductCode']").val()
|
||
|
let bootstrapTable = $('#addsubsidiarybomTable').bootstrapTable('getRowByUniqueId', data[i].subsidiaryMaterialCode);
|
||
|
if (bootstrapTable != null) {
|
||
|
$.modal.alert(bootstrapTable.subsidiaryMaterialName + "已存在,不可重复添加!");
|
||
|
continue;
|
||
|
}
|
||
|
$("#addsubsidiarybomTable").bootstrapTable('insertRow', {
|
||
|
index: count + i,
|
||
|
row: {
|
||
|
finishProductcode: finishProductCode,
|
||
|
subsidiaryMaterialCode: data[i].subsidiaryMaterialCode,
|
||
|
subsidiaryMaterialName: data[i].subsidiaryMaterialName,
|
||
|
specificationModel: data[i].specificationModel,
|
||
|
inventoryUnit: data[i].inventoryUnit,
|
||
|
supplierNumber: data[i].supplierNumber,
|
||
|
subsidiaryMaterialConsumption: '',
|
||
|
subsidiaryMaterialLoss: '',
|
||
|
finishedProductQuantity: '',
|
||
|
remarks: '',
|
||
|
processingCategory: ''
|
||
|
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
$("#subsidiarybomTable").bootstrapTable("uncheckAll");
|
||
|
}
|
||
|
|
||
|
// 确认添加辅料
|
||
|
function confirmsubsidiary() {
|
||
|
|
||
|
$("#addsubsidiarybomTable").bootstrapTable('refresh');
|
||
|
// console.log(data)
|
||
|
let data = $('#addsubsidiarybomTable').bootstrapTable('getData', true)
|
||
|
// console.log(data.length)
|
||
|
for (let i=0;i<data.length;i++) {
|
||
|
// console.log(data[i])
|
||
|
//新原料数据添加
|
||
|
$.ajax({
|
||
|
url: ctx + 'system/subsidiarymaterial/list',
|
||
|
type: 'post',
|
||
|
data: {
|
||
|
subsidiaryMaterialCode : data[i].subsidiaryMaterialCode
|
||
|
},
|
||
|
success: function (res) {
|
||
|
// console.log(res)
|
||
|
if (res.rows.length === 0) {//不存在
|
||
|
// console.log(data[i].subsidiaryMaterialCode+"unExist!")
|
||
|
$.ajax({
|
||
|
url: ctx + 'system/subsidiarymaterial/addFromBom',
|
||
|
type: "POST",
|
||
|
data: {
|
||
|
data: JSON.stringify(data[i])
|
||
|
},
|
||
|
dataType: "json",
|
||
|
success: function (resp) {
|
||
|
console.log(resp)
|
||
|
}
|
||
|
})
|
||
|
} else {//存在
|
||
|
// console.log(data[i].subsidiaryMaterialCode+"exist!")
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
//bom原料数据添加
|
||
|
$.ajax({
|
||
|
url: ctx + 'system/bomsubsidiarymaterial/add',
|
||
|
type: "POST",
|
||
|
data: {
|
||
|
data: JSON.stringify(data)
|
||
|
},
|
||
|
dataType: "json",
|
||
|
success: function (resp) {
|
||
|
console.log(resp)
|
||
|
},
|
||
|
|
||
|
})
|
||
|
|
||
|
}
|
||
|
|
||
|
//辅料删除
|
||
|
function removeSub(subsidiaryMaterialCode){
|
||
|
var ids = [];
|
||
|
ids.push(subsidiaryMaterialCode);
|
||
|
$('#addsubsidiarybomTable').bootstrapTable("remove",{
|
||
|
field:'subsidiaryMaterialCode',
|
||
|
values:ids
|
||
|
})
|
||
|
$("#addsubsidiarybomTable").bootstrapTable('refresh');
|
||
|
}
|
||
|
|
||
|
// 获取物料清单数据
|
||
|
function getbom(){
|
||
|
let finishProductCode = $("select[name='finishProductCode']").val()
|
||
|
$.ajax({
|
||
|
url: ctx + 'system/bom/list',
|
||
|
type: "POST",
|
||
|
dataType: "json",
|
||
|
data:{
|
||
|
finishProductCode:finishProductCode
|
||
|
},
|
||
|
success: function (resp) {
|
||
|
// console.log(finishProductCode)
|
||
|
// console.log(resp.rows)
|
||
|
if(resp.rows.length>0){
|
||
|
$.modal.alert("该成品已存在物料清单")
|
||
|
}
|
||
|
else {
|
||
|
confirmraw()
|
||
|
confirmsubsidiary()
|
||
|
if ($.validate.form()) {
|
||
|
$.operate.save(prefix + "/add", $('#form-bom-add').serialize());
|
||
|
}
|
||
|
}
|
||
|
// alert("添加成功辅料!");
|
||
|
},
|
||
|
|
||
|
})
|
||
|
|
||
|
}
|
||
|
|
||
|
//原料表新增一行
|
||
|
function addrawLine() {
|
||
|
var finishProductCode = $("input[name='finishProductCode']").val()
|
||
|
console.log(finishProductCode)
|
||
|
if (finishProductCode == "") {
|
||
|
$.modal.alertWarning("请先填写成品")
|
||
|
} else {
|
||
|
let obj={
|
||
|
finishProductcode: finishProductCode,
|
||
|
rawMaterialCode: '',
|
||
|
rawMaterialName: '',
|
||
|
specificationModel: '',
|
||
|
inventoryUnit: '',
|
||
|
supplierNumber: '',
|
||
|
rawMaterialConsumption: '',
|
||
|
rawMaterialLoss: '',
|
||
|
finishedProductQuantity: '',
|
||
|
remarks: '',
|
||
|
processingCategory: ''
|
||
|
}
|
||
|
$('#addrowbomTable').bootstrapTable('insertRow', {index:1, row: obj});
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
//辅料表新增一行
|
||
|
function addsubsidiaryLine() {
|
||
|
var finishProductCode = $("input[name='finishProductCode']").val()
|
||
|
console.log(finishProductCode)
|
||
|
if (finishProductCode == "") {
|
||
|
$.modal.alertWarning("请先填写成品")
|
||
|
} else {
|
||
|
let obj={
|
||
|
finishProductcode: finishProductCode,
|
||
|
subsidiaryMaterialCode: '',
|
||
|
subsidiaryMaterialName: '',
|
||
|
specificationModel: '',
|
||
|
inventoryUnit: '',
|
||
|
supplierNumber: '',
|
||
|
subsidiaryMaterialConsumption: '',
|
||
|
subsidiaryMaterialLoss: '',
|
||
|
finishedProductQuantity: '',
|
||
|
remarks: '',
|
||
|
processingCategory: ''
|
||
|
}
|
||
|
$('#addsubsidiarybomTable').bootstrapTable('insertRow', {index:1, row: obj});
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|