Commit 0db191ff by liuyang

2024-05-29 销售出库单

parent 357b8919
......@@ -109,6 +109,8 @@ public class HGConstant {
public static final String CW_CONTRACT_NO = "CW_CONTRACT_NO";
public static final String CW_SETTLEMENT_NO = "CW_SETTLEMENT_NO";
// 销售出库单号
public static final String SALE_OUT_CODE = "SALE_OUT_CODE";
}
/**
......
......@@ -210,14 +210,14 @@ public class HGSqlConstant {
* @author:songx
* @date:2024/1/20,16:45
*/
public class HPKC004 {
public class HGKC004 {
// 统计
public static final String STAT_DATE = "HPKC004.statDate";
public static final String STAT_DATE = "HGKC004.statDate";
// 锁
public static final String LOCK = "HPKC004.lock";
public static final String LOCK = "HGKC004.lock";
// 修改打印状态
public static final String UPDATE_PRINT = "HPKC004.updatePrint";
public static final String UPDATE_PRINT = "HGKC004.updatePrint";
}
/**
......
package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.kc.domain.HGKC004;
import com.baosight.hggp.hg.kc.domain.HGKC004A;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sb.domain.HGSB002;
import com.baosight.hggp.hg.sb.tools.HGSBTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.util.*;
/**
* @author LiuYang
* @version 1.0 2024/5/28
*/
public class ServiceHGKC004 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
EiInfo outEiInfo = super.initLoad(inInfo,new HGKC004());
CommonMethod.initBlock(outEiInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID,DdynamicEnum.COMPANY_BOX_BLOCK_ID), null, false);
return outEiInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
String receiptDate = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC004.FIELD_RECEIPT_DATE);
if (CollectionUtils.isNotEmpty(Collections.singleton(receiptDate))) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC004.FIELD_RECEIPT_DATE, DateUtils.formatShort(receiptDate));
}
return super.query(inInfo, HGKC004.QUERY, new HGKC004());
}
@OperationLogAnnotation(operModul = "销售出库单",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HGKC004 hgsb004 = new HGKC004();
hgsb004.fromMap(map);
hgsb004.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGKC004.DELETE_FLAG, hgsb004);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "销售出库单",operType = "保存",operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<Map> detailRows = inInfo.getBlock(CommonConstant.Field.DETAIL).getRows();
// 写入数据
for (Map resultRow : resultRows) {
HGKC004 hgkc004 = new HGKC004();
hgkc004.fromMap(resultRow);
if (hgkc004.getId() == null || hgkc004.getId() == 0) {
this.add(hgkc004);
List<HGKC004> list = this.dao.query(HGKC004A.QUERY,hgkc004);
if (CollectionUtils.isEmpty(list)){
throw new PlatException("保存失败,请刷新后重试!");
}
this.addDetail(detailRows, list.get(0).getId());
} else {
this.modify(hgkc004);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
@OperationLogAnnotation(operModul = "销售出库单",operType = "新增",operDesc = "新增操作")
public void add(HGKC004 hgkc004) {
//生成工序编码
hgkc004.setSaleOutCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.SALE_OUT_CODE));
hgkc004.setReceiptDate(DateUtils.formatShort(DateUtils.date()));
DaoUtils.insert(HGKC004.INSERT, hgkc004);
}
/**
* 修改操作
*/
@OperationLogAnnotation(operModul = "销售出库单",operType = "修改",operDesc = "修改操作")
public void modify(HGKC004 hgkc004) {
DaoUtils.update(HGKC004.UPDATE, hgkc004);
}
/**
* 新增销售出库明细
* @param list
*/
public void addDetail(List<Map> list,Long parentId) {
for (Map map : list) {
HGKC004A hgkc004A = new HGKC004A();
hgkc004A.fromMap(map);
hgkc004A.setParentId(parentId);
HGPZ005 hgpz005 = HGPZTools.HgPz005.getBySpec(hgkc004A.getInventCode(), hgkc004A.getSpec());
if (hgpz005 == null) {
throw new PlatException("存货档案不能为空!");
}
hgkc004A.setInventName(hgpz005.getInventName());
hgkc004A.setInventType(hgpz005.getInventType());
BigDecimal weight = BigDecimal.ZERO;
if (hgkc004A.getQuantity().compareTo(BigDecimal.ZERO) < 0) {
hgkc004A.setQuantity(BigDecimal.ZERO);
}
if (hgkc004A.getUnitWeight().compareTo(BigDecimal.ZERO) < 0) {
hgkc004A.setUnitWeight(BigDecimal.ZERO);
}
weight = hgkc004A.getQuantity().multiply(hgkc004A.getUnitWeight());
hgkc004A.setWeight(weight);
DaoUtils.insert(HGKC004A.INSERT, hgkc004A);
}
}
@OperationLogAnnotation(operModul = "销售出库单",operType = "修改",operDesc = "修改状态操作")
public EiInfo updateStatus(EiInfo inInfo){
int i = 0;
try {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HGKC004 hgkc004 = new HGKC004();
hgkc004.fromMap(map);
DaoUtils.update(HGKC004.UPDATE_STATUS, hgkc004);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "提交失败");
return inInfo;
}
return inInfo;
}
}
package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.kc.domain.HGKC004;
import com.baosight.hggp.hg.kc.domain.HGKC004A;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/5/28
*/
public class ServiceHGKC004A extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
EiInfo outEiInfo = super.query(inInfo, HGKC004A.QUERY,new HGKC004A());
CommonMethod.initBlock(outEiInfo, Arrays.asList(DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID,DdynamicEnum.INVENT_RECORD_BLOCK_ID), null, false);
return outEiInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
return super.query(inInfo,HGKC004A.QUERY,new HGKC004A());
}
@OperationLogAnnotation(operModul = "销售出库明细",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
int status = Integer.parseInt(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC004.FIELD_STATUS));
if (status==1) {
throw new PlatException("单据状态为已提交,不能删除!");
}
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HGKC004A hgsb004a = new HGKC004A();
hgsb004a.fromMap(map);
hgsb004a.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGKC004A.DELETE_FLAG, hgsb004a);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 保存操作
*/
@OperationLogAnnotation(operModul = "销售出库明细",operType = "保存",operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
Long parentId = Long.valueOf(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC004A.FIELD_PARENT_ID));
int status = Integer.parseInt(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC004.FIELD_STATUS));
// 写入数据
for (Map resultRow : resultRows) {
HGKC004A hgkc004A = new HGKC004A();
hgkc004A.fromMap(resultRow);
if (hgkc004A.getId() == null || hgkc004A.getId() == 0) {
hgkc004A.setParentId(parentId);
this.add(hgkc004A);
} else {
if (status==1) {
throw new PlatException("单据状态为已提交,不能修改!");
}
this.modify(hgkc004A);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HGKC004A hgkc004A) {
/*HGPZ005 hgpz005 = HGPZTools.HgPz005.getBySpec(hgkc004A.getInventCode(), hgkc004A.getSpec());
if (hgpz005 == null) {
throw new PlatException("存货档案不能为空!");
}
hgkc004A.setInventName(hgpz005.getInventName());
hgkc004A.setInventType(hgpz005.getInventType());
BigDecimal weight = BigDecimal.ZERO;
if (hgkc004A.getQuantity().compareTo(BigDecimal.ZERO) < 0){
hgkc004A.setQuantity(BigDecimal.ZERO);
}
if (hgkc004A.getUnitWeight().compareTo(BigDecimal.ZERO) < 0){
hgkc004A.setUnitWeight(BigDecimal.ZERO);
}
weight = hgkc004A.getQuantity().multiply(hgkc004A.getUnitWeight());
hgkc004A.setWeight(weight);*/
DaoUtils.insert(HGKC004A.INSERT, hgkc004A);
}
/**
* 修改操作
*/
public void modify(HGKC004A hgkc004A) {
hgkc004A.setAmount(hgkc004A.getQuantity().multiply(hgkc004A.getPrice()));
DaoUtils.update(HGKC004A.UPDATE, hgkc004A);
}
}
......@@ -213,6 +213,88 @@ public class HGKCTools {
}
/**
* HPKC004 公共方法定义
*
* @author:songx
* @date:2024/1/31,16:36
*/
public static class HgKc004 {
/**
* 锁
*
* @param saleNos
* @return
*/
public static void lock(List<String> saleNos) {
if (org.springframework.util.CollectionUtils.isEmpty(saleNos)) {
return;
}
Map queryMap = new HashMap();
queryMap.put("saleOutCodes", saleNos);
DaoBase.getInstance().update(HGSqlConstant.HGKC004.LOCK, queryMap);
}
/**
* 查询销售出库信息
*
* @param ids
* @return
*/
public static List<HGKC004> listById(List<Long> ids) {
if (org.springframework.util.CollectionUtils.isEmpty(ids)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
return DaoBase.getInstance().query(HGKC004.QUERY, queryMap);
}
/**
* 查询销售出库信息
*
* @param saleNos
* @return
*/
public static List<HGKC004> list(List<String> saleNos) {
if (org.springframework.util.CollectionUtils.isEmpty(saleNos)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("saleOutCodes", saleNos);
return DaoBase.getInstance().query(HGKC004.QUERY, queryMap);
}
/**
* 查询销售出库信息
*
* @param saleNos
* @return
*/
public static Map<String, HGKC004> map(List<String> saleNos) {
List<HGKC004> results = list(saleNos);
if (org.springframework.util.CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HGKC004::getSaleOutCode, item -> item));
}
/**
* 修改打印状态
*
* @param ids
*/
public static void updatePrint(List<Long> ids) {
if (org.springframework.util.CollectionUtils.isEmpty(ids)) {
return;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
DaoUtils.update(HGSqlConstant.HGKC004.UPDATE_PRINT, queryMap);
}
}
/**
* HGKC010 工具类
*
* @author:songx
......
......@@ -20,6 +20,8 @@
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC001.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC002.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC003.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC004.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC004A.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC010.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC011.xml"/>
<!-- 质量 -->
......
$(function () {
IPLATUI.EFGrid = {
"result": {
columns: [{
field: "operator",
title: "操作",
template: function (item) {
let auditStatus = item.status;
let template = '';
if (!isBlank(item.id)){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ', ' + item.status + ')" >销售出库单详情</a>';
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',1)" >已提交</a>';
} else if (auditStatus == -1) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',0)" >未提交</a>';
}
}
return template;
}
},],
loadComplete: function (grid) {
},
onSave: function (e) {
// 阻止后台保存请求,使用自定义保存
e.preventDefault();
save();
},
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'delete' ){
query();
}
}
}
// 查询
$("#QUERY").on("click", query);
// 导出打印
//$("#PRINT").on("click", exportPrint);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
/*$.each(rows, function(index, item) {
let inventType= item.get("inventType");
let inventName= item.get("inventName");
let length= item.get("length");
let width= item.get("width");
let thick= item.get("thick");
let status= item.get("status");
if(isBlank(inventType)){
message("选中的第"+(index+1)+"行\"存货类型\",不能为空!");
flag = false;
return false;
}
if(isBlank(inventName)){
message("选中的第"+(index+1)+"行\"存货名称\",不能为空!");
flag = false;
return false;
}
if(isBlank(status)){
message("选中的第"+(index+1)+"行\"状态\",不能为空!");
flag = false;
return false;
}
if(!isBlank(length) && !isNumber(length)){
message("选中的第" + (i + 1) + "行\"长\",必须是数值!");
flag = false;
return false;
}
if(!isBlank(width) && !isNumber(width)){
message("选中的第" + (i + 1) + "行\"宽\",必须是数值!");
flag = false;
return false;
}
if(!isBlank(thick) && !isNumber(thick)){
message("选中的第" + (i + 1) + "行\"厚\",必须是数值!");
flag = false;
return false;
}
});*/
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC004", "save", true);
}
});
}
}
function updateStatus(id,deviceStatus) {
JSUtils.confirm("确定是否\"提交\"操作? ", {
ok: function () {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
inEiInfo.set("result-0-status", deviceStatus);
EiCommunicator.send('HGKC004', 'updateStatus', inEiInfo, {
onSuccess(response) {
if (response.status == 1){
NotificationUtil(response.msg);
query();
}else {
NotificationUtil(response.msg, "error");
}
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
}
)
}
});
}
/**
* 显示详情
*/
function showDetail(id,status) {
JSColorbox.open({
href: "HGKC004A?methodName=initLoad&inqu_status-0-parentId=" + id+"&inqu_status-0-status="+status,
title: "<div style='text-align: center;'>销售出库单明细</div>",
width: "80%",
height: "80%",
});
}
/**
* 挑选库存回调
*/
let selectStockCallback = function () {
// 刷新页面
query();
// 关闭弹窗
JSColorbox.close();
}
/**
* 导出打印
*/
let exportPrint = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择同一个项目的数据")
return;
}
let saleIds = [];
let projCodeTemp;
for (let i = 0; i < rows.length; i++) {
let companyCode = rows[i]['companyCode'];
if (projCodeTemp == null) {
projCodeTemp = companyCode;
} else if (projCodeTemp != companyCode) {
message("第" + (i + 1) + "行项目不一致,请选择同一个项目的数据");
return;
}
saleIds.push(rows[i]['id']);
}
let parameter = {
"saleOutCodes": saleIds
};
window.location = IPLATUI.CONTEXT_PATH + "/HP/KC/HPKC90.jsp?route=1&parameter="
+ encodeURI(encodeURI(JSON.stringify(parameter)));
}
function returnApply(){
//重置全局变量
ids = [];
let rows = resultGrid.getCheckedRows()
if (rows.length < 1) {
message("请至少选择一条需要退货的数据");
return;
}
let factoryCodes = null;
let flag = true;
$.each(rows, function(index, item) {
let isReturn= item.get("isReturn");
if(isReturn == 1){
IPLAT.alert({
message : "选中的出库单已申请退货!",
okFn : function(e) {
},
title : '错误'
});
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"申请退货\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPKC004", "returnApply", true);
query();
}
});
}
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/5/28
Time: 11:33
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="销售出库单">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect blockId="inqu_status" row="0" ename="companyCode" cname="公司名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="receiptDate" cname="单据日期" colWidth="3"
format="yyyy-MM-dd"/>
<EF:EFInput blockId="inqu_status" row="0" ename="saleOutCode" cname="销售出库单号" colWidth="3" placeholder="模糊查询"/>
<EF:EFSelect blockId="inqu_status" row="0" ename="whCode" cname="仓库名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="210" align="center"/>
<EF:EFComboColumn ename="companyCode" enable="true" cname="公司名称" width="110" align="center"
filter="contains" readonly="true" required="true">
<EF:EFOptions blockId="companyBox_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="receiptDate" cname="单据日期" enable="true" width="90" align="center"
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="saleOutCode" cname="销售出库单号" enable="false" width="140" align="center"/>
<EF:EFComboColumn ename="whCode" cname="仓库名称" enable="true" width="120" align="center" required="true"
blockName="wh_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFComboColumn ename="status" cname="状态" width="80" align="center" enable="false" defaultValue="0" required="true">
<EF:EFCodeOption codeName="hggp.hgkc.status"/>
</EF:EFComboColumn>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function() {
var inventTypeBox = __eiInfo.getBlock("invent_type_box_block_id").getMappedRows();
var inventRecordBox = __eiInfo.getBlock("invent_record_block_id").getMappedRows();
// 查询
$("#QUERY").on("click", query);
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200]
},
columns: [/*{
field: "operator",
title: "操作",
template: function (item) {
let status = item.status;
let template = '';
if (item.id){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showFlowDetail(' + item.id + ',\''+item.inventCode+'\','+item.flowId+')" >工艺流程</a>';
if (item.flowId>0){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ')" >工艺流程详情</a>';
}
}
return template;
}
}, */{
field: "inventCode",
title: "存货名称",
template: function (dataItem) {
for (let i = 0; i < inventRecordBox.length; i++) {
if (inventRecordBox[i]['valueField'] === dataItem['inventCode']){
dataItem['inventName'] = inventRecordBox[i]['textField']
return inventRecordBox[i]['textField'];
}
}
return dataItem["inventCode"];
}
}, {
field: "inventType",
filter: function (options) {
return _.filter(inventTypeBox, function (item) {
return item["param1Field"]=="true";
})
},
editor: function (container, options) {
this.filter(options);
}
}, {
field: "spec",
template: function (options) {
return $.trim(options.spec) == "" ? "无规格" : options.spec;
}
}, {
field: "length",
template: function (options) {
return options.length == 0 ? "-" : options.length;
}
}, {
field: "width",
template: function (options) {
return options.width == 0 ? "-" : options.width;
}
}, {
field: "thick",
template: function (options) {
return options.thick == 0 ? "-" : options.thick;
}
}, {
field: "price",
template: function (options) {
options.amount = options.quantity*options.price;
return options.price
}
}, {
field: "amount",
template: function (options) {
if (options.quantity != 0){
options.price = options.amount/options.quantity;
}
return options.amount;
}
}],
loadComplete: function(grid) {
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field == "price") {
loadChange(grid,e,"amount");
}else if (e.field == "amount") {
if (e.items[0].price==0){
loadChange(grid,e,"price");
}
}
});
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'delete' ){
query();
}
},
onSave: function (e) {
// 阻止后台保存请求,使用自定义保存
e.preventDefault();
save();
},
onDelete: function (e) {
// 阻止后台删除请求,使用自定义删除
//e.preventDefault();
//deleteFunc();
}
}
downKeyUp();
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let price= item.get("price");
let amount= item.get("amount");
if(!isBlank(price) && !isNumber(price)){
message("选中的第" + (index + 1) + "行\"单价\",必须是数值!");
flag = false;
return false;
}
if(!isBlank(amount) && !isNumber(amount)){
message("选中的第" + (index + 1) + "行\"金额\",必须是数值!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC004A", "save", true);
}
});
}
}
/**
* 删除
*/
let deleteFunc = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC004A", "delete", true);
}
});
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/5/28
Time: 11:35
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script>
var ctx = "${ctx}";
</script>
<EF:EFPage title="存货档案">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect cname="存货类型" ename="inqu_status-0-inventType" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="invent_type_box_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput cname="存货名称" ename="inventName" blockId="inqu_status" row="0" colWidth="3" placeholder="模糊查询"/>
<%--<EF:EFSelect blockId="inqu_status" row="0" ename="status" cname="状态" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.status"/>
</EF:EFSelect>--%>
<EF:EFInput blockId="inqu_status" row="0" ename="status" cname="状态" colWidth="3" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="parentId" cname="上级ID" colWidth="3" type="hidden"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<%--<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="140" align="center"/>--%>
<EF:EFComboColumn ename="inventType" cname="存货类型" enable="true" width="120" align="center" required="true"
blockName="invent_type_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true"
filter="contains">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventCode" cname="存货名称" enable="true" width="120" align="center" required="true"
blockName="invent_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true"
filter="contains">
</EF:EFComboColumn>
<EF:EFColumn ename="spec" cname="规格" width="120" enable="true" readonly="true" align="center" maxLength="50"/>
<EF:EFColumn ename="length" cname="长度(MM)" enable="true" readonly="true" width="100" align="right" format="{0:N2}" maxLength="10"/>
<EF:EFColumn ename="width" cname="宽度(MM)" enable="true" readonly="true" width="100" align="right" format="{0:N2}" maxLength="10"/>
<EF:EFColumn ename="thick" cname="厚度(MM)" enable="true" readonly="true" width="100" align="right" format="{0:N2}" maxLength="10"/>
<EF:EFColumn ename="quantity" cname="数量" enable="true" readonly="true" width="100" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
<EF:EFColumn ename="unitWeight" cname="单重" width="100" enable="true" readonly="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
<EF:EFColumn ename="weight" cname="重量" width="100" enable="true" readonly="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
<EF:EFColumn ename="price" cname="单价" width="100" enable="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
<EF:EFColumn ename="amount" cname="金额" width="100" enable="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
</EF:EFGrid>
</EF:EFRegion>
<EF:EFWindow id="openFile">
<EF:EFRegion id="upload" title="文件导入区">
<div id="button"></div>
<EF:EFUpload ename="fileUpload" cname="导入" docTag="HGPZ005" path="pz"/>
</EF:EFRegion>
</EF:EFWindow>
</EF:EFPage>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment