mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 19:54:00 +09:00
#수정
재고량이 수정되어 예약된 출고량보다 낮아지면 즉시 출고 안됨
This commit is contained in:
@@ -37,10 +37,11 @@
|
|||||||
|
|
||||||
|
|
||||||
<select id="outOne" parameterType="Map" resultType="Map">
|
<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
|
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 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}
|
where o.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
@@ -103,7 +104,7 @@
|
|||||||
|
|
||||||
<update id="updateWarehouseDeleteStock" parameterType="com.no1.wms.out.ProductOutDto">
|
<update id="updateWarehouseDeleteStock" parameterType="com.no1.wms.out.ProductOutDto">
|
||||||
update warehouse
|
update warehouse
|
||||||
set current_capacity = current_capacity - #{quantity}
|
set current_capacity = current_capacity - #{outQuantity}
|
||||||
where id = #{warehouse_id};
|
where id = #{warehouse_id};
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
@@ -116,13 +117,13 @@
|
|||||||
|
|
||||||
<update id="outNowUpdate" parameterType="com.no1.wms.out.ProductOutDto">
|
<update id="outNowUpdate" parameterType="com.no1.wms.out.ProductOutDto">
|
||||||
update product_out
|
update product_out
|
||||||
set quantity = #{quantity}, expected_delivery_date = #{expected_delivery_date}, delivery_date = #{delivery_date}
|
set quantity = #{outQuantity}, expected_delivery_date = #{expected_delivery_date}, delivery_date = #{delivery_date}
|
||||||
where id = #{id};
|
where id = #{id};
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="stockQuantityUpdate" parameterType="com.no1.wms.out.ProductOutDto">
|
<update id="stockQuantityUpdate" parameterType="com.no1.wms.out.ProductOutDto">
|
||||||
update stock
|
update stock
|
||||||
set quantity = quantity - #{quantity}
|
set quantity = quantity - #{outQuantity}
|
||||||
where product_id = #{product_id} and warehouse_id = #{warehouse_id};
|
where product_id = #{product_id} and warehouse_id = #{warehouse_id};
|
||||||
</update>
|
</update>
|
||||||
<!-- update -->
|
<!-- update -->
|
||||||
|
|||||||
@@ -37,8 +37,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-group mb-3 w-40 col-centered">
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
<span id='quantity_name' class="input-group-text">출고량</span>
|
<span id='stockQuantity_name' class="input-group-text">재고량</span>
|
||||||
<input readonly id="quantity" type="text" class="form-control" placeholder="수량을 입력하세요" value="${dto.quantity}">
|
<input readonly id="stockQuantity" type="text" class="form-control" placeholder="수량을 입력하세요" value="${dto.stockQuantity}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='outQuantity_name' class="input-group-text">출고량</span>
|
||||||
|
<input readonly id="outQuantity" type="text" class="form-control" placeholder="수량을 입력하세요" value="${dto.outQuantity}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--창고 관련 -->
|
<!--창고 관련 -->
|
||||||
@@ -214,7 +219,8 @@
|
|||||||
|
|
||||||
function outNowUpdate() {
|
function outNowUpdate() {
|
||||||
var id = $("#id").val();
|
var id = $("#id").val();
|
||||||
var quantity = $("#quantity").val();
|
var stockQuantity = parseInt($("#stockQuantity").val(), 10);
|
||||||
|
var outQuantity = parseInt($("#outQuantity").val(), 10);
|
||||||
var product_id = $("#product_id").val()
|
var product_id = $("#product_id").val()
|
||||||
var warehouse_id = $("#warehouse_id").val();
|
var warehouse_id = $("#warehouse_id").val();
|
||||||
var expected_delivery_date = $("#expected_delivery_date").val();
|
var expected_delivery_date = $("#expected_delivery_date").val();
|
||||||
@@ -222,12 +228,17 @@
|
|||||||
var now = new Date();
|
var now = new Date();
|
||||||
var delivery_date = now.toISOString().slice(0, 19).replace('T', ' ');
|
var delivery_date = now.toISOString().slice(0, 19).replace('T', ' ');
|
||||||
|
|
||||||
|
if (outQuantity > stockQuantity) {
|
||||||
|
alert("출고량이 재고량을 넘을 수 없습니다.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/out/outNow",
|
url: "/out/outNow",
|
||||||
type: "put",
|
type: "put",
|
||||||
data: {
|
data: {
|
||||||
"id": id,
|
"id": id,
|
||||||
"quantity": quantity,
|
"outQuantity": outQuantity,
|
||||||
"product_id":product_id,
|
"product_id":product_id,
|
||||||
"warehouse_id": warehouse_id,
|
"warehouse_id": warehouse_id,
|
||||||
"expected_delivery_date": expected_delivery_date,
|
"expected_delivery_date": expected_delivery_date,
|
||||||
|
|||||||
@@ -34,10 +34,14 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="input-group mb-3 w-40 col-centered">
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
<span id='shipment_quantity_label' class="input-group-text">출고량</span>
|
<span id='stockQuantity_name' class="input-group-text">재고량</span>
|
||||||
<input id="quantity" type="text" class="form-control" placeholder="수량을 입력하세요" value="${dto.quantity}">
|
<input readonly id="stockQuantity" type="text" class="form-control" placeholder="수량을 입력하세요" value="${dto.stockQuantity}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='outQuantity_name' class="input-group-text">출고량</span>
|
||||||
|
<input readonly id="outQuantity" type="text" class="form-control" placeholder="수량을 입력하세요" value="${dto.outQuantity}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!--창고 관련 -->
|
<!--창고 관련 -->
|
||||||
@@ -103,13 +107,17 @@
|
|||||||
$("#updateBtn").on("click", function () {
|
$("#updateBtn").on("click", function () {
|
||||||
var id = $("#id").val();
|
var id = $("#id").val();
|
||||||
var product_id = $("#product_id").val();
|
var product_id = $("#product_id").val();
|
||||||
var quantity = $("#quantity").val();
|
var stockQuantity = parseInt($("#stockQuantity").val(), 10);
|
||||||
|
var outQuantity = parseInt($("#outQuantity").val(), 10);
|
||||||
var expected_delivery_date = $("#expected_delivery_date").val();
|
var expected_delivery_date = $("#expected_delivery_date").val();
|
||||||
var warehouse_id = $("#warehouse_id").val();
|
var warehouse_id = $("#warehouse_id").val();
|
||||||
var note = $("#note").val();
|
var note = $("#note").val();
|
||||||
var activation = $("#activation").val();
|
var activation = $("#activation").val();
|
||||||
|
|
||||||
|
if (outQuantity > stockQuantity) {
|
||||||
|
alert("출고량이 재고량을 넘을 수 없습니다.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!product_id) {
|
if (!product_id) {
|
||||||
alert("제품을 선택해야 합니다.");
|
alert("제품을 선택해야 합니다.");
|
||||||
@@ -130,7 +138,7 @@
|
|||||||
"expected_delivery_date":expected_delivery_date,
|
"expected_delivery_date":expected_delivery_date,
|
||||||
"note":note,
|
"note":note,
|
||||||
"warehouse_id": warehouse_id,
|
"warehouse_id": warehouse_id,
|
||||||
"quantity": quantity,
|
"quantity": outQuantity,
|
||||||
"activation": activation,
|
"activation": activation,
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user