Browse Source

[fix]

仓库管理 入库单
修改生产订单委内入库页面,修改提交函数,补全字段;
修改委外单入库页面,修改页面表格定义,修改提交函数;
修改退换货入库页面,修改页面表格,修改提交函数;
修改委外单入库详情页面,正常显示;
修改暂收委外单页面,修改页面样式、表格定义,修改提交函数;
修改暂收委外单详情页面,正常显示;
修改入库单mapper列表查询方法;
修改入库单controller和service接口;
dev
王晓迪 2 months ago
parent
commit
ef19d52976
  1. 4
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/OutsourceStorageOrderServiceImpl.java
  2. 26
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java
  3. 17
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java
  4. 550
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java
  5. 4
      ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseStorageOrderMapper.xml
  6. 1
      ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageMakeIn.html
  7. 361
      ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageOutOrder.html
  8. 162
      ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageOutOrderDetail.html
  9. 34
      ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageRefundsExchanges.html
  10. 195
      ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryOutOrder.html
  11. 170
      ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryOutOrderDetail.html

4
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/OutsourceStorageOrderServiceImpl.java

@ -76,6 +76,7 @@ public class OutsourceStorageOrderServiceImpl implements IOutsourceStorageOrderS
String warehouseStorageCode = redisCache.generateBillNo("RK");
warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode);
warehouseStorageOrder.setNotifyArrivedNum(outsourceStorage.getNotifyArrivedNum());
warehouseStorageOrder.setArrivedTime(DateUtils.getNowDate());
warehouseStorageOrder.setRelatedOrderCode(outsourceStorage.getRelatedOrderCode());
List<OutsourceStorageDetail> outsourceStorageDetails = outsourceStorage.getStorageDetailList();
if(StringUtils.isEmpty(outsourceStorageDetails)){
@ -121,14 +122,15 @@ public class OutsourceStorageOrderServiceImpl implements IOutsourceStorageOrderS
storageOrderDetail.setWarehouseStorageType("4");
storageOrderDetail.setWarehouseOrderType("3");
storageOrderDetail.setNotifyArriveNum(outstorageDetail.getTakingMaterial().intValue());
storageOrderDetail.setActualHasArrivedNum(outstorageDetail.getTakingMaterial().intValue());
storageOrderDetail.setMaterialNo(outstorageDetail.getMaterialNo());
storageOrderDetail.setMaterialName(outstorageDetail.getMaterialName());
storageOrderDetail.setMaterialType(outstorageDetail.getMaterialType());
storageOrderDetail.setMaterialPhotourl(outstorageDetail.getMaterialPhotoUrl());
storageOrderDetail.setMaterialProcessMethod(outstorageDetail.getProcessMethod());
storageOrderDetail.setMaterialDeptType(outstorageDetail.getDescription());
storageOrderDetail.setMaterialUnit(outstorageDetail.getUnit());
storageOrderDetail.setMaterialBrand(outstorageDetail.getBrand());
storageOrderDetail.setMaterialDescribe(outstorageDetail.getDescription());
storageOrderDetail.setArrivedTime(DateUtils.getNowDate());
storageOrderDetail.setCreateBy(ShiroUtils.getLoginName());
storageOrderDetail.setCreateTime(DateUtils.getNowDate());

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

@ -260,7 +260,7 @@ public class WarehouseStorageOrderController extends BaseController
@ResponseBody
public AjaxResult temporaryOutOrderSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder)
{
return toAjax(warehouseStorageOrderService.updateWarehouseStorageOrder(warehouseStorageOrder));
return toAjax(warehouseStorageOrderService.temporaryOutsourceSave(warehouseStorageOrder));
}
@ -289,14 +289,16 @@ public class WarehouseStorageOrderController extends BaseController
}
/**
* 暂收-委外订单 供应商物料详情列表
* 暂收-委外订单 物料详情列表
*/
@ResponseBody
@RequestMapping("/temporaryOutOrderDetailList")
public Map<String,List<WarehouseStorageOrderDetail>> temporaryOutOrderDetail(String warehouseStorageCode){
public TableDataInfo temporaryOutOrderDetail(WarehouseStorageOrder warehouseStorageOrder){
startPage();
String warehouseStorageCode = warehouseStorageOrder.getWarehouseStorageCode();
List<WarehouseStorageOrderDetail> allDetails = storageOrderDetailService.selectStorageOrderDetailListByCode(warehouseStorageCode);
Map<String, List<WarehouseStorageOrderDetail>> groupedDetails = allDetails.stream().collect(Collectors.groupingBy(WarehouseStorageOrderDetail::getSupplierCode));
return groupedDetails;
// Map<String, List<WarehouseStorageOrderDetail>> groupedDetails = allDetails.stream().collect(Collectors.groupingBy(WarehouseStorageOrderDetail::getSupplierCode));
return getDataTable(allDetails);
}
@ -446,7 +448,7 @@ public class WarehouseStorageOrderController extends BaseController
@ResponseBody
public AjaxResult storageOutOrderSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder)
{
return toAjax(warehouseStorageOrderService.updateWarehouseStorageOrder(warehouseStorageOrder));
return toAjax(warehouseStorageOrderService.updateOutsourceStorageSave(warehouseStorageOrder));
}
@ -474,14 +476,16 @@ public class WarehouseStorageOrderController extends BaseController
}
/**
* 入库-委外单 供应商物料详情列表
* 入库-委外单 物料详情列表
*/
@ResponseBody
@RequestMapping("/storageOutOrderDetailList")
public Map<String,List<WarehouseStorageOrderDetail>> storageOutOrderDetail(String warehouseStorageCode){
public TableDataInfo storageOutOrderDetail(WarehouseStorageOrder warehouseStorageOrder){
startPage();
String warehouseStorageCode = warehouseStorageOrder.getWarehouseStorageCode();
List<WarehouseStorageOrderDetail> allDetails = storageOrderDetailService.selectStorageOrderDetailListByCode(warehouseStorageCode);
Map<String, List<WarehouseStorageOrderDetail>> groupedDetails = allDetails.stream().collect(Collectors.groupingBy(WarehouseStorageOrderDetail::getSupplierCode));
return groupedDetails;
// Map<String, List<WarehouseStorageOrderDetail>> groupedDetails = allDetails.stream().collect(Collectors.groupingBy(WarehouseStorageOrderDetail::getSupplierCode));
return getDataTable(allDetails);
}
@ -625,7 +629,7 @@ public class WarehouseStorageOrderController extends BaseController
@ResponseBody
public AjaxResult storageRefundsExchangesSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder)
{
return toAjax(warehouseStorageOrderService.updateStorageMake(warehouseStorageOrder));
return toAjax(warehouseStorageOrderService.updateRefundsExchangeStorage(warehouseStorageOrder));
}

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

@ -5,6 +5,7 @@ import java.util.List;
import com.ruoyi.quality.domain.QualityOrder;
import com.ruoyi.quality.domain.QualityOrderDetail;
import com.ruoyi.warehouse.domain.WarehouseStorageOrder;
import org.springframework.transaction.annotation.Transactional;
/**
* 仓库入库单Service接口
@ -46,6 +47,11 @@ public interface IWarehouseStorageOrderService
*/
public int updateWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder);
/*
* 入库-退换货订单
* */
int updateRefundsExchangeStorage(WarehouseStorageOrder warehouseStorageOrder);
/**
* 批量删除仓库入库单
*
@ -89,6 +95,8 @@ public interface IWarehouseStorageOrderService
int updateWarehouseStorageOrderByQualityOrder(QualityOrder qualityOrder, List<QualityOrderDetail> qualityOrderDetailList);
int updateWarehouseStorageOrderByOutQualityOrder(QualityOrder qualityOrder, List<QualityOrderDetail> qualityOrderDetailList);
/**
* 入库-采购单(采购入库)
* */
@ -99,6 +107,15 @@ public interface IWarehouseStorageOrderService
* */
int temporaryPurchaseSave(WarehouseStorageOrder warehouseStorageOrder);
/**
* 修改保存暂收-委外单(委外入库)
* */
@Transactional(rollbackFor = Exception.class)
int temporaryOutsourceSave(WarehouseStorageOrder warehouseStorageOrder);
@Transactional(rollbackFor = Exception.class)
int updateOutsourceStorageSave(WarehouseStorageOrder warehouseStorageOrder);
/**
* 入库-采购单(采购入库)
* */

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

@ -1,6 +1,6 @@
package com.ruoyi.warehouse.service.impl;
import java.util.ArrayList;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -10,33 +10,33 @@ 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.ErpMaterial;
import com.ruoyi.erp.mapper.ErpDevelopModifyorderMapper;
import com.ruoyi.erp.mapper.ErpMaterialMapper;
import com.ruoyi.purchase.domain.PurchaseOrderChild;
import com.ruoyi.purchase.mapper.PurchaseOrderChildMapper;
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.domain.QualityRefundsExchanges;
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.mapper.QualityRefundsExchangesMapper;
import com.ruoyi.quality.service.IQualityOrderService;
import com.ruoyi.system.domain.OutsourceStorageDetail;
import com.ruoyi.system.domain.SysMakeOrder;
import com.ruoyi.system.domain.SysSalesOrder;
import com.ruoyi.system.domain.SysSalesOrderChild;
import com.ruoyi.system.mapper.OutsourceStorageDetailMapper;
import com.ruoyi.system.mapper.SysMakeOrderMapper;
import com.ruoyi.system.mapper.SysSalesOrderChildMapper;
import com.ruoyi.system.mapper.SysSalesOrderMapper;
import com.ruoyi.system.service.ISysMakeOrderService;
import com.ruoyi.system.service.ISysSalesOrderService;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper;
import com.ruoyi.warehouse.domain.*;
import com.ruoyi.warehouse.mapper.*;
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;
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;
@ -85,6 +85,26 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
@Autowired
private ErpDevelopModifyorderMapper developModifyorderMapper;
@Autowired
private WarehouseInventoryInquiryMapper warehouseInventoryInquiryMapper;
@Autowired
private WarehouseInventoryInquiryDetailMapper inventoryInquiryDetailMapper;
@Autowired
private PurchaseOrderChildMapper purchaseOrderChildMapper;
@Autowired
private ErpMaterialMapper erpMaterialMapper;
@Autowired
private WarehouseInventoryReportDamageChildMapper damageChildMapper;
@Autowired
private OutsourceStorageDetailMapper outsourceStorageDetailMapper;
@Autowired
private QualityRefundsExchangesMapper exchangesMapper;
/**
* 查询仓库入库单
*
@ -119,7 +139,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
{
String loginName = ShiroUtils.getLoginName();
warehouseStorageOrder.setUpdateBy(loginName);
warehouseStorageOrder.setUpdateTime(new Date());
warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate());
List<WarehouseStorageOrderDetail> storageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
if (StringUtils.isEmpty(storageOrderDetailList)){
@ -154,7 +174,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
{
String loginName = ShiroUtils.getLoginName();
warehouseStorageOrder.setUpdateBy(loginName);
warehouseStorageOrder.setUpdateTime(new Date());
warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate());
List<WarehouseStorageOrderDetail> storageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
@ -194,7 +214,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
warehouseStorageOrder.setWarehouseStorageStatus("1");
warehouseStorageOrder.setWarehouseEmployee(loginName);
//设置暂存时间
warehouseStorageOrder.setTemporaryTime(new Date());
warehouseStorageOrder.setTemporaryTime(DateUtils.getNowDate());
updateWarehouseStorageOrderDetails(warehouseStorageOrder);
int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder);
@ -258,6 +278,48 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
return updateResult;
}
/**
* 委外订单,委外入库单品质完成后,更新委外入库单,后续进行入库操作
* */
@Override
public int updateWarehouseStorageOrderByOutQualityOrder(QualityOrder qualityOrder, List<QualityOrderDetail> qualityOrderDetailList) {
WarehouseStorageOrder warehouseStorageOrder = new WarehouseStorageOrder();
warehouseStorageOrder.setWarehouseStorageCode(qualityOrder.getInStorageCode());
//入库状态 为待入库
warehouseStorageOrder.setWarehouseStorageStatus("2");
//品质状态
warehouseStorageOrder.setWarehouseQualityStatus(qualityOrder.getQualityStatus());
//设置品质时间
warehouseStorageOrder.setQualityTime(qualityOrder.getDeliveryInspectionTime());
//设置品质合格数
warehouseStorageOrder.setQualityQualifiedNum(qualityOrder.getQualityQualifiedNum());
//设置品质不合格数
warehouseStorageOrder.setQualityUnqualifiedNum(qualityOrder.getQualityUnqualifiedNum());
//设置交检时间
warehouseStorageOrder.setDeliveryInspectionTime(qualityOrder.getDeliveryInspectionTime());
for (QualityOrderDetail qualityOrderDetail : qualityOrderDetailList) {
WarehouseStorageOrderDetail storageOrderDetail = new WarehouseStorageOrderDetail();
storageOrderDetail.setWarehouseStorageCode(qualityOrder.getInStorageCode());
storageOrderDetail.setQualityQualifiedNum(qualityOrderDetail.getQualityQualifiedNum());
//更新品质已合格数
storageOrderDetail.setQualityHasQualifiedNum(qualityOrderDetail.getQualityQualifiedNum());
storageOrderDetail.setMaterialNo(qualityOrderDetail.getMaterialNo());
storageOrderDetail.setSupplierCode(qualityOrderDetail.getSupplierCode());
int updateStorageOrderDetailResult = storageOrderDetailMapper.updateWarehouseStorageOrderDetailByCode(storageOrderDetail);
if (updateStorageOrderDetailResult <= 0){
throw new BusinessException("更新仓库入库单详情失败,未影响任何行");
}
}
int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrderByCode(warehouseStorageOrder);
if (updateResult <= 0){
throw new BusinessException("更新仓库入库单失败,未影响任何行");
}
return updateResult;
}
/**
* 入库-采购单(采购入库) 旧版弃用
* */
@ -269,9 +331,9 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
//假设全部入库
warehouseStorageOrder.setWarehouseStorageStatus("4");
warehouseStorageOrder.setUpdateBy(ShiroUtils.getLoginName());
warehouseStorageOrder.setUpdateTime(new Date());
warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate());
//记录一下入库时间
warehouseStorageOrder.setStorageTime(new Date());
warehouseStorageOrder.setStorageTime(DateUtils.getNowDate());
List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
if (StringUtils.isEmpty(warehouseStorageOrderDetailList)){
log.warn("入库单详情数据为空:{}",warehouseStorageOrderDetailList);
@ -343,7 +405,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
//插入暂收不合格数
warehouseStorageOrder.setTemporaryUnqualifiedNum(Math.max(0, actualArriveNum - temporaryQualifiedNum));
//设置暂存时间
warehouseStorageOrder.setTemporaryTime(new Date());
warehouseStorageOrder.setTemporaryTime(DateUtils.getNowDate());
int updateDetailResult = updateTemporaryPurchaseDetails(warehouseStorageOrder);
if (updateDetailResult != warehouseStorageOrder.getWarehouseStorageOrderDetailList().size()) {
throw new BusinessException("更新入库单明细记录失败");
@ -374,6 +436,153 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
return updateResult;
}
/**
* 修改保存暂收-委外单(委外入库)
* */
@Transactional(rollbackFor = Exception.class)
@Override
public int temporaryOutsourceSave(WarehouseStorageOrder warehouseStorageOrder) {
String loginName = ShiroUtils.getLoginName();
warehouseStorageOrder.setUpdateBy(loginName);
warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate());
//改变状态为已暂收
warehouseStorageOrder.setWarehouseStorageStatus("1");
//设置品质状态,为待品质
warehouseStorageOrder.setWarehouseQualityStatus("0");
warehouseStorageOrder.setWarehouseEmployee(loginName);
List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
int actualArriveNum = 0;
//检查填写的实际到货数是否有空值
boolean hasActualArriveNumNull = warehouseStorageOrderDetailList.stream()
.anyMatch(item -> item.getActualArriveNum() == null);
if (hasActualArriveNumNull) {
throw new BusinessException("存在实际到货数为空,请检查!");
}
//入库单主表的实际到货数为子表的合计
actualArriveNum = warehouseStorageOrderDetailList.stream().mapToInt(WarehouseStorageOrderDetail::getActualArriveNum).sum();
int temporaryQualifiedNum = 0;
//检查填写的品质合格数是否有空值
boolean hasTemporaryQualifiedNumNull = warehouseStorageOrderDetailList.stream()
.anyMatch(item -> item.getTemporaryQualifiedNum() == null);
if (hasTemporaryQualifiedNumNull) {
throw new BusinessException("存在品质合格数为空,请检查!");
}
//入库单主表的暂收合格数为子表的合计
temporaryQualifiedNum = warehouseStorageOrderDetailList.stream().mapToInt(WarehouseStorageOrderDetail::getTemporaryQualifiedNum).sum();
if (actualArriveNum < temporaryQualifiedNum) {
throw new BusinessException("暂收合格数不能大于实际到货数");
}
//插入实际到货数
warehouseStorageOrder.setActualArrivedNum(actualArriveNum);
//插入暂收合格数
warehouseStorageOrder.setTemporaryQualifiedNum(temporaryQualifiedNum);
//插入暂收不合格数
warehouseStorageOrder.setTemporaryUnqualifiedNum(Math.max(0, actualArriveNum - temporaryQualifiedNum));
//设置暂存时间
warehouseStorageOrder.setTemporaryTime(DateUtils.getNowDate());
int updateDetailResult = updateTemporaryPurchaseDetails(warehouseStorageOrder);
if (updateDetailResult != warehouseStorageOrder.getWarehouseStorageOrderDetailList().size()) {
throw new BusinessException("更新入库单明细记录失败");
}
int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder);
if (updateResult <= 0) {
throw new BusinessException("更新入库单主记录失败");
}
try {
qualityOrderService.insertQualityOrderByOutsourceStorageOrder(warehouseStorageOrder, warehouseStorageOrder.getWarehouseStorageOrderDetailList());
} catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
log.error("生成品质单时发生错误", e);
throw new BusinessException("生成品质单时发生错误");
}
return updateResult;
}
/**
* 修改保存 入库-委外单(委外入库)
* */
@Transactional(rollbackFor = Exception.class)
@Override
public int updateOutsourceStorageSave(WarehouseStorageOrder warehouseStorageOrder) {
String loginName = ShiroUtils.getLoginName();
//假设全部入库
warehouseStorageOrder.setWarehouseStorageStatus("4");
warehouseStorageOrder.setUpdateBy(loginName);
warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate());
//记录一下入库时间
warehouseStorageOrder.setStorageTime(DateUtils.getNowDate());
List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
if (StringUtils.isEmpty(warehouseStorageOrderDetailList)){
log.warn("入库单详情数据为空:{}",warehouseStorageOrderDetailList);
throw new BusinessException("入库单详情数据为空");
}
//入库数
Integer storageNum = 0;
// 检查storageNum是否含有null值
boolean hasThisStorageNumNull = warehouseStorageOrderDetailList.stream()
.anyMatch(item -> item.getStorageNum() == null);
if (hasThisStorageNumNull) {
throw new BusinessException("存在入库数为空,请检查!");
}
// 计算各个字段的总和
storageNum = warehouseStorageOrderDetailList.stream()
.mapToInt(WarehouseStorageOrderDetail::getStorageNum)
.sum();
//插入主表入库数量
warehouseStorageOrder.setStorageNum(storageNum);
for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : warehouseStorageOrderDetailList) {
//更新入库单详情的数据
warehouseStorageOrderDetail.setUpdateBy(loginName);
warehouseStorageOrderDetail.setUpdateTime(DateUtils.getNowDate());
//更新已入库数
warehouseStorageOrderDetail.setHasStorageNum(warehouseStorageOrderDetail.getStorageNum());
int updateWarehouseStorageOrderDetailResult = storageOrderDetailMapper.updateWarehouseStorageOrderDetail(warehouseStorageOrderDetail);
if (updateWarehouseStorageOrderDetailResult <= 0){
throw new BusinessException("更新仓库入库单详情失败,未影响任何行");
}
OutsourceStorageDetail tempOut = new OutsourceStorageDetail();
tempOut.setWarehouseStorageCode(warehouseStorageOrderDetail.getWarehouseStorageCode());
tempOut.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo());
List<OutsourceStorageDetail> outStorageDetails = outsourceStorageDetailMapper.selectOutsourceStorageDetailList(tempOut);
OutsourceStorageDetail updateDetail = outStorageDetails.get(0);
updateDetail.setTakenMaterial(new BigDecimal(warehouseStorageOrderDetail.getHasStorageNum()));
updateDetail.setUpdateBy(loginName);
updateDetail.setUpdateTime(DateUtils.getNowDate());
int outUpdateResult = outsourceStorageDetailMapper.updateOutsourceStorageDetail(updateDetail);
if(outUpdateResult<=0){
throw new BusinessException("更新委外入库单详情失败!");
}
WarehouseStorageOrderDetail storageOrderDetail = storageOrderDetailMapper.selectWarehouseStorageOrderDetailById(warehouseStorageOrderDetail.getWarehouseStorageDetailId());
int inventoryInquiryResult = createWarehouseInventoryInquiry(storageOrderDetail);
if (inventoryInquiryResult <= 0){
throw new BusinessException("更新/新增库存查询失败,未影响任何行");
}
}
//更新入库单的数据
int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder);
if (updateResult <= 0){
log.warn("更新入库单失败,未影响任何行");
}
return updateResult;
}
/**
* 修改保存 入库-采购单(采购入库)
@ -388,9 +597,9 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
//假设全部入库
warehouseStorageOrder.setWarehouseStorageStatus("4");
warehouseStorageOrder.setUpdateBy(loginName);
warehouseStorageOrder.setUpdateTime(new Date());
warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate());
//记录一下入库时间
warehouseStorageOrder.setStorageTime(new Date());
warehouseStorageOrder.setStorageTime(DateUtils.getNowDate());
List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
if (StringUtils.isEmpty(warehouseStorageOrderDetailList)){
log.warn("入库单详情数据为空:{}",warehouseStorageOrderDetailList);
@ -400,14 +609,14 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
//入库数
Integer storageNum = 0;
// 检查storageNum是否含有null值
// 检查storageNum是否含有null值
boolean hasThisStorageNumNull = warehouseStorageOrderDetailList.stream()
.anyMatch(item -> item.getStorageNum() == null);
if (hasThisStorageNumNull) {
throw new BusinessException("存在入库数为空,请检查!");
}
// 计算各个字段的总和
// 计算各个字段的总和
storageNum = warehouseStorageOrderDetailList.stream()
.mapToInt(WarehouseStorageOrderDetail::getStorageNum)
.sum();
@ -423,12 +632,18 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : warehouseStorageOrderDetailList) {
//更新入库单详情的数据
warehouseStorageOrderDetail.setUpdateBy(loginName);
warehouseStorageOrderDetail.setUpdateTime(new Date());
warehouseStorageOrderDetail.setUpdateTime(DateUtils.getNowDate());
//更新已入库数
warehouseStorageOrderDetail.setHasStorageNum(warehouseStorageOrderDetail.getStorageNum());
int updateWarehouseStorageOrderDetailResult = storageOrderDetailMapper.updateWarehouseStorageOrderDetail(warehouseStorageOrderDetail);
if (updateWarehouseStorageOrderDetailResult <= 0){
throw new BusinessException("更新仓库入库单详情失败,未影响任何行");
}else{
WarehouseStorageOrderDetail storageOrderDetail = storageOrderDetailMapper.selectWarehouseStorageOrderDetailById(warehouseStorageOrderDetail.getWarehouseStorageDetailId());
int inventoryInquiryResult = createWarehouseInventoryInquiry(storageOrderDetail);
if (inventoryInquiryResult <= 0){
throw new BusinessException("更新/新增库存查询失败,未影响任何行");
}
}
}
@ -451,7 +666,168 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
}
// 生成/修改库存查询
public int createWarehouseInventoryInquiry(WarehouseStorageOrderDetail warehouseStorageOrderDetail){
String materialNo = warehouseStorageOrderDetail.getMaterialNo();
String correlationCode = warehouseStorageOrderDetail.getRelatedOrderCode();
String warehouseStorageType = warehouseStorageOrderDetail.getWarehouseStorageType();
if(warehouseStorageType.equals("0")) {
// 新增采购入库库存历史记录
List<PurchaseOrderChild> purchaseOrderChild = purchaseOrderChildMapper.selectPurchaseOrderChildByOrderCode(warehouseStorageOrderDetail.getRelatedOrderCode());
for (PurchaseOrderChild child : purchaseOrderChild) {
if(child.getMaterialCode().equals(materialNo)){
int storageNum = warehouseStorageOrderDetail.getStorageNum();
WarehouseInventoryInquiryDetail inquiryDetail = new WarehouseInventoryInquiryDetail();
inquiryDetail = generateInquiryDetailByPurchaseChild(child,storageNum);
inquiryDetail.setInventoryHistoricalType("0");
// if (correlationCode.startsWith("QG")) {
//// 有无归属分类
// }
inventoryInquiryDetailMapper.insertWarehouseInventoryInquiryDetail(inquiryDetail);
}
}
}else if(warehouseStorageType.equals("2")){//新增委内入库库存历史记录
WarehouseInventoryInquiryDetail inquiryDetail = new WarehouseInventoryInquiryDetail();
inquiryDetail = createMakeInOrderInquiryDetail(warehouseStorageOrderDetail);
inquiryDetail.setInventoryHistoricalType("1");
inventoryInquiryDetailMapper.insertWarehouseInventoryInquiryDetail(inquiryDetail);
}else if(warehouseStorageType.equals("4")){//新增委外入库库存历史记录
WarehouseInventoryInquiryDetail inquiryDetail = new WarehouseInventoryInquiryDetail();
inquiryDetail = createMakeInOrderInquiryDetail(warehouseStorageOrderDetail);
inquiryDetail.setInventoryHistoricalType("2");
inventoryInquiryDetailMapper.insertWarehouseInventoryInquiryDetail(inquiryDetail);
}
//查询该物料报损数,更新库存查询报损数
List<WarehouseInventoryReportDamageChild> damageChildren = damageChildMapper.selectWarehouseInventoryReportDamageChildByMaterialNo(materialNo);
BigDecimal scrapSum = BigDecimal.ZERO;
if(StringUtils.isNotEmpty(damageChildren)){
for (WarehouseInventoryReportDamageChild damageChild:damageChildren) {
BigDecimal scrapNum = damageChild.getActualScrapQuantity();
scrapSum = scrapSum.add(scrapSum);
}
}
// 存在库存查询记录,更新可用库存数
if(warehouseInventoryInquiryMapper.selectWarehouseInventoryInquiryByMaterialNo(materialNo)!=null){
WarehouseInventoryInquiry inventoryInquiry = warehouseInventoryInquiryMapper.selectWarehouseInventoryInquiryByMaterialNo(materialNo);
// 增加可用库存数
Integer storage = warehouseStorageOrderDetail.getStorageNum();
BigDecimal storagenum = BigDecimal.valueOf(storage);
BigDecimal avaliableStorage = inventoryInquiry.getAvailableStockNum();
avaliableStorage = avaliableStorage.add(storagenum);
inventoryInquiry.setAvailableStockNum(avaliableStorage);
inventoryInquiry.setReportDamageNum(scrapSum);
// 设置历史总数
if(warehouseStorageOrderDetail.getWarehouseStorageType().equals("0")){
BigDecimal historicalNum = getHistoricalTotalFromQualityOrder(warehouseStorageOrderDetail);
BigDecimal historicalTotal = inventoryInquiry.getHistoricalTotal();
historicalTotal = historicalTotal.add(historicalNum);
inventoryInquiry.setHistoricalTotal(historicalTotal);
}else{
BigDecimal historicalNum = BigDecimal.valueOf(warehouseStorageOrderDetail.getStorageNum());
BigDecimal historicalTotal = inventoryInquiry.getHistoricalTotal();
historicalTotal = historicalTotal.add(historicalNum);
inventoryInquiry.setHistoricalTotal(historicalTotal);
}
inventoryInquiry.setUpdateBy(ShiroUtils.getLoginName());
inventoryInquiry.setUpdateTime(DateUtils.getNowDate());
return warehouseInventoryInquiryMapper.updateWarehouseInventoryInquiry(inventoryInquiry);
}else{
WarehouseInventoryInquiry inventoryInquiry = new WarehouseInventoryInquiry();
inventoryInquiry.setMaterialNo(materialNo);
inventoryInquiry.setMaterialName(warehouseStorageOrderDetail.getMaterialName());
inventoryInquiry.setMaterialPhotourl(warehouseStorageOrderDetail.getMaterialPhotourl());
inventoryInquiry.setMaterialBrand(warehouseStorageOrderDetail.getMaterialBrand());
inventoryInquiry.setMaterialDescribe(warehouseStorageOrderDetail.getMaterialDescribe());
inventoryInquiry.setMaterialUnit(warehouseStorageOrderDetail.getMaterialUnit());
inventoryInquiry.setMaterialType(warehouseStorageOrderDetail.getMaterialType());
inventoryInquiry.setMaterialProcessMethod(warehouseStorageOrderDetail.getMaterialProcessMethod());
Integer storage = warehouseStorageOrderDetail.getStorageNum();
BigDecimal storagenum = BigDecimal.valueOf(storage);
// 设置历史总数
if(warehouseStorageOrderDetail.getWarehouseStorageType().equals("0")){
BigDecimal historicalNum = getHistoricalTotalFromQualityOrder(warehouseStorageOrderDetail);
inventoryInquiry.setHistoricalTotal(historicalNum);
}else{
inventoryInquiry.setHistoricalTotal(storagenum);
}
inventoryInquiry.setAvailableStockNum(storagenum);
inventoryInquiry.setReportDamageNum(scrapSum);
ErpMaterial material = erpMaterialMapper.selectErpMaterialByMaterialNo(materialNo);
inventoryInquiry.setMaterialUseStatus(material.getUseStatus());
inventoryInquiry.setCreateBy(ShiroUtils.getLoginName());
inventoryInquiry.setCreateTime(DateUtils.getNowDate());
inventoryInquiry.setUpdateBy(ShiroUtils.getLoginName());
inventoryInquiry.setUpdateTime(DateUtils.getNowDate());
return warehouseInventoryInquiryMapper.insertWarehouseInventoryInquiry(inventoryInquiry);
}
}
// 生成采购订单库存历史记录
public WarehouseInventoryInquiryDetail generateInquiryDetailByPurchaseChild(PurchaseOrderChild child,int storageNum){
WarehouseInventoryInquiryDetail inquiryDetail = new WarehouseInventoryInquiryDetail();
inquiryDetail.setMaterialNo(child.getMaterialCode());
inquiryDetail.setMaterialName(child.getMaterialName());
inquiryDetail.setMaterialBrand(child.getMaterialBrand());
inquiryDetail.setMaterialPhotourl(child.getMaterialPhotourl());
inquiryDetail.setMaterialDescribe(child.getMaterialDescribe());
inquiryDetail.setMaterialType(child.getMaterialType());
inquiryDetail.setMaterialUnit(child.getMaterialUnit());
inquiryDetail.setInventoryAttributionCode(child.getPurchasePlanCorrelationCode());
inquiryDetail.setSupplierCode(child.getSupplierCode());
inquiryDetail.setSupplierName(child.getSupplierName());
inquiryDetail.setPurchaseOrderCode(child.getPurchaseOrderCode());
// 库存归属单号
BigDecimal realStorageNum = BigDecimal.valueOf(storageNum);
inquiryDetail.setAvailableStockNum(realStorageNum);
inquiryDetail.setPurchasePriceIncludesTax(child.getMaterialRealRmbSum());
inquiryDetail.setPurchasePriceExcludingTax(child.getMaterialRealNoRmbSum());
inquiryDetail.setInventoryIncreaseDecrease("1");
inquiryDetail.setCreateBy(ShiroUtils.getLoginName());
inquiryDetail.setCreateTime(DateUtils.getNowDate());
inquiryDetail.setInventoryHistoricalTime(DateUtils.getNowDate());
return inquiryDetail;
}
//生成委内(委外)入库库存历史记录
public WarehouseInventoryInquiryDetail createMakeInOrderInquiryDetail(WarehouseStorageOrderDetail warehouseStorageOrderDetail){
WarehouseInventoryInquiryDetail inquiryDetail = new WarehouseInventoryInquiryDetail();
inquiryDetail.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo());
inquiryDetail.setMaterialName(warehouseStorageOrderDetail.getMaterialName());
inquiryDetail.setMaterialType(warehouseStorageOrderDetail.getMaterialType());
inquiryDetail.setMaterialPhotourl(warehouseStorageOrderDetail.getMaterialPhotourl());
inquiryDetail.setMaterialUnit(warehouseStorageOrderDetail.getMaterialUnit());
inquiryDetail.setMaterialDescribe(warehouseStorageOrderDetail.getMaterialDescribe());
inquiryDetail.setMaterialBrand(warehouseStorageOrderDetail.getMaterialBrand());
inquiryDetail.setMaterialProcessMethod(warehouseStorageOrderDetail.getMaterialProcessMethod());
BigDecimal storagenum = BigDecimal.ZERO;
if(warehouseStorageOrderDetail.getStorageNum()!=null){
storagenum = BigDecimal.valueOf(warehouseStorageOrderDetail.getStorageNum());
}
inquiryDetail.setAvailableStockNum(storagenum);
inquiryDetail.setInventoryIncreaseDecrease("1");
inquiryDetail.setCreateBy(ShiroUtils.getLoginName());
inquiryDetail.setCreateTime(DateUtils.getNowDate());
inquiryDetail.setInventoryHistoricalTime(DateUtils.getNowDate());
return inquiryDetail;
}
// 根据入库单(采购订单)关联品质单获取历史总数(已到货数-品质不合格数)(采购总数-退换货数)
public BigDecimal getHistoricalTotalFromQualityOrder(WarehouseStorageOrderDetail warehouseStorageOrderDetail){
BigDecimal historicalTotal = BigDecimal.ZERO;
QualityOrderDetail tempDetail = new QualityOrderDetail();
tempDetail.setInStorageCode(warehouseStorageOrderDetail.getWarehouseStorageCode());
tempDetail.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo());
QualityOrderDetail qualityOrderDetail = qualityOrderDetailMapper.selectQualityOrderDetailByStorageCodeAndno(tempDetail);
Integer actualArriveNum = qualityOrderDetail.getActualArriveNum();
Integer qualityUnqualifiedNum = qualityOrderDetail.getQualityUnqualifiedNum();
historicalTotal = BigDecimal.valueOf(actualArriveNum)
.subtract(BigDecimal.valueOf(qualityUnqualifiedNum));
return historicalTotal;
}
/**
* 修改保存入库-采购单(仓库入库)
*/
@ -463,9 +839,9 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
//假设全部入库
warehouseStorageOrder.setWarehouseStorageStatus("4");
warehouseStorageOrder.setUpdateBy(loginName);
warehouseStorageOrder.setUpdateTime(new Date());
warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate());
//记录一下入库时间
warehouseStorageOrder.setStorageTime(new Date());
warehouseStorageOrder.setStorageTime(DateUtils.getNowDate());
List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
if (StringUtils.isEmpty(warehouseStorageOrderDetailList)){
log.warn("入库单详情数据为空:{}",warehouseStorageOrderDetailList);
@ -498,12 +874,18 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : warehouseStorageOrderDetailList) {
//更新入库单详情的数据
warehouseStorageOrderDetail.setUpdateBy(loginName);
warehouseStorageOrderDetail.setUpdateTime(new Date());
warehouseStorageOrderDetail.setUpdateTime(DateUtils.getNowDate());
//更新已入库数
warehouseStorageOrderDetail.setHasStorageNum(warehouseStorageOrderDetail.getStorageNum());
int updateWarehouseStorageOrderDetailResult = storageOrderDetailMapper.updateWarehouseStorageOrderDetail(warehouseStorageOrderDetail);
if (updateWarehouseStorageOrderDetailResult <= 0){
throw new BusinessException("更新仓库入库单详情失败,未影响任何行");
}else{
WarehouseStorageOrderDetail storageOrderDetail = storageOrderDetailMapper.selectWarehouseStorageOrderDetailById(warehouseStorageOrderDetail.getWarehouseStorageDetailId());
int inventoryInquiryResult = createWarehouseInventoryInquiry(storageOrderDetail);
if (inventoryInquiryResult <= 0){
throw new BusinessException("更新/新增库存查询失败,未影响任何行");
}
}
}
@ -555,8 +937,8 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
warehouseStorageOrder.setQualityUnqualifiedNum(tempQualityOrder.getQualityUnqualifiedNum());
warehouseStorageOrder.setQualityQualifiedNum(tempQualityOrder.getQualityQualifiedNum());
warehouseStorageOrder.setCreateBy(loginName);
warehouseStorageOrder.setQualityTime(new Date());
warehouseStorageOrder.setCreateTime(new Date());
warehouseStorageOrder.setQualityTime(DateUtils.getNowDate());
warehouseStorageOrder.setCreateTime(DateUtils.getNowDate());
//设置委内完成数总价
warehouseStorageOrder.setMakeInTotalPrice(tempQualityOrder.getMakeInTotalPrice());
//插入入库单详情数据
@ -584,7 +966,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
warehouseStorageOrderDetail.setMaterialType(qualityOrderDetail.getMaterialType());
warehouseStorageOrderDetail.setMaterialUnit(qualityOrderDetail.getMaterialUnit());
warehouseStorageOrderDetail.setCreateBy(loginName);
warehouseStorageOrderDetail.setCreateTime(new Date());
warehouseStorageOrderDetail.setCreateTime(DateUtils.getNowDate());
storageOrderDetailMapper.insertWarehouseStorageOrderDetail(warehouseStorageOrderDetail);
}
@ -603,9 +985,9 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
//假设全部入库
warehouseStorageOrder.setWarehouseStorageStatus("4");
warehouseStorageOrder.setUpdateBy(loginName);
warehouseStorageOrder.setUpdateTime(new Date());
warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate());
//记录一下入库时间
warehouseStorageOrder.setStorageTime(new Date());
warehouseStorageOrder.setStorageTime(DateUtils.getNowDate());
String warehouseCode = warehouseStorageOrder.getWarehouseCode();
String warehouseName = warehouseStorageOrder.getWarehouseName();
if (StringUtils.isNotEmpty(warehouseCode)){
@ -647,12 +1029,18 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : warehouseStorageOrderDetailList) {
//更新入库单详情的数据
warehouseStorageOrderDetail.setUpdateBy(loginName);
warehouseStorageOrderDetail.setUpdateTime(new Date());
warehouseStorageOrderDetail.setUpdateTime(DateUtils.getNowDate());
//更新已入库数
warehouseStorageOrderDetail.setHasStorageNum(warehouseStorageOrderDetail.getStorageNum());
int updateWarehouseStorageOrderDetailResult = storageOrderDetailMapper.updateWarehouseStorageOrderDetail(warehouseStorageOrderDetail);
if (updateWarehouseStorageOrderDetailResult <= 0){
throw new BusinessException("更新仓库入库单详情失败,未影响任何行");
}else{
WarehouseStorageOrderDetail storageOrderDetail = storageOrderDetailMapper.selectWarehouseStorageOrderDetailById(warehouseStorageOrderDetail.getWarehouseStorageDetailId());
int inventoryInquiryResult = createWarehouseInventoryInquiry(storageOrderDetail);
if (inventoryInquiryResult <= 0){
throw new BusinessException("更新/新增库存查询失败,未影响任何行");
}
}
}
//更新入库单的数据
@ -717,7 +1105,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
//插入暂收不合格数
warehouseStorageOrder.setTemporaryUnqualifiedNum(Math.max(0, actualArriveNum - temporaryQualifiedNum));
//设置暂存时间
warehouseStorageOrder.setTemporaryTime(new Date());
warehouseStorageOrder.setTemporaryTime(DateUtils.getNowDate());
int updateDetailResult = updateTemporaryPurchaseDetails(warehouseStorageOrder);
if (updateDetailResult != warehouseStorageOrder.getWarehouseStorageOrderDetailList().size()) {
throw new BusinessException("更新入库单明细记录失败");
@ -760,8 +1148,8 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
warehouseStorageOrder.setQualityUnqualifiedNum(tempQualityOrder.getQualityUnqualifiedNum());
warehouseStorageOrder.setQualityQualifiedNum(tempQualityOrder.getQualityQualifiedNum());
warehouseStorageOrder.setCreateBy(loginName);
warehouseStorageOrder.setQualityTime(new Date());
warehouseStorageOrder.setCreateTime(new Date());
warehouseStorageOrder.setQualityTime(DateUtils.getNowDate());
warehouseStorageOrder.setCreateTime(DateUtils.getNowDate());
//插入入库单详情数据
for (QualityOrderDetail qualityOrderDetail : qualityOrderDetailList) {
@ -787,7 +1175,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
warehouseStorageOrderDetail.setMaterialType(qualityOrderDetail.getMaterialType());
warehouseStorageOrderDetail.setMaterialUnit(qualityOrderDetail.getMaterialUnit());
warehouseStorageOrderDetail.setCreateBy(loginName);
warehouseStorageOrderDetail.setCreateTime(new Date());
warehouseStorageOrderDetail.setCreateTime(DateUtils.getNowDate());
storageOrderDetailMapper.insertWarehouseStorageOrderDetail(warehouseStorageOrderDetail);
}
@ -814,7 +1202,11 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
if (actualArriveNum < temporaryQualifiedNum){
throw new BusinessException("暂收合格数要小于等于实际到货数");
}
updateResultDetails += storageOrderDetailMapper.updateWarehouseStorageOrderDetailByObject(detail);
if(detail.getWarehouseStorageType()!=null&&detail.getWarehouseStorageType().equals("4")){
updateResultDetails += storageOrderDetailMapper.updateWarehouseStorageOrderDetail(detail);
}else {
updateResultDetails += storageOrderDetailMapper.updateWarehouseStorageOrderDetailByObject(detail);
}
}
return updateResultDetails;
}
@ -890,9 +1282,9 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
//假设全部入库
warehouseStorageOrder.setWarehouseStorageStatus("4");
warehouseStorageOrder.setUpdateBy(loginName);
warehouseStorageOrder.setUpdateTime(new Date());
warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate());
//记录一下入库时间
warehouseStorageOrder.setStorageTime(new Date());
warehouseStorageOrder.setStorageTime(DateUtils.getNowDate());
String warehouseCode = warehouseStorageOrder.getWarehouseCode();
String warehouseName = warehouseStorageOrder.getWarehouseName();
if (StringUtils.isNotEmpty(warehouseCode)){
@ -956,7 +1348,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
sysSalesOrderChild.setMaterialCode(warehouseStorageOrderDetail.getMaterialNo());
sysSalesOrderChild.setFinishNum(warehouseStorageOrderDetail.getStorageNum());
sysSalesOrderChild.setUpdateBy(loginName);
sysSalesOrderChild.setUpdateTime(new Date());
sysSalesOrderChild.setUpdateTime(DateUtils.getNowDate());
int updateSalesOrderChildResult = salesOrderChildMapper.updateSysSalesOrderChildByCodeAndQuoteId(sysSalesOrderChild);
if (updateSalesOrderChildResult <= 0){
throw new BusinessException("更新销售订单子表数据失败");
@ -973,7 +1365,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : warehouseStorageOrderDetailList) {
//更新入库单详情的数据
warehouseStorageOrderDetail.setUpdateBy(loginName);
warehouseStorageOrderDetail.setUpdateTime(new Date());
warehouseStorageOrderDetail.setUpdateTime(DateUtils.getNowDate());
//更新已入库数
warehouseStorageOrderDetail.setHasStorageNum(warehouseStorageOrderDetail.getStorageNum());
int updateWarehouseStorageOrderDetailResult = storageOrderDetailMapper.updateWarehouseStorageOrderDetail(warehouseStorageOrderDetail);
@ -991,6 +1383,84 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
}
/*
* 入库-退换货订单(入库前退货)
* */
@Transactional(rollbackFor = Exception.class)
@Override
public int updateRefundsExchangeStorage(WarehouseStorageOrder warehouseStorageOrder) {
String loginName = ShiroUtils.getLoginName();
//假设全部入库
warehouseStorageOrder.setWarehouseStorageStatus("4");
warehouseStorageOrder.setUpdateBy(loginName);
warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate());
//记录一下入库时间
warehouseStorageOrder.setStorageTime(DateUtils.getNowDate());
String warehouseCode = warehouseStorageOrder.getWarehouseCode();
String warehouseName = warehouseStorageOrder.getWarehouseName();
if (StringUtils.isNotEmpty(warehouseCode)){
warehouseStorageOrder.setWarehouseCode(warehouseCode);
}
if (StringUtils.isNotEmpty(warehouseName)){
warehouseStorageOrder.setWarehouseName(warehouseName);
}
List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
if (StringUtils.isEmpty(warehouseStorageOrderDetailList)){
log.warn("入库单详情数据为空:{}",warehouseStorageOrderDetailList);
throw new BusinessException("入库单详情数据为空");
}
//入库数
Integer storageNum = 0;
// 检查storageNum是否含有null值
boolean hasThisStorageNumNull = warehouseStorageOrderDetailList.stream()
.anyMatch(item -> item.getStorageNum() == null);
if (hasThisStorageNumNull) {
throw new BusinessException("存在入库数为空,请检查!");
}
// 计算各个字段的总和
storageNum = warehouseStorageOrderDetailList.stream()
.mapToInt(WarehouseStorageOrderDetail::getStorageNum)
.sum();
//插入主表入库数量
warehouseStorageOrder.setStorageNum(storageNum);
for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : warehouseStorageOrderDetailList) {
//更新入库单详情的数据
warehouseStorageOrderDetail.setUpdateBy(loginName);
warehouseStorageOrderDetail.setUpdateTime(DateUtils.getNowDate());
//更新已入库数
warehouseStorageOrderDetail.setHasStorageNum(warehouseStorageOrderDetail.getStorageNum());
int updateWarehouseStorageOrderDetailResult = storageOrderDetailMapper.updateWarehouseStorageOrderDetail(warehouseStorageOrderDetail);
if (updateWarehouseStorageOrderDetailResult <= 0){
throw new BusinessException("更新仓库入库单详情失败,未影响任何行");
}
}
//更新入库单的数据
int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder);
if (updateResult <= 0){
log.warn("更新入库单失败,未影响任何行");
}
QualityRefundsExchanges tempExchanges = new QualityRefundsExchanges();
tempExchanges.setInStorageCode(warehouseStorageOrder.getWarehouseStorageCode());
List<QualityRefundsExchanges> qualityRefundsExchanges = exchangesMapper.selectQualityRefundsExchangesList(tempExchanges);
if(qualityRefundsExchanges.size()<=0){
throw new BusinessException("未找到关联退换货订单!");
}
QualityRefundsExchanges updateExchanges = qualityRefundsExchanges.get(0);
updateExchanges.setRefundsExchangesStatus("1");
int updateExchangeResult = exchangesMapper.updateQualityRefundsExchanges(updateExchanges);
if(updateExchangeResult<=0){
throw new BusinessException("更新退换货订单入库状态失败!");
}
return updateResult;
}
/**
* 删除仓库入库单对象
*

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

@ -50,8 +50,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWarehouseStorageOrderList" 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="warehouseStorageCode != null and warehouseStorageCode != ''"> and warehouse_storage_code like concat('%', #{warehouseStorageCode}, '%')</if>
<if test="relatedOrderCode != null and relatedOrderCode != ''"> and related_order_code like concat('%', #{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>

1
ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageMakeIn.html

@ -99,6 +99,7 @@
// 新增提交
function submitHandler() {
$("select[name='warehouseStorageType']").removeAttr("disabled");
// 获取表单数据
const storageMakeInData = $("#form-storageMakeIn-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;

361
ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageOutOrder.html

@ -3,40 +3,33 @@
<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-temporaryPurchaseWarehouse-edit" th:object="${warehouseStorageOrder}">
<form class="form-horizontal m" id="form-storageOutsource-save" th:object="${warehouseStorageOrder}">
<input name="warehouseStorageId" th:field="*{warehouseStorageId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">入库单号:</label>
<label class="col-sm-4 control-label">入库单号:</label>
<div class="col-sm-8">
<input name="warehouseStorageCode" th:field="*{warehouseStorageCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">关联单号:</label>
<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="col-xs-12">
<label class="col-sm-1 control-label">入库类型:</label>
<div class="col-sm-4">
<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-3 control-label">到货时间:</label>
<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>
@ -45,7 +38,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交检时间:</label>
<label class="col-sm-4 control-label">交检时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="deliveryInspectionTime" th:value="${#dates.format(warehouseStorageOrder.deliveryInspectionTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
@ -57,7 +50,7 @@
<label class="col-sm-4 control-label is-required">仓库ID:</label>
<div class="col-sm-8">
<select class="form-control" id="warehouseCode" name="warehouseCode" th:field="*{warehouseCode}" required>
<!-- 这里动态生成仓库ID选项 -->
</select>
</div>
</div>
@ -68,7 +61,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">仓库详细地址:</label>
<label class="col-sm-4 control-label">仓库详细地址:</label>
<div class="col-sm-8">
<input name="warehouseDetailAddress" th:field="*{warehouseDetailAddress}" class="form-control" type="text">
</div>
@ -79,6 +72,8 @@
<div class="row">
<div class="col-sm-12" id="tablesContainer">
<!-- 表格将在这里动态生成 -->
<h3 class="mb-4">入库单详情</h3>
<table id="bootstrap-storageDetail-table"></table>
</div>
</div>
</div>
@ -91,8 +86,10 @@
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]
var warehouseCode = [[${warehouseStorageOrder.warehouseCode}]]
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var prefix = ctx + "warehouse/storageOrder";
$("#form-temporaryPurchaseWarehouse-edit").validate({
$("#form-storageOutsource-save").validate({
focusCleanup: true
});
@ -100,58 +97,48 @@
var tableDatas = [];
function submitHandler() {
const storageOrderData = $("#form-temporaryPurchaseWarehouse-edit").serializeArray().reduce((obj, item) => {
const storageOrderData = $("#form-storageOutsource-save").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,
"qualityHasQualifiedNum": item.qualityHasQualifiedNum,
"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 tableData = $("#bootstrap-storageDetail-table").bootstrapTable('getData');
var materialDataList = tableData.map(function (item) {
// 根据实际字段名调整
return {
"warehouseStorageDetailId": item.warehouseStorageDetailId,
"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,
"qualityHasQualifiedNum": item.qualityHasQualifiedNum,
"hasStorageNum": item.hasStorageNum,
"notifyArriveNum": item.notifyArriveNum,
"actualArriveNum": item.actualArriveNum,
"temporaryQualifiedNum": item.temporaryQualifiedNum,
"temporaryRemark": item.temporaryRemark,
"temporaryReportUrl": item.temporaryReportUrl,
"storageNum": item.storageNum,
"storageLocation": item.storageLocation,
// ...其他字段
};
});
const combinedData = Object.assign({}, storageOrderData, {
warehouseStorageOrderDetailList: allMaterialDataList
warehouseStorageOrderDetailList: materialDataList
});
// 合并表单数据和表格数据
// const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData);
console.log(combinedData)
// console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/temporaryPurchaseWarehouse", jsonData);
$.operate.saveJson(prefix + "/storageOutOrder", jsonData);
}
$("input[name='arrivedTime']").datetimepicker({
@ -167,147 +154,137 @@
});
$(function() {
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]; // 这里需要实际赋值,比如从前端某个地方读取
$.getJSON(prefix + "/storageOutOrderDetailList?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') +
' </br> ' + (supplierInfo.customerContact || 'N/A') +
' - ' + (supplierInfo.contactNumber || 'N/A') +
' - ' + (supplierInfo.supplierAddress || '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',
},
$(function() {
var options = {
id:"bootstrap-storageDetail-table",
url: prefix + "/storageOutOrderDetailList",
modalName: "入库单记录",
showFooter: true,
showColumns: false,
pagination: false,
showToggle: false,
showRefresh:false,
showSearch:false,
queryParams:queryParams,
columns: [
{
title: '入库单详情ID',
field: 'warehouseStorageDetailId',
visible: false
},
{
title: '料号',
field: 'materialNo'
}, {
title: '物料名称',
field: 'materialName'
},
{
title: '物料类型',
field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
title: '图片',
field: 'materialPhotourl',
},
{
title: '物料描述',
field: 'materialDescribe',
},
{
title: '物料品牌',
field: 'materialBrand',
},
{
title: '物料单位',
field: 'materialUnit',
},
{
title: '物料加工方式',
field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
title: '通知已到货数',
field: 'notifyHasArrivedNum',
},
{
title: '实际已到货数',
field: 'actualHasArrivedNum',
},
{
title: '暂收已合格数',
field: 'temporaryHasQualifiedNum',
},
{
title: '品质已合格数',
field: 'qualityHasQualifiedNum',
},
{
title: '已入库数',
field: 'hasStorageNum',
},
{
title: '通知到货数',
field: 'notifyArriveNum',
},
{
title: '通知已到货数',
field: 'notifyHasArrivedNum',
},
{
title: '实际已到货数',
field: 'actualHasArrivedNum',
},
{
title: '暂收已合格数',
field: 'temporaryHasQualifiedNum',
},
{
title: '品质已合格数',
field: 'qualityHasQualifiedNum',
},
{
title: '已入库数',
field: 'hasStorageNum',
},
{
title: '通知到货数',
field: 'notifyArriveNum',
},
{
title: '实际到货数',
field: 'actualArriveNum',
},
{
title: '实际到货数',
field: 'actualArriveNum',
},
{
title: '暂收合格数',
field: 'temporaryQualifiedNum',
},
{
title: '暂收备注',
field: 'temporaryRemark',
editable: true
},
{
title: '暂收报告',
field: 'temporaryReportUrl',
},
{
title: '入库数',
field: 'storageNum',
editable:{
type: 'text',
mode:'inline',
validate: function (v) {
if (!v) return '数量不能为空';
if (isNaN(v)) return '数量必须是数字';
var processBadNum = parseInt(v);
if (processBadNum <= 0) return '数量必须是正整数';
{
title: '暂收合格数',
field: 'temporaryQualifiedNum',
},
{
title: '暂收备注',
field: 'temporaryRemark',
},
{
title: '暂收报告',
field: 'temporaryReportUrl',
},
{
title: '入库数',
field: 'storageNum',
editable:{
type: 'text',
mode:'inline',
validate: function (v) {
if (!v) return '数量不能为空';
if (isNaN(v)) return '数量必须是数字';
var processBadNum = parseInt(v);
if (processBadNum <= 0) return '数量必须是正整数';
}
}
},
{
title: '存放位置',
field: 'storageLocation',
editable: true,
}
},
{
title: '存放位置',
field: 'storageLocation',
editable: true
}]
]
};
$.table.init(options);
});
});
$tableWrapper.append($header).append($table);
$('#tablesContainer').append($tableWrapper);
function queryParams(params) {
var curParams = {
// 传递参数查询参数
warehouseStorageCode: warehouseStorageCode
};
return curParams;
}
//根据仓库ID查询仓库名称
$(document).ready(function() {
// 初始化时默认加载仓库ID列表

162
ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageOutOrderDetail.html

@ -3,13 +3,6 @@
<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">
@ -17,19 +10,19 @@
<input name="warehouseStorageId" th:field="*{warehouseStorageId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">入库单号:</label>
<div class="col-sm-8">
<div class="col-sm-6">
<input name="warehouseStorageCode" th:field="*{warehouseStorageCode}" 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">
<div class="col-sm-6">
<input name="relatedOrderCode" th:field="*{relatedOrderCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="col-xs-12">
<label class="col-sm-1 control-label">入库类型:</label>
<div class="col-sm-4">
<div class="form-group">
<label class="col-sm-3 control-label">入库类型:</label>
<div class="col-sm-6">
<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>
@ -37,7 +30,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">到货时间:</label>
<div class="col-sm-8">
<div class="col-sm-6">
<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>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
@ -46,7 +39,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交检时间:</label>
<div class="col-sm-8">
<div class="col-sm-6">
<div class="input-group date">
<input name="deliveryInspectionTime" th:value="${#dates.format(warehouseStorageOrder.deliveryInspectionTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
@ -54,22 +47,22 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label is-required">仓库ID:</label>
<div class="col-sm-8">
<label class="col-sm-3 control-label is-required">仓库ID:</label>
<div class="col-sm-6">
<select class="form-control" id="warehouseCode" name="warehouseCode" th:field="*{warehouseCode}" required disabled>
<!-- 这里动态生成仓库ID选项 -->
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">仓库名称:</label>
<div class="col-sm-8">
<label class="col-sm-3 control-label">仓库名称:</label>
<div class="col-sm-6">
<input name="warehouseName" th:field="*{warehouseName}" 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">
<div class="col-sm-6">
<input name="warehouseDetailAddress" th:field="*{warehouseDetailAddress}" class="form-control" type="text" disabled>
</div>
</div>
@ -79,6 +72,8 @@
<div class="row">
<div class="col-sm-12" id="tablesContainer">
<!-- 表格将在这里动态生成 -->
<h3 class="mb-4">入库单详情</h3>
<table id="bootstrap-storageDetail-table"></table>
</div>
</div>
</div>
@ -91,6 +86,9 @@
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]
var warehouseCode = [[${warehouseStorageOrder.warehouseCode}]]
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var prefix = ctx + "warehouse/storageOrder";
$("#form-temporaryPurchaseWarehouse-edit").validate({
focusCleanup: true
@ -99,60 +97,6 @@
//生成的不同table的id集合
var tableDatas = [];
function submitHandler() {
const storageOrderData = $("#form-temporaryPurchaseWarehouse-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 初始化一个数组用于存放所有表格的数据
let allMaterialDataList = [];
for(let i in tableDatas){
$('#' + tableDatas[i]).each(function() {
const tableData = $(this).bootstrapTable('getData');
console.log(JSON.stringify(tableData));
// 将表数据转换成与qualityReportData格式一致的数组
var materialDataList = tableData.map(function (item) {
// 根据实际字段名调整
return {
"supplierCode": item.supplierCode,
"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,
"qualityHasQualifiedNum": item.qualityHasQualifiedNum,
"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 + "/temporaryPurchaseWarehouse", jsonData);
}
$("input[name='arrivedTime']").datetimepicker({
format: "yyyy-mm-dd",
@ -165,42 +109,19 @@
minView: "month",
autoclose: true
});
$(function() {
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]; // 这里需要实际赋值,比如从前端某个地方读取
$.getJSON(prefix + "/storageOutOrderDetailList?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') +
' </br> ' + (supplierInfo.customerContact || 'N/A') +
' - ' + (supplierInfo.contactNumber || 'N/A') +
' - ' + (supplierInfo.supplierAddress || '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
},
var options = {
id:"bootstrap-storageDetail-table",
url: prefix + "/storageOutOrderDetailList",
modalName: "入库单记录",
showFooter: true,
showColumns: false,
pagination: false,
showToggle: false,
showRefresh:false,
showSearch:false,
queryParams:queryParams,
columns: [
{
title: '供应商ID',
field: 'supplierCode',
@ -216,9 +137,12 @@
{
title: '物料类型',
field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
title: '物料图片地址',
title: '图片',
field: 'materialPhotourl',
},
{
@ -236,6 +160,9 @@
{
title: '物料加工方式',
field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
@ -288,15 +215,20 @@
{
title: '存放位置',
field: 'storageLocation',
}]
});
}
]
};
$.table.init(options);
});
$tableWrapper.append($header).append($table);
$('#tablesContainer').append($tableWrapper);
function queryParams(params) {
var curParams = {
// 传递参数查询参数
warehouseStorageCode: warehouseStorageCode
};
return curParams;
}
//根据仓库ID查询仓库名称
$(document).ready(function() {
// 初始化时默认加载仓库ID列表

34
ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageRefundsExchanges.html

@ -16,27 +16,27 @@
<form class="form-horizontal m" id="form-temporaryPurchaseWarehouse-edit" th:object="${warehouseStorageOrder}">
<input name="warehouseStorageId" th:field="*{warehouseStorageId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">入库单号:</label>
<label class="col-sm-4 control-label">入库单号:</label>
<div class="col-sm-8">
<input name="warehouseStorageCode" th:field="*{warehouseStorageCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">关联单号:</label>
<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="col-xs-12">
<label class="col-sm-1 control-label">入库类型:</label>
<div class="col-sm-4">
<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-3 control-label">到货时间:</label>
<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>
@ -45,7 +45,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交检时间:</label>
<label class="col-sm-4 control-label">交检时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="deliveryInspectionTime" th:value="${#dates.format(warehouseStorageOrder.deliveryInspectionTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
@ -68,7 +68,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">仓库详细地址:</label>
<label class="col-sm-4 control-label">仓库详细地址:</label>
<div class="col-sm-8">
<input name="warehouseDetailAddress" th:field="*{warehouseDetailAddress}" class="form-control" type="text">
</div>
@ -91,6 +91,10 @@
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]
var warehouseCode = [[${warehouseStorageOrder.warehouseCode}]]
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var prefix = ctx + "warehouse/storageOrder";
$("#form-temporaryPurchaseWarehouse-edit").validate({
focusCleanup: true
@ -143,7 +147,7 @@
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/storagePurchase", jsonData);
$.operate.saveJson(prefix + "/storageRefundsExchanges", jsonData);
}
$("input[name='arrivedTime']").datetimepicker({
@ -190,9 +194,7 @@
$table.bootstrapTable({
data: supplierData,
columns: [{
checkbox: true
},
columns: [
{
title: '供应商ID',
field: 'supplierCode',
@ -208,9 +210,12 @@
{
title: '物料类型',
field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
title: '物料图片地址',
title: '图片',
field: 'materialPhotourl',
},
{
@ -228,6 +233,9 @@
{
title: '物料加工方式',
field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
title: '退货数',

195
ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryOutOrder.html

@ -4,11 +4,6 @@
<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">
@ -17,19 +12,19 @@
<input name="warehouseStorageId" th:field="*{warehouseStorageId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">入库单号:</label>
<div class="col-sm-8">
<div class="col-sm-6">
<input name="warehouseStorageCode" th:field="*{warehouseStorageCode}" 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">
<div class="col-sm-6">
<input name="relatedOrderCode" th:field="*{relatedOrderCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="col-xs-12">
<label class="col-sm-1 control-label">入库类型:</label>
<div class="col-sm-4">
<div class="form-group">
<label class="col-sm-3 control-label">入库类型:</label>
<div class="col-sm-6">
<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>
@ -37,7 +32,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">到货时间:</label>
<div class="col-sm-8">
<div class="col-sm-6">
<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>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
@ -46,7 +41,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交检时间:</label>
<div class="col-sm-8">
<div class="col-sm-6">
<div class="input-group date">
<input name="deliveryInspectionTime" th:value="${#dates.format(warehouseStorageOrder.deliveryInspectionTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
@ -54,22 +49,22 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label is-required">仓库ID:</label>
<div class="col-sm-8">
<label class="col-sm-3 control-label is-required">仓库ID:</label>
<div class="col-sm-6">
<select class="form-control" id="warehouseCode" name="warehouseCode" th:field="*{warehouseCode}" required>
<!-- 这里动态生成仓库ID选项 -->
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">仓库名称:</label>
<div class="col-sm-8">
<label class="col-sm-3 control-label">仓库名称:</label>
<div class="col-sm-6">
<input name="warehouseName" th:field="*{warehouseName}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">仓库详细地址:</label>
<div class="col-sm-8">
<div class="col-sm-6">
<input name="warehouseDetailAddress" th:field="*{warehouseDetailAddress}" class="form-control" type="text">
</div>
</div>
@ -78,7 +73,8 @@
<!--供应商物料相关-->
<div class="row">
<div class="col-sm-12" id="tablesContainer">
<!-- 表格将在这里动态生成 -->
<h3 class="mb-4">入库单详情</h3>
<table id="bootstrap-storageDetail-table"></table>
</div>
</div>
</div>
@ -90,7 +86,9 @@
<script th:inline="javascript">
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]
var warehouseCode = [[${warehouseStorageOrder.warehouseCode}]]
var warehouseCode = [[${warehouseStorageOrder.warehouseCode}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var prefix = ctx + "warehouse/storageOrder";
$("#form-temporaryPurchaseWarehouse-edit").validate({
focusCleanup: true
@ -100,54 +98,49 @@
var tableDatas = [];
function submitHandler() {
$("select[name='warehouseStorageType']").removeAttr('disabled');
const storageOrderData = $("#form-temporaryPurchaseWarehouse-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 初始化一个数组用于存放所有表格的数据
let allMaterialDataList = [];
for(let i in tableDatas){
$('#' + tableDatas[i]).each(function() {
const tableData = $(this).bootstrapTable('getData');
console.log(JSON.stringify(tableData));
// 将表数据转换成与qualityReportData格式一致的数组
var materialDataList = tableData.map(function (item) {
// 根据实际字段名调整
return {
"supplierCode": item.supplierCode,
"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,
"qualityHasQualifiedNum": item.qualityHasQualifiedNum,
"hasStorageNum": item.hasStorageNum,
"notifyArriveNum": item.notifyArriveNum,
"actualArriveNum": item.actualArriveNum,
"temporaryQualifiedNum": item.temporaryQualifiedNum,
"temporaryRemark": item.temporaryRemark,
"temporaryReportUrl": item.temporaryReportUrl,
// ...其他字段
};
});
allMaterialDataList = allMaterialDataList.concat(materialDataList);
});
}
const tableData = $("#bootstrap-storageDetail-table").bootstrapTable('getData');
// 将表数据转换成与qualityReportData格式一致的数组
var materialDataList = tableData.map(function (item) {
// 根据实际字段名调整
return {
"supplierCode": item.supplierCode,
"warehouseStorageDetailId": item.warehouseStorageDetailId,
"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,
"qualityHasQualifiedNum": item.qualityHasQualifiedNum,
"hasStorageNum": item.hasStorageNum,
"notifyArriveNum": item.notifyArriveNum,
"actualArriveNum": item.actualArriveNum,
"temporaryQualifiedNum": item.temporaryQualifiedNum,
"temporaryRemark": item.temporaryRemark,
"temporaryReportUrl": item.temporaryReportUrl,
"warehouseStorageType": item.warehouseStorageType,
// ...其他字段
};
});
const combinedData = Object.assign({}, storageOrderData, {
warehouseStorageOrderDetailList: allMaterialDataList
warehouseStorageOrderDetailList: materialDataList
});
// 合并表单数据和表格数据
// const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData);
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
console.log(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/temporaryOutOrder", jsonData);
}
@ -165,45 +158,28 @@
});
$(function() {
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]; // 这里需要实际赋值,比如从前端某个地方读取
$.getJSON(prefix + "/temporaryOutOrderDetailList?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') +
' </br> ' + (supplierInfo.customerContact || 'N/A') +
' - ' + (supplierInfo.contactNumber || 'N/A') +
' - ' + (supplierInfo.supplierAddress || '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
},
var options = {
id:"bootstrap-storageDetail-table",
url: prefix + "/storageOutOrderDetailList",
modalName: "入库单记录",
showFooter: true,
showColumns: false,
pagination: false,
showToggle: false,
showRefresh:false,
showSearch:false,
queryParams:queryParams,
columns: [
{
title: '供应商ID',
field: 'supplierCode',
visible: false
},
{
title: '入库单详情ID',
field: 'warehouseStorageDetailId',
visible: false,
},
{
title: '料号',
field: 'materialNo'
@ -214,6 +190,9 @@
{
title: '物料类型',
field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
title: '物料图片地址',
@ -234,6 +213,9 @@
{
title: '物料加工方式',
field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
@ -260,7 +242,11 @@
title: '通知到货数',
field: 'notifyArriveNum',
},
{
title: '入库类型',
field: 'warehouseStorageType',
visible: false,
},
{
title: '实际到货数',
field: 'actualArriveNum',
@ -273,7 +259,7 @@
var processBadNum = parseInt(v);
if (processBadNum <= 0) return '数量必须是正整数';
}
}
},
},
{
@ -288,21 +274,32 @@
var processBadNum = parseInt(v);
if (processBadNum <= 0) return '数量必须是正整数';
}
}
},
},
{
title: '暂收备注',
field: 'temporaryRemark',
editable: true
editable: {
type: 'text',
mode:'inline',
},
},
{
title: '暂收报告',
field: 'temporaryReportUrl',
}]
});
};
$.table.init(options);
});
$tableWrapper.append($header).append($table);
$('#tablesContainer').append($tableWrapper);
function queryParams(params) {
var curParams = {
// 传递参数查询参数
warehouseStorageCode: warehouseStorageCode
};
return curParams;
}

170
ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryOutOrderDetail.html

@ -3,13 +3,6 @@
<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">
@ -17,19 +10,19 @@
<input name="warehouseStorageId" th:field="*{warehouseStorageId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">入库单号:</label>
<div class="col-sm-8">
<div class="col-sm-6">
<input name="warehouseStorageCode" th:field="*{warehouseStorageCode}" 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">
<div class="col-sm-6">
<input name="relatedOrderCode" th:field="*{relatedOrderCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="col-xs-12">
<label class="col-sm-1 control-label">入库类型:</label>
<div class="col-sm-4">
<div class="form-group">
<label class="col-sm-3 control-label">入库类型:</label>
<div class="col-sm-6">
<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>
@ -37,7 +30,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">到货时间:</label>
<div class="col-sm-8">
<div class="col-sm-6">
<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>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
@ -46,7 +39,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交检时间:</label>
<div class="col-sm-8">
<div class="col-sm-6">
<div class="input-group date">
<input name="deliveryInspectionTime" th:value="${#dates.format(warehouseStorageOrder.deliveryInspectionTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
@ -54,22 +47,22 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label is-required">仓库ID:</label>
<div class="col-sm-8">
<label class="col-sm-3 control-label is-required">仓库ID:</label>
<div class="col-sm-6">
<select class="form-control" id="warehouseCode" name="warehouseCode" th:field="*{warehouseCode}" required disabled>
<!-- 这里动态生成仓库ID选项 -->
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">仓库名称:</label>
<div class="col-sm-8">
<label class="col-sm-3 control-label">仓库名称:</label>
<div class="col-sm-6">
<input name="warehouseName" th:field="*{warehouseName}" 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">
<div class="col-sm-6">
<input name="warehouseDetailAddress" th:field="*{warehouseDetailAddress}" class="form-control" type="text" disabled>
</div>
</div>
@ -79,6 +72,8 @@
<div class="row">
<div class="col-sm-12" id="tablesContainer">
<!-- 表格将在这里动态生成 -->
<h3 class="mb-4">入库单详情</h3>
<table id="bootstrap-storageDetail-table"></table>
</div>
</div>
</div>
@ -91,67 +86,13 @@
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]
var warehouseCode = [[${warehouseStorageOrder.warehouseCode}]]
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var prefix = ctx + "warehouse/storageOrder";
$("#form-temporaryPurchaseWarehouse-edit").validate({
focusCleanup: true
});
//生成的不同table的id集合
var tableDatas = [];
function submitHandler() {
const storageOrderData = $("#form-temporaryPurchaseWarehouse-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 初始化一个数组用于存放所有表格的数据
let allMaterialDataList = [];
for(let i in tableDatas){
$('#' + tableDatas[i]).each(function() {
const tableData = $(this).bootstrapTable('getData');
console.log(JSON.stringify(tableData));
// 将表数据转换成与qualityReportData格式一致的数组
var materialDataList = tableData.map(function (item) {
// 根据实际字段名调整
return {
"supplierCode": item.supplierCode,
"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,
"qualityHasQualifiedNum": item.qualityHasQualifiedNum,
"hasStorageNum": item.hasStorageNum,
"notifyArriveNum": item.notifyArriveNum,
"actualArriveNum": item.actualArriveNum,
"temporaryQualifiedNum": item.temporaryQualifiedNum,
"temporaryRemark": item.temporaryRemark,
"temporaryReportUrl": item.temporaryReportUrl,
// ...其他字段
};
});
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 + "/temporaryOutOrder", jsonData);
}
$("input[name='arrivedTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
@ -163,42 +104,19 @@
minView: "month",
autoclose: true
});
$(function() {
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]; // 这里需要实际赋值,比如从前端某个地方读取
$.getJSON(prefix + "/temporaryOutOrderDetailList?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') +
' </br> ' + (supplierInfo.customerContact || 'N/A') +
' - ' + (supplierInfo.contactNumber || 'N/A') +
' - ' + (supplierInfo.supplierAddress || '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
},
var options = {
id:"bootstrap-storageDetail-table",
url: prefix + "/storageOutOrderDetailList",
modalName: "入库单记录",
showFooter: true,
showColumns: false,
pagination: false,
showToggle: false,
showRefresh:false,
showSearch:false,
queryParams:queryParams,
columns: [
{
title: '供应商ID',
field: 'supplierCode',
@ -214,6 +132,9 @@
{
title: '物料类型',
field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
title: '物料图片地址',
@ -234,6 +155,9 @@
{
title: '物料加工方式',
field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
@ -263,7 +187,7 @@
{
title: '实际到货数',
field: 'actualArriveNum'
field: 'actualArriveNum',
},
{
@ -273,15 +197,31 @@
{
title: '暂收备注',
field: 'temporaryRemark',
editable: true
},
{
title: '暂收报告',
field: 'temporaryReportUrl',
}]
});
},
{
title: '入库数',
field: 'storageNum',
},
{
title: '存放位置',
field: 'storageLocation',
}
]
};
$.table.init(options);
});
$tableWrapper.append($header).append($table);
$('#tablesContainer').append($tableWrapper);
function queryParams(params) {
var curParams = {
// 传递参数查询参数
warehouseStorageCode: warehouseStorageCode
};
return curParams;
}

Loading…
Cancel
Save