Commit db39ec9a by liuyang

2024-07-23 修复采购开票审批逻辑判断和开票逻辑

parent 33e7b5aa
package com.baosight.hggp.common;
/**
* @author LiuYang
* @version 1.0 2024/7/23
*/
public enum ReviewStatusEnum {
/**
* 0:未审核
*/
UNREVIEWED(0, "未审核"),
/**
* 1:已审核
*/
REVIEWED(1, "已审核"),
/**
* 2:未提交
*/
UNSUBMITTED(2, "未提交"),
/**
* 3:已提交
*/
SUBMITTED(3, "已提交"),
;
private Integer code;
private String desc;
ReviewStatusEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public static String getDesc(Integer code) {
for (ReviewStatusEnum reviewStatusEnum : ReviewStatusEnum.values()) {
if (reviewStatusEnum.getCode().equals(code)) {
return reviewStatusEnum.getDesc();
}
}
return null;
}
public static Integer getCode(String desc) {
for (ReviewStatusEnum reviewStatusEnum : ReviewStatusEnum.values()) {
if (reviewStatusEnum.getDesc().equals(desc)) {
return reviewStatusEnum.getCode();
}
}
return null;
}
}
...@@ -101,7 +101,7 @@ public class HGCW012 extends DaoEPBase { ...@@ -101,7 +101,7 @@ public class HGCW012 extends DaoEPBase {
private String settlementNumber = " "; /* 来源单号*/ private String settlementNumber = " "; /* 来源单号*/
private Integer billTybe = new Integer(0); /* 票据类型*/ private Integer billTybe = new Integer(0); /* 票据类型*/
private String billNumber = " "; /* 发票号*/ private String billNumber = " "; /* 发票号*/
private Integer billState = new Integer(0); /* 开票状态*/ private Integer billState = new Integer(0); /* 开票状态 0:未开票 1:已开票*/
private String signingDate = " "; /* 开票日期*/ private String signingDate = " "; /* 开票日期*/
private String partyA = " "; /* 供应商名称*/ private String partyA = " "; /* 供应商名称*/
private Integer reviewStatus = new Integer(0); /* 审批状态*/ private Integer reviewStatus = new Integer(0); /* 审批状态*/
......
...@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.cw.service; ...@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.cw.service;
import com.baosight.eplat.utils.StringUtils; import com.baosight.eplat.utils.StringUtils;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.ReviewStatusEnum;
import com.baosight.hggp.core.dao.DaoBase; import com.baosight.hggp.core.dao.DaoBase;
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;
...@@ -85,22 +86,29 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -85,22 +86,29 @@ public class ServiceHGCW012 extends ServiceBase {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据 // 写入数据
for (Map resultRow : resultRows) { for (Map resultRow : resultRows) {
HGCW012 HGCW012 = new HGCW012(); HGCW012 hgcw012 = new HGCW012();
HGCW012.fromMap(resultRow); hgcw012.fromMap(resultRow);
UserVO userVO = HGCWTools.HgCw002.getUserCompany(); //UserVO userVO = HGCWTools.HgCw002.getUserCompany();
HGCW012.setCompanyCode(userVO.getUsercode()); //hgcw012.setCompanyCode(userVO.getUsercode());
HGCW012.setCompanyName(userVO.getUsername()); //hgcw012.setCompanyName(userVO.getUsername());
HGCW012.setBillState(1);
HGCW012.setReviewStatus(0);
HGCW012.setSigningDate(DateUtils.formatShort(HGCW012.getSigningDate()));
// 获取项目名称 // 获取项目名称
//HGSC001 HGSC001 = HGSCTools.Hgsc001.queryByCode(HGCW012.getProjCode()); //HGSC001 HGSC001 = HGSCTools.Hgsc001.queryByCode(HGCW012.getProjCode());
//HGCW012.setProjName(HGSC001.getProjName()); //HGCW012.setProjName(HGSC001.getProjName());
if (HGCW012.getId() == null || HGCW012.getId() == 0) { String signingDate = DateUtils.formatShort(hgcw012.getSigningDate());
this.add(HGCW012); String billState = hgcw012.getBillNumber();
if (StringUtils.isNotNull(billState)) {
hgcw012.setSigningDate(signingDate);
hgcw012.setBillState(1);
}
if (hgcw012.getReviewStatus().equals(ReviewStatusEnum.REVIEWED.getCode())){
throw new PlatException("该数据已审核,不能保存!");
}
if (hgcw012.getId() == null || hgcw012.getId() == 0) {
hgcw012.setReviewStatus(ReviewStatusEnum.UNREVIEWED.getCode());
this.add(hgcw012);
} else { } else {
this.modify(HGCW012); this.modify(hgcw012);
this.updateHGCW013(HGCW012); this.updateHGCW013(hgcw012);
} }
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
...@@ -194,7 +202,7 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -194,7 +202,7 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setCompanyCode(userVO.getUsercode()); hgcw012.setCompanyCode(userVO.getUsercode());
hgcw012.setCompanyName(userVO.getUsername()); hgcw012.setCompanyName(userVO.getUsername());
hgcw012.setReviewStatus(0); hgcw012.setReviewStatus(0);
hgcw012.setBillState(1); hgcw012.setBillState(0);
hgcw012.setBillTybe(1); hgcw012.setBillTybe(1);
hgcw012.setContractType(2); hgcw012.setContractType(2);
//hgcw012.setSigningDate(DateUtils.shortDate()); //hgcw012.setSigningDate(DateUtils.shortDate());
...@@ -293,7 +301,7 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -293,7 +301,7 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setCompanyCode(userVO.getUsercode()); hgcw012.setCompanyCode(userVO.getUsercode());
hgcw012.setCompanyName(userVO.getUsername()); hgcw012.setCompanyName(userVO.getUsername());
hgcw012.setReviewStatus(0); hgcw012.setReviewStatus(0);
hgcw012.setBillState(1); hgcw012.setBillState(0);
hgcw012.setBillTybe(1); hgcw012.setBillTybe(1);
hgcw012.setContractType(1); hgcw012.setContractType(1);
//hgcw012.setSigningDate(DateUtils.shortDate()); //hgcw012.setSigningDate(DateUtils.shortDate());
...@@ -389,7 +397,7 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -389,7 +397,7 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setCompanyCode(userVO.getUsercode()); hgcw012.setCompanyCode(userVO.getUsercode());
hgcw012.setCompanyName(userVO.getUsername()); hgcw012.setCompanyName(userVO.getUsername());
hgcw012.setReviewStatus(0); hgcw012.setReviewStatus(0);
hgcw012.setBillState(1); hgcw012.setBillState(0);
hgcw012.setBillTybe(1); hgcw012.setBillTybe(1);
hgcw012.setContractType(3); hgcw012.setContractType(3);
//hgcw012.setSigningDate(DateUtils.shortDate()); //hgcw012.setSigningDate(DateUtils.shortDate());
...@@ -496,17 +504,19 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -496,17 +504,19 @@ public class ServiceHGCW012 extends ServiceBase {
public EiInfo submit(EiInfo inInfo){ public EiInfo submit(EiInfo inInfo){
try { try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) { for (Map resultRow : resultRows) {
HGCW012 hgcw012 = new HGCW012(); HGCW012 hgcw012 = new HGCW012();
hgcw012.fromMap(resultRows.get(i)); hgcw012.fromMap(resultRow);
hgcw012.setReviewStatus(1); if (hgcw012.getBillState() == 0) {
throw new PlatException("数据未开票,请先开票!");
}
hgcw012.setReviewStatus(ReviewStatusEnum.REVIEWED.getCode());
DaoUtils.update("HGCW012.submit", hgcw012); DaoUtils.update("HGCW012.submit", hgcw012);
} }
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据审核成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据审核成功!");
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "审核失败,发票类型未选!"); LogUtils.setDetailMsg(inInfo, e, "审核失败");
} }
return inInfo; return inInfo;
} }
......
...@@ -29,7 +29,7 @@ $(function() { ...@@ -29,7 +29,7 @@ $(function() {
$("#B_SAVE").on("click",saveFunc); $("#B_SAVE").on("click",saveFunc);
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 == "taxPoints"){ if(e.field === "taxPoints"){
if(item.thisSettlementTax && item.totalContractPriceIncluding){ if(item.thisSettlementTax && item.totalContractPriceIncluding){
let thisSettlementAmount = item.totalContractPriceIncluding / (item.taxPoints / 100 + 1); let thisSettlementAmount = item.totalContractPriceIncluding / (item.taxPoints / 100 + 1);
// 使用toFixed方法四舍五入到两位小数,并转换为数字 // 使用toFixed方法四舍五入到两位小数,并转换为数字
...@@ -42,6 +42,11 @@ $(function() { ...@@ -42,6 +42,11 @@ $(function() {
thisSettlementTax = Number(thisSettlementTax.toFixed(2)); thisSettlementTax = Number(thisSettlementTax.toFixed(2));
resultGrid.setCellValue(item,'thisSettlementTax',thisSettlementTax) resultGrid.setCellValue(item,'thisSettlementTax',thisSettlementTax)
} }
}else if(e.field === "billNumber"){
if(isBlank(item.signingDate)){
resultGrid.setCellValue(item,'signingDate',currShortDate())
}
} }
}) })
}, },
...@@ -99,8 +104,14 @@ function saveFunc() { ...@@ -99,8 +104,14 @@ function saveFunc() {
let flag = true; let flag = true;
$.each(rows, function(index, item) { $.each(rows, function(index, item) {
let reviewStatus= item.get("reviewStatus"); let reviewStatus= item.get("reviewStatus");
let signingDate = item.get("signingDate");
if((reviewStatus === "1")){ if((reviewStatus === "1")){
message("数据已审核"); message("数据已审核,");
flag = false;
return false;
}
if(isBlank(signingDate)){
message("数据未签单,");
flag = false; flag = false;
return false; return false;
} }
...@@ -194,16 +205,12 @@ function submitFunc() { ...@@ -194,16 +205,12 @@ function submitFunc() {
EiCommunicator.send("HGCW012", "submit", info, { EiCommunicator.send("HGCW012", "submit", info, {
onSuccess: function (ei) { onSuccess: function (ei) {
if (ei.getStatus() >= 0) { if (ei.getStatus() >= 0) {
try {
query();
} catch (e) {
// TODO: handle exception
}
if (ei.getStatus() == 0) { if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning'); NotificationUtil(ei, 'warning');
} else { } else {
NotificationUtil(ei); NotificationUtil(ei);
} }
query();
} else { } else {
NotificationUtil(ei, "error"); NotificationUtil(ei, "error");
} }
......
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