Commit 1a63dea6 by liuyang

2024-05-31 调拨单

parent 59d462d3
......@@ -135,7 +135,7 @@ public enum DdynamicEnum {
* 用途:调拨单下拉框
* 编写:ly
*/
SPEC_BOX_BLOCK_ID("spec_box_block_id", "specId", "spec","length", "width","thick","invQty","invUnitWeight","invWeight", "HGKC010.querySpecIdBox"),
SPEC_BOX_BLOCK_ID("spec_box_block_id", "spec", "spec","length", "width","thick","invQty","invUnitWeight","invWeight","specId", "HGKC010.querySpecIdBox"),
/**
* 模块:仓库类型
......
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.HGKC010;
import com.baosight.hggp.hg.kc.domain.HGKC013;
import com.baosight.hggp.hg.kc.domain.HGKC013A;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
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.util.*;
/**
* @author LiuYang
* @version 1.0 2024/5/29
*/
public class ServiceHGKC013A extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
Map map = EiInfoUtils.getFirstRow(inInfo);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC013A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo = super.query(inInfo, HGKC013A.QUERY, new HGKC013A());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID,DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_CODE_BOX_BLOCK_ID,DdynamicEnum.SPEC_BOX_BLOCK_ID),
new HashMap<String,Object>(){{
put(HGKC013.FIELD_COMPANY_CODE,map.get(HGKC013.FIELD_CALLOUT_COMPANY_CODE));
put(HGKC010.FIELD_WH_CODE,map.get(HGKC013A.FIELD_CALLOUT_WH_CODE));
put(HGKC013A.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
}}, false);
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC013A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HGKC013A.QUERY,new HGKC013A());
}
@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, HGKC013.FIELD_STATUS));
if (status==1) {
throw new PlatException("单据状态为已提交,不能删除!");
}
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HGKC013A hgkc013a = new HGKC013A();
hgkc013a.fromMap(map);
hgkc013a.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGKC013A.DELETE_FLAG, hgkc013a);
}
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();
int status = Integer.parseInt(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC013.FIELD_STATUS));
String calloutWhCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC013A.FIELD_CALLOUT_WH_CODE);
String calloutWhName = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC013A.FIELD_CALLOUT_WH_NAME);
String callinWhCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC013A.FIELD_CALLIN_WH_CODE);
String callinWhName = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC013A.FIELD_CALLIN_WH_NAME);
Long parentId = Long.parseLong(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC013A.FIELD_PARENT_ID));
if (status==1) {
throw new PlatException("单据状态为已提交,不能保存!");
}
// 写入数据
for (Map resultRow : resultRows) {
HGKC013A hgkc013a = new HGKC013A();
hgkc013a.fromMap(resultRow);
hgkc013a.setParentId(parentId);
hgkc013a.setCalloutWhCode(calloutWhCode);
hgkc013a.setCalloutWhName(calloutWhName);
hgkc013a.setCallinWhCode(callinWhCode);
hgkc013a.setCallinWhName(callinWhName);
Object object = this.dao.get(HGKC013.QUERY,HGKC010.FIELD_ID,parentId);
if (object!=null){
Map map1 = MapUtils.toMap(object);
HGKC010 hgkc010 = HGKCTools.HgKc010.get(map1.get(HGKC013.FIELD_COMPANY_CODE).toString(),map1.get(HGKC013.FIELD_CALLOUT_WH_CODE).toString(),hgkc013a.getInventRecordId());
if (hgkc010==null){
throw new PlatException("实时库存不存在!");
}
int result = hgkc013a.getQuantity().compareTo(hgkc010.getInvQty());
if ( result > 0){
throw new PlatException("实时库存数量不够,无法保存!");
}
}
if (hgkc013a.getId() == null || hgkc013a.getId() == 0) {
this.add(hgkc013a);
} else {
this.modify(hgkc013a);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HGKC013A hgkc013a) {
DaoUtils.insert(HGKC013A.INSERT, hgkc013a);
}
/**
* 修改操作
*/
public void modify(HGKC013A hgkc013a) {
DaoUtils.update(HGKC013A.UPDATE, hgkc013a);
}
/**
* 下拉框
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "仓库档案",operType = "查询",operDesc = "下拉框")
public EiInfo queryComboBox(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.INVENT_ALL_BOX_BLOCK_ID);
boolean isSplicingSymbol = true;
if (inInfo.getString("isSplicingSymbol") != null) {
isSplicingSymbol = Boolean.parseBoolean(inInfo.getString("isSplicingSymbol"));
} else if (queryRow.get("isSplicingSymbol") != null) {
isSplicingSymbol = MapUtils.getBoolean(queryRow, "isSplicingSymbol");
}
CommonMethod.initBlock(inInfo, list, EiInfoUtils.getFirstRow(inInfo), isSplicingSymbol);
return inInfo;
}
}
......@@ -444,4 +444,94 @@
ID = #id#
</update>
<select id="queryList" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.kc.domain.HGKC006">
SELECT
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
OTHER_ENTER_DATE as "otherEnterDate", <!-- 其他入库日期 -->
OTHER_ENTER_NO as "otherEnterNo", <!-- 其他入库单号 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
OTHER_ENTER_NO_OLD as "otherEnterNoOld", <!-- 其他入库单号(旧) -->
REMARK as "remark", <!-- 备注 -->
FACTORY_CODE as "factoryCode", <!-- 工厂代码 -->
PROD_ORDER_NO as "prodOrderNo", <!-- 生产订单号 -->
PROD_TASK_NO as "prodTaskNo", <!-- 生产任务号 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
PRDT_TYPE as "prdtType", <!-- 产品类型 -->
PRDT_CODE as "prdtCode", <!-- 产品编码 -->
PRDT_NAME as "prdtName", <!-- 产品名称 -->
PRDT_LENGTH as "prdtLength", <!-- 产品-长 -->
PRDT_WIDTH as "prdtWidth", <!-- 产品-宽 -->
PRDT_THICK as "prdtThick", <!-- 产品-厚 -->
PRDT_SPEC as "prdtSpec", <!-- 产品规格 -->
PART_TYPE as "partType", <!-- 零件类型 -->
PART_CODE as "partCode", <!-- 零件编码 -->
PART_NAME as "partName", <!-- 零件名称 -->
PART_LENGTH as "partLength", <!-- 零件-长 -->
PART_WIDTH as "partWidth", <!-- 零件-宽 -->
PART_THICK as "partThick", <!-- 零件-厚 -->
PART_SPEC as "partSpec", <!-- 零件规格 -->
SUBMIT_STATUS as "submitStatus", <!-- 提交状态 -->
SOURCE as "source" <!-- 数据来源 -->
FROM ${hggpSchema}.HGKC006 WHERE 1=1 and DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="otherEnterDate">
OTHER_ENTER_DATE = #otherEnterDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="otherEnterNo">
OTHER_ENTER_NO = #otherEnterNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="otherEnterNoOld">
OTHER_ENTER_NO_OLD = #otherEnterNoOld#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</select>
</sqlMap>
......@@ -442,4 +442,94 @@
ID = #id#
</update>
<select id="queryList" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.kc.domain.HGKC007">
SELECT
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
OTHER_OUT_DATE as "otherOutDate", <!-- 其他出库日期 -->
OTHER_OUT_NO as "otherOutNo", <!-- 其他出库单号 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
OTHER_OUT_NO_OLD as "otherOutNoOld", <!-- 其他出库单号(旧) -->
REMARK as "remark", <!-- 备注 -->
FACTORY_CODE as "factoryCode", <!-- 工厂代码 -->
PROD_ORDER_NO as "prodOrderNo", <!-- 生产订单号 -->
PROD_TASK_NO as "prodTaskNo", <!-- 生产任务号 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
PRDT_TYPE as "prdtType", <!-- 产品类型 -->
PRDT_CODE as "prdtCode", <!-- 产品编码 -->
PRDT_NAME as "prdtName", <!-- 产品名称 -->
PRDT_LENGTH as "prdtLength", <!-- 产品-长 -->
PRDT_WIDTH as "prdtWidth", <!-- 产品-宽 -->
PRDT_THICK as "prdtThick", <!-- 产品-厚 -->
PRDT_SPEC as "prdtSpec", <!-- 产品规格 -->
PART_TYPE as "partType", <!-- 零件类型 -->
PART_CODE as "partCode", <!-- 零件编码 -->
PART_NAME as "partName", <!-- 零件名称 -->
PART_LENGTH as "partLength", <!-- 零件-长 -->
PART_WIDTH as "partWidth", <!-- 零件-宽 -->
PART_THICK as "partThick", <!-- 零件-厚 -->
PART_SPEC as "partSpec", <!-- 零件规格 -->
SUBMIT_STATUS as "submitStatus", <!-- 提交状态 -->
SOURCE as "source" <!-- 数据来源 -->
FROM ${hggpSchema}.HGKC007 WHERE 1=1 and DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="otherOutDate">
OTHER_OUT_DATE = #otherOutDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="otherOutNo">
OTHER_OUT_NO = #otherOutNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="otherOutNoOld">
OTHER_OUT_NO_OLD = #otherOutNoOld#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</select>
</sqlMap>
......@@ -12,10 +12,7 @@ import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -489,4 +486,26 @@ public class HGKCTools {
}
}
public static class HgKc013 {
public static HGKC013 getId(Long id) {
AssertUtils.isEmpty(Collections.singleton(id), "调拨单为空!");
Map<String, Object> paramMap = new HashMap();
paramMap.put("id", id);
paramMap.put("deleteFlag", 0);
List<HGKC013> list = DaoBase.getInstance().query(HGKC013.QUERY, paramMap);
AssertUtils.isEmpty(list, "调拨单为空!");
return list.get(0);
}
public static List<HGKC013A> getDetail(Long parentId) {
AssertUtils.isEmpty(Collections.singleton(parentId), "调拨单ID不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("parentId", parentId);
paramMap.put("deleteFlag", 0);
List<HGKC013A> list = DaoBase.getInstance().query(HGKC013A.QUERY, paramMap);
AssertUtils.isEmpty(list, "调拨单明细为空!");
return list;
}
}
}
......@@ -6,6 +6,7 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
......@@ -202,5 +203,26 @@ public class MapUtils extends org.apache.commons.collections.MapUtils {
return newBean;
}).filter(t -> t != null).collect(Collectors.toList());
}
/**
* object 转 map
*/
public static Map<String, Object> toMap(Object obj) {
Map<String, Object> map = new HashMap<>();
Method[] methods = obj.getClass().getMethods();
for (Method method : methods) {
if (method.getName().startsWith("get")) {
try {
Object value = method.invoke(obj);
String key = method.getName().substring(3);
key = key.substring(0, 1).toLowerCase() + key.substring(1);
map.put(key, value);
} catch (Exception e) {
// Handle exception
}
}
}
return map;
}
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/5/29
Time: 14:20
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:EFDatePicker blockId="inqu_status" row="0" ename="receiptDate" cname="单据日期" colWidth="3" format="yyyy-MM-dd"/>
<EF:EFInput blockId="inqu_status" row="0" ename="allotNo" cname="调拨单号" colWidth="3" placeholder="模糊查询"/>
<EF:EFInput blockId="inqu_status" row="0" ename="calloutWhName" cname="调入仓库名称" colWidth="3" placeholder="模糊查询"/>
<EF:EFInput blockId="inqu_status" row="0" ename="callinWhName" cname="调出仓库名称" colWidth="3" placeholder="模糊查询"/>
<%--<EF:EFSelect blockId="inqu_status" row="0" ename="status" cname="状态" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.hgkc.status"/>
</EF:EFSelect>
<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>--%>
</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="150" 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:EFComboColumn ename="allotType" cname="调拨类型" width="80" align="center" enable="true" required="true">
<EF:EFCodeOption codeName="hggp.hgkc.allotType"/>
</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="allotNo" cname="调拨单号" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="calloutCompanyCode" 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:EFComboColumn ename="calloutWhCode" cname="调出仓库名称" enable="true" width="120" align="center" required="true"
blockName="wh_record_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFComboColumn ename="callinCompanyCode" 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:EFComboColumn ename="callinWhCode" cname="调入仓库名称" enable="true" width="120" align="center" required="true"
blockName="wh_record_box_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() {
$(".row").children().attr("class", "col-md-3");
var inventTypeBox = __eiInfo.getBlock("invent_type_box_block_id").getMappedRows();
var inventCodedBox = __eiInfo.getBlock("invent_code_box_block_id").getMappedRows();
var specIdBox = __eiInfo.getBlock("spec_box_block_id").getMappedRows();
// 查询
$("#QUERY").on("click", query);
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200]
},
columns: [{
field: "inventType",
filter: function (options) {
return _.filter(inventTypeBox, function (item) {
return item["param1Field"]=="true";
})
},
editor: function (container, options) {
this.filter(options);
}
}, {
field: "inventCode",
title: "存货名称",
filter: function (options) {
let inventType = options.model["inventType"];
if (inventType){
return _.filter(inventCodedBox, function (item) {
return item["param1Field"] === inventType;
})
}
return options.values;
},
template: function (dataItem) {
for (let i = 0; i < inventCodedBox.length; i++) {
if (inventCodedBox[i]['valueField'] === dataItem['inventCode']){
dataItem['inventName'] = inventCodedBox[i]['textField']
dataItem['inventRecordId'] = inventCodedBox[i]['param2Field'];
return inventCodedBox[i]['textField'];
}
}
return dataItem["inventCode"];
}
}, {
field: "spec",
filter: function (options) {
let specId = options.model["inventRecordId"];
if (specId){
return _.filter(specIdBox, function (item) {
return item["param7Field"] === specId;
})
}
return options.values;
},
template: function (item) {
return $.trim(item.spec) == "" ? "" : item.spec;
}
}, {
field: "length",
template: function (item) {
return item.length == 0 ? "-" : item.length;
}
}, {
field: "width",
template: function (item) {
return item.width == 0 ? "-" : item.width;
}
}, {
field: "thick",
template: function (item) {
return item.thick == 0 ? "-" : item.thick;
}
}/*, {
field: "unitWeight",
format: "{0:n3}",
template: function (item) {
item["weight"] = item["quantity"]*item["unitWeight"];
return item["unitWeight"];
}
}, {
field: "weight",
format: "{0:n3}",
template: function (item) {
if (item["quantity"] != 0){
item["unitWeight"] = item["weight"]/item["quantity"];
}
return item["weight"];
}
}*/],
loadComplete: function(grid) {
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field === "spec"){
for (let i = 0; i < specIdBox.length; i++) {
if (specIdBox[i]['param7Field'] === e.items[0]["inventRecordId"]){
e.items[0]["length"] = specIdBox[i]['param1Field'];
e.items[0]["width"] = specIdBox[i]['param2Field'];
e.items[0]["thick"] = specIdBox[i]['param3Field'];
e.items[0]["quantity"] = specIdBox[i]['param4Field'];
e.items[0]["unitWeight"] = specIdBox[i]['param5Field'];
e.items[0]["weight"] = specIdBox[i]['param6Field'];
}
}
loadChange(grid,e,"length");
loadChange(grid,e,"width");
loadChange(grid,e,"thick");
loadChange(grid,e,"unitWeight");
loadChange(grid,e,"weight");
loadChange(grid,e,"quantity");
}else if (e.field === "quantity"){
if (e.items[0].quantity != 0 && e.items[0].unitWeight > 0){
e.items[0].weight = e.items[0].unitWeight*e.items[0].quantity;
loadChange(grid,e,"weight");
}else if (e.items[0].unitWeight == 0){
loadChange(grid,e,"unitWeight");
}
}else if (e.field === "unitWeight"){
if (e.items[0].unitWeight != 0){
e.items[0].weight = e.items[0].quantity*e.items[0].unitWeight;
loadChange(grid,e,"weight");
}
}else if (e.field === "weight"){
if (e.items[0].quantity != 0){
e.items[0].unitWeight = e.items[0].weight/e.items[0].quantity;
loadChange(grid,e,"unitWeight");
}
}else if (e.field === "inventCode"){
loadChange(grid,e,"spec");
}else if (e.field === "inventRecordId"){
loadChange(grid,e,"spec");
}
});
},
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 inventType= item.get("inventType");
let inventCode= item.get("inventCode");
let spec= item.get("spec");
let quantity= item.get("quantity");
let unitWeight= item.get("unitWeight");
let weight= item.get("weight");
if(isBlank(inventType)){
message("选中的第" + (index + 1) + "行\"存货类型\",不能为空!");
flag = false;
return false;
}
if(isBlank(inventCode)){
message("选中的第" + (index + 1) + "行\"存货编码\",不能为空!");
flag = false;
return false;
}
if(isBlank(spec)){
message("选中的第" + (index + 1) + "行\"规格\",不能为空!");
flag = false;
return false;
}
if(isBlank(quantity) || parseInt(quantity) <= 0){
message("选中的第" + (index + 1) + "行\"数量\",必须是数值并且数量必须大于0!");
flag = false;
return false;
}
if(isBlank(unitWeight) || parseFloat(unitWeight) <= 0){
message("选中的第" + (index + 1) + "行\"单重\",必须是数值并且数量必须大于0!");
flag = false;
return false;
}
if(isBlank(weight)){
message("选中的第" + (index + 1) + "行\"重量\",必须是数值!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC013A", "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);
}
});
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/5/29
Time: 15:43
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:EFInput blockId="inqu_status" row="0" ename="calloutWhName" cname="调出仓库名称" colWidth="3" readonly="true"/>
<EF:EFInput blockId="inqu_status" row="0" ename="callinWhName" cname="调入仓库名称" colWidth="3" readonly="true"/>
<EF:EFInput blockId="inqu_status" row="0" ename="calloutWhCode" cname="调出仓库编码" colWidth="3" type="hidden" readonly="true"/>
<EF:EFInput blockId="inqu_status" row="0" ename="callinWhCode" cname="调入仓库编码" colWidth="3" type="hidden" readonly="true"/>
<EF:EFInput blockId="inqu_status" row="0" ename="inventName" cname="存货名称" colWidth="3" placeholder="模糊查询"/>
<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: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="false"
filter="contains">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventCode" cname="存货名称" enable="true" width="120" align="center" required="true"
blockName="invent_code_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false"
filter="contains">
</EF:EFComboColumn>
<EF:EFComboColumn ename="spec" cname="规格" enable="true" width="120" align="center" required="true"
blockName="spec_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false"
filter="contains">
</EF:EFComboColumn>
<%--defaultValue="0"--%>
<EF:EFColumn ename="inventRecordId" cname="规格ID" width="120" enable="true" readonly="true" align="center" hidden="true" maxLength="50"/>
<EF:EFColumn ename="length" cname="长度(MM)" enable="true" readonly="false" width="100" align="right" format="{0:N3}" maxLength="10"/>
<EF:EFColumn ename="width" cname="宽度(MM)" enable="true" readonly="false" width="100" align="right" format="{0:N3}" maxLength="10"/>
<EF:EFColumn ename="thick" cname="厚度(MM)" enable="true" readonly="false" width="100" align="right" format="{0:N3}" maxLength="10"/>
<EF:EFColumn ename="quantity" cname="数量" width="120" enable="true" format="{0:N0}" editType="text"
displayType="0.000" sort="true" align="right"
data-regex="/^-?[0-9]{1,20}([.][0-9]{1,3})?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFColumn ename="unitWeight" cname="单重" width="120" enable="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/" maxLength="15" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFColumn ename="weight" cname="重量" width="120" enable="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/" maxLength="15" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和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>
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/5/28
Time: 15:30
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="com.baosight.hggp.hg.kc.tools.CKExcelTools" %>
<%@ page import="com.baosight.iplat4j.core.exception.PlatException" %>
<%
try {
// 1.出库单
if ("1".equals(request.getParameter("route"))) {
CKExcelTools.downloadFile(pageContext);
} else {
throw new PlatException("非法的路由信息");
}
out.clear();
out = pageContext.pushBody();
} catch (Throwable e) {
request.setAttribute("iplat_msgKey", "ES001");
request.setAttribute("iplat_msg", "文件下载失败");
request.setAttribute("iplat_msgDetail", e.toString());
request.getRequestDispatcher("/EU/DM/EUDM30.jsp").forward(request, response);
}
%>
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