Commit 28459713 by 江和松

1.重量计算处理

parent cf7adc10
......@@ -112,6 +112,7 @@ public class HGKC003 extends DaoEPBase {
public static final String INSERT = "HGKC003.insert";
public static final String UPDATE = "HGKC003.update";
public static final String DELETE = "HGKC003.delete";
public static final String UPDATE_SUBMIT_STATUS = "HGKC003.updateSubmitStatus";
private Long id = new Long(0);
private String accountCode = " "; /* 企业编码*/
......
......@@ -7,14 +7,15 @@ import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.kc.domain.HGKC003;
import com.baosight.hggp.hg.kc.utils.HGKCUtils;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.BeanUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.hg.sc.domain.HGSC003;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
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.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
......@@ -105,6 +106,35 @@ public class ServiceHGKC003 extends ServiceBase {
}
}
/**
* 修改提交状态
* @param inInfo
* @return
*/
public EiInfo updateSubmitStatus(EiInfo inInfo){
int i = 0;
try {
HGKC003 hgkc003 = new HGKC003();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgkc003.fromMap(map);
DaoUtils.update(HGKC003.UPDATE_SUBMIT_STATUS, hgkc003);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "提交")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
}
return inInfo;
}
/**
* 删除数据
*
......
......@@ -291,4 +291,15 @@
ID = #id#
</update>
<update id="updateSubmitStatus">
UPDATE ${hggpSchema}.HGKC003
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
SUBMIT_STATUS = #submitStatus# <!-- 提交状态 -->
WHERE
ID = #id#
</update>
</sqlMap>
......@@ -5,7 +5,25 @@ $(function () {
pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200],
},
columns: [],
columns: [
{
field: "operator",
title: "操作",
template: function (item) {
let status = item.submitStatus;
let template = '';
if (item.id){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id +')" >详情</a>';
if (status == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="updateSubmitStatus(' + item.id + ',1)" >提交</a>';
}
}
return template;
}
}
],
loadComplete: function (grid) {
},
onSuccess: function (e) {
......@@ -59,3 +77,37 @@ let selectTaskCallback = function () {
// 关闭弹窗
JSColorbox.close();
}
/**
* 显示详情
*/
function showDetail(id) {
JSColorbox.open({
href: "HGKC003B?methodName=initLoad&inqu_status-0-primaryId=" + id,
title: "<div style='text-align: center;'>入库单详情</div>",
width: "80%",
height: "80%",
});
}
/**
* 提交
* @param id
* @param status
*/
function updateSubmitStatus(id,status) {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
inEiInfo.set("result-0-submitStatus", status);
EiCommunicator.send('HGKC003', 'updateSubmitStatus', inEiInfo, {
onSuccess(response) {
NotificationUtil(response.msg);
query();
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
}
);
}
......@@ -27,6 +27,7 @@
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row" readonly="true">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" width="140" enable="false" readonly="false"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="140" align="center"/>
<EF:EFColumn ename="projCode" cname="项目编号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="140" align="center"/>
......
$(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200],
},
columns: [
],
loadComplete: function (grid) {
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'delete' ){
query();
}
}
}
// 查询
$("#QUERY").on("click", query);
// 选择生产任务
$("#SELECT_TASK").on("click", selectTask);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
......@@ -8,8 +8,7 @@
<EF:EFPage title="生产入库详情">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFDatePicker cname="单据日期" ename="documentDate" blockId="inqu_status" row="0" colWidth="3"
format="yyyy-MM-dd" readonly="true"/>
<EF:EFInput ename="inqu_status-0-primaryId" cname="主表id" colWidth="3" type="hidden"/>
<EF:EFSelect cname="仓库名称" ename="whCode" blockId="inqu_status" row="0" colWidth="3"
filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
......@@ -21,24 +20,24 @@
</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="row" enable="false">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="prodNo" cname="生产单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="depositDate" cname="单据日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="140" align="center"/>
<EF:EFComboColumn ename="whCode" cname="仓库名称" enable="false" width="120" align="center"
blockName="wh_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
<EF:EFColumn ename="whName" cname="仓库名称" enable="false" width="140" align="center"/>
<EF:EFColumn ename="prdtType" cname="存货类型" enable="false" width="140" align="center"/>
<EF:EFColumn ename="prdtCode" cname="存货编码" enable="false" width="140" align="center"/>
<EF:EFColumn ename="prdtName" cname="存货名称" enable="false" width="140" align="center"/>
<EF:EFComboColumn cname="入库类型" ename="storageType" width="90" align="center" required="false">
<EF:EFCodeOption codeName="hggp.sc.storageType" />
</EF:EFComboColumn>
<EF:EFColumn ename="prdtName" cname="部件名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="partName" cname="零件名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="partSpec" cname="零件规格" enable="false" width="150" align="center"/>
<EF:EFColumn ename="prdtSpec" cname="规格" enable="false" width="140" align="center"/>
<EF:EFColumn ename="prdtLength" cname="长度(MM)" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="prdtWidth" cname="宽度(MM)" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="prdtThick" cname="厚度(MM)" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="invQty" cname="数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="invQeight" cname="总重(T)" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="150"/>
<EF:EFColumn ename="prdtCode" cname="部件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="partCode" cname="零件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="invUnitWeight" cname="单重" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="invWeight" cname="总重" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="price" cname="单价" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="amount" cname="金额" enable="false" width="120" align="right" format="{0:N3}"/>
</EF:EFGrid>
</EF:EFRegion>
......
......@@ -152,6 +152,31 @@ $(function () {
}
},
{
field: "quantity",
title: "数量",
template: function (item) {
if(item.quantity && item.singleWeight){
let totalWeight = item.quantity * item.singleWeight;
item['totalWeight'] = totalWeight;
}
return item.quantity;
}
},
{
field: "singleWeight",
title: "单重(kg)",
template: function (item) {
let template = "";
if(item.quantity && item.singleWeight){
let totalWeight = item.quantity * item.singleWeight;
item['totalWeight'] = totalWeight.toString();
}
template = item.singleWeight;
console.log(item)
return template;
}
},
{
field: "productCode",
template: function (item) {
let template = "";
......@@ -238,7 +263,15 @@ $(function () {
loadChange(grid,e,"productId");
loadChange(grid,e,"inventType");
loadChange(grid,e,"productName");
loadChange(grid,e,"quantity");
}
if (e.field == "quantity") {
loadChange(grid,e,"totalWeight");
}
if (e.field == "singleWeight") {
loadChange(grid,e,"totalWeight");
}
loadChange(grid,e,"id");
});
},
onSuccess: function (e) {
......@@ -599,3 +632,25 @@ function updateProductStatus(id,status) {
}
);
}
function loadChange(grid,e,field) {
var cell_label = field,that = grid;
// locked 表示是否为固定列
var locked = that.isCellLocked(cell_label);
// tr 表示 locked 和非 locked 的行,index 表示此行的第几列
var tr,index;
// 获取此 model 元素信息
var item = e.items[0];
var _uid = item.uid;
if (locked) {
tr = $(".k-grid-content-locked tr[data-uid="+ _uid +"]");
index = $("th[data-field='"+cell_label+"']").data("index");
} else {
tr = $(".k-grid-content tr[data-uid="+ _uid +"]");
index = parseInt($("th[data-field='"+cell_label+"']").data("index")) - that.lockedHeader.find("th").length;
}
// 获取子 cell(td)
var td = tr.children("td:eq("+index+")");
// 触发 td.click 事件,
td.trigger("click");
}
......@@ -59,7 +59,7 @@
<EF:EFColumn ename="thick" cname="厚(MM)" width="100" align="right" format="{0:N2}" maxLength="10" enable="false"/>
<EF:EFColumn ename="quantity" required="true" cname="数量"/>
<EF:EFColumn ename="singleWeight" required="true" format="{0:N3}" cname="单重(kg)"/>
<EF:EFColumn enable="true" required="true" format="{0:N3}" ename="totalWeight" cname="总重(kg)"/>
<EF:EFColumn ename="totalWeight" cname="总重(kg)" required="true" format="{0:N3}"/>
<EF:EFComboColumn cname="提交状态" ename="productStatus" width="90" align="center" required="false" enable="false">
<EF:EFCodeOption codeName="hggp.sc.productStatus" />
</EF:EFComboColumn>
......
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