Commit c7854021 by 宋祥

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	src/main/java/com/baosight/hggp/hg/cg/service/ServiceHGCG001.java
#	src/main/java/com/baosight/hggp/hg/cg/service/ServiceHGCG002.java
#	src/main/java/com/baosight/hggp/hg/cg/service/ServiceHGCG002B.java
parents f2176c5c 564d3b17
...@@ -6,28 +6,30 @@ import com.baosight.hggp.core.dao.DaoUtils; ...@@ -6,28 +6,30 @@ 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.HGCG001;
import com.baosight.hggp.hg.cg.domain.HGCG001A;
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;
import com.baosight.hggp.hg.constant.HGSqlConstant; import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sb.tools.HGSBTools;
import com.baosight.hggp.hg.sc.domain.HGSC009;
import com.baosight.hggp.hg.sc.domain.HGSC009A;
import com.baosight.hggp.hg.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.*;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
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.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 org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.Arrays; import java.util.*;
import java.util.List; import java.util.stream.Collectors;
import java.util.Map;
/** /**
* @author:songx * @author:songx
...@@ -52,6 +54,11 @@ public class ServiceHGCG001 extends ServiceBase { ...@@ -52,6 +54,11 @@ public class ServiceHGCG001 extends ServiceBase {
CommonMethod.objConvertComboBox(resultList,inInfo,DdynamicEnum.SPEC_NAME_BLOCK_ID.getBlockId(),HGCG001.FIELD_SPEC,HGCG001.FIELD_SPEC); CommonMethod.objConvertComboBox(resultList,inInfo,DdynamicEnum.SPEC_NAME_BLOCK_ID.getBlockId(),HGCG001.FIELD_SPEC,HGCG001.FIELD_SPEC);
CommonMethod.distinctTextField(inInfo,DdynamicEnum.SPEC_NAME_BLOCK_ID.getBlockId()); CommonMethod.distinctTextField(inInfo,DdynamicEnum.SPEC_NAME_BLOCK_ID.getBlockId());
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class); EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
Map qarma = new HashMap();
Map userCompany = HGSBTools.getUserCompany();
qarma.put(HGSC009.FIELD_COMPANY_CODE,userCompany.get(HGSC009.FIELD_COMPANY_CODE));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BY_ROLE_BLOCK_ID),qarma);
qarma.clear();
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG001().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG001().eiMetadata);
} catch (Exception e) { } catch (Exception e) {
...@@ -88,13 +95,19 @@ public class ServiceHGCG001 extends ServiceBase { ...@@ -88,13 +95,19 @@ public class ServiceHGCG001 extends ServiceBase {
@OperationLogAnnotation(operModul = "采购计划", operType = "修改", operDesc = "保存") @OperationLogAnnotation(operModul = "采购计划", operType = "修改", operDesc = "保存")
public EiInfo save(EiInfo inInfo) { public EiInfo save(EiInfo inInfo) {
try { try {
List<HGCG001> fCg001s = MapUtils.toDaoEPBases(inInfo, HGCG001.class); List<HGCG001> fCg001s = MapUtils.toDaoEPBase(inInfo, HGCG001.class);
// db数据
Map<String, HGCG001> dbCg001Map = this.lockGetData(fCg001s);
// 数据校验 // 数据校验
this.checkSaveData(fCg001s, dbCg001Map); this.checkSaveData(fCg001s);
// 保存数据 // 写入数据
this.saveData(fCg001s); for (int i = 0; i < fCg001s.size(); i++) {
HGCG001 hgcg001 = fCg001s.get(i);
if (hgcg001.getId() == null || hgcg001.getId() == 0) {
// 修改数据
this.saveData(hgcg001);
} else {
DaoUtils.update(HGCG001.UPDATE, hgcg001);
}
}
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg001s.size() + "]条数据保存成功!"); inInfo.setMsg("操作成功!本次对[" + fCg001s.size() + "]条数据保存成功!");
...@@ -108,30 +121,30 @@ public class ServiceHGCG001 extends ServiceBase { ...@@ -108,30 +121,30 @@ public class ServiceHGCG001 extends ServiceBase {
* 数据校验 * 数据校验
* *
* @param fCg001s * @param fCg001s
* @param dbCg001Map
*/ */
private void checkSaveData(List<HGCG001> fCg001s, Map<String, HGCG001> dbCg001Map) { private void checkSaveData(List<HGCG001> fCg001s) {
for (HGCG001 fCg001 : fCg001s) { for (HGCG001 fCg001 : fCg001s) {
String planNo = fCg001.getPlanNo(); AssertUtils.isNotEquals(HGConstant.CgPlanStatus.S_0, fCg001.getStatus(),
HGCG001 dbCg001 = dbCg001Map.get(planNo); String.format("计划[%s]状态不是\"待审核\",不允许操作", fCg001.getPlanNo()));
AssertUtils.isNull(dbCg001, String.format("计划[%s]不存在", planNo));
AssertUtils.isNotEquals(HGConstant.CgPlanStatus.S_0, dbCg001.getStatus(),
String.format("计划[%s]状态不是\"待审核\",不允许操作", planNo));
AssertUtils.isGe(BigDecimal.ZERO, fCg001.getPurQty(), String.format("计划[%s]采购数量必须大于0", planNo));
AssertUtils.isGe(BigDecimal.ZERO, fCg001.getPurWeight(), String.format("计划[%s]采购重量必须大于0", planNo));
} }
} }
/** /**
* 数据保存 * 数据保存
* *
* @param fCg001s * @param fCg001
*/ */
private void saveData(List<HGCG001> fCg001s) { private void saveData(HGCG001 fCg001) {
for (HGCG001 fCg001 : fCg001s) { if(fCg001.getPurWeight().compareTo(BigDecimal.ZERO) > 0 && fCg001.getPurQty().compareTo(BigDecimal.ZERO) > 0){
fCg001.setPurUnitWeight(fCg001.getPurWeight().divide(fCg001.getPurQty(), 3, RoundingMode.HALF_UP)); fCg001.setPurUnitWeight(fCg001.getPurWeight().divide(fCg001.getPurQty(), 3, RoundingMode.HALF_UP));
DaoUtils.update(HGSqlConstant.HgCg001.UPDATE_PUR, fCg001); }else{
fCg001.setPurUnitWeight(BigDecimal.ZERO);
} }
fCg001.setStatus(HGConstant.CgPlanStatus.S_0);
fCg001.setPlanNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_PLAN_NO));
fCg001.setPlanDate(DateUtils.formatShort(DateUtils.date()));
fCg001.setSource(HGConstant.CgSource.SDLR);
DaoUtils.insert(HGCG001.INSERT, fCg001);
} }
/** /**
...@@ -247,6 +260,34 @@ public class ServiceHGCG001 extends ServiceBase { ...@@ -247,6 +260,34 @@ public class ServiceHGCG001 extends ServiceBase {
//子表修改 //子表修改
DaoUtils.update(HGSqlConstant.HgCg001A.UPDATE_STATUS_BY_PLAN_NO, fCg001); DaoUtils.update(HGSqlConstant.HgCg001A.UPDATE_STATUS_BY_PLAN_NO, fCg001);
} }
List<Long> primaryIds = fCg001s.stream().map(HGCG001::getId).collect(Collectors.toList());
List<HGCG001A> hgcg001AList = HGCGTools.HgCg001A.listByPrimaryIds(primaryIds);
List<String> inventCodes = Optional.ofNullable(hgcg001AList).orElse(new ArrayList<>()).stream().map(HGCG001A::getInventCode).collect(Collectors.toList());
Map<String,HGPZ005> pz005Map = new HashMap<>();
if(CollectionUtils.isNotEmpty(inventCodes)){
List<HGPZ005> hgpz005List = HGPZTools.HgPz005.listByInventCodes(inventCodes);
if(CollectionUtils.isNotEmpty(hgpz005List)){
pz005Map = hgpz005List.stream().collect(Collectors.toMap(HGPZ005::getInventCode, item -> item));
pz005MapComparison(pz005Map,hgcg001AList);
}
}
}
private void pz005MapComparison(Map<String, HGPZ005> pz005Map, List<HGCG001A> hgcg001AList) {
hgcg001AList.forEach(hgcg001A -> {
HGPZ005 oldHgpz005 = pz005Map.get(hgcg001A.getInventCode());
HGPZ005 newHgpz005 = new HGPZ005();
BeanUtils.copyProperties(hgcg001A,newHgpz005,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
//存在名称、材质、规格、长宽厚不一致的,则新增一条物料数据库数据
if(!oldHgpz005.equals(newHgpz005)){
oldHgpz005.setInventCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.INVENT_CODE));
oldHgpz005.setEntityValue(newHgpz005);
oldHgpz005.setId(null);
DaoUtils.insert(HGPZ005.INSERT, oldHgpz005);
hgcg001A.setInventCode(oldHgpz005.getInventCode());
pz005Map.put(oldHgpz005.getInventCode(),oldHgpz005);
}
});
} }
/** /**
......
...@@ -115,13 +115,10 @@ public class ServiceHGCG001A extends ServiceBase { ...@@ -115,13 +115,10 @@ public class ServiceHGCG001A extends ServiceBase {
*/ */
private void checkSaveData(List<HGCG001A> fCg001As, Map<Long, HGCG001A> dbCg001Map,HGCG001 cg001) { private void checkSaveData(List<HGCG001A> fCg001As, Map<Long, HGCG001A> dbCg001Map,HGCG001 cg001) {
for (HGCG001A fCg001a : fCg001As) { 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(), AssertUtils.isNotEquals(HGConstant.CgPlanStatus.S_0, cg001.getStatus(),
String.format("计划[%s]状态不是\"待审核\",不允许操作", cg001.getPlanNo())); String.format("计划[%s]状态不是\"待审核\",不允许操作", cg001.getPlanNo()));
AssertUtils.isGe(BigDecimal.ZERO, fCg001a.getPurQty(), String.format("计划明细[%s]采购数量必须大于0", dbCg001A.getInventCode())); AssertUtils.isGe(BigDecimal.ZERO, fCg001a.getPurQty(), String.format("计划明细[%s]采购数量必须大于0", fCg001a.getInventCode()));
AssertUtils.isGe(BigDecimal.ZERO, fCg001a.getPurWeight(), String.format("计划明细[%s]采购重量必须大于0", dbCg001A.getInventCode())); AssertUtils.isGe(BigDecimal.ZERO, fCg001a.getPurWeight(), String.format("计划明细[%s]采购重量必须大于0", fCg001a.getInventCode()));
} }
} }
...@@ -133,8 +130,14 @@ public class ServiceHGCG001A extends ServiceBase { ...@@ -133,8 +130,14 @@ public class ServiceHGCG001A extends ServiceBase {
private void saveData(List<HGCG001A> fCg001s,HGCG001 cg001) { private void saveData(List<HGCG001A> fCg001s,HGCG001 cg001) {
for (HGCG001A fCg001a : fCg001s) { for (HGCG001A fCg001a : fCg001s) {
fCg001a.setPurUnitWeight(fCg001a.getPurWeight().divide(fCg001a.getPurQty(), 3, RoundingMode.HALF_UP)); fCg001a.setPurUnitWeight(fCg001a.getPurWeight().divide(fCg001a.getPurQty(), 3, RoundingMode.HALF_UP));
if(fCg001a.getId() == null || fCg001a.getId() == 0){
BeanUtils.copyProperties(cg001,fCg001a,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime",
"inventType","inventTypeDetail","inventCode","inventName","spec","material","unit","length","width","thick","purQty","purUnitWeight","purWeight");
DaoUtils.insert(HGCG001A.INSERT, fCg001a);
}else{
DaoUtils.update(HGCG001A.UPDATE, fCg001a); DaoUtils.update(HGCG001A.UPDATE, fCg001a);
} }
}
//修改主表数量 //修改主表数量
updateCg001Pur(cg001); updateCg001Pur(cg001);
} }
......
...@@ -10,25 +10,23 @@ import com.baosight.hggp.hg.cg.tools.HGCGTools; ...@@ -10,25 +10,23 @@ 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.constant.HGSqlConstant; import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sb.tools.HGSBTools;
import com.baosight.hggp.hg.sc.domain.HGSC009;
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.hg.xs.tools.HGXSTools; import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.*;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -52,6 +50,11 @@ public class ServiceHGCG002 extends ServiceBase { ...@@ -52,6 +50,11 @@ public class ServiceHGCG002 extends ServiceBase {
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));
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class); EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
Map qarma = new HashMap();
Map userCompany = HGSBTools.getUserCompany();
qarma.put(HGSC009.FIELD_COMPANY_CODE,userCompany.get(HGSC009.FIELD_COMPANY_CODE));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BY_ROLE_BLOCK_ID),qarma);
qarma.clear();
EiInfoUtils.addBlock(inInfo,"userByCompany", HGXSTools.XsUser.listAll(UserSessionUtils.getAccountCode()), User.class); EiInfoUtils.addBlock(inInfo,"userByCompany", HGXSTools.XsUser.listAll(UserSessionUtils.getAccountCode()), User.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG002().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG002().eiMetadata);
} catch (Exception e) { } catch (Exception e) {
...@@ -89,12 +92,18 @@ public class ServiceHGCG002 extends ServiceBase { ...@@ -89,12 +92,18 @@ public class ServiceHGCG002 extends ServiceBase {
public EiInfo save(EiInfo inInfo) { public EiInfo save(EiInfo inInfo) {
try { try {
List<HGCG002> fCg002s = MapUtils.toDaoEPBases(inInfo, HGCG002.class); List<HGCG002> fCg002s = MapUtils.toDaoEPBases(inInfo, HGCG002.class);
// db数据 // 写入数据
Map<String, HGCG002A> dbCg002AMap = HGCGUtils.HgCg002.lockGetDataEp(fCg002s); for (int i = 0; i < fCg002s.size(); i++) {
HGCG002 hgcg002 = fCg002s.get(i);
// 数据校验 // 数据校验
this.checkSaveData(fCg002s, dbCg002AMap); this.checkSaveData(fCg002s);
// 保存数据 if (hgcg002.getId() == null || hgcg002.getId() == 0) {
this.saveData(fCg002s); // 修改数据
this.saveData(hgcg002);
} else {
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_PUR, hgcg002);
}
}
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg002s.size() + "]条数据保存成功!"); inInfo.setMsg("操作成功!本次对[" + fCg002s.size() + "]条数据保存成功!");
...@@ -108,27 +117,32 @@ public class ServiceHGCG002 extends ServiceBase { ...@@ -108,27 +117,32 @@ public class ServiceHGCG002 extends ServiceBase {
* 数据校验 * 数据校验
* *
* @param fCg002s * @param fCg002s
* @param dbCg002AMap
*/ */
private void checkSaveData(List<HGCG002> fCg002s, Map<String, HGCG002A> dbCg002AMap) { private void checkSaveData(List<HGCG002> fCg002s) {
for (HGCG002 fCg002 : fCg002s) { for (HGCG002 fCg002 : fCg002s) {
String contractNo = fCg002.getContractNo(); AssertUtils.isTrue(fCg002.getStatus().intValue() == HGConstant.CgContractStatus.S_4
HGCG002 dbCg002 = dbCg002AMap.get(contractNo); || fCg002.getStatus().intValue() == HGConstant.CgContractStatus.S_5,
AssertUtils.isNull(dbCg002, String.format("合同[%s]不存在", contractNo)); String.format("合同[%s]已生成收货单,不允许操作", fCg002.getContractNo()));
AssertUtils.isNotEquals(HGConstant.CgPlanStatus.S_0, dbCg002.getStatus(), String.format("合同[%s]状态不是\"待审核\",不允许操作", contractNo)); AssertUtils.isEmpty(fCg002.getContractDate(), "合同日期不能为空");
AssertUtils.isTrue(fCg002.getAmount().compareTo(BigDecimal.ZERO) <= 0, String.format("合同[%s]不含税金额小于等于0,不允许操作", contractNo)); AssertUtils.isTrue(fCg002.getAmount().compareTo(BigDecimal.ZERO) < 0, "合同不含税金额小于等于0,不允许操作");
AssertUtils.isTrue(fCg002.getTaxIncludeAmount().compareTo(BigDecimal.ZERO) <= 0, String.format("合同[%s]含税金额小于等于0,不允许操作", contractNo)); AssertUtils.isTrue(fCg002.getTaxIncludeAmount().compareTo(BigDecimal.ZERO) < 0, "合同[%s]含税金额小于等于0,不允许操作");
} }
} }
/** /**
* 数据保存 * 数据保存
* *
* @param fCg002s * @param fCg002
*/ */
private void saveData(List<HGCG002> fCg002s) { private void saveData(HGCG002 fCg002) {
for (HGCG002 fCg002 : fCg002s) { if (fCg002.getId() == null || fCg002.getId() == 0) {
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_PUR, fCg002); fCg002.setSource(HGConstant.CgSource.SDLR);
fCg002.setContractDate(StringUtils.isNotBlank(fCg002.getContractDate()) ? fCg002.getContractDate() : DateUtils.formatShort(DateUtils.date()));
fCg002.setContractNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_CONTRACT_NO));
fCg002.setStatus(HGConstant.CgContractStatus.S_0);
fCg002.setContractDate(DateUtils.formatShort(fCg002.getContractDate()));
fCg002.setId(null);
DaoUtils.insert(HGCG002.INSERT, fCg002);
} }
} }
...@@ -190,7 +204,7 @@ public class ServiceHGCG002 extends ServiceBase { ...@@ -190,7 +204,7 @@ public class ServiceHGCG002 extends ServiceBase {
dbCg002.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode()); dbCg002.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGCG002.DELETE, dbCg002); DaoUtils.update(HGCG002.DELETE, dbCg002);
// 更新计划状态 // 更新计划状态
HGCGTools.HgCg001.updateStatus(dbCg002.getPlanNo(), HGConstant.CgPlanStatus.S_2); HGCGTools.HgCg001.updateStatus(dbCg002.getPlanNo(), HGConstant.CgContractStatus.S_2);
} }
List<Long> primaryIds = fCg002s.stream().map(o->o.getId()).collect(Collectors.toList()); List<Long> primaryIds = fCg002s.stream().map(o->o.getId()).collect(Collectors.toList());
...@@ -239,6 +253,8 @@ public class ServiceHGCG002 extends ServiceBase { ...@@ -239,6 +253,8 @@ public class ServiceHGCG002 extends ServiceBase {
String contractNo = fCg002.getContractNo(); String contractNo = fCg002.getContractNo();
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.isTrue(StringUtils.isBlank(dbCg002.getSupName()), String.format("合同[%s]供应商为空", contractNo));
AssertUtils.isTrue(StringUtils.isBlank(dbCg002.getPurUserName()), 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(fCg002.getAmount().compareTo(BigDecimal.ZERO) <= 0, String.format("合同[%s]不含税金额小于等于0,不允许操作", contractNo)); AssertUtils.isTrue(fCg002.getAmount().compareTo(BigDecimal.ZERO) <= 0, String.format("合同[%s]不含税金额小于等于0,不允许操作", contractNo));
...@@ -262,6 +278,35 @@ public class ServiceHGCG002 extends ServiceBase { ...@@ -262,6 +278,35 @@ public class ServiceHGCG002 extends ServiceBase {
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_AUDIT, fCg002); DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_AUDIT, fCg002);
HGCGTools.HgCg002B.updateStatus(fCg002.getId(),HGConstant.CgContractStatus.S_2); HGCGTools.HgCg002B.updateStatus(fCg002.getId(),HGConstant.CgContractStatus.S_2);
} }
List<Long> primaryIds = fCg002s.stream().map(HGCG002::getId).collect(Collectors.toList());
List<HGCG002B> hgcg002BList = HGCGTools.HgCg002B.listByPrimaryIds(primaryIds);
List<String> inventCodes = Optional.ofNullable(hgcg002BList).orElse(new ArrayList<>()).stream().map(HGCG002B::getInventCode).collect(Collectors.toList());
Map<String, HGPZ005> pz005Map = new HashMap<>();
if(CollectionUtils.isNotEmpty(inventCodes)){
List<HGPZ005> hgpz005List = HGPZTools.HgPz005.listByInventCodes(inventCodes);
if(CollectionUtils.isNotEmpty(hgpz005List)){
pz005Map = hgpz005List.stream().collect(Collectors.toMap(HGPZ005::getInventCode, item -> item));
pz005MapComparison(pz005Map,hgcg002BList);
}
}
DaoUtils.updateBatch(HGCG002B.UPDATE,hgcg002BList);
}
private void pz005MapComparison(Map<String, HGPZ005> pz005Map, List<HGCG002B> hgcg002BList) {
hgcg002BList.forEach(hgcg002B -> {
HGPZ005 oldHgpz005 = pz005Map.get(hgcg002B.getInventCode());
HGPZ005 newHgpz005 = new HGPZ005();
BeanUtils.copyProperties(hgcg002B,newHgpz005,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
//存在名称、材质、规格、长宽厚不一致的,则新增一条物料数据库数据
if(!oldHgpz005.equals(newHgpz005)){
oldHgpz005.setInventCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.INVENT_CODE));
oldHgpz005.setEntityValue(newHgpz005);
oldHgpz005.setId(null);
DaoUtils.insert(HGPZ005.INSERT, oldHgpz005);
hgcg002B.setInventCode(oldHgpz005.getInventCode());
pz005Map.put(oldHgpz005.getInventCode(),oldHgpz005);
}
});
} }
} }
...@@ -123,8 +123,8 @@ public class ServiceHGCG002A extends ServiceBase { ...@@ -123,8 +123,8 @@ public class ServiceHGCG002A extends ServiceBase {
Long id = fCg001A.getId(); Long id = fCg001A.getId();
HGCG001A dbCg001A = dbCg001AMap.get(id); HGCG001A dbCg001A = dbCg001AMap.get(id);
AssertUtils.isNull(dbCg001A, String.format("计划明细[%s]不存在", id)); AssertUtils.isNull(dbCg001A, String.format("计划明细[%s]不存在", id));
AssertUtils.isTrue(fCg001A.getTaxRate().compareTo(BigDecimal.ZERO) <= 0, "税率不能小于等于"); AssertUtils.isTrue(fCg001A.getTaxRate().compareTo(BigDecimal.ZERO) <= 0, "税率不能小于等于0");
AssertUtils.isTrue(fCg001A.getPrice().compareTo(BigDecimal.ZERO) <= 0, "单价不能小于等于"); AssertUtils.isTrue(fCg001A.getPrice().compareTo(BigDecimal.ZERO) <= 0, "单价不能小于等于0");
} }
} }
......
...@@ -2,6 +2,7 @@ package com.baosight.hggp.hg.cg.service; ...@@ -2,6 +2,7 @@ package com.baosight.hggp.hg.cg.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.InventTypeDetailEnum;
import com.baosight.hggp.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;
...@@ -10,6 +11,8 @@ import com.baosight.hggp.hg.cg.tools.HGCGTools; ...@@ -10,6 +11,8 @@ 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.constant.HGSqlConstant; import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ004;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
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.hg.xs.tools.HGXSTools; import com.baosight.hggp.hg.xs.tools.HGXSTools;
...@@ -20,6 +23,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase; ...@@ -20,6 +23,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -45,6 +49,11 @@ public class ServiceHGCG002B extends ServiceBase { ...@@ -45,6 +49,11 @@ public class ServiceHGCG002B extends ServiceBase {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID), null, false); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID), null, false);
EiInfoUtils.addBlock(inInfo,"userByCompany", HGXSTools.XsUser.listAll(UserSessionUtils.getAccountCode()), User.class); EiInfoUtils.addBlock(inInfo,"userByCompany", HGXSTools.XsUser.listAll(UserSessionUtils.getAccountCode()), User.class);
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);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG002B().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG002B().eiMetadata);
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败"); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
...@@ -79,13 +88,32 @@ public class ServiceHGCG002B extends ServiceBase { ...@@ -79,13 +88,32 @@ public class ServiceHGCG002B extends ServiceBase {
public EiInfo save(EiInfo inInfo) { public EiInfo save(EiInfo inInfo) {
try { try {
List<HGCG002B> fCg002Bs = MapUtils.toDaoEPBases(inInfo, HGCG002B.class); List<HGCG002B> fCg002Bs = MapUtils.toDaoEPBases(inInfo, HGCG002B.class);
HGCG002 cg002 = HGCGTools.HgCg002.get(fCg002Bs.get(0).getPrimaryId());
if(cg002.getSource().intValue() == HGConstant.CgSource.DEFAULT){
// db数据 // db数据
Map<Long, HGCG002B> dbCg002AMap = HGCGUtils.HgCg002B.lockGetDataEp(fCg002Bs); Map<Long, HGCG002B> dbCg002AMap = HGCGUtils.HgCg002B.lockGetDataEp(fCg002Bs);
HGCG002 cg001 = HGCGTools.HgCg002.get(fCg002Bs.get(0).getPrimaryId());
// 数据校验 // 数据校验
this.checkSaveData(fCg002Bs, dbCg002AMap,cg001); this.checkSaveData(fCg002Bs, dbCg002AMap,cg002);
// 保存数据 // 保存数据
this.saveData(fCg002Bs,cg001); this.editData(fCg002Bs,cg002);
}else{
// 写入数据
for (int i = 0; i < fCg002Bs.size(); i++) {
HGCG002B hgcg002B = fCg002Bs.get(i);
if (hgcg002B.getId() == null || hgcg002B.getId() == 0) {
// 修改数据
this.saveData(hgcg002B,cg002);
} else {
// 新增数据
hgcg002B.setStatus(HGConstant.CgContractStatus.S_0);
DaoUtils.update(HGCG002B.UPDATE, hgcg002B);
}
}
//修改主表信息
cg002.setStatus(HGConstant.CgContractStatus.S_0);
HGCGTools.HgCg002.updateCg002Pur(cg002);
}
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg002Bs.size() + "]条数据保存成功!"); inInfo.setMsg("操作成功!本次对[" + fCg002Bs.size() + "]条数据保存成功!");
...@@ -95,18 +123,26 @@ public class ServiceHGCG002B extends ServiceBase { ...@@ -95,18 +123,26 @@ public class ServiceHGCG002B extends ServiceBase {
return inInfo; return inInfo;
} }
private void saveData(HGCG002B hgcg002B, HGCG002 cg002) {
BeanUtils.copyProperties(hgcg002B,cg002,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime",
"inventType","inventTypeDetail","inventCode","inventName","spec","material","unit","length","width","thick","purQty","purUnitWeight","purWeight");
DaoUtils.insert(HGCG002B.INSERT, hgcg002B);
}
/** /**
* 数据校验 * 数据校验
* *
* @param fCg002Bs * @param fCg002Bs
* @param dbCg002BMap * @param dbCg002BMap
*/ */
private void checkSaveData(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap,HGCG002 cg001) { private void checkSaveData(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap,HGCG002 cg002) {
for (HGCG002B fCg002B : fCg002Bs) { for (HGCG002B fCg002B : fCg002Bs) {
Long id = fCg002B.getId(); Long id = fCg002B.getId();
HGCG002B dbCg002B = dbCg002BMap.get(id); HGCG002B dbCg002B = dbCg002BMap.get(id);
AssertUtils.isNull(dbCg002B, String.format("合同明细[%s]不存在", id)); AssertUtils.isNull(dbCg002B, String.format("合同明细[%s]不存在", id));
AssertUtils.isNotEquals(HGConstant.CgPlanStatus.S_0, cg001.getStatus(), String.format("合同[%s]状态不是\"待审核\",不允许操作", cg001.getContractNo())); AssertUtils.isTrue(cg002.getStatus().intValue() == HGConstant.CgContractStatus.S_4
|| cg002.getStatus().intValue() == HGConstant.CgContractStatus.S_5,
String.format("合同[%s]已生成收货单,不允许操作", cg002.getContractNo()));
AssertUtils.isTrue(fCg002B.getPrice().compareTo(BigDecimal.ZERO) <= 0, String.format("存货[%s]单价小于等于0,不允许操作", dbCg002B.getInventCode())); 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())); AssertUtils.isTrue(fCg002B.getTaxRate().compareTo(BigDecimal.ZERO) <= 0, String.format("存货[%s]税率小于等于0,不允许操作", dbCg002B.getInventCode()));
} }
...@@ -118,11 +154,13 @@ public class ServiceHGCG002B extends ServiceBase { ...@@ -118,11 +154,13 @@ public class ServiceHGCG002B extends ServiceBase {
* @param fCg002Bs * @param fCg002Bs
* @param cg002 * @param cg002
*/ */
private void saveData(List<HGCG002B> fCg002Bs, HGCG002 cg002) { private void editData(List<HGCG002B> fCg002Bs, HGCG002 cg002) {
for (HGCG002B fCg002B : fCg002Bs) { for (HGCG002B fCg002B : fCg002Bs) {
fCg002B.setStatus(HGConstant.CgContractStatus.S_0);
DaoUtils.update(HGCG002B.UPDATE, fCg002B); DaoUtils.update(HGCG002B.UPDATE, fCg002B);
} }
//修改主表信息 //修改主表信息
cg002.setStatus(HGConstant.CgContractStatus.S_0);
HGCGTools.HgCg002.updateCg002Pur(cg002); HGCGTools.HgCg002.updateCg002Pur(cg002);
} }
...@@ -185,6 +223,7 @@ public class ServiceHGCG002B extends ServiceBase { ...@@ -185,6 +223,7 @@ public class ServiceHGCG002B extends ServiceBase {
DaoUtils.update(HGCG002B.DELETE, dbCg002B); DaoUtils.update(HGCG002B.DELETE, dbCg002B);
} }
//修改主表信息 //修改主表信息
cg002.setStatus(HGConstant.CgContractStatus.S_0);
HGCGTools.HgCg002.updateCg002Pur(cg002); HGCGTools.HgCg002.updateCg002Pur(cg002);
} }
......
...@@ -363,7 +363,7 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -363,7 +363,7 @@ public class ServiceHGCG003 extends ServiceBase {
hgcg003BList.forEach(o->{ hgcg003BList.forEach(o->{
Map<String, Object> paramDetailMap = new HashMap<>(); Map<String, Object> paramDetailMap = new HashMap<>();
paramDetailMap.put(HGCG003B.FIELD_ID, o.getId()); paramDetailMap.put(HGCG003B.FIELD_ID, o.getId());
paramDetailMap.put(HGCG003B.FIELD_STATUS, HGConstant.CgReceiveStatus.S_2); paramDetailMap.put(HGCG003B.FIELD_STATUS, HGConstant.CgReceiveStatus.S_5);
paramDetailMap.put(HGCG003B.FIELD_DELIVER_QTY, 0); paramDetailMap.put(HGCG003B.FIELD_DELIVER_QTY, 0);
paramDetailMap.put(HGCG003B.FIELD_DEPOSIT_QTY, o.getReceiveQty()); paramDetailMap.put(HGCG003B.FIELD_DEPOSIT_QTY, o.getReceiveQty());
DaoUtils.update(HGSqlConstant.HgCg003B.UPDATE_CONFIRM, paramDetailMap); DaoUtils.update(HGSqlConstant.HgCg003B.UPDATE_CONFIRM, paramDetailMap);
......
...@@ -230,6 +230,9 @@ ...@@ -230,6 +230,9 @@
<isNotEmpty prepend=" AND " property="projName"> <isNotEmpty prepend=" AND " property="projName">
a.PROJ_NAME LIKE CONCAT('%', #projName# ,'%') a.PROJ_NAME LIKE CONCAT('%', #projName# ,'%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="primaryIds">
a.PRIMARY_ID IN <iterate open="(" close=")" conjunction="," property="primaryIds">#primaryIds[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="source"> <isNotEmpty prepend=" AND " property="source">
b.SOURCE = #source# b.SOURCE = #source#
</isNotEmpty> </isNotEmpty>
......
...@@ -267,6 +267,7 @@ ...@@ -267,6 +267,7 @@
TAX_AMOUNT = #taxAmount#, <!-- 税额 --> TAX_AMOUNT = #taxAmount#, <!-- 税额 -->
PUR_QTY = #purQty#, PUR_QTY = #purQty#,
PUR_WEIGHT = #purWeight#, PUR_WEIGHT = #purWeight#,
STATUS = #status#, <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
<include refid="updateRevise"/> <include refid="updateRevise"/>
WHERE CONTRACT_NO = #contractNo# WHERE CONTRACT_NO = #contractNo#
</update> </update>
......
...@@ -194,6 +194,19 @@ public class HGCGTools { ...@@ -194,6 +194,19 @@ public class HGCGTools {
paramMap.put("primaryId", primaryId); paramMap.put("primaryId", primaryId);
return DaoBase.getInstance().query(HGCG001A.QUERY, paramMap); return DaoBase.getInstance().query(HGCG001A.QUERY, paramMap);
} }
/**
* 查询
*
* @param primaryIds
* @return
*/
public static List<HGCG001A> listByPrimaryIds(List<Long> primaryIds) {
AssertUtils.isEmpty(primaryIds, "计划id不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("primaryIds", primaryIds);
return DaoBase.getInstance().query(HGCG001A.QUERY, paramMap);
}
/** /**
* 查询 * 查询
* *
......
...@@ -28,6 +28,8 @@ public class HGCW012 extends DaoEPBase { ...@@ -28,6 +28,8 @@ public class HGCW012 extends DaoEPBase {
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 企业编码*/ public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 企业编码*/
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 公司编码*/ public static final String FIELD_COMPANY_CODE = "companyCode"; /* 公司编码*/
public static final String FIELD_COMPANY_NAME = "companyName"; /* 公司名称*/ public static final String FIELD_COMPANY_NAME = "companyName"; /* 公司名称*/
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编号*/
public static final String FIELD_SETTLEMENT_NUMBER = "settlementNumber"; /* 来源单号*/ public static final String FIELD_SETTLEMENT_NUMBER = "settlementNumber"; /* 来源单号*/
public static final String FIELD_BILL_TYBE = "billTybe"; /* 票据类型*/ public static final String FIELD_BILL_TYBE = "billTybe"; /* 票据类型*/
public static final String FIELD_BILL_NUMBER = "billNumber"; /* 发票号*/ public static final String FIELD_BILL_NUMBER = "billNumber"; /* 发票号*/
...@@ -98,6 +100,8 @@ public class HGCW012 extends DaoEPBase { ...@@ -98,6 +100,8 @@ public class HGCW012 extends DaoEPBase {
private String accountCode = " "; /* 企业编码*/ private String accountCode = " "; /* 企业编码*/
private String companyCode = " "; /* 公司编码*/ private String companyCode = " "; /* 公司编码*/
private String companyName = " "; /* 公司名称*/ private String companyName = " "; /* 公司名称*/
private String projName = " "; /* 项目名称*/
private String projCode = " "; /* 项目编号*/
private String settlementNumber = " "; /* 来源单号*/ private String settlementNumber = " "; /* 来源单号*/
private Integer billTybe = new Integer(0); /* 票据类型*/ private Integer billTybe = new Integer(0); /* 票据类型*/
private String billNumber = " "; /* 发票号*/ private String billNumber = " "; /* 发票号*/
...@@ -149,6 +153,14 @@ public class HGCW012 extends DaoEPBase { ...@@ -149,6 +153,14 @@ public class HGCW012 extends DaoEPBase {
eiColumn.setDescName("公司名称"); eiColumn.setDescName("公司名称");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PROJ_NAME);
eiColumn.setDescName("项目名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PROJ_CODE);
eiColumn.setDescName("项目编号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SETTLEMENT_NUMBER); eiColumn = new EiColumn(FIELD_SETTLEMENT_NUMBER);
eiColumn.setDescName("来源单号"); eiColumn.setDescName("来源单号");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -335,6 +347,22 @@ public class HGCW012 extends DaoEPBase { ...@@ -335,6 +347,22 @@ public class HGCW012 extends DaoEPBase {
return this.companyName; return this.companyName;
} }
public String getProjName() {
return projName;
}
public void setProjName(String projName) {
this.projName = projName;
}
public String getProjCode() {
return projCode;
}
public void setProjCode(String projCode) {
this.projCode = projCode;
}
/** /**
* set the companyName - 公司名称. * set the companyName - 公司名称.
* *
...@@ -787,6 +815,8 @@ public class HGCW012 extends DaoEPBase { ...@@ -787,6 +815,8 @@ public class HGCW012 extends DaoEPBase {
setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_CODE)), accountCode)); setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_CODE)), accountCode));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode)); setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName)); setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setSettlementNumber(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SETTLEMENT_NUMBER)), settlementNumber)); setSettlementNumber(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SETTLEMENT_NUMBER)), settlementNumber));
setBillTybe(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_BILL_TYBE)), billTybe)); setBillTybe(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_BILL_TYBE)), billTybe));
setBillNumber(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_BILL_NUMBER)), billNumber)); setBillNumber(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_BILL_NUMBER)), billNumber));
...@@ -827,6 +857,8 @@ public class HGCW012 extends DaoEPBase { ...@@ -827,6 +857,8 @@ public class HGCW012 extends DaoEPBase {
map.put(FIELD_ACCOUNT_CODE, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_ACCOUNT_CODE))); map.put(FIELD_ACCOUNT_CODE, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_ACCOUNT_CODE)));
map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE))); map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE)));
map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME))); map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME)));
map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME)));
map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE)));
map.put(FIELD_SETTLEMENT_NUMBER, StringUtils.toString(settlementNumber, eiMetadata.getMeta(FIELD_SETTLEMENT_NUMBER))); map.put(FIELD_SETTLEMENT_NUMBER, StringUtils.toString(settlementNumber, eiMetadata.getMeta(FIELD_SETTLEMENT_NUMBER)));
map.put(FIELD_BILL_TYBE, StringUtils.toString(billTybe, eiMetadata.getMeta(FIELD_BILL_TYBE))); map.put(FIELD_BILL_TYBE, StringUtils.toString(billTybe, eiMetadata.getMeta(FIELD_BILL_TYBE)));
map.put(FIELD_BILL_NUMBER, StringUtils.toString(billNumber, eiMetadata.getMeta(FIELD_BILL_NUMBER))); map.put(FIELD_BILL_NUMBER, StringUtils.toString(billNumber, eiMetadata.getMeta(FIELD_BILL_NUMBER)));
......
...@@ -29,6 +29,8 @@ public class HGCW013 extends DaoEPBase { ...@@ -29,6 +29,8 @@ public class HGCW013 extends DaoEPBase {
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 企业编码*/ public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 企业编码*/
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 公司编码*/ public static final String FIELD_COMPANY_CODE = "companyCode"; /* 公司编码*/
public static final String FIELD_COMPANY_NAME = "companyName"; /* 公司名称*/ public static final String FIELD_COMPANY_NAME = "companyName"; /* 公司名称*/
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编号*/
public static final String FIELD_SETTLEMENT_NUMBER = "settlementNumber"; /* 来源单号*/ public static final String FIELD_SETTLEMENT_NUMBER = "settlementNumber"; /* 来源单号*/
public static final String FIELD_BILL_NUMBER = "billNumber"; /* 发票号*/ public static final String FIELD_BILL_NUMBER = "billNumber"; /* 发票号*/
public static final String FIELD_PARTY_A = "partyA"; /* 供应商名称*/ public static final String FIELD_PARTY_A = "partyA"; /* 供应商名称*/
...@@ -77,6 +79,8 @@ public class HGCW013 extends DaoEPBase { ...@@ -77,6 +79,8 @@ public class HGCW013 extends DaoEPBase {
private String accountCode = " "; /* 企业编码*/ private String accountCode = " "; /* 企业编码*/
private String companyCode = " "; /* 公司编码*/ private String companyCode = " "; /* 公司编码*/
private String companyName = " "; /* 公司名称*/ private String companyName = " "; /* 公司名称*/
private String projName = " "; /* 项目名称*/
private String projCode = " "; /* 项目编号*/
private String settlementNumber = " "; /* 来源单号*/ private String settlementNumber = " "; /* 来源单号*/
private String billNumber = " "; /* 发票号*/ private String billNumber = " "; /* 发票号*/
private String partyA = " "; /* 供应商名称*/ private String partyA = " "; /* 供应商名称*/
...@@ -119,6 +123,14 @@ public class HGCW013 extends DaoEPBase { ...@@ -119,6 +123,14 @@ public class HGCW013 extends DaoEPBase {
eiColumn.setDescName("公司名称"); eiColumn.setDescName("公司名称");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PROJ_NAME);
eiColumn.setDescName("项目名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PROJ_CODE);
eiColumn.setDescName("项目编号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SETTLEMENT_NUMBER); eiColumn = new EiColumn(FIELD_SETTLEMENT_NUMBER);
eiColumn.setDescName("来源单号"); eiColumn.setDescName("来源单号");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -268,6 +280,23 @@ public class HGCW013 extends DaoEPBase { ...@@ -268,6 +280,23 @@ public class HGCW013 extends DaoEPBase {
public void setCompanyName(String companyName) { public void setCompanyName(String companyName) {
this.companyName = companyName; this.companyName = companyName;
} }
public String getProjName() {
return projName;
}
public void setProjName(String projName) {
this.projName = projName;
}
public String getProjCode() {
return projCode;
}
public void setProjCode(String projCode) {
this.projCode = projCode;
}
/** /**
* get the settlementNumber - 来源单号. * get the settlementNumber - 来源单号.
* @return the settlementNumber * @return the settlementNumber
...@@ -506,6 +535,8 @@ public class HGCW013 extends DaoEPBase { ...@@ -506,6 +535,8 @@ public class HGCW013 extends DaoEPBase {
setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_CODE)), accountCode)); setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_CODE)), accountCode));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode)); setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName)); setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setSettlementNumber(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SETTLEMENT_NUMBER)), settlementNumber)); setSettlementNumber(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SETTLEMENT_NUMBER)), settlementNumber));
setBillNumber(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_BILL_NUMBER)), billNumber)); setBillNumber(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_BILL_NUMBER)), billNumber));
setPartyA(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARTY_A)), partyA)); setPartyA(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARTY_A)), partyA));
...@@ -534,6 +565,8 @@ public class HGCW013 extends DaoEPBase { ...@@ -534,6 +565,8 @@ public class HGCW013 extends DaoEPBase {
map.put(FIELD_ACCOUNT_CODE, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_ACCOUNT_CODE))); map.put(FIELD_ACCOUNT_CODE, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_ACCOUNT_CODE)));
map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE))); map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE)));
map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME))); map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME)));
map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME)));
map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE)));
map.put(FIELD_SETTLEMENT_NUMBER, StringUtils.toString(settlementNumber, eiMetadata.getMeta(FIELD_SETTLEMENT_NUMBER))); map.put(FIELD_SETTLEMENT_NUMBER, StringUtils.toString(settlementNumber, eiMetadata.getMeta(FIELD_SETTLEMENT_NUMBER)));
map.put(FIELD_BILL_NUMBER, StringUtils.toString(billNumber, eiMetadata.getMeta(FIELD_BILL_NUMBER))); map.put(FIELD_BILL_NUMBER, StringUtils.toString(billNumber, eiMetadata.getMeta(FIELD_BILL_NUMBER)));
map.put(FIELD_PARTY_A, StringUtils.toString(partyA, eiMetadata.getMeta(FIELD_PARTY_A))); map.put(FIELD_PARTY_A, StringUtils.toString(partyA, eiMetadata.getMeta(FIELD_PARTY_A)));
......
...@@ -228,6 +228,8 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -228,6 +228,8 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setBillNumber(hgcw013List.get(0).getBillNumber()); hgcw012.setBillNumber(hgcw013List.get(0).getBillNumber());
hgcw012.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1)); hgcw012.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding))); hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
hgcw012.setProjCode(hgcw013List.get(0).getProjCode());
hgcw012.setProjName(hgcw013List.get(0).getProjName());
this.add(hgcw012); this.add(hgcw012);
//生成明细表 //生成明细表
...@@ -308,6 +310,8 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -308,6 +310,8 @@ public class ServiceHGCW012 extends ServiceBase {
//hgcw012.setSigningDate(DateUtils.shortDate()); //hgcw012.setSigningDate(DateUtils.shortDate());
hgcw012.setReceiveDate(DateUtils.shortDate()); hgcw012.setReceiveDate(DateUtils.shortDate());
hgcw012.setPartyA(hgcw013List.get(0).getPartyA()); hgcw012.setPartyA(hgcw013List.get(0).getPartyA());
hgcw012.setProjCode(hgcw013List.get(0).getProjCode());
hgcw012.setProjName(hgcw013List.get(0).getProjName());
//BigDecimal totalContractPriceIncluding = BigDecimal.ZERO; //BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
//StringBuffer settlementNumber = new StringBuffer(); //StringBuffer settlementNumber = new StringBuffer();
Map<String, BigDecimal> rowMap = new HashMap<>(); Map<String, BigDecimal> rowMap = new HashMap<>();
...@@ -424,6 +428,8 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -424,6 +428,8 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setBillNumber(hgcw013List.get(0).getBillNumber()); hgcw012.setBillNumber(hgcw013List.get(0).getBillNumber());
hgcw012.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1)); hgcw012.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding))); hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
hgcw012.setProjCode(hgcw013List.get(0).getProjCode());
hgcw012.setProjName(hgcw013List.get(0).getProjName());
this.add(hgcw012); this.add(hgcw012);
//生成明细表 //生成明细表
......
...@@ -52,7 +52,7 @@ public class ServiceHGCW012C extends ServiceBase { ...@@ -52,7 +52,7 @@ public class ServiceHGCW012C extends ServiceBase {
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
inInfo = super.query(inInfo, HGCW013.QUERY, new HGCW012()); inInfo = super.query(inInfo, HGCW013.QUERY, new HGCW013());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
......
...@@ -43,6 +43,8 @@ ...@@ -43,6 +43,8 @@
ACCOUNT_CODE as "accountCode", <!-- 企业编码 --> ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 --> COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 --> COMPANY_NAME as "companyName", <!-- 公司名称 -->
PROJ_CODE as "projCode", <!-- 项目编号 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
SETTLEMENT_NUMBER as "settlementNumber", <!-- 来源单号 --> SETTLEMENT_NUMBER as "settlementNumber", <!-- 来源单号 -->
BILL_TYBE as "billTybe", <!-- 票据类型 --> BILL_TYBE as "billTybe", <!-- 票据类型 -->
BILL_NUMBER as "billNumber", <!-- 发票号 --> BILL_NUMBER as "billNumber", <!-- 发票号 -->
...@@ -84,6 +86,12 @@ ...@@ -84,6 +86,12 @@
<isNotEmpty prepend=" AND " property="companyName"> <isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName# COMPANY_NAME = #companyName#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="settlementNumber"> <isNotEmpty prepend=" AND " property="settlementNumber">
SETTLEMENT_NUMBER = #settlementNumber# SETTLEMENT_NUMBER = #settlementNumber#
</isNotEmpty> </isNotEmpty>
...@@ -293,6 +301,8 @@ ...@@ -293,6 +301,8 @@
ACCOUNT_CODE, <!-- 企业编码 --> ACCOUNT_CODE, <!-- 企业编码 -->
COMPANY_CODE, <!-- 公司编码 --> COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 --> COMPANY_NAME, <!-- 公司名称 -->
PROJ_CODE, <!-- 项目编号 -->
PROJ_NAME, <!-- 项目名称 -->
SETTLEMENT_NUMBER, <!-- 来源单号 --> SETTLEMENT_NUMBER, <!-- 来源单号 -->
BILL_TYBE, <!-- 票据类型 --> BILL_TYBE, <!-- 票据类型 -->
BILL_NUMBER, <!-- 发票号 --> BILL_NUMBER, <!-- 发票号 -->
...@@ -321,7 +331,11 @@ ...@@ -321,7 +331,11 @@
DEPOSIT_QTY, <!-- 入库数量 --> DEPOSIT_QTY, <!-- 入库数量 -->
RECEIVE_WEIGHT <!-- 收货重量 --> RECEIVE_WEIGHT <!-- 收货重量 -->
) )
VALUES (#id#, #accountCode#, #companyCode#, #companyName#, #settlementNumber#, #billTybe#, #billNumber#, #billState#, #signingDate#, #partyA#, #reviewStatus#, #taxPoints#, #thisSettlementTax#, #thisSettlementAmount#, #totalContractPriceIncluding#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #depCode#, #remainingAmount#, #receiveDate#, #contractType#, #inventTypeDetail#, #inventCode#, #inventName#, #spec#, #depositQty#, #receiveWeight#) VALUES (#id#, #accountCode#, #companyCode#, #companyName#, #projCode#, #projName#, #settlementNumber#,
#billTybe#, #billNumber#, #billState#, #signingDate#, #partyA#, #reviewStatus#, #taxPoints#,
#thisSettlementTax#, #thisSettlementAmount#, #totalContractPriceIncluding#, #createdBy#, #createdName#,
#createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #depCode#, #remainingAmount#, #receiveDate#,
#contractType#, #inventTypeDetail#, #inventCode#, #inventName#, #spec#, #depositQty#, #receiveWeight#)
<selectKey resultClass="long" keyProperty="id"> <selectKey resultClass="long" keyProperty="id">
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGCW012 SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGCW012
</selectKey> </selectKey>
...@@ -338,6 +352,8 @@ ...@@ -338,6 +352,8 @@
ACCOUNT_CODE = #accountCode#, <!-- 企业编码 --> ACCOUNT_CODE = #accountCode#, <!-- 企业编码 -->
COMPANY_CODE = #companyCode#, <!-- 公司编码 --> COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 --> COMPANY_NAME = #companyName#, <!-- 公司名称 -->
PROJ_CODE = #projCode#, <!-- 项目编号 -->
PROJ_NAME = #projName#, <!-- 项目名称 -->
SETTLEMENT_NUMBER = #settlementNumber#, <!-- 来源单号 --> SETTLEMENT_NUMBER = #settlementNumber#, <!-- 来源单号 -->
BILL_TYBE = #billTybe#, <!-- 票据类型 --> BILL_TYBE = #billTybe#, <!-- 票据类型 -->
BILL_NUMBER = #billNumber#, <!-- 发票号 --> BILL_NUMBER = #billNumber#, <!-- 发票号 -->
......
...@@ -421,6 +421,8 @@ ...@@ -421,6 +421,8 @@
A.ACCOUNT_CODE as "accountCode", <!-- 企业编码 --> A.ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
A.COMPANY_CODE as "companyCode", <!-- 公司编码 --> A.COMPANY_CODE as "companyCode", <!-- 公司编码 -->
A.COMPANY_NAME as "companyName", <!-- 公司名称 --> A.COMPANY_NAME as "companyName", <!-- 公司名称 -->
A.PROJ_CODE as "projCode", <!-- 项目编码 -->
A.PROJ_NAME as "projName", <!-- 项目名称 -->
B.SUP_CODE as "supCode", <!-- 供应商编码 --> B.SUP_CODE as "supCode", <!-- 供应商编码 -->
B.SUP_NAME as "supName", <!-- 供应商名称 --> B.SUP_NAME as "supName", <!-- 供应商名称 -->
A.RECEIVE_DATE as "receiveDate", <!-- 收货日期 --> A.RECEIVE_DATE as "receiveDate", <!-- 收货日期 -->
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
ACCOUNT_CODE as "accountCode", <!-- 企业编码 --> ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 --> COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 --> COMPANY_NAME as "companyName", <!-- 公司名称 -->
PROJ_CODE as "projCode", <!-- 项目编号 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
SETTLEMENT_NUMBER as "settlementNumber", <!-- 来源单号 --> SETTLEMENT_NUMBER as "settlementNumber", <!-- 来源单号 -->
BILL_NUMBER as "billNumber", <!-- 发票号 --> BILL_NUMBER as "billNumber", <!-- 发票号 -->
PARTY_A as "partyA", <!-- 供应商名称 --> PARTY_A as "partyA", <!-- 供应商名称 -->
...@@ -64,6 +66,12 @@ ...@@ -64,6 +66,12 @@
<isNotEmpty prepend=" AND " property="companyName"> <isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName# COMPANY_NAME = #companyName#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="settlementNumber"> <isNotEmpty prepend=" AND " property="settlementNumber">
SETTLEMENT_NUMBER = #settlementNumber# SETTLEMENT_NUMBER = #settlementNumber#
</isNotEmpty> </isNotEmpty>
...@@ -199,6 +207,8 @@ ...@@ -199,6 +207,8 @@
ACCOUNT_CODE, <!-- 企业编码 --> ACCOUNT_CODE, <!-- 企业编码 -->
COMPANY_CODE, <!-- 公司编码 --> COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 --> COMPANY_NAME, <!-- 公司名称 -->
PROJ_CODE, <!-- 项目编号 -->
PROJ_NAME, <!-- 项目名称 -->
SETTLEMENT_NUMBER, <!-- 来源单号 --> SETTLEMENT_NUMBER, <!-- 来源单号 -->
BILL_NUMBER, <!-- 发票号 --> BILL_NUMBER, <!-- 发票号 -->
PARTY_A, <!-- 供应商名称 --> PARTY_A, <!-- 供应商名称 -->
...@@ -214,7 +224,7 @@ ...@@ -214,7 +224,7 @@
UPDATED_TIME, <!-- 记录修改时间 --> UPDATED_TIME, <!-- 记录修改时间 -->
DEP_CODE <!-- 部门编码 --> DEP_CODE <!-- 部门编码 -->
) )
VALUES (#id#, #mainId#, #accountCode#, #companyCode#, #companyName#, #settlementNumber#, #billNumber#, #partyA#, #taxPoints#, #thisSettlementTax#, #thisSettlementAmount#, #totalContractPriceIncluding#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #depCode#) VALUES (#id#, #mainId#, #accountCode#, #companyCode#, #companyName#, #projCode#, #projName#, #settlementNumber#, #billNumber#, #partyA#, #taxPoints#, #thisSettlementTax#, #thisSettlementAmount#, #totalContractPriceIncluding#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #depCode#)
</insert> </insert>
<delete id="delete"> <delete id="delete">
...@@ -232,6 +242,8 @@ ...@@ -232,6 +242,8 @@
ACCOUNT_CODE = #accountCode#, <!-- 企业编码 --> ACCOUNT_CODE = #accountCode#, <!-- 企业编码 -->
COMPANY_CODE = #companyCode#, <!-- 公司编码 --> COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 --> COMPANY_NAME = #companyName#, <!-- 公司名称 -->
PROJ_CODE = #projCode#, <!-- 项目编号 -->
PROJ_NAME = #projName#, <!-- 项目名称 -->
SETTLEMENT_NUMBER = #settlementNumber#, <!-- 来源单号 --> SETTLEMENT_NUMBER = #settlementNumber#, <!-- 来源单号 -->
BILL_NUMBER = #billNumber#, <!-- 发票号 --> BILL_NUMBER = #billNumber#, <!-- 发票号 -->
PARTY_A = #partyA#, <!-- 供应商名称 --> PARTY_A = #partyA#, <!-- 供应商名称 -->
......
...@@ -160,11 +160,10 @@ public class HGKCTools { ...@@ -160,11 +160,10 @@ public class HGKCTools {
List<HGPZ007> hgpz007List = HGPZTools.HgPz007.allList(); List<HGPZ007> hgpz007List = HGPZTools.HgPz007.allList();
//获取仓库信息 //获取仓库信息
HGPZ007 hgpz007 = hgpz007List.stream().filter(wh->wh.getInventTypeDetail() != null && wh.getInventTypeDetail().intValue() == newKc001.getInventTypeDetail()).findAny().orElse(null); HGPZ007 hgpz007 = hgpz007List.stream().filter(wh->wh.getInventTypeDetail() != null && wh.getInventTypeDetail().intValue() == newKc001.getInventTypeDetail()).findAny().orElse(null);
AssertUtils.isNull(hgpz007, "仓库信息未获取到,请检查仓库档案是否维护存货大类!");
if(Objects.nonNull(hgpz007)){ if(Objects.nonNull(hgpz007)){
newKc001.setWhCode(hgpz007.getWhCode()); newKc001.setWhCode(hgpz007.getWhCode());
newKc001.setWhName(hgpz007.getWhName()); newKc001.setWhName(hgpz007.getWhName());
}else{
AssertUtils.isNull(hgpz007.getId(), "仓库信息未获取到,请检查仓库档案是否维护存货大类!");
} }
DaoUtils.insert(HGKC001.INSERT, newKc001); DaoUtils.insert(HGKC001.INSERT, newKc001);
// 更新库存数量 // 更新库存数量
......
...@@ -7,6 +7,8 @@ import com.baosight.iplat4j.core.ei.EiColumn; ...@@ -7,6 +7,8 @@ import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase; import com.baosight.iplat4j.core.data.DaoEPBase;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import com.baosight.iplat4j.core.util.StringUtils; import com.baosight.iplat4j.core.util.StringUtils;
/** /**
...@@ -584,6 +586,43 @@ public class HGPZ005 extends DaoEPBase { ...@@ -584,6 +586,43 @@ public class HGPZ005 extends DaoEPBase {
} }
/** /**
* 用于材料计划对比物料数据库是否存在不同,存在时就新录入一条
* @param o
* @return
*/
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
HGPZ005 hgpz005 = (HGPZ005) o;
return Objects.equals(inventName, hgpz005.inventName)
&& Objects.equals(spec, hgpz005.spec)
&& Objects.equals(length, hgpz005.length)
&& Objects.equals(width, hgpz005.width)
&& Objects.equals(thick, hgpz005.thick)
&& Objects.equals(material, hgpz005.material);
}
@Override
public int hashCode() {
return Objects.hash(inventName, spec, length, width, thick, material);
}
/**
* 用于不同的字段生成新的实体后,赋值
* @param newEntity
* @return
*/
public void setEntityValue(HGPZ005 newEntity) {
this.setInventName(newEntity.getInventName());
this.setSpec(newEntity.getSpec());
this.setLength(newEntity.getLength());
this.setWidth(newEntity.getWidth());
this.setThick(newEntity.getThick());
this.setMaterial(newEntity.getMaterial());
}
/**
* get the value from Map. * get the value from Map.
* *
* @param map - source data map * @param map - source data map
......
...@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.sc.service; ...@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.InventTypeDetailEnum; import com.baosight.hggp.common.InventTypeDetailEnum;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
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.domain.HGCG001A;
...@@ -230,6 +231,7 @@ public class ServiceHGSC009A extends ServiceBase { ...@@ -230,6 +231,7 @@ public class ServiceHGSC009A extends ServiceBase {
List<HGPZ005> hgpz005List = HGPZTools.HgPz005.listByInventCodes(inventCodes); List<HGPZ005> hgpz005List = HGPZTools.HgPz005.listByInventCodes(inventCodes);
if(CollectionUtils.isNotEmpty(hgpz005List)){ if(CollectionUtils.isNotEmpty(hgpz005List)){
pz005Map = hgpz005List.stream().collect(Collectors.toMap(HGPZ005::getInventCode, item -> item)); pz005Map = hgpz005List.stream().collect(Collectors.toMap(HGPZ005::getInventCode, item -> item));
pz005MapComparison(pz005Map,hgsc009AList);
} }
} }
// 数据校验 // 数据校验
...@@ -280,6 +282,23 @@ public class ServiceHGSC009A extends ServiceBase { ...@@ -280,6 +282,23 @@ public class ServiceHGSC009A extends ServiceBase {
return inInfo; return inInfo;
} }
private void pz005MapComparison(Map<String, HGPZ005> pz005Map, List<HGSC009A> hgsc009AList) {
hgsc009AList.forEach(hgsc009A -> {
HGPZ005 oldHgpz005 = pz005Map.get(hgsc009A.getInventCode());
HGPZ005 newHgpz005 = new HGPZ005();
BeanUtils.copyProperties(hgsc009A,newHgpz005,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
//存在名称、材质、规格、长宽厚不一致的,则新增一条物料数据库数据
if(!oldHgpz005.equals(newHgpz005)){
oldHgpz005.setInventCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.INVENT_CODE));
oldHgpz005.setEntityValue(newHgpz005);
oldHgpz005.setId(null);
DaoUtils.insert(HGPZ005.INSERT, oldHgpz005);
hgsc009A.setInventCode(oldHgpz005.getInventCode());
pz005Map.put(oldHgpz005.getInventCode(),oldHgpz005);
}
});
}
private void checkInsertcgData(List<HGSC009> hgsc009List) { private void checkInsertcgData(List<HGSC009> hgsc009List) {
List<Long> materialPlanIds = hgsc009List.stream().map(HGSC009::getId).collect(Collectors.toList()); List<Long> materialPlanIds = hgsc009List.stream().map(HGSC009::getId).collect(Collectors.toList());
List<HGCG001> hgcg001List = HGCGTools.HgCg001.listByMaterialPlanIds(materialPlanIds); List<HGCG001> hgcg001List = HGCGTools.HgCg001.listByMaterialPlanIds(materialPlanIds);
......
$(function () { $(function () {
var companyCodeBox = __eiInfo.getBlock("roleCompany").getMappedRows();
var projCodeBox = __eiInfo.getBlock("projRecordByRole_block_id").getMappedRows();
IPLATUI.EFGrid = { IPLATUI.EFGrid = {
"result": { "result": {
exportGrid: false, // 隐藏右侧自定义导出按钮 exportGrid: false, // 隐藏右侧自定义导出按钮
...@@ -15,21 +16,126 @@ $(function () { ...@@ -15,21 +16,126 @@ $(function () {
let template = ''; let template = '';
if (!isBlank(item.id)){ if (!isBlank(item.id)){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ', ' + item.status + ')" >详情</a>'; + 'onclick="showDetail(' + item.id + ', ' + item.status + ', ' + item.source + ')" >详情</a>';
} }
return template; return template;
} }
}, {
field: "companyCode",
title: "公司编码",
template: function (dataItem) {
for (let i = 0; i < companyCodeBox.length; i++) {
if (companyCodeBox[i]['companyCode'] === dataItem['companyCode']) {
return companyCodeBox[i]['companyCode'];
}
}
return dataItem["companyCode"];
}
}, {
field: "projCode",
title: "项目编码",
template: function (dataItem) {
for (let i = 0; i < projCodeBox.length; i++) {
if (projCodeBox[i]['valueField'] === dataItem['projCode']) {
dataItem['projName'] = projCodeBox[i]['textField']
return projCodeBox[i]['valueField'];
}
}
return dataItem["projCode"];
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-companyCode", options.model["companyCode"]);
inInfo.set("inqu_status-0-approvalStatus", 2);
inInfo.set("field", options.field);
EiCommunicator.send("HGSC003", "projComboBox", inInfo, {
onSuccess: function (ei) {
projCodeBox = ei.getBlock("projRecordByRole_block_id").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: projCodeBox,
minLength: 0,
dataTextField: "textField",
dataValueField: "valueField",
optionLabelTemplate: "[#:valueField#]#:textField#",
valueTemplate: "[#:valueField#]#:textField#",
template: "[#:valueField#]#:textField#",
filter: "contains"
});
}
} }
], ],
beforeEdit: function (e) { beforeEdit: function (e) {
let item = e.model; let item = e.model;
if(item.status != '0'){ //只有生成的不能编辑
e.preventDefault(); if(item.source === '0'){
//选择指定列不让修改
for (let i = 0; i < e.sender.columns.length; i++) {
//指定的列不让修改
if (e.sender.columns[i]["name"] === "companyCode") {
e.sender.columns[i]["enable"] = false;
e.sender.columns[i]["readonly"] = true;
}
if (e.sender.columns[i]["name"] === "projCode") {
e.sender.columns[i]["enable"] = false;
e.sender.columns[i]["readonly"] = true;
}
if (e.sender.columns[i]["name"] === "planDate") {
e.sender.columns[i]["enable"] = false;
e.sender.columns[i]["readonly"] = true;
}
}
}else{
//手动添加的需要修改
for (let i = 0; i < e.sender.columns.length; i++) {
//指定的列不让修改
if (e.sender.columns[i]["name"] === "companyCode") {
e.sender.columns[i]["enable"] = true;
e.sender.columns[i]["readonly"] = false;
}
if (e.sender.columns[i]["name"] === "projCode") {
e.sender.columns[i]["enable"] = true;
e.sender.columns[i]["readonly"] = false;
}
if (e.sender.columns[i]["name"] === "planDate") {
e.sender.columns[i]["enable"] = true;
e.sender.columns[i]["readonly"] = false;
}
}
} }
}, },
loadComplete: function (grid) { loadComplete: function (grid) {
// 提交 // 提交
$(document.body).on("click", "#SUBMIT", submit); $(document.body).on("click", "#SUBMIT", submit);
// change事件
grid.dataSource.bind("change", function (e) {
if (e.field == "companyCode") {
for (let i = 0; i < companyCodeBox.length; i++) {
if (companyCodeBox[i]['companyCode'] === e.items[0]['companyCode']) {
resultGrid.setCellValue(e.items[0],"companyName",companyCodeBox[i]['companyName']);
}
}
}
if (e.field == "projCode") {
for (let i = 0; i < projCodeBox.length; i++) {
if (projCodeBox[i]['valueField'] === e.items[0]['projCode']) {
resultGrid.setCellValue(e.items[0],"projName",projCodeBox[i]['textField']);
}
}
}
});
},
onAdd: function (e) {
$.each(e.items, function (index, item) {
item['status'] = 0;
});
}, },
onSave: function (e) { onSave: function (e) {
// 阻止后台请求,使用自定义 // 阻止后台请求,使用自定义
...@@ -76,12 +182,12 @@ let save = function () { ...@@ -76,12 +182,12 @@ let save = function () {
return; return;
} }
for (let i = 0; i < rows.length; i++) { for (let i = 0; i < rows.length; i++) {
if (!isPositiveNumber(rows[i]['purQty'])) { if (isBlank(rows[i]['companyCode'])) {
message("勾选的第" + (i + 1) + "行采购数量必须是大于0的数字"); message("勾选的第" + (i + 1) + "行公司编号不能为空");
return; return;
} }
if (!isPositiveNumber(rows[i]['purWeight'])) { if (isBlank(rows[i]['projCode'])) {
message("勾选的第" + (i + 1) + "行采购重量必须是大于0的数字"); message("勾选的第" + (i + 1) + "行项目编号不能为空");
return; return;
} }
if (rows[i]['status']!='0') { if (rows[i]['status']!='0') {
...@@ -155,9 +261,9 @@ function windowCallback() { ...@@ -155,9 +261,9 @@ function windowCallback() {
/** /**
* 显示详情 * 显示详情
*/ */
function showDetail(id,status) { function showDetail(id,status,source) {
JSColorbox.open({ JSColorbox.open({
href: "HGCG001A?methodName=initLoad&inqu_status-0-primaryId=" + id+"&inqu_status-0-status="+status, href: "HGCG001A?methodName=initLoad&inqu_status-0-primaryId=" + id+"&inqu_status-0-status="+status+"&source="+source,
title: "<div style='text-align: center;'>详情</div>", title: "<div style='text-align: center;'>详情</div>",
width: "80%", width: "80%",
height: "80%", height: "80%",
......
...@@ -21,6 +21,10 @@ ...@@ -21,6 +21,10 @@
</EF:EFSelect> </EF:EFSelect>
</div> </div>
<div class="row"> <div class="row">
<EF:EFSelect cname="数据来源" blockId="inqu_status" ename="source" row="0" colWidth="3" optionLabel="全部"
defultValue="">
<EF:EFCodeOption codeName="hggp.hpcg.receiveSource"/>
</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">
...@@ -32,19 +36,28 @@ ...@@ -32,19 +36,28 @@
<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="operator" cname="操作" locked="true" enable="false" width="80" align="center"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/> <EF:EFComboColumn ename="source" cname="数据来源" enable="false" width="80" align="center">
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/> <EF:EFCodeOption codeName="hggp.hpcg.receiveSource"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="100" align="center" hidden="true"/> </EF:EFComboColumn>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="130" align="center"/> <EF:EFComboColumn ename="companyCode" cname="公司编码"
<EF:EFColumn ename="planDate" cname="计划日期" enable="false" width="100" align="center" editType="date" columnTemplate="#=companyName#" itemTemplate="#=companyName#"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/> textField="companyName" valueField="companyCode"
maxLength="16" readonly="false" width="100" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/>
</EF:EFComboColumn>
<EF:EFColumn ename="companyName" cname="公司名称" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="true" width="120" align="center" required="true"/>
<EF:EFColumn ename="projName" cname="项目名称" width="120" align="center" enable="false"/>
<EF:EFColumn ename="planDate" cname="计划日期" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center"/> <EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center"/>
<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="purQty" cname="采购数量" enable="false" width="120" align="right" format="{0:N3}" /> <EF:EFColumn ename="purQty" cname="采购数量" enable="false" width="120" align="right" format="{0:N3}" defaultValue="0"/>
<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}" defaultValue="0"/>
<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}" defaultValue="0"/>
<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 () { $(function () {
var inventRecordBoxBlockId = __eiInfo.getBlock("invent_record_box_block_id").getMappedRows();
IPLATUI.EFGrid = { IPLATUI.EFGrid = {
"result": { "result": {
exportGrid: false, // 隐藏右侧自定义导出按钮 exportGrid: false, // 隐藏右侧自定义导出按钮
...@@ -8,15 +8,103 @@ $(function () { ...@@ -8,15 +8,103 @@ $(function () {
pageSizes: [20, 50, 70, 100], pageSizes: [20, 50, 70, 100],
}, },
columns: [ columns: [
{
field: "inventCode",
template: function (item) {
let template = item.inventCode;
if(item.inventCode){
for(let i=0;i<inventRecordBoxBlockId.length;i++){
if(item.inventCode === inventRecordBoxBlockId[i]['valueField']){
template = inventRecordBoxBlockId[i]['valueField'];
}else{
template = item.inventCode;
}
}
}
return template;
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("field", options.field);
let dataSource = inventRecordBoxBlockId;
EiCommunicator.send("HGPZ005", "queryInventCodeProdTypeFourBox", inInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("invent_record_box_block_id").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: dataSource,
minLength: 0,
dataTextField: "textField",
dataValueField: "valueField",
optionLabelTemplate: "[#:valueField#]#:textField#",
valueTemplate: "[#:valueField#]#:textField#",
template: "[#:valueField#]#:textField#|#:param4Field#",
filter: "contains"
});
}
},
{
field: "primaryId",
template: function (item) {
item['primaryId'] =$("#inqu_status-0-primaryId").val();
return $("#inqu_status-0-primaryId").val();
}
}
], ],
beforeEdit: function (e) { beforeEdit: function (e) {
var status = $("#inqu_status-0-status").val(); var status = $("#inqu_status-0-status").val();
if(status != '0'){ if(status != '0'){
e.preventDefault(); e.preventDefault();
} }
let item = e.model;
//只有合同生成的不能编辑
if(item.source === '0'){
//选择收货的指定列不让修改
for (let i = 0; i < e.sender.columns.length; i++) {
//指定的列不让修改
if (e.sender.columns[i]["name"] === "inventCode") {
e.sender.columns[i]["enable"] = false;
e.sender.columns[i]["readonly"] = true;
}
}
}else{
//手动添加的需要修改
for (let i = 0; i < e.sender.columns.length; i++) {
//指定的列不让修改
if (e.sender.columns[i]["name"] === "inventCode") {
e.sender.columns[i]["enable"] = true;
e.sender.columns[i]["readonly"] = false;
}
}
}
}, },
loadComplete: function (grid) { loadComplete: function (grid) {
// 此grid对象
grid.dataSource.bind("change", function (e) {
if (e.field === "inventCode") {
for (let i = 0; i < inventRecordBoxBlockId.length; i++) {
if (inventRecordBoxBlockId[i]['valueField'] === e.items[0].inventCode) {
resultGrid.setCellValue(e.items[0], 'inventName', inventRecordBoxBlockId[i]['textField'])
resultGrid.setCellValue(e.items[0], 'inventTypeDetail', inventRecordBoxBlockId[i]['param1Field'])
resultGrid.setCellValue(e.items[0], 'inventType', inventRecordBoxBlockId[i]['param3Field'])
resultGrid.setCellValue(e.items[0], 'spec', inventRecordBoxBlockId[i]['param4Field'])
resultGrid.setCellValue(e.items[0], 'material', inventRecordBoxBlockId[i]['param5Field'])
resultGrid.setCellValue(e.items[0], 'unit', inventRecordBoxBlockId[i]['param6Field'])
resultGrid.setCellValue(e.items[0], 'length', inventRecordBoxBlockId[i]['param7Field'])
resultGrid.setCellValue(e.items[0], 'width', inventRecordBoxBlockId[i]['param8Field'])
resultGrid.setCellValue(e.items[0], 'thick', inventRecordBoxBlockId[i]['param9Field'])
break
}
}
}
})
}, },
onSave: function (e) { onSave: function (e) {
// 阻止后台请求,使用自定义 // 阻止后台请求,使用自定义
...@@ -45,6 +133,28 @@ $(window).load(function () { ...@@ -45,6 +133,28 @@ $(window).load(function () {
query(); query();
//存货编号查询条件 //存货编号查询条件
initInventCode(); initInventCode();
let status = $("#inqu_status-0-status").val();
if(status != '0'){
$(".k-grid-add").hide();
$(".k-grid-save-changes").hide();
$(".k-grid-cancel-changes").hide();
$(".k-grid-delete").hide();
}else {
//合同选择的存货不让新增、删除
var source = $("#source").val();
if(source === '0'){
$(".k-grid-save-changes").hide();
$(".k-grid-delete").hide();
}
}
//合同选择的存货不让新增、删除
var source = $("#source").val();
if(source === '0'){
$(".k-grid-add").hide();
$(".k-grid-delete").hide();
}
}); });
/** /**
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<EF:EFInput ename="inqu_status-0-status" cname="状态" colWidth="3" type="hidden"/> <EF:EFInput ename="inqu_status-0-status" cname="状态" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-planDate" cname="计划日期" colWidth="3" type="hidden"/> <EF:EFInput ename="inqu_status-0-planDate" cname="计划日期" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-planNo" cname="计划单号" colWidth="3" type="hidden"/> <EF:EFInput ename="inqu_status-0-planNo" cname="计划单号" colWidth="3" type="hidden"/>
<EF:EFInput ename="source" cname="数据来源" colWidth="3" type="hidden"/>
<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="" template="[#=valueField#]#=textField#"> filter="contains" optionLabel="全部" defultValue="" template="[#=valueField#]#=textField#">
...@@ -34,22 +35,23 @@ ...@@ -34,22 +35,23 @@
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" required="true" cname="存货编号" />
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/> <EF:EFColumn ename="inventName" cname="存货名称" width="120" align="center" required="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="false" <EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="false"
blockName="invent_type_box_block_id" textField="textField" valueField="valueField" blockName="invent_type_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true" columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true"
filter="contains" enable="false" > filter="contains" enable="false" >
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/> <EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center" required="true"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" required="true"/> <EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" 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="material" cname="材质" width="80" align="center" required="true"/>
<EF:EFColumn ename="unit" 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="length" cname="长(MM)" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="width" cname="宽(MM)" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="thick" cname="厚(MM)" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="remarks" cname="备注" width="150" enable="false"/> <EF:EFColumn ename="remarks" cname="备注" width="150" enable="false"/>
<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"/>
...@@ -57,6 +59,7 @@ ...@@ -57,6 +59,7 @@
<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="primaryId" cname="主表id" enable="false" width="100" align="center" hidden="true"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
......
$(function () { $(function () {
var userByCompany = __eiInfo.getBlock("userByCompany").getMappedRows(); var userByCompany = __eiInfo.getBlock("userByCompany").getMappedRows();
var companyCodeBox = __eiInfo.getBlock("roleCompany").getMappedRows();
var projCodeBox = __eiInfo.getBlock("projRecordByRole_block_id").getMappedRows();
IPLATUI.EFGrid = { IPLATUI.EFGrid = {
"result": { "result": {
exportGrid: false, // 隐藏右侧自定义导出按钮 exportGrid: false, // 隐藏右侧自定义导出按钮
...@@ -12,16 +13,72 @@ $(function () { ...@@ -12,16 +13,72 @@ $(function () {
{ {
field: "operator", field: "operator",
title: "操作", title: "操作",
width: 120,
template: function (item) { template: function (item) {
let template = ''; let template = '';
if (!isBlank(item.id)){ if (!isBlank(item.id)){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ', ' + item.status + ')" >详情</a>'; + 'onclick="showDetail(' + item.id + ', ' + item.status + ',0, ' + item.source + ')" >详情</a>';
}
if (!isBlank(item.id)){
//待审核、审核通过的,可以进行合同变更
if(item.status == 0 || item.status == 2)
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ', ' + item.status + ', 1, ' + item.source + ')" >合同变更</a>';
} }
return template; return template;
} }
}, {
field: "companyCode",
title: "公司编码",
template: function (dataItem) {
for (let i = 0; i < companyCodeBox.length; i++) {
if (companyCodeBox[i]['companyCode'] === dataItem['companyCode']) {
return companyCodeBox[i]['companyCode'];
}
}
return dataItem["companyCode"];
}
}, {
field: "projCode",
title: "项目编码",
template: function (dataItem) {
for (let i = 0; i < projCodeBox.length; i++) {
if (projCodeBox[i]['valueField'] === dataItem['projCode']) {
dataItem['projName'] = projCodeBox[i]['textField']
return projCodeBox[i]['valueField'];
}
}
return dataItem["projCode"];
}, },
{ editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-companyCode", options.model["companyCode"]);
inInfo.set("inqu_status-0-approvalStatus", 2);
inInfo.set("field", options.field);
EiCommunicator.send("HGSC003", "projComboBox", inInfo, {
onSuccess: function (ei) {
projCodeBox = ei.getBlock("projRecordByRole_block_id").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: projCodeBox,
minLength: 0,
dataTextField: "textField",
dataValueField: "valueField",
optionLabelTemplate: "[#:valueField#]#:textField#",
valueTemplate: "[#:valueField#]#:textField#",
template: "[#:valueField#]#:textField#",
filter: "contains"
});
}
},{
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++) {
...@@ -67,6 +124,42 @@ $(function () { ...@@ -67,6 +124,42 @@ $(function () {
if(item.status != '0'){ if(item.status != '0'){
e.preventDefault(); e.preventDefault();
} }
//只有生成的不能编辑
if(item.source === '0'){
//选择指定列不让修改
for (let i = 0; i < e.sender.columns.length; i++) {
//指定的列不让修改
if (e.sender.columns[i]["name"] === "companyCode") {
e.sender.columns[i]["enable"] = false;
e.sender.columns[i]["readonly"] = true;
}
if (e.sender.columns[i]["name"] === "projCode") {
e.sender.columns[i]["enable"] = false;
e.sender.columns[i]["readonly"] = true;
}
if (e.sender.columns[i]["name"] === "contractDate") {
e.sender.columns[i]["enable"] = false;
e.sender.columns[i]["readonly"] = true;
}
}
}else{
//手动添加的需要修改
for (let i = 0; i < e.sender.columns.length; i++) {
//指定的列不让修改
if (e.sender.columns[i]["name"] === "companyCode") {
e.sender.columns[i]["enable"] = true;
e.sender.columns[i]["readonly"] = false;
}
if (e.sender.columns[i]["name"] === "projCode") {
e.sender.columns[i]["enable"] = true;
e.sender.columns[i]["readonly"] = false;
}
if (e.sender.columns[i]["name"] === "contractDate") {
e.sender.columns[i]["enable"] = true;
e.sender.columns[i]["readonly"] = false;
}
}
}
}, },
loadComplete: function (grid) { loadComplete: function (grid) {
// 提交 // 提交
...@@ -81,6 +174,20 @@ $(function () { ...@@ -81,6 +174,20 @@ $(function () {
if (e.field == "taxRate") { if (e.field == "taxRate") {
calAmount(item); calAmount(item);
} }
if (e.field === "companyCode") {
for (let i = 0; i < companyCodeBox.length; i++) {
if (companyCodeBox[i]['companyCode'] === e.items[0]['companyCode']) {
resultGrid.setCellValue(e.items[0],"companyName",companyCodeBox[i]['companyName']);
}
}
}
if (e.field === "projCode") {
for (let i = 0; i < projCodeBox.length; i++) {
if (projCodeBox[i]['valueField'] === e.items[0]['projCode']) {
resultGrid.setCellValue(e.items[0],"projName",projCodeBox[i]['textField']);
}
}
}
}); });
}, },
onSave: function (e) { onSave: function (e) {
...@@ -292,9 +399,9 @@ let selectPlanCallback = function () { ...@@ -292,9 +399,9 @@ let selectPlanCallback = function () {
/** /**
* 显示详情 * 显示详情
*/ */
function showDetail(id,status) { function showDetail(id,status,updateFlag,source) {
JSColorbox.open({ JSColorbox.open({
href: "HGCG002B?methodName=initLoad&inqu_status-0-primaryId=" + id+"&inqu_status-0-status="+status, href: "HGCG002B?methodName=initLoad&inqu_status-0-primaryId=" + id+"&inqu_status-0-status="+status+"&updateFlag="+updateFlag+"&source="+source,
title: "<div style='text-align: center;'>详情</div>", title: "<div style='text-align: center;'>详情</div>",
width: "80%", width: "80%",
height: "80%", height: "80%",
......
...@@ -31,21 +31,36 @@ ...@@ -31,21 +31,36 @@
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>
<div class="row">
<EF:EFSelect cname="数据来源" blockId="inqu_status" ename="source" row="0" colWidth="3" optionLabel="全部"
defultValue="">
<EF:EFCodeOption codeName="hggp.hpcg.receiveSource"/>
</EF:EFSelect>
</div>
</EF:EFRegion> </EF:EFRegion>
<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="operator" cname="操作" locked="true" enable="false" width="80" align="center"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/> <EF:EFComboColumn ename="source" cname="数据来源" enable="false" width="80" align="center" defaultValue="1">
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/> <EF:EFCodeOption codeName="hggp.hpcg.receiveSource"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="100" align="center" hidden="true"/> </EF:EFComboColumn>
<EF:EFComboColumn ename="companyCode" cname="公司编码"
columnTemplate="#=companyName#" itemTemplate="#=companyName#"
textField="companyName" valueField="companyCode"
maxLength="16" readonly="false" width="100" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/>
</EF:EFComboColumn>
<EF:EFColumn ename="companyName" cname="公司名称" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="projCode" cname="项目编码" width="100" align="center" required="true"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="130" align="center"/> <EF:EFColumn ename="projName" 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="合同日期" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="contractNo" cname="合同号" enable="false" width="120" align="center"/> <EF:EFColumn ename="contractNo" cname="合同号" enable="false" width="120" align="center"/>
<%-- <EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center"/>--%> <%-- <EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center"/>--%>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center"> <EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center" defaultValue="0">
<EF:EFCodeOption codeName="hggp.hgcg.contractStatus" condition="ITEM_CODE IN ('0','2','4','5')"/> <EF:EFCodeOption codeName="hggp.hgcg.contractStatus" condition="ITEM_CODE IN ('0','2','4','5')"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="supCode" cname="供应商名称" width="120" align="left" defaultValue="" <EF:EFComboColumn ename="supCode" cname="供应商名称" width="120" align="left" defaultValue=""
...@@ -54,12 +69,12 @@ ...@@ -54,12 +69,12 @@
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="120" align="center" hidden="true"/> <EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="purUserName" cname="采购员" width="120" align="center" required="true"/> <EF:EFColumn ename="purUserName" cname="采购员" width="120" align="center" required="true"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" enable="false"/> <EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" enable="false" defaultValue="0"/>
<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" defaultValue="0"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="120" align="right" format="{0:N3}"/> <EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="120" align="right" format="{0:N3}" defaultValue="0"/>
<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}" defaultValue="0"/>
<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}" defaultValue="0"/>
<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}" defaultValue="0"/>
<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 () { $(function () {
var userByCompany = __eiInfo.getBlock("userByCompany").getMappedRows(); var userByCompany = __eiInfo.getBlock("userByCompany").getMappedRows();
var inventRecordBoxBlockId = __eiInfo.getBlock("invent_record_box_block_id").getMappedRows();
IPLATUI.EFGrid = { IPLATUI.EFGrid = {
"result": { "result": {
exportGrid: false, // 隐藏右侧自定义导出按钮 exportGrid: false, // 隐藏右侧自定义导出按钮
...@@ -10,6 +10,55 @@ $(function () { ...@@ -10,6 +10,55 @@ $(function () {
}, },
columns: [ columns: [
{ {
field: "inventCode",
template: function (item) {
let template = item.inventCode;
if(item.inventCode){
for(let i=0;i<inventRecordBoxBlockId.length;i++){
if(item.inventCode === inventRecordBoxBlockId[i]['valueField']){
template = inventRecordBoxBlockId[i]['valueField'];
}else{
template = item.inventCode;
}
}
}
return template;
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("field", options.field);
let dataSource = inventRecordBoxBlockId;
EiCommunicator.send("HGPZ005", "queryInventCodeProdTypeFourBox", inInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("invent_record_box_block_id").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: dataSource,
minLength: 0,
dataTextField: "textField",
dataValueField: "valueField",
optionLabelTemplate: "[#:valueField#]#:textField#",
valueTemplate: "[#:valueField#]#:textField#",
template: "[#:valueField#]#:textField#|#:param4Field#",
filter: "contains"
});
}
},
{
field: "primaryId",
template: function (item) {
item['primaryId'] =$("#inqu_status-0-primaryId").val();
return $("#inqu_status-0-primaryId").val();
}
},
{
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++) {
...@@ -52,9 +101,47 @@ $(function () { ...@@ -52,9 +101,47 @@ $(function () {
], ],
beforeEdit: function (e) { beforeEdit: function (e) {
var status = $("#inqu_status-0-status").val(); var status = $("#inqu_status-0-status").val();
if(status != '0'){ let updateFlag = $("#updateFlag").val();
if(updateFlag == 0){
e.preventDefault(); e.preventDefault();
} }
let item = e.model;
//只有生成的不能编辑
if(item.source === '0'){
//选择指定列不让修改
for (let i = 0; i < e.sender.columns.length; i++) {
//指定的列不让修改
if (e.sender.columns[i]["name"] === "inventCode") {
e.sender.columns[i]["enable"] = false;
e.sender.columns[i]["readonly"] = true;
}
if (e.sender.columns[i]["name"] === "purWeight") {
e.sender.columns[i]["enable"] = false;
e.sender.columns[i]["readonly"] = true;
}
if (e.sender.columns[i]["name"] === "purQty") {
e.sender.columns[i]["enable"] = false;
e.sender.columns[i]["readonly"] = true;
}
}
}else{
//手动添加的需要修改
for (let i = 0; i < e.sender.columns.length; i++) {
//指定的列可以修改
if (e.sender.columns[i]["name"] === "inventCode") {
e.sender.columns[i]["enable"] = true;
e.sender.columns[i]["readonly"] = false;
}
if (e.sender.columns[i]["name"] === "purWeight") {
e.sender.columns[i]["enable"] = true;
e.sender.columns[i]["readonly"] = false;
}
if (e.sender.columns[i]["name"] === "purQty") {
e.sender.columns[i]["enable"] = true;
e.sender.columns[i]["readonly"] = false;
}
}
}
}, },
loadComplete: function (grid) { loadComplete: function (grid) {
// change事件 // change事件
...@@ -66,6 +153,22 @@ $(function () { ...@@ -66,6 +153,22 @@ $(function () {
if (e.field == "taxRate") { if (e.field == "taxRate") {
calAmount(item); calAmount(item);
} }
if (e.field === "inventCode") {
for (let i = 0; i < inventRecordBoxBlockId.length; i++) {
if (inventRecordBoxBlockId[i]['valueField'] === e.items[0].inventCode) {
resultGrid.setCellValue(e.items[0], 'inventName', inventRecordBoxBlockId[i]['textField'])
resultGrid.setCellValue(e.items[0], 'inventTypeDetail', inventRecordBoxBlockId[i]['param1Field'])
resultGrid.setCellValue(e.items[0], 'inventType', inventRecordBoxBlockId[i]['param3Field'])
resultGrid.setCellValue(e.items[0], 'spec', inventRecordBoxBlockId[i]['param4Field'])
resultGrid.setCellValue(e.items[0], 'material', inventRecordBoxBlockId[i]['param5Field'])
resultGrid.setCellValue(e.items[0], 'unit', inventRecordBoxBlockId[i]['param6Field'])
resultGrid.setCellValue(e.items[0], 'length', inventRecordBoxBlockId[i]['param7Field'])
resultGrid.setCellValue(e.items[0], 'width', inventRecordBoxBlockId[i]['param8Field'])
resultGrid.setCellValue(e.items[0], 'thick', inventRecordBoxBlockId[i]['param9Field'])
break
}
}
}
}); });
}, },
onSave: function (e) { onSave: function (e) {
...@@ -135,6 +238,22 @@ $(window).load(function () { ...@@ -135,6 +238,22 @@ $(window).load(function () {
query(); query();
initInventCode(); initInventCode();
let status = $("#inqu_status-0-status").val();
let updateFlag = $("#updateFlag").val();
//只有审核的、合同变更的可以修改
if(updateFlag == 0){
$(".k-grid-add").hide();
$(".k-grid-save-changes").hide();
$(".k-grid-cancel-changes").hide();
$(".k-grid-delete").hide();
}else{
//如果不是手动录入的,并且没生成收款单的,不能新增、删除
let source = $("#source").val();
if(source == 0){
$(".k-grid-add").hide();
$(".k-grid-delete").hide();
}
}
}); });
...@@ -191,7 +310,7 @@ let save = function () { ...@@ -191,7 +310,7 @@ let save = function () {
} }
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () { ok: function () {
JSUtils.submitGridsData("result", save, "remove", JSUtils.submitGridsData("result", "HGCG002B", "save",
true, function (e) { true, function (e) {
var status = e.getStatus(); var status = e.getStatus();
if (status !== -1) { if (status !== -1) {
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
<EF:EFRegion id="inqu" 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-primaryId" cname="主表id" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-status" cname="状态" colWidth="3" type="hidden"/> <EF:EFInput ename="inqu_status-0-status" cname="状态" colWidth="3" type="hidden"/>
<EF:EFInput ename="updateFlag" cname="合同变更标记" colWidth="3" type="hidden"/>
<EF:EFInput ename="source" cname="数据来源" colWidth="3" type="hidden"/>
<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="" template="[#=valueField#]#=textField#"> filter="contains" optionLabel="全部" defultValue="" template="[#=valueField#]#=textField#">
...@@ -24,17 +26,18 @@ ...@@ -24,17 +26,18 @@
<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="inventCode" cname="存货编码" enable="false" width="100" align="center"/> <EF:EFColumn ename="inventCode" required="true" cname="存货编号" />
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/> <EF:EFColumn ename="inventName" cname="存货名称" width="120" align="center" required="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="false" <EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="false"
blockName="invent_type_box_block_id" textField="textField" valueField="valueField" blockName="invent_type_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true" columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true"
filter="contains" enable="false" > filter="contains" enable="false" >
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/> <EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" enable="false"/> <EF:EFColumn ename="spec" cname="规格" width="120" align="center" required="true"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" enable="false"/> <EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" required="true" defaultValue="0"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="120" align="right" format="{0:N3}"/> <EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" required="true" defaultValue="0"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="120" align="right" format="{0:N3}" defaultValue="0"/>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" required="true"/> <EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFComboColumn ename="taxRate" cname="税率(%)" enable="true" width="80" align="center" required="true"> <EF:EFComboColumn ename="taxRate" cname="税率(%)" enable="true" width="80" align="center" required="true">
<EF:EFCodeOption codeName="hggp.cw.taxPoints" /> <EF:EFCodeOption codeName="hggp.cw.taxPoints" />
...@@ -42,16 +45,15 @@ ...@@ -42,16 +45,15 @@
<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="material" cname="材质" width="80" align="center" required="true"/>
<EF:EFColumn ename="unit" 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="length" cname="长(MM)" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="width" cname="宽(MM)" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="thick" cname="厚(MM)" width="80" align="right" format="{0:N3}" required="true"/>
<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: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" 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" <EF:EFColumn ename="contractDate" cname="合同日期" enable="false" width="100" align="center" editType="date"
......
...@@ -94,10 +94,9 @@ $(function () { ...@@ -94,10 +94,9 @@ $(function () {
inInfo.set("inqu_status-0-companyCode", options.model["companyCode"]); inInfo.set("inqu_status-0-companyCode", options.model["companyCode"]);
inInfo.set("inqu_status-0-approvalStatus", 2); inInfo.set("inqu_status-0-approvalStatus", 2);
inInfo.set("field", options.field); inInfo.set("field", options.field);
let dataSource;
EiCommunicator.send("HGSC003", "projComboBox", inInfo, { EiCommunicator.send("HGSC003", "projComboBox", inInfo, {
onSuccess: function (ei) { onSuccess: function (ei) {
dataSource = ei.getBlock("projRecordByRole_block_id").getMappedRows(); projCodeBox = ei.getBlock("projRecordByRole_block_id").getMappedRows();
}, },
onFail: function (ei) { onFail: function (ei) {
} }
...@@ -107,7 +106,7 @@ $(function () { ...@@ -107,7 +106,7 @@ $(function () {
input.attr("id", options.field); input.attr("id", options.field);
input.appendTo(container); input.appendTo(container);
input.kendoDropDownList({ input.kendoDropDownList({
dataSource: dataSource, dataSource: projCodeBox,
minLength: 0, minLength: 0,
dataTextField: "textField", dataTextField: "textField",
dataValueField: "valueField", dataValueField: "valueField",
...@@ -263,7 +262,7 @@ let save = function () { ...@@ -263,7 +262,7 @@ let save = function () {
} }
for (let i = 0; i < rows.length; i++) { for (let i = 0; i < rows.length; i++) {
if (isBlank(rows[i]['companyCode'])) { if (isBlank(rows[i]['companyCode'])) {
message("勾选的第" + (i + 1) + "行公司编号名称不能为空"); message("勾选的第" + (i + 1) + "行公司编号不能为空");
return; return;
} }
if (isBlank(rows[i]['supCode'])) { if (isBlank(rows[i]['supCode'])) {
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/> <EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="companyName" cname="公司名称" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="companyName" cname="公司名称" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="true" width="120" align="center"/> <EF:EFColumn ename="projCode" cname="项目编码" enable="true" width="120" align="center" required="true"/>
<EF:EFColumn ename="projName" cname="项目名称" width="120" align="center" enable="false"/> <EF:EFColumn ename="projName" cname="项目名称" width="120" align="center" enable="false"/>
<EF:EFColumn ename="receiveDate" cname="收货日期" width="100" align="center" editType="date" <EF:EFColumn ename="receiveDate" cname="收货日期" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
......
...@@ -163,6 +163,20 @@ $(function () { ...@@ -163,6 +163,20 @@ $(function () {
locked: false locked: false
}, },
{ {
field: "projCode",
title: "项目编号",
headerTemplate: "<span style='color: '>项目编号 </span>",
enable: false,
locked: false
},
{
field: "projName",
title: "项目名称",
headerTemplate: "<span style='color: '>项目名称 </span>",
enable: false,
locked: false
},
{
field: "receiveNo", field: "receiveNo",
title: "收货编号", title: "收货编号",
headerTemplate: "<span style='color: '>收货编号 </span>", headerTemplate: "<span style='color: '>收货编号 </span>",
......
...@@ -44,17 +44,17 @@ ...@@ -44,17 +44,17 @@
<%-- </EF:EFComboColumn>--%> <%-- </EF:EFComboColumn>--%>
<EF:EFColumn ename="inventCode" required="true" cname="产品编号" /> <EF:EFColumn ename="inventCode" required="true" cname="产品编号" />
<EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/> <EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" width="120" align="center" enable="false" readonly="true" required="true"/> <EF:EFColumn ename="inventName" cname="存货名称" width="120" align="center" required="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="false" <EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="false"
blockName="invent_type_box_block_id" textField="textField" valueField="valueField" blockName="invent_type_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true" columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true"
filter="contains" enable="false" > filter="contains" enable="false" >
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="material" cname="材质" width="120" align="center" enable="false" readonly="true" required="true"/> <EF:EFColumn ename="material" cname="材质" width="120" align="center" required="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center" required="true" readonly="true" enable="false"/> <EF:EFColumn ename="spec" cname="规格" width="120" align="center" required="true"/>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="length" cname="长(MM)" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="width" cname="宽(MM)" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="thick" cname="厚(MM)" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="quantity" cname="数量" width="120" align="right" format="{0:N3}" <EF:EFColumn ename="quantity" cname="数量" width="120" align="right" format="{0:N3}"
defaultValue="0" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/" data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/"
......
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