Commit 83e9b103 by 宋祥

1.生产领料页面优化,增加查询条件

parent 3825520d
...@@ -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.
...@@ -180,7 +186,13 @@ public class HGKC008 extends DaoEPBase { ...@@ -180,7 +186,13 @@ public class HGKC008 extends DaoEPBase {
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);
} }
/** /**
...@@ -495,6 +507,22 @@ public class HGKC008 extends DaoEPBase { ...@@ -495,6 +507,22 @@ public class HGKC008 extends DaoEPBase {
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
...@@ -47,9 +47,9 @@ public class ServiceHGKC008 extends ServiceBase { ...@@ -47,9 +47,9 @@ public class ServiceHGKC008 extends ServiceBase {
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) {
...@@ -84,7 +84,9 @@ public class ServiceHGKC008 extends ServiceBase { ...@@ -84,7 +84,9 @@ public class ServiceHGKC008 extends ServiceBase {
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>() {{
put("ids", ids);
}});
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
...@@ -94,24 +96,28 @@ public class ServiceHGKC008 extends ServiceBase { ...@@ -94,24 +96,28 @@ public class ServiceHGKC008 extends ServiceBase {
return inInfo; return inInfo;
} }
public EiInfo save(EiInfo inInfo){ /**
* @param inInfo
* @return
*/
public EiInfo save(EiInfo inInfo) {
try { try {
Map resultMap = EiInfoUtils.getFirstRow(inInfo,EiConstant.resultBlock); List<HGKC008> fKc008s = MapUtils.toDaoEPBases(inInfo, HGKC008.class);
HGKC008 hgkc008 = new HGKC008(); for (HGKC008 fKc008 : fKc008s) {
hgkc008.fromMap(resultMap); this.checkSaveData(fKc008);
this.checkSaveData(hgkc008); if (Objects.nonNull(fKc008.getId()) && fKc008.getId() != 0) {
if(Objects.nonNull(hgkc008.getId())&&hgkc008.getId()!=0){ DaoUtils.update(HGKC008.UPDATE, fKc008);
DaoUtils.update(HGKC008.UPDATE, hgkc008);
//同时修改子表的仓库数据、公司数据 //同时修改子表的仓库数据、公司数据
HGKCTools.HgKc008A.updateWhCodeByReceiveId(hgkc008); HGKCTools.HgKc008A.updateWhCodeByReceiveId(fKc008);
}else { } else {
//生成生产领料编号 //生成生产领料编号
hgkc008.setApplyCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.RECEIVE_CODE)); fKc008.setApplyCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.RECEIVE_CODE));
hgkc008.setStatus(HGConstant.ProductStatus.WTJ); fKc008.setStatus(HGConstant.ProductStatus.WTJ);
DaoUtils.insert(HGKC008.INSERT, hgkc008); DaoUtils.insert(HGKC008.INSERT, fKc008);
// EiInfoUtils.addBlock(inInfo, "entity", hgkc008, HGKC008.class);
EiInfoUtils.addBlock(inInfo,"entity", hgkc008, HGKC008.class); }
} }
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!"); inInfo.setMsg("保存成功!");
} catch (Exception e) { } catch (Exception e) {
...@@ -126,8 +132,8 @@ public class ServiceHGKC008 extends ServiceBase { ...@@ -126,8 +132,8 @@ public class ServiceHGKC008 extends ServiceBase {
* @param hgkc008 * @param hgkc008
*/ */
private void checkSaveData(HGKC008 hgkc008) { private void checkSaveData(HGKC008 hgkc008) {
if(Objects.nonNull(hgkc008.getId())&&hgkc008.getId()>0){ if (Objects.nonNull(hgkc008.getId()) && hgkc008.getId() > 0) {
AssertUtils.isTrue(hgkc008.getStatus().compareTo(HGConstant.ProductStatus.YTJ) == 0,"领料单已提交,不可修改"); AssertUtils.isTrue(hgkc008.getStatus().compareTo(HGConstant.ProductStatus.YTJ) == 0, "领料单已提交,不可修改");
} }
AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!"); AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!"); AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
...@@ -136,7 +142,6 @@ public class ServiceHGKC008 extends ServiceBase { ...@@ -136,7 +142,6 @@ public class ServiceHGKC008 extends ServiceBase {
AssertUtils.isEmpty(hgkc008.getWhName(), "请选择仓库信息!"); AssertUtils.isEmpty(hgkc008.getWhName(), "请选择仓库信息!");
} }
/** /**
* 修改启用状态 * 修改启用状态
* @param inInfo * @param inInfo
......
...@@ -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="HGKC008"> <sqlMap namespace="HGKC008">
<sql id="column">
ID as "id", <!-- 主键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", <!-- 公司名称 -->
RECEIPT_DATE as "receiptDate", <!-- 单据日期 -->
APPLY_CODE as "applyCode", <!-- 申请单号 -->
WH_CODE as "whCode", <!-- 仓库编号 -->
WH_NAME as "whName", <!-- 仓库名称 -->
STATUS as "status", <!-- 状态 0未提交,1已提交 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
RECEIVE_TYPE as "receiveType", <!-- 领料单类型 0:正常,1:退库 -->
RECEIVE_USER_ID as "receiveUserId", <!-- 领料人ID -->
RECEIVE_USER_NAME as "receiveUserName" <!-- 领料人姓名 -->
</sql>
<sql id="condition"> <sql id="condition">
<include refid="HGXSDataAuth.authCondition"/> <include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
...@@ -58,6 +83,9 @@ ...@@ -58,6 +83,9 @@
<isNotEmpty prepend=" AND " property="receiveType"> <isNotEmpty prepend=" AND " property="receiveType">
RECEIVE_TYPE = #receiveType# RECEIVE_TYPE = #receiveType#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveUserId">
RECEIVE_USER_ID = #receiveUserId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode"> <isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode# PROJ_CODE = #projCode#
</isNotEmpty> </isNotEmpty>
...@@ -66,31 +94,14 @@ ...@@ -66,31 +94,14 @@
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <sql id="customCondition">
resultClass="com.baosight.hggp.hg.kc.domain.HGKC008"> <include refid="condition"/>
SELECT <isNotEmpty prepend=" AND " property="inventTypeDetail">
ID as "id", <!-- 主键id --> ID IN (SELECT RECEIVE_ID FROM ${hggpSchema}.HGKC008A WHERE INVENT_TYPE_DETAIL = #inventTypeDetail#)
ACCOUNT_CODE as "accountCode", <!-- 账套 --> </isNotEmpty>
DEP_CODE as "depCode", <!-- 部门编码 --> </sql>
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 --> <sql id="orderBy">
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", <!-- 公司名称 -->
RECEIPT_DATE as "receiptDate", <!-- 单据日期 -->
APPLY_CODE as "applyCode", <!-- 申请单号 -->
WH_CODE as "whCode", <!-- 仓库编号 -->
WH_NAME as "whName", <!-- 仓库名称 -->
STATUS as "status", <!-- 状态 0未提交,1已提交 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
RECEIVE_TYPE as "receiveType" <!-- 领料单类型 0:正常,1:退库 -->
FROM ${hggpSchema}.HGKC008 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
...@@ -99,17 +110,23 @@ ...@@ -99,17 +110,23 @@
CREATED_TIME desc CREATED_TIME desc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.kc.domain.HGKC008">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGKC008 WHERE 1=1
<include refid="customCondition" />
<include refid="orderBy"/>
</select> </select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGKC008 WHERE 1=1 SELECT COUNT(*) FROM ${hggpSchema}.HGKC008 WHERE 1=1
<include refid="condition" /> <include refid="customCondition"/>
</select> </select>
<insert id="insert"> <insert id="insert">
INSERT INTO ${hggpSchema}.HGKC008 (ID, <!-- 主键id --> INSERT INTO ${hggpSchema}.HGKC008 (
PROJ_CODE, <!-- 项目编码 --> PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 --> PROJ_NAME, <!-- 项目名称 -->
ACCOUNT_CODE, <!-- 账套 --> ACCOUNT_CODE, <!-- 账套 -->
...@@ -117,9 +134,6 @@ ...@@ -117,9 +134,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-是 -->
COMPANY_CODE, <!-- 公司编码 --> COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 --> COMPANY_NAME, <!-- 公司名称 -->
...@@ -128,9 +142,13 @@ ...@@ -128,9 +142,13 @@
WH_CODE, <!-- 仓库编号 --> WH_CODE, <!-- 仓库编号 -->
WH_NAME, <!-- 仓库名称 --> WH_NAME, <!-- 仓库名称 -->
STATUS, <!-- 状态 0未提交,1已提交 --> STATUS, <!-- 状态 0未提交,1已提交 -->
RECEIVE_TYPE <!-- 领料单类型 0:正常,1:退库 --> RECEIVE_TYPE, <!-- 领料单类型 0:正常,1:退库 -->
) RECEIVE_USER_ID,
VALUES (#id#,#projCode#, #projName#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #receiptDate#, #applyCode#, #whCode#, #whName#, #status#, #receiveType#) RECEIVE_USER_NAME
) VALUES (
#projCode#, #projName#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #companyCode#, #companyName#, #receiptDate#,
#applyCode#, #whCode#, #whName#, #status#, #receiveType#, #receiveUserId#, #receiveUserName#)
<selectKey resultClass="long" keyProperty="id"> <selectKey resultClass="long" keyProperty="id">
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGKC008 SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGKC008
</selectKey> </selectKey>
...@@ -143,34 +161,29 @@ ...@@ -143,34 +161,29 @@
<update id="update"> <update id="update">
UPDATE ${hggpSchema}.HGKC008 UPDATE ${hggpSchema}.HGKC008
SET SET
ACCOUNT_CODE = #accountCode#, <!-- 账套 -->
PROJ_CODE = #projCode#, <!-- 项目编码 --> PROJ_CODE = #projCode#, <!-- 项目编码 -->
PROJ_NAME = #projName#, <!-- 项目名称 --> PROJ_NAME = #projName#, <!-- 项目名称 -->
DEP_CODE = #depCode#, <!-- 部门编码 -->
CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_NAME = #createdName#, <!-- 创建人名称 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 修改人 --> UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 --> UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 修改时间 --> UPDATED_TIME = #updatedTime#, <!-- 修改时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除 0-否1-是 -->
COMPANY_CODE = #companyCode#, <!-- 公司编码 --> COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 --> COMPANY_NAME = #companyName#, <!-- 公司名称 -->
RECEIPT_DATE = #receiptDate#, <!-- 单据日期 --> RECEIPT_DATE = #receiptDate#, <!-- 单据日期 -->
APPLY_CODE = #applyCode#, <!-- 申请单号 -->
WH_CODE = #whCode#, <!-- 仓库编号 --> WH_CODE = #whCode#, <!-- 仓库编号 -->
WH_NAME = #whName#, <!-- 仓库名称 --> WH_NAME = #whName#, <!-- 仓库名称 -->
STATUS = #status#, <!-- 状态 0未提交,1已提交 --> STATUS = #status#, <!-- 状态 0未提交,1已提交 -->
RECEIVE_TYPE = #receiveType# <!-- 领料单类型 0:正常,1:退库 --> RECEIVE_TYPE = #receiveType#, <!-- 领料单类型 0:正常,1:退库 -->
RECEIVE_USER_ID = #receiveUserId#,
RECEIVE_USER_NAME = #receiveUserName#
WHERE ID = #id# WHERE ID = #id#
</update> </update>
<delete id="batchDelete"> <delete id="batchDelete">
DELETE FROM ${hggpSchema}.HGKC008 WHERE DELETE FROM ${hggpSchema}.HGKC008 WHERE
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate> id IN
<iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</delete> </delete>
<update id="updateStatus"> <update id="updateStatus">
UPDATE ${hggpSchema}.HGKC008 UPDATE ${hggpSchema}.HGKC008
SET SET
...@@ -181,6 +194,7 @@ ...@@ -181,6 +194,7 @@
WHERE WHERE
ID = #id# ID = #id#
</update> </update>
<update id="updateReceiveType"> <update id="updateReceiveType">
UPDATE ${hggpSchema}.HGKC008 UPDATE ${hggpSchema}.HGKC008
SET SET
......
<?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">
...@@ -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);
......
...@@ -1060,9 +1060,10 @@ public class HGSCTools { ...@@ -1060,9 +1060,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()));
//通过工序编码查询工序设置 //通过工序编码查询工序设置
...@@ -1114,24 +1115,24 @@ public class HGSCTools { ...@@ -1114,24 +1115,24 @@ 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 private static BigDecimal calculateWordHour(HGSC005A planInfo, List<HGSJ001> hgsj001List,
, List<HGPZ005> hgpz005List, List<HGPZ005A> hgpz005AList List<HGPZ005> hgpz005List, List<HGPZ005A> hgpz005AList, String endDate, BigDecimal remainder) {
, 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())){
......
...@@ -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"/>
......
...@@ -3,6 +3,7 @@ $(function (){ ...@@ -3,6 +3,7 @@ $(function (){
var companyCodes = __eiInfo.getBlock("roleCompany").getMappedRows(); var companyCodes = __eiInfo.getBlock("roleCompany").getMappedRows();
var projCodes = __eiInfo.getBlock("projRecordByRole_block_id").getMappedRows(); var projCodes = __eiInfo.getBlock("projRecordByRole_block_id").getMappedRows();
var whRecordBoxBlocks = __eiInfo.getBlock("wh_record_block_id").getMappedRows(); var whRecordBoxBlocks = __eiInfo.getBlock("wh_record_block_id").getMappedRows();
var users = __eiInfo.getBlock("user_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3"); $(".row").children().attr("class", "col-md-3");
...@@ -21,16 +22,16 @@ $(function (){ ...@@ -21,16 +22,16 @@ $(function (){
pageSize: 10, pageSize: 10,
pageSizes: [10, 20, 50, 100], pageSizes: [10, 20, 50, 100],
}, },
columns: [ columns: [{
{
field: "operator", field: "operator",
title: "操作", title: "操作",
template: function (item) { template: function (item) {
let status = item.status; let status = item.status;
let template = ''; let template = '';
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" '
+ 'onclick="showDetail(' + item.id + ',\''+item.whCode+'\',\''+item.companyCode+'\',\''+item.status+'\')" >领料详情</a>'; + 'onclick="showDetail(' + item.id + ',\'' + item.whCode + '\',\''
+ item.companyCode + '\',\'' + item.status + '\')" >领料详情</a>';
if (status == 0) { if (status == 0) {
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" '
+ 'onclick="updateStatus(' + item.id + ',1)" >提交</a>'; + 'onclick="updateStatus(' + item.id + ',1)" >提交</a>';
...@@ -38,11 +39,11 @@ $(function (){ ...@@ -38,11 +39,11 @@ $(function (){
} }
return template; return template;
} }
},{ }, {
field: "companyCode", field: "companyCode",
template: function (dataItem) { template: function (dataItem) {
for (let i = 0; i < companyCodes.length; i++) { for (let i = 0; i < companyCodes.length; i++) {
if (companyCodes[i]['companyCode'] === dataItem['companyCode']){ if (companyCodes[i]['companyCode'] === dataItem['companyCode']) {
dataItem['companyName'] = companyCodes[i]['companyName'] dataItem['companyName'] = companyCodes[i]['companyName']
return companyCodes[i]['companyName']; return companyCodes[i]['companyName'];
} }
...@@ -53,9 +54,9 @@ $(function (){ ...@@ -53,9 +54,9 @@ $(function (){
field: "projCode", field: "projCode",
template: function (item) { template: function (item) {
let template = ""; let template = "";
if(item.projCode){ if (item.projCode) {
for(let i=0;i<projCodes.length;i++){ for (let i = 0; i < projCodes.length; i++) {
if(item.projCode === projCodes[i]['valueField']){ if (item.projCode === projCodes[i]['valueField']) {
template = projCodes[i]['valueField']; template = projCodes[i]['valueField'];
} }
} }
...@@ -94,9 +95,9 @@ $(function (){ ...@@ -94,9 +95,9 @@ $(function (){
field: "whCode", field: "whCode",
template: function (item) { template: function (item) {
let template = ""; let template = "";
if(item.whCode){ if (item.whCode) {
for(let i=0;i<whRecordBoxBlocks.length;i++){ for (let i = 0; i < whRecordBoxBlocks.length; i++) {
if(item.whCode === whRecordBoxBlocks[i]['valueField']){ if (item.whCode === whRecordBoxBlocks[i]['valueField']) {
template = whRecordBoxBlocks[i]['valueField']; template = whRecordBoxBlocks[i]['valueField'];
} }
} }
...@@ -160,6 +161,13 @@ $(function (){ ...@@ -160,6 +161,13 @@ $(function (){
} }
} }
} }
if (e.field == "receiveUserId") {
for (let i = 0; i < users.length; i++) {
if (item.receiveUserId === users[i]['valueField']) {
resultGrid.setCellValue(item, 'receiveUserName', users[i]['textField'])
}
}
}
}); });
}, },
beforeEdit: function (e) { beforeEdit: function (e) {
...@@ -184,7 +192,7 @@ $(function (){ ...@@ -184,7 +192,7 @@ $(function (){
//deleteFunc(); //deleteFunc();
}, },
onSuccess: function (e) { onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') { if (e.eiInfo.extAttr.methodName == 'delete') {
query(); query();
} }
}, },
......
...@@ -19,13 +19,29 @@ ...@@ -19,13 +19,29 @@
<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>
<div class="row">
<EF:EFSelect ename="receiveUserId" cname="领料人" blockId="inqu_status" row="0" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect ename="inventTypeDetail" cname="存货类型" blockId="inqu_status" row="0" colWidth="3"
filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.hgpz.inventTypeDetail"/>
</EF:EFSelect>
<EF:EFSelect ename="status" cname="状态" blockId="inqu_status" row="0" colWidth="3">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.sc.productStatus"/>
</EF:EFSelect>
</div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="记录集"> <EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true" copyToAdd="false"> <EF:EFGrid blockId="result" autoDraw="no" isFloat="true" copyToAdd="false">
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/> <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:EFComboColumn cname="类型" ename="receiveType" width="90" align="center" required="false" enable="false">
<EF:EFCodeOption codeName="hggp.receiveType" /> <EF:EFCodeOption codeName="hggp.receiveType"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="companyCode" cname="公司名称" <EF:EFComboColumn ename="companyCode" cname="公司名称"
columnTemplate="#=textField#" itemTemplate="#=textField#" columnTemplate="#=textField#" itemTemplate="#=textField#"
...@@ -42,8 +58,13 @@ ...@@ -42,8 +58,13 @@
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="whCode" cname="仓库编码" enable="true" width="120" align="center" 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: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:EFComboColumn cname="状态" ename="status" width="90" align="center" required="false" enable="false">
<EF:EFCodeOption codeName="hggp.sc.productStatus" /> <EF:EFCodeOption codeName="hggp.sc.productStatus"/>
</EF:EFComboColumn> </EF:EFComboColumn>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
......
...@@ -25,14 +25,13 @@ $(function (){ ...@@ -25,14 +25,13 @@ $(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'];
} }
} }
...@@ -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}"/>
......
...@@ -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"
......
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