Commit be677d66 by 宋祥

1.采购合同、采购收货手动录入的数据功能报错问题修复

parent 5e497113
...@@ -36,8 +36,10 @@ public class HGCG003B extends DaoEPBase { ...@@ -36,8 +36,10 @@ public class HGCG003B extends DaoEPBase {
public static final String FIELD_COMPANY_NAME = "companyName"; /* 公司名称*/ public static final String FIELD_COMPANY_NAME = "companyName"; /* 公司名称*/
public static final String FIELD_RECEIVE_DATE = "receiveDate"; /* 收货日期*/ public static final String FIELD_RECEIVE_DATE = "receiveDate"; /* 收货日期*/
public static final String FIELD_RECEIVE_NO = "receiveNo"; /* 收货单号*/ public static final String FIELD_RECEIVE_NO = "receiveNo"; /* 收货单号*/
public static final String FIELD_RECEIVE_LINE_NO = "receiveLineNo"; /* 收货单行号*/
public static final String FIELD_PLAN_NO = "planNo"; /* 计划单号*/ public static final String FIELD_PLAN_NO = "planNo"; /* 计划单号*/
public static final String FIELD_CONTRACT_NO = "contractNo"; /* 合同号*/ public static final String FIELD_CONTRACT_NO = "contractNo"; /* 合同号*/
public static final String FIELD_CONTRACT_LINE_NO = "contractLineNo"; /* 合同行号*/
public static final String FIELD_CONTRACT_DETAIL_ID = "contractDetailId"; /* 合同明细id*/ public static final String FIELD_CONTRACT_DETAIL_ID = "contractDetailId"; /* 合同明细id*/
public static final String FIELD_INVENT_TYPE = "inventType"; /* 存货类型*/ public static final String FIELD_INVENT_TYPE = "inventType"; /* 存货类型*/
public static final String FIELD_INVENT_CODE = "inventCode"; /* 存货编码*/ public static final String FIELD_INVENT_CODE = "inventCode"; /* 存货编码*/
...@@ -136,8 +138,10 @@ public class HGCG003B extends DaoEPBase { ...@@ -136,8 +138,10 @@ public class HGCG003B extends DaoEPBase {
private String companyName = " "; /* 公司名称*/ private String companyName = " "; /* 公司名称*/
private String receiveDate = " "; /* 收货日期*/ private String receiveDate = " "; /* 收货日期*/
private String receiveNo = " "; /* 收货单号*/ private String receiveNo = " "; /* 收货单号*/
private String receiveLineNo = " "; /* 收货单行号*/
private String planNo = " "; /* 计划单号*/ private String planNo = " "; /* 计划单号*/
private String contractNo = " "; /* 合同号*/ private String contractNo = " "; /* 合同号*/
private String contractLineNo = " "; /* 合同行号*/
private Long contractDetailId = new Long(0); /* 合同明细id*/ private Long contractDetailId = new Long(0); /* 合同明细id*/
private String inventType = " "; /* 存货类型*/ private String inventType = " "; /* 存货类型*/
private String inventCode = " "; /* 存货编码*/ private String inventCode = " "; /* 存货编码*/
...@@ -234,6 +238,10 @@ public class HGCG003B extends DaoEPBase { ...@@ -234,6 +238,10 @@ public class HGCG003B extends DaoEPBase {
eiColumn.setDescName("收货单号"); eiColumn.setDescName("收货单号");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_RECEIVE_LINE_NO);
eiColumn.setDescName("收货单行号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PLAN_NO); eiColumn = new EiColumn(FIELD_PLAN_NO);
eiColumn.setDescName("计划单号"); eiColumn.setDescName("计划单号");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -242,6 +250,10 @@ public class HGCG003B extends DaoEPBase { ...@@ -242,6 +250,10 @@ public class HGCG003B extends DaoEPBase {
eiColumn.setDescName("合同号"); eiColumn.setDescName("合同号");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CONTRACT_LINE_NO);
eiColumn.setDescName("合同行号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CONTRACT_DETAIL_ID); eiColumn = new EiColumn(FIELD_CONTRACT_DETAIL_ID);
eiColumn.setDescName("合同明细id"); eiColumn.setDescName("合同明细id");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -1159,7 +1171,23 @@ public class HGCG003B extends DaoEPBase { ...@@ -1159,7 +1171,23 @@ public class HGCG003B extends DaoEPBase {
public void setSupName(String supName) { public void setSupName(String supName) {
this.supName = supName; this.supName = supName;
} }
public String getReceiveLineNo() {
return receiveLineNo;
}
public void setReceiveLineNo(String receiveLineNo) {
this.receiveLineNo = receiveLineNo;
}
public String getContractLineNo() {
return contractLineNo;
}
public void setContractLineNo(String contractLineNo) {
this.contractLineNo = contractLineNo;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -1182,8 +1210,10 @@ public class HGCG003B extends DaoEPBase { ...@@ -1182,8 +1210,10 @@ public class HGCG003B extends DaoEPBase {
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName)); setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName));
setReceiveDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RECEIVE_DATE)), receiveDate)); setReceiveDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RECEIVE_DATE)), receiveDate));
setReceiveNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RECEIVE_NO)), receiveNo)); setReceiveNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RECEIVE_NO)), receiveNo));
setReceiveLineNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RECEIVE_LINE_NO)), receiveLineNo));
setPlanNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_NO)), planNo)); setPlanNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_NO)), planNo));
setContractNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CONTRACT_NO)), contractNo)); setContractNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CONTRACT_NO)), contractNo));
setContractLineNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CONTRACT_LINE_NO)), contractLineNo));
setContractDetailId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_CONTRACT_DETAIL_ID)), contractDetailId)); setContractDetailId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_CONTRACT_DETAIL_ID)), contractDetailId));
setInventType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType)); setInventType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType));
setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode)); setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode));
...@@ -1239,8 +1269,10 @@ public class HGCG003B extends DaoEPBase { ...@@ -1239,8 +1269,10 @@ public class HGCG003B extends DaoEPBase {
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_RECEIVE_DATE, StringUtils.toString(receiveDate, eiMetadata.getMeta(FIELD_RECEIVE_DATE))); map.put(FIELD_RECEIVE_DATE, StringUtils.toString(receiveDate, eiMetadata.getMeta(FIELD_RECEIVE_DATE)));
map.put(FIELD_RECEIVE_NO, StringUtils.toString(receiveNo, eiMetadata.getMeta(FIELD_RECEIVE_NO))); map.put(FIELD_RECEIVE_NO, StringUtils.toString(receiveNo, eiMetadata.getMeta(FIELD_RECEIVE_NO)));
map.put(FIELD_RECEIVE_LINE_NO, StringUtils.toString(receiveLineNo, eiMetadata.getMeta(FIELD_RECEIVE_LINE_NO)));
map.put(FIELD_PLAN_NO, StringUtils.toString(planNo, eiMetadata.getMeta(FIELD_PLAN_NO))); map.put(FIELD_PLAN_NO, StringUtils.toString(planNo, eiMetadata.getMeta(FIELD_PLAN_NO)));
map.put(FIELD_CONTRACT_NO, StringUtils.toString(contractNo, eiMetadata.getMeta(FIELD_CONTRACT_NO))); map.put(FIELD_CONTRACT_NO, StringUtils.toString(contractNo, eiMetadata.getMeta(FIELD_CONTRACT_NO)));
map.put(FIELD_CONTRACT_LINE_NO, StringUtils.toString(contractLineNo, eiMetadata.getMeta(FIELD_CONTRACT_LINE_NO)));
map.put(FIELD_CONTRACT_DETAIL_ID, StringUtils.toString(contractDetailId, eiMetadata.getMeta(FIELD_CONTRACT_DETAIL_ID))); map.put(FIELD_CONTRACT_DETAIL_ID, StringUtils.toString(contractDetailId, eiMetadata.getMeta(FIELD_CONTRACT_DETAIL_ID)));
map.put(FIELD_INVENT_TYPE, StringUtils.toString(inventType, eiMetadata.getMeta(FIELD_INVENT_TYPE))); map.put(FIELD_INVENT_TYPE, StringUtils.toString(inventType, eiMetadata.getMeta(FIELD_INVENT_TYPE)));
map.put(FIELD_INVENT_CODE, StringUtils.toString(inventCode, eiMetadata.getMeta(FIELD_INVENT_CODE))); map.put(FIELD_INVENT_CODE, StringUtils.toString(inventCode, eiMetadata.getMeta(FIELD_INVENT_CODE)));
......
...@@ -49,6 +49,7 @@ public class ServiceHGCG002 extends ServiceBase { ...@@ -49,6 +49,7 @@ public class ServiceHGCG002 extends ServiceBase {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.USER_ID_BOX_BLOCK_ID));
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class); EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
Map qarma = new HashMap(); Map qarma = new HashMap();
Map userCompany = HGSBTools.getUserCompany(); Map userCompany = HGSBTools.getUserCompany();
......
...@@ -96,14 +96,14 @@ public class ServiceHGCG002A extends ServiceBase { ...@@ -96,14 +96,14 @@ public class ServiceHGCG002A extends ServiceBase {
try { try {
List<HGCG001A> fCg001As = MapUtils.toDaoEPBases(inInfo, HGCG001A.class); List<HGCG001A> fCg001As = MapUtils.toDaoEPBases(inInfo, HGCG001A.class);
// db数据 // db数据
Map<Long, HGCG001A> dbCg001Map = this.lockGetData(fCg001As); Map<Long, HGCG001A> dbCg001AMap = this.lockGetData(fCg001As);
//计划主表信息 //计划主表信息
List<String> planNos = fCg001As.stream().map(HGCG001A::getPlanNo).collect(Collectors.toList()); Map<String, HGCG001> dbCg001Map = HGCGTools.HgCg001.map(
Map<String, HGCG001> hgcg001Map = HGCGTools.HgCg001.map(planNos); ObjectUtils.listEpKey(fCg001As, HGCG001.FIELD_PLAN_NO));
// 数据校验 // 数据校验
this.checkConfirmData(fCg001As, dbCg001Map,hgcg001Map); this.checkConfirmData(fCg001As, dbCg001AMap, dbCg001Map);
// 保存数据 // 保存数据
this.confirmData(fCg001As, dbCg001Map,hgcg001Map); this.confirmData(fCg001As, dbCg001AMap, dbCg001Map);
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg001As.size() + "]条数据保存成功!"); inInfo.setMsg("操作成功!本次对[" + fCg001As.size() + "]条数据保存成功!");
...@@ -112,37 +112,41 @@ public class ServiceHGCG002A extends ServiceBase { ...@@ -112,37 +112,41 @@ public class ServiceHGCG002A extends ServiceBase {
} }
return inInfo; return inInfo;
} }
/** /**
* 数据校验 * 数据校验
* @param fCg001As *
* @param fCg001As
* @param dbCg001AMap * @param dbCg001AMap
* @param hgcg001Map * @param dbCg001Map
*/ */
private void checkConfirmData(List<HGCG001A> fCg001As, Map<Long, HGCG001A> dbCg001AMap, Map<String, HGCG001> hgcg001Map) { private void checkConfirmData(List<HGCG001A> fCg001As, Map<Long, HGCG001A> dbCg001AMap,
Map<String, HGCG001> dbCg001Map) {
for (HGCG001A fCg001A : fCg001As) { for (HGCG001A fCg001A : fCg001As) {
Long id = fCg001A.getId(); HGCG001A dbCg001A = dbCg001AMap.get(fCg001A.getId());
HGCG001A dbCg001A = dbCg001AMap.get(id); AssertUtils.isNull(dbCg001A, String.format("计划明细[%s]不存在", fCg001A.getId()));
AssertUtils.isNull(dbCg001A, String.format("计划明细[%s]不存在", id)); HGCG001 dbCg001 = dbCg001Map.get(fCg001A.getPlanNo());
AssertUtils.isNull(dbCg001, String.format("计划[%s]不存在", fCg001A.getPlanNo()));
AssertUtils.isGe(BigDecimal.ZERO, fCg001A.getPurQty(), "采购数量不能小于等于0"); AssertUtils.isGe(BigDecimal.ZERO, fCg001A.getPurQty(), "采购数量不能小于等于0");
AssertUtils.isGt(BigDecimal.ZERO, fCg001A.getPurWeight(), "采购总量不能小于0"); AssertUtils.isGt(BigDecimal.ZERO, fCg001A.getPurWeight(), "采购总量不能小于0");
AssertUtils.isTrue(fCg001A.getTaxRate().compareTo(BigDecimal.ZERO) <= 0, "税率不能小于等于0"); AssertUtils.isTrue(fCg001A.getTaxRate().compareTo(BigDecimal.ZERO) <= 0, "税率不能小于等于0");
AssertUtils.isTrue(fCg001A.getPrice().compareTo(BigDecimal.ZERO) <= 0, "单价不能小于等于0"); AssertUtils.isTrue(fCg001A.getPrice().compareTo(BigDecimal.ZERO) <= 0, "单价不能小于等于0");
} }
} }
/** /**
* 数据保存 * 数据保存
*
* @param fCg001As * @param fCg001As
* @param dbCg001AMap
* @param dbCg001Map * @param dbCg001Map
* @param hgcg001Map
*/ */
private void confirmData(List<HGCG001A> fCg001As, Map<Long, HGCG001A> dbCg001Map, Map<String, HGCG001> hgcg001Map) { private void confirmData(List<HGCG001A> fCg001As, Map<Long, HGCG001A> dbCg001AMap,
//取一条主表数据,用于拷贝合同主表信息 Map<String, HGCG001> dbCg001Map) {
// 取一条主表数据,用于拷贝合同主表信息
HGCG001A oneCg001A = fCg001As.get(0); HGCG001A oneCg001A = fCg001As.get(0);
HGCG001 oneCG001 = hgcg001Map.get(oneCg001A.getPlanNo()); HGCG001 oneCG001 = dbCg001Map.get(oneCg001A.getPlanNo());
HGCG002 newCg002 = new HGCG002(); HGCG002 newCg002 = BeanUtils.copy(oneCG001, HGCG002.class);
BeanUtils.copyProperties(oneCG001, newCg002,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
newCg002.setContractDate(DateUtils.shortDate()); newCg002.setContractDate(DateUtils.shortDate());
newCg002.setContractNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_CONTRACT_NO)); newCg002.setContractNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_CONTRACT_NO));
newCg002.setStatus(HGConstant.CgContractStatus.S_0); newCg002.setStatus(HGConstant.CgContractStatus.S_0);
...@@ -150,11 +154,11 @@ public class ServiceHGCG002A extends ServiceBase { ...@@ -150,11 +154,11 @@ public class ServiceHGCG002A extends ServiceBase {
newCg002.setSource(HGConstant.CgSource.DEFAULT); newCg002.setSource(HGConstant.CgSource.DEFAULT);
DaoUtils.insert(HGCG002.INSERT, newCg002); DaoUtils.insert(HGCG002.INSERT, newCg002);
for (HGCG001A fCg001A : fCg001As) { for (HGCG001A fCg001A : fCg001As) {
//新增子表信息 // 新增子表信息
insertDetails(fCg001A, newCg002); insertDetails(fCg001A, newCg002);
HGCG001 cg001 = hgcg001Map.get(fCg001A.getPlanNo()); HGCG001 dbCg001 = dbCg001Map.get(fCg001A.getPlanNo());
// 更新计划状态 // 更新计划状态
HGCGTools.HgCg001.updateStatus(cg001.getPlanNo(), HGConstant.CgPlanStatus.S_4); HGCGTools.HgCg001.updateStatus(dbCg001.getPlanNo(), HGConstant.CgPlanStatus.S_4);
// 更新计划状态 // 更新计划状态
HGCGTools.HgCg001A.updateStatus(fCg001A.getId(), HGConstant.CgPlanStatus.S_4); HGCGTools.HgCg001A.updateStatus(fCg001A.getId(), HGConstant.CgPlanStatus.S_4);
} }
...@@ -173,6 +177,7 @@ public class ServiceHGCG002A extends ServiceBase { ...@@ -173,6 +177,7 @@ public class ServiceHGCG002A extends ServiceBase {
cg002B.setContractNo(newCg002.getContractNo()); cg002B.setContractNo(newCg002.getContractNo());
cg002B.setContractLineNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_CONTRACT_LINE_NO, cg002B.setContractLineNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_CONTRACT_LINE_NO,
new String[]{newCg002.getContractNo()})); new String[]{newCg002.getContractNo()}));
cg002B.setStatus(HGConstant.CgContractStatus.S_0);
cg002B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); cg002B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
cg002B.setPrimaryId(newCg002.getId()); cg002B.setPrimaryId(newCg002.getId());
cg002B.setPlanDetailId(fCg001A.getId()); cg002B.setPlanDetailId(fCg001A.getId());
......
...@@ -13,6 +13,7 @@ import com.baosight.hggp.hg.constant.HGConstant; ...@@ -13,6 +13,7 @@ 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.HGPZ004;
import com.baosight.hggp.hg.pz.domain.HGPZ005; import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.utils.HGUtils;
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,8 +21,10 @@ import com.baosight.hggp.util.*; ...@@ -20,8 +21,10 @@ import com.baosight.hggp.util.*;
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.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -87,33 +90,32 @@ public class ServiceHGCG002B extends ServiceBase { ...@@ -87,33 +90,32 @@ public class ServiceHGCG002B extends ServiceBase {
@OperationLogAnnotation(operModul = "采购合同", operType = "修改", operDesc = "保存") @OperationLogAnnotation(operModul = "采购合同", operType = "修改", operDesc = "保存")
public EiInfo save(EiInfo inInfo) { public EiInfo save(EiInfo inInfo) {
try { try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
Long primaryId = MapUtils.getLong(queryMap, HGCG002B.FIELD_PRIMARY_ID);
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()); HGCG002 dbCg002 = HGCGTools.HgCg002.get(primaryId);
if(cg002.getSource().intValue() == HGConstant.CgSource.DEFAULT){ AssertUtils.isNull(dbCg002, String.format("主合同【%s】信息不存在", primaryId));
if (dbCg002.getSource().intValue() == HGConstant.CgSource.DEFAULT) {
// db数据 // db数据
Map<Long, HGCG002B> dbCg002AMap = HGCGUtils.HgCg002B.lockGetDataEp(fCg002Bs); Map<Long, HGCG002B> dbCg002AMap = HGCGUtils.HgCg002B.lockGetDataEp(fCg002Bs);
// 数据校验 // 数据校验
this.checkSaveData(fCg002Bs, dbCg002AMap,cg002); this.checkSaveData(fCg002Bs, dbCg002AMap, dbCg002);
// 保存数据 // 保存数据
this.editData(fCg002Bs,cg002); this.editData(fCg002Bs, dbCg002);
}else{ } else {
// 写入数据 // 写入数据
for (int i = 0; i < fCg002Bs.size(); i++) { for (HGCG002B fCg002B : fCg002Bs) {
HGCG002B hgcg002B = fCg002Bs.get(i); if (fCg002B.getId() == null || fCg002B.getId() == 0) {
if (hgcg002B.getId() == null || hgcg002B.getId() == 0) { this.saveData(fCg002B, dbCg002);
// 修改数据
this.saveData(hgcg002B,cg002);
} else { } else {
// 新增数据 fCg002B.setStatus(HGConstant.CgContractStatus.S_0);
hgcg002B.setStatus(HGConstant.CgContractStatus.S_0); DaoUtils.update(HGCG002B.UPDATE, fCg002B);
DaoUtils.update(HGCG002B.UPDATE, hgcg002B);
} }
} }
//修改主表信息 // 修改主表信息
cg002.setStatus(HGConstant.CgContractStatus.S_0); dbCg002.setStatus(HGConstant.CgContractStatus.S_0);
HGCGTools.HgCg002.updateCg002Pur(cg002); HGCGTools.HgCg002.updateCg002Pur(dbCg002);
} }
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() + "]条数据保存成功!");
...@@ -122,29 +124,46 @@ public class ServiceHGCG002B extends ServiceBase { ...@@ -122,29 +124,46 @@ 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 fCg002B
* @param dbCg002
*/
private void saveData(HGCG002B fCg002B, HGCG002 dbCg002) {
fCg002B.setPrimaryId(dbCg002.getId());
fCg002B.setContractNo(dbCg002.getContractNo());
fCg002B.setContractLineNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_CONTRACT_LINE_NO,
new String[]{dbCg002.getContractNo()}));
fCg002B.setCompanyCode(dbCg002.getCompanyCode());
fCg002B.setCompanyName(dbCg002.getCompanyName());
fCg002B.setProjCode(dbCg002.getProjCode());
fCg002B.setProjName(dbCg002.getProjName());
// 单重
fCg002B.setPurUnitWeight(fCg002B.getPurWeight().divide(fCg002B.getPurQty(), 3, RoundingMode.HALF_UP));
fCg002B.setStatus(HGConstant.CgContractStatus.S_0);
DaoUtils.insert(HGCG002B.INSERT, fCg002B);
} }
/** /**
* 数据校验 * 数据校验
* *
* @param fCg002Bs * @param fCg002Bs
* @param dbCg002BMap * @param dbCg002BMap
*/ */
private void checkSaveData(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap,HGCG002 cg002) { 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.isTrue(cg002.getStatus().intValue() == HGConstant.CgContractStatus.S_4 AssertUtils.isTrue(cg002.getStatus().intValue() == HGConstant.CgContractStatus.S_4
|| cg002.getStatus().intValue() == HGConstant.CgContractStatus.S_5, || cg002.getStatus().intValue() == HGConstant.CgContractStatus.S_5,
String.format("合同[%s]已生成收货单,不允许操作", cg002.getContractNo())); 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,
AssertUtils.isTrue(fCg002B.getTaxRate().compareTo(BigDecimal.ZERO) <= 0, String.format("存货[%s]税率小于等于0,不允许操作", dbCg002B.getInventCode())); String.format("存货[%s]单价小于等于0,不允许操作", dbCg002B.getInventCode()));
AssertUtils.isTrue(fCg002B.getTaxRate().compareTo(BigDecimal.ZERO) <= 0,
String.format("存货[%s]税率小于等于0,不允许操作", dbCg002B.getInventCode()));
} }
} }
......
...@@ -53,7 +53,7 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -53,7 +53,7 @@ public class ServiceHGCG003 extends ServiceBase {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.USER_BLOCK_ID));
Map qarma = new HashMap(); Map qarma = new HashMap();
Map userCompany = HGSBTools.getUserCompany(); Map userCompany = HGSBTools.getUserCompany();
qarma.put(HGSC009.FIELD_COMPANY_CODE,userCompany.get(HGSC009.FIELD_COMPANY_CODE)); qarma.put(HGSC009.FIELD_COMPANY_CODE,userCompany.get(HGSC009.FIELD_COMPANY_CODE));
...@@ -99,13 +99,11 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -99,13 +99,11 @@ public class ServiceHGCG003 extends ServiceBase {
try { try {
List<HGCG003> fCg003s = MapUtils.toDaoEPBases(inInfo, HGCG003.class); List<HGCG003> fCg003s = MapUtils.toDaoEPBases(inInfo, HGCG003.class);
// 写入数据 // 写入数据
for (int i = 0; i < fCg003s.size(); i++) { for (HGCG003 fCg003 : fCg003s) {
HGCG003 hgcg003 = fCg003s.get(i); if (fCg003.getId() == null || fCg003.getId() == 0) {
if (hgcg003.getId() == null || hgcg003.getId() == 0) { this.saveData(fCg003);
// 修改数据
this.saveData(hgcg003);
} else { } else {
DaoUtils.update(HGCG003.UPDATE, hgcg003); this.editData(fCg003);
} }
} }
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
...@@ -120,38 +118,26 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -120,38 +118,26 @@ public class ServiceHGCG003 extends ServiceBase {
/** /**
* 保存数据 * 保存数据
* *
* @param hgcg003 * @param fCg003
*/ */
private void saveData(HGCG003 hgcg003) { private void saveData(HGCG003 fCg003) {
// 新增数据 // 新增数据
hgcg003.setReceiveNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_RECEIVE_NO)); fCg003.setReceiveNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_RECEIVE_NO));
hgcg003.setStatus(HGConstant.CgReceiveStatus.S_2); fCg003.setStatus(HGConstant.CgReceiveStatus.S_2);
hgcg003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); fCg003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
hgcg003.setSource(HGConstant.CgSource.SDLR); fCg003.setSource(HGConstant.CgSource.SDLR);
hgcg003.setReceiveDate(DateUtils.formatShort(hgcg003.getReceiveDate())); fCg003.setReceiveDate(DateUtils.formatShort(fCg003.getReceiveDate()));
DaoUtils.insert(HGCG003.INSERT, hgcg003); DaoUtils.insert(HGCG003.INSERT, fCg003);
} }
/** /**
* 数据修改,修改合同数据 * 数据修改,修改合同数据
* *
* @param fCg003s * @param fCg003
* @param dbCg003Map
* @param dbCg002AMap
*/ */
private void editData(List<HGCG003> fCg003s, Map<String, HGCG003> dbCg003Map, Map<String, HGCG002A> dbCg002AMap) { private void editData(HGCG003 fCg003) {
for (HGCG003 fCg003 : fCg003s) { fCg003.setReceiveDate(DateUtils.formatShort(fCg003.getReceiveDate()));
String receiveNo = fCg003.getReceiveNo(); DaoUtils.update(HGCG003.UPDATE, fCg003);
String contractNo = fCg003.getContractNo();
// 计算重量
fCg003.setReceiveWeight(fCg003.getReceiveQty().multiply(fCg003.getReceiveUnitWeight()));
DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_QTY, fCg003);
// 计算差异数量,更新合同状态
HGCG003 dbCg003 = dbCg003Map.get(receiveNo);
BigDecimal diffQty = fCg003.getReceiveQty().subtract(dbCg003.getReceiveQty());
BigDecimal diffWeight = fCg003.getReceiveWeight().subtract(dbCg003.getReceiveWeight());
HGCGTools.HgCg002.updateReceive(dbCg002AMap.get(contractNo), diffQty, diffWeight);
}
} }
/** /**
......
...@@ -10,6 +10,7 @@ import com.baosight.hggp.hg.cg.domain.HGCG002; ...@@ -10,6 +10,7 @@ import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.domain.HGCG002A; import com.baosight.hggp.hg.cg.domain.HGCG002A;
import com.baosight.hggp.hg.cg.domain.HGCG002B; import com.baosight.hggp.hg.cg.domain.HGCG002B;
import com.baosight.hggp.hg.cg.domain.HGCG003; import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cg.domain.HGCG003A;
import com.baosight.hggp.hg.cg.domain.HGCG003B; import com.baosight.hggp.hg.cg.domain.HGCG003B;
import com.baosight.hggp.hg.cg.tools.HGCGTools; import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HGCGUtils; import com.baosight.hggp.hg.cg.utils.HGCGUtils;
...@@ -28,8 +29,10 @@ import com.baosight.hggp.util.ObjectUtils; ...@@ -28,8 +29,10 @@ 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.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
...@@ -92,9 +95,12 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -92,9 +95,12 @@ public class ServiceHGCG003B extends ServiceBase {
@OperationLogAnnotation(operModul = "采购收货", operType = "修改", operDesc = "保存") @OperationLogAnnotation(operModul = "采购收货", operType = "修改", operDesc = "保存")
public EiInfo save(EiInfo inInfo) { public EiInfo save(EiInfo inInfo) {
try { try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
Long primaryId = MapUtils.getLong(queryMap, HGCG003B.FIELD_PRIMARY_ID);
List<HGCG003B> fCg003Bs = MapUtils.toDaoEPBases(inInfo, HGCG003B.class); List<HGCG003B> fCg003Bs = MapUtils.toDaoEPBases(inInfo, HGCG003B.class);
HGCG003 cg003 = HGCGTools.HgCg003.get(fCg003Bs.get(0).getPrimaryId()); HGCG003 dbCg003 = HGCGTools.HgCg003.get(primaryId);
if (cg003.getSource() == HGConstant.CgSource.DEFAULT) { AssertUtils.isNull(dbCg003, "主收货信息不存在");
if (dbCg003.getSource() == HGConstant.CgSource.DEFAULT) {
// 采购收货DB数据 // 采购收货DB数据
Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetDataEp(fCg003Bs); Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetDataEp(fCg003Bs);
// 采购合同DB数据 // 采购合同DB数据
...@@ -104,20 +110,32 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -104,20 +110,32 @@ public class ServiceHGCG003B extends ServiceBase {
Map<Long, HGCG002B> dbCg002BMap = HGCGUtils.HgCg002B.lockGetData( Map<Long, HGCG002B> dbCg002BMap = HGCGUtils.HgCg002B.lockGetData(
ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_DETAIL_ID)); ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_DETAIL_ID));
// 数据校验 // 数据校验
this.checkEditData(fCg003Bs, dbCg003BMap, cg003); this.checkEditData(fCg003Bs, dbCg003BMap, dbCg003);
// 保存数据 // 保存数据
this.editData(fCg003Bs, dbCg003BMap, dbCg002AMap, cg003, dbCg002BMap); this.editData(fCg003Bs, dbCg003BMap, dbCg002AMap, dbCg003, dbCg002BMap);
} else { } else {
// 写入数据 // 写入数据
for (HGCG003B fCg003B : fCg003Bs) { for (HGCG003B fCg003B : fCg003Bs) {
AssertUtils.isGe(BigDecimal.ZERO, fCg003B.getReceiveQty(),
String.format("收货单[%s]的\"收货数量(%s)\"必须大于0", fCg003B.getReceiveLineNo(),
fCg003B.getReceiveQty()));
AssertUtils.isGt(BigDecimal.ZERO, fCg003B.getReceiveWeight(),
String.format("收货单[%s]的\"收货重量(%s)\"必须大于等于0", fCg003B.getReceiveLineNo(),
fCg003B.getReceiveQty()));
// 计算单重
if (fCg003B.getReceiveUnitWeight() == null
|| fCg003B.getReceiveUnitWeight().compareTo(BigDecimal.ZERO) < 1) {
fCg003B.setReceiveUnitWeight(fCg003B.getReceiveWeight()
.divide(fCg003B.getReceiveQty(), 3, RoundingMode.HALF_UP));
}
if (fCg003B.getId() == null || fCg003B.getId() == 0) { if (fCg003B.getId() == null || fCg003B.getId() == 0) {
this.addData(fCg003B, cg003); this.addData(fCg003B, dbCg003);
} else { } else {
this.updateData(fCg003B); this.updateData(fCg003B);
} }
} }
//修改主表信息 //修改主表信息
updateCg003Pur(cg003); updateCg003Pur(dbCg003);
} }
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
...@@ -192,21 +210,25 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -192,21 +210,25 @@ public class ServiceHGCG003B extends ServiceBase {
/** /**
* 新增数据 * 新增数据
* *
* @param hgcg003B * @param fCg003B
* @param cg003 * @param dbCg003
*/ */
private void addData(HGCG003B hgcg003B, HGCG003 cg003) { private void addData(HGCG003B fCg003B, HGCG003 dbCg003) {
hgcg003B.setPrimaryId(cg003.getId()); fCg003B.setProjCode(dbCg003.getProjCode());
hgcg003B.setReceiveNo(cg003.getReceiveNo()); fCg003B.setProjName(dbCg003.getProjName());
hgcg003B.setStatus(HGConstant.CgReceiveStatus.S_2); fCg003B.setPrimaryId(dbCg003.getId());
hgcg003B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); fCg003B.setReceiveNo(dbCg003.getReceiveNo());
hgcg003B.setReceiveDate(DateUtils.formatShort(cg003.getReceiveDate())); fCg003B.setReceiveLineNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_RECEIVE_LINE_NO,
hgcg003B.setCompanyCode(cg003.getCompanyCode()); new String[]{dbCg003.getReceiveNo()}));
hgcg003B.setCompanyName(cg003.getCompanyName()); fCg003B.setStatus(HGConstant.CgReceiveStatus.S_2);
hgcg003B.setDepCode(cg003.getDepCode()); fCg003B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
hgcg003B.setAccountCode(cg003.getAccountCode()); fCg003B.setReceiveDate(DateUtils.formatShort(dbCg003.getReceiveDate()));
hgcg003B.setUnCancelAmount(hgcg003B.getTaxIncludeAmount()); fCg003B.setCompanyCode(dbCg003.getCompanyCode());
DaoUtils.insert(HGCG003B.INSERT, hgcg003B); fCg003B.setCompanyName(dbCg003.getCompanyName());
fCg003B.setDepCode(dbCg003.getDepCode());
fCg003B.setAccountCode(dbCg003.getAccountCode());
fCg003B.setUnCancelAmount(fCg003B.getTaxIncludeAmount());
DaoUtils.insert(HGCG003B.INSERT, fCg003B);
} }
/** /**
...@@ -219,17 +241,33 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -219,17 +241,33 @@ public class ServiceHGCG003B extends ServiceBase {
DaoUtils.update(HGCG003B.UPDATE, hgcg003B); DaoUtils.update(HGCG003B.UPDATE, hgcg003B);
} }
/**
* 修改主收货信息
*
* @param cg003
*/
private void updateCg003Pur(HGCG003 cg003) { private void updateCg003Pur(HGCG003 cg003) {
List<HGCG003B> queryCG003Bs = HGCGTools.HgCg003B.listByPrimaryId(cg003.getId()); List<HGCG003B> queryCG003Bs = HGCGTools.HgCg003B.listByPrimaryId(cg003.getId());
//修改主表信息 // 收货数量
//收货数量
BigDecimal receiveQtySum = queryCG003Bs.stream().map(HGCG003B::getReceiveQty) BigDecimal receiveQtySum = queryCG003Bs.stream().map(HGCG003B::getReceiveQty)
.reduce(BigDecimal.ZERO, BigDecimal::add); .reduce(BigDecimal.ZERO, BigDecimal::add);
cg003.setReceiveQty(receiveQtySum); cg003.setReceiveQty(receiveQtySum);
//收货重量 // 收货重量
BigDecimal receiveWeightSum = queryCG003Bs.stream().map(HGCG003B::getReceiveWeight) BigDecimal receiveWeightSum = queryCG003Bs.stream().map(HGCG003B::getReceiveWeight)
.reduce(BigDecimal.ZERO, BigDecimal::add); .reduce(BigDecimal.ZERO, BigDecimal::add);
cg003.setReceiveWeight(receiveWeightSum); cg003.setReceiveWeight(receiveWeightSum);
// 金额
BigDecimal amountSum = queryCG003Bs.stream().map(HGCG003B::getAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
cg003.setAmount(amountSum);
// 税额
BigDecimal taxAmountSum = queryCG003Bs.stream().map(HGCG003B::getTaxAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
cg003.setTaxAmount(taxAmountSum);
// 不含税税额
BigDecimal taxIncludeAmountSum = queryCG003Bs.stream().map(HGCG003B::getTaxIncludeAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
cg003.setTaxIncludeAmount(taxIncludeAmountSum);
DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_QTY, cg003); DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_QTY, cg003);
} }
...@@ -242,10 +280,12 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -242,10 +280,12 @@ public class ServiceHGCG003B extends ServiceBase {
@OperationLogAnnotation(operModul = "采购收货", operType = "修改", operDesc = "删除") @OperationLogAnnotation(operModul = "采购收货", operType = "修改", operDesc = "删除")
public EiInfo remove(EiInfo inInfo) { public EiInfo remove(EiInfo inInfo) {
try { try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
Long primaryId = MapUtils.getLong(queryMap, HGCG003B.FIELD_PRIMARY_ID);
List<HGCG003B> fCg003Bs = MapUtils.toDaoEPBases(inInfo, HGCG003B.class); List<HGCG003B> fCg003Bs = MapUtils.toDaoEPBases(inInfo, HGCG003B.class);
// 采购收货DB数据 // 采购收货DB数据
Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetDataEp(fCg003Bs); Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetDataEp(fCg003Bs);
HGCG003 cg003 = HGCGTools.HgCg003.get(fCg003Bs.get(0).getPrimaryId()); HGCG003 dbCg003 = HGCGTools.HgCg003.get(primaryId);
// 采购合同DB数据 // 采购合同DB数据
Map<String, HGCG002A> dbCg002AMap = HGCGUtils.HgCg002.lockGetData( Map<String, HGCG002A> dbCg002AMap = HGCGUtils.HgCg002.lockGetData(
ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_NO)); ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_NO));
...@@ -253,9 +293,9 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -253,9 +293,9 @@ public class ServiceHGCG003B extends ServiceBase {
Map<Long, HGCG002B> dbCg002BMap = HGCGUtils.HgCg002B.lockGetData( Map<Long, HGCG002B> dbCg002BMap = HGCGUtils.HgCg002B.lockGetData(
ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_DETAIL_ID)); ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_DETAIL_ID));
// 数据校验 // 数据校验
this.checkRemoveData(fCg003Bs, dbCg003BMap, cg003); this.checkRemoveData(fCg003Bs, dbCg003BMap, dbCg003);
// 保存数据 // 保存数据
this.removeData(fCg003Bs, dbCg003BMap, dbCg002AMap, cg003, dbCg002BMap); this.removeData(fCg003Bs, dbCg003BMap, dbCg002AMap, dbCg003, dbCg002BMap);
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg003Bs.size() + "]条数据删除成功!"); inInfo.setMsg("操作成功!本次对[" + fCg003Bs.size() + "]条数据删除成功!");
...@@ -270,14 +310,15 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -270,14 +310,15 @@ public class ServiceHGCG003B extends ServiceBase {
* *
* @param fCg003Bs * @param fCg003Bs
* @param dbCg003BMap * @param dbCg003BMap
* @param cg003 * @param dbCg003
*/ */
private void checkRemoveData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003BMap, HGCG003 cg003) { private void checkRemoveData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003BMap, HGCG003 dbCg003) {
AssertUtils.isNull(dbCg003, "主收货单不存在");
for (HGCG003B fCg003B : fCg003Bs) { for (HGCG003B fCg003B : fCg003Bs) {
String receiveNo = fCg003B.getReceiveNo(); String receiveNo = fCg003B.getReceiveNo();
HGCG003B dbCg003B = dbCg003BMap.get(fCg003B.getId()); HGCG003B dbCg003B = dbCg003BMap.get(fCg003B.getId());
AssertUtils.isNull(dbCg003B, String.format("收货单[%s]不存在", receiveNo)); AssertUtils.isNull(dbCg003B, String.format("收货单[%s]不存在", receiveNo));
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_2, cg003.getStatus(), AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_2, dbCg003.getStatus(),
String.format("收货单[%s]状态不是\"已收货\",不允许操作", receiveNo)); String.format("收货单[%s]状态不是\"已收货\",不允许操作", receiveNo));
} }
} }
...@@ -288,13 +329,13 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -288,13 +329,13 @@ public class ServiceHGCG003B extends ServiceBase {
* @param fCg003Bs * @param fCg003Bs
* @param dbCg003bMap * @param dbCg003bMap
* @param dbCg002AMap * @param dbCg002AMap
* @param cg003 * @param dbCg003
* @param dbCg002BMap * @param dbCg002BMap
*/ */
private void removeData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003bMap, Map<String, HGCG002A> dbCg002AMap, private void removeData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003bMap, Map<String, HGCG002A> dbCg002AMap,
HGCG003 cg003, Map<Long, HGCG002B> dbCg002BMap) { HGCG003 dbCg003, Map<Long, HGCG002B> dbCg002BMap) {
// 数据来源为合同的 // 数据来源为合同的
if (cg003.getSource().intValue() == HGConstant.CgSource.DEFAULT) { if (dbCg003.getSource().intValue() == HGConstant.CgSource.DEFAULT) {
for (HGCG003B fCg003B : fCg003Bs) { for (HGCG003B fCg003B : fCg003Bs) {
HGCG003B dbCg003B = dbCg003bMap.get(fCg003B.getId()); HGCG003B dbCg003B = dbCg003bMap.get(fCg003B.getId());
dbCg003B.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode()); dbCg003B.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
...@@ -318,7 +359,7 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -318,7 +359,7 @@ public class ServiceHGCG003B extends ServiceBase {
} }
} }
//修改主表信息 //修改主表信息
updateCg003Pur(cg003); updateCg003Pur(dbCg003);
} }
} }
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGCG001A"> <sqlMap namespace="HGCG001A">
<sql id="condition"> <sql id="condition">
AND DELETE_FLAG = 0 AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
...@@ -124,7 +124,8 @@ ...@@ -124,7 +124,8 @@
</sql> </sql>
<sql id="conditionByContract"> <sql id="conditionByContract">
AND a.DELETE_FLAG = 0 AND A.DELETE_FLAG = 0
AND B.DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
a.ID = #id# a.ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -311,47 +312,47 @@ ...@@ -311,47 +312,47 @@
<include refid="condition" /> <include refid="condition" />
</select> </select>
<select id="queryByContract" parameterClass="java.util.HashMap" <select id="queryByContract" resultClass="com.baosight.hggp.hg.cg.domain.HGCG001A">
resultClass="com.baosight.hggp.hg.cg.domain.HGCG001A"> SELECT
SELECT a.ID as "id",
a.ID as "id", a.ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
a.ACCOUNT_CODE as "accountCode", <!-- 企业编码 --> a.DEP_CODE as "depCode", <!-- 部门编码 -->
a.DEP_CODE as "depCode", <!-- 部门编码 --> a.CREATED_BY as "createdBy", <!-- 记录创建者 -->
a.CREATED_BY as "createdBy", <!-- 记录创建者 --> a.CREATED_NAME as "createdName", <!-- 记录创建名称 -->
a.CREATED_NAME as "createdName", <!-- 记录创建名称 --> a.CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
a.CREATED_TIME as "createdTime", <!-- 记录创建时间 --> a.UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
a.UPDATED_BY as "updatedBy", <!-- 记录修改者 --> a.UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
a.UPDATED_NAME as "updatedName", <!-- 记录修改名称 --> a.UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
a.UPDATED_TIME as "updatedTime", <!-- 记录修改时间 --> a.DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
a.DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 --> a.COMPANY_CODE as "companyCode", <!-- 公司编码 -->
a.COMPANY_CODE as "companyCode", <!-- 公司编码 --> a.COMPANY_NAME as "companyName", <!-- 公司名称 -->
a.COMPANY_NAME as "companyName", <!-- 公司名称 --> a.INVENT_TYPE as "inventType", <!-- 存货类型 -->
a.INVENT_TYPE as "inventType", <!-- 存货类型 --> a.INVENT_CODE as "inventCode", <!-- 存货编码 -->
a.INVENT_CODE as "inventCode", <!-- 存货编码 --> a.INVENT_NAME as "inventName", <!-- 存货名称 -->
a.INVENT_NAME as "inventName", <!-- 存货名称 --> a.SPEC as "spec", <!-- 规格 -->
a.SPEC as "spec", <!-- 规格 --> a.MATERIAL as "material", <!-- 材质 -->
a.MATERIAL as "material", <!-- 材质 --> a.UNIT as "unit", <!-- 单位 -->
a.UNIT as "unit", <!-- 单位 --> a.LENGTH as "length", <!-- 长度 -->
a.LENGTH as "length", <!-- 长度 --> a.WIDTH as "width", <!-- 宽度 -->
a.WIDTH as "width", <!-- 宽度 --> a.THICK as "thick", <!-- 厚度 -->
a.THICK as "thick", <!-- 厚度 --> a.PLAN_QTY as "planQty", <!-- 计划数量 -->
a.PLAN_QTY as "planQty", <!-- 计划数量 --> a.PLAN_UNIT_WEIGHT as "planUnitWeight", <!-- 计划单重 -->
a.PLAN_UNIT_WEIGHT as "planUnitWeight", <!-- 计划单重 --> a.PLAN_WEIGHT as "planWeight", <!-- 计划重量 -->
a.PLAN_WEIGHT as "planWeight", <!-- 计划重量 --> a.PUR_QTY as "purQty", <!-- 采购数量 -->
a.PUR_QTY as "purQty", <!-- 采购数量 --> a.PUR_UNIT_WEIGHT as "purUnitWeight", <!-- 采购单重 -->
a.PUR_UNIT_WEIGHT as "purUnitWeight", <!-- 采购单重 --> a.PUR_WEIGHT as "purWeight", <!-- 采购重量 -->
a.PUR_WEIGHT as "purWeight", <!-- 采购重量 --> a.MATERIAL_PLAN_ID as "materialPlanId", <!-- 材料计划id -->
a.MATERIAL_PLAN_ID as "materialPlanId", <!-- 材料计划id --> a.INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 -->
a.INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 --> a.REMARKS as "remarks", <!-- 备注 -->
a.REMARKS as "remarks", <!-- 备注 --> a.STATUS as "status", <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
a.STATUS as "status", <!-- 状态:0-未审批,1-审核通过,2-审核未通过 --> a.PROJ_CODE as "projCode", <!-- 项目编码 -->
a.PROJ_CODE as "projCode", <!-- 项目编码 --> a.PROJ_NAME as "projName", <!-- 项目名称 -->
a.PROJ_NAME as "projName", <!-- 项目名称 --> b.SOURCE as "source", <!-- 数据来源 根据采购数据来源小代码 目前默认0材料计划,1手工录入 -->
b.SOURCE as "source", <!-- 数据来源 根据采购数据来源小代码 目前默认0材料计划,1手工录入 --> b.PLAN_DATE as "planDate", <!-- 计划日期 -->
b.PLAN_DATE as "planDate", <!-- 计划日期 --> b.PLAN_NO as "planNo", <!-- 计划单号 -->
b.PLAN_NO as "planNo", <!-- 计划单号 --> a.PRIMARY_ID as "primaryId" <!-- 主表id -->
a.PRIMARY_ID as "primaryId" <!-- 主表id --> FROM ${hggpSchema}.HGCG001A A
FROM ${hggpSchema}.HGCG001A a LEFT JOIN ${hggpSchema}.HGCG001 b ON a.PRIMARY_ID = b.ID LEFT JOIN ${hggpSchema}.HGCG001 B ON A.PRIMARY_ID = B.ID
WHERE 1=1 WHERE 1=1
<include refid="conditionByContract" /> <include refid="conditionByContract" />
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
...@@ -362,7 +363,6 @@ ...@@ -362,7 +363,6 @@
a.ID desc a.ID desc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</select> </select>
<insert id="insert"> <insert id="insert">
......
...@@ -187,7 +187,6 @@ ...@@ -187,7 +187,6 @@
<insert id="insert"> <insert id="insert">
INSERT INTO ${hggpSchema}.HGCG002 ( INSERT INTO ${hggpSchema}.HGCG002 (
ID,
ACCOUNT_CODE, <!-- 企业编码 --> ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 --> DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 --> CREATED_BY, <!-- 记录创建者 -->
...@@ -226,7 +225,7 @@ ...@@ -226,7 +225,7 @@
PROJ_NAME, <!-- 项目名称 --> PROJ_NAME, <!-- 项目名称 -->
SOURCE <!-- 数据来源 根据采购数据来源小代码 目前默认0采购计划,1手工录入 --> SOURCE <!-- 数据来源 根据采购数据来源小代码 目前默认0采购计划,1手工录入 -->
) VALUES ( ) VALUES (
#id#,#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #companyCode#, #companyName#, #contractDate#, #contractNo#, #planNo#, #deleteFlag#, #companyCode#, #companyName#, #contractDate#, #contractNo#, #planNo#,
#supCode#, #supName#, #purUserId#, #purUserName#, #inventCode#, #inventName#, #supCode#, #supName#, #purUserId#, #purUserName#, #inventCode#, #inventName#,
#specId#, #spec#, #material#, #unit#, #length#, #width#, #thick#, #specId#, #spec#, #material#, #unit#, #length#, #width#, #thick#,
......
...@@ -237,13 +237,15 @@ ...@@ -237,13 +237,15 @@
CALCULATION_METHOD, CALCULATION_METHOD,
PLAN_DETAIL_ID, PLAN_DETAIL_ID,
CONTRACT_NO, CONTRACT_NO,
CONTRACT_LINE_NO CONTRACT_LINE_NO,
STATUS
) VALUES ( ) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #companyCode#, #companyName#, #inventType#, #inventCode#, #inventName#, #spec#, #deleteFlag#, #companyCode#, #companyName#, #inventType#, #inventCode#, #inventName#, #spec#,
#material#, #unit#, #length#, #width#, #thick#, #purQty#, #purUnitWeight#, #purWeight#, #receiveQty#, #material#, #unit#, #length#, #width#, #thick#, #purQty#, #purUnitWeight#, #purWeight#, #receiveQty#,
#receiveWeight#, #price#, #amount#, #taxIncludeAmount#, #taxAmount#, #taxRate#, #inventTypeDetail#, #receiveWeight#, #price#, #amount#, #taxIncludeAmount#, #taxAmount#, #taxRate#, #inventTypeDetail#,
#primaryId#,#projCode#,#projName#,#calculationMethod#, #planDetailId#, #contractNo#, #contractLineNo# #primaryId#,#projCode#,#projName#,#calculationMethod#, #planDetailId#, #contractNo#, #contractLineNo#,
#status#
) )
</insert> </insert>
......
...@@ -274,23 +274,15 @@ ...@@ -274,23 +274,15 @@
<update id="update"> <update id="update">
UPDATE ${hggpSchema}.HGCG003 UPDATE ${hggpSchema}.HGCG003
SET SET
ID = #id#,
SUP_CODE = #supCode#, <!-- 供应商编码 --> SUP_CODE = #supCode#, <!-- 供应商编码 -->
SUP_NAME = #supName#, <!-- 供应商名称 --> SUP_NAME = #supName#, <!-- 供应商名称 -->
PUR_USER_ID = #purUserId#, <!-- 采购员 -->
PUR_USER_NAME = #purUserName#, <!-- 采购员名称 -->
RECEIVE_QTY = #receiveQty#, <!-- 收货数量 -->
RECEIVE_WEIGHT = #receiveWeight#, <!-- 收货重量 -->
AMOUNT = #amount#, <!-- 金额 -->
TAX_INCLUDE_AMOUNT = #taxIncludeAmount#, <!-- 含税金额 -->
TAX_AMOUNT = #taxAmount#, <!-- 税额 -->
TAX_RATE = #taxRate#, <!-- 税率 -->
RECEIVE_DATE = REPLACE(#receiveDate#, '-', ''), <!-- 收货日期 -->
PROJ_CODE = #projCode#, <!-- 项目编号 --> PROJ_CODE = #projCode#, <!-- 项目编号 -->
PROJ_NAME = #projName#, <!-- 项目名称 --> PROJ_NAME = #projName#, <!-- 项目名称 -->
PUR_USER_ID = #purUserId#, <!-- 采购员 -->
PUR_USER_NAME = #purUserName#, <!-- 采购员名称 -->
RECEIVE_DATE = #receiveDate#, <!-- 收货日期 -->
<include refid="updateRevise"/> <include refid="updateRevise"/>
WHERE WHERE ID = #id#
ID = #id#
</update> </update>
<!-- 修改数量 --> <!-- 修改数量 -->
...@@ -299,6 +291,9 @@ ...@@ -299,6 +291,9 @@
SET SET
RECEIVE_QTY = #receiveQty#, <!-- 收货数量 --> RECEIVE_QTY = #receiveQty#, <!-- 收货数量 -->
RECEIVE_WEIGHT = #receiveWeight#, <!-- 收货重量 --> RECEIVE_WEIGHT = #receiveWeight#, <!-- 收货重量 -->
AMOUNT = #amount#, <!-- 金额(不含税金额) -->
TAX_INCLUDE_AMOUNT = #taxIncludeAmount#, <!-- 含税金额 -->
TAX_AMOUNT = #taxAmount#, <!-- 税额 -->
<include refid="updateRevise"/> <include refid="updateRevise"/>
WHERE RECEIVE_NO = #receiveNo# WHERE RECEIVE_NO = #receiveNo#
</update> </update>
......
...@@ -17,8 +17,10 @@ ...@@ -17,8 +17,10 @@
COMPANY_NAME as "companyName", <!-- 公司名称 --> COMPANY_NAME as "companyName", <!-- 公司名称 -->
RECEIVE_DATE as "receiveDate", <!-- 收货日期 --> RECEIVE_DATE as "receiveDate", <!-- 收货日期 -->
RECEIVE_NO as "receiveNo", <!-- 收货单号 --> RECEIVE_NO as "receiveNo", <!-- 收货单号 -->
RECEIVE_LINE_NO as "receiveLineNo", <!-- 收货单行号 -->
PLAN_NO as "planNo", <!-- 计划单号 --> PLAN_NO as "planNo", <!-- 计划单号 -->
CONTRACT_NO as "contractNo", <!-- 合同号 --> CONTRACT_NO as "contractNo", <!-- 合同号 -->
CONTRACT_LINE_NO as "contractLineNo", <!-- 合同行号 -->
CONTRACT_DETAIL_ID as "contractDetailId", <!-- 合同明细id --> CONTRACT_DETAIL_ID as "contractDetailId", <!-- 合同明细id -->
INVENT_TYPE as "inventType", <!-- 存货类型 --> INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 --> INVENT_CODE as "inventCode", <!-- 存货编码 -->
...@@ -238,8 +240,10 @@ ...@@ -238,8 +240,10 @@
COMPANY_NAME, <!-- 公司名称 --> COMPANY_NAME, <!-- 公司名称 -->
RECEIVE_DATE, <!-- 收货日期 --> RECEIVE_DATE, <!-- 收货日期 -->
RECEIVE_NO, <!-- 收货单号 --> RECEIVE_NO, <!-- 收货单号 -->
RECEIVE_LINE_NO, <!-- 收货单行号 -->
PLAN_NO, <!-- 计划单号 --> PLAN_NO, <!-- 计划单号 -->
CONTRACT_NO, <!-- 合同号 --> CONTRACT_NO, <!-- 合同号 -->
CONTRACT_LINE_NO, <!-- 合同行号 -->
CONTRACT_DETAIL_ID, <!-- 合同明细id --> CONTRACT_DETAIL_ID, <!-- 合同明细id -->
INVENT_TYPE, <!-- 存货类型 --> INVENT_TYPE, <!-- 存货类型 -->
INVENT_CODE, <!-- 存货编码 --> INVENT_CODE, <!-- 存货编码 -->
...@@ -272,7 +276,8 @@ ...@@ -272,7 +276,8 @@
UN_CANCEL_AMOUNT UN_CANCEL_AMOUNT
) VALUES ( ) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#,
#companyCode#, #companyName#, #receiveDate#, #receiveNo#, #planNo#, #contractNo#, #companyCode#, #companyName#, #receiveDate#, #receiveNo#, #receiveLineNo#, #planNo#,
#contractNo#, #contractLineNo#,
#contractDetailId#, #inventType#, #inventCode#, #inventName#, #specId#, #spec#, #contractDetailId#, #inventType#, #inventCode#, #inventName#, #specId#, #spec#,
#material#, #unit#, #length#, #width#, #thick#, #receiveQty#, #deliverQty#, #material#, #unit#, #length#, #width#, #thick#, #receiveQty#, #deliverQty#,
#depositQty#, #receiveUnitWeight#, #receiveWeight#, #status#, #price#, #amount#, #depositQty#, #receiveUnitWeight#, #receiveWeight#, #status#, #price#, #amount#,
...@@ -288,14 +293,6 @@ ...@@ -288,14 +293,6 @@
<update id="update"> <update id="update">
UPDATE ${hggpSchema}.HGCG003A UPDATE ${hggpSchema}.HGCG003A
SET SET
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 -->
RECEIVE_DATE = #receiveDate#, <!-- 收货日期 -->
RECEIVE_NO = #receiveNo#, <!-- 收货单号 -->
CONTRACT_NO = #contractNo#, <!-- 合同号 -->
INVENT_TYPE = #inventType#, <!-- 存货类型 --> INVENT_TYPE = #inventType#, <!-- 存货类型 -->
INVENT_CODE = #inventCode#, <!-- 存货编码 --> INVENT_CODE = #inventCode#, <!-- 存货编码 -->
INVENT_NAME = #inventName#, <!-- 存货名称 --> INVENT_NAME = #inventName#, <!-- 存货名称 -->
...@@ -309,21 +306,17 @@ ...@@ -309,21 +306,17 @@
RECEIVE_QTY = #receiveQty#, <!-- 收货数量 --> RECEIVE_QTY = #receiveQty#, <!-- 收货数量 -->
RECEIVE_UNIT_WEIGHT = #receiveUnitWeight#, <!-- 收货单重 --> RECEIVE_UNIT_WEIGHT = #receiveUnitWeight#, <!-- 收货单重 -->
RECEIVE_WEIGHT = #receiveWeight#, <!-- 收货重量 --> RECEIVE_WEIGHT = #receiveWeight#, <!-- 收货重量 -->
STATUS = #status#, <!-- 状态:0-已收货,1-已入库,2-部分入库,3-退货 -->
PRICE = #price#, <!-- 单价 --> PRICE = #price#, <!-- 单价 -->
AMOUNT = #amount#, <!-- 金额(不含税金额) --> AMOUNT = #amount#, <!-- 金额(不含税金额) -->
TAX_INCLUDE_AMOUNT = #taxIncludeAmount#, <!-- 含税金额 --> TAX_INCLUDE_AMOUNT = #taxIncludeAmount#, <!-- 含税金额 -->
TAX_AMOUNT = #taxAmount#, <!-- 税额 --> TAX_AMOUNT = #taxAmount#, <!-- 税额 -->
TAX_RATE = #taxRate#, <!-- 税率 --> TAX_RATE = #taxRate#, <!-- 税率 -->
INVENT_TYPE_DETAIL = #inventTypeDetail#, <!-- 存货类型大类 --> INVENT_TYPE_DETAIL = #inventTypeDetail#, <!-- 存货类型大类 -->
PRIMARY_ID = #primaryId#, <!-- 主表id -->
CONTRACT_DETAIL_ID = #contractDetailId#, <!-- 合同明细id -->
PROJ_CODE = #projCode#, <!-- 项目编码 -->
PROJ_NAME = #projName#, <!-- 项目名称 -->
CALCULATION_METHOD = #calculationMethod#, CALCULATION_METHOD = #calculationMethod#,
IS_INVOICING = #isInvoicing#, IS_INVOICING = #isInvoicing#,
CANCEL_AMOUNT = #cancelAmount#, CANCEL_AMOUNT = #cancelAmount#,
UN_CANCEL_AMOUNT = #unCancelAmount# UN_CANCEL_AMOUNT = #unCancelAmount#,
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id# WHERE ID = #id#
</update> </update>
...@@ -392,8 +385,10 @@ ...@@ -392,8 +385,10 @@
a.COMPANY_NAME as "companyName", <!-- 公司名称 --> a.COMPANY_NAME as "companyName", <!-- 公司名称 -->
a.RECEIVE_DATE as "receiveDate", <!-- 收货日期 --> a.RECEIVE_DATE as "receiveDate", <!-- 收货日期 -->
a.RECEIVE_NO as "receiveNo", <!-- 收货单号 --> a.RECEIVE_NO as "receiveNo", <!-- 收货单号 -->
a.RECEIVE_LINE_NO as "receiveLineNo", <!-- 收货单行号 -->
a.PLAN_NO as "planNo", <!-- 计划单号 --> a.PLAN_NO as "planNo", <!-- 计划单号 -->
a.CONTRACT_NO as "contractNo", <!-- 合同号 --> a.CONTRACT_NO as "contractNo", <!-- 合同号 -->
a.CONTRACT_LINE_NO as "contractLineNo", <!-- 合同行号 -->
a.INVENT_TYPE as "inventType", <!-- 存货类型 --> a.INVENT_TYPE as "inventType", <!-- 存货类型 -->
a.INVENT_CODE as "inventCode", <!-- 存货编码 --> a.INVENT_CODE as "inventCode", <!-- 存货编码 -->
a.INVENT_NAME as "inventName", <!-- 存货名称 --> a.INVENT_NAME as "inventName", <!-- 存货名称 -->
......
...@@ -476,32 +476,40 @@ public class HGCGTools { ...@@ -476,32 +476,40 @@ public class HGCGTools {
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_RECEIVE, paramMap); DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_RECEIVE, paramMap);
}); });
} }
/**
* 修改主合同信息
*
* @param cg002
*/
public static void updateCg002Pur(HGCG002 cg002) { public static void updateCg002Pur(HGCG002 cg002) {
List<HGCG002B> hgcg002BList = HGCGTools.HgCg002B.listByPrimaryId(cg002.getId()); List<HGCG002B> dbCg002Bs = HGCGTools.HgCg002B.listByPrimaryId(cg002.getId());
//修改主表信息 // 采购数量
//采购数量 BigDecimal purQtySum = dbCg002Bs.stream().map(HGCG002B::getPurQty).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal purQtySum = hgcg002BList.stream().map(HGCG002B::getPurQty).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setPurQty(purQtySum); cg002.setPurQty(purQtySum);
//采购重量 //采购重量
BigDecimal purWeightSum = hgcg002BList.stream().map(HGCG002B::getPurWeight).reduce(BigDecimal.ZERO,BigDecimal::add); BigDecimal purWeightSum = dbCg002Bs.stream().map(HGCG002B::getPurWeight)
.reduce(BigDecimal.ZERO, BigDecimal::add);
cg002.setPurWeight(purWeightSum); cg002.setPurWeight(purWeightSum);
//收货数量 //收货数量
BigDecimal receiveQtySum = hgcg002BList.stream().map(HGCG002B::getReceiveQty).reduce(BigDecimal.ZERO,BigDecimal::add); BigDecimal receiveQtySum = dbCg002Bs.stream().map(HGCG002B::getReceiveQty)
.reduce(BigDecimal.ZERO, BigDecimal::add);
cg002.setReceiveQty(receiveQtySum); cg002.setReceiveQty(receiveQtySum);
//收货重量 //收货重量
BigDecimal receiveWeightSum = hgcg002BList.stream().map(HGCG002B::getReceiveWeight).reduce(BigDecimal.ZERO,BigDecimal::add); BigDecimal receiveWeightSum = dbCg002Bs.stream().map(HGCG002B::getReceiveWeight)
.reduce(BigDecimal.ZERO, BigDecimal::add);
cg002.setReceiveWeight(receiveWeightSum); cg002.setReceiveWeight(receiveWeightSum);
//金额(不含税金额) //金额(不含税金额)
BigDecimal amountSum = hgcg002BList.stream().map(HGCG002B::getAmount).reduce(BigDecimal.ZERO,BigDecimal::add); BigDecimal amountSum = dbCg002Bs.stream().map(HGCG002B::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
cg002.setAmount(amountSum); cg002.setAmount(amountSum);
//税额 //税额
BigDecimal taxAmountSum = hgcg002BList.stream().map(HGCG002B::getTaxAmount).reduce(BigDecimal.ZERO,BigDecimal::add); BigDecimal taxAmountSum = dbCg002Bs.stream().map(HGCG002B::getTaxAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
cg002.setTaxAmount(taxAmountSum); cg002.setTaxAmount(taxAmountSum);
//含税金额 //含税金额
BigDecimal taxIncludeAmountSum = hgcg002BList.stream().map(HGCG002B::getTaxIncludeAmount).reduce(BigDecimal.ZERO,BigDecimal::add); BigDecimal taxIncludeAmountSum = dbCg002Bs.stream().map(HGCG002B::getTaxIncludeAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
cg002.setTaxIncludeAmount(taxIncludeAmountSum); cg002.setTaxIncludeAmount(taxIncludeAmountSum);
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_PUR, cg002); DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_PUR, cg002);
} }
......
...@@ -9,6 +9,8 @@ import com.baosight.hggp.util.MapUtils; ...@@ -9,6 +9,8 @@ import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils; import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils; import com.baosight.hggp.util.StringUtils;
import org.apache.commons.collections.CollectionUtils;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -83,6 +85,9 @@ public class HGCGUtils { ...@@ -83,6 +85,9 @@ public class HGCGUtils {
* @return * @return
*/ */
public static Map<String, HGCG002A> lockGetData(List<String> contractNos) { public static Map<String, HGCG002A> lockGetData(List<String> contractNos) {
if (CollectionUtils.isEmpty(contractNos)) {
return null;
}
// 锁 // 锁
HGCGTools.HgCg002.lock(contractNos); HGCGTools.HgCg002.lock(contractNos);
// db数据 // db数据
...@@ -142,6 +147,9 @@ public class HGCGUtils { ...@@ -142,6 +147,9 @@ public class HGCGUtils {
* @return * @return
*/ */
public static Map<Long, HGCG002B> lockGetData(List<Long> ids) { public static Map<Long, HGCG002B> lockGetData(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
// 锁 // 锁
HGCGTools.HgCg002B.lock(ids); HGCGTools.HgCg002B.lock(ids);
// db数据 // db数据
......
...@@ -105,6 +105,8 @@ public class HGConstant { ...@@ -105,6 +105,8 @@ public class HGConstant {
public static final String CG_CONTRACT_LINE_NO = "CG_CONTRACT_LINE_NO"; public static final String CG_CONTRACT_LINE_NO = "CG_CONTRACT_LINE_NO";
// 采购收货号 // 采购收货号
public static final String CG_RECEIVE_NO = "CG_RECEIVE_NO"; public static final String CG_RECEIVE_NO = "CG_RECEIVE_NO";
// 采购收货行号
public static final String CG_RECEIVE_LINE_NO = "CG_RECEIVE_LINE_NO";
// 采购入库号 // 采购入库号
public static final String CG_DEPOSIT_NO = "CG_DEPOSIT_NO"; public static final String CG_DEPOSIT_NO = "CG_DEPOSIT_NO";
// 点检单号 // 点检单号
......
...@@ -31,8 +31,11 @@ ...@@ -31,8 +31,11 @@
<!-- 采购 --> <!-- 采购 -->
<sqlMap resource="com/baosight/hggp/hg/cg/sql/HGCG001.xml"/> <sqlMap resource="com/baosight/hggp/hg/cg/sql/HGCG001.xml"/>
<sqlMap resource="com/baosight/hggp/hg/cg/sql/HGCG001A.xml"/>
<sqlMap resource="com/baosight/hggp/hg/cg/sql/HGCG002.xml"/> <sqlMap resource="com/baosight/hggp/hg/cg/sql/HGCG002.xml"/>
<sqlMap resource="com/baosight/hggp/hg/cg/sql/HGCG002A.xml"/>
<sqlMap resource="com/baosight/hggp/hg/cg/sql/HGCG003.xml"/> <sqlMap resource="com/baosight/hggp/hg/cg/sql/HGCG003.xml"/>
<sqlMap resource="com/baosight/hggp/hg/cg/sql/HGCG003A.xml"/>
<!-- 库存 --> <!-- 库存 -->
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC001.xml"/> <sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC001.xml"/>
......
...@@ -93,16 +93,6 @@ $(function () { ...@@ -93,16 +93,6 @@ $(function () {
return dataItem["purUserName"]; return dataItem["purUserName"];
}, },
editor: function (container, options) { editor: function (container, options) {
// let inInfo = new EiInfo();
// inInfo.set("inqu_status-0-companyCode", options.model["companyCode"]);
// inInfo.set("field", options.field);
// EiCommunicator.send("HGSC001", "userByCompanyComboBox", inInfo, {
// onSuccess: function (ei) {
// userByCompany = ei.getBlock("userByCompany").getMappedRows();
// },
// onFail: function (ei) {
// }
// }, {async: false});
var input = $('<input />'); var input = $('<input />');
input.attr("name", options.field); input.attr("name", options.field);
input.attr("id", options.field); input.attr("id", options.field);
...@@ -168,6 +158,7 @@ $(function () { ...@@ -168,6 +158,7 @@ $(function () {
// change事件 // change事件
grid.dataSource.bind("change", function (e) { grid.dataSource.bind("change", function (e) {
supCodeChange(e); supCodeChange(e);
purUserIdChange(e);
var item = e.items[0]; var item = e.items[0];
if (e.field == "price") { if (e.field == "price") {
calAmount(item); calAmount(item);
...@@ -317,6 +308,26 @@ let supCodeChange = function (e) { ...@@ -317,6 +308,26 @@ let supCodeChange = function (e) {
} }
/** /**
* 采购员变更
*/
let purUserIdChange = function (e) {
if (e.field != "purUserId") {
return;
}
let item = e.items[0];
let userRecordRows = __eiInfo.blocks.user_block_id.rows;
for (let k = 0; k < resultGrid.getCheckedRowsIndex() + 1; k++) {
for (let i = 0; i < userRecordRows.length; i++) {
if (userRecordRows[i][1] === item.supCode) {
let userName = userRecordRows[i][0];
resultGrid.setCellValue(item, 'purUserName', userName == null ? "" : userName);
return;
}
}
}
}
/**
* 保存 * 保存
*/ */
let save = function () { let save = function () {
......
...@@ -65,7 +65,12 @@ ...@@ -65,7 +65,12 @@
<EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/> <EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/>
</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:EFComboColumn ename="purUserId" cname="采购员" width="120" align="left" defaultValue=""
filter="contains" required="true" columnTemplate="#=valueField# - #=textField#"
itemTemplate="#=valueField# - #=textField#">
<EF:EFOptions blockId="user_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="purUserName" cname="采购员姓名" enable="false" width="120" align="center" hidden="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" sumType="page"/> defaultValue="0" sumType="page"/>
<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"
......
...@@ -8,8 +8,7 @@ $(function () { ...@@ -8,8 +8,7 @@ $(function () {
pageSize: 20, pageSize: 20,
pageSizes: [20, 50, 70, 100], pageSizes: [20, 50, 70, 100],
}, },
columns: [ columns: [{
{
field: "inventCode", field: "inventCode",
template: function (item) { template: function (item) {
let template = item.inventCode; let template = item.inventCode;
...@@ -50,54 +49,36 @@ $(function () { ...@@ -50,54 +49,36 @@ $(function () {
filter: "contains" filter: "contains"
}); });
} }
}, }, {
{ field: "purUserName",
field: "primaryId", template: function (dataItem) {
template: function (item) { for (let i = 0; i < userByCompany.length; i++) {
item['primaryId'] =$("#inqu_status-0-primaryId").val(); let purUserName = dataItem['purUserName'];
return $("#inqu_status-0-primaryId").val(); if (purUserName) {
} if (userByCompany[i]['userName'] === purUserName.userName) {
}, return userByCompany[i]['userName'];
{
field: "purUserName",
template: function (dataItem) {
for (let i = 0; i < userByCompany.length; i++) {
let purUserName = dataItem['purUserName'];
if(purUserName){
if (userByCompany[i]['userName'] === purUserName.userName) {
return userByCompany[i]['userName'];
}
} }
} }
return dataItem["purUserName"];
},
editor: function (container, options) {
// let inInfo = new EiInfo();
// inInfo.set("inqu_status-0-companyCode", options.model["companyCode"]);
// inInfo.set("field", options.field);
// EiCommunicator.send("HGSC001", "userByCompanyComboBox", inInfo, {
// onSuccess: function (ei) {
// userByCompany = ei.getBlock("userByCompany").getMappedRows();
// },
// onFail: function (ei) {
// }
// }, {async: false});
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoDropDownList({
dataSource: userByCompany,
minLength: 0,
dataTextField: "userName",
dataValueField: "userName",
optionLabelTemplate: "[#:loginName#]#:userName#-#:depName#",
valueTemplate: "[#:loginName#]#:userName#-#:depName#",
template: "[#:loginName#]#:userName#-#:depName#",
filter: "contains"
});
} }
return dataItem["purUserName"];
},
editor: function (container, options) {
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoDropDownList({
dataSource: userByCompany,
minLength: 0,
dataTextField: "userName",
dataValueField: "userName",
optionLabelTemplate: "[#:loginName#]#:userName#-#:depName#",
valueTemplate: "[#:loginName#]#:userName#-#:depName#",
template: "[#:loginName#]#:userName#-#:depName#",
filter: "contains"
});
} }
}
], ],
beforeEdit: function (e) { beforeEdit: function (e) {
var status = $("#inqu_status-0-status").val(); var status = $("#inqu_status-0-status").val();
......
...@@ -69,8 +69,9 @@ ...@@ -69,8 +69,9 @@
<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"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" hidden="true"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" hidden="true"/>
<EF:EFColumn ename="contractNo" cname="合同号" enable="false" width="120" align="center" hidden="true"/> <EF:EFColumn ename="contractLineNo" cname="合同行号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center" hidden="true"/> <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="supCode" cname="供应商编号" enable="false" width="120" align="center" hidden="true"/> <EF:EFColumn ename="supCode" cname="供应商编号" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="purUserName" cname="采购员" width="100" align="center" required="true" hidden="true"/> <EF:EFColumn ename="purUserName" cname="采购员" width="100" align="center" required="true" hidden="true"/>
......
...@@ -51,16 +51,6 @@ $(function () { ...@@ -51,16 +51,6 @@ $(function () {
return dataItem["purUserName"]; return dataItem["purUserName"];
}, },
editor: function (container, options) { editor: function (container, options) {
// let inInfo = new EiInfo();
// inInfo.set("inqu_status-0-companyCode", options.model["companyCode"]);
// inInfo.set("field", options.field);
// EiCommunicator.send("HGSC001", "userByCompanyComboBox", inInfo, {
// onSuccess: function (ei) {
// userByCompany = ei.getBlock("userByCompany").getMappedRows();
// },
// onFail: function (ei) {
// }
// }, {async: false});
var input = $('<input />'); var input = $('<input />');
input.attr("name", options.field); input.attr("name", options.field);
input.attr("id", options.field); input.attr("id", options.field);
...@@ -170,6 +160,7 @@ $(function () { ...@@ -170,6 +160,7 @@ $(function () {
// change事件 // change事件
grid.dataSource.bind("change", function (e) { grid.dataSource.bind("change", function (e) {
supCodeChange(e); supCodeChange(e);
supCodeChange(e);
if (e.field == "companyCode") { if (e.field == "companyCode") {
for (let i = 0; i < companyCodeBox.length; i++) { for (let i = 0; i < companyCodeBox.length; i++) {
if (companyCodeBox[i]['companyCode'] === e.items[0]['companyCode']) { if (companyCodeBox[i]['companyCode'] === e.items[0]['companyCode']) {
...@@ -355,19 +346,40 @@ let supCodeChange = function (e) { ...@@ -355,19 +346,40 @@ let supCodeChange = function (e) {
} }
} }
/**
* 采购员变更
*/
let purUserIdChange = function (e) {
if (e.field != "purUserId") {
return;
}
let item = e.items[0];
let userRecordRows = __eiInfo.blocks.user_block_id.rows;
for (let k = 0; k < resultGrid.getCheckedRowsIndex() + 1; k++) {
for (let i = 0; i < userRecordRows.length; i++) {
if (userRecordRows[i][1] === item.supCode) {
let userName = userRecordRows[i][0];
resultGrid.setCellValue(item, 'purUserName', userName == null ? "" : userName);
return;
}
}
}
}
/** /**
* 显示详情 * 显示详情
*/ */
function showDetail(id,status,source) { function showDetail(id, status, source) {
JSColorbox.open({ JSColorbox.open({
href: "HGCG003B?methodName=initLoad&inqu_status-0-primaryId=" + id+"&status="+status+"&source="+source, href: "HGCG003B?methodName=initLoad&inqu_status-0-primaryId=" + id + "&status=" + status + "&source="
+ source,
title: "<div style='text-align: center;'>详情</div>", title: "<div style='text-align: center;'>详情</div>",
width: "80%", width: "80%",
height: "90%", height: "90%",
callbackName: windowCallback callbackName: windowCallback
}); });
} }
function windowCallback() { function windowCallback() {
query(); query();
JSColorbox.close(); JSColorbox.close();
......
...@@ -44,17 +44,17 @@ ...@@ -44,17 +44,17 @@
<EF:EFCodeOption codeName="hggp.hpcg.receiveSource"/> <EF:EFCodeOption codeName="hggp.hpcg.receiveSource"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="companyCode" cname="公司编码" <EF:EFComboColumn ename="companyCode" cname="公司编码"
columnTemplate="#=companyName#" itemTemplate="#=companyName#" columnTemplate="#=companyName#" itemTemplate="#=companyName#"
textField="companyName" valueField="companyCode" textField="companyName" valueField="companyCode"
maxLength="16" readonly="false" width="100" required="true" maxLength="16" readonly="false" width="100" required="true"
align="center" filter="contains" sort="true"> align="center" filter="contains" sort="true">
<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="公司名称" enable="false" width="200" align="left"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="true" width="120" align="center" required="true"/> <EF:EFColumn ename="projCode" cname="项目编码" width="140" 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"/>
<EF:EFColumn ename="receiveNo" cname="收货单号" enable="false" width="120" align="center"/> <EF:EFColumn ename="receiveNo" 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.receiveStatus"/> <EF:EFCodeOption codeName="hggp.hgcg.receiveStatus"/>
...@@ -64,7 +64,12 @@ ...@@ -64,7 +64,12 @@
<EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/> <EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/>
</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:EFComboColumn ename="purUserId" cname="采购员" width="120" align="left" defaultValue=""
filter="contains" required="true" columnTemplate="#=valueField# - #=textField#"
itemTemplate="#=valueField# - #=textField#">
<EF:EFOptions blockId="user_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="purUserName" cname="采购员姓名" enable="false" width="120" align="center" hidden="true"/>
<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}"
sumType="page"/> sumType="page"/>
<EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N3}" <EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N3}"
......
...@@ -58,7 +58,7 @@ $(function () { ...@@ -58,7 +58,7 @@ $(function () {
}], }],
beforeEdit: function (e) { beforeEdit: function (e) {
var status = $("#status").val(); var status = $("#status").val();
if (status != '0') { if (status != '0' && status != '2') {
e.preventDefault(); e.preventDefault();
} }
var source = $("#source").val(); var source = $("#source").val();
...@@ -80,13 +80,16 @@ $(function () { ...@@ -80,13 +80,16 @@ $(function () {
// 此grid对象 // 此grid对象
grid.dataSource.bind("change", function (e) { grid.dataSource.bind("change", function (e) {
var item = e.items[0]; var item = e.items[0];
//数量发生变化进行计算 // 数量发生变化进行计算
if(e.field === "receiveQty"){ if(e.field === "receiveQty"){
calAmount(item) calAmount(item)
} }
if(e.field === "price"){ if(e.field === "price"){
calAmount(item) calAmount(item)
} }
if(e.field === "taxRate"){
calAmount(item)
}
if(e.field === "receiveWeight"){ if(e.field === "receiveWeight"){
calAmount(item) calAmount(item)
} }
...@@ -96,18 +99,38 @@ $(function () { ...@@ -96,18 +99,38 @@ $(function () {
if (e.field === "inventCode") { if (e.field === "inventCode") {
for (let i = 0; i < inventRecordBoxBlockId.length; i++) { for (let i = 0; i < inventRecordBoxBlockId.length; i++) {
if (inventRecordBoxBlockId[i]['valueField'] === e.items[0].inventCode) { if (inventRecordBoxBlockId[i]['valueField'] === e.items[0].inventCode) {
resultGrid.setCellValue(e.items[0], 'inventName', inventRecordBoxBlockId[i]['textField']) resultGrid.setCellValue(e.items[0], 'inventName',
resultGrid.setCellValue(e.items[0], 'inventTypeDetail', inventRecordBoxBlockId[i]['param1Field']) inventRecordBoxBlockId[i]['textField']
resultGrid.setCellValue(e.items[0], 'inventType', inventRecordBoxBlockId[i]['param3Field']) )
resultGrid.setCellValue(e.items[0], 'spec', inventRecordBoxBlockId[i]['param4Field']) resultGrid.setCellValue(e.items[0], 'inventTypeDetail',
resultGrid.setCellValue(e.items[0], 'material', inventRecordBoxBlockId[i]['param5Field']) inventRecordBoxBlockId[i]['param1Field']
resultGrid.setCellValue(e.items[0], 'unit', inventRecordBoxBlockId[i]['param6Field']) )
resultGrid.setCellValue(e.items[0], 'length', inventRecordBoxBlockId[i]['param7Field']) resultGrid.setCellValue(e.items[0], 'inventType',
resultGrid.setCellValue(e.items[0], 'width', inventRecordBoxBlockId[i]['param8Field']) inventRecordBoxBlockId[i]['param3Field']
resultGrid.setCellValue(e.items[0], 'thick', inventRecordBoxBlockId[i]['param9Field']) )
//系数 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']
)
// 系数
let coefficient = inventRecordBoxBlockId[i]['param10Field'] let coefficient = inventRecordBoxBlockId[i]['param10Field']
calUnitWeight(e.items[0],e.items[0].length,e.items[0].width,e.items[0].thick,coefficient); calUnitWeight(e.items[0], e.items[0].length, e.items[0].width,
e.items[0].thick, coefficient
);
break break
} }
} }
...@@ -143,15 +166,15 @@ $(window).load(function () { ...@@ -143,15 +166,15 @@ $(window).load(function () {
initInventCode(); initInventCode();
var status = $("#status").val(); var status = $("#status").val();
if(status != '0'){ if (status != '0' && status != '2') {
$(".k-grid-add").hide(); $(".k-grid-add").hide();
$(".k-grid-save-changes").hide(); $(".k-grid-save-changes").hide();
$(".k-grid-cancel-changes").hide(); $(".k-grid-cancel-changes").hide();
$(".k-grid-delete").hide(); $(".k-grid-delete").hide();
}else { } else {
//合同选择的存货不让新增、删除 //合同选择的存货不让新增、删除
var source = $("#source").val(); var source = $("#source").val();
if(source === '0'){ if (source === '0') {
$(".k-grid-add").hide(); $(".k-grid-add").hide();
$(".k-grid-save-changes").hide(); $(".k-grid-save-changes").hide();
$(".k-grid-cancel-changes").hide(); $(".k-grid-cancel-changes").hide();
...@@ -170,23 +193,34 @@ $(window).load(function () { ...@@ -170,23 +193,34 @@ $(window).load(function () {
* @param coefficient * @param coefficient
*/ */
let calAmount = function (item) { let calAmount = function (item) {
let totalAmount;
let price = item.price; let price = item.price;
//计算方式为重量乘单价 //计算方式为重量乘单价
if (item.calculationMethod == 1) { if (item.calculationMethod == 1) {
let receiveWeight = item.receiveWeight; let receiveWeight = item.receiveWeight;
if (!isBlank(receiveWeight) && !isBlank(price)) { if (!isBlank(receiveWeight) && !isBlank(price)) {
// 重量*单价金额 // 重量*单价金额
let totalAmount = parseFloat(receiveWeight) * parseFloat(price); totalAmount = parseFloat(receiveWeight) * parseFloat(price);
resultGrid.setCellValue(item, 'amount', totalAmount)
} }
} else { } else {
let receiveQty = item.receiveQty; let receiveQty = item.receiveQty;
if (!isBlank(receiveQty) && !isBlank(price)) { if (!isBlank(receiveQty) && !isBlank(price)) {
// 数量*单价金额 // 数量*单价金额
let totalAmount = parseFloat(receiveQty) * parseFloat(price); totalAmount = parseFloat(receiveQty) * parseFloat(price);
resultGrid.setCellValue(item, 'amount', totalAmount)
} }
} }
if (isBlank(totalAmount)) {
return;
}
// 不含税金额
let amount = isBlank(item.taxRate) ? totalAmount : totalAmount / (1 + item.taxRate / 100);
// 税额
let taxAmount = totalAmount - amount;
// 含税金额
let taxIncludeAmount = totalAmount;
resultGrid.setCellValue(item, 'amount', amount)
resultGrid.setCellValue(item, 'taxAmount', taxAmount)
resultGrid.setCellValue(item, 'taxIncludeAmount', taxIncludeAmount)
} }
/** /**
...@@ -273,13 +307,12 @@ let remove = function () { ...@@ -273,13 +307,12 @@ let remove = function () {
}); });
} }
let calUnitWeight = function (item, length, width, thick, coefficient) {
let calUnitWeight = function (item,length,width,thick,coefficient) { let l = Number(length) || 1;
let l = Number(length)||1; let w = Number(width) || 1;
let w = Number(width)||1; let t = Number(thick) || 1;
let t = Number(thick)||1; let unitWeight = (l * w * t) > 1 ? l * w * t * Number(coefficient) / 100000 : 0;
let amount = (l * w * t )>1? l * w * t * Number(coefficient)/100000:0;
//item['amount'] = amount.toString(); //item['amount'] = amount.toString();
resultGrid.setCellValue(item, 'receiveUnitWeight', amount); resultGrid.setCellValue(item, 'receiveUnitWeight', unitWeight);
resultGrid.setCellValue(item, 'receiveWeight', item.receiveQty*amount); resultGrid.setCellValue(item, 'receiveWeight', item.receiveQty * unitWeight);
} }
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