Browse Source

[feat]仓库管理

修改暂收采购入库前端页面,按照新版prd调整:供应商不在分组,放在from表单上,暂收合格数和实际到货数加上4个校验条件,修改提交方法;
修改采购入库通知单生成采购入库单主表和仓库入库单子表的方法:加上查询供应商的方法:采购入库主表和仓库入库主表的供应商相关数据都来自供应商资料的数据
修改 暂收-采购单(采购入库) 供应商物料详情列表后端接口,不在进行分组和就加工方式的筛选:采用分页查询接口
修改 保存暂收-采购单(采购入库)后端接口,采用新流程:现在保存的时候不在生成品质单;对实际到货数和暂收合格数都要进行校验;并且,实际到货数和暂收合格数都要小于等于通知到货数
dev
liuxiaoxu 9 hours ago
parent
commit
2e9a47c282
  1. 24
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java
  2. 9
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java
  3. 56
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java
  4. 223
      ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html

24
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java

@ -1192,6 +1192,10 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
private void buildPurchaseStorage(PurchaseOrder purchaseOrder, List<PurchaseOrderChild> filterPurchaseOrderChildList, String warehouseStorageCode) { private void buildPurchaseStorage(PurchaseOrder purchaseOrder, List<PurchaseOrderChild> filterPurchaseOrderChildList, String warehouseStorageCode) {
PurchaseStorage purchaseStorage = new PurchaseStorage(); PurchaseStorage purchaseStorage = new PurchaseStorage();
String supplierCode = purchaseOrder.getSupplierCode();
SysSupplier sysSupplier = sysSupplierService.selectSysSupplierByCode(supplierCode);
PurchaseOrderChild purchaseOrderChild = filterPurchaseOrderChildList.get(0); PurchaseOrderChild purchaseOrderChild = filterPurchaseOrderChildList.get(0);
purchaseStorage.setWarehouseStorageStatus("0"); purchaseStorage.setWarehouseStorageStatus("0");
purchaseStorage.setWarehouseStorageType("5"); purchaseStorage.setWarehouseStorageType("5");
@ -1202,8 +1206,11 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
purchaseStorage.setArrivedTime(purchaseOrder.getArrivedTime()); purchaseStorage.setArrivedTime(purchaseOrder.getArrivedTime());
purchaseStorage.setRelatedOrderCode(purchaseOrder.getPurchaseOrderCode()); purchaseStorage.setRelatedOrderCode(purchaseOrder.getPurchaseOrderCode());
purchaseStorage.setSupplierCode(purchaseOrder.getSupplierCode()); purchaseStorage.setSupplierCode(supplierCode);
purchaseStorage.setSupplierName(purchaseOrder.getSupplierName()); purchaseStorage.setSupplierName(purchaseOrder.getSupplierName());
purchaseStorage.setSupplierAddress(sysSupplier.getReceiveAddress());
purchaseStorage.setContactNumber(sysSupplier.getReceivePersonPhone());
purchaseStorage.setCustomerContact(sysSupplier.getReceivePerson());
purchaseStorage.setWarehouseStorageCode(warehouseStorageCode); purchaseStorage.setWarehouseStorageCode(warehouseStorageCode);
int allNotifyArrivedNum = filterPurchaseOrderChildList.stream().mapToInt(PurchaseOrderChild::getNotifyArriveNum).sum(); int allNotifyArrivedNum = filterPurchaseOrderChildList.stream().mapToInt(PurchaseOrderChild::getNotifyArriveNum).sum();
@ -1224,6 +1231,11 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
//采购入库生成仓库入库主表数据 //采购入库生成仓库入库主表数据
private void buildWarehouseStorage(PurchaseOrder purchaseOrder, String warehouseStorageCode, List<PurchaseOrderChild> filterPurchaseOrderChildList) { private void buildWarehouseStorage(PurchaseOrder purchaseOrder, String warehouseStorageCode, List<PurchaseOrderChild> filterPurchaseOrderChildList) {
String supplierCode = purchaseOrder.getSupplierCode();
SysSupplier sysSupplier = sysSupplierService.selectSysSupplierByCode(supplierCode);
PurchaseOrderChild purchaseOrderChild = filterPurchaseOrderChildList.get(0); PurchaseOrderChild purchaseOrderChild = filterPurchaseOrderChildList.get(0);
WarehouseStorageOrder warehouseStorageOrder = new WarehouseStorageOrder(); WarehouseStorageOrder warehouseStorageOrder = new WarehouseStorageOrder();
warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode); warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode);
@ -1233,6 +1245,14 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
warehouseStorageOrder.setWarehouseQualityStatus("0"); warehouseStorageOrder.setWarehouseQualityStatus("0");
warehouseStorageOrder.setWarehouseOrderType("0"); warehouseStorageOrder.setWarehouseOrderType("0");
warehouseStorageOrder.setArrivedTime(purchaseOrder.getArrivedTime()); warehouseStorageOrder.setArrivedTime(purchaseOrder.getArrivedTime());
warehouseStorageOrder.setSupplierCode(supplierCode);
warehouseStorageOrder.setSupplierName(purchaseOrder.getSupplierName());
warehouseStorageOrder.setSupplierAddress(sysSupplier.getReceiveAddress());
warehouseStorageOrder.setContactNumber(sysSupplier.getReceivePersonPhone());
warehouseStorageOrder.setCustomerContact(sysSupplier.getReceivePerson());
int allNotifyArrivedNum = filterPurchaseOrderChildList.stream().mapToInt(PurchaseOrderChild::getNotifyArriveNum).sum(); int allNotifyArrivedNum = filterPurchaseOrderChildList.stream().mapToInt(PurchaseOrderChild::getNotifyArriveNum).sum();
int allNotifyHasArrivedNum = filterPurchaseOrderChildList.stream().mapToInt(PurchaseOrderChild::getNotifyHasArrivedNum).sum(); int allNotifyHasArrivedNum = filterPurchaseOrderChildList.stream().mapToInt(PurchaseOrderChild::getNotifyHasArrivedNum).sum();
if (allNotifyHasArrivedNum == 0){ if (allNotifyHasArrivedNum == 0){
@ -1290,6 +1310,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
}else { }else {
warehouseStorageOrderDetail.setNotifyHasArrivedNum(notifyHasArrivedNum + notifyArriveNum); warehouseStorageOrderDetail.setNotifyHasArrivedNum(notifyHasArrivedNum + notifyArriveNum);
} }
warehouseStorageOrderDetail.setNotifyArriveNum(notifyArriveNum);
warehouseStorageOrderDetailChildren.add(warehouseStorageOrderDetail); warehouseStorageOrderDetailChildren.add(warehouseStorageOrderDetail);
} }
int result = warehouseStorageOrderDetailMapper.insertBatchWarehouseStorageOrderDetail(warehouseStorageOrderDetailChildren); int result = warehouseStorageOrderDetailMapper.insertBatchWarehouseStorageOrderDetail(warehouseStorageOrderDetailChildren);
@ -1338,6 +1359,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
}else { }else {
purchaseStorageChild.setNotifyHasArrivedNum(notifyHasArrivedNum + notifyArriveNum); purchaseStorageChild.setNotifyHasArrivedNum(notifyHasArrivedNum + notifyArriveNum);
} }
purchaseStorageChild.setNotifyArriveNum(notifyArriveNum);
purchaseStorageChildren.add(purchaseStorageChild); purchaseStorageChildren.add(purchaseStorageChild);
} }
int result = purchaseStorageChildMapper.insertBatchPurchaseStorageChild(purchaseStorageChildren); int result = purchaseStorageChildMapper.insertBatchPurchaseStorageChild(purchaseStorageChildren);

9
ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java

@ -234,11 +234,10 @@ public class WarehouseStorageOrderController extends BaseController
*/ */
@ResponseBody @ResponseBody
@RequestMapping("/temporaryPurchaseDetailList") @RequestMapping("/temporaryPurchaseDetailList")
public Map<String,List<WarehouseStorageOrderDetail>> temporaryPurchaseDetail(String warehouseStorageCode){ public TableDataInfo temporaryPurchaseDetail(String warehouseStorageCode){
List<WarehouseStorageOrderDetail> allDetails = storageOrderDetailService.selectStorageOrderDetailListByCode(warehouseStorageCode); startPage();
List<WarehouseStorageOrderDetail> filterAllDetails = allDetails.stream().filter(wso -> "1".equals(wso.getMaterialDeptType())).collect(Collectors.toList()); List<WarehouseStorageOrderDetail> list = storageOrderDetailService.selectStorageOrderDetailListByCode(warehouseStorageCode);
Map<String, List<WarehouseStorageOrderDetail>> groupedDetails = filterAllDetails.stream().collect(Collectors.groupingBy(WarehouseStorageOrderDetail::getSupplierCode)); return getDataTable(list);
return groupedDetails;
} }

56
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java

@ -362,13 +362,14 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
@Override @Override
public int temporaryPurchaseSave(WarehouseStorageOrder warehouseStorageOrder) { public int temporaryPurchaseSave(WarehouseStorageOrder warehouseStorageOrder) {
//流程说明:入库部门(采购):1、采购发起【采购入库单】:2、仓库暂收【入库单】;3、采购入库【入库单】
String loginName = ShiroUtils.getLoginName(); String loginName = ShiroUtils.getLoginName();
warehouseStorageOrder.setUpdateBy(loginName); warehouseStorageOrder.setUpdateBy(loginName);
warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate()); warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate());
//改变状态为已暂收 //改变状态为已暂收
warehouseStorageOrder.setWarehouseStorageStatus("1"); warehouseStorageOrder.setWarehouseStorageStatus("2");
//设置品质状态,为待品质 //设置品质状态,为待品质
warehouseStorageOrder.setWarehouseQualityStatus("0"); //warehouseStorageOrder.setWarehouseQualityStatus("0");
warehouseStorageOrder.setWarehouseEmployee(loginName); warehouseStorageOrder.setWarehouseEmployee(loginName);
List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList(); List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
@ -385,19 +386,15 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
actualArriveNum = warehouseStorageOrderDetailList.stream().mapToInt(WarehouseStorageOrderDetail::getActualArriveNum).sum(); actualArriveNum = warehouseStorageOrderDetailList.stream().mapToInt(WarehouseStorageOrderDetail::getActualArriveNum).sum();
int temporaryQualifiedNum = 0; int temporaryQualifiedNum = 0;
//检查填写的品质合格数是否有空值 //检查填写的暂收合格数是否有空值
boolean hasTemporaryQualifiedNumNull = warehouseStorageOrderDetailList.stream() boolean hasTemporaryQualifiedNumNull = warehouseStorageOrderDetailList.stream()
.anyMatch(item -> item.getTemporaryQualifiedNum() == null); .anyMatch(item -> item.getTemporaryQualifiedNum() == null);
if (hasTemporaryQualifiedNumNull) { if (hasTemporaryQualifiedNumNull) {
throw new BusinessException("存在品质合格数为空,请检查!"); throw new BusinessException("存在暂收合格数为空,请检查!");
} }
//入库单主表的暂收合格数为子表的合计 //入库单主表的暂收合格数为子表的合计
temporaryQualifiedNum = warehouseStorageOrderDetailList.stream().mapToInt(WarehouseStorageOrderDetail::getTemporaryQualifiedNum).sum(); temporaryQualifiedNum = warehouseStorageOrderDetailList.stream().mapToInt(WarehouseStorageOrderDetail::getTemporaryQualifiedNum).sum();
if (actualArriveNum < temporaryQualifiedNum) {
throw new BusinessException("暂收合格数不能大于实际到货数");
}
//插入实际到货数 //插入实际到货数
warehouseStorageOrder.setActualArrivedNum(actualArriveNum); warehouseStorageOrder.setActualArrivedNum(actualArriveNum);
//插入暂收合格数 //插入暂收合格数
@ -425,13 +422,15 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
} }
try { //新流程,采购入库不走品质
qualityOrderService.insertQualityOrderByWarehouseStorageOrder(warehouseStorageOrder, warehouseStorageOrder.getWarehouseStorageOrderDetailList()); //
} catch (Exception e) { // try {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); // qualityOrderService.insertQualityOrderByWarehouseStorageOrder(warehouseStorageOrder, warehouseStorageOrder.getWarehouseStorageOrderDetailList());
log.error("生成品质单时发生错误", e); // } catch (Exception e) {
throw new BusinessException("生成品质单时发生错误"); // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
} // log.error("生成品质单时发生错误", e);
// throw new BusinessException("生成品质单时发生错误");
// }
return updateResult; return updateResult;
} }
@ -1147,14 +1146,33 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
for (WarehouseStorageOrderDetail detail : details) { for (WarehouseStorageOrderDetail detail : details) {
detail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); detail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode());
Integer actualArriveNum = detail.getActualArriveNum(); Integer actualArriveNum = detail.getActualArriveNum();
Integer notifyArriveNum = detail.getNotifyArriveNum();
Integer temporaryQualifiedNum = detail.getTemporaryQualifiedNum(); Integer temporaryQualifiedNum = detail.getTemporaryQualifiedNum();
//添加实际已到货数 Integer actualHasArrivedNum = detail.getActualHasArrivedNum();
Integer temporaryHasQualifiedNum = detail.getTemporaryHasQualifiedNum();
if (notifyArriveNum < temporaryQualifiedNum){
throw new BusinessException("暂收合格数要小于等于通知到货数");
}
if (notifyArriveNum < actualArriveNum){
throw new BusinessException("实际到货数要小于等于通知到货数");
}
if (actualHasArrivedNum == null || actualHasArrivedNum == 0){
detail.setActualHasArrivedNum(actualArriveNum); detail.setActualHasArrivedNum(actualArriveNum);
//添加暂收已合格数 }else {
detail.setActualHasArrivedNum(actualHasArrivedNum + actualArriveNum);
}
if (temporaryHasQualifiedNum == null || temporaryHasQualifiedNum == 0){
detail.setTemporaryHasQualifiedNum(temporaryQualifiedNum); detail.setTemporaryHasQualifiedNum(temporaryQualifiedNum);
if (actualArriveNum < temporaryQualifiedNum){ }else {
throw new BusinessException("暂收合格数要小于等于实际到货数"); detail.setTemporaryHasQualifiedNum(temporaryHasQualifiedNum + temporaryQualifiedNum);
} }
//添加实际已到货数
detail.setActualArriveNum(actualArriveNum);
//添加暂收已合格数
detail.setTemporaryQualifiedNum(temporaryQualifiedNum);
if(detail.getWarehouseStorageType() != null && detail.getWarehouseStorageType().equals("4")){ if(detail.getWarehouseStorageType() != null && detail.getWarehouseStorageType().equals("4")){
updateResultDetails += storageOrderDetailMapper.updateWarehouseStorageOrderDetail(detail); updateResultDetails += storageOrderDetailMapper.updateWarehouseStorageOrderDetail(detail);
}else { }else {

223
ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html

@ -3,6 +3,7 @@
<head> <head>
<th:block th:include="include :: header('暂收-采购单(采购入库)')" /> <th:block th:include="include :: header('暂收-采购单(采购入库)')" />
<th:block th:include="include :: datetimepicker-css" /> <th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: bootstrap-editable-css"/>
<style> <style>
.supplier-value span { .supplier-value span {
@ -35,6 +36,38 @@
</select> </select>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-4 control-label">供应商ID:</label>
<div class="col-sm-8">
<input name="supplierCode" th:field="*{supplierCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">供应商名称:</label>
<div class="col-sm-8">
<input name="supplierName" th:field="*{supplierName}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">联系人:</label>
<div class="col-sm-8">
<input name="customerContact" th:field="*{customerContact}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">联系人电话:</label>
<div class="col-sm-8">
<input name="contactNumber" th:field="*{contactNumber}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">联系人地址:</label>
<div class="col-sm-8">
<input name="supplierAddress" th:field="*{supplierAddress}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label">到货时间:</label> <label class="col-sm-4 control-label">到货时间:</label>
<div class="col-sm-8"> <div class="col-sm-8">
@ -53,6 +86,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label is-required">仓库ID:</label> <label class="col-sm-4 control-label is-required">仓库ID:</label>
<div class="col-sm-8"> <div class="col-sm-8">
@ -74,11 +108,11 @@
</div> </div>
</div> </div>
<!--物料信息-->
<div class="container"> <div class="container">
<!--供应商物料相关-->
<div class="row"> <div class="row">
<div class="col-sm-12" id="tablesContainer"> <div class="col-sm-12 select-table table-striped">
<!-- 表格将在这里动态生成 --> <table id="bootstrap-table"></table>
</div> </div>
</div> </div>
</div> </div>
@ -95,28 +129,38 @@
var warehouseDeptTypeDatas = [[${@dict.getType('warehouse_dept_type')}]]; var warehouseDeptTypeDatas = [[${@dict.getType('warehouse_dept_type')}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]]; var processMethodDatas = [[${@dict.getType('processMethod')}]];
var prefix = ctx + "warehouse/storageOrder"; var prefix = ctx + "warehouse/storageOrder";
$("#form-temporaryPurchaseWarehouse-edit").validate({ $("#form-temporaryPurchaseWarehouse-edit").validate({
focusCleanup: true focusCleanup: true
}); });
//生成的不同table的id集合
var tableDatas = []; $("input[name='arrivedTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='deliveryInspectionTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
function submitHandler() { function submitHandler() {
if ($.validate.form()) {
const storageOrderData = $("#form-temporaryPurchaseWarehouse-edit").serializeArray().reduce((obj, item) => { const storageOrderData = $("#form-temporaryPurchaseWarehouse-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value; obj[item.name] = item.value;
return obj; return obj;
}, {}); }, {});
// 初始化一个数组用于存放所有表格的数据
let allMaterialDataList = [];
for(let i in tableDatas){ var table = $('#bootstrap-table').bootstrapTable("getData");
$('#' + tableDatas[i]).each(function() {
const tableData = $(this).bootstrapTable('getData'); var materialDataList = table.map(function(item) {
console.log(JSON.stringify(tableData));
// 将表数据转换成与qualityReportData格式一致的数组
var materialDataList = tableData.map(function (item) {
// 根据实际字段名调整 // 根据实际字段名调整
return { return {
"supplierCode": item.supplierCode, "supplierCode": item.supplierCode,
@ -144,66 +188,31 @@
// ...其他字段 // ...其他字段
}; };
}); });
allMaterialDataList = allMaterialDataList.concat(materialDataList);
});
}
const combinedData = Object.assign({}, storageOrderData, { const combinedData = Object.assign({}, storageOrderData, {
warehouseStorageOrderDetailList: allMaterialDataList warehouseStorageOrderDetailList: materialDataList,
}); });
// 合并表单数据和表格数据 // 合并表单数据和表格数据
// const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData);
console.log(combinedData) console.log(combinedData)
// 使用 JSON.stringify() 序列化数据 // 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData); const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口 // 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/temporaryPurchase", jsonData); $.operate.saveJson(prefix + "/temporaryPurchase", jsonData);
} }
$("input[name='arrivedTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='deliveryInspectionTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$(function() {
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]; // 这里需要实际赋值,比如从前端某个地方读取
$.getJSON(prefix + "/temporaryPurchaseDetailList?warehouseStorageCode=" + warehouseStorageCode, function(data) {
for (var supplierCode in data) {
if (data.hasOwnProperty(supplierCode)) {
var supplierData = data[supplierCode];
createTableForSupplier(supplierCode, supplierData);
}
} }
});
});
function createTableForSupplier(supplierCode, supplierData) {
var tableId = 'bootstrap-table-' + supplierCode.replace(/[^a-z0-9]/gi, '_').toLowerCase();
tableDatas.push(tableId);
var $tableWrapper = $('<div class="table-responsive mt-3"></div>');
// 确保supplierData至少有一条记录,并从中提取供应商详细信息
var supplierInfo = supplierData.length > 0 ? supplierData[0] : {}; // 默认为空对象,以防数据不存在
// 构建含有额外供应商信息的标题字符串
var headerTitle ='供应商'+'</br>'+supplierCode + ' - ' + (supplierInfo.supplierName || 'N/A') +
' </br> ' + (supplierInfo.customerContact || 'N/A') +
' - ' + (supplierInfo.contactNumber || 'N/A') +
' - ' + (supplierInfo.supplierAddress || 'N/A');
var $header = $('<h4>' + headerTitle + '</h4>'); //物料信息展示列表
var $table = $('<table id="' + tableId + '" class="table table-striped table-bordered"></table>'); $(function() {
var options = {
$table.bootstrapTable({ modalName: "选择物料",
data: supplierData, url: prefix + "/temporaryPurchaseDetailList",
queryParams: queryParams,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
pagination: false, // 设置不分页
columns: [{ columns: [{
checkbox: true checkbox: true
}, },
@ -280,28 +289,78 @@
title: '实际到货数', title: '实际到货数',
field: 'actualArriveNum', field: 'actualArriveNum',
editable: { editable: {
type: 'text', validate: function(value) {
mode:'inline', if ($.trim(value) === '') {
validate: function (v) { return '实际到货数不能为空';
if (!v) return '数量不能为空'; }
if (isNaN(v)) return '数量必须是数字'; if (isNaN(value)) {
var processBadNum = parseInt(v); return '请输入有效的数字';
if (processBadNum < 0) return '数量必须是整数'; }
if (value < 0) {
return '实际到货数不能小于0';
}
//不能为小数
if (value % 1 !== 0) {
return '实际到货数不能为小数';
}
},
},
formatter: function (value, row) {
// 检查 row 是否存在
if (!row) {
return "";
}
// 检查 actualArriveNum 是否存在
if (row.actualArriveNum === undefined || row.actualArriveNum === null) {
return "";
}
// 根据 actualArriveNum 的值决定返回值
if (row.actualArriveNum) {
return row.actualArriveNum;
} else {
return value;
} }
} }
}, },
{ {
title: '暂收数量', title: '暂收合格数量',
field: 'temporaryQualifiedNum', field: 'temporaryQualifiedNum',
editable: { editable: {
type: 'text', validate: function(value) {
mode:'inline', if ($.trim(value) === '') {
validate: function (v) { return '暂收数不能为空';
if (!v) return '数量不能为空'; }
if (isNaN(v)) return '数量必须是数字'; if (isNaN(value)) {
var processBadNum = parseInt(v); return '请输入有效的数字';
if (processBadNum < 0) return '数量必须是整数'; }
if (value < 0) {
return '暂收数不能小于0';
}
//不能为小数
if (value % 1 !== 0) {
return '暂收数不能为小数';
}
},
},
formatter: function (value, row) {
// 检查 row 是否存在
if (!row) {
return "";
}
// 检查 temporaryQualifiedNum 是否存在
if (row.temporaryQualifiedNum === undefined || row.temporaryQualifiedNum === null) {
return "";
}
// 根据 temporaryQualifiedNum 的值决定返回值
if (row.temporaryQualifiedNum) {
return row.temporaryQualifiedNum;
} else {
return value;
} }
} }
}, },
@ -316,10 +375,16 @@
field: 'temporaryReportUrl', field: 'temporaryReportUrl',
visible: false, visible: false,
}] }]
}); };
$.table.init(options);
})
$tableWrapper.append($header).append($table); function queryParams(params) {
$('#tablesContainer').append($tableWrapper); var curParams = {
// 传递参数查询参数
warehouseStorageCode: warehouseStorageCode
};
return curParams;
} }

Loading…
Cancel
Save