mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-05 04:03:45 +09:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -38,11 +38,14 @@
|
||||
|
||||
<!-- insert -->
|
||||
<insert id="createProcess" parameterType="InDto">
|
||||
INSERT INTO product_in (id, product_id, in_date, quantity, warehouse_id, manager_id, note, activation)
|
||||
VALUES (UUID(), #{product_id}, #{in_date}, #{quantity}, #{warehouse_id}, #{manager_id}, #{note}, 1)
|
||||
INSERT INTO product_in (id, product_id, in_date, quantity, warehouse_id, manager_id, note, activation)
|
||||
VALUES (UUID(), #{product_id}, #{in_date}, #{quantity}, #{warehouse_id}, #{manager_id}, #{note}, 1)
|
||||
</insert>
|
||||
|
||||
|
||||
<insert id="createStockProcess" parameterType="InDto">
|
||||
INSERT INTO stock (id, warehouse_id, product_id, quantity, activation)
|
||||
VALUES (UUID(), #{warehouse_id}, #{product_id}, #{quantity}, 1)
|
||||
</insert>
|
||||
|
||||
|
||||
<!-- update -->
|
||||
@@ -52,13 +55,30 @@
|
||||
warehouse_id = #{warehouse_id}, manager_id = #{manager_id}, note = #{note}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<update id="deactivateById" parameterType="String">
|
||||
UPDATE product_in
|
||||
SET activation = 0
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateStockProcessForUpdate" parameterType="InDto">
|
||||
UPDATE stock
|
||||
SET quantity = #{quantity}
|
||||
WHERE warehouse_id = #{warehouse_id} AND product_id = #{product_id} and activation = 1
|
||||
</update>
|
||||
|
||||
<update id="updateStockProcess" parameterType="InDto">
|
||||
UPDATE stock
|
||||
SET quantity = quantity + #{quantity}
|
||||
WHERE warehouse_id = #{warehouse_id} AND product_id = #{product_id} and activation = 1
|
||||
</update>
|
||||
|
||||
<update id="updateWarehouseQuantity" parameterType="Map">
|
||||
update warehouse set current_capacity = #{updateValue} where id = #{warehouseId} and activation = 1
|
||||
</update>
|
||||
|
||||
<!-- delete -->
|
||||
|
||||
<!-- select -->
|
||||
<select id="count" parameterType="map" resultType="int">
|
||||
SELECT COUNT(*)
|
||||
@@ -141,19 +161,29 @@
|
||||
|
||||
<select id="checkIfExistsStock" resultType="int" parameterType="InDto">
|
||||
SELECT COUNT(*) FROM stock
|
||||
WHERE warehouse_id = #{warehouse_id} AND product_id = #{product_id}
|
||||
WHERE warehouse_id = #{warehouse_id} AND product_id = #{product_id} and activation = 1
|
||||
</select>
|
||||
|
||||
<update id="updateStockProcess" parameterType="InDto">
|
||||
UPDATE stock
|
||||
SET quantity = quantity + #{quantity}
|
||||
WHERE warehouse_id = #{warehouse_id} AND product_id = #{product_id}
|
||||
</update>
|
||||
|
||||
<insert id="createStockProcess" parameterType="InDto">
|
||||
INSERT INTO stock (id, warehouse_id, product_id, quantity, activation)
|
||||
VALUES (UUID(), #{warehouse_id}, #{product_id}, #{quantity}, 1)
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
<select id="currntStockQuantity" parameterType="InDto" resultType="int">
|
||||
SELECT quantity
|
||||
FROM stock
|
||||
WHERE warehouse_id = #{warehouse_id} AND product_id = #{product_id} and activation = 1
|
||||
</select>
|
||||
|
||||
<select id="currntInQuantity" parameterType="InDto" resultType="int">
|
||||
SELECT quantity
|
||||
FROM product_in
|
||||
WHERE id = #{id} and activation = 1
|
||||
</select>
|
||||
|
||||
<select id="selectWarehouseQuantity" parameterType="String" resultType="String">
|
||||
select sum(quantity) from stock where warehouse_id = #{warehouseId} and activation = 1
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -66,8 +66,9 @@
|
||||
and plan.warehouse_id = warehouse.id and product.kan_code = product_category.kan_code
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 1"> plan.activation = 1 and pn like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 0"> plan.activation = 1 and plan.group_number like concat('%',#{search},'%') </when>
|
||||
<when test="searchn == 0"> plan.activation = 1 and plan.view_group_number like concat('%',#{search},'%') </when>
|
||||
<when test="searchn == 1"> plan.activation = 1 and product.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> plan.activation = 1 and plan.quantity like concat(#{search})</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by plan.view_group_number desc limit #{start}, #{perPage}
|
||||
|
||||
@@ -37,10 +37,11 @@
|
||||
|
||||
|
||||
<select id="outOne" parameterType="Map" resultType="Map">
|
||||
select o.id as id, p.name as product_name, p.kan_code, o.quantity, w.name as warehouse_name, w.id as warehouse_id, p.id as product_id, o.expected_delivery_date, o.delivery_date, o.note
|
||||
select o.id as id, p.name as product_name, p.kan_code, o.quantity as outQuantity, s.quantity as stockQuantity, w.name as warehouse_name, w.id as warehouse_id, p.id as product_id, o.expected_delivery_date, o.delivery_date, o.note
|
||||
from product_out o
|
||||
left join warehouse w on o.warehouse_id = w.id
|
||||
left join product p on o.product_id = p.id
|
||||
left join warehouse w on o.warehouse_id = w.id
|
||||
left join stock s on o.product_id = s.product_id and o.warehouse_id = s.warehouse_id
|
||||
|
||||
where o.id = #{id}
|
||||
</select>
|
||||
@@ -119,6 +120,12 @@
|
||||
set quantity = #{quantity}, expected_delivery_date = #{expected_delivery_date}, delivery_date = #{delivery_date}
|
||||
where id = #{id};
|
||||
</update>
|
||||
|
||||
<update id="stockQuantityUpdate" parameterType="com.no1.wms.out.ProductOutDto">
|
||||
update stock
|
||||
set quantity = quantity - #{quantity}
|
||||
where product_id = #{product_id} and warehouse_id = #{warehouse_id};
|
||||
</update>
|
||||
<!-- update -->
|
||||
|
||||
|
||||
@@ -136,4 +143,9 @@
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<!-- delete -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -27,6 +27,7 @@
|
||||
<when test="searchn == 0">s.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1">s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2">s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 3">s.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
@@ -44,6 +45,7 @@
|
||||
<when test="searchn == 0">s.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1">s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2">s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 3">s.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by s.id desc limit #{start}, #{perPage}
|
||||
@@ -62,6 +64,7 @@
|
||||
<when test="searchn == 0"> quantity <= 200 and s.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> quantity <= 200 and s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> quantity <= 200 and s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 3">s.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
@@ -79,13 +82,22 @@
|
||||
<when test="searchn == 0"> quantity <= 200 and s.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> quantity <= 200 and s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> quantity <= 200 and s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 3">s.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by s.id desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="stockOne" parameterType="Map" resultType="Map">
|
||||
select s.id as id, s.warehouse_id as warehouseId, s.product_id as productId, s.quantity, p.name as productName, p.kan_code, c.cls_nm_4, w.name as warehouseName, p.company_name, w.address, w.capacity, w.current_capacity
|
||||
select s.id as id,
|
||||
s.warehouse_id as warehouseId,
|
||||
s.product_id as productId, s.quantity,
|
||||
p.name as productName,
|
||||
p.kan_code, c.cls_nm_4, w.name as warehouseName,
|
||||
p.company_name,
|
||||
w.address,
|
||||
w.capacity,
|
||||
(SELECT SUM(s.quantity) FROM stock s WHERE s.warehouse_id = w.id) AS current_capacity
|
||||
|
||||
from stock s
|
||||
left join warehouse w on s.warehouse_id = w.id
|
||||
@@ -98,7 +110,6 @@
|
||||
<select id="productSelect" parameterType="Map" resultType="Map">
|
||||
SELECT p.id as productId, name, company_name, cls_Nm_4, p.kan_code
|
||||
FROM product p
|
||||
LEFT JOIN stock s ON s.product_id = p.id
|
||||
left join product_category c on p.kan_code = c.kan_code
|
||||
<where>
|
||||
<choose>
|
||||
@@ -113,7 +124,6 @@
|
||||
<select id="productCount" parameterType="Map" resultType="java.lang.Integer">
|
||||
SELECT count(name)
|
||||
FROM product p
|
||||
LEFT JOIN stock s ON s.product_id = p.id
|
||||
left join product_category c on p.kan_code = c.kan_code
|
||||
<where>
|
||||
<choose>
|
||||
@@ -125,15 +135,18 @@
|
||||
</select>
|
||||
|
||||
<select id="warehouseSelect" parameterType="Map" resultType="Map">
|
||||
select w.id as warehouseId, w.name as warehouseName, capacity, current_capacity ,address
|
||||
select w.id as warehouseId,
|
||||
w.name as warehouseName,
|
||||
capacity,
|
||||
(SELECT SUM(s.quantity) FROM stock s WHERE s.warehouse_id = w.id) AS current_capacity ,
|
||||
address
|
||||
from warehouse w
|
||||
left join stock s on s.warehouse_id = w.id
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> (s.product_id <> #{product_id} or s.product_id is null) and w.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> (s.product_id <> #{product_id} or s.product_id is null) and w.activation = 1 and address like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> (s.product_id <> #{product_id} or s.product_id is null) and w.activation = 1 and capacity like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 0"> w.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> w.activation = 1 and address like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> w.activation = 1 and capacity like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by w.name desc limit #{start}, #{perPage}
|
||||
@@ -142,13 +155,12 @@
|
||||
<select id="warehouseCount" parameterType="Map" resultType="java.lang.Integer">
|
||||
select count(w.id)
|
||||
from warehouse w
|
||||
left join stock s on s.warehouse_id = w.id
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> (s.product_id <> #{product_id} or s.product_id is null) and w.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> (s.product_id <> #{product_id} or s.product_id is null) and w.activation = 1 and address like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> (s.product_id <> #{product_id} or s.product_id is null) and w.activation = 1 and capacity like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 0"> w.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> w.activation = 1 and address like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> w.activation = 1 and capacity like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
@@ -198,4 +210,24 @@
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<!-- delete -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="checkIfExistsStock" resultType="int" parameterType="com.no1.wms.stock.StockDto">
|
||||
SELECT COUNT(*) FROM stock
|
||||
WHERE warehouse_id = #{warehouseId} AND product_id = #{productId}
|
||||
</select>
|
||||
|
||||
<update id="updateStockProcess" parameterType="com.no1.wms.stock.StockDto">
|
||||
UPDATE stock
|
||||
SET quantity = quantity + #{quantity}
|
||||
WHERE warehouse_id = #{warehouseId} AND product_id = #{productId}
|
||||
</update>
|
||||
|
||||
<insert id="createStockProcess" parameterType="com.no1.wms.stock.StockDto">
|
||||
INSERT INTO stock (id, warehouse_id, product_id, quantity, activation)
|
||||
VALUES (UUID(), #{warehouseId}, #{productId}, #{quantity}, 1)
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -5,7 +5,7 @@
|
||||
<mapper namespace="com.no1.wms.vendor.VendorMapper">
|
||||
|
||||
<select id="selectAll" resultType="VendorDto">
|
||||
select
|
||||
select id,
|
||||
name,
|
||||
president_name,
|
||||
address,
|
||||
@@ -14,7 +14,9 @@
|
||||
president_telephone,
|
||||
vendor_manager,
|
||||
vendor_manager_telephone,
|
||||
main_products
|
||||
main_product,
|
||||
manager_id,
|
||||
activation
|
||||
|
||||
from vendor;
|
||||
</select>
|
||||
@@ -108,7 +110,12 @@
|
||||
<!-- insert -->
|
||||
<insert id="createVendor" parameterType="VendorDto">
|
||||
insert into vendor (id, name, president_name, address, registration_number, email, president_telephone, vendor_manager, vendor_manager_telephone, main_product, manager_id, activation)
|
||||
values (UUID(), #{name}, #{president_name}, #{address}, #{registration_number}, #{email}, #{president_telephone}, #{vendor_manager}, #{vendor_manager_telephone}, #{main_product}, #{manager_id}, #{activation})
|
||||
values (UUID(), #{name}, #{president_name}, #{address}, #{registration_number}, #{email}, #{president_telephone}, #{vendor_manager}, #{vendor_manager_telephone}, #{main_product}, #{manager_id}, 1)
|
||||
</insert>
|
||||
|
||||
<insert id="createProcess" parameterType="VendorDto">
|
||||
insert into vendor (id, name, president_name, address, registration_number, email, president_telephone, vendor_manager, vendor_manager_telephone, main_product, manager_id, activation)
|
||||
values (UUID(), #{name}, #{president_name}, #{address}, #{registration_number}, #{email}, #{president_telephone}, #{vendor_manager}, #{vendor_manager_telephone}, #{main_product}, #{manager_id}, 1)
|
||||
</insert>
|
||||
<!-- insert -->
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
|
||||
<select id="count" parameterType="map" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
select count(w.id)
|
||||
|
||||
from warehouse w
|
||||
|
||||
@@ -20,9 +20,11 @@
|
||||
</select>
|
||||
|
||||
<select id="list" parameterType="map" resultType="com.no1.wms.warehouse.WarehouseDto">
|
||||
select w.id, w.name, w.capacity, w.current_capacity as currentCapacity
|
||||
|
||||
from warehouse w
|
||||
SELECT w.id,
|
||||
w.name,
|
||||
w.capacity,
|
||||
(SELECT SUM(s.quantity) FROM stock s WHERE s.warehouse_id = w.id) AS current_capacity
|
||||
FROM warehouse w
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
@@ -35,7 +37,7 @@
|
||||
</select>
|
||||
|
||||
<select id="One" parameterType="String" resultType="com.no1.wms.warehouse.WarehouseDto">
|
||||
select w.id, w.name, w.capacity, w.current_capacity as currentCapacity, w.address
|
||||
select w.id, w.name, w.capacity, (SELECT SUM(s.quantity) FROM stock s WHERE s.warehouse_id = w.id) AS current_capacity, w.address
|
||||
|
||||
from warehouse w
|
||||
|
||||
|
||||
Reference in New Issue
Block a user