140 lines
3.9 KiB
C#
140 lines
3.9 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盘点单
|
||
/// </summary>
|
||
[Serializable]
|
||
[Table("t_wms_takestock")]
|
||
public class TakeStock : EntityBase
|
||
{
|
||
public TakeStock() { }
|
||
/// <summary>
|
||
/// 主键 订单编号
|
||
/// </summary>
|
||
[Column("Id")]
|
||
public override int Id { get; set; }
|
||
/// <summary>
|
||
/// 单据编号
|
||
/// </summary>
|
||
[Column("BillNo")]
|
||
public string BillNo { get; set; }
|
||
/// <summary>
|
||
/// 盘点日期
|
||
/// </summary>
|
||
[Column("Date")]
|
||
public DateTime Date { get; set; } = DateTime.Now;
|
||
/// <summary>
|
||
/// 盘点人员
|
||
/// </summary>
|
||
[Column("CreatorId")]
|
||
public int CreatorId { get; set; }
|
||
/// <summary>
|
||
/// 同步成功或者失败 null 就是未同步
|
||
/// </summary>
|
||
[Column("SuccessSync")]
|
||
public bool? SuccessSync { get; set; }
|
||
/// <summary>
|
||
/// 箱Id
|
||
/// </summary>
|
||
[Column("BoxId")]
|
||
public int BoxId { get; set; }
|
||
/// <summary>
|
||
/// 物料ID
|
||
/// </summary>
|
||
[Column("MaterialId")]
|
||
public int MaterialId { get; set; }
|
||
/// <summary>
|
||
/// 仓库ID
|
||
/// </summary>
|
||
[Column("StockId")]
|
||
public int StockId { get; set; }
|
||
/// <summary>
|
||
/// 仓位ID
|
||
/// </summary>
|
||
[Column("SubStockId")]
|
||
public int SubStockId { get; set; }
|
||
/// <summary>
|
||
/// 盘点前数量(wms系统数量)
|
||
/// </summary>
|
||
[Column("BeforeQty")]
|
||
public decimal BeforeQty { get; set; }
|
||
/// <summary>
|
||
/// 盘点实际数量(实际仓库数量)
|
||
/// </summary>
|
||
[Column("AfterQty")]
|
||
public decimal AfterQty { get; set; }
|
||
/// <summary>
|
||
/// 盘点数量
|
||
/// </summary>
|
||
[Column("FinalQty")]
|
||
public decimal FinalQty { get; set; }
|
||
/// <summary>
|
||
/// 盘点结果类型:1为盘盈,2位盘亏
|
||
/// 实际仓库数量-WMS系统数量 大于0为盘盈 小于0为盘亏
|
||
/// </summary>
|
||
[Column("ResultType")]
|
||
public TakeStockType ResultType { get; set; } = TakeStockType.Profit;
|
||
/// <summary>
|
||
/// 备注
|
||
/// </summary>
|
||
[Column("Remark")]
|
||
public string Remark { get; set; }
|
||
/// <summary>
|
||
/// 创建
|
||
/// </summary>
|
||
/// <param name="creatorId"></param>
|
||
public void Create(int creatorId)
|
||
{
|
||
this.CreatorId = creatorId;
|
||
this.Date = DateTime.Now;
|
||
}
|
||
/// <summary>
|
||
/// 同步金蝶结果
|
||
/// </summary>
|
||
/// <param name="isSuccess"></param>
|
||
/// <param name="remark"></param>
|
||
public void Sync(bool isSuccess,string remark)
|
||
{
|
||
if (isSuccess)
|
||
{
|
||
this.SuccessSync = true;
|
||
this.Remark = "";
|
||
}
|
||
else
|
||
{
|
||
this.SuccessSync = false;
|
||
this.Remark = remark;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 生成单据号
|
||
/// </summary>
|
||
public void GenerateNo()
|
||
{
|
||
//用户手动输入了 就不自动生成了
|
||
if (!string.IsNullOrEmpty(this.BillNo)) return;
|
||
|
||
if (this.Id.ToString().Length >= 8)
|
||
{
|
||
this.BillNo = "PD" + this.Id.ToString();
|
||
return;
|
||
}
|
||
|
||
string idStr = this.Id.ToString();
|
||
while (true)
|
||
{
|
||
idStr = "0" + idStr;
|
||
if (idStr.Length >= 8) break;
|
||
}
|
||
this.BillNo = "PD" + idStr;
|
||
}
|
||
}
|
||
}
|