Commit e5f883dd by liuyang

Merge branch 'dev' of http://git.pseer.com:8800/platform/hg-smart into dev-ly

parents 6a782160 c56d3dcd
...@@ -42,6 +42,8 @@ public class HGKC008 extends DaoEPBase { ...@@ -42,6 +42,8 @@ public class HGKC008 extends DaoEPBase {
public static final String FIELD_RECEIVE_TYPE = "receiveType"; /* 领料单类型 0:正常,1:退库*/ public static final String FIELD_RECEIVE_TYPE = "receiveType"; /* 领料单类型 0:正常,1:退库*/
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/ public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/ public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
public static final String FIELD_RECEIVE_USER_ID = "receiveUserId"; /* 领用人ID*/
public static final String FIELD_RECEIVE_USER_NAME = "receiveUserName"; /* 领用人姓名*/
public static final String COL_ID = "ID"; /* 主键id*/ public static final String COL_ID = "ID"; /* 主键id*/
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 账套*/ public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 账套*/
...@@ -63,6 +65,8 @@ public class HGKC008 extends DaoEPBase { ...@@ -63,6 +65,8 @@ public class HGKC008 extends DaoEPBase {
public static final String COL_RECEIVE_TYPE = "RECEIVE_TYPE"; /* 领料单类型 0:正常,1:退库*/ public static final String COL_RECEIVE_TYPE = "RECEIVE_TYPE"; /* 领料单类型 0:正常,1:退库*/
public static final String COL_PROJ_CODE = "PROJ_CODE"; /* 项目编码*/ public static final String COL_PROJ_CODE = "PROJ_CODE"; /* 项目编码*/
public static final String COL_PROJ_NAME = "PROJ_NAME"; /* 项目名称*/ public static final String COL_PROJ_NAME = "PROJ_NAME"; /* 项目名称*/
public static final String COL_RECEIVE_USER_ID = "RECEIVE_USER_ID"; /* 领用人ID*/
public static final String COL_RECEIVE_USER_NAME = "RECEIVE_USER_NAME"; /* 领用人姓名*/
public static final String QUERY = "HGKC008.query"; public static final String QUERY = "HGKC008.query";
public static final String COUNT = "HGKC008.count"; public static final String COUNT = "HGKC008.count";
...@@ -93,6 +97,8 @@ public class HGKC008 extends DaoEPBase { ...@@ -93,6 +97,8 @@ public class HGKC008 extends DaoEPBase {
private Integer receiveType = new Integer(0); /* 领料单类型 0:正常,1:退库*/ private Integer receiveType = new Integer(0); /* 领料单类型 0:正常,1:退库*/
private String projCode = " "; /* 项目编码*/ private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/ private String projName = " "; /* 项目名称*/
private String receiveUserId = " "; /* 领用人ID*/
private String receiveUserName = " "; /* 领用人姓名*/
/** /**
* initialize the metadata. * initialize the metadata.
...@@ -179,8 +185,14 @@ public class HGKC008 extends DaoEPBase { ...@@ -179,8 +185,14 @@ public class HGKC008 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_PROJ_NAME); eiColumn = new EiColumn(FIELD_PROJ_NAME);
eiColumn.setDescName("项目名称"); eiColumn.setDescName("项目名称");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_RECEIVE_USER_ID);
eiColumn.setDescName("领用人ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_RECEIVE_USER_NAME);
eiColumn.setDescName("领用人姓名");
eiMetadata.addMeta(eiColumn);
} }
/** /**
...@@ -494,7 +506,23 @@ public class HGKC008 extends DaoEPBase { ...@@ -494,7 +506,23 @@ public class HGKC008 extends DaoEPBase {
public void setProjName(String projName) { public void setProjName(String projName) {
this.projName = projName; this.projName = projName;
} }
public String getReceiveUserId() {
return receiveUserId;
}
public void setReceiveUserId(String receiveUserId) {
this.receiveUserId = receiveUserId;
}
public String getReceiveUserName() {
return receiveUserName;
}
public void setReceiveUserName(String receiveUserName) {
this.receiveUserName = receiveUserName;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -523,6 +551,8 @@ public class HGKC008 extends DaoEPBase { ...@@ -523,6 +551,8 @@ public class HGKC008 extends DaoEPBase {
setReceiveType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_RECEIVE_TYPE)), receiveType)); setReceiveType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_RECEIVE_TYPE)), receiveType));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode)); setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName)); setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
setReceiveUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RECEIVE_USER_ID)), receiveUserId));
setReceiveUserName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RECEIVE_USER_NAME)), receiveUserName));
} }
/** /**
...@@ -552,6 +582,8 @@ public class HGKC008 extends DaoEPBase { ...@@ -552,6 +582,8 @@ public class HGKC008 extends DaoEPBase {
map.put(FIELD_RECEIVE_TYPE, StringUtils.toString(receiveType, eiMetadata.getMeta(FIELD_RECEIVE_TYPE))); map.put(FIELD_RECEIVE_TYPE, StringUtils.toString(receiveType, eiMetadata.getMeta(FIELD_RECEIVE_TYPE)));
map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE))); map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE)));
map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME))); map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME)));
map.put(FIELD_RECEIVE_USER_ID, StringUtils.toString(receiveUserId, eiMetadata.getMeta(FIELD_RECEIVE_USER_ID)));
map.put(FIELD_RECEIVE_USER_NAME, StringUtils.toString(receiveUserName, eiMetadata.getMeta(FIELD_RECEIVE_USER_NAME)));
return map; return map;
} }
......
package com.baosight.hggp.hg.kc.domain;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.util.StringUtils;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
/**
* Project: <br>
* Title:Hgkc010.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-05-13 15:39:23 create
*/
public class HGKC010B extends HGKC010 {
public static final String FIELD_APPLY_QTY = "applyQty"; /* 申请数量*/
public static final String COL_APPLY_QTY = "APPLY_QTY"; /* 申请数量*/
private BigDecimal applyQty = new BigDecimal(0.000); /* 申请数量*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_APPLY_QTY);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(15);
eiColumn.setDescName("申请数量");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HGKC010B() {
super.initMetaData();
initMetaData();
}
public BigDecimal getApplyQty() {
return applyQty;
}
public void setApplyQty(BigDecimal applyQty) {
this.applyQty = applyQty;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
super.fromMap(map);
setApplyQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_APPLY_QTY)), applyQty));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = super.toMap();
map.put(FIELD_APPLY_QTY, StringUtils.toString(applyQty, eiMetadata.getMeta(FIELD_APPLY_QTY)));
return map;
}
}
...@@ -17,6 +17,7 @@ import com.baosight.hggp.util.CommonMethod; ...@@ -17,6 +17,7 @@ import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.ErrorCodeUtils; import com.baosight.hggp.util.ErrorCodeUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils; import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.contants.ACConstants; import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
...@@ -35,7 +36,6 @@ import java.util.List; ...@@ -35,7 +36,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
/** /**
* @Author jhs * @Author jhs
* @Date 2024/5/14 14:46 * @Date 2024/5/14 14:46
...@@ -44,12 +44,12 @@ public class ServiceHGKC008 extends ServiceBase { ...@@ -44,12 +44,12 @@ public class ServiceHGKC008 extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
try { try {
inInfo = super.query(inInfo, HGKC008.QUERY, new HGKC008()); inInfo = super.query(inInfo, HGKC008.QUERY, new HGKC008());
Map map = new HashMap(); Map map = new HashMap();
map.put(HGKC008.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode()); map.put(HGKC008.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID,
Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID, DdynamicEnum.PROJ_RECORD_BY_ROLE_BLOCK_ID, DdynamicEnum.PROJ_RECORD_BY_ROLE_BLOCK_ID, DdynamicEnum.WH_RECORD_BLOCK_ID,
DdynamicEnum.WH_RECORD_BLOCK_ID), map, false DdynamicEnum.USER_BLOCK_ID), map, false
); );
EiInfoUtils.addBlock(inInfo, "roleCompany", UserSessionUtils.getRoleCompany(), Company.class); EiInfoUtils.addBlock(inInfo, "roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
} catch (Exception e) { } catch (Exception e) {
...@@ -81,61 +81,94 @@ public class ServiceHGKC008 extends ServiceBase { ...@@ -81,61 +81,94 @@ public class ServiceHGKC008 extends ServiceBase {
@Override @Override
public EiInfo delete(EiInfo inInfo) { public EiInfo delete(EiInfo inInfo) {
try { try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 生产领料ids // 生产领料ids
List<Long> ids = ObjectUtils.listKey(resultRows, HGKC008.FIELD_ID); List<Long> ids = ObjectUtils.listKey(resultRows, HGKC008.FIELD_ID);
DaoUtils.update(HGKC008.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",ids);}}); DaoUtils.update(HGKC008.BATCH_DELETE, new HashMap<String, Object>() {{
inInfo = this.query(inInfo); put("ids", ids);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); }});
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!"); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败"); LogUtils.setDetailMsg(inInfo, e, "删除失败");
} }
return inInfo; return inInfo;
} }
public EiInfo save(EiInfo inInfo){ /**
try { * @param inInfo
Map resultMap = EiInfoUtils.getFirstRow(inInfo,EiConstant.resultBlock); * @return
HGKC008 hgkc008 = new HGKC008(); */
hgkc008.fromMap(resultMap); public EiInfo save(EiInfo inInfo) {
this.checkSaveData(hgkc008); try {
if(Objects.nonNull(hgkc008.getId())&&hgkc008.getId()!=0){ List<HGKC008> fKc008s = MapUtils.toDaoEPBases(inInfo, HGKC008.class);
DaoUtils.update(HGKC008.UPDATE, hgkc008); for (HGKC008 fKc008 : fKc008s) {
//同时修改子表的仓库数据、公司数据 this.checkSaveData(fKc008);
HGKCTools.HgKc008A.updateWhCodeByReceiveId(hgkc008); if (Objects.nonNull(fKc008.getId()) && fKc008.getId() != 0) {
}else { DaoUtils.update(HGKC008.UPDATE, fKc008);
//生成生产领料编号 //同时修改子表的仓库数据、公司数据
hgkc008.setApplyCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.RECEIVE_CODE)); HGKCTools.HgKc008A.updateWhCodeByReceiveId(fKc008);
hgkc008.setStatus(HGConstant.ProductStatus.WTJ); } else {
DaoUtils.insert(HGKC008.INSERT, hgkc008); //生成生产领料编号
fKc008.setApplyCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.RECEIVE_CODE));
EiInfoUtils.addBlock(inInfo,"entity", hgkc008, HGKC008.class); fKc008.setStatus(HGConstant.ProductStatus.WTJ);
} DaoUtils.insert(HGKC008.INSERT, fKc008);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); }
inInfo.setMsg("保存成功!"); }
} catch (Exception e) { inInfo = this.query(inInfo);
LogUtils.setDetailMsg(inInfo, e, "保存失败"); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} inInfo.setMsg("保存成功!");
return inInfo; } catch (Exception e) {
} LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
/** return inInfo;
* 校验保存的数据 }
*
* @param hgkc008 /**
*/ * 移动端
private void checkSaveData(HGKC008 hgkc008) { *
if(Objects.nonNull(hgkc008.getId())&&hgkc008.getId()>0){ * @param inInfo
AssertUtils.isTrue(hgkc008.getStatus().compareTo(HGConstant.ProductStatus.YTJ) == 0,"领料单已提交,不可修改"); * @return
} */
AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!"); public EiInfo saveApp(EiInfo inInfo) {
AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!"); try {
AssertUtils.isEmpty(hgkc008.getCompanyCode(), "请选择公司!"); HGKC008 fKc008 = MapUtils.toDaoEPBase(inInfo, HGKC008.class);
AssertUtils.isEmpty(hgkc008.getWhCode(), "请选择仓库信息!"); this.checkSaveData(fKc008);
AssertUtils.isEmpty(hgkc008.getWhName(), "请选择仓库信息!"); if (Objects.nonNull(fKc008.getId()) && fKc008.getId() != 0) {
} DaoUtils.update(HGKC008.UPDATE, fKc008);
//同时修改子表的仓库数据、公司数据
HGKCTools.HgKc008A.updateWhCodeByReceiveId(fKc008);
} else {
//生成生产领料编号
fKc008.setApplyCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.RECEIVE_CODE));
fKc008.setStatus(HGConstant.ProductStatus.WTJ);
DaoUtils.insert(HGKC008.INSERT, fKc008);
EiInfoUtils.addBlock(inInfo, "entity", fKc008, HGKC008.class);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 校验保存的数据
*
* @param hgkc008
*/
private void checkSaveData(HGKC008 hgkc008) {
if (Objects.nonNull(hgkc008.getId()) && hgkc008.getId() > 0) {
AssertUtils.isTrue(hgkc008.getStatus().compareTo(HGConstant.ProductStatus.YTJ) == 0, "领料单已提交,不可修改");
}
AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(hgkc008.getCompanyCode(), "请选择公司!");
AssertUtils.isEmpty(hgkc008.getWhCode(), "请选择仓库信息!");
AssertUtils.isEmpty(hgkc008.getWhName(), "请选择仓库信息!");
}
/** /**
* 修改启用状态 * 修改启用状态
......
...@@ -33,7 +33,7 @@ public class ServiceHGKC008A extends ServiceBase { ...@@ -33,7 +33,7 @@ public class ServiceHGKC008A extends ServiceBase {
Map map = new HashMap(); Map map = new HashMap();
map.put(HGKC008A.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode()); map.put(HGKC008A.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
map.put(HGKC008A.FIELD_WH_CODE, whCode); map.put(HGKC008A.FIELD_WH_CODE, whCode);
map.put(HGPZ004.FIELD_INVENT_TYPE_DETAILS, InventTypeDetailEnum.getInentTypeThree()); // map.put(HGPZ004.FIELD_INVENT_TYPE_DETAILS, InventTypeDetailEnum.getInentTypeThree());
CommonMethod.initBlock(inInfo, CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID,DdynamicEnum.INVENT_CODE_BOX_BLOCK_ID),map,false Arrays.asList(DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID,DdynamicEnum.INVENT_CODE_BOX_BLOCK_ID),map,false
); );
......
...@@ -4,12 +4,14 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; ...@@ -4,12 +4,14 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.InventTypeDetailEnum; import com.baosight.hggp.common.InventTypeDetailEnum;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant; import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.kc.domain.HGKC008; import com.baosight.hggp.hg.kc.domain.HGKC008;
import com.baosight.hggp.hg.kc.domain.HGKC008A; import com.baosight.hggp.hg.kc.domain.HGKC008A;
import com.baosight.hggp.hg.kc.domain.HGKC010; import com.baosight.hggp.hg.kc.domain.HGKC010;
import com.baosight.hggp.hg.kc.domain.HGKC010B;
import com.baosight.hggp.hg.kc.utils.HGKCUtils; import com.baosight.hggp.hg.kc.utils.HGKCUtils;
import com.baosight.hggp.hg.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
...@@ -23,9 +25,9 @@ import com.baosight.iplat4j.core.ei.EiConstant; ...@@ -23,9 +25,9 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -87,56 +89,79 @@ public class ServiceHGKC008B extends ServiceBase { ...@@ -87,56 +89,79 @@ public class ServiceHGKC008B extends ServiceBase {
@OperationLogAnnotation(operModul = "实时库存", operType = "查询", operDesc = "确认") @OperationLogAnnotation(operModul = "实时库存", operType = "查询", operDesc = "确认")
public EiInfo confirm(EiInfo inInfo) { public EiInfo confirm(EiInfo inInfo) {
try { try {
String receiveId = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC008A.FIELD_RECEIVE_ID); String receiveId = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0,
List<HGKC010> hgkc010s = MapUtils.toDaoEPBases(inInfo, HGKC010.class); HGKC008A.FIELD_RECEIVE_ID);
List<HGKC010B> fKc010Bs = MapUtils.toDaoEPBases(inInfo, HGKC010B.class);
// db数据 // db数据
Map<Long, HGKC010> dbHgkc010Map = HGKCUtils.HgKc010.lockGetDataEp(hgkc010s); Map<Long, HGKC010> dbKc010Map = HGKCUtils.HgKc010.lockGetDataEp(fKc010Bs);
// 领料明细
List<HGKC008A> hgkc008AList = HGKCUtils.HgKc008A.listByPrimaryId(receiveId); List<HGKC008A> dbKc008As = HGKCUtils.HgKc008A.listByPrimaryId(receiveId);
// 领料主信息
HGKC008 hgkc008 = HGKCUtils.HgKc008.get(receiveId); HGKC008 hgkc008 = HGKCUtils.HgKc008.get(receiveId);
// 数据校验 // 数据校验
this.checkConfirmData(hgkc008AList, dbHgkc010Map,hgkc008); this.checkConfirmData(fKc010Bs, dbKc008As, dbKc010Map, hgkc008);
// 保存数据 // 保存数据
this.confirmData(dbHgkc010Map, hgkc008); this.confirmData(fKc010Bs, dbKc010Map, hgkc008);
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + hgkc010s.size() + "]条数据保存成功!"); inInfo.setMsg("操作成功!本次对[" + fKc010Bs.size() + "]条数据保存成功!");
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败"); LogUtils.setDetailMsg(inInfo, e, "保存失败");
} }
return inInfo; return inInfo;
} }
private void confirmData(Map<Long, HGKC010> dbHgkc010Map, HGKC008 hgkc008) { /**
List<HGKC008A> hgkc008AList = new LinkedList<>(); * 确认数量
dbHgkc010Map.forEach((k,v) ->{ *
HGKC008A hgkc008A = new HGKC008A(); * @param fKc010Bs
BeanUtils.copyProperties(hgkc008,hgkc008A,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime"); * @param dbKc010Map
hgkc008A.setReceiveId(hgkc008.getId()); * @param dbKc008
hgkc008A.setInvLength(v.getLength()); */
hgkc008A.setInvThick(v.getThick()); private void confirmData(List<HGKC010B> fKc010Bs, Map<Long, HGKC010> dbKc010Map, HGKC008 dbKc008) {
hgkc008A.setInvUnitWeight(v.getInvUnitWeight()); for (HGKC010B fKc010B : fKc010Bs) {
hgkc008A.setInvWeight(v.getInvWeight()); Long id = fKc010B.getId();
hgkc008A.setInvWidth(v.getWidth()); HGKC010 dbKc010 = dbKc010Map.get(id);
hgkc008A.setInvSpec(v.getSpec()); HGKC008A newKc008A = BeanUtils.copy(dbKc010, HGKC008A.class);
hgkc008A.setInventType(v.getInventType()); newKc008A.setProjCode(dbKc008.getProjCode());
hgkc008A.setInventTypeDetail(v.getInventTypeDetail()); newKc008A.setProjName(dbKc008.getProjName());
hgkc008A.setInventCode(v.getInventCode()); newKc008A.setCompanyCode(dbKc008.getCompanyCode());
hgkc008A.setInventName(v.getInventName()); newKc008A.setCompanyName(dbKc008.getCompanyName());
hgkc008A.setInvQty(v.getInvQty()); newKc008A.setReceiveId(dbKc008.getId());
hgkc008AList.add(hgkc008A); newKc008A.setInvQty(fKc010B.getApplyQty());
}); newKc008A.setInvWeight(fKc010B.getApplyQty().multiply(dbKc010.getInvUnitWeight()));
DaoUtils.insertBatch(HGKC008A.INSERT, hgkc008AList); newKc008A.setInvWidth(dbKc010.getWidth());
newKc008A.setInvLength(dbKc010.getLength());
newKc008A.setInvThick(dbKc010.getThick());
newKc008A.setInvSpec(dbKc010.getSpec());
newKc008A.setInvSpecId(dbKc010.getSpecId());
newKc008A.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGKC008A.INSERT, newKc008A);
}
} }
private void checkConfirmData(List<HGKC008A> hgkc008AList, Map<Long, HGKC010> dbHgkc010Map, HGKC008 hgkc008) { /**
AssertUtils.isTrue(hgkc008.getStatus().compareTo(HGConstant.ProductStatus.YTJ) == 0, "领料单已提交,不可修改"); * 数据校验
hgkc008AList.forEach(o -> { *
dbHgkc010Map.forEach((k, v) -> { * @param fKc010Bs
AssertUtils.isTrue(o.getInventCode().equals(v.getInventCode()), "此领料单已选择存货:" + v.getInventCode()); * @param dbKc008As
}); * @param dbKc010Map
}); * @param dbKc008
*/
private void checkConfirmData(List<HGKC010B> fKc010Bs, List<HGKC008A> dbKc008As, Map<Long, HGKC010> dbKc010Map,
HGKC008 dbKc008) {
AssertUtils.isEquals(dbKc008.getStatus(), HGConstant.ProductStatus.YTJ, "领料单已提交,不可修改");
for (HGKC010B fKc010B : fKc010Bs) {
AssertUtils.isGe(BigDecimal.ZERO, fKc010B.getApplyQty(), String.format("库存【%s】申请数量必须大于0",
fKc010B.getInventCode()));
}
for (HGKC008A dbKc008A : dbKc008As) {
for (Map.Entry<Long, HGKC010> dbKc010MapEntry : dbKc010Map.entrySet()) {
HGKC010 dbKc010 = dbKc010MapEntry.getValue();
AssertUtils.isEquals(dbKc010.getInventCode(), dbKc008A.getInventCode(),
String.format("此领料单已选择存货:%s", dbKc010.getInventCode()));
}
}
} }
} }
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGKC008A"> <sqlMap namespace="HGKC008A">
<sql id="condition"> <sql id="condition">
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
</select> </select>
<insert id="insert"> <insert id="insert">
INSERT INTO ${hggpSchema}.HGKC008A (ID, <!-- 主键id --> INSERT INTO ${hggpSchema}.HGKC008A (
ACCOUNT_CODE, <!-- 账套 --> ACCOUNT_CODE, <!-- 账套 -->
PROJ_CODE, <!-- 项目编码 --> PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 --> PROJ_NAME, <!-- 项目名称 -->
...@@ -166,9 +166,6 @@ ...@@ -166,9 +166,6 @@
CREATED_BY, <!-- 创建人 --> CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 --> CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 --> CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 修改人 -->
UPDATED_NAME, <!-- 修改人名称 -->
UPDATED_TIME, <!-- 修改时间 -->
DELETE_FLAG, <!-- 是否删除 0-否1-是 --> DELETE_FLAG, <!-- 是否删除 0-否1-是 -->
RECEIVE_ID, <!-- 领料单id --> RECEIVE_ID, <!-- 领料单id -->
COMPANY_CODE, <!-- 公司编码 --> COMPANY_CODE, <!-- 公司编码 -->
...@@ -190,9 +187,8 @@ ...@@ -190,9 +187,8 @@
PRICE, <!-- 单价 --> PRICE, <!-- 单价 -->
AMOUNT, <!-- 金额 --> AMOUNT, <!-- 金额 -->
INVENT_TYPE_DETAIL INVENT_TYPE_DETAIL
) ) VALUES (#accountCode#,#projCode#, #projName#, #depCode#, #createdBy#, #createdName#, #createdTime#,
VALUES (#id#, #accountCode#,#projCode#, #projName#, #depCode#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#, #receiveId#, #companyCode#, #companyName#, #whCode#,
#updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #receiveId#, #companyCode#, #companyName#, #whCode#,
#whName#, #inventRecordId#, #inventType#, #inventCode#, #inventName#, #invSpecId#,#invSpec#, #invLength#, #whName#, #inventRecordId#, #inventType#, #inventCode#, #inventName#, #invSpecId#,#invSpec#, #invLength#,
#invWidth#, #invThick#, #invQty#, #invUnitWeight#, #invWeight#, #price#, #amount#, #inventTypeDetail#) #invWidth#, #invThick#, #invQty#, #invUnitWeight#, #invWeight#, #price#, #amount#, #inventTypeDetail#)
</insert> </insert>
......
...@@ -7,13 +7,22 @@ import com.baosight.hggp.core.dao.DaoUtils; ...@@ -7,13 +7,22 @@ import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.sc.domain.HGSC005; import com.baosight.hggp.hg.sc.domain.HGSC005;
import com.baosight.hggp.hg.sc.domain.HGSC005A; import com.baosight.hggp.hg.sc.domain.HGSC005A;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.*; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtil;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.*; import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/** /**
* @Author wwl * @Author wwl
...@@ -110,7 +119,32 @@ public class ServiceHGSC005A extends ServiceBase { ...@@ -110,7 +119,32 @@ public class ServiceHGSC005A extends ServiceBase {
} }
/** /**
* 排产 * 正序排产
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产计划详情", operType = "排产", operDesc = "排产")
public EiInfo scheduleEx(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String planCode = MapUtils.getString(queryMap, "planCode");
HGSC005 dbSc005 = HGSCTools.THGSC005.queryByPlanCode(planCode);
this.checkScheduleData(dbSc005);
int count = HGSCTools.THGSC005A.schedule(queryMap, "A");
dbSc005.setIsSchedule(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSC005.UPDATE, dbSc005);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + count + "]条数据排产成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
/**
* 倒序排产
* *
* @param inInfo * @param inInfo
* @return * @return
...@@ -122,7 +156,7 @@ public class ServiceHGSC005A extends ServiceBase { ...@@ -122,7 +156,7 @@ public class ServiceHGSC005A extends ServiceBase {
String planCode = MapUtils.getString(queryMap, "planCode"); String planCode = MapUtils.getString(queryMap, "planCode");
HGSC005 dbSc005 = HGSCTools.THGSC005.queryByPlanCode(planCode); HGSC005 dbSc005 = HGSCTools.THGSC005.queryByPlanCode(planCode);
this.checkScheduleData(dbSc005); this.checkScheduleData(dbSc005);
int count = HGSCTools.THGSC005A.schedule(queryMap); int count = HGSCTools.THGSC005A.schedule(queryMap, "D");
dbSc005.setIsSchedule(CommonConstant.YesNo.YES_1); dbSc005.setIsSchedule(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSC005.UPDATE, dbSc005); DaoUtils.update(HGSC005.UPDATE, dbSc005);
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
......
...@@ -1092,9 +1092,10 @@ public class HGSCTools { ...@@ -1092,9 +1092,10 @@ public class HGSCTools {
* 排产 * 排产
* *
* @param queryMap * @param queryMap
* @param sortType
* @return * @return
*/ */
public static int schedule(Map queryMap) { public static int schedule(Map queryMap, String sortType) {
List<HGSC005A> hgsc005AList = DaoBase.getInstance().query(HGSC005A.QUERY, queryMap); List<HGSC005A> hgsc005AList = DaoBase.getInstance().query(HGSC005A.QUERY, queryMap);
// hgsc005AList.sort(Comparator.comparing(HGSC005A::getProductType).thenComparing(HGSC005A::getProcessOrder,Comparator.reverseOrder())); // hgsc005AList.sort(Comparator.comparing(HGSC005A::getProductType).thenComparing(HGSC005A::getProcessOrder,Comparator.reverseOrder()));
//通过工序编码查询工序设置 //通过工序编码查询工序设置
...@@ -1145,26 +1146,26 @@ public class HGSCTools { ...@@ -1145,26 +1146,26 @@ public class HGSCTools {
} }
return hgsc005AList.size(); return hgsc005AList.size();
} }
private static String handleEndDate(String endDate ,HGSC005A planInfo){ private static String handleEndDate(String endDate, HGSC005A planInfo) {
if(StringUtils.isBlank(endDate)&&StringUtils.isNotBlank(planInfo.getFinishDate())){ if (StringUtils.isBlank(endDate) && StringUtils.isNotBlank(planInfo.getFinishDate())) {
endDate = DateUtil.toDateStr(DateUtils.addDays(DateUtil.toDate(planInfo.getFinishDate(),DateUtil.DATE10_PATTERN),finishDateDiffDay.intValue()),DateUtil.DATE10_PATTERN); endDate = DateUtil.toDateStr(DateUtils.addDays(DateUtil.toDate(planInfo.getFinishDate(),
} DateUtil.DATE10_PATTERN), finishDateDiffDay.intValue()), DateUtil.DATE10_PATTERN);
return endDate; }
} return endDate;
}
private static BigDecimal calculateWordHour(HGSC005A planInfo, List<HGSJ001> hgsj001List
, List<HGPZ005> hgpz005List, List<HGPZ005A> hgpz005AList private static BigDecimal calculateWordHour(HGSC005A planInfo, List<HGSJ001> hgsj001List,
, String endDate, BigDecimal remainder){ List<HGPZ005> hgpz005List, List<HGPZ005A> hgpz005AList, String endDate, BigDecimal remainder) {
endDate = handleEndDate(endDate,planInfo); endDate = handleEndDate(endDate, planInfo);
planInfo.setPlanEndDate(endDate); planInfo.setPlanEndDate(endDate);
AtomicReference<BigDecimal> workHour = new AtomicReference<>(new BigDecimal(0)); AtomicReference<BigDecimal> workHour = new AtomicReference<>(new BigDecimal(0));
BigDecimal finalRemainder = remainder; BigDecimal finalRemainder = remainder;
hgsj001List.stream().forEach(sj->{ hgsj001List.stream().forEach(sj -> {
if(StringUtils.equals(sj.getProcessCode(),planInfo.getProcessCode())){ if (StringUtils.equals(sj.getProcessCode(), planInfo.getProcessCode())) {
hgpz005AList.forEach(productProcess -> { hgpz005AList.forEach(productProcess -> {
if(productProcess.getId().compareTo(planInfo.getInventProcessId())==0){ if (productProcess.getId().compareTo(planInfo.getInventProcessId()) == 0) {
BigDecimal composingCoeff = productProcess.getComposingCoeff(); BigDecimal composingCoeff = productProcess.getComposingCoeff();
hgpz005List.forEach(product->{ hgpz005List.forEach(product->{
if(StringUtils.equals(product.getInventCode(),planInfo.getProductCode())){ if(StringUtils.equals(product.getInventCode(),planInfo.getProductCode())){
//额定工时 //额定工时
......
...@@ -34,6 +34,8 @@ public class HgWdConstant { ...@@ -34,6 +34,8 @@ public class HgWdConstant {
public static final String P = "P"; public static final String P = "P";
// 目录 // 目录
public static final String C = "C"; public static final String C = "C";
// 文件
public static final String F = "F";
} }
/** /**
......
...@@ -2,10 +2,12 @@ package com.baosight.hggp.hg.wd.service; ...@@ -2,10 +2,12 @@ package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.cw.tools.HGCWTools; import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.wd.domain.HGWD001B; import com.baosight.hggp.hg.wd.domain.HGWD001B;
import com.baosight.hggp.hg.wd.domain.HGWD002; import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.hg.wd.tools.HGWDTools; import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils; import com.baosight.hggp.util.MapUtils;
...@@ -91,9 +93,11 @@ public class ServiceHGWD001B extends ServiceBase { ...@@ -91,9 +93,11 @@ public class ServiceHGWD001B extends ServiceBase {
try { try {
List<HGWD001B> fWd001bs = MapUtils.toDaoEPBases(inInfo, HGWD001B.class); List<HGWD001B> fWd001bs = MapUtils.toDaoEPBases(inInfo, HGWD001B.class);
for (HGWD001B fWd001b : fWd001bs) { for (HGWD001B fWd001b : fWd001bs) {
// AssertUtils.isEmpty(fWd001b.getFileId(), "文件ID不能为空");
// 预览记录+1 // 预览记录+1
HGWDTools.HgWd099.previewIncr(fWd001b.getDocId()); HGWDTools.HgWd099.previewIncr(fWd001b.getDocId());
// 新增 // 新增
fWd001b.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGWD001B.INSERT, fWd001b); DaoUtils.insert(HGWD001B.INSERT, fWd001b);
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
......
...@@ -2,10 +2,12 @@ package com.baosight.hggp.hg.wd.service; ...@@ -2,10 +2,12 @@ package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.cw.tools.HGCWTools; import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.wd.domain.HGWD001C; import com.baosight.hggp.hg.wd.domain.HGWD001C;
import com.baosight.hggp.hg.wd.domain.HGWD002; import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.hg.wd.tools.HGWDTools; import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils; import com.baosight.hggp.util.MapUtils;
...@@ -91,9 +93,11 @@ public class ServiceHGWD001C extends ServiceBase { ...@@ -91,9 +93,11 @@ public class ServiceHGWD001C extends ServiceBase {
try { try {
List<HGWD001C> fWd001cs = MapUtils.toDaoEPBases(inInfo, HGWD001C.class); List<HGWD001C> fWd001cs = MapUtils.toDaoEPBases(inInfo, HGWD001C.class);
for (HGWD001C fWd001c : fWd001cs) { for (HGWD001C fWd001c : fWd001cs) {
AssertUtils.isEmpty(fWd001c.getFileId(), "文件ID不能为空");
// 下载记录+1 // 下载记录+1
HGWDTools.HgWd099.downloadIncr(fWd001c.getDocId()); HGWDTools.HgWd099.downloadIncr(fWd001c.getDocId());
// 新增 // 新增
fWd001c.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGWD001C.INSERT, fWd001c); DaoUtils.insert(HGWD001C.INSERT, fWd001c);
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
......
package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGWD002A extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档浏览", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 树节点查询
*
* @param inInfo
* @return
*/
public EiInfo queryTree(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String fileId = MapUtils.getString(queryMap, HGWD001.FIELD_FILE_ID);
String node = MapUtils.getString(queryMap, CommonConstant.Field.NODE);
if (CommonConstant.Field.ROOT.equals(node) || CommonConstant.Field.ROOT2.equals(node)) {
inInfo.addBlock(node).setRows(queryTopNode(node, fileId));
} else {
inInfo.addBlock(node).setRows(queryChildNode(node));
}
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
}
return inInfo;
}
/**
* 查询树根
*
* @param parentId
* @param fileId
* @return
*/
public List queryTopNode(String parentId, String fileId) {
List<Map> results = new ArrayList();
Map queryMap = new HashMap();
queryMap.put(HGWD001.FIELD_FILE_ID, fileId);
List<HGWD001> dbWd001s = dao.query(HGWD001.QUERY, queryMap);
if (CollectionUtils.isEmpty(dbWd001s)) {
return results;
}
for (HGWD001 dbWd001 : dbWd001s) {
results.add(buildLeaf(parentId, dbWd001.getFileId(), dbWd001.getFileName(),
HgWdConstant.LeafType.C, "", 0));
}
return results;
}
/**
* 查询叶子节点
*
* @param parentId
* @return
*/
public List queryChildNode(String parentId) {
List<Map> results = new ArrayList();
Map queryMap = new HashMap();
queryMap.put("parentId", parentId);
queryMap.put("userId", UserSessionUtils.getLoginName());
List<HGWD002> dbWd002s = dao.query(HGWD002.QUERY, queryMap);
if (CollectionUtils.isEmpty(dbWd002s)) {
return results;
}
for (HGWD002 dbWd002 : dbWd002s) {
results.add(buildLeaf(parentId, dbWd002.getDocId(), dbWd002.getDocName(),
HgWdConstant.LeafType.F, dbWd002.getDocType(), 1));
}
return results;
}
/**
* 构建叶子节点
*
* @param parentId
* @param label
* @param text
* @param leaf
*/
private HashMap buildLeaf(String parentId, String label, String text, String leafType, String docType,
Integer leaf) {
HashMap<String, Object> leafMap = new HashMap();
leafMap.put("parentId", parentId);
leafMap.put("label", label);
leafMap.put("text", text);
leafMap.put("leafType", leafType);
leafMap.put("docType", docType);
leafMap.put("leaf", leaf);
return leafMap;
}
}
...@@ -301,10 +301,10 @@ public class ServiceHGXSUser extends ServiceBase { ...@@ -301,10 +301,10 @@ public class ServiceHGXSUser extends ServiceBase {
private void syncDcSingleUserAdd(DcUserList dcUserList, DcUser dcUser, HGPZ009 dbPz009) throws Exception { private void syncDcSingleUserAdd(DcUserList dcUserList, DcUser dcUser, HGPZ009 dbPz009) throws Exception {
String userId = dcUser.getYgid(); String userId = dcUser.getYgid();
// -1:冻结用户,1:正常 // -1:冻结用户,1:正常
String isLock = HGXSUtils.XsUser.convertIsLock(dcUserList.getStatus()); String isLocked = HGXSUtils.XsUser.convertIsLock(dcUserList.getStatus());
// 新增用户 // 新增用户
HGXSTools.XsUser.addUser(dbPz009.getAccountCode(), userId, dcUser.getName(), dcUser.getSex(), dcUser.getEmail(), HGXSTools.XsUser.addUser(dbPz009.getAccountCode(), userId, dcUser.getName(), dcUser.getSex(), dcUser.getEmail(),
dcUser.getCardid(), isLock, dcUserList.getOrd().toString()); dcUser.getCardid(), isLocked, dcUserList.getOrd().toString());
// 新增用户和组织机构关系 // 新增用户和组织机构关系
Map addMap = new HashMap(); Map addMap = new HashMap();
addMap.put("orgId", dbPz009.getLoginPrefix() + dcUser.getOrgsid()); addMap.put("orgId", dbPz009.getLoginPrefix() + dcUser.getOrgsid());
......
...@@ -219,10 +219,10 @@ public class HGXSTools { ...@@ -219,10 +219,10 @@ public class HGXSTools {
* @param gender * @param gender
* @param mobile * @param mobile
* @param idCard * @param idCard
* @param isLock * @param isLocked
*/ */
public static void addUser(String accountCode, String userId, String userName, String gender, String mobile, public static void addUser(String accountCode, String userId, String userName, String gender, String mobile,
String idCard, String isLock, String extId) throws Exception { String idCard, String isLocked, String extId) throws Exception {
Map inInfoRowMap = new HashMap(); Map inInfoRowMap = new HashMap();
inInfoRowMap.put("userId", userId); inInfoRowMap.put("userId", userId);
inInfoRowMap.put("loginName", userId); inInfoRowMap.put("loginName", userId);
...@@ -235,7 +235,7 @@ public class HGXSTools { ...@@ -235,7 +235,7 @@ public class HGXSTools {
inInfoRowMap.put("idCard", StringUtils.isBlank(idCard) ? " " : idCard); inInfoRowMap.put("idCard", StringUtils.isBlank(idCard) ? " " : idCard);
inInfoRowMap.put("gender", HGXSUtils.XsUser.convertGender(gender)); inInfoRowMap.put("gender", HGXSUtils.XsUser.convertGender(gender));
inInfoRowMap.put("mobile", StringUtils.isBlank(mobile) ? " " : mobile); inInfoRowMap.put("mobile", StringUtils.isBlank(mobile) ? " " : mobile);
inInfoRowMap.put("isLock", isLock); inInfoRowMap.put("isLocked", isLocked);
inInfoRowMap.put("extId", extId); inInfoRowMap.put("extId", extId);
inInfoRowMap.put("accountCode", accountCode); inInfoRowMap.put("accountCode", accountCode);
EiInfo inInfo = new EiInfo(); EiInfo inInfo = new EiInfo();
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="120" align="right" format="{0:N3}" <EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="120" align="right" format="{0:N3}"
defaultValue="0" sumType="page"/> defaultValue="0" sumType="page"/>
<EF:EFComboColumn ename="calculationMethod" cname="计算方式" enable="true" width="100" align="center" <EF:EFComboColumn ename="calculationMethod" cname="计算方式" enable="true" width="100" align="center"
required="true"> copy="true" required="true">
<EF:EFCodeOption codeName="hggp.cg.calculationMethod"/> <EF:EFCodeOption codeName="hggp.cg.calculationMethod"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" required="true"/> <EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" required="true"/>
......
...@@ -309,7 +309,6 @@ $(function() { ...@@ -309,7 +309,6 @@ $(function() {
* 配置了query时,默认每次打开窗口都会进行一次查询 * 配置了query时,默认每次打开窗口都会进行一次查询
*/ */
query: function (e) { query: function (e) {
debugger;
console.log("Step" + (++i) + ": ----query----"); console.log("Step" + (++i) + ": ----query----");
// 将自定义div中的字段构造成查询条件 EiInfo // 将自定义div中的字段构造成查询条件 EiInfo
// var queryInfo = EiInfo.build("#result-0-contractCategory"); // var queryInfo = EiInfo.build("#result-0-contractCategory");
...@@ -525,8 +524,6 @@ function uploadFileFunc() { ...@@ -525,8 +524,6 @@ function uploadFileFunc() {
* @param docId * @param docId
*/ */
function uploadFileCallback(data) { function uploadFileCallback(data) {
debugger;
console.log("uploadFileCallback") console.log("uploadFileCallback")
let inEiInfo = new EiInfo(); let inEiInfo = new EiInfo();
inEiInfo.set("result-0-matId", data.matId); inEiInfo.set("result-0-matId", data.matId);
......
...@@ -12,39 +12,60 @@ ...@@ -12,39 +12,60 @@
</head> </head>
<EF:EFPage title="生产领料单"> <EF:EFPage title="生产领料单">
<EF:EFRegion id="inqu" title="查询条件"> <EF:EFRegion id="inqu" title="查询条件">
<div class="row"> <div class="row">
<EF:EFInput ename="inqu_status-0-companyName" cname="公司名称" colWidth="3"/> <EF:EFInput ename="inqu_status-0-companyName" cname="公司名称" colWidth="3"/>
<EF:EFDatePicker cname="单据日期" blockId="inqu_status" ename="receiptDate" row="0" colWidth="3" <EF:EFDatePicker cname="单据日期" blockId="inqu_status" ename="receiptDate" row="0" colWidth="3"
role="date" format="yyyy-MM-dd" readonly="true"/> role="date" format="yyyy-MM-dd" readonly="true"/>
<EF:EFInput ename="inqu_status-0-applyCode" cname="生产领料单号" colWidth="3"/> <EF:EFInput ename="inqu_status-0-applyCode" cname="生产领料单号" colWidth="3"/>
<EF:EFInput ename="inqu_status-0-whName" cname="仓库名称" colWidth="3"/> <EF:EFInput ename="inqu_status-0-whName" cname="仓库名称" colWidth="3"/>
</div> </div>
</EF:EFRegion> <div class="row">
<EF:EFRegion id="result" title="记录集"> <EF:EFSelect ename="receiveUserId" cname="领料人" blockId="inqu_status" row="0" colWidth="3" filter="contains">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true" copyToAdd="false"> <EF:EFOption label="全部" value=""/>
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/> </EF:EFSelect>
<EF:EFComboColumn cname="类型" ename="receiveType" width="90" align="center" required="false" enable="false"> <EF:EFSelect ename="inventTypeDetail" cname="存货类型" blockId="inqu_status" row="0" colWidth="3"
<EF:EFCodeOption codeName="hggp.receiveType" /> filter="contains">
</EF:EFComboColumn> <EF:EFOption label="全部" value=""/>
<EF:EFComboColumn ename="companyCode" cname="公司名称" <EF:EFCodeOption codeName="hggp.hgpz.inventTypeDetail"/>
columnTemplate="#=textField#" itemTemplate="#=textField#" </EF:EFSelect>
textField="textField" valueField="valueField" <EF:EFSelect ename="status" cname="状态" blockId="inqu_status" row="0" colWidth="3">
maxLength="16" width="140" required="true" <EF:EFOption label="全部" value=""/>
align="center" filter="contains" sort="true"> <EF:EFCodeOption codeName="hggp.sc.productStatus"/>
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/> </EF:EFSelect>
</EF:EFComboColumn> </div>
<EF:EFColumn ename="companyName" cname="公司名称" hidden="true"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="true" width="130" align="center" required="true"/>
<EF:EFColumn ename="projName" cname="项目名称" width="120" align="center" enable="false" required="true"/>
<EF:EFColumn ename="applyCode" cname="生产领料单号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="whCode" cname="仓库编码" enable="true" width="120" align="center" required="true"/>
<EF:EFColumn ename="whName" cname="仓库名称" width="120" align="center" enable="false" required="true"/>
<EF:EFComboColumn cname="状态" ename="status" width="90" align="center" required="false" enable="false">
<EF:EFCodeOption codeName="hggp.sc.productStatus" />
</EF:EFComboColumn>
</EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true" copyToAdd="false">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>
<EF:EFComboColumn cname="类型" ename="receiveType" width="90" align="center" required="false" enable="false">
<EF:EFCodeOption codeName="hggp.receiveType"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="companyCode" cname="公司名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" width="140" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="companyName" cname="公司名称" hidden="true"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="true" width="130" align="center" required="true"/>
<EF:EFColumn ename="projName" cname="项目名称" width="120" align="center" enable="false" required="true"/>
<EF:EFColumn ename="applyCode" cname="生产领料单号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="whCode" cname="仓库编码" enable="true" width="120" align="center" required="true"/>
<EF:EFColumn ename="whName" cname="仓库名称" width="120" align="center" enable="false" required="true"/>
<EF:EFComboColumn ename="receiveUserId" cname="领料人" width="120" align="center"
required="true" blockName="user_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="receiveUserName" cname="领料人姓名" width="120" align="center" enable="false" hidden="true"/>
<EF:EFComboColumn cname="状态" ename="status" width="90" align="center" required="false" enable="false">
<EF:EFCodeOption codeName="hggp.sc.productStatus"/>
</EF:EFComboColumn>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage> </EF:EFPage>
...@@ -25,18 +25,17 @@ $(function (){ ...@@ -25,18 +25,17 @@ $(function (){
e.preventDefault(); e.preventDefault();
} }
}, },
columns: [ columns: [{
{ field: "inventCode",
field: "inventCode", template: function (item) {
template: function (item) { let template = "";
let template = ""; if (item.inventCode) {
if(item.inventCode){ for (let i = 0; i < inventRecordBoxBlocks.length; i++) {
for(let i=0;i<inventRecordBoxBlocks.length;i++){ if (item.inventCode === inventRecordBoxBlocks[i]['valueField']) {
if(item.inventCode === inventRecordBoxBlocks[i]['valueField']){ template = inventRecordBoxBlocks[i]['valueField'];
template = inventRecordBoxBlocks[i]['valueField']; }
} }
} }
}
return template; return template;
}, },
editor: function (container, options) { editor: function (container, options) {
...@@ -55,8 +54,7 @@ $(function (){ ...@@ -55,8 +54,7 @@ $(function (){
filter: "contains" filter: "contains"
}); });
} }
}, }, {
{
field: "receiveId", field: "receiveId",
template: function (item) { template: function (item) {
item['receiveId'] =$("#inqu_status-0-receiveId").val(); item['receiveId'] =$("#inqu_status-0-receiveId").val();
......
...@@ -40,16 +40,11 @@ let confirm = function () { ...@@ -40,16 +40,11 @@ let confirm = function () {
return; return;
} }
for (let i = 0; i < rows.length; i++) { for (let i = 0; i < rows.length; i++) {
let invQty = rows[i]['invQty']; let applyQty = rows[i]['applyQty'];
let invWeight = rows[i]['invWeight']; if (!isPositiveNumber(applyQty)) {
if (!isPositiveNumber(invQty)) { message("勾选的第" + (i + 1) + "行申请数量必须大于0");
message("勾选的第" + (i + 1) + "行库存数量必须大于0");
return; return;
} }
// if (!isPositiveNumber(invWeight)) {
// message("勾选的第" + (i + 1) + "行库存总重必须大于0");
// return;
// }
} }
JSUtils.confirm("确定对勾选的[" + rows.length + "]条数据进行\"生产领料\"操作吗? ", { JSUtils.confirm("确定对勾选的[" + rows.length + "]条数据进行\"生产领料\"操作吗? ", {
ok: function () { ok: function () {
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/> <EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="specId" cname="规格ID" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="specId" cname="规格ID" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/> <EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="applyQty" cname="申请数量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="invQty" cname="库存数量" enable="false" width="120" align="right" format="{0:N3}"/> <EF:EFColumn ename="invQty" cname="库存数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="invUnitWeight" cname="单重(KG)" enable="false" width="120" align="right" format="{0:N3}"/> <EF:EFColumn ename="invUnitWeight" cname="单重(KG)" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="invWeight" cname="库存总重(KG)" enable="false" width="120" align="right" format="{0:N3}"/> <EF:EFColumn ename="invWeight" cname="库存总重(KG)" enable="false" width="120" align="right" format="{0:N3}"/>
......
...@@ -15,7 +15,6 @@ $(function () { ...@@ -15,7 +15,6 @@ $(function () {
field: "operator", field: "operator",
template: function (item) { template: function (item) {
let template = ''; let template = '';
debugger;
// banner清单 // banner清单
if (item.id) { if (item.id) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
......
...@@ -6,6 +6,12 @@ $(function () { ...@@ -6,6 +6,12 @@ $(function () {
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
}); });
// 正序排产
$("#BNT_SCHEDULE_EX").on("click", scheduleEx);
// 倒序排产
$("#BNT_SCHEDULE").on("click", schedule);
IPLATUI.EFGrid.result = { IPLATUI.EFGrid.result = {
pageable: { pageable: {
pageSize: 20, pageSize: 20,
...@@ -14,8 +20,6 @@ $(function () { ...@@ -14,8 +20,6 @@ $(function () {
columns: [ columns: [
], ],
loadComplete: function(grid) { loadComplete: function(grid) {
//排产
$("#BNT_SCHEDULE").on("click", schedule);
}, },
onSuccess: function (e) { onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete' if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete'
...@@ -39,7 +43,18 @@ $(window).load(function () { ...@@ -39,7 +43,18 @@ $(window).load(function () {
}); });
/** /**
* 排产 * 正序排产
*/
function schedule() {
JSUtils.confirm("自动排产将覆盖原排产数据,请谨慎操作,确认对当前数据进行排产? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGSC005A", "scheduleEx", true);
}
});
}
/**
* 倒序排产
*/ */
function schedule() { function schedule() {
JSUtils.confirm("自动排产将覆盖原排产数据,请谨慎操作,确认对当前数据进行排产? ", { JSUtils.confirm("自动排产将覆盖原排产数据,请谨慎操作,确认对当前数据进行排产? ", {
......
...@@ -39,10 +39,10 @@ ...@@ -39,10 +39,10 @@
<EF:EFColumn ename="productName" cname="产品名称" width="120" enable="true" align="center" readonly="true"/> <EF:EFColumn ename="productName" cname="产品名称" width="120" enable="true" align="center" readonly="true"/>
<EF:EFColumn ename="processName" cname="工序" width="120" enable="true" align="center" readonly="true"/> <EF:EFColumn ename="processName" cname="工序" width="120" enable="true" align="center" readonly="true"/>
<EF:EFColumn ename="finishDate" cname="交货日期" width="120" enable="true" align="center" readonly="true"/> <EF:EFColumn ename="finishDate" cname="交货日期" width="120" enable="true" align="center" readonly="true"/>
<EF:EFColumn ename="planStartDate" cname="计划开工日期" width="120" enable="true" align="center" editType="date" <EF:EFColumn ename="planStartDate" cname="计划开工日期" width="140" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" required="true"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" required="true" copy="true"/>
<EF:EFColumn ename="planEndDate" cname="计划完工日期" width="120" enable="true" align="center" editType="date" <EF:EFColumn ename="planEndDate" cname="计划完工日期" width="140" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" required="true"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" required="true" copy="true"/>
<EF:EFColumn ename="singleWeight" cname="单重(KG)" format="{0:0.00}" editType="text" width="120" enable="true" <EF:EFColumn ename="singleWeight" cname="单重(KG)" format="{0:0.00}" editType="text" width="120" enable="true"
align="center" readonly="true"/> align="center" readonly="true"/>
<EF:EFColumn ename="totalWeight" cname="计划重量(KG)" format="{0:0.00}" editType="text" width="120" <EF:EFColumn ename="totalWeight" cname="计划重量(KG)" format="{0:0.00}" editType="text" width="120"
......
...@@ -258,23 +258,34 @@ let showDownloadRecord = function (fileId, docId) { ...@@ -258,23 +258,34 @@ let showDownloadRecord = function (fileId, docId) {
* 预览 * 预览
*/ */
let preview = function () { let preview = function () {
let rows = resultGrid.getCheckedRows(); let params = {
if (rows.length < 1) { "inqu_status-0-fileId": $("#inqu_status-0-fileId").val()
message("请选择数据");
return;
} }
JSUtils.submitGridsData("result", "HGWD001B", "add", false, JSColorbox.open({
function (res) { href: "HGWD002A",
if (res.status > -1) { title: "<div style='text-align: center;'>文件预览</div>",
for (let i = 0; i < rows.length; i++) { width: "90%",
let row = rows[i]; height: "95%",
previewDoc(row['docType'], row['docId']); params: params
} });
} else {
message(res.msg); // let rows = resultGrid.getCheckedRows();
} // if (rows.length < 1) {
} // message("请选择数据");
); // return;
// }
// JSUtils.submitGridsData("result", "HGWD001B", "add", false,
// function (res) {
// if (res.status > -1) {
// for (let i = 0; i < rows.length; i++) {
// let row = rows[i];
// previewDoc(row['docType'], row['docId']);
// }
// } else {
// message(res.msg);
// }
// }
// );
} }
/** /**
......
$(function () {
IPLATUI.EFTree = {
"docTree": {
query: function (inInfo, model) {
inInfo.set("inqu_status-0-fileId", $("#inqu_status-0-fileId").val());
return inInfo;
},
select: function (e) {
var nodeData = this.dataItem(e.node);
let label = nodeData.label;
let leafType = nodeData.leafType;
IPLATUI.EFTree.docTree.selectNode.treeId = label;
IPLATUI.EFTree.docTree.selectNode.leaf = nodeData.leaf;
IPLATUI.EFTree.docTree.selectNode.leafType = leafType;
// 添加预览记录
add(label, leafType, nodeData.docType);
},
template: function (node) {
var item = node.item;
let icon = 'fa fa-globe'
switch (item.leafType) {
case 'P':
icon = 'fa fa-clipboard'
break;
case 'C':
icon = 'fa fa-folder'
break;
}
return '<span class="' + icon + '" style="padding-right: 8px"> </span>'
+ '<span class="titleClass" title="' + item.label + '">'
+ item.text + '</span>'
},
loadComplete: function (options) {
// 保持结点展开状态
let fileId = $("#inqu_status-0-fileId").val();
let tree = $("#docTree").data("kendoTreeView");
expandTreeNode(tree, fileId);
},
selectNode: {
treeId: '',
leaf: false,
leafType: '',
}
// ROOT: {label: "root", text: "系统菜单", leaf: true}
}
};
});
/**
* 页面加载完后执行
*/
$(window).load(function () {
imageMouseListener();
});
/**
* 图片鼠标事件监听
*/
function imageMouseListener() {
document.getElementById('image').addEventListener('mousewheel', function (event) {
var scale = event.wheelDelta / 1000;
var newScale = Math.max(Math.min(this.scale || 1, 3), 0.1);
newScale += scale;
this.style.transform = 'scale(' + newScale + ')';
this.scale = newScale;
event.preventDefault();
});
}
function zoomImage(scale) {
var img = document.getElementById('image');
var width = img.naturalWidth * (scale / 100);
var height = img.naturalHeight * (scale / 100);
img.style.width = width + 'px';
img.style.height = height + 'px';
}
/**
* 批量展开树节点
*
* @param tree
* @param node
*/
function expandTreeNode(tree, node) {
if (node == null || tree == null) {
return;
}
let barDataItem = tree.dataSource.get(node);
if (barDataItem) {
tree.expandPath([node])
} else {
setTimeout(() => {
expandTreeNode(tree, node)
}, 100)
}
}
/**
* 预览
*
* @param label docId
* @param leafType 节点类型:C=目录,F=文件
* @param docType
*/
function add(docId, leafType, docType) {
if (isBlank(leafType) || isBlank(docId)) {
message("文件类型或ID不能为空");
return;
}
let inInfo = new EiInfo();
inInfo.set("result-0-fileId", $("#inqu_status-0-fileId").val());
inInfo.set("result-0-docId", docId);
EiCommunicator.send('HGWD001B', 'add', inInfo, {
onSuccess: function (res) {
if (res.getStatus() >= 0) {
preview(docId, docType);
} else {
message(res.getMsg());
}
},
onFail: function (res) {
NotificationUtil("操作失败,原因[" + res.getMsg() + "]", "error");
}
});
}
/**
* 新增记录后回调
*
* @param docId
* @param docType
*/
function preview(docId, docType) {
// 隐藏预览区域
hideHtml();
// 隐藏文本描述
$("#descDiv").css('display', 'none');
if ("docx" == docType) {
previewDocx(docId);
} else if (isImage(docType)) {
previewImage(docId);
} else if (isFrame(docType)) {
previewFrame(docId);
} else {
otherDownload(docId);
}
}
/**
* 隐藏显示区域
*/
function hideHtml() {
$("#docxContainer").css('display', 'none');
$("#imageContainer").css('display', 'none');
$("#previewFrame").css('display', 'none');
}
/**
* docx预览
*
* @param docId
*/
function previewDocx(docId) {
fetch(downloadHref(docId, true)).then(res => {
return res.arrayBuffer();
}).then(arrayBuffer => {
let container = document.getElementById("docxContainer");
container.style.display = 'block';
docx.renderAsync(arrayBuffer, container).then((x) => {
console.log("docx: finished")
});
});
}
/**
* 判断是否是图片
*
* @param fileName
* @returns {boolean}
*/
function isImage(docType) {
if (isBlank(docType)) {
return false;
}
const extensions = ['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp'];
return extensions.includes(docType.toLowerCase());
}
/**
* image预览
*
* @param docId
*/
function previewImage(docId) {
$("#image").attr('src', downloadHref(docId, true));
$("#imageContainer").css('display', '');
}
/**
* 判断是否frame预览
*
* @param fileName
* @returns {boolean}
*/
function isFrame(docType) {
if (isBlank(docType)) {
return false;
}
const extensions = ['pdf'];
return extensions.includes(docType.toLowerCase());
}
/**
* frame预览
*
* @param docId
*/
function previewFrame(docId) {
$("#previewFrame").css('display', '');
$("#previewFrame").attr("src", downloadHref(docId, true));
}
/**
* 其他下载
*
* @param docId
*/
function otherDownload(docId) {
$("#descDiv").css('display', '');
$("#descSpan").html("该文件暂不支持预览,点击<a href='" + downloadHref(docId, false)
+ "' target='_blank'>下载</a>");
}
<!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 src="${ctx}/common/docxjs/jszip.min.js"></script>
<script src="${ctx}/common/docxjs/docx-preview.js"></script>
<style>
.left-flex {
display: flex;
align-items: center;
height: 100%;
width: 100%;
overflow: scroll;
}
.center-flex {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 100%;
overflow: scroll;
}
iframe {
min-width: 100%;
min-height: 100%;
border: 0px;
}
.imageContainer {
display: flex;
flex-direction: column;
height: 100%;
}
.wide-div {
flex: 1;
flex-basis: 90%;
overflow: scroll;
}
.narrow-div {
flex: 0 0 10%;
}
img {
max-width: 100%;
max-height: 100%;
cursor: zoom-in;
transition: transform 0.1s;
}
img:hover {
cursor: zoom-out;
}
.zoom-slider {
width: 100%;
margin-top: 10px;
}
</style>
<EF:EFPage title="文件预览">
<div class="row" style="margin: 0 -10px;">
<div class="col-md-3">
<EF:EFRegion title="文件目录树" id="tree" fitHeight="true">
<EF:EFInput ename="fileId" cname="文件ID" blockId="inqu_status" row="0" type="hidden"/>
<div id="menu" style="margin-top: 12px; margin-bottom: 8px">
<EF:EFTree bindId="docTree" ename="node" textField="text" valueField="label" hasChildren="leaf"
serviceName="HGWD002A" methodName="queryTree" expandLevel="1">
</EF:EFTree>
</div>
</EF:EFRegion>
</div>
<div class="col-md-9">
<EF:EFRegion title="预览区域" id="preview" fitHeight="true">
<div id="descDiv" class="center-flex">
<span id="descSpan" style="font-weight: bold;font-size: 18px">文件预览区域...</span>
</div>
<%-- docx文件预览--%>
<div id="docxContainer" style="display: none;"></div>
<%-- IMAGE文件预览--%>
<div id="imageContainer" class="left-flex" style="display: none;">
<%-- <div class="wide-div">--%>
<img id="image" src="" style="border: 1px solid gray;"/>
<%-- </div>--%>
<%-- <div class="narrow-div">--%>
<%-- <input type="range" id="zoom-slider" class="zoom-slider" min="10" max="300" value="100"--%>
<%-- oninput="zoomImage(this.value)">--%>
<%-- </div>--%>
</div>
<%-- other --%>
<iframe id="previewFrame" src="" style="display: none;"></iframe>
</EF:EFRegion>
</div>
</div>
</EF:EFPage>
...@@ -9,7 +9,6 @@ $(document).ready(function () { ...@@ -9,7 +9,6 @@ $(document).ready(function () {
}).then(arrayBuffer => { }).then(arrayBuffer => {
renderDocx(arrayBuffer); renderDocx(arrayBuffer);
}); });
}); });
/** /**
......
...@@ -7,10 +7,13 @@ ...@@ -7,10 +7,13 @@
<script src="${ctx}/common/docxjs/jszip.min.js"></script> <script src="${ctx}/common/docxjs/jszip.min.js"></script>
<script src="${ctx}/common/docxjs/docx-preview.js"></script> <script src="${ctx}/common/docxjs/docx-preview.js"></script>
<style>
.fixed-window {
height: 92vh;
overflow-y: scroll;
}
</style>
<EF:EFPage title="WORD预览"> <EF:EFPage title="WORD预览">
<EF:EFRegion id="result" title="展示区域" fitHeight="true"> <EF:EFInput cname="文件ID" ename="docId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="文件ID" ename="docId" blockId="inqu_status" row="0" type="hidden"/> <div id="docx-container" class="fixed-window"></div>
<div id="docx-container"></div>
</EF:EFRegion>
</EF:EFPage> </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