Commit c30de553 by zhangtw

入库物料明细统计

入库明细显示物料名bug
parent 36733eb3
...@@ -49,3 +49,11 @@ export function delInbound_items(id) { ...@@ -49,3 +49,11 @@ export function delInbound_items(id) {
method: 'delete' method: 'delete'
}) })
} }
// 统计入库单明细
export function inbound_details(){
return request({
url: '/inventory/inbound_items/details',
method: 'get'
})
}
...@@ -615,6 +615,8 @@ export default { ...@@ -615,6 +615,8 @@ export default {
}) })
this.open = true this.open = true
this.title = "修改入库单" this.title = "修改入库单"
}).finally(() => {
this.inboundOrderId = null
}) })
}, },
/** 查看详情 */ /** 查看详情 */
...@@ -627,6 +629,8 @@ export default { ...@@ -627,6 +629,8 @@ export default {
this.detailForm = response.data this.detailForm = response.data
this.detailForm.inboundOrderId = id this.detailForm.inboundOrderId = id
this.detailOpen = true this.detailOpen = true
}).finally(() => {
this.detailForm.inboundOrderId = null
}) })
}, },
// 打开物料选择弹窗 // 打开物料选择弹窗
...@@ -767,6 +771,7 @@ export default { ...@@ -767,6 +771,7 @@ export default {
}) })
} else { } else {
addInbound(submitData).then(response => { addInbound(submitData).then(response => {
console.log(submitData)
this.$message.success("新增成功") this.$message.success("新增成功")
this.open = false this.open = false
this.getList() this.getList()
......
...@@ -302,7 +302,7 @@ export default { ...@@ -302,7 +302,7 @@ export default {
}, },
{ prop: 'plannedQuantity', label: '计划数量', width: '100', type: 'number', editable: true }, { prop: 'plannedQuantity', label: '计划数量', width: '100', type: 'number', editable: true },
{ prop: 'actualQuantity', label: '实际数量', width: '100', type: 'number', editable: true }, { prop: 'actualQuantity', label: '实际数量', width: '100', type: 'number', editable: true },
{ prop: 'plannedPackages', label: '计划件数', width: '100', type: 'number', editable: true }, // { prop: 'plannedPackages', label: '计划件数', width: '100', type: 'number', editable: true },
{ prop: 'actualPackages', label: '实际件数', width: '100', type: 'number', editable: true }, { prop: 'actualPackages', label: '实际件数', width: '100', type: 'number', editable: true },
{ prop: 'divisor', label: '约数', width: '100', type: 'number', editable: true }, { prop: 'divisor', label: '约数', width: '100', type: 'number', editable: true },
{ prop: 'labelColor', label: '标签颜色', width: '100', type: 'select', editable: true }, { prop: 'labelColor', label: '标签颜色', width: '100', type: 'select', editable: true },
...@@ -320,6 +320,8 @@ export default { ...@@ -320,6 +320,8 @@ export default {
}, },
data() { data() {
return { return {
showSearch: true, showSearch: true,
loading: false, loading: false,
selectedRows: [], selectedRows: [],
...@@ -389,7 +391,6 @@ export default { ...@@ -389,7 +391,6 @@ export default {
inboundOrderId: { inboundOrderId: {
immediate: true, immediate: true,
handler(newVal) { handler(newVal) {
console.log('inboundOrderId 变化:', newVal)
// 核心:过滤 null/空值,只在有效时执行逻辑 // 核心:过滤 null/空值,只在有效时执行逻辑
if (!newVal) return if (!newVal) return
this.loadRelatedData(newVal) this.loadRelatedData(newVal)
...@@ -412,9 +413,7 @@ export default { ...@@ -412,9 +413,7 @@ export default {
methods: { methods: {
// 根据字典类型和值,获取对应的listClass(标签样式) // 根据字典类型和值,获取对应的listClass(标签样式)
getDictListClass(dictType, value) { getDictListClass(dictType, value) {
console.log(value)
const dictList = this.dict.type[dictType] || [] const dictList = this.dict.type[dictType] || []
console.log(dictList)
if (!value) return 'info' if (!value) return 'info'
const dictItem = dictList.find(item => item.value === value+"") const dictItem = dictList.find(item => item.value === value+"")
...@@ -445,7 +444,9 @@ export default { ...@@ -445,7 +444,9 @@ export default {
this.queryParams.inboundOrderId = inboundOrderId this.queryParams.inboundOrderId = inboundOrderId
listInbound_itemsAndMname(this.queryParams).then(response => { listInbound_itemsAndMname(this.queryParams).then(response => {
this.displayData = response.rows.map(item => ({ this.displayData = response.rows.map(item => ({
...item, ...item,
materialName: item.materialName,
editable: false, editable: false,
tempId: item.id || Date.now() + Math.random() tempId: item.id || Date.now() + Math.random()
})) }))
...@@ -454,6 +455,8 @@ export default { ...@@ -454,6 +455,8 @@ export default {
this.loading = false this.loading = false
}).catch(() => { }).catch(() => {
this.loading = false this.loading = false
}).finally(() => {
}) })
}, },
......
...@@ -5,6 +5,7 @@ import java.util.UUID; ...@@ -5,6 +5,7 @@ import java.util.UUID;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.inventory.domain.InboundOrderItems; import com.ruoyi.inventory.domain.InboundOrderItems;
import com.ruoyi.inventory.domain.vo.InboundDetailsVO;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -131,4 +132,16 @@ public class InboundOrderItemsController extends BaseController ...@@ -131,4 +132,16 @@ public class InboundOrderItemsController extends BaseController
String message = inboundOrderItemsService.importInboundOrderItems(inboundOrderItems, updateSupport, operName); String message = inboundOrderItemsService.importInboundOrderItems(inboundOrderItems, updateSupport, operName);
return success(message); return success(message);
} }
/**
* 统计入库单物料明细
*/
@PreAuthorize("@ss.hasPermi('inventory:inbound_items:list')")
@GetMapping("/details")
public TableDataInfo itemDetails(InboundDetailsVO inboundDetailsVO) throws Exception
{
startPage();
List<InboundDetailsVO> list = inboundOrderItemsService.selectInboundDetailsVOBySapNo();
return getDataTable(list);
}
} }
package com.ruoyi.inventory.domain.vo;
import com.ruoyi.common.annotation.Excel;
import java.util.Date;
public class InboundDetailsVO {
private static final long serialVersionUID = 1L;
@Excel(name = "物料sapNo")
private String materialId;
@Excel(name = "物料名")
private String materialName;
@Excel(name = "入库单号")
private String orderId;
@Excel(name = "批次ID")
private String batchId;
@Excel(name = "仓库ID")
private String warehouseId;
@Excel(name = "库位ID")
private String locationId;
@Excel(name = "入库数量")
private Long actualQuantity;
@Excel(name = "件数")
private Long actualPackages;
@Excel(name = "标签颜色")
private String labelColor;
@Excel(name = "单价")
private Double unitPrice;
@Excel(name = "入库物料总价")
private Double totalPrice;
@Excel(name = "备注")
private String remark;
@Excel(name = "入库时间")
private Date inboundDate;
public String getMaterialId() {
return materialId;
}
public void setMaterialId(String materialId) {
this.materialId = materialId;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public String getBatchId() {
return batchId;
}
public void setBatchId(String batchId) {
this.batchId = batchId;
}
public String getWarehouseId() {
return warehouseId;
}
public void setWarehouseId(String warehouseId) {
this.warehouseId = warehouseId;
}
public String getLocationId() {
return locationId;
}
public void setLocationId(String locationId) {
this.locationId = locationId;
}
public Long getActualQuantity() {
return actualQuantity;
}
public void setActualQuantity(Long actualQuantity) {
this.actualQuantity = actualQuantity;
}
public Long getActualPackages() {
return actualPackages;
}
public void setActualPackages(Long actualPackages) {
this.actualPackages = actualPackages;
}
public String getLabelColor() {
return labelColor;
}
public void setLabelColor(String labelColor) {
this.labelColor = labelColor;
}
public Double getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(Double unitPrice) {
this.unitPrice = unitPrice;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Double getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(Double totalPrice) {
this.totalPrice = totalPrice;
}
public Date getInboundDate() {
return inboundDate;
}
public void setInboundDate(Date inboundDate) {
this.inboundDate = inboundDate;
}
@Override
public String toString() {
return "InboundDetailsVO{" +
"sapNo='" + materialId + '\'' +
", materialName='" + materialName + '\'' +
", orderId='" + orderId + '\'' +
", batchId='" + batchId + '\'' +
", warehouseId='" + warehouseId + '\'' +
", locationId='" + locationId + '\'' +
", actualQuantity=" + actualQuantity +
", actualPackages=" + actualPackages +
", labelColor='" + labelColor + '\'' +
", unitPrice=" + unitPrice +
", totalPrice=" + totalPrice +
", remark='" + remark + '\'' +
", inboundDate=" + inboundDate +
'}';
}
}
...@@ -2,6 +2,7 @@ package com.ruoyi.inventory.mapper; ...@@ -2,6 +2,7 @@ package com.ruoyi.inventory.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.inventory.domain.InboundOrderItems; import com.ruoyi.inventory.domain.InboundOrderItems;
import com.ruoyi.inventory.domain.vo.InboundDetailsVO;
/** /**
* 入库单明细Mapper接口 * 入库单明细Mapper接口
...@@ -66,4 +67,10 @@ public interface InboundOrderItemsMapper ...@@ -66,4 +67,10 @@ public interface InboundOrderItemsMapper
* @return 结果 * @return 结果
*/ */
public int deleteInboundOrderItemsByIds(String[] ids); public int deleteInboundOrderItemsByIds(String[] ids);
/**
* 统计入库单明细
* @return 结果
*/
public List<InboundDetailsVO> selectInboundDetailsVOBySapNo();
} }
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
import com.ruoyi.common.core.domain.entity.Materials; import com.ruoyi.common.core.domain.entity.Materials;
import com.ruoyi.inventory.domain.InboundOrderItems; import com.ruoyi.inventory.domain.InboundOrderItems;
import com.ruoyi.inventory.domain.vo.InboundDetailsVO;
/** /**
* 入库单明细Service接口 * 入库单明细Service接口
...@@ -68,4 +69,10 @@ public interface IInboundOrderItemsService ...@@ -68,4 +69,10 @@ public interface IInboundOrderItemsService
* @return 结果 * @return 结果
*/ */
public String importInboundOrderItems(List<InboundOrderItems> inboundOrderItems, Boolean isUpdateSupport, String operName); public String importInboundOrderItems(List<InboundOrderItems> inboundOrderItems, Boolean isUpdateSupport, String operName);
/**
* 统计入库单明细
* @return 结果
*/
public List<InboundDetailsVO> selectInboundDetailsVOBySapNo();
} }
...@@ -10,6 +10,7 @@ import com.ruoyi.common.exception.ServiceException; ...@@ -10,6 +10,7 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.inventory.domain.vo.InboundDetailsVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.InboundOrderItemsMapper; import com.ruoyi.inventory.mapper.InboundOrderItemsMapper;
...@@ -173,4 +174,9 @@ public class InboundOrderItemsServiceImpl implements IInboundOrderItemsService ...@@ -173,4 +174,9 @@ public class InboundOrderItemsServiceImpl implements IInboundOrderItemsService
} }
return successMsg.toString(); return successMsg.toString();
} }
@Override
public List<InboundDetailsVO> selectInboundDetailsVOBySapNo() {
return inboundOrderItemsMapper.selectInboundDetailsVOBySapNo();
}
} }
...@@ -240,6 +240,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService ...@@ -240,6 +240,7 @@ public class InboundOrdersServiceImpl implements IInboundOrdersService
itemDO.setId(UUID.randomUUID().toString()); itemDO.setId(UUID.randomUUID().toString());
itemDO.setMaterialId(vo.getSapNo()); itemDO.setMaterialId(vo.getSapNo());
itemDO.setOrderId(orderId); // 关联入库单号 itemDO.setOrderId(orderId); // 关联入库单号
itemDO.setBatchId(mainDO.getBatchId());
itemDO.setInboundOrderId(mainDO.getId()); // 关联主表ID(核心!) itemDO.setInboundOrderId(mainDO.getId()); // 关联主表ID(核心!)
itemDO.setCreateBy(operId); itemDO.setCreateBy(operId);
itemDO.setCreateTime(now); itemDO.setCreateTime(now);
......
...@@ -299,4 +299,64 @@ ...@@ -299,4 +299,64 @@
<result property="inboundOrderId" column="inbound_order_id" /> <result property="inboundOrderId" column="inbound_order_id" />
<result property="materialName" column="material_name" /> <result property="materialName" column="material_name" />
</resultMap> </resultMap>
<resultMap id="InboundDetailsResultMap" type="com.ruoyi.inventory.domain.vo.InboundDetailsVO">
<!-- 基础字段映射 -->
<result column="material_id" property="materialId" jdbcType="VARCHAR" />
<result column="material_name" property="materialName" jdbcType="VARCHAR" />
<result column="order_id" property="orderId" jdbcType="VARCHAR" />
<result column="batch_id" property="batchId" jdbcType="VARCHAR" />
<result column="warehouse_id" property="warehouseId" jdbcType="VARCHAR" />
<result column="location_id" property="locationId" jdbcType="VARCHAR" />
<!-- 数值型字段 -->
<result column="actual_quantity" property="actualQuantity" jdbcType="BIGINT" />
<result column="actual_packages" property="actualPackages" jdbcType="BIGINT" />
<!-- 字符串/枚举类字段 -->
<result column="label_color" property="labelColor" jdbcType="VARCHAR" />
<!-- 金额字段 -->
<result column="unit_price" property="unitPrice" jdbcType="DOUBLE" />
<result column="total_price" property="totalPrice" jdbcType="DOUBLE" />
<!-- 备注字段 -->
<result column="remark" property="remark" jdbcType="VARCHAR" />
<!-- 日期字段(指定日期格式化) -->
<result column="inbound_date" property="inboundDate"/>
</resultMap>
<select id="selectInboundDetailsVOBySapNo" resultMap="InboundDetailsResultMap">
SELECT
ioi.material_id,
ms.material_name,
ioi.order_id,
ioi.batch_id,
ioi.warehouse_id,
ioi.location_id,
SUM(ioi.actual_quantity) AS actual_quantity,
SUM(ioi.actual_packages) AS actual_packages,
ioi.label_color,
ioi.unit_price,
SUM(ioi.unit_price * ioi.actual_quantity) AS total_price,
ioi.remark,
io.inbound_date
FROM inbound_orders io
INNER JOIN inbound_order_items ioi ON io.id = ioi.inbound_order_id
INNER JOIN materials ms ON ms.sap_no = ioi.material_id
WHERE io.order_status = 2
GROUP BY
ioi.material_id,
ioi.batch_id,
ioi.warehouse_id,
ioi.location_id,
ms.material_name,
ioi.order_id,
ioi.label_color,
ioi.unit_price,
ioi.remark,
io.inbound_date
order by ioi.order_id asc,ioi.material_id asc
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论