Compare commits

..

2 Commits

Author SHA1 Message Date
gaowdong 85319380fe Merge remote-tracking branch 'origin/master' 2025-07-17 16:54:54 +08:00
gaowdong 2e801db9a4 出库管理 2025-07-17 16:54:25 +08:00
11 changed files with 47 additions and 12 deletions

View File

@ -90,7 +90,8 @@ public class ImsOutInventoryController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody @Valid ImsOutInventoryAdd imsOutInventoryAdd)
{
return toAjax(imsOutInventoryService.insertImsOutInventory(imsOutInventoryAdd));
imsOutInventoryService.insertImsOutInventory(imsOutInventoryAdd);
return AjaxResult.success("新增成功");
}
/**

View File

@ -135,4 +135,8 @@ public class ImsOutInventoryDetail extends BaseEntity
@ApiModelProperty(value = "库存数量")
@Excel(name = "库存数量")
private BigDecimal materialNum;
@ApiModelProperty(value = "出库单价")
@Excel(name = "出库单价")
private BigDecimal outUnitPrice;
}

View File

@ -101,4 +101,6 @@ public class ImsInventoryVO extends BaseEntity
@Excel(name = "总库存数")
private BigDecimal totalNum;
@ApiModelProperty(value = "货品单价")
private Integer unitPrice;
}

View File

@ -180,6 +180,10 @@ public class OrderGoodsVO extends BaseEntity {
@ApiModelProperty(value = "累计合格总数量")
private BigDecimal totalQualifiedNum;
@Excel(name = "采购计划编号,逗号分隔存储")
@ApiModelProperty(value = "采购计划编号,逗号分隔存储")
private String purchasePlanCode;
private List<OrderGoodsDetailVO> orderGoodsDetailList;
}

View File

@ -37,7 +37,7 @@ public interface IImsOutInventoryService
* @param imsOutInventoryAdd 出库记录
* @return 结果
*/
public int insertImsOutInventory(ImsOutInventoryAdd imsOutInventoryAdd);
public ImsOutInventory insertImsOutInventory(ImsOutInventoryAdd imsOutInventoryAdd);
/**
* 修改出库记录

View File

@ -1,6 +1,7 @@
package com.bonus.canteen.core.ims.service.impl;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import cn.hutool.core.collection.CollUtil;
@ -93,7 +94,7 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int insertImsOutInventory(ImsOutInventoryAdd imsOutInventoryAdd)
public ImsOutInventory insertImsOutInventory(ImsOutInventoryAdd imsOutInventoryAdd)
{
ImsOutInventory imsOutInventory = new ImsOutInventory();
BeanUtils.copyProperties(imsOutInventoryAdd, imsOutInventory);
@ -102,8 +103,7 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
imsOutInventory.setOutCode(NoGenerateUtils.generateOutCode());
imsOutInventory.setTotalAmount(0L);
int rows = imsOutInventoryMapper.insertImsOutInventory(imsOutInventory);
insertImsOutInventoryDetail(imsOutInventoryAdd.getImsOutInventoryDetailAddList(), imsOutInventory);
return rows;
return insertImsOutInventoryDetail(imsOutInventoryAdd.getImsOutInventoryDetailAddList(), imsOutInventory);
}
/**
@ -132,7 +132,8 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
imsOutInventory.setUpdateBy(SecurityUtils.getUsername());
imsOutInventory.setOutCode(imsOutInventoryVO.getOutCode());
imsOutInventoryMapper.deleteImsOutInventoryDetailByOutId(imsOutInventory.getOutId());
return insertImsOutInventoryDetail(imsOutInventoryUpdate.getImsOutInventoryDetailAddList(), imsOutInventory);
insertImsOutInventoryDetail(imsOutInventoryUpdate.getImsOutInventoryDetailAddList(), imsOutInventory);
return 0;
}
/**
@ -168,7 +169,7 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
*
* @param imsOutInventory 出库记录对象
*/
public int insertImsOutInventoryDetail(List<ImsOutInventoryDetailAdd> imsOutInventoryDetailAddList, ImsOutInventory imsOutInventory)
public ImsOutInventory insertImsOutInventoryDetail(List<ImsOutInventoryDetailAdd> imsOutInventoryDetailAddList, ImsOutInventory imsOutInventory)
{
Long outId = imsOutInventory.getOutId();
if (StringUtils.isNotNull(imsOutInventoryDetailAddList))
@ -261,6 +262,11 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
throw new ServiceException("出口失败,库存不足");
}
totalPriceSum += totalPrice;
BigDecimal outUnitPrice = BigDecimal.ZERO;
if(imsOutInventoryDetail.getFetchNum().compareTo(BigDecimal.ZERO) > 0) {
outUnitPrice = new BigDecimal(totalPrice).divide(imsOutInventoryDetail.getFetchNum(), 2, RoundingMode.HALF_UP);
}
imsOutInventoryDetail.setOutUnitPrice(outUnitPrice);
}else {
ImsIntoInventoryDetailVO imsIntoInventoryDetail = imsIntoInventoryMapper
.selectImsIntoInventoryDetailListByIntoDetailId(imsOutInventoryDetail.getIntoDetailId());
@ -297,8 +303,10 @@ public class ImsOutInventoryServiceImpl implements IImsOutInventoryService
imsOutInventoryMapper.batchImsOutInventoryDetail(list);
imsOutInventory.setTotalAmount(totalPriceSum);
}
imsOutInventory.setImsOutInventoryDetailList(list);
}
return imsOutInventoryMapper.updateImsOutInventory(imsOutInventory);
imsOutInventoryMapper.updateImsOutInventory(imsOutInventory);
return imsOutInventory;
}
private void updateFetchMaterialOrderStatus(ImsOutInventory imsOutInventory) {

View File

@ -172,7 +172,7 @@ public class InspectGoodsServiceImpl implements IInspectGoodsService {
for(String orderGoodId : orderGoodsIds) {
ProductionPurchaseOrder productionPurchaseOrder = new ProductionPurchaseOrder();
productionPurchaseOrder.setGoodsOrderId(orderGoodId);
productionPurchaseOrder.setInspectGoodsId(String.valueOf(inspectGoods.getInspectGoodsId()));
productionPurchaseOrder.setInspectGoodsId(inspectGoodsVO.getInspectGoodsCode());
productionPurchaseOrder.setOrderType(SupplierOrderGenerateTypeEnum.PURCHASE_TO_INSPECT.getKey());
productionPurchaseOrderService.insertProductionPurchaseOrder(productionPurchaseOrder);
}

View File

@ -79,6 +79,19 @@ public class OrderGoodsServiceImpl implements IOrderGoodsService {
}
}
orderGoodsVO.setOrderGoodsDetailList(orderGoodsDetails);
ProductionPurchaseOrder productionPurchaseOrder = new ProductionPurchaseOrder();
productionPurchaseOrder.setOrderType(SupplierOrderGenerateTypeEnum.PURCHASE_TO_ORDER.getKey());
productionPurchaseOrder.setGoodsOrderId(String.valueOf(orderGoodsVO.getOrderGoodsCode()));
List<ProductionPurchaseOrder> productionPurchaseOrderList = productionPurchaseOrderService.selectProductionPurchaseOrderList(productionPurchaseOrder);
if(CollUtil.isNotEmpty(productionPurchaseOrderList)) {
List<String> purchaseCodeList = productionPurchaseOrderList.stream()
.map(ProductionPurchaseOrder::getPurchasePlanId)
.distinct()
.sorted()
.collect(Collectors.toList());
orderGoodsVO.setPurchasePlanCodeList(purchaseCodeList);
orderGoodsVO.setPurchasePlanCode(String.join(",", purchaseCodeList));
}
}
return orderGoodsVO;
}
@ -108,6 +121,7 @@ public class OrderGoodsServiceImpl implements IOrderGoodsService {
if(CollUtil.isNotEmpty(purchaseCodeList)) {
for (String purchaseCode : purchaseCodeList) {
productionPurchaseOrder = new ProductionPurchaseOrder();
productionPurchaseOrder.setOrderType(SupplierOrderGenerateTypeEnum.PRODUCTION_TO_PURCHASE.getKey());
productionPurchaseOrder.setPurchasePlanId(purchaseCode);
productionPurchaseOrderList = productionPurchaseOrderService.selectProductionPurchaseOrderList(productionPurchaseOrder);
@ -224,7 +238,7 @@ public class OrderGoodsServiceImpl implements IOrderGoodsService {
for(String purchasePlanCode : purchasePlanCodes) {
ProductionPurchaseOrder productionPurchaseOrder = new ProductionPurchaseOrder();
productionPurchaseOrder.setPurchasePlanId(purchasePlanCode);
productionPurchaseOrder.setGoodsOrderId(orderGoods.getOrderGoodsCode());
productionPurchaseOrder.setGoodsOrderId(orderGoodsVO.getOrderGoodsCode());
productionPurchaseOrder.setOrderType(SupplierOrderGenerateTypeEnum.PURCHASE_TO_ORDER.getKey());
productionPurchaseOrderService.insertProductionPurchaseOrder(productionPurchaseOrder);
}

View File

@ -226,7 +226,7 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService {
for(String productionPlanCode : productionPlanCodes) {
ProductionPurchaseOrder productionPurchaseOrder = new ProductionPurchaseOrder();
productionPurchaseOrder.setProductionPlanId(productionPlanCode);
productionPurchaseOrder.setPurchasePlanId(purchasePlan.getPlanCode());
productionPurchaseOrder.setPurchasePlanId(purchasePlanVO.getPlanCode());
productionPurchaseOrder.setOrderType(SupplierOrderGenerateTypeEnum.PRODUCTION_TO_PURCHASE.getKey());
productionPurchaseOrderService.insertProductionPurchaseOrder(productionPurchaseOrder);
}

View File

@ -28,13 +28,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="areaName" column="area_name" />
<result property="areaId" column="area_id" />
<result property="materialCode" column="material_code" />
<result property="unitPrice" column="unit_price" />
</resultMap>
<sql id="selectImsInventoryVo">
select ii.inventory_id, ii.warehouse_id, ii.material_id, ii.unit_id, min_num, max_num,
material_num, inventory_status, remark, ii.del_flag, ii.create_by, ii.create_time,
ii.update_by, ii.update_time, iwi.warehouse_name, cm.material_name, cmt.material_type_name,
iu.unit_name, cm.bar_code, cm.size, ba.area_name, ba.area_id, cm.material_code
iu.unit_name, cm.bar_code, cm.size, ba.area_name, ba.area_id, cm.material_code, cm.unit_price
from ims_inventory ii
left join ims_warehouse_info iwi on ii.warehouse_id = iwi.warehouse_id
left join cook_material cm on ii.material_id = cm.material_id

View File

@ -67,6 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and ippd.detail_date <![CDATA[ <= ]]> #{endDateTime} )
</if>
</where>
order by ipp.plan_id desc
</select>
<select id="selectProductionPlanByPlanId" parameterType="Long" resultMap="ProductionPlanResult">