Browse Source

[feat] 修改仓库前端获取,修改入库类型为采购入库,添加采购入库单生成是携带数据为分类采购入库,仓库入库设备

dev
zhangsiqi 4 months ago
parent
commit
06fef80377
  1. 32
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java
  2. 2
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java
  3. 8
      ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html
  4. 89
      ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html
  5. 2
      ruoyi-admin/src/main/resources/templates/stock/stockInfo/stockInfo.html

32
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java

@ -366,14 +366,14 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
int result = 0; int result = 0;
if(!CollectionUtils.isEmpty(list)) { if(!CollectionUtils.isEmpty(list)) {
//根据物料入库部门划分入库单,入库单类型:0 仓库,1 采购,生成入库单号 //根据物料入库部门划分入库单,入库单类型:0 仓库,1 采购,生成入库单号
List<WarehouseStorageOrderDetail> list1 = list.stream().filter(e -> e.getMaterialDeptType().equals("0")).collect(Collectors.toList()); List<WarehouseStorageOrderDetail> list1 = list.stream().filter(e -> ("1").equals(e.getMaterialDeptType())).collect(Collectors.toList());
List<WarehouseStorageOrderDetail> list2 = list.stream().filter(e -> e.getMaterialDeptType().equals("1")).collect(Collectors.toList()); List<WarehouseStorageOrderDetail> list2 = list.stream().filter(e -> ("0").equals(e.getMaterialDeptType())).collect(Collectors.toList());
//WarehouseStorageStatus 仓库入库状态(0待暂收、1已暂收、2待入库、3部分入库、4全部入库), //WarehouseStorageStatus 仓库入库状态(0待暂收、1已暂收、2待入库、3部分入库、4全部入库),
//WarehouseStorageType 仓库入库类型(0采购入库、1供应商补货、2委内入库、3公司退货、4委外入库、5生产入库), //WarehouseStorageType 仓库入库类型(0采购入库、1供应商补货、2委内入库、3公司退货、4委外入库、5生产入库),
//setWarehouseOrderType仓库订单类型(0采购订单、1生产订单、2退换货订单、3委外订单), //setWarehouseOrderType仓库订单类型(0采购订单、1生产订单、2退换货订单、3委外订单),
//WarehouseDeptType 仓库入库部门类型(0仓库,1采购 ), //WarehouseDeptType 仓库入库部门类型(0仓库,1采购 ),
if(list1.size() > 0) { if(list1.size() > 0) {
//采购入库单,物料入库列表信息读取,放入生成的入库订单号 //仓库入库单,物料入库列表信息读取,放入生成的入库订单号
String warehouseStorageCode = redisCache.generateBillNo("RK"); String warehouseStorageCode = redisCache.generateBillNo("RK");
for (WarehouseStorageOrderDetail warehouseStorageOrderDetail: list1) { for (WarehouseStorageOrderDetail warehouseStorageOrderDetail: list1) {
warehouseStorageOrderDetail.setWarehouseStorageCode(warehouseStorageCode); warehouseStorageOrderDetail.setWarehouseStorageCode(warehouseStorageCode);
@ -384,36 +384,42 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
} }
//入库代表为采购部分的入库单 //入库代表为采购部分的入库单
warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode); warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode);
warehouseStorageOrder.setWarehouseStorageType("0"); warehouseStorageOrder.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode());
warehouseStorageOrder.setWarehouseDeptType("0");
warehouseStorageOrder.setWarehouseOrderType("1");
warehouseStorageOrder.setWarehouseStorageStatus("0"); warehouseStorageOrder.setWarehouseStorageStatus("0");
warehouseStorageOrder.setWarehouseQualityStatus("0");
warehouseStorageOrder.setWarehouseStorageType("0");
warehouseStorageOrder.setWarehouseOrderType("0");
warehouseStorageOrder.setWarehouseDeptType("1");
warehouseStorageOrder.setCreateTime(DateUtils.getNowDate()); warehouseStorageOrder.setCreateTime(DateUtils.getNowDate());
warehouseStorageOrder.setCreateBy(ShiroUtils.getLoginName()); warehouseStorageOrder.setCreateBy(ShiroUtils.getLoginName());
result = warehouseStorageOrderMapper.insertWarehouseStorageOrder(warehouseStorageOrder); result = warehouseStorageOrderMapper.insertWarehouseStorageOrder(warehouseStorageOrder);
} }
if(list.size()>0) { if(list2.size()>0) {
String warehouseStorageCode1 = redisCache.generateBillNo("RK"); String warehouseStorageCode1 = redisCache.generateBillNo("RK");
//仓库入库单 //入库部门类型:采购入库单
for (WarehouseStorageOrderDetail warehouseStorageOrderDetail: list2) { for (WarehouseStorageOrderDetail warehouseStorageOrderDetail: list2) {
warehouseStorageOrderDetail.setWarehouseStorageCode(warehouseStorageCode1); warehouseStorageOrderDetail.setWarehouseStorageCode(warehouseStorageCode1);
warehouseStorageOrderDetail.setWarehouseStorageType("1"); warehouseStorageOrderDetail.setWarehouseStorageType("0");
warehouseStorageOrderDetail.setMaterialDeptType("0"); warehouseStorageOrderDetail.setMaterialDeptType("1");
warehouseStorageOrderDetail.setWarehouseDeptType("0"); warehouseStorageOrderDetail.setWarehouseDeptType("0");
storageOrderDetailMapper.insertWarehouseStorageOrderDetail(warehouseStorageOrderDetail); storageOrderDetailMapper.insertWarehouseStorageOrderDetail(warehouseStorageOrderDetail);
} }
//入库代表为仓库部分的入库单 //入库代表为仓库部分的入库单
//WarehouseStorageStatus 仓库入库状态(0待暂收、1已暂收、2待入库、3部分入库、4全部入库),
//WarehouseStorageType 仓库入库类型(0采购入库、1供应商补货、2委内入库、3公司退货、4委外入库、5生产入库),
//setWarehouseOrderType仓库订单类型(0采购订单、1生产订单、2退换货订单、3委外订单),
//WarehouseDeptType 仓库入库部门类型(0仓库,1采购 ),
warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode1); warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode1);
warehouseStorageOrder.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode());
warehouseStorageOrder.setWarehouseStorageStatus("0"); warehouseStorageOrder.setWarehouseStorageStatus("0");
warehouseStorageOrder.setWarehouseQualityStatus("0"); warehouseStorageOrder.setWarehouseQualityStatus("0");
warehouseStorageOrder.setWarehouseStorageType("1"); warehouseStorageOrder.setWarehouseStorageType("0");
warehouseStorageOrder.setWarehouseOrderType("0"); warehouseStorageOrder.setWarehouseOrderType("0");
warehouseStorageOrder.setWarehouseDeptType("1"); warehouseStorageOrder.setWarehouseDeptType("0");
warehouseStorageOrder.setCreateTime(DateUtils.getNowDate()); warehouseStorageOrder.setCreateTime(DateUtils.getNowDate());
warehouseStorageOrder.setCreateBy(ShiroUtils.getLoginName()); warehouseStorageOrder.setCreateBy(ShiroUtils.getLoginName());
warehouseStorageOrder.setWarehouseStorageOrderDetailList(list2); warehouseStorageOrder.setWarehouseStorageOrderDetailList(list2);
result = warehouseStorageOrderMapper.insertWarehouseStorageOrder(warehouseStorageOrder); result = warehouseStorageOrderMapper.insertWarehouseStorageOrder(warehouseStorageOrder);
} }
} }

2
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java

@ -254,6 +254,8 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService
purchasePlanChild.setProcessMethod("0"); purchasePlanChild.setProcessMethod("0");
purchasePlanChild.setBrand(bom.getBrand()); purchasePlanChild.setBrand(bom.getBrand());
purchasePlanChild.setDescribe(bom.getDescribe()); purchasePlanChild.setDescribe(bom.getDescribe());
purchasePlanChild.setUnit(bom.getUnit());
purchasePlanChild.setWarehouseDept(bom.getWarehouseDept());
//物料用量 //物料用量
Long useNum = bom.getUseNum(); Long useNum = bom.getUseNum();
//物料的计划采购数 //物料的计划采购数

8
ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html

@ -56,6 +56,7 @@
var materialUnitDatas = [[${@dict.getType('sysUnitClassDatas')}]]; var materialUnitDatas = [[${@dict.getType('sysUnitClassDatas')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var warehouseDeptDatas = [[${@dict.getType('warehouseDept')}]]; var warehouseDeptDatas = [[${@dict.getType('warehouseDept')}]];
var purchaseOrderCode = [[${purchaseOrder.purchaseOrderCode}]];
$("#form-addPurchaseStorage-edit").validate({ focusCleanup: true}); $("#form-addPurchaseStorage-edit").validate({ focusCleanup: true});
//生成的不同table的id集合 //生成的不同table的id集合
var tableDatas = []; var tableDatas = [];
@ -144,7 +145,7 @@
$tableWrapper.append($header).append($table); $tableWrapper.append($header).append($table);
$('#tablesContainer').append($tableWrapper); $('#tablesContainer').append($tableWrapper);
} }
var purchaseOrderCode = [[${purchaseOrder.purchaseOrderCode}]]; var relatedOrderCode = [[${purchaseOrder.purchaseOrderCode}]];
var warehouseCode = [[${purchaseOrder.stockNo}]]; var warehouseCode = [[${purchaseOrder.stockNo}]];
var warehouseName = [[${purchaseOrder.stockName}]]; var warehouseName = [[${purchaseOrder.stockName}]];
var warehouseDetailAddress = [[${purchaseOrder.stockAddress}]]; var warehouseDetailAddress = [[${purchaseOrder.stockAddress}]];
@ -179,7 +180,6 @@
"deliveryInspectionTime":item.deliveryTime, "deliveryInspectionTime":item.deliveryTime,
"hasStorageNum": item.hasStorageNum, //已入库数量 "hasStorageNum": item.hasStorageNum, //已入库数量
"notifyArriveNum": item.notifyArriveNum, //通知到货数量 "notifyArriveNum": item.notifyArriveNum, //通知到货数量
"actualArriveNum": item.actualArriveNum, //实际到货数量
"relatedOrderCode":purchaseOrderCode, "relatedOrderCode":purchaseOrderCode,
// ...其他字段 // ...其他字段
}; };
@ -188,6 +188,10 @@
}); });
} }
const combinedData = Object.assign({}, storageOrderData, { const combinedData = Object.assign({}, storageOrderData, {
relatedOrderCode:relatedOrderCode,
warehouseCode:warehouseCode,
warehouseName:warehouseName,
warehouseDetailAddress:warehouseDetailAddress,
warehouseStorageOrderDetailList: allMaterialDataList warehouseStorageOrderDetailList: allMaterialDataList
}); });
// 合并表单数据和表格数据 // 合并表单数据和表格数据

89
ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html

@ -257,6 +257,8 @@
var materialRmbTotal = 0; var materialRmbTotal = 0;
var totalMaterialSum = 0; var totalMaterialSum = 0;
var totalPurchaseSum = 0; var totalPurchaseSum = 0;
var totalRmbSum = 0;
var totalNoRmbSum = 0;
tableIdList.forEach(function(tableId) { tableIdList.forEach(function(tableId) {
$('#' + 'supplier-' + tableId).find('.supplier-card').each(function (supplierIndex, supplierCard) { $('#' + 'supplier-' + tableId).find('.supplier-card').each(function (supplierIndex, supplierCard) {
var purchaseNum = parseFloat($(supplierCard).find('.supplierMaterialNum').val()) || 0; var purchaseNum = parseFloat($(supplierCard).find('.supplierMaterialNum').val()) || 0;
@ -442,38 +444,71 @@
} }
} }
//获取仓库相关信息Select2 //获取仓库相关信息Select2
$("#stockNo").on("select2:select", function (e) { //根据仓库ID查询仓库名称
var data = e.params.data; $(function() {
$("#stockName").val(data.stockName); // 初始化时默认加载仓库ID列表
$("#stockAddress").val(data.stockAddr); loadWarehouseCodes();
$("#stockContact").val(data.stockManager); // 监听仓库ID下拉框的变化
}); });
$("#stockNo").select2({
theme: "bootstrap", $('#stockNo').on('change', function() {
allowClear: true, var selectedWarehouseCode = $(this).val(); // 获取选中的仓库ID
placeholder: "请选择仓库", if (selectedWarehouseCode) {
ajax: { // 发起Ajax请求获取仓库名称
url: ctx + "stock/stockInfo/getAllWarehouseCode", $.ajax({
type: "get", type: 'GET',
dataType: "json", url: ctx +'stock/stockInfo/getStockNameByWarehouseCode/' + selectedWarehouseCode,
delay: 250, dataType: 'json', // 假设返回的数据格式是JSON
processResults: function (data) { success: function(data) {
var resultList = data; console.log(data);
var options = []; // 将获取到的仓库名称填充到输入框
for(var i= 0, len=resultList.length;i<len;i++){ if(data.data == null){
var option = resultList[i]; // 如果返回的数据有问题,可以给出提示或处理
option.id = resultList[i]["stockNo"]; $.modal.alertWarning('未能获取到仓库名称!');
option.text = resultList[i]["stockNo"];
options.push(option);
} }
return { $('input[name="stockName"]').val(data.data.stockName);
results: options, $('input[name="stockAddress"]').val(data.data.stockAddr);
pagination: {} $('input[name="stockContact"]').val(data.data.stockManager);
}; $('input[name="stockPhone"]').val(data.data.stockManagerPhone);
}, },
escapeMarkup: function (markup) {return markup;}, 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 = $('#stockNo'); // 获取仓库编号下拉框元素
// 清空下拉框现有选项
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("数据为空");
}
} }
}); });
}
$("input[name='deliveryTime']").datepicker({ $("input[name='deliveryTime']").datepicker({
language: 'zh-CN', language: 'zh-CN',
todayHighlight: true, todayHighlight: true,

2
ruoyi-admin/src/main/resources/templates/stock/stockInfo/stockInfo.html

@ -76,7 +76,7 @@
{title: '仓库名',field: 'stockName',}, {title: '仓库名',field: 'stockName',},
{title: '仓库地址',field: 'stockAddr',}, {title: '仓库地址',field: 'stockAddr',},
{title: '仓库管理人',field: 'stockManager',}, {title: '仓库管理人',field: 'stockManager',},
{title: '仓库管理人',field: 'stockManagerPhone',}, {title: '仓库管理人电话',field: 'stockManagerPhone',},
{title: '仓库备注',field: 'stockMemo',}, {title: '仓库备注',field: 'stockMemo',},
{title: '录入时间',field: 'firstAddTime', {title: '录入时间',field: 'firstAddTime',
formatter: function (value, row, index) { formatter: function (value, row, index) {

Loading…
Cancel
Save