Commit ee9f0d9d by wuwenlong

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

parents f0735172 8dac78b4
......@@ -153,6 +153,8 @@ public class ServiceHGKC007 extends ServiceBase {
*/
private void modify(HGKC007 hgkc007) throws Exception {
DaoUtils.update(HGKC007.UPDATE, hgkc007);
//同时修改子表的仓库数据、公司数据
HGKCTools.HgKc007A.updateWhCodeByPrimaryId(hgkc007);
}
/**
......
package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.InventTypeDetailEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
......@@ -8,8 +9,10 @@ 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.pz.domain.HGPZ004;
import com.baosight.hggp.hg.xs.domain.Company;
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;
......@@ -47,6 +50,15 @@ public class ServiceHGKC008 extends ServiceBase {
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGKC008.QUERY, new HGKC008());
//移动端需要主表查询
String whCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC008A.FIELD_WH_CODE);
Map map = new HashMap();
map.put(HGKC008A.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
map.put(HGKC008A.FIELD_WH_CODE, whCode);
map.put(HGPZ004.FIELD_INVENT_TYPE_DETAILS, InventTypeDetailEnum.getInentTypeThree());
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID,DdynamicEnum.INVENT_CODE_BOX_BLOCK_ID),map,false
);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
......@@ -78,6 +90,8 @@ public class ServiceHGKC008 extends ServiceBase {
this.checkSaveData(hgkc008);
if(Objects.nonNull(hgkc008.getId())&&hgkc008.getId()!=0){
DaoUtils.update(HGKC008.UPDATE, hgkc008);
//同时修改子表的仓库数据、公司数据
HGKCTools.HgKc008A.updateWhCodeByReceiveId(hgkc008);
}else {
//生成生产领料编号
hgkc008.setApplyCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.RECEIVE_CODE));
......
......@@ -98,6 +98,9 @@
<isNotEmpty prepend=" AND " property="inventTypeDetails">
INVENT_TYPE_DETAIL IN <iterate close=")" open="(" conjunction="," property="inventTypeDetails">#inventTypeDetails[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCodes">
INVENT_CODE IN <iterate close=")" open="(" conjunction="," property="inventCodes">#inventCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="idCondition">
......
......@@ -752,6 +752,30 @@ public class HGKCTools {
List<HGKC007A> results = DaoBase.getInstance().query(HGKC007A.QUERY, paramMap);
return results;
}
public static List<HGKC007A> updateWhCodeByPrimaryId(HGKC007 kc007) {
Map paramMap = new HashMap();
paramMap.put("primaryId", kc007.getId());
List<HGKC007A> results = DaoBase.getInstance().query(HGKC007A.QUERY, paramMap);
results.forEach(o->{
o.setWhName(kc007.getWhName());
o.setWhCode(kc007.getWhCode());
o.setCompanyCode(kc007.getCompanyCode());
o.setCompanyName(kc007.getCompanyName());
o.setProjCode(kc007.getProjCode());
o.setProjName(kc007.getProjName());
});
if (!CollectionUtil.isEmpty(results)){
List<String> inventCodes = results.stream().map(o -> o.getInventCode()).collect(Collectors.toList());
List<HGKC010> kc010List = HGKCTools.HgKc010.getListByBussiness(kc007.getCompanyCode(),kc007.getWhCode(),inventCodes);
results.forEach(o ->{
HGKC010 kc010 = kc010List.stream().filter(k -> k.getInventCode().equals(o.getInventCode())).findAny().orElse(null);
AssertUtils.isTrue(Objects.isNull(kc010), "仓库("+kc007.getWhCode()+"|"+kc007.getWhName()+"),不存在存货信息:("+o.getInventCode()+"|"+o.getInventName()+")");
});
DaoUtils.updateBatch(HGKC007A.UPDATE, results);
}
return results;
}
}
......@@ -798,6 +822,31 @@ public class HGKCTools {
return results;
}
public static List<HGKC008A> updateWhCodeByReceiveId(HGKC008 kc008) {
Map paramMap = new HashMap();
paramMap.put("receiveId", kc008.getId());
List<HGKC008A> results = DaoBase.getInstance().query(HGKC008A.QUERY, paramMap);
results.forEach(o->{
o.setWhName(kc008.getWhName());
o.setWhCode(kc008.getWhCode());
o.setCompanyCode(kc008.getCompanyCode());
o.setCompanyName(kc008.getCompanyName());
o.setProjCode(kc008.getProjCode());
o.setProjName(kc008.getProjName());
});
if (!CollectionUtil.isEmpty(results)){
List<String> inventCodes = results.stream().map(o -> o.getInventCode()).collect(Collectors.toList());
List<HGKC010> kc010List = HGKCTools.HgKc010.getListByBussiness(kc008.getCompanyCode(),kc008.getWhCode(),inventCodes);
results.forEach(o ->{
HGKC010 kc010 = kc010List.stream().filter(k -> k.getInventCode().equals(o.getInventCode())).findAny().orElse(null);
AssertUtils.isTrue(Objects.isNull(kc010), "仓库("+kc008.getWhCode()+"|"+kc008.getWhName()+"),不存在存货信息:("+o.getInventCode()+"|"+o.getInventName()+")");
});
DaoUtils.updateBatch(HGKC008A.UPDATE, results);
}
return results;
}
}
/**
......@@ -861,6 +910,23 @@ public class HGKCTools {
}
/**
* @param companyCode
* @param whCode
* @param inventCodes
*/
public static List<HGKC010> getListByBussiness(String companyCode, String whCode, List<String> inventCodes) {
AssertUtils.isEmpty(companyCode, "公司编码不能为空");
AssertUtils.isEmpty(whCode, "仓库编码不能为空");
AssertUtils.isEmpty(inventCodes, "物料编码不能为空");
Map paramMap = new HashMap();
paramMap.put("companyCode", companyCode);
paramMap.put("whCode", whCode);
paramMap.put("inventCodes", inventCodes);
List<HGKC010> results = DaoBase.getInstance().query(HGKC010.QUERY, paramMap);
return results;
}
/**
* 查询
*
* @param ids
......
......@@ -22,11 +22,28 @@ $(function() {
return template;
}
}],
loadComplete: function (e) {
loadComplete: function (grid) {
$("#SELECT_BILL").on("click",addFunc);
//$("#BTN_UPDATE").on("click",updateFunc);
$("#SUBMIT").on("click",submitFunc);
$("#B_SAVE").on("click",saveFunc);
grid.dataSource.bind("change",function(e){
var item = e.items[0];
if(e.field == "taxPoints"){
if(item.thisSettlementTax && item.totalContractPriceIncluding){
let thisSettlementAmount = item.totalContractPriceIncluding / (item.taxPoints / 100 + 1);
// 使用toFixed方法四舍五入到两位小数,并转换为数字
thisSettlementAmount = Number(thisSettlementAmount.toFixed(2));
resultGrid.setCellValue(item,'thisSettlementAmount',thisSettlementAmount)
}
if(item.taxPoints && item.totalContractPriceIncluding){
let thisSettlementTax = item.totalContractPriceIncluding-item.thisSettlementAmount;
// 使用toFixed方法四舍五入到两位小数,并转换为数字
thisSettlementTax = Number(thisSettlementTax.toFixed(2));
resultGrid.setCellValue(item,'thisSettlementTax',thisSettlementTax)
}
}
})
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
......
......@@ -42,8 +42,11 @@
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true" />
<EF:EFColumn ename="signingDate" cname="开票日期" width="120" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true" />
<EF:EFColumn ename="billNumber" cname="发票号" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="taxPoints" cname="税率" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="billNumber" cname="发票号" width="120" enable="true" readonly="false" align="center"/>
<EF:EFComboColumn ename="taxPoints" cname="税率" width="120" align="center" required="true"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" >
<EF:EFCodeOption codeName="hggp.cw.taxPoints"/>
</EF:EFComboColumn>
<EF:EFColumn ename="thisSettlementAmount" cname="不含税金额" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="thisSettlementTax" cname="税额" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="totalContractPriceIncluding" cname="发票总额" width="120" enable="false" readonly="true" align="center"/>
......
......@@ -14,6 +14,81 @@ $(function () {
},
columns: [
{
field: "inventCode",
template: function (item) {
let template = "";
if(item.inventCode){
for(let i=0;i<inventRecordBoxBlocks.length;i++){
if(item.inventCode === inventRecordBoxBlocks[i]['valueField']){
item.inventName = inventRecordBoxBlocks[i]['textField'];
template = inventRecordBoxBlocks[i]['valueField'];
}
}
}
return item.inventCode;
},
editor: function (container, options) {
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoDropDownList({
dataSource: inventRecordBoxBlocks,
minLength: 0,
dataTextField: "textField",
dataValueField: "valueField",
optionLabelTemplate: "[#:valueField#]#:textField#[#:param3Field#]",
valueTemplate: "[#:valueField#]#:textField#[#:param3Field#]",
template: "[#:valueField#]#:textField#[#:param3Field#]",
filter: "contains"
});
}
},
{
field: "prdtSpec",
template: function (item) {
let template = "";
if(item.prdtSpec){
for(let i=0;i<specBoxBlocks.length;i++){
if(item.prdtSpec === specBoxBlocks[i]['valueField']){
template = specBoxBlocks[i]['valueField'];
}
}
}
return item.prdtSpec;
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-whCode", options.model["whCode"]);
inInfo.set("inqu_status-0-companyCode", options.model["companyCode"]);
inInfo.set("inqu_status-0-inventType", options.model["inventType"]);
inInfo.set("inqu_status-0-inventCode", options.model["inventCode"]);
inInfo.set("field", options.field);
let dataSource;
EiCommunicator.send("HGKC010", "querySpecBox", inInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("spec_box_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoDropDownList({
dataSource: dataSource,
minLength: 0,
dataTextField: "textField",
dataValueField: "valueField",
optionLabelTemplate: "[#:valueField#]#:textField#",
valueTemplate: "[#:valueField#]#:textField#",
template: "[#:valueField#]#:textField#",
filter: "contains"
});
}
},
{
field: "primaryId",
template: function (item) {
item['primaryId'] =$("#inqu_status-0-primaryId").val();
......@@ -37,6 +112,88 @@ $(function () {
loadComplete: function (grid) {
// 此grid对象
grid.dataSource.bind("change", function(e) {
var item = e.items[0];
//数量计算
if (e.field == "invQty") {
if(item.invQty && item.invUnitWeight){
let totalWeight = item.invQty * item.invUnitWeight;
resultGrid.setCellValue(item, 'invWeight', totalWeight)
}
if(item.price && item.invQty){
let totalAmount = item.price * item.invQty;
resultGrid.setCellValue(item, 'amount', totalAmount)
}
loadChange(grid,e,"price");
}
//单价计算
if (e.field == "price") {
if(item.price && item.invQty){
let totalAmount = item.price * item.invQty;
resultGrid.setCellValue(item, 'amount', totalAmount)
}
}
if (e.field == "inventType") {
//选择后,先加载此方法,再加载属性中的方法,所以存货类型加载时,先修改存货编号下拉框的查询
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-whCode",item.whCode);
inInfo.set("inqu_status-0-companyCode",item.companyCode);
inInfo.set("inqu_status-0-inventType",item.inventType);
EiCommunicator.send("HGKC010", "queryInventCodeBox", inInfo, {
onSuccess: function (ei) {
inventRecordBoxBlocks = ei.getBlock("invent_code_box_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
resultGrid.setCellValue(item, 'inventCode', "")
resultGrid.setCellValue(item, 'inventName', "")
resultGrid.setCellValue(item, 'prdtSpecId', "")
resultGrid.setCellValue(item, 'prdtSpec', "")
resultGrid.setCellValue(item, 'prdtLength', "")
resultGrid.setCellValue(item, 'prdtWidth', "")
resultGrid.setCellValue(item, 'prdtThick', "")
resultGrid.setCellValue(item, 'invQty', "")
resultGrid.setCellValue(item, 'invUnitWeight', "")
resultGrid.setCellValue(item, 'invWeight', "")
loadChange(grid,e,"inventCode");
}
if (e.field == "inventCode") {
for(let i=0;i<inventRecordBoxBlocks.length;i++){
if(item.inventCode === inventRecordBoxBlocks[i]['valueField']){
resultGrid.setCellValue(item, 'inventType', inventRecordBoxBlocks[i]['param1Field']);
resultGrid.setCellValue(item, 'inventName', inventRecordBoxBlocks[i]['textField']);
resultGrid.setCellValue(item, 'prdtSpecId', inventRecordBoxBlocks[i]['param2Field']);
resultGrid.setCellValue(item, 'prdtSpec', inventRecordBoxBlocks[i]['param3Field']);
resultGrid.setCellValue(item, 'prdtLength', inventRecordBoxBlocks[i]['param4Field']);
resultGrid.setCellValue(item, 'prdtWidth', inventRecordBoxBlocks[i]['param5Field']);
resultGrid.setCellValue(item, 'prdtThick', inventRecordBoxBlocks[i]['param6Field']);
resultGrid.setCellValue(item, 'invQty', inventRecordBoxBlocks[i]['param7Field']);
resultGrid.setCellValue(item, 'invUnitWeight', inventRecordBoxBlocks[i]['param8Field']);
resultGrid.setCellValue(item, 'invWeight', inventRecordBoxBlocks[i]['param9Field']);
resultGrid.setCellValue(item, 'inventTypeDetail', inventRecordBoxBlocks[i]['param10Field']);
break
}
}
loadChange(grid,e,"price");
}
if (e.field == "prdtSpec") {
for(let i=0;i<specBoxBlocks.length;i++){
if(item.prdtSpec === specBoxBlocks[i]['valueField']){
resultGrid.setCellValue(item, 'prdtLength', specBoxBlocks[i]['param1Field'])
resultGrid.setCellValue(item, 'prdtWidth', specBoxBlocks[i]['param2Field'])
resultGrid.setCellValue(item, 'prdtThick', specBoxBlocks[i]['param3Field'])
resultGrid.setCellValue(item, 'invQty', specBoxBlocks[i]['param4Field'])
resultGrid.setCellValue(item, 'invUnitWeight', specBoxBlocks[i]['param5Field'])
resultGrid.setCellValue(item, 'invWeight', specBoxBlocks[i]['param6Field'])
resultGrid.setCellValue(item, 'prdtSpecId', specBoxBlocks[i]['param7Field'])
break
}
}
resultGrid.setCellValue(item, 'price', "")
resultGrid.setCellValue(item, 'amount', "")
loadChange(grid,e,"invQty");
}
});
},
onSave: function (e) {
......
......@@ -38,7 +38,7 @@
<EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" width="220" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" width="160" align="center" required="true" enable="false"/>
<EF:EFColumn ename="prdtSpec" cname="规格" width="120" align="center" enable="true" required="true"/>
<EF:EFColumn ename="prdtSpec" cname="规格" width="120" align="center" enable="false" required="false" />
<EF:EFColumn ename="inventRecordId" cname="规格id" width="120" align="center" required="true" enable="false" hidden="true"/>
<EF:EFColumn ename="prdtLength" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="prdtWidth" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
......
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