feat(inventory): 完善入库单功能并关联采购订单
- 在入库单列表中增加采购单号显示字段 - 优化入库单详情中的序号列显示 - 修复入库单提交时清空库存信息列表的逻辑 - 简化采购订单选择后的表单赋值操作 - 增加入库单与采购订单关联字段及映射 - 实现采购订单项的入库状态更新逻辑 - 添加采购订单状态枚举类型定义 - 修改采购订单项的数量及税率相关字段 - 更新采购订单 Mapper 文件以支持按 itemId 查询 - 实现批量插入采购订单项时的字段对应调整dev_1.0.0
parent
9556a2d6d9
commit
a94ede8b40
|
|
@ -57,6 +57,7 @@
|
|||
<el-table v-loading="loading" :data="innerList">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="入库单号" align="center" prop="innerCode" show-overflow-tooltip/>
|
||||
<el-table-column label="采购单号" align="center" prop="purchaseNo" show-overflow-tooltip/>
|
||||
<el-table-column label="产品编码" align="center" prop="productCode" show-overflow-tooltip/>
|
||||
<el-table-column label="数量" align="center" prop="quantity" />
|
||||
<el-table-column label="制造商" align="center" prop="vendorName" show-overflow-tooltip/>
|
||||
|
|
@ -168,7 +169,7 @@
|
|||
</el-row>
|
||||
|
||||
<el-table :data="form.inventoryInfoList">
|
||||
<el-table-column type="index"/>
|
||||
<el-table-column type="index" label="序号"/>
|
||||
<el-table-column label="SN码" prop="productSn" />
|
||||
<el-table-column label="产品编码" prop="productCode" />
|
||||
<el-table-column label="产品型号" prop="model" />
|
||||
|
|
@ -431,7 +432,7 @@ export default {
|
|||
this.snOpen = false;
|
||||
return;
|
||||
}
|
||||
|
||||
this.form.inventoryInfoList=[]
|
||||
let quantity = Number(this.form.quantity);
|
||||
let productSn = this.inputSn;
|
||||
let snPrefix = "";
|
||||
|
|
@ -503,18 +504,11 @@ export default {
|
|||
this.purchaseOrderSelectVisible = true;
|
||||
},
|
||||
handlePurchaseOrderSelect(order) {
|
||||
this.form.vendorCode = order.vendorCode
|
||||
this.form.vendorName = order.vendorName
|
||||
this.form.productType = order.productType
|
||||
this.form.productCode = order.productCode
|
||||
this.form.productModel = order.productModel
|
||||
this.form.price = order.price
|
||||
this.form.quantity = order.quantity
|
||||
this.form.warehouseId = order.warehouseId
|
||||
this.form= Object.assign(this.form,order)
|
||||
this.form.totalAmount=order.amountTotal
|
||||
const warehouse = this.warehouseOptions.find(w => w.id === this.form.warehouseId);
|
||||
this.form.warehouseName = warehouse.warehouseName || '';
|
||||
this.form.warehouseType = warehouse.warehouseType
|
||||
this.form.productDesc = order.productDesc
|
||||
this.open = true;
|
||||
this.isView = false;
|
||||
this.title = "添加入库单";
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -66,5 +67,12 @@ public class OmsInventoryInner extends BaseEntity {
|
|||
@Excel(name = "入库时间",dateFormat="yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
private String purchaseNo;
|
||||
private String productType;
|
||||
private String orderCode;
|
||||
private BigDecimal totalAmount;
|
||||
private BigDecimal taxRate;
|
||||
private BigDecimal taxTotal;
|
||||
private Long itemId;
|
||||
private List<InventoryInfo> inventoryInfoList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,5 +140,23 @@ public class OmsPurchaseOrder extends BaseEntity
|
|||
}
|
||||
|
||||
}
|
||||
@Getter
|
||||
public enum StatusEnum {
|
||||
WAIT_COMPLETED(0, "待入库"),
|
||||
PART_COMPLETED(1, "部分入库"),
|
||||
COMPLETED(2, "已完成"),
|
||||
|
||||
|
||||
;
|
||||
|
||||
private final String value;
|
||||
private final Integer code;
|
||||
|
||||
StatusEnum(Integer code, String value) {
|
||||
this.code = code;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,11 +31,10 @@ public class OmsPurchaseOrderItem extends BaseEntity
|
|||
/** 产品CODE */
|
||||
private String productCode;
|
||||
|
||||
/** 0:待入库 1:已完成 */
|
||||
private Long innerStatus;
|
||||
|
||||
/** 数量 */
|
||||
private BigDecimal quantity;
|
||||
private BigDecimal innerQuantity;
|
||||
|
||||
/** 单价 */
|
||||
private BigDecimal price;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@ public class OmsPurchaseOrderItemDto extends OmsPurchaseOrder {
|
|||
/** 数量 */
|
||||
private BigDecimal quantity;
|
||||
private BigDecimal innerQuantity;
|
||||
private BigDecimal taxTotal;
|
||||
private BigDecimal amountTotal;
|
||||
private BigDecimal taxRate;
|
||||
private Long itemId;
|
||||
|
||||
|
||||
/** 单价 */
|
||||
|
|
|
|||
|
|
@ -102,4 +102,8 @@ public interface OmsPurchaseOrderMapper
|
|||
List<OmsPurchaseOrder> listByCodeList(List<String> businessKeyList);
|
||||
|
||||
List<OmsPurchaseOrderItemDto> listItem(OmsPurchaseOrderItemDto omsPurchaseOrder);
|
||||
|
||||
List<OmsPurchaseOrderItem> listByItemId(Long itemId);
|
||||
|
||||
void updateOmsPurchaseOrderItem(OmsPurchaseOrderItem updateItem);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,4 +90,6 @@ public interface IOmsPurchaseOrderService
|
|||
List<OmsPurchaseOrder> listApproved(OmsPurchaseOrder omsPurchaseOrder);
|
||||
|
||||
List<OmsPurchaseOrderItemDto> listItem(OmsPurchaseOrderItemDto omsPurchaseOrder);
|
||||
|
||||
void innerWarehouse(Long itemId, Long quantity);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ public class OmsInventoryInnerServiceImpl implements IOmsInventoryInnerService {
|
|||
@Autowired
|
||||
private IInventoryAuthService inventoryAuthService;
|
||||
|
||||
@Autowired
|
||||
private IOmsPurchaseOrderService purchaseOrderService;
|
||||
@Autowired
|
||||
private IOmsPayableBillService payableBillService;
|
||||
/**
|
||||
|
|
@ -123,6 +125,9 @@ public class OmsInventoryInnerServiceImpl implements IOmsInventoryInnerService {
|
|||
}
|
||||
omsInventoryInner.setWarehouseId(warehouseIdList.get(0));
|
||||
|
||||
//修改对应的采购订单
|
||||
purchaseOrderService.innerWarehouse(omsInventoryInner.getItemId(),omsInventoryInner.getQuantity());
|
||||
|
||||
//todo 判断制造商是否需要生成应付单
|
||||
// BigDecimal totalPriceWithTax = inventoryInfoList.stream().map(InventoryInfo::getInnerPrice).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
// //生成应付单
|
||||
|
|
|
|||
|
|
@ -279,6 +279,36 @@ public class OmsPurchaseOrderServiceImpl implements IOmsPurchaseOrderService, To
|
|||
return omsPurchaseOrderMapper.listItem(omsPurchaseOrder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void innerWarehouse(Long itemId, Long quantity) {
|
||||
List<OmsPurchaseOrderItem> omsPurchaseOrderItems = omsPurchaseOrderMapper.listByItemId(itemId);
|
||||
if (CollUtil.isEmpty(omsPurchaseOrderItems)){
|
||||
return;
|
||||
}
|
||||
//默认全部入库 一旦入库数量与实际数量不等 则代表部分入库
|
||||
OmsPurchaseOrderItem updateItem = new OmsPurchaseOrderItem();
|
||||
boolean flag = true;
|
||||
for (OmsPurchaseOrderItem omsPurchaseOrderItem : omsPurchaseOrderItems) {
|
||||
if (omsPurchaseOrderItem.getId().equals(itemId)) {
|
||||
BigDecimal innerQuantity = omsPurchaseOrderItem.getInnerQuantity() == null ? BigDecimal.ZERO : omsPurchaseOrderItem.getInnerQuantity();
|
||||
omsPurchaseOrderItem.setInnerQuantity(innerQuantity.add(BigDecimal.valueOf(quantity)));
|
||||
updateItem = omsPurchaseOrderItem;
|
||||
}
|
||||
if (omsPurchaseOrderItem.getInnerQuantity().compareTo(omsPurchaseOrderItem.getQuantity()) != 0) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
omsPurchaseOrderMapper.updateOmsPurchaseOrderItem(updateItem);
|
||||
|
||||
//更新订单入库状态
|
||||
OmsPurchaseOrder omsPurchaseOrder = new OmsPurchaseOrder();
|
||||
omsPurchaseOrder.setId(omsPurchaseOrderItems.get(0).getPurchaseId());
|
||||
omsPurchaseOrder.setStatus(flag ? OmsPurchaseOrder.StatusEnum.COMPLETED.getCode() : OmsPurchaseOrder.StatusEnum.PART_COMPLETED.getCode());
|
||||
omsPurchaseOrder.setUpdateTime(DateUtils.getNowDate());
|
||||
omsPurchaseOrderMapper.updateOmsPurchaseOrder(omsPurchaseOrder);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增采购单明细表信息
|
||||
|
|
|
|||
|
|
@ -14,10 +14,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="updateBy" column="update_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="purchaseNo" column="purchase_no" />
|
||||
<result property="productType" column="product_type" />
|
||||
<result property="orderCode" column="order_code" />
|
||||
<result property="totalAmount" column="total_amount" />
|
||||
<result property="taxRate" column="tax_rate" />
|
||||
<result property="taxTotal" column="tax_total" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectOmsInventoryInnerVo">
|
||||
select t1.id, t1.inner_code, t1.product_code, t1.quantity, t1.warehouse_id, t1.create_by, t1.update_by, t1.create_time, t1.update_time ,t1.vendor_code,t1.file_id,t1.remark,
|
||||
t1.purchase_no,t1.product_type,t1.order_code,t1.total_amount,t1.tax_rate,t1.tax_total,
|
||||
t2.warehouse_name, t3.user_name as create_by_name,
|
||||
t4.vendor_name,t5.model
|
||||
,t6.original_filename
|
||||
|
|
@ -44,6 +51,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="warehouseId != null "> and t1.warehouse_id = #{warehouseId}</if>
|
||||
<if test="createBy != null and createBy != ''"> and t1.create_by like concat('%', #{createBy}, '%')</if>
|
||||
<if test="createByName != null and createByName != ''"> and t3.user_name like concat('%', #{createByName}, '%')</if>
|
||||
<if test="purchaseNo != null and purchaseNo != ''"> and t1.purchase_no = #{purchaseNo}</if>
|
||||
<if test="productType != null and productType != ''"> and t1.product_type = #{productType}</if>
|
||||
<if test="orderCode != null and orderCode != ''"> and t1.order_code = #{orderCode}</if>
|
||||
<if test="(params.beginCreateTime != null and params.beginCreateTime != '') or (params.endCreateTime != null and params.endCreateTime!='')">
|
||||
<choose>
|
||||
<when test="(params.beginCreateTime != null and params.beginCreateTime != '') and (params.endCreateTime != null and params.endCreateTime!='')">
|
||||
|
|
@ -98,6 +108,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="purchaseNo != null">purchase_no,</if>
|
||||
<if test="productType != null">product_type,</if>
|
||||
<if test="orderCode != null">order_code,</if>
|
||||
<if test="totalAmount != null">total_amount,</if>
|
||||
<if test="taxRate != null">tax_rate,</if>
|
||||
<if test="taxTotal != null">tax_total,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="innerCode != null and innerCode != ''">#{innerCode},</if>
|
||||
|
|
@ -111,6 +127,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="purchaseNo != null">#{purchaseNo},</if>
|
||||
<if test="productType != null">#{productType},</if>
|
||||
<if test="orderCode != null">#{orderCode},</if>
|
||||
<if test="totalAmount != null">#{totalAmount},</if>
|
||||
<if test="taxRate != null">#{taxRate},</if>
|
||||
<if test="taxTotal != null">#{taxTotal},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -128,6 +150,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="purchaseNo != null">purchase_no = #{purchaseNo},</if>
|
||||
<if test="productType != null">product_type = #{productType},</if>
|
||||
<if test="orderCode != null">order_code = #{orderCode},</if>
|
||||
<if test="totalAmount != null">total_amount = #{totalAmount},</if>
|
||||
<if test="taxRate != null">tax_rate = #{taxRate},</if>
|
||||
<if test="taxTotal != null">tax_total = #{taxTotal},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="id" column="id" />
|
||||
<result property="purchaseId" column="purchase_id" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="innerStatus" column="inner_status" />
|
||||
<result property="innerQuantity" column="inner_quantity" />
|
||||
<result property="quantity" column="quantity" />
|
||||
<result property="price" column="price" />
|
||||
<result property="taxRate" column="tax_rate" />
|
||||
|
|
@ -59,8 +59,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
t1.tax_rate,
|
||||
t1.tax_total,
|
||||
t1.amount_total,
|
||||
t1.inner_status,
|
||||
t1.delivery_date,
|
||||
t1.inner_quantity,
|
||||
t2.type as product_type,t2.model as product_model,t2.description as product_description
|
||||
FROM
|
||||
oms_purchase_order_item t1 left join product_info t2 on t1.product_code = t2.product_code
|
||||
|
|
@ -165,6 +165,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
t1.quantity,
|
||||
t1.price,
|
||||
t1.amount_total,
|
||||
t1.tax_total,
|
||||
t1.tax_rate,
|
||||
t1.id as item_id,
|
||||
|
||||
t2.warehouse_id,
|
||||
t3.description as product_desc
|
||||
|
||||
|
|
@ -189,6 +193,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
|
||||
</select>
|
||||
<select id="listByItemId" resultType="com.ruoyi.sip.domain.OmsPurchaseOrderItem">
|
||||
<include refid="selectOmsPurchaseOrderItemVo"/>
|
||||
inner JOIN oms_purchase_order_item opoi ON t1.purchase_id = opoi.purchase_id
|
||||
WHERE opoi.id = #{itemId};
|
||||
</select>
|
||||
|
||||
<insert id="insertOmsPurchaseOrder" parameterType="OmsPurchaseOrder" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into oms_purchase_order
|
||||
|
|
@ -341,6 +350,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
where purchase_no = #{purchaseNo}
|
||||
</update>
|
||||
<update id="updateOmsPurchaseOrderItem">
|
||||
update oms_purchase_order_item
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="innerQuantity != null">inner_quantity = #{innerQuantity},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteOmsPurchaseOrderById" parameterType="Long">
|
||||
delete from oms_purchase_order where id = #{id}
|
||||
|
|
@ -365,9 +381,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</delete>
|
||||
|
||||
<insert id="batchOmsPurchaseOrderItem">
|
||||
insert into oms_purchase_order_item( purchase_id, product_code, inner_status, quantity, price, tax_rate, tax_total, amount_total,delivery_date) values
|
||||
insert into oms_purchase_order_item( purchase_id, product_code, inner_quantity, quantity, price, tax_rate, tax_total, amount_total,delivery_date) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.purchaseId}, #{item.productCode}, #{item.innerStatus}, #{item.quantity},
|
||||
( #{item.purchaseId}, #{item.productCode}, #{item.innerQuantity}, #{item.quantity},
|
||||
#{item.price}, #{item.taxRate}, #{item.taxTotal}, #{item.amountTotal}, #{item.deliveryDate})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
|
|
|||
Loading…
Reference in New Issue