Commit d7440820 by liuyang

2024-04-11 报工管理功能优化

parent 3aa17fcc
......@@ -86,6 +86,7 @@ public class HPSC010A extends DaoEPBase {
private String prdtName = " "; /* 产品名称*/
private BigDecimal weight = new BigDecimal("0"); /* 产量*/
private BigDecimal weightJh = new BigDecimal("0"); /* 加焊产量*/
private Integer rowNo = 0;
private Long parentId = new Long(0); /* 父级ID*/
private Integer deleteFlag; /* 是否删除0:否1.是*/
private String createdBy = " "; /* 创建人*/
......@@ -518,6 +519,15 @@ public class HPSC010A extends DaoEPBase {
public void setUpdatedName(String updatedName) {
this.updatedName = updatedName;
}
public Integer getRowNo() {
return rowNo;
}
public void setRowNo(Integer rowNo) {
this.rowNo = rowNo;
}
/**
* get the value from Map.
*
......
package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
......@@ -7,6 +8,7 @@ import com.baosight.hpjx.hp.sc.domain.HPSC010;
import com.baosight.hpjx.hp.sc.domain.HPSC010A;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.ErrorCodeUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
......@@ -77,18 +79,32 @@ public class ServiceHPSC010 extends ServiceEPBase {
return inInfo;
}
@OperationLogAnnotation(operModul = "报工管理",operType = "修改",operDesc = "修改操作")
@Override
public EiInfo update(EiInfo inInfo) {
int i = 0;
try {
HPSC010 hpxs010 = new HPSC010();
HPSC010 hpsc010 = new HPSC010();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpxs010.fromMap(map);
hpxs010.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.update(HPSC010.UPDATE, hpxs010);
List<Map> list = eiBlock.getRows();
list.addAll(inInfo.getBlock(CommonConstant.Field.DETAIL).getRows());
double weight = 0;
//BigDecimal weight = new BigDecimal("0");
for (i = 0; i < list.size(); i++) {
Map<?, ?> map = list.get(i);
HPSC010A hpsc010A = new HPSC010A();
hpsc010A.fromMap(map);
weight = weight+hpsc010A.getWeight().doubleValue()+hpsc010A.getWeightJh().doubleValue();
}
String registerDate = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSC010.FIELD_REGISTER_DATE);
hpsc010.fromMap(eiBlock.getRow(0));
hpsc010.setDeleteFlag(CommonConstant.YesNo.NO_0);
hpsc010.setWeight(BigDecimal.valueOf(weight/2));
hpsc010.setId(Long.valueOf(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSC010.FIELD_ID)));
hpsc010.setRegisterDate(StringUtil.removeHorizontalLine(registerDate));
hpsc010.setUserCount(Long.valueOf(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSC010.FIELD_USER_COUNT)));
DaoUtils.update(HPSC010.UPDATE, hpsc010);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
......@@ -101,6 +117,7 @@ public class ServiceHPSC010 extends ServiceEPBase {
return inInfo;
}
@OperationLogAnnotation(operModul = "报工管理",operType = "新增",operDesc = "新增操作")
@Override
public EiInfo insert(EiInfo inInfo) {
int i = 0;
......@@ -110,14 +127,17 @@ public class ServiceHPSC010 extends ServiceEPBase {
List<Map> list = eiBlock.getRows();
list.addAll(inInfo.getBlock(CommonConstant.Field.DETAIL).getRows());
double weight = 0;
//BigDecimal weight = new BigDecimal("0");
String registerDate = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSC010.FIELD_REGISTER_DATE);
Map queryMap = new HashMap();
queryMap.put(HPSC010.FIELD_FACTORY_CODE,list.get(0).get(HPSC010.FIELD_FACTORY_CODE));
queryMap.put(HPSC010.FIELD_REGISTER_DATE,StringUtil.removeHorizontalLine(registerDate));
queryFactoryCode(inInfo,queryMap);
for (i = 0; i < list.size(); i++) {
Map<?, ?> map = list.get(i);
HPSC010A hpsc010A = new HPSC010A();
hpsc010A.fromMap(map);
weight = weight+hpsc010A.getWeight().doubleValue()+hpsc010A.getWeightJh().doubleValue();
}
String registerDate = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSC010.FIELD_REGISTER_DATE);
hpxs010.fromMap(eiBlock.getRow(0));
hpxs010.setDeleteFlag(CommonConstant.YesNo.NO_0);
hpxs010.setWeight(BigDecimal.valueOf(weight/2));
......@@ -129,8 +149,7 @@ public class ServiceHPSC010 extends ServiceEPBase {
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleInsertException(inInfo,i,e);
logError("新增失败", e.getMessage());
LogUtils.setDetailMsg(inInfo, e, "保存失败");
return inInfo;
}
return inInfo;
......@@ -142,4 +161,12 @@ public class ServiceHPSC010 extends ServiceEPBase {
hpsc010A.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPSC010A.DELETE_PARENT_ID, hpsc010A);
}
public void queryFactoryCode(EiInfo inInfo,Map<String,Object> queryMap){
List<HPSC010> hpsc010List = this.dao.query(HPSC010.QUERY,queryMap);
if (hpsc010List.size() > 0) {
inInfo.setDetailMsg("当前数据以存在,添加失败!");
throw new PlatException("E_Plat_InsertError",new Exception(),inInfo);
}
}
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.sc.domain.*;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.ErrorCodeUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.contants.ACConstants;
......@@ -30,21 +31,21 @@ public class ServiceHPSC096 extends ServiceEPBase {
@OperationLogAnnotation(operModul = "报工管理",operType = "查询",operDesc = "初始化")
@Override
public EiInfo initLoad(EiInfo inInfo) {
String methodType = inInfo.getString("inqu_status-0-methodType"); //操作类型
List<Map> listFactoryCode;
EiBlock queryBlock = inInfo.getBlock(EiConstant.queryBlock);
String methodType = queryBlock.getCellStr(ACConstants.ROW_CODE_0,"methodType"); //操作类型
if ("update".equals(methodType)) {
String id = inInfo.getString("inqu_status-0-id");
initUpdateData(inInfo);
/*String id = queryBlock.getCellStr(ACConstants.ROW_CODE_0,HPSC010.FIELD_ID);
listFactoryCode = this.dao.query(HPSC010A.QUERY,new HashMap<String,Object>(){{
put(HPSC010A.FIELD_PARENT_ID,id);
}},EiConstant.defaultOffset,100);
EiInfo eiInfo = super.query(inInfo,HPSC010.QUERY,new HPSC010());
if (eiInfo.getBlock(EiConstant.resultBlock).getRows().size() >0) {
inInfo.setCell(EiConstant.queryBlock,ACConstants.ROW_CODE_0,HPSC010.FIELD_USER_COUNT,
eiInfo.getCellStr(EiConstant.resultBlock,ACConstants.ROW_CODE_0,HPSC010.FIELD_USER_COUNT));
}
inInfo.addBlock(EiConstant.resultBlock).setRows(listFactoryCode);
//EiInfo eiInfo = super.query(inInfo,HPSC010.QUERY,new HPSC010());
queryBlock.setCell(ACConstants.ROW_CODE_0,HPSC010.FIELD_REGISTER_DATE,queryBlock.getCellStr(ACConstants.ROW_CODE_0,HPSC010.FIELD_REGISTER_DATE));
queryBlock.setCell(ACConstants.ROW_CODE_0,HPSC010.FIELD_USER_COUNT,queryBlock.getCellStr(ACConstants.ROW_CODE_0,HPSC010.FIELD_USER_COUNT));
resultBlock.setRows(listFactoryCode);*/
}else {
List<Map> listResult = new ArrayList<>();
initSave(inInfo);
/*List<Map> listResult = new ArrayList<>();
List<Map> listdetail = new ArrayList<>();
String loginName = UserSession.getLoginName();
Map queryMap = new HashMap();
......@@ -54,31 +55,28 @@ public class ServiceHPSC096 extends ServiceEPBase {
int rowNo = 0;
int detrowNo = 0;
for (int i = 0; i < listFactoryCode.size(); i++) {
Map result = new HashMap();
result.putAll(listFactoryCode.get(i));
result.put(HPSC010A.FIELD_WEIGHT,0);
result.put(HPSC010A.FIELD_WEIGHT_JH,0);
if ("prodGroup".equals(listFactoryCode.get(i).get(HPSC096.FIELD_ORG_TYPE))) {
rowNo++;
Map result = new HashMap();
result.putAll(listFactoryCode.get(i));
result.put(HPSC010A.FIELD_WEIGHT,0);
result.put(HPSC010A.FIELD_WEIGHT_JH,0);
result.put(HPSC010A.FIELD_GROUP_TYPE,1);
result.put("rowNo",rowNo);
listResult.add(result);
}else if ("cutGroup".equals(listFactoryCode.get(i).get(HPSC096.FIELD_ORG_TYPE))){
Map detailMap = new HashMap();
detailMap.putAll(listFactoryCode.get(i));
detailMap.put(HPSC010A.FIELD_WEIGHT,0);
detailMap.put(HPSC010A.FIELD_WEIGHT_JH,0);
detailMap.put("rowNo",detrowNo);
listdetail.add(detailMap);
result.put(HPSC010A.FIELD_GROUP_TYPE,0);
result.put("rowNo",detrowNo);
listdetail.add(result);
detrowNo++;
}
}
inInfo.addBlock(EiConstant.resultBlock).setRows(listResult);
inInfo.addBlock(CommonConstant.Field.DETAIL).setRows(listdetail);
resultBlock.setRows(listResult);
detailBlock.setRows(listdetail);*/
queryBlock.setCell(ACConstants.ROW_CODE_0,HPSC010.FIELD_REGISTER_DATE, DateUtils.date());
queryBlock.setCell(ACConstants.ROW_CODE_0,HPSC010.FIELD_ID, 0);
}
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPSC096().eiMetadata);
inInfo.addBlock(CommonConstant.Field.DETAIL).addBlockMeta(new HPSC096().eiMetadata);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,"methodType",methodType);
queryBlock.setCell(ACConstants.ROW_CODE_0,"methodType",methodType);
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.GROUP_RECORD1_BLOCK_ID,DdynamicEnum.FACTORY_CODE_BLOCK_ID),
new HashMap<String,Object>(){{
......@@ -98,13 +96,28 @@ public class ServiceHPSC096 extends ServiceEPBase {
public EiInfo update(EiInfo inInfo) {
int i = 0;
try {
HPSC010A hpsc010A = new HPSC010A();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
// Map queryMap = new HashMap();
//queryMap.put(HPSC010.FIELD_REGISTER_DATE,eiBlock.getCellStr(ACConstants.ROW_CODE_0,HPSC010.FIELD_REGISTER_DATE));
//queryMap.put(HPSC010.FIELD_FACTORY_CODE,eiBlock.getCellStr(ACConstants.ROW_CODE_0,HPSC010.FIELD_FACTORY_CODE));
//queryMap.put(HPSC010.FIELD_ID,eiBlock.getCellStr(ACConstants.ROW_CODE_0,HPSC010A.FIELD_PARENT_ID));
//List<HPSC010> list = this.dao.query(HPSC010.QUERY,queryMap);
List<Map> listResult = eiBlock.getRows();
listResult.addAll(inInfo.getBlock(CommonConstant.Field.DETAIL).getRows());
String registerDate = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSC010.FIELD_REGISTER_DATE);
HPSC010A hpsc010A = new HPSC010A();
for (i = 0; i < listResult.size(); i++) {
Map<?, ?> map = listResult.get(i);
hpsc010A.fromMap(map);
hpsc010A.setRegisterDate(StringUtil.removeHorizontalLine(registerDate));
hpsc010A.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.update(HPSC010A.UPDATE, hpsc010A);
if (hpsc010A.getParentId() == null || hpsc010A.getParentId() == 0) {
hpsc010A.setParentId(Long.valueOf(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSC010.FIELD_ID)));
DaoUtils.insert(HPSC010A.INSERT, hpsc010A);
}else {
DaoUtils.update(HPSC010A.UPDATE, hpsc010A);
}
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
......@@ -153,4 +166,101 @@ public class ServiceHPSC096 extends ServiceEPBase {
}
return inInfo;
}
public EiInfo initSave(EiInfo inInfo){
EiBlock resultBlock = new EiBlock(EiConstant.resultBlock);
EiBlock detailBlock = new EiBlock(CommonConstant.Field.DETAIL);
List<Map> listResult = new ArrayList<>();
List<Map> listdetail = new ArrayList<>();
Map queryMap = new HashMap();
queryMap.put("loginName", UserSession.getLoginName());
List<Map> listFactoryCode = this.dao.query(HPSC096.QUERY_FACTORY_CODE,queryMap,EiConstant.defaultOffset,100);
int rowNo = 0;
int detrowNo = 0;
for (int i = 0; i < listFactoryCode.size(); i++) {
Map result = new HashMap();
result.putAll(listFactoryCode.get(i));
result.put(HPSC010A.FIELD_WEIGHT,0);
result.put(HPSC010A.FIELD_WEIGHT_JH,0);
if ("prodGroup".equals(listFactoryCode.get(i).get(HPSC096.FIELD_ORG_TYPE))) {
rowNo++;
result.put(HPSC010A.FIELD_GROUP_TYPE,"1");
result.put("rowNo",rowNo);
listResult.add(result);
}else if ("cutGroup".equals(listFactoryCode.get(i).get(HPSC096.FIELD_ORG_TYPE))){
result.put(HPSC010A.FIELD_GROUP_TYPE,"0");
result.put("rowNo",detrowNo);
listdetail.add(result);
detrowNo++;
}
}
resultBlock.setRows(listResult);
detailBlock.setRows(listdetail);
inInfo.setBlock(resultBlock).addBlockMeta(new HPSC010A().eiMetadata);
inInfo.addBlock(detailBlock).addBlockMeta(new HPSC010A().eiMetadata);
return inInfo;
}
public EiInfo initUpdateData(EiInfo inInfo){
EiBlock queryBlock = inInfo.getBlock(EiConstant.queryBlock);
EiBlock resultBlock = new EiBlock(EiConstant.resultBlock);
EiBlock detailBlock = new EiBlock(CommonConstant.Field.DETAIL);
String id = queryBlock.getCellStr(ACConstants.ROW_CODE_0,HPSC010.FIELD_ID);
List<HPSC010A> resultList = this.dao.query(HPSC010A.QUERY,new HashMap<String,Object>(){{
put(HPSC010A.FIELD_PARENT_ID,id);
put(HPSC010A.FIELD_GROUP_TYPE,"1");
}},EiConstant.defaultOffset,100);
List<HPSC010A> detailList = this.dao.query(HPSC010A.QUERY,new HashMap<String,Object>(){{
put(HPSC010A.FIELD_PARENT_ID,id);
put(HPSC010A.FIELD_GROUP_TYPE,"0");
}},EiConstant.defaultOffset,100);
Map queryMap = new HashMap();
queryMap.put("loginName", UserSession.getLoginName());
List<Map<String,Object>> listFactoryCode = this.dao.query(HPSC096.QUERY_FACTORY_CODE,queryMap,EiConstant.defaultOffset,100);
List<HPSC010A> listResult = new ArrayList<>();
List<HPSC010A> listdetail = new ArrayList<>();
int rowNo = 0;
int detrowNo = 0;
for (int i = 0; i < listFactoryCode.size(); i++) {
HPSC010A result = new HPSC010A();
result.fromMap(listFactoryCode.get(i));
if ("prodGroup".equals(listFactoryCode.get(i).get(HPSC096.FIELD_ORG_TYPE))) {
rowNo++;
for (HPSC010A hpsc010A: resultList) {
String factoryCode = hpsc010A.getFactoryCode();
String groupCode = hpsc010A.getGroupCode();
if (factoryCode.equals(result.getFactoryCode()) && groupCode.equals(result.getGroupCode())) {
result = hpsc010A;
break;
}
}
result.setGroupType("1");
result.setRowNo(rowNo);
listResult.add(result);
}else if ("cutGroup".equals(listFactoryCode.get(i).get(HPSC096.FIELD_ORG_TYPE))){
detrowNo++;
for (HPSC010A hpsc010A: detailList) {
String factoryCode = hpsc010A.getFactoryCode();
String groupCode = hpsc010A.getGroupCode();
if (factoryCode.equals(result.getFactoryCode()) && groupCode.equals(result.getGroupCode())) {
result = hpsc010A;
break;
}
}
result.setGroupType("0");
result.setRowNo(detrowNo);
listdetail.add(result);
}
}
queryBlock.setCell(ACConstants.ROW_CODE_0,HPSC010.FIELD_ID, id);
queryBlock.setCell(ACConstants.ROW_CODE_0,HPSC010.FIELD_REGISTER_DATE,
queryBlock.getCellStr(ACConstants.ROW_CODE_0,HPSC010.FIELD_REGISTER_DATE));
queryBlock.setCell(ACConstants.ROW_CODE_0,HPSC010.FIELD_USER_COUNT,
queryBlock.getCellStr(ACConstants.ROW_CODE_0,HPSC010.FIELD_USER_COUNT));
inInfo.addBlock(resultBlock).setRows(listResult);
inInfo.addBlock(detailBlock).setRows(listdetail);
return inInfo;
}
}
......@@ -106,7 +106,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
REGISTER_DATE desc,CREATED_TIME desc
</isEmpty>
</dynamic>
......
......@@ -98,7 +98,7 @@
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC008">
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC010A">
SELECT
ID as "id", <!-- ID -->
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
......@@ -134,7 +134,7 @@
</select>
<select id="queryResult" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC008">
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC010A">
SELECT
ID as "id", <!-- ID -->
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
......@@ -170,7 +170,7 @@
</select>
<select id="queryDetail" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC010A">
SELECT
ID as "id", <!-- ID -->
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
......@@ -199,7 +199,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME desc
REGISTER_DATE desc,CREATED_NAME asc
</isEmpty>
</dynamic>
......
......@@ -59,10 +59,11 @@ $(function () {
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
//e.preventDefault();
e.preventDefault();
//let btnNode = $(this);
//禁用按钮
//btnNode.attr("disabled", true);
updateWindowOpen();
//saveResult(btnNode);
},
onSuccess: function (e) {
......@@ -342,7 +343,7 @@ function showGroupDetail(id) {
function addWindowOpen(id) {
JSColorbox.open({
href: "HPSC096?methodName=initLoad&inqu_status-0-methodType=insert&inqu_status-0-id=" + id,
href: "HPSC096?methodName=initLoad&inqu_status-0-methodType=insert&efParentFormEname=HPSC010&inqu_status-0-id=" + id,
title: "<div style='text-align: center;'>新增</div>",
width: "80%",
height: "90%",
......@@ -350,12 +351,25 @@ function addWindowOpen(id) {
});
}
function updateWindowOpen(id) {
function updateWindowOpen() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1 || rows.length > 1) {
message("请选择1条数据");
return;
}
$.each(rows, function(index, item) {
let id= item.get("id");
if(isBlank(id)){
message("不能为空,青玄一条数据!");
flag = false;
return false;
}
});
JSColorbox.open({
href: "HPSC096?methodName=initLoad&inqu_status-0-methodType=update&inqu_status-0-id=" + id,
href: "HPSC096?methodName=initLoad&inqu_status-0-methodType=update&efParentFormEname=HPSC010&inqu_status-0-id="+rows[0].id+"&inqu_status-0-userCount="+rows[0].userCount+"&inqu_status-0-registerDate="+rows[0].registerDate,
title: "<div style='text-align: center;'>修改</div>",
width: "60%",
height: "50%",
width: "80%",
height: "90%",
callbackName: windowOpenCallback
});
}
......
......@@ -28,7 +28,7 @@
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="single">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="企业编码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>
......@@ -40,15 +40,15 @@
maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true">
</EF:EFComboColumn>
<EF:EFColumn ename="weight" cname="产量" width="120" enable="false" format="{0:N2}" editType="text"
<EF:EFColumn ename="weight" cname="产量" width="120" enable="false" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right"
data-regex="/^-?[0-9]{1,16}([.][0-9]{1,2})?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置17位整数和2位小数!"
data-regex="/^-?[0-9]{1,16}([.][0-9]{1,3})?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"
/>
<EF:EFColumn ename="userCount" cname="用工人数" width="120" enable="true" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right"
<EF:EFColumn ename="userCount" cname="用工人数" width="120" enable="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right"
data-regex="/^-?[0-9]{1,16}([.][0-9]{1,3})?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置17位整数!"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"
/>
</EF:EFGrid>
</EF:EFRegion>
......
......@@ -68,15 +68,15 @@
<EF:EFCodeOption codeName="hpjx.hpjx.productionType" />
</EF:EFComboColumn>
<EF:EFColumn ename="prdtName" cname="生产内容" enable="false" width="160" align="center" required="true"/>
<EF:EFColumn ename="weight" cname="组拼产量(T)" width="120" enable="false" format="{0:N2}" editType="text"
<EF:EFColumn ename="weight" cname="组拼产量(T)" width="120" enable="false" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right"
data-regex="/^-?[0-9]{1,16}([.][0-9]{1,2})?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置17位整数和2位小数!"
data-regex="/^-?[0-9]{1,16}([.][0-9]{1,3})?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"
/>
<EF:EFColumn ename="weightJh" cname="加焊产量(T)" width="120" enable="false" format="{0:N2}" editType="text"
<EF:EFColumn ename="weightJh" cname="加焊产量(T)" width="120" enable="false" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right"
data-regex="/^-?[0-9]{1,16}([.][0-9]{1,2})?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置17位整数和2位小数!"
data-regex="/^-?[0-9]{1,16}([.][0-9]{1,3})?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"
/>
<%--<EF:EFColumn ename="remark" cname="备注" enable="true" width="200" align="center"/>--%>
</EF:EFGrid>
......
......@@ -20,10 +20,10 @@ $(function (){
IPLATUI.EFDatePicker = {
"inqu_status-0-registerDate": {
start: "day",
depth: "day",
value:year+"-"+month+"-"+day
depth: "day"
}
}
//value:year+"-"+month+"-"+day
IPLATUI.EFGrid = {
"result": {
......@@ -36,7 +36,7 @@ $(function (){
pageSize: 10,
pageSizes: [10, 20, 30, 50, 100, 200],
},*/
columns: [{
columns: [/*{
field: "operator",
title: "操作",
template: function (item) {
......@@ -45,7 +45,7 @@ $(function (){
+ 'onclick="deleteRow(' + item.rowNo + ')" >删除</a>';
return template
}
}/*,{
}*//*,{
field: "registerDate",
attributes: {
class: "i-input-readonly"
......@@ -63,6 +63,12 @@ $(function (){
}else {
$("#inqu_status-0-userCount").val(0);
}
let methodType = $("#inqu_status-0-methodType").val();
if (methodType == "update"){
$("#inqu_status-0-registerDate").attr("disabled","disabled");
}else {
$("#inqu_status-0-registerDate").removeAttr("disabled");
}
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
......@@ -84,7 +90,7 @@ $(function (){
toolbarConfig:{
hidden: false,
},
columns: [{
columns: [/*{
field: "operator",
title: "操作",
template: function (item) {
......@@ -93,7 +99,7 @@ $(function (){
+ 'onclick="detailDeleteRow(' + item.rowNo + ')" >删除</a>';
return template
}
}],
}*/],
}
};
......@@ -110,7 +116,6 @@ $(function (){
*/
$('#confirm').on('click', function () {
let resultRows = resultGrid.getDataItems();
let detailRows = detailGrid.getDataItems();
let methodType = $("#inqu_status-0-methodType").val();
let registerDate = $("#inqu_status-0-registerDate").val();
if (registerDate.length<=0){
......@@ -119,38 +124,26 @@ $(function (){
let flag = true;
$.each(resultRows, function(index, item) {
let prdtName= item.get("prdtName");
if(isBlank(prdtName)){
message("选中的生产组第"+(index+1)+"行\"产品\",不能为空!");
flag = false;
return false;
}
let weight= item.get("weight");
if(isBlank(weight)){
message("选中的生产组第"+(index+1)+"行\"组拼产量(T)\",不能为空!");
if(weight != 0 && isBlank(prdtName)){
message("选中的生产组第"+(index+1)+"行\"产品\",不能为空!");
flag = false;
return false;
}
let weightJh= item.get("weightJh");
if(isBlank(weightJh)){
if(weightJh !=0 && isBlank(prdtName)){
message("选中的生产组第"+(index+1)+"行\"加焊产量(T)\",不能为空!");
flag = false;
return false;
}
});
$.each(detailRows, function(index, item) {
let prdtName= item.get("prdtName");
if(isBlank(prdtName)){
message("选中的下料组第"+(index+1)+"行\"产品\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () {
var info = new EiInfo();
info.set("inqu_status-0-userCount",$("#inqu_status-0-userCount").val());
info.set("inqu_status-0-registerDate",registerDate);
info.set("inqu_status-0-id",$("#inqu_status-0-id").val());
info.addBlock(rowsBlock("result"));
info.addBlock(rowsBlock("detail"))
EiCommunicator.send("HPSC010", methodType, info, {
......@@ -315,10 +308,14 @@ var rowsBlock = function (grid_id) {
$.each(dateColumns, function (index, dateColumn) {
var field = dateColumn.field, dateFormat = dateColumn.dateFormat;
model[field] = kendo.toString(model[field],
dateFormat
dateFormat
);// 日期转String
});
eiblock.addRow(eiblock.getMappedArray(model, true));
if (isBlank(model.prdtName)){
continue;
}else {
eiblock.addRow(eiblock.getMappedArray(model, true));
}
}
var showCount = eiblock.get(EiConstant.SHOW_COUNT) || "true";
eiblock.set(EiConstant.SHOW_COUNT, showCount);
......
......@@ -15,9 +15,10 @@
<EF:EFPage title="报工管理">
<EF:EFRegion id="result" title="生产明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="ID" hidden="true"/>
<EF:EFColumn ename="rowNo" cname="行号" hidden="true"/>
<EF:EFColumn ename="remark" cname="上级ID" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>
<%--<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>--%>
<%--<EF:EFColumn ename="registerDate" cname="登记日期" width="160" align="center" editType="date" readonly="true"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>--%>
<EF:EFComboColumn ename="factoryCode" cname="工厂" blockName="factory_code_block_id"
......@@ -50,14 +51,15 @@
align="center" filter="contains" sort="true">
<EF:EFCodeOption codeName="hpjx.hpjx.productionType" />
</EF:EFComboColumn>
<EF:EFColumn ename="prdtName" cname="产品" enable="true" width="160" align="center" hidden="true"/>
<%--<EF:EFColumn ename="prdtName" cname="产品" enable="true" width="160" align="center" hidden="true"/>--%>
</EF:EFGrid>
</EF:EFRegion>
<EF:EFRegion id="detail" title="下料明细信息">
<EF:EFGrid blockId="detail" autoDraw="override" toolbarConfig="{hidden:'all'}" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="ID" hidden="true"/>
<EF:EFColumn ename="rowNo" cname="行号" hidden="true"/>
<EF:EFColumn ename="remark" cname="上级ID" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>
<%--<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>--%>
<%--<EF:EFColumn ename="registerDate" cname="登记日期" width="160" align="center" editType="date" readonly="true"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>--%>
<EF:EFComboColumn ename="factoryCode" cname="工厂" blockName="factory_code_block_id"
......@@ -87,7 +89,7 @@
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"
/>
<EF:EFColumn ename="weightJh" cname="加焊产量(T)" width="120" enable="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" hidden="true" defaultValue="0"
displayType="0.000" sort="true" align="right" defaultValue="0" hidden="true"
data-regex="/^-?[0-9]{1,16}([.][0-9]{1,3})?$/" maxLength="20"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"
/>
......@@ -101,6 +103,7 @@
<EF:EFDatePicker ename="inqu_status-0-registerDate" colWidth="3" cname="登记日期"
required="true" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFInput cname="" blockId="inqu_status" ename="methodType" row="0" colWidth="3" hidden="true"/>
<EF:EFInput cname="" ename="inqu_status-0-id" colWidth="3" hidden="true"/>
</div>
</EF:EFRegion>
<div class="row">
......
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