Browse Source

[fix]仓库管理

仓库入库单
修改仓库入库 采购订单暂收后端接口,新增点击暂收后,仓库入库状态改为已暂收,采购订单暂收转为品质单
修复仓库入库单暂收按钮的仓库ID回显问题
新增品质单,品质单详情,品质单报告,品质单不合格分类新增接口
dev
liuxiaoxu 5 months ago
parent
commit
1460303373
  1. 7
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderService.java
  2. 180
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java
  3. 2
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java
  4. 6
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java
  5. 117
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java
  6. 6
      ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html

7
ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderService.java

@ -2,6 +2,8 @@ package com.ruoyi.quality.service;
import java.util.List;
import com.ruoyi.quality.domain.QualityOrder;
import com.ruoyi.warehouse.domain.WarehouseStorageOrder;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
/**
* 品质管理品质单Service接口
@ -72,4 +74,9 @@ public interface IQualityOrderService
* @return
*/
int restoreQualityOrderById(Long qualityOrderId);
/*
*
* */
void insertQualityOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList);
}

180
ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java

@ -1,8 +1,20 @@
package com.ruoyi.quality.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.quality.domain.QualityOrderDetail;
import com.ruoyi.quality.domain.QualityOrderReport;
import com.ruoyi.quality.domain.QualityOrderReportUnqualified;
import com.ruoyi.quality.mapper.QualityOrderDetailMapper;
import com.ruoyi.quality.mapper.QualityOrderReportMapper;
import com.ruoyi.quality.mapper.QualityOrderReportUnqualifiedMapper;
import com.ruoyi.warehouse.domain.WarehouseStorageOrder;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.quality.mapper.QualityOrderMapper;
@ -22,6 +34,19 @@ public class QualityOrderServiceImpl implements IQualityOrderService
@Autowired
private QualityOrderMapper qualityOrderMapper;
@Autowired
private QualityOrderDetailMapper orderDetailMapper;
@Autowired
private QualityOrderReportMapper orderReportMapper;
@Autowired
private QualityOrderReportUnqualifiedMapper orderReportUnqualifiedMapper;
@Autowired
private RedisCache redisCache;
/**
* 查询品质管理品质单
*
@ -123,4 +148,159 @@ public class QualityOrderServiceImpl implements IQualityOrderService
{
return qualityOrderMapper.restoreQualityOrderById(qualityOrderId);
}
/*
* 采购入库仓库入库后生成品质单
* */
@Override
public void insertQualityOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List<WarehouseStorageOrderDetail> storageOrderDetailList) {
QualityOrder qualityOrder = new QualityOrder();
qualityOrder.setCreateTime(new Date());
qualityOrder.setCreateBy(warehouseStorageOrder.getCreateBy());
//使用redis自动生成品质单号
String qualityOrderCode = redisCache.generateBillNo("PZ");
qualityOrder.setQualityOrderCode(qualityOrderCode);
qualityOrder.setInStorageCode(warehouseStorageOrder.getWarehouseStorageCode());
qualityOrder.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode());
qualityOrder.setQualityStatus("0");
qualityOrder.setQualityOrderType("0");
qualityOrder.setQualityStorageStatus("0");
qualityOrder.setThisArrivedNum(warehouseStorageOrder.getActualArrivedNum());
qualityOrder.setWarehouseCode(warehouseStorageOrder.getWarehouseCode());
qualityOrder.setWarehouseName(warehouseStorageOrder.getWarehouseName());
qualityOrder.setDeliveryInspectionTime(warehouseStorageOrder.getDeliveryInspectionTime());
qualityOrderMapper.insertQualityOrder(qualityOrder);
//新增三个子表的数据
for (WarehouseStorageOrderDetail detail : storageOrderDetailList) {
// 构建QualityOrderDetail,假设其他属性与QualityOrder相同,故不重复设置
insertQualityOrderDetailByWarehouseStorageOrder(warehouseStorageOrder, detail, qualityOrderCode);
insertQualityOrderReportByWarehouseStorageOrder(detail);
insertQualityOrderUnqualifiedByWarehouseStorageOrder(detail);
// ...
}
}
private void insertQualityOrderUnqualifiedByWarehouseStorageOrder( WarehouseStorageOrderDetail warehouseStorageOrderDetail) {
QualityOrderReportUnqualified qualityOrderReportUnqualified = new QualityOrderReportUnqualified();
//插入品质报告不合格数
qualityOrderReportUnqualified.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode());
qualityOrderReportUnqualified.setSupplierName(warehouseStorageOrderDetail.getSupplierName());
qualityOrderReportUnqualified.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo());
qualityOrderReportUnqualified.setMaterialName(warehouseStorageOrderDetail.getMaterialName());
qualityOrderReportUnqualified.setCreateTime(new Date());
qualityOrderReportUnqualified.setCreateBy(warehouseStorageOrderDetail.getCreateBy());
orderReportUnqualifiedMapper.insertQualityOrderReportUnqualified(qualityOrderReportUnqualified);
}
private void insertQualityOrderReportByWarehouseStorageOrder(WarehouseStorageOrderDetail warehouseStorageOrderDetail) {
QualityOrderReport qualityOrderReport = new QualityOrderReport();
//插入品质单报告开始品质单
qualityOrderReport.setSupplierCode(qualityOrderReport.getSupplierCode());
qualityOrderReport.setSupplierName(warehouseStorageOrderDetail.getSupplierName());
qualityOrderReport.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo());
qualityOrderReport.setMaterialName(warehouseStorageOrderDetail.getMaterialName());
qualityOrderReport.setQualityHasqualifiedNum(warehouseStorageOrderDetail.getQualityHasQualifiedNum());
qualityOrderReport.setCreateTime(new Date());
qualityOrderReport.setCreateBy(warehouseStorageOrderDetail.getCreateBy());
orderReportMapper.insertQualityOrderReport(qualityOrderReport);
}
private void insertQualityOrderDetailByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, WarehouseStorageOrderDetail warehouseStorageOrderDetail, String qualityOrderCode) {
QualityOrderDetail qualityOrderDetail = new QualityOrderDetail();
//插入数据到品质报告详情和 品质报告
qualityOrderDetail.setQualityOrderCode(qualityOrderCode);
qualityOrderDetail.setInStorageCode(warehouseStorageOrder.getWarehouseStorageCode());
qualityOrderDetail.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode());
qualityOrderDetail.setQualityStatus("0");
qualityOrderDetail.setQualityOrderType("0");
qualityOrderDetail.setQualityStorageStatus("0");
qualityOrderDetail.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo());
qualityOrderDetail.setMaterialBrand(warehouseStorageOrderDetail.getMaterialBrand());
qualityOrderDetail.setMaterialDescribe(warehouseStorageOrderDetail.getMaterialDescribe());
qualityOrderDetail.setMaterialName(warehouseStorageOrderDetail.getMaterialName());
qualityOrderDetail.setMaterialProcessMethod(warehouseStorageOrderDetail.getMaterialProcessMethod());
qualityOrderDetail.setMaterialPhotourl(warehouseStorageOrderDetail.getMaterialPhotourl());
qualityOrderDetail.setMaterialUnit(warehouseStorageOrderDetail.getMaterialUnit());
qualityOrderDetail.setMaterialType(warehouseStorageOrderDetail.getMaterialType());
qualityOrderDetail.setMakeTotal(warehouseStorageOrderDetail.getMakeTotal());
qualityOrderDetail.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode());
qualityOrderDetail.setSupplierName(warehouseStorageOrderDetail.getSupplierName());
qualityOrderDetail.setSupplierAddress(warehouseStorageOrderDetail.getSupplierAddress());
qualityOrderDetail.setCustomerContact(warehouseStorageOrderDetail.getCustomerContact());
qualityOrderDetail.setContactNumber(warehouseStorageOrderDetail.getContactNumber());
qualityOrderDetail.setQualityHasqualifiedNum(warehouseStorageOrderDetail.getQualityHasQualifiedNum());
qualityOrderDetail.setCreateTime(new Date());
qualityOrderDetail.setCreateBy(warehouseStorageOrderDetail.getCreateBy());
orderDetailMapper.insertQualityOrderDetail(qualityOrderDetail);
}
// /*
// * 根据仓库入库单采购入库 生成品质单
// * */
// private void insertQualityOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List<WarehouseStorageOrderDetail> storageOrderDetailList) {
//
//
//
//
// //插入数据到品质报告详情和 品质报告
// for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : storageOrderDetailList) {
// QualityOrderDetail qualityOrderDetail = new QualityOrderDetail();
// QualityOrderReport qualityOrderReport = new QualityOrderReport();
// QualityOrderReportUnqualified qualityOrderReportUnqualified = new QualityOrderReportUnqualified();
// qualityOrderDetail.setQualityOrderCode(qualityOrderCode);
// qualityOrderDetail.setInStorageCode(warehouseStorageOrder.getWarehouseStorageCode());
// qualityOrderDetail.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode());
// qualityOrderDetail.setQualityStatus("0");
// qualityOrderDetail.setQualityOrderType("0");
// qualityOrderDetail.setQualityStorageStatus("0");
// qualityOrderDetail.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo());
// qualityOrderDetail.setMaterialBrand(warehouseStorageOrderDetail.getMaterialBrand());
// qualityOrderDetail.setMaterialDescribe(warehouseStorageOrderDetail.getMaterialDescribe());
// qualityOrderDetail.setMaterialName(warehouseStorageOrderDetail.getMaterialName());
// qualityOrderDetail.setMaterialProcessMethod(warehouseStorageOrderDetail.getMaterialProcessMethod());
// qualityOrderDetail.setMaterialPhotourl(warehouseStorageOrderDetail.getMaterialPhotourl());
// qualityOrderDetail.setMaterialUnit(warehouseStorageOrderDetail.getMaterialUnit());
// qualityOrderDetail.setMaterialType(warehouseStorageOrderDetail.getMaterialType());
// qualityOrderDetail.setMakeTotal(warehouseStorageOrderDetail.getMakeTotal());
// qualityOrderDetail.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode());
// qualityOrderDetail.setSupplierName(warehouseStorageOrderDetail.getSupplierName());
// qualityOrderDetail.setSupplierAddress(warehouseStorageOrderDetail.getSupplierAddress());
// qualityOrderDetail.setCustomerContact(warehouseStorageOrderDetail.getCustomerContact());
// qualityOrderDetail.setContactNumber(warehouseStorageOrderDetail.getContactNumber());
// qualityOrderDetail.setQualityHasqualifiedNum(warehouseStorageOrderDetail.getQualityHasQualifiedNum());
// qualityOrderDetail.setCreateTime(new Date());
// qualityOrderDetail.setCreateBy(warehouseStorageOrderDetail.getCreateBy());
// orderDetailMapper.insertQualityOrderDetail(qualityOrderDetail);
// //插入品质单报告开始品质单
// qualityOrderReport.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode());
// qualityOrderReport.setSupplierName(warehouseStorageOrderDetail.getSupplierName());
// qualityOrderReport.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo());
// qualityOrderReport.setMaterialName(warehouseStorageOrderDetail.getMaterialName());
// qualityOrderReport.setQualityHasqualifiedNum(warehouseStorageOrderDetail.getQualityHasQualifiedNum());
// qualityOrderDetail.setCreateTime(new Date());
// qualityOrderDetail.setCreateBy(warehouseStorageOrderDetail.getCreateBy());
// orderReportMapper.insertQualityOrderReport(qualityOrderReport);
// //插入品质报告不合格数
// qualityOrderReportUnqualified.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode());
// qualityOrderReportUnqualified.setSupplierName(warehouseStorageOrderDetail.getSupplierName());
// qualityOrderReportUnqualified.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo());
// qualityOrderReportUnqualified.setMaterialName(warehouseStorageOrderDetail.getMaterialName());
// qualityOrderReportUnqualified.setCreateTime(new Date());
// qualityOrderReportUnqualified.setCreateBy(warehouseStorageOrderDetail.getCreateBy());
// orderReportUnqualifiedMapper.insertQualityOrderReportUnqualified(qualityOrderReportUnqualified);
// }
// }
}

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

@ -197,7 +197,7 @@ public class WarehouseStorageOrderController extends BaseController
@ResponseBody
public AjaxResult temporaryPurchaseSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder)
{
return toAjax(warehouseStorageOrderService.updateWarehouseStorageOrder(warehouseStorageOrder));
return toAjax(warehouseStorageOrderService.temporaryPurchaseWarehouseStorageOrder(warehouseStorageOrder));
}

6
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java

@ -77,4 +77,10 @@ public interface IWarehouseStorageOrderService
* 入库-生产订单
* */
int updateStorageMake(WarehouseStorageOrder warehouseStorageOrder);
/**
* 修改保存暂收-采购单(采购入库)
*/
int temporaryPurchaseWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder);
}

117
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java

@ -1,12 +1,27 @@
package com.ruoyi.warehouse.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.quality.domain.QualityOrder;
import com.ruoyi.quality.domain.QualityOrderDetail;
import com.ruoyi.quality.domain.QualityOrderReport;
import com.ruoyi.quality.domain.QualityOrderReportUnqualified;
import com.ruoyi.quality.mapper.QualityOrderDetailMapper;
import com.ruoyi.quality.mapper.QualityOrderMapper;
import com.ruoyi.quality.mapper.QualityOrderReportMapper;
import com.ruoyi.quality.mapper.QualityOrderReportUnqualifiedMapper;
import com.ruoyi.quality.service.IQualityOrderService;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper;
import lombok.extern.slf4j.Slf4j;
import org.activiti.editor.language.json.converter.util.CollectionUtils;
import org.apache.avalon.framework.service.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper;
@ -14,6 +29,7 @@ import com.ruoyi.warehouse.domain.WarehouseStorageOrder;
import com.ruoyi.warehouse.service.IWarehouseStorageOrderService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
/**
* 仓库入库单Service业务层处理
@ -30,6 +46,13 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
@Autowired
private WarehouseStorageOrderDetailMapper storageOrderDetailMapper;
@Autowired
private IQualityOrderService qualityOrderService;
@Autowired
private RedisCache redisCache;
/**
* 查询仓库入库单
*
@ -102,11 +125,103 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
}
}
}
warehouseStorageOrder.setWarehouseStorageStatus("1");
return warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder);
}
/**
* 修改保存暂收-采购单(采购入库)
*
* @param warehouseStorageOrder 仓库入库单
* @return 结果
*/
@Transactional
@Override
public int temporaryPurchaseWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder) {
String loginName = ShiroUtils.getLoginName();
warehouseStorageOrder.setUpdateBy(loginName);
warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate());
warehouseStorageOrder.setWarehouseStorageStatus("1");
updateWarehouseStorageOrderDetails(warehouseStorageOrder);
int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder);
if (updateResult <= 0) {
throw new RuntimeException("更新入库单主记录失败");
}
try {
qualityOrderService.insertQualityOrderByWarehouseStorageOrder(warehouseStorageOrder, warehouseStorageOrder.getWarehouseStorageOrderDetailList());
} catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
log.error("生成品质单时发生错误", e);
throw new RuntimeException("生成品质单时发生错误");
}
return updateResult;
}
/*
* 更新仓库入库单详情的数据
* */
private void updateWarehouseStorageOrderDetails(WarehouseStorageOrder warehouseStorageOrder) {
List<WarehouseStorageOrderDetail> details = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
if (!CollectionUtils.isEmpty(details)) {
for (WarehouseStorageOrderDetail detail : details) {
detail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode());
WarehouseStorageOrderDetail tempStorageOrderDetail = new WarehouseStorageOrderDetail();
tempStorageOrderDetail.setMaterialNo(detail.getMaterialNo());
tempStorageOrderDetail.setSupplierCode(detail.getSupplierCode());
tempStorageOrderDetail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode());
WarehouseStorageOrderDetail storageOrderDetailFromData = storageOrderDetailMapper.selectWarehouseStorageOrderByObject(tempStorageOrderDetail);
if (storageOrderDetailFromData == null){
log.warn("数据库中入库单详情为空:{}",tempStorageOrderDetail);
}else {
storageOrderDetailMapper.updateWarehouseStorageOrderDetailByObject(detail);
}
}
}
}
/*
* 原仓库入库单暂收
*
*/
// @Transactional
// @Override
// public int updateWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder)
// {
// String loginName = ShiroUtils.getLoginName();
// warehouseStorageOrder.setUpdateBy(loginName);
// warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate());
//
// List<WarehouseStorageOrderDetail> storageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
//
// if (StringUtils.isEmpty(storageOrderDetailList)){
// log.warn("入库单详情为空:{}",storageOrderDetailList);
// }else {
// for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : storageOrderDetailList) {
// warehouseStorageOrderDetail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode());
// WarehouseStorageOrderDetail tempStorageOrderDetail = new WarehouseStorageOrderDetail();
// tempStorageOrderDetail.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo());
// tempStorageOrderDetail.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode());
// tempStorageOrderDetail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode());
// WarehouseStorageOrderDetail storageOrderDetailFromData = storageOrderDetailMapper.selectWarehouseStorageOrderByObject(tempStorageOrderDetail);
// if (storageOrderDetailFromData == null){
// log.warn("数据库中入库单详情为空:{}",tempStorageOrderDetail);
// }else {
// storageOrderDetailMapper.updateWarehouseStorageOrderDetailByObject(warehouseStorageOrderDetail);
// }
// }
// }
// warehouseStorageOrder.setWarehouseStorageStatus("1");
// return warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder);
// }
/*
* 入库-生产订单
* */

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

@ -148,7 +148,7 @@
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/temporaryPurchaseWarehouse", jsonData);
$.operate.saveJson(prefix + "/temporaryPurchase", jsonData);
}
$("input[name='arrivedTime']").datetimepicker({
@ -351,7 +351,7 @@
// 清空下拉框现有选项
selectElement.empty();
// 添加默认选项(如果需要)编辑时不需要添加默认选项
// // 添加默认选项(如果需要)编辑时不需要添加默认选项
selectElement.append('<option value="">所有</option>');
// 遍历返回的数据,添加为下拉框的选项
@ -359,7 +359,7 @@
// 仓库ID
selectElement.append('<option value="' + item.stockNO + '">' + item.stockNO + '</option>');
});
// $('#warehouseCode').val(stockNO);
$('#warehouseCode').val(warehouseCode);
} else {
$.modal.errMsg("数据为空");
}

Loading…
Cancel
Save