Commit 36abee8b by wuwenlong

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

parents 3ed1cafa b204ad4e
...@@ -85,7 +85,7 @@ public class ServiceHGCB002 extends ServiceEPBase { ...@@ -85,7 +85,7 @@ public class ServiceHGCB002 extends ServiceEPBase {
public EiInfo selectAll(EiInfo inInfo) { public EiInfo selectAll(EiInfo inInfo) {
try { try {
Map params= EiInfoUtils.getFirstRow(inInfo); Map params= EiInfoUtils.getFirstRow(inInfo);
HGCW001 hgcw001 = HGCWTools.HgCw001.getMaxAccountPeriod(params.get(HGCB002.FIELD_COMPANY_CODE).toString()); HGCW001 hgcw001 = HGCWTools.HgCw001.getMaxAccountPeriod(params);
EiInfoUtils.addBlock(inInfo,"hgcw001_block_id", hgcw001, HGCW001.class); EiInfoUtils.addBlock(inInfo,"hgcw001_block_id", hgcw001, HGCW001.class);
}catch (Exception e){ }catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "同步数据失败"); LogUtils.setDetailMsg(inInfo, e, "同步数据失败");
......
...@@ -398,9 +398,11 @@ public class HGCBTools { ...@@ -398,9 +398,11 @@ public class HGCBTools {
BigDecimal endAmount = hgcb004 == null ? BigDecimal.ZERO : hgcb004.getEndAmount(); BigDecimal endAmount = hgcb004 == null ? BigDecimal.ZERO : hgcb004.getEndAmount();
quantity = quantity.add(endQuantity); quantity = quantity.add(endQuantity);
amount = amount.add(endAmount); amount = amount.add(endAmount);
BigDecimal price = amount.divide(quantity, 3, RoundingMode.HALF_UP); if (quantity.compareTo(BigDecimal.ZERO) > 0) {
cb003.setPrice(price); BigDecimal price = amount.divide(quantity, 3, RoundingMode.HALF_UP);
cb003.setAmount(cb003.getQuantity().multiply(price)); cb003.setPrice(price);
cb003.setAmount(cb003.getQuantity().multiply(price));
}
cb003.setIsEstimate(0); cb003.setIsEstimate(0);
results.add(cb003); results.add(cb003);
//DaoUtils.insert(HGCB003.INSERT, cb003); //DaoUtils.insert(HGCB003.INSERT, cb003);
......
...@@ -127,13 +127,7 @@ public class ServiceHGCW001 extends ServiceBase { ...@@ -127,13 +127,7 @@ public class ServiceHGCW001 extends ServiceBase {
DaoUtils.insert(HGCW001.INSERT, hgcw001); DaoUtils.insert(HGCW001.INSERT, hgcw001);
HGCB001 hgcb001 = new HGCB001(); HGCB001 hgcb001 = new HGCB001();
BeanUtils.copyProperties(hgcw001,hgcb001); BeanUtils.copyProperties(hgcw001,hgcb001);
HGCB001 cb001 = HGCBTools.HgCb001.select(new HashMap<String,String>(){{ HGCBTools.HgCb001.add(Collections.singletonList(hgcb001));
put(HGCB001.FIELD_ACCOUNT_PERIOD,hgcw001.getAccountPeriod());
put(HGCB001.FIELD_COMPANY_CODE,hgcw001.getCompanyCode());
}});
if (cb001 == null) {
DaoUtils.insert(HGCB001.INSERT, hgcb001); //同步添加会计期维护
}
} }
/** /**
...@@ -274,7 +268,7 @@ public class ServiceHGCW001 extends ServiceBase { ...@@ -274,7 +268,7 @@ public class ServiceHGCW001 extends ServiceBase {
throw new PlatException(String.format("公司[%s]会计期[%s]会计期维护为关账状态,业务账期关账失败!", hgcb001.getCompanyCode(),hgcw001.getAccountPeriod())); throw new PlatException(String.format("公司[%s]会计期[%s]会计期维护为关账状态,业务账期关账失败!", hgcb001.getCompanyCode(),hgcw001.getAccountPeriod()));
} }
//检查数据 //检查数据
HGCWTools.HgCw001.checkAllData(hgcw001); //HGCWTools.HgCw001.checkAllData(hgcw001);
hgcw001.setAccountPeriodStatus(0); //关账 hgcw001.setAccountPeriodStatus(0); //关账
DaoUtils.update("HGCW001.updateSwitchRow", hgcw001); DaoUtils.update("HGCW001.updateSwitchRow", hgcw001);
......
...@@ -338,14 +338,14 @@ ...@@ -338,14 +338,14 @@
ACCOUNT_PERIOD_DATE_START as "accountPeriodDateStart", ACCOUNT_PERIOD_DATE_START as "accountPeriodDateStart",
ACCOUNT_PERIOD_DATE_END as "accountPeriodDateEnd" ACCOUNT_PERIOD_DATE_END as "accountPeriodDateEnd"
from ${hggpSchema}.HGCW001 from ${hggpSchema}.HGCW001
where ACCOUNT_PERIOD_STATUS = 0 where ACCOUNT_PERIOD_STATUS = #accountPeriodStatus#
AND ACCOUNT_CODE = #accountCode# AND ACCOUNT_CODE = #accountCode#
AND COMPANY_CODE = #companyCode# AND COMPANY_CODE = #companyCode#
AND ACCOUNT_PERIOD = ( AND ACCOUNT_PERIOD = (
select MAX(ACCOUNT_PERIOD) from ${hggpSchema}.HGCW001 select MAX(ACCOUNT_PERIOD) from ${hggpSchema}.HGCW001
where ACCOUNT_CODE = #accountCode# where ACCOUNT_CODE = #accountCode#
and COMPANY_CODE = #companyCode# and COMPANY_CODE = #companyCode#
and ACCOUNT_PERIOD_STATUS = 0 and ACCOUNT_PERIOD_STATUS = #accountPeriodStatus#
) )
</select> </select>
......
...@@ -363,6 +363,23 @@ ...@@ -363,6 +363,23 @@
ID = #id# ID = #id#
</update> </update>
<select id="queryInvoicing" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.cw.domain.HGCW012">
SELECT
<include refid="column" />
FROM ${hggpSchema}.HGCW012 WHERE REVIEW_STATUS = '1'
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID desc
</isEmpty>
</dynamic>
</select>
<select id="queryCheckList" parameterClass="java.util.HashMap" resultClass="com.baosight.hggp.hg.cw.domain.HGCW012"> <select id="queryCheckList" parameterClass="java.util.HashMap" resultClass="com.baosight.hggp.hg.cw.domain.HGCW012">
SELECT SELECT
<include refid="column" /> <include refid="column" />
......
...@@ -24,7 +24,10 @@ import java.math.BigDecimal; ...@@ -24,7 +24,10 @@ import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -45,8 +48,19 @@ public class HGCWTools { ...@@ -45,8 +48,19 @@ public class HGCWTools {
public static HGCW001 getMaxAccountPeriod(String companyCode) { public static HGCW001 getMaxAccountPeriod(String companyCode) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("companyCode", companyCode); params.put("companyCode", companyCode);
params.put(HGCW001.FIELD_ACCOUNT_PERIOD_STATUS, AccountPeriodStatusEnum.OPEN.getCode());
List<HGCW001> list = DaoBase.getInstance().query("HGCW001.getMaxAccountPeriod", params); List<HGCW001> list = DaoBase.getInstance().query("HGCW001.getMaxAccountPeriod", params);
AssertUtils.isEmpty(list, "未找到公司对应的会计期"); AssertUtils.isEmpty(list, "未找到公司有关账状态的会计期,请先业务账期关账!");
return list.get(0);
}
public static HGCW001 getMaxAccountPeriod(Map paramMap) {
AssertUtils.isEmpty(paramMap.get("companyCode").toString(), "公司不能为空!");
Map<String, Object> params = new HashMap<>();
params.put(HGCW001.FIELD_COMPANY_CODE, paramMap.get("companyCode"));
params.put(HGCW001.FIELD_ACCOUNT_PERIOD_STATUS, AccountPeriodStatusEnum.OPEN.getCode());
List<HGCW001> list = DaoBase.getInstance().query("HGCW001.getMaxAccountPeriod", params);
AssertUtils.isEmpty(list, String.format("未找到[%s]有关账状态的会计期,请先业务账期关账!", paramMap.get(HGCW001.FIELD_COMPANY_NAME)));
return list.get(0); return list.get(0);
} }
...@@ -136,14 +150,12 @@ public class HGCWTools { ...@@ -136,14 +150,12 @@ public class HGCWTools {
paramMap.put(HGCW001.FIELD_ACCOUNT_PERIOD, DateUtils.formatShort(accountPeriod.substring(0, 7))); paramMap.put(HGCW001.FIELD_ACCOUNT_PERIOD, DateUtils.formatShort(accountPeriod.substring(0, 7)));
List<HGCW001> list =DaoBase.getInstance().query(HGCW001.QUERY, paramMap); List<HGCW001> list =DaoBase.getInstance().query(HGCW001.QUERY, paramMap);
if (list.size() > 0) { if (list.size() > 0) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); //SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
Date account = formatter.parse(list.get(0).getAccountPeriodDateEnd()); //Date account = formatter.parse(list.get(0).getAccountPeriodDateEnd());
String dateEnd = DateUtil.getLastDayInMonth(account,0,0,DateUtil.DATE10_PATTERN);//DateUtils.yesterdayEnd(dateStart,-1); //String dateEnd = DateUtil.getLastDayInMonth(account,0,0,DateUtil.DATE10_PATTERN);
inInfo.set(HGCW001.FIELD_ACCOUNT_PERIOD_DATE_START, dateEnd); inInfo.set(HGCW001.FIELD_ACCOUNT_PERIOD_DATE_START, DateUtils.yesterdayEnd(list.get(0).getAccountPeriodDateEnd(),1));
}else { }else {
/*获取当前最后时间*/ /*获取当前开始时间*/
//
//
inInfo.set(HGCW001.FIELD_ACCOUNT_PERIOD_DATE_START, (accountPeriodStr.substring(0,7).concat("-01"))); inInfo.set(HGCW001.FIELD_ACCOUNT_PERIOD_DATE_START, (accountPeriodStr.substring(0,7).concat("-01")));
} }
}catch (Exception e){ }catch (Exception e){
......
...@@ -322,7 +322,7 @@ ...@@ -322,7 +322,7 @@
</select> </select>
<select id="queryList" parameterClass="java.util.HashMap" <select id="queryList" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.kc.domain.HGKC007A"> resultClass="com.baosight.hggp.hg.kc.domain.HGKC007B">
SELECT SELECT
A.ACCOUNT_CODE as "accountCode", <!-- 企业编码 --> A.ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
A.DEP_CODE as "depCode", <!-- 部门编码 --> A.DEP_CODE as "depCode", <!-- 部门编码 -->
......
...@@ -91,7 +91,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { ...@@ -91,7 +91,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
* @return * @return
*/ */
public static String yesterdayEnd(String date,Integer day) { public static String yesterdayEnd(String date,Integer day) {
return LocalDate.parse(date).minusDays(day).format(DATE); return LocalDate.parse(date, SHORT_DATE).plusDays(day).format(DATE);
} }
/** /**
* 获取日期字符串(yyyy-MM-dd) * 获取日期字符串(yyyy-MM-dd)
......
...@@ -3,33 +3,43 @@ $(function() { ...@@ -3,33 +3,43 @@ $(function() {
let companyCodeBox = __eiInfo.getBlock("roleCompany").getMappedRows(); let companyCodeBox = __eiInfo.getBlock("roleCompany").getMappedRows();
$(".row").children().attr("class", "col-md-3"); $(".row").children().attr("class", "col-md-3");
$("#inqu_status-0-companyCode").on("change", function () {
let companyCode = $("#inqu_status-0-companyCode");
let textField = IPLAT.EFSelect.text(companyCode);
//let valueField = IPLAT.EFSelect.value(companyCode);
$("#inqu_status-0-companyName").val(textField);
})
$("#CONFIRM").on("click", function () { $("#CONFIRM").on("click", function () {
let companyCode = $("#inqu_status-0-companyCode").val(); let companyCode = $("#inqu_status-0-companyCode").val();
let companyName = $("#inqu_status-0-companyName").val();
if (companyCode.length < 1) { if (companyCode.length < 1) {
message("请选择公司"); message("请选择公司");
return; return;
} }
let hgcw001 = queryHgcw001(companyCode); let flag = true;
let companyName; let hgcw001 = queryHgcw001(companyCode,companyName);
let accountPeriod = hgcw001[0].accountPeriod; if (hgcw001.length <= 0 ){
for (let i = 0; i <companyCodeBox.length ; i++) { flag = false;
if (companyCodeBox[i].companyCode == hgcw001[0].companyCode) { return false;
companyName = companyCodeBox[i].companyName;
break;
}
} }
JSUtils.confirm("确定要对[" + companyName + " 会计期"+accountPeriod+"]做\"数据同步\"操作? ", { if (flag){
ok: function () { let accountPeriod = hgcw001[0].accountPeriod;
parent.JSColorbox.setValueCallback(hgcw001[0]); JSUtils.confirm("确定要对[" + companyName + " 会计期"+accountPeriod+"]做\"数据同步\"操作? ", {
} ok: function () {
}); parent.JSColorbox.setValueCallback(hgcw001[0]);
}
});
}
}); });
}); });
let queryHgcw001 = function (companyCode){ let queryHgcw001 = function (companyCode,companyName){
var hgcw001_block_id =[]; var hgcw001_block_id =[];
let info = new EiInfo(); let info = new EiInfo();
info.set("inqu_status-0-companyCode", companyCode); info.set("inqu_status-0-companyCode", companyCode);
info.set("inqu_status-0-companyName", companyName);
EiCommunicator.send("HGCB002", "selectAll", info, { EiCommunicator.send("HGCB002", "selectAll", info, {
onSuccess: function (ei) { onSuccess: function (ei) {
if (ei.getStatus() >= 0) { if (ei.getStatus() >= 0) {
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<EF:EFOption label="-- 请选择 --" value="" /> <EF:EFOption label="-- 请选择 --" value="" />
<EF:EFOptions blockId="roleCompany" valueField="companyCode" textField="companyName"/> <EF:EFOptions blockId="roleCompany" valueField="companyCode" textField="companyName"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFInput blockId="inqu_status" row="0" ename="companyName" cname="公司名称" colWidth="3" type="hidden" />
</div> </div>
</EF:EFRegion> </EF:EFRegion>
</EF:EFPage> </EF:EFPage>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect blockId="inqu_status" row="0" ename="status" cname="业务类型" colWidth="3" filter="contains"> <EF:EFSelect blockId="inqu_status" row="0" ename="status" cname="业务类型" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.common.yesNo"/> <EF:EFCodeOption codeName="hggp.hgcb.bizType"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="accountPeriod" cname="会计期" colWidth="3" <EF:EFDatePicker blockId="inqu_status" row="0" ename="accountPeriod" cname="会计期" colWidth="3"
format="yyyy-MM" depth="year" start="year" required="true"/> format="yyyy-MM" depth="year" start="year" required="true"/>
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<EF:EFColumn ename="accountPeriod" cname="会计期" enable="false" width="120" align="center" <EF:EFColumn ename="accountPeriod" cname="会计期" enable="false" width="120" align="center"
editType="date" dateFormat="yyyy-MM" parseFormats="['yyyyMM']"/> editType="date" dateFormat="yyyy-MM" parseFormats="['yyyyMM']"/>
<EF:EFComboColumn ename="bizType" cname="业务类型" width="120" enable="false" align="center" required="true"> <EF:EFComboColumn ename="bizType" cname="业务类型" width="120" enable="false" align="center" required="true">
<EF:EFCodeOption codeName="hggp.hgsj.computeType"/> <EF:EFCodeOption codeName="hggp.hgcb.bizType"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="receiptDate" cname="单据日期" width="120" align="center" editType="date" enable="false" <EF:EFColumn ename="receiptDate" cname="单据日期" width="120" align="center" editType="date" enable="false"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="false" required="true"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="false" required="true"/>
......
$(function () { $(function () {
$(".row").children().attr("class", "col-md-3"); $(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query); $("#QUERY").on("click", query);
let companyCodeBox = __eiInfo.getBlock("roleCompany").getMappedRows();
IPLATUI.EFGrid = { IPLATUI.EFGrid = {
"result":{ "result":{
pageable: { pageable: {
...@@ -66,19 +66,21 @@ $(function () { ...@@ -66,19 +66,21 @@ $(function () {
}); });
grid.dataSource.bind("change",function(e){ grid.dataSource.bind("change",function(e){
var item = e.items[0]; var item = e.items[0];
/* if(e.field == "accountYear"){ if(e.field == "companyCode"){
let accountPeriod = currMonth(item.accountYear); for (let i = 0; i < companyCodeBox.length; i++) {
resultGrid.setCellValue(item,'accountPeriod',accountPeriod) if (item.companyCode == companyCodeBox[i].companyCode){
//loadChange(grid,e,"accountPeriod"); resultGrid.setCellValue(item,'companyName',companyCodeBox[i].companyName);
}else */ break;
if(e.field == "accountPeriod"){ }
}
}else if(e.field == "accountPeriod"){
let accountPeriod = dateFormate(item.accountPeriod,"yyyy-MM-dd") let accountPeriod = dateFormate(item.accountPeriod,"yyyy-MM-dd")
let accountPeriodDateStart = queryLast(item.companyCode,accountPeriod); let accountPeriodDateStart = queryLast(item.companyCode,accountPeriod);
resultGrid.setCellValue(item,'accountYear',accountPeriod.substring(0,4)); resultGrid.setCellValue(item,'accountYear',accountPeriod.substring(0,4));
resultGrid.setCellValue(item,'accountPeriodDateStart',dateFormate(new Date(accountPeriodDateStart),"yyyyMMdd")); resultGrid.setCellValue(item,'accountPeriodDateStart',dateFormate(new Date(accountPeriodDateStart),"yyyyMMdd"));
loadChange(grid,e,"accountPeriodDateEnd"); loadChange(grid,e,"accountPeriodDateEnd");
} }
}) })
}, },
onSave: function (e) { onSave: function (e) {
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
filter="contains" readonly="true"> filter="contains" readonly="true">
<EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/> <EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="companyName" cname="公司名称" hidden="true"/>
<EF:EFColumn ename="accountYear" cname="会计年度" enable="false" width="100" align="center" start="decade" depth="decade" <EF:EFColumn ename="accountYear" cname="会计年度" enable="false" width="100" align="center" start="decade" depth="decade"
editType="date" dateFormat="yyyy" parseFormats="['yyyy']" required="true"/> editType="date" dateFormat="yyyy" parseFormats="['yyyy']" required="true"/>
<EF:EFColumn ename="accountPeriod" cname="会计期" readonly="true" width="100" align="center" start="year" depth="year" <EF:EFColumn ename="accountPeriod" cname="会计期" readonly="true" width="100" align="center" start="year" depth="year"
...@@ -38,7 +39,7 @@ ...@@ -38,7 +39,7 @@
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" defaultValue="1"> columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" defaultValue="1">
<EF:EFCodeOption codeName="hggp.cw.accountPeriodStatus"/> <EF:EFCodeOption codeName="hggp.cw.accountPeriodStatus"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="accountPeriodDateStart" cname="账期开始日期" enable="false" width="100" align="center" <EF:EFColumn ename="accountPeriodDateStart" cname="账期开始日期" width="100" align="center"
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/> editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="accountPeriodDateEnd" cname="账期结束日期" width="100" align="center" <EF:EFColumn ename="accountPeriodDateEnd" cname="账期结束日期" width="100" align="center"
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/> editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
......
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