Commit 5bd34e3c by liuyang
parents 2a6f1560 e0275d7a
package com.baosight.hggp.common; package com.baosight.hggp.common;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
/** /**
* @author:songx * @author:songx
* @date:2022/9/23,14:51 * @date:2022/9/23,14:51
*/ */
public enum DocRouteEnum { public enum DocRouteEnum {
// HPSC002("route_001", "HPSC002", "importData", HPSC002.class), HGSC004A("route_001", "HGSC004A", "importData", HGSC004A.class),
// HPSC006("route_002", "HPSC006", "importData", HPSC006.class), // HPSC006("route_002", "HPSC006", "importData", HPSC006.class),
; ;
private String id; private String id;
......
package com.baosight.hggp.hg.sc.domain; package com.baosight.hggp.hg.sc.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;
...@@ -118,24 +119,35 @@ public class HGSC004A extends DaoEPBase { ...@@ -118,24 +119,35 @@ public class HGSC004A extends DaoEPBase {
private String depName = " "; /* 部门名称(预留)*/ private String depName = " "; /* 部门名称(预留)*/
private String projCode = " "; /* 项目编码(预留)*/ private String projCode = " "; /* 项目编码(预留)*/
private String projName = " "; /* 项目名称(预留)*/ private String projName = " "; /* 项目名称(预留)*/
@ExcelAnno(index = 7)
private String parentProdCode = " "; /* 父节点-产品编码*/ private String parentProdCode = " "; /* 父节点-产品编码*/
@ExcelAnno(index = 8)
private String parentProdName = " "; /* 父节点-产品名称*/ private String parentProdName = " "; /* 父节点-产品名称*/
private Integer leaf = new Integer(1); /* 是否有叶子节点*/ private Integer leaf = new Integer(1); /* 是否有叶子节点*/
private Integer sort = new Integer(1); /* 排序字段*/ private Integer sort = new Integer(1); /* 排序字段*/
private Integer lv = new Integer(0);; /* 树的层级*/ private Integer lv = new Integer(0);; /* 树的层级*/
private Long materialId = new Long(0); /* 物料清单id*/ private Long materialId = new Long(0); /* 物料清单id*/
private Long productId = new Long(0); /* 产品id*/ private Long productId = new Long(0); /* 产品id*/
@ExcelAnno(index = 0)
private String productCode = " "; /* 产品编号*/ private String productCode = " "; /* 产品编号*/
@ExcelAnno(index = 1)
private String productName = " "; /* 产品名称*/ private String productName = " "; /* 产品名称*/
private String productType = " "; /* 产品类型*/ private String productType = " "; /* 产品类型*/
@ExcelAnno(index = 9)
private String inventType = " "; /* 档案类型*/ private String inventType = " "; /* 档案类型*/
@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 = 12)
private BigDecimal width = new BigDecimal("0"); /* 宽*/ private BigDecimal width = new BigDecimal("0"); /* 宽*/
@ExcelAnno(index = 13)
private BigDecimal thick = new BigDecimal("0"); /* 厚*/ private BigDecimal thick = new BigDecimal("0"); /* 厚*/
private Integer productStatus = new Integer(0); /* 产品状态 0:未提交,1:已提交*/ private Integer productStatus = new Integer(0); /* 产品状态 0:未提交,1:已提交*/
private Integer changeType = new Integer(0); /* 变更类型:默认0,1:增加,2:替换,3:删除*/ private Integer changeType = new Integer(0); /* 变更类型:默认0,1:增加,2:替换,3:删除*/
@ExcelAnno(index = 5)
private BigDecimal quantity = new BigDecimal(0); /* 数量*/ private BigDecimal quantity = new BigDecimal(0); /* 数量*/
@ExcelAnno(index = 6)
private BigDecimal singleWeight = new BigDecimal(0.000); /* 单重*/ private BigDecimal singleWeight = new BigDecimal(0.000); /* 单重*/
private BigDecimal totalWeight = new BigDecimal(0.000); /* 总重*/ private BigDecimal totalWeight = new BigDecimal(0.000); /* 总重*/
private Integer approvalStatus = new Integer(0); /* 审批状态\t0:待审;1:审核中;2:已审*/ private Integer approvalStatus = new Integer(0); /* 审批状态\t0:待审;1:审核中;2:已审*/
...@@ -146,9 +158,11 @@ public class HGSC004A extends DaoEPBase { ...@@ -146,9 +158,11 @@ public class HGSC004A extends DaoEPBase {
private String updatedBy = " "; /* 更新人*/ private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 修改人名称*/ private String updatedName = " "; /* 修改人名称*/
private String updatedTime = " "; /* 更新时间*/ private String updatedTime = " "; /* 更新时间*/
@ExcelAnno(index = 4)
private String material = " "; /* 材质*/ private String material = " "; /* 材质*/
@ExcelAnno(index = 11)
private BigDecimal coefficient = new BigDecimal("0"); /* 系数*/ private BigDecimal coefficient = new BigDecimal("0"); /* 系数*/
@ExcelAnno(index = 10)
private String unit = " "; /* 单位*/ private String unit = " "; /* 单位*/
private Long techFlowId = new Long(0); /* 工艺流程id*/ private Long techFlowId = new Long(0); /* 工艺流程id*/
......
...@@ -552,26 +552,44 @@ public class ServiceHGSC004A extends ServiceBase { ...@@ -552,26 +552,44 @@ public class ServiceHGSC004A 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);
String fileName = inInfo.getString(ACConstants.FILE_NAME); List<HGSC004A> dataList = (List) inInfo.get("dataList");
String projCode = inInfo.getString(HGSC004A.FIELD_proj_code); HashMap params = (HashMap) inInfo.get("params");
String projName = inInfo.getString(HGSC004A.FIELD_proj_name); String parentId = (String) params.get("parentProdCode");
String projCode = (String) params.get("projCode");
String projName = (String) params.get("projName");
String materialId = (String) params.get("materialId");
String parentPrdtName = (String) params.get("parentPrdtName");
dataList.forEach(o->{
o.setProjCode(projCode);
o.setProjName(projName);
o.setMaterialId(Long.valueOf(materialId));
});
//int lv = Integer.parseInt((String) params.get("lv")) +1;
HGSCTools.THGSC004A.add(dataList, params.get("materialId").toString());
//Map<String, Object> params = new HashMap<>(10);
//String fileName = inInfo.getString(ACConstants.FILE_NAME);
//String projCode = inInfo.getString(HGSC004A.FIELD_proj_code);
//String projName = inInfo.getString(HGSC004A.FIELD_proj_name);
//String parentProdCode = inInfo.getString(HGSC004A.FIELD_parent_prod_code); //String parentProdCode = inInfo.getString(HGSC004A.FIELD_parent_prod_code);
//String parentProdName = inInfo.getString(HGSC004A.FIELD_parent_prod_name); //String parentProdName = inInfo.getString(HGSC004A.FIELD_parent_prod_name);
//String lv = inInfo.getString(HGSC004A.FIELD_lv); //String lv = inInfo.getString(HGSC004A.FIELD_lv);
String materialId = inInfo.getString(HGSC004A.FIELD_material_id); //String materialId = inInfo.getString(HGSC004A.FIELD_material_id);
params.put(HGSC004A.FIELD_account_code, UserSessionUtils.getAccountCode()); //params.put(HGSC004A.FIELD_account_code, UserSessionUtils.getAccountCode());
params.put(HGSC004A.FIELD_proj_code, projCode); //params.put(HGSC004A.FIELD_proj_code, projCode);
params.put(HGSC004A.FIELD_proj_name, projName); //params.put(HGSC004A.FIELD_proj_name, projName);
//params.put(HGSC004A.FIELD_parent_prod_code, parentProdCode); //params.put(HGSC004A.FIELD_parent_prod_code, parentProdCode);
//params.put(HGSC004A.FIELD_parent_prod_name, parentProdName); //params.put(HGSC004A.FIELD_parent_prod_name, parentProdName);
//params.put(HGSC004A.FIELD_lv, lv); //params.put(HGSC004A.FIELD_lv, lv);
params.put(HGSC004A.FIELD_material_id, materialId); //params.put(HGSC004A.FIELD_material_id, materialId);
//解析文件,将文件中数据传入到inInfo中 //解析文件,将文件中数据传入到inInfo中
ExcelUtils.importFromExcel(inInfo, fileName, params, new HGSC004A()); //ExcelUtils.importFromExcel(inInfo, fileName, params, new HGSC004A());
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, "导入失败");
......
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
/**
* @author LiuYang
* @version 1.0 2024/8/6
* @description 导入
*/
public class ServiceHGSC097 extends ServiceBase {
/**
* 画面初始化.
*/
@OperationLogAnnotation(operModul = "附件上传",operType = "查询",operDesc = "初始化")
@Override
public EiInfo initLoad(EiInfo inInfo) {
return inInfo;
}
/**
* 附件上传.
*/
@OperationLogAnnotation(operModul = "附件上传",operType = "上传",operDesc = "附件上传")
public EiInfo form(EiInfo inInfo) {
return inInfo;
}
}
...@@ -318,14 +318,14 @@ public class HGSCTools { ...@@ -318,14 +318,14 @@ public class HGSCTools {
return DaoBase.getInstance().query(HGSC004A.QUERY, paramMap); return DaoBase.getInstance().query(HGSC004A.QUERY, paramMap);
} }
public static void add(List<Map> arrayList, String materialId) { public static void add(List<HGSC004A> arrayList, String materialId) {
List<HGSC004> results = DaoBase.getInstance().query(HGSC004.QUERY, new HashMap<String,Object>(){ List<HGSC004> results = DaoBase.getInstance().query(HGSC004.QUERY, new HashMap<String,Object>(){
{put("id",materialId);} {put("id",materialId);}
}); });
AssertUtils.isEmpty(results, "物料清单不存在!"); AssertUtils.isEmpty(results, "物料清单不存在!");
for (Map resultRow : arrayList){ for (HGSC004A hgsc004a : arrayList){
HGSC004A hgsc004a = new HGSC004A(); //HGSC004A hgsc004a = new HGSC004A();
hgsc004a.fromMap(resultRow); //hgsc004a.fromMap(resultRow);
hgsc004a.setCompanyCode(results.get(0).getCompanyCode()); hgsc004a.setCompanyCode(results.get(0).getCompanyCode());
hgsc004a.setCompanyName(results.get(0).getCompanyName()); hgsc004a.setCompanyName(results.get(0).getCompanyName());
hgsc004a.setDepCode(results.get(0).getDepCode()); hgsc004a.setDepCode(results.get(0).getDepCode());
...@@ -436,7 +436,7 @@ public class HGSCTools { ...@@ -436,7 +436,7 @@ public class HGSCTools {
AssertUtils.isTrue(!org.springframework.util.CollectionUtils.isEmpty(hgsc004AList), "已存在构建"+hgsc004a.getProductCode()+"-"+hgsc004a.getProductName()); AssertUtils.isTrue(!org.springframework.util.CollectionUtils.isEmpty(hgsc004AList), "已存在构建"+hgsc004a.getProductCode()+"-"+hgsc004a.getProductName());
} }
AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!"); AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!"); //AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(hgsc004a.getCompanyCode(), "请选择公司!"); AssertUtils.isEmpty(hgsc004a.getCompanyCode(), "请选择公司!");
AssertUtils.isEmpty(hgsc004a.getProjCode(), "请填写项目编号!"); AssertUtils.isEmpty(hgsc004a.getProjCode(), "请填写项目编号!");
AssertUtils.isEmpty(hgsc004a.getProjName(), "请填写项目名称!"); AssertUtils.isEmpty(hgsc004a.getProjName(), "请填写项目名称!");
......
...@@ -253,7 +253,7 @@ public class ExcelUtils { ...@@ -253,7 +253,7 @@ public class ExcelUtils {
inInfo.setMsg("导入成功" + arrayList.size() + "条"); inInfo.setMsg("导入成功" + arrayList.size() + "条");
break; break;
case "HGSC004": case "HGSC004":
HGSCTools.THGSC004A.add(arrayList, params.get("materialId").toString()); //HGSCTools.THGSC004A.add(arrayList, params.get("materialId").toString());
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("导入成功" + arrayList.size() + "条"); inInfo.setMsg("导入成功" + arrayList.size() + "条");
break; break;
......
...@@ -462,7 +462,26 @@ $(function () { ...@@ -462,7 +462,26 @@ $(function () {
}); });
return false; return false;
} }
openFileWindow.open(); let selectTreeNode = IPLATUI.EFTree.materialTree.selectTreeNode;
let materialId = $("#inqu_status-0-materialId").val()
JSColorbox.open({
href: "HGSC097?methodName=initLoad&inqu_status-0-id=route_001&inqu_status-0-parentProdCode="
+ selectTreeNode.nodeId + "&inqu_status-0-projCode=" + selectTreeNode.projCode + "&inqu_status-0-projName="
+ selectTreeNode.projName + "&inqu_status-0-parentProdName=" + selectTreeNode.pName
+ "&inqu_status-0-materialId=" + materialId
+ "&inqu_status-0-lv=" + selectTreeNode.lv,
title: "<div style='text-align: center;'>导入</div>",
width: "60%",
height: "50%",
callbackName: function () {
// 刷新列表
resultGrid.dataSource.page(1);
// 刷新树
refreshTree();
// 关闭弹窗
JSColorbox.close();
}
});
}); });
//grush.openImportBox(); //grush.openImportBox();
......
$(function () {
// 提交
$("#btn_upload").on("click", upload);
$("#cancel").on("click", cancel);
});
let cancel = function(){
parent.JSColorbox.close();
}
/**
* 上传文件
*/
let upload = function () {
let file = $("#inqu_status-0-file").val();
if(isBlank(file)){
message("请选择文件");
return;
}
let id = $("#inqu_status-0-id").val();
let parentId = $("#inqu_status-0-parentProdCode").val();
let projCode = $("#inqu_status-0-projCode").val();
let projName = $("#inqu_status-0-projName").val();
let parentPrdtName = $("#inqu_status-0-parentPrdtName").val();
let productionOrderNo = $("#inqu_status-0-productionOrderNo").val();
let materialId = $("#inqu_status-0-materialId").val();
let lv = $("#inqu_status-0-lv").val();
let _IPLAT = IPLAT;
_IPLAT.progress($("body"), true);
let formData = new FormData();
if(id === 'route_001'){
formData.append("id", id);
formData.append("startRow", "1"); // 第几行开始读取
formData.append("projCode", projCode);
formData.append("projName", projName);
formData.append("parentProdCode", parentId);
formData.append("parentProdName", parentPrdtName);
formData.append("materialId", materialId);
formData.append("lv", lv);
}
if(id === 'route_002'){
formData.append("id", id);
formData.append("startRow", "1"); // 第几行开始读取
formData.append("productionOrderNo", productionOrderNo);
formData.append("projCode", projCode);
formData.append("projName", projName);
formData.append("deliveryDate", deliveryDate);
}
formData.append("file", $("#inqu_status-0-file")[0].files[0]);
$.ajax({
url: IPLATUI.CONTEXT_PATH + '/doc/import/api',
type: 'POST',
// dataType: 'json',
data: formData,
async: true,
cache: false,
contentType: false,
processData: false,
success: function (res) {
_IPLAT.progress($("body"), false);
if(res.status===0){
parent.JSColorbox.setValueCallback();
}else{
NotificationUtil(res.msg, "error");
}
},
error: function (res) {
message(res.msg);
_IPLAT.progress($("body"), false);
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="导入">
<EF:EFRegion id="upload" title="文件导入区">
<EF:EFInput ename="inqu_status-0-id" cname="服务Id" type="hidden"/>
<EF:EFInput ename="inqu_status-0-parentProdCode" cname="父Id" type="hidden"/>
<EF:EFInput ename="inqu_status-0-projCode" cname="项目代码" type="hidden"/>
<EF:EFInput ename="inqu_status-0-projName" cname="项目名称" type="hidden"/>
<EF:EFInput ename="inqu_status-0-parentProdName" cname="项目部件名称" type="hidden"/>
<EF:EFInput ename="inqu_status-0-productionOrderNo" cname="生产订单号" type="hidden"/>
<EF:EFInput ename="inqu_status-0-materialId" cname="上级ID" type="hidden"/>
<EF:EFInput ename="inqu_status-0-lv" cname="级别" type="hidden"/>
<EF:EFInput cname="上传文件" blockId="inqu_status" ename="file" row="0" type="file" />
<%--<button id="btn_upload" type="submit">提交</button>--%>
<%-- <EF:EFButton cname="提交" ename="btn_upload"></EF:EFButton>--%>
<div class="row">
<EF:EFButton ename="cancel" cname="取消" type="button" class="btn-align-right"/>
<EF:EFButton ename="btn_upload" cname="确认" type="button" class="btn-align-right"/>
</div>
</EF:EFRegion>
</EF:EFPage>
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