Commit 21b0ee32 by 宋祥

1.fixBug:修复采购合同数量金额不对的问题

parent 03d12f35
...@@ -245,26 +245,27 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -245,26 +245,27 @@ public class ServiceHGCG003 extends ServiceBase {
HGCG003 dbCg003 = dbCg003Map.get(receiveNo); HGCG003 dbCg003 = dbCg003Map.get(receiveNo);
dbCg003.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode()); dbCg003.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGCG003.DELETE, dbCg003); DaoUtils.update(HGCG003.DELETE, dbCg003);
if(fCg003.getSource().intValue() == HGConstant.CgSource.DEFAULT){ if (fCg003.getSource().intValue() == HGConstant.CgSource.DEFAULT) {
// 更新合同状态 // 更新合同状态
HGCGTools.HgCg002.updateReceive(dbCg002AMap.get(contractNo), dbCg003.getReceiveQty().negate()); HGCGTools.HgCg002.updateReceive(dbCg002AMap.get(contractNo), dbCg003.getReceiveQty().negate());
} }
} }
//子表修改 //子表修改
List<Long> cg003Ids = fCg003s.stream().map(o->o.getId()).collect(Collectors.toList()); List<Long> cg003Ids = fCg003s.stream().map(o -> o.getId()).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(cg003Ids)){ if (!CollectionUtils.isEmpty(cg003Ids)) {
List<HGCG003B> fCg003Bs = HGCGTools.HgCg003B.listByPrimaryIds(cg003Ids); List<HGCG003B> fCg003Bs = HGCGTools.HgCg003B.listByPrimaryIds(cg003Ids);
// 采购合同明细DB数据 // 采购合同明细DB数据
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));
for (HGCG003B fCg003B : fCg003Bs) { for (HGCG003B fCg003B : fCg003Bs) {
HGCG003 hgcg003 = fCg003s.stream().filter(o->o.getId().compareTo(fCg003B.getPrimaryId()) == 0).findAny().orElse(null); HGCG003 hgcg003 = fCg003s.stream().filter(o -> o.getId().compareTo(fCg003B.getPrimaryId()) == 0)
.findAny().orElse(null);
fCg003B.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode()); fCg003B.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGCG003B.DELETE, fCg003B); DaoUtils.update(HGCG003B.DELETE, fCg003B);
//数据来源为合同的才需要更新合同状态 // 数据来源为合同的才需要更新合同状态
if(Objects.nonNull(hgcg003) && hgcg003.getSource().intValue() == HGConstant.CgSource.DEFAULT){ if (Objects.nonNull(hgcg003) && hgcg003.getSource().intValue() == HGConstant.CgSource.DEFAULT) {
// 更新合同状态 HGCG002B dbCg002b = dbCg002BMap.get(fCg003B.getContractDetailId());
HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()), fCg003B.getReceiveQty().negate()); HGCGTools.HgCg002B.updateReceive(dbCg002b, fCg003B.getReceiveQty().negate());
} }
} }
} }
......
...@@ -22,6 +22,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase; ...@@ -22,6 +22,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays; import java.util.Arrays;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
...@@ -86,12 +87,14 @@ public class ServiceHGCG003A extends ServiceBase { ...@@ -86,12 +87,14 @@ public class ServiceHGCG003A extends ServiceBase {
try { try {
List<HGCG002B> fCg002Bs = MapUtils.toDaoEPBases(inInfo, HGCG002B.class); List<HGCG002B> fCg002Bs = MapUtils.toDaoEPBases(inInfo, HGCG002B.class);
// db数据 // db数据
Map<Long, HGCG002B> dbCg002AMap = HGCGUtils.HgCg002B.lockGetDataEp(fCg002Bs); Map<Long, HGCG002B> dbCg002bMap = HGCGUtils.HgCg002B.lockGetDataEp(fCg002Bs);
HGCG002 cg001 = HGCGTools.HgCg002.get(fCg002Bs.get(0).getPrimaryId()); HGCG002 dbCg002 = HGCGTools.HgCg002.get(fCg002Bs.get(0).getPrimaryId());
// 数据校验 // 数据校验
this.checkConfirmData(fCg002Bs, dbCg002AMap,cg001); this.checkConfirmData(fCg002Bs, dbCg002bMap, dbCg002);
// 计算总金额和总重
this.calcAmountAndWeight(fCg002Bs, dbCg002bMap, dbCg002);
// 保存数据 // 保存数据
this.confirmData(fCg002Bs, dbCg002AMap,cg001); this.confirmData(fCg002Bs, dbCg002bMap, 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() + "]条数据保存成功!");
...@@ -119,58 +122,96 @@ public class ServiceHGCG003A extends ServiceBase { ...@@ -119,58 +122,96 @@ public class ServiceHGCG003A extends ServiceBase {
fCg002B.getBcReceiveQty(), fCg002B.getBcMaxReceiveQty())); fCg002B.getBcReceiveQty(), fCg002B.getBcMaxReceiveQty()));
} }
} }
/**
* 计算总金额和总重
*
* @param fCg002Bs
* @param dbCg002BMap
* @param dbCg002
*/
private void calcAmountAndWeight(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap, HGCG002 dbCg002) {
for (HGCG002B fCg002B : fCg002Bs) {
Long id = fCg002B.getId();
HGCG002B dbCg002b = dbCg002BMap.get(id);
// 总重
fCg002B.setReceiveWeight(fCg002B.getBcReceiveQty().multiply(dbCg002b.getPurUnitWeight()));
// 含税总金额
BigDecimal amount = fCg002B.getReceiveWeight().multiply(dbCg002b.getPrice());
// 如果税率不为空,总金额减去税额
if (dbCg002b.getTaxRate() != null) {
amount = amount.subtract(amount.multiply(dbCg002b.getTaxRate()).divide(new BigDecimal("100")));
}
fCg002B.setAmount(amount);
}
}
/** /**
* 数据保存 * 数据保存
* @param fCg002Bs *
* @param fCg002Bs
* @param dbCg002BMap * @param dbCg002BMap
* @param cg002 * @param cg002
*/ */
private void confirmData(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap, HGCG002 cg002) { private void confirmData(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap, HGCG002 cg002) {
HGCG002B hgcg002B = fCg002Bs.get(0); HGCG002B hgcg002B = fCg002Bs.get(0);
HGCG003 newCg003 = new HGCG003(); HGCG003 newCg003 = new HGCG003();
BeanUtils.copyProperties(hgcg002B, newCg003,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime"); BeanUtils.copyProperties(hgcg002B, newCg003, "id", "createdBy", "createdName", "createdTime", "updatedBy",
"updatedName", "updatedTime");
newCg003.setReceiveDate(DateUtils.shortDate()); newCg003.setReceiveDate(DateUtils.shortDate());
newCg003.setReceiveNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_RECEIVE_NO)); newCg003.setReceiveNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_RECEIVE_NO));
BigDecimal bcReceiveQtySum = fCg002Bs.stream().map(HGCG002B::getBcReceiveQty).reduce(BigDecimal.ZERO,BigDecimal::add); // 计算收获总数量
BigDecimal bcReceiveQtySum = fCg002Bs.stream().map(HGCG002B::getBcReceiveQty)
.reduce(BigDecimal.ZERO, BigDecimal::add);
newCg003.setReceiveQty(bcReceiveQtySum); newCg003.setReceiveQty(bcReceiveQtySum);
BigDecimal purUnitWeightSum = fCg002Bs.stream().map(HGCG002B::getPurUnitWeight).reduce(BigDecimal.ZERO,BigDecimal::add); // 计算收货总重
newCg003.setReceiveUnitWeight(purUnitWeightSum); BigDecimal receiveWeight = fCg002Bs.stream().map(HGCG002B::getReceiveWeight)
newCg003.setReceiveWeight(newCg003.getReceiveQty().multiply(newCg003.getReceiveUnitWeight())); .reduce(BigDecimal.ZERO, BigDecimal::add);
newCg003.setReceiveWeight(receiveWeight);
newCg003.setReceiveUnitWeight(receiveWeight.divide(bcReceiveQtySum).setScale(3, RoundingMode.HALF_UP));
// 计算收货总金额
BigDecimal receiveAmount = fCg002Bs.stream().map(HGCG002B::getAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
newCg003.setAmount(receiveAmount);
newCg003.setStatus(HGConstant.CgReceiveStatus.S_0); newCg003.setStatus(HGConstant.CgReceiveStatus.S_0);
newCg003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); newCg003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
newCg003.setSource(HGConstant.CgSource.DEFAULT); newCg003.setSource(HGConstant.CgSource.DEFAULT);
DaoUtils.insert(HGCG003.INSERT, newCg003); DaoUtils.insert(HGCG003.INSERT, newCg003);
// 写入明细数据
for (HGCG002B fCg002B : fCg002Bs) { for (HGCG002B fCg002B : fCg002Bs) {
insertDetails(fCg002B,newCg003); Long id = fCg002B.getId();
HGCG002B dbCg002b = dbCg002BMap.get(id);
insertDetails(fCg002B, dbCg002b, newCg003);
} }
List<HGCG002> hgcg002List = new LinkedList<>(); List<HGCG002> hgcg002List = new LinkedList<>();
hgcg002List.add(cg002); hgcg002List.add(cg002);
HGCGTools.HgCg002.updateContractPrimary(hgcg002List); HGCGTools.HgCg002.updateContractPrimary(hgcg002List);
} }
private void insertDetails(HGCG002B dbCg002B, HGCG003 newCg003) { /**
* 新增明细数据
*
* @param fCg002B
* @param dbCg002b
* @param newCg003
*/
private void insertDetails(HGCG002B fCg002B, HGCG002B dbCg002b, HGCG003 newCg003) {
HGCG003B cg003B = new HGCG003B(); HGCG003B cg003B = new HGCG003B();
//拷贝主表明细信息 //拷贝主表明细信息
BeanUtils.copyProperties(newCg003,cg003B,"id"); BeanUtils.copyProperties(newCg003, cg003B, "id");
//拷贝明细信息 //拷贝明细信息
BeanUtils.copyProperties(dbCg002B,cg003B,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime" BeanUtils.copyProperties(fCg002B, cg003B, "id", "createdBy", "createdName", "createdTime", "updatedBy",
,"contractNo","planNo","supCode","supName","purUserId","purUserName","status"); "updatedName", "updatedTime", "contractNo", "planNo", "supCode", "supName", "purUserId",
"purUserName", "status");
cg003B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); cg003B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
cg003B.setPrimaryId(newCg003.getId()); cg003B.setPrimaryId(newCg003.getId());
cg003B.setReceiveUnitWeight(dbCg002B.getPurUnitWeight()); cg003B.setReceiveUnitWeight(fCg002B.getPurUnitWeight());
cg003B.setReceiveQty(dbCg002B.getBcReceiveQty()); cg003B.setReceiveQty(fCg002B.getBcReceiveQty());
cg003B.setReceiveWeight(dbCg002B.getBcReceiveQty().multiply(dbCg002B.getPurUnitWeight())); cg003B.setReceiveWeight(fCg002B.getReceiveWeight());
cg003B.setContractDetailId(dbCg002B.getId()); cg003B.setContractDetailId(fCg002B.getId());
DaoUtils.insert(HGCG003B.INSERT,cg003B); DaoUtils.insert(HGCG003B.INSERT, cg003B);
BigDecimal diffQty = cg003B.getReceiveQty().subtract(dbCg002B.getReceiveQty());
Integer status = diffQty.compareTo(BigDecimal.ZERO) == 0 ? HGConstant.CgContractStatus.S_5
: HGConstant.CgContractStatus.S_4;
dbCg002B.setStatus(status);
// 更新合同状态 // 更新合同状态
HGCGTools.HgCg002B.updateReceive(dbCg002B, cg003B.getReceiveQty()); HGCGTools.HgCg002B.updateReceive(dbCg002b, cg003B.getReceiveQty());
} }
} }
...@@ -155,7 +155,8 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -155,7 +155,8 @@ public class ServiceHGCG003B extends ServiceBase {
* @param cg003 * @param cg003
* @param dbCg002BMap * @param dbCg002BMap
*/ */
private void editData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003BMap, Map<String, HGCG002A> dbCg002AMap, HGCG003 cg003, Map<Long, HGCG002B> dbCg002BMap) { private void editData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003BMap, Map<String, HGCG002A> dbCg002AMap,
HGCG003 cg003, Map<Long, HGCG002B> dbCg002BMap) {
for (HGCG003B fCg003B : fCg003Bs) { for (HGCG003B fCg003B : fCg003Bs) {
// 计算重量 // 计算重量
fCg003B.setReceiveWeight(fCg003B.getReceiveQty().multiply(fCg003B.getReceiveUnitWeight())); fCg003B.setReceiveWeight(fCg003B.getReceiveQty().multiply(fCg003B.getReceiveUnitWeight()));
...@@ -262,15 +263,17 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -262,15 +263,17 @@ public class ServiceHGCG003B extends ServiceBase {
* @param cg003 * @param cg003
* @param dbCg002BMap * @param dbCg002BMap
*/ */
private void removeData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003bMap, Map<String, HGCG002A> dbCg002AMap, HGCG003 cg003, Map<Long, HGCG002B> dbCg002BMap) { private void removeData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003bMap, Map<String, HGCG002A> dbCg002AMap,
HGCG003 cg003, Map<Long, HGCG002B> dbCg002BMap) {
//数据来源为合同的 //数据来源为合同的
if(cg003.getSource().intValue() == HGConstant.CgSource.DEFAULT){ if (cg003.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());
DaoUtils.update(HGCG003B.DELETE, dbCg003B); DaoUtils.update(HGCG003B.DELETE, dbCg003B);
// 更新合同状态 // 更新合同状态
HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()), dbCg003B.getReceiveQty().negate()); HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()),
dbCg003B.getReceiveQty().negate());
} }
List<HGCG002> hgcg002List = new LinkedList<>(); List<HGCG002> hgcg002List = new LinkedList<>();
dbCg002AMap.forEach((k, v)->{ dbCg002AMap.forEach((k, v)->{
......
...@@ -135,9 +135,8 @@ ...@@ -135,9 +135,8 @@
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" resultClass="com.baosight.hggp.hg.cg.domain.HGCG002B">
resultClass="com.baosight.hggp.hg.cg.domain.HGCG002B"> SELECT
SELECT
ID as "id", ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 --> ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 --> DEP_CODE as "depCode", <!-- 部门编码 -->
...@@ -174,7 +173,8 @@ ...@@ -174,7 +173,8 @@
PROJ_CODE as "projCode", <!-- 项目编码 --> PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 --> PROJ_NAME as "projName", <!-- 项目名称 -->
CALCULATION_METHOD as "calculationMethod", <!-- 计算方式 0-数量乘单价 1-重量乘单价 --> CALCULATION_METHOD as "calculationMethod", <!-- 计算方式 0-数量乘单价 1-重量乘单价 -->
PLAN_DETAIL_ID as "planDetailId" <!-- 计划明细id --> PLAN_DETAIL_ID as "planDetailId", <!-- 计划明细id -->
STATUS as "status"
FROM ${hggpSchema}.HGCG002A WHERE 1=1 FROM ${hggpSchema}.HGCG002A WHERE 1=1
<include refid="condition" /> <include refid="condition" />
<include refid="idCondition"/> <include refid="idCondition"/>
......
...@@ -345,7 +345,12 @@ public class HGCGTools { ...@@ -345,7 +345,12 @@ public class HGCGTools {
List<HGCG002A> results = list(contractNos); List<HGCG002A> results = list(contractNos);
return results.stream().collect(Collectors.toMap(HGCG002A::getContractNo, item -> item)); return results.stream().collect(Collectors.toMap(HGCG002A::getContractNo, item -> item));
} }
/**
* 更新合同信息
*
* @param hgcg002List
*/
public static void updateContractPrimary(List<HGCG002> hgcg002List) { public static void updateContractPrimary(List<HGCG002> hgcg002List) {
List<Long> primaryIds = hgcg002List.stream().map(o->o.getId()).collect(Collectors.toList()); List<Long> primaryIds = hgcg002List.stream().map(o->o.getId()).collect(Collectors.toList());
List<HGCG002B> queryHgcg002BList = HGCGTools.HgCg002B.listByPrimaryIds(primaryIds); List<HGCG002B> queryHgcg002BList = HGCGTools.HgCg002B.listByPrimaryIds(primaryIds);
...@@ -569,7 +574,13 @@ public class HGCGTools { ...@@ -569,7 +574,13 @@ public class HGCGTools {
paramMap.put(HGCG002.FIELD_ID, dbCg002B.getId()); paramMap.put(HGCG002.FIELD_ID, dbCg002B.getId());
paramMap.put(HGCG002.FIELD_RECEIVE_QTY, newReceiveQty); paramMap.put(HGCG002.FIELD_RECEIVE_QTY, newReceiveQty);
paramMap.put(HGCG002.FIELD_RECEIVE_WEIGHT, newReceiveQty.multiply(dbCg002B.getPurUnitWeight())); paramMap.put(HGCG002.FIELD_RECEIVE_WEIGHT, newReceiveQty.multiply(dbCg002B.getPurUnitWeight()));
paramMap.put(HGCG002.FIELD_STATUS, dbCg002B.getStatus()); if (newReceiveQty.compareTo(BigDecimal.ZERO) == 0) {
paramMap.put(HGCG002.FIELD_STATUS, HGConstant.CgContractStatus.S_2);
} else if (dbCg002B.getPurQty().compareTo(newReceiveQty) == 0) {
paramMap.put(HGCG002.FIELD_STATUS, HGConstant.CgContractStatus.S_5);
} else {
paramMap.put(HGCG002.FIELD_STATUS, HGConstant.CgContractStatus.S_4);
}
DaoUtils.update(HGSqlConstant.HgCg002B.UPDATE_RECEIVE, paramMap); DaoUtils.update(HGSqlConstant.HgCg002B.UPDATE_RECEIVE, paramMap);
} }
......
...@@ -7,28 +7,27 @@ $(function () { ...@@ -7,28 +7,27 @@ $(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; if (item.inventCode) {
if(item.inventCode){ for (let i = 0; i < inventRecordBoxBlockId.length; i++) {
for(let i=0;i<inventRecordBoxBlockId.length;i++){ if (item.inventCode === inventRecordBoxBlockId[i]['valueField']) {
if(item.inventCode === inventRecordBoxBlockId[i]['valueField']){ template = inventRecordBoxBlockId[i]['valueField'];
template = inventRecordBoxBlockId[i]['valueField']; } else {
}else{ template = item.inventCode;
template = item.inventCode;
}
} }
} }
return template; }
}, return template;
editor: function (container, options) { },
let inInfo = new EiInfo(); editor: function (container, options) {
inInfo.set("field", options.field); let inInfo = new EiInfo();
let dataSource = inventRecordBoxBlockId; inInfo.set("field", options.field);
EiCommunicator.send("HGPZ005", "queryInventCodeProdTypeFourBox", inInfo, { let dataSource = inventRecordBoxBlockId;
onSuccess: function (ei) { EiCommunicator.send("HGPZ005", "queryInventCodeProdTypeFourBox", inInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("invent_record_box_block_id").getMappedRows(); dataSource = ei.getBlock("invent_record_box_block_id").getMappedRows();
}, },
onFail: function (ei) { onFail: function (ei) {
...@@ -48,24 +47,25 @@ $(function () { ...@@ -48,24 +47,25 @@ $(function () {
template: "[#:valueField#]#:textField#|#:param4Field#", template: "[#:valueField#]#:textField#|#:param4Field#",
filter: "contains" filter: "contains"
}); });
}
},
{
field: "primaryId",
template: function (item) {
item['primaryId'] =$("#inqu_status-0-primaryId").val();
return $("#inqu_status-0-primaryId").val();
}
} }
], }, {
field: "primaryId",
template: function (item) {
item['primaryId'] = $("#inqu_status-0-primaryId").val();
return $("#inqu_status-0-primaryId").val();
}
}],
onRowClick: function (e){
setPurQty();
},
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; let item = e.model;
//只有合同生成的不能编辑 //只有合同生成的不能编辑
if(item.source === '0'){ if (item.source === '0') {
//选择收货的指定列不让修改 //选择收货的指定列不让修改
for (let i = 0; i < e.sender.columns.length; i++) { for (let i = 0; i < e.sender.columns.length; i++) {
//指定的列不让修改 //指定的列不让修改
...@@ -147,9 +147,45 @@ $(window).load(function () { ...@@ -147,9 +147,45 @@ $(window).load(function () {
$(".k-grid-add").hide(); $(".k-grid-add").hide();
$(".k-grid-delete").hide(); $(".k-grid-delete").hide();
} }
// 勾选事件
resultCheckClick();
}); });
/**
* 勾选事件
*/
let resultCheckClick = function (){
resultGrid.element.on("click", "input.check-one,input.check-all", function (e) {
let action = $(this).prop("checked");
if (action != true) {
return;
}
setPurQty();
});
}
/**
* 设置采购数量
*/
let setPurQty = function (){
let checkRows = resultGrid.getCheckedRows();
let checkRowIndexs = resultGrid.getCheckedRowsIndex();
for (let rowNo = 0; rowNo < checkRowIndexs.length; rowNo++) {
let index = checkRowIndexs[rowNo];
let purQty = checkRows[rowNo]["purQty"];
let planQty = checkRows[rowNo]["planQty"];
if (isBlank(purQty) || parseFloat(purQty) == 0) {
resultGrid.setCellValue(index, "purQty", planQty);
}
let purWeight = checkRows[rowNo]["purWeight"];
let planWeight = checkRows[rowNo]["planWeight"];
if (isBlank(purWeight) || parseFloat(purWeight) == 0) {
resultGrid.setCellValue(index, "purWeight", planWeight);
}
}
}
/** /**
* 查询 * 查询
*/ */
......
...@@ -72,8 +72,8 @@ ...@@ -72,8 +72,8 @@
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" enable="false" defaultValue="0"/> <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" defaultValue="0"/> <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}" defaultValue="0"/> <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}" defaultValue="0"/> <EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="100" align="right" format="{0:N3}" defaultValue="0"/>
<EF:EFColumn ename="taxAmount" cname="税额" enable="false" width="80" align="right" format="{0:N3}" defaultValue="0"/> <EF:EFColumn ename="taxAmount" cname="税额" enable="false" width="100" align="right" format="{0:N3}" defaultValue="0"/>
<EF:EFColumn ename="taxIncludeAmount" 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}" 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"
......
...@@ -3,7 +3,7 @@ $(function () { ...@@ -3,7 +3,7 @@ $(function () {
"result": { "result": {
pageable: { pageable: {
pageSize: 20, pageSize: 20,
pageSizes: [20, 50, 70, 100], pageSizes: [20, 50, 100, 300],
}, },
columns: [ columns: [
], ],
......
...@@ -41,12 +41,13 @@ ...@@ -41,12 +41,13 @@
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<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="100" align="center" required="true"
<EF:EFCodeOption codeName="hggp.cw.taxPoints" /> copy="true">
<EF:EFCodeOption codeName="hggp.cw.taxPoints"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="100" 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="100" 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="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/> <EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center" <EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/> editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
......
...@@ -47,8 +47,9 @@ ...@@ -47,8 +47,9 @@
<EF:EFColumn ename="width" cname="宽(MM)" width="80" align="right" format="{0:N3}" required="true"/> <EF:EFColumn ename="width" cname="宽(MM)" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="thick" cname="厚(MM)" width="80" align="right" format="{0:N3}" required="true"/> <EF:EFColumn ename="thick" cname="厚(MM)" width="80" align="right" format="{0:N3}" required="true"/>
<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" /> copy="true">
<EF:EFCodeOption codeName="hggp.cw.taxPoints"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="100" align="right" format="{0:N3}"/> <EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="100" 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}"/>
......
...@@ -9,46 +9,45 @@ $(function () { ...@@ -9,46 +9,45 @@ $(function () {
pageSize: 20, pageSize: 20,
pageSizes: [20, 50, 70, 100], pageSizes: [20, 50, 70, 100],
}, },
columns: [ columns: [{
{ field: "operator",
field: "operator", title: "操作",
title: "操作", 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 + ', ' + item.source
+ 'onclick="showDetail(' + item.id + ', ' + item.status + ', ' + item.source + ')" >详情</a>'; + ')" >详情</a>';
} }
if (item.status == 0 && item.source == 1) { if (item.status == 0 && item.source == 1) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' + template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',2)" >确认收货</a>'; 'onclick="updateStatus(' + item.id + ',2)" >确认收货</a>';
} }
return template; return template;
} }
}, { }, {
field: "companyCode", field: "companyCode",
title: "公司编码", title: "公司编码",
template: function (dataItem) { template: function (dataItem) {
for (let i = 0; i < companyCodeBox.length; i++) { for (let i = 0; i < companyCodeBox.length; i++) {
if (companyCodeBox[i]['companyCode'] === dataItem['companyCode']) { if (companyCodeBox[i]['companyCode'] === dataItem['companyCode']) {
return companyCodeBox[i]['companyCode']; return companyCodeBox[i]['companyCode'];
}
} }
return dataItem["companyCode"];
} }
}, return dataItem["companyCode"];
{ }
field: "purUserName", }, {
template: function (dataItem) { field: "purUserName",
for (let i = 0; i < userByCompany.length; i++) { template: function (dataItem) {
let purUserName = dataItem['purUserName']; for (let i = 0; i < userByCompany.length; i++) {
if(purUserName){ let purUserName = dataItem['purUserName'];
if (userByCompany[i]['userName'] === purUserName.userName) { if (purUserName) {
return userByCompany[i]['userName']; if (userByCompany[i]['userName'] === purUserName.userName) {
} return userByCompany[i]['userName'];
} }
} }
}
return dataItem["purUserName"]; return dataItem["purUserName"];
}, },
editor: function (container, options) { editor: function (container, options) {
......
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
format="{0:N3}"/> format="{0:N3}"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="100" align="right" format="{0:N3}"/> <EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purQty" cname="采购数量" enable="false" width="100" align="right" format="{0:N3}"/> <EF:EFColumn ename="purQty" cname="采购数量" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purUnitWeight" cname="采购单重" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purWeight" cname="采购重量" enable="false" width="100" align="right" format="{0:N3}"/> <EF:EFColumn ename="purWeight" cname="采购重量" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFComboColumn ename="supCode" cname="供应商名称" enable="false" width="120" align="left" defaultValue="" <EF:EFComboColumn ename="supCode" cname="供应商名称" enable="false" width="120" align="left" defaultValue=""
filter="contains"> filter="contains">
...@@ -69,9 +70,9 @@ ...@@ -69,9 +70,9 @@
<EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center"/> <EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center"/>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" enable="false"/> <EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" enable="false"/>
<EF:EFColumn ename="taxRate" cname="税率(%)" width="80" align="right" format="{0:N3}" enable="false"/> <EF:EFColumn ename="taxRate" cname="税率(%)" width="80" align="right" format="{0:N3}" enable="false"/>
<EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="100" 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="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/> <EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
......
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