Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dev
zhangsiqi 5 months ago
parent
commit
3d3c571674
  1. 24
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseStorageServiceImpl.java
  2. 7
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderService.java
  3. 180
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java
  4. 2
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java
  5. 2
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java
  6. 10
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseStorageOrderMapper.java
  7. 6
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java
  8. 117
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java
  9. 18
      ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseStorageOrderMapper.xml
  10. 290
      ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html
  11. 28
      ruoyi-admin/src/main/resources/templates/purchase/purchaseStorage/purchaseStorage.html
  12. 18
      ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html
  13. 6
      ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html

24
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseStorageServiceImpl.java

@ -52,14 +52,15 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService
@Override @Override
public List<PurchaseStorage> selectPurchaseStorageList(WarehouseStorageOrder warehouseStorageOrder) public List<PurchaseStorage> selectPurchaseStorageList(WarehouseStorageOrder warehouseStorageOrder)
{ {
List<WarehouseStorageOrder> allWarehouseStorageOrders = warehouseStorageOrderMapper.selectWarehouseStorageOrderList(warehouseStorageOrder); // List<WarehouseStorageOrder> allWarehouseStorageOrders = warehouseStorageOrderMapper.selectWarehouseStorageOrderList(warehouseStorageOrder);
List<PurchaseStorage> purchaseStorages = new ArrayList<>(); List<PurchaseStorage> purchaseStorages = new ArrayList<>();
// 使用流过滤出warehouseOrderType为"0"的记录 也就是采购订单 // 使用流过滤出warehouseOrderType为"0"的记录 也就是采购订单
List<WarehouseStorageOrder> filteredWarehouseStorageOrders = allWarehouseStorageOrders.stream() // List<WarehouseStorageOrder> filteredWarehouseStorageOrders = allWarehouseStorageOrders.stream()
.filter(s -> "0".equals(s.getWarehouseOrderType())) // .filter(s -> "0".equals(s.getWarehouseOrderType()))
.collect(Collectors.toList()); // .collect(Collectors.toList());
List<WarehouseStorageOrder> allWarehouseStorageOrders = warehouseStorageOrderMapper.selectPurchaseStorageList(warehouseStorageOrder);
for (WarehouseStorageOrder wso : filteredWarehouseStorageOrders) { for (WarehouseStorageOrder wso : allWarehouseStorageOrders) {
PurchaseStorage ps = new PurchaseStorage(); PurchaseStorage ps = new PurchaseStorage();
BeanUtils.copyProperties(wso, ps); BeanUtils.copyProperties(wso, ps);
purchaseStorages.add(ps); purchaseStorages.add(ps);
@ -70,13 +71,14 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService
@Override @Override
public List<WarehouseStorageOrder> selectWarehouseStorageList(WarehouseStorageOrder warehouseStorageOrder) { public List<WarehouseStorageOrder> selectWarehouseStorageList(WarehouseStorageOrder warehouseStorageOrder) {
// 先获取所有仓储订单列表 // 先获取所有仓储订单列表
List<WarehouseStorageOrder> allWarehouseStorageOrders = warehouseStorageOrderMapper.selectWarehouseStorageOrderList(warehouseStorageOrder); List<WarehouseStorageOrder> allWarehouseStorageOrders = warehouseStorageOrderMapper.selectPurchaseStorageList(warehouseStorageOrder);
// 使用流过滤出warehouseOrderType为"0"的记录 也就是采购订单 // // 使用流过滤出warehouseOrderType为"0"的记录 也就是采购订单
List<WarehouseStorageOrder> filteredWarehouseStorageOrders = allWarehouseStorageOrders.stream() // List<WarehouseStorageOrder> filteredWarehouseStorageOrders = allWarehouseStorageOrders.stream()
.filter(s -> "0".equals(s.getWarehouseOrderType())) // .filter(s -> "0".equals(s.getWarehouseOrderType()))
.collect(Collectors.toList()); // .collect(Collectors.toList());
return filteredWarehouseStorageOrders; // return filteredWarehouseStorageOrders;
return allWarehouseStorageOrders;
} }
/** /**

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 java.util.List;
import com.ruoyi.quality.domain.QualityOrder; import com.ruoyi.quality.domain.QualityOrder;
import com.ruoyi.warehouse.domain.WarehouseStorageOrder;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
/** /**
* 品质管理品质单Service接口 * 品质管理品质单Service接口
@ -72,4 +74,9 @@ public interface IQualityOrderService
* @return * @return
*/ */
int restoreQualityOrderById(Long qualityOrderId); 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; package com.ruoyi.quality.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.quality.mapper.QualityOrderMapper; import com.ruoyi.quality.mapper.QualityOrderMapper;
@ -22,6 +34,19 @@ public class QualityOrderServiceImpl implements IQualityOrderService
@Autowired @Autowired
private QualityOrderMapper qualityOrderMapper; 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); 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/system/controller/SysMakeOrderController.java

@ -146,7 +146,7 @@ public class SysMakeOrderController extends BaseController
sysMakeOrder.setCustomerOderCode(sysSalesOrder.getSalesOrderNumber()); sysMakeOrder.setCustomerOderCode(sysSalesOrder.getSalesOrderNumber());
} }
mmap.put("sysMakeOrder", sysMakeOrder); mmap.put("sysMakeOrder", sysMakeOrder);
return prefix + "/addPick"; return prefix + "/addpick";
} }
/** /**

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

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

10
ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseStorageOrderMapper.java

@ -28,6 +28,16 @@ public interface WarehouseStorageOrderMapper
*/ */
public List<WarehouseStorageOrder> selectWarehouseStorageOrderList(WarehouseStorageOrder warehouseStorageOrder); public List<WarehouseStorageOrder> selectWarehouseStorageOrderList(WarehouseStorageOrder warehouseStorageOrder);
/**
* 采购入库通知单查询仓库入库单列表
*
* @param warehouseStorageOrder 仓库入库单
* @return 仓库入库单集合
*/
public List<WarehouseStorageOrder> selectPurchaseStorageList(WarehouseStorageOrder 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 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; package com.ruoyi.warehouse.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; 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.domain.WarehouseStorageOrderDetail;
import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper; import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper;
import lombok.extern.slf4j.Slf4j; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper; 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.warehouse.service.IWarehouseStorageOrderService;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
/** /**
* 仓库入库单Service业务层处理 * 仓库入库单Service业务层处理
@ -30,6 +46,13 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
@Autowired @Autowired
private WarehouseStorageOrderDetailMapper storageOrderDetailMapper; 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); 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);
// }
/* /*
* 入库-生产订单 * 入库-生产订单
* */ * */

18
ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseStorageOrderMapper.xml

@ -50,6 +50,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="warehouseEmployee != null and warehouseEmployee != ''"> and warehouse_employee = #{warehouseEmployee}</if> <if test="warehouseEmployee != null and warehouseEmployee != ''"> and warehouse_employee = #{warehouseEmployee}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if> <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where> </where>
order by create_time desc
</select>
<select id="selectPurchaseStorageList" parameterType="WarehouseStorageOrder" resultMap="WarehouseStorageOrderResult">
<include refid="selectWarehouseStorageOrderVo"/>
<where>
<if test="warehouseStorageCode != null and warehouseStorageCode != ''"> and warehouse_storage_code = #{warehouseStorageCode}</if>
<if test="relatedOrderCode != null and relatedOrderCode != ''"> and related_order_code = #{relatedOrderCode}</if>
<if test="warehouseStorageStatus != null and warehouseStorageStatus != ''"> and warehouse_storage_status = #{warehouseStorageStatus}</if>
<if test="warehouseQualityStatus != null and warehouseQualityStatus != ''"> and warehouse_quality_status = #{warehouseQualityStatus}</if>
<if test="warehouseDeptType != null and warehouseDeptType != ''"> and warehouse_dept_type = #{warehouseDeptType}</if>
<if test="warehouseEmployee != null and warehouseEmployee != ''"> and warehouse_employee = #{warehouseEmployee}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
and warehouse_order_type = '0'
</where>
order by create_time desc
</select> </select>
<select id="selectWarehouseStorageOrderById" parameterType="Long" resultMap="WarehouseStorageOrderResult"> <select id="selectWarehouseStorageOrderById" parameterType="Long" resultMap="WarehouseStorageOrderResult">

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

@ -0,0 +1,290 @@
<!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-purchaseStorage-detail" th:object="${warehouseStorageOrder}">
<input name="warehouseStorageId" th:field="*{warehouseStorageId}" type="hidden">
<div class="form-group">
<label class="col-sm-4 control-label">采购单号:</label>
<div class="col-sm-8">
<input name="relatedOrderCode" th:field="*{relatedOrderCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">入库类型:</label>
<div class="col-sm-8">
<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-4 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 disabled>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</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 + "purchase/purchaseStorage";
$("#form-purchaseStorage-detail").validate({
focusCleanup: true
});
//生成的不同table的id集合
var tableDatas = [];
function submitHandler() {
const storageOrderData = $("#form-purchaseStorage-detail").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 + "/detail", 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 + "/storagePurchaseDetailList?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');
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: 'hasStorageNum',
},
{
title: '通知到货数',
field: 'notifyArriveNum',
},
]
});
$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>

28
ruoyi-admin/src/main/resources/templates/purchase/purchaseStorage/purchaseStorage.html

@ -12,33 +12,34 @@
<ul> <ul>
<li> <li>
<label>入库单号:</label> <label>入库单号:</label>
<input type="text" name="purchaseStorageCode"/> <input type="text" name="warehouseStorageCode"/>
</li>
<li>
<label>关联订单号:</label>
<input type="text" name="purchaseOrderCode"/>
</li>
<li>
<label>仓库员:</label>
<input type="text" name="storageEmployee"/>
</li> </li>
<li> <li>
<label>入库状态:</label> <label>入库状态:</label>
<select name="storageStatus" th:with="type=${@dict.getType('eceiptStatus')}"> <select name="warehouseStorageStatus" th:with="type=${@dict.getType('warehouse_storage_status')}">
<option value="">所有</option> <option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option> <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select> </select>
</li> </li>
<li> <li>
<label>品质状态:</label> <label>品质状态:</label>
<select name="qualityStatus" th:with="type=${@dict.getType('qualityStatus')}"> <select name="warehouseQualityStatus" th:with="type=${@dict.getType('warehouse_quality_status')}">
<option value="">所有</option> <option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option> <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select> </select>
</li> </li>
<li>
<label>关联订单号:</label>
<input type="text" name="relatedOrderCode"/>
</li>
<li>
<label>仓库员:</label>
<input type="text" name="warehouseEmployee"/>
</li>
<li> <li>
<label>入库部门:</label> <label>入库部门:</label>
<select name="purchaseDeptType" th:with="type=${@dict.getType('warehouseDept')}"> <select name="warehouseDeptType" th:with="type=${@dict.getType('warehouse_dept_type')}">
<option value="">所有</option> <option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option> <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select> </select>
@ -97,8 +98,7 @@
restoreUrl: prefix + "/restore/{id}", restoreUrl: prefix + "/restore/{id}",
exportUrl: prefix + "/export", exportUrl: prefix + "/export",
modalName: "采购入库通知单", modalName: "采购入库通知单",
fixedColumns: true, // 启用冻结列
fixedRightNumber: 1, // 冻结右列个数
columns: [ columns: [
{checkbox: true}, {checkbox: true},
{title: '入库单id',field: 'warehouseStorageId',visible: false}, {title: '入库单id',field: 'warehouseStorageId',visible: false},

18
ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html

@ -78,15 +78,15 @@
</div> </div>
<div class="btn-group-sm" id="toolbar" role="group"> <div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:makeorder:add"> <!-- <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:makeorder:add">-->
<i class="fa fa-plus"></i> 添加 <!-- <i class="fa fa-plus"></i> 添加-->
</a> <!-- </a>-->
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:makeorder:edit"> <!-- <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:makeorder:edit">-->
<i class="fa fa-edit"></i> 修改 <!-- <i class="fa fa-edit"></i> 修改-->
</a> <!-- </a>-->
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:makeorder:remove"> <!-- <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:makeorder:remove">-->
<i class="fa fa-remove"></i> 删除 <!-- <i class="fa fa-remove"></i> 删除-->
</a> <!-- </a>-->
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:makeorder:export"> <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:makeorder:export">
<i class="fa fa-download"></i> 导出 <i class="fa fa-download"></i> 导出
</a> </a>

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

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

Loading…
Cancel
Save