Commit 7327ca42 by wancheng

生产下料导入修改

parent 17f6152d
......@@ -2,15 +2,16 @@ package com.baosight.hpjx.common;
import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.hp.sc.domain.HPSC006;
/**
* @author:songx
* @date:2022/9/23,14:51
*/
public enum DocRouteEnum {
HT("route_001", "HPSC002", "importData", HPSC002.class);
HPSC002("route_001", "HPSC002", "importData", HPSC002.class),
HPSC006("route_002", "HPSC006", "importData",HPSC006 .class);
private String id;
private String serviceNme;
private String methodName;
......
package com.baosight.hpjx.hp.sc.domain;
import com.baosight.hpjx.common.ExcelAnno;
import com.baosight.iplat4j.core.util.NumberUtils;
import java.math.BigDecimal;
import com.baosight.iplat4j.core.ei.EiColumn;
......@@ -117,13 +118,20 @@ public class HPSC006 extends DaoEPBase {
private String productionOrderNo = " "; /* 生产订单号*/
private Integer inventType; /* 材料类型*/
private String inventCode = " "; /* 材料编码*/
@ExcelAnno(index = 0)
private String inventName = " "; /* 材料名称*/
@ExcelAnno(index = 1)
private BigDecimal inventLength = new BigDecimal("0"); /* 材料-长*/
@ExcelAnno(index = 2)
private BigDecimal inventWidth = new BigDecimal("0"); /* 材料-宽*/
@ExcelAnno(index = 3)
private BigDecimal inventThick = new BigDecimal("0"); /* 材料-厚*/
private String inventSpec = " "; /* 材料规格*/
@ExcelAnno(index = 8)
private String planCompletionDate = " "; /* 计划完成日期*/
@ExcelAnno(index = 6)
private BigDecimal num = new BigDecimal(0.000); /* 计划数量*/
@ExcelAnno(index = 7)
private BigDecimal unitWt = new BigDecimal("0"); /* 计划单重*/
private BigDecimal totalWt = new BigDecimal(0.000); /* 计划重量*/
private String actualCompletionDate = " "; /* 实际完工日期*/
......@@ -139,9 +147,11 @@ public class HPSC006 extends DaoEPBase {
private String updatedBy = " "; /* 更新人*/
private String updatedTime = " "; /* 更新时间*/
private String depCode = " "; /* 部门编码*/
@ExcelAnno(index = 5)
private String remark = " "; /* 备注*/
private String filePath1 = " "; /* 文件地址1*/
private Integer inventRecordId = new Integer(0); /* 存货档案ID*/
@ExcelAnno(index = 4)
private String material = " "; /* 材质*/
private String prdtName = " "; /* 产品名称*/
private String partName = " "; /* 零件名称*/
......
......@@ -381,6 +381,41 @@ public class ServiceHPSC006 extends ServiceBase {
return outInfo;
}
@OperationLogAnnotation(operModul = "物料清单",operType = "导入",operDesc = "导入")
public EiInfo importData(EiInfo inInfo) {
try {
List<HPSC006> dataList = (List) inInfo.get("dataList");
HashMap params = (HashMap) inInfo.get("params");
String productionOrderNo = (String) params.get("productionOrderNo");
String projCode = (String) params.get("projCode");
String projName = (String) params.get("projName");
// 写入数据
for (HPSC006 hpsc006:dataList) {
hpsc006.setInventType(7);
BigDecimal num = hpsc006.getNum();
BigDecimal unitWt = hpsc006.getUnitWt();
DecimalFormat decimalFormat = new DecimalFormat("#.000");
BigDecimal totalWt = new BigDecimal(decimalFormat.format(num.multiply(unitWt).floatValue()));
hpsc006.setInventSpec(HPPZTools.HpPz006.jointSpec(hpsc006.getInventLength(),hpsc006.getInventWidth(),hpsc006.getInventThick()));
hpsc006.setProjCode(projCode);
hpsc006.setProjName(projName);
hpsc006.setProductionOrderNo(productionOrderNo);
hpsc006.setTotalWt(totalWt);
hpsc006.setInventCode(HPPZTools.checkAndSavePZ04(hpsc006.getInventType(),hpsc006.getInventName()));
// 去除日期字符串中的-
hpsc006.setPlanCompletionDate(StringUtil.removeHorizontalLine(hpsc006.getPlanCompletionDate()));
add(hpsc006);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + dataList.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 删除附件文件
* @param id 文件ID
......
......@@ -390,10 +390,10 @@ $(function () {
var projName = IPLATUI.EFTree.materialTree.selectTreeNode.projName;
var lv = IPLATUI.EFTree.materialTree.selectTreeNode.lv;
JSColorbox.open({
href: "HPSC097?methodName=initLoad&inqu_status-0-parentId=" + parentId+"&inqu_status-0-projCode="+projCode+"&inqu_status-0-projName="+projName+"&inqu_status-0-parentPrdtName="+parentPrdtName,
href: "HPSC097?methodName=initLoad&inqu_status-0-id=route_001&inqu_status-0-parentId=" + parentId+"&inqu_status-0-projCode="+projCode+"&inqu_status-0-projName="+projName+"&inqu_status-0-parentPrdtName="+parentPrdtName,
title: "<div style='text-align: center;'>导入</div>",
width: "70%",
height: "70%",
width: "60%",
height: "50%",
callbackName: function () {
// 刷新列表
resultGrid.dataSource.page(1);
......
......@@ -268,10 +268,34 @@ $(function () {
});
e.preventDefault();
} else {
openFileWindow.open();
//openFileWindow.open();
var productionOrderNo = rows[0].get('prodOrderNo');
var projCode = rows[0].get('projCode');
var projName = rows[0].get('projName');
JSColorbox.open({
href: "HPSC097?methodName=initLoad&inqu_status-0-id=route_002&inqu_status-0-productionOrderNo="+productionOrderNo+"&inqu_status-0-projCode="+projCode+"&inqu_status-0-projName="+projName,
title: "<div style='text-align: center;'>导入</div>",
width: "70%",
height: "70%",
callbackName: function () {
// 刷新列表
//resultGrid.dataSource.page(1);
var info = new EiInfo();
info.set("productionOrderNo",productionOrderNo);
EiCommunicator.send("HPSC006","queryDetail",info,{
onSuccess:function(ei){//返回结果集
detailGrid.setEiInfo(ei);
// 关闭弹窗
JSColorbox.close();
},onFail:function(ei){}
},{async:false});
}
});
}
});
IPLATUI.EFUpload = {
/* IPLATUI.EFUpload = {
fileUpload: {
showFileList: false,
upload: function (e) {
......@@ -322,7 +346,7 @@ $(function () {
IPLAT.NotificationUtil('导入失败!', "error");// 失败提示信息
}
}
}
}*/
$("#DOWNLOAD").on("click", function (e) {
var href = ctx + "\\HP\\template\\SC\\HPSC006_生产下料.xls";
......
$(function () {
/* IPLATUI.EFUpload = {
uploadFile: {
success: function(e) {
let docId = e.response.docId;
if (isBlank(docId)) {
return;
}
$("#fileDocId").val(docId);
NotificationUtil("附件上传成功");
console.log($("#fileDocId").val())
saveTemp(e);
try {
parent.JSColorbox.setValueCallback(docId);
} catch (e){
}
},
}
};*/
// 提交
$("#upload").on("click", upload);
function saveTemp(e) {
let docId = e.response.docId;
let docName = e.response.docName;
let docSize = e.response.docSize;
let docTag = e.response.docTag;
let docUrl = e.response.docUrl;
let result = new EiInfo();
result.set("result-0-docId",docId);
result.set("result-0-docName",docName);
result.set("result-0-docSize",docSize);
result.set("result-0-docTag",docTag);
result.set("result-0-realPath",docUrl);
result.set("result-0-bizType",$("#inqu_status-0-bizType").val());
result.set("result-0-matId",$("#inqu_status-0-matId").val());
EiCommunicator.send("HPDS002", "insert", result, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
}
});
/**
* 上传文件
......@@ -65,25 +11,30 @@ let upload = function () {
message("请选择文件");
return;
}
/* let orderTypeCode = $("#inqu_status-0-orderTypeCode").val();
if(isBlank(orderTypeCode)){
message("请选择类别");
return;
}*/
let id = $("#inqu_status-0-id").val();
let parentId = $("#inqu_status-0-parentId").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 _IPLAT = IPLAT;
_IPLAT.progress($("body"), true);
let formData = new FormData();
formData.append("id", "route_001");
formData.append("startRow", "1"); // 第几行开始读取
formData.append("parentId", parentId);
formData.append("projCode", projCode);
formData.append("projName", projName);
formData.append("parentPrdtName", parentPrdtName);
/* formData.append("orderTypeCode", orderTypeCode);*/
if(id === 'route_001'){
formData.append("id", id);
formData.append("startRow", "1"); // 第几行开始读取
formData.append("parentId", parentId);
formData.append("projCode", projCode);
formData.append("projName", projName);
formData.append("parentPrdtName", parentPrdtName);
}
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("file", $("#inqu_status-0-file")[0].files[0]);
$.ajax({
url: IPLATUI.CONTEXT_PATH + '/doc/import/api',
......
......@@ -5,12 +5,16 @@
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="附件上传">
<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-parentId" 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-parentPrdtName" cname="项目部件名称" type="hidden"/>
<EF:EFInput cname="上传文件" blockId="inqu_status" ename="file" row="0" type="file" colWidth="4"/>
<EF:EFInput ename="inqu_status-0-productionOrderNo" cname="生产订单号" type="hidden"/>
<EF:EFInput cname="上传文件" blockId="inqu_status" ename="file" row="0" type="file" />
<button id="upload" type="submit">提交</button>
</EF:EFRegion>
</EF:EFPage>
<script src="${ctx}/HP/SC/HPSC097.js"></script>
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