Commit 83e9b103 by 宋祥

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

parent 3825520d
......@@ -42,6 +42,8 @@ public class HGKC008 extends DaoEPBase {
public static final String FIELD_RECEIVE_TYPE = "receiveType"; /* 领料单类型 0:正常,1:退库*/
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/
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_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 账套*/
......@@ -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_PROJ_CODE = "PROJ_CODE"; /* 项目编码*/
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 COUNT = "HGKC008.count";
......@@ -93,6 +97,8 @@ public class HGKC008 extends DaoEPBase {
private Integer receiveType = new Integer(0); /* 领料单类型 0:正常,1:退库*/
private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/
private String receiveUserId = " "; /* 领用人ID*/
private String receiveUserName = " "; /* 领用人姓名*/
/**
* initialize the metadata.
......@@ -179,8 +185,14 @@ public class HGKC008 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_PROJ_NAME);
eiColumn.setDescName("项目名称");
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 {
public void setProjName(String 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.
*
......@@ -523,6 +551,8 @@ public class HGKC008 extends DaoEPBase {
setReceiveType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_RECEIVE_TYPE)), receiveType));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
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 {
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_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;
}
......
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;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.ErrorCodeUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
......@@ -35,7 +36,6 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* @Author jhs
* @Date 2024/5/14 14:46
......@@ -44,12 +44,12 @@ public class ServiceHGKC008 extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGKC008.QUERY, new HGKC008());
Map map = new HashMap();
inInfo = super.query(inInfo, HGKC008.QUERY, new HGKC008());
Map map = new HashMap();
map.put(HGKC008.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID, DdynamicEnum.PROJ_RECORD_BY_ROLE_BLOCK_ID,
DdynamicEnum.WH_RECORD_BLOCK_ID), map, false
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID,
DdynamicEnum.PROJ_RECORD_BY_ROLE_BLOCK_ID, DdynamicEnum.WH_RECORD_BLOCK_ID,
DdynamicEnum.USER_BLOCK_ID), map, false
);
EiInfoUtils.addBlock(inInfo, "roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
} catch (Exception e) {
......@@ -81,61 +81,66 @@ public class ServiceHGKC008 extends ServiceBase {
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 生产领料ids
List<Long> ids = ObjectUtils.listKey(resultRows, HGKC008.FIELD_ID);
DaoUtils.update(HGKC008.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",ids);}});
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 生产领料ids
List<Long> ids = ObjectUtils.listKey(resultRows, HGKC008.FIELD_ID);
DaoUtils.update(HGKC008.BATCH_DELETE, new HashMap<String, Object>() {{
put("ids", ids);
}});
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
return inInfo;
}
public EiInfo save(EiInfo inInfo){
try {
Map resultMap = EiInfoUtils.getFirstRow(inInfo,EiConstant.resultBlock);
HGKC008 hgkc008 = new HGKC008();
hgkc008.fromMap(resultMap);
this.checkSaveData(hgkc008);
if(Objects.nonNull(hgkc008.getId())&&hgkc008.getId()!=0){
DaoUtils.update(HGKC008.UPDATE, hgkc008);
//同时修改子表的仓库数据、公司数据
HGKCTools.HgKc008A.updateWhCodeByReceiveId(hgkc008);
}else {
//生成生产领料编号
hgkc008.setApplyCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.RECEIVE_CODE));
hgkc008.setStatus(HGConstant.ProductStatus.WTJ);
DaoUtils.insert(HGKC008.INSERT, hgkc008);
EiInfoUtils.addBlock(inInfo,"entity", hgkc008, 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(), "请选择仓库信息!");
}
/**
* @param inInfo
* @return
*/
public EiInfo save(EiInfo inInfo) {
try {
List<HGKC008> fKc008s = MapUtils.toDaoEPBases(inInfo, HGKC008.class);
for (HGKC008 fKc008 : fKc008s) {
this.checkSaveData(fKc008);
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", hgkc008, HGKC008.class);
}
}
inInfo = this.query(inInfo);
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 {
Map map = new HashMap();
map.put(HGKC008A.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
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,
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;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.InventTypeDetailEnum;
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.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.kc.domain.HGKC008;
import com.baosight.hggp.hg.kc.domain.HGKC008A;
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.xs.domain.Company;
import com.baosight.hggp.util.AssertUtils;
......@@ -23,9 +25,9 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
......@@ -87,56 +89,79 @@ public class ServiceHGKC008B extends ServiceBase {
@OperationLogAnnotation(operModul = "实时库存", operType = "查询", operDesc = "确认")
public EiInfo confirm(EiInfo inInfo) {
try {
String receiveId = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC008A.FIELD_RECEIVE_ID);
List<HGKC010> hgkc010s = MapUtils.toDaoEPBases(inInfo, HGKC010.class);
String receiveId = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0,
HGKC008A.FIELD_RECEIVE_ID);
List<HGKC010B> fKc010Bs = MapUtils.toDaoEPBases(inInfo, HGKC010B.class);
// db数据
Map<Long, HGKC010> dbHgkc010Map = HGKCUtils.HgKc010.lockGetDataEp(hgkc010s);
List<HGKC008A> hgkc008AList = HGKCUtils.HgKc008A.listByPrimaryId(receiveId);
Map<Long, HGKC010> dbKc010Map = HGKCUtils.HgKc010.lockGetDataEp(fKc010Bs);
// 领料明细
List<HGKC008A> dbKc008As = HGKCUtils.HgKc008A.listByPrimaryId(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.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + hgkc010s.size() + "]条数据保存成功!");
inInfo.setMsg("操作成功!本次对[" + fKc010Bs.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
private void confirmData(Map<Long, HGKC010> dbHgkc010Map, HGKC008 hgkc008) {
List<HGKC008A> hgkc008AList = new LinkedList<>();
dbHgkc010Map.forEach((k,v) ->{
HGKC008A hgkc008A = new HGKC008A();
BeanUtils.copyProperties(hgkc008,hgkc008A,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
hgkc008A.setReceiveId(hgkc008.getId());
hgkc008A.setInvLength(v.getLength());
hgkc008A.setInvThick(v.getThick());
hgkc008A.setInvUnitWeight(v.getInvUnitWeight());
hgkc008A.setInvWeight(v.getInvWeight());
hgkc008A.setInvWidth(v.getWidth());
hgkc008A.setInvSpec(v.getSpec());
hgkc008A.setInventType(v.getInventType());
hgkc008A.setInventTypeDetail(v.getInventTypeDetail());
hgkc008A.setInventCode(v.getInventCode());
hgkc008A.setInventName(v.getInventName());
hgkc008A.setInvQty(v.getInvQty());
hgkc008AList.add(hgkc008A);
});
DaoUtils.insertBatch(HGKC008A.INSERT, hgkc008AList);
/**
* 确认数量
*
* @param fKc010Bs
* @param dbKc010Map
* @param dbKc008
*/
private void confirmData(List<HGKC010B> fKc010Bs, Map<Long, HGKC010> dbKc010Map, HGKC008 dbKc008) {
for (HGKC010B fKc010B : fKc010Bs) {
Long id = fKc010B.getId();
HGKC010 dbKc010 = dbKc010Map.get(id);
HGKC008A newKc008A = BeanUtils.copy(dbKc010, HGKC008A.class);
newKc008A.setProjCode(dbKc008.getProjCode());
newKc008A.setProjName(dbKc008.getProjName());
newKc008A.setCompanyCode(dbKc008.getCompanyCode());
newKc008A.setCompanyName(dbKc008.getCompanyName());
newKc008A.setReceiveId(dbKc008.getId());
newKc008A.setInvQty(fKc010B.getApplyQty());
newKc008A.setInvWeight(fKc010B.getApplyQty().multiply(dbKc010.getInvUnitWeight()));
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) -> {
AssertUtils.isTrue(o.getInventCode().equals(v.getInventCode()), "此领料单已选择存货:" + v.getInventCode());
});
});
/**
* 数据校验
*
* @param fKc010Bs
* @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"?>
<!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">
<sql id="condition">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -158,7 +158,7 @@
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGKC008A (ID, <!-- 主键id -->
INSERT INTO ${hggpSchema}.HGKC008A (
ACCOUNT_CODE, <!-- 账套 -->
PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 -->
......@@ -166,9 +166,6 @@
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 修改人 -->
UPDATED_NAME, <!-- 修改人名称 -->
UPDATED_TIME, <!-- 修改时间 -->
DELETE_FLAG, <!-- 是否删除 0-否1-是 -->
RECEIVE_ID, <!-- 领料单id -->
COMPANY_CODE, <!-- 公司编码 -->
......@@ -190,9 +187,8 @@
PRICE, <!-- 单价 -->
AMOUNT, <!-- 金额 -->
INVENT_TYPE_DETAIL
)
VALUES (#id#, #accountCode#,#projCode#, #projName#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #receiveId#, #companyCode#, #companyName#, #whCode#,
) VALUES (#accountCode#,#projCode#, #projName#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #receiveId#, #companyCode#, #companyName#, #whCode#,
#whName#, #inventRecordId#, #inventType#, #inventCode#, #inventName#, #invSpecId#,#invSpec#, #invLength#,
#invWidth#, #invThick#, #invQty#, #invUnitWeight#, #invWeight#, #price#, #amount#, #inventTypeDetail#)
</insert>
......
......@@ -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.HGSC005A;
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.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
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
......@@ -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
* @return
......@@ -122,7 +156,7 @@ public class ServiceHGSC005A extends ServiceBase {
String planCode = MapUtils.getString(queryMap, "planCode");
HGSC005 dbSc005 = HGSCTools.THGSC005.queryByPlanCode(planCode);
this.checkScheduleData(dbSc005);
int count = HGSCTools.THGSC005A.schedule(queryMap);
int count = HGSCTools.THGSC005A.schedule(queryMap, "D");
dbSc005.setIsSchedule(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSC005.UPDATE, dbSc005);
inInfo = this.query(inInfo);
......
......@@ -1060,9 +1060,10 @@ public class HGSCTools {
* 排产
*
* @param queryMap
* @param sortType
* @return
*/
public static int schedule(Map queryMap) {
public static int schedule(Map queryMap, String sortType) {
List<HGSC005A> hgsc005AList = DaoBase.getInstance().query(HGSC005A.QUERY, queryMap);
// hgsc005AList.sort(Comparator.comparing(HGSC005A::getProductType).thenComparing(HGSC005A::getProcessOrder,Comparator.reverseOrder()));
//通过工序编码查询工序设置
......@@ -1113,26 +1114,26 @@ public class HGSCTools {
}
return hgsc005AList.size();
}
private static String handleEndDate(String endDate ,HGSC005A planInfo){
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);
}
return endDate;
}
private static BigDecimal calculateWordHour(HGSC005A planInfo, List<HGSJ001> hgsj001List
, List<HGPZ005> hgpz005List, List<HGPZ005A> hgpz005AList
, String endDate, BigDecimal remainder){
endDate = handleEndDate(endDate,planInfo);
planInfo.setPlanEndDate(endDate);
AtomicReference<BigDecimal> workHour = new AtomicReference<>(new BigDecimal(0));
BigDecimal finalRemainder = remainder;
hgsj001List.stream().forEach(sj->{
if(StringUtils.equals(sj.getProcessCode(),planInfo.getProcessCode())){
hgpz005AList.forEach(productProcess -> {
if(productProcess.getId().compareTo(planInfo.getInventProcessId())==0){
BigDecimal composingCoeff = productProcess.getComposingCoeff();
private static String handleEndDate(String endDate, HGSC005A planInfo) {
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);
}
return endDate;
}
private static BigDecimal calculateWordHour(HGSC005A planInfo, List<HGSJ001> hgsj001List,
List<HGPZ005> hgpz005List, List<HGPZ005A> hgpz005AList, String endDate, BigDecimal remainder) {
endDate = handleEndDate(endDate, planInfo);
planInfo.setPlanEndDate(endDate);
AtomicReference<BigDecimal> workHour = new AtomicReference<>(new BigDecimal(0));
BigDecimal finalRemainder = remainder;
hgsj001List.stream().forEach(sj -> {
if (StringUtils.equals(sj.getProcessCode(), planInfo.getProcessCode())) {
hgpz005AList.forEach(productProcess -> {
if (productProcess.getId().compareTo(planInfo.getInventProcessId()) == 0) {
BigDecimal composingCoeff = productProcess.getComposingCoeff();
hgpz005List.forEach(product->{
if(StringUtils.equals(product.getInventCode(),planInfo.getProductCode())){
//额定工时
......
......@@ -47,7 +47,7 @@
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="120" align="right" format="{0:N3}"
defaultValue="0" sumType="page"/>
<EF:EFComboColumn ename="calculationMethod" cname="计算方式" enable="true" width="100" align="center"
required="true">
copy="true" required="true">
<EF:EFCodeOption codeName="hggp.cg.calculationMethod"/>
</EF:EFComboColumn>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" required="true"/>
......
......@@ -12,39 +12,60 @@
</head>
<EF:EFPage title="生产领料单">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput ename="inqu_status-0-companyName" cname="公司名称" colWidth="3"/>
<EF:EFDatePicker cname="单据日期" blockId="inqu_status" ename="receiptDate" row="0" colWidth="3"
role="date" format="yyyy-MM-dd" readonly="true"/>
<EF:EFInput ename="inqu_status-0-applyCode" cname="生产领料单号" colWidth="3"/>
<EF:EFInput ename="inqu_status-0-whName" cname="仓库名称" colWidth="3"/>
</div>
</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 cname="状态" ename="status" width="90" align="center" required="false" enable="false">
<EF:EFCodeOption codeName="hggp.sc.productStatus" />
</EF:EFComboColumn>
</EF:EFGrid>
<div class="row">
<EF:EFInput ename="inqu_status-0-companyName" cname="公司名称" colWidth="3"/>
<EF:EFDatePicker cname="单据日期" blockId="inqu_status" ename="receiptDate" row="0" colWidth="3"
role="date" format="yyyy-MM-dd" readonly="true"/>
<EF:EFInput ename="inqu_status-0-applyCode" cname="生产领料单号" colWidth="3"/>
<EF:EFInput ename="inqu_status-0-whName" cname="仓库名称" colWidth="3"/>
</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 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>
......@@ -25,18 +25,17 @@ $(function (){
e.preventDefault();
}
},
columns: [
{
field: "inventCode",
template: function (item) {
let template = "";
if(item.inventCode){
for(let i=0;i<inventRecordBoxBlocks.length;i++){
if(item.inventCode === inventRecordBoxBlocks[i]['valueField']){
template = inventRecordBoxBlocks[i]['valueField'];
}
}
}
columns: [{
field: "inventCode",
template: function (item) {
let template = "";
if (item.inventCode) {
for (let i = 0; i < inventRecordBoxBlocks.length; i++) {
if (item.inventCode === inventRecordBoxBlocks[i]['valueField']) {
template = inventRecordBoxBlocks[i]['valueField'];
}
}
}
return template;
},
editor: function (container, options) {
......@@ -55,8 +54,7 @@ $(function (){
filter: "contains"
});
}
},
{
}, {
field: "receiveId",
template: function (item) {
item['receiveId'] =$("#inqu_status-0-receiveId").val();
......
......@@ -40,16 +40,11 @@ let confirm = function () {
return;
}
for (let i = 0; i < rows.length; i++) {
let invQty = rows[i]['invQty'];
let invWeight = rows[i]['invWeight'];
if (!isPositiveNumber(invQty)) {
message("勾选的第" + (i + 1) + "行库存数量必须大于0");
let applyQty = rows[i]['applyQty'];
if (!isPositiveNumber(applyQty)) {
message("勾选的第" + (i + 1) + "行申请数量必须大于0");
return;
}
// if (!isPositiveNumber(invWeight)) {
// message("勾选的第" + (i + 1) + "行库存总重必须大于0");
// return;
// }
}
JSUtils.confirm("确定对勾选的[" + rows.length + "]条数据进行\"生产领料\"操作吗? ", {
ok: function () {
......
......@@ -39,6 +39,7 @@
<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="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="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}"/>
......
......@@ -6,6 +6,12 @@ $(function () {
resultGrid.dataSource.page(1);
});
// 正序排产
$("#BNT_SCHEDULE_EX").on("click", scheduleEx);
// 倒序排产
$("#BNT_SCHEDULE").on("click", schedule);
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
......@@ -14,8 +20,6 @@ $(function () {
columns: [
],
loadComplete: function(grid) {
//排产
$("#BNT_SCHEDULE").on("click", schedule);
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete'
......@@ -39,7 +43,18 @@ $(window).load(function () {
});
/**
* 排产
* 正序排产
*/
function schedule() {
JSUtils.confirm("自动排产将覆盖原排产数据,请谨慎操作,确认对当前数据进行排产? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGSC005A", "scheduleEx", true);
}
});
}
/**
* 倒序排产
*/
function schedule() {
JSUtils.confirm("自动排产将覆盖原排产数据,请谨慎操作,确认对当前数据进行排产? ", {
......
......@@ -39,10 +39,10 @@
<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="finishDate" cname="交货日期" width="120" enable="true" align="center" readonly="true"/>
<EF:EFColumn ename="planStartDate" cname="计划开工日期" width="120" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" required="true"/>
<EF:EFColumn ename="planEndDate" cname="计划完工日期" width="120" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" required="true"/>
<EF:EFColumn ename="planStartDate" cname="计划开工日期" width="140" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" required="true" copy="true"/>
<EF:EFColumn ename="planEndDate" cname="计划完工日期" width="140" enable="true" align="center" editType="date"
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"
align="center" readonly="true"/>
<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