Commit 71b7d1c8 by 江和松

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

parents 71bd4acc c8c6c7d0
...@@ -53,8 +53,16 @@ public class DocController extends WebDispatchController { ...@@ -53,8 +53,16 @@ public class DocController extends WebDispatchController {
outInfo.setMsg("导入文件不能为空"); outInfo.setMsg("导入文件不能为空");
return outInfo; return outInfo;
} }
Map<String, String> params = this.convertParam(paramMaps);
String id = request.getParameter("id"); String id = request.getParameter("id");
DocRouteEnum docRouteEnum = DocRouteEnum.getById(id); DocRouteEnum docRouteEnum = DocRouteEnum.getById(id);
if (params.get("fileName").contains("HGSC004A")){
docRouteEnum = DocRouteEnum.getById("route_001");
}else if (params.get("fileName").contains("HGSC009A")){
docRouteEnum = DocRouteEnum.getById("route_002");
}else if (params.get("fileName").contains("HGPZ005")){
docRouteEnum = DocRouteEnum.getById("route_003");
}
if (docRouteEnum == null) { if (docRouteEnum == null) {
outInfo.setMsg("导入标识ID不存在"); outInfo.setMsg("导入标识ID不存在");
return outInfo; return outInfo;
......
package com.baosight.hggp.hg.cw.domain; package com.baosight.hggp.hg.cw.domain;
import com.baosight.hggp.common.ExcelAnno;
import com.baosight.iplat4j.core.util.NumberUtils; import com.baosight.iplat4j.core.util.NumberUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baosight.iplat4j.core.ei.EiColumn; import com.baosight.iplat4j.core.ei.EiColumn;
...@@ -78,14 +79,23 @@ public class HGCW003 extends DaoEPBase { ...@@ -78,14 +79,23 @@ public class HGCW003 extends DaoEPBase {
private String companyCode = " "; /* 公司编码*/ private String companyCode = " "; /* 公司编码*/
private String companyName = " "; /* 公司名称*/ private String companyName = " "; /* 公司名称*/
private String contractNumber = " "; /* 合同号*/ private String contractNumber = " "; /* 合同号*/
@ExcelAnno(index = 0)
private String inventory = " "; /* 清单*/ private String inventory = " "; /* 清单*/
@ExcelAnno(index = 1)
private String unit = " "; /* 单位*/ private String unit = " "; /* 单位*/
@ExcelAnno(index = 2)
private BigDecimal provisionalQuantity = new BigDecimal("0"); /* 暂定工程量*/ private BigDecimal provisionalQuantity = new BigDecimal("0"); /* 暂定工程量*/
@ExcelAnno(index = 3)
private String measurementMethod = " "; /* 计量方式*/ private String measurementMethod = " "; /* 计量方式*/
@ExcelAnno(index = 4)
private String supplyMethod = " "; /* 材料供应方式*/ private String supplyMethod = " "; /* 材料供应方式*/
@ExcelAnno(index = 5)
private BigDecimal unitPriceExcludingTax = new BigDecimal("0"); /* 除税单价/元*/ private BigDecimal unitPriceExcludingTax = new BigDecimal("0"); /* 除税单价/元*/
@ExcelAnno(index = 6)
private BigDecimal totalPriceExcluding = new BigDecimal("0"); /* 不含税总价*/ private BigDecimal totalPriceExcluding = new BigDecimal("0"); /* 不含税总价*/
@ExcelAnno(index = 7)
private BigDecimal totalPriceIncluding = new BigDecimal("0"); /* 含税总价*/ private BigDecimal totalPriceIncluding = new BigDecimal("0"); /* 含税总价*/
@ExcelAnno(index = 8)
private BigDecimal laborCosts = new BigDecimal("0"); /* 其中人工费/元*/ private BigDecimal laborCosts = new BigDecimal("0"); /* 其中人工费/元*/
private String createdBy = " "; /* 记录创建者*/ private String createdBy = " "; /* 记录创建者*/
private String createdName = " "; /* 记录创建名称*/ private String createdName = " "; /* 记录创建名称*/
......
...@@ -12,19 +12,23 @@ import com.baosight.hggp.hg.pz.domain.HGPZ002; ...@@ -12,19 +12,23 @@ import com.baosight.hggp.hg.pz.domain.HGPZ002;
import com.baosight.hggp.hg.pz.domain.HGPZ003; import com.baosight.hggp.hg.pz.domain.HGPZ003;
import com.baosight.hggp.hg.pz.tools.HGPZTools; import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.domain.HGSC004A; import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sj.domain.HGSJ003;
import com.baosight.hggp.hg.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.tools.HGXSTools; import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.ExcelUtils; import com.baosight.hggp.util.ExcelUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants; import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -128,18 +132,4 @@ public class ServiceHGCW002A extends ServiceBase { ...@@ -128,18 +132,4 @@ public class ServiceHGCW002A extends ServiceBase {
} }
return inInfo; return inInfo;
} }
@OperationLogAnnotation(operModul = "合同清单",operType = "导入",operDesc = "导入操作")
public EiInfo importDate(EiInfo inInfo) {
try {
Map<String, Object> params = new HashMap<>(2);
String fileName = inInfo.getString(ACConstants.FILE_NAME);
//解析文件,将文件中数据传入到inInfo中
inInfo = ExcelUtils.importFromExcel(inInfo, fileName, params, new HGCW003());
}catch (Exception e){
inInfo.setStatus(EiConstant.STATUS_FAILURE);
LogUtils.setDetailMsg(inInfo, e, "导入失败");
}
return inInfo;
}
} }
...@@ -12,11 +12,9 @@ import com.baosight.hggp.hg.sb.tools.HGSBTools; ...@@ -12,11 +12,9 @@ import com.baosight.hggp.hg.sb.tools.HGSBTools;
import com.baosight.hggp.hg.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.cw.vo.UserVO; import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.*;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants; import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
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;
...@@ -200,4 +198,35 @@ public class ServiceHGCW003 extends ServiceBase { ...@@ -200,4 +198,35 @@ public class ServiceHGCW003 extends ServiceBase {
} }
return inInfo; return inInfo;
} }
@OperationLogAnnotation(operModul = "合同清单",operType = "导入",operDesc = "导入操作")
public EiInfo importData(EiInfo inInfo) {
try {
List<HGCW003> dataList = (List) inInfo.get("dataList");
for (HGCW003 hgcw003: dataList) {
if (hgcw003.getProvisionalQuantity().compareTo(BigDecimal.ZERO)<=0) {
AssertUtils.isTrue(true, "暂定工程量不能为0");
}
if (hgcw003.getUnitPriceExcludingTax().compareTo(BigDecimal.ZERO)<=0) {
AssertUtils.isTrue(true, "除税单价不能为0");
}
if (hgcw003.getTotalPriceExcluding().compareTo(BigDecimal.ZERO)<=0) {
AssertUtils.isTrue(true, "不含税总价不能为0");
}
if (hgcw003.getTotalPriceIncluding().compareTo(BigDecimal.ZERO)<=0) {
AssertUtils.isTrue(true, "含税总价不能为0");
}
}
EiBlock block = new EiBlock("detail1");
block.setBlockMeta(new HGCW003().eiMetadata);
block.setRows(dataList);
inInfo.setBlock(block);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("导入成功" + dataList.size() + "条");
}catch (Exception e){
inInfo.setStatus(EiConstant.STATUS_FAILURE);
LogUtils.setDetailMsg(inInfo, e, "导入失败");
}
return inInfo;
}
} }
package com.baosight.hggp.hg.pz.domain; package com.baosight.hggp.hg.pz.domain;
import com.baosight.hggp.common.ExcelAnno;
import com.baosight.iplat4j.core.util.NumberUtils; import com.baosight.iplat4j.core.util.NumberUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baosight.iplat4j.core.ei.EiColumn; import com.baosight.iplat4j.core.ei.EiColumn;
...@@ -78,16 +79,26 @@ public class HGPZ005 extends DaoEPBase { ...@@ -78,16 +79,26 @@ public class HGPZ005 extends DaoEPBase {
private Long id = new Long(0); private Long id = new Long(0);
private String accountCode = " "; /* 帐套编码*/ private String accountCode = " "; /* 帐套编码*/
private String depCode = " "; /* 部门编码*/ private String depCode = " "; /* 部门编码*/
@ExcelAnno(index = 5)
private String inventType = " ";; /* 存货类型*/ private String inventType = " ";; /* 存货类型*/
private Integer inventTypeDetail; /*存货类型明细 1:构建 2:零件*/ private Integer inventTypeDetail; /*存货类型明细 1:构建 2:零件*/
@ExcelAnno(index = 0)
private String inventCode = " "; /* 存货编码*/ private String inventCode = " "; /* 存货编码*/
@ExcelAnno(index = 1)
private String inventName = " "; /* 存货名称*/ private String inventName = " "; /* 存货名称*/
@ExcelAnno(index = 2)
private String spec = " "; /* 规格*/ private String spec = " "; /* 规格*/
@ExcelAnno(index = 3)
private BigDecimal length = new BigDecimal("0"); /* 长*/ private BigDecimal length = new BigDecimal("0"); /* 长*/
@ExcelAnno(index = 8)
private BigDecimal width = new BigDecimal("0"); /* 宽*/ private BigDecimal width = new BigDecimal("0"); /* 宽*/
@ExcelAnno(index = 9)
private BigDecimal thick = new BigDecimal("0"); /* 厚*/ private BigDecimal thick = new BigDecimal("0"); /* 厚*/
@ExcelAnno(index = 4)
private String material = " "; /* 材质*/ private String material = " "; /* 材质*/
@ExcelAnno(index = 7)
private BigDecimal coefficient = new BigDecimal("0"); /* 系数*/ private BigDecimal coefficient = new BigDecimal("0"); /* 系数*/
@ExcelAnno(index = 6)
private String unit = " "; /* 单位*/ private String unit = " "; /* 单位*/
private Integer status; /* 状态 0未启用 1启用*/ private Integer status; /* 状态 0未启用 1启用*/
private String createdBy = " "; /* 创建人*/ private String createdBy = " "; /* 创建人*/
......
...@@ -388,13 +388,17 @@ public class ServiceHGPZ005 extends ServiceBase { ...@@ -388,13 +388,17 @@ public class ServiceHGPZ005 extends ServiceBase {
} }
@OperationLogAnnotation(operModul = "存货档案",operType = "导入",operDesc = "导入操作") @OperationLogAnnotation(operModul = "存货档案",operType = "导入",operDesc = "导入操作")
public EiInfo importDate(EiInfo inInfo) { public EiInfo importData(EiInfo inInfo) {
try { try {
Map<String, Object> params = new HashMap<>(10); List<HGPZ005> dataList = (List) inInfo.get("dataList");
HGPZTools.HgPz005.add(dataList);
/*Map<String, Object> params = new HashMap<>(10);
String fileName = inInfo.getString("fileName"); String fileName = inInfo.getString("fileName");
params.put(HGPZ005.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode()); params.put(HGPZ005.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
//解析文件,将文件中数据传入到inInfo中 //解析文件,将文件中数据传入到inInfo中
ExcelUtils.importFromExcel(inInfo, fileName, params, new HGPZ005()); ExcelUtils.importFromExcel(inInfo, fileName, params, new HGPZ005());*/
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("导入成功" + dataList.size() + "条");
}catch (Exception e){ }catch (Exception e){
inInfo.setStatus(EiConstant.STATUS_FAILURE); inInfo.setStatus(EiConstant.STATUS_FAILURE);
LogUtils.setDetailMsg(inInfo, e, "导入失败"); LogUtils.setDetailMsg(inInfo, e, "导入失败");
......
...@@ -596,19 +596,17 @@ public class HGPZTools { ...@@ -596,19 +596,17 @@ public class HGPZTools {
* 导入添加存货档案 * 导入添加存货档案
* @param list * @param list
*/ */
public static void add(List<Map> list){ public static void add(List<HGPZ005> list){
List<HGPZ004> hgpz004s = DaoBase.getInstance().query(HGPZ004.QUERY, new HashMap<String, Object>(){{ List<HGPZ004> hgpz004s = DaoBase.getInstance().query(HGPZ004.QUERY, new HashMap<String, Object>(){{
put(HGPZ004.FIELD_STATUS, CommonConstant.YesNo.YES_1); put(HGPZ004.FIELD_STATUS, CommonConstant.YesNo.YES_1);
}}); }});
// Map parmap = hgpz004s.stream().filter(item-> !Objects.equals(item.getParInventType(), "root")).collect(Collectors.toMap(HGPZ004::getInventTypeName, HGPZ004::getInventType,(v1, v2) -> v1)); // Map parmap = hgpz004s.stream().filter(item-> !Objects.equals(item.getParInventType(), "root")).collect(Collectors.toMap(HGPZ004::getInventTypeName, HGPZ004::getInventType,(v1, v2) -> v1));
Map parmap = hgpz004s.stream().collect(Collectors.toMap(HGPZ004::getInventTypeName, HGPZ004::getInventType,(v1, v2) -> v1)); Map parmap = hgpz004s.stream().collect(Collectors.toMap(HGPZ004::getInventTypeName, HGPZ004::getInventType,(v1, v2) -> v1));
for (Map map:list) { for (HGPZ005 hgpz005: list) {
String inventType = MapUtils.getString(parmap, StringUtils.trimToEmpty(map.get(HGPZ005.FIELD_INVENT_TYPE).toString())); String inventType = MapUtils.getString(parmap, StringUtils.trimToEmpty(hgpz005.getInventType()));
AssertUtils.isEmpty(inventType, String.format("存货类型[%s]代码不存在,添加失败!", map.get(HGPZ005.FIELD_INVENT_TYPE))); AssertUtils.isEmpty(inventType, String.format("存货类型[%s]代码不存在,添加失败!", hgpz005.getInventType()));
Map<String,String> inventMap = hgpz004s.stream().filter(item-> Objects.equals(item.getInventType(), inventType)).collect(Collectors.toMap(HGPZ004::getInventType,HGPZ004::getInventTypeDetail)); Map<String,String> inventMap = hgpz004s.stream().filter(item-> Objects.equals(item.getInventType(), inventType)).collect(Collectors.toMap(HGPZ004::getInventType,HGPZ004::getInventTypeDetail));
AssertUtils.isEmpty(inventMap.get(inventType), String.format("存货类型[%s]明细不存在,添加失败!", map.get(HGPZ005.FIELD_INVENT_TYPE))); AssertUtils.isEmpty(inventMap.get(inventType), String.format("存货类型[%s]明细不存在,添加失败!", hgpz005.getInventType()));
HGPZ005 hgpz005 = new HGPZ005();
hgpz005.fromMap(map);
hgpz005.setInventType(inventType); hgpz005.setInventType(inventType);
hgpz005.setInventTypeDetail(Integer.valueOf(inventMap.get(inventType))); hgpz005.setInventTypeDetail(Integer.valueOf(inventMap.get(inventType)));
hgpz005.setStatus(1); //默认启用 hgpz005.setStatus(1); //默认启用
......
...@@ -89,33 +89,33 @@ public class HGSC009A extends DaoEPBase { ...@@ -89,33 +89,33 @@ public class HGSC009A extends DaoEPBase {
private String depCode = " "; /* 部门编码*/ private String depCode = " "; /* 部门编码*/
private String companyCode = " "; /* 公司编码*/ private String companyCode = " "; /* 公司编码*/
private String companyName = " "; /* 公司名称*/ private String companyName = " "; /* 公司名称*/
@ExcelAnno(index = 8,name = "projCode") @ExcelAnno(index = 14)
private String projCode = " "; /* 项目编码*/ private String projCode = " "; /* 项目编码*/
@ExcelAnno(index = 9,name = "projName") @ExcelAnno(index = 15)
private String projName = " "; /* 项目名称*/ private String projName = " "; /* 项目名称*/
@ExcelAnno(index = 10,name = "planMaterialDate") @ExcelAnno(index = 7)
private String planMaterialDate = " "; /* 材料计划编码*/ private String planMaterialDate = " "; /* 材料计划编码*/
private String planMaterialCode = " "; /* 材料计划编码*/ private String planMaterialCode = " "; /* 材料计划编码*/
@ExcelAnno(index = 11,name = "planMaterialName") @ExcelAnno(index = 8)
private String planMaterialName = " "; /* 材料计划名称*/ private String planMaterialName = " "; /* 材料计划名称*/
@ExcelAnno(index = 0,name = "inventCode") @ExcelAnno(index = 0)
private String inventCode = " "; /* 存货编码*/ private String inventCode = " "; /* 存货编码*/
@ExcelAnno(index = 1,name = "inventName") @ExcelAnno(index = 1)
private String inventName = " "; /* 存货名称*/ private String inventName = " "; /* 存货名称*/
@ExcelAnno(index = 2,name = "spec") @ExcelAnno(index = 2)
private String spec = " "; /* 规格*/ private String spec = " "; /* 规格*/
@ExcelAnno(index = 13,name = "material") @ExcelAnno(index = 4)
private String material = " "; /* 材质*/ private String material = " "; /* 材质*/
@ExcelAnno(index = 3,name = "length") @ExcelAnno(index = 3)
private BigDecimal length = new BigDecimal("0"); /* 长*/ private BigDecimal length = new BigDecimal("0"); /* 长*/
@ExcelAnno(index = 4,name = "width") @ExcelAnno(index = 12)
private BigDecimal width = new BigDecimal("0"); /* 宽*/ private BigDecimal width = new BigDecimal("0"); /* 宽*/
@ExcelAnno(index = 5,name = "thick") @ExcelAnno(index = 13)
private BigDecimal thick = new BigDecimal("0"); /* 厚*/ private BigDecimal thick = new BigDecimal("0"); /* 厚*/
@ExcelAnno(index = 6,name = "quantity") @ExcelAnno(index = 5)
private BigDecimal quantity = new BigDecimal("0"); /* 数量*/ private BigDecimal quantity = new BigDecimal("0"); /* 数量*/
@ExcelAnno(index = 7,name = "singleWeight")
private BigDecimal singleWeight = new BigDecimal("0"); /* 单重*/ private BigDecimal singleWeight = new BigDecimal("0"); /* 单重*/
@ExcelAnno(index = 6)
private BigDecimal grossAmount = new BigDecimal("0"); /* 总量*/ private BigDecimal grossAmount = new BigDecimal("0"); /* 总量*/
private String createdBy = " "; /* 创建人*/ private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/ private String createdName = " "; /* 创建人名称*/
...@@ -124,11 +124,11 @@ public class HGSC009A extends DaoEPBase { ...@@ -124,11 +124,11 @@ public class HGSC009A extends DaoEPBase {
private String updatedName = " "; /* 修改人名称*/ private String updatedName = " "; /* 修改人名称*/
private String updatedTime = " "; /* 修改时间*/ private String updatedTime = " "; /* 修改时间*/
private String inventTypeDetail; /*存货类型明细 1:构建 2:零件*/ private String inventTypeDetail; /*存货类型明细 1:构建 2:零件*/
@ExcelAnno(index = 12,name = "inventType") @ExcelAnno(index = 9)
private String inventType = " "; /* 存货类型*/ private String inventType = " "; /* 存货类型*/
@ExcelAnno(index = 14,name = "coefficient") @ExcelAnno(index = 11)
private BigDecimal coefficient = new BigDecimal("0"); /* 系数*/ private BigDecimal coefficient = new BigDecimal("0"); /* 系数*/
@ExcelAnno(index = 15,name = "unit") @ExcelAnno(index = 10)
private String unit = " "; /* 单位*/ private String unit = " "; /* 单位*/
/** /**
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
PLAN_MATERIAL_CODE = #planMaterialCode# PLAN_MATERIAL_CODE = #planMaterialCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="planMaterialName"> <isNotEmpty prepend=" AND " property="planMaterialName">
PLAN_MATERIAL_NAME = #planMaterialName# PLAN_MATERIAL_NAME like CONCAT('%',#planMaterialName#,'%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode"> <isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode# INVENT_CODE = #inventCode#
......
...@@ -32,6 +32,7 @@ import org.apache.commons.collections.MapUtils; ...@@ -32,6 +32,7 @@ import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function; import java.util.function.Function;
...@@ -1446,7 +1447,7 @@ public class HGSCTools { ...@@ -1446,7 +1447,7 @@ public class HGSCTools {
//hgsc009a.setProjCode(hgsc009.getProjCode()); //hgsc009a.setProjCode(hgsc009.getProjCode());
hgsc009a.setProjName(hgsc009.getProjName()); hgsc009a.setProjName(hgsc009.getProjName());
hgsc009a.setPlanMaterialCode(hgsc009.getPlanMaterialCode()); hgsc009a.setPlanMaterialCode(hgsc009.getPlanMaterialCode());
//hgsc009a.setPlanMaterialName(hgsc009.getPlanMaterialName()); hgsc009a.setPlanMaterialName(hgsc009.getPlanMaterialName());
hgsc009a.setInventName(hgpz005.getInventName()); hgsc009a.setInventName(hgpz005.getInventName());
hgsc009a.setInventCode(hgpz005.getInventCode()); hgsc009a.setInventCode(hgpz005.getInventCode());
hgsc009a.setSpec(hgpz005.getSpec()); hgsc009a.setSpec(hgpz005.getSpec());
...@@ -1455,11 +1456,7 @@ public class HGSCTools { ...@@ -1455,11 +1456,7 @@ public class HGSCTools {
hgsc009a.setWidth(hgpz005.getWidth()); hgsc009a.setWidth(hgpz005.getWidth());
hgsc009a.setThick(hgpz005.getThick()); hgsc009a.setThick(hgpz005.getThick());
hgsc009a.setInventTypeDetail(hgpz005.getInventTypeDetail()+""); hgsc009a.setInventTypeDetail(hgpz005.getInventTypeDetail()+"");
if (hgsc009a.getSingleWeight().compareTo(BigDecimal.ZERO) == 0 ){
hgsc009a.setSingleWeight(HGPZTools.HgPz005.calcUnitWeight(hgpz005));
}
AssertUtils.isTrue(hgsc009a.getQuantity().compareTo(BigDecimal.ZERO) == 0, "数量不能为0!");
hgsc009a.setGrossAmount(hgsc009a.getQuantity().multiply(hgsc009a.getSingleWeight()));
hgsc009as.add(hgsc009a); hgsc009as.add(hgsc009a);
} }
DaoUtils.insertBatch(HGSC009A.INSERT,hgsc009as); DaoUtils.insertBatch(HGSC009A.INSERT,hgsc009as);
...@@ -1491,10 +1488,9 @@ public class HGSCTools { ...@@ -1491,10 +1488,9 @@ public class HGSCTools {
arrayList.forEach(array -> { arrayList.forEach(array -> {
AssertUtils.isEmpty(Collections.singleton(array.getQuantity()), "材料计划数量不能为空!"); AssertUtils.isEmpty(Collections.singleton(array.getQuantity()), "材料计划数量不能为空!");
array.setPlanMaterialDate(DateUtils.formatShort(array.getPlanMaterialDate())); array.setPlanMaterialDate(DateUtils.formatShort(array.getPlanMaterialDate()));
if (array.getSingleWeight().compareTo(BigDecimal.ZERO) == 0 || array.getQuantity().compareTo(BigDecimal.ZERO) == 0){ if (array.getQuantity().compareTo(BigDecimal.ZERO) > 0 && array.getGrossAmount().compareTo(BigDecimal.ZERO)>0){
AssertUtils.isTrue(false,"单重和数量不能为空!"); array.setSingleWeight(array.getGrossAmount().divide(array.getQuantity(), RoundingMode.HALF_UP));
} }
array.setGrossAmount(array.getQuantity().multiply(array.getSingleWeight()));
hgsc009aList.add(array); hgsc009aList.add(array);
}); });
......
package com.baosight.hggp.hg.sj.domain; package com.baosight.hggp.hg.sj.domain;
import com.baosight.hggp.common.ExcelAnno;
import com.baosight.iplat4j.core.data.DaoEPBase; import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn; import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils; import com.baosight.iplat4j.core.util.NumberUtils;
...@@ -93,20 +94,30 @@ public class HGSJ003 extends DaoEPBase { ...@@ -93,20 +94,30 @@ public class HGSJ003 extends DaoEPBase {
private String updatedName = " "; /* 更新人名称*/ private String updatedName = " "; /* 更新人名称*/
private String updatedTime = " "; /* 更新时间*/ private String updatedTime = " "; /* 更新时间*/
private Integer deleteFlag = 0; /* 是否删除:0-否 1-是*/ private Integer deleteFlag = 0; /* 是否删除:0-否 1-是*/
@ExcelAnno(index = 0)
private String factoryCode = " "; /* 厂区编码*/ private String factoryCode = " "; /* 厂区编码*/
@ExcelAnno(index = 1)
private String factoryName = " "; /* 厂区名称*/ private String factoryName = " "; /* 厂区名称*/
private String flowCode = " "; /* 流程编码*/ private String flowCode = " "; /* 流程编码*/
private String flowName = " "; /* 流程名称*/ private String flowName = " "; /* 流程名称*/
@ExcelAnno(index = 2)
private String processCode = " "; /* 工序编码*/ private String processCode = " "; /* 工序编码*/
@ExcelAnno(index = 3)
private String processName = " "; /* 工序名称*/ private String processName = " "; /* 工序名称*/
@ExcelAnno(index = 5)
private String unit = " "; /* 单位*/ private String unit = " "; /* 单位*/
private Integer processClass = new Integer(0); /* 工序分类*/ private Integer processClass = new Integer(0); /* 工序分类*/
@ExcelAnno(index = 4)
private String processClassName = " "; /* 工序分类名称*/ private String processClassName = " "; /* 工序分类名称*/
private String spec = " "; /* 规格*/ private String spec = " "; /* 规格*/
@ExcelAnno(index = 6)
private BigDecimal length = new BigDecimal(0.000); /* 长*/ private BigDecimal length = new BigDecimal(0.000); /* 长*/
@ExcelAnno(index = 7)
private BigDecimal width = new BigDecimal(0.000); /* 宽*/ private BigDecimal width = new BigDecimal(0.000); /* 宽*/
@ExcelAnno(index = 8)
private BigDecimal thick = new BigDecimal(0.000); /* 厚*/ private BigDecimal thick = new BigDecimal(0.000); /* 厚*/
private BigDecimal coefficient = new BigDecimal(0.000); /* 系数*/ private BigDecimal coefficient = new BigDecimal(0.000); /* 系数*/
@ExcelAnno(index = 9)
private BigDecimal price = new BigDecimal(0.000); /* 单价*/ private BigDecimal price = new BigDecimal(0.000); /* 单价*/
private Integer status = 0; /* 状态 0-启用 1-停止*/ private Integer status = 0; /* 状态 0-启用 1-停止*/
...@@ -158,11 +169,11 @@ public class HGSJ003 extends DaoEPBase { ...@@ -158,11 +169,11 @@ public class HGSJ003 extends DaoEPBase {
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FACTORY_CODE); eiColumn = new EiColumn(FIELD_FACTORY_CODE);
eiColumn.setDescName("厂区编码"); eiColumn.setDescName("公司编码");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FACTORY_NAME); eiColumn = new EiColumn(FIELD_FACTORY_NAME);
eiColumn.setDescName("厂区名称"); eiColumn.setDescName("公司名称");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FLOW_CODE); eiColumn = new EiColumn(FIELD_FLOW_CODE);
......
...@@ -8,6 +8,7 @@ import com.baosight.hggp.core.enums.OrgTypeEnum; ...@@ -8,6 +8,7 @@ import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sb.domain.HGSB001; import com.baosight.hggp.hg.sb.domain.HGSB001;
import com.baosight.hggp.hg.sb.tools.HGSBTools; import com.baosight.hggp.hg.sb.tools.HGSBTools;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sj.domain.HGSJ002; import com.baosight.hggp.hg.sj.domain.HGSJ002;
import com.baosight.hggp.hg.sj.domain.HGSJ002A; import com.baosight.hggp.hg.sj.domain.HGSJ002A;
import com.baosight.hggp.hg.sj.domain.HGSJ003; import com.baosight.hggp.hg.sj.domain.HGSJ003;
...@@ -28,6 +29,7 @@ import com.baosight.iplat4j.core.util.DateUtils; ...@@ -28,6 +29,7 @@ import com.baosight.iplat4j.core.util.DateUtils;
import com.baosight.iplat4j.core.web.threadlocal.UserSession; import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.util.*; import java.util.*;
...@@ -193,16 +195,35 @@ public class ServiceHGSJ003 extends ServiceEPBase { ...@@ -193,16 +195,35 @@ public class ServiceHGSJ003 extends ServiceEPBase {
} }
@OperationLogAnnotation(operModul = "工艺单价",operType = "导入",operDesc = "导入操作") @OperationLogAnnotation(operModul = "工艺单价",operType = "导入",operDesc = "导入操作")
public EiInfo importDate(EiInfo inInfo) { public EiInfo importData(EiInfo inInfo) {
try { try {
Map<String, Object> params = new HashMap<>(10); List<HGSJ003> dataList = (List) inInfo.get("dataList");
String fileName = inInfo.getString("fileName"); Map mapSmall = HGSJTools.Hgsj003.getSmallCode("hggp.hgsj.processClass");
for (HGSJ003 hgsj003 : dataList) {
String processClass = MapUtils.getString(mapSmall, StringUtils.trimToEmpty(hgsj003.getProcessClassName()));
AssertUtils.isEmpty(processClass, String.format("工序分类[%s]代码不存在,添加失败!", hgsj003.getProcessClassName()));
// 设置规格
if (StringUtils.isBlank(hgsj003.getSpec())) {
hgsj003.setSpec(HGSJTools.Hgsj003.jointSpec(hgsj003.getLength(), hgsj003.getWidth(), hgsj003.getThick()));
}
// 去除空格
hgsj003.setSpec(StringUtils.trimToEmpty(hgsj003.getSpec()));
hgsj003.setProcessClass(Integer.valueOf(processClass));
hgsj003.setStatus(1);
//校验
checkAddData(hgsj003);
DaoUtils.insert(HGSJ003.INSERT, hgsj003.toMap());
}
//Map<String, Object> params = new HashMap<>(10);
//String fileName = inInfo.getString("fileName");
// Map<String,Object> map = HGSJTools.Hgsj003.getCompany(UserSession.getLoginName(),OrgTypeEnum.COMPANY.getCode()); // Map<String,Object> map = HGSJTools.Hgsj003.getCompany(UserSession.getLoginName(),OrgTypeEnum.COMPANY.getCode());
params.put(HGSJ003.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode()); //params.put(HGSJ003.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
//params.put(HGSJ003.FIELD_FACTORY_CODE, map.get("orgEname")); //params.put(HGSJ003.FIELD_FACTORY_CODE, map.get("orgEname"));
//params.put(HGSJ003.FIELD_FACTORY_NAME, map.get("orgCname")); //params.put(HGSJ003.FIELD_FACTORY_NAME, map.get("orgCname"));
//解析文件,将文件中数据传入到inInfo中 //解析文件,将文件中数据传入到inInfo中
ExcelUtils.importFromExcel(inInfo, fileName, params, new HGSJ003()); //ExcelUtils.importFromExcel(inInfo, fileName, params, new HGSJ003());
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("导入成功" + dataList.size() + "条");
}catch (Exception e){ }catch (Exception e){
inInfo.setStatus(EiConstant.STATUS_FAILURE); inInfo.setStatus(EiConstant.STATUS_FAILURE);
LogUtils.setDetailMsg(inInfo, e, "导入失败"); LogUtils.setDetailMsg(inInfo, e, "导入失败");
......
...@@ -18,12 +18,7 @@ import java.io.InputStream; ...@@ -18,12 +18,7 @@ import java.io.InputStream;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Comparator;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -132,7 +127,7 @@ public class DocExcelUtils { ...@@ -132,7 +127,7 @@ public class DocExcelUtils {
} else if (f.getType() == BigDecimal.class) { } else if (f.getType() == BigDecimal.class) {
f.set(obj, new BigDecimal(cellValue)); f.set(obj, new BigDecimal(cellValue));
} else { } else {
f.set(obj, cellValue); f.set(obj, cellValue.trim().toUpperCase(Locale.ROOT));
} }
} catch (Exception e) { } catch (Exception e) {
String msg = String.format("读取数据值失败,名称[%s],数值[%s],%s", f.getName(), cellValue, e.getMessage()); String msg = String.format("读取数据值失败,名称[%s],数值[%s],%s", f.getName(), cellValue, e.getMessage());
......
...@@ -243,7 +243,7 @@ public class ExcelUtils { ...@@ -243,7 +243,7 @@ public class ExcelUtils {
inInfo.setMsg("导入成功" + arrayList.size() + "条"); inInfo.setMsg("导入成功" + arrayList.size() + "条");
break; break;
case "HGPZ005": case "HGPZ005":
HGPZTools.HgPz005.add(arrayList); //HGPZTools.HgPz005.add(arrayList);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("导入成功" + arrayList.size() + "条"); inInfo.setMsg("导入成功" + arrayList.size() + "条");
break; break;
......
...@@ -407,21 +407,34 @@ $(function() { ...@@ -407,21 +407,34 @@ $(function() {
} }
}) })
/*$("#IMPORT").on("click", function (e) { $("#IMPORT").on("click", function (e) {
let status = $("#inqu_status-0-status").val(); JSColorbox.open({
if (status == 2){ href: "HGSC097?methodName=initLoad&inqu_status-0-id=route_004",
IPLAT.alert({ title: "<div style='text-align: center;'>导入</div>",
message: '<b>物料清单全部提交,无法导入!</b>', width: "60%",
okFn: function (e) { height: "50%",
}, callbackName: function (ei) {
title: '提示' let rows = ei.blocks.detail1.rows;
detail1Grid.addRows(rows);
var totalPriceExcluding = 0;
var totalPriceIncluding = 0;
var valueAddedTax = 0;
rows.forEach(function (row, index) {
totalPriceExcluding += parseFloat(row.totalPriceExcluding);
totalPriceIncluding += parseFloat(row.totalPriceIncluding);
}); });
return false; valueAddedTax = parseFloat(totalPriceIncluding) - parseFloat(totalPriceExcluding);
$("#result-0-totalContractPriceExcluding").val(totalPriceExcluding.toFixed(3))
$("#result-0-totalContractPriceIncluding").val(totalPriceIncluding.toFixed(3))
$("#result-0-remainingAmount").val(totalPriceIncluding.toFixed(3))
$("#result-0-valueAddedTax").val(valueAddedTax.toFixed(3))
// 关闭弹窗
JSColorbox.close();
} }
openFileWindow.open(); })
});*/ });
grush.openImportBox(); //grush.openImportBox();
IPLATUI.EFUpload = { IPLATUI.EFUpload = {
fileUpload: { fileUpload: {
showFileList: false, showFileList: false,
......
...@@ -353,7 +353,35 @@ $(function() { ...@@ -353,7 +353,35 @@ $(function() {
} }
}) })
grush.openImportBox(); $("#IMPORT").on("click", function (e) {
JSColorbox.open({
href: "HGSC097?methodName=initLoad&inqu_status-0-id=route_004",
title: "<div style='text-align: center;'>导入</div>",
width: "60%",
height: "50%",
callbackName: function (ei) {
let rows = ei.blocks.detail1.rows;
detail1Grid.addRows(rows);
var totalPriceExcluding = 0;
var totalPriceIncluding = 0;
var valueAddedTax = 0;
var allRows = detail1Grid.getDataItems();
allRows.forEach(function (row, index) {
totalPriceExcluding += parseFloat(row.totalPriceExcluding);
totalPriceIncluding += parseFloat(row.totalPriceIncluding);
});
valueAddedTax = parseFloat(totalPriceIncluding) - parseFloat(totalPriceExcluding);
$("#result-0-totalContractPriceExcluding").val(totalPriceExcluding.toFixed(3))
$("#result-0-totalContractPriceIncluding").val(totalPriceIncluding.toFixed(3))
$("#result-0-remainingAmount").val(totalPriceIncluding.toFixed(3))
$("#result-0-valueAddedTax").val(valueAddedTax.toFixed(3))
// 关闭弹窗
JSColorbox.close();
}
})
});
//grush.openImportBox();
IPLATUI.EFUpload = { IPLATUI.EFUpload = {
fileUpload: { fileUpload: {
showFileList: false, showFileList: false,
......
...@@ -119,8 +119,21 @@ $(function() { ...@@ -119,8 +119,21 @@ $(function() {
var href = ${ctx} + "\\common\\template\\PZ\\HGPZ005_存货档案.xls"; var href = ${ctx} + "\\common\\template\\PZ\\HGPZ005_存货档案.xls";
window.location.href = href; window.location.href = href;
});*/ });*/
$("#IMPORT").on("click", function (e) {
grush.openImportBox(); JSColorbox.open({
href: "HGSC097?methodName=initLoad&inqu_status-0-id=route_003",
title: "<div style='text-align: center;'>导入</div>",
width: "60%",
height: "50%",
callbackName: function () {
// 刷新列表
resultGrid.dataSource.page(1);
// 关闭弹窗
JSColorbox.close();
}
})
});
//grush.openImportBox();
IPLATUI.EFUpload = { IPLATUI.EFUpload = {
fileUpload: { fileUpload: {
showFileList: false, showFileList: false,
......
...@@ -40,7 +40,9 @@ let upload = function () { ...@@ -40,7 +40,9 @@ let upload = function () {
}else { }else {
formData.append("id", id); formData.append("id", id);
} }
let fileName = $("#inqu_status-0-file")[0].files[0].name;
formData.append("file", $("#inqu_status-0-file")[0].files[0]); formData.append("file", $("#inqu_status-0-file")[0].files[0]);
formData.append("fileName", fileName);
$.ajax({ $.ajax({
url: IPLATUI.CONTEXT_PATH + '/doc/import/api', url: IPLATUI.CONTEXT_PATH + '/doc/import/api',
type: 'POST', type: 'POST',
...@@ -53,7 +55,7 @@ let upload = function () { ...@@ -53,7 +55,7 @@ let upload = function () {
success: function (res) { success: function (res) {
_IPLAT.progress($("body"), false); _IPLAT.progress($("body"), false);
if(res.status===0){ if(res.status===0){
parent.JSColorbox.setValueCallback(); parent.JSColorbox.setValueCallback(res);
}else{ }else{
NotificationUtil(res.msg, "error"); NotificationUtil(res.msg, "error");
} }
......
...@@ -200,7 +200,21 @@ $(function (){ ...@@ -200,7 +200,21 @@ $(function (){
IPLAT.Util.exportGrid(info); IPLAT.Util.exportGrid(info);
}); });
grush.openImportBox(); $("#IMPORT").on("click", function (e) {
JSColorbox.open({
href: "HGSC097?methodName=initLoad&inqu_status-0-id=route_005",
title: "<div style='text-align: center;'>导入</div>",
width: "60%",
height: "50%",
callbackName: function () {
// 刷新列表
resultGrid.dataSource.page(1);
// 关闭弹窗
JSColorbox.close();
}
})
});
//grush.openImportBox();
IPLATUI.EFUpload = { IPLATUI.EFUpload = {
fileUpload: { fileUpload: {
showFileList: false, showFileList: false,
......
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