Commit 744e2566 by 江和松

采购收货功能修改,增加手动新增逻辑

parent 50e71e74
...@@ -80,6 +80,10 @@ public enum InventTypeDetailEnum { ...@@ -80,6 +80,10 @@ public enum InventTypeDetailEnum {
return new Integer[]{COMPONENT.code,SEMI_FINISHED_PRODUCT.code,RAW.code,CONSUMABLE.code}; return new Integer[]{COMPONENT.code,SEMI_FINISHED_PRODUCT.code,RAW.code,CONSUMABLE.code};
} }
public static Integer[] getProdTypeSix(){
return new Integer[]{CONSUMABLE.code};
}
public static EiBlock generatorEiBlock() { public static EiBlock generatorEiBlock() {
EiBlock block = new EiBlock("invent_type_detail_block_id"); EiBlock block = new EiBlock("invent_type_detail_block_id");
List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>() {{ List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>() {{
......
...@@ -20,7 +20,7 @@ import com.baosight.iplat4j.core.util.StringUtils; ...@@ -20,7 +20,7 @@ import com.baosight.iplat4j.core.util.StringUtils;
*/ */
public class HGCG003 extends DaoEPBase { public class HGCG003 extends DaoEPBase {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id"; public static final String FIELD_ID = "id";
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 企业编码*/ public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 企业编码*/
...@@ -110,6 +110,7 @@ public class HGCG003 extends DaoEPBase { ...@@ -110,6 +110,7 @@ public class HGCG003 extends DaoEPBase {
public static final String UPDATE = "HGCG003.update"; public static final String UPDATE = "HGCG003.update";
public static final String DELETE = "HGCG003.delete"; public static final String DELETE = "HGCG003.delete";
public static final String MAX_ID = "HGCG003.maxId"; public static final String MAX_ID = "HGCG003.maxId";
public static final String UPDATE_STATUS = "HGCG003.updateStatus";
private Long id = new Long(0); private Long id = new Long(0);
private String accountCode = " "; /* 企业编码*/ private String accountCode = " "; /* 企业编码*/
......
...@@ -66,6 +66,7 @@ public class HGCG003B extends DaoEPBase { ...@@ -66,6 +66,7 @@ public class HGCG003B extends DaoEPBase {
public static final String FIELD_PUR_USER_ID = "purUserId"; /* 采购员*/ public static final String FIELD_PUR_USER_ID = "purUserId"; /* 采购员*/
public static final String FIELD_PUR_USER_NAME = "purUserName"; /* 采购员名称*/ public static final String FIELD_PUR_USER_NAME = "purUserName"; /* 采购员名称*/
public static final String FIELD_IS_INVOICING = "isInvoicing"; /*是否开票 0否 1是*/ public static final String FIELD_IS_INVOICING = "isInvoicing"; /*是否开票 0否 1是*/
public static final String FIELD_SOURCE = "source"; /* 数据来源 根据采购数据来源小代码 目前0默认采购合同,1手动录入*/
public static final String COL_ID = "ID"; public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/ public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
...@@ -158,7 +159,7 @@ public class HGCG003B extends DaoEPBase { ...@@ -158,7 +159,7 @@ public class HGCG003B extends DaoEPBase {
private String purUserName = " "; /* 采购员名称*/ private String purUserName = " "; /* 采购员名称*/
private Integer isInvoicing = 0; /*是否开票 0-否 1-是*/ private Integer isInvoicing = 0; /*是否开票 0-否 1-是*/
private Integer source; /* 数据来源 根据采购数据来源小代码 目前0默认采购合同,1手动录入*/
/** /**
* initialize the metadata. * initialize the metadata.
*/ */
...@@ -359,9 +360,14 @@ public class HGCG003B extends DaoEPBase { ...@@ -359,9 +360,14 @@ public class HGCG003B extends DaoEPBase {
eiColumn = new EiColumn(FIELD_PUR_USER_NAME); eiColumn = new EiColumn(FIELD_PUR_USER_NAME);
eiColumn.setDescName("采购员名称"); eiColumn.setDescName("采购员名称");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_IS_INVOICING); eiColumn = new EiColumn(FIELD_IS_INVOICING);
eiColumn.setDescName("是否开票"); eiColumn.setDescName("是否开票");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SOURCE);
eiColumn.setDescName("数据来源");
eiMetadata.addMeta(eiColumn);
} }
/** /**
...@@ -997,6 +1003,14 @@ public class HGCG003B extends DaoEPBase { ...@@ -997,6 +1003,14 @@ public class HGCG003B extends DaoEPBase {
this.isInvoicing = isInvoicing; this.isInvoicing = isInvoicing;
} }
public Integer getSource() {
return source;
}
public void setSource(Integer source) {
this.source = source;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -1047,6 +1061,7 @@ public class HGCG003B extends DaoEPBase { ...@@ -1047,6 +1061,7 @@ public class HGCG003B extends DaoEPBase {
setPurUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PUR_USER_ID)), purUserId)); setPurUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PUR_USER_ID)), purUserId));
setPurUserName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PUR_USER_NAME)), purUserName)); setPurUserName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PUR_USER_NAME)), purUserName));
setIsInvoicing(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_IS_INVOICING)), isInvoicing)); setIsInvoicing(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_IS_INVOICING)), isInvoicing));
setSource(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_SOURCE)), source));
} }
/** /**
...@@ -1098,6 +1113,7 @@ public class HGCG003B extends DaoEPBase { ...@@ -1098,6 +1113,7 @@ public class HGCG003B extends DaoEPBase {
map.put(FIELD_PUR_USER_ID, StringUtils.toString(purUserId, eiMetadata.getMeta(FIELD_PUR_USER_ID))); map.put(FIELD_PUR_USER_ID, StringUtils.toString(purUserId, eiMetadata.getMeta(FIELD_PUR_USER_ID)));
map.put(FIELD_PUR_USER_NAME, StringUtils.toString(purUserName, eiMetadata.getMeta(FIELD_PUR_USER_NAME))); map.put(FIELD_PUR_USER_NAME, StringUtils.toString(purUserName, eiMetadata.getMeta(FIELD_PUR_USER_NAME)));
map.put(FIELD_IS_INVOICING, StringUtils.toString(isInvoicing, eiMetadata.getMeta(FIELD_IS_INVOICING))); map.put(FIELD_IS_INVOICING, StringUtils.toString(isInvoicing, eiMetadata.getMeta(FIELD_IS_INVOICING)));
map.put(FIELD_SOURCE, StringUtils.toString(source, eiMetadata.getMeta(FIELD_SOURCE)));
return map; return map;
} }
......
...@@ -10,24 +10,23 @@ import com.baosight.hggp.hg.cg.tools.HGCGTools; ...@@ -10,24 +10,23 @@ import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HGCGUtils; import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant; import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.sc.domain.HGSC009;
import com.baosight.hggp.hg.sj.domain.HGSJ002;
import com.baosight.hggp.hg.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.*;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays; import java.util.*;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -51,6 +50,7 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -51,6 +50,7 @@ public class ServiceHGCG003 extends ServiceBase {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class); EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
EiInfoUtils.addBlock(inInfo,"userByCompany", UserSessionUtils.getUserByCompany(UserSessionUtils.getAccountCode()), User.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG003().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG003().eiMetadata);
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败"); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
...@@ -87,15 +87,27 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -87,15 +87,27 @@ public class ServiceHGCG003 extends ServiceBase {
public EiInfo save(EiInfo inInfo) { public EiInfo save(EiInfo inInfo) {
try { try {
List<HGCG003> fCg003s = MapUtils.toDaoEPBase(inInfo, HGCG003.class); List<HGCG003> fCg003s = MapUtils.toDaoEPBase(inInfo, HGCG003.class);
// 采购收货DB数据 // 写入数据
Map<String, HGCG003> dbCg003Map = HGCGUtils.HgCg003.lockGetDataEp(fCg003s); for (int i = 0; i < fCg003s.size(); i++) {
// 采购合同DB数据 HGCG003 hgcg003 = fCg003s.get(i);
Map<String, HGCG002A> dbCg002AMap = HGCGUtils.HgCg002.lockGetData( if (hgcg003.getId() == null || hgcg003.getId() == 0) {
ObjectUtils.listEpKey(fCg003s, HGCG003.FIELD_CONTRACT_NO)); // 修改数据
// 数据校验 this.saveData(hgcg003);
this.checkSaveData(fCg003s, dbCg003Map); } else {
// 保存数据 DaoUtils.update(HGCG003.UPDATE, hgcg003);
this.saveData(fCg003s, dbCg003Map, dbCg002AMap); }
}
// 合同过来的数据不让修改
// // 采购收货DB数据
// Map<String, HGCG003> dbCg003Map = HGCGUtils.HgCg003.lockGetDataEp(fCg003s);
// // 采购合同DB数据
// Map<String, HGCG002A> dbCg002AMap = HGCGUtils.HgCg002.lockGetData(
// ObjectUtils.listEpKey(fCg003s, HGCG003.FIELD_CONTRACT_NO));
// // 数据校验
// this.checkEditData(fCg003s, dbCg003Map);
// // 修改数据
// this.editData(fCg003s, dbCg003Map, dbCg002AMap);
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg003s.size() + "]条数据保存成功!"); inInfo.setMsg("操作成功!本次对[" + fCg003s.size() + "]条数据保存成功!");
...@@ -105,13 +117,23 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -105,13 +117,23 @@ public class ServiceHGCG003 extends ServiceBase {
return inInfo; return inInfo;
} }
private void saveData(HGCG003 hgcg003) {
// 新增数据
hgcg003.setReceiveNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_RECEIVE_NO));
hgcg003.setStatus(HGConstant.CgReceiveStatus.S_0);
hgcg003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
hgcg003.setSource(HGConstant.CgSource.SDLR);
hgcg003.setReceiveDate(DateUtils.formatShort(hgcg003.getReceiveDate()));
DaoUtils.insert(HGCG003.INSERT, hgcg003);
}
/** /**
* 数据校验 * 数据校验
* *
* @param fCg003s * @param fCg003s
* @param dbCg003Map * @param dbCg003Map
*/ */
private void checkSaveData(List<HGCG003> fCg003s, Map<String, HGCG003> dbCg003Map) { private void checkEditData(List<HGCG003> fCg003s, Map<String, HGCG003> dbCg003Map) {
// 查询合同信息 // 查询合同信息
List<String> contractNos = ObjectUtils.listEpKey(dbCg003Map.values(), HGCG003.FIELD_CONTRACT_NO); List<String> contractNos = ObjectUtils.listEpKey(dbCg003Map.values(), HGCG003.FIELD_CONTRACT_NO);
Map<String, HGCG002A> dbCg002AMap = HGCGTools.HgCg002.map(contractNos); Map<String, HGCG002A> dbCg002AMap = HGCGTools.HgCg002.map(contractNos);
...@@ -135,13 +157,13 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -135,13 +157,13 @@ public class ServiceHGCG003 extends ServiceBase {
} }
/** /**
* 数据保存 * 数据修改,修改合同数据
* *
* @param fCg003s * @param fCg003s
* @param dbCg003Map * @param dbCg003Map
* @param dbCg002AMap * @param dbCg002AMap
*/ */
private void saveData(List<HGCG003> fCg003s, Map<String, HGCG003> dbCg003Map, Map<String, HGCG002A> dbCg002AMap) { private void editData(List<HGCG003> fCg003s, Map<String, HGCG003> dbCg003Map, Map<String, HGCG002A> dbCg002AMap) {
for (HGCG003 fCg003 : fCg003s) { for (HGCG003 fCg003 : fCg003s) {
String receiveNo = fCg003.getReceiveNo(); String receiveNo = fCg003.getReceiveNo();
String contractNo = fCg003.getContractNo(); String contractNo = fCg003.getContractNo();
...@@ -213,9 +235,10 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -213,9 +235,10 @@ 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){
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());
...@@ -225,10 +248,14 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -225,10 +248,14 @@ public class ServiceHGCG003 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));
for (HGCG003B fCg003B : fCg003Bs) { for (HGCG003B fCg003B : fCg003Bs) {
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);
// 更新合同状态 //数据来源为合同的才需要更新合同状态
HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()), fCg003B.getReceiveQty().negate()); if(Objects.nonNull(hgcg003) && hgcg003.getSource().intValue() == HGConstant.CgSource.DEFAULT){
// 更新合同状态
HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()), fCg003B.getReceiveQty().negate());
}
} }
} }
} }
...@@ -291,4 +318,45 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -291,4 +318,45 @@ public class ServiceHGCG003 extends ServiceBase {
} }
} }
/**
* 修改状态
*/
@OperationLogAnnotation(operModul = "工艺流程",operType = "修改",operDesc = "修改状态操作")
public EiInfo updateStatus(EiInfo inInfo){
int i = 0;
try {
HGCG003 hgcg003 = new HGCG003();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
List<Long> primaryIds = new LinkedList<>();
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgcg003.fromMap(map);
primaryIds.add(hgcg003.getId());
HGCG003 old = HGCGTools.HgCg003.get(hgcg003.getId());
hgcg003.setReceiveNo(old.getReceiveNo());
DaoUtils.update(HGCG003.UPDATE_STATUS, hgcg003);
}
List<HGCG003B> hgcg003BList = HGCGTools.HgCg003B.listByPrimaryIds(primaryIds);
hgcg003BList.forEach(o->{
Map<String, Object> paramDetailMap = new HashMap<>();
paramDetailMap.put(HGCG003B.FIELD_ID, o.getId());
paramDetailMap.put(HGCG003B.FIELD_STATUS, HGConstant.CgReceiveStatus.S_2);
paramDetailMap.put(HGCG003B.FIELD_DELIVER_QTY, 0);
paramDetailMap.put(HGCG003B.FIELD_DEPOSIT_QTY, o.getReceiveQty());
DaoUtils.update(HGSqlConstant.HgCg003B.UPDATE_CONFIRM, paramDetailMap);
//采购入库
HGKCTools.HgKc001.putInStorageData(o.getId());
});
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
}
return inInfo;
}
} }
...@@ -2,6 +2,7 @@ package com.baosight.hggp.hg.cg.service; ...@@ -2,6 +2,7 @@ package com.baosight.hggp.hg.cg.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.InventTypeDetailEnum;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum; import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
...@@ -10,17 +11,17 @@ import com.baosight.hggp.hg.cg.tools.HGCGTools; ...@@ -10,17 +11,17 @@ import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HGCGUtils; import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant; import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ004;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*; 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.util.Arrays; import java.util.*;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/** /**
* @author:songx * @author:songx
...@@ -42,6 +43,11 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -42,6 +43,11 @@ public class ServiceHGCG003B 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.INVENT_RECORD_BOX_BLOCK_ID),
new HashMap<String, Object>(){{
put(HGPZ005.FIELD_STATUS,1);
put(HGPZ004.FIELD_INVENT_TYPE_DETAILS, InventTypeDetailEnum.getProdTypeSix());
}}, false);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class); EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG003B().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG003B().eiMetadata);
} catch (Exception e) { } catch (Exception e) {
...@@ -77,19 +83,35 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -77,19 +83,35 @@ public class ServiceHGCG003B extends ServiceBase {
public EiInfo save(EiInfo inInfo) { public EiInfo save(EiInfo inInfo) {
try { try {
List<HGCG003B> fCg003Bs = MapUtils.toDaoEPBase(inInfo, HGCG003B.class); List<HGCG003B> fCg003Bs = MapUtils.toDaoEPBase(inInfo, HGCG003B.class);
// 采购收货DB数据
Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetDataEp(fCg003Bs);
HGCG003 cg003 = HGCGTools.HgCg003.get(fCg003Bs.get(0).getPrimaryId()); HGCG003 cg003 = HGCGTools.HgCg003.get(fCg003Bs.get(0).getPrimaryId());
// 采购合同DB数据 if(cg003.getSource().intValue() == HGConstant.CgSource.DEFAULT){
Map<String, HGCG002A> dbCg002AMap = HGCGUtils.HgCg002.lockGetData( // 采购收货DB数据
ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_NO)); Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetDataEp(fCg003Bs);
// 采购合同明细DB数据 // 采购合同DB数据
Map<Long, HGCG002B> dbCg002BMap = HGCGUtils.HgCg002B.lockGetData( Map<String, HGCG002A> dbCg002AMap = HGCGUtils.HgCg002.lockGetData(
ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_DETAIL_ID)); ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_NO));
// 数据校验 // 采购合同明细DB数据
this.checkSaveData(fCg003Bs, dbCg003BMap,cg003); Map<Long, HGCG002B> dbCg002BMap = HGCGUtils.HgCg002B.lockGetData(
// 保存数据 ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_DETAIL_ID));
this.saveData(fCg003Bs, dbCg003BMap, dbCg002AMap,cg003,dbCg002BMap); // 数据校验
this.checkEditData(fCg003Bs, dbCg003BMap,cg003);
// 保存数据
this.editData(fCg003Bs, dbCg003BMap, dbCg002AMap,cg003,dbCg002BMap);
}else{
// 写入数据
for (int i = 0; i < fCg003Bs.size(); i++) {
HGCG003B hgcg003B = fCg003Bs.get(i);
if (hgcg003B.getId() == null || hgcg003B.getId() == 0) {
// 修改数据
this.saveData(hgcg003B,cg003);
} else {
this.updateData(hgcg003B);
}
}
//修改主表信息
updateCg003Pur(cg003);
}
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() + "]条数据保存成功!");
...@@ -105,7 +127,7 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -105,7 +127,7 @@ public class ServiceHGCG003B extends ServiceBase {
* @param dbCg003Map * @param dbCg003Map
* @param cg003 * @param cg003
*/ */
private void checkSaveData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003Map, HGCG003 cg003) { private void checkEditData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003Map, HGCG003 cg003) {
// 查询合同信息 // 查询合同信息
List<String> contractNos = ObjectUtils.listEpKey(dbCg003Map.values(), HGCG003.FIELD_CONTRACT_NO); List<String> contractNos = ObjectUtils.listEpKey(dbCg003Map.values(), HGCG003.FIELD_CONTRACT_NO);
Map<String, HGCG002A> dbCg002AMap = HGCGTools.HgCg002.map(contractNos); Map<String, HGCG002A> dbCg002AMap = HGCGTools.HgCg002.map(contractNos);
...@@ -136,7 +158,7 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -136,7 +158,7 @@ public class ServiceHGCG003B extends ServiceBase {
* @param cg003 * @param cg003
* @param dbCg002BMap * @param dbCg002BMap
*/ */
private void saveData(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()));
...@@ -156,6 +178,25 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -156,6 +178,25 @@ public class ServiceHGCG003B extends ServiceBase {
updateCg003Pur(cg003); updateCg003Pur(cg003);
} }
private void saveData(HGCG003B hgcg003B, HGCG003 cg003) {
// 新增数据
hgcg003B.setPrimaryId(cg003.getId());
hgcg003B.setReceiveNo(cg003.getReceiveNo());
hgcg003B.setStatus(HGConstant.CgReceiveStatus.S_0);
hgcg003B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
hgcg003B.setReceiveDate(DateUtils.formatShort(cg003.getReceiveDate()));
hgcg003B.setCompanyCode(cg003.getCompanyCode());
hgcg003B.setCompanyName(cg003.getCompanyName());
hgcg003B.setDepCode(cg003.getDepCode());
hgcg003B.setAccountCode(cg003.getAccountCode());
DaoUtils.insert(HGCG003B.INSERT, hgcg003B);
}
private void updateData(HGCG003B hgcg003B) {
// 新增数据
DaoUtils.update(HGCG003B.UPDATE, hgcg003B);
}
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());
//修改主表信息 //修改主表信息
...@@ -225,19 +266,29 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -225,19 +266,29 @@ public class ServiceHGCG003B extends ServiceBase {
* @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) {
for (HGCG003B fCg003B : fCg003Bs) { //数据来源为合同的
HGCG003B dbCg003B = dbCg003bMap.get(fCg003B.getId()); if(cg003.getSource().intValue() == HGConstant.CgSource.DEFAULT){
dbCg003B.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode()); for (HGCG003B fCg003B : fCg003Bs) {
DaoUtils.update(HGCG003B.DELETE, dbCg003B); HGCG003B dbCg003B = dbCg003bMap.get(fCg003B.getId());
// 更新合同状态 dbCg003B.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()), dbCg003B.getReceiveQty().negate()); DaoUtils.update(HGCG003B.DELETE, dbCg003B);
// 更新合同状态
HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()), dbCg003B.getReceiveQty().negate());
}
List<HGCG002> hgcg002List = new LinkedList<>();
dbCg002AMap.forEach((k, v)->{
hgcg002List.add(v);
});
//根据子表明细刷新合同主表信息
HGCGTools.HgCg002.updateContractPrimary(hgcg002List);
}else{
//手工录入的
for (HGCG003B fCg003B : fCg003Bs) {
HGCG003B dbCg003B = dbCg003bMap.get(fCg003B.getId());
dbCg003B.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGCG003B.DELETE, dbCg003B);
}
} }
List<HGCG002> hgcg002List = new LinkedList<>();
dbCg002AMap.forEach((k, v)->{
hgcg002List.add(v);
});
//根据子表明细刷新合同主表信息
HGCGTools.HgCg002.updateContractPrimary(hgcg002List);
//修改主表信息 //修改主表信息
updateCg003Pur(cg003); updateCg003Pur(cg003);
} }
......
...@@ -440,6 +440,9 @@ ...@@ -440,6 +440,9 @@
<isNotEmpty prepend=" AND " property="status"> <isNotEmpty prepend=" AND " property="status">
b.STATUS = #status# b.STATUS = #status#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="source">
b.SOURCE = #source#
</isNotEmpty>
<include refid="idCondition"/> <include refid="idCondition"/>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
......
...@@ -302,6 +302,26 @@ public class ServiceHGPZ005 extends ServiceBase { ...@@ -302,6 +302,26 @@ public class ServiceHGPZ005 extends ServiceBase {
} }
/** /**
* 下拉框 (不默认状态)
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "查询",operDesc = "下拉框(耗材)")
public EiInfo queryInventCodeProdTypeSixBox(EiInfo inInfo) {
try {
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.INVENT_RECORD_BOX_BLOCK_ID);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGPZ004.FIELD_INVENT_TYPE_DETAILS, InventTypeDetailEnum.getProdTypeSix());
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGPZ005.FIELD_STATUS,1);
CommonMethod.initBlock(inInfo, list, EiInfoUtils.getFirstRow(inInfo), false);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询规格失败");
}
return inInfo;
}
/**
* 下拉框 * 下拉框
* *
* @param inInfo * @param inInfo
......
...@@ -67,7 +67,7 @@ public class ServiceHGZL001B extends ServiceEPBase { ...@@ -67,7 +67,7 @@ public class ServiceHGZL001B extends ServiceEPBase {
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HGCG003B.FIELD_STATUS, HGConstant.CgReceiveStatus.S_0); queryMap.put(HGCG003B.FIELD_SOURCE, HGConstant.CgSource.DEFAULT);
inInfo = super.query(inInfo, HGCG003B.QUERY_BY_QUALITY_TESTING, new HGCG003B()); inInfo = super.query(inInfo, HGCG003B.QUERY_BY_QUALITY_TESTING, new HGCG003B());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
......
$(function () { $(function () {
var companyCodeBox = __eiInfo.getBlock("roleCompany").getMappedRows();
var userByCompany = __eiInfo.getBlock("userByCompany").getMappedRows();
IPLATUI.EFGrid = { IPLATUI.EFGrid = {
"result": { "result": {
exportGrid: false, // 隐藏右侧自定义导出按钮 exportGrid: false, // 隐藏右侧自定义导出按钮
...@@ -15,21 +16,89 @@ $(function () { ...@@ -15,21 +16,89 @@ $(function () {
let template = ''; let template = '';
if (!isBlank(item.id)){ if (!isBlank(item.id)){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ', ' + item.status + ')" >详情</a>'; + 'onclick="showDetail(' + item.id + ', ' + item.status + ', ' + item.source + ')" >详情</a>';
}
if (item.status == 0 && item.source == 1) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',2)" >确认收货</a>';
} }
return template; return template;
} }
}, {
field: "companyCode",
title: "公司编码",
template: function (dataItem) {
for (let i = 0; i < companyCodeBox.length; i++) {
if (companyCodeBox[i]['companyCode'] === dataItem['companyCode']) {
return companyCodeBox[i]['companyCode'];
}
}
return dataItem["companyCode"];
}
},
{
field: "purUserName",
template: function (dataItem) {
for (let i = 0; i < userByCompany.length; i++) {
let purUserName = dataItem['purUserName'];
if(purUserName){
if (userByCompany[i]['userName'] === purUserName.userName) {
return userByCompany[i]['userName'];
}
}
}
return dataItem["purUserName"];
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-companyCode", options.model["companyCode"]);
inInfo.set("field", options.field);
EiCommunicator.send("HGSC001", "userByCompanyComboBox", inInfo, {
onSuccess: function (ei) {
userByCompany = ei.getBlock("userByCompany").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoDropDownList({
dataSource: userByCompany,
minLength: 0,
dataTextField: "userName",
dataValueField: "userName",
optionLabelTemplate: "[#:loginName#]#:userName#-#:depName#",
valueTemplate: "[#:loginName#]#:userName#-#:depName#",
template: "[#:loginName#]#:userName#-#:depName#",
filter: "contains"
});
}
} }
], ],
beforeEdit: function (e) { beforeEdit: function (e) {
let item = e.model; let item = e.model;
if(item.status != '0'){ //只有合同生成的不能编辑
if(item.source === '0'){
e.preventDefault(); e.preventDefault();
} }
}, },
loadComplete: function (grid) { loadComplete: function (grid) {
// 确认 // 确认
$("#CONFIRM").on("click", confirm); $("#CONFIRM").on("click", confirm);
// change事件
grid.dataSource.bind("change", function (e) {
supCodeChange(e);
if (e.field == "companyCode") {
for (let i = 0; i < companyCodeBox.length; i++) {
if (companyCodeBox[i]['companyCode'] === e.items[0]['companyCode']) {
resultGrid.setCellValue(e.items[0],"companyName",companyCodeBox[i]['companyName']);
}
}
}
});
}, },
onSave: function (e) { onSave: function (e) {
// 阻止后台请求,使用自定义 // 阻止后台请求,使用自定义
...@@ -105,8 +174,16 @@ let save = function () { ...@@ -105,8 +174,16 @@ let save = function () {
return; return;
} }
for (let i = 0; i < rows.length; i++) { for (let i = 0; i < rows.length; i++) {
if (!isPositiveNumber(rows[i]['receiveQty'])) { if (isBlank(rows[i]['companyCode'])) {
message("勾选的第" + (i + 1) + "行收货数量必须大于0"); message("勾选的第" + (i + 1) + "行公司编号名称不能为空");
return;
}
if (isBlank(rows[i]['supCode'])) {
message("勾选的第" + (i + 1) + "行供应商名称不能为空");
return;
}
if (isBlank(rows[i]['purUserName'])) {
message("勾选的第" + (i + 1) + "行采购员不能为空");
return; return;
} }
} }
...@@ -172,16 +249,54 @@ let selectContractCallback = function () { ...@@ -172,16 +249,54 @@ let selectContractCallback = function () {
JSColorbox.close(); JSColorbox.close();
} }
/**
* 供应商变更
*/
let supCodeChange = function (e) {
if (e.field != "supCode") {
return;
}
let item = e.items[0];
let supRecordRows = __eiInfo.blocks.sup_record_block_id.rows;
for (let k = 0; k < resultGrid.getCheckedRowsIndex() + 1; k++) {
for (let i = 0; i < supRecordRows.length; i++) {
if (supRecordRows[i][1] === item.supCode) {
let supName = supRecordRows[i][0];
resultGrid.setCellValue(item, 'supName', supName == null ? "" : supName);
return;
}
}
}
}
/** /**
* 显示详情 * 显示详情
*/ */
function showDetail(id,status) { function showDetail(id,status,source) {
JSColorbox.open({ JSColorbox.open({
href: "HGCG003B?methodName=initLoad&inqu_status-0-primaryId=" + id+"&status="+status, 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: "80%", height: "80%",
}); });
} }
function updateStatus(id,status) {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
inEiInfo.set("result-0-status", status);
EiCommunicator.send('HGCG003', 'updateStatus', inEiInfo, {
onSuccess(response) {
NotificationUtil(response.msg);
query();
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
}
);
}
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<EF:EFCodeOption codeName="hggp.hgcg.receiveStatus"/> <EF:EFCodeOption codeName="hggp.hgcg.receiveStatus"/>
</EF:EFSelect> </EF:EFSelect>
</div> </div>
<div class="row"> <div class="row">
<EF:EFSelect cname="公司名称" blockId="inqu_status" ename="companyCode" row="0" colWidth="3" <EF:EFSelect cname="公司名称" blockId="inqu_status" ename="companyCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue=""> filter="contains" optionLabel="全部" defultValue="">
...@@ -26,6 +27,12 @@ ...@@ -26,6 +27,12 @@
filter="contains" optionLabel="全部" defultValue=""> filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect cname="数据来源" blockId="inqu_status" ename="source" row="0" colWidth="3" optionLabel="全部"
defultValue="">
<EF:EFCodeOption codeName="hggp.hpcg.receiveSource"/>
</EF:EFSelect>
</div>
<div>
<EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status" <EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status"
startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime" startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime"
format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true"> format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
...@@ -34,20 +41,32 @@ ...@@ -34,20 +41,32 @@
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row" copyToAdd="false">
<EF:EFColumn ename="id" cname="内码" hidden="true"/> <EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"/> <EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/> <EF:EFComboColumn ename="source" cname="数据来源" enable="false" width="80" align="center">
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/> <EF:EFCodeOption codeName="hggp.hpcg.receiveSource"/>
<EF:EFColumn ename="receiveDate" cname="收货日期" enable="false" width="100" align="center" editType="date" </EF:EFComboColumn>
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/> <EF:EFComboColumn ename="companyCode" cname="公司编码"
columnTemplate="#=companyName#" itemTemplate="#=companyName#"
textField="companyName" valueField="companyCode"
maxLength="16" readonly="false" width="100" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/>
</EF:EFComboColumn>
<EF:EFColumn ename="companyName" cname="公司名称" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="receiveDate" cname="收货日期" width="100" align="center" editType="date"
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"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="supCode" cname="供应商编码" enable="false" width="100" align="center" hidden="true"/> <EF:EFComboColumn ename="supCode" cname="供应商名称" width="120" align="left" defaultValue=""
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center"/> filter="contains" required="true">
<EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center"/> <EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="purUserName" cname="采购员" width="100" align="center" required="true"/>
<EF:EFColumn ename="receiveQty" cname="收货数量" enable="false" width="120" align="right" format="{0:N0}"/> <EF:EFColumn ename="receiveQty" cname="收货数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N0}"/> <EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="depositQty" cname="入库数量" enable="false" width="120" align="right" format="{0:N0}"/> <EF:EFColumn ename="depositQty" cname="入库数量" enable="false" width="120" align="right" format="{0:N0}"/>
...@@ -58,8 +77,8 @@ ...@@ -58,8 +77,8 @@
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/> editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion title="提示"> <%-- <EF:EFRegion title="提示">--%>
<span style="color: red">1."待确认"状态时,仅能修改收货数量。</span><br/> <%-- <span style="color: red">1."待确认"状态时,仅能修改收货数量。</span><br/>--%>
</EF:EFRegion> <%-- </EF:EFRegion>--%>
</EF:EFPage> </EF:EFPage>
$(function () { $(function () {
var inventRecordBoxBlockId = __eiInfo.getBlock("invent_record_box_block_id").getMappedRows();
IPLATUI.EFGrid = { IPLATUI.EFGrid = {
"result": { "result": {
exportGrid: false, // 隐藏右侧自定义导出按钮 exportGrid: false, // 隐藏右侧自定义导出按钮
...@@ -8,14 +8,117 @@ $(function () { ...@@ -8,14 +8,117 @@ $(function () {
pageSizes: [20, 50, 70, 100], pageSizes: [20, 50, 70, 100],
}, },
columns: [ columns: [
{
field: "inventCode",
template: function (item) {
let template = item.inventCode;
if(item.inventCode){
for(let i=0;i<inventRecordBoxBlockId.length;i++){
if(item.inventCode === inventRecordBoxBlockId[i]['valueField']){
template = inventRecordBoxBlockId[i]['valueField'];
}else{
template = item.inventCode;
}
}
}
return template;
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("field", options.field);
let dataSource = inventRecordBoxBlockId;
EiCommunicator.send("HGPZ005", "queryInventCodeProdTypeSixBox", inInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("invent_record_box_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoDropDownList({
dataSource: dataSource,
minLength: 0,
dataTextField: "valueField",
dataValueField: "valueField",
optionLabelTemplate: "[#:valueField#]#:textField#",
valueTemplate: "[#:valueField#]#:textField#",
template: "[#:valueField#]#:textField#",
filter: "contains"
});
}
},
{
field: "primaryId",
template: function (item) {
item['primaryId'] =$("#inqu_status-0-primaryId").val();
return $("#inqu_status-0-primaryId").val();
}
}
], ],
beforeEdit: function (e) { beforeEdit: function (e) {
var status = $("#status").val(); var status = $("#status").val();
if(status != '0'){ if(status != '0'){
e.preventDefault(); e.preventDefault();
} }
var source = $("#source").val();
if(source === '0'){
//选择合同的明细不能修改存货信息
for (let i = 0; i < e.sender.columns.length; i++) {
//指定的列不让修改
if (e.sender.columns[i]["name"] === "inventCode") {
e.sender.columns[i]["enable"] = false;
e.sender.columns[i]["readonly"] = true;
}
if (e.sender.columns[i]["name"] === "price") {
e.sender.columns[i]["enable"] = false;
}
}
}
}, },
loadComplete: function (grid) { loadComplete: function (grid) {
// 此grid对象
grid.dataSource.bind("change", function (e) {
//数量发生变化进行计算
if(e.field === "receiveQty"){
if(e.items[0].receiveUnitWeight != null){
let receiveWeight = e.items[0].receiveQty * e.items[0].receiveUnitWeight;
resultGrid.setCellValue(e.items[0], 'receiveWeight', receiveWeight);
}
if(e.items[0].price != null){
let amount = e.items[0].receiveQty * e.items[0].price;
resultGrid.setCellValue(e.items[0], 'amount', amount);
}
}
if(e.field === "price"){
if(e.items[0].receiveQty != null){
let amount = e.items[0].receiveQty * e.items[0].price;
resultGrid.setCellValue(e.items[0], 'amount', amount);
}
}
if (e.field === "inventCode") {
for (let i = 0; i < inventRecordBoxBlockId.length; i++) {
if (inventRecordBoxBlockId[i]['valueField'] === e.items[0].inventCode) {
resultGrid.setCellValue(e.items[0], 'inventName', inventRecordBoxBlockId[i]['textField'])
resultGrid.setCellValue(e.items[0], 'inventTypeDetail', inventRecordBoxBlockId[i]['param1Field'])
resultGrid.setCellValue(e.items[0], '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']
calUnitWeight(e.items[0],e.items[0].length,e.items[0].width,e.items[0].thick,coefficient);
break
}
}
}
})
}, },
onSave: function (e) { onSave: function (e) {
// 阻止后台请求,使用自定义 // 阻止后台请求,使用自定义
...@@ -44,6 +147,20 @@ $(window).load(function () { ...@@ -44,6 +147,20 @@ $(window).load(function () {
query(); query();
initInventCode(); initInventCode();
var status = $("#status").val();
if(status != '0'){
$(".k-grid-add").hide();
$(".k-grid-save-changes").hide();
$(".k-grid-cancel-changes").hide();
$(".k-grid-delete").hide();
}else {
//合同选择的存货不让新增、删除
var source = $("#source").val();
if(source === '0'){
$(".k-grid-save-changes").hide();
}
}
}); });
/** /**
...@@ -115,3 +232,14 @@ let remove = function () { ...@@ -115,3 +232,14 @@ let remove = function () {
} }
}); });
} }
let calUnitWeight = function (item,length,width,thick,coefficient) {
let l = Number(length)||1;
let w = Number(width)||1;
let t = Number(thick)||1;
let amount = (l * w * t )>1? l * w * t * Number(coefficient)/100000:0;
//item['amount'] = amount.toString();
resultGrid.setCellValue(item, 'receiveUnitWeight', amount);
resultGrid.setCellValue(item, 'receiveWeight', item.receiveQty*amount);
}
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<EF:EFRegion id="inqu" title="查询条件"> <EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput ename="inqu_status-0-primaryId" cname="主表id" colWidth="3" type="hidden"/> <EF:EFInput ename="inqu_status-0-primaryId" cname="主表id" colWidth="3" type="hidden"/>
<EF:EFInput ename="status" cname="状态" colWidth="3" type="hidden"/> <EF:EFInput ename="status" cname="状态" colWidth="3" type="hidden"/>
<EF:EFInput ename="source" cname="数据来源" colWidth="3" type="hidden"/>
<div class="row"> <div class="row">
<EF:EFSelect cname="存货编号" blockId="inqu_status" ename="inventCode" row="0" colWidth="3" <EF:EFSelect cname="存货编号" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="" template="[#=valueField#]#=textField#"> filter="contains" optionLabel="全部" defultValue="" template="[#=valueField#]#=textField#">
...@@ -20,34 +21,35 @@ ...@@ -20,34 +21,35 @@
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/> <EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="primaryId" cname="主表id" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="inventCode" required="true" cname="存货编号" />
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="inventName" cname="存货名称" width="120" align="center" enable="false" readonly="true" required="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/>
<EF:EFColumn ename="receiveDate" cname="收货日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="receiveNo" cname="收货单号" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.receiveStatus"/>
</EF:EFComboColumn>
<EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/> <EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="specId" cname="规格ID" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="specId" cname="规格ID" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/> <EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="receiveQty" cname="收货数量" width="120" align="right" format="{0:N0}" required="true"/> <EF:EFColumn ename="receiveQty" cname="收货数量" width="120" align="right" format="{0:N0}" required="true"/>
<EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N0}"/> <EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="depositQty" cname="入库数量" enable="false" width="120" align="right" format="{0:N0}"/> <EF:EFColumn ename="depositQty" cname="入库数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="receiveWeight" cname="收货重量" enable="false" width="120" align="right" format="{0:N3}"/> <EF:EFColumn ename="receiveWeight" cname="收货重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" enable="false"/> <EF:EFColumn ename="receiveUnitWeight" cname="收货单重" enable="false" width="120" align="right" format="{0:N3}" hidden="true"/>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="amount" cname="金额" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="amount" cname="金额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/> <EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/> <EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="length" cname="长(MM)" 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}"/>
<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:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.receiveStatus"/>
</EF:EFComboColumn>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/> <EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center" <EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/> editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center" hidden="true"/>
<EF:EFColumn ename="receiveDate" cname="收货日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" hidden="true"/>
<EF:EFColumn ename="receiveNo" cname="收货单号" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="primaryId" cname="主表id" enable="false" width="100" align="center" hidden="true"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
......
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