Browse Source

[feat]

仓库管理 出库单
新增委外单出库页面和委外单出库详情页面;
修改出库单列表页面,补全按钮;
修改出库单出库controller、service方法,补全出库类型,添加库存查询、库存历史相关;
dev
王晓迪 2 months ago
parent
commit
f7d508d33f
  1. 49
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseOutOrderController.java
  2. 381
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java
  3. 210
      ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/outsourceOutWarehouse.html
  4. 197
      ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/outsourceOutWarehouseDetail.html
  5. 21
      ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/warehouseOutOrder.html

49
ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseOutOrderController.java

@ -247,6 +247,40 @@ public class WarehouseOutOrderController extends BaseController
}
/**
* 委外单-出库
*/
@GetMapping("/outsourceOutWarehouse/{outOrderId}")
public String outsourceOutWarehouse(@PathVariable("outOrderId") Long outOrderId, ModelMap mmap)
{
WarehouseOutOrder warehouseOutOrder = warehouseOutOrderService.selectWarehouseOutOrderById(outOrderId);
mmap.put("warehouseOutOrder", warehouseOutOrder);
return prefix + "/outsourceOutWarehouse";
}
/**
* 修改保存委外单-出库
*/
@RequiresPermissions("warehouse:warehouseOutOrder:outsourceOutWarehouse")
@Log(title = "仓库出库单", businessType = BusinessType.UPDATE)
@PostMapping("/outsourceOutWarehouse")
@ResponseBody
public AjaxResult outsourceOutWarehouseSave(@RequestBody WarehouseOutOrder warehouseOutOrder)
{
return toAjax(warehouseOutOrderService.updateOutsourceOutWarehouse(warehouseOutOrder));
}
/**
* 委外单-出库详情
*/
@GetMapping("/outsourceOutWarehouseDetail/{outOrderId}")
public String outsourceOutWarehouseDetail(@PathVariable("outOrderId") Long outOrderId, ModelMap mmap)
{
WarehouseOutOrder warehouseOutOrder = warehouseOutOrderService.selectWarehouseOutOrderById(outOrderId);
mmap.put("warehouseOutOrder", warehouseOutOrder);
return prefix + "/outsourceOutWarehouseDetail";
}
/**
* 生产单-出库
*/
@ -282,19 +316,6 @@ public class WarehouseOutOrderController extends BaseController
return prefix + "/makeOutWarehouseDetail";
}
/**
* 修改保存生产单-出库详情
*/
@RequiresPermissions("warehouse:warehouseOutOrder:makeOutWarehouseDetail")
@Log(title = "仓库出库单", businessType = BusinessType.UPDATE)
@PostMapping("/makeOutWarehouseDetail")
@ResponseBody
public AjaxResult makeOutWarehouseDetailSave(@RequestBody WarehouseOutOrder warehouseOutOrder)
{
return toAjax(warehouseOutOrderService.generalUpdateWarehouseOutOrder(warehouseOutOrder));
}
/**
* 生产单-出库
*/
@ -340,7 +361,7 @@ public class WarehouseOutOrderController extends BaseController
@ResponseBody
public AjaxResult requisitioningOutWarehouseSave(@RequestBody WarehouseOutOrder warehouseOutOrder)
{
return toAjax(warehouseOutOrderService.updatePrepareMaterial(warehouseOutOrder));
return toAjax(warehouseOutOrderService.updateRequisitionOutWarehouse(warehouseOutOrder));
}

381
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java

@ -1,5 +1,6 @@
package com.ruoyi.warehouse.service.impl;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@ -8,25 +9,25 @@ import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.erp.domain.ErpDevelopModifyorder;
import com.ruoyi.erp.domain.ErpDevelopModifyorderPicking;
import com.ruoyi.erp.domain.ErpDevelopModifyorderPickingDetail;
import com.ruoyi.erp.domain.vo.ErpDevelopModifyorderPickingVo;
import com.ruoyi.erp.mapper.ErpDevelopModifyorderDetailMapper;
import com.ruoyi.erp.mapper.ErpDevelopModifyorderPickingDetailMapper;
import com.ruoyi.erp.mapper.ErpDevelopModifyorderPickingMapper;
import com.ruoyi.quality.domain.QualityRefundsExchanges;
import com.ruoyi.quality.mapper.QualityRefundsExchangesMapper;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.domain.Vo.BaseEmpRequisiteOrderVO;
import com.ruoyi.system.domain.Vo.OutsourceRequisitionVO;
import com.ruoyi.system.mapper.*;
import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail;
import com.ruoyi.warehouse.domain.WarehouseStorageOrder;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
import com.ruoyi.warehouse.domain.*;
import com.ruoyi.warehouse.mapper.WarehouseInventoryInquiryDetailMapper;
import com.ruoyi.warehouse.mapper.WarehouseInventoryInquiryMapper;
import com.ruoyi.warehouse.mapper.WarehouseOutOrderDetailMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.warehouse.mapper.WarehouseOutOrderMapper;
import com.ruoyi.warehouse.domain.WarehouseOutOrder;
import com.ruoyi.warehouse.service.IWarehouseOutOrderService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
@ -79,6 +80,20 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
@Autowired
private ErpDevelopModifyorderPickingMapper modifyorderPickingMapper;
@Autowired
private WarehouseInventoryInquiryMapper inventoryInquiryMapper;
@Autowired
private WarehouseInventoryInquiryDetailMapper inventoryInquiryDetailMapper;
@Autowired
private OutsourceRequisitionMapper requisitionMapper;
@Autowired
private BaseEmpRequisiteOrderMapper empRequisiteOrderMapper;
@Autowired
private QualityRefundsExchangesMapper refundsExchangesMapper;
/**
* 查询仓库出库单
@ -237,7 +252,7 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
String loginName = ShiroUtils.getLoginName();
warehouseOutOrder.setUpdateBy(loginName);
warehouseOutOrder.setUpdateTime(new Date());
warehouseOutOrder.setUpdateTime(DateUtils.getNowDate());
//设置为已出库
warehouseOutOrder.setWarehouseOutStatus("7");
@ -273,6 +288,24 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
int updateWarehouseOutOrderDetailResult = outOrderDetailMapper.updateWarehouseOutOrderDetail(warehouseOutOrderDetail);
if (updateWarehouseOutOrderDetailResult <= 0){
throw new BusinessException("更新出库单详情数据失败");
}else {
// 更新库存查询记录,新增库存历史
String materialNo = warehouseOutOrderDetail.getMaterialNo();
WarehouseInventoryInquiry inventoryInquiry = inventoryInquiryMapper.selectWarehouseInventoryInquiryByMaterialNo(materialNo);
if(inventoryInquiry == null){
throw new BusinessException("更新库存查询数据失败!该物料不存在库存查询数据");
}else{
int inquiryUpdateResult = updateWarehouseInventoryInquiry(warehouseOutOrderDetail,inventoryInquiry);
if (inquiryUpdateResult <= 0){
throw new BusinessException("更新库存查询数据失败");
}
WarehouseInventoryInquiryDetail inquiryDetail = createWarehouseInventoryInquiryDetail(warehouseOutOrderDetail);
inquiryDetail.setInventoryHistoricalType("8");//销售出库
int insertInquiryResult = inventoryInquiryDetailMapper.insertWarehouseInventoryInquiryDetail(inquiryDetail);
if (insertInquiryResult <= 0){
throw new BusinessException("新增库存历史数据失败");
}
}
}
}
//更新销售出货通知列表
@ -296,7 +329,48 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
return updateWarehouseOutOrderResult;
}
// 更新物料对应库存查询记录
public int updateWarehouseInventoryInquiry(WarehouseOutOrderDetail outOrderDetail,WarehouseInventoryInquiry inventoryInquiry){
// 更新可用库存数
BigDecimal stockNum = inventoryInquiry.getAvailableStockNum();
if((stockNum.compareTo(BigDecimal.ZERO) <= 0)){
throw new BusinessException("出库失败!该物料无可用库存数");
}
int outNum = outOrderDetail.getActualOutOrderSum();
stockNum = stockNum.subtract(BigDecimal.valueOf(outNum));
inventoryInquiry.setAvailableStockNum(stockNum);
// 更新使用数
BigDecimal useNum = inventoryInquiry.getUseNum();
useNum = useNum.add(BigDecimal.valueOf(outNum));
inventoryInquiry.setUseNum(useNum);
inventoryInquiry.setUpdateBy(ShiroUtils.getLoginName());
inventoryInquiry.setUpdateTime(DateUtils.getNowDate());
int inquiryUpdateResult = inventoryInquiryMapper.updateWarehouseInventoryInquiry(inventoryInquiry);
return inquiryUpdateResult;
}
// 根据出库单详情生成库存历史记录
public WarehouseInventoryInquiryDetail createWarehouseInventoryInquiryDetail(WarehouseOutOrderDetail outOrderDetail){
WarehouseInventoryInquiryDetail inquiryDetail = new WarehouseInventoryInquiryDetail();
inquiryDetail.setMaterialNo(outOrderDetail.getMaterialNo());
inquiryDetail.setMaterialName(outOrderDetail.getMaterialName());
inquiryDetail.setMaterialBrand(outOrderDetail.getMaterialBrand());
inquiryDetail.setMaterialPhotourl(outOrderDetail.getMaterialPhotourl());
inquiryDetail.setMaterialDescribe(outOrderDetail.getMaterialDescribe());
inquiryDetail.setMaterialUnit(outOrderDetail.getMaterialUnit());
inquiryDetail.setMaterialType(outOrderDetail.getMaterialType());
inquiryDetail.setInventoryIncreaseDecrease("0");
int decreaseNum = outOrderDetail.getActualOutOrderSum();
BigDecimal useNum = BigDecimal.valueOf(decreaseNum);
inquiryDetail.setUseNum(useNum);
inquiryDetail.setAvailableStockNum(useNum);
inquiryDetail.setInventoryHistoricalTime(DateUtils.getNowDate());
inquiryDetail.setCreateBy(ShiroUtils.getLoginName());
inquiryDetail.setCreateTime(DateUtils.getNowDate());
return inquiryDetail;
}
/**
* 修改保存退换货-出库
*/
@ -308,16 +382,67 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
List<WarehouseOutOrderDetail> warehouseOutOrderDetailList = warehouseOutOrder.getWarehouseOutOrderDetailList();
if (StringUtils.isEmpty(warehouseOutOrderDetailList)){
log.warn("退换货-出库,物料列表信息为空:{}",warehouseOutOrder);
throw new BusinessException("出库失败,出库单物料详情为空!");
}
int updateRows = 0;
for (WarehouseOutOrderDetail warehouseOutOrderDetail : warehouseOutOrderDetailList) {
warehouseOutOrderDetail.setUpdateBy(loginName);
warehouseOutOrderDetail.setUpdateTime(new Date());
warehouseOutOrderDetail.setUpdateTime(DateUtils.getNowDate());
//设置已出库数
warehouseOutOrderDetail.setHasOutOrderSum(warehouseOutOrderDetail.getActualOutOrderSum());
//设置仓库员
warehouseOutOrderDetail.setWarehouseName(loginName);
//更新数据库记录
updateRows += outOrderDetailMapper.updateWarehouseOutOrderDetail(warehouseOutOrderDetail);
if (updateRows <= 0) {
throw new BusinessException("更新出库单详情数据失败");
}
}
warehouseOutOrder.setUpdateBy(loginName);
warehouseOutOrder.setUpdateTime(DateUtils.getNowDate());
//表明已出库
warehouseOutOrder.setWarehouseOutStatus("7");
//设置出库时间
warehouseOutOrder.setOutOrderTime(DateUtils.getNowDate());
//设置仓库员
warehouseOutOrder.setWarehouseName(loginName);
//计算出库单主表的出库数
Integer outOrderSum = 0;
// 检查outOrderSum是否含有null值
boolean hasOutOrderSumNull = warehouseOutOrderDetailList.stream()
.anyMatch(item -> item.getActualOutOrderSum() == null);
if (hasOutOrderSumNull) {
throw new BusinessException("存在实际出库数为空,请检查!");
}
// 检查库存是否超出
boolean hasOutOrderSumOver = warehouseOutOrderDetailList.stream()
.anyMatch(item -> item.getActualOutOrderSum() > item.getApplyOutOrderSum());
if (hasOutOrderSumOver) {
throw new BusinessException("存在实际出库数大于申请出库数,请检查!");
}
return updateRows;
// 计算各个字段的总和
outOrderSum = warehouseOutOrderDetailList.stream()
.mapToInt(WarehouseOutOrderDetail::getActualOutOrderSum)
.sum();
//设置出库单主表的出库数
warehouseOutOrder.setOutOrderSum(outOrderSum);
QualityRefundsExchanges tempExchanges = new QualityRefundsExchanges();
tempExchanges.setOutStorageCode(warehouseOutOrder.getOutOrderCode());
List<QualityRefundsExchanges> tempExchangesList = refundsExchangesMapper.selectQualityRefundsExchangesList(tempExchanges);
QualityRefundsExchanges refundsExchanges = tempExchangesList.get(0);
refundsExchanges.setQualityWarehouseStatus("4");
refundsExchanges.setUpdateBy(ShiroUtils.getLoginName());
refundsExchanges.setUpdateTime(DateUtils.getNowDate());
int updateRefundResult = refundsExchangesMapper.updateQualityRefundsExchanges(refundsExchanges);
if(updateRefundResult<=0){
throw new BusinessException("更新关联退换货订单仓库状态失败!");
}
return warehouseOutOrderMapper.updateWarehouseOutOrder(warehouseOutOrder);
}
/*
@ -522,18 +647,37 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
warehouseOutOrderDetail.setWarehouseName(loginName);
//更新数据库记录
updateRows += outOrderDetailMapper.updateWarehouseOutOrderDetail(warehouseOutOrderDetail);
}
if (updateRows <= 0){
throw new BusinessException("更新出库单详情数据失败");
}
if (updateRows <= 0){
throw new BusinessException("更新出库单详情数据失败");
}else {
// 更新库存查询记录,新增库存历史
String materialNo = warehouseOutOrderDetail.getMaterialNo();
WarehouseInventoryInquiry inventoryInquiry = inventoryInquiryMapper.selectWarehouseInventoryInquiryByMaterialNo(materialNo);
if(inventoryInquiry == null){
throw new BusinessException("更新库存查询数据失败!该物料不存在库存数据");
}else{
int inquiryUpdateResult = updateWarehouseInventoryInquiry(warehouseOutOrderDetail,inventoryInquiry);
if (inquiryUpdateResult <= 0){
throw new BusinessException("更新库存查询数据失败");
}
WarehouseInventoryInquiryDetail inquiryDetail = createWarehouseInventoryInquiryDetail(warehouseOutOrderDetail);
inquiryDetail.setInventoryHistoricalType("4");//生产出库
int insertInquiryResult = inventoryInquiryDetailMapper.insertWarehouseInventoryInquiryDetail(inquiryDetail);
if (insertInquiryResult <= 0){
throw new BusinessException("新增库存历史数据失败");
}
}
}
}
}
warehouseOutOrder.setUpdateBy(loginName);
warehouseOutOrder.setUpdateTime(new Date());
warehouseOutOrder.setUpdateTime(DateUtils.getNowDate());
//表明已出库
warehouseOutOrder.setWarehouseOutStatus("7");
//设置出库时间
warehouseOutOrder.setOutOrderTime(new Date());
warehouseOutOrder.setOutOrderTime(DateUtils.getNowDate());
//设置仓库员
warehouseOutOrder.setWarehouseName(loginName);
@ -853,8 +997,8 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
// log.warn("关联订单号为空:{}",relatedCode);
// }
//出库状态为 待仓库准备物料
warehouseOutOrder.setWarehouseOutStatus("0");
//出库状态为 待出库
warehouseOutOrder.setWarehouseOutStatus("4");
//订单类型设置为 请购订单
warehouseOutOrder.setWarehouseOrderType("2");
//出库类型设置为 员工领料
@ -875,7 +1019,203 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
return warehouseOutOrderMapper.insertWarehouseOutOrder(warehouseOutOrder);
}
//新增出库单明细
// 委外单-出库
@Transactional(rollbackFor = Exception.class)
@Override
public int updateOutsourceOutWarehouse(WarehouseOutOrder warehouseOutOrder) {
String loginName = ShiroUtils.getLoginName();
// 参数校验
if (warehouseOutOrder == null) {
throw new BusinessException("更新出库单信息失败:缺少必要参数");
}
List<WarehouseOutOrderDetail> warehouseOutOrderDetailList = warehouseOutOrder.getWarehouseOutOrderDetailList();
if (CollectionUtils.isEmpty(warehouseOutOrderDetailList)){
log.warn("保存委外单出库,物料列表信息为空:{}",warehouseOutOrder);
throw new BusinessException("出库单详情数据为空");
}else {
int updateRows = 0;
for (WarehouseOutOrderDetail warehouseOutOrderDetail : warehouseOutOrderDetailList) {
warehouseOutOrderDetail.setUpdateBy(loginName);
warehouseOutOrderDetail.setUpdateTime(DateUtils.getNowDate());
warehouseOutOrderDetail.setRemark(warehouseOutOrder.getRemark());
//设置已出库数
warehouseOutOrderDetail.setHasOutOrderSum(warehouseOutOrderDetail.getActualOutOrderSum());
//设置仓库员
warehouseOutOrderDetail.setWarehouseName(loginName);
//更新数据库记录
updateRows += outOrderDetailMapper.updateWarehouseOutOrderDetail(warehouseOutOrderDetail);
if (updateRows <= 0){
throw new BusinessException("更新出库单详情数据失败");
}else {
// 更新库存查询记录,新增库存历史
String materialNo = warehouseOutOrderDetail.getMaterialNo();
WarehouseInventoryInquiry inventoryInquiry = inventoryInquiryMapper.selectWarehouseInventoryInquiryByMaterialNo(materialNo);
if(inventoryInquiry == null){
throw new BusinessException("更新库存查询数据失败!该物料不存在库存数据");
}else{
int inquiryUpdateResult = updateWarehouseInventoryInquiry(warehouseOutOrderDetail,inventoryInquiry);
if (inquiryUpdateResult <= 0){
throw new BusinessException("更新库存查询数据失败");
}
WarehouseInventoryInquiryDetail inquiryDetail = createWarehouseInventoryInquiryDetail(warehouseOutOrderDetail);
inquiryDetail.setInventoryHistoricalType("5");//委外领料
int insertInquiryResult = inventoryInquiryDetailMapper.insertWarehouseInventoryInquiryDetail(inquiryDetail);
if (insertInquiryResult <= 0){
throw new BusinessException("新增库存历史数据失败");
}
}
}
}
}
warehouseOutOrder.setUpdateBy(loginName);
warehouseOutOrder.setUpdateTime(DateUtils.getNowDate());
//表明已出库
warehouseOutOrder.setWarehouseOutStatus("7");
//设置出库时间
warehouseOutOrder.setOutOrderTime(DateUtils.getNowDate());
//设置仓库员
warehouseOutOrder.setWarehouseName(loginName);
//计算出库单主表的出库数
Integer outOrderSum = 0;
// 检查outOrderSum是否含有null值
boolean hasOutOrderSumNull = warehouseOutOrderDetailList.stream()
.anyMatch(item -> item.getActualOutOrderSum() == null);
if (hasOutOrderSumNull) {
throw new BusinessException("存在实际出库数为空,请检查!");
}
// 检查outOrderSum是否含有null值
boolean hasOutOrderSumOver = warehouseOutOrderDetailList.stream()
.anyMatch(item -> item.getActualOutOrderSum() > item.getApplyOutOrderSum());
if (hasOutOrderSumOver) {
throw new BusinessException("存在实际出库数大于申请出库数,请检查!");
}
// 计算各个字段的总和
outOrderSum = warehouseOutOrderDetailList.stream()
.mapToInt(WarehouseOutOrderDetail::getActualOutOrderSum)
.sum();
//设置出库单主表的出库数
warehouseOutOrder.setOutOrderSum(outOrderSum);
// 更新委外领料单
OutsourceRequisitionVO temp = new OutsourceRequisitionVO();
temp.setOutsourceRequisitionNo(warehouseOutOrder.getRelatedOrderCode());
List<OutsourceRequisitionVO> outRequisitions = requisitionMapper.selectOutsourceRequisitionList(temp);
OutsourceRequisitionVO requisitionVO = outRequisitions.get(0);
requisitionVO.setRequisitionStatus("2");
requisitionVO.setUpdateTime(DateUtils.getNowDate());
requisitionVO.setUpdateBy(ShiroUtils.getLoginName());
int updateResult = requisitionMapper.updateOutsourceRequisition(requisitionVO);
if(updateResult<=0){
throw new BusinessException("更新委外领料单失败!");
}
return warehouseOutOrderMapper.updateWarehouseOutOrder(warehouseOutOrder);
}
// 请购单-出库
@Transactional(rollbackFor = Exception.class)
@Override
public int updateRequisitionOutWarehouse(WarehouseOutOrder warehouseOutOrder) {
String loginName = ShiroUtils.getLoginName();
// 参数校验
if (warehouseOutOrder == null) {
throw new BusinessException("更新出库单信息失败:缺少必要参数");
}
List<WarehouseOutOrderDetail> warehouseOutOrderDetailList = warehouseOutOrder.getWarehouseOutOrderDetailList();
if (CollectionUtils.isEmpty(warehouseOutOrderDetailList)){
log.warn("保存请购单出库,物料列表信息为空:{}",warehouseOutOrder);
throw new BusinessException("出库单详情数据为空");
}else {
int updateRows = 0;
for (WarehouseOutOrderDetail warehouseOutOrderDetail : warehouseOutOrderDetailList) {
warehouseOutOrderDetail.setUpdateBy(loginName);
warehouseOutOrderDetail.setUpdateTime(DateUtils.getNowDate());
warehouseOutOrderDetail.setRemark(warehouseOutOrder.getRemark());
//设置已出库数
warehouseOutOrderDetail.setHasOutOrderSum(warehouseOutOrderDetail.getActualOutOrderSum());
//设置仓库员
warehouseOutOrderDetail.setWarehouseName(loginName);
//更新数据库记录
updateRows += outOrderDetailMapper.updateWarehouseOutOrderDetail(warehouseOutOrderDetail);
if (updateRows <= 0){
throw new BusinessException("更新出库单详情数据失败");
}else {
// 更新库存查询记录,新增库存历史
String materialNo = warehouseOutOrderDetail.getMaterialNo();
WarehouseInventoryInquiry inventoryInquiry = inventoryInquiryMapper.selectWarehouseInventoryInquiryByMaterialNo(materialNo);
if(inventoryInquiry == null){
throw new BusinessException("更新库存查询数据失败!该物料不存在库存数据");
}else{
int inquiryUpdateResult = updateWarehouseInventoryInquiry(warehouseOutOrderDetail,inventoryInquiry);
if (inquiryUpdateResult <= 0){
throw new BusinessException("更新库存查询数据失败");
}
WarehouseInventoryInquiryDetail inquiryDetail = createWarehouseInventoryInquiryDetail(warehouseOutOrderDetail);
inquiryDetail.setInventoryHistoricalType("6");//员工领料
int insertInquiryResult = inventoryInquiryDetailMapper.insertWarehouseInventoryInquiryDetail(inquiryDetail);
if (insertInquiryResult <= 0){
throw new BusinessException("新增库存历史数据失败");
}
}
}
}
}
warehouseOutOrder.setUpdateBy(loginName);
warehouseOutOrder.setUpdateTime(DateUtils.getNowDate());
//表明已出库
warehouseOutOrder.setWarehouseOutStatus("7");
//设置出库时间
warehouseOutOrder.setOutOrderTime(DateUtils.getNowDate());
//设置仓库员
warehouseOutOrder.setWarehouseName(loginName);
//计算出库单主表的出库数
Integer outOrderSum = 0;
// 检查outOrderSum是否含有null值
boolean hasOutOrderSumNull = warehouseOutOrderDetailList.stream()
.anyMatch(item -> item.getActualOutOrderSum() == null);
if (hasOutOrderSumNull) {
throw new BusinessException("存在实际出库数为空,请检查!");
}
// 检查outOrderSum是否含有null值
boolean hasOutOrderSumOver = warehouseOutOrderDetailList.stream()
.anyMatch(item -> item.getActualOutOrderSum() > item.getApplyOutOrderSum());
if (hasOutOrderSumOver) {
throw new BusinessException("存在实际出库数大于申请出库数,请检查!");
}
// 计算各个字段的总和
outOrderSum = warehouseOutOrderDetailList.stream()
.mapToInt(WarehouseOutOrderDetail::getActualOutOrderSum)
.sum();
//设置出库单主表的出库数
warehouseOutOrder.setOutOrderSum(outOrderSum);
// 更新员工领料单
BaseEmpRequisiteOrderVO temp = new BaseEmpRequisiteOrderVO();
temp.setRequisitieCode(warehouseOutOrder.getRelatedOrderCode());
List<BaseEmpRequisiteOrderVO> empRequisiteOrderVOS = empRequisiteOrderMapper.selectBaseEmpRequisiteOrderList(temp);
BaseEmpRequisiteOrderVO requisitionVO = empRequisiteOrderVOS.get(0);
requisitionVO.setRequisitieStatus("2");
requisitionVO.setUpdateTime(DateUtils.getNowDate());
requisitionVO.setUpdateBy(ShiroUtils.getLoginName());
int updateResult = empRequisiteOrderMapper.updateBaseEmpRequisiteOrder(requisitionVO);
if(updateResult<=0){
throw new BusinessException("更新员工领料单失败!");
}
return warehouseOutOrderMapper.updateWarehouseOutOrder(warehouseOutOrder);
}
//新增出库单明细(员工领料)
private void CreateOutOrderDetailByRequisiteOrderChildList(BaseEmpRequisiteOrderVO baseEmpRequisiteOrderVO, String outOrderCode) {
List<BaseEmpRequisiteOrderChild> childList = baseEmpRequisiteOrderVO.getBaseEmpRequisiteOrderChildList();
String requisiteCode = baseEmpRequisiteOrderVO.getRequisitieCode();
@ -894,6 +1234,9 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
warehouseOutOrderDetail.setMaterialProcessMethod(child.getProcessMethod());
warehouseOutOrderDetail.setEnterpriseSum(Math.toIntExact(child.getMaterialNum()));
warehouseOutOrderDetail.setMakeNum(Math.toIntExact(child.getMaterialNum()));
warehouseOutOrderDetail.setApplyOutOrderSum(Math.toIntExact(child.getMaterialNum()));
warehouseOutOrderDetail.setWarehouseOrderType("2");
warehouseOutOrderDetail.setWarehouseOutType("2");
warehouseOutOrderDetail.setCreateTime(DateUtils.getNowDate());
warehouseOutOrderDetail.setCreateBy(child.getCreateBy());
int insertOutOrderDetailResult = outOrderDetailMapper.insertWarehouseOutOrderDetail(warehouseOutOrderDetail);

210
ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/outsourceOutWarehouse.html

@ -0,0 +1,210 @@
<!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" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-outsourceOutWarehouse-edit" th:object="${warehouseOutOrder}">
<input name="outOrderId" th:field="*{outOrderId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">出库单号:</label>
<div class="col-sm-8">
<input name="outOrderCode" th:field="*{outOrderCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">订单类型:</label>
<div class="col-sm-8">
<select name="warehouseOrderType" class="form-control m-b" th:with="type=${@dict.getType('warehouse_order_type')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehouseOrderType}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">委外单号:</label>
<div class="col-sm-8">
<input name="makeNo" th:field="*{relatedOrderCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">申请人员:</label>
<div class="col-sm-8">
<input name="applyName" th:field="*{applyName}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="remark" th:field="*{remark}" class="form-control" type="text">
</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 warehouseOutOrder = [[${warehouseOutOrder}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var prefix = ctx + "warehouse/warehouseOutOrder";
$("#form-outsourceOutWarehouse-edit").validate({
focusCleanup: true
});
// 新增提交
function submitHandler() {
// 获取表单数据
const warehouseOutOrderData = $("#form-outsourceOutWarehouse-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据
var table = $('#bootstrap-table').bootstrapTable('getData');
// 将表数据转换成与complaintNoticeData格式一致的数组
var materialDataList = table.map(function(item) {
// 根据实际字段名调整
return {
"outOrderDetailId":item.outOrderDetailId,
"outOrderCode":item.outOrderCode,
"materialNo": item.materialNo, // 假设id对应materialId
"prepareOutOrderSum":item.prepareOutOrderSum,
"actualOutOrderSum":item.actualOutOrderSum,
"applyOutOrderSum": item.applyOutOrderSum
// ...其他字段
};
});
const combinedData = Object.assign({}, warehouseOutOrderData, {
warehouseOutOrderDetailList: materialDataList,
});
// 合并表单数据和表格数据
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/outsourceOutWarehouse", jsonData);
}
//物料信息展示列表
$(function() {
var options = {
modalName: "选择物料",
url: ctx + "warehouse/warehouseOutOrder/getMaterialListByOutOrderCode",
queryParams: queryParams,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
pagination: false, // 设置不分页
columns: [{
checkbox: true
},
{
title: '出库单详情ID',
field: 'outOrderDetailId',
visible: false
},
{
title: '出库单号',
field: 'outOrderCode',
visible: false
},
{
title: '料号',
field: 'materialNo',
},
{
title: '图片',
field: 'materialPhotourl',
formatter: function(value, row, index) {
return $.table.imageView(value);
}
},
{
title: '物料名称',
field: 'materialName',
},
{
title: '物料类型',
field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
title: '描述',
field: 'materialDescribe',
},
{
title: '品牌',
field: 'materialBrand',
},
{
title: '单位',
field: 'materialUnit',
},
{
title: '加工方式',
field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
title: '订单数量',
field: 'makeNum',
},
{
title: '已出库数',
field: 'hasOutOrderSum',
},
{
title: '申请出库数',
field: 'applyOutOrderSum',
},
{
title: '实际出库数',
field: 'actualOutOrderSum',
editable: {
type: 'text',
mode:'inline',
validate: function (v,row) {
if (!v) return '数量不能为空';
if (isNaN(v)) return '数量必须是数字';
var actualOutOrderSum = parseInt(v);
if (actualOutOrderSum <= 0) return '数量必须是正整数';
}
}
}
]
};
$.table.init(options);
})
function queryParams(params) {
var curParams = {
// 传递参数查询参数
outOrderCode: warehouseOutOrder.outOrderCode
};
// console.log(curParams);
return curParams;
}
</script>
</body>
</html>

197
ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/outsourceOutWarehouseDetail.html

@ -0,0 +1,197 @@
<!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" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-makeOutWarehouse-edit" th:object="${warehouseOutOrder}">
<input name="outOrderId" th:field="*{outOrderId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">出库单号:</label>
<div class="col-sm-8">
<input name="outOrderCode" th:field="*{outOrderCode}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">订单类型:</label>
<div class="col-sm-8">
<select name="warehouseOrderType" class="form-control m-b" th:with="type=${@dict.getType('warehouse_order_type')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehouseOrderType}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">委外单号:</label>
<div class="col-sm-8">
<input name="makeNo" th:field="*{relatedOrderCode}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">申请人员:</label>
<div class="col-sm-8">
<input name="applyName" th:field="*{applyName}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="remark" th:field="*{remark}" class="form-control" type="text" disabled>
</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 warehouseOutOrder = [[${warehouseOutOrder}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var prefix = ctx + "warehouse/warehouseOutOrder";
$("#form-makeOutWarehouse-edit").validate({
focusCleanup: true
});
// 新增提交
function submitHandler() {
// 获取表单数据
const warehouseOutOrderData = $("#form-makeOutWarehouse-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据
var table = $('#bootstrap-table').bootstrapTable('getData');
// 将表数据转换成与complaintNoticeData格式一致的数组
var materialDataList = table.map(function(item) {
// 根据实际字段名调整
return {
"outOrderDetailId":item.outOrderDetailId,
"outOrderCode":item.outOrderCode,
"materialNo": item.materialNo, // 假设id对应materialId
"prepareOutOrderSum":item.prepareOutOrderSum,
"actualOutOrderSum":item.actualOutOrderSum
// ...其他字段
};
});
const combinedData = Object.assign({}, warehouseOutOrderData, {
warehouseOutOrderDetailList: materialDataList,
});
// 合并表单数据和表格数据
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/outsourceOutWarehouse", jsonData);
}
//物料信息展示列表
$(function() {
var options = {
modalName: "选择物料",
url: ctx + "warehouse/warehouseOutOrder/getMaterialListByOutOrderCode",
queryParams: queryParams,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
pagination: false, // 设置不分页
columns: [{
checkbox: true
},
{
title: '出库单详情ID',
field: 'outOrderDetailId',
visible: false
},
{
title: '出库单号',
field: 'outOrderCode',
visible: false
},
{
title: '料号',
field: 'materialNo',
},
{
title: '图片',
field: 'materialPhotourl',
formatter: function(value, row, index) {
return $.table.imageView(value);
}
},
{
title: '物料名称',
field: 'materialName',
},
{
title: '物料类型',
field: 'materialType',
},
{
title: '描述',
field: 'materialDescribe',
},
{
title: '品牌',
field: 'materialBrand',
},
{
title: '单位',
field: 'materialUnit',
},
{
title: '加工方式',
field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
title: '订单数量',
field: 'makeNum',
},
{
title: '已出库数',
field: 'hasOutOrderSum',
},
{
title: '申请出库数',
field: 'applyOutOrderSum',
},
{
title: '实际出库数',
field: 'actualOutOrderSum',
}
]
};
$.table.init(options);
})
function queryParams(params) {
var curParams = {
// 传递参数查询参数
outOrderCode: warehouseOutOrder.outOrderCode
};
console.log(curParams);
return curParams;
}
</script>
</body>
</html>

21
ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/warehouseOutOrder.html

@ -71,6 +71,7 @@
var prepareMaterialFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:prepareMaterial')}]];
var salesOutWarehouseFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:salesOutWarehouse')}]];
var makeOutWarehouseFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:makeOutWarehouse')}]];
var outsourceOutWarehouseFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:outsourceOutWarehouse')}]];
var requisitioningOutWarehouseFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:requisitioningOutWarehouse')}]];
var refundsExchangesOutWarehouseFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:refundsExchangesOutWarehouse')}]];
var developModifyOutWarehouseFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:developModifyOutWarehouse')}]];
@ -78,6 +79,7 @@
var prepareMaterialDetailFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:prepareMaterialDetail')}]];
var salesOutWarehouseDetailFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:salesOutWarehouseDetail')}]];
var makeOutWarehouseDetailFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:makeOutWarehouseDetail')}]];
var outsourceOutWarehouseDetailFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:outsoruceOutWarehouseDetail')}]];
var requisitioningOutWarehouseDetailFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:requisitioningOutWarehouseDetail')}]];
var refundsExchangesOutWarehouseDetailFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:refundsExchangesOutWarehouseDetail')}]];
var developModifyOutWarehouseDetailFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:developModifyOutWarehouseDetail')}]];
@ -237,6 +239,14 @@
actions.push('<a class="btn btn-success btn-xs ' + developModifyOutWarehouseDetailFlag + '" href="javascript:void(0)" onclick="developModifyOutWarehouseDetail(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>详情</a> ');
}
/*委外单-出库*/
if (row.warehouseOutStatus == 4 && row.warehouseOrderType == 3 && row.warehouseOutType == 3){
actions.push('<a class="btn btn-success btn-xs ' + outsourceOutWarehouseFlag + '" href="javascript:void(0)" onclick="outsourceOutWarehouse(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>出库</a> ');
}
/*生产单-出库 详情*/
if (row.warehouseOrderType == 3 && row.warehouseOutType == 3){
actions.push('<a class="btn btn-success btn-xs ' + outsourceOutWarehouseDetailFlag + '" href="javascript:void(0)" onclick="outsourceOutWarehouseDetail(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>详情</a> ');
}
return actions.join('');
}
@ -282,6 +292,17 @@
$.modal.open("出库详情",url);
}
/*生产单-出库*/
function outsourceOutWarehouse(outOrderId){
var url = ctx + 'warehouse/warehouseOutOrder/outsourceOutWarehouse/' + outOrderId;
$.modal.open("出库",url);
}
/*生产单-出库详情*/
function outsourceOutWarehouseDetail(outOrderId){
var url = ctx + 'warehouse/warehouseOutOrder/outsourceOutWarehouseDetail/' + outOrderId;
$.modal.open("出库详情",url);
}
/*开发修改单-出库*/
function developModifyOutWarehouse(outOrderId){
var url = ctx + 'warehouse/warehouseOutOrder/developModifyOutWarehouse/' + outOrderId;

Loading…
Cancel
Save