Browse Source

[feat]仓库管理:

仓库入库单
新增 入库-采购单(采购入库)页面storagePurchase.html
新增入库按钮
后端新增入库接口
dev
liuxiaoxu 6 months ago
parent
commit
504ceaecc3
  1. 37
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java
  2. 13
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseStorageOrderDetail.java
  3. 7
      ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseStorageOrderDetailMapper.xml
  4. 19
      ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageOrder.html
  5. 375
      ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storagePurchase.html

37
ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java

@ -191,4 +191,41 @@ public class WarehouseStorageOrderController extends BaseController
} }
/**
* 入库-采购单(采购入库)
*/
@GetMapping("/storagePurchase/{warehouseStorageId}")
public String storagePurchase(@PathVariable("warehouseStorageId") Long warehouseStorageId, ModelMap mmap)
{
WarehouseStorageOrder warehouseStorageOrder = warehouseStorageOrderService.selectWarehouseStorageOrderById(warehouseStorageId);
mmap.put("warehouseStorageOrder", warehouseStorageOrder);
return prefix + "/storagePurchase";
}
/**
* 修改保存入库-采购单(采购入库)
*/
@RequiresPermissions("warehouse:storageOrder:storagePurchase")
@Log(title = "仓库入库单", businessType = BusinessType.UPDATE)
@PostMapping("/storagePurchase")
@ResponseBody
public AjaxResult storagePurchaseSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder)
{
return toAjax(warehouseStorageOrderService.updateWarehouseStorageOrder(warehouseStorageOrder));
}
/**
* 入库-采购单(采购入库) 供应商物料详情列表
*/
@ResponseBody
@RequestMapping("/storagePurchaseDetail")
public Map<String,List<WarehouseStorageOrderDetail>> storagePurchaseDetail(String warehouseStorageCode){
List<WarehouseStorageOrderDetail> allDetails = storageOrderDetailService.selectStorageOrderDetailListByCode(warehouseStorageCode);
Map<String, List<WarehouseStorageOrderDetail>> groupedDetails = allDetails.stream().collect(Collectors.groupingBy(WarehouseStorageOrderDetail::getSupplierCode));
return groupedDetails;
}
} }

13
ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseStorageOrderDetail.java

@ -205,6 +205,9 @@ public class WarehouseStorageOrderDetail extends BaseEntity
@Excel(name = "暂收报告") @Excel(name = "暂收报告")
private String temporaryReportUrl; private String temporaryReportUrl;
/** 存放位置 */
@Excel(name = "存放位置")
private String storageLocation;
public void setWarehouseStorageDetailId(Long warehouseStorageDetailId) public void setWarehouseStorageDetailId(Long warehouseStorageDetailId)
{ {
this.warehouseStorageDetailId = warehouseStorageDetailId; this.warehouseStorageDetailId = warehouseStorageDetailId;
@ -620,6 +623,15 @@ public class WarehouseStorageOrderDetail extends BaseEntity
return temporaryReportUrl; return temporaryReportUrl;
} }
public String getStorageLocation() {
return storageLocation;
}
public void setStorageLocation(String storageLocation) {
this.storageLocation = storageLocation;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -669,6 +681,7 @@ public class WarehouseStorageOrderDetail extends BaseEntity
.append("storageTime", getStorageTime()) .append("storageTime", getStorageTime())
.append("temporaryRemark", getTemporaryRemark()) .append("temporaryRemark", getTemporaryRemark())
.append("temporaryReportUrl", getTemporaryReportUrl()) .append("temporaryReportUrl", getTemporaryReportUrl())
.append("storageLocation",getStorageLocation())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())

7
ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseStorageOrderDetailMapper.xml

@ -51,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="storageTime" column="storage_time" /> <result property="storageTime" column="storage_time" />
<result property="temporaryRemark" column="temporary_remark" /> <result property="temporaryRemark" column="temporary_remark" />
<result property="temporaryReportUrl" column="temporary_report_url" /> <result property="temporaryReportUrl" column="temporary_report_url" />
<result property="storageLocation" column="storage_location" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
@ -58,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectWarehouseStorageOrderDetailVo"> <sql id="selectWarehouseStorageOrderDetailVo">
select warehouse_storage_detail_id, warehouse_storage_code, related_order_code, warehouse_storage_status, warehouse_quality_status, warehouse_storage_type, warehouse_storage_class, warehouse_order_type, warehouse_dept_type, warehouse_employee, warehouse_code, warehouse_name, warehouse_detail_address, supplier_code, supplier_name, customer_contact, contact_number, supplier_address, material_no, material_name, material_type, material_photoUrl, material_brand, material_unit, material_describe, material_process_method, material_dept_type, make_total, notify_has_arrived_num, notify_arrive_num, actual_has_arrived_num, actual_arrive_num, temporary_has_qualified_num, temporary_qualified_num, has_storage_num, storage_num, quality_has_qualified_num, quality_qualified_num, refunds_exchanges_num, arrived_time, temporary_time, delivery_inspection_time, quality_time, storage_time, temporary_remark, temporary_report_url, create_time, create_by, update_by, update_time from warehouse_storage_order_detail select warehouse_storage_detail_id, warehouse_storage_code, related_order_code, warehouse_storage_status, warehouse_quality_status, warehouse_storage_type, warehouse_storage_class, warehouse_order_type, warehouse_dept_type, warehouse_employee, warehouse_code, warehouse_name, warehouse_detail_address, supplier_code, supplier_name, customer_contact, contact_number, supplier_address, material_no, material_name, material_type, material_photoUrl, material_brand, material_unit, material_describe, material_process_method, material_dept_type, make_total, notify_has_arrived_num, notify_arrive_num, actual_has_arrived_num, actual_arrive_num, temporary_has_qualified_num, temporary_qualified_num, has_storage_num, storage_num, quality_has_qualified_num, quality_qualified_num, refunds_exchanges_num, arrived_time, temporary_time, delivery_inspection_time, quality_time, storage_time, temporary_remark, temporary_report_url, storage_location, create_time, create_by, update_by, update_time from warehouse_storage_order_detail
</sql> </sql>
<select id="selectWarehouseStorageOrderDetailList" parameterType="WarehouseStorageOrderDetail" resultMap="WarehouseStorageOrderDetailResult"> <select id="selectWarehouseStorageOrderDetailList" parameterType="WarehouseStorageOrderDetail" resultMap="WarehouseStorageOrderDetailResult">
@ -131,6 +132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="storageTime != null">storage_time,</if> <if test="storageTime != null">storage_time,</if>
<if test="temporaryRemark != null">temporary_remark,</if> <if test="temporaryRemark != null">temporary_remark,</if>
<if test="temporaryReportUrl != null">temporary_report_url,</if> <if test="temporaryReportUrl != null">temporary_report_url,</if>
<if test="storageLocation != null">storage_location,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
@ -182,6 +184,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="storageTime != null">#{storageTime},</if> <if test="storageTime != null">#{storageTime},</if>
<if test="temporaryRemark != null">#{temporaryRemark},</if> <if test="temporaryRemark != null">#{temporaryRemark},</if>
<if test="temporaryReportUrl != null">#{temporaryReportUrl},</if> <if test="temporaryReportUrl != null">#{temporaryReportUrl},</if>
<if test="storageLocation != null">#{storageLocation},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
@ -237,6 +240,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="storageTime != null">storage_time = #{storageTime},</if> <if test="storageTime != null">storage_time = #{storageTime},</if>
<if test="temporaryRemark != null">temporary_remark = #{temporaryRemark},</if> <if test="temporaryRemark != null">temporary_remark = #{temporaryRemark},</if>
<if test="temporaryReportUrl != null">temporary_report_url = #{temporaryReportUrl},</if> <if test="temporaryReportUrl != null">temporary_report_url = #{temporaryReportUrl},</if>
<if test="storageLocation != null">storage_location = #{storageLocation},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
@ -294,6 +298,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="storageTime != null">storage_time = #{storageTime},</if> <if test="storageTime != null">storage_time = #{storageTime},</if>
<if test="temporaryRemark != null">temporary_remark = #{temporaryRemark},</if> <if test="temporaryRemark != null">temporary_remark = #{temporaryRemark},</if>
<if test="temporaryReportUrl != null">temporary_report_url = #{temporaryReportUrl},</if> <if test="temporaryReportUrl != null">temporary_report_url = #{temporaryReportUrl},</if>
<if test="storageLocation != null">storage_location = #{storageLocation},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>

19
ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageOrder.html

@ -77,6 +77,10 @@
var editFlag = [[${@permission.hasPermi('warehouse:storageOrder:edit')}]]; var editFlag = [[${@permission.hasPermi('warehouse:storageOrder:edit')}]];
var temporaryPurchaseWarehouseFlag = [[${@permission.hasPermi('warehouse:storageOrder:temporaryPurchaseWarehouse')}]]; var temporaryPurchaseWarehouseFlag = [[${@permission.hasPermi('warehouse:storageOrder:temporaryPurchaseWarehouse')}]];
var temporaryPurchaseFlag = [[${@permission.hasPermi('warehouse:storageOrder:temporaryPurchase')}]]; var temporaryPurchaseFlag = [[${@permission.hasPermi('warehouse:storageOrder:temporaryPurchase')}]];
var storagePurchaseFlag = [[${@permission.hasPermi('warehouse:storageOrder:storagePurchase')}]];
var warehouseStorageStatusDatas = [[${@dict.getType('warehouse_storage_status')}]]; var warehouseStorageStatusDatas = [[${@dict.getType('warehouse_storage_status')}]];
var warehouseQualityStatusDatas = [[${@dict.getType('warehouse_quality_status')}]]; var warehouseQualityStatusDatas = [[${@dict.getType('warehouse_quality_status')}]];
var warehouseStorageTypeDatas = [[${@dict.getType('warehouse_storage_type')}]]; var warehouseStorageTypeDatas = [[${@dict.getType('warehouse_storage_type')}]];
@ -225,13 +229,18 @@
formatter: function(value, row, index) { formatter: function(value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.warehouseStorageId + '\')"><i class="fa fa-edit"></i>编辑</a> '); actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.warehouseStorageId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
if (row.warehouseDeptType == 1 && row.warehouseOrderType == 0){ if (row.warehouseDeptType == 1 && row.warehouseOrderType == 0 && row.warehouseStorageStatus == 0 ){
/*暂收-采购单(仓库入库)*/ /*暂收-采购单(仓库入库)*/
actions.push('<a class="btn btn-success btn-xs ' + temporaryPurchaseWarehouseFlag + '" href="javascript:void(0)" onclick="temporaryPurchaseWarehouse(\'' + row.warehouseStorageId + '\')"><i class="fa fa-edit"></i>暂收</a> '); actions.push('<a class="btn btn-success btn-xs ' + temporaryPurchaseWarehouseFlag + '" href="javascript:void(0)" onclick="temporaryPurchaseWarehouse(\'' + row.warehouseStorageId + '\')"><i class="fa fa-edit"></i>暂收</a> ');
} }
if (row.warehouseDeptType == 0 && row.warehouseOrderType == 0){ if (row.warehouseDeptType == 0 && row.warehouseOrderType == 0 && row.warehouseStorageStatus == 0 ){
/*暂收-采购单(采购入库)*/ /*暂收-采购单(采购入库)*/
actions.push('<a class="btn btn-success btn-xs ' + temporaryPurchaseFlag + '" href="javascript:void(0)" onclick="temporaryPurchase(\'' + row.warehouseStorageId + '\')"><i class="fa fa-edit"></i>暂收</a> '); actions.push('<a class="btn btn-success btn-xs ' + temporaryPurchaseFlag + '" href="javascript:void(0)" onclick="temporaryPurchase(\'' + row.warehouseStorageId + '\')"><i class="fa fa-edit"></i>暂收</a> ');
}
/*入库-采购单(采购入库)*/
if ( row.warehouseDeptType == 0 && row.warehouseOrderType == 0 && (row.warehouseStorageStatus == 2 || row.warehouseStorageStatus == 3) ){
/*暂收-采购单(采购入库)*/
actions.push('<a class="btn btn-success btn-xs ' + storagePurchaseFlag + '" href="javascript:void(0)" onclick="storagePurchase(\'' + row.warehouseStorageId + '\')"><i class="fa fa-edit"></i>入库</a> ');
} }
return actions.join(''); return actions.join('');
} }
@ -252,6 +261,12 @@
$.modal.open("暂收",url); $.modal.open("暂收",url);
}; };
/*入库-采购单(采购入库)*/
function storagePurchase(warehouseStorageId){
var url = ctx + 'warehouse/storageOrder/storagePurchase/' + warehouseStorageId;
$.modal.open("入库",url);
};
</script> </script>
</body> </body>
</html> </html>

375
ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storagePurchase.html

@ -0,0 +1,375 @@
<!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" />
<style>
.supplier-value span {
margin-right: 10px;
}
</style>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-temporaryPurchaseWarehouse-edit" th:object="${warehouseStorageOrder}">
<input name="warehouseStorageId" th:field="*{warehouseStorageId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">入库单号:</label>
<div class="col-sm-8">
<input name="warehouseStorageCode" th:field="*{warehouseStorageCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">关联单号:</label>
<div class="col-sm-8">
<input name="relatedOrderCode" th:field="*{relatedOrderCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="col-xs-12">
<label class="col-sm-1 control-label">入库类型:</label>
<div class="col-sm-4">
<select name="warehouseStorageType" class="form-control m-b" th:with="type=${@dict.getType('warehouse_storage_type')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehouseStorageType}"></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="arrivedTime" th:value="${#dates.format(warehouseStorageOrder.arrivedTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" readonly>
<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">
<div class="input-group date">
<input name="deliveryInspectionTime" th:value="${#dates.format(warehouseStorageOrder.deliveryInspectionTime, 'yyyy-MM-dd')}" 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="form-group">
<label class="col-sm-4 control-label is-required">仓库ID:</label>
<div class="col-sm-8">
<select class="form-control" id="warehouseCode" name="warehouseCode" th:field="*{warehouseCode}" required>
<!-- 这里动态生成仓库ID选项 -->
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">仓库名称:</label>
<div class="col-sm-8">
<input name="warehouseName" th:field="*{warehouseName}" 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="warehouseDetailAddress" th:field="*{warehouseDetailAddress}" class="form-control" type="text">
</div>
</div>
<div class="container">
<!--供应商物料相关-->
<div class="row">
<div class="col-sm-12" id="tablesContainer">
<!-- 表格将在这里动态生成 -->
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript">
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]
var warehouseCode = [[${warehouseStorageOrder.warehouseCode}]]
var prefix = ctx + "warehouse/storageOrder";
$("#form-temporaryPurchaseWarehouse-edit").validate({
focusCleanup: true
});
//生成的不同table的id集合
var tableDatas = [];
function submitHandler() {
const storageOrderData = $("#form-temporaryPurchaseWarehouse-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 初始化一个数组用于存放所有表格的数据
let allMaterialDataList = [];
for(let i in tableDatas){
$('#' + tableDatas[i]).each(function() {
const tableData = $(this).bootstrapTable('getData');
console.log(JSON.stringify(tableData));
// 将表数据转换成与qualityReportData格式一致的数组
var materialDataList = tableData.map(function (item) {
// 根据实际字段名调整
return {
"supplierCode": item.supplierCode,
"materialNo": item.materialNo,
"materialName": item.materialName,
"materialType": item.materialType,
"materialPhotourl": item.materialPhotourl,
"materialDescribe": item.materialDescribe,
"materialBrand": item.materialBrand,
"materialUnit": item.materialUnit,
"materialProcessMethod": item.materialProcessMethod,
"notifyHasArrivedNum": item.notifyHasArrivedNum,
"actualHasArrivedNum": item.actualHasArrivedNum,
"temporaryHasQualifiedNum": item.temporaryHasQualifiedNum,
"hasStorageNum": item.hasStorageNum,
"notifyArriveNum": item.notifyArriveNum,
"actualArriveNum": item.actualArriveNum,
"temporaryQualifiedNum": item.temporaryQualifiedNum,
"temporaryRemark": item.temporaryRemark,
"temporaryReportUrl": item.temporaryReportUrl,
"storageNum": item.storageNum,
"storageLocation": item.storageLocation,
// ...其他字段
};
});
allMaterialDataList = allMaterialDataList.concat(materialDataList);
});
}
const combinedData = Object.assign({}, storageOrderData, {
warehouseStorageOrderDetailList: allMaterialDataList
});
// 合并表单数据和表格数据
// const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData);
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/storagePurchase", jsonData);
}
$("input[name='arrivedTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='deliveryInspectionTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$(function() {
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]; // 这里需要实际赋值,比如从前端某个地方读取
$.getJSON(prefix + "/storagePurchaseDetail?warehouseStorageCode=" + warehouseStorageCode, function(data) {
for (var supplierCode in data) {
if (data.hasOwnProperty(supplierCode)) {
var supplierData = data[supplierCode];
createTableForSupplier(supplierCode, supplierData);
}
}
});
});
function createTableForSupplier(supplierCode, supplierData) {
var tableId = 'bootstrap-table-' + supplierCode.replace(/[^a-z0-9]/gi, '_').toLowerCase();
tableDatas.push(tableId);
var $tableWrapper = $('<div class="table-responsive mt-3"></div>');
// 确保supplierData至少有一条记录,并从中提取供应商详细信息
var supplierInfo = supplierData.length > 0 ? supplierData[0] : {}; // 默认为空对象,以防数据不存在
// 构建含有额外供应商信息的标题字符串
var headerTitle ='供应商'+'</br>'+supplierCode + ' - ' + (supplierInfo.supplierName || 'N/A') +
' </br> ' + (supplierInfo.customerContact || 'N/A') +
' - ' + (supplierInfo.contactNumber || 'N/A') +
' - ' + (supplierInfo.supplierAddress || 'N/A');
var $header = $('<h4>' + headerTitle + '</h4>');
var $table = $('<table id="' + tableId + '" class="table table-striped table-bordered"></table>');
$table.bootstrapTable({
data: supplierData,
columns: [{
checkbox: true
},
{
title: '供应商ID',
field: 'supplierCode',
visible: false
},
{
title: '料号',
field: 'materialNo'
}, {
title: '物料名称',
field: 'materialName'
},
{
title: '物料类型',
field: 'materialType',
},
{
title: '物料图片地址',
field: 'materialPhotourl',
},
{
title: '物料描述',
field: 'materialDescribe',
},
{
title: '物料品牌',
field: 'materialBrand',
},
{
title: '物料单位',
field: 'materialUnit',
},
{
title: '物料加工方式',
field: 'materialProcessMethod',
},
{
title: '通知已到货数',
field: 'notifyHasArrivedNum',
},
{
title: '实际已到货数',
field: 'actualHasArrivedNum',
},
{
title: '暂收已合格数',
field: 'temporaryHasQualifiedNum',
},
{
title: '已入库数',
field: 'hasStorageNum',
},
{
title: '通知到货数',
field: 'notifyArriveNum',
},
{
title: '实际到货数',
field: 'actualArriveNum'
},
{
title: '暂收合格数',
field: 'temporaryQualifiedNum'
},
{
title: '暂收备注',
field: 'temporaryRemark'
},
{
title: '暂收报告',
field: 'temporaryReportUrl',
},
{
title: '入库数',
field: 'storageNum',
editable:{
type: 'text',
mode:'inline',
validate: function (v) {
if (!v) return '数量不能为空';
if (isNaN(v)) return '数量必须是数字';
var processBadNum = parseInt(v);
if (processBadNum <= 0) return '数量必须是正整数';
}
}
},
{
title: '存放位置',
field: 'storageLocation',
editable: true
},
]
});
$tableWrapper.append($header).append($table);
$('#tablesContainer').append($tableWrapper);
}
//根据仓库ID查询仓库名称
$(document).ready(function() {
// 初始化时默认加载仓库ID列表
loadWarehouseCodes();
// 监听仓库ID下拉框的变化
$('#warehouseCode').on('change', function() {
var selectedWarehouseCode = $(this).val(); // 获取选中的仓库ID
if (selectedWarehouseCode) {
// 发起Ajax请求获取仓库名称
$.ajax({
type: 'GET',
url: ctx +'stock/stockInfo/getStockNameByWarehouseCode/' + selectedWarehouseCode,
dataType: 'json', // 假设返回的数据格式是JSON
success: function(data) {
console.log(data);
// 将获取到的仓库名称填充到输入框
if(data.data == null){
// 如果返回的数据有问题,可以给出提示或处理
$.modal.alertWarning('未能获取到仓库名称!');
}
$('input[name="warehouseName"]').val(data.data.stockname);
},
error: function(jqXHR, textStatus, errorThrown) {
console.error('Error:', textStatus, errorThrown);
$.modal.alertWarning('查询仓库名称时发生错误!');
}
});
} else {
// 如果没有选择仓库ID,清空仓库名称输入框
$('input[name="warehouseName"]').val('');
}
});
});
// 加载仓库Id列表函数
function loadWarehouseCodes() {
var url = ctx + 'stock/stockInfo/getAllWarehouseCode';
$.ajax({
type: 'GET', // 请求类型
url: url, // 后端接口URL
dataType: 'json', // 预期服务器返回的数据类型
success: function(data) {
if (data && Array.isArray(data)) {
var selectElement = $('#warehouseCode'); // 获取仓库编号下拉框元素
// 清空下拉框现有选项
selectElement.empty();
// 添加默认选项(如果需要)编辑时不需要添加默认选项
selectElement.append('<option value="">所有</option>');
// 遍历返回的数据,添加为下拉框的选项
$.each(data, function(index, item) {
// 仓库ID
selectElement.append('<option value="' + item.stockNO + '">' + item.stockNO + '</option>');
});
// $('#warehouseCode').val(stockNO);
} else {
$.modal.errMsg("数据为空");
}
}
});
}
</script>
</body>
</html>
Loading…
Cancel
Save