Commit 3737f775 by wuwenlong

Merge remote-tracking branch 'origin/dev' into dev

parents f75cfaeb 50191afd
......@@ -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.tools.HGKCTools;
import com.baosight.hggp.hg.kc.utils.HGKCUtils;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -34,9 +35,10 @@ public class ServiceHGKC008 extends ServiceBase {
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
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, "初始化失败");
}
return inInfo;
......@@ -45,11 +47,6 @@ public class ServiceHGKC008 extends ServiceBase {
public EiInfo query(EiInfo inInfo) {
try {
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);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
......
......@@ -279,6 +279,26 @@ public class ServiceHGPZ005 extends ServiceBase {
}
/**
* 下拉框 (不默认状态)
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "查询",operDesc = "下拉框(原料、零件、耗材)")
public EiInfo queryInventCodeProdTypeFourBox(EiInfo inInfo) {
try {
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.INVENT_RECORD_BOX_BLOCK_ID);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGPZ004.FIELD_INVENT_TYPE_DETAILS, InventTypeDetailEnum.getInentTypeThree());
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGPZ005.FIELD_STATUS,1);
CommonMethod.initBlock(inInfo, list, EiInfoUtils.getFirstRow(inInfo), false);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询规格失败");
}
return inInfo;
}
/**
* 下拉框
*
* @param inInfo
......
......@@ -4,9 +4,13 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
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.sc.domain.HGSC009;
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.Org;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
......@@ -20,6 +24,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author ZhangJiHui
......@@ -41,7 +46,7 @@ public class ServiceHGSC009 extends ServiceEPBase {
Map userCompany = HGSBTools.getUserCompany();
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();
List<String> orgIds = HGSBTools.getRoleCompanyCode();
......@@ -143,6 +148,9 @@ public class ServiceHGSC009 extends ServiceEPBase {
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgsc009.fromMap(map);
// 数据校验
this.checkUpdateStatusData(hgsc009);
DaoUtils.update(HGSC009.UPDATE_BLUEPRINT_STATUS, hgsc009);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
......@@ -157,7 +165,20 @@ public class ServiceHGSC009 extends ServiceEPBase {
return inInfo;
}
/**
* 校验提交数据
* @param hgsc009
*/
private void checkUpdateStatusData(HGSC009 hgsc009) {
hgsc009 = HGSCTools.THGSC009.getById(hgsc009.getId());
List<HGSC009A> hgsc009AList = HGSCTools.THGSC009.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 {
public EiInfo insertcg(EiInfo inInfo) {
try {
String[] orderDetailIds = inInfo.getString("planMaterialCodes").split(",");
List<HGSC009A> hgsc009AList = HGSCTools.HGSC009.getById(orderDetailIds);
List<HGSC009A> hgsc009AList = HGSCTools.THGSC009.getByPlanMaterialCodes(orderDetailIds);
List<String> inventCodes = Optional.ofNullable(hgsc009AList).orElse(new ArrayList<>()).stream().map(HGSC009A::getInventCode).collect(Collectors.toList());
Map<String,String> inventUnitMap = new HashMap<>();
if(CollectionUtils.isNotEmpty(inventCodes)){
......
......@@ -1185,7 +1185,7 @@ public class HGSCTools {
}
public static class HGSC009{
public static class THGSC009{
/* public static void generatorOrder(List<HGSC005> hgsc005List, List<HGSC005A> hgsc005AList){
Map<String, Optional<HGSC005>> hgsc005Map = hgsc005List.stream().collect(Collectors.groupingBy(HGSC005::getPlanCode,Collectors.maxBy(
Comparator.comparingLong(HGSC005::getId))));
......@@ -1211,11 +1211,24 @@ public class HGSCTools {
hgsc006.setAssignStatus(UNASSIGN.getCode());
return hgsc006;
}*/
public static HGSC009 getById(Long taskId){
AssertUtils.isTrue(Objects.isNull(taskId)||taskId<=0, "材料计划ID不能为空!");
HGSC009 results = (HGSC009)DaoBase.getInstance().get(HGSC009.QUERY, HGSC009.FIELD_ID, taskId);
return results;
}
public static List<HGSC009A> getByPlanMaterialCodes(String[] planMaterialCodes){
AssertUtils.isTrue(Objects.isNull(planMaterialCodes)||planMaterialCodes.length<=0, "材料计划编码不能为空!");
Map map = new HashMap<>();
map.put("planMaterialCodes",planMaterialCodes);
List<HGSC009A> results = DaoBase.getInstance().query(HGSC009A.QUERYList, map);
AssertUtils.isEmpty(results,"材料明细不能为空!");
return results;
}
public static List<HGSC009A> getById(String[] orderDetailId){
AssertUtils.isTrue(Objects.isNull(orderDetailId)||orderDetailId.length<=0, "订单明细ID不能为空!");
public static List<HGSC009A> getByPlanMaterialCode(String planMaterialCode){
AssertUtils.isTrue(StringUtils.isBlank(planMaterialCode), "材料计划编码不能为空!");
Map map = new HashMap<>();
map.put("planMaterialCodes",orderDetailId);
map.put("planMaterialCode",planMaterialCode);
List<HGSC009A> results = DaoBase.getInstance().query(HGSC009A.QUERYList, map);
AssertUtils.isEmpty(results,"材料明细不能为空!");
return results;
......
......@@ -64,34 +64,10 @@ $(function () {
supCodeChange(e);
var item = e.items[0];
if (e.field == "price") {
if(item.purQty && item.price && item.taxRate){
// 数量*单价金额
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)
}
calAmount(item);
}
if (e.field == "taxRate") {
if(item.purQty && item.price && item.taxRate){
// 数量*单价金额
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)
}
calAmount(item);
}
});
},
......@@ -115,6 +91,47 @@ $(function () {
downKeyUp();
});
/**
* 计算金额
* @param item
* @param length
* @param width
* @param thick
* @param coefficient
*/
let calAmount = function (item) {
//原材料
if(item.inventTypeDetail === '3'){
if(item.purWeight && item.price && item.taxRate){
// 重量*单价金额
let totalAmount = item.purWeight * 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)
}
}else{
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)
}
}
}
/**
* 页面加载时执行
......
......@@ -83,6 +83,8 @@
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
<EF:EFColumn ename="inventTypeDetail" cname="存货类型明细" enable="false" width="100" align="center" hidden="true"/>
</EF:EFGrid>
</EF:EFRegion>
......
$(function (){
var companyCodes = __eiInfo.getBlock("companyBox_block_id").getMappedRows();
var projCodes = __eiInfo.getBlock("proj_record_block_id").getMappedRows();
var companyCodes = __eiInfo.getBlock("roleCompany").getMappedRows();
var projCodes = __eiInfo.getBlock("projRecordByRole_block_id").getMappedRows();
var whRecordBoxBlocks = __eiInfo.getBlock("wh_record_box_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3");
......@@ -42,8 +42,9 @@ $(function (){
field: "companyCode",
template: function (dataItem) {
for (let i = 0; i < companyCodes.length; i++) {
if (companyCodes[i]['valueField'] === dataItem['companyCode']){
return companyCodes[i]['textField'];
if (companyCodes[i]['companyCode'] === dataItem['companyCode']){
dataItem['companyName'] = companyCodes[i]['companyName']
return companyCodes[i]['companyName'];
}
}
return dataItem["companyCode"];
......@@ -59,7 +60,7 @@ $(function (){
}
}
}
return template;
return item.projCode;
},
editor: function (container, options) {
let inInfo = new EiInfo();
......@@ -69,7 +70,7 @@ $(function (){
let dataSource;
EiCommunicator.send("HGSC003", "projComboBox", inInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("proj_record_block_id").getMappedRows();
dataSource = ei.getBlock("projRecordByRole_block_id").getMappedRows();
},
onFail: function (ei) {
}
......@@ -100,7 +101,7 @@ $(function (){
}
}
}
return template;
return item.whCode;
},
editor: function (container, options) {
var input = $('<input />');
......
$(function () {
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 () {
resultGrid.dataSource.page(1);
......@@ -65,7 +65,7 @@ $(function () {
let dataSource;
EiCommunicator.send("HGSC003", "projComboBox", inInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("proj_record_block_id").getMappedRows();
dataSource = ei.getBlock("projRecordByRole_block_id").getMappedRows();
},
onFail: function (ei) {
}
......@@ -232,7 +232,7 @@ function INSERTCG() {
});
if(flag) {
inEiInfo.set("planMaterialCodes",ids.join(','));
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"生成采购计划\"操作? ", {
ok: function () {
EiCommunicator.send('HGSC009A', 'insertcg', inEiInfo, {
onSuccess(response) {
......
......@@ -25,7 +25,7 @@
</EF:EFRegion>
<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="operator" cname="操作" locked="true" enable="false" width="150" align="center"/>
<EF:EFComboColumn ename="companyCode" cname="公司编码"
......
......@@ -11,11 +11,6 @@ $(function () {
},
columns: [{
field: "inventCode",
filter: function (options) {
return _.filter(inventAllBlockId, function (item) {
return item["param1Field"] == "true";
})
},
template: function (item) {
let template = "";
if(item.inventCode){
......@@ -31,10 +26,9 @@ $(function () {
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-isSplicingSymbol", true);
inInfo.set("field", options.field);
let dataSource = inventRecordBoxBlockId;
EiCommunicator.send("HGPZ005", "queryInventCodeBox", inInfo, {
EiCommunicator.send("HGPZ005", "queryInventCodeProdTypeFourBox", inInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("invent_record_box_block_id").getMappedRows();
},
......
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