Commit a6deecab by liuyang

Merge branch 'dev' of http://git.pseer.com:8800/platform/hg-smart into dev-ly

parents a03d4f66 f8296b1d
...@@ -103,7 +103,7 @@ public class HGSC005A extends DaoEPBase { ...@@ -103,7 +103,7 @@ public class HGSC005A extends DaoEPBase {
public static final String INSERT = "HGSC005A.insert"; public static final String INSERT = "HGSC005A.insert";
public static final String UPDATE = "HGSC005A.update"; public static final String UPDATE = "HGSC005A.update";
public static final String DELETE = "HGSC005A.delete"; public static final String DELETE = "HGSC005A.delete";
public static final String BATCH_DELETE = "HGSC005.batch_delete"; public static final String BATCH_DELETE = "HGSC005A.batch_delete";
public static final String UPDATE_PLAN_DATE = "HGSC005A.update_plan_date"; public static final String UPDATE_PLAN_DATE = "HGSC005A.update_plan_date";
private Long id = new Long(0); private Long id = new Long(0);
......
...@@ -4,10 +4,12 @@ import cn.hutool.core.bean.BeanUtil; ...@@ -4,10 +4,12 @@ import cn.hutool.core.bean.BeanUtil;
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.ProductTypeEnum; import com.baosight.hggp.common.ProductTypeEnum;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sb.domain.HGSB002; import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.domain.*; import com.baosight.hggp.hg.sc.domain.*;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.*; import com.baosight.hggp.util.*;
...@@ -21,7 +23,9 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase; ...@@ -21,7 +23,9 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.util.StringUtils; import com.baosight.iplat4j.core.util.StringUtils;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
...@@ -62,19 +66,37 @@ public class ServiceHGSC004A extends ServiceBase { ...@@ -62,19 +66,37 @@ public class ServiceHGSC004A extends ServiceBase {
@Override @Override
public EiInfo delete(EiInfo inInfo) { public EiInfo delete(EiInfo inInfo) {
try { try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); Map resultMap = EiInfoUtils.getFirstRow(inInfo,EiConstant.resultBlock);
// 蓝图ids HGSC004A hgsc004A = new HGSC004A();
List<Long> ids = ObjectUtils.listKey(resultRows, HGSC004A.FIELD_id); hgsc004A.fromMap(resultMap);
hgsc004A = (HGSC004A) super.dao.get(HGSC004A.QUERY,HGSC004A.FIELD_id,hgsc004A.getId());
Map<String,Object> mapA = new HashMap<>(); HGSC004 hgsc004 = (HGSC004) super.dao.get(HGSC004.QUERY,HGSC004A.FIELD_id,hgsc004A.getMaterialId());
mapA.put("ids",ids);
List<HGSC004A> hgsc004AList = dao.query(HGSC004A.QUERY_BY_MATERIAL_ID,mapA, 0, -999999);
HGSC004 hgsc004 = (HGSC004) super.dao.get(HGSC004.QUERY,HGSC004A.FIELD_id,hgsc004AList.get(0).getMaterialId());
if(Objects.nonNull(hgsc004)){ if(Objects.nonNull(hgsc004)){
if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){ if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
DaoUtils.update(HGSC004A.BATCH_CHANGE_TYPE, new HashMap<String,Object>(){{put("ids",ids);put("changeType",HGConstant.ChangeType.SC);}}); if(hgsc004A.getProductStatus().intValue() == HGConstant.ProductStatus.YTJ){
for(HGSC004A hgsc004A : hgsc004AList){ allSubmitDelele(hgsc004,hgsc004A);
}else{
noSubmitDetele(hgsc004A);
}
}else{
noSubmitDetele(hgsc004A);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 全部提交后的删除
* @param hgsc004
* @param hgsc004A
*/
private void allSubmitDelele(HGSC004 hgsc004, HGSC004A hgsc004A) {
//子表 //子表
HGSC005A hgsc005a = new HGSC005A(); HGSC005A hgsc005a = new HGSC005A();
BeanUtil.copyProperties(hgsc004A,hgsc005a,"id","productType"); BeanUtil.copyProperties(hgsc004A,hgsc005a,"id","productType");
...@@ -85,23 +107,62 @@ public class ServiceHGSC004A extends ServiceBase { ...@@ -85,23 +107,62 @@ public class ServiceHGSC004A extends ServiceBase {
}else{ }else{
hgsc005a.setProductType(ProductTypeEnum.PART.getCode()); hgsc005a.setProductType(ProductTypeEnum.PART.getCode());
} }
//如果是构建需要删除构建下的明细
if(hgsc004A.getProductType().equals(ProductTypeEnum.STRUCT.getCode().toString())){
Map paramMap = new HashMap();
paramMap.put(HGSC004A.FIELD_material_id, hgsc004A.getMaterialId());
paramMap.put(HGSC004A.FIELD_parent_prod_code, hgsc004A.getProductCode());
List<HGSC004A> oldObjList = dao.query(HGSC004A.QUERY, paramMap);
List<String> inventCodes = oldObjList.stream().map(HGSC004A::getProductCode).collect(Collectors.toList());
List<HGPZ005> hgpz005List = HGPZTools.HgPz005.listByInventCodes(inventCodes);
//零件明细
List<HGSC005A> partList = new LinkedList<>();
for (HGSC004A o : oldObjList){
if(o.getChangeType().intValue() != HGConstant.ChangeType.SC){
HGSC005A partHgsc005a = new HGSC005A();
BeanUtil.copyProperties(o,partHgsc005a,"id","productType");
partHgsc005a.setMatDetailId(o.getId());
partHgsc005a.setMatId(hgsc004.getId());
partHgsc005a.setProductType(ProductTypeEnum.PART.getCode());
HGPZ005 hgpz005 = hgpz005List.stream().filter(p -> p.getInventCode().equals(o.getProductCode())).findAny().orElse(null);
if(Objects.nonNull(hgpz005)){
partHgsc005a.setTechFlowId(hgpz005.getFlowId());
}
partList.add(partHgsc005a);
o.setChangeType(HGConstant.ChangeType.SC);
}
}
hgsc005a.setPartList(partList);
DaoUtils.updateBatch(HGSC004A.UPDATE,oldObjList);
}
hgsc004A.setChangeType(HGConstant.ChangeType.SC);
DaoUtils.update(HGSC004A.UPDATE,hgsc004A);
Long techFlowId = (Long) DaoBase.getInstance().get(HGSC004A.QUERY_TECHFLOW_ID_BY_PRODUCTID, HGSC004A.FIELD_product_id, hgsc004A.getProductId());
hgsc005a.setTechFlowId(techFlowId);
HGSCTools.THGSC005A.delete(hgsc005a); HGSCTools.THGSC005A.delete(hgsc005a);
HGSCTools.THGSC004B.save(hgsc004A,null); HGSCTools.THGSC004B.save(hgsc004A,null);
} }
/**
* 未提交,需要删除的
* @param hgsc004A
*/
private void noSubmitDetele(HGSC004A hgsc004A) {
//如果是构建需要删除构建下的明细
if(hgsc004A.getProductType().equals(ProductTypeEnum.STRUCT.getCode().toString())){
Map paramMap = new HashMap();
paramMap.put(HGSC004A.FIELD_material_id, hgsc004A.getMaterialId());
paramMap.put(HGSC004A.FIELD_parent_prod_code, hgsc004A.getProductCode());
List<HGSC004A> oldObjList = dao.query(HGSC004A.QUERY, paramMap);
oldObjList.add(hgsc004A);
//未提交的直接删除
DaoUtils.updateBatch(HGSC004A.DELETE,oldObjList);
}else{ }else{
DaoUtils.update(HGSC004A.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",ids);}}); //未提交的直接删除
DaoUtils.update(HGSC004A.DELETE,hgsc004A);
} }
} }
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
public EiInfo save(EiInfo inInfo){ public EiInfo save(EiInfo inInfo){
...@@ -120,30 +181,33 @@ public class ServiceHGSC004A extends ServiceBase { ...@@ -120,30 +181,33 @@ public class ServiceHGSC004A extends ServiceBase {
hgsc004a.setDepCode(hgsc004.getDepCode()); hgsc004a.setDepCode(hgsc004.getDepCode());
hgsc004a.setDepName(hgsc004.getDepName()); hgsc004a.setDepName(hgsc004.getDepName());
hgsc004a.setMaterialId(hgsc004.getId()); hgsc004a.setMaterialId(hgsc004.getId());
hgsc004a.setLv(hgsc004a.getLv() + 1); //不为4级都有叶子节点,父节点需要+1
//不为4级都有叶子节点
if(hgsc004a.getLv().intValue() < 4){ if(hgsc004a.getLv().intValue() < 4){
hgsc004a.setLv(hgsc004a.getLv() + 1);
}
if(hgsc004a.getLv().intValue() == 3){
hgsc004a.setLeaf(2); hgsc004a.setLeaf(2);
}else{ }else{
hgsc004a.setLeaf(1); hgsc004a.setLeaf(1);
} }
this.checkSaveData(hgsc004a,hgsc004); this.checkSaveData(hgsc004a,hgsc004);
if(Objects.nonNull(hgsc004a.getId())&&hgsc004a.getId()!=0){ if(Objects.nonNull(hgsc004a.getId())&&hgsc004a.getId()!=0){
if(hgsc004a.getLv().intValue() == 3){ //替换/修改
hgsc004a.setProductType(ProductTypeEnum.STRUCT.getCode().toString()); replaceEntity(hgsc004a,hgsc004);
}else{ }else {
hgsc004a.setProductType(ProductTypeEnum.PART.getCode().toString()); //新增/增加
addEntity(hgsc004a,hgsc004);
} }
//主表全部提交时需要有改变状态
if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
hgsc004a.setChangeType(HGConstant.ChangeType.TH);
HGSC004A oldHGSC004A = (HGSC004A) super.dao.get(HGSC004A.QUERY,HGSC004A.FIELD_id,hgsc004a.getId());
HGSCTools.THGSC004B.save(oldHGSC004A,hgsc004a);
} }
DaoUtils.update(HGSC004A.UPDATE, hgsc004a); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
}else { private void addEntity(HGSC004A hgsc004a, HGSC004 hgsc004) {
hgsc004a.setProductStatus(HGConstant.ProductStatus.WTJ); hgsc004a.setProductStatus(HGConstant.ProductStatus.WTJ);
if(hgsc004a.getLv().intValue() == 3){ if(hgsc004a.getLv().intValue() == 3){
hgsc004a.setProductType(ProductTypeEnum.STRUCT.getCode().toString()); hgsc004a.setProductType(ProductTypeEnum.STRUCT.getCode().toString());
...@@ -156,17 +220,68 @@ public class ServiceHGSC004A extends ServiceBase { ...@@ -156,17 +220,68 @@ public class ServiceHGSC004A extends ServiceBase {
Long maxId = (Long) super.dao.get(HGSC004A.MAX_ID,null,null); Long maxId = (Long) super.dao.get(HGSC004A.MAX_ID,null,null);
hgsc004a.setId(maxId+1); hgsc004a.setId(maxId+1);
HGSCTools.THGSC004B.save(null,hgsc004a); HGSCTools.THGSC004B.save(null,hgsc004a);
//新增生产计划
HGSC005A hgsc005a = new HGSC005A();
BeanUtil.copyProperties(hgsc004a,hgsc005a,"id","productType");
hgsc005a.setMatDetailId(hgsc004a.getId());
hgsc005a.setMatId(hgsc004.getId());
hgsc005a.setProductType(Integer.valueOf(hgsc004a.getProductType()));
Long techFlowId = (Long) DaoBase.getInstance().get(HGSC004A.QUERY_TECHFLOW_ID_BY_PRODUCTID, HGSC004A.FIELD_product_id, hgsc004a.getProductId());
hgsc005a.setTechFlowId(techFlowId);
HGSCTools.THGSC005A.save(hgsc005a);
} }
DaoUtils.insert(HGSC004A.INSERT, hgsc004a); DaoUtils.insert(HGSC004A.INSERT, hgsc004a);
} }
/**
* 替换,需要先删除计划里面的明细,或者修改明细数量
* @param hgsc004a
* @param hgsc004
*/
private void replaceEntity(HGSC004A hgsc004a, HGSC004 hgsc004) {
if(hgsc004a.getLv().intValue() == 3){
hgsc004a.setProductType(ProductTypeEnum.STRUCT.getCode().toString());
//查询零件,修改零件的父级
Map paramMap = new HashMap();
paramMap.put(HGSC004A.FIELD_material_id, hgsc004a.getMaterialId());
paramMap.put(HGSC004A.FIELD_product_code, hgsc004a.getParentProdCode());
List<HGSC004A> oldObjList = dao.query(HGSC004A.QUERY, paramMap);
oldObjList.forEach(o->{
o.setParentProdCode(hgsc004a.getProductCode());
o.setParentProdName(hgsc004a.getParentProdName());
});
DaoUtils.updateBatch(HGSC004A.UPDATE, oldObjList);
}else{
hgsc004a.setProductType(ProductTypeEnum.PART.getCode().toString());
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); //主表全部提交时需要有改变状态
inInfo.setMsg("保存成功!"); if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
} catch (Exception e) { hgsc004a.setChangeType(HGConstant.ChangeType.TH);
LogUtils.setDetailMsg(inInfo, e, "保存失败"); HGSC004A oldHGSC004A = (HGSC004A) super.dao.get(HGSC004A.QUERY,HGSC004A.FIELD_id,hgsc004a.getId());
HGSCTools.THGSC004B.save(oldHGSC004A,hgsc004a);
Long techFlowId = (Long) DaoBase.getInstance().get(HGSC004A.QUERY_TECHFLOW_ID_BY_PRODUCTID, HGSC004A.FIELD_product_id, hgsc004a.getProductId());
//删除或修改数量生产计划
HGSC005A delHgsc005a = new HGSC005A();
BeanUtil.copyProperties(oldHGSC004A,delHgsc005a,"id","productType");
delHgsc005a.setMatDetailId(oldHGSC004A.getId());
delHgsc005a.setMatId(hgsc004.getId());
delHgsc005a.setProductType(Integer.valueOf(oldHGSC004A.getProductType()));
delHgsc005a.setTechFlowId(techFlowId);
HGSCTools.THGSC005A.delete(delHgsc005a);
//变更生产计划
HGSC005A hgsc005a = new HGSC005A();
BeanUtil.copyProperties(hgsc004a,hgsc005a,"id","productType");
hgsc005a.setMatDetailId(hgsc004a.getId());
hgsc005a.setMatId(hgsc004.getId());
hgsc005a.setProductType(Integer.valueOf(hgsc004a.getProductType()));
hgsc005a.setTechFlowId(techFlowId);
HGSCTools.THGSC005A.update(hgsc005a);
} }
return inInfo; DaoUtils.update(HGSC004A.UPDATE, hgsc004a);
} }
/** /**
...@@ -194,6 +309,8 @@ public class ServiceHGSC004A extends ServiceBase { ...@@ -194,6 +309,8 @@ public class ServiceHGSC004A extends ServiceBase {
AssertUtils.isEmpty(hgsc004a.getCompanyCode(), "请选择公司!"); AssertUtils.isEmpty(hgsc004a.getCompanyCode(), "请选择公司!");
AssertUtils.isEmpty(hgsc004a.getProjCode(), "请填写项目编号!"); AssertUtils.isEmpty(hgsc004a.getProjCode(), "请填写项目编号!");
AssertUtils.isEmpty(hgsc004a.getProjName(), "请填写项目名称!"); AssertUtils.isEmpty(hgsc004a.getProjName(), "请填写项目名称!");
AssertUtils.isTrue(hgsc004a.getSingleWeight().compareTo(BigDecimal.ZERO) <= 0, "单重不能小于等于0!");
} }
...@@ -254,11 +371,16 @@ public class ServiceHGSC004A extends ServiceBase { ...@@ -254,11 +371,16 @@ public class ServiceHGSC004A extends ServiceBase {
//获取主表信息 //获取主表信息
HGSC004 hgsc004 = (HGSC004) super.dao.get(HGSC004.QUERY_BY_ID,HGSC004.FIELD_id,materialId); HGSC004 hgsc004 = (HGSC004) super.dao.get(HGSC004.QUERY_BY_ID,HGSC004.FIELD_id,materialId);
Map<String,Object> queryEntityMap = new HashMap<>();
queryEntityMap.put("materialId",materialId);
List<HGSC004A> allHgsc004AList = dao.query(HGSC004A.QUERY,queryEntityMap, 0, -999999);
for (i = 0; i < eiBlock.getRowCount(); i++) { for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i); Map<?, ?> map = eiBlock.getRow(i);
//前端传参不完成 //前端传参不完成
hgsc004a.fromMap(map); hgsc004a.fromMap(map);
if(Objects.nonNull(hgsc004)){ if(Objects.nonNull(hgsc004)){
//全部提交后的操作,如新增的提交、替换的提交
if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){ if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
hgsc004a = (HGSC004A) super.dao.get(HGSC004A.QUERY_BY_MATERIAL_ID,HGSC004A.FIELD_id,hgsc004a.getId()); hgsc004a = (HGSC004A) super.dao.get(HGSC004A.QUERY_BY_MATERIAL_ID,HGSC004A.FIELD_id,hgsc004a.getId());
//校验计划父单据是否提交,提交了不让新增 //校验计划父单据是否提交,提交了不让新增
...@@ -275,6 +397,18 @@ public class ServiceHGSC004A extends ServiceBase { ...@@ -275,6 +397,18 @@ public class ServiceHGSC004A extends ServiceBase {
} }
HGSCTools.THGSC005A.save(hgsc005a); HGSCTools.THGSC005A.save(hgsc005a);
}else{ }else{
//构建全部提交
if(hgsc004a.getProductType().equals(ProductTypeEnum.STRUCT.getCode().toString())){
HGSC004A finalHgsc004a = hgsc004a;
List<HGSC004A> partList = allHgsc004AList.stream().filter(o -> o.getParentProdCode().equals(finalHgsc004a.getProductCode())
&& o.getProductStatus().intValue() == HGConstant.ProductStatus.WTJ).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(partList)){
partList.forEach(o ->{
o.setProductStatus(HGConstant.ProductStatus.YTJ);
});
DaoUtils.updateBatch(HGSC004A.UPDATE_PRODUCT_STATUS, partList);
}
}
Map<String,Object> mapA = new HashMap<>(); Map<String,Object> mapA = new HashMap<>();
mapA.put("materialId",hgsc004a.getMaterialId()); mapA.put("materialId",hgsc004a.getMaterialId());
mapA.put("productStatus",HGConstant.ProductStatus.WTJ); mapA.put("productStatus",HGConstant.ProductStatus.WTJ);
...@@ -292,7 +426,6 @@ public class ServiceHGSC004A extends ServiceBase { ...@@ -292,7 +426,6 @@ public class ServiceHGSC004A extends ServiceBase {
saveTHGSC005(hgsc004,hgsc004a); saveTHGSC005(hgsc004,hgsc004a);
} }
} }
} }
hgsc004a.setProductStatus(HGConstant.ProductStatus.YTJ); hgsc004a.setProductStatus(HGConstant.ProductStatus.YTJ);
DaoUtils.update(HGSC004A.UPDATE_PRODUCT_STATUS, hgsc004a); DaoUtils.update(HGSC004A.UPDATE_PRODUCT_STATUS, hgsc004a);
......
...@@ -221,6 +221,9 @@ ...@@ -221,6 +221,9 @@
<isNotEmpty prepend=" AND " property="materialId"> <isNotEmpty prepend=" AND " property="materialId">
a.material_id = #materialId# a.material_id = #materialId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="materialId">
a.material_id = #materialId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
a.id = #id# a.id = #id#
</isNotEmpty> </isNotEmpty>
...@@ -235,7 +238,7 @@ ...@@ -235,7 +238,7 @@
</select> </select>
<select id="queryTechFlowIdByProductId" parameterClass="java.util.HashMap" <select id="queryTechFlowIdByProductId" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sc.domain.HGSC004A"> resultClass="Long">
SELECT SELECT
b.flow_id as "techFlowId" b.flow_id as "techFlowId"
FROM ${hggpSchema}.hgpz005 b FROM ${hggpSchema}.hgpz005 b
...@@ -243,6 +246,9 @@ ...@@ -243,6 +246,9 @@
<isNotEmpty prepend=" AND " property="productId"> <isNotEmpty prepend=" AND " property="productId">
b.id = #productId# b.id = #productId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="productIds">
b.id IN <iterate close=")" open="(" conjunction="," property="productIds">#productIds[]#</iterate>
</isNotEmpty>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
......
...@@ -8,8 +8,11 @@ $(function () { ...@@ -8,8 +8,11 @@ $(function () {
$("#QUERY").on("click", function () { $("#QUERY").on("click", function () {
query(); query();
}); });
// 批量提交
$("#BATCH_SUBMIT").on("click", batchSubmit);
let inventNameGlobalData = []; let inventNameGlobalData = [];
let parentId = ''; let parentId = '';
var strs; var strs;
...@@ -30,6 +33,7 @@ $(function () { ...@@ -30,6 +33,7 @@ $(function () {
* @param options: 树的配置项 * @param options: 树的配置项
*/ */
query: function (postEiInfo, model) { query: function (postEiInfo, model) {
postEiInfo.set("companyCode",companyCode ? companyCode : null); postEiInfo.set("companyCode",companyCode ? companyCode : null);
postEiInfo.set("projCode",projCode ? projCode : null); postEiInfo.set("projCode",projCode ? projCode : null);
postEiInfo.set("materialId",$("#inqu_status-0-materialId").val()); postEiInfo.set("materialId",$("#inqu_status-0-materialId").val());
...@@ -111,6 +115,8 @@ $(function () { ...@@ -111,6 +115,8 @@ $(function () {
let status = item.productStatus; let status = item.productStatus;
let changeType = item.changeType; let changeType = item.changeType;
let template = ''; let template = '';
// template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
// + 'onclick="saveDetail()" >保存</a>';
if (item.id){ if (item.id){
if(changeType != 0){ if(changeType != 0){
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" '
...@@ -120,10 +126,12 @@ $(function () { ...@@ -120,10 +126,12 @@ $(function () {
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="updateProductStatus(' + item.id + ',1)" >提交</a>'; + 'onclick="updateProductStatus(' + item.id + ',1)" >提交</a>';
} }
// else if (status == 1) { if(changeType != 3){
// 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="updateProductStatus(' + item.id + ',0)" >取消提交</a>'; + 'onclick="deteleDetail(' + item.id + ')" >删除</a>';
// } }
} }
return template; return template;
} }
...@@ -257,13 +265,13 @@ $(function () { ...@@ -257,13 +265,13 @@ $(function () {
let totalWeight = item.quantity * item.singleWeight; let totalWeight = item.quantity * item.singleWeight;
resultGrid.setCellValue(item, 'totalWeight', totalWeight) resultGrid.setCellValue(item, 'totalWeight', totalWeight)
} }
loadChange(grid,e,"singleWeight");
} }
if (e.field == "singleWeight") { if (e.field == "singleWeight") {
if(item.quantity && item.singleWeight){ if(item.quantity && item.singleWeight){
let totalWeight = item.quantity * item.singleWeight; let totalWeight = item.quantity * item.singleWeight;
resultGrid.setCellValue(item, 'totalWeight', totalWeight) resultGrid.setCellValue(item, 'totalWeight', totalWeight)
} }
loadChange(grid,e,"totalWeight");
} }
}); });
}, },
...@@ -444,7 +452,7 @@ $(function () { ...@@ -444,7 +452,7 @@ $(function () {
}); });
}); });
$(window).load(function () { $(window).load(function () {
query(); // query();
}); });
/** /**
...@@ -636,6 +644,8 @@ function showDetail(id) { ...@@ -636,6 +644,8 @@ function showDetail(id) {
} }
function updateProductStatus(id,status) { function updateProductStatus(id,status) {
JSUtils.confirm("确定是否\"删除\"操作? ", {
ok: function () {
let inEiInfo = new EiInfo(); let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id); inEiInfo.set("result-0-id", id);
inEiInfo.set("result-0-productStatus", status); inEiInfo.set("result-0-productStatus", status);
...@@ -644,6 +654,54 @@ function updateProductStatus(id,status) { ...@@ -644,6 +654,54 @@ function updateProductStatus(id,status) {
onSuccess(response) { onSuccess(response) {
NotificationUtil(response.msg); NotificationUtil(response.msg);
query(); query();
refreshTree();
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
}
);
}
});
}
function saveDetail() {
JSUtils.confirm("确定是否\"保存\"操作? ", {
ok: function () {
var inEiInfo = new EiInfo();
inEiInfo.setByNode("result");
EiCommunicator.send('HGSC004A', 'save', inEiInfo, {
onSuccess(response) {
NotificationUtil(response.msg);
query();
refreshTree();
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
}
);
}
});
}
function deteleDetail(id) {
JSUtils.confirm("确定是否\"删除\"操作? ", {
ok: function () {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
inEiInfo.set("result-0-materialId", $("#inqu_status-0-materialId").val());
EiCommunicator.send('HGSC004A', 'delete', inEiInfo, {
onSuccess(response) {
NotificationUtil(response.msg);
query();
refreshTree();
}, },
onFail(errorMessage, status, e) { onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error"); NotificationUtil("执行失败!", "error");
...@@ -652,8 +710,39 @@ function updateProductStatus(id,status) { ...@@ -652,8 +710,39 @@ function updateProductStatus(id,status) {
async: false async: false
} }
); );
}
});
} }
/**
* 提交操作
*
* @param id
* @param checkNo
*/
let batchSubmit = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
for (let i = 0; i < rows.length; i++) {
let singleWeight = rows[i]['singleWeight'];
let quantity = rows[i]['quantity'];
if (!isNumber(singleWeight) || !isNumber(quantity)) {
message("第" + (i + 1) + "行单重和数量必须是大于等于0的数字");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做提交操作吗? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGSC004A", "updateProductStatus", true);
}
});
}
function loadChange(grid,e,field) { function loadChange(grid,e,field) {
var cell_label = field,that = grid; var cell_label = field,that = grid;
// locked 表示是否为固定列 // locked 表示是否为固定列
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<div id="right-pane" class="i-fit-height" style="width: 80%;float: right"> <div id="right-pane" class="i-fit-height" style="width: 80%;float: right">
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="no" checkMode="single"> <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="lv" cname="层级" hidden="true"/> <EF:EFColumn ename="lv" cname="层级" hidden="true"/>
<EF:EFColumn enable="false" ename="parentProdCode" hidden="true" cname="上级产品编号"/> <EF:EFColumn enable="false" ename="parentProdCode" hidden="true" cname="上级产品编号"/>
......
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