오류수정 : 계산서 즉시발행시 첨부파일이 있으면 발행 후 수정이 안되는 오류가 있어서 발행완료 되나 첨부파일등록 오류로 에러 리턴됨

- 즉시발행 함수에 첨부파일 로직 삭제
- 즉시발행시 첨부파일 있으면 임시저장->발행 순서로 처리하게 로직 수정
This commit is contained in:
lch 2021-07-05 05:15:14 +00:00
parent 5066977cb6
commit fa2df36c09
3 changed files with 91 additions and 54 deletions

View File

@ -253,7 +253,7 @@
}
<a href="#" class="btn btn-danger" onclick="cancelIssue();">발행취소</a>
}
<a href="#" class="btn btn-default" onclick="$('#dform').attr('action', '/croom/tax');golist();">목록</a>
<a href="#" class="btn btn-default" onclick="golist();">목록</a>
</div>
@Html.Partial("./Partial/dform", Model)
</form>
@ -307,9 +307,9 @@
}
function cbsave() {
if (capResult.code == 1000) {
msg("저장되었습니다.", null, null, null, null, "bglayer();rfs(0,'sform');");
msg("저장되었습니다.", null, null, null, null, "rfs(0,'sform');");
} else if (capResult.code == -1) {
msg("이미 발행요청건이 존재합니다.");
msg("이미 발행요청건이 존재합니다.", null, null, null, null, "rfs(0,'sform');");
} else {
msgadmin();
}
@ -319,12 +319,12 @@
}
function cbtempsave() {
if (capResult.code == 1000) {
msg("임시저장되었습니다.", null, null, null, null, "bglayer();rfs(0,'sform');");
msg("임시저장되었습니다.", null, null, null, null, "rfs(0,'sform');");
} else if (capResult.code == -1) {
msg("이미 발행요청건이 존재합니다.");
msg("이미 발행요청건이 존재합니다.", null, null, null, null, "rfs(0,'sform');");
} else {
if (capResult.msg != "") {
msg(capResult.msg);
msg(capResult.msg, null, null, null, null, "rfs(0,'sform');");
} else {
msgadmin();
}
@ -338,10 +338,10 @@
}
function cbcancelIssue() {
if (capResult.code == 1000) {
msg("발행취소되었습니다.", null, null, null, null, "bglayer();rfs(0,'sform');");
msg("발행취소되었습니다.", null, null, null, null, "rfs(0,'sform');");
} else {
if (capResult.msg != "") {
msg(capResult.msg);
msg(capResult.msg, null, null, null, null, "rfs(0,'sform');");
} else {
msgadmin();
}
@ -354,12 +354,12 @@
}
function cbIssue() {
if (capResult.code == 1000) {
msg("발행되었습니다.", null, null, null, null, "bglayer();rfs(0,'sform');");
msg("발행되었습니다.", null, null, null, null, "rfs(0,'sform');");
} else if (capResult.code == -1) {
msg("이미 발행요청건이 존재합니다.");
msg("이미 발행요청건이 존재합니다.", null, null, null, null, "rfs(0,'sform');");
} else {
if (capResult.msg != "") {
msg(capResult.msg);
msg(capResult.msg, null, null, null, null, "rfs(0,'sform');");
} else {
msgadmin();
}
@ -372,12 +372,12 @@
}
function cbregistIssue() {
if (capResult.code == 1000) {
msg("즉시발행되었습니다.", null, null, null, null, "bglayer();rfs(0,'sform');");
msg("즉시발행되었습니다.", null, null, null, null, "rfs(0,'sform');");
} else if (capResult.code == -1) {
msg("이미 발행요청건이 존재합니다.");
msg("이미 발행요청건이 존재합니다.", null, null, null, null, "rfs(0,'sform');");
} else {
if (capResult.msg != "") {
msg(capResult.msg);
msg(capResult.msg, null, null, null, null, "rfs(0,'sform');");
} else {
msgadmin();
}

View File

@ -842,7 +842,7 @@ namespace NP.Base.Controllers
payTax.udt = DateTime.Now;
if (string.IsNullOrEmpty(payTax.mgtkey))
{
payTax.mgtkey = Popbill.PopbillService.MakeMgtKey(Dao, payTax.udt);
payTax.mgtkey = Popbill.PopbillService.MakeMgtKey(Dao, payTax.taxno, payTax.udt);
}
if (Dao.Save("cr.paytax.save", payTax) > 0)
@ -922,13 +922,35 @@ namespace NP.Base.Controllers
payTax.udt = DateTime.Now;
if (string.IsNullOrEmpty(payTax.mgtkey))
{
payTax.mgtkey = Popbill.PopbillService.MakeMgtKey(Dao, payTax.udt);
payTax.mgtkey = Popbill.PopbillService.MakeMgtKey(Dao,payTax.taxno, payTax.udt);
}
if (Dao.Save("cr.paytax.save", payTax) > 0)
{
var payItems = Dao.Get<PayItem>("cr.paytaxitem2", new System.Collections.Hashtable() { { "taxno", payTax.taxno } });
//첨부파일이 있으면 임시저장 후 발행처리
if(payTax.fgno != null && payTax.fgno != 0)
{
var result = Popbill.PopbillService.TempSave(Dao, payTax, payItems);
if (result.IsSuccess)
{
var resultIssue = Popbill.PopbillService.Issue(payTax.mgtkey);
if (resultIssue.IsSuccess)
{
return JsonOK(resultIssue.Code);
}
else
{
return JsonError(JSONCode.Error, resultIssue.Message, resultIssue);
}
}
else
{
return JsonError(JSONCode.Error, result.Message, result);
}
}
else
{
var result = Popbill.PopbillService.RegistIssue(Dao, payTax, payItems);
if (result.IsSuccess)
{
@ -939,6 +961,7 @@ namespace NP.Base.Controllers
return JsonError(JSONCode.Error, result.Message, result);
}
}
}
return JsonOK(0);
}
#endregion
@ -955,6 +978,13 @@ namespace NP.Base.Controllers
payTax.uno = SUserInfo.UserNo; payTax.uip = GetUserIP();
payTax.iscancel = 1;
//mgtkey 발급여부 체크
var nowPayTax = Dao.Get<PayTax>("cr.paytaxes", new Hashtable() { { "taxno", payTax.taxno } }).FirstOrDefault();
if (nowPayTax != null && !string.IsNullOrEmpty(nowPayTax.mgtkey))
{
payTax.mgtkey = nowPayTax.mgtkey;
}
if (!string.IsNullOrEmpty(payTax.mgtkey))
{
var taxinvoice = Popbill.PopbillService.GetTaxinvoice(payTax).Data;

View File

@ -19,13 +19,22 @@ namespace NP.Base.Popbill
/// 세금계산서 mgtKey(문서번호) 생성
/// </summary>
/// <param name="Dao">CommonDao</param>
/// <param name="taxno">PayTax.taxno</param>
/// <param name="writeDate">발행일</param>
/// <param name="keyType">세금계산서 유형 : SELL = 매출, BUY = 매입, TRUSTEE = 위수탁</param>
/// <returns>mgtKey</returns>
public static string MakeMgtKey(CommonDao Dao, DateTime writeDate, MgtKeyType keyType = MgtKeyType.SELL)
public static string MakeMgtKey(CommonDao Dao, long taxno, DateTime writeDate, MgtKeyType keyType = MgtKeyType.SELL)
{
int no = 1;
string mgtkey = string.Empty;
var nowPayTax = Dao.Get<PayTax>("cr.paytaxes", new Hashtable() { { "taxno", taxno } }).FirstOrDefault();
//이미 mgtkey 발급되어 있으면 발급된 mgtkey 사용
if (nowPayTax != null && !string.IsNullOrEmpty(nowPayTax.mgtkey))
{
mgtkey = nowPayTax.mgtkey;
}
else
{
var payTax = Dao.Get<PayTax>("cr.paytax.formgtkey", new Hashtable() { { "writeDate", writeDate } }).FirstOrDefault();
if (payTax != null && !string.IsNullOrEmpty(payTax.mgtkey))
{
@ -37,7 +46,7 @@ namespace NP.Base.Popbill
}
}
string mgtkey = $"{writeDate:yyyy-MM-dd}-L{no:D5}";
mgtkey = $"{writeDate:yyyy-MM-dd}-L{no:D5}";
bool isUse = true;
int checkLimit = 50;
@ -49,10 +58,13 @@ namespace NP.Base.Popbill
++no;
mgtkey = $"{writeDate:yyyy-MM-dd}-L{no:D5}";
}
else
{
break;
}
--checkLimit;
}
}
return mgtkey;
}
#endregion
@ -402,11 +414,6 @@ namespace NP.Base.Popbill
result.Data = PopbillConfig.taxinvoiceService.RegistIssue(PopbillConfig.CorpNum, taxinvoice, forceIssue, memo);
result.Code = result.Data.code;
result.Message = result.Data.message;
if (result.Data.code == 1)
{
AttachFile(Dao, payTax, keyType);
}
}
catch (PopbillException ex)
{