Commit 93f6895c by liuyang

Merge branch 'dev' of http://git.pseer.com:8800/platform/hg-smart into dev-ly

parents 71c014dc 9519b5cd
......@@ -5,7 +5,10 @@ import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.domain.*;
import com.baosight.hggp.hg.cg.domain.HGCG001;
import com.baosight.hggp.hg.cg.domain.HGCG001A;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.domain.HGCG002B;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant;
......@@ -123,6 +126,8 @@ public class ServiceHGCG002A extends ServiceBase {
Long id = fCg001A.getId();
HGCG001A dbCg001A = dbCg001AMap.get(id);
AssertUtils.isNull(dbCg001A, String.format("计划明细[%s]不存在", id));
AssertUtils.isGe(BigDecimal.ZERO, fCg001A.getPurQty(), "采购数量不能小于等于0");
AssertUtils.isGt(BigDecimal.ZERO, fCg001A.getPurWeight(), "采购总量不能小于0");
AssertUtils.isTrue(fCg001A.getTaxRate().compareTo(BigDecimal.ZERO) <= 0, "税率不能小于等于0");
AssertUtils.isTrue(fCg001A.getPrice().compareTo(BigDecimal.ZERO) <= 0, "单价不能小于等于0");
}
......@@ -130,13 +135,13 @@ public class ServiceHGCG002A extends ServiceBase {
/**
* 数据保存
* @param resultRows
* @param fCg001As
* @param dbCg001Map
* @param hgcg001Map
*/
private void confirmData(List<HGCG001A> resultRows, Map<Long, HGCG001A> dbCg001Map, Map<String, HGCG001> hgcg001Map) {
private void confirmData(List<HGCG001A> fCg001As, Map<Long, HGCG001A> dbCg001Map, Map<String, HGCG001> hgcg001Map) {
//取一条主表数据,用于拷贝合同主表信息
HGCG001A oneCg001A = resultRows.get(0);
HGCG001A oneCg001A = fCg001As.get(0);
HGCG001 oneCG001 = hgcg001Map.get(oneCg001A.getPlanNo());
HGCG002 newCg002 = new HGCG002();
BeanUtils.copyProperties(oneCG001, newCg002,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
......@@ -146,30 +151,31 @@ public class ServiceHGCG002A extends ServiceBase {
newCg002.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
newCg002.setSource(HGConstant.CgSource.DEFAULT);
DaoUtils.insert(HGCG002.INSERT, newCg002);
for (HGCG001A hgcg001A : resultRows) {
for (HGCG001A fCg001A : fCg001As) {
//新增子表信息
insertDetails(hgcg001A,newCg002);
HGCG001 cg001 = hgcg001Map.get(hgcg001A.getPlanNo());
insertDetails(fCg001A, newCg002);
HGCG001 cg001 = hgcg001Map.get(fCg001A.getPlanNo());
// 更新计划状态
HGCGTools.HgCg001.updateStatus(cg001.getPlanNo(), HGConstant.CgPlanStatus.S_4);
// 更新计划状态
HGCGTools.HgCg001A.updateStatus(hgcg001A.getId(), HGConstant.CgPlanStatus.S_4);
HGCGTools.HgCg001A.updateStatus(fCg001A.getId(), HGConstant.CgPlanStatus.S_4);
}
//修改主表信息
HGCGTools.HgCg002.updateCg002Pur(newCg002);
}
private void insertDetails(HGCG001A dbCg001A, HGCG002 newCg002) {
private void insertDetails(HGCG001A fCg001A, HGCG002 newCg002) {
//获取采购计划明细
List<HGCG002B> cg002BList = new LinkedList<>();
HGCG002B cg002B = new HGCG002B();
//拷贝明细信息
BeanUtils.copyProperties(dbCg001A,cg002B,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
BeanUtils.copyProperties(fCg001A, cg002B, "id", "createdBy", "createdName", "createdTime", "updatedBy",
"updatedName", "updatedTime");
cg002B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
cg002B.setPrimaryId(newCg002.getId());
cg002B.setPlanDetailId(dbCg001A.getId());
cg002B.setPlanDetailId(fCg001A.getId());
cg002BList.add(cg002B);
DaoUtils.insertBatch(HGCG002B.INSERT,cg002BList);
DaoUtils.insertBatch(HGCG002B.INSERT, cg002BList);
}
/**
......
......@@ -381,7 +381,7 @@ let selectPlan = function () {
href: "HGCG002A?methodName=initLoad",
title: "<div style='text-align: center;'>计划查询</div>",
width: "80%",
height: "80%",
height: "90%",
callbackName: selectPlanCallback
});
}
......
......@@ -37,7 +37,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="row" height="65vh">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"/>
<EF:EFComboColumn ename="source" cname="数据来源" enable="false" width="80" align="center" defaultValue="1">
......
......@@ -23,7 +23,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="row" height="67vh">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/>
......@@ -33,15 +33,15 @@
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" enable="false"
sumType="page"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" enable="false"
sumType="page"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" sumType="page"
required="true"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" sumType="page"
required="true"/>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFComboColumn ename="taxRate" cname="税率(%)" enable="true" width="100" align="center" required="true"
copy="true">
......
......@@ -320,7 +320,7 @@ let selectContract = function () {
href: "HGCG003A?methodName=initLoad",
title: "<div style='text-align: center;'>合同查询</div>",
width: "80%",
height: "80%",
height: "90%",
callbackName: selectContractCallback
});
}
......@@ -364,7 +364,7 @@ function showDetail(id,status,source) {
href: "HGCG003B?methodName=initLoad&inqu_status-0-primaryId=" + id+"&status="+status+"&source="+source,
title: "<div style='text-align: center;'>详情</div>",
width: "80%",
height: "80%",
height: "90%",
callbackName: windowCallback
});
}
......
......@@ -37,7 +37,7 @@
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row" copyToAdd="false">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row" copyToAdd="false" height="63vh">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="source" cname="数据来源" enable="false" width="80" align="center">
......
......@@ -40,7 +40,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="row" height="60vh">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/>
......
$(function () {
var inventRecordBoxBlockId = __eiInfo.getBlock("invent_record_box_block_id").getMappedRows();
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
......@@ -7,16 +8,15 @@ $(function () {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
columns: [
{
columns: [{
field: "inventCode",
template: function (item) {
let template = item.inventCode;
if(item.inventCode){
for(let i=0;i<inventRecordBoxBlockId.length;i++){
if(item.inventCode === inventRecordBoxBlockId[i]['valueField']){
if (item.inventCode) {
for (let i = 0; i < inventRecordBoxBlockId.length; i++) {
if (item.inventCode === inventRecordBoxBlockId[i]['valueField']) {
template = inventRecordBoxBlockId[i]['valueField'];
}else{
} else {
template = item.inventCode;
}
}
......@@ -49,22 +49,20 @@ $(function () {
filter: "contains"
});
}
},
{
}, {
field: "primaryId",
template: function (item) {
item['primaryId'] =$("#inqu_status-0-primaryId").val();
item['primaryId'] = $("#inqu_status-0-primaryId").val();
return $("#inqu_status-0-primaryId").val();
}
}
],
}],
beforeEdit: function (e) {
var status = $("#status").val();
if(status != '0'){
if (status != '0') {
e.preventDefault();
}
var source = $("#source").val();
if(source === '0'){
if (source === '0') {
//选择合同的明细不能修改存货信息
for (let i = 0; i < e.sender.columns.length; i++) {
//指定的列不让修改
......@@ -77,7 +75,6 @@ $(function () {
}
}
}
},
loadComplete: function (grid) {
// 此grid对象
......@@ -170,23 +167,23 @@ $(window).load(function () {
* @param coefficient
*/
let calAmount = function (item) {
let price = item.price;
//计算方式为重量乘单价
if(item.calculationMethod == 1){
if(item.receiveWeight && item.price){
if (item.calculationMethod == 1) {
let receiveWeight = item.receiveWeight;
if (!isBlank(receiveWeight) && !isBlank(price)) {
// 重量*单价金额
let totalAmount = item.receiveWeight * item.price;
let totalAmount = parseFloat(receiveWeight) * parseFloat(price);
resultGrid.setCellValue(item, 'amount', totalAmount)
}
}else{
if(item.receiveQty && item.price){
if(item.receiveQty && item.price){
// 重量*单价金额
let totalAmount = item.receiveQty * item.price;
} else {
let receiveQty = item.receiveQty;
if (!isBlank(receiveQty) && !isBlank(price)) {
// 数量*单价金额
let totalAmount = parseFloat(receiveQty) * parseFloat(price);
resultGrid.setCellValue(item, 'amount', totalAmount)
}
}
}
}
/**
......
......@@ -51,7 +51,7 @@
sumType="page"/>
<EF:EFColumn ename="receiveUnitWeight" cname="收货单重" enable="false" width="120" align="right" format="{0:N3}"
hidden="true"/>
<EF:EFComboColumn ename="calculationMethod" cname="计算方式" enable="true" width="100" align="center" required="true">
<EF:EFComboColumn ename="calculationMethod" cname="计算方式" enable="true" width="120" align="center" required="true">
<EF:EFCodeOption codeName="hggp.cg.calculationMethod" />
</EF:EFComboColumn>
<EF:EFColumn ename="price" cname="单价" width="120" align="right" format="{0:C3}" required="true"/>
......
......@@ -14,9 +14,9 @@
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true" copyToAdd="false">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="120" align="left"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="120" align="left"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="120" align="left"/>
<EF:EFColumn ename="createdBy" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
......
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