Browse Source

[feat]采购管理

新增采购入库前端页面
采购订单前端页面新增入库通知按钮和其方法
采购订单子表数据库和实体类新增 notifyHasArrivedNum、notifyArriveNum、temporaryNum、temporaryNum;mapper.xml的所有方法新增otifyHasArrivedNum、notifyArriveNum、temporaryNum、temporaryNum;
采购订单Controller层新增 加载采购入库通知单弹窗后端接口;去掉detailListGroupedBySupplier接口;
修改生产订单部分数据类型转换错误问题
dev
liuxiaoxu 5 days ago
parent
commit
b4567028ed
  1. 37
      ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java
  2. 50
      ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java
  3. 3
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java
  4. 3
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java
  5. 18
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml
  6. 239
      ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html
  7. 11
      ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html

37
ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java

@ -203,13 +203,10 @@ public class PurchaseOrderController extends BaseController
/**
* 加载采购入库通知单弹窗
*/
@GetMapping("/addPurchaseOrderStorage/{purchaseOrderCode}")
public String addPurchaseOrderStorage(@PathVariable("purchaseOrderCode") String purchaseOrderCode,ModelMap mmap){
//purchasePlanCodes去除重复数据,purchasePlanCodeArray作为数组类型去除
//查询相关采购计划数据
PurchaseOrder purchaseOrder = purchaseOrderService.selectPurchaseOrderByOrderCode(purchaseOrderCode);
//根据采购计划编号查询对应的采购报价数据
//再根据采购计划编号分组查询对应的采购报价数据分组
@GetMapping("/addPurchaseStorage/{purchaseOrderId}")
public String addPurchaseStorage(@PathVariable("purchaseOrderId") Long purchaseOrderId,ModelMap mmap){
PurchaseOrder purchaseOrder = purchaseOrderService.selectPurchaseOrderById(purchaseOrderId);
mmap.put("purchaseOrder", purchaseOrder);
return prefix + "/addPurchaseStorage";
}
@ -230,21 +227,6 @@ public class PurchaseOrderController extends BaseController
// @ResponseBody
// @RequestMapping("/detailListGroupedBySupplier")
// public Map<String, List<PurchaseOrderChild>> detailListGroupedBySupplier(String qualityOrderCode) {
// PurchaseOrderChild purchaseOrderChild = new PurchaseOrderChild();
// purchaseOrderChild.setPurchaseOrderCode(qualityOrderCode);
// List<PurchaseOrderChild> allDetails = purchaseOrderChildService.selectPurchaseOrderStorageByPurchaseOrderCode(qualityOrderCode);
// Map<String, List< PurchaseOrderChild>> groupedDetails = allDetails.stream()
// .collect(Collectors.groupingBy(PurchaseOrderChild::getSupplierCode));
// return groupedDetails;
// }
/**
* 加载审批弹窗
* @param taskId
@ -330,13 +312,8 @@ public class PurchaseOrderController extends BaseController
/**
* 采购订单审核页面采购信息列表
* 采购订单审核页面和采购入库单采购信息列表
* */
@PostMapping ("/selectOrderChildMaterialList")
@ResponseBody
@ -349,10 +326,6 @@ public class PurchaseOrderController extends BaseController
/**
* 删除采购订单
*/

50
ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java

@ -81,6 +81,19 @@ public class PurchaseOrderChild extends BaseEntity
@Excel(name = "共享库存占用数")
private Integer sharedInventoryOccupancyNum;
/** 通知已到货数 */
private Integer notifyHasArrivedNum;
/** '通知到货数' */
private Integer notifyArriveNum;
/** '暂收数' */
private Integer temporaryNum;
/** '已入库数' */
private Integer hasStorageNum;
/** 计划交付时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "计划交付时间", width = 30, dateFormat = "yyyy-MM-dd")
@ -240,6 +253,39 @@ public class PurchaseOrderChild extends BaseEntity
this.sharedInventoryOccupancyNum = sharedInventoryOccupancyNum;
}
public Integer getNotifyHasArrivedNum() {
return notifyHasArrivedNum;
}
public void setNotifyHasArrivedNum(Integer notifyHasArrivedNum) {
this.notifyHasArrivedNum = notifyHasArrivedNum;
}
public Integer getNotifyArriveNum() {
return notifyArriveNum;
}
public void setNotifyArriveNum(Integer notifyArriveNum) {
this.notifyArriveNum = notifyArriveNum;
}
public Integer getTemporaryNum() {
return temporaryNum;
}
public void setTemporaryNum(Integer temporaryNum) {
this.temporaryNum = temporaryNum;
}
public Integer getHasStorageNum() {
return hasStorageNum;
}
public void setHasStorageNum(Integer hasStorageNum) {
this.hasStorageNum = hasStorageNum;
}
public void setPlanDeliveryTime(Date planDeliveryTime)
{
this.planDeliveryTime = planDeliveryTime;
@ -279,6 +325,10 @@ public class PurchaseOrderChild extends BaseEntity
.append("planPurchaseNum", getPlanPurchaseNum())
.append("actualPurchaseNum", getActualPurchaseNum())
.append("sharedInventoryOccupancyNum", getSharedInventoryOccupancyNum())
.append("notifyHasArrivedNum", getNotifyHasArrivedNum())
.append("notifyArriveNum", getNotifyArriveNum())
.append("temporaryNum", getTemporaryNum())
.append("hasStorageNum", getHasStorageNum())
.append("planDeliveryTime", getPlanDeliveryTime())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())

3
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java

@ -490,7 +490,8 @@ public class SysMakeOrderController extends BaseController
makeOrder.setCustomerId(sysSalesOrder.getEnterpriseCode());
makeOrder.setCustomerOderCode(sysSalesOrder.getSalesOrderNumber());
makeOrder.setMaterial(String.valueOf(sysSalesOrder.getMaterialSum()));
makeOrder.setMaterialSum(sysSalesOrder.getEnterpriseSum());
//这个类型需要注意
// makeOrder.setMaterialSum(sysSalesOrder.getEnterpriseSum());
}
}
}

3
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java

@ -258,7 +258,8 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
makeOrder.setCustomerId(sysSalesOrderVo.getEnterpriseCode());
makeOrder.setCustomerName(sysSalesOrderVo.getEnterpriseName());
makeOrder.setCustomerOderCode(sysSalesOrderVo.getSalesOrderNumber());
makeOrder.setMaterialSum(sysSalesOrderVo.getEnterpriseSum());
//这里需要注意一下类型
//makeOrder.setMaterialSum(sysSalesOrderVo.getEnterpriseSum());
makeOrder.setMaterial(String.valueOf(sysSalesOrderVo.getMaterialSum()));
String makeNo = redisCache.generateBillNo("PO");
makeOrder.setMakeNo(makeNo);

18
ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml

@ -22,6 +22,10 @@
<result property="planPurchaseNum" column="plan_purchase_num" />
<result property="actualPurchaseNum" column="actual_purchase_num" />
<result property="sharedInventoryOccupancyNum" column="shared_inventory_occupancy_num" />
<result property="notifyArriveNum" column="notify_arrive_num" />
<result property="notifyHasArrivedNum" column="notify_has_arrived_num" />
<result property="hasStorageNum" column="has_storage_num" />
<result property="temporaryNum" column="temporary_num" />
<result property="planDeliveryTime" column="plan_delivery_time" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
@ -31,7 +35,7 @@
</resultMap>
<sql id="selectPurchaseOrderChildVo">
select purchase_order_child_id, purchase_order_code, material_no, material_name, material_type, material_photoUrl, material_brand, material_unit, material_describe, material_process_method, material_model, warehouse_dept, material_noRmb_sum, material_rmb_sum, plan_purchase_num, actual_purchase_num, shared_inventory_occupancy_num, plan_delivery_time, create_by, create_time, update_by, update_time, del_flag from purchase_order_child
select purchase_order_child_id, purchase_order_code, material_no, material_name, material_type, material_photoUrl, material_brand, material_unit, material_describe, material_process_method, material_model, warehouse_dept, material_noRmb_sum, material_rmb_sum, plan_purchase_num, actual_purchase_num, shared_inventory_occupancy_num, notify_arrive_num, notify_has_arrived_num, has_storage_num, temporary_num,plan_delivery_time, create_by, create_time, update_by, update_time, del_flag from purchase_order_child
</sql>
<select id="selectPurchaseOrderChildList" parameterType="PurchaseOrderChild" resultMap="PurchaseOrderChildResult">
@ -78,6 +82,10 @@
<if test="planPurchaseNum != null">plan_purchase_num,</if>
<if test="actualPurchaseNum != null">actual_purchase_num,</if>
<if test="sharedInventoryOccupancyNum != null">shared_inventory_occupancy_num,</if>
<if test="notifyArriveNum != null">notify_arrive_num,</if>
<if test="notifyHasArrivedNum != null">notify_has_arrived_num,</if>
<if test="hasStorageNum != null">has_storage_num,</if>
<if test="temporaryNum != null">temporary_num,</if>
<if test="planDeliveryTime != null">plan_delivery_time,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
@ -102,6 +110,10 @@
<if test="planPurchaseNum != null">#{planPurchaseNum},</if>
<if test="actualPurchaseNum != null">#{actualPurchaseNum},</if>
<if test="sharedInventoryOccupancyNum != null">#{sharedInventoryOccupancyNum},</if>
<if test="notifyArriveNum != null">#{notifyArriveNum},</if>
<if test="notifyHasArrivedNum != null">#{notifyHasArrivedNum},</if>
<if test="hasStorageNum != null">#{hasStorageNum},</if>
<if test="temporaryNum != null">#{temporaryNum},</if>
<if test="planDeliveryTime != null">#{planDeliveryTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
@ -148,6 +160,10 @@
<if test="planPurchaseNum != null">plan_purchase_num = #{planPurchaseNum},</if>
<if test="actualPurchaseNum != null">actual_purchase_num = #{actualPurchaseNum},</if>
<if test="sharedInventoryOccupancyNum != null">shared_inventory_occupancy_num = #{sharedInventoryOccupancyNum},</if>
<if test="notifyArriveNum != null">notify_arrive_num = #{notifyArriveNum},</if>
<if test="notifyHasArrivedNum != null">notify_has_arrived_num = #{notifyHasArrivedNum},</if>
<if test="hasStorageNum != null">has_storage_num = #{hasStorageNum},</if>
<if test="temporaryNum != null">temporary_num = #{temporaryNum},</if>
<if test="planDeliveryTime != null">plan_delivery_time = #{planDeliveryTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>

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

@ -1,52 +1,64 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('暂收-采购单(采购入库)')" />
<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-addPurchaseStorage-edit" th:object="${purchaseOrder}">
<input type="hidden" name="warehouseCode" th:field="*{stockNo}"/>
<div class="form-group">
<label class="col-sm-3 control-label is-required">采购单号:</label>
<label class="col-sm-3 control-label">采购单号:</label>
<div class="col-sm-8">
<input name="relatedOrderCode" th:field="*{purchaseOrderCode}" class="form-control" type="text" required readonly>
<input name="purchaseOrderCode" th:field="*{purchaseOrderCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">入库类别</label>
<label class="col-sm-3 control-label ">供应商ID</label>
<div class="col-sm-8">
<select name="eceiptType" class="form-control m-b" th:with="type=${@dict.getType('purchase_warehouse_type')}" required>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
</select>
<input name="supplierCode" th:field="*{supplierCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">到货时间:</label>
<label class="col-sm-3 control-label is-required">供应商名称:</label>
<div class="col-sm-8">
<input name="supplierName" th:field="*{supplierName}" 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">
<div class="input-group date">
<input name="arrivedTime" class="form-control" placeholder="yyyy-MM-dd" type="text" required readonly>
<input name="arrivedTime" 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="container" >-->
<!--供应商物料相关-->
<div id="tablesContainer" class="col-md-12" style="margin-left: auto;margin-right:auto">
<!-- &lt;!&ndash; 表格将在这里动态生成 &ndash;&gt;-->
</div>
<!-- </div>-->
</form>
<!--物料信息-->
<div class="container">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</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 prefix = ctx + "purchase/purchaseOrder";
var purchaseOrder = [[${purchaseOrder}]];
var auditStatusDatas = [[${@dict.getType('auditStatus')}]];
var useStatusDatas = [[${@dict.getType('useStatus')}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
@ -55,165 +67,102 @@
var warehouseDeptDatas = [[${@dict.getType('warehouseDept')}]];
var purchaseOrderCode = [[${purchaseOrder.purchaseOrderCode}]];
$("#form-addPurchaseStorage-edit").validate({ focusCleanup: true});
//生成的不同table的id集合
var tableDatas = [];
//物料信息展示列表
$(function() {
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到
var purchaseOrderCode = [[${purchaseOrder.purchaseOrderCode}]]; // 这里需要实际赋值,比如从前端某个地方读取
$.getJSON(prefix + "/detailListGroupedBySupplier?qualityOrderCode=" + purchaseOrderCode, 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"></div>');
// 确保supplierData至少有一条记录,并从中提取供应商详细信息
var supplierInfo = supplierData.length > 0 ? supplierData[0] : {}; // 默认为空对象,以防数据不存在
// 构建含有额外供应商信息的标题字符串
var headerTitle ='供应商'+'</br>'+supplierCode + ' - ' + supplierInfo.supplierName ;
var $header = $('<h4>' + headerTitle + '</h4>');
var $table = $('<table id="' + tableId + '" class="table table-striped table-bordered"></table>');
$table.bootstrapTable({
data: supplierData,
columns: [
{checkbox: false,visible: false},
{title: '供应商ID',field: 'supplierCode',visible: false},
{title: '料号',field: 'materialCode'},
{title: '物料名称',field: 'materialName'},
{title: '物料类型',field: 'materialType',
var options = {
modalName: "选择物料",
url: prefix + "/selectOrderChildMaterialList",
queryParams: queryParams,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
pagination: false, // 设置不分页
columns: [{
checkbox: true
},
{
title: '料号',
field: 'materialNo',
},
{
title: '物料名称',
field: 'materialName',
},
{
title: '物料类型',
field: 'materialType',
formatter: function (value,row, index) {
$.table.selectCategoryLabel(materialTypeDatas, value)
}
},
{title: '物料图片地址',field: 'materialPhotourl',
formatter: function (value, row, index) {
$.table.imageView(value)
}
{
title: '物料型号',
field: 'materialModel',
},
{title: '物料描述',field: 'materialDescribe',},
{title: '物料品牌',field: 'materialBrand',},
{title: '物料单位',field: 'materialUnit',
{
title: '物料品牌',
field: 'materialBrand',
},
{
title: '物料单位',
field: 'materialUnit',
formatter:function (value) {
return $.table.selectDictLabel(materialUnitDatas, value);
}
},
{title: '物料加工方式',field: 'materialProcessMethod',
{
title: '物料描述',
field: 'materialDescribe',
},
{
title: '物料加工方式',
field: 'materialProcessMethod',
formatter:function (value) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{title: '入库部门',field: 'warehouseDept',visible: false,
{
title: '物料入库部门',
field: 'materialDeptType',
formatter:function (value) {
return $.table.selectDictLabel(warehouseDeptDatas, value);
}
},
{title: '计划采购数',field: 'materialNum',},
{title: '实际采购数',field: 'materialRealNum',},
{title: '交付时间',field: 'deliveryTime',},
{title: '计划采购数',field: 'planPurchaseNum',},
{title: '实际采购数',field: 'actualPurchaseNum',},
{title: '交付时间',field: 'planDeliveryTime',},
{title: '通知已到货数',field: 'notifyHasArrivedNum',
formatter: function (value, row, index) {
if (value == null || value == '') {
value = 0;
}
return value;
}
},
{title: '暂收数',field: 'temporaryNum',},
{title: '已入库数',field: 'hasStorageNum',
formatter: function (value, row, index) {
if (value == null || value == '') {
value = 0;
}
return value;
}
},
{title: '通知到货数',field: 'notifyArriveNum',editable: {
type: 'text',
title: '通知到货数',
validate: function (value, row, index) {
var num = parseInt(value);
if (isNaN(num)) {
return '请输入数字';
} else if (num < 0) {
return '不能小于0';
}
}
}
{title: '通知到货数',field: 'notifyArriveNum'
}
]
});
$tableWrapper.append($header).append($table);
$('#tablesContainer').append($tableWrapper);
}
var relatedOrderCode = [[${purchaseOrder.purchaseOrderCode}]];
var warehouseCode = [[${purchaseOrder.stockNo}]];
var warehouseName = [[${purchaseOrder.stockName}]];
var warehouseDetailAddress = [[${purchaseOrder.stockAddress}]];
function submitHandler() {
const storageOrderData = $("#form-addPurchaseStorage-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,
"supplierName":item.supplierName,
"materialNo": item.materialCode,
"materialName": item.materialName,
"materialType": item.materialType,
"materialPhotourl": item.materialPhotourl,
"materialDescribe": item.materialDescribe,
"materialBrand": item.materialBrand,
"materialUnit": item.materialUnit,
"materialDeptType": item.warehouseDept,
"materialProcessMethod": item.materialProcessMethod,
"notifyHasArrivedNum": item.notifyHasArrivedNum,
"hasStorageNum": item.hasStorageNum, //已入库数量
"notifyArriveNum": item.notifyArriveNum, //通知到货数量
"relatedOrderCode":purchaseOrderCode
};
});
allMaterialDataList = allMaterialDataList.concat(materialDataList);
});
}
const combinedData = Object.assign({}, storageOrderData, {
relatedOrderCode:relatedOrderCode,
warehouseCode:warehouseCode,
warehouseName:warehouseName,
warehouseDetailAddress:warehouseDetailAddress,
warehouseStorageOrderDetailList: allMaterialDataList
});
// 合并表单数据和表格数据
// const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData);
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/addPurchaseOrderStorageSave", jsonData);
$.table.init(options);
})
function queryParams(params) {
var curParams = {
// 传递参数查询参数
purchaseOrderCode: purchaseOrder.purchaseOrderCode
};
return curParams;
}
$("input[name='arrivedTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true,
}).datetimepicker("update", new Date());;
$("input[name='deliveryInspectionTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

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

@ -72,6 +72,9 @@
var removeFlag = [[${@permission.hasPermi('purchase:purchaseOrder:remove')}]];
var cancelFlag = [[${@permission.hasPermi('purchase:purchaseOrder:cancel')}]];
var restoreFlag = [[${@permission.hasPermi('purchase:purchaseOrder:restore')}]];
var addPurchaseStorageFlag = [[${@permission.hasPermi('purchase:purchaseOrder:addPurchaseStorage')}]];
var warehouseStorageStatusDatas = [[${@dict.getType('eceiptStatus')}]];
var paymentStatusDatas = [[${@dict.getType('sys_pay_close')}]];
var useStatusDatas = [[${@dict.getType('useStatus')}]];
@ -236,6 +239,8 @@
if(row.auditStatus=="1" && row.useStatus=="1" && !row.cancelInstanceId) {
// 作废
actions.push('<a class=" ' + cancelFlag + ' " href="javascript:void(0)" onclick="cancel(\'' + row.purchaseOrderId + '\')"><i class="fa fa-remove"></i> 作废</a>');
//入库通知
actions.push('<a class=" ' + addPurchaseStorageFlag + ' " href="javascript:void(0)" onclick="addPurchaseStorage(\'' + row.purchaseOrderId + '\')"><i class="fa fa-edit"></i> 入库通知</a>');
// 已作废
}
@ -337,6 +342,12 @@
}
//入库通知
function addPurchaseStorage(purchaseOrderId) {
var url = prefix + "/addPurchaseStorage/" + purchaseOrderId;
$.modal.open("入库通知", url);
}
</script>
</body>
</html>
Loading…
Cancel
Save