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