Commit 1d2cdf1f by 江和松

1.项目权限修改后,页面修改项目下拉框

2.计算不含税金额逻辑修改
parent 0f487e8c
...@@ -8,6 +8,7 @@ import com.baosight.hggp.hg.kc.domain.HGKC008; ...@@ -8,6 +8,7 @@ import com.baosight.hggp.hg.kc.domain.HGKC008;
import com.baosight.hggp.hg.kc.domain.HGKC008A; import com.baosight.hggp.hg.kc.domain.HGKC008A;
import com.baosight.hggp.hg.kc.tools.HGKCTools; import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.kc.utils.HGKCUtils; import com.baosight.hggp.hg.kc.utils.HGKCUtils;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*; import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
...@@ -34,9 +35,10 @@ public class ServiceHGKC008 extends ServiceBase { ...@@ -34,9 +35,10 @@ public class ServiceHGKC008 extends ServiceBase {
Map map = new HashMap(); Map map = new HashMap();
map.put(HGKC008.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode()); map.put(HGKC008.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID,DdynamicEnum.PROJ_RECORD_BLOCK_ID,DdynamicEnum.WH_RECORD_BOX_BLOCK_ID),map,false Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID,DdynamicEnum.PROJ_RECORD_BY_ROLE_BLOCK_ID,DdynamicEnum.WH_RECORD_BOX_BLOCK_ID),map,false
); );
} catch (PlatException e) { EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败"); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
} }
return inInfo; return inInfo;
...@@ -45,11 +47,6 @@ public class ServiceHGKC008 extends ServiceBase { ...@@ -45,11 +47,6 @@ public class ServiceHGKC008 extends ServiceBase {
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
inInfo = super.query(inInfo, HGKC008.QUERY, new HGKC008()); inInfo = super.query(inInfo, HGKC008.QUERY, new HGKC008());
Map map = new HashMap();
map.put(HGKC008.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID,DdynamicEnum.PROJ_RECORD_BLOCK_ID,DdynamicEnum.WH_RECORD_BOX_BLOCK_ID),map,false
);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) { } catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
......
...@@ -4,9 +4,13 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; ...@@ -4,9 +4,13 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.domain.HGCG001;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sc.domain.HGSC009; import com.baosight.hggp.hg.sc.domain.HGSC009;
import com.baosight.hggp.hg.sb.tools.HGSBTools; import com.baosight.hggp.hg.sb.tools.HGSBTools;
import com.baosight.hggp.hg.sc.domain.HGSC009A;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.tools.HGXSTools; import com.baosight.hggp.hg.xs.tools.HGXSTools;
...@@ -20,6 +24,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceEPBase; ...@@ -20,6 +24,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author ZhangJiHui * @author ZhangJiHui
...@@ -41,7 +46,7 @@ public class ServiceHGSC009 extends ServiceEPBase { ...@@ -41,7 +46,7 @@ public class ServiceHGSC009 extends ServiceEPBase {
Map userCompany = HGSBTools.getUserCompany(); Map userCompany = HGSBTools.getUserCompany();
qarma.put(HGSC009.FIELD_COMPANY_CODE,userCompany.get(HGSC009.FIELD_COMPANY_CODE)); qarma.put(HGSC009.FIELD_COMPANY_CODE,userCompany.get(HGSC009.FIELD_COMPANY_CODE));
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID),qarma); CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BY_ROLE_BLOCK_ID),qarma);
qarma.clear(); qarma.clear();
List<String> orgIds = HGSBTools.getRoleCompanyCode(); List<String> orgIds = HGSBTools.getRoleCompanyCode();
...@@ -143,6 +148,9 @@ public class ServiceHGSC009 extends ServiceEPBase { ...@@ -143,6 +148,9 @@ public class ServiceHGSC009 extends ServiceEPBase {
for (i = 0; i < eiBlock.getRowCount(); i++) { for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i); Map<?, ?> map = eiBlock.getRow(i);
hgsc009.fromMap(map); hgsc009.fromMap(map);
// 数据校验
this.checkUpdateStatusData(hgsc009);
DaoUtils.update(HGSC009.UPDATE_BLUEPRINT_STATUS, hgsc009); DaoUtils.update(HGSC009.UPDATE_BLUEPRINT_STATUS, hgsc009);
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
...@@ -157,7 +165,19 @@ public class ServiceHGSC009 extends ServiceEPBase { ...@@ -157,7 +165,19 @@ public class ServiceHGSC009 extends ServiceEPBase {
return inInfo; return inInfo;
} }
/**
* 校验提交数据
* @param hgsc009
*/
private void checkUpdateStatusData(HGSC009 hgsc009) {
List<HGSC009A> hgsc009AList = HGSCTools.HGSC009.getByPlanMaterialCode(hgsc009.getPlanMaterialCode());
List<Long> materialPlanIds = hgsc009AList.stream().map(HGSC009A::getId).collect(Collectors.toList());
List<HGCG001> hgcg001List = HGCGTools.HgCg001.listByMaterialPlanIds(materialPlanIds);
hgsc009AList.forEach(o->{
HGCG001 hgcg001 = hgcg001List.stream().filter(c -> c.getMaterialPlanId().intValue() == o.getId()).findAny().orElse(null);
AssertUtils.isTrue(Objects.nonNull(hgcg001), String.format("材料计划[%s]已生成采购计划", o.getPlanMaterialCode()));
});
}
} }
...@@ -217,7 +217,7 @@ public class ServiceHGSC009A extends ServiceBase { ...@@ -217,7 +217,7 @@ public class ServiceHGSC009A extends ServiceBase {
public EiInfo insertcg(EiInfo inInfo) { public EiInfo insertcg(EiInfo inInfo) {
try { try {
String[] orderDetailIds = inInfo.getString("planMaterialCodes").split(","); String[] orderDetailIds = inInfo.getString("planMaterialCodes").split(",");
List<HGSC009A> hgsc009AList = HGSCTools.HGSC009.getById(orderDetailIds); List<HGSC009A> hgsc009AList = HGSCTools.HGSC009.getByPlanMaterialCodes(orderDetailIds);
List<String> inventCodes = Optional.ofNullable(hgsc009AList).orElse(new ArrayList<>()).stream().map(HGSC009A::getInventCode).collect(Collectors.toList()); List<String> inventCodes = Optional.ofNullable(hgsc009AList).orElse(new ArrayList<>()).stream().map(HGSC009A::getInventCode).collect(Collectors.toList());
Map<String,String> inventUnitMap = new HashMap<>(); Map<String,String> inventUnitMap = new HashMap<>();
if(CollectionUtils.isNotEmpty(inventCodes)){ if(CollectionUtils.isNotEmpty(inventCodes)){
......
...@@ -1212,10 +1212,19 @@ public class HGSCTools { ...@@ -1212,10 +1212,19 @@ public class HGSCTools {
return hgsc006; return hgsc006;
}*/ }*/
public static List<HGSC009A> getById(String[] orderDetailId){ public static List<HGSC009A> getByPlanMaterialCodes(String[] planMaterialCodes){
AssertUtils.isTrue(Objects.isNull(orderDetailId)||orderDetailId.length<=0, "订单明细ID不能为空!"); AssertUtils.isTrue(Objects.isNull(planMaterialCodes)||planMaterialCodes.length<=0, "材料计划编码不能为空!");
Map map = new HashMap<>(); Map map = new HashMap<>();
map.put("planMaterialCodes",orderDetailId); map.put("planMaterialCodes",planMaterialCodes);
List<HGSC009A> results = DaoBase.getInstance().query(HGSC009A.QUERYList, map);
AssertUtils.isEmpty(results,"材料明细不能为空!");
return results;
}
public static List<HGSC009A> getByPlanMaterialCode(String planMaterialCode){
AssertUtils.isTrue(StringUtils.isBlank(planMaterialCode), "材料计划编码不能为空!");
Map map = new HashMap<>();
map.put("planMaterialCode",planMaterialCode);
List<HGSC009A> results = DaoBase.getInstance().query(HGSC009A.QUERYList, map); List<HGSC009A> results = DaoBase.getInstance().query(HGSC009A.QUERYList, map);
AssertUtils.isEmpty(results,"材料明细不能为空!"); AssertUtils.isEmpty(results,"材料明细不能为空!");
return results; return results;
......
...@@ -64,34 +64,10 @@ $(function () { ...@@ -64,34 +64,10 @@ $(function () {
supCodeChange(e); supCodeChange(e);
var item = e.items[0]; var item = e.items[0];
if (e.field == "price") { if (e.field == "price") {
if(item.purQty && item.price && item.taxRate){ calAmount(item);
// 数量*单价金额
let totalAmount = item.purQty * item.price;
//税额
let taxAmount = totalAmount * item.taxRate / 100;
//不含税金额
let amount = totalAmount - taxAmount;
//含税金额
let taxIncludeAmount = amount + taxAmount;
resultGrid.setCellValue(item, 'taxAmount', taxAmount)
resultGrid.setCellValue(item, 'amount', amount)
resultGrid.setCellValue(item, 'taxIncludeAmount', taxIncludeAmount)
}
} }
if (e.field == "taxRate") { if (e.field == "taxRate") {
if(item.purQty && item.price && item.taxRate){ calAmount(item);
// 数量*单价金额
let totalAmount = item.purQty * item.price;
//税额
let taxAmount = totalAmount* item.taxRate / 100;
//不含税金额
let amount = totalAmount - taxAmount;
//含税金额
let taxIncludeAmount = amount + taxAmount;
resultGrid.setCellValue(item, 'taxAmount', taxAmount)
resultGrid.setCellValue(item, 'amount', amount)
resultGrid.setCellValue(item, 'taxIncludeAmount', taxIncludeAmount)
}
} }
}); });
}, },
...@@ -115,6 +91,29 @@ $(function () { ...@@ -115,6 +91,29 @@ $(function () {
downKeyUp(); downKeyUp();
}); });
/**
* 计算金额
* @param item
* @param length
* @param width
* @param thick
* @param coefficient
*/
let calAmount = function (item) {
if(item.purQty && item.price && item.taxRate){
// 数量*单价金额
let totalAmount = item.purQty * item.price;
//不含税金额
let amount = totalAmount / (1 + item.taxRate / 100);
//税额
let taxAmount = totalAmount - amount;
//含税金额
let taxIncludeAmount = totalAmount;
resultGrid.setCellValue(item, 'taxAmount', taxAmount)
resultGrid.setCellValue(item, 'amount', amount)
resultGrid.setCellValue(item, 'taxIncludeAmount', taxIncludeAmount)
}
}
/** /**
* 页面加载时执行 * 页面加载时执行
......
$(function (){ $(function (){
var companyCodes = __eiInfo.getBlock("companyBox_block_id").getMappedRows(); var companyCodes = __eiInfo.getBlock("roleCompany").getMappedRows();
var projCodes = __eiInfo.getBlock("proj_record_block_id").getMappedRows(); var projCodes = __eiInfo.getBlock("projRecordByRole_block_id").getMappedRows();
var whRecordBoxBlocks = __eiInfo.getBlock("wh_record_box_block_id").getMappedRows(); var whRecordBoxBlocks = __eiInfo.getBlock("wh_record_box_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3"); $(".row").children().attr("class", "col-md-3");
...@@ -42,8 +42,9 @@ $(function (){ ...@@ -42,8 +42,9 @@ $(function (){
field: "companyCode", field: "companyCode",
template: function (dataItem) { template: function (dataItem) {
for (let i = 0; i < companyCodes.length; i++) { for (let i = 0; i < companyCodes.length; i++) {
if (companyCodes[i]['valueField'] === dataItem['companyCode']){ if (companyCodes[i]['companyCode'] === dataItem['companyCode']){
return companyCodes[i]['textField']; dataItem['companyName'] = companyCodes[i]['companyName']
return companyCodes[i]['companyName'];
} }
} }
return dataItem["companyCode"]; return dataItem["companyCode"];
...@@ -59,7 +60,7 @@ $(function (){ ...@@ -59,7 +60,7 @@ $(function (){
} }
} }
} }
return template; return item.projCode;
}, },
editor: function (container, options) { editor: function (container, options) {
let inInfo = new EiInfo(); let inInfo = new EiInfo();
...@@ -69,7 +70,7 @@ $(function (){ ...@@ -69,7 +70,7 @@ $(function (){
let dataSource; let dataSource;
EiCommunicator.send("HGSC003", "projComboBox", inInfo, { EiCommunicator.send("HGSC003", "projComboBox", inInfo, {
onSuccess: function (ei) { onSuccess: function (ei) {
dataSource = ei.getBlock("proj_record_block_id").getMappedRows(); dataSource = ei.getBlock("projRecordByRole_block_id").getMappedRows();
}, },
onFail: function (ei) { onFail: function (ei) {
} }
...@@ -100,7 +101,7 @@ $(function (){ ...@@ -100,7 +101,7 @@ $(function (){
} }
} }
} }
return template; return item.whCode;
}, },
editor: function (container, options) { editor: function (container, options) {
var input = $('<input />'); var input = $('<input />');
......
$(function () { $(function () {
var companyCodeBox = __eiInfo.getBlock("roleCompany").getMappedRows(); var companyCodeBox = __eiInfo.getBlock("roleCompany").getMappedRows();
var groupCodeBox = __eiInfo.getBlock("proj_record_block_id").getMappedRows(); var groupCodeBox = __eiInfo.getBlock("projRecordByRole_block_id").getMappedRows();
$("#QUERY").on("click", function () { $("#QUERY").on("click", function () {
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
...@@ -65,7 +65,7 @@ $(function () { ...@@ -65,7 +65,7 @@ $(function () {
let dataSource; let dataSource;
EiCommunicator.send("HGSC003", "projComboBox", inInfo, { EiCommunicator.send("HGSC003", "projComboBox", inInfo, {
onSuccess: function (ei) { onSuccess: function (ei) {
dataSource = ei.getBlock("proj_record_block_id").getMappedRows(); dataSource = ei.getBlock("projRecordByRole_block_id").getMappedRows();
}, },
onFail: function (ei) { onFail: function (ei) {
} }
...@@ -232,7 +232,7 @@ function INSERTCG() { ...@@ -232,7 +232,7 @@ function INSERTCG() {
}); });
if(flag) { if(flag) {
inEiInfo.set("planMaterialCodes",ids.join(',')); inEiInfo.set("planMaterialCodes",ids.join(','));
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"生成采购计划\"操作? ", {
ok: function () { ok: function () {
EiCommunicator.send('HGSC009A', 'insertcg', inEiInfo, { EiCommunicator.send('HGSC009A', 'insertcg', inEiInfo, {
onSuccess(response) { onSuccess(response) {
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/> <EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="150" align="center"/> <EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="150" align="center"/>
<EF:EFComboColumn ename="companyCode" cname="公司编码" <EF:EFComboColumn ename="companyCode" cname="公司编码"
......
...@@ -31,7 +31,6 @@ $(function () { ...@@ -31,7 +31,6 @@ $(function () {
}, },
editor: function (container, options) { editor: function (container, options) {
let inInfo = new EiInfo(); let inInfo = new EiInfo();
inInfo.set("inqu_status-0-isSplicingSymbol", true);
inInfo.set("field", options.field); inInfo.set("field", options.field);
let dataSource = inventRecordBoxBlockId; let dataSource = inventRecordBoxBlockId;
EiCommunicator.send("HGPZ005", "queryInventCodeBox", inInfo, { EiCommunicator.send("HGPZ005", "queryInventCodeBox", inInfo, {
......
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