Files
WMS-Api/src/WMS.Web.Domain/Entitys/InStockErpDetails.cs
tongfei add492744f 优化
2024-03-30 15:06:42 +08:00

106 lines
2.8 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using WMS.Web.Core;
using WMS.Web.Domain.Values;
namespace WMS.Web.Domain.Entitys
{
/// <summary>
/// wms入库单ERP明细
/// </summary>
[Serializable]
[Table("t_wms_instock_erp_details")]
public class InStockErpDetails : EntityBase
{
public InStockErpDetails() { }
/// <summary>
/// ID
/// </summary>
public override int Id { get; set; }
/// <summary>
/// 单据头ID
/// </summary>
public int Fid { get; set; }
/// <summary>
/// 对应金蝶的明细ID
/// </summary>
public int ErpDetailId { get; set; }
/// <summary>
/// 来源单号
/// </summary>
public string SourceBillNo { get; set; }
/// <summary>
/// 物料编码
/// </summary>
public string MaterialNumber { get; set; }
/// <summary>
/// 数量
/// </summary>
public decimal Qty { get; set; }
/// <summary>
/// 同步成功或者失败 默认是失败状态
/// </summary>
public SyncStatus SuccessSync { get; set; } = SyncStatus.SyncIng;
/// <summary>
/// 同步到金蝶后金蝶的单据Id
/// </summary>
public string ErpSyncBillNo { get; set; }
/// <summary>
/// 批号
/// </summary>
public string BatchBillNo { get; set; }
/// <summary>
/// 箱唛编号-首位
/// </summary>
public int? FirstBillNo { get; set; }
/// <summary>
/// 箱唛编号-末尾序号
/// </summary>
public int? LastBillNo { get; set; }
/// <summary>
/// 生成批号
/// </summary>
/// <param name="firstBillNo"></param>
/// <param name="lastBillNo"></param>
public void GenerateBatchBillNo(int firstBillNo,int lastBillNo,bool isBatchManage)
{
if (isBatchManage)
{
this.FirstBillNo = Convert.ToInt32(DateTime.Now.ToString("yyMMdd"));
if (this.FirstBillNo == firstBillNo)
this.LastBillNo = lastBillNo + 1;
else
this.LastBillNo = 1;
if (this.LastBillNo.ToString().Length >= 6)
{
this.BatchBillNo = "W" + this.FirstBillNo + this.LastBillNo;
return;
}
string lastStr = this.LastBillNo.ToString();
while (true)
{
lastStr = "0" + lastStr;
if (lastStr.Length >= 6) break;
}
this.BatchBillNo = "W" + this.FirstBillNo + lastStr;
}
}
}
}