完成了 BOM 管理和生产管理,完成部分发料单、采购计划和调拨单。
This commit is contained in:
@@ -21,4 +21,22 @@
|
||||
<result column="reserve2" property="reserve2" />
|
||||
</resultMap>
|
||||
|
||||
<select id="getBomItemListByBomId" parameterType="Long" resultType="com.niuan.erp.module.production.controller.dto.BomItemDto">
|
||||
SELECT b.PartNumber, p.ProductType, p.ProductSpecs, p.ProductPacksize, p.ProductBrand,
|
||||
b.ManufactureCount, b.ItemPosition, b.SameUseCount, b.ProductMark
|
||||
FROM bom b
|
||||
INNER JOIN product p ON b.PartNumber = p.PartNumber
|
||||
WHERE b.BomId = ${bomId}
|
||||
</select>
|
||||
|
||||
<select id="getBomItemListByBomIdAndPartNumber" parameterType="Long" resultType="com.niuan.erp.module.production.controller.dto.BomItemDto">
|
||||
SELECT b.PartNumber, p.ProductType, p.ProductSpecs, p.ProductPacksize, p.ProductBrand,
|
||||
b.ManufactureCount, b.ItemPosition, b.SameUseCount, b.ProductMark
|
||||
FROM bom b
|
||||
INNER JOIN product p ON b.PartNumber = p.PartNumber
|
||||
<where>
|
||||
b.BomId = #{bomId} AND b.PartNumber Like CONCAT('%', #{partNumber}, '%')
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -2,25 +2,25 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.niuan.erp.module.production.mapper.BomMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.niuan.erp.module.production.entity.Bom">
|
||||
<id column="Id" property="id" />
|
||||
<result column="Status" property="status" />
|
||||
<result column="CreateDate" property="createDate" />
|
||||
<result column="CreateUserId" property="createUserId" />
|
||||
<result column="CreateUserName" property="createUserName" />
|
||||
<result column="UpdateDate" property="updateDate" />
|
||||
<result column="UpdateUserId" property="updateUserId" />
|
||||
<result column="UpdateUserName" property="updateUserName" />
|
||||
<result column="ParentId" property="parentId" />
|
||||
<result column="BomNo" property="bomNo" />
|
||||
<result column="Manufacturer" property="manufacturer" />
|
||||
<result column="BomName" property="bomName" />
|
||||
<result column="Spec" property="spec" />
|
||||
<result column="BrandName" property="brandName" />
|
||||
<result column="FormMark" property="formMark" />
|
||||
<result column="customerName" property="customerName" />
|
||||
<result column="CustomerId" property="customerId" />
|
||||
</resultMap>
|
||||
<select id="selectPageByPartNumber" resultType="com.niuan.erp.module.production.entity.Bom">
|
||||
SELECT DISTINCT b.*
|
||||
FROM bom_list b
|
||||
INNER JOIN bom i ON i.BomId = b.Id
|
||||
INNER JOIN product p ON i.PartNumber = p.PartNumber
|
||||
<where>
|
||||
<if test="searchCode != null and searchCode != ''">
|
||||
AND (b.BomNo LIKE CONCAT('%', #{searchCode}, '%')
|
||||
OR b.BomName LIKE CONCAT('%', #{searchCode}, '%'))
|
||||
</if>
|
||||
<if test="partNumber != null and searchCode != ''">
|
||||
AND i.PartNumber LIKE CONCAT('%', #{partNumber}, '%')
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY b.CreateDate DESC
|
||||
</select>
|
||||
|
||||
<select id="getBomSelectList" resultType="BaseSelectDto">
|
||||
SELECT Id, BomName FROM bom_list
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -29,4 +29,83 @@
|
||||
<result column="CustomerId" property="customerId" />
|
||||
</resultMap>
|
||||
|
||||
<select id="getProductionPlanRequiredQtyList" resultType="ProductionPlanShortageDto">
|
||||
SELECT b.Id AS id, b.PartNumber AS partNumber, MAX(pro.ProductSpecs) AS productSpecs,
|
||||
SUM(p.ProductionCount * b.ManufactureCount) AS requiredQty, COALESCE(MAX(s.ProductCount), 0) AS stockQty,
|
||||
NULL AS diffQty
|
||||
FROM produceorder p
|
||||
INNER JOIN bom b ON p.ProjectId = b.BomId
|
||||
INNER JOIN product pro ON b.PartNumber = pro.PartNumber
|
||||
LEFT JOIN storagecount s ON s.PartNumber = pro.PartNumber
|
||||
<if test="warehouseId != null">
|
||||
AND s.StoreNo = #{warehouseId}
|
||||
</if>
|
||||
<where>
|
||||
p.Id IN
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</where>
|
||||
GROUP BY b.Id, b.PartNumber, pro.ProductSpecs
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectProduceOrderData" resultType="ProduceOrderList">
|
||||
SELECT
|
||||
d.Id,
|
||||
d.PartNumber AS Partnumber,
|
||||
d.ProductSpecs AS Productspecs,
|
||||
a.StoreNo,
|
||||
b.SameUseCount,
|
||||
b.SameUseNum1 AS SameNum1,
|
||||
b.SameUseNum2 AS SameNum2,
|
||||
b.SameUseNum3 AS SameNum3,
|
||||
b.ManufactureCount AS BomTotal,
|
||||
a.ProductionCount AS OrderTotal,
|
||||
|
||||
<!-- 1. 主料库存 -->
|
||||
COALESCE(f_main.ProductCount, 0) AS MainStock,
|
||||
|
||||
<!-- 2. 替换料1库存 (根据 SameNum1 关联) -->
|
||||
COALESCE(f_sub1.ProductCount, 0) AS Sub1Stock,
|
||||
|
||||
<!-- 3. 替换料2库存 (根据 SameNum2 关联) -->
|
||||
COALESCE(f_sub2.ProductCount, 0) AS Sub2Stock,
|
||||
|
||||
<!-- 4. 替换料3库存 (根据 SameNum3 关联) -->
|
||||
COALESCE(f_sub3.ProductCount, 0) AS Sub3Stock,
|
||||
|
||||
<!-- 占用数量 (示例设为0,实际请根据表结构补充) -->
|
||||
0 AS OccupyTotal
|
||||
|
||||
FROM produceorder a
|
||||
INNER JOIN bom b ON a.ProjectId = b.BomId
|
||||
INNER JOIN product d ON b.PartNumber = d.PartNumber AND d.CustomerId = a.CustomerId
|
||||
|
||||
<!-- 关联主料库存 -->
|
||||
LEFT JOIN storagecount f_main
|
||||
ON a.StoreNo = f_main.StoreNo AND b.PartNumber = f_main.PartNumber
|
||||
|
||||
<!-- 关联替换料1库存 -->
|
||||
LEFT JOIN storagecount f_sub1
|
||||
ON a.StoreNo = f_sub1.StoreNo AND b.SameUseNum1 = f_sub1.PartNumber
|
||||
|
||||
<!-- 关联替换料2库存 -->
|
||||
LEFT JOIN storagecount f_sub2
|
||||
ON a.StoreNo = f_sub2.StoreNo AND b.SameUseNum2 = f_sub2.PartNumber
|
||||
|
||||
<!-- 关联替换料3库存 -->
|
||||
LEFT JOIN storagecount f_sub3
|
||||
ON a.StoreNo = f_sub3.StoreNo AND b.SameUseNum3 = f_sub3.PartNumber
|
||||
|
||||
<where>
|
||||
a.Id IN
|
||||
<foreach item="itemId" collection="ids" open="(" separator="," close=")">
|
||||
#{itemId}
|
||||
</foreach>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
11
src/main/resources/mapper/sys/RolePermissionMapper.xml
Normal file
11
src/main/resources/mapper/sys/RolePermissionMapper.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.niuan.erp.module.sys.mapper.RolePermissionMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.niuan.erp.module.sys.entity.RolePermission">
|
||||
<id column="role_id" property="roleId" />
|
||||
<id column="permission_id" property="permissionId" />
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
37
src/main/resources/mapper/sys/SysPermissionMapper.xml
Normal file
37
src/main/resources/mapper/sys/SysPermissionMapper.xml
Normal file
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.niuan.erp.module.sys.mapper.SysPermissionMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.niuan.erp.module.sys.entity.SysPermission">
|
||||
<id column="id" property="id" />
|
||||
<result column="parent_id" property="parentId" />
|
||||
<result column="status" property="status" />
|
||||
<result column="create_date" property="createDate" />
|
||||
<result column="create_user_id" property="createUserId" />
|
||||
<result column="create_user_name" property="createUserName" />
|
||||
<result column="update_date" property="updateDate" />
|
||||
<result column="update_user_id" property="updateUserId" />
|
||||
<result column="update_user_name" property="updateUserName" />
|
||||
<result column="permission_name" property="permissionName" />
|
||||
<result column="permission_i18n" property="permissionI18n" />
|
||||
<result column="permission_type" property="permissionType" />
|
||||
<result column="page_link" property="pageLink" />
|
||||
<result column="view_link" property="viewLink" />
|
||||
<result column="permission_code" property="permissionCode" />
|
||||
<result column="event_name" property="eventName" />
|
||||
<result column="class_name" property="className" />
|
||||
<result column="icon_name" property="iconName" />
|
||||
<result column="sort" property="sort" />
|
||||
<result column="hidden" property="hidden" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByUserId" parameterType="Long" resultMap="BaseResultMap">
|
||||
SELECT p.* FROM sys_permission p
|
||||
LEFT JOIN role_permission rp ON rp.permission_id = p.id
|
||||
LEFT JOIN yy_sysrole r ON r.Id = rp.role_id
|
||||
LEFT JOIN yy_usersrolemapping ur ON ur.RoleId = r.Id
|
||||
WHERE ur.UserId = #{userId} AND r.status = 1 AND p.status = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -22,4 +22,30 @@
|
||||
<result column="ProductOccupyTotal" property="productOccupyTotal" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectPageByParams" resultType="com.niuan.erp.module.warehouse.controller.dto.StockDto">
|
||||
SELECT s.StoreName as storeName, p.ProductType as productType, p.PartNumber as partNumber,
|
||||
p.ProductSpecs as productSpecs, p.ProductPacking as productPacking, p.ProductBrand as productBrand,
|
||||
p.ProductPackSize as productPackSize, c.ProductCount as productCount, null as storeId, null as searchCode
|
||||
FROM product p
|
||||
INNER JOIN storagecount c ON p.PartNumber = c.PartNumber
|
||||
INNER JOIN storage_list s ON s.Id = c.StoreNo
|
||||
<where>
|
||||
<if test="searchParams != null">
|
||||
<if test="searchParams.productType != null and searchParams.productType != ''">
|
||||
AND p.ProductType = #{searchParams.productType}
|
||||
</if>
|
||||
<if test="searchParams.productBrand != null and searchParams.productBrand != ''">
|
||||
AND p.ProductBrand = #{searchParams.productBrand}
|
||||
</if>
|
||||
<if test="searchParams.storeId != null">
|
||||
AND s.Id = #{searchParams.storeId}
|
||||
</if>
|
||||
<if test="searchParams.searchCode != null and searchParams.searchCode != ''">
|
||||
AND (p.PartNumber LIKE CONCAT("%", #{searchParams.searchCode}, "%")
|
||||
OR p.ProductSpecs LIKE CONCAT("%", #{searchParams.searchCode}, "%"))
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.niuan.erp.module.warehouse.mapper.StockTransferOrderMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.niuan.erp.module.warehouse.entity.StockTransferOrder">
|
||||
<id column="Id" property="id" />
|
||||
<result column="Status" property="status" />
|
||||
<result column="CreateDate" property="createDate" />
|
||||
<result column="CreateUserId" property="createUserId" />
|
||||
<result column="CreateUserName" property="createUserName" />
|
||||
<result column="UpdateDate" property="updateDate" />
|
||||
<result column="UpdateUserId" property="updateUserId" />
|
||||
<result column="UpdateUserName" property="updateUserName" />
|
||||
<result column="StoreNo" property="storeNo" />
|
||||
<result column="StoreName" property="storeName" />
|
||||
<result column="FormType" property="formType" />
|
||||
<result column="FormCode" property="formCode" />
|
||||
<result column="FormName" property="formName" />
|
||||
<result column="FormStatus" property="formStatus" />
|
||||
<result column="FormMark" property="formMark" />
|
||||
<result column="reserve1" property="reserve1" />
|
||||
<result column="reserve2" property="reserve2" />
|
||||
<result column="VendorNo" property="vendorNo" />
|
||||
<result column="VendorName" property="vendorName" />
|
||||
<result column="TotalValue" property="totalValue" />
|
||||
<result column="OutStoreNo" property="outStoreNo" />
|
||||
<result column="OutStoreName" property="outStoreName" />
|
||||
<result column="GroupId" property="groupId" />
|
||||
<result column="CustomerId" property="customerId" />
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
@@ -32,5 +32,25 @@
|
||||
<result column="ProductOccupyTotal" property="productOccupyTotal" />
|
||||
<result column="CustomerId" property="customerId" />
|
||||
</resultMap>
|
||||
|
||||
<select id="getProductTypeSelectList" resultType="java.lang.String">
|
||||
SELECT DISTINCT ProductType FROM product
|
||||
</select>
|
||||
|
||||
<select id="getProductBrandSelectList" resultType="java.lang.String">
|
||||
SELECT DISTINCT ProductBrand FROM product
|
||||
</select>
|
||||
|
||||
<select id="getWarehouseItemStockListByPartNumbers" resultType="java.util.Map">
|
||||
SELECT p.PartNumber AS partNumber, COALESCE(s.ProductCount, 0) AS productCount
|
||||
FROM product p
|
||||
LEFT JOIN storagecount s ON p.PartNumber = s.PartNumber
|
||||
<where>
|
||||
p.PartNumber IN
|
||||
<foreach collection="partNumbers" item="partNumber" open="(" separator=", " close=")">
|
||||
#{partNumber}
|
||||
</foreach>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -21,4 +21,8 @@
|
||||
<result column="CustomerId" property="customerId" />
|
||||
</resultMap>
|
||||
|
||||
<select id="getWarehouseSelectList" resultType="com.niuan.erp.common.base.BaseSelectDto">
|
||||
SELECT Id, StoreName FROM storage_list
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user