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
......@@ -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