添加项目文件。
This commit is contained in:
195
src/BarCode.Web.Domain/Entitys/Box.cs
Normal file
195
src/BarCode.Web.Domain/Entitys/Box.cs
Normal file
@@ -0,0 +1,195 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BarCode.Web.Core;
|
||||
using BarCode.Web.Core.Help;
|
||||
using BarCode.Web.Core.Internal.Results;
|
||||
using BarCode.Web.Domain.Values;
|
||||
|
||||
namespace BarCode.Web.Domain.Entitys
|
||||
{
|
||||
/// <summary>
|
||||
/// 箱信息头
|
||||
/// alter table t_barcode_box_details AUTO_INCREMENT=50000;
|
||||
/// </summary>
|
||||
|
||||
[Serializable]
|
||||
[Table("t_barcode_box")]
|
||||
public class Box : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
[Column("Id")]
|
||||
public override int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 箱编号
|
||||
/// </summary>
|
||||
[Column("BoxBillNo")]
|
||||
public string BoxBillNo { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 供应商Code
|
||||
/// </summary>
|
||||
[Column("SupplierCode")]
|
||||
public string SupplierCode { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 组织Code
|
||||
/// </summary>
|
||||
[Column("OrgCode")]
|
||||
public string OrgCode { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 公司Id
|
||||
/// </summary>
|
||||
[Column("CompanyId")]
|
||||
public int CompanyId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 箱状态
|
||||
/// </summary>
|
||||
[Column("Status")]
|
||||
public BoxStatus Status { get; set; } = BoxStatus.NoUse;
|
||||
/// <summary>
|
||||
/// 装箱开始时间
|
||||
/// </summary>
|
||||
[Column("CartonBeginTime")]
|
||||
public DateTime? CartonBeginTime { get; set; }
|
||||
/// <summary>
|
||||
/// 装箱结束时间(完成装箱时间)
|
||||
/// </summary>
|
||||
[Column("CartonEndTime")]
|
||||
public DateTime? CartonEndTime { get; set; }
|
||||
/// <summary>
|
||||
/// 装箱用户
|
||||
/// </summary>
|
||||
[Column("CartonUserId")]
|
||||
public int CartonUserId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 箱子创建用户
|
||||
/// </summary>
|
||||
[Column("CreatorId")]
|
||||
public int CreatorId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[Column("CreateTime")]
|
||||
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||
/// <summary>
|
||||
/// 箱号打印次数
|
||||
/// </summary>
|
||||
[Column("PrintNumber")]
|
||||
public int PrintNumber { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 最新打印时间
|
||||
/// </summary>
|
||||
[Column("PrintTime")]
|
||||
public DateTime? PrintTime { get; set; }
|
||||
/// <summary>
|
||||
/// 明细
|
||||
/// </summary>
|
||||
public List<BoxDetails> Details { get; set; } = new List<BoxDetails>();
|
||||
|
||||
public void GenerateNo()
|
||||
{
|
||||
//用户手动输入了 就不自动生成了
|
||||
if (!string.IsNullOrEmpty(this.BoxBillNo)) return;
|
||||
|
||||
if (this.Id.ToString().Length >= 8)
|
||||
{
|
||||
this.BoxBillNo = "CTN" + this.Id.ToString();
|
||||
return;
|
||||
}
|
||||
|
||||
string idStr = this.Id.ToString();
|
||||
while (true)
|
||||
{
|
||||
idStr = "0" + idStr;
|
||||
if (idStr.Length >= 8) break;
|
||||
}
|
||||
this.BoxBillNo = "CTN" + idStr;
|
||||
}
|
||||
/// <summary>
|
||||
/// 打印
|
||||
/// </summary>
|
||||
public void Print()
|
||||
{
|
||||
this.PrintNumber++;
|
||||
this.PrintTime = DateTime.Now;
|
||||
}
|
||||
/// <summary>
|
||||
/// 解绑序列号
|
||||
/// </summary>
|
||||
/// <param name="serialNumber"></param>
|
||||
/// <param name="materialNumber"></param>
|
||||
public Result UnSerialNumber(string serialNumber, string materialNumber)
|
||||
{
|
||||
var detail = this.Details.FirstOrDefault(f => f.MaterialNumber.Equals(materialNumber));
|
||||
if (detail == null)
|
||||
return Result.ReFailure(ResultCodes.BoxMaterialNoDataError);
|
||||
var serial = detail.SerialNumbers.FirstOrDefault(f => f.Equals(serialNumber));
|
||||
if (serial == null)
|
||||
return Result.ReFailure(ResultCodes.BoxSerialNumberNoDataError);
|
||||
detail.SerialNumbers.Remove(serialNumber);
|
||||
detail.Qty = detail.SerialNumbers.Count();
|
||||
//如果数量为0了就删除这条明细
|
||||
if (detail.SerialNumbers.Count() <= 0)
|
||||
this.Details.Remove(detail);
|
||||
//如果没有明细了 就把状态改成未使用
|
||||
if (this.Details.Count() <= 0)
|
||||
this.Status = BoxStatus.NoUse;
|
||||
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
this.Details.Clear();
|
||||
}
|
||||
/// <summary>
|
||||
/// 装箱
|
||||
/// </summary>
|
||||
public Result Carton(bool isComplete, int cartonUserId)
|
||||
{
|
||||
if (this.Status == BoxStatus.Complete)
|
||||
return Result.ReFailure(ResultCodes.CartonCompleteError);
|
||||
if (this.CartonBeginTime == null) this.CartonBeginTime = DateTime.Now;
|
||||
this.CartonUserId = cartonUserId;
|
||||
if (isComplete == true)
|
||||
{
|
||||
//完成装箱
|
||||
this.Status = BoxStatus.Complete;
|
||||
this.CartonEndTime = DateTime.Now;
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
this.Status = BoxStatus.NoComplete;
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
/// <summary>
|
||||
/// 开始装箱
|
||||
/// </summary>
|
||||
/// <param name="cartonUserId"></param>
|
||||
/// <returns></returns>
|
||||
public Result BeginCarton(int cartonUserId)
|
||||
{
|
||||
if (this.Status == BoxStatus.Complete)
|
||||
return Result.ReFailure(ResultCodes.CartonCompleteError);
|
||||
if (this.CartonBeginTime == null)
|
||||
this.CartonBeginTime = DateTime.Now;
|
||||
if (this.CartonUserId == 0)
|
||||
this.CartonUserId = cartonUserId;
|
||||
this.Status = BoxStatus.NoComplete;
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
/// <summary>
|
||||
/// 重置
|
||||
/// </summary>
|
||||
public void Restart()
|
||||
{
|
||||
this.Status = BoxStatus.NoComplete;
|
||||
this.CartonEndTime = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
45
src/BarCode.Web.Domain/Entitys/BoxDetails.cs
Normal file
45
src/BarCode.Web.Domain/Entitys/BoxDetails.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
using BarCode.Web.Core;
|
||||
|
||||
namespace BarCode.Web.Domain.Entitys
|
||||
{
|
||||
/// <summary>
|
||||
/// 老ops箱信息明细
|
||||
/// alter table t_barcode_box_details AUTO_INCREMENT=50000;
|
||||
/// </summary>
|
||||
|
||||
[Serializable]
|
||||
[Table("t_barcode_box_details")]
|
||||
public class BoxDetails : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
[Column("Id")]
|
||||
public override int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 单据头ID
|
||||
/// </summary>
|
||||
[Column("Fid")]
|
||||
public int Fid { get; set; }
|
||||
/// <summary>
|
||||
/// 物料编码
|
||||
/// </summary>
|
||||
[Column("MaterialNumber")]
|
||||
public string MaterialNumber { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 数量(装箱数量)
|
||||
/// </summary>
|
||||
[Column("Qty")]
|
||||
public decimal Qty { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 序列号
|
||||
/// </summary>
|
||||
[Column("SerialNumbers")]
|
||||
public List<string> SerialNumbers { get; set; } = new List<string>();
|
||||
|
||||
}
|
||||
}
|
||||
192
src/BarCode.Web.Domain/Entitys/BoxMark.cs
Normal file
192
src/BarCode.Web.Domain/Entitys/BoxMark.cs
Normal file
@@ -0,0 +1,192 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
using BarCode.Web.Core;
|
||||
|
||||
namespace BarCode.Web.Domain.Entitys
|
||||
{
|
||||
/// <summary>
|
||||
/// 箱唛表
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Table("t_barcode_box_mark")]
|
||||
public class BoxMark : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
public override int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 供应商Code
|
||||
/// </summary>
|
||||
[Column("SupplierCode")]
|
||||
public string SupplierCode { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 组织Code
|
||||
/// </summary>
|
||||
[Column("OrgCode")]
|
||||
public string OrgCode { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 订单编号
|
||||
/// </summary>
|
||||
public string OrderBillNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料编码
|
||||
/// </summary>
|
||||
public string MaterialNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 产品数量
|
||||
/// </summary>
|
||||
public decimal ProductQty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 装箱数量
|
||||
/// </summary>
|
||||
public decimal CratingQty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 装箱净重
|
||||
/// </summary>
|
||||
public decimal CratingNetWeightQty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 装箱毛重
|
||||
/// </summary>
|
||||
public decimal CratingGrossWeightQty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 尾箱数量
|
||||
/// </summary>
|
||||
public decimal TailboxQty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 尾箱净重
|
||||
/// </summary>
|
||||
public decimal TailboxNetWeightQty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 尾箱毛重
|
||||
/// </summary>
|
||||
public decimal TailboxGrossWeightQty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作人
|
||||
/// </summary>
|
||||
public int CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间(生成时间)
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
/// <summary>
|
||||
/// 流水号(开始)
|
||||
/// </summary>
|
||||
public Int64? BeginNumber { get; set; } = null;
|
||||
/// <summary>
|
||||
/// 流水号(结束)
|
||||
/// </summary>
|
||||
public Int64? EndNumber { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// 编号集合
|
||||
/// </summary>
|
||||
public List<BoxMarkBillNo> BillNos { get; set; } = new List<BoxMarkBillNo>();
|
||||
|
||||
/// <summary>
|
||||
/// 创建
|
||||
/// </summary>
|
||||
/// <param name="creatorId"></param>
|
||||
public void Create(int creatorId)
|
||||
{
|
||||
this.CreatorId = creatorId;
|
||||
this.CreateTime = DateTime.Now;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成编号
|
||||
/// </summary>
|
||||
/// <param name="firstBillNo"></param>
|
||||
/// <param name="lastBillNo"></param>
|
||||
public void GenerateBillNo(int firstBillNo, int lastBillNo)
|
||||
{
|
||||
if (this.BillNos == null)
|
||||
this.BillNos = new List<BoxMarkBillNo>();
|
||||
|
||||
//计算要装的箱数量
|
||||
var boxCount_tag = this.ProductQty / this.CratingQty;
|
||||
var boxCount = Convert.ToInt32(boxCount_tag);
|
||||
|
||||
//判断是否存在小数点;true表明有尾箱数,false没有尾箱数
|
||||
var hasPart = Math.Floor(boxCount_tag) != boxCount_tag;
|
||||
|
||||
//有小数点向上取整
|
||||
if (hasPart)
|
||||
boxCount = Convert.ToInt32(Math.Ceiling(boxCount_tag));
|
||||
|
||||
for (int i = 1; i <= boxCount; i++)
|
||||
{
|
||||
//添加编号生成
|
||||
var bill = new BoxMarkBillNo();
|
||||
bill.Sort = i;
|
||||
if (hasPart && i == boxCount && boxCount > 1)
|
||||
bill.IsTail = true;
|
||||
bill.GenerateBillNo(firstBillNo, lastBillNo);
|
||||
|
||||
//用户设置了序列号才计算
|
||||
if (this.BeginNumber != null && this.EndNumber != null)
|
||||
{
|
||||
//只有一个箱子 就用产品数量
|
||||
if (boxCount == 1)
|
||||
{
|
||||
//如果是尾箱
|
||||
if (bill.IsTail)
|
||||
{
|
||||
bill.BeginNumber = this.BeginNumber + Convert.ToInt64((i - 1) * ProductQty);
|
||||
bill.EndNumber = this.EndNumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
//不是尾箱
|
||||
bill.BeginNumber = this.BeginNumber + Convert.ToInt64((i - 1) * ProductQty);
|
||||
bill.EndNumber = Convert.ToInt64(bill.BeginNumber + ProductQty) - 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//如果是尾箱
|
||||
if (bill.IsTail)
|
||||
{
|
||||
bill.BeginNumber = this.BeginNumber + Convert.ToInt64((i - 1) * CratingQty);
|
||||
bill.EndNumber = this.EndNumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
//不是尾箱
|
||||
bill.BeginNumber = this.BeginNumber + Convert.ToInt64((i - 1) * CratingQty);
|
||||
bill.EndNumber = Convert.ToInt64(bill.BeginNumber + CratingQty) - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.BillNos.Add(bill);
|
||||
|
||||
//改变前后的billNo值,新的值再一次被使用
|
||||
firstBillNo = bill.FirstBillNo;
|
||||
lastBillNo = bill.LastBillNo;
|
||||
}
|
||||
//判断有小数点,那么它就有尾箱,把当前第一条的编号是否是尾箱字段改为true
|
||||
//if (this.BillNos.Count != 0 && hasPart)
|
||||
// this.BillNos[0].IsTail = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
87
src/BarCode.Web.Domain/Entitys/BoxMarkBillNo.cs
Normal file
87
src/BarCode.Web.Domain/Entitys/BoxMarkBillNo.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
using BarCode.Web.Core;
|
||||
|
||||
namespace BarCode.Web.Domain.Entitys
|
||||
{
|
||||
/// <summary>
|
||||
/// 箱唛表-编号表
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Table("t_barcode_box_mark_billno")]
|
||||
public class BoxMarkBillNo : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
public override int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上级ID
|
||||
/// </summary>
|
||||
public int Fid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 箱唛编号
|
||||
/// </summary>
|
||||
public string BillNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 箱唛编号-首位
|
||||
/// </summary>
|
||||
public int FirstBillNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 箱唛编号-末尾序号
|
||||
/// </summary>
|
||||
public int LastBillNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否是尾箱
|
||||
/// </summary>
|
||||
public bool IsTail { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int Sort { get; set; }
|
||||
/// <summary>
|
||||
/// 流水号(开始)
|
||||
/// </summary>
|
||||
public Int64? BeginNumber { get; set; } = null;
|
||||
/// <summary>
|
||||
/// 流水号(结束)
|
||||
/// </summary>
|
||||
public Int64? EndNumber { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// 生成编号
|
||||
/// </summary>
|
||||
/// <param name="firstBillNo"></param>
|
||||
/// <param name="lastBillNo"></param>
|
||||
public void GenerateBillNo(int firstBillNo, int lastBillNo)
|
||||
{
|
||||
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 >= 5)
|
||||
{
|
||||
this.BillNo = "XM" + this.FirstBillNo + this.LastBillNo;
|
||||
return;
|
||||
}
|
||||
|
||||
string lastStr = this.LastBillNo.ToString();
|
||||
while (true)
|
||||
{
|
||||
lastStr = "0" + lastStr;
|
||||
if (lastStr.Length >= 5) break;
|
||||
}
|
||||
this.BillNo = "XM" + this.FirstBillNo + lastStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
40
src/BarCode.Web.Domain/Entitys/CenerateData.cs
Normal file
40
src/BarCode.Web.Domain/Entitys/CenerateData.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using BarCode.Web.Core;
|
||||
using BarCode.Web.Domain.Values;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BarCode.Web.Domain.Entitys
|
||||
{
|
||||
/// <summary>
|
||||
/// 生成计划管理
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Table("t_wms_cenerate_date")]
|
||||
public class CenerateData : EntityBase
|
||||
{
|
||||
public CenerateData() { }
|
||||
public CenerateData(CenerateDataType type)
|
||||
{
|
||||
this.Type = type;
|
||||
}
|
||||
/// <summary>
|
||||
/// 主键 订单编号
|
||||
/// </summary>
|
||||
[Column("Id")]
|
||||
public override int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 同步类型
|
||||
/// </summary>
|
||||
[Column("Type")]
|
||||
public CenerateDataType Type { get; set; } = CenerateDataType.Serial;
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
[Column("Number")]
|
||||
public int Number { get; set; } = 1;
|
||||
}
|
||||
}
|
||||
90
src/BarCode.Web.Domain/Entitys/FileDownManager.cs
Normal file
90
src/BarCode.Web.Domain/Entitys/FileDownManager.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
using BarCode.Web.Core;
|
||||
using BarCode.Web.Domain.Values;
|
||||
|
||||
namespace BarCode.Web.Domain.Entitys
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件下载类型
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Table("t_barcode_file_down_manager")]
|
||||
public class FileDownManager : EntityBase
|
||||
{
|
||||
public FileDownManager() { }
|
||||
public FileDownManager(int userId, int companyId, FileDownLoadOrderType type,string orgCode, string path, string supplierCode)
|
||||
{
|
||||
this.UserId = userId;
|
||||
this.CompanyId = companyId;
|
||||
this.Type = type;
|
||||
this.FilePath = path;
|
||||
this.SupplierCode = supplierCode;
|
||||
this.OrgCode = orgCode;
|
||||
}
|
||||
/// <summary>
|
||||
/// 主键 订单编号
|
||||
/// </summary>
|
||||
[Column("Id")]
|
||||
public override int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 日期
|
||||
/// </summary>
|
||||
[Column("Date")]
|
||||
public DateTime? Date { get; set; } = DateTime.Now;
|
||||
/// <summary>
|
||||
/// 单据类型(任务类型)
|
||||
/// </summary>
|
||||
[Column("Type")]
|
||||
public FileDownLoadOrderType Type { get; set; } = FileDownLoadOrderType.SerialNumbers;
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
[Column("Status")]
|
||||
public ExportStatus Status { get; set; } = ExportStatus.Ing;
|
||||
/// <summary>
|
||||
/// 公司Id
|
||||
/// </summary>
|
||||
[Column("CompanyId")]
|
||||
public int CompanyId { get; set; }
|
||||
/// <summary>
|
||||
/// 组织编码
|
||||
/// </summary>
|
||||
[Column("OrgCode")]
|
||||
public string OrgCode { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 文件地址
|
||||
/// </summary>
|
||||
[Column("FilePath")]
|
||||
public string FilePath { get; set; }
|
||||
/// <summary>
|
||||
/// 操作人
|
||||
/// </summary>
|
||||
[Column("UserId")]
|
||||
public int UserId { get; set; }
|
||||
/// <summary>
|
||||
/// 失败原因
|
||||
/// </summary>
|
||||
[Column("Reason")]
|
||||
public string Reason { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 供应商编码
|
||||
/// </summary>
|
||||
[Column("SupplierCode")]
|
||||
public string SupplierCode { get; set; } = "";
|
||||
|
||||
public void Finish(bool IsSuccess, string reson)
|
||||
{
|
||||
if (IsSuccess)
|
||||
this.Status = ExportStatus.Success;
|
||||
else
|
||||
{
|
||||
this.Status = ExportStatus.Fail;
|
||||
this.Reason = reson;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
77
src/BarCode.Web.Domain/Entitys/Materials.cs
Normal file
77
src/BarCode.Web.Domain/Entitys/Materials.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
using BarCode.Web.Core;
|
||||
|
||||
namespace BarCode.Web.Domain.Entitys
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Table("t_barcode_materials")]
|
||||
public class Materials : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
public override int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 组织Id
|
||||
/// </summary>
|
||||
public int OrgId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 组织编码
|
||||
/// </summary>
|
||||
public string OrgCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料ID
|
||||
/// </summary>
|
||||
public int MaterialId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料名称
|
||||
/// </summary>
|
||||
public string MaterialName { get; set; }
|
||||
/// <summary>
|
||||
/// 物料编码
|
||||
/// </summary>
|
||||
public string MaterialNumber { get; set; }
|
||||
/// <summary>
|
||||
/// 物料规格型号
|
||||
/// </summary>
|
||||
public string Specifications { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 基本单位
|
||||
/// </summary>
|
||||
public int BaseUnitId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 基本单位名称
|
||||
/// </summary>
|
||||
public string BaseUnitName { get; set; }
|
||||
/// <summary>
|
||||
/// 基本单位编码
|
||||
/// </summary>
|
||||
public string BaseUnitNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 条码
|
||||
/// </summary>
|
||||
public string BarCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用批号管理
|
||||
/// </summary>
|
||||
public bool IsBatchManage { get; set; }
|
||||
/// <summary>
|
||||
/// 物料Id 32进制字符串
|
||||
/// </summary>
|
||||
public string IdConvertBar { get; set; }
|
||||
}
|
||||
}
|
||||
116
src/BarCode.Web.Domain/Entitys/SecurityNumberGenerateRecord.cs
Normal file
116
src/BarCode.Web.Domain/Entitys/SecurityNumberGenerateRecord.cs
Normal file
@@ -0,0 +1,116 @@
|
||||
using BarCode.Web.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BarCode.Web.Domain.Entitys
|
||||
{
|
||||
/// <summary>
|
||||
/// 防伪码生成记录
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Table("t_barcode_securitynumbergeneraterecord")]
|
||||
public class SecurityNumberGenerateRecord : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键 订单编号
|
||||
/// </summary>
|
||||
[Column("Id")]
|
||||
public override int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 防伪码批次
|
||||
/// </summary>
|
||||
[Column("LotNumber")]
|
||||
public string LotNumber { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 物料编码
|
||||
/// </summary>
|
||||
[Column("MaterialNumber")]
|
||||
public string MaterialNumber { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 公司Id
|
||||
/// </summary>
|
||||
[Column("CompanyId")]
|
||||
public int CompanyId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 组织Id
|
||||
/// </summary>
|
||||
[Column("OrgCode")]
|
||||
public string OrgCode { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 供应商code
|
||||
/// </summary>
|
||||
[Column("SupplierCode")]
|
||||
public string SupplierCode { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 生成完成 1 生成中 0
|
||||
///</summary>
|
||||
[Column("IsGenerateComplete")]
|
||||
public bool IsGenerateComplete { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 生成条码数量
|
||||
///</summary>
|
||||
[Column("Number")]
|
||||
public int Number { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 下载数
|
||||
///</summary>
|
||||
[Column("DownLoadNumber")]
|
||||
public int DownLoadNumber { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
/// </summary>
|
||||
[Column("CreatorId")]
|
||||
public int CreatorId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 生成时间
|
||||
/// </summary>
|
||||
[Column("CreateTime")]
|
||||
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||
/// <summary>
|
||||
/// 生成完成时间
|
||||
/// </summary>
|
||||
[Column("GenerateCompleteTime")]
|
||||
public DateTime? GenerateCompleteTime { get; set; } = null;
|
||||
/// <summary>
|
||||
/// 生成完成
|
||||
/// </summary>
|
||||
public void Complete()
|
||||
{
|
||||
this.IsGenerateComplete = true;
|
||||
this.GenerateCompleteTime = DateTime.Now;
|
||||
}
|
||||
/// <summary>
|
||||
/// 下载
|
||||
/// </summary>
|
||||
public void DownLoad(int number)
|
||||
{
|
||||
this.DownLoadNumber = number;
|
||||
}
|
||||
/// <summary>
|
||||
/// 生成批号
|
||||
/// </summary>
|
||||
public void GenerateLotNumber(int number)
|
||||
{
|
||||
//用户手动输入了 就不自动生成了
|
||||
if (!string.IsNullOrEmpty(this.LotNumber)) return;
|
||||
|
||||
if (number.ToString().Length >= 3)
|
||||
{
|
||||
this.LotNumber = "FWM" + DateTime.Now.ToString("yyMMdd") + number;
|
||||
return;
|
||||
}
|
||||
|
||||
string idStr = number.ToString();
|
||||
while (true)
|
||||
{
|
||||
idStr = "0" + idStr;
|
||||
if (idStr.Length >= 3) break;
|
||||
}
|
||||
this.LotNumber = "FWM" + DateTime.Now.ToString("yyMMdd") + idStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
110
src/BarCode.Web.Domain/Entitys/SecurityNumbers.cs
Normal file
110
src/BarCode.Web.Domain/Entitys/SecurityNumbers.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
using BarCode.Web.Core;
|
||||
using BarCode.Web.Domain.Services.Public;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BarCode.Web.Domain.Entitys
|
||||
{
|
||||
/// <summary>
|
||||
/// 防伪码
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Table("t_barcode_securitynumbers")]
|
||||
public class SecurityNumbers : EntityLongBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键 订单编号
|
||||
/// </summary>
|
||||
[Column("Id")]
|
||||
public override long Id { get; set; }
|
||||
/// <summary>
|
||||
/// 组织Code
|
||||
/// </summary>
|
||||
[Column("OrgCode")]
|
||||
public string OrgCode { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 供应商code
|
||||
/// </summary>
|
||||
[Column("SupplierCode")]
|
||||
public string SupplierCode { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 生成记录Id
|
||||
/// </summary>
|
||||
[Column("GenerateRecordId")]
|
||||
public int GenerateRecordId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 防伪码
|
||||
/// </summary>
|
||||
[Column("SecurityNumber")]
|
||||
public string SecurityNumber { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 物料编码
|
||||
/// </summary>
|
||||
[Column("MaterialNumber")]
|
||||
public string MaterialNumber { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 下载次数
|
||||
/// </summary>
|
||||
[Column("DownLoadNumber")]
|
||||
public int DownLoadNumber { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 最新下载时间
|
||||
/// </summary>
|
||||
[Column("DownLoadTime")]
|
||||
public DateTime? DownLoadTime { get; set; }
|
||||
/// <summary>
|
||||
/// 查询次数
|
||||
/// </summary>
|
||||
[Column("QueryCount")]
|
||||
public int QueryCount { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 第一次查询时间
|
||||
/// </summary>
|
||||
[Column("QueryTime")]
|
||||
public DateTime? QueryTime { get; set; }
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
/// </summary>
|
||||
[Column("CreatorId")]
|
||||
public int CreatorId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 生成时间
|
||||
/// </summary>
|
||||
[Column("CreateTime")]
|
||||
public DateTime? CreateTime { get; set; } = DateTime.Now;
|
||||
/// <summary>
|
||||
/// 下载
|
||||
/// </summary>
|
||||
public void DownLoad()
|
||||
{
|
||||
this.DownLoadNumber++;
|
||||
this.DownLoadTime = DateTime.Now;
|
||||
}
|
||||
/// <summary>
|
||||
/// 生成防伪码
|
||||
/// </summary>
|
||||
public void GenerateSecurityNumber()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.SecurityNumber)) return;
|
||||
string exclude = "WXYZ";
|
||||
int? FLength = 9;
|
||||
|
||||
var idStr = Radix.ConvertRadix36((ulong)this.Id, exclude.ToCharArray()).PadLeft(FLength ?? 0, '0');
|
||||
this.SecurityNumber = "A" + idStr;
|
||||
}
|
||||
/// <summary>
|
||||
/// 被查询
|
||||
/// </summary>
|
||||
public void Get()
|
||||
{
|
||||
if (this.QueryCount <= 0)
|
||||
this.QueryTime = DateTime.Now;
|
||||
this.QueryCount++;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
150
src/BarCode.Web.Domain/Entitys/SerialNumberGenerateRecord.cs
Normal file
150
src/BarCode.Web.Domain/Entitys/SerialNumberGenerateRecord.cs
Normal file
@@ -0,0 +1,150 @@
|
||||
using BarCode.Web.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BarCode.Web.Domain.Entitys
|
||||
{
|
||||
/// <summary>
|
||||
/// 序列号生成记录
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Table("t_barcode_serialnumbergeneraterecord")]
|
||||
public class SerialNumberGenerateRecord : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键 订单编号
|
||||
/// </summary>
|
||||
[Column("Id")]
|
||||
public override int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 物料Id转32进制
|
||||
/// </summary>
|
||||
[Column("IdConvertBar")]
|
||||
public string IdConvertBar { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 物料编码
|
||||
/// </summary>
|
||||
[Column("MaterialNumber")]
|
||||
public string MaterialNumber { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 是否更改过物料编码
|
||||
/// </summary>
|
||||
[Column("IsUpdateMaterial")]
|
||||
public bool? IsUpdateMaterial { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 采购单号
|
||||
///</summary>
|
||||
[Column("PurchaseBillNo")]
|
||||
public string PurchaseBillNo { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 供应商code
|
||||
/// </summary>
|
||||
[Column("SupplierCode")]
|
||||
public string SupplierCode { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 公司Id
|
||||
/// </summary>
|
||||
[Column("CompanyId")]
|
||||
public int CompanyId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 组织Id
|
||||
/// </summary>
|
||||
[Column("OrgCode")]
|
||||
public string OrgCode { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 生成完成 1 生成中 0
|
||||
///</summary>
|
||||
[Column("IsGenerateComplete")]
|
||||
public bool IsGenerateComplete { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 生成条码数量
|
||||
///</summary>
|
||||
[Column("Number")]
|
||||
public int Number { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 生成条码起始位数量(后端用来做标记)
|
||||
///</summary>
|
||||
[Column("BeginNumber")]
|
||||
public int BeginNumber { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 打印数
|
||||
///</summary>
|
||||
[Column("PrintNumber")]
|
||||
public int PrintNumber { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 下载数
|
||||
///</summary>
|
||||
[Column("DownLoadNumber")]
|
||||
public int DownLoadNumber { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 使用数
|
||||
///</summary>
|
||||
[Column("UseNumber")]
|
||||
public int UseNumber { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
/// </summary>
|
||||
[Column("CreatorId")]
|
||||
public int CreatorId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 是否套装,默认是为1,1即为单个,不是套装Alter by yzh
|
||||
///</summary>
|
||||
[Column("IsTwo")]
|
||||
public int IsTwo { get; set; } = 1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生成时间
|
||||
/// </summary>
|
||||
[Column("CreateTime")]
|
||||
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||
/// <summary>
|
||||
/// 生成完成时间
|
||||
/// </summary>
|
||||
[Column("GenerateCompleteTime")]
|
||||
public DateTime? GenerateCompleteTime { get; set; } = null;
|
||||
/// <summary>
|
||||
/// 生成完成
|
||||
/// </summary>
|
||||
public void Complete()
|
||||
{
|
||||
this.IsGenerateComplete = true;
|
||||
this.GenerateCompleteTime = DateTime.Now;
|
||||
}
|
||||
/// <summary>
|
||||
/// 打印
|
||||
/// </summary>
|
||||
public void Print(int number)
|
||||
{
|
||||
this.PrintNumber= number;
|
||||
}
|
||||
/// <summary>
|
||||
/// 下载
|
||||
/// </summary>
|
||||
public void DownLoad(int number)
|
||||
{
|
||||
this.DownLoadNumber= number;
|
||||
}
|
||||
/// <summary>
|
||||
/// 反写使用数
|
||||
/// </summary>
|
||||
/// <param name="number"></param>
|
||||
public void Use(int number)
|
||||
{
|
||||
this.UseNumber = number;
|
||||
}
|
||||
/// <summary>
|
||||
/// 标记修改物料
|
||||
/// </summary>
|
||||
public void UpdateMaterial()
|
||||
{
|
||||
this.IsUpdateMaterial = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
287
src/BarCode.Web.Domain/Entitys/SerialNumbers.cs
Normal file
287
src/BarCode.Web.Domain/Entitys/SerialNumbers.cs
Normal file
@@ -0,0 +1,287 @@
|
||||
using BarCode.Web.Core;
|
||||
using BarCode.Web.Core.Help;
|
||||
using BarCode.Web.Core.Internal.Results;
|
||||
using BarCode.Web.Domain.Services.Public;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BarCode.Web.Domain.Entitys
|
||||
{
|
||||
/// <summary>
|
||||
/// 序列号 默认Id从 200000000 起始
|
||||
/// alter table users AUTO_INCREMENT=200000000;
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Table("t_barcode_serialnumbers")]
|
||||
public class SerialNumbers : EntityLongBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键 订单编号
|
||||
/// </summary>
|
||||
[Column("Id")]
|
||||
public override long Id { get; set; }
|
||||
/// <summary>
|
||||
/// 组织Code
|
||||
/// </summary>
|
||||
[Column("OrgCode")]
|
||||
public string OrgCode { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 供应商code
|
||||
/// </summary>
|
||||
[Column("SupplierCode")]
|
||||
public string SupplierCode { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 生成记录Id
|
||||
/// </summary>
|
||||
[Column("GenerateRecordId")]
|
||||
public int GenerateRecordId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 序列号
|
||||
/// </summary>
|
||||
[Column("SerialNumber")]
|
||||
public string SerialNumber { get; set; } = string.Empty;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 套装(1代表单套,2代表2套,3代表3套) aLTER BY YZH
|
||||
/// </summary>
|
||||
[Column("IsTwo")]
|
||||
public int IsTwo { get; set; } =1;
|
||||
|
||||
/// <summary>
|
||||
///当次序号,用来记录当次所产生时所处的序列号
|
||||
/// </summary>
|
||||
[Column("thisNumber")]
|
||||
public int thisNumber { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 序列号
|
||||
/// </summary>
|
||||
[Column("SuitNumber")]
|
||||
public string SuitNumber { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 产生第二个
|
||||
/// </summary>
|
||||
[Column("TwoSerialNumber")]
|
||||
public string TwoSerialNumber { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 物料Id
|
||||
/// </summary>
|
||||
[Column("MaterialId")]
|
||||
public int MaterialId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 物料编码
|
||||
/// </summary>
|
||||
[Column("MaterialNumber")]
|
||||
public string MaterialNumber { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 老物料编码(上一次物料编码)
|
||||
/// </summary>
|
||||
[Column("Old_MaterialNumber")]
|
||||
public string? Old_MaterialNumber { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 箱ID
|
||||
/// </summary>
|
||||
[Column("BoxId")]
|
||||
public int BoxId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 数字序列码
|
||||
/// </summary>
|
||||
[Column("NumberCode")]
|
||||
public string NumberCode { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 数字序列码(不包含日期)
|
||||
/// </summary>
|
||||
[Column("Number")]
|
||||
public int Number { get; set; } = 1;
|
||||
/// <summary>
|
||||
/// 是否使用
|
||||
/// </summary>
|
||||
[Column("IsUse")]
|
||||
public bool IsUse { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
/// </summary>
|
||||
[Column("CreatorId")]
|
||||
public int CreatorId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 生成时间
|
||||
/// </summary>
|
||||
[Column("CreateTime")]
|
||||
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||
/// <summary>
|
||||
/// 完成装箱时间
|
||||
/// </summary>
|
||||
[Column("CompleteCartonTime")]
|
||||
public DateTime? CompleteCartonTime { get; set; }
|
||||
/// <summary>
|
||||
/// 打印次数
|
||||
/// </summary>
|
||||
[Column("PrintNumber")]
|
||||
public int PrintNumber { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 下载次数
|
||||
/// </summary>
|
||||
[Column("DownLoadNumber")]
|
||||
public int DownLoadNumber { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 最新打印时间
|
||||
/// </summary>
|
||||
[Column("PrintTime")]
|
||||
public DateTime? PrintTime { get; set; }
|
||||
/// <summary>
|
||||
/// 最新下载时间
|
||||
/// </summary>
|
||||
[Column("DownLoadTime")]
|
||||
public DateTime? DownLoadTime { get; set; }
|
||||
/// <summary>
|
||||
/// 是否使用的是数字序列码未使用null,数字序列码true,序列码false
|
||||
/// </summary>
|
||||
[Column("IsUseNumber")]
|
||||
public bool? IsUseNumber { get; set; } = null;
|
||||
/// <summary>
|
||||
/// 生成序列码
|
||||
/// </summary>
|
||||
public string GenerateSerialNumber()
|
||||
{
|
||||
string exclude = "ISOZ";
|
||||
int? FLength = 6;
|
||||
|
||||
var idStr = Radix.ConvertRadix36((ulong)this.Id, exclude.ToCharArray()).PadLeft(FLength ?? 0, '0');
|
||||
this.SerialNumber = this.SerialNumber + "-" + idStr;
|
||||
return this.SerialNumber;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 生成套装编码 alter by yzh
|
||||
///// </summary>
|
||||
//public void GenerateSuitNumber(string sn,)
|
||||
//{
|
||||
|
||||
|
||||
// string exclude = "ISOZ";
|
||||
// int? FLength = 6;
|
||||
|
||||
// var idStr = Radix.ConvertRadix36((ulong)this.Id, exclude.ToCharArray()).PadLeft(FLength ?? 0, '0');
|
||||
// this.SerialNumber = this.SerialNumber + "-" + idStr;
|
||||
//}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生成时间序列码
|
||||
/// </summary>
|
||||
public void GenerateNumberCode()
|
||||
{
|
||||
//用户手动输入了 就不自动生成了
|
||||
if (!string.IsNullOrEmpty(this.NumberCode)) return;
|
||||
|
||||
if (this.Number.ToString().Length >= 6)
|
||||
{
|
||||
this.NumberCode = this.CreateTime.ToString("yyMMdd") + this.Number.ToString();
|
||||
return;
|
||||
}
|
||||
|
||||
string idStr = this.Number.ToString();
|
||||
while (true)
|
||||
{
|
||||
idStr = "0" + idStr;
|
||||
if (idStr.Length >= 6) break;
|
||||
}
|
||||
this.NumberCode = this.CreateTime.ToString("yyMMdd") + idStr;
|
||||
}
|
||||
/// <summary>
|
||||
/// 产生套装编码 alter by yzh
|
||||
/// </summary>
|
||||
/// <param name="sn"></param>
|
||||
|
||||
public void GenerateSuitNumber(string sn)
|
||||
{
|
||||
this.SuitNumber = sn;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 产生第二个序列号
|
||||
/// </summary>
|
||||
/// <param name="sn"></param>
|
||||
public void GenerateTwoSerialNumber(string sn)
|
||||
{
|
||||
this.TwoSerialNumber = sn;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 打印
|
||||
/// </summary>
|
||||
public void Print()
|
||||
{
|
||||
//被wms使用的数据不能被打印
|
||||
if (this.BoxId <= 0 && this.IsUse == true) return;
|
||||
|
||||
this.PrintNumber++;
|
||||
this.PrintTime = DateTime.Now;
|
||||
}
|
||||
/// <summary>
|
||||
/// 下载
|
||||
/// </summary>
|
||||
public void DownLoad()
|
||||
{
|
||||
this.DownLoadNumber++;
|
||||
this.DownLoadTime = DateTime.Now;
|
||||
}
|
||||
/// <summary>
|
||||
/// 装箱
|
||||
/// </summary>
|
||||
/// <param name="boxId"></param>
|
||||
/// <param name="str"></param>
|
||||
public void CompleteBox(int boxId, string str)
|
||||
{
|
||||
//每个序列码延时1毫秒来装箱 这样到时候获取序列码时就可以来排序
|
||||
Thread.Sleep(1);
|
||||
this.BoxId = boxId;
|
||||
this.CompleteCartonTime = DateTime.Now;
|
||||
this.IsUse = true;
|
||||
this.IsUseNumber = this.NumberCode.Equals(str) ? true : false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 解绑箱
|
||||
/// </summary>
|
||||
public void UnBox()
|
||||
{
|
||||
this.BoxId = 0;
|
||||
this.CompleteCartonTime = null;
|
||||
this.IsUse = false;
|
||||
this.IsUseNumber = null;
|
||||
}
|
||||
/// <summary>
|
||||
/// wms系统获取序列码后 序列码调整为已使用
|
||||
/// </summary>
|
||||
public void WmsGet(string str)
|
||||
{
|
||||
this.BoxId = -1;
|
||||
this.IsUse = true;
|
||||
this.IsUseNumber = this.NumberCode.Equals(str) ? true : false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改物料编码
|
||||
/// </summary>
|
||||
/// <param name="number"></param>
|
||||
public Result UpdateMaterial(string number)
|
||||
{
|
||||
if (this.IsUse)
|
||||
return Result.ReFailure($"序列码 {this.SerialNumber} 已被使用,不允许规格转换", 600007);
|
||||
if (!this.MaterialNumber.Equals(number))
|
||||
{
|
||||
this.Old_MaterialNumber = this.MaterialNumber;
|
||||
this.MaterialNumber = number;
|
||||
}
|
||||
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user