Commit 91cdba6f by liuyang

2024-09-29 委托加工

parent 7363e2b3
......@@ -143,6 +143,9 @@ public class HGConstant {
// 维修单号
public static final String REP_ORDER_NO = "REP_ORDER_NO";
// 委托单号
public static final String CONTRACT_CODE = "CONTRACT_CODE";
}
......
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sc.domain.HGSC010;
import com.baosight.hggp.hg.sc.domain.HGSC010A;
import com.baosight.hggp.hg.sc.domain.HGSC010B;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.lang.StringUtils;
import java.util.*;
/**
* @author LiuYang
* @version 1.0 2024/9/29
* @description 委托加工
*/
public class ServiceHGSC010 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID, DdynamicEnum.USER_BLOCK_ID));
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC010().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "委托加工", operType = "查询", operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String contractDate = MapUtils.getString(queryMap, HGSC010.FIELD_CONTRACT_DATE);
if (StringUtils.isNotBlank(contractDate)) {
queryMap.put(HGSC010.FIELD_CONTRACT_DATE, StringUtil.removeHorizontalLine(contractDate));
}
inInfo = super.query(inInfo, HGSC010.QUERY, new HGSC010());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "委托加工", operType = "删除", operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HGSC010 hgsc010 = new HGSC010();
hgsc010.fromMap(map);
DaoUtils.update(HGSC010.DELETE_FLAG, hgsc010.toMap());
Map<String,Object> params = new HashMap<>();
params.put(HGSC010A.FIELD_PARENT_ID, hgsc010.getId());
DaoUtils.update(HGSC010A.DELETE, params);
DaoUtils.update(HGSC010B.DELETE, params);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "委托加工", operType = "保存", operDesc = "保存操作")
public EiInfo save(EiInfo inInfo){
try {
List<Map> resultMaps = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultMap: resultMaps) {
HGSC010 hgsc010 = new HGSC010();
hgsc010.fromMap(resultMap);
if(Objects.nonNull(hgsc010.getId())&&hgsc010.getId()!=0){
this.modify(hgsc010);
}else {
this.add(hgsc010);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
public void add(HGSC010 hgsc010) {
hgsc010.setContractCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CONTRACT_CODE));
DaoUtils.insert(HGSC010.INSERT, hgsc010);
}
public void modify(HGSC010 hgsc010) {
DaoUtils.update(HGSC010.UPDATE, hgsc010);
}
@OperationLogAnnotation(operModul = "委托加工", operType = "提交", operDesc = "提交操作")
public EiInfo updateStatus(EiInfo inInfo) {
int i = 0;
try {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HGSC010 hgsc010 = new HGSC010();
hgsc010.fromMap(map);
hgsc010.setSubStatus(CommonConstant.YesNo.YES_1);
DaoUtils.update("HGSC010.updateBySubStatus", hgsc010.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "提交")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "提交失败");
}
return inInfo;
}
}
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.InventTypeDetailEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ004;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.sc.domain.HGSC010;
import com.baosight.hggp.hg.sc.domain.HGSC010A;
import com.baosight.hggp.hg.sc.domain.HGSC010B;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.lang.StringUtils;
import java.util.*;
/**
* @author LiuYang
* @version 1.0 2024/9/29
* @description 委托加工成本
*/
public class ServiceHGSC010A extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo,
Arrays.asList(
DdynamicEnum.SUP_RECORD_BLOCK_ID,
DdynamicEnum.INVENT_TYPE_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, Arrays.asList(InventTypeDetailEnum.COMPONENT.getCode(),InventTypeDetailEnum.RAW.getCode()));
}}, false);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC010A().eiMetadata);
inInfo.addBlock(CommonConstant.Field.DETAIL).addBlockMeta(new HGSC010B().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "委托加工", operType = "查询", operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HGSC010A.QUERY, new HGSC010A());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "委托加工", operType = "删除", operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HGSC010A hgsc010a = new HGSC010A();
hgsc010a.fromMap(map);
DaoUtils.update(HGSC010A.DELETE, hgsc010a);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "委托加工", operType = "保存", operDesc = "保存操作")
public EiInfo save(EiInfo inInfo){
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
HGSC010 hgsc010 = HGSCTools.Hgsc010.getById(Long.parseLong(queryMap.get("parentId").toString()));
AssertUtils.isTrue(hgsc010.getSubStatus().equals(CommonConstant.YesNo.YES_1), "当前委托任务已提交,不允许修改保存!");
List<Map> resultMaps = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultMap: resultMaps) {
HGSC010A hgsc010a = new HGSC010A();
hgsc010a.fromMap(resultMap);
if(Objects.nonNull(hgsc010a.getId())&&hgsc010a.getId()!=0){
this.modifyHgsc010a(hgsc010a);
}else {
hgsc010a.setCompanyCode(queryMap.get("companyCode").toString());
hgsc010a.setCompanyName(queryMap.get("companyName").toString());
hgsc010a.setParentId(Long.parseLong(queryMap.get("parentId").toString()));
hgsc010a.setContractCode(queryMap.get("contractCode").toString());
this.addHgsc010a(hgsc010a);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
public void addHgsc010a(HGSC010A hgsc010a) {
DaoUtils.insert(HGSC010A.INSERT, hgsc010a);
}
public void modifyHgsc010a(HGSC010A hgsc010a) {
DaoUtils.update(HGSC010A.UPDATE, hgsc010a);
}
public void addHgsc010b(HGSC010B hgsc010b) {
DaoUtils.insert(HGSC010A.INSERT, hgsc010b);
}
public void modifyHgsc010b(HGSC010B hgsc010a) {
DaoUtils.update(HGSC010A.UPDATE, hgsc010a);
}
}
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.InventTypeDetailEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ004;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.sc.domain.HGSC010;
import com.baosight.hggp.hg.sc.domain.HGSC010A;
import com.baosight.hggp.hg.sc.domain.HGSC010B;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/9/29
* @description 委托加工原料
*/
public class ServiceHGSC010B extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo,
Arrays.asList(
DdynamicEnum.SUP_RECORD_BLOCK_ID,
DdynamicEnum.INVENT_TYPE_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, Arrays.asList(InventTypeDetailEnum.COMPONENT.getCode(),InventTypeDetailEnum.RAW.getCode()));
}}, false);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC010B().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "委托加工", operType = "查询", operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HGSC010B.QUERY, new HGSC010B(),false,new HGSC010B().eiMetadata,EiConstant.queryBlock, CommonConstant.Field.DETAIL,CommonConstant.Field.DETAIL);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "市场调研-需求调研",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
EiBlock eiBlock = inInfo.getBlock(CommonConstant.Field.DETAIL);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HGSC010B hgsc010B = new HGSC010B();
hgsc010B.fromMap(map);
DaoUtils.update(HGSC010B.DELETE, hgsc010B.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "市场调研-需求调研",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
HGSC010 hgsc010 = HGSCTools.Hgsc010.getById(Long.parseLong(queryMap.get("parentId").toString()));
AssertUtils.isTrue(hgsc010.getSubStatus().equals(CommonConstant.YesNo.YES_1), "当前委托任务已提交,不允许修改保存!");
List<Map> resultRows = inInfo.getBlock(CommonConstant.Field.DETAIL).getRows();
// 写入数据
for (Map resultRow : resultRows) {
HGSC010B hgsc010B = new HGSC010B();
hgsc010B.fromMap(resultRow);
if (hgsc010B.getId() == null || hgsc010B.getId() == 0) {
hgsc010B.setCompanyCode(queryMap.get("companyCode").toString());
hgsc010B.setCompanyName(queryMap.get("companyName").toString());
hgsc010B.setParentId(Long.parseLong(queryMap.get("parentId").toString()));
hgsc010B.setContractCode(queryMap.get("contractCode").toString());
this.add(hgsc010B);
} else {
this.modify(hgsc010B);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HGSC010B hgsc010B) {
DaoUtils.insert(HGSC010B.INSERT, hgsc010B);
}
/**
* 修改操作
*/
public void modify(HGSC010B hgsc010B) {
DaoUtils.update(HGSC010B.UPDATE, hgsc010B);
}
}
......@@ -17,22 +17,7 @@ import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.domain.HGPZ005A;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.hg.sc.domain.HGSC003;
import com.baosight.hggp.hg.sc.domain.HGSC004;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sc.domain.HGSC004B;
import com.baosight.hggp.hg.sc.domain.HGSC005;
import com.baosight.hggp.hg.sc.domain.HGSC005A;
import com.baosight.hggp.hg.sc.domain.HGSC006;
import com.baosight.hggp.hg.sc.domain.HGSC006A;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC007B;
import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.domain.HGSC009;
import com.baosight.hggp.hg.sc.domain.HGSC009A;
import com.baosight.hggp.hg.sc.domain.HGSC099;
import com.baosight.hggp.hg.sc.domain.*;
import com.baosight.hggp.hg.sj.domain.HGSJ001;
import com.baosight.hggp.hg.sj.tools.HGSJTools;
import com.baosight.hggp.hg.zl.domain.HGZL002;
......@@ -1954,4 +1939,14 @@ public class HGSCTools {
}
}
public static class Hgsc010 {
public static HGSC010 getById(Long id){
AssertUtils.isTrue(Objects.isNull(id)||id<=0, "委托加工ID不能为空!");
return (HGSC010)DaoBase.getInstance().get(HGSC010.QUERY, HGSC009.FIELD_ID, id);
}
}
}
$(function () {
var companyCodeBox = __eiInfo.getBlock("roleCompany").getMappedRows();
var supRecordCodeBox = __eiInfo.getBlock("sup_record_block_id").getMappedRows();
$("#QUERY").on("click", function () {
resultGrid.dataSource.page(1);
});
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [
{
field: "operator",
template: function (item) {
let template = '';
if (item.companyCode) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showFunc(\'' + item.companyCode + '\',\'' + item.companyName + '\',\'' + item.id + '\',\'' + item.contractCode + '\')" >详情</a>';
}
return template;
}
}, {
field: "contractDate",
attributes: {
class: "i-input-readonly"
},
defaultValue: function () {
return currShortDate();
}
},
],
beforeEdit: function (e) {
let item = e.model;
if(item.subStatus == '1'){
e.preventDefault();
}
},
loadComplete: function (grid) {
$("#BNT_SUBMIT").on("click", updateStatus);
grid.dataSource.bind("change", function (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']);
break;
}
}
}
if (e.field == "supCode") {
for (let i = 0; i < supRecordCodeBox.length; i++) {
if (supRecordCodeBox[i]['valueField'] === e.items[0]['supCode']) {
resultGrid.setCellValue(e.items[0],"supName",supRecordCodeBox[i]['textField']);
break;
}
}
}
});
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
save(btnNode);
}
}
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 显示附件详情
* @param companyCode 公司编码
* @param companyName 公司名称
* @param parentId 父级ID
* @param contractCode 委托编号
*/
function showFunc(companyCode,companyName,parentId,contractCode) {
JSColorbox.open({
href: "HGSC010A?methodName=initLoad" +
"&inqu_status-0-companyCode=" + companyCode +
"&inqu_status-0-companyName=" + companyName +
"&inqu_status-0-parentId=" + parentId +
"&inqu_status-0-contractCode="+ contractCode,
title: "<div style='text-align: center;'>委托详情</div>",
width: "90%",
height: "80%",
});
}
let save = function (btnNode) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function (index, item) {
let companyName = item.get("companyName");
let contractDate = item.get("contractDate");
let supCode = item.get("supCode");
if (isBlank(companyName)) {
message("选中的第" + (index + 1) + "行\"公司\",不能为空!");
flag = false;
return false;
}
if (isBlank(contractDate)) {
message("选中的第" + (index + 1) + "行\"委托日期\",不能为空!");
flag = false;
return false;
}
if (isBlank(supCode)) {
message("选中的第" + (index + 1) + "行\"供应商名称\",不能为空!");
flag = false;
return false;
}
});
if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGSC010", "save", true);
btnNode.attr("disabled", false);
}
});
}
};
function updateStatus() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function (index, item) {
let subStatus = item.get("subStatus");
if (subStatus == '1') {
message("选中的第" + (index + 1) + "行\"委托任务已提交\",不能重复提交!");
flag = false;
return false;
}
});
if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"提交\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGSC010", "updateStatus", true);
}
});
}
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/29
Time: 15:49
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %><
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<script>
var ctx = "${ctx}";
</script>
<EF:EFPage title="委托加工">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect blockId="inqu_status" row="0" ename="companyCode" cname="公司名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/>
</EF:EFSelect>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="contractDate" cname="委托加工日期" role="date"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="contractCode" cname="委托单号" placeholder="模糊查询" colWidth="3"/>
<EF:EFSelect blockId="inqu_status" row="0" ename="supCode" cname="供应商名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect blockId="inqu_status" row="0" ename="userId" cname="申请人" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect blockId="inqu_status" row="0" ename="subStatus" cname="提交状态" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.hpkc.submitStatus"/>
</EF:EFSelect>
<EF:EFSelect blockId="inqu_status" row="0" ename="depositStatus" cname="入库状态" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.hgsc.depositStatus"/>
</EF:EFSelect>
<EF:EFSelect blockId="inqu_status" row="0" ename="outStatus" cname="出库状态" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.hgsc.outStatus"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="150" align="center"/>
<EF:EFComboColumn ename="companyCode" cname="公司名称"
columnTemplate="#=companyName#" itemTemplate="#=companyName#"
textField="companyName" valueField="companyCode"
maxLength="16" readonly="false" width="200" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/>
</EF:EFComboColumn>
<EF:EFColumn ename="companyName" cname="公司名称" hidden="true"/>
<EF:EFColumn ename="contractDate" cname="委托日期" width="120" enable="true" readonly="false" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="contractCode" cname="委托单号" width="120" enable="false" readonly="false" align="center"/>
<EF:EFComboColumn ename="supCode" cname="供应商名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="200" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="supName" cname="供应商名称" hidden="true"/>
<EF:EFComboColumn ename="userId" cname="申请人" defaultValue="${loginName}"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="100" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="subStatus" cname="提交状态" width="80" enable="true" readonly="true" align="center"
required="false" defaultValue="0">
<EF:EFCodeOption codeName="hggp.hpkc.submitStatus"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="depositStatus" cname="入库状态" width="80" enable="true" readonly="true" align="center"
required="false" defaultValue="0">
<EF:EFCodeOption codeName="hggp.hgsc.depositStatus"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="outStatus" cname="出库状态" width="80" enable="true" readonly="true" align="center"
required="false" defaultValue="0">
<EF:EFCodeOption codeName="hggp.hgsc.outStatus"/>
</EF:EFComboColumn>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
var inventRecordBox = __eiInfo.getBlock("invent_record_box_block_id").getMappedRows();
$("#QUERY").on("click", function () {
resultGrid.dataSource.page(1);
});
IPLATUI.EFGrid = {
"result":{
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [
{
field: "productCode",
filter: function (option) {
let inventType = option.model['inventType'];
if (inventType){
return _.filter(inventRecordBox, function (item) {
return item["param3Field"]==inventType && item["param1Field"]=='1';
})
}else {
return _.filter(inventRecordBox, function (item) {
return item["param1Field"]=='1';
})
}
},
template: function (dataItem) {
for (let i = 0; i < inventRecordBox.length; i++) {
if (inventRecordBox[i]['valueField'] === dataItem['productCode']) {
return inventRecordBox[i]['valueField'];
}
}
return dataItem["productCode"];
}
}
],
loadComplete: function (grid) {
grid.dataSource.bind("change", function (e) {
if (e.field == "productCode") {
for (let i = 0; i < inventRecordBox.length; i++) {
if (inventRecordBox[i]['valueField'] === e.items[0]['productCode']) {
resultGrid.setCellValue(e.items[0],"productName",inventRecordBox[i]['textField']);
resultGrid.setCellValue(e.items[0],"spec",inventRecordBox[i]['param4Field']);
resultGrid.setCellValue(e.items[0],"unit",inventRecordBox[i]['param6Field']);
if (isBlank(e.items[0]['inventType'])){
resultGrid.setCellValue(e.items[0],"inventType",inventRecordBox[i]['param3Field']);
}
}
}
loadChange(grid, e, "pcsQty");
}else if (e.field == "pcsQty"){
resultGrid.setCellValue(e.items[0],"remainingQty",e.items[0]['pcsQty']);
}else if (e.field == "pcsWeight"){
resultGrid.setCellValue(e.items[0],"remainingWeight",e.items[0]['pcsWeight']);
}
});
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
saveResult(btnNode);
}
},
"detail":{
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [
{
field: "inventCode",
filter: function (option) {
let inventType = option.model['inventType'];
if (inventType){
return _.filter(inventRecordBox, function (item) {
return item["param3Field"]==inventType && item["param1Field"]=='3';
})
}else {
return _.filter(inventRecordBox, function (item) {
return item["param1Field"]=='3';
})
}
},
template: function (dataItem) {
for (let i = 0; i < inventRecordBox.length; i++) {
if (inventRecordBox[i]['valueField'] === dataItem['inventCode']) {
return inventRecordBox[i]['valueField'];
}
}
return dataItem["inventCode"];
}
}
],
loadComplete: function (grid) {
grid.dataSource.bind("change", function (e) {
// 判断父级节点是否发生变化
if (e.field == "inventCode") {
for (let i = 0; i < inventRecordBox.length; i++) {
if (inventRecordBox[i]['valueField'] === e.items[0]['inventCode']) {
detailGrid.setCellValue(e.items[0],"inventName",inventRecordBox[i]['textField']);
detailGrid.setCellValue(e.items[0],"spec",inventRecordBox[i]['param4Field']);
detailGrid.setCellValue(e.items[0],"unit",inventRecordBox[i]['param6Field']);
if (isBlank(e.items[0]['inventType'])){
detailGrid.setCellValue(e.items[0],"inventType",inventRecordBox[i]['param3Field']);
}
}
}
loadChange(grid, e, "pcsQty");
}else if (e.field == "pcsQty"){
detailGrid.setCellValue(e.items[0],"remainingQty",e.items[0]['pcsQty']);
}else if (e.field == "pcsWeight"){
detailGrid.setCellValue(e.items[0],"remainingWeight",e.items[0]['pcsWeight']);
}
});
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
saveDetail(btnNode);
}
}
}
})
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
let query = function () {
resultGrid.dataSource.page(1);
detailGrid.dataSource.page(1);
}
let saveResult = function (btnNode) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function (index, item) {
let inventType = item.get("inventType");
let productCode = item.get("productCode");
if (isBlank(inventType)) {
message("选中的第" + (index + 1) + "行\"存货类型\",不能为空!");
flag = false;
return false;
}
if (isBlank(productCode)) {
message("选中的第" + (index + 1) + "行\"成品编码\",不能为空!");
flag = false;
return false;
}
});
if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGSC010A", "save", true);
btnNode.attr("disabled", false);
}
});
}
};
let saveDetail = function (btnNode) {
let rows = detailGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function (index, item) {
let inventType = item.get("inventType");
let inventCode = item.get("inventCode");
if (isBlank(inventType)) {
message("选中的第" + (index + 1) + "行\"存货类型\",不能为空!");
flag = false;
return false;
}
if (isBlank(inventCode)) {
message("选中的第" + (index + 1) + "行\"原料编码\",不能为空!");
flag = false;
return false;
}
});
if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("detail", "HGSC010B", "save", true);
btnNode.attr("disabled", false);
}
});
}
};
function updateStatus(id,status) {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
inEiInfo.set("result-0-status", status);
EiCommunicator.send('HGSC009', 'updateStatus', inEiInfo, {
onSuccess(response) {
NotificationUtil(response.msg);
query();
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
}
);
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/29
Time: 15:50
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ 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}"/>
<script>
var ctx = "${ctx}";
</script>
<EF:EFPage title="委托加工">
<EF:EFRegion id="result" title="成本信息">
<EF:EFInput blockId="inqu_status" row="0" ename="parentId" cname="委托ID" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="companyCode" cname="公司编码" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="companyName" cname="公司名称" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="contractCode" cname="委托单号" type="hidden"/>
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" needAuth="false">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="true"
blockName="invent_type_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false"
filter="contains">
</EF:EFComboColumn>
<EF:EFComboColumn ename="productCode" cname="成品编码" width="120" align="center" required="true" readonly="false"
blockName="invent_record_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#"
filter="contains">
</EF:EFComboColumn>
<EF:EFColumn ename="productName" cname="成品名称" width="120" align="center" required="true"/>
<EF:EFColumn ename="spec" cname="规格" width="140" align="center" maxLength="50"/>
<EF:EFColumn ename="unit" cname="单位" width="80" align="center"/>
<EF:EFColumn ename="pcsQty" cname="加工数量" width="120" enable="true" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" maxLength="17" required="true" defaultValue="0"
data-regex="/^-?[0-9]{1,17}$/" readonly="false"
data-errorprompt="请输入数字,该值最大可设置17位整数!"/>
<EF:EFColumn ename="pcsWeight" cname="加工重量" width="120" enable="true" format="{0:N3}" editType="text"
displayType="0.00" sort="true" align="right" maxLength="17" required="true" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/" readonly="false"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
<EF:EFColumn ename="depositQty" cname="入库数量" width="100" enable="false" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}$/" readonly="false"
data-errorprompt="请输入数字,该值最大可设置17位整数!"/>
<EF:EFColumn ename="depositWeight" cname="入库重量" width="100" enable="false" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/" readonly="false"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
<EF:EFColumn ename="remainingQty" cname="剩余数量" width="100" enable="false" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}$/" readonly="false"
data-errorprompt="请输入数字,该值最大可设置17位整数!"/>
<EF:EFColumn ename="remainingWeight" cname="剩余重量" width="100" enable="false" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/" readonly="false"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
</EF:EFGrid>
</EF:EFRegion>
<EF:EFRegion id="detail" title="原料信息">
<EF:EFGrid blockId="detail" autoDraw="override" isFloat="true" needAuth="false" serviceName="HGSC010B">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="100" align="center" required="true"
blockName="invent_type_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false"
filter="contains">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventCode" cname="原料编码" width="120" align="center" required="true" readonly="false"
blockName="invent_record_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#"
filter="contains">
</EF:EFComboColumn>
<EF:EFColumn ename="inventName" cname="原料名称" width="120" align="center" required="true"/>
<EF:EFColumn ename="spec" cname="规格" width="140" align="center" maxLength="50"/>
<EF:EFColumn ename="unit" cname="单位" width="80" align="center"/>
<EF:EFColumn ename="pcsQty" cname="加工数量" width="120" enable="true" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" maxLength="17" required="true" defaultValue="0"
data-regex="/^-?[0-9]{1,17}$/" readonly="false"
data-errorprompt="请输入数字,该值最大可设置17位整数!"/>
<EF:EFColumn ename="pcsWeight" cname="加工重量" width="120" enable="true" format="{0:N3}" editType="text"
displayType="0.00" sort="true" align="right" maxLength="17" required="true" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/" readonly="false"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
<EF:EFColumn ename="outQty" cname="出库数量" width="100" enable="false" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}$/" readonly="false"
data-errorprompt="请输入数字,该值最大可设置17位整数!"/>
<EF:EFColumn ename="outWeight" cname="出库重量" width="100" enable="false" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/" readonly="false"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
<EF:EFColumn ename="remainingQty" cname="剩余数量" width="100" enable="false" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}$/" readonly="false"
data-errorprompt="请输入数字,该值最大可设置17位整数!"/>
<EF:EFColumn ename="remainingWeight" cname="剩余重量" width="100" enable="false" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/" readonly="false"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
</EF:EFGrid>
</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