Commit 02f51c36 by liuyang

2024-07-26 采购开票选择采购收货逻辑调整

parent 21df8859
...@@ -62,7 +62,6 @@ public class HGCG002 extends DaoEPBase { ...@@ -62,7 +62,6 @@ public class HGCG002 extends DaoEPBase {
public static final String FIELD_AUDIT_USER_NAME = "auditUserName"; /* 审核人名称*/ public static final String FIELD_AUDIT_USER_NAME = "auditUserName"; /* 审核人名称*/
public static final String FIELD_AUDIT_REASON = "auditReason"; /* 审核原因*/ public static final String FIELD_AUDIT_REASON = "auditReason"; /* 审核原因*/
public static final String FIELD_INVENT_TYPE_DETAIL = "inventTypeDetail"; /*存货类型明细*/ public static final String FIELD_INVENT_TYPE_DETAIL = "inventTypeDetail"; /*存货类型明细*/
public static final String FIELD_SOURCE = "source"; /* 数据来源 根据采购数据来源小代码 目前0默认采购计划,1手动录入*/ public static final String FIELD_SOURCE = "source"; /* 数据来源 根据采购数据来源小代码 目前0默认采购计划,1手动录入*/
public static final String FIELD_PRICE = "price"; /* 单价*/ public static final String FIELD_PRICE = "price"; /* 单价*/
...@@ -122,6 +121,7 @@ public class HGCG002 extends DaoEPBase { ...@@ -122,6 +121,7 @@ public class HGCG002 extends DaoEPBase {
public static final String INSERT = "HGCG002.insert"; public static final String INSERT = "HGCG002.insert";
public static final String UPDATE = "HGCG002.update"; public static final String UPDATE = "HGCG002.update";
public static final String DELETE = "HGCG002.delete"; public static final String DELETE = "HGCG002.delete";
public static final String MAX_ID = "HGCG002.maxId";
private Long id = new Long(0); private Long id = new Long(0);
private String accountCode = " "; /* 企业编码*/ private String accountCode = " "; /* 企业编码*/
......
...@@ -109,6 +109,7 @@ public class HGCG003 extends DaoEPBase { ...@@ -109,6 +109,7 @@ public class HGCG003 extends DaoEPBase {
public static final String INSERT = "HGCG003.insert"; public static final String INSERT = "HGCG003.insert";
public static final String UPDATE = "HGCG003.update"; public static final String UPDATE = "HGCG003.update";
public static final String DELETE = "HGCG003.delete"; public static final String DELETE = "HGCG003.delete";
public static final String MAX_ID = "HGCG003.maxId";
private Long id = new Long(0); private Long id = new Long(0);
private String accountCode = " "; /* 企业编码*/ private String accountCode = " "; /* 企业编码*/
......
package com.baosight.hggp.hg.cg.service;
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.cg.domain.HGCG001;
import com.baosight.hggp.hg.cg.domain.HGCG001A;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.cw.domain.HGCW004;
import com.baosight.hggp.hg.kc.domain.HGKC008A;
import com.baosight.hggp.hg.pz.domain.HGPZ004;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.sc.domain.HGSC009A;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
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.math.RoundingMode;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGCG001A extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "采购计划明细", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
String primaryId = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGCG001A.FIELD_PRIMARY_ID);
HGCG001 hgcg001 = HGCGTools.HgCg001.get(Long.valueOf(primaryId));
EiInfo outEiInfo = super.query(inInfo, HGCG001A.QUERY,new HGCG001A());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID), null, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BOX_BLOCK_ID),
new HashMap<String, Object>(){{
put(HGPZ005.FIELD_STATUS,1);
put(HGPZ004.FIELD_INVENT_TYPE_DETAILS, InventTypeDetailEnum.getInentTypeThree());
}}, false);
//进入页面给上方主表信息赋值
outEiInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGCG001A.FIELD_PLAN_DATE,hgcg001.getPlanDate());
outEiInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGCG001A.FIELD_COMPANY_CODE,hgcg001.getCompanyCode());
outEiInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGCG001A.FIELD_COMPANY_NAME,hgcg001.getCompanyName());
outEiInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGCG001A.FIELD_PLAN_NO,hgcg001.getPlanNo());
return outEiInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "采购计划明细", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGCG001A.QUERY, new HGCG001A());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购计划明细", operType = "修改", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<HGCG001A> fCg001As = MapUtils.toDaoEPBase(inInfo, HGCG001A.class);
// db数据
Map<Long, HGCG001A> dbCg001Map = this.lockGetData(fCg001As);
HGCG001 cg001 = HGCGTools.HgCg001.get(fCg001As.get(0).getPrimaryId());
// 数据校验
this.checkSaveData(fCg001As, dbCg001Map,cg001);
// 保存数据
this.saveData(fCg001As,cg001);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg001As.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fCg001As
* @param dbCg001Map
* @param cg001
*/
private void checkSaveData(List<HGCG001A> fCg001As, Map<Long, HGCG001A> dbCg001Map,HGCG001 cg001) {
for (HGCG001A fCg001a : fCg001As) {
Long id = fCg001a.getId();
HGCG001A dbCg001A = dbCg001Map.get(id);
AssertUtils.isNull(dbCg001A, String.format("计划明细[%s]不存在", id));
AssertUtils.isNotEquals(HGConstant.CgPlanStatus.S_0, cg001.getStatus(),
String.format("计划[%s]状态不是\"待审核\",不允许操作", cg001.getPlanNo()));
AssertUtils.isGe(BigDecimal.ZERO, fCg001a.getPurQty(), String.format("计划明细[%s]采购数量必须大于0", dbCg001A.getInventCode()));
AssertUtils.isGe(BigDecimal.ZERO, fCg001a.getPurWeight(), String.format("计划明细[%s]采购重量必须大于0", dbCg001A.getInventCode()));
}
}
/**
* 数据保存
*
* @param fCg001s
*/
private void saveData(List<HGCG001A> fCg001s,HGCG001 cg001) {
for (HGCG001A fCg001a : fCg001s) {
fCg001a.setPurUnitWeight(fCg001a.getPurWeight().divide(fCg001a.getPurQty(), 3, RoundingMode.HALF_UP));
DaoUtils.update(HGCG001A.UPDATE, fCg001a);
}
//修改主表数量
updateCg001Pur(cg001);
}
private void updateCg001Pur(HGCG001 cg001) {
List<HGCG001A> hgcg001AList = HGCGTools.HgCg001A.listByPrimaryId(cg001.getId());
//修改主表信息
BigDecimal purQtySum = hgcg001AList.stream().map(HGCG001A::getPurQty).reduce(BigDecimal.ZERO,BigDecimal::add);
BigDecimal purWeightSum = hgcg001AList.stream().map(HGCG001A::getPurWeight).reduce(BigDecimal.ZERO,BigDecimal::add);
cg001.setPurQty(purQtySum);
cg001.setPurWeight(purWeightSum);
DaoUtils.update(HGSqlConstant.HgCg001.UPDATE_PUR, cg001);
}
/**
* 删除操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购计划明细", operType = "修改", operDesc = "删除")
public EiInfo remove(EiInfo inInfo) {
try {
List<HGCG001A> fCg001s = MapUtils.toDaoEPBase(inInfo, HGCG001A.class);
// db数据
Map<Long, HGCG001A> dbCg001Map = this.lockGetData(fCg001s);
HGCG001 cg001 = HGCGTools.HgCg001.get(fCg001s.get(0).getPrimaryId());
// 数据校验
this.checkRemoveData(fCg001s, dbCg001Map,cg001);
// 保存数据
this.removeData(fCg001s,cg001);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg001s.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fCg001s
* @param dbCg001Map
* @param cg001
*/
private void checkRemoveData(List<HGCG001A> fCg001s, Map<Long, HGCG001A> dbCg001Map,HGCG001 cg001) {
for (HGCG001A fCg001 : fCg001s) {
Long id = fCg001.getId();
HGCG001A dbCg001A = dbCg001Map.get(id);
AssertUtils.isNull(dbCg001A, String.format("计划明细[%s]不存在", id));
AssertUtils.isNotEquals(HGConstant.CgPlanStatus.S_0, cg001.getStatus(),
String.format("计划[%s]状态不是\"待审核\",不允许操作", cg001.getPlanNo()));
}
}
/**
* 数据保存
*
* @param fCg001s
*/
private void removeData(List<HGCG001A> fCg001s,HGCG001 cg001) {
for (HGCG001A fCg001A : fCg001s) {
fCg001A.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGCG001A.DELETE, fCg001A);
}
//修改主表数量
updateCg001Pur(cg001);
}
/**
* 锁并且获取数据
*
* @param fCg001As
* @return
*/
private Map<Long, HGCG001A> lockGetData(List<HGCG001A> fCg001As) {
// ids
List<String> ids = ObjectUtils.listEpKey(fCg001As, HGCG001A.FIELD_ID);
// 锁
HGCGTools.HgCg001A.lock(ids);
// db数据
return HGCGTools.HgCg001A.map(ids);
}
}
...@@ -114,8 +114,8 @@ public class ServiceHGCG002 extends ServiceBase { ...@@ -114,8 +114,8 @@ public class ServiceHGCG002 extends ServiceBase {
HGCG002 dbCg002 = dbCg002AMap.get(contractNo); HGCG002 dbCg002 = dbCg002AMap.get(contractNo);
AssertUtils.isNull(dbCg002, String.format("合同[%s]不存在", contractNo)); AssertUtils.isNull(dbCg002, String.format("合同[%s]不存在", contractNo));
AssertUtils.isNotEquals(HGConstant.CgPlanStatus.S_0, dbCg002.getStatus(), String.format("合同[%s]状态不是\"待审核\",不允许操作", contractNo)); AssertUtils.isNotEquals(HGConstant.CgPlanStatus.S_0, dbCg002.getStatus(), String.format("合同[%s]状态不是\"待审核\",不允许操作", contractNo));
AssertUtils.isTrue(fCg002.getPrice().compareTo(BigDecimal.ZERO) <= 0, String.format("合同[%s]单价小于等于0,不允许操作", contractNo)); AssertUtils.isTrue(fCg002.getAmount().compareTo(BigDecimal.ZERO) <= 0, String.format("合同[%s]不含税金额小于等于0,不允许操作", contractNo));
AssertUtils.isTrue(fCg002.getTaxRate().compareTo(BigDecimal.ZERO) <= 0, String.format("合同[%s]税率小于等于0,不允许操作", contractNo)); AssertUtils.isTrue(fCg002.getTaxIncludeAmount().compareTo(BigDecimal.ZERO) <= 0, String.format("合同[%s]含税金额小于等于0,不允许操作", contractNo));
} }
} }
...@@ -226,10 +226,8 @@ public class ServiceHGCG002 extends ServiceBase { ...@@ -226,10 +226,8 @@ public class ServiceHGCG002 extends ServiceBase {
AssertUtils.isNull(dbCg002, String.format("合同[%s]不存在", contractNo)); AssertUtils.isNull(dbCg002, String.format("合同[%s]不存在", contractNo));
AssertUtils.isNotEquals(HGConstant.CgContractStatus.S_0, dbCg002.getStatus(), AssertUtils.isNotEquals(HGConstant.CgContractStatus.S_0, dbCg002.getStatus(),
String.format("合同[%s]状态不是\"待审核\",不允许操作", contractNo)); String.format("合同[%s]状态不是\"待审核\",不允许操作", contractNo));
AssertUtils.isTrue(dbCg002.getPrice().compareTo(BigDecimal.ZERO) <= 0, AssertUtils.isTrue(fCg002.getAmount().compareTo(BigDecimal.ZERO) <= 0, String.format("合同[%s]不含税金额小于等于0,不允许操作", contractNo));
String.format("合同[%s]单价小于等于0,不允许操作", contractNo)); AssertUtils.isTrue(fCg002.getTaxIncludeAmount().compareTo(BigDecimal.ZERO) <= 0, String.format("合同[%s]含税金额小于等于0,不允许操作", contractNo));
AssertUtils.isTrue(dbCg002.getTaxRate().compareTo(BigDecimal.ZERO) <= 0,
String.format("合同[%s]税率小于等于0,不允许操作", contractNo));
} }
} }
......
...@@ -5,12 +5,10 @@ import com.baosight.hggp.common.DdynamicEnum; ...@@ -5,12 +5,10 @@ import com.baosight.hggp.common.DdynamicEnum;
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.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.domain.HGCG001; import com.baosight.hggp.hg.cg.domain.*;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.tools.HGCGTools; import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HGCGUtils; import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.User; import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
...@@ -23,11 +21,11 @@ import com.baosight.hggp.util.MapUtils; ...@@ -23,11 +21,11 @@ import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils; import com.baosight.hggp.util.ObjectUtils;
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.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.Arrays; import java.util.Arrays;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -132,7 +130,10 @@ public class ServiceHGCG002A extends ServiceBase { ...@@ -132,7 +130,10 @@ public class ServiceHGCG002A extends ServiceBase {
private void confirmData(List<Map> resultRows, Map<String, HGCG001> dbCg001Map) { private void confirmData(List<Map> resultRows, Map<String, HGCG001> dbCg001Map) {
for (Map resultRow : resultRows) { for (Map resultRow : resultRows) {
String planNo = MapUtils.getString(resultRow, HGCG001.FIELD_PLAN_NO); String planNo = MapUtils.getString(resultRow, HGCG001.FIELD_PLAN_NO);
HGCG002 newCg002 = BeanUtils.copy(dbCg001Map.get(planNo), HGCG002.class); HGCG001 dbCg001 = dbCg001Map.get(planNo);
HGCG002 newCg002 = BeanUtils.copy(dbCg001, HGCG002.class);
Long maxId = (Long) super.dao.get(HGCG002.MAX_ID,null,null);
newCg002.setId(maxId+1);
newCg002.setContractDate(DateUtils.shortDate()); newCg002.setContractDate(DateUtils.shortDate());
newCg002.setContractNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_CONTRACT_NO)); newCg002.setContractNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_CONTRACT_NO));
newCg002.setSupCode(MapUtils.getString(resultRow, HGCG002.FIELD_SUP_CODE)); newCg002.setSupCode(MapUtils.getString(resultRow, HGCG002.FIELD_SUP_CODE));
...@@ -140,12 +141,29 @@ public class ServiceHGCG002A extends ServiceBase { ...@@ -140,12 +141,29 @@ public class ServiceHGCG002A extends ServiceBase {
newCg002.setPurUserName(MapUtils.getString(resultRow, HGCG002.FIELD_PUR_USER_NAME)); newCg002.setPurUserName(MapUtils.getString(resultRow, HGCG002.FIELD_PUR_USER_NAME));
newCg002.setStatus(HGConstant.CgContractStatus.S_0); newCg002.setStatus(HGConstant.CgContractStatus.S_0);
newCg002.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); newCg002.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
newCg002.setSource(HGConstant.CgSource.DEFAULT);
DaoUtils.insert(HGCG002.INSERT, newCg002); DaoUtils.insert(HGCG002.INSERT, newCg002);
//新增子表信息
insertDetails(dbCg001,newCg002);
// 更新计划状态 // 更新计划状态
HGCGTools.HgCg001.updateStatus(planNo, HGConstant.CgPlanStatus.S_4); HGCGTools.HgCg001.updateStatus(planNo, HGConstant.CgPlanStatus.S_4);
} }
} }
private void insertDetails(HGCG001 dbCg001, HGCG002 newCg002) {
//获取采购计划明细
List<HGCG001A> hgcg001AList = HGCGTools.HgCg001A.listByPrimaryId(dbCg001.getId());
List<HGCG002B> cg002BList = new LinkedList<>();
hgcg001AList.forEach(cg001A->{
HGCG002B cg002B = new HGCG002B();
//拷贝明细信息
BeanUtils.copyProperties(cg001A,cg002B,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
cg002B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
cg002B.setPrimaryId(newCg002.getId());
cg002BList.add(cg002B);
});
DaoUtils.insertBatch(HGCG002B.INSERT,cg002BList);
}
/** /**
* 锁并且获取数据 * 锁并且获取数据
......
package com.baosight.hggp.hg.cg.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
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.cg.domain.*;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.util.*;
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.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGCG002B extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "采购合同", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
EiInfoUtils.addBlock(inInfo,"userByCompany", UserSessionUtils.getUserByCompany(UserSessionUtils.getAccountCode()), User.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG002B().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "采购合同", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGCG002B.QUERY, new HGCG002());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购合同", operType = "修改", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<HGCG002B> fCg002Bs = MapUtils.toDaoEPBase(inInfo, HGCG002B.class);
// db数据
Map<Long, HGCG002B> dbCg002AMap = HGCGUtils.HgCg002B.lockGetDataEp(fCg002Bs);
HGCG002 cg001 = HGCGTools.HgCg002.get(fCg002Bs.get(0).getPrimaryId());
// 数据校验
this.checkSaveData(fCg002Bs, dbCg002AMap,cg001);
// 保存数据
this.saveData(fCg002Bs,cg001);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg002Bs.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fCg002Bs
* @param dbCg002BMap
*/
private void checkSaveData(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap,HGCG002 cg001) {
for (HGCG002B fCg002B : fCg002Bs) {
Long id = fCg002B.getId();
HGCG002B dbCg002B = dbCg002BMap.get(id);
AssertUtils.isNull(dbCg002B, String.format("合同明细[%s]不存在", id));
AssertUtils.isNotEquals(HGConstant.CgPlanStatus.S_0, cg001.getStatus(), String.format("合同[%s]状态不是\"待审核\",不允许操作", cg001.getContractNo()));
AssertUtils.isTrue(fCg002B.getPrice().compareTo(BigDecimal.ZERO) <= 0, String.format("存货[%s]单价小于等于0,不允许操作", dbCg002B.getInventCode()));
AssertUtils.isTrue(fCg002B.getTaxRate().compareTo(BigDecimal.ZERO) <= 0, String.format("存货[%s]税率小于等于0,不允许操作", dbCg002B.getInventCode()));
}
}
/**
* 数据保存
*
* @param fCg002Bs
* @param cg001
*/
private void saveData(List<HGCG002B> fCg002Bs, HGCG002 cg001) {
for (HGCG002B fCg002B : fCg002Bs) {
DaoUtils.update(HGCG002B.UPDATE, fCg002B);
}
//修改主表信息
updateCg002Pur(cg001);
}
private void updateCg002Pur(HGCG002 cg002) {
List<HGCG002B> hgcg002BList = HGCGTools.HgCg002B.listByPrimaryId(cg002.getId());
//修改主表信息
//采购数量
BigDecimal purQtySum = hgcg002BList.stream().map(HGCG002B::getPurQty).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setPurQty(purQtySum);
//采购重量
BigDecimal purWeightSum = hgcg002BList.stream().map(HGCG002B::getPurWeight).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setPurWeight(purWeightSum);
//收货数量
BigDecimal receiveQtySum = hgcg002BList.stream().map(HGCG002B::getReceiveQty).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setReceiveQty(receiveQtySum);
//收货重量
BigDecimal receiveWeightSum = hgcg002BList.stream().map(HGCG002B::getReceiveWeight).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setReceiveWeight(receiveWeightSum);
//金额(不含税金额)
BigDecimal amountSum = hgcg002BList.stream().map(HGCG002B::getAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setAmount(amountSum);
//税额
BigDecimal taxAmountSum = hgcg002BList.stream().map(HGCG002B::getTaxAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setTaxAmount(taxAmountSum);
//含税金额
BigDecimal taxIncludeAmountSum = hgcg002BList.stream().map(HGCG002B::getTaxIncludeAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setTaxIncludeAmount(taxIncludeAmountSum);
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_PUR, cg002);
}
/**
* 删除操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购计划", operType = "修改", operDesc = "删除")
public EiInfo remove(EiInfo inInfo) {
try {
List<HGCG002B> fCg002Bs = MapUtils.toDaoEPBase(inInfo, HGCG002B.class);
// db数据
Map<Long, HGCG002B> dbCg002BMap = HGCGUtils.HgCg002B.lockGetDataEp(fCg002Bs);
HGCG002 cg001 = HGCGTools.HgCg002.get(fCg002Bs.get(0).getPrimaryId());
// 数据校验
this.checkRemoveData(fCg002Bs, dbCg002BMap,cg001);
// 保存数据
this.removeData(fCg002Bs, dbCg002BMap,cg001);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg002Bs.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fCg002Bs
* @param dbCg002BMap
* @param cg001
*/
private void checkRemoveData(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap,HGCG002 cg001) {
for (HGCG002B fCg002B : fCg002Bs) {
Long id = fCg002B.getId();
HGCG002B dbCg002B = dbCg002BMap.get(id);
AssertUtils.isNull(dbCg002B, String.format("合同明细[%s]不存在", id));
AssertUtils.isNotEquals(HGConstant.CgContractStatus.S_0, cg001.getStatus(),
String.format("合同[%s]状态不是\"待审核\",不允许操作", cg001.getContractNo()));
}
}
/**
* 数据保存
*
* @param fCg002Bs
* @param dbCg002BMap
* @param cg001
*/
private void removeData(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap,HGCG002 cg001) {
for (HGCG002B fCg002B : fCg002Bs) {
Long id = fCg002B.getId();
HGCG002B dbCg002B = dbCg002BMap.get(id);
dbCg002B.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGCG002B.DELETE, dbCg002B);
}
//修改主表信息
updateCg002Pur(cg001);
}
}
...@@ -5,8 +5,7 @@ import com.baosight.hggp.common.DdynamicEnum; ...@@ -5,8 +5,7 @@ import com.baosight.hggp.common.DdynamicEnum;
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.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.domain.HGCG002A; import com.baosight.hggp.hg.cg.domain.*;
import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cg.tools.HGCGTools; import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HGCGUtils; import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
...@@ -22,11 +21,14 @@ import com.baosight.iplat4j.core.ei.EiConstant; ...@@ -22,11 +21,14 @@ 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 org.springframework.util.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author:songx * @author:songx
...@@ -213,6 +215,21 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -213,6 +215,21 @@ public class ServiceHGCG003 extends ServiceBase {
DaoUtils.update(HGCG003.DELETE, dbCg003); DaoUtils.update(HGCG003.DELETE, dbCg003);
// 更新合同状态 // 更新合同状态
HGCGTools.HgCg002.updateReceive(dbCg002AMap.get(contractNo), dbCg003.getReceiveQty().negate()); HGCGTools.HgCg002.updateReceive(dbCg002AMap.get(contractNo), dbCg003.getReceiveQty().negate());
}
//子表修改
List<Long> cg003Ids = fCg003s.stream().map(o->o.getId()).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(cg003Ids)){
List<HGCG003B> fCg003Bs = HGCGTools.HgCg003B.listByPrimaryIds(cg003Ids);
// 采购合同明细DB数据
Map<Long, HGCG002B> dbCg002BMap = HGCGUtils.HgCg002B.lockGetData(
ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_DETAIL_ID));
for (HGCG003B fCg003B : fCg003Bs) {
fCg003B.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGCG003B.DELETE, fCg003B);
// 更新合同状态
HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()), fCg003B.getReceiveQty().negate());
}
} }
} }
......
...@@ -4,9 +4,7 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; ...@@ -4,9 +4,7 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
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.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.cg.domain.HGCG002; import com.baosight.hggp.hg.cg.domain.*;
import com.baosight.hggp.hg.cg.domain.HGCG002A;
import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cg.tools.HGCGTools; import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HGCGUtils; import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
...@@ -23,7 +21,9 @@ import com.baosight.iplat4j.core.exception.PlatException; ...@@ -23,7 +21,9 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -47,7 +47,7 @@ public class ServiceHGCG003A extends ServiceBase { ...@@ -47,7 +47,7 @@ public class ServiceHGCG003A extends ServiceBase {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG002A().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG002B().eiMetadata);
} catch (PlatException e) { } catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败"); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
} }
...@@ -65,10 +65,10 @@ public class ServiceHGCG003A extends ServiceBase { ...@@ -65,10 +65,10 @@ public class ServiceHGCG003A extends ServiceBase {
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo); Map queryRow = EiInfoUtils.getFirstRow(inInfo);
HGCGUtils.HgCg001.setCondition(queryRow); HGCGUtils.HgCg002.setCondition(queryRow);
// 仅审核通过和收货中 // 仅审核通过和收货中
queryRow.put("statuses", new Integer[]{HGConstant.CgContractStatus.S_2, HGConstant.CgContractStatus.S_4}); queryRow.put("statuses", new Integer[]{HGConstant.CgContractStatus.S_2, HGConstant.CgContractStatus.S_4});
inInfo = super.query(inInfo, HGCG002.QUERY, new HGCG002A()); inInfo = super.query(inInfo, HGCG002B.QUERY_BY_RECEIVE, new HGCG002B());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
...@@ -84,16 +84,17 @@ public class ServiceHGCG003A extends ServiceBase { ...@@ -84,16 +84,17 @@ public class ServiceHGCG003A extends ServiceBase {
@OperationLogAnnotation(operModul = "采购合同", operType = "修改", operDesc = "确认") @OperationLogAnnotation(operModul = "采购合同", operType = "修改", operDesc = "确认")
public EiInfo confirm(EiInfo inInfo) { public EiInfo confirm(EiInfo inInfo) {
try { try {
List<HGCG002A> fCg002As = MapUtils.toDaoEPBase(inInfo, HGCG002A.class); List<HGCG002B> fCg002Bs = MapUtils.toDaoEPBase(inInfo, HGCG002B.class);
// db数据 // db数据
Map<String, HGCG002A> dbCg002AMap = HGCGUtils.HgCg002.lockGetDataEp(fCg002As); Map<Long, HGCG002B> dbCg002AMap = HGCGUtils.HgCg002B.lockGetDataEp(fCg002Bs);
HGCG002 cg001 = HGCGTools.HgCg002.get(fCg002Bs.get(0).getPrimaryId());
// 数据校验 // 数据校验
this.checkConfirmData(fCg002As, dbCg002AMap); this.checkConfirmData(fCg002Bs, dbCg002AMap,cg001);
// 保存数据 // 保存数据
this.confirmData(fCg002As, dbCg002AMap); this.confirmData(fCg002Bs, dbCg002AMap,cg001);
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg002As.size() + "]条数据保存成功!"); inInfo.setMsg("操作成功!本次对[" + fCg002Bs.size() + "]条数据保存成功!");
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败"); LogUtils.setDetailMsg(inInfo, e, "保存失败");
} }
...@@ -102,46 +103,71 @@ public class ServiceHGCG003A extends ServiceBase { ...@@ -102,46 +103,71 @@ public class ServiceHGCG003A extends ServiceBase {
/** /**
* 数据校验 * 数据校验
* * @param fCg002Bs
* @param fCg002As * @param dbCg002BMap
* @param dbCg002AMap * @param cg001
*/ */
private void checkConfirmData(List<HGCG002A> fCg002As, Map<String, HGCG002A> dbCg002AMap) { private void checkConfirmData(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap, HGCG002 cg001) {
for (HGCG002A fCg002A : fCg002As) { for (HGCG002B fCg002B : fCg002Bs) {
String contractNo = fCg002A.getContractNo(); HGCG002B dbCg002B = dbCg002BMap.get(fCg002B.getId());
HGCG002A dbCg002A = dbCg002AMap.get(contractNo); AssertUtils.isNull(dbCg002B, String.format("合同明细[%s]不存在", dbCg002B.getId()));
AssertUtils.isNull(dbCg002A, String.format("合同[%s]不存在", contractNo)); AssertUtils.isTrue(!(HGConstant.CgContractStatus.S_2.equals(cg001.getStatus())
AssertUtils.isTrue(!(HGConstant.CgContractStatus.S_2.equals(dbCg002A.getStatus()) || HGConstant.CgContractStatus.S_4.equals(cg001.getStatus())),
|| HGConstant.CgContractStatus.S_4.equals(dbCg002A.getStatus())), String.format("合同[%s]状态不是\"审核通过\"或\"收货中\",不允许操作", cg001.getContractNo()));
String.format("合同[%s]状态不是\"审核通过\"或\"收货中\",不允许操作", contractNo)); AssertUtils.isGt(fCg002B.getBcReceiveQty(), fCg002B.getBcMaxReceiveQty(),
AssertUtils.isGt(fCg002A.getBcReceiveQty(), dbCg002A.getBcMaxReceiveQty(), String.format("合同[%s]本次收货数量(%s)不能大于本次最大收货数量(%s)", cg001.getContractNo(),
String.format("合同[%s]本次收货数量(%s)不能大于本次最大收货数量(%s)", contractNo, fCg002B.getBcReceiveQty(), fCg002B.getBcMaxReceiveQty()));
fCg002A.getBcReceiveQty(), dbCg002A.getBcMaxReceiveQty()));
} }
} }
/** /**
* 数据保存 * 数据保存
* * @param fCg002Bs
* @param fCg002As * @param dbCg002BMap
* @param dbCg002AMap * @param cg002
*/ */
private void confirmData(List<HGCG002A> fCg002As, Map<String, HGCG002A> dbCg002AMap) { private void confirmData(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap, HGCG002 cg002) {
for (HGCG002A fCg002A : fCg002As) { HGCG002B hgcg002B = fCg002Bs.get(0);
String contractNo = fCg002A.getContractNo(); HGCG003 newCg003 = BeanUtils.copy(hgcg002B, HGCG003.class);
HGCG002A dbCg002A = dbCg002AMap.get(contractNo); Long maxId = (Long) super.dao.get(HGCG003.MAX_ID,null,null);
HGCG003 newCg003 = BeanUtils.copy(dbCg002AMap.get(contractNo), HGCG003.class); newCg003.setId(maxId+1);
newCg003.setReceiveDate(DateUtils.shortDate()); newCg003.setReceiveDate(DateUtils.shortDate());
newCg003.setReceiveNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_RECEIVE_NO)); newCg003.setReceiveNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_RECEIVE_NO));
newCg003.setReceiveQty(fCg002A.getBcReceiveQty()); BigDecimal bcReceiveQtySum = fCg002Bs.stream().map(HGCG002B::getBcReceiveQty).reduce(BigDecimal.ZERO,BigDecimal::add);
newCg003.setReceiveUnitWeight(fCg002A.getPurUnitWeight()); newCg003.setReceiveQty(bcReceiveQtySum);
newCg003.setReceiveWeight(fCg002A.getBcReceiveQty().multiply(fCg002A.getPurUnitWeight())); BigDecimal purUnitWeightSum = fCg002Bs.stream().map(HGCG002B::getPurUnitWeight).reduce(BigDecimal.ZERO,BigDecimal::add);
newCg003.setStatus(HGConstant.CgReceiveStatus.S_0); newCg003.setReceiveUnitWeight(purUnitWeightSum);
newCg003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); newCg003.setReceiveWeight(newCg003.getReceiveQty().multiply(newCg003.getReceiveUnitWeight()));
DaoUtils.insert(HGCG003.INSERT, newCg003); newCg003.setStatus(HGConstant.CgReceiveStatus.S_0);
// 更新合同状态 newCg003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
HGCGTools.HgCg002.updateReceive(dbCg002A, fCg002A.getBcReceiveQty()); newCg003.setSource(HGConstant.CgSource.DEFAULT);
DaoUtils.insert(HGCG003.INSERT, newCg003);
for (HGCG002B fCg002B : fCg002Bs) {
insertDetails(fCg002B,newCg003);
} }
List<HGCG002> hgcg002List = new LinkedList<>();
hgcg002List.add(cg002);
HGCGTools.HgCg002.updateContractPrimary(hgcg002List);
}
private void insertDetails(HGCG002B dbCg002B, HGCG003 newCg003) {
HGCG003B cg003B = new HGCG003B();
//拷贝主表明细信息
BeanUtils.copyProperties(newCg003,cg003B,"id");
//拷贝明细信息
BeanUtils.copyProperties(dbCg002B,cg003B,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime"
,"contractNo","planNo","supCode","supName","purUserId","purUserName","status");
cg003B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
cg003B.setPrimaryId(newCg003.getId());
cg003B.setReceiveUnitWeight(dbCg002B.getPurUnitWeight());
cg003B.setReceiveQty(dbCg002B.getBcReceiveQty());
cg003B.setReceiveWeight(dbCg002B.getBcReceiveQty().multiply(dbCg002B.getPurUnitWeight()));
cg003B.setContractDetailId(dbCg002B.getId());
DaoUtils.insert(HGCG003B.INSERT,cg003B);
// 更新合同状态
HGCGTools.HgCg002B.updateReceive(dbCg002B, cg003B.getReceiveQty());
} }
} }
package com.baosight.hggp.hg.cg.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
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.cg.domain.*;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*;
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.LinkedList;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGCG003B extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "采购收货", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG003B().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "采购合同", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGCG003B.QUERY, new HGCG003B());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购收货", operType = "修改", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<HGCG003B> fCg003Bs = MapUtils.toDaoEPBase(inInfo, HGCG003B.class);
// 采购收货DB数据
Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetDataEp(fCg003Bs);
HGCG003 cg003 = HGCGTools.HgCg003.get(fCg003Bs.get(0).getPrimaryId());
// 采购合同DB数据
Map<String, HGCG002A> dbCg002AMap = HGCGUtils.HgCg002.lockGetData(
ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_NO));
// 采购合同明细DB数据
Map<Long, HGCG002B> dbCg002BMap = HGCGUtils.HgCg002B.lockGetData(
ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_DETAIL_ID));
// 数据校验
this.checkSaveData(fCg003Bs, dbCg003BMap,cg003);
// 保存数据
this.saveData(fCg003Bs, dbCg003BMap, dbCg002AMap,cg003,dbCg002BMap);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg003Bs.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 数据校验
* @param fCg003Bs
* @param dbCg003Map
* @param cg003
*/
private void checkSaveData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003Map, HGCG003 cg003) {
// 查询合同信息
List<String> contractNos = ObjectUtils.listEpKey(dbCg003Map.values(), HGCG003.FIELD_CONTRACT_NO);
Map<String, HGCG002A> dbCg002AMap = HGCGTools.HgCg002.map(contractNos);
for (HGCG003B fCg003B : fCg003Bs) {
String receiveNo = fCg003B.getReceiveNo();
HGCG003B dbCg003B = dbCg003Map.get(fCg003B.getId());
AssertUtils.isNull(dbCg003B, String.format("收货单[%s]不存在", receiveNo));
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_0, cg003.getStatus(),
String.format("收货单[%s]状态不是\"待确认\",不允许操作", receiveNo));
AssertUtils.isGt(BigDecimal.ZERO, fCg003B.getReceiveQty(),
String.format("收货单[%s]的\"收货数量(%s)\"必须大于0", receiveNo, fCg003B.getReceiveQty()));
// 校验合同数量
BigDecimal diffQty = fCg003B.getReceiveQty().subtract(dbCg003B.getReceiveQty());
if (diffQty.compareTo(BigDecimal.ZERO) == 1) {
HGCG002A dbCg002A = dbCg002AMap.get(fCg003B.getContractNo());
AssertUtils.isGt(diffQty, dbCg002A.getBcMaxReceiveQty(),
String.format("收货单【%s】的累计\"收货数量(%s)\"不能大于合同的\"采购数量(%s)\"", receiveNo,
fCg003B.getReceiveQty(), dbCg002A.getPurQty()));
}
}
}
/**
* 数据保存
* @param fCg003Bs
* @param dbCg003BMap
* @param dbCg002AMap
* @param cg003
* @param dbCg002BMap
*/
private void saveData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003BMap, Map<String, HGCG002A> dbCg002AMap, HGCG003 cg003, Map<Long, HGCG002B> dbCg002BMap) {
for (HGCG003B fCg003B : fCg003Bs) {
// 计算重量
fCg003B.setReceiveWeight(fCg003B.getReceiveQty().multiply(fCg003B.getReceiveUnitWeight()));
DaoUtils.update(HGSqlConstant.HgCg003B.UPDATE_QTY, fCg003B);
// 计算差异数量,更新合同状态
HGCG003B dbCg003B = dbCg003BMap.get(fCg003B.getId());
BigDecimal diffQty = fCg003B.getReceiveQty().subtract(dbCg003B.getReceiveQty());
HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()), diffQty);
}
List<HGCG002> hgcg002List = new LinkedList<>();
dbCg002AMap.forEach((k, v)->{
hgcg002List.add(v);
});
//根据子表明细刷新合同主表信息
HGCGTools.HgCg002.updateContractPrimary(hgcg002List);
//修改主表信息
updateCg003Pur(cg003);
}
private void updateCg003Pur(HGCG003 cg003) {
List<HGCG003B> queryCG003Bs = HGCGTools.HgCg003B.listByPrimaryId(cg003.getId());
//修改主表信息
//收货数量
BigDecimal receiveQtySum = queryCG003Bs.stream().map(HGCG003B::getReceiveQty).reduce(BigDecimal.ZERO,BigDecimal::add);
cg003.setReceiveQty(receiveQtySum);
//收货重量
BigDecimal receiveWeightSum = queryCG003Bs.stream().map(HGCG003B::getReceiveWeight).reduce(BigDecimal.ZERO,BigDecimal::add);
cg003.setReceiveWeight(receiveWeightSum);
DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_QTY, cg003);
}
/**
* 删除操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购收货", operType = "修改", operDesc = "删除")
public EiInfo remove(EiInfo inInfo) {
try {
List<HGCG003B> fCg003Bs = MapUtils.toDaoEPBase(inInfo, HGCG003B.class);
// 采购收货DB数据
Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetDataEp(fCg003Bs);
HGCG003 cg003 = HGCGTools.HgCg003.get(fCg003Bs.get(0).getPrimaryId());
// 采购合同DB数据
Map<String, HGCG002A> dbCg002AMap = HGCGUtils.HgCg002.lockGetData(
ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_NO));
// 采购合同明细DB数据
Map<Long, HGCG002B> dbCg002BMap = HGCGUtils.HgCg002B.lockGetData(
ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_DETAIL_ID));
// 数据校验
this.checkRemoveData(fCg003Bs, dbCg003BMap,cg003);
// 保存数据
this.removeData(fCg003Bs, dbCg003BMap, dbCg002AMap,cg003,dbCg002BMap);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg003Bs.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 数据校验
* @param fCg003Bs
* @param dbCg003BMap
* @param cg003
*/
private void checkRemoveData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003BMap, HGCG003 cg003) {
for (HGCG003B fCg003B : fCg003Bs) {
String receiveNo = fCg003B.getReceiveNo();
HGCG003B dbCg003B = dbCg003BMap.get(fCg003B.getId());
AssertUtils.isNull(dbCg003B, String.format("收货单[%s]不存在", receiveNo));
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_0, cg003.getStatus(),
String.format("收货单[%s]状态不是\"待确认\",不允许操作", receiveNo));
}
}
/**
* 数据保存
* @param fCg003Bs
* @param dbCg003bMap
* @param dbCg002AMap
* @param cg003
* @param dbCg002BMap
*/
private void removeData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003bMap, Map<String, HGCG002A> dbCg002AMap, HGCG003 cg003, Map<Long, HGCG002B> dbCg002BMap) {
for (HGCG003B fCg003B : fCg003Bs) {
HGCG003B dbCg003B = dbCg003bMap.get(fCg003B.getId());
dbCg003B.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGCG003B.DELETE, dbCg003B);
// 更新合同状态
HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()), dbCg003B.getReceiveQty().negate());
}
List<HGCG002> hgcg002List = new LinkedList<>();
dbCg002AMap.forEach((k, v)->{
hgcg002List.add(v);
});
//根据子表明细刷新合同主表信息
HGCGTools.HgCg002.updateContractPrimary(hgcg002List);
//修改主表信息
updateCg003Pur(cg003);
}
}
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<sqlMap namespace="HGCG001A"> <sqlMap namespace="HGCG001A">
<sql id="condition"> <sql id="condition">
AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
......
...@@ -246,11 +246,9 @@ ...@@ -246,11 +246,9 @@
SUP_NAME = #supName#, <!-- 供应商名称 --> SUP_NAME = #supName#, <!-- 供应商名称 -->
PUR_USER_ID = #purUserId#, <!-- 采购员 --> PUR_USER_ID = #purUserId#, <!-- 采购员 -->
PUR_USER_NAME = #purUserName#, <!-- 采购员名称 --> PUR_USER_NAME = #purUserName#, <!-- 采购员名称 -->
PRICE = #price#, <!-- 单价 -->
AMOUNT = #amount#, <!-- 金额(不含税金额) --> AMOUNT = #amount#, <!-- 金额(不含税金额) -->
TAX_INCLUDE_AMOUNT = #taxIncludeAmount#, <!-- 含税金额 --> TAX_INCLUDE_AMOUNT = #taxIncludeAmount#, <!-- 含税金额 -->
TAX_AMOUNT = #taxAmount#, <!-- 税额 --> TAX_AMOUNT = #taxAmount#, <!-- 税额 -->
TAX_RATE = #taxRate#, <!-- 税率 -->
<include refid="updateRevise"/> <include refid="updateRevise"/>
WHERE CONTRACT_NO = #contractNo# WHERE CONTRACT_NO = #contractNo#
</update> </update>
...@@ -288,4 +286,8 @@ ...@@ -288,4 +286,8 @@
WHERE CONTRACT_NO = #contractNo# WHERE CONTRACT_NO = #contractNo#
</update> </update>
<select id="maxId" resultClass="long">
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGCG002
</select>
</sqlMap> </sqlMap>
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<sqlMap namespace="HGCG002A"> <sqlMap namespace="HGCG002A">
<sql id="condition"> <sql id="condition">
AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -103,6 +104,24 @@ ...@@ -103,6 +104,24 @@
PRIMARY_ID = #primaryId# PRIMARY_ID = #primaryId#
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#,
UPDATED_NAME = #updatedName#,
UPDATED_TIME = #updatedTime#
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate open="(" close=")" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="primaryIds">
PRIMARY_ID IN <iterate open="(" close=")" conjunction="," property="primaryIds">#primaryIds[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.cg.domain.HGCG002B"> resultClass="com.baosight.hggp.hg.cg.domain.HGCG002B">
...@@ -142,6 +161,7 @@ ...@@ -142,6 +161,7 @@
PRIMARY_ID as "primaryId" <!-- 主表id --> PRIMARY_ID as "primaryId" <!-- 主表id -->
FROM ${hggpSchema}.HGCG002A WHERE 1=1 FROM ${hggpSchema}.HGCG002A WHERE 1=1
<include refid="condition" /> <include refid="condition" />
<include refid="idCondition"/>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
...@@ -150,7 +170,6 @@ ...@@ -150,7 +170,6 @@
ID asc ID asc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</select> </select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
...@@ -240,4 +259,144 @@ ...@@ -240,4 +259,144 @@
ID = #id# ID = #id#
</update> </update>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hggpSchema}.HGCG002A
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<include refid="idCondition"/>
</update>
<select id="queryByReceive" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.cg.domain.HGCG002B">
SELECT
a.ID as "id",
a.ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
a.DEP_CODE as "depCode", <!-- 部门编码 -->
a.CREATED_BY as "createdBy", <!-- 记录创建者 -->
a.CREATED_NAME as "createdName", <!-- 记录创建名称 -->
a.CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
a.UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
a.UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
a.UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
a.DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
a.COMPANY_CODE as "companyCode", <!-- 公司编码 -->
a.COMPANY_NAME as "companyName", <!-- 公司名称 -->
a.INVENT_TYPE as "inventType", <!-- 存货类型 -->
a.INVENT_CODE as "inventCode", <!-- 存货编码 -->
a.INVENT_NAME as "inventName", <!-- 存货名称 -->
a.SPEC as "spec", <!-- 规格 -->
a.MATERIAL as "material", <!-- 材质 -->
a.UNIT as "unit", <!-- 单位 -->
a.LENGTH as "length", <!-- 长度 -->
a.WIDTH as "width", <!-- 宽度 -->
a.THICK as "thick", <!-- 厚度 -->
a.PUR_QTY as "purQty", <!-- 采购数量 -->
a.PUR_UNIT_WEIGHT as "purUnitWeight", <!-- 采购单重 -->
a.PUR_WEIGHT as "purWeight", <!-- 采购重量 -->
a.RECEIVE_QTY as "receiveQty", <!-- 收货数量 -->
a.RECEIVE_WEIGHT as "receiveWeight", <!-- 收货重量 -->
a.PRICE as "price", <!-- 单价 -->
a.AMOUNT as "amount", <!-- 金额(不含税金额) -->
a.TAX_INCLUDE_AMOUNT as "taxIncludeAmount", <!-- 含税金额 -->
a.TAX_AMOUNT as "taxAmount", <!-- 税额 -->
a.TAX_RATE as "taxRate", <!-- 税率 -->
a.INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 -->
a.PRIMARY_ID as "primaryId", <!-- 主表id -->
(a.PUR_QTY - a.RECEIVE_QTY) as "bcMaxReceiveQty",
b.STATUS as "status", <!-- 状态 -->
b.CONTRACT_DATE as "contractDate", <!-- 合同日期 -->
b.CONTRACT_NO as "contractNo", <!-- 合同号 -->
b.PLAN_NO as "planNo", <!-- 计划单号 -->
b.SUP_CODE as "supCode", <!-- 供应商编码 -->
b.SUP_NAME as "supName", <!-- 供应商名称 -->
b.PUR_USER_ID as "purUserId", <!-- 采购员 -->
b.PUR_USER_NAME as "purUserName" <!-- 采购员名称 -->
FROM ${hggpSchema}.HGCG002A a
LEFT JOIN ${hggpSchema}.HGCG002 b ON a.PRIMARY_ID = b.id
WHERE 1=1
AND a.DELETE_FLAG = 0
AND b.DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id">
a.ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
a.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
a.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
a.COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
a.INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="primaryId">
a.PRIMARY_ID = #primaryId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
a.INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeFrom">
a.CREATED_TIME &gt;= #createdTimeFrom#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeTo">
a.CREATED_TIME &lt;= #createdTimeTo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
a.ID IN <iterate open="(" close=")" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="contractDate">
b.CONTRACT_DATE = #contractDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="contractNo">
b.CONTRACT_NO = #contractNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planNo">
b.PLAN_NO = #planNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="supCode">
b.SUP_CODE = #supCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="supName">
b.SUP_NAME = #supName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="purUserId">
b.PUR_USER_ID = #purUserId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="purUserName">
b.PUR_USER_NAME = #purUserName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="statuses">
b.STATUS IN <iterate open="(" close=")" conjunction="," property="statuses">#statuses[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
b.STATUS = #status#
</isNotEmpty>
<include refid="idCondition"/>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
a.ID desc
</isEmpty>
</dynamic>
</select>
<!-- 修改收货 -->
<update id="updateReceive">
UPDATE ${hggpSchema}.HGCG002A
SET
RECEIVE_QTY = #receiveQty#,
RECEIVE_WEIGHT = #receiveWeight#,
<include refid="updateRevise"/>
WHERE ID = #id#
</update>
</sqlMap> </sqlMap>
...@@ -175,6 +175,7 @@ ...@@ -175,6 +175,7 @@
<insert id="insert"> <insert id="insert">
INSERT INTO ${hggpSchema}.HGCG003 ( INSERT INTO ${hggpSchema}.HGCG003 (
ID,
ACCOUNT_CODE, <!-- 企业编码 --> ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 --> DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 --> CREATED_BY, <!-- 记录创建者 -->
...@@ -275,4 +276,8 @@ ...@@ -275,4 +276,8 @@
WHERE RECEIVE_NO = #receiveNo# WHERE RECEIVE_NO = #receiveNo#
</update> </update>
<select id="maxId" resultClass="long">
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGCG003
</select>
</sqlMap> </sqlMap>
...@@ -3,9 +3,8 @@ ...@@ -3,9 +3,8 @@
<sqlMap namespace="HGCG003A"> <sqlMap namespace="HGCG003A">
<sql id="condition"> <sql id="condition">
<isNotEmpty prepend=" AND " property="id"> AND DELETE_FLAG = 0
ID = #id# <include refid="idCondition"/>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode"> <isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode# ACCOUNT_CODE = #accountCode#
</isNotEmpty> </isNotEmpty>
...@@ -111,10 +110,31 @@ ...@@ -111,10 +110,31 @@
<isNotEmpty prepend=" AND " property="primaryId"> <isNotEmpty prepend=" AND " property="primaryId">
PRIMARY_ID = #primaryId# PRIMARY_ID = #primaryId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="contractDetailId">
CONTRACT_DETAIL_ID = #contractDetailId#
</isNotEmpty>
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate open="(" close=")" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="primaryIds">
PRIMARY_ID IN <iterate open="(" close=")" conjunction="," property="primaryIds">#primaryIds[]#</iterate>
</isNotEmpty>
</sql>
<sql id="updateRevise">
UPDATED_BY = #updatedBy#,
UPDATED_NAME = #updatedName#,
UPDATED_TIME = #updatedTime#
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.cg.domain.HGCG003A"> resultClass="com.baosight.hggp.hg.cg.domain.HGCG003B">
SELECT SELECT
ID as "id", ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 --> ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
...@@ -152,6 +172,8 @@ ...@@ -152,6 +172,8 @@
AMOUNT as "amount", <!-- 金额(不含税金额) --> AMOUNT as "amount", <!-- 金额(不含税金额) -->
INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 --> INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 -->
PRIMARY_ID as "primaryId", <!-- 主表id --> PRIMARY_ID as "primaryId", <!-- 主表id -->
CONTRACT_DETAIL_ID as "contractDetailId" <!-- 合同明细id -->
PRIMARY_ID as "primaryId", <!-- 主表id -->
IS_INVOICING as "isInvoicing" IS_INVOICING as "isInvoicing"
FROM ${hggpSchema}.HGCG003A WHERE 1=1 FROM ${hggpSchema}.HGCG003A WHERE 1=1
<include refid="condition" /> <include refid="condition" />
...@@ -208,8 +230,11 @@ ...@@ -208,8 +230,11 @@
AMOUNT, <!-- 金额(不含税金额) --> AMOUNT, <!-- 金额(不含税金额) -->
INVENT_TYPE_DETAIL, <!-- 存货类型大类 --> INVENT_TYPE_DETAIL, <!-- 存货类型大类 -->
PRIMARY_ID, <!-- 主表id --> PRIMARY_ID, <!-- 主表id -->
CONTRACT_DETAIL_ID <!-- 合同明细id -->
PRIMARY_ID, <!-- 主表id -->
IS_INVOICING IS_INVOICING
) )
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #receiveDate#, #receiveNo#, #planNo#, #contractNo#, #inventType#, #inventCode#, #inventName#, #specId#, #spec#, #material#, #unit#, #length#, #width#, #thick#, #receiveQty#, #deliverQty#, #depositQty#, #receiveUnitWeight#, #receiveWeight#, #status#, #price#, #amount#, #inventTypeDetail#, #primaryId#, #contractDetailId#)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #receiveDate#, #receiveNo#, #planNo#, #contractNo#, #inventType#, #inventCode#, #inventName#, #specId#, #spec#, #material#, #unit#, #length#, #width#, #thick#, #receiveQty#, #deliverQty#, #depositQty#, #receiveUnitWeight#, #receiveWeight#, #status#, #price#, #amount#, #inventTypeDetail#, #primaryId#,#isInvoicing#) VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #receiveDate#, #receiveNo#, #planNo#, #contractNo#, #inventType#, #inventCode#, #inventName#, #specId#, #spec#, #material#, #unit#, #length#, #width#, #thick#, #receiveQty#, #deliverQty#, #depositQty#, #receiveUnitWeight#, #receiveWeight#, #status#, #price#, #amount#, #inventTypeDetail#, #primaryId#,#isInvoicing#)
</insert> </insert>
...@@ -256,6 +281,7 @@ ...@@ -256,6 +281,7 @@
AMOUNT = #amount#, <!-- 金额(不含税金额) --> AMOUNT = #amount#, <!-- 金额(不含税金额) -->
INVENT_TYPE_DETAIL = #inventTypeDetail#, <!-- 存货类型大类 --> INVENT_TYPE_DETAIL = #inventTypeDetail#, <!-- 存货类型大类 -->
PRIMARY_ID = #primaryId#, <!-- 主表id --> PRIMARY_ID = #primaryId#, <!-- 主表id -->
CONTRACT_DETAIL_ID = #contractDetailId# <!-- 合同明细id -->
IS_INVOICING = #isInvoicing# IS_INVOICING = #isInvoicing#
WHERE WHERE
ID = #id# ID = #id#
...@@ -271,4 +297,157 @@ ...@@ -271,4 +297,157 @@
</update> </update>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hggpSchema}.HGCG003A
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<include refid="idCondition"/>
</update>
<!-- 修改数量 -->
<update id="updateQty">
UPDATE ${hggpSchema}.HGCG003A
SET
RECEIVE_QTY = #receiveQty#, <!-- 收货数量 -->
RECEIVE_WEIGHT = #receiveWeight#, <!-- 收货重量 -->
<include refid="updateRevise"/>
WHERE ID = #id#
</update>
<!-- 修改确认 -->
<update id="updateConfirm">
UPDATE ${hggpSchema}.HGCG003A
SET
STATUS = #status#,
DELIVER_QTY = #deliverQty#, <!-- 退货数量 -->
DEPOSIT_QTY = #depositQty#, <!-- 入库数量 -->
<include refid="updateRevise"/>
WHERE ID = #id#
</update>
<!-- 修改状态 -->
<update id="updateStatus">
UPDATE ${hggpSchema}.HGCG003A
SET
STATUS = #status#,
<include refid="updateRevise"/>
WHERE ID = #id#
</update>
<select id="queryByQualityTesting" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.cg.domain.HGCG003B">
SELECT
a.ID as "id",
a.ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
a.DEP_CODE as "depCode", <!-- 部门编码 -->
a.CREATED_BY as "createdBy", <!-- 记录创建者 -->
a.CREATED_NAME as "createdName", <!-- 记录创建名称 -->
a.CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
a.UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
a.UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
a.UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
a.DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
a.COMPANY_CODE as "companyCode", <!-- 公司编码 -->
a.COMPANY_NAME as "companyName", <!-- 公司名称 -->
a.RECEIVE_DATE as "receiveDate", <!-- 收货日期 -->
a.RECEIVE_NO as "receiveNo", <!-- 收货单号 -->
a.PLAN_NO as "planNo", <!-- 计划单号 -->
a.CONTRACT_NO as "contractNo", <!-- 合同号 -->
a.INVENT_TYPE as "inventType", <!-- 存货类型 -->
a.INVENT_CODE as "inventCode", <!-- 存货编码 -->
a.INVENT_NAME as "inventName", <!-- 存货名称 -->
a.SPEC_ID as "specId", <!-- 规格ID -->
a.SPEC as "spec", <!-- 规格 -->
a.MATERIAL as "material", <!-- 材质 -->
a.UNIT as "unit", <!-- 单位 -->
a.LENGTH as "length", <!-- 长度 -->
a.WIDTH as "width", <!-- 宽度 -->
a.THICK as "thick", <!-- 厚度 -->
a.RECEIVE_QTY as "receiveQty", <!-- 收货数量 -->
a.DELIVER_QTY as "deliverQty", <!-- 退货数量 -->
a.DEPOSIT_QTY as "depositQty", <!-- 入库数量 -->
a.RECEIVE_UNIT_WEIGHT as "receiveUnitWeight", <!-- 收货单重 -->
a.RECEIVE_WEIGHT as "receiveWeight", <!-- 收货重量 -->
a.PRICE as "price", <!-- 单价 -->
a.AMOUNT as "amount", <!-- 金额(不含税金额) -->
a.INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 -->
a.PRIMARY_ID as "primaryId", <!-- 主表id -->
a.CONTRACT_DETAIL_ID as "contractDetailId", <!-- 合同明细id -->
b.STATUS as "status", <!-- 状态 -->
b.SUP_CODE as "supCode", <!-- 供应商编码 -->
b.SUP_NAME as "supName", <!-- 供应商名称 -->
b.PUR_USER_ID as "purUserId", <!-- 采购员 -->
b.PUR_USER_NAME as "purUserName" <!-- 采购员名称 -->
FROM ${hggpSchema}.HGCG003A a
LEFT JOIN ${hggpSchema}.HGCG003 b ON a.PRIMARY_ID = b.id
WHERE 1=1
AND a.DELETE_FLAG = 0
AND b.DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id">
a.ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
a.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
a.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
a.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
a.COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="primaryId">
a.PRIMARY_ID = #primaryId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
a.INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeFrom">
a.CREATED_TIME &gt;= replace(#createdTimeFrom#,'-','')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeTo">
a.CREATED_TIME &lt;= replace(#createdTimeTo#,'-','')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
a.ID IN <iterate open="(" close=")" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventTypeDetails">
a.INVENT_TYPE_DETAIL IN <iterate close=")" open="(" conjunction="," property="inventTypeDetails">#inventTypeDetails[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveNo">
a.RECEIVE_NO = #receiveNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveDate">
a.RECEIVE_DATE = replace(#receiveDate#,'-','')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="supCode">
b.SUP_CODE = #supCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="supName">
b.SUP_NAME like concat('%',#supName#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="purUserId">
b.PUR_USER_ID = #purUserId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="purUserName">
b.PUR_USER_NAME = #purUserName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
b.STATUS = #status#
</isNotEmpty>
<include refid="idCondition"/>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
a.ID desc
</isEmpty>
</dynamic>
</select>
</sqlMap> </sqlMap>
package com.baosight.hggp.hg.cg.utils; package com.baosight.hggp.hg.cg.utils;
import com.baosight.hggp.hg.cg.domain.HGCG001; import com.baosight.hggp.hg.cg.domain.*;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.domain.HGCG002A;
import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cg.tools.HGCGTools; import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.utils.HGUtils; import com.baosight.hggp.hg.utils.HGUtils;
import com.baosight.hggp.util.DateUtils; import com.baosight.hggp.util.DateUtils;
...@@ -19,7 +16,7 @@ import java.util.Map; ...@@ -19,7 +16,7 @@ import java.util.Map;
* @date:2024/5/9,13:50 * @date:2024/5/9,13:50
*/ */
public class HGCGUtils { public class HGCGUtils {
/** /**
* HGCG001 工具类 * HGCG001 工具类
* *
...@@ -27,7 +24,7 @@ public class HGCGUtils { ...@@ -27,7 +24,7 @@ public class HGCGUtils {
* @date:2024/5/9,16:57 * @date:2024/5/9,16:57
*/ */
public static class HgCg001 { public static class HgCg001 {
/** /**
* 设置查询条件 * 设置查询条件
* *
...@@ -42,9 +39,9 @@ public class HGCGUtils { ...@@ -42,9 +39,9 @@ public class HGCGUtils {
queryRow.put(HGCG001.FIELD_PLAN_DATE, DateUtils.formatShort(planDate)); queryRow.put(HGCG001.FIELD_PLAN_DATE, DateUtils.formatShort(planDate));
} }
} }
} }
/** /**
* HGCG002 工具类 * HGCG002 工具类
* *
...@@ -52,7 +49,7 @@ public class HGCGUtils { ...@@ -52,7 +49,7 @@ public class HGCGUtils {
* @date:2024/5/9,16:58 * @date:2024/5/9,16:58
*/ */
public static class HgCg002 { public static class HgCg002 {
/** /**
* 设置查询条件 * 设置查询条件
* *
...@@ -67,7 +64,7 @@ public class HGCGUtils { ...@@ -67,7 +64,7 @@ public class HGCGUtils {
queryRow.put(HGCG002.FIELD_CONTRACT_DATE, DateUtils.formatShort(contractDate)); queryRow.put(HGCG002.FIELD_CONTRACT_DATE, DateUtils.formatShort(contractDate));
} }
} }
/** /**
* 锁并且获取数据 * 锁并且获取数据
* *
...@@ -77,7 +74,7 @@ public class HGCGUtils { ...@@ -77,7 +74,7 @@ public class HGCGUtils {
public static Map<String, HGCG002A> lockGetDataEp(List<? extends HGCG002> fCg002s) { public static Map<String, HGCG002A> lockGetDataEp(List<? extends HGCG002> fCg002s) {
return lockGetData(ObjectUtils.listEpKey(fCg002s, HGCG002.FIELD_CONTRACT_NO)); return lockGetData(ObjectUtils.listEpKey(fCg002s, HGCG002.FIELD_CONTRACT_NO));
} }
/** /**
* 锁并且获取数据 * 锁并且获取数据
* *
...@@ -90,9 +87,42 @@ public class HGCGUtils { ...@@ -90,9 +87,42 @@ public class HGCGUtils {
// db数据 // db数据
return HGCGTools.HgCg002.map(contractNos); return HGCGTools.HgCg002.map(contractNos);
} }
} }
/**
* HGCG002 工具类
*
* @author:songx
* @date:2024/5/9,16:58
*/
public static class HgCg002B {
/**
* 锁并且获取数据
*
* @param fCg002Bs
* @return
*/
public static Map<Long, HGCG002B> lockGetDataEp(List<? extends HGCG002B> fCg002Bs) {
return lockGetData(ObjectUtils.listEpKey(fCg002Bs, HGCG002B.FIELD_ID));
}
/**
* 锁并且获取数据
*
* @param ids
* @return
*/
public static Map<Long, HGCG002B> lockGetData(List<Long> ids) {
// 锁
HGCGTools.HgCg002B.lock(ids);
// db数据
return HGCGTools.HgCg002B.map(ids);
}
}
/** /**
* HGCG003 工具类 * HGCG003 工具类
* *
...@@ -100,7 +130,7 @@ public class HGCGUtils { ...@@ -100,7 +130,7 @@ public class HGCGUtils {
* @date:2024/5/9,16:58 * @date:2024/5/9,16:58
*/ */
public static class HgCg003 { public static class HgCg003 {
/** /**
* 设置查询条件 * 设置查询条件
* *
...@@ -115,7 +145,7 @@ public class HGCGUtils { ...@@ -115,7 +145,7 @@ public class HGCGUtils {
queryRow.put(HGCG003.FIELD_RECEIVE_DATE, DateUtils.formatShort(receiveDate)); queryRow.put(HGCG003.FIELD_RECEIVE_DATE, DateUtils.formatShort(receiveDate));
} }
} }
/** /**
* 锁并且获取数据 * 锁并且获取数据
* *
...@@ -125,7 +155,7 @@ public class HGCGUtils { ...@@ -125,7 +155,7 @@ public class HGCGUtils {
public static Map<String, HGCG003> lockGetDataEp(List<? extends HGCG003> fCg003s) { public static Map<String, HGCG003> lockGetDataEp(List<? extends HGCG003> fCg003s) {
return lockGetData(ObjectUtils.listEpKey(fCg003s, HGCG003.FIELD_RECEIVE_NO)); return lockGetData(ObjectUtils.listEpKey(fCg003s, HGCG003.FIELD_RECEIVE_NO));
} }
/** /**
* 锁并且获取数据 * 锁并且获取数据
* *
...@@ -138,7 +168,40 @@ public class HGCGUtils { ...@@ -138,7 +168,40 @@ public class HGCGUtils {
// db数据 // db数据
return HGCGTools.HgCg003.map(receiveNos); return HGCGTools.HgCg003.map(receiveNos);
} }
} }
/**
* HGCG003B 工具类
*
* @author:songx
* @date:2024/5/9,16:58
*/
public static class HgCg003B {
/**
* 锁并且获取数据
*
* @param fCg003Bs
* @return
*/
public static Map<Long, HGCG003B> lockGetDataEp(List<? extends HGCG003B> fCg003Bs) {
return lockGetData(ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_ID));
}
/**
* 锁并且获取数据
*
* @param ids
* @return
*/
public static Map<Long, HGCG003B> lockGetData(List<Long> ids) {
// 锁
HGCGTools.HgCg003B.lock(ids);
// db数据
return HGCGTools.HgCg003B.map(ids);
}
}
} }
...@@ -64,6 +64,22 @@ public class HGSqlConstant { ...@@ -64,6 +64,22 @@ public class HGSqlConstant {
} }
/** /**
* HGCG002 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HgCg002B {
// 模块名称
private static final String MODULE_NAME = "HGCG002A.";
// 锁
public static final String LOCK = MODULE_NAME + "lock";
// 修改收货数量
public static final String UPDATE_RECEIVE = MODULE_NAME + "updateReceive";
}
/**
* HGCG003 SQL 定义 * HGCG003 SQL 定义
* *
* @author:songx * @author:songx
...@@ -92,6 +108,26 @@ public class HGSqlConstant { ...@@ -92,6 +108,26 @@ public class HGSqlConstant {
public static final String UPDATE_IS_INVOICING = MODULE_NAME + "updateIsInvoicing"; public static final String UPDATE_IS_INVOICING = MODULE_NAME + "updateIsInvoicing";
} }
/**
* HGCG003 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HgCg003B {
// 模块名称
private static final String MODULE_NAME = "HGCG003A.";
// 锁
public static final String LOCK = MODULE_NAME + "lock";
// 修改数量
public static final String UPDATE_QTY = MODULE_NAME + "updateQty";
// 修改状态
public static final String UPDATE_STATUS = MODULE_NAME + "updateStatus";
// 收货完成
public static final String UPDATE_CONFIRM = MODULE_NAME + "updateConfirm";
}
public class HgCw012 { public class HgCw012 {
/** /**
* 模块名称:HGCW012 * 模块名称:HGCW012
......
...@@ -4,10 +4,15 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; ...@@ -4,10 +4,15 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.AssignStatusEnum; import com.baosight.hggp.common.AssignStatusEnum;
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.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.cb.domain.HGCB001;
import com.baosight.hggp.hg.cb.tools.HGCBTools;
import com.baosight.hggp.hg.cg.domain.HGCG001; import com.baosight.hggp.hg.cg.domain.HGCG001;
import com.baosight.hggp.hg.cg.domain.HGCG001A;
import com.baosight.hggp.hg.cg.tools.HGCGTools; import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.kc.domain.HGKC004;
import com.baosight.hggp.hg.pz.domain.HGPZ004; import com.baosight.hggp.hg.pz.domain.HGPZ004;
import com.baosight.hggp.hg.pz.domain.HGPZ005; import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.tools.HGPZTools; import com.baosight.hggp.hg.pz.tools.HGPZTools;
...@@ -22,6 +27,7 @@ import com.baosight.iplat4j.core.exception.PlatException; ...@@ -22,6 +27,7 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.aspectj.apache.bcel.classfile.Constant;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
...@@ -217,43 +223,59 @@ public class ServiceHGSC009A extends ServiceBase { ...@@ -217,43 +223,59 @@ public class ServiceHGSC009A extends ServiceBase {
public EiInfo insertcg(EiInfo inInfo) { public EiInfo insertcg(EiInfo inInfo) {
try { try {
String[] orderDetailIds = inInfo.getString("planMaterialCodes").split(","); String[] orderDetailIds = inInfo.getString("planMaterialCodes").split(",");
String[] ids = inInfo.getString("ids").split(",");
List<HGSC009A> hgsc009AList = HGSCTools.THGSC009.getByPlanMaterialCodes(orderDetailIds); List<HGSC009A> hgsc009AList = HGSCTools.THGSC009.getByPlanMaterialCodes(orderDetailIds);
List<HGSC009> hgsc009List = HGSCTools.THGSC009.getByIds(ids);
List<String> inventCodes = Optional.ofNullable(hgsc009AList).orElse(new ArrayList<>()).stream().map(HGSC009A::getInventCode).collect(Collectors.toList()); List<String> inventCodes = Optional.ofNullable(hgsc009AList).orElse(new ArrayList<>()).stream().map(HGSC009A::getInventCode).collect(Collectors.toList());
Map<String,String> inventUnitMap = new HashMap<>(); Map<String,HGPZ005> pz005Map = new HashMap<>();
if(CollectionUtils.isNotEmpty(inventCodes)){ if(CollectionUtils.isNotEmpty(inventCodes)){
List<HGPZ005> hgpz005List = HGPZTools.HgPz005.listByInventCodes(inventCodes); List<HGPZ005> hgpz005List = HGPZTools.HgPz005.listByInventCodes(inventCodes);
if(CollectionUtils.isNotEmpty(hgpz005List)){ if(CollectionUtils.isNotEmpty(hgpz005List)){
inventUnitMap = hgpz005List.stream().collect(Collectors.toMap(HGPZ005::getInventCode,HGPZ005::getUnit,(v1,v2)->v1)); pz005Map = hgpz005List.stream().collect(Collectors.toMap(HGPZ005::getInventCode, item -> item));
} }
} }
// 数据校验 // 数据校验
this.checkInsertcgData(hgsc009AList); this.checkInsertcgData(hgsc009AList);
Map<String,List<HGSC009A>> sc009Map = hgsc009AList.stream().collect(Collectors.groupingBy(HGSC009A::getPlanMaterialCode));
for (HGSC009A hgsc009 : hgsc009AList) { Map<String, HGPZ005> finalPz005Map = pz005Map;
// 写入子表数据 Optional.ofNullable(sc009Map).orElse(new HashMap<>()).forEach((k, v)->{
HGCG001 hgcg001 = new HGCG001(); HGSC009 sc009 = hgsc009List.stream().filter(o->o.getPlanMaterialCode().equals(k)).findAny().orElse(null);
BeanUtils.copyProperties(hgsc009,hgcg001); if(Objects.nonNull(sc009)){
hgcg001.setMaterialPlanId(hgsc009.getId()); HGCG001 hgcg001 = new HGCG001();
hgcg001.setCompanyCode(hgsc009.getCompanyCode()); BeanUtils.copyProperties(sc009,hgcg001,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
hgcg001.setCompanyName(hgsc009.getCompanyName()); Long maxId = (Long) super.dao.get(HGCG001.MAX_ID,null,null);
hgcg001.setInventCode(hgsc009.getInventCode()); hgcg001.setMaterialPlanId(sc009.getId());
hgcg001.setInventName(hgsc009.getInventName()); hgcg001.setId(maxId+1);
hgcg001.setStatus(HGConstant.CgPlanStatus.S_0);
//hgcg001.setInventName(hgsc009.getSpec()); //规格 hgcg001.setPlanNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_PLAN_NO));
hgcg001.setSpec(hgsc009.getSpec()); hgcg001.setPlanDate(DateUtils.formatShort(DateUtils.date()));
hgcg001.setLength(hgsc009.getLength()); hgcg001.setSource(HGConstant.CgSource.DEFAULT);
hgcg001.setWidth(hgsc009.getWidth()); //计划数量
hgcg001.setThick(hgsc009.getThick()); BigDecimal planQty = v.stream().map(HGSC009A::getQuantity).reduce(BigDecimal.ZERO,BigDecimal::add);
hgcg001.setInventTypeDetail(Integer.parseInt(hgsc009.getInventTypeDetail())); hgcg001.setPlanQty(planQty);
hgcg001.setStatus(0); //计划重量
hgcg001.setPlanDate(DateUtils.formatShort(DateUtils.date())); BigDecimal planWeight = v.stream().map(HGSC009A::getGrossAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
hgcg001.setPlanUnitWeight(hgsc009.getSingleWeight());//单量 hgcg001.setPlanWeight(planWeight);
hgcg001.setPlanWeight(hgsc009.getGrossAmount()); DaoUtils.insert(HGCG001.INSERT, hgcg001);
hgcg001.setPlanQty(hgsc009.getQuantity()); v.forEach(hgsc009A->{
hgcg001.setPlanNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_PLAN_NO)); // 写入子表数据
hgcg001.setUnit(inventUnitMap.get(hgsc009.getInventCode())); HGCG001A cg001A = new HGCG001A();
DaoUtils.insert(HGCG001.INSERT, hgcg001); BeanUtils.copyProperties(hgsc009A,cg001A,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
} //材料计划id存主表id
cg001A.setMaterialPlanId(sc009.getId());
cg001A.setPrimaryId(hgcg001.getId());
cg001A.setInventTypeDetail(Integer.parseInt(hgsc009A.getInventTypeDetail()));
cg001A.setPlanDate(hgcg001.getPlanDate());
cg001A.setPlanUnitWeight(hgsc009A.getSingleWeight());//单量
cg001A.setPlanWeight(hgsc009A.getGrossAmount());
cg001A.setPlanQty(hgsc009A.getQuantity());
cg001A.setPlanNo(hgcg001.getPlanNo());
cg001A.setUnit(finalPz005Map.get(hgsc009A.getInventCode()).getUnit());
cg001A.setInventType(finalPz005Map.get(hgsc009A.getInventCode()).getInventType());
DaoUtils.insert(HGCG001A.INSERT, cg001A);
});
}
});
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("操作成功!本次对[" + orderDetailIds.length + "]条数据生成采购计划成功!"); inInfo.setMsg("操作成功!本次对[" + orderDetailIds.length + "]条数据生成采购计划成功!");
} catch (Exception e) { } catch (Exception e) {
......
...@@ -1234,6 +1234,14 @@ public class HGSCTools { ...@@ -1234,6 +1234,14 @@ public class HGSCTools {
HGSC009 results = (HGSC009)DaoBase.getInstance().get(HGSC009.QUERY, HGSC009.FIELD_ID, taskId); HGSC009 results = (HGSC009)DaoBase.getInstance().get(HGSC009.QUERY, HGSC009.FIELD_ID, taskId);
return results; return results;
} }
public static List<HGSC009> getByIds(String[] ids){
AssertUtils.isTrue(Objects.isNull(ids)||ids.length<=0, "材料计划主表id不能为空!");
Map map = new HashMap<>();
map.put("ids",ids);
List<HGSC009> results = DaoBase.getInstance().query(HGSC009.QUERY, map);
AssertUtils.isEmpty(results,"材料计划不能为空!");
return results;
}
public static List<HGSC009A> getByPlanMaterialCodes(String[] planMaterialCodes){ public static List<HGSC009A> getByPlanMaterialCodes(String[] planMaterialCodes){
AssertUtils.isTrue(Objects.isNull(planMaterialCodes)||planMaterialCodes.length<=0, "材料计划编码不能为空!"); AssertUtils.isTrue(Objects.isNull(planMaterialCodes)||planMaterialCodes.length<=0, "材料计划编码不能为空!");
Map map = new HashMap<>(); Map map = new HashMap<>();
......
...@@ -54,7 +54,7 @@ public class HGZL001 extends DaoEPBase { ...@@ -54,7 +54,7 @@ public class HGZL001 extends DaoEPBase {
public static final String FIELD_RECEIVE_WEIGHT = "receiveWeight"; /* 收货重量*/ public static final String FIELD_RECEIVE_WEIGHT = "receiveWeight"; /* 收货重量*/
public static final String FIELD_STATUS = "status"; /* 状态:0-质检中,1-质检完成*/ public static final String FIELD_STATUS = "status"; /* 状态:0-质检中,1-质检完成*/
public static final String FIELD_INVENT_TYPE_DETAIL = "inventTypeDetail"; /*存货类型明细*/ public static final String FIELD_INVENT_TYPE_DETAIL = "inventTypeDetail"; /*存货类型明细*/
public static final String FIELD_RECEIVE_DETAIL_ID = "receiveDetailId"; public static final String FIELD_RECEIVE_DETAIL_ID = "receiveDetailId"; /*采购收货明细id*/
public static final String COL_ID = "ID"; public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/ public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
...@@ -126,7 +126,8 @@ public class HGZL001 extends DaoEPBase { ...@@ -126,7 +126,8 @@ public class HGZL001 extends DaoEPBase {
private BigDecimal receiveWeight = new BigDecimal(0.000); /* 收货重量*/ private BigDecimal receiveWeight = new BigDecimal(0.000); /* 收货重量*/
private Integer status; /* 状态:0-质检中,1-质检完成*/ private Integer status; /* 状态:0-质检中,1-质检完成*/
private Integer inventTypeDetail; /*存货类型明细 1:构建 2:零件*/ private Integer inventTypeDetail; /*存货类型明细 1:构建 2:零件*/
private Long receiveDetailId = 0l; private Long receiveDetailId = new Long(0); /* 采购收货明细id*/
/** /**
* initialize the metadata. * initialize the metadata.
...@@ -288,7 +289,7 @@ public class HGZL001 extends DaoEPBase { ...@@ -288,7 +289,7 @@ public class HGZL001 extends DaoEPBase {
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_RECEIVE_DETAIL_ID); eiColumn = new EiColumn(FIELD_RECEIVE_DETAIL_ID);
eiColumn.setDescName("采购收货明细ID"); eiColumn.setDescName("采购收货明细id");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
} }
......
...@@ -172,6 +172,8 @@ public class ServiceHGZL001 extends ServiceBase { ...@@ -172,6 +172,8 @@ public class ServiceHGZL001 extends ServiceBase {
dbZl010.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode()); dbZl010.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGZL001.DELETE, dbZl010); DaoUtils.update(HGZL001.DELETE, dbZl010);
} }
// 更新收货单状态
HGCGTools.HgCg003.deleteChecks(fZl001s);
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fZl001s.size() + "]条数据删除成功!"); inInfo.setMsg("操作成功!本次对[" + fZl001s.size() + "]条数据删除成功!");
...@@ -238,11 +240,13 @@ public class ServiceHGZL001 extends ServiceBase { ...@@ -238,11 +240,13 @@ public class ServiceHGZL001 extends ServiceBase {
dbZl001.setUnqualifyQty(fZl001.getUnqualifyQty()); dbZl001.setUnqualifyQty(fZl001.getUnqualifyQty());
dbZl001.setStatus(CommonConstant.YesNo.YES_1); dbZl001.setStatus(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSqlConstant.HgZl001.PROCESS, dbZl001); DaoUtils.update(HGSqlConstant.HgZl001.PROCESS, dbZl001);
// 更新收货单状态 // // 更新收货单状态
HGCGTools.HgCg003.updateCheck(dbZl001); // HGCGTools.HgCg003.updateCheck(dbZl001);
//生成采购入库单 //生成采购入库单
HGKCTools.HgKc001.putInStorageData(dbZl001.getReceiveDetailId()); HGKCTools.HgKc001.putInStorageData(dbZl001.getReceiveDetailId());
} }
// 更新收货单状态
HGCGTools.HgCg003.updateChecks(fZl001s);
} }
} }
...@@ -5,6 +5,7 @@ import com.baosight.hggp.common.DdynamicEnum; ...@@ -5,6 +5,7 @@ import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.cg.domain.HGCG003; import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cg.domain.HGCG003B;
import com.baosight.hggp.hg.cg.tools.HGCGTools; import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HGCGUtils; import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
...@@ -22,6 +23,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceEPBase; ...@@ -22,6 +23,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.Arrays; import java.util.Arrays;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -40,7 +42,7 @@ public class ServiceHGZL001B extends ServiceEPBase { ...@@ -40,7 +42,7 @@ public class ServiceHGZL001B extends ServiceEPBase {
* @return * @return
*/ */
@Override @Override
@OperationLogAnnotation(operModul = "生产任务查询", operType = "查询", operDesc = "质量巡检单-生产任务查询-初始化") @OperationLogAnnotation(operModul = "采购收货单查询", operType = "查询", operDesc = "质量巡检单-采购收货单查询-初始化")
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
try { try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
...@@ -61,12 +63,12 @@ public class ServiceHGZL001B extends ServiceEPBase { ...@@ -61,12 +63,12 @@ public class ServiceHGZL001B extends ServiceEPBase {
* @return * @return
*/ */
@Override @Override
@OperationLogAnnotation(operModul = "生产任务查询", operType = "查询", operDesc = "质量巡检单-生产任务查询-查询") @OperationLogAnnotation(operModul = "采购收货单查询", operType = "查询", operDesc = "质量巡检单-采购收货单查询-查询")
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HGCG003.FIELD_STATUS, HGConstant.CgReceiveStatus.S_0); queryMap.put(HGCG003B.FIELD_STATUS, HGConstant.CgReceiveStatus.S_0);
inInfo = super.query(inInfo, HGCG003.QUERY, new HGCG003()); inInfo = super.query(inInfo, HGCG003B.QUERY_BY_QUALITY_TESTING, new HGCG003B());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
...@@ -79,15 +81,18 @@ public class ServiceHGZL001B extends ServiceEPBase { ...@@ -79,15 +81,18 @@ public class ServiceHGZL001B extends ServiceEPBase {
* @param inInfo * @param inInfo
* @return * @return
*/ */
@OperationLogAnnotation(operModul = "生产任务查询", operType = "新增", operDesc = "质量巡检单-生产任务查询-生成巡检单") @OperationLogAnnotation(operModul = "采购收货单查询", operType = "新增", operDesc = "质量巡检单-采购收货单查询-生成巡检单")
public EiInfo confirm(EiInfo inInfo) { public EiInfo confirm(EiInfo inInfo) {
try { try {
List<HGCG003> fCg003s = MapUtils.toDaoEPBase(inInfo, HGCG003.class); List<HGCG003B> fCg003Bs = MapUtils.toDaoEPBase(inInfo, HGCG003B.class);
Map<String, HGCG003> dbCg003Map = HGCGUtils.HgCg003.lockGetDataEp(fCg003s); Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetDataEp(fCg003Bs);
// Map<Long, HGCG003> dbCg003Map = HGCGUtils.HgCg003.lockGetDataEp(fCg003Bs);
HGCG003 cg003 = HGCGTools.HgCg003.get(fCg003Bs.get(0).getPrimaryId());
// 数据校验 // 数据校验
this.checkConfirmData(fCg003s, dbCg003Map); this.checkConfirmData(fCg003Bs, dbCg003BMap,cg003);
// 生成巡检单 // 生成巡检单
this.saveConfirmData(fCg003s, dbCg003Map); this.saveConfirmData(fCg003Bs, dbCg003BMap);
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "生成质检单失败"); LogUtils.setDetailMsg(inInfo, e, "生成质检单失败");
} }
...@@ -97,37 +102,39 @@ public class ServiceHGZL001B extends ServiceEPBase { ...@@ -97,37 +102,39 @@ public class ServiceHGZL001B extends ServiceEPBase {
/** /**
* 校验数据 * 校验数据
* *
* @param fCg003s * @param fCg003Bs
* @param dbCg003Map * @param dbCg003BMap
*/ */
private void checkConfirmData(List<HGCG003> fCg003s, Map<String, HGCG003> dbCg003Map) { private void checkConfirmData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003BMap,HGCG003 cg003) {
for (HGCG003 fCg003 : fCg003s) { AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_0, cg003.getStatus(),
String receiveNo = fCg003.getReceiveNo(); String.format("采购收货单[%s]状态不是\"待确认\",不允许操作", cg003.getReceiveNo()));
HGCG003 dbSc003 = dbCg003Map.get(fCg003.getReceiveNo()); // for (HGCG003B fCg003B : fCg003Bs) {
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_0, dbSc003.getStatus(), // HGCG003B dbSc003B = dbCg003BMap.get(fCg003B.getId());
String.format("采购收货单[%s]状态不是\"待确认\",不允许操作", receiveNo)); //
} // }
} }
/** /**
* 保存数据 * 保存数据
* * @param fCg003Bs
* @param fCg003s * @param dbCg003BMap
* @param dbCg003Map
*/ */
private void saveConfirmData(List<HGCG003> fCg003s, Map<String, HGCG003> dbCg003Map) { private void saveConfirmData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003BMap) {
for (HGCG003 fCg003 : fCg003s) { List<HGZL001> hgzl001s = new LinkedList<>();
String receiveNo = fCg003.getReceiveNo(); for (HGCG003B fCg003B : fCg003Bs) {
// 生成新数据 // 生成新数据
HGCG003 dbSc003b = dbCg003Map.get(receiveNo); HGCG003B dbCg003B = dbCg003BMap.get(fCg003B.getId());
HGZL001 newZl001 = BeanUtils.copy(dbSc003b, HGZL001.class); HGZL001 newZl001 = BeanUtils.copy(dbCg003B, HGZL001.class);
newZl001.setCheckNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HPZL001_NUMBER)); newZl001.setCheckNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HPZL001_NUMBER));
newZl001.setReceiptDate(DateUtils.shortDate()); newZl001.setReceiptDate(DateUtils.shortDate());
newZl001.setStatus(CommonConstant.YesNo.NO_0); newZl001.setStatus(CommonConstant.YesNo.NO_0);
newZl001.setDeleteFlag(CommonConstant.YesNo.NO_0); newZl001.setDeleteFlag(CommonConstant.YesNo.NO_0);
newZl001.setReceiveDetailId(fCg003B.getId());
DaoUtils.insert(HGZL001.INSERT, newZl001); DaoUtils.insert(HGZL001.INSERT, newZl001);
hgzl001s.add(newZl001);
// 更新收货单状态 // 更新收货单状态
HGCGTools.HgCg003.updateStatus(receiveNo, HGConstant.CgReceiveStatus.S_3); HGCGTools.HgCg003.updateStatus(fCg003B.getReceiveNo(), HGConstant.CgReceiveStatus.S_3);
HGCGTools.HgCg003B.updateStatus(newZl001.getReceiveDetailId(), HGConstant.CgReceiveStatus.S_3);
} }
} }
......
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
RECEIVE_UNIT_WEIGHT as "receiveUnitWeight", <!-- 收货单重 --> RECEIVE_UNIT_WEIGHT as "receiveUnitWeight", <!-- 收货单重 -->
RECEIVE_WEIGHT as "receiveWeight", <!-- 收货重量 --> RECEIVE_WEIGHT as "receiveWeight", <!-- 收货重量 -->
STATUS as "status", <!-- 状态:0-质检中,1-质检完成 --> STATUS as "status", <!-- 状态:0-质检中,1-质检完成 -->
INVENT_TYPE_DETAIL as "inventTypeDetail" <!-- 存货类型明细 --> INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型明细 -->
RECEIVE_DETAIL_ID as "receiveDetailId" <!-- 采购收货明细id -->
</sql> </sql>
<sql id="condition"> <sql id="condition">
...@@ -93,6 +94,12 @@ ...@@ -93,6 +94,12 @@
<isNotEmpty prepend=" AND " property="inventTypeDetails"> <isNotEmpty prepend=" AND " property="inventTypeDetails">
INVENT_TYPE_DETAIL IN <iterate close=")" open="(" conjunction="," property="inventTypeDetails">#inventTypeDetails[]#</iterate> INVENT_TYPE_DETAIL IN <iterate close=")" open="(" conjunction="," property="inventTypeDetails">#inventTypeDetails[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveDetailId">
RECEIVE_DETAIL_ID = #receiveDetailId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveDetailIds">
RECEIVE_DETAIL_ID IN <iterate close=")" open="(" conjunction="," property="receiveDetailIds">#receiveDetailIds[]#</iterate>
</isNotEmpty>
</sql> </sql>
...@@ -171,15 +178,15 @@ ...@@ -171,15 +178,15 @@
RECEIVE_UNIT_WEIGHT, <!-- 收货单重 --> RECEIVE_UNIT_WEIGHT, <!-- 收货单重 -->
RECEIVE_WEIGHT, <!-- 收货重量 --> RECEIVE_WEIGHT, <!-- 收货重量 -->
STATUS, <!-- 状态:0-质检中,1-质检完成 --> STATUS, <!-- 状态:0-质检中,1-质检完成 -->
INVENT_TYPE_DETAIL INVENT_TYPE_DETAIL,
RECEIVE_DETAIL_ID
) VALUES ( ) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #companyCode#, #companyName#, #receiptDate#, #checkNo#, #receiveNo#, #inventType#, #deleteFlag#, #companyCode#, #companyName#, #receiptDate#, #checkNo#, #receiveNo#, #inventType#,
#inventCode#, #inventName#, #specId#, #spec#, #material#, #unit#, #length#, #width#, #thick#, #receiveQty#, #inventCode#, #inventName#, #specId#, #spec#, #material#, #unit#, #length#, #width#, #thick#, #receiveQty#,
#receiveUnitWeight#, #receiveWeight#, #status#, #inventTypeDetail# #receiveUnitWeight#, #receiveWeight#, #status#, #inventTypeDetail#, #receiveDetailId#
) )
</insert> </insert>
<delete id="delete"> <delete id="delete">
UPDATE ${hggpSchema}.HGZL001 UPDATE ${hggpSchema}.HGZL001
SET SET
......
...@@ -7,12 +7,20 @@ $(function () { ...@@ -7,12 +7,20 @@ $(function () {
pageSize: 20, pageSize: 20,
pageSizes: [20, 50, 70, 100], pageSizes: [20, 50, 70, 100],
}, },
columns: [{ columns: [
field: "length", {
template: function (options) { field: "operator",
return options.length == 0 ? "-" : options.length; title: "操作",
template: function (item) {
let template = '';
if (!isBlank(item.id)){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ', ' + item.status + ')" >详情</a>';
}
return template;
}
} }
}], ],
beforeEdit: function (e) { beforeEdit: function (e) {
let item = e.model; let item = e.model;
if(item.status != '0'){ if(item.status != '0'){
...@@ -48,8 +56,6 @@ $(function () { ...@@ -48,8 +56,6 @@ $(function () {
$(window).load(function () { $(window).load(function () {
// 查询 // 查询
query(); query();
//存货编号查询条件
initInventCode();
}); });
/** /**
...@@ -59,30 +65,6 @@ let query = function () { ...@@ -59,30 +65,6 @@ let query = function () {
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
} }
/**
* 存货编号
*/
let initInventCode = function () {
//物料信息下拉
var inInfo=new EiInfo();
EiCommunicator.send("HGPZ005", "queryComboBox", inInfo, {
onSuccess: function (ei) {
let dataSource;
var input=$("#inqu_status-0-inventCode");
dataSource=ei.getBlock("invent_record_block_id").getMappedRows();
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "valueField",
dataValueField: "valueField",
optionLabel:"请选择",
dataSource: dataSource,
template: "[#:valueField#]#:textField#|#:param2Field#",
filter: "contains"
});
}, onFail: function (ei) {
}
}, {async: false});
}
/** /**
* 保存 * 保存
...@@ -166,3 +148,17 @@ let submit = function () { ...@@ -166,3 +148,17 @@ let submit = function () {
}); });
} }
/**
* 显示详情
*/
function showDetail(id,status) {
JSColorbox.open({
href: "HGCG001A?methodName=initLoad&inqu_status-0-primaryId=" + id+"&inqu_status-0-status="+status,
title: "<div style='text-align: center;'>详情</div>",
width: "80%",
height: "80%",
});
}
...@@ -21,10 +21,6 @@ ...@@ -21,10 +21,6 @@
</EF:EFSelect> </EF:EFSelect>
</div> </div>
<div class="row"> <div class="row">
<EF:EFSelect cname="存货编号" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="" template="[#=valueField#]#=textField#">
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status" <EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status"
startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime" startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime"
format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true"> format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
...@@ -35,6 +31,7 @@ ...@@ -35,6 +31,7 @@
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/> <EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/> <EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/>
<EF:EFColumn ename="planDate" cname="计划日期" enable="false" width="100" align="center" editType="date" <EF:EFColumn ename="planDate" cname="计划日期" enable="false" width="100" align="center" editType="date"
...@@ -43,18 +40,9 @@ ...@@ -43,18 +40,9 @@
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center"> <EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.planStatus"/> <EF:EFCodeOption codeName="hggp.hgcg.planStatus"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/> <EF:EFColumn ename="purQty" cname="采购数量" enable="false" width="120" align="right" format="{0:N0}" />
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/> <EF:EFColumn ename="purWeight" cname="采购重量" enable="false" width="120" align="right" format="{0:N3}" />
<EF:EFColumn ename="specId" cname="规格ID" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N0}" required="true"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="planWeight" cname="计划重量" enable="false" width="120" align="right" format="{0:N3}"/> <EF:EFColumn ename="planWeight" cname="计划重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/> <EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center" <EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/> editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<EF:EFColumn ename="planDate" cname="计划日期" enable="false" width="100" align="center" editType="date" <EF:EFColumn ename="planDate" cname="计划日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" hidden="true"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" hidden="true"/>
<EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center" hidden="true"/> <EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/> <EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<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="spec" cname="规格" enable="false" width="120" align="center"/> <EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
......
...@@ -10,6 +10,18 @@ $(function () { ...@@ -10,6 +10,18 @@ $(function () {
}, },
columns: [ columns: [
{ {
field: "operator",
title: "操作",
template: function (item) {
let template = '';
if (!isBlank(item.id)){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ', ' + item.status + ')" >详情</a>';
}
return template;
}
},
{
field: "purUserName", field: "purUserName",
template: function (dataItem) { template: function (dataItem) {
for (let i = 0; i < userByCompany.length; i++) { for (let i = 0; i < userByCompany.length; i++) {
...@@ -214,14 +226,6 @@ let save = function () { ...@@ -214,14 +226,6 @@ let save = function () {
message("勾选的第" + (i + 1) + "行采购员不能为空"); message("勾选的第" + (i + 1) + "行采购员不能为空");
return; return;
} }
if(!isBlank(rows[i]['price']) && !isNumber(rows[i]['price'])){
message("勾选的第" + (i + 1) + "行单价不能小于0");
return;
}
if(!isBlank(rows[i]['taxRate']) && !isNumber(rows[i]['taxRate'])){
message("勾选的第" + (i + 1) + "行税率不能为空");
return;
}
} }
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () { ok: function () {
...@@ -284,3 +288,15 @@ let selectPlanCallback = function () { ...@@ -284,3 +288,15 @@ let selectPlanCallback = function () {
// 关闭弹窗 // 关闭弹窗
JSColorbox.close(); JSColorbox.close();
} }
/**
* 显示详情
*/
function showDetail(id,status) {
JSColorbox.open({
href: "HGCG002B?methodName=initLoad&inqu_status-0-primaryId=" + id+"&inqu_status-0-status="+status,
title: "<div style='text-align: center;'>详情</div>",
width: "80%",
height: "80%",
});
}
...@@ -26,19 +26,9 @@ ...@@ -26,19 +26,9 @@
filter="contains" optionLabel="全部" defultValue=""> filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect cname="存货编号" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="" template="[#=valueField#]#=textField#">
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<%-- <EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" optionLabel="全部"--%>
<%-- defultValue="">--%>
<%-- <EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>--%>
<%-- </EF:EFSelect>--%>
</div>
<div class="row">
<EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status" <EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status"
startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime" startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime"
format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true"> format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan> </EF:EFDateSpan>
</div> </div>
</EF:EFRegion> </EF:EFRegion>
...@@ -46,6 +36,7 @@ ...@@ -46,6 +36,7 @@
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/> <EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/> <EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/>
<EF:EFColumn ename="contractDate" cname="合同日期" enable="false" width="100" align="center" editType="date" <EF:EFColumn ename="contractDate" cname="合同日期" enable="false" width="100" align="center" editType="date"
...@@ -61,30 +52,15 @@ ...@@ -61,30 +52,15 @@
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="purUserName" cname="采购员" width="100" align="center" required="true"/> <EF:EFColumn ename="purUserName" cname="采购员" width="100" align="center" required="true"/>
<EF:EFColumn ename="inventCode" 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="120" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N0}" enable="false"/> <EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N0}" enable="false"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" enable="false"/> <EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" enable="false"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="120" align="right" format="{0:N0}"/> <EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFComboColumn ename="taxRate" cname="税率(%)" enable="true" width="80" align="center" required="true">
<EF:EFCodeOption codeName="hggp.cw.taxPoints" />
</EF:EFComboColumn>
<EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="taxAmount" cname="税额" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="taxAmount" cname="税额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="taxIncludeAmount" cname="含税金额" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="taxIncludeAmount" cname="含税金额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/> <EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center" <EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/> editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
<EF:EFColumn ename="inventTypeDetail" cname="存货类型明细" enable="false" width="100" align="center" hidden="true"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
......
...@@ -15,19 +15,9 @@ ...@@ -15,19 +15,9 @@
filter="contains" optionLabel="全部" defultValue=""> filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="roleCompany" valueField="companyCode" textField="companyName"/> <EF:EFOptions blockId="roleCompany" valueField="companyCode" textField="companyName"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" optionLabel="全部"
defultValue="">
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status" <EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status"
startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime" startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime"
format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true"> format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan> </EF:EFDateSpan>
</div> </div>
</EF:EFRegion> </EF:EFRegion>
...@@ -46,17 +36,8 @@ ...@@ -46,17 +36,8 @@
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="purUserName" cname="采购员" width="120" align="center" maxLength="100" required="true"/> <EF:EFColumn ename="purUserName" cname="采购员" width="120" align="center" maxLength="100" required="true"/>
<EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="sepcId" cname="规格ID" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="purQty" cname="采购数量" enable="false" width="120" align="right" format="{0:N0}"/> <EF:EFColumn ename="purQty" cname="采购数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="purWeight" cname="采购重量" enable="false" width="120" align="right" format="{0:N3}"/> <EF:EFColumn ename="purWeight" cname="采购重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/> <EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center" <EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/> editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
......
$(function () {
var userByCompany = __eiInfo.getBlock("userByCompany").getMappedRows();
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
columns: [
{
field: "purUserName",
template: function (dataItem) {
for (let i = 0; i < userByCompany.length; i++) {
let purUserName = dataItem['purUserName'];
if(purUserName){
if (userByCompany[i]['userName'] === purUserName.userName) {
return userByCompany[i]['userName'];
}
}
}
return dataItem["purUserName"];
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-companyCode", options.model["companyCode"]);
inInfo.set("field", options.field);
EiCommunicator.send("HGSC001", "userByCompanyComboBox", inInfo, {
onSuccess: function (ei) {
userByCompany = ei.getBlock("userByCompany").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoDropDownList({
dataSource: userByCompany,
minLength: 0,
dataTextField: "userName",
dataValueField: "userName",
optionLabelTemplate: "[#:loginName#]#:userName#-#:depName#",
valueTemplate: "[#:loginName#]#:userName#-#:depName#",
template: "[#:loginName#]#:userName#-#:depName#",
filter: "contains"
});
}
}
],
beforeEdit: function (e) {
var status = $("#inqu_status-0-status").val();
if(status != '0'){
e.preventDefault();
}
},
loadComplete: function (grid) {
// change事件
grid.dataSource.bind("change", function (e) {
var item = e.items[0];
if (e.field == "price") {
calAmount(item);
}
if (e.field == "taxRate") {
calAmount(item);
}
});
},
onSave: function (e) {
// 阻止后台请求,使用自定义
e.preventDefault();
save();
},
onDelete: function (e) {
// 阻止后台请求,使用自定义
e.preventDefault();
remove();
}
}
}
// 查询
$("#QUERY").on("click", query);
downKeyUp();
});
/**
* 计算金额
* @param item
* @param length
* @param width
* @param thick
* @param coefficient
*/
let calAmount = function (item) {
//原材料
if(item.inventTypeDetail === '3'){
if(item.purWeight && item.price && item.taxRate){
// 重量*单价金额
let totalAmount = item.purWeight * item.price;
//不含税金额
let amount = totalAmount / (1 + item.taxRate / 100);
//税额
let taxAmount = totalAmount - amount;
//含税金额
let taxIncludeAmount = totalAmount;
resultGrid.setCellValue(item, 'taxAmount', taxAmount)
resultGrid.setCellValue(item, 'amount', amount)
resultGrid.setCellValue(item, 'taxIncludeAmount', taxIncludeAmount)
}
}else{
if(item.purQty && item.price && item.taxRate){
// 数量*单价金额
let totalAmount = item.purQty * item.price;
//不含税金额
let amount = totalAmount / (1 + item.taxRate / 100);
//税额
let taxAmount = totalAmount - amount;
//含税金额
let taxIncludeAmount = totalAmount;
resultGrid.setCellValue(item, 'taxAmount', taxAmount)
resultGrid.setCellValue(item, 'amount', amount)
resultGrid.setCellValue(item, 'taxIncludeAmount', taxIncludeAmount)
}
}
}
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
initInventCode();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 存货编号
*/
let initInventCode = function () {
//物料信息下拉
var inInfo=new EiInfo();
EiCommunicator.send("HGPZ005", "queryComboBox", inInfo, {
onSuccess: function (ei) {
let dataSource;
var input=$("#inqu_status-0-inventCode");
dataSource=ei.getBlock("invent_record_block_id").getMappedRows();
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "valueField",
dataValueField: "valueField",
optionLabel:"请选择",
dataSource: dataSource,
template: "[#:valueField#]#:textField#|#:param2Field#",
filter: "contains"
});
}, onFail: function (ei) {
}
}, {async: false});
}
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
for (let i = 0; i < rows.length; i++) {
if(!isBlank(rows[i]['price']) && !isNumber(rows[i]['price'])){
message("勾选的第" + (i + 1) + "行单价不能小于0");
return;
}
if(!isBlank(rows[i]['taxRate']) && !isNumber(rows[i]['taxRate'])){
message("勾选的第" + (i + 1) + "行税率不能为空");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG002B", "save", true);
}
});
}
/**
* 删除
*/
let remove = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG002B", "remove", true);
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="采购合同">
<EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput ename="inqu_status-0-primaryId" cname="主表id" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-status" cname="状态" colWidth="3" type="hidden"/>
<div class="row">
<EF:EFSelect cname="存货编号" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="" template="[#=valueField#]#=textField#">
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N0}" enable="false"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" enable="false"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFComboColumn ename="taxRate" cname="税率(%)" enable="true" width="80" align="center" required="true">
<EF:EFCodeOption codeName="hggp.cw.taxPoints" />
</EF:EFComboColumn>
<EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="taxAmount" cname="税额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="taxIncludeAmount" cname="含税金额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
<%-- 隐藏字段--%>
<EF:EFColumn ename="inventTypeDetail" cname="存货类型明细" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center" hidden="true"/>
<EF:EFColumn ename="contractDate" cname="合同日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" hidden="true"/>
<EF:EFColumn ename="contractNo" cname="合同号" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="supCode" cname="供应商编号" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="purUserName" cname="采购员" width="100" align="center" required="true" hidden="true"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
...@@ -8,6 +8,18 @@ $(function () { ...@@ -8,6 +8,18 @@ $(function () {
pageSizes: [20, 50, 70, 100], pageSizes: [20, 50, 70, 100],
}, },
columns: [ columns: [
{
field: "operator",
title: "操作",
template: function (item) {
let template = '';
if (!isBlank(item.id)){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ', ' + item.status + ')" >详情</a>';
}
return template;
}
}
], ],
beforeEdit: function (e) { beforeEdit: function (e) {
let item = e.model; let item = e.model;
...@@ -159,3 +171,17 @@ let selectContractCallback = function () { ...@@ -159,3 +171,17 @@ let selectContractCallback = function () {
// 关闭弹窗 // 关闭弹窗
JSColorbox.close(); JSColorbox.close();
} }
/**
* 显示详情
*/
function showDetail(id,status) {
JSColorbox.open({
href: "HGCG003B?methodName=initLoad&inqu_status-0-primaryId=" + id+"&status="+status,
title: "<div style='text-align: center;'>详情</div>",
width: "80%",
height: "80%",
});
}
...@@ -26,19 +26,9 @@ ...@@ -26,19 +26,9 @@
filter="contains" optionLabel="全部" defultValue=""> filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect cname="存货编号" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<%-- <EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" optionLabel="全部"--%>
<%-- defultValue="">--%>
<%-- <EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>--%>
<%-- </EF:EFSelect>--%>
</div>
<div class="row">
<EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status" <EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status"
startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime" startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime"
format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true"> format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan> </EF:EFDateSpan>
</div> </div>
</EF:EFRegion> </EF:EFRegion>
...@@ -46,6 +36,7 @@ ...@@ -46,6 +36,7 @@
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/> <EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/> <EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/>
<EF:EFColumn ename="receiveDate" cname="收货日期" enable="false" width="100" align="center" editType="date" <EF:EFColumn ename="receiveDate" cname="收货日期" enable="false" width="100" align="center" editType="date"
...@@ -57,23 +48,11 @@ ...@@ -57,23 +48,11 @@
<EF:EFColumn ename="supCode" cname="供应商编码" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="supCode" cname="供应商编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center"/> <EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center"/> <EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/> <EF:EFColumn ename="receiveQty" cname="收货数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="inventCode" 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="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="receiveQty" cname="收货数量" width="120" align="right" format="{0:N0}" required="true"/>
<EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N0}"/> <EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="depositQty" cname="入库数量" enable="false" width="120" align="right" format="{0:N0}"/> <EF:EFColumn ename="depositQty" cname="入库数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="receiveWeight" cname="收货重量" enable="false" width="120" align="right" format="{0:N3}"/> <EF:EFColumn ename="receiveWeight" cname="收货重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" enable="false"/>
<EF:EFColumn ename="amount" cname="金额" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="amount" cname="金额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="contractNo" cname="合同号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/> <EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center" <EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/> editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
......
...@@ -29,9 +29,36 @@ $(window).load(function () { ...@@ -29,9 +29,36 @@ $(window).load(function () {
resultCheckClick(); resultCheckClick();
// 初始化查询 // 初始化查询
query(); query();
initInventCode();
}); });
/** /**
* 存货编号
*/
let initInventCode = function () {
//物料信息下拉
var inInfo=new EiInfo();
EiCommunicator.send("HGPZ005", "queryComboBox", inInfo, {
onSuccess: function (ei) {
let dataSource;
var input=$("#inqu_status-0-inventCode");
dataSource=ei.getBlock("invent_record_block_id").getMappedRows();
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "valueField",
dataValueField: "valueField",
optionLabel:"请选择",
dataSource: dataSource,
template: "[#:valueField#]#:textField#|#:param2Field#",
filter: "contains"
});
}, onFail: function (ei) {
}
}, {async: false});
}
/**
* 勾选事件 * 勾选事件
*/ */
let resultCheckClick = function (){ let resultCheckClick = function (){
......
...@@ -26,13 +26,9 @@ ...@@ -26,13 +26,9 @@
filter="contains" optionLabel="全部" defultValue=""> filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3" <EF:EFSelect cname="存货编号" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue=""> filter="contains" optionLabel="全部" defultValue="" template="[#=valueField#]#=textField#">
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" optionLabel="全部"
defultValue="">
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect> </EF:EFSelect>
</div> </div>
<div class="row"> <div class="row">
...@@ -55,7 +51,7 @@ ...@@ -55,7 +51,7 @@
<EF:EFCodeOption codeName="hggp.hgcg.contractStatus"/> <EF:EFCodeOption codeName="hggp.hgcg.contractStatus"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="inventType" cname="存货类型大类" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="inventType" cname="存货类型大类" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<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="inventRecordId" cname="规格ID" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="inventRecordId" 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"/>
......
$(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
columns: [
],
beforeEdit: function (e) {
var status = $("#status").val();
if(status != '0'){
e.preventDefault();
}
},
loadComplete: function (grid) {
},
onSave: function (e) {
// 阻止后台请求,使用自定义
e.preventDefault();
save();
},
onDelete: function (e) {
// 阻止后台请求,使用自定义
e.preventDefault();
remove();
}
}
}
// 查询
$("#QUERY").on("click", query);
downKeyUp();
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
initInventCode();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 存货编号
*/
let initInventCode = function () {
//物料信息下拉
var inInfo=new EiInfo();
EiCommunicator.send("HGPZ005", "queryComboBox", inInfo, {
onSuccess: function (ei) {
let dataSource;
var input=$("#inqu_status-0-inventCode");
dataSource=ei.getBlock("invent_record_block_id").getMappedRows();
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "valueField",
dataValueField: "valueField",
optionLabel:"请选择",
dataSource: dataSource,
template: "[#:valueField#]#:textField#|#:param2Field#",
filter: "contains"
});
}, onFail: function (ei) {
}
}, {async: false});
}
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
for (let i = 0; i < rows.length; i++) {
if (!isPositiveNumber(rows[i]['receiveQty'])) {
message("勾选的第" + (i + 1) + "行收货数量必须大于0");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG003B", "save", true);
}
});
}
/**
* 删除
*/
let remove = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG003B", "remove", true);
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="采购收货">
<EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput ename="inqu_status-0-primaryId" cname="主表id" colWidth="3" type="hidden"/>
<EF:EFInput ename="status" cname="状态" colWidth="3" type="hidden"/>
<div class="row">
<EF:EFSelect cname="存货编号" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="" template="[#=valueField#]#=textField#">
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="primaryId" cname="主表id" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/>
<EF:EFColumn ename="receiveDate" cname="收货日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="receiveNo" cname="收货单号" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.receiveStatus"/>
</EF:EFComboColumn>
<EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/>
<EF:EFColumn ename="inventCode" 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="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="receiveQty" cname="收货数量" width="120" align="right" format="{0:N0}" required="true"/>
<EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="depositQty" cname="入库数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="receiveWeight" cname="收货重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" enable="false"/>
<EF:EFColumn ename="amount" cname="金额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
...@@ -215,7 +215,8 @@ function updateStatus(id,status) { ...@@ -215,7 +215,8 @@ function updateStatus(id,status) {
function INSERTCG() { function INSERTCG() {
let inEiInfo = new EiInfo(); let inEiInfo = new EiInfo();
//重置全局变量 //重置全局变量
ids = []; let planMaterialCodes = [];
let ids = [];
let rows = resultGrid.getCheckedRows() let rows = resultGrid.getCheckedRows()
if (rows.length < 1) { if (rows.length < 1) {
message("请至少选择一条需要分派的数据"); message("请至少选择一条需要分派的数据");
...@@ -228,10 +229,12 @@ function INSERTCG() { ...@@ -228,10 +229,12 @@ function INSERTCG() {
flag = false; flag = false;
return false; return false;
} }
ids.push(item.planMaterialCode) planMaterialCodes.push(item.planMaterialCode)
ids.push(item.id)
}); });
if(flag) { if(flag) {
inEiInfo.set("planMaterialCodes",ids.join(',')); inEiInfo.set("planMaterialCodes",planMaterialCodes.join(','));
inEiInfo.set("ids",ids.join(','));
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"生成采购计划\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"生成采购计划\"操作? ", {
ok: function () { ok: function () {
EiCommunicator.send('HGSC009A', 'insertcg', inEiInfo, { EiCommunicator.send('HGSC009A', 'insertcg', inEiInfo, {
...@@ -254,7 +257,7 @@ function INSERTCG() { ...@@ -254,7 +257,7 @@ function INSERTCG() {
} }
}); });
} }
inEiInfo.set("planMaterialCodes", ids.join(',')); inEiInfo.set("planMaterialCodes", planMaterialCodes.join(','));
} }
......
...@@ -24,9 +24,36 @@ $(function () { ...@@ -24,9 +24,36 @@ $(function () {
$(window).load(function () { $(window).load(function () {
// 初始化查询 // 初始化查询
query(); query();
initInventCode();
}); });
/** /**
* 存货编号
*/
let initInventCode = function () {
//物料信息下拉
var inInfo=new EiInfo();
EiCommunicator.send("HGPZ005", "queryComboBox", inInfo, {
onSuccess: function (ei) {
let dataSource;
var input=$("#inqu_status-0-inventCode");
dataSource=ei.getBlock("invent_record_block_id").getMappedRows();
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "valueField",
dataValueField: "valueField",
optionLabel:"请选择",
dataSource: dataSource,
template: "[#:valueField#]#:textField#|#:param2Field#",
filter: "contains"
});
}, onFail: function (ei) {
}
}, {async: false});
}
/**
* 查询 * 查询
*/ */
var query = function (e) { var query = function (e) {
......
...@@ -21,13 +21,9 @@ ...@@ -21,13 +21,9 @@
</EF:EFSelect> </EF:EFSelect>
</div> </div>
<div class="row"> <div class="row">
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3" <EF:EFSelect cname="存货编号" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue=""> filter="contains" optionLabel="全部" defultValue="" template="[#=valueField#]#=textField#">
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" optionLabel="全部"
defultValue="">
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status" <EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status"
startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime" startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime"
...@@ -51,9 +47,8 @@ ...@@ -51,9 +47,8 @@
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center"/> <EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center"/> <EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/> <EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<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="spec" cname="规格" enable="false" width="120" align="center"/> <EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<%-- <EF:EFComboColumn ename="poorType" cname="不良品类" width="100" align="center" required="true">--%> <%-- <EF:EFComboColumn ename="poorType" cname="不良品类" width="100" align="center" required="true">--%>
<%-- <EF:EFCodeOption codeName="hggp.hgzl.poorType"/>--%> <%-- <EF:EFCodeOption codeName="hggp.hgzl.poorType"/>--%>
......
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