万材erp项目
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.
 
 
 
 

1594 lines
67 KiB

<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增领料单')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: bootstrap-editable-css"/>
<link th:href="@{/ajax/libs/select2/select2.css}" rel="stylesheet">
<link th:href="@{/ajax/libs/select2/select2-bootstrap.css}" rel="stylesheet">
<style>
.other-container {
width: 90%;
height: 200px;
margin: auto;
}
.other {
margin-top: 20px;
}
h4 {
display: inline-block;
margin-right: 20px;
}
.modal-body{
height: 550px;
}
iframe{
width: 100%;
height: 500px;
frameborder: 0;
border: 0;
display: inline-block;
}
</style>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-materialRequisitionInfo-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">领料单号:</label>
<div class="col-sm-8">
<input name="materialRequisitionNumber" class="form-control" type="text" required readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">订单号码:</label>
<div class="col-sm-8">
<input name="salesOrderNumber" 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="workOrderNumber" class="form-control" type="text">-->
<select name="workOrderNumber" class="form-control m-b" type="text">
<option value="">请选择工单号</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">领料部门:</label>
<div class="col-sm-8">
<select name="deptName" class="form-control m-b" th:with="type=${@dict.getType('sys_dept_type')}">
<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">
<select name="materialRequisitionPerson" class="form-control m-b" type="text">
<option value="">请选择领料人</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">部门编号:</label>
<div class="col-sm-8">
<input name="deptNumber" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">仓库名称:</label>
<div class="col-sm-8">
<select name="stockName" class="form-control m-b">
<option value="">请选择仓库名称</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">仓库编号:</label>
<div class="col-sm-8">
<input name="stockNumber" 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="stockManager" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">出库类型:</label>
<div class="col-sm-8">
<select name="outputClass" class="form-control m-b" th:with="type=${@dict.getType('sys_out_type')}">
<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="input-group date">
<input name="outputDate" class="form-control" placeholder="yyyy-MM-dd hh:ii:ss" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">成品代码:</label>
<div class="col-sm-8">
<input name="finishProductCode" 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="typeMachine" 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="workOrderQuantity" 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="remarkContent" class="form-control" type="text"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">领料否:</label>
<div class="col-sm-8">
<select name="getMaterialFlag" class="form-control m-b" th:with="type=${@dict.getType('sys_whether')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</form>
</div>
<div class="other-container">
<div class="other">
<br><hr>
<h4>物料信息</h4>
<!-- <a class="btn btn-primary" onclick="showMaterialModal()"><i class="fa fa-plus"></i>&nbsp;选择信息</a>-->
<!-- <div style="width: 10%;display: inline-block;margin-left: 10px;">-->
<!-- <select id="materialTypeSelect" name="materialType" class="form-control m-b" th:with="type=${@dict.getType('ck_meterialt_type')}" style="margin-top: 10px;">-->
<!-- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>-->
<!-- </select>-->
<!-- </div>-->
<!-- <form class="form-horizontal m">-->
<!-- <div class="form-group">-->
<!-- <label class="col-sm-3 control-label">物料类别:</label>-->
<!-- <div class="col-sm-3">-->
<!-- <select id="materialTypeSelect" name="materialType" class="form-control m-b" th:with="type=${@dict.getType('ck_meterialt_type')}">-->
<!-- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>-->
<!-- </select>-->
<!-- </div>-->
<!-- </div>-->
<!-- </form>-->
<div class="col-sm-12 select-table table-striped">
<table id="addMaterialTable" style="white-space:nowrap"></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="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="$.table.search('formRawMaterialSearch','rawTable')"><i
class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('formRawMaterialSearch','rawTable')"><i
class="fa fa-refresh"></i>&nbsp;重置</a> </li>
</ul>
</div>
</form>
</div>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="rawTable" style="white-space:nowrap">
</table>
</div>
</div>
<div class="modal-footer">
<!-- <button type="button" class="btn btn-default" data-dismiss="modal" onclick="addrowconfirm()">-->
<!-- 确定-->
<!-- </button>-->
<a class="btn btn-warning btn-rounded" onclick="addRawToTable()">确认添加</a>
<a class="btn btn-primary btn-rounded" onclick="closeRawModal()">关闭</a>
</div>
</div>
</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="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="$.table.search('formSubsidiarySearch','subsidiaryTable')"><i
class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('formSubsidiarySearch','subsidiaryTable')"><i
class="fa fa-refresh"></i>&nbsp;重置</a> </li>
</ul>
</div>
</form>
</div>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="subsidiaryTable" style="white-space:nowrap">
</table>
</div>
</div>
<div class="modal-footer">
<!-- <button type="button" class="btn btn-default" data-dismiss="modal" onclick="addsubsidiaryconfirm()">-->
<!-- 确定-->
<!-- </button>-->
<a class="btn btn-warning btn-rounded" onclick="addSubsidiaryToTable()">确认添加</a>
<a class="btn btn-primary btn-rounded" onclick="closeSubsidiaryModal()">关闭</a>
</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>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('productFormId','productTable')"><i
class="fa fa-refresh"></i>&nbsp;重置</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>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: bootstrap-table-editable-js"/>
<script th:inline="javascript">
var prefix = ctx + "manufacture/materialRequisitionInfo"
var prefixMaterialPequisitionDetail = ctx + "manufacture/materialRequisitionDetail"
var prefixWorkOrder = ctx + "manufacture/workOrderInfo"
var materialCategoryDatas = [[${@dict.getType('sys_raw_material_category')}]];
var inventoryUnitDatas = [[${@dict.getType('sys_unit_class')}]];
var exportSalesDatas = [[${@dict.getType('sys_export_sales')}]];
var purchasingUnitDatas = [[${@dict.getType('sys_unit_class')}]];
var whetherStopDatas = [[${@dict.getType('sys_whether')}]];
var limitWhetherDatas = [[${@dict.getType('sys_whether')}]];
var whetherSemiManufacturesDatas = [[${@dict.getType('sys_whether')}]];
var gpItemSelectionDatas = [[${@dict.getType('sys_gp_Item_selection')}]];
var finishProductCategoryDatas = [[${@dict.getType('sys_finish_product_category')}]];;
var productionCategoryDatas = [[${@dict.getType('sys_production_category')}]];
$("#form-materialRequisitionInfo-add").validate({
focusCleanup: true
});
function submitHandler() {
let getData=$('#addMaterialTable').bootstrapTable('getData', true)
if(getData.length > 0){
//确认添加选中的物料数据
confirmMaterial();
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-materialRequisitionInfo-add').serialize());
}
} else {
$.modal.alertWarning("未选择物料,请选择!")
}
}
$("input[name='outputDate']").datetimepicker({
format: "yyyy-mm-dd hh:ii:ss",
minView: "month",
autoclose: true,
todayBtn: true
});
$("input[name='outputDate']").datetimepicker("setDate",new Date())
$(function() {
//显示原料表
showRawMaterial();
//显示辅料表
showSubsidiaryMaterial();
//显示成品表
showFinishProductMaterial();
//初始化添加材料表
$('#addMaterialTable').bootstrapTable({
pagination: true,
pageNumber: 1,
pageSize: 10,
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
cardView: false, // 是否显示详细视图
detailView: false, // 是否显示父子表
smartDisplay: false, // 加了这个才显示每页显示的行数
showExport: false, // 是否显示导出按钮
clickToSelect: true,//点击行选中
paginationDetailHAlign: ' hiddenDetailInfo',
height: 250,
uniqueId: 'materialCode',
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: [
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeMaterial(\'' + row.materialCode + '\')" ><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
},
{
field: 'materialRequisitionNumber',
title: '领料单号',
visible: false
},
{
field: 'materialCode',
title: '物料代码'
},
{
field: 'materialName',
title: '物料名称'
},
{
field: 'specificationModel',
title: '规格型号'
},
{
field: 'typeMachine',
title: '机种',
formatter: (value, row, index) => {
if (value === null) {
return "";
} else {
return value
}
}
},
{
field: 'inventoryUnit',
title: '单位'
},
{
field: 'planQuantity',
title: '计划数量',
editable: {
type: 'text',
title: '计划数量',
emptytext: '计划数量',
validate: function (value) {
}
}
},
{
field: 'description',
title: '说明',
editable: {
type: 'text',
title: '说明',
emptytext: '说明',
validate: function (value) {
}
}
},
{
field: 'unitUsage',
title: '单位用量',
editable: {
type: 'text',
title: '单位用量',
emptytext: '单位用量',
validate: function (value) {
}
}
},
{
field: 'storageLocation',
title: '存放位置',
editable: {
type: 'text',
title: '存放位置',
emptytext: '存放位置',
validate: function (value) {
}
}
},
{
field: 'materialType',
title: '物料类别',
visible: false
}]
})
});
//获取单号
$.ajax({
url: prefix + "/id",
type: "post",
dateType: "json",
success: function (resp) {
if (resp.code === 0) {
$("input[name='materialRequisitionNumber']").val(resp.data);
} else {
$.modal.msgError("失败啦");
}
},
error: function () {
$.modal.msgError("后台出错啦!");
}
});
//获取领料人
$.ajax({
url: ctx + "system/user/list",
type: "post",
success: function (res) {
// console.log(res)
if (res.rows.length > 0) {
let userData = res.rows;
for (let i in userData) {
// console.log(finishProductData[i].finishProductCode)
$("#form-materialRequisitionInfo-add select[name='materialRequisitionPerson']").append("<option value='" + userData[i].userName + "'>" + userData[i].userName + "</option>");
}
}
}
})
//工单号
$.ajax({
url: prefixWorkOrder + '/list',
type: "post",
success: function (res) {
// console.log(res)
if (res.rows.length > 0) {
let orderData = res.rows;
for (let i in orderData) {
$("#form-materialRequisitionInfo-add select[name='workOrderNumber']").append("<option value='" + orderData[i].workOrderNumber + "'>" + orderData[i].workOrderNumber + "</option>");
}
$("#form-materialRequisitionInfo-add select[name='workOrderNumber']").change(function () {
var workOrderNumber = $(this).val();
for (let i=0;i<orderData.length;i++) {
if (orderData[i].workOrderNumber == workOrderNumber) {
$("#form-materialRequisitionInfo-add input[name='finishProductCode']").val(orderData[i].finishProductCode);
$("#form-materialRequisitionInfo-add input[name='typeMachine']").val(orderData[i].typeMachine);
$("#form-materialRequisitionInfo-add input[name='workOrderQuantity']").val(orderData[i].orderQuantity);
showDetailMaterial(workOrderNumber);
}
}
})
}
}
})
//获取仓库信息
$.ajax({
url: ctx + "stock/stockInfo/list",
type: "post",
success: function (res) {
// console.log(res)
if (res.rows.length > 0) {
let stockData = res.rows;
for (let i in stockData) {
// console.log(finishProductData[i].finishProductCode)
$("#form-materialRequisitionInfo-add select[name='stockName']").append("<option value='" + stockData[i].stockname + "'>" + stockData[i].stockname + "</option>");
$("#form-materialRequisitionInfo-add select[name='stockName']").change(function () {
var stockName = $(this).val();
for (let i=0;i<stockData.length;i++) {
if (stockData[i].stockname == stockName) {
$("#form-materialRequisitionInfo-add input[name='stockNumber']").val(stockData[i].stockNO);
$("#form-materialRequisitionInfo-add input[name='stockManager']").val(stockData[i].stockmanager);
}
}
})
}
}
}
})
//显示物料模态框
function showMaterialModal() {
var materialType = $("#materialTypeSelect").val();
console.log(materialType)
if (materialType === "原料") {
$("#rawModal").modal("show")
} else if (materialType === "辅料") {
$("#subsidiaryModal").modal("show")
} else if (materialType === "成品") {
$("#productInfoModal").modal("show")
} else {
$.modal.alertError("error!")
}
}
//关闭模态框
function closeRawModal() {
$("#rawModal").modal("hide")
}
function closeSubsidiaryModal() {
$("#subsidiaryModal").modal("hide")
}
function closeProductModal() {
$("#productInfoModal").modal("hide")
}
//显示物料表
function showRawMaterial() {
var options = {
id: 'rawTable',
url: ctx + "system/rawmaterial/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("formRawMaterialSearch"));
return json;
},
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
},
{
field: 'firstAddTime',
title: '录入时间',
formatter: function (value, row, index) {
if (value == null) {
return " ";
} else {
return value;
}
}
},
{
field: 'updateInfoTime',
title: '上次修改时间',
formatter: function (value, row, index) {
if (value == null) {
return " ";
} else {
var vArr = value.split(',')
return vArr[0];
}
}
}
// {
// title: '操作',
// align: 'center',
// formatter: function(value, row, index) {
// var actions = [];
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.rawMaterialId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
// actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.rawMaterialId + '\')"><i class="fa fa-remove"></i>删除</a>');
// return actions.join('');
// }
// }
]
};
$.table.init(options);
}
function showSubsidiaryMaterial() {
var options = {
id: 'subsidiaryTable',
url: ctx + "system/subsidiarymaterial/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("formSubsidiarySearch"));
return json;
},
columns: [{
checkbox: true
},
{
field: 'subsidiaryMaterialId',
title: '辅料id',
visible: false
},
{
field: 'subsidiaryMaterialCode',
title: '辅料代码'
},
{
field: 'subsidiaryMaterialName',
title: '辅料名称'
},
{
field: 'specificationModel',
title: '规格型号'
},
{
field: 'hsNumber',
title: '海关HS号',
visible: false
},
{
field: 'stockUnitWeight',
title: '单位重量',
},
{
field: 'inventoryUnit',
title: '库存单位',
formatter: function (value, row, index) {
return $.table.selectDictLabel(inventoryUnitDatas, value);
},
},
{
field: 'customsName',
title: '海关名称',
visible: false
},
{
field: 'defaultWarehouse',
title: '默认仓库',
},
{
field: 'safetyStock',
title: '安全库存',
},
{
field: 'maximumInventory',
title: '最高库存',
},
{
field: 'specialUse',
title: '专用部门或人',
visible: false
},
{
field: 'supplierNumber',
title: '供应商料号'
},
{
field: 'limitCollectionAmount',
title: '限额领用数',
visible: false
},
{
field: 'subsidiaryMaterialCategory',
title: '辅料类别',
formatter: function (value, row, index) {
return $.table.selectDictLabel(subsidiaryMaterialCategoryDatas, value);
},
visible: false
},
{
field: 'warehouseLocation',
title: '库位',
},
{
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: 'dedicatedWhether',
title: '是否专用',
formatter: function (value, row, index) {
return $.table.selectDictLabel(dedicatedWhetherDatas, value);
},
visible: false
},
{
field: 'maximumPurchaseQuantity',
title: '最大采购量',
visible: false
},
{
field: 'costPrice',
title: '成本价',
visible: false
},
{
field: 'primarySupplier',
title: '主供应商'
},
{
field: 'subSupplier',
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: '内外销',
formatter: function (value, row, index) {
return $.table.selectDictLabel(exportSalesDatas, value);
}
},
{
field: 'whetherStop',
title: '料号是否停用',
formatter: function (value, row, index) {
return $.table.selectDictLabel(whetherStopDatas, value);
}
},
{
field: 'remarks',
title: '备注说明',
visible: false
},
{
field: 'createrName',
title: '创建人'
},
{
field: 'materialCategory',
title: '类别',
formatter: function (value, row, index) {
return $.table.selectDictLabel(materialCategoryDatas, value);
}
},
{
field: 'kesNumber',
title: '科恩仕料号'
},
{
field: 'typeMachine',
title: '机种'
},
{
field: 'standbyOne',
title: '备用一',
visible: false
},
{
field: 'standbyTwo',
title: '备用二',
visible: false
},
{
field: 'createrTime',
title: '创建时间',
visible: false
},
{
field: 'firstAddTime',
title: '录入时间',
formatter: function (value, row, index) {
if (value == null) {
return " ";
} else {
return value;
}
}
},
{
field: 'updateInfoTime',
title: '上次修改时间',
formatter: function (value, row, index) {
if (value == null) {
return " ";
} else {
var vArr = value.split(',')
return vArr[0];
}
}
}
// {
// title: '操作',
// align: 'center',
// formatter: function (value, row, index) {
// var actions = [];
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.subsidiaryMaterialId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
// actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.subsidiaryMaterialId + '\')"><i class="fa fa-remove"></i>删除</a>');
// return actions.join('');
// }
// }
]
};
$.table.init(options);
}
function showFinishProductMaterial() {
var options = {
id: 'productTable',
url: ctx + "system/finishproduct/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: '科恩仕料号'
},
{
field: 'standbyOne',
title: '备用一',
visible: false
},
{
field: 'standbyTwo',
title: '备用二',
visible: false
},
{
field: 'firstAddTime',
title: '录入时间',
formatter: function (value, row, index) {
if (value == null) {
return " ";
} else {
return value;
}
}
},
{
field: 'updateInfoTime',
title: '上次修改时间',
formatter: function (value, row, index) {
if (value == null) {
return " ";
} else {
var vArr = value.split(',')
return vArr[0];
}
}
}
// {
// title: '操作',
// align: 'center',
// formatter: function(value, row, index) {
// var actions = [];
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.finishProductId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
// actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.finishProductId + '\')"><i class="fa fa-remove"></i>删除</a>');
// return actions.join('');
// }
// }
]
};
$.table.init(options);
}
//表中添加选中的物料信息
function addRawToTable() {
var data = $("#rawTable").bootstrapTable("getSelections");
var count = $('#addMaterialTable').bootstrapTable('getData').length;
var materialRequisitionNumber = $("input[name='materialRequisitionNumber']").val();
var materialType = $("#materialTypeSelect").val();
// console.log(materialType)
for (i = 0; i < data.length; i++) {
let rawMaterial = $('#addMaterialTable').bootstrapTable('getRowByUniqueId', data[i].rawMaterialCode);
if (rawMaterial != null) {
alert(rawMaterial.rawMaterialName + "已存在,不可重复添加!");
continue;
}
$("#addMaterialTable").bootstrapTable('insertRow', {
index: count + i,
row: {
materialRequisitionNumber: materialRequisitionNumber,
materialCode: data[i].rawMaterialCode,
materialName: data[i].rawMaterialName,
specificationModel: data[i].specificationModel,
typeMachine: data[i].typeMachine,
inventoryUnit: data[i].inventoryUnit,
planQuantity: '',
description: '',
unitUsage: '',
storageLocation: '',
materialType: materialType
}
});
}
$("#rawTable").bootstrapTable("uncheckAll");
closeRawModal();
}
function addSubsidiaryToTable() {
var data = $("#subsidiaryTable").bootstrapTable("getSelections");
var count = $('#addMaterialTable').bootstrapTable('getData').length;
var materialRequisitionNumber = $("input[name='materialRequisitionNumber']").val();
var materialType = $("#materialTypeSelect").val();
// console.log(materialType)
for (i = 0; i < data.length; i++) {
let subsidiaryMaterial = $('#addMaterialTable').bootstrapTable('getRowByUniqueId', data[i].subsidiaryMaterialCode);
if (subsidiaryMaterial != null) {
alert(subsidiaryMaterial.subsidiaryMaterialName + "已存在,不可重复添加!");
continue;
}
$("#addMaterialTable").bootstrapTable('insertRow', {
index: count + i,
row: {
materialRequisitionNumber: materialRequisitionNumber,
materialCode: data[i].subsidiaryMaterialCode,
materialName: data[i].subsidiaryMaterialName,
specificationModel: data[i].specificationModel,
typeMachine: data[i].typeMachine,
inventoryUnit: data[i].inventoryUnit,
planQuantity: '',
description: '',
unitUsage: '',
storageLocation: '',
materialType: materialType
}
});
}
$("#subsidiaryTable").bootstrapTable("uncheckAll");
closeSubsidiaryModal();
}
function addProductToTable() {
var data = $("#productTable").bootstrapTable("getSelections");
var count = $('#addMaterialTable').bootstrapTable('getData').length;
var materialRequisitionNumber = $("input[name='materialRequisitionNumber']").val();
var materialType = $("#materialTypeSelect").val();
// console.log(materialType)
for (i = 0; i < data.length; i++) {
let finishProduct = $('#addMaterialTable').bootstrapTable('getRowByUniqueId', data[i].finishProductCode);
if (finishProduct != null) {
alert(finishProduct.finishProductName + "已存在,不可重复添加!");
continue;
}
$("#addMaterialTable").bootstrapTable('insertRow', {
index: count + i,
row: {
materialRequisitionNumber: materialRequisitionNumber,
materialCode: data[i].finishProductCode,
materialName: data[i].finishProductName,
specificationModel: data[i].specificationModel,
typeMachine: data[i].typeMachine,
inventoryUnit: data[i].inventoryUnit,
planQuantity: '',
description: '',
unitUsage: '',
storageLocation: '',
materialType: materialType
}
});
}
$("#productTable").bootstrapTable("uncheckAll");
closeProductModal();
}
//选择工单号显示表内订单信息
function showDetailMaterial(workOrderNumber) {
$('#addMaterialTable').bootstrapTable("removeAll")
console.log(workOrderNumber)
$.ajax({
url: ctx + 'manufacture/workOrderDetail/list',
type: 'post',
data: {
workOrderNumber: workOrderNumber
},
success: function (res) {
console.log(res)
var count = res.rows.length;
var data = res.rows;
var materialRequisitionNumber = $("input[name='materialRequisitionNumber']").val();
for (i = 0; i < data.length; i++) {
$("#addMaterialTable").bootstrapTable('insertRow', {
index: count + i,
row: {
materialRequisitionNumber: materialRequisitionNumber,
materialCode: data[i].materialCode,
materialName: data[i].materialName,
specificationModel: data[i].specificationModel,
typeMachine: data[i].typeMachine,
inventoryUnit: data[i].inventoryUnit,
planQuantity: '',
description: '',
unitUsage: '',
storageLocation: '',
materialType: data[i].materialType
}
});
}
}
})
}
//确认添加选中的物料数据
function confirmMaterial() {
$("#addMaterialTable").bootstrapTable('refresh');
let data = $('#addMaterialTable').bootstrapTable('getData', true);
// let getData=$('#addProductTable').bootstrapTable('getData', true)
// console.log(data)
$.ajax({
url: prefixMaterialPequisitionDetail + '/addEditSave',
type: "POST",
data: {
data: JSON.stringify(data)
},
dataType: "json",
success: function (resp) {
// console.log(data)
console.log(resp)
},
})
}
//添加表格内删除物料信息
function removeMaterial(materialCode){
var ids = [];
ids.push(materialCode);
$('#addMaterialTable').bootstrapTable("remove",{
field:'materialCode',
values:ids
})
$("#addMaterialTable").bootstrapTable('refresh');
}
</script>
</body>
</html>