Merge branch 'master' of https://codeup.aliyun.com/62ce7bca487c500c27f70a79/OPS/WMS-Api
This commit is contained in:
@@ -44,18 +44,19 @@ namespace WMS.Web.Api.Controllers
|
||||
[Route("hj")]
|
||||
public async Task<string> TestHJ()
|
||||
{
|
||||
//var t=await _outStockTaskRepositories.Get(1);
|
||||
// t.Details[0].Remark = "sdf";
|
||||
// t.Details[0].ErpDetails[0].SaleBillNo = "sdfsfsbbbb";
|
||||
// var s = await _outStockTaskRepositories.Edit(t);
|
||||
//var t=await _outStockTaskRepositories.Get(1);
|
||||
// t.Details[0].Remark = "sdf";
|
||||
// t.Details[0].ErpDetails[0].SaleBillNo = "sdfsfsbbbb";
|
||||
// var s = await _outStockTaskRepositories.Edit(t);
|
||||
// await _boxService.Sync();
|
||||
//var res = await this._erpService.BillQueryForDeliveryNoticeOutStock(null,DateTime.Now.AddDays(-300));
|
||||
var res = await this._erpService.BillQueryForAssembledAppOutStock_Dassembly(null,DateTime.Now.AddDays(-300));
|
||||
//var result= await this._erpService.BillQueryForPurchaseInStock();
|
||||
//var result = await this._erpService.BillQueryForOrg();
|
||||
var result = await this._erpService.BillQueryForMaterial();
|
||||
if (!result.IsSuccess)
|
||||
return "";
|
||||
return JsonConvert.SerializeObject(result.Data);
|
||||
//var result = await this._erpService.BillQueryForMaterial();
|
||||
//if (!result.IsSuccess)
|
||||
// return "";
|
||||
//return JsonConvert.SerializeObject(result.Data);
|
||||
return "";
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
|
||||
@@ -961,12 +961,12 @@
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStock.SuccessSync">
|
||||
<summary>
|
||||
同步成功或者失败 null 就是未同步
|
||||
同步成功或者失败 默认是失败状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStock.SuccessSyncFail">
|
||||
<summary>
|
||||
同步失败的源订单号
|
||||
同步失败的源订单号(默认就包含所有来源单号)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStock.SyncTime">
|
||||
@@ -986,13 +986,19 @@
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Entitys.OutStock.Create(System.Int32,WMS.Web.Domain.Entitys.OutStockTask)">
|
||||
<summary>
|
||||
创建
|
||||
创建(需要在明细都生成后最后调用)
|
||||
</summary>
|
||||
<param name="creatorId"></param>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Entitys.OutStock.Sync(System.Collections.Generic.List{System.String},System.Boolean,System.Int32,System.String)">
|
||||
<member name="M:WMS.Web.Domain.Entitys.OutStock.SyncSuccess(System.String,System.Int32)">
|
||||
<summary>
|
||||
同步金蝶
|
||||
同步金蝶(成功)
|
||||
</summary>
|
||||
<param name="operateId"></param>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Entitys.OutStock.SyncFail(System.String,System.Int32)">
|
||||
<summary>
|
||||
同步金蝶(失败)
|
||||
</summary>
|
||||
<param name="operateId"></param>
|
||||
</member>
|
||||
@@ -3394,6 +3400,13 @@
|
||||
<param name="dto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.OutStockService.Push(WMS.Web.Core.Dto.Erp.ErpPushDto)">
|
||||
<summary>
|
||||
下推
|
||||
</summary>
|
||||
<param name="dto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Services.OutStockTaskService">
|
||||
<summary>
|
||||
出库任务
|
||||
|
||||
@@ -62,12 +62,12 @@ namespace WMS.Web.Domain.Entitys
|
||||
[Column("CreateTime")]
|
||||
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||
/// <summary>
|
||||
/// 同步成功或者失败 null 就是未同步
|
||||
/// 同步成功或者失败 默认是失败状态
|
||||
/// </summary>
|
||||
[Column("SuccessSync")]
|
||||
public bool? SuccessSync { get; set; }
|
||||
public bool SuccessSync { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 同步失败的源订单号
|
||||
/// 同步失败的源订单号(默认就包含所有来源单号)
|
||||
/// </summary>
|
||||
[Column("SuccessSyncFail")]
|
||||
public List<string> SuccessSyncFail { get; set; }=new List<string>();
|
||||
@@ -86,7 +86,7 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// </summary>
|
||||
public List<OutStockDetails> Details = new List<OutStockDetails>();
|
||||
/// <summary>
|
||||
/// 创建
|
||||
/// 创建(需要在明细都生成后最后调用)
|
||||
/// </summary>
|
||||
/// <param name="creatorId"></param>
|
||||
public void Create(int creatorId, OutStockTask task)
|
||||
@@ -97,16 +97,28 @@ namespace WMS.Web.Domain.Entitys
|
||||
this.ReceiptCustomerId = task.ReceiptCustomerId;
|
||||
this.CreatorId = creatorId;
|
||||
this.CreateTime = DateTime.Now;
|
||||
this.SuccessSync = false;
|
||||
this.SuccessSyncFail = this.Details.SelectMany(s => s.ErpDetails).GroupBy(g => g.SourceBillNo).Select(s=>s.Key).ToList();
|
||||
}
|
||||
/// <summary>
|
||||
/// 同步金蝶
|
||||
/// 同步金蝶(成功)
|
||||
/// </summary>
|
||||
/// <param name="operateId"></param>
|
||||
public void Sync(List<string> sourcBilNos, bool isSuccess, int operateId, string remark)
|
||||
public void SyncSuccess(string sourcNos, int operateId)
|
||||
{
|
||||
SuccessSyncFail.AddRange(sourcBilNos);
|
||||
SuccessSyncFail.Distinct();
|
||||
this.SuccessSync = isSuccess;
|
||||
this.SuccessSyncFail.Remove(sourcNos);
|
||||
this.SuccessSync = true;
|
||||
this.Remark = "";
|
||||
this.OperateId = operateId;
|
||||
this.SyncTime = DateTime.Now;
|
||||
}
|
||||
/// <summary>
|
||||
/// 同步金蝶(失败)
|
||||
/// </summary>
|
||||
/// <param name="operateId"></param>
|
||||
public void SyncFail(string remark,int operateId)
|
||||
{
|
||||
this.SuccessSync = false;
|
||||
this.Remark = remark;
|
||||
this.OperateId = operateId;
|
||||
this.SyncTime = DateTime.Now;
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Dto.Login;
|
||||
using WMS.Web.Core.Dto.Login.Temp;
|
||||
using WMS.Web.Core.Dto.Login.Temp.v3;
|
||||
using WMS.Web.Core.Help;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Mappers
|
||||
{
|
||||
@@ -61,7 +64,11 @@ namespace WMS.Web.Domain.Mappers
|
||||
.ForMember(x => x.Roles, opt => opt.Ignore()).ReverseMap();
|
||||
|
||||
|
||||
|
||||
CreateMap<FileDownManager, FileDownInfoManagerResponse>()
|
||||
.ForMember(x => x.Date, ops => ops.MapFrom(x => x.Date.DateToStringSeconds()))
|
||||
//.ForMember(x => x.StatusKey, ops => ops.MapFrom(x => (int)x.Status))
|
||||
// .ForMember(x => x.Status, ops => ops.MapFrom(x => x.Status.GetRemark()))
|
||||
.ForMember(x => x.Type, ops => ops.MapFrom(x => (int)x.Type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,17 +46,17 @@ namespace WMS.Web.Domain.QuartzJob
|
||||
{
|
||||
//2.记录:开始时间
|
||||
var begindatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
_logger.LogInformation($"出库单-同步金蝶入库单数据:执行开始时间->{begindatetime}");
|
||||
_logger.LogInformation($"出库单-同步金蝶出库单数据:执行开始时间->{begindatetime}");
|
||||
//3.同步数据
|
||||
var result = await _outStockTaskService.Sync(null);
|
||||
//5.记录:结束时间
|
||||
var enddatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
_logger.LogInformation($"出库单-同步金蝶入库单数据:执行结束时间->{begindatetime}");
|
||||
_logger.LogInformation($"出库单-同步金蝶出库单数据:执行结束时间->{begindatetime}");
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogInformation($"同步金蝶入库单数据:定时任务执行失败->{ex.Message}");
|
||||
_logger.LogInformation($"同步金蝶出库单数据:定时任务执行失败->{ex.Message}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,7 +56,8 @@ namespace WMS.Web.Domain.Services
|
||||
{
|
||||
//数据库里已经存在箱信息 移除
|
||||
var box = list.FirstOrDefault(f => f.BoxBillNo.Equals(s));
|
||||
list.Remove(box);
|
||||
if (box != null)
|
||||
list.Remove(box);
|
||||
}
|
||||
var boxs = _mapper.Map<List<Box>>(list);
|
||||
|
||||
@@ -75,13 +76,14 @@ namespace WMS.Web.Domain.Services
|
||||
var ops_box = list.FirstOrDefault(f => f.OpsBoxId == b.OpsBoxId);
|
||||
foreach (var sn in ops_box.Details.SelectMany(s => s.SerialNumbers))
|
||||
{
|
||||
var detail = ops_box.Details.FirstOrDefault(f => f.SerialNumbers.Select(s=>s.SerialNumber).Equals(sn.SerialNumber));
|
||||
if (detail == null) continue;
|
||||
var detail = ops_box.Details.FirstOrDefault(f => f.SerialNumbers.Select(s => s.SerialNumber).Contains(sn.SerialNumber));
|
||||
if (detail == null)
|
||||
continue;
|
||||
var opsSerial = list.FirstOrDefault(f => f.OpsBoxId == b.OpsBoxId).Details
|
||||
.SelectMany(s => s.SerialNumbers)
|
||||
.FirstOrDefault(s => s.SerialNumber.Equals(sn.SerialNumber));
|
||||
//序列号
|
||||
SerialNumbers s = new SerialNumbers(sn.SerialNumber, detail.MaterialId,b.Id,b.OpsBoxId, opsSerial.BarCereateUser,opsSerial.BarCreateTime);
|
||||
SerialNumbers s = new SerialNumbers(sn.SerialNumber, detail.MaterialId, b.Id, b.OpsBoxId, opsSerial.BarCereateUser, opsSerial.BarCreateTime);
|
||||
sList.Add(s);
|
||||
//序列号记录(序列号生成)
|
||||
SerialNumberOperate so = new SerialNumberOperate(sn.SerialNumber, SerialNumberOperateType.Generate, detail.MaterialId, opsSerial.BarCereateUser, "", b.SupplierId, b.OrgId, null, opsSerial.BarCreateTime);
|
||||
|
||||
@@ -48,6 +48,8 @@ namespace WMS.Web.Domain.Services
|
||||
/// <returns></returns>
|
||||
public async Task<Result> ChangeBoxSave(SaveChangeBoxRecordRequest dto, LoginInDto loginInfo, bool isTransaction = false)
|
||||
{
|
||||
//1.有原箱时 需要判断 物料对应的序列号是否存在
|
||||
|
||||
List<Box> boxList = new List<Box>();
|
||||
//原箱有可能没有
|
||||
var srcBox = await _boxRepositories.Get(dto.SrcBoxId);
|
||||
@@ -70,6 +72,8 @@ namespace WMS.Web.Domain.Services
|
||||
if (destBox != null)
|
||||
boxList.Add(destBox);
|
||||
|
||||
//2.修改库存时需要区别 有原箱和没有原箱的情况
|
||||
|
||||
//var entity = _mapper.Map<ChangeBoxRecord>(dto);\
|
||||
List<ChangeBoxRecord> list = new List<ChangeBoxRecord>();
|
||||
foreach (var d in dto.Details)
|
||||
@@ -111,6 +115,8 @@ namespace WMS.Web.Domain.Services
|
||||
/// <returns></returns>
|
||||
public async Task<Result> MoveBoxSave(List<SaveMoveBoxRecordRequest> dto, bool IsUp, LoginInDto loginInfo)
|
||||
{
|
||||
//1.下架时 需要验证箱是否在库存里
|
||||
|
||||
List<MoveBoxRecord> entityList = new List<MoveBoxRecord>();
|
||||
foreach (var d in dto)
|
||||
{
|
||||
@@ -118,8 +124,8 @@ namespace WMS.Web.Domain.Services
|
||||
entity.Create(IsUp == true ? MoveBoxType.Up : MoveBoxType.Down, d.BoxId, d.SubStockId, loginInfo.UserInfo.StaffId);
|
||||
entityList.Add(entity);
|
||||
}
|
||||
//需要填写规格型号
|
||||
//需要修改库存
|
||||
|
||||
//2.需要修改库存
|
||||
|
||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||
bool isRollback = false;
|
||||
|
||||
@@ -6,15 +6,18 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Dto.Erp;
|
||||
using WMS.Web.Core.Dto.Login;
|
||||
using WMS.Web.Core.Dto.OutStock;
|
||||
using WMS.Web.Core.Dto.TakeStock;
|
||||
using WMS.Web.Core.Help;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Domain.IService;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
using WMS.Web.Domain.Values;
|
||||
using WMS.Web.Domain.Values.Erp;
|
||||
|
||||
namespace WMS.Web.Domain.Services
|
||||
{
|
||||
@@ -62,10 +65,10 @@ namespace WMS.Web.Domain.Services
|
||||
var ex = dto.Details.Select(s => s.MaterialId).Except(outStockTask.Details.Select(s => s.MaterialId)).ToList();
|
||||
if (ex.Count() > 0)
|
||||
return Result.ReFailure(ResultCodes.OutStockMaterialError);
|
||||
//1.需要验证物料对应箱和序列号是否存在库存
|
||||
|
||||
var mIds = dto.Details.GroupBy(g => g.MaterialId).Select(s => s.Key).ToList();
|
||||
OutStock entity = new OutStock();
|
||||
entity.Create(loginInfo.UserInfo.StaffId, outStockTask);
|
||||
foreach (var mid in mIds)
|
||||
{
|
||||
//任务单明细
|
||||
@@ -90,6 +93,8 @@ namespace WMS.Web.Domain.Services
|
||||
outd.SerialNumbers.AddRange(dtoDetails.SelectMany(s => s.SerialNumbers));
|
||||
entity.Details.Add(outd);
|
||||
}
|
||||
entity.Create(loginInfo.UserInfo.StaffId, outStockTask);
|
||||
|
||||
|
||||
//需要填写序列号
|
||||
//需要修改库存
|
||||
@@ -122,13 +127,43 @@ namespace WMS.Web.Domain.Services
|
||||
var list = await _outStockRepositories.GetEntityList(dto.Ids);
|
||||
foreach (var entity in list)
|
||||
{
|
||||
//下推金蝶
|
||||
var res = await _erpService.Push(new Core.Dto.Erp.ErpPushDto() { });
|
||||
entity.Sync(new List<string>(), res.IsSuccess, loginInfo.UserInfo.StaffId, res.Message);
|
||||
if (entity.SuccessSync) continue;
|
||||
List<string> failList = entity.SuccessSyncFail.Clone();//同步失败的来源单号
|
||||
//找到单据里需要同步的单据
|
||||
var sourcNos = entity.Details.SelectMany(s => s.ErpDetails).GroupBy(s => s.SourceBillNo).Select(s => s.Key);
|
||||
foreach (var s in failList)
|
||||
{
|
||||
var erp_details = entity.Details.SelectMany(s => s.ErpDetails).Select(s => s.Erp_DetailId).ToList();
|
||||
var erpDto = new ErpPushDto() {
|
||||
FormId = FormIdParam.SAL_DELIVERYNOTICE.ToString(),
|
||||
Numbers = new List<string>() { s },
|
||||
Type="",
|
||||
DetailsId = string.Join(",", erp_details)
|
||||
};
|
||||
//下推金蝶
|
||||
var res = await this.Push(erpDto);
|
||||
if (res.IsSuccess)
|
||||
entity.SyncSuccess(s, loginInfo.UserInfo.StaffId);
|
||||
else
|
||||
entity.SyncFail(res.Message, loginInfo.UserInfo.StaffId);
|
||||
}
|
||||
entity.SuccessSync = entity.SuccessSyncFail.Count() > 0 ? false : true;
|
||||
//最好一条一条执行,否则执行失败 但是金蝶那边又同步成功 就会造成数据比价乱
|
||||
var isSuccess = await _outStockRepositories.Edit(entity, true);
|
||||
if (entity == null) return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
}
|
||||
var isSuccess = await _outStockRepositories.EditEntityList(list, true);
|
||||
if (!isSuccess) return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
|
||||
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
/// <summary>
|
||||
/// 下推
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<Result> Push(ErpPushDto dto)
|
||||
{
|
||||
var res = await _erpService.Push(dto);
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1623,7 +1623,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
//4.仓库:wms系统的仓库值---现在这个没有加,因为还单点没有和金蝶同步 FBillTypeID
|
||||
param.FilterString = "FDocumentStatus='C' and FAffairType='Dassembly' and FBillTypeID='3441ac133848446f824d0ab760c8b3c7'";
|
||||
//string srt = JsonConvert.SerializeObject(stocks_codes);
|
||||
param.FilterString += " and FSrcStockID in (" + stocks_codes + ")";
|
||||
param.FilterString += " and FStockID in (" + stocks_codes + ")";
|
||||
|
||||
//根据原订单号查询
|
||||
if (sourceBillNos != null && sourceBillNos.Count() > 0)
|
||||
@@ -1779,7 +1779,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
//4.仓库:wms系统的仓库值---现在这个没有加,因为还单点没有和金蝶同步 FBillTypeID
|
||||
param.FilterString = "FDocumentStatus='C' and FAffairType='Assembly' and FBillTypeID='3441ac133848446f824d0ab760c8b3c7'";
|
||||
//string srt = JsonConvert.SerializeObject(stocks_codes);
|
||||
param.FilterString += " and FSrcStockID in (" + stocks_codes + ")";
|
||||
param.FilterString += " and FStockIDSETY in (" + stocks_codes + ")";
|
||||
|
||||
//根据原订单号查询
|
||||
if (sourceBillNos != null && sourceBillNos.Count() > 0)
|
||||
|
||||
Reference in New Issue
Block a user