diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java index 7f02469d..7b1fca45 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -4,6 +4,11 @@ import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.date.DateUtil; +import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.sip.domain.OmsFileLog; +import com.ruoyi.sip.service.IOmsFileLogService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -35,6 +40,8 @@ public class CommonController @Autowired private ServerConfig serverConfig; + @Autowired + private IOmsFileLogService fileLogService; private static final String FILE_DELIMETER = ","; @@ -84,7 +91,17 @@ public class CommonController // 上传并返回新文件名称 String fileName = FileUploadUtils.upload(filePath, file); String url = serverConfig.getUrl() + fileName; + OmsFileLog omsFileLog =OmsFileLog.builder() + .url(url) + .fileName(fileName) + .newFilename(FileUtils.getName(fileName)) + .originalFilename(file.getOriginalFilename()) + .createBy(ShiroUtils.getUserId().toString()) + .createTime(DateUtil.date()) + .build(); + fileLogService.insert(omsFileLog); AjaxResult ajax = AjaxResult.success(); + ajax.put("id", omsFileLog.getId()); ajax.put("url", url); ajax.put("fileName", fileName); ajax.put("newFileName", FileUtils.getName(fileName)); diff --git a/ruoyi-admin/src/main/resources/templates/inventory/execution/edit.html b/ruoyi-admin/src/main/resources/templates/inventory/execution/edit.html index 2906ef9f..5201791c 100644 --- a/ruoyi-admin/src/main/resources/templates/inventory/execution/edit.html +++ b/ruoyi-admin/src/main/resources/templates/inventory/execution/edit.html @@ -104,7 +104,7 @@ display: none !important; } - +
@@ -543,8 +543,8 @@ function initWarehouseTable(data) { field: 'warehouseName', title: '仓库', formatter: function (value, row, index) { - var html = $.common.sprintf("" + - "", index, row.warehouseId, index, row.confirmQuantity); + var html = $.common.sprintf("" + , index, row.warehouseId); return value + html; } }, @@ -560,37 +560,52 @@ function initWarehouseTable(data) { { field: 'confirmQuantity', title: '本次提交出库', - editable: { - type: 'number', - min: 0, - title: '本次提交出库', - emptytext: "【本次提交出库】为空", - validate: function (value) { - if (!value) { - return '数量不能空'; - } - if (value > Number.MAX_VALUE) { - return '数量不能超过' + Number.MAX_VALUE; - } - if (value < 0) { - return '数量不能为负数'; - } - }, - toggleDisabled: function (isEnable) { - if (isEnable) { - console.log("enable") - this.enable();// 可编辑 - } else { - console.log("disable") - this.disabled();// 不可编辑 - } - } + formatter: function (value, row, index) { + return $.common.sprintf("", index, value, row.availableCount); } + + // editable: { + // type: 'number', + // min: 0, + // title: '本次提交出库', + // emptytext: "【本次提交出库】为空", + // validate: function (value) { + // if (!value) { + // return '数量不能空'; + // } + // if (value > Number.MAX_VALUE) { + // return '数量不能超过' + Number.MAX_VALUE; + // } + // if (value < 0) { + // return '数量不能为负数'; + // } + // }, + // toggleDisabled: function (isEnable) { + // if (isEnable) { + // console.log("enable") + // this.enable();// 可编辑 + // } else { + // console.log("disable") + // this.disabled();// 不可编辑 + // } + // } + // } }] }; $.table.init(options); } + function onEdit(value) { + let totalConfirmQuantity = 0; + $("input[name$='confirmQuantity']").each(function () { + let val = $(this).val(); + if (val && !isNaN(val)) { + totalConfirmQuantity += Number(val); + } + }); + $('#out-current-quantity').text(totalConfirmQuantity) + $('#out-current-quantity-commit').val(totalConfirmQuantity) + } function onEditableSave(field, row, rowIndex, oldValue, $el) { if (!row['defaultWarehouse'] && row[field] > row['availableCount']) { @@ -667,6 +682,31 @@ function initWarehouseTable(data) { content: $('#generateOuter'), // 捕获的元素 btn: ['确定', '关闭'], yes: function (index, layero, that) { + let totalConfirmQuantity = 0; + let errFlag = false; + $("input[name$='confirmQuantity']").each(function () { + let val = $(this).val(); + if (val && !isNaN(val)) { + if (Number(val) <= 0) { + errFlag = true; + } + totalConfirmQuantity += Number(val); + } + }); + if (errFlag) { + $.modal.msgError("本次提交出库数量应大于0") + return; + } + if (totalConfirmQuantity <= 0) { + $.modal.msgError("本次提交出库数量应大于0") + return; + } + let generateNumber = $('#out-generatedQuantity').text(); + let allTotal = totalConfirmQuantity + Number(generateNumber) + if (allTotal > Number($('#out-quantity').text())) { + $.modal.msgError("本次提交出库数量+已提交出库数量不能大于应出库数量") + return; + } $('#deliveryTime').attr('disabled', false); $.operate.post(outerPrefix + "/add", $('#generateOuterForm').serializeArray(), res => { refreshTable(); @@ -680,7 +720,7 @@ function initWarehouseTable(data) { // layer.msg('关闭后的回调', {icon:6}); } }); - layer.full(index); + // layer.full(index); }) } @@ -884,7 +924,7 @@ function initWarehouseTable(data) { // layer.msg('关闭后的回调', {icon:6}); } }); - layer.full(index); + // layer.full(index); }) } diff --git a/ruoyi-admin/src/main/resources/templates/inventory/inner/add.html b/ruoyi-admin/src/main/resources/templates/inventory/inner/add.html index 05b8cc3d..860cdfea 100644 --- a/ruoyi-admin/src/main/resources/templates/inventory/inner/add.html +++ b/ruoyi-admin/src/main/resources/templates/inventory/inner/add.html @@ -1,5 +1,5 @@ - + @@ -8,7 +8,7 @@ padding-right: 0px; } - +
@@ -42,16 +42,44 @@
+
+
+ +
+ +
+
+
+
+
+ +
+
+ +
+ + +
+
+ + +
+
+

产品信息

@@ -165,6 +193,7 @@