mahao 1 year ago
parent
commit
634f1154c4
  1. 12
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-input.js
  2. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js
  3. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/table/index.js
  4. 29
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/bei-jian.js
  5. 33
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js
  6. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
  7. 25
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs
  8. 56
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs
  9. 32
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs
  10. 395
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
  11. 24
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs
  12. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs
  13. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs
  14. 577
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
  15. 19
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs
  16. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs
  17. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs
  18. 303
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  19. 456
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
  20. 44
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs
  21. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_NOT_SA_SERVICE.cs
  22. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  23. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PURCHASE_PRICE_SERVICE.cs
  24. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs
  25. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/TB_RePartsRelationship_SERVICE.cs
  26. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs
  27. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs
  28. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs
  29. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs
  30. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs
  31. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs
  32. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs
  33. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs
  34. 27
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  35. 84
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs
  36. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs
  37. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs
  38. 5793
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230909013408_202309090001.Designer.cs
  39. 178
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230909013408_202309090001.cs
  40. 25
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

12
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-input.js

@ -19,17 +19,17 @@ export default {
</template>
</template>
<template v-else>
<template v-if="getInput(schema)==='select'">
<el-select v-model="model[prop]" :placeholder="schema.placeholder??schema.title" :multiple="!!schema.multiple" :clearable="!!schema.clearable">
<el-option v-for="item in options" :key="item.key" :label="item.label" :value="item.value" />
</el-select>
</template>
<template v-else-if="getInput(schema)==='tabs'">
<template v-if="getInput(schema)==='tabs'&&mode==='query'">
<el-tabs type="card" v-model="model[prop]" style="height:24px;margin:0;" class="form">
<el-tab-pane label="全部" key="all" :name="''" />
<el-tab-pane v-for="item in options" :label="item.label" :name="item.value" />
</el-tabs>
</template>
<template v-else-if="getInput(schema)==='select'||getInput(schema)==='tabs'">
<el-select v-model="model[prop]" :placeholder="schema.placeholder??schema.title" :multiple="!!schema.multiple" :clearable="!!schema.clearable">
<el-option v-for="item in options" :key="item.key" :label="item.label" :value="item.value" />
</el-select>
</template>
<template v-else-if="getInput(schema)==='month'||getInput(schema)==='datetime'||getInput(schema)==='datetimerange'">
<el-date-picker v-model="model[prop]" :type="schema.input" :value-format="schema.format??'YYYY-MM-DD HH:mm:ss'" :clearable="!!schema.clearable" />
</template>

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js

@ -25,7 +25,7 @@ export default {
<template v-for="item in filterList.filter(o=>!o.hidden&&o.readOnly)">
<template v-if="config.edit.schema.properties[item.column]?.title">
<el-form-item :label="item.title??config.edit.schema.properties[item.column].title">
<app-form-input v-model="item" :schema="config.edit.schema.properties[item.column]" prop="value" />
<app-form-input v-model="item" :schema="config.edit.schema.properties[item.column]" prop="value" mode="query" />
</el-form-item>
</template>
<div v-else>{{item.column}}</div>

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/table/index.js

@ -18,7 +18,7 @@ export default {
</template>
</template>
<div class="cell el-table__cell" :class="key" v-else-if="!item.hidden">
<div class="cell">{{item.title}}</div>
<div class="cell">{{item.title}} <template v-if="data.length&&item.reduce">:{{data.map(o=>o[key]).reduce(item.reduce)}}</template></div>
</div>
</template>
</div>

29
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/bei-jian.js

@ -12,11 +12,15 @@ const schema = {
},
beginDate: {
title: "开始时间",
type: "DateTime",
type: "string",
input: "datetime",
clearable: true,
},
endDate: {
title: "结束时间",
type: "DateTime",
type: "string",
input: "datetime",
clearable: true,
},
clientCode: {
title: "客户编码",
@ -72,6 +76,20 @@ export default function () {
},
},
default: [
{
logic: "and",
column: "beginDate",
action: "biggerThanOrEqual",
value: null,
readOnly: true,
},
{
logic: "and",
column: "endDate",
action: "smallThanOrEqual",
value: null,
readOnly: true,
},
{
logic: "and",
column: "lu",
@ -79,6 +97,13 @@ export default function () {
value: null,
readOnly: true,
},
{
logic: "and",
column: "contractNo",
action: "like",
value: null,
readOnly: true,
},
],
},
skipCount: {

33
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js

@ -87,7 +87,7 @@ export default {
</el-col>
<el-col :span="12" style="height:100%;padding:0 0 0 5px;">
<el-scrollbar>
<app-table ref="setup2table2Ref" :data="adjList" :columns="setup2columns" />
<app-table ref="setup2table2Ref" :data="adjList2" :columns="setup2columns" />
</el-scrollbar>
</el-col>
</el-row>
@ -97,16 +97,17 @@ export default {
<el-col style="height:100%;padding:0 5px 0 0;">
<el-scrollbar>
<el-tabs style="height:100%;">
<template v-for="item in setup3Model.items">
<el-tab-pane :label="item.invbillNum">
<template v-for="item in setup3Model">
<el-tab-pane :label="item.invbillNum??'null'">
<el-descriptions border>
<el-descriptions-item label="发票号">{{item.invbillNum}}</el-descriptions-item>
<el-descriptions-item label="业务类型">{{businessTypes.options.find(o=>o.value===item.businesType)?.label}}</el-descriptions-item>
<el-descriptions-item label="未税金额">{{item.tax}}</el-descriptions-item>
<el-descriptions-item label="税额">{{item.businesType}}</el-descriptions-item>
<el-descriptions-item label="税率">{{item.businesType}}</el-descriptions-item>
<el-descriptions-item label="未税金额">{{item.amt}}</el-descriptions-item>
<el-descriptions-item label="税后金额">{{item.taxAmt}}</el-descriptions-item>
<el-descriptions-item label="税额">{{item.realAmt }}</el-descriptions-item>
<el-descriptions-item label="税率">{{item.tax}}</el-descriptions-item>
</el-descriptions>
<app-table v-if="item.detail" :data="item.detail" :columns="setup2columns" />
<app-table :data="item.detail" :columns="setup2columns" />
</el-tab-pane>
</template>
</el-tabs>
@ -188,7 +189,7 @@ export default {
height: calc(100% - 120px);
}
.cell.diff {
background: yellow;
background: orangered;
}
</style>`,
props: ["modelValue", "row", "data", "isBusiness", "businessType"],
@ -374,10 +375,12 @@ export default {
qty: {
type: "number",
title: "数量",
reduce: (x, y) => x + y,
},
amt: {
type: "number",
title: "金额",
reduce: (x, y) => x + y,
},
},
};
@ -416,15 +419,14 @@ export default {
const setupDialogVisable = ref(false);
const setupRef = ref(1);
const adjList = ref([]);
const adjList2 = ref([]);
const scrollRef = ref(null);
const adjListRef = ref(null);
const addDialogVisible = ref(false);
const importDialogVisible = ref(false);
const setup2table1Ref = ref(null);
const setup2table2Ref = ref(null);
const setup3Model = ref({
detail: [],
});
const setup3Model = ref(null);
const showSetupDialog = () => {
//重开发票号
//invBillNum=
@ -584,9 +586,9 @@ export default {
// setupRef.value += 1;
// return; //临时
//发到服务的校验
const result = await request(`settleaccount/adj_service/check-import`, adjList.value, { method: "POST" });
const result = await request(`settleaccount/${service}/reissue-invoice-list`, adjList.value, { method: "POST" });
if (!result.errors) {
adjList.value = result.data.data;
adjList2.value = result.data.data;
setupRef.value += 1;
//处理高亮
nextTick(() => {
@ -612,11 +614,11 @@ export default {
console.log(e);
}
} else if (setupRef.value === 2) {
const url = `settleaccount/${service}/reissue-invoice-list`;
const url = `settleaccount/${service}/reissue-invoice-list-ext`;
const result = await request(url, adjList.value, { method: "POST" });
if (!result.errors) {
//setup3的数据来源
setup3Model.value = result.data;
setup3Model.value = result.data.data;
setupRef.value += 1;
} else if (result.data?.code === 400 && result.data.fileName) {
window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`));
@ -670,6 +672,7 @@ export default {
setupRef,
setupDialogVisable,
adjList,
adjList2,
adjListRef,
deleteAdj,
showAddAdjDialog,

6
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs

@ -90,7 +90,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[Display(Name = "税后金额")]
public decimal TaxAmt { get; set; }
[Display(Name = "发票金额")]
[Display(Name = "税额")]
public decimal RealAmt { get; set; }
/// <summary>
///发票分组号
@ -103,7 +103,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[Display(Name = "业务类别")]
public EnumBusinessType BusinessType { get; set; }
public List<INVOICE_WAIT_DETAIL_DTO> DETIAL { set; get; }
public List<INVOICE_WAIT_DETAIL_DTO> DETAIL { set; get; }
}
public class INVOICE_GRP_EXP_DTO
@ -657,7 +657,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public string LU { get; set; }
[Display(Name = "数量")]
public string Qty { get; set; }
public decimal? Qty { get; set; }
/// <summary>
///不可结算零件号
/// </summary>

25
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs

@ -133,7 +133,7 @@ public class ADJ_SERVICE : BASE_SERVICE
errorList.Add(
new ErrorExportDto() { ItemCode = $"{itm}", Message = $"[客户零件关系表]不存在客户零件号{itm}" });
}
var errorEntitylist = await _baseDomainService.CheckPriceList(entityList);
var errorEntitylist = await _baseDomainService.CheckPriceList(entityList,"1040");
if (errorEntitylist.Count > 0)
{
foreach (var itm in errorEntitylist)
@ -178,7 +178,7 @@ public class ADJ_SERVICE : BASE_SERVICE
/// <exception cref="BusinessException"></exception>
[HttpPost]
[DisableRequestSizeLimit]
public async Task<IActionResult> CheckImport(List<PUB_ADJ_DETAIL_DTO> p_list)
public async Task<string> CheckImport(List<PUB_ADJ_DETAIL_DTO> p_list)
{
if (p_list.Count == 0)
{
@ -193,10 +193,14 @@ public class ADJ_SERVICE : BASE_SERVICE
int flag = 0;
var keylist = p_list.Select(p => p.KeyCode).Distinct();
List<ERR_EXP_DTO> errorList = new List<ERR_EXP_DTO>();
//var inv = _invRepository.Where(p => p.InvbillNum == first.InvBillNum).FirstOrDefault();
var first = p_list.FirstOrDefault();
var inv = _invRepository.Where(p => p.InvbillNum == first.InvBillNum).FirstOrDefault();
if (first != null)
{
var inv = _invRepository.Where(p => p.InvbillNum == first.InvBillNum).FirstOrDefault();
string keyname = string.Empty;
List<PUB_ADJ_DETAIL> adjlist = new List<PUB_ADJ_DETAIL>();
@ -257,6 +261,10 @@ public class ADJ_SERVICE : BASE_SERVICE
}
}
var entityList = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list);
var codelist = entityList.Select(p => p.LU).ToList();
var errors = await _baseDomainService.CheckBase(codelist, new BASE_CONF() { IsRelationShip = true });
@ -265,7 +273,7 @@ public class ADJ_SERVICE : BASE_SERVICE
errorList.Add(
new ERR_EXP_DTO() { ItemCode = $"{itm}", Message = $"[客户零件关系表]不存在客户零件号{itm}" });
}
var errorEntitylist = await _baseDomainService.CheckPriceList(entityList);
var errorEntitylist = await _baseDomainService.CheckPriceList(entityList,inv.Site);
if (errorEntitylist.Count > 0)
{
foreach (var itm in errorEntitylist)
@ -275,8 +283,7 @@ public class ADJ_SERVICE : BASE_SERVICE
}
if (errorList.Count > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorList) });
return await ExportErrorReportAsync(errorList) ;
}
List<PUB_ADJ_DETAIL_DTO> ls = new List<PUB_ADJ_DETAIL_DTO>();
if (flag == 1)
@ -287,7 +294,7 @@ public class ADJ_SERVICE : BASE_SERVICE
var inner = from d in p_list
join p in pricebjlist on d.LU equals p.LU
where
d.SettleDate >= p.BeginDate && d.SettleDate <= p.EndDate
d.SettleDate >= p.BeginDate && d.SettleDate <= p.EndDate
select
new PUB_ADJ_DETAIL_DTO()
{
@ -310,7 +317,7 @@ public class ADJ_SERVICE : BASE_SERVICE
var inner = from d in p_list
join p in pricelist on d.LU equals p.LU
where
d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.ClientCode== inv.Site
select new PUB_ADJ_DETAIL_DTO()
{
InvBillNum = d.InvBillNum,
@ -325,7 +332,7 @@ public class ADJ_SERVICE : BASE_SERVICE
ls = inner.ToList();
}
return new JsonResult(new { Code = 200, data =ls }); ;
return "OK" ;
}
}

56
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs

@ -164,28 +164,28 @@ namespace Win.Sfs.SettleAccount.Bases
var wquery = from itm in AMap
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp
select from tm in temp.DefaultIfEmpty()
select
new INVOICE_WAIT_DETAIL_BBAC_DTO()
{
PartDesc=tm==null?string.Empty:itm.PartDesc,
InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version,
InvbillNum = itm.InvbillNum,
InvGroupNum = itm.InvGroupNum,
LU = itm.LU,
PartCode = itm.PartCode,
PRICE = itm.PRICE,
Qty = itm.Qty,
Amt = itm.Amt,
BussiessType = itm.BussiessType,
Extend1 = itm.Extend1,
BeginDate = itm.BeginDate,
EndDate = itm.EndDate,
};
entity.INVOICE_WAIT_DETAIL_BBAC = AMap;
from tm in temp.DefaultIfEmpty()
select
new INVOICE_WAIT_DETAIL_BBAC_DTO()
{
PartDesc = tm == null ? string.Empty : itm.PartDesc,
InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version,
InvbillNum = itm.InvbillNum,
InvGroupNum = itm.InvGroupNum,
LU = itm.LU,
PartCode = itm.PartCode,
PRICE = itm.PRICE,
Qty = itm.Qty,
Amt = itm.Amt,
BussiessType = itm.BussiessType,
Extend1 = itm.Extend1,
BeginDate = itm.BeginDate,
EndDate = itm.EndDate,
};
entity.INVOICE_WAIT_DETAIL_BBAC = wquery.ToList();
}
else if (invs.FirstOrDefault().BusinessType == EnumBusinessType.BeiJian)
{
@ -195,7 +195,7 @@ namespace Win.Sfs.SettleAccount.Bases
var wquery = from itm in BMap
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp
select from tm in temp.DefaultIfEmpty()
from tm in temp.DefaultIfEmpty()
select
new INVOICE_WAIT_DETAIL_BJ_DTO()
{
@ -215,7 +215,7 @@ namespace Win.Sfs.SettleAccount.Bases
BeginDate = itm.BeginDate,
EndDate = itm.EndDate,
};
entity.INVOICE_WAIT_DETAIL_BJ = BMap;
entity.INVOICE_WAIT_DETAIL_BJ = wquery.ToList();
}
else
{
@ -224,7 +224,7 @@ namespace Win.Sfs.SettleAccount.Bases
var wquery = from itm in wdtos
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp
select from tm in temp.DefaultIfEmpty()
from tm in temp.DefaultIfEmpty()
select
new INVOICE_WAIT_DETAIL_DTO()
{
@ -473,7 +473,7 @@ namespace Win.Sfs.SettleAccount.Bases
throw new BusinessException("8989", "生成失败,请检查调整表和旧发票内容");
}
[UnitOfWork(false)]
/// <summary>
/// hbpo、jit、备件等
/// </summary>
@ -493,7 +493,7 @@ namespace Win.Sfs.SettleAccount.Bases
}
[UnitOfWork(false)]
/// <summary>
/// 第一次开票
/// </summary>
@ -550,7 +550,7 @@ namespace Win.Sfs.SettleAccount.Bases
var inner = from d in dto1s
join p in p_pricelist on d.LU equals p.LU
where
d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && d.Site==p.ClientCode && p.IsCancel==false
select d;
var left = from d in dto1s
join p in inner on new { d.LU, d.PN } equals new { p.LU, p.PN }

32
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs

@ -256,19 +256,45 @@ namespace Win.Sfs.SettleAccount.Bases
/// <param name="dto1s"></param>
/// <param name="p_pricelist"></param>
/// <returns></returns>
protected async Task<List<ERR_EXP_DTO>> CheckInvoiceGenerationRules<T>(List<T> dto1s, List<PriceList> p_pricelist,EnumBusinessType p_businessType) where T : SA_CAN_BASE
protected async Task<List<ERR_EXP_DTO>> CheckInvoiceGenerationRules<T>(List<T> dto1s,string p_site, List<PriceList> p_pricelist,EnumBusinessType p_businessType) where T : SA_CAN_BASE
{
//var maxDate = p_pricelist.Max(p => p.Date);
var prices = p_pricelist.Where(p =>p.ClientCode==p_site && p.IsCancel == false).ToList();
var inner = from d in dto1s
join p in p_pricelist on d.LU equals p.LU
join p in prices on d.LU equals p.LU
where
d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.ClientCode==d.Site && p.IsCancel == false
select d;
var ls = inner.ToList();
var left = from d in dto1s
join p in inner on new { d.LU, d.PN } equals new { p.LU, p.PN }
into temp
from tm in temp.DefaultIfEmpty()//校验错误项
where tm == null
select d;
//var maxDate = p_pricelist.Max(p => p.Date);
//var left = from a in dto1s
// join b in (from p in p_pricelist
// where p.Date == maxDate
// select p) on a.LU equals b.LU into joinedResult
// from jr in joinedResult.DefaultIfEmpty()
// where a.SettleDate >= jr.BeginTime && a.SettleDate <= jr.EndTime && jr.LU == null
// select a;
List<ERR_EXP_DTO> errorList = new List<ERR_EXP_DTO> ();
string name = string.Empty;
string keyname = string.Empty;

395
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs

@ -1,4 +1,5 @@
using DocumentFormat.OpenXml.Drawing.Charts;
using DocumentFormat.OpenXml.Spreadsheet;
using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
@ -15,6 +16,7 @@ using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
@ -40,7 +42,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
private readonly ADJ_SERVICE _adjservice;
public BBAC_BA_SERVICE(IExcelImportAppService excelImportService,
@ -58,8 +60,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
INV_MNG invMng,
TaskJobService service,
BaseDomainService baseservice,
INormalEfCoreRepository<PriceList, Guid> priceRepository
INormalEfCoreRepository<PriceList, Guid> priceRepository,
ADJ_SERVICE adjservice
) : base(
excelImportService,
@ -78,6 +81,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
baseservice)
{
_priceRepository = priceRepository;
_adjservice = adjservice;
}
@ -149,24 +153,21 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();
//var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算
var priceList = _priceRepository.ToList();//价格单
priceList.GroupBy(p => new { p.BeginTime, p.EndTime }).Select(p => p.First());
var priceList = _priceRepository.Where(p=>p.IsCancel==false).ToList();//价格单
// priceList.GroupBy(p => new { p.BeginTime, p.EndTime }).Select(p => p.First());
var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
if (errorList.Count() > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorList) });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode,Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) });
}
var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && d.Site==p.ClientCode && p.IsCancel == false && p.ClientCode == inv.Site//客户零件号
select new TEMP_CAN_SA_DETAIL
{
Id = d.Id,
@ -215,6 +216,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
[HttpPost]
[UnitOfWork(false)]
/// <summary>
/// 发票重开
/// </summary>
@ -285,16 +287,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();
//var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算
var priceList = _priceRepository.ToList();//价格单
var errorList =await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
if (errorList.Count() > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorList) });
}
//var errorList =await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
//if (errorList.Count() > 0)
//{
//return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) });
//}
var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号
join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.ClientCode==inv.Site && p.IsCancel==false//客户零件号
select new TEMP_CAN_SA_DETAIL
{
Id=d.Id,
@ -343,15 +344,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
[HttpPost]
[UnitOfWork(false)]
/// <summary>
/// 发票重开列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public virtual async Task<INVOICE_REPEAT_DTO> ReissueInvoiceList(List<PUB_ADJ_DETAIL_DTO> p_list)
public virtual async Task<IActionResult> ReissueInvoiceList(List<PUB_ADJ_DETAIL_DTO> p_list)
{
var invBill = new INVOICE_REPEAT_DTO();
var result =await _adjservice.CheckImport(p_list);
if(result != "OK")
{
return new JsonResult(new { Code = 400, Message = "请下载错误模版", fileName =result });
}
var invBilllist = new List<INVOICE_WAIT_DETAIL_DTO>();
var adjlist=ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list);
if (adjlist == null && adjlist.Count==0)
{
@ -373,134 +381,283 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不在请检查!");
}
version = settle.Version;
if (inv != null)
if (inv != null)
{
if (inv.InvoiceState == InvoiceBillState.)
{
if (inv.InvoiceState == InvoiceBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态为报废状态不能重开!");
}
if (inv.State == SettleBillState. || inv.State == SettleBillState.)
throw new UserFriendlyException($"选择发票:{invbillnum}状态为报废状态不能重开!");
}
if (inv.State == SettleBillState. || inv.State == SettleBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!");
}
var bbaclist = await _bbacMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count() > 0)
{
foreach (var itm in adjlist)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!");
bbaclist.Add(new BBAC_CAN_SA_DETAIL(
guid: itm.Id,
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
category: itm.BusinessType,
isReturn: itm.Qty > 0 ? false : true,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
contactid: itm.Extend1,//生产号
invbillnum: string.Empty,
partcode: itm.PartCode
));
}
}
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
var priceList = _priceRepository.ToList();//价格单
var bbaclist = await _bbacMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count() > 0)
{
foreach (var itm in adjlist)
var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site//客户零件号
select new TEMP_CAN_SA_DETAIL
{
bbaclist.Add(new BBAC_CAN_SA_DETAIL(
guid: itm.Id,
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
category: itm.BusinessType,
isReturn: itm.Qty > 0 ? false : true,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
contactid: itm.Extend1,//生产号
invbillnum: string.Empty,
partcode: itm.PartCode
));
}
}
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
var priceList = _priceRepository.ToList();//价格单
//var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
//if (errorList.Count() > 0)
//{
// return await ExportErrorReportAsync(errorList);
//}
var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号
select new TEMP_CAN_SA_DETAIL
{
Id = d.Id,
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,
Price = p.Price,
BillNum = d.BillNum,
SettleDate = d.SettleDate,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
MaterialDesc = d.MaterialDesc,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
Amt = Math.Round(d.Qty * p.Price, 2),
ContractDocID = d.ContractDocID,
BeginDate = p.BeginTime,
EndDate = p.EndTime,
PartCode = d.PartCode
Id = d.Id,
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,
Price = p.Price,
BillNum = d.BillNum,
SettleDate = d.SettleDate,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
MaterialDesc = d.MaterialDesc,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
Amt = Math.Round(d.Qty * p.Price, 2),
ContractDocID = d.ContractDocID,
BeginDate = p.BeginTime,
EndDate = p.EndTime,
PartCode = d.PartCode
};
var dtos = q.ToList();
if (dtos != null && dtos.Count > 0)
{
};
var dtos = q.ToList();
if (dtos != null && dtos.Count > 0)
{
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
{
var entities = await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
var ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
var tax = inv.Tax;
var amt = entities.Sum(p => p.Amt);
var taxamt =amt+ Math.Round(amt * tax, 2);
var billnum = string.Empty;
invBill.Amt = amt;
invBill.TaxAmt = taxamt;
invBill.Tax = tax;
invBill.BusinessType=inv.BusinessType;
invBill.DETIAL = ls;
invBilllist.AddRange(ls);
}
else//二次开票
{
var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
var ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
invBilllist.AddRange(ls);
var tax = inv.Tax;
var amt = entities.Sum(p => p.Amt);
var taxamt = amt + Math.Round(amt * tax, 2);
var billnum = string.Empty;
invBill.Amt = amt;
invBill.TaxAmt = taxamt;
invBill.Tax = tax;
invBill.BusinessType = inv.BusinessType;
invBill.DETIAL = ls;
}
}
}
else
{
throw new UserFriendlyException($"不存发票号为:{invbillnum}发票");
}
}
var invlist=invBilllist.OrderBy(p => p.PartCode).ToList();
return new JsonResult(new { Code = 200, Data= invlist });
}
[HttpPost]
[UnitOfWork(false)]
/// <summary>
/// 发票重开列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public virtual async Task<IActionResult> ReissueInvoiceListExt(List<PUB_ADJ_DETAIL_DTO> p_list)
{
var invBilllist = new List<INVOICE_REPEAT_DTO>();
var adjlist = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list);
if (adjlist == null && adjlist.Count == 0)
{
throw new UserFriendlyException($"调整表无数据!");
}
var first = p_list.FirstOrDefault();
var invbillnum = first.InvBillNum;
//var mappingList = await GetMapGroupAsync(invbillnum);//发票对应结算分组
//if (mappingList != null && mappingList.Count() > 0)
//{
var version = int.Parse(DateTime.Now.ToString("yyyymm"));
//var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
var inv = await GetInvoiceGroupByInvBillNum(invbillnum);
var settle = await _bbacMng.GetMainAsync(inv.InvGroupNum);
if (settle == null)
{
throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不在请检查!");
}
version = settle.Version;
if (inv != null)
{
if (inv.InvoiceState == InvoiceBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态为报废状态不能重开!");
}
if (inv.State == SettleBillState. || inv.State == SettleBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!");
}
var bbaclist = await _bbacMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件 //var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count() > 0)
{
foreach (var itm in adjlist)
{
bbaclist.Add(new BBAC_CAN_SA_DETAIL(
guid: itm.Id,
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
category: itm.BusinessType,
isReturn: itm.Qty > 0 ? false : true,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
contactid: itm.Extend1,//生产号
invbillnum: string.Empty,
partcode: itm.PartCode
));
}
}
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
var priceList = _priceRepository.ToList();//价格单
var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site//客户零件号
select new TEMP_CAN_SA_DETAIL
{
Id = d.Id,
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,
Price = p.Price,
BillNum = d.BillNum,
SettleDate = d.SettleDate,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
MaterialDesc = d.MaterialDesc,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
Amt = Math.Round(d.Qty * p.Price, 2),
ContractDocID = d.ContractDocID,
BeginDate = p.BeginTime,
EndDate = p.EndTime,
PartCode = d.PartCode
};
var dtos = q.ToList();
if (dtos != null && dtos.Count > 0)
{
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
{
var entities = await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
var ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
if (ls.Count > 0)
{
var invlist = ls.Select(p => p.InvbillNum).Distinct();
foreach (var itm in invlist)
{
var invBill = new INVOICE_REPEAT_DTO();
var invls = ls.Where(p => p.InvbillNum == itm).ToList();
var entitylist = entities.Where(p => p.InvbillNum == itm).ToList();
var tax = inv.Tax;//税率
var amt = entitylist.Sum(p => p.Amt);//税前
var taxamt = amt + Math.Round(amt * tax, 2);//税后
var realamt = Math.Round(amt * tax, 2);//税额
invBill.Amt = amt;
invBill.TaxAmt = taxamt;
invBill.Tax = tax;
invBill.BusinessType = inv.BusinessType;
invBill.DETAIL = invls;
invBill.RealAmt = realamt;
invBilllist.Add(invBill);
}
}
}
else//二次开票
{
var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
var ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
var invlist = ls.Select(p => p.InvbillNum).Distinct();
foreach (var itm in invlist)
{
var invBill = new INVOICE_REPEAT_DTO();
var invls = ls.Where(p => p.InvbillNum == itm).ToList();
var entitylist = entities.Where(p => p.InvbillNum == itm).ToList();
var tax = inv.Tax;//税率
var amt = entitylist.Sum(p => p.Amt);//税前
var taxamt = amt + Math.Round(amt * tax, 2);//税后
var realamt = Math.Round(amt * tax, 2);//税额
invBill.Amt = amt;
invBill.TaxAmt = taxamt;
invBill.Tax = tax;
invBill.BusinessType = inv.BusinessType;
invBill.DETAIL = invls;
invBill.RealAmt = realamt;
invBilllist.Add(invBill);
}
}
}
}
else
{
throw new UserFriendlyException($"不存发票号为:{invbillnum}发票");
}
//}
//else
//{
// throw new UserFriendlyException($"不存发票号:{p_invbillnum}对应的结算分组号");
//}
return invBill;
return new JsonResult(new { Code = 200, Data = invBilllist });
}
}
}

24
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs

@ -87,32 +87,32 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
public async Task<IActionResult> GenerateInvoice([FromBody] string invbillNum)
{
var main =await _bbacMng.GetMainAsync(invbillNum);
if (main != null)
{
if (main.State != SettleBillState.)
{
return new JsonResult(new { Code = 400, Message = "已创建发票不能重复创建" });
}
if (await _bbacMng.SetForwardState(main, SettleBillState.))
var entitys = await _bbacMng.GetDetalListAsync(invbillNum);//可结算
var priceList = _priceRepository.Where(p => p.IsCancel == false).ToList();
;//价格单
var errorList = await CheckInvoiceGenerationRules(entitys,main.Site,priceList, main.BusinessType);//校验生成规则
if (errorList.Count() > 0)
{
var entitys = await _bbacMng.GetDetalListAsync(invbillNum);//可结算
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) });
}
if (await _bbacMng.SetForwardState(main, SettleBillState.))
{
var groupNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();
var notQuery = _notRepository.Where(p => groupNumList.Contains(p.GroupNum)).ToList();//不能结算
var priceList = _priceRepository.ToList();//价格单
var errorList = await CheckInvoiceGenerationRules(entitys, priceList,main.BusinessType);//校验生成规则
if (errorList.Count() > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorList) });
}
var notQuery = _notRepository.Where(p => groupNumList.Contains(p.GroupNum)).ToList();//不能结算
var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode ==main.Site
select new TEMP_CAN_SA_DETAIL
{
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs

@ -61,7 +61,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
errorlist.Add(new ERR_EXP_DTO() { Message = itm });
}
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorlist) });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorlist) });
}
}
return new JsonResult(new { Code = 200, Message = "生成成功" });

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs

@ -181,7 +181,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message= "请下载错误信息", fileName = fileName });
}
#endregion

577
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs

@ -10,6 +10,7 @@ using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.Uow;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
@ -29,20 +30,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[Route("api/settleaccount/[controller]/[action]")]
public class HBPO_BA_SERVICE : BA_SERVICE
{
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
private readonly ADJ_SERVICE _adjservice;
public HBPO_BA_SERVICE(IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> pubRepository, INormalEfCoreRepository<INVOICE_GRP, Guid> repository, INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository, INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository,
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository, BBAC_CAN_SA_MNG bbacMng,
HBPO_CAN_SA_MNG hbpoMng, PUB_CAN_SA_MNG pubMng, INV_MNG invMng,
TaskJobService service,
BaseDomainService baseservice,
INormalEfCoreRepository<PriceList, Guid> priceRepository
INormalEfCoreRepository<PriceList, Guid> priceRepository,
ADJ_SERVICE adjservice
)
: base(excelImportService, snowflakeIdGenerator, commonManager, repository, wRepository, sRepository, mRepository, adjRepository, bbacMng, hbpoMng, pubMng, invMng, service,baseservice)
{
_priceRepository= priceRepository;
_adjservice = adjservice;
}
@ -115,13 +118,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
if (errorList.Count() > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorList) });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) });
;
}
// var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in entitys
join p in priceList on d.PartCode equals p.LU
join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
select new TEMP_CAN_SA_DETAIL
{
@ -170,6 +173,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
[HttpPost]
[UnitOfWork(false)]
/// <summary>
/// 发票重开
/// </summary>
@ -239,16 +244,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();
//var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算
var priceList = _priceRepository.ToList();//价格单
var priceList = _priceRepository.Where(p=>p.IsCancel==false).ToList();//价格单
var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
if (errorList.Count() > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorList) });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) });
}
// var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in entitys
join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel==false && p.ClientCode==inv.Site
select new TEMP_CAN_SA_DETAIL
{
SettleBillNum = d.SettleBillNum,
@ -296,6 +301,150 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
//[HttpPost]
//[UnitOfWork(false)]
///// <summary>
///// 发票重开列表
///// </summary>
///// <param name="input"></param>
///// <returns></returns>
//public virtual async Task<IActionResult> ReissueInvoiceList(List<PUB_ADJ_DETAIL_DTO> p_list)
//{
// var result = await _adjservice.CheckImport(p_list);
// if (result != "OK")
// {
// return new JsonResult(new { Code = 400, Message = "请下载错误模版", fileName = result });
// }
// var invBilllist = new List<INVOICE_WAIT_DETAIL_DTO>();
// var adjlist = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list);
// if (adjlist == null && adjlist.Count == 0)
// {
// throw new UserFriendlyException($"调整表无数据!");
// }
// var first = p_list.FirstOrDefault();
// var invbillnum = first.InvBillNum;
// //var mappingList = await GetMapGroupAsync(invbillnum);//发票对应结算分组
// //if (mappingList != null && mappingList.Count() > 0)
// //{
// var version = int.Parse(DateTime.Now.ToString("yyyymm"));
// //var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
// var inv = await GetInvoiceGroupByInvBillNum(invbillnum);
// var settle = await _bbacMng.GetMainAsync(inv.InvGroupNum);
// if (settle == null)
// {
// throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不在请检查!");
// }
// version = settle.Version;
// if (inv != null)
// {
// if (inv.InvoiceState == InvoiceBillState.报废)
// {
// throw new UserFriendlyException($"选择发票:{invbillnum}状态为报废状态不能重开!");
// }
// if (inv.State == SettleBillState.商务已审核 || inv.State == SettleBillState.已开票)
// {
// throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!");
// }
// var bbaclist = await _bbacMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件
// //var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
// if (adjlist != null && adjlist.Count() > 0)
// {
// foreach (var itm in adjlist)
// {
// bbaclist.Add(new BBAC_CAN_SA_DETAIL(
// guid: itm.Id,
// keyCode: itm.KeyCode,
// version: itm.Version,
// billNum: itm.InvGroupNum,
// settleBillNum: itm.SettleBillNum,
// lU: itm.LU,
// pN: itm.PN,
// site: itm.Site,
// qty: itm.Qty,
// price: itm.Price,
// category: itm.BusinessType,
// isReturn: itm.Qty > 0 ? false : true,
// settleDate: itm.SettleDate,
// groupNum: itm.GroupNum,
// invGroupNum: itm.InvGroupNum,
// contactid: itm.Extend1,//生产号
// invbillnum: string.Empty,
// partcode: itm.PartCode
// ));
// }
// }
// var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
// var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
// var priceList = _priceRepository.ToList();//价格单
// var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys);
// var q = from d in dto1s
// join p in priceList on d.LU equals p.LU
// where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site//客户零件号
// select new TEMP_CAN_SA_DETAIL
// {
// Id = d.Id,
// SettleBillNum = d.SettleBillNum,
// Site = d.Site,
// Version = d.Version,
// Price = p.Price,
// BillNum = d.BillNum,
// SettleDate = d.SettleDate,
// InvGroupNum = d.InvGroupNum,
// LU = d.LU,
// MaterialDesc = d.MaterialDesc,
// PN = d.PN,
// Qty = d.Qty,
// GroupNum = d.GroupNum,
// Amt = Math.Round(d.Qty * p.Price, 2),
// ContractDocID = d.ContractDocID,
// BeginDate = p.BeginTime,
// EndDate = p.EndTime,
// PartCode = d.PartCode
// };
// var dtos = q.ToList();
// if (dtos != null && dtos.Count > 0)
// {
// if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
// {
// var entities = await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
// var ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
// invBilllist.AddRange(ls);
// }
// else//二次开票
// {
// var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
// var ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
// invBilllist.AddRange(ls);
// }
// }
// else
// {
// throw new UserFriendlyException($"不存发票号为:{invbillnum}发票");
// }
// }
// var invlist = invBilllist.OrderBy(p => p.PartCode);
// return new JsonResult(new { Code = 200, Data = invlist });
//}
@ -304,9 +453,18 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public virtual async Task<List<INVOICE_WAIT_DETAIL_DTO>> ReissueInvoiceList( List<PUB_ADJ_DETAIL_DTO> p_list)
public virtual async Task<IActionResult> ReissueInvoiceList(List<PUB_ADJ_DETAIL_DTO> p_list)
{
List<INVOICE_WAIT_DETAIL_DTO> ls = new List<INVOICE_WAIT_DETAIL_DTO>();
var result = await _adjservice.CheckImport(p_list);
if (result != "OK")
{
return new JsonResult(new { Code = 400, Message = "请下载错误模版", fileName = result });
}
var invBilllist = new List<INVOICE_WAIT_DETAIL_DTO>();
var adjlist = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list);
if (adjlist == null && adjlist.Count == 0)
@ -319,120 +477,342 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//var mappingList = await GetMapGroupAsync(invbillnum);//发票对应结算分组
//if (mappingList != null && mappingList.Count() > 0)
//{
var version = int.Parse(DateTime.Now.ToString("yyyymm"));
//var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
var inv = await GetInvoiceGroupByInvBillNum(invbillnum);
var version = int.Parse(DateTime.Now.ToString("yyyymm"));
//var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
var inv = await GetInvoiceGroupByInvBillNum(invbillnum);
var settle = await _hbpoMng.GetMainAsync(inv.InvGroupNum);
var settle = await _hbpoMng.GetMainAsync(inv.InvGroupNum);
if (settle == null)
if (settle == null)
{
throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不在请检查!", "400");
}
version = settle.Version;
if (inv != null)
{
if (inv.InvoiceState == InvoiceBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不在请检查!","400");
throw new UserFriendlyException($"选择发票:{invbillnum}状态为报废状态不能重开!", "400");
}
version = settle.Version;
if (inv != null)
if (inv.State == SettleBillState. || inv.State == SettleBillState.)
{
if (inv.InvoiceState == InvoiceBillState.)
throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!", "400");
}
var bbaclist = await _hbpoMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count() > 0)
{
foreach (var itm in adjlist)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态为报废状态不能重开!","400");
bbaclist.Add(new HBPO_CAN_SA_DETAIL(
guid: itm.Id,
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
businessType: itm.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty,
partcode: itm.PartCode
));
}
if (inv.State == SettleBillState. || inv.State == SettleBillState.)
}
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
var priceList = _priceRepository.ToList();//价格单
//var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
//if (errorList.Count() > 0)
//{
// return await ExportErrorReportAsync(errorList);
//}
var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site//客户零件号
select new TEMP_CAN_SA_DETAIL
{
Id = d.Id,
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,
Price = p.Price,
BillNum = d.BillNum,
SettleDate = d.SettleDate,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
MaterialDesc = d.MaterialDesc,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
Amt = Math.Round(d.Qty * p.Price, 2),
ContractDocID = "N",
BeginDate = p.BeginTime,
EndDate = p.EndTime,
PartCode = d.PartCode
};
var dtos = q.ToList();
if (dtos != null && dtos.Count > 0)
{
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!","400");
var entities = await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
var ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
invBilllist.AddRange(ls);
//var invlist = ls.Select(p => p.InvbillNum).Distinct();
//foreach (var itm in invlist)
//{
// var invBill = new INVOICE_REPEAT_DTO();
// var invls = ls.Where(p => p.InvbillNum == itm).ToList();
// var entitylist = entities.Where(p => p.InvbillNum == itm).ToList();
// var tax = inv.Tax;//税率
// var amt = entitylist.Sum(p => p.Amt);//税前
// var taxamt = amt + Math.Round(amt * tax, 2);//税后
// var realamt = Math.Round(amt * tax, 2);//税额
// invBill.Amt = amt;
// invBill.TaxAmt = taxamt;
// invBill.Tax = tax;
// invBill.BusinessType = inv.BusinessType;
// invBill.DETAIL = invls;
// invBill.RealAmt = realamt;
// invBilllist.Add(invBill);
//}
}
var bbaclist = await _hbpoMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count() > 0)
else//二次开票
{
foreach (var itm in adjlist)
{
bbaclist.Add(new HBPO_CAN_SA_DETAIL(
guid: itm.Id,
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
businessType: itm.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty,
partcode: itm.PartCode
));
}
var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
var ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
invBilllist.AddRange(ls);
//var invlist = ls.Select(p => p.InvbillNum).Distinct();
//foreach (var itm in invlist)
//{
// var invBill = new INVOICE_REPEAT_DTO();
// var invls = ls.Where(p => p.InvbillNum == itm).ToList();
// var entitylist = entities.Where(p => p.InvbillNum == itm).ToList();
// var tax = inv.Tax;//税率
// var amt = entitylist.Sum(p => p.Amt);//税前
// var taxamt = amt + Math.Round(amt * tax, 2);//税后
// var realamt = Math.Round(amt * tax, 2);//税额
// invBill.Amt = amt;
// invBill.TaxAmt = taxamt;
// invBill.Tax = tax;
// invBill.BusinessType = inv.BusinessType;
// invBill.DETAIL = invls;
// invBill.RealAmt = realamt;
// invBilllist.Add(invBill);
//}
}
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
}
}
else
{
throw new UserFriendlyException($"不存发票号为:{invbillnum}发票", "400");
}
var invlist = invBilllist.OrderBy(p => p.PartCode).ToList();
//}
//else
//{
// throw new UserFriendlyException($"不存发票号:{invbillnum}对应的结算分组号");
//}
var priceList = _priceRepository.ToList();//价格单
//var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
//if (errorList.Count() > 0)
//{
// return await ExportErrorReportAsync(errorList);
//}
var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号
select new TEMP_CAN_SA_DETAIL
{
Id = d.Id,
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,
Price = p.Price,
BillNum = d.BillNum,
SettleDate = d.SettleDate,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
MaterialDesc = d.MaterialDesc,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
Amt = Math.Round(d.Qty * p.Price, 2),
ContractDocID = "N",
BeginDate = p.BeginTime,
EndDate = p.EndTime,
PartCode = d.PartCode
return new JsonResult(new { Code = 200, Message = "生成成功", Data= invBilllist });
};
var dtos = q.ToList();
if (dtos != null && dtos.Count > 0)
}
[HttpPost]
/// 发票重开列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public virtual async Task<IActionResult> ReissueInvoiceListExt(List<PUB_ADJ_DETAIL_DTO> p_list)
{
var result = await _adjservice.CheckImport(p_list);
if (result != "OK")
{
return new JsonResult(new { Code = 400, Message = "请下载错误模版", fileName = result });
}
var invBilllist = new List<INVOICE_REPEAT_DTO>();
var adjlist = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list);
if (adjlist == null && adjlist.Count == 0)
{
throw new UserFriendlyException($"调整表无数据!");
}
var first = p_list.FirstOrDefault();
var invbillnum = first.InvBillNum;
//var mappingList = await GetMapGroupAsync(invbillnum);//发票对应结算分组
//if (mappingList != null && mappingList.Count() > 0)
//{
var version = int.Parse(DateTime.Now.ToString("yyyymm"));
//var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
var inv = await GetInvoiceGroupByInvBillNum(invbillnum);
var settle = await _hbpoMng.GetMainAsync(inv.InvGroupNum);
if (settle == null)
{
throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不在请检查!", "400");
}
version = settle.Version;
if (inv != null)
{
if (inv.InvoiceState == InvoiceBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态为报废状态不能重开!", "400");
}
if (inv.State == SettleBillState. || inv.State == SettleBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!", "400");
}
var bbaclist = await _hbpoMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count() > 0)
{
foreach (var itm in adjlist)
{
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
{
var entities = await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
bbaclist.Add(new HBPO_CAN_SA_DETAIL(
guid: itm.Id,
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
businessType: itm.BusinessType,
ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty,
partcode: itm.PartCode
));
}
}
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
}
else//二次开票
var priceList = _priceRepository.ToList();//价格单
//var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
//if (errorList.Count() > 0)
//{
// return await ExportErrorReportAsync(errorList);
//}
var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site//客户零件号
select new TEMP_CAN_SA_DETAIL
{
var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
Id = d.Id,
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,
Price = p.Price,
BillNum = d.BillNum,
SettleDate = d.SettleDate,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
MaterialDesc = d.MaterialDesc,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
Amt = Math.Round(d.Qty * p.Price, 2),
ContractDocID = "N",
BeginDate = p.BeginTime,
EndDate = p.EndTime,
PartCode = d.PartCode
};
var dtos = q.ToList();
if (dtos != null && dtos.Count > 0)
{
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
{
var entities = await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
var ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
var invlist = ls.Select(p => p.InvbillNum).Distinct();
foreach (var itm in invlist)
{
var invBill = new INVOICE_REPEAT_DTO();
var invls = ls.Where(p => p.InvbillNum == itm).ToList();
var entitylist = entities.Where(p => p.InvbillNum == itm).ToList();
var tax = inv.Tax;//税率
var amt = entitylist.Sum(p => p.Amt);//税前
var taxamt = amt + Math.Round(amt * tax, 2);//税后
var realamt = Math.Round(amt * tax, 2);//税额
invBill.Amt = amt;
invBill.TaxAmt = taxamt;
invBill.Tax = tax;
invBill.BusinessType = inv.BusinessType;
invBill.DETAIL = invls;
invBill.RealAmt = realamt;
invBilllist.Add(invBill);
}
}
else//二次开票
{
var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
var ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
var invlist = ls.Select(p => p.InvbillNum).Distinct();
foreach (var itm in invlist)
{
var invBill = new INVOICE_REPEAT_DTO();
var invls = ls.Where(p => p.InvbillNum == itm).ToList();
var entitylist = entities.Where(p => p.InvbillNum == itm).ToList();
var tax = inv.Tax;//税率
var amt = entitylist.Sum(p => p.Amt);//税前
var taxamt = amt + Math.Round(amt * tax, 2);//税后
var realamt = Math.Round(amt * tax, 2);//税额
invBill.Amt = amt;
invBill.TaxAmt = taxamt;
invBill.Tax = tax;
invBill.BusinessType = inv.BusinessType;
invBill.DETAIL = invls;
invBill.RealAmt = realamt;
invBilllist.Add(invBill);
}
}
}
else
{
throw new UserFriendlyException($"不存发票号为:{invbillnum}发票","400");
}
}
else
{
throw new UserFriendlyException($"不存发票号为:{invbillnum}发票", "400");
}
//}
//else
//{
// throw new UserFriendlyException($"不存发票号:{invbillnum}对应的结算分组号");
//}
return ls;
return new JsonResult(new { Code = 200, Message = "生成成功", Data = invBilllist });
}
@ -441,6 +821,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
}

19
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs

@ -87,22 +87,23 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
return new JsonResult(new { Code = 400, Message = "已创建发票不能重复创建" });
}
var entitys = await _hbpoMng.GetDetalListAsync(invbillnum);
var priceList = _priceRepository.Where(p => p.IsCancel == false).ToList(); //价格单
var errorList = await CheckInvoiceGenerationRules(entitys,main.Site,priceList, main.BusinessType);//校验生成规则
if (errorList.Count() > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) });
}
if (await _hbpoMng.SetForwardState(main, SettleBillState.))
{
var entitys = await _hbpoMng.GetDetalListAsync(invbillnum);
var groupNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
var notQuery = _notRepository.Where(p => groupNumList.Contains(p.GroupNum)).ToList();
var priceList = _priceRepository.ToList();//价格单
var errorList = await CheckInvoiceGenerationRules(entitys, priceList, main.BusinessType);//校验生成规则
if (errorList.Count() > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorList) });
}
var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == main.Site
select new TEMP_CAN_SA_DETAIL
{
SettleBillNum = d.SettleBillNum,

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs

@ -65,7 +65,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
errorlist.Add(new ERR_EXP_DTO() { Message = itm });
}
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorlist) });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorlist) });
}
}
return new JsonResult(new { Code = 200, Message = "生成成功" });

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs

@ -230,7 +230,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = fileName });
}
#endregion
@ -269,7 +269,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = fileName });
}
#endregion

303
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs

@ -2,6 +2,7 @@ using CodeArts.Db;
using DocumentFormat.OpenXml.Bibliography;
using DocumentFormat.OpenXml.Drawing.Diagrams;
using DocumentFormat.OpenXml.Spreadsheet;
using DocumentFormat.OpenXml.Wordprocessing;
using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Csv;
@ -16,6 +17,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Management;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
@ -31,6 +33,7 @@ using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase;
@ -110,7 +113,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
if (errors.Count() > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errors) });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errors) });
}
}
await _invMng.SetForwardState(p_invs, SettleBillState.);
@ -161,7 +164,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var wquery = from itm in AMap
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp
select from tm in temp.DefaultIfEmpty()
from tm in temp.DefaultIfEmpty()
select
new INVOICE_WAIT_DETAIL_BBAC_DTO()
{
@ -181,7 +184,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
BeginDate = itm.BeginDate,
EndDate = itm.EndDate,
};
entity.INVOICE_WAIT_DETAIL_BBAC = AMap;
entity.INVOICE_WAIT_DETAIL_BBAC = wquery.OrderBy(p => p.LU).ToList();
}
else if (invs.FirstOrDefault().BusinessType == EnumBusinessType.BeiJian)
{
@ -191,7 +194,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var wquery = from itm in BMap
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp
select from tm in temp.DefaultIfEmpty()
from tm in temp.DefaultIfEmpty()
select
new INVOICE_WAIT_DETAIL_BJ_DTO()
{
@ -211,7 +214,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
BeginDate = itm.BeginDate,
EndDate = itm.EndDate,
};
entity.INVOICE_WAIT_DETAIL_BJ = BMap;
entity.INVOICE_WAIT_DETAIL_BJ = wquery.OrderBy(p => p.LU).ToList();
}
else
{
@ -221,7 +224,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var wquery = from itm in wdtos
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp
select from tm in temp.DefaultIfEmpty()
from tm in temp.DefaultIfEmpty()
select
new INVOICE_WAIT_DETAIL_DTO()
{
@ -243,7 +246,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
EndDate = itm.EndDate,
};
entity.INVOICE_WAIT_DETAIL = wdtos;
entity.INVOICE_WAIT_DETAIL= wquery.OrderBy(p=>p.LU).ToList();
}
var s = await _sRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
@ -336,6 +342,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
);
return _fileName;
}
/// <summary>
/// 导出发票组明细
/// </summary>
@ -349,7 +359,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var materialList = await _baseservice.GetMaterialList();
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true);
var first=entities.FirstOrDefault();
var dtoDetails = ObjectMapper.Map<List<INVOICE_GRP>, List<INVOICE_GRP_EXP_DTO>>(entities);
var invdetail= await DetailQueryAsync(input);
var m = invdetail.INVOICE_MAP_GROUP;
@ -378,137 +396,172 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var mgroup =m.Where(p => p.InvbillNum == itm.InvbillNum).ToList();
var adjp = adj.Where(p => p.InvBillNum == itm.InvbillNum).ToList();
var nolist = not.Where(p => p.InvBillNum == itm.InvbillNum).ToList();
var lsC =nolist.Where(p => p.Extend1 == "可结算").ToList();
var lsN = nolist.Where(p => p.Extend1 == "不可结算").ToList();
// var r = (from t1 in lsC
// join t2 in lsN on new { t1.LU, t1.SettleGroupNum }
// equals new { t2.LU, t2.SettleGroupNum }
// into temp
// from tm in temp.DefaultIfEmpty()
// select new INVOICE_NOT_SETTLE_EXT_DTO
// {
// RealInvBillNum = t1.RealInvBillNum,
// InvDate = t1.InvDate,
// InvBillNum = t1.InvBillNum,
// InvGroupNum = t1.InvGroupNum,
// SettleGroupNum = t1.SettleGroupNum,
// SettleLU = t1.LU,
// NotSettleLU = tm == null ? string.Empty : tm.LU,
// Qty = tm == null ? string.Empty : tm.Qty
// }
// )
//.Union
//(from t2 in lsN
// join t1 in lsC
// on new { t2.LU, t2.SettleGroupNum }
// equals new { t1.LU, t1.SettleGroupNum }
// into temp
// from tm in temp.DefaultIfEmpty()
// where tm == null
// select new INVOICE_NOT_SETTLE_EXT_DTO
// {
// RealInvBillNum = t2.RealInvBillNum,
// InvDate = t2.InvDate,
// InvBillNum = t2.InvBillNum,
// InvGroupNum = t2.InvGroupNum,
// SettleGroupNum = t2.SettleGroupNum,
// SettleLU = string.Empty,
// NotSettleLU = t2.LU,
// Qty = t2.Qty
// }
// );
//_excel.Append(r.OrderBy(p=>p.SettleGroupNum).ToList(), "结算分组零件" + itm.InvbillNum);
var lsC = nolist.Where(p => p.Extend1 == "可结算")
.GroupBy(p => new
{
p.LU,
p.RealInvBillNum,
p.InvDate,
p.InvBillNum,
p.InvGroupNum,
}).Select(p => new INVOICE_NOT_SETTLE_DTO() {
LU =p.Key.LU,
RealInvBillNum =p.Key.RealInvBillNum,
InvDate =p.Key.InvDate,
InvBillNum =p.Key.InvBillNum,
InvGroupNum =p.Key.InvGroupNum,
Qty=p.Sum(itm=>itm.Qty)
}).ToList();
var lsN = nolist.Where(p => p.Extend1 == "不可结算").ToList()
.GroupBy(p => new
{
p.LU,
p.RealInvBillNum,
p.InvDate,
p.InvBillNum,
p.InvGroupNum,
}).Select(p => new INVOICE_NOT_SETTLE_DTO()
{
LU = p.Key.LU,
RealInvBillNum = p.Key.RealInvBillNum,
InvDate = p.Key.InvDate,
InvBillNum = p.Key.InvBillNum,
InvGroupNum = p.Key.InvGroupNum,
Qty = p.Sum(itm => itm.Qty)
}).ToList();
var lineC = lsC.Count;
var lineN = lsN.Count;
List<INVOICE_NOT_SETTLE_EXT_DTO> ls = new List<INVOICE_NOT_SETTLE_EXT_DTO>();
if (lineC > lineN)//可结大于不可结行数时
for (int i = 0; i < 10000; i++)
{
for (int number = 0; number < lineC; number++)
{
if (number + 1 > lineN)
{
INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
entity.RealInvBillNum = lsC[number].RealInvBillNum;
entity.InvDate = lsC[number].InvDate;
entity.InvBillNum = lsC[number].InvBillNum;
entity.InvGroupNum = lsC[number].InvGroupNum;
entity.SettleGroupNum = lsC[number].SettleGroupNum;
entity.SettleLU = lsC[number].LU;
entity.SettleQty = lsC[number].Qty;
entity.NotSettleLU = string.Empty;
entity.Qty = string.Empty;
ls.Add(entity);
}
else
{
INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
entity.RealInvBillNum = lsC[number].RealInvBillNum;
entity.InvDate = lsC[number].InvDate;
entity.InvBillNum = lsC[number].InvBillNum;
entity.InvGroupNum = lsC[number].InvGroupNum;
entity.SettleGroupNum = lsC[number].SettleGroupNum;
entity.SettleLU = lsC[number].LU;
entity.SettleQty= lsC[number].Qty;
entity.NotSettleLU = lsN[number].LU;
entity.Qty = lsN[number].Qty;
ls.Add(entity);
}
}
INVOICE_NOT_SETTLE_EXT_DTO invnot = new INVOICE_NOT_SETTLE_EXT_DTO();
invnot.RealInvBillNum = string.Empty;
invnot.InvDate = null;
invnot.InvBillNum = string.Empty;
invnot.InvGroupNum = string.Empty;
invnot.SettleGroupNum = string.Empty;
invnot.SettleLU = string.Empty;
invnot.SettleQty = null;
invnot.NotSettleLU = string.Empty;
invnot.Qty = string.Empty;
ls.Add(invnot);
}
else
var entity= nolist.FirstOrDefault();
var disList = lsC.Select(p => p.SettleGroupNum).Distinct().ToList();
for (int i = 0; i < disList.Count; i++)
{
for (int number = 0; number < lineN; number++)
{
if (number + 1 > lineC)//不可结大于可结行数时
{
INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
entity.RealInvBillNum = lsN[number].RealInvBillNum;
entity.InvDate = lsN[number].InvDate;
entity.InvBillNum = lsN[number].InvBillNum;
entity.InvGroupNum = lsN[number].InvGroupNum;
entity.SettleGroupNum = lsN[number].SettleGroupNum;
entity.SettleLU = string.Empty;
entity.SettleQty = string.Empty;
entity.NotSettleLU = lsN[number].LU;
entity.Qty = lsN[number].Qty;
ls.Add(entity);
}
else
{
INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
entity.RealInvBillNum = lsN[number].RealInvBillNum;
entity.InvDate = lsN[number].InvDate;
entity.InvBillNum = lsN[number].InvBillNum;
entity.InvGroupNum = lsN[number].InvGroupNum;
entity.SettleGroupNum = lsN[number].SettleGroupNum;
entity.SettleLU = lsC[number].LU;
entity.NotSettleLU = lsN[number].LU;
entity.Qty = lsN[number].Qty;
entity.SettleQty = lsC[number].Qty;
ls.Add(entity);
}
}
ls[i].SettleGroupNum = disList[i];
}
var disList= ls.Select(p => p.SettleGroupNum).Distinct().ToList();
foreach (var de in ls)
for (int i = 0; i < lineC; i++)
{
de.SettleGroupNum = string.Empty;
ls[i].RealInvBillNum = entity.RealInvBillNum;
ls[i].InvDate = entity.InvDate;
ls[i].InvBillNum = entity.InvBillNum;
ls[i].InvGroupNum = entity.InvGroupNum;
ls[i].SettleGroupNum = entity.SettleGroupNum;
ls[i].SettleLU = lsC[i].LU;
ls[i].SettleQty = lsC[i].Qty == null ? string.Empty : lsC[i].Qty.ToString();
}
for (int i = 0; i < disList.Count; i++)
for (int i = 0; i < lineN; i++)
{
ls[i].SettleGroupNum = disList[i];
ls[i].RealInvBillNum = entity.RealInvBillNum;
ls[i].InvDate = entity.InvDate;
ls[i].InvBillNum = entity.InvBillNum;
ls[i].InvGroupNum = entity.InvGroupNum;
ls[i].SettleGroupNum = entity.SettleGroupNum;
ls[i].NotSettleLU = lsN[i].LU;
ls[i].Qty = lsN[i].Qty == null ? string.Empty : lsN[i].Qty.ToString();
}
//if (lineC > lineN)//可结大于不可结行数时
//{
// for (int number = 0; number < lineC; number++)
// {
// if (number + 1 > lineN)
// {
// INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
// entity.RealInvBillNum = lsC[number].RealInvBillNum;
// entity.InvDate = lsC[number].InvDate;
// entity.InvBillNum = lsC[number].InvBillNum;
// entity.InvGroupNum = lsC[number].InvGroupNum;
// entity.SettleGroupNum = lsC[number].SettleGroupNum;
// entity.SettleLU = lsC[number].LU;
// entity.SettleQty = lsC[number].Qty == null ? string.Empty : lsC[number].Qty.ToString();
// entity.NotSettleLU = string.Empty;
// entity.Qty = string.Empty;
// ls.Add(entity);
// }
// else
// {
// INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
// entity.RealInvBillNum = lsC[number].RealInvBillNum;
// entity.InvDate = lsC[number].InvDate;
// entity.InvBillNum = lsC[number].InvBillNum;
// entity.InvGroupNum = lsC[number].InvGroupNum;
// entity.SettleGroupNum = lsC[number].SettleGroupNum;
// entity.SettleLU = lsC[number].LU;
// entity.SettleQty= lsC[number].Qty==null?string.Empty:lsC[number].Qty.ToString();
// entity.NotSettleLU = lsN[number].LU;
// entity.Qty = lsN[number].Qty == null ? string.Empty : lsC[number].Qty.ToString();
// ls.Add(entity);
// }
// }
//}
//else
//{
// for (int number = 0; number < lineN; number++)
// {
// if (number + 1 > lineC)//不可结大于可结行数时
// {
// INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
// entity.RealInvBillNum = lsN[number].RealInvBillNum;
// entity.InvDate = lsN[number].InvDate;
// entity.InvBillNum = lsN[number].InvBillNum;
// entity.InvGroupNum = lsN[number].InvGroupNum;
// entity.SettleGroupNum = lsN[number].SettleGroupNum;
// entity.SettleLU = string.Empty;
// entity.SettleQty = string.Empty;
// entity.NotSettleLU = lsN[number].LU;
// entity.Qty = lsN[number].Qty == null ? string.Empty : lsN[number].Qty.ToString();
// ls.Add(entity);
// }
// else
// {
// INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
// entity.RealInvBillNum = lsN[number].RealInvBillNum;
// entity.InvDate = lsN[number].InvDate;
// entity.InvBillNum = lsN[number].InvBillNum;
// entity.InvGroupNum = lsN[number].InvGroupNum;
// entity.SettleGroupNum = lsN[number].SettleGroupNum;
// entity.SettleLU = lsC[number].LU;
// entity.NotSettleLU = lsN[number].LU;
// entity.Qty = lsN[number].Qty == null ? string.Empty : lsN[number].Qty.ToString(); ;
// entity.SettleQty = lsC[number].Qty == null ? string.Empty : lsC[number].Qty.ToString(); ;
// ls.Add(entity);
// }
// }
//}
//var disList= ls.Select(p => p.SettleGroupNum).Distinct().ToList();
//foreach (var de in ls)
//{
// de.SettleGroupNum = string.Empty;
//}
//for (int i = 0; i < disList.Count; i++)
//{
// ls[i].SettleGroupNum = disList[i];
//}
_excel.Append(ls, "结算分组零件" + itm.InvbillNum);
_excel.Append(mgroup, "发票结算分组对应" + itm.InvbillNum).SeparateBySheet();
_excel.Append(adjp, "发票调整数据" + itm.InvbillNum).SeparateBySheet();

456
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs

@ -10,6 +10,7 @@ using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.Uow;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
@ -32,18 +33,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
private readonly INormalEfCoreRepository<PriceListBJ, Guid> _pricebjRepository;
private readonly ADJ_SERVICE _adjservice;
public PUB_BA_SERVICE(IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> pubRepository, INormalEfCoreRepository<INVOICE_GRP, Guid> repository, INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository, INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository, INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository, BBAC_CAN_SA_MNG bbacMng, HBPO_CAN_SA_MNG hbpoMng, PUB_CAN_SA_MNG pubMng, INV_MNG invMng,
TaskJobService service,
BaseDomainService baseservice,
INormalEfCoreRepository<PriceList, Guid> priceRepository
INormalEfCoreRepository<PriceList, Guid> priceRepository,
INormalEfCoreRepository<PriceListBJ, Guid> pricebjRepository,
ADJ_SERVICE adjservice
) : base(excelImportService, snowflakeIdGenerator, commonManager, repository, wRepository, sRepository, mRepository, adjRepository, bbacMng, hbpoMng, pubMng, invMng, service,baseservice)
{
_priceRepository = priceRepository;
_pricebjRepository = pricebjRepository;
_adjservice= adjservice;
}
@ -55,6 +60,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <exception cref="UserFriendlyException"></exception>
/// <exception cref="BusinessException"></exception>
[HttpPost]
[UnitOfWork(false)]
public virtual async Task<IActionResult> ReissueInvoiceExtend(List<PUB_ADJ_DETAIL_DTO> p_list)
{
var first = p_list.FirstOrDefault();
@ -124,16 +130,33 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();
//var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算
var priceList = _priceRepository.ToList();//价格单
List<PriceList> priceList = new List<PriceList>();
if (inv.BusinessType == EnumBusinessType.BeiJian)
{
var priceListbj = _pricebjRepository.ToList();//价格单
foreach (var itm in priceListbj)
{
priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price });
}
}
else
{
priceList = _priceRepository.ToList();//价格单
}
var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
if (errorList.Count > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorList) });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) });
}
// var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in entitys
join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site
select new TEMP_CAN_SA_DETAIL
{
SettleBillNum = d.SettleBillNum,
@ -161,6 +184,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
{
await ReissueFirstInvoice(publist, adjlist, dtos, version, invbillnum);
}
else//二次开票
{
@ -240,8 +268,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
invbillnum: string.Empty,
partcode:itm.PartCode,
pobillnum:string.Empty
));
}
}
@ -249,17 +275,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();
//var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算
var priceList = _priceRepository.ToList();//价格单
var priceList = _priceRepository.Where(p=>p.IsCancel==false).ToList();//价格单
var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
if (errorList.Count > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorList) });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) });
}
// var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in entitys
join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site
select new TEMP_CAN_SA_DETAIL
{
SettleBillNum = d.SettleBillNum,
@ -310,12 +335,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public virtual async Task<List<INVOICE_WAIT_DETAIL_DTO>> ReissueInvoiceList(List<PUB_ADJ_DETAIL_DTO> p_list)
public virtual async Task<IActionResult> ReissueInvoiceListExt(List<PUB_ADJ_DETAIL_DTO> p_list)
{
var first=p_list.FirstOrDefault();
var invbillnum=first.InvBillNum;
var result = await _adjservice.CheckImport(p_list);
if (result != "OK")
{
return new JsonResult(new { Code = 400, Message = "请下载错误模版", fileName = result });
}
var first = p_list.FirstOrDefault();
var invbillnum = first.InvBillNum;
var invBilllist = new List<INVOICE_REPEAT_DTO>();
List<INVOICE_WAIT_DETAIL_DTO> ls = new List<INVOICE_WAIT_DETAIL_DTO>();
var adjlist = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list);
if (adjlist == null && adjlist.Count == 0)
@ -326,127 +358,339 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//var mappingList = await GetMapGroupAsync(invbillnum);//发票对应结算分组
//if (mappingList != null && mappingList.Count() > 0)
//{
var version = int.Parse(DateTime.Now.ToString("yyyymm"));
//var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
var inv = await GetInvoiceGroupByInvBillNum(invbillnum);
var version = int.Parse(DateTime.Now.ToString("yyyymm"));
//var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
var inv = await GetInvoiceGroupByInvBillNum(invbillnum);
var settle = await _pubMng.GetMainAsync(inv.InvGroupNum);
var settle = await _pubMng.GetMainAsync(inv.InvGroupNum);
if (settle == null)
if (settle == null)
{
throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不在请检查!", "400");
}
version = settle.Version;
if (inv != null)
{
if (inv.InvoiceState == InvoiceBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不在请检查!", "400");
throw new UserFriendlyException($"选择发票:{invbillnum}状态为报废状态不能重开!", "400");
}
version = settle.Version;
if (inv != null)
if (inv.State == SettleBillState. || inv.State == SettleBillState.)
{
if (inv.InvoiceState == InvoiceBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态为报废状态不能重开!", "400");
}
if (inv.State == SettleBillState. || inv.State == SettleBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!", "400");
}
var bbaclist = await _pubMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count() > 0)
throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!", "400");
}
var bbaclist = await _pubMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count() > 0)
{
foreach (var itm in adjlist)
{
foreach (var itm in adjlist)
{
bbaclist.Add(new PUB_CAN_SA_DETAIL(
guid: itm.Id,
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
businessType: itm.BusinessType,
bbaclist.Add(new PUB_CAN_SA_DETAIL(
guid: itm.Id,
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
businessType: itm.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty,
partcode: itm.PartCode,
pobillnum:string.Empty
));
}
invbillnum: string.Empty,
partcode: itm.PartCode,
pobillnum: string.Empty
));
}
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
var priceList = _priceRepository.ToList();//价格单
//var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
//if (errorList.Count() > 0)
//{
// return await ExportErrorReportAsync(errorList);
//}
var dto1s = ObjectMapper.Map<List<PUB_CAN_SA_DETAIL>, List<PUB_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号
select new TEMP_CAN_SA_DETAIL
{
Id = d.Id,
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,
Price = p.Price,
BillNum = d.BillNum,
SettleDate = d.SettleDate,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
MaterialDesc = d.MaterialDesc,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
Amt = Math.Round(d.Qty * p.Price, 2),
ContractDocID = "N",
BeginDate = p.BeginTime,
EndDate = p.EndTime,
PartCode = d.PartCode
}
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
};
var dtos = q.ToList();
if (dtos != null && dtos.Count > 0)
{
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
var priceList = _priceRepository.ToList();//价格单
//var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
//if (errorList.Count() > 0)
//{
// return await ExportErrorReportAsync(errorList);
//}
var dto1s = ObjectMapper.Map<List<PUB_CAN_SA_DETAIL>, List<PUB_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site//客户零件号
select new TEMP_CAN_SA_DETAIL
{
var entities = await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
Id = d.Id,
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,
Price = p.Price,
BillNum = d.BillNum,
SettleDate = d.SettleDate,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
MaterialDesc = d.MaterialDesc,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
Amt = Math.Round(d.Qty * p.Price, 2),
ContractDocID = "N",
BeginDate = p.BeginTime,
EndDate = p.EndTime,
PartCode = d.PartCode
ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
};
var dtos = q.ToList();
if (dtos != null && dtos.Count > 0)
{
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
{
var entities = await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
var invlist = ls.Select(p => p.InvbillNum).Distinct();
foreach (var itm in invlist)
{
var invBill = new INVOICE_REPEAT_DTO();
var invls = ls.Where(p => p.InvbillNum == itm).ToList();
var entitylist = entities.Where(p => p.InvbillNum == itm).ToList();
var tax = inv.Tax;//税率
var amt = entitylist.Sum(p => p.Amt);//税前
var taxamt = amt + Math.Round(amt * tax, 2);//税后
var realamt = Math.Round(amt * tax, 2);//税额
invBill.Amt = amt;
invBill.TaxAmt = taxamt;
invBill.Tax = tax;
invBill.BusinessType = inv.BusinessType;
invBill.DETAIL = invls;
invBill.RealAmt = realamt;
invBilllist.Add(invBill);
}
else//二次开票
}
else//二次开票
{
var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
var invlist = ls.Select(p => p.InvbillNum).Distinct();
foreach (var itm in invlist)
{
var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
var invBill = new INVOICE_REPEAT_DTO();
var invls = ls.Where(p => p.InvbillNum == itm).ToList();
var entitylist = entities.Where(p => p.InvbillNum == itm).ToList();
var tax = inv.Tax;//税率
var amt = entitylist.Sum(p => p.Amt);//税前
var taxamt = amt + Math.Round(amt * tax, 2);//税后
var realamt = Math.Round(amt * tax, 2);//税额
invBill.Amt = amt;
invBill.TaxAmt = taxamt;
invBill.Tax = tax;
invBill.BusinessType = inv.BusinessType;
invBill.DETAIL = invls;
invBill.RealAmt = realamt;
invBilllist.Add(invBill);
}
}
}
else
{
throw new UserFriendlyException($"不存发票号为:{invbillnum}发票", "400");
}
}
else
{
throw new UserFriendlyException($"不存发票号为:{invbillnum}发票", "400");
}
//}
//else
//{
// throw new UserFriendlyException($"不存发票号:{invbillnum}对应的结算分组号");
//}
return ls;
return new JsonResult(new { Code = 200, Message = "生成成功", Data = invBilllist });
}
[HttpPost]
public virtual async Task<IActionResult> ReissueInvoiceList(List<PUB_ADJ_DETAIL_DTO> p_list)
{
var result = await _adjservice.CheckImport(p_list);
if (result != "OK")
{
return new JsonResult(new { Code = 400, Message = "请下载错误模版", fileName = result });
}
var first = p_list.FirstOrDefault();
var invbillnum = first.InvBillNum;
var invBilllist = new List<INVOICE_WAIT_DETAIL_DTO>();
List<INVOICE_WAIT_DETAIL_DTO> ls = new List<INVOICE_WAIT_DETAIL_DTO>();
var adjlist = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list);
if (adjlist == null && adjlist.Count == 0)
{
throw new UserFriendlyException($"调整表无数据!", "400");
}
//var mappingList = await GetMapGroupAsync(invbillnum);//发票对应结算分组
//if (mappingList != null && mappingList.Count() > 0)
//{
var version = int.Parse(DateTime.Now.ToString("yyyymm"));
//var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
var inv = await GetInvoiceGroupByInvBillNum(invbillnum);
var settle = await _pubMng.GetMainAsync(inv.InvGroupNum);
if (settle == null)
{
throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不在请检查!", "400");
}
version = settle.Version;
if (inv != null)
{
if (inv.InvoiceState == InvoiceBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态为报废状态不能重开!", "400");
}
if (inv.State == SettleBillState. || inv.State == SettleBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!", "400");
}
var bbaclist = await _pubMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count() > 0)
{
foreach (var itm in adjlist)
{
bbaclist.Add(new PUB_CAN_SA_DETAIL(
guid: itm.Id,
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
businessType: itm.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty,
partcode: itm.PartCode,
pobillnum: string.Empty
));
}
}
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
var priceList = _priceRepository.ToList();//价格单
//var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
//if (errorList.Count() > 0)
//{
// return await ExportErrorReportAsync(errorList);
//}
var dto1s = ObjectMapper.Map<List<PUB_CAN_SA_DETAIL>, List<PUB_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site//客户零件号
select new TEMP_CAN_SA_DETAIL
{
Id = d.Id,
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,
Price = p.Price,
BillNum = d.BillNum,
SettleDate = d.SettleDate,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
MaterialDesc = d.MaterialDesc,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
Amt = Math.Round(d.Qty * p.Price, 2),
ContractDocID = "N",
BeginDate = p.BeginTime,
EndDate = p.EndTime,
PartCode = d.PartCode
};
var dtos = q.ToList();
if (dtos != null && dtos.Count > 0)
{
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
{
var entities = await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
invBilllist.AddRange(ls.ToList());
//var invlist = ls.Select(p => p.InvbillNum).Distinct();
//foreach (var itm in invlist)
//{
// var invBill = new INVOICE_REPEAT_DTO();
// var invls = ls.Where(p => p.InvbillNum == itm).ToList();
// var entitylist = entities.Where(p => p.InvbillNum == itm).ToList();
// var tax = inv.Tax;//税率
// var amt = entitylist.Sum(p => p.Amt);//税前
// var taxamt = amt + Math.Round(amt * tax, 2);//税后
// var realamt = Math.Round(amt * tax, 2);//税额
// invBill.Amt = amt;
// invBill.TaxAmt = taxamt;
// invBill.Tax = tax;
// invBill.BusinessType = inv.BusinessType;
// invBill.DETAIL = invls;
// invBill.RealAmt = realamt;
// invBilllist.Add(invBill);
//}
}
else//二次开票
{
var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
//var invlist = ls.Select(p => p.InvbillNum).Distinct();
//foreach (var itm in invlist)
//{
// var invBill = new INVOICE_REPEAT_DTO();
// var invls = ls.Where(p => p.InvbillNum == itm).ToList();
// var entitylist = entities.Where(p => p.InvbillNum == itm).ToList();
// var tax = inv.Tax;//税率
// var amt = entitylist.Sum(p => p.Amt);//税前
// var taxamt = amt + Math.Round(amt * tax, 2);//税后
// var realamt = Math.Round(amt * tax, 2);//税额
// invBill.Amt = amt;
// invBill.TaxAmt = taxamt;
// invBill.Tax = tax;
// invBill.BusinessType = inv.BusinessType;
// invBill.DETAIL = invls;
// invBill.RealAmt = realamt;
// invBilllist.Add(invBill);
//}
invBilllist.AddRange(ls.ToList());
}
}
}
else
{
throw new UserFriendlyException($"不存发票号为:{invbillnum}发票", "400");
}
var invlist = invBilllist.OrderBy(p => p.PartCode).ToList();
//}
//else
//{
// throw new UserFriendlyException($"不存发票号:{invbillnum}对应的结算分组号");
//}
return new JsonResult(new { Code = 200, Message = "生成成功", Data = invBilllist });
}

44
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs

@ -6,6 +6,7 @@ using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
using SettleAccount.Domain.BQ;
using Volo.Abp;
using Volo.Abp.Data;
@ -77,33 +78,32 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
return new JsonResult(new { Code = 400, Message = "已创建发票不能重复创建" });
}
if (await _pubMng.SetForwardState(main, SettleBillState.))
var entitys = await _pubMng.GetDetalListAsync(billnum);
List<PriceList> priceList = new List<PriceList>();
if (main.BusinessType == EnumBusinessType.BeiJian)
{
var entitys = await _pubMng.GetDetalListAsync(billnum);
var groupNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
List<PriceList> priceList = new List<PriceList>();
if (main.BusinessType == EnumBusinessType.BeiJian)
{
var priceListbj = _pricebjRepository.ToList();//价格单
foreach (var itm in priceListbj)
{
priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price });
}
}
else
{
priceList = _priceRepository.ToList();//价格单
}
var errorList = await CheckInvoiceGenerationRules(entitys, priceList, main.BusinessType);//校验生成规则
if (errorList.Count() > 0)
var priceListbj = _pricebjRepository.Where(p => p.IsCancel == false).ToList(); //价格单
foreach (var itm in priceListbj)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorList) });
priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price });
}
}
else
{
priceList = _priceRepository.Where(p => p.IsCancel == false).ToList();//价格单
}
var errorList = await CheckInvoiceGenerationRules(entitys,main.Site,priceList, main.BusinessType);//校验生成规则
if (errorList.Count() > 0)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorList) });
}
if (await _pubMng.SetForwardState(main, SettleBillState.))
{
var groupNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
var dto1s = ObjectMapper.Map<List<PUB_CAN_SA_DETAIL>, List<PUB_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == main.Site
select new TEMP_CAN_SA_DETAIL
{
Id = d.Id,
@ -130,9 +130,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
if (billnum.Substring(0, 1) == "C")//一次开票
{
await FirstInvoice(entitys, new List<PUB_ADJ_DETAIL>(), dtos, new List<TEMP_NOT_SA_DETAIL>(), main.Version, main.InvGroupNum, string.Empty, main.BusinessType);
}
else//二次开票
{

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_NOT_SA_SERVICE.cs

@ -61,7 +61,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
errorlist.Add(new ERR_EXP_DTO() { Message = itm });
}
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorlist) });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = await ExportErrorReportAsync(errorlist) });
}
}

8
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs

@ -246,7 +246,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = fileName });
}
#endregion
@ -283,7 +283,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = fileName });
}
#endregion
@ -313,7 +313,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = fileName });
}
#endregion
@ -344,7 +344,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = fileName });
}
#endregion

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PURCHASE_PRICE_SERVICE.cs

@ -73,7 +73,7 @@ public class PURCHASE_PRICE_SERVICE : SettleAccountApplicationBase<PURCHASE_PRIC
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = fileName });
}
foreach (var itm in _ls)
{

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs

@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using System.Threading.Tasks;
using Coravel.Invocable;

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/TB_RePartsRelationship_SERVICE.cs

@ -91,7 +91,7 @@ public class TB_RePartsRelationship_SERVICE : SettleAccountApplicationBase<TB_Re
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = fileName });
}
foreach (var itm in _ls)
{

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs

@ -75,7 +75,7 @@ public class MaterialRelationshipAppService : SettleAccountApplicationBase<Mater
if (checkList.Count > 0)
{
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName });
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "请下载错误信息", fileName = fileName });
}
foreach (var itm in _ls)
{

7
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs

@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using SettleAccount.Bases;
using SettleAccount.Domain.BQ;
using System;
using System.Collections.Generic;
using System.Linq;
@ -200,7 +201,7 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices
return errorList;
}
public async Task<List<TEntity>> CheckPriceList<TEntity>(List<TEntity> p_list,bool isBj=false)
public async Task<List<TEntity>> CheckPriceList<TEntity>(List<TEntity> p_list,string p_site,bool isBj=false)
where TEntity : ISA_BASE,new()
{
List<TEntity> errorList = new List<TEntity>();
@ -225,7 +226,7 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices
}
else
{
var pricebjlist = _priceRepository.ToList();
var pricebjlist = _priceRepository.Where(p=>p.ClientCode==p_site).ToList();
var inner = from d in p_list
join p in pricebjlist on d.LU equals p.LU
@ -244,8 +245,8 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices
return errorList;
}
}
}

7
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs

@ -399,6 +399,10 @@ namespace SettleAccount.Bases
/// 匹配类型
/// </summary>
public EnumMappingType MappingType { get; set; }
}
public class SA_CAN_BASE : AuditedAggregateRoot<Guid>, ISA_BASE
@ -461,6 +465,9 @@ namespace SettleAccount.Bases
public string PartCode { get; set; }
public string RealPartCode { get; set; }
public string Site { get; set; }
//public SA_CAN_BASE(int version, decimal price, string billNum, DateTime settleDate, string invGroupNum, string lU, string pN, string keyCode, decimal qty, string groupNum)
//{
// Version = version;

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs

@ -88,8 +88,8 @@ public class BBAC_CAN_SA_DETAIL: SA_CAN_BASE
/// <summary>
/// 选择工厂导入
/// </summary>
[Display(Name = "工厂地点")]
public string Site { get; set; } = null!;
//[Display(Name = "工厂地点")]
//public string Site { get; set; } = null!;
/// <summary>
/// 对应字段Quantity

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs

@ -90,8 +90,8 @@ public class HBPO_CAN_SA_DETAIL:SA_CAN_BASE
/// <summary>
/// 对应字段filename 区分 cn1、cn5
/// </summary>
[Display(Name = "工厂地点")]
public string Site { get; set; } = null!;
//[Display(Name = "工厂地点")]
//public string Site { get; set; } = null!;
///// <summary>
///// 对应字段Qty

3
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs

@ -56,6 +56,9 @@ public class INVOICE_GRP : FullAuditedAggregateRoot<Guid>
public decimal RealAmt { get; set; }
[Display(Name = "地点")]
public string Site { get; set; }

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs

@ -47,9 +47,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
public virtual async Task<List<string>> GenerateSettlementOrder(List<BBAC_NOT_SA_DETAIL> p_list)
{
var first = p_list.FirstOrDefault();
List<string> errors = new List<string>();
var priceErrors = await _service.CheckPriceList(p_list);
var priceErrors = await _service.CheckPriceList(p_list,first.Site);
if (priceErrors.Count > 0)
{
foreach (var itm in priceErrors)
@ -70,6 +71,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_entity.Version = int.Parse(DateTime.Now.ToString("yyyyMM"));
_entity.State = SettleBillState.;
_entity.SettleBillNum = string.Empty;
_entity.Site = first.Site;
_entity.BusinessType = EnumBusinessType.JisBBAC;
var _entityList = new List<BBAC_CAN_SA_DETAIL>();
foreach (var itm in p_list)

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs

@ -29,7 +29,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
private readonly INormalEfCoreRepository<HBPO_CAN_SA_DETAIL, Guid> _detailRepository;
private readonly INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> _notRepository;
private readonly BaseDomainService _service;
public HBPO_NOT_SA_MNG()
{
}
@ -51,7 +50,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
var first=p_list.FirstOrDefault();
List<string> errors = new List<string>();
var priceErrors = await _service.CheckPriceList(p_list);
var priceErrors = await _service.CheckPriceList(p_list,first.Site);
if (priceErrors.Count > 0)
{
foreach (var itm in priceErrors)
@ -83,6 +82,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_entity.SettleBillNum = string.Empty;
_entity.BusinessType = p_list.FirstOrDefault().BusinessType;
_entity.SetId(Guid.NewGuid());
_entity.Site = first.Site;
var _entityList = new List<HBPO_CAN_SA_DETAIL>();
foreach (var itm in p_list)
{

27
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs

@ -1,6 +1,7 @@
using EFCore.BulkExtensions;
using EmptyFiles;
using Hangfire;
using Microsoft.AspNetCore.Razor.Language.Intermediate;
using Microsoft.AspNetCore.SignalR;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.EntityFrameworkCore;
@ -40,6 +41,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository;
private readonly INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> _groupRepository;
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _detailRepository;
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _notRepository;
private readonly INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> _adjRepository;
protected readonly INormalEfCoreRepository<CodeSetting, Guid> _codesetRepository;
@ -369,7 +372,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
/// <summary>
/// 获得发票主表
/// </summary>
/// <param name="p_billNum"></param>
/// <returns></returns>
/// <summary>
@ -1246,7 +1254,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
taxDiff: 0,
clientCode: string.Empty,
realAmt: readAmt
);
invbill.Site = dtos.FirstOrDefault().Site;
invlist.Add(invbill);
}
await _repository.DbContext.BulkInsertAsync(invlist);
@ -1343,7 +1355,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
foreach (var detail in adjdetails)
{
detail.InvBillNum = key;
adjdetails.Add(detail);
}
}
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID, p.LU })
@ -1478,6 +1489,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
clientCode: string.Empty,
realAmt: realAmt
);
invbill.Site= dtos.FirstOrDefault().Site;
invbill.CreationTime = DateTime.Now;
invlist.Add(invbill);
}
@ -1747,6 +1759,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
realAmt:0
);
invbill.Site = dtos.FirstOrDefault().Site;
invbill.CreationTime = DateTime.Now;
invlist.Add(invbill);
}
@ -1973,6 +1986,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
clientCode: string.Empty,
realAmt: realAmt
);
invbill.Site = dtos.FirstOrDefault().Site;
invbill.CreationTime = DateTime.Now;
invlist.Add(invbill);
}
@ -2002,7 +2016,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
[UnitOfWork(false)]
/// <summary>
/// 重开一次开票
/// </summary>
@ -2401,5 +2415,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
return false;
}
}
}

84
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs

@ -21,6 +21,7 @@ using Volo.Abp.Data;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;
using Volo.Abp.Uow;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Entities.BQ.Temp;
using Win.Sfs.SettleAccount.Entities.Prices;
@ -261,7 +262,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
return detailList;
}
[UnitOfWork(false)]
public async Task<List<INVOICE_WAIT_DETAIL>> FirstInvoiceExtend<TDetail>(List<TDetail> p_list, List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> dtos, List<TEMP_NOT_SA_DETAIL> p_notlist, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType)
where TDetail : SA_CAN_BASE
{
@ -315,35 +316,32 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
if (invoiceMap.Keys.Count > 0)
{
var groupList = new List<INVOICE_MAP_GROUP>();
var notDetialList = new List<INVOICE_NOT_SETTLE>();
var invlist = new List<INVOICE_GRP>();
var salist = new List<TDetail>();
var adjlist = new List<PUB_ADJ_DETAIL>();
foreach (var itm in invoiceMap)//分组影响和
{
var key = itm.Key;//发票票号
var ls = itm.Value;//结算分组号列表
//反向查找结算数据
var invdetails = p_list.Where(p => ls.Contains(p.GroupNum)).ToList();
foreach (var detail in invdetails)
{
detail.InvbillNum = key;
salist.Add(detail);
}
if (!string.IsNullOrEmpty(p_parentInvBillNum))
{
//反向查找调整数据
var adjdetails = p_adjlist.Where(p => ls.Contains(p.GroupNum)).ToList();
foreach (var detail in adjdetails)
{
detail.InvBillNum = key;
adjdetails.Add(detail);
}
}
//foreach (var detail in invdetails)
//{
// detail.InvbillNum = key;
// salist.Add(detail);
//}
//if (!string.IsNullOrEmpty(p_parentInvBillNum))
//{
// //反向查找调整数据
// var adjdetails = p_adjlist.Where(p => ls.Contains(p.GroupNum)).ToList();
// foreach (var detail in adjdetails)
// {
// detail.InvBillNum = key;
// adjdetails.Add(detail);
// }
//}
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID })
.Select(itm => new
@ -405,31 +403,31 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
detailList.AddRange(_entityDetailList);
}
var innotls = new List<INVOICE_NOT_SETTLE>();
if (p_notlist != null && p_notlist.Count > 0)
{
var notls = p_notlist.Where(p=>ls.Contains(p.GroupNum)).GroupBy(p => new { p.GroupNum, p.LU }).Select(p => new { GroupNum = p.Key.GroupNum, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty) });
foreach (var nitm in notls)
{
innotls.Add(new INVOICE_NOT_SETTLE(
guid: GuidGenerator.Create(),
version: p_version,
invGroupNum: p_InvGroupNum,
settleGroupNum: nitm.GroupNum,
lU: string.Empty,
lU1: nitm.LU,
extend1: string.Empty,
extend2: string.Empty,
qty: nitm.Qty,
p_invbillnum:key
//var innotls = new List<INVOICE_NOT_SETTLE>();
//if (p_notlist != null && p_notlist.Count > 0)
//{
// var notls = p_notlist.Where(p=>ls.Contains(p.GroupNum)).GroupBy(p => new { p.GroupNum, p.LU }).Select(p => new { GroupNum = p.Key.GroupNum, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty) });
// foreach (var nitm in notls)
// {
// innotls.Add(new INVOICE_NOT_SETTLE(
// guid: GuidGenerator.Create(),
// version: p_version,
// invGroupNum: p_InvGroupNum,
// settleGroupNum: nitm.GroupNum,
// lU: string.Empty,
// lU1: nitm.LU,
// extend1: string.Empty,
// extend2: string.Empty,
// qty: nitm.Qty,
// p_invbillnum:key
));
}
if (innotls.Count > 0)
{
notDetialList.AddRange(innotls);
}
}
// ));
// }
// if (innotls.Count > 0)
// {
// notDetialList.AddRange(innotls);
// }
//}
var invbill = new INVOICE_GRP
(guid: GuidGenerator.Create(),
realnvBillNum: string.Empty,

6
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs

@ -76,11 +76,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
if (first.BusinessType == EnumBusinessType.BeiJian)
{
name = "备件";
priceErrors = await _service.CheckPriceList(notlist,true);
priceErrors = await _service.CheckPriceList(notlist,first.Site,true);
}
else
{
priceErrors = await _service.CheckPriceList(notlist);
priceErrors = await _service.CheckPriceList(notlist,first.Site);
}
if (priceErrors.Count > 0)
{
@ -102,6 +102,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_entity.State = SettleBillState.;
_entity.SettleBillNum = string.Empty;
_entity.BusinessType = first.BusinessType;
_entity.Site = first.Site;
var _entityList = new List<PUB_CAN_SA_DETAIL>();
foreach (var itm in notlist)
{

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs

@ -82,8 +82,8 @@ public class PUB_CAN_SA_DETAIL : SA_CAN_BASE
/// <summary>
/// 对应字段filename 区分 cn1、cn5
/// </summary>
[Display(Name = "工厂地点")]
public string Site { get; set; } = null!;
//[Display(Name = "工厂地点")]
//public string Site { get; set; } = null!;
/// <summary>
/// 对应字段Qty

5793
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230909013408_202309090001.Designer.cs

File diff suppressed because it is too large

178
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230909013408_202309090001.cs

@ -0,0 +1,178 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202309090001 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Site",
table: "Set_INVOICE_GRP",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
column: "ConcurrencyStamp",
value: "dece69c1928241df9f38feccf47d0c0a");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
column: "ConcurrencyStamp",
value: "431db509a1f34bfe9fd1a4d7efcf1d4c");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "06df83918cbc4543a2b44a83f739dc67");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "9004a8ecf43a4fe1848f6802a6d4576f");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "960ce38962e949558923f71d04f4e338");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "f9c840d4749b410982c3288ce64a8691");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "de291b54ac7e487988bb2660050b0db4");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "3ec6e8d3979a41088508d5ec64f5118a");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "e5bf812fc44e445991f4a7b6ece063db");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
column: "ConcurrencyStamp",
value: "18add54a57684dd1818440f0d5005ebb");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "03899f76c20043e896f38246ccb0d037");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Site",
table: "Set_INVOICE_GRP");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
column: "ConcurrencyStamp",
value: "1aefd0b8d1ab49458c36e3932717ab35");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
column: "ConcurrencyStamp",
value: "6b33d7dda3f645dcbe8b4a3f51a7399f");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "22c0f3b78cf8410392dbaf098eecc973");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "25d4d2fdf5e6403188ccd684459a6a47");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "9475ae5b030a480b81c539f9eeabd7d5");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "cdd7dba0132b488aa38becaebc9725eb");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "f54dc633986d4eba9ce0793f450545c0");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "d3521bfcefe94a38962bd1b7d72ed219");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "c63da47e046c4d8cbe927a450388df2f");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
column: "ConcurrencyStamp",
value: "024d5742d21c41e4b63052f4e03f15f8");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "ff08e4cbf0c0461d8426470f9b84bf62");
}
}
}

25
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

@ -2505,6 +2505,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Site")
.HasColumnType("nvarchar(max)");
b.Property<int>("State")
.HasColumnType("int");
@ -4474,7 +4477,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
ConcurrencyStamp = "024d5742d21c41e4b63052f4e03f15f8",
ConcurrencyStamp = "18add54a57684dd1818440f0d5005ebb",
Cron = "0 0 8 26 *",
IsDisabled = false,
IsRunning = false,
@ -4484,7 +4487,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
ConcurrencyStamp = "1aefd0b8d1ab49458c36e3932717ab35",
ConcurrencyStamp = "dece69c1928241df9f38feccf47d0c0a",
Cron = "0 0/1 * * * ?",
IsDisabled = false,
IsRunning = false,
@ -4494,7 +4497,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
ConcurrencyStamp = "6b33d7dda3f645dcbe8b4a3f51a7399f",
ConcurrencyStamp = "431db509a1f34bfe9fd1a4d7efcf1d4c",
Cron = "0 0/1 * * * ?",
IsDisabled = false,
IsRunning = false,
@ -4504,7 +4507,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
ConcurrencyStamp = "f54dc633986d4eba9ce0793f450545c0",
ConcurrencyStamp = "de291b54ac7e487988bb2660050b0db4",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4514,7 +4517,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
ConcurrencyStamp = "22c0f3b78cf8410392dbaf098eecc973",
ConcurrencyStamp = "06df83918cbc4543a2b44a83f739dc67",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4524,7 +4527,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
ConcurrencyStamp = "9475ae5b030a480b81c539f9eeabd7d5",
ConcurrencyStamp = "960ce38962e949558923f71d04f4e338",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4534,7 +4537,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
ConcurrencyStamp = "25d4d2fdf5e6403188ccd684459a6a47",
ConcurrencyStamp = "9004a8ecf43a4fe1848f6802a6d4576f",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4544,7 +4547,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
ConcurrencyStamp = "ff08e4cbf0c0461d8426470f9b84bf62",
ConcurrencyStamp = "03899f76c20043e896f38246ccb0d037",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4554,7 +4557,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
ConcurrencyStamp = "cdd7dba0132b488aa38becaebc9725eb",
ConcurrencyStamp = "f9c840d4749b410982c3288ce64a8691",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4564,7 +4567,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
ConcurrencyStamp = "c63da47e046c4d8cbe927a450388df2f",
ConcurrencyStamp = "e5bf812fc44e445991f4a7b6ece063db",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4574,7 +4577,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
ConcurrencyStamp = "d3521bfcefe94a38962bd1b7d72ed219",
ConcurrencyStamp = "3ec6e8d3979a41088508d5ec64f5118a",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,

Loading…
Cancel
Save