diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseStorageServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseStorageServiceImpl.java index 88d653c4..7aec9541 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseStorageServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseStorageServiceImpl.java @@ -52,14 +52,15 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService @Override public List selectPurchaseStorageList(WarehouseStorageOrder warehouseStorageOrder) { - List allWarehouseStorageOrders = warehouseStorageOrderMapper.selectWarehouseStorageOrderList(warehouseStorageOrder); +// List allWarehouseStorageOrders = warehouseStorageOrderMapper.selectWarehouseStorageOrderList(warehouseStorageOrder); List purchaseStorages = new ArrayList<>(); // 使用流过滤出warehouseOrderType为"0"的记录 也就是采购订单 - List filteredWarehouseStorageOrders = allWarehouseStorageOrders.stream() - .filter(s -> "0".equals(s.getWarehouseOrderType())) - .collect(Collectors.toList()); +// List filteredWarehouseStorageOrders = allWarehouseStorageOrders.stream() +// .filter(s -> "0".equals(s.getWarehouseOrderType())) +// .collect(Collectors.toList()); + List allWarehouseStorageOrders = warehouseStorageOrderMapper.selectPurchaseStorageList(warehouseStorageOrder); - for (WarehouseStorageOrder wso : filteredWarehouseStorageOrders) { + for (WarehouseStorageOrder wso : allWarehouseStorageOrders) { PurchaseStorage ps = new PurchaseStorage(); BeanUtils.copyProperties(wso, ps); purchaseStorages.add(ps); @@ -70,13 +71,14 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService @Override public List selectWarehouseStorageList(WarehouseStorageOrder warehouseStorageOrder) { // 先获取所有仓储订单列表 - List allWarehouseStorageOrders = warehouseStorageOrderMapper.selectWarehouseStorageOrderList(warehouseStorageOrder); + List allWarehouseStorageOrders = warehouseStorageOrderMapper.selectPurchaseStorageList(warehouseStorageOrder); - // 使用流过滤出warehouseOrderType为"0"的记录 也就是采购订单 - List filteredWarehouseStorageOrders = allWarehouseStorageOrders.stream() - .filter(s -> "0".equals(s.getWarehouseOrderType())) - .collect(Collectors.toList()); - return filteredWarehouseStorageOrders; +// // 使用流过滤出warehouseOrderType为"0"的记录 也就是采购订单 +// List filteredWarehouseStorageOrders = allWarehouseStorageOrders.stream() +// .filter(s -> "0".equals(s.getWarehouseOrderType())) +// .collect(Collectors.toList()); +// return filteredWarehouseStorageOrders; + return allWarehouseStorageOrders; } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderService.java index 3d681473..f6a4e709 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderService.java @@ -2,6 +2,8 @@ package com.ruoyi.quality.service; import java.util.List; import com.ruoyi.quality.domain.QualityOrder; +import com.ruoyi.warehouse.domain.WarehouseStorageOrder; +import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; /** * 品质管理品质单Service接口 @@ -72,4 +74,9 @@ public interface IQualityOrderService * @return */ int restoreQualityOrderById(Long qualityOrderId); + + /* + * + * */ + void insertQualityOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List warehouseStorageOrderDetailList); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java index 0beb2176..5dc8bda7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java @@ -1,8 +1,20 @@ package com.ruoyi.quality.service.impl; +import java.util.ArrayList; +import java.util.Date; import java.util.List; + +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.quality.domain.QualityOrderDetail; +import com.ruoyi.quality.domain.QualityOrderReport; +import com.ruoyi.quality.domain.QualityOrderReportUnqualified; +import com.ruoyi.quality.mapper.QualityOrderDetailMapper; +import com.ruoyi.quality.mapper.QualityOrderReportMapper; +import com.ruoyi.quality.mapper.QualityOrderReportUnqualifiedMapper; +import com.ruoyi.warehouse.domain.WarehouseStorageOrder; +import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.quality.mapper.QualityOrderMapper; @@ -22,6 +34,19 @@ public class QualityOrderServiceImpl implements IQualityOrderService @Autowired private QualityOrderMapper qualityOrderMapper; + + @Autowired + private QualityOrderDetailMapper orderDetailMapper; + + @Autowired + private QualityOrderReportMapper orderReportMapper; + + @Autowired + private QualityOrderReportUnqualifiedMapper orderReportUnqualifiedMapper; + + @Autowired + private RedisCache redisCache; + /** * 查询品质管理品质单 * @@ -123,4 +148,159 @@ public class QualityOrderServiceImpl implements IQualityOrderService { return qualityOrderMapper.restoreQualityOrderById(qualityOrderId); } + + + + /* + * 采购入库仓库入库后生成品质单 + * */ + @Override + public void insertQualityOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List storageOrderDetailList) { + + QualityOrder qualityOrder = new QualityOrder(); + qualityOrder.setCreateTime(new Date()); + qualityOrder.setCreateBy(warehouseStorageOrder.getCreateBy()); + //使用redis自动生成品质单号 + String qualityOrderCode = redisCache.generateBillNo("PZ"); + + qualityOrder.setQualityOrderCode(qualityOrderCode); + qualityOrder.setInStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); + qualityOrder.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode()); + qualityOrder.setQualityStatus("0"); + qualityOrder.setQualityOrderType("0"); + qualityOrder.setQualityStorageStatus("0"); + qualityOrder.setThisArrivedNum(warehouseStorageOrder.getActualArrivedNum()); + qualityOrder.setWarehouseCode(warehouseStorageOrder.getWarehouseCode()); + qualityOrder.setWarehouseName(warehouseStorageOrder.getWarehouseName()); + qualityOrder.setDeliveryInspectionTime(warehouseStorageOrder.getDeliveryInspectionTime()); + qualityOrderMapper.insertQualityOrder(qualityOrder); + + + //新增三个子表的数据 + for (WarehouseStorageOrderDetail detail : storageOrderDetailList) { + // 构建QualityOrderDetail,假设其他属性与QualityOrder相同,故不重复设置 + insertQualityOrderDetailByWarehouseStorageOrder(warehouseStorageOrder, detail, qualityOrderCode); + insertQualityOrderReportByWarehouseStorageOrder(detail); + insertQualityOrderUnqualifiedByWarehouseStorageOrder(detail); + // ... + } + + } + + private void insertQualityOrderUnqualifiedByWarehouseStorageOrder( WarehouseStorageOrderDetail warehouseStorageOrderDetail) { + QualityOrderReportUnqualified qualityOrderReportUnqualified = new QualityOrderReportUnqualified(); + //插入品质报告不合格数 + qualityOrderReportUnqualified.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode()); + qualityOrderReportUnqualified.setSupplierName(warehouseStorageOrderDetail.getSupplierName()); + qualityOrderReportUnqualified.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); + qualityOrderReportUnqualified.setMaterialName(warehouseStorageOrderDetail.getMaterialName()); + qualityOrderReportUnqualified.setCreateTime(new Date()); + qualityOrderReportUnqualified.setCreateBy(warehouseStorageOrderDetail.getCreateBy()); + orderReportUnqualifiedMapper.insertQualityOrderReportUnqualified(qualityOrderReportUnqualified); + + } + + private void insertQualityOrderReportByWarehouseStorageOrder(WarehouseStorageOrderDetail warehouseStorageOrderDetail) { + QualityOrderReport qualityOrderReport = new QualityOrderReport(); + //插入品质单报告开始品质单 + qualityOrderReport.setSupplierCode(qualityOrderReport.getSupplierCode()); + qualityOrderReport.setSupplierName(warehouseStorageOrderDetail.getSupplierName()); + qualityOrderReport.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); + qualityOrderReport.setMaterialName(warehouseStorageOrderDetail.getMaterialName()); + qualityOrderReport.setQualityHasqualifiedNum(warehouseStorageOrderDetail.getQualityHasQualifiedNum()); + qualityOrderReport.setCreateTime(new Date()); + qualityOrderReport.setCreateBy(warehouseStorageOrderDetail.getCreateBy()); + orderReportMapper.insertQualityOrderReport(qualityOrderReport); + } + + private void insertQualityOrderDetailByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, WarehouseStorageOrderDetail warehouseStorageOrderDetail, String qualityOrderCode) { + + QualityOrderDetail qualityOrderDetail = new QualityOrderDetail(); + + //插入数据到品质报告详情和 品质报告 + qualityOrderDetail.setQualityOrderCode(qualityOrderCode); + qualityOrderDetail.setInStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); + qualityOrderDetail.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode()); + qualityOrderDetail.setQualityStatus("0"); + qualityOrderDetail.setQualityOrderType("0"); + qualityOrderDetail.setQualityStorageStatus("0"); + qualityOrderDetail.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); + qualityOrderDetail.setMaterialBrand(warehouseStorageOrderDetail.getMaterialBrand()); + qualityOrderDetail.setMaterialDescribe(warehouseStorageOrderDetail.getMaterialDescribe()); + qualityOrderDetail.setMaterialName(warehouseStorageOrderDetail.getMaterialName()); + qualityOrderDetail.setMaterialProcessMethod(warehouseStorageOrderDetail.getMaterialProcessMethod()); + qualityOrderDetail.setMaterialPhotourl(warehouseStorageOrderDetail.getMaterialPhotourl()); + qualityOrderDetail.setMaterialUnit(warehouseStorageOrderDetail.getMaterialUnit()); + qualityOrderDetail.setMaterialType(warehouseStorageOrderDetail.getMaterialType()); + qualityOrderDetail.setMakeTotal(warehouseStorageOrderDetail.getMakeTotal()); + qualityOrderDetail.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode()); + qualityOrderDetail.setSupplierName(warehouseStorageOrderDetail.getSupplierName()); + qualityOrderDetail.setSupplierAddress(warehouseStorageOrderDetail.getSupplierAddress()); + qualityOrderDetail.setCustomerContact(warehouseStorageOrderDetail.getCustomerContact()); + qualityOrderDetail.setContactNumber(warehouseStorageOrderDetail.getContactNumber()); + qualityOrderDetail.setQualityHasqualifiedNum(warehouseStorageOrderDetail.getQualityHasQualifiedNum()); + qualityOrderDetail.setCreateTime(new Date()); + qualityOrderDetail.setCreateBy(warehouseStorageOrderDetail.getCreateBy()); + orderDetailMapper.insertQualityOrderDetail(qualityOrderDetail); + + + } + + +// /* +// * 根据仓库入库单采购入库 生成品质单 +// * */ +// private void insertQualityOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List storageOrderDetailList) { +// +// +// +// +// //插入数据到品质报告详情和 品质报告 +// for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : storageOrderDetailList) { +// QualityOrderDetail qualityOrderDetail = new QualityOrderDetail(); +// QualityOrderReport qualityOrderReport = new QualityOrderReport(); +// QualityOrderReportUnqualified qualityOrderReportUnqualified = new QualityOrderReportUnqualified(); +// qualityOrderDetail.setQualityOrderCode(qualityOrderCode); +// qualityOrderDetail.setInStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); +// qualityOrderDetail.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode()); +// qualityOrderDetail.setQualityStatus("0"); +// qualityOrderDetail.setQualityOrderType("0"); +// qualityOrderDetail.setQualityStorageStatus("0"); +// qualityOrderDetail.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); +// qualityOrderDetail.setMaterialBrand(warehouseStorageOrderDetail.getMaterialBrand()); +// qualityOrderDetail.setMaterialDescribe(warehouseStorageOrderDetail.getMaterialDescribe()); +// qualityOrderDetail.setMaterialName(warehouseStorageOrderDetail.getMaterialName()); +// qualityOrderDetail.setMaterialProcessMethod(warehouseStorageOrderDetail.getMaterialProcessMethod()); +// qualityOrderDetail.setMaterialPhotourl(warehouseStorageOrderDetail.getMaterialPhotourl()); +// qualityOrderDetail.setMaterialUnit(warehouseStorageOrderDetail.getMaterialUnit()); +// qualityOrderDetail.setMaterialType(warehouseStorageOrderDetail.getMaterialType()); +// qualityOrderDetail.setMakeTotal(warehouseStorageOrderDetail.getMakeTotal()); +// qualityOrderDetail.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode()); +// qualityOrderDetail.setSupplierName(warehouseStorageOrderDetail.getSupplierName()); +// qualityOrderDetail.setSupplierAddress(warehouseStorageOrderDetail.getSupplierAddress()); +// qualityOrderDetail.setCustomerContact(warehouseStorageOrderDetail.getCustomerContact()); +// qualityOrderDetail.setContactNumber(warehouseStorageOrderDetail.getContactNumber()); +// qualityOrderDetail.setQualityHasqualifiedNum(warehouseStorageOrderDetail.getQualityHasQualifiedNum()); +// qualityOrderDetail.setCreateTime(new Date()); +// qualityOrderDetail.setCreateBy(warehouseStorageOrderDetail.getCreateBy()); +// orderDetailMapper.insertQualityOrderDetail(qualityOrderDetail); +// //插入品质单报告开始品质单 +// qualityOrderReport.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode()); +// qualityOrderReport.setSupplierName(warehouseStorageOrderDetail.getSupplierName()); +// qualityOrderReport.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); +// qualityOrderReport.setMaterialName(warehouseStorageOrderDetail.getMaterialName()); +// qualityOrderReport.setQualityHasqualifiedNum(warehouseStorageOrderDetail.getQualityHasQualifiedNum()); +// qualityOrderDetail.setCreateTime(new Date()); +// qualityOrderDetail.setCreateBy(warehouseStorageOrderDetail.getCreateBy()); +// orderReportMapper.insertQualityOrderReport(qualityOrderReport); +// //插入品质报告不合格数 +// qualityOrderReportUnqualified.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode()); +// qualityOrderReportUnqualified.setSupplierName(warehouseStorageOrderDetail.getSupplierName()); +// qualityOrderReportUnqualified.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); +// qualityOrderReportUnqualified.setMaterialName(warehouseStorageOrderDetail.getMaterialName()); +// qualityOrderReportUnqualified.setCreateTime(new Date()); +// qualityOrderReportUnqualified.setCreateBy(warehouseStorageOrderDetail.getCreateBy()); +// orderReportUnqualifiedMapper.insertQualityOrderReportUnqualified(qualityOrderReportUnqualified); +// } +// } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java index f09fcdab..a536b003 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java @@ -146,7 +146,7 @@ public class SysMakeOrderController extends BaseController sysMakeOrder.setCustomerOderCode(sysSalesOrder.getSalesOrderNumber()); } mmap.put("sysMakeOrder", sysMakeOrder); - return prefix + "/addPick"; + return prefix + "/addpick"; } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java index f8cd11c0..877d4a91 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java @@ -197,7 +197,7 @@ public class WarehouseStorageOrderController extends BaseController @ResponseBody public AjaxResult temporaryPurchaseSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder) { - return toAjax(warehouseStorageOrderService.updateWarehouseStorageOrder(warehouseStorageOrder)); + return toAjax(warehouseStorageOrderService.temporaryPurchaseWarehouseStorageOrder(warehouseStorageOrder)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseStorageOrderMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseStorageOrderMapper.java index 760b974a..8c576ef1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseStorageOrderMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseStorageOrderMapper.java @@ -28,6 +28,16 @@ public interface WarehouseStorageOrderMapper */ public List selectWarehouseStorageOrderList(WarehouseStorageOrder warehouseStorageOrder); + + + /** + * 采购入库通知单查询仓库入库单列表 + * + * @param warehouseStorageOrder 仓库入库单 + * @return 仓库入库单集合 + */ + public List selectPurchaseStorageList(WarehouseStorageOrder warehouseStorageOrder); + /** * 新增仓库入库单 * diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java index 3c8399da..bf2f3cab 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java @@ -77,4 +77,10 @@ public interface IWarehouseStorageOrderService * 入库-生产订单 * */ int updateStorageMake(WarehouseStorageOrder warehouseStorageOrder); + + + /** + * 修改保存暂收-采购单(采购入库) + */ + int temporaryPurchaseWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java index 865d6386..ecbc1261 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java @@ -1,12 +1,27 @@ package com.ruoyi.warehouse.service.impl; +import java.util.ArrayList; +import java.util.Date; import java.util.List; + +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.quality.domain.QualityOrder; +import com.ruoyi.quality.domain.QualityOrderDetail; +import com.ruoyi.quality.domain.QualityOrderReport; +import com.ruoyi.quality.domain.QualityOrderReportUnqualified; +import com.ruoyi.quality.mapper.QualityOrderDetailMapper; +import com.ruoyi.quality.mapper.QualityOrderMapper; +import com.ruoyi.quality.mapper.QualityOrderReportMapper; +import com.ruoyi.quality.mapper.QualityOrderReportUnqualifiedMapper; +import com.ruoyi.quality.service.IQualityOrderService; import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper; import lombok.extern.slf4j.Slf4j; +import org.activiti.editor.language.json.converter.util.CollectionUtils; +import org.apache.avalon.framework.service.ServiceException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper; @@ -14,6 +29,7 @@ import com.ruoyi.warehouse.domain.WarehouseStorageOrder; import com.ruoyi.warehouse.service.IWarehouseStorageOrderService; import com.ruoyi.common.core.text.Convert; import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; /** * 仓库入库单Service业务层处理 @@ -30,6 +46,13 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS @Autowired private WarehouseStorageOrderDetailMapper storageOrderDetailMapper; + + @Autowired + private IQualityOrderService qualityOrderService; + + @Autowired + private RedisCache redisCache; + /** * 查询仓库入库单 * @@ -71,7 +94,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS /** * 修改仓库入库单 - * + * * @param warehouseStorageOrder 仓库入库单 * @return 结果 */ @@ -102,11 +125,103 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS } } } - + warehouseStorageOrder.setWarehouseStorageStatus("1"); return warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder); } + + + /** + * 修改保存暂收-采购单(采购入库) + * + * @param warehouseStorageOrder 仓库入库单 + * @return 结果 + */ + @Transactional + @Override + public int temporaryPurchaseWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder) { + String loginName = ShiroUtils.getLoginName(); + warehouseStorageOrder.setUpdateBy(loginName); + warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate()); + warehouseStorageOrder.setWarehouseStorageStatus("1"); + updateWarehouseStorageOrderDetails(warehouseStorageOrder); + + int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder); + if (updateResult <= 0) { + throw new RuntimeException("更新入库单主记录失败"); + } + + try { + qualityOrderService.insertQualityOrderByWarehouseStorageOrder(warehouseStorageOrder, warehouseStorageOrder.getWarehouseStorageOrderDetailList()); + } catch (Exception e) { + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + log.error("生成品质单时发生错误", e); + throw new RuntimeException("生成品质单时发生错误"); + } + + return updateResult; + } + + /* + * 更新仓库入库单详情的数据 + * */ + private void updateWarehouseStorageOrderDetails(WarehouseStorageOrder warehouseStorageOrder) { + List details = warehouseStorageOrder.getWarehouseStorageOrderDetailList(); + if (!CollectionUtils.isEmpty(details)) { + for (WarehouseStorageOrderDetail detail : details) { + detail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); + WarehouseStorageOrderDetail tempStorageOrderDetail = new WarehouseStorageOrderDetail(); + tempStorageOrderDetail.setMaterialNo(detail.getMaterialNo()); + tempStorageOrderDetail.setSupplierCode(detail.getSupplierCode()); + tempStorageOrderDetail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); + WarehouseStorageOrderDetail storageOrderDetailFromData = storageOrderDetailMapper.selectWarehouseStorageOrderByObject(tempStorageOrderDetail); + if (storageOrderDetailFromData == null){ + log.warn("数据库中入库单详情为空:{}",tempStorageOrderDetail); + }else { + storageOrderDetailMapper.updateWarehouseStorageOrderDetailByObject(detail); + } + } + } + } + + + /* + * 原仓库入库单暂收 + * + */ +// @Transactional +// @Override +// public int updateWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder) +// { +// String loginName = ShiroUtils.getLoginName(); +// warehouseStorageOrder.setUpdateBy(loginName); +// warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate()); +// +// List storageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList(); +// +// if (StringUtils.isEmpty(storageOrderDetailList)){ +// log.warn("入库单详情为空:{}",storageOrderDetailList); +// }else { +// for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : storageOrderDetailList) { +// warehouseStorageOrderDetail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); +// WarehouseStorageOrderDetail tempStorageOrderDetail = new WarehouseStorageOrderDetail(); +// tempStorageOrderDetail.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); +// tempStorageOrderDetail.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode()); +// tempStorageOrderDetail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); +// WarehouseStorageOrderDetail storageOrderDetailFromData = storageOrderDetailMapper.selectWarehouseStorageOrderByObject(tempStorageOrderDetail); +// if (storageOrderDetailFromData == null){ +// log.warn("数据库中入库单详情为空:{}",tempStorageOrderDetail); +// }else { +// storageOrderDetailMapper.updateWarehouseStorageOrderDetailByObject(warehouseStorageOrderDetail); +// } +// } +// } +// warehouseStorageOrder.setWarehouseStorageStatus("1"); +// return warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder); +// } + + /* * 入库-生产订单 * */ diff --git a/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseStorageOrderMapper.xml b/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseStorageOrderMapper.xml index 4b98771e..262bc0f0 100644 --- a/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseStorageOrderMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseStorageOrderMapper.xml @@ -50,8 +50,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and warehouse_employee = #{warehouseEmployee} and create_time between #{params.beginCreateTime} and #{params.endCreateTime} + order by create_time desc - + + + + + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ +
+
+
+ + + + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseStorage/purchaseStorage.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseStorage/purchaseStorage.html index eb435a5d..1dfca6a3 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchaseStorage/purchaseStorage.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseStorage/purchaseStorage.html @@ -12,33 +12,34 @@
  • - -
  • -
  • - - -
  • -
  • - - +
  • -
  • -
  • +
  • + + +
  • + +
  • + + +
  • - @@ -97,8 +98,7 @@ restoreUrl: prefix + "/restore/{id}", exportUrl: prefix + "/export", modalName: "采购入库通知单", - fixedColumns: true, // 启用冻结列 - fixedRightNumber: 1, // 冻结右列个数 + columns: [ {checkbox: true}, {title: '入库单id',field: 'warehouseStorageId',visible: false}, diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html b/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html index 1c0c1582..ef301b71 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html @@ -78,15 +78,15 @@
    - - 添加 - - - 修改 - - - 删除 - + + + + + + + + + 导出 diff --git a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html index b34a95ea..6c67a6cf 100644 --- a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html +++ b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html @@ -148,7 +148,7 @@ // 使用 JSON.stringify() 序列化数据 const jsonData = JSON.stringify(combinedData); // 发送 AJAX 请求到后端接口 - $.operate.saveJson(prefix + "/temporaryPurchaseWarehouse", jsonData); + $.operate.saveJson(prefix + "/temporaryPurchase", jsonData); } $("input[name='arrivedTime']").datetimepicker({ @@ -351,7 +351,7 @@ // 清空下拉框现有选项 selectElement.empty(); - // 添加默认选项(如果需要)编辑时不需要添加默认选项 + // // 添加默认选项(如果需要)编辑时不需要添加默认选项 selectElement.append(''); // 遍历返回的数据,添加为下拉框的选项 @@ -359,7 +359,7 @@ // 仓库ID selectElement.append(''); }); - // $('#warehouseCode').val(stockNO); + $('#warehouseCode').val(warehouseCode); } else { $.modal.errMsg("数据为空"); }