Browse Source

添加托盘条码生成打印功能

master
lvzb 4 years ago
parent
commit
ca5468911f
  1. 306
      Controller/SCP_ASN_CONTROLLER.cs
  2. 202
      Controller/SCP_BARCODE_CONTROLLER.cs
  3. 1
      Models/CK.SCP.Models.csproj
  4. 1
      Models/ScpEntities.cs
  5. 9
      Models/ScpEntity/TB_PALLETS.cs
  6. 33
      Models/ScpEntity/TB_PALLETS_RULL.cs
  7. 4
      SCP/Views/锦州锦恒/SupplierData/SCP_ASN.aspx
  8. 54
      SCP/Views/锦州锦恒/SupplierData/SCP_ASN.aspx.designer.cs
  9. 9
      SCP/Views/锦州锦恒/SupplierData/SCP_ASN_DETAIL.aspx
  10. 110
      SCP/Views/锦州锦恒/SupplierData/SCP_ASN_DETAIL.aspx.cs
  11. 26
      SCP/Views/锦州锦恒/SupplierData/SCP_ASN_DETAIL.aspx.designer.cs
  12. 4
      SCP/default.aspx

306
Controller/SCP_ASN_CONTROLLER.cs

@ -1666,7 +1666,6 @@ namespace CK.SCP.Controller
string _oldpartcode = ""; //上一个托盘所装零件编号
decimal _oldbox = 0; //上一个托盘箱数计数
string _oldpalletnum = "";//上一个托盘码
List<string> _listm = new List<string>();
p_list.ForEach(p =>
{
var _askDetail = db.TA_VEND_PART.Where
@ -1674,10 +1673,10 @@ namespace CK.SCP.Controller
&& itm.PartCode == p.PartCode
).FirstOrDefault();
if (_askDetail != null)
{
{
var _palletPack = _askDetail.PalletPackQty;
#region 补充未满托盘
if (p.PartCode== _oldpartcode)
if (p.PartCode == _oldpartcode)
{
decimal _box1 = 0;
int _TempQty1 = Convert.ToInt32(p.Qty);
@ -1698,7 +1697,7 @@ namespace CK.SCP.Controller
_box1++;
}
}
if(_box1< _oldbox)
if (_box1 < _oldbox)
{
TB_PALLETS pallet = new TB_PALLETS();
pallet.AsnBillNum = p.AsnBillNum;
@ -1708,6 +1707,11 @@ namespace CK.SCP.Controller
pallet.Box = Convert.ToInt32(_box1);
pallet.Qty = p.Qty;
pallet.PalletNum = _oldpalletnum;
pallet.BarCode = _oldpalletnum;
pallet.VendBatch = p.VendBatch;
pallet.PoBillLine = p.PoLine;
pallet.PoBillNum = p.PoBillNum;
pallet.ProduceDate = Convert.ToDateTime(p.ProduceDate);
db.TB_PALLETS.Add(pallet);
p.Qty = 0;
}
@ -1719,10 +1723,15 @@ namespace CK.SCP.Controller
pallet.Batch = p.Batch;
pallet.VendId = p.VendId;
pallet.Box = Convert.ToInt32(_oldbox);
pallet.Qty = _oldbox* _PackQty1;
pallet.Qty = _oldbox * _PackQty1;
pallet.PalletNum = _oldpalletnum;
pallet.BarCode = _oldpalletnum;
pallet.VendBatch = p.VendBatch;
pallet.PoBillLine = p.PoLine;
pallet.PoBillNum = p.PoBillNum;
pallet.ProduceDate = Convert.ToDateTime(p.ProduceDate);
db.TB_PALLETS.Add(pallet);
p.Qty = p.Qty- _oldbox * _PackQty1;
p.Qty = p.Qty - _oldbox * _PackQty1;
}
}
#endregion
@ -1758,6 +1767,12 @@ namespace CK.SCP.Controller
pallet.Box = Convert.ToInt32(_box);
pallet.Qty = p.Qty;
pallet.PalletNum = SCP_BILLCODE_CONTROLLER.MakePalletCode_QD(codenum);
pallet.BarCode = pallet.PalletNum;
pallet.VendBatch = p.VendBatch;
pallet.PoBillLine = p.PoLine;
pallet.PoBillNum = p.PoBillNum;
pallet.ProduceDate = Convert.ToDateTime(p.ProduceDate);
db.TB_PALLETS.Add(pallet);
_oldpartcode = p.PartCode;
_oldbox = Convert.ToInt32(_palletPack) - _box;
@ -1772,7 +1787,7 @@ namespace CK.SCP.Controller
{
_pallet++;
}
for (int i = 1; i <= _pallet;i++)
for (int i = 1; i <= _pallet; i++)
{
TB_PALLETS pallet = new TB_PALLETS();
pallet.AsnBillNum = p.AsnBillNum;
@ -1780,6 +1795,11 @@ namespace CK.SCP.Controller
pallet.Batch = p.Batch;
pallet.VendId = p.VendId;
pallet.PalletNum = SCP_BILLCODE_CONTROLLER.MakePalletCode_QD(codenum);
pallet.BarCode = pallet.PalletNum;
pallet.VendBatch = p.VendBatch;
pallet.PoBillLine = p.PoLine;
pallet.PoBillNum = p.PoBillNum;
pallet.ProduceDate = Convert.ToDateTime(p.ProduceDate);
if (i == _pallet)
{
pallet.Box = Convert.ToInt32(_box - Convert.ToDecimal(_palletPack) * (_pallet - 1));
@ -1803,17 +1823,27 @@ namespace CK.SCP.Controller
_list.Add(_str);
}
});
int state = db.SaveChanges();
if (state != -1)
{
_ret.State = ReturnStatus.Succeed;
_ret.Result = true;
if (_list.Count == 0)
{
int state = db.SaveChanges();
if (state != -1)
{
_ret.State = ReturnStatus.Succeed;
_ret.Result = true;
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.MessageList = _list;
}
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.MessageList = _listm;
_ret.MessageList = _list;
}
}
}
@ -1867,6 +1897,256 @@ namespace CK.SCP.Controller
}
return _ret;
}
public static ResultObject<bool> Save_TB_PALLET_JZJH(List<V_TB_ASN_DETAIL> p_list)
{
ResultObject<bool> _ret = new ResultObject<bool>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
List<string> _list = new List<string>();
string _oldpartcode = ""; //上一个托盘所装零件编号
decimal _oldbox = 0; //上一个托盘箱数计数
string _oldpalletnum = "";//上一个托盘码
string _oldpalletfullnum = "";//上一个托盘码
p_list.ForEach(p =>
{
var _askDetail = db.TA_VEND_PART.Where
(itm => itm.VendId == p.VendId
&& itm.PartCode == p.PartCode
).FirstOrDefault();
if (_askDetail != null)
{
var _palletPack = _askDetail.PalletPackQty;
#region 补充未满托盘
if (p.PartCode== _oldpartcode)
{
decimal _box1 = 0;
int _TempQty1 = Convert.ToInt32(p.Qty);
int _PackQty1 = Convert.ToInt32(p.PackQty);
if (_TempQty1 / _PackQty1 > 0)
{
int _count = _TempQty1 / _PackQty1;
_box1 += _count;
if (p.Qty % p.PackQty > 0)
{
_box1++;
}
}
else
{
if (_TempQty1 > 0)
{
_box1++;
}
}
if(_box1< _oldbox)
{
TB_PALLETS pallet = new TB_PALLETS();
pallet.AsnBillNum = p.AsnBillNum;
pallet.PartCode = p.PartCode;
pallet.Batch = p.Batch;
pallet.VendId = p.VendId;
pallet.Box = Convert.ToInt32(_box1);
pallet.Qty = p.Qty;
pallet.PalletNum = _oldpalletnum;
pallet.BarCode = _oldpalletnum;
pallet.FullBarCode = _oldpalletfullnum;
pallet.VendBatch = p.VendBatch;
pallet.PoBillLine = p.PoLine;
pallet.PoBillNum = p.PoBillNum;
pallet.ProduceDate =Convert.ToDateTime( p.ProduceDate);
db.TB_PALLETS.Add(pallet);
p.Qty = 0;
}
else
{
TB_PALLETS pallet = new TB_PALLETS();
pallet.AsnBillNum = p.AsnBillNum;
pallet.PartCode = p.PartCode;
pallet.Batch = p.Batch;
pallet.VendId = p.VendId;
pallet.Box = Convert.ToInt32(_oldbox);
pallet.Qty = _oldbox* _PackQty1;
pallet.PalletNum = _oldpalletnum;
pallet.BarCode = _oldpalletnum;
pallet.FullBarCode = _oldpalletfullnum;
pallet.VendBatch = p.VendBatch;
pallet.PoBillLine = p.PoLine;
pallet.PoBillNum = p.PoBillNum;
pallet.ProduceDate = Convert.ToDateTime(p.ProduceDate);
db.TB_PALLETS.Add(pallet);
p.Qty = p.Qty- _oldbox * _PackQty1;
}
}
#endregion
#region 新托盘
if (p.Qty != 0)
{
decimal _box = 0;
int _TempQty = Convert.ToInt32(p.Qty);
int _PackQty = Convert.ToInt32(p.PackQty);
if (_TempQty / _PackQty > 0)
{
int _count = _TempQty / _PackQty;
_box += _count;
if (p.Qty % p.PackQty > 0)
{
_box++;
}
}
else
{
if (_TempQty > 0)
{
_box++;
}
}
if (_box <= _palletPack)
{
TB_PALLETS pallet = new TB_PALLETS();
pallet.AsnBillNum = p.AsnBillNum;
pallet.PartCode = p.PartCode;
pallet.Batch = p.Batch;
pallet.VendId = p.VendId;
pallet.Box = Convert.ToInt32(_box);
pallet.Qty = p.Qty;
pallet.VendBatch = p.VendBatch;
pallet.PoBillLine = p.PoLine;
pallet.PoBillNum = p.PoBillNum;
pallet.ProduceDate = Convert.ToDateTime(p.ProduceDate);
var ret = SCP_BARCODE_CONTROLLER.CreatePallets(pallet);
if (ret.State == ReturnStatus.Succeed)
{
pallet.BarCode = pallet.PalletNum;
db.TB_PALLETS.Add(pallet);
_oldpartcode = p.PartCode;
_oldbox = Convert.ToInt32(_palletPack) - _box;
_oldpalletnum = pallet.PalletNum;
_oldpalletfullnum= pallet.FullBarCode;
}
}
else
{
decimal _pallet = 0;
_pallet += Convert.ToInt32(_box) / Convert.ToInt32(_palletPack);
if (_box % _palletPack > 0)
{
_pallet++;
}
for (int i = 1; i <= _pallet;i++)
{
TB_PALLETS pallet = new TB_PALLETS();
pallet.AsnBillNum = p.AsnBillNum;
pallet.PartCode = p.PartCode;
pallet.Batch = p.Batch;
pallet.VendId = p.VendId;
pallet.VendBatch = p.VendBatch;
pallet.PoBillLine = p.PoLine;
pallet.PoBillNum = p.PoBillNum;
pallet.ProduceDate = Convert.ToDateTime(p.ProduceDate);
if (i == _pallet)
{
pallet.Box = Convert.ToInt32(_box - Convert.ToDecimal(_palletPack) * (_pallet - 1));
pallet.Qty = p.Qty - Convert.ToDecimal(_palletPack) * (_pallet - 1) * _PackQty;
}
else
{
pallet.Box = Convert.ToInt32(_palletPack);
pallet.Qty = Convert.ToDecimal(_palletPack) * _PackQty;
}
var ret = SCP_BARCODE_CONTROLLER.CreatePallets(pallet);
if (ret.State == ReturnStatus.Succeed)
{
pallet.BarCode = pallet.PalletNum;
db.TB_PALLETS.Add(pallet);
}
}
}
}
#endregion
}
else
{
string _str = string.Format("零件号:{0},供应商编号:{1},没有维护托盘标包数!请先维护供应商零件信息", p.PartCode, p.VendBatch);
_list.Add(_str);
}
});
int state = db.SaveChanges();
if (_list.Count == 0)
{
if (state != -1)
{
_ret.State = ReturnStatus.Succeed;
_ret.Result = true;
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.MessageList = _list;
}
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.MessageList = _list;
}
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_PALLET_JZJH", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_PALLET_JZJH", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_PALLET_JZJH", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_PALLET", e.Message);
_ret.Result = false;
_ret.ErrorList.Add(e);
throw e;
}
return _ret;
}
public static ResultObject<bool> Save_TB_CREATE_BARCODE_SYJB(List<V_TB_ASN_DETAIL> p_list)
{
ResultObject<bool> _ret = new ResultObject<bool>();

202
Controller/SCP_BARCODE_CONTROLLER.cs

@ -594,6 +594,83 @@ namespace CK.SCP.Controller
}
return _ret;
}
public static ResultObject<TB_PALLETS> CreatePallets(TB_PALLETS p_entity, int cnt = 1)
{
ResultObject<TB_PALLETS> _ret = new ResultObject<TB_PALLETS>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var ret = GetPalletsRule(p_entity.PartCode, p_entity.Batch, cnt);
if (ret.State == ReturnStatus.Succeed)
{
var barcodeRule = ret.Result;
for (int i = cnt; i > 0; i--)
{
var createTime = ScpCache.GetServerTime();
var code = GetLastPalletsBarCode(p_entity.PartCode, p_entity.Batch, barcodeRule.LastNumber - i + 1);
p_entity.PalletNum = code;
}
var fullCode = GetFullCode_Pallets(p_entity);
p_entity.FullBarCode = fullCode;
_ret.State = ReturnStatus.Succeed;
_ret.Result = p_entity;
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Message = "创建编码规则出错!";
}
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "CreateSmallBarcodeList", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "CreateSmallBarcodeList", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "CreateSmallBarcodeList", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "CreateSmallBarcodeList", e.Message);
throw e;
}
return _ret;
}
public static ResultObject<List<TS_BARCODE>> CreateBarcodeList(V_TB_ASN_DETAIL p_entity, int cnt = 1)
{
@ -751,6 +828,20 @@ namespace CK.SCP.Controller
}
return fullcode;
}
public static string GetFullCode_Pallets(TB_PALLETS barcode)
{
var fullcode = string.Empty;
switch (ScpCache.Config.)
{
case "1":
fullcode =
GetFullCode(barcode.PalletNum, barcode.Qty, barcode.VendId, barcode.VendBatch, barcode.PoBillNum,
barcode.PoBillLine, barcode.ProduceDate, barcode.AsnBillNum);
break;
}
return fullcode;
}
public static string GetFullCode(TS_BARCODE barcode)
{
var fullcode = string.Empty;
@ -997,6 +1088,101 @@ namespace CK.SCP.Controller
}
return _ret;
}
private static ResultObject<TB_PALLETS_RULL> GetPalletsRule(string partcode, string batch, int cnt = 1)
{
ResultObject<TB_PALLETS_RULL> _ret = new ResultObject<TB_PALLETS_RULL>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var ruleBatch = batch.Substring(0, 4);
var barcodeRule = db.TB_PALLETS_RULL.Find(partcode, ruleBatch);
if (barcodeRule == null)
{
barcodeRule = new TB_PALLETS_RULL
{
PartCode = partcode,
RuleBatch = ruleBatch,
LastNumber = cnt,
State = 0
};
}
else
{
barcodeRule.LastNumber += cnt;
}
barcodeRule.LastBarCode = GetLastPalletsBarCode(partcode, batch, barcodeRule.LastNumber);
barcodeRule.LastTime = ScpCache.GetServerTime();
db.TB_PALLETS_RULL.AddOrUpdate(p => new { p.PartCode, p.RuleBatch }, barcodeRule);
if (db.SaveChanges() != -1)
{
_ret.State = ReturnStatus.Succeed;
_ret.Result = barcodeRule;
}
else
{
_ret.State = ReturnStatus.Failed;
}
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetPalletsRule", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetPalletsRule", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetPalletsRule", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetPalletsRule", e.Message);
throw e;
}
return _ret;
}
private static string GetLastBarCode(string partcode, string batch, int lastnum)
{
@ -1014,7 +1200,23 @@ namespace CK.SCP.Controller
barcode += lastnum.ToString(ScpCache.Config.ÌõÂëÐòÁкŸñʽ);
return barcode;
}
private static string GetLastPalletsBarCode(string partcode, string batch, int lastnum)
{
var barcode = "G.";
barcode += partcode + ScpCache.Config.;
if (ScpCache.Config.)
{
barcode += batch + ScpCache.Config.;
}
else
{
barcode += batch + ScpCache.Config.;
}
barcode += lastnum.ToString(ScpCache.Config.);
return barcode;
}
private static string GetLastSmallBarCode(string partcode, string batch, int lastnum)
{

1
Models/CK.SCP.Models.csproj

@ -345,6 +345,7 @@
<Compile Include="ScpEntity\TA_VENDER_EXTEND.cs" />
<Compile Include="ScpEntity\TB_CLAIM_APPEND.cs" />
<Compile Include="ScpEntity\TB_PALLETS.cs" />
<Compile Include="ScpEntity\TB_PALLETS_RULL.cs" />
<Compile Include="ScpEntity\TB_PLAN_CUSTOM.cs" />
<Compile Include="ScpEntity\TB_PO_PLAN_EXTEND.cs" />
<Compile Include="ScpEntity\TB_PO_PLAN.cs" />

1
Models/ScpEntities.cs

@ -96,6 +96,7 @@ namespace CK.SCP.Models
public virtual DbSet<V_TB_REJECT_DETAIL> V_TB_REJECT_DETAIL { get; set; }
public virtual DbSet<TS_BARCODE_RULE> TS_BARCODE_RULE { get; set; }
public virtual DbSet<TS_BARCODE_RULE_SMALL> TS_BARCODE_RULE_SMALL { get; set; }
public virtual DbSet<TB_PALLETS_RULL> TB_PALLETS_RULL { get; set; }
public virtual DbSet<V_TB_INVOICE_DETAIL> V_TB_INVOICE_DETAIL { get; set; }
public virtual DbSet<V_TB_INVOICE> V_TB_INVOICE { get; set; }
public virtual DbSet<V_TB_INVOICE_DETAIL_RED> V_TB_INVOICE_DETAIL_RED { get; set; }

9
Models/ScpEntity/TB_PALLETS.cs

@ -16,11 +16,20 @@ namespace CK.SCP.Models.ScpEntity
[StringLength(50)]
public string AsnBillNum { get; set; }
public string PalletNum { get; set; }
public string BarCode { get; set; }
public string FullBarCode { get; set; }
public string PartCode { get; set; }
public string Batch { get; set; }
public string VendId { get; set; }
public int Box { get; set; }
public decimal Qty { get; set; }
//--新添加
public string VendBatch { get; set; }
public string PoBillNum { get; set; }
public int PoBillLine { get; set; }
[Column(TypeName = "datetime2")]
public DateTime ProduceDate { get; set; }
}
}

33
Models/ScpEntity/TB_PALLETS_RULL.cs

@ -0,0 +1,33 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CK.SCP.Models.ScpEntity
{
public partial class TB_PALLETS_RULL
{
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public int UID { get; set; }
[Key]
[Column(Order = 0)]
[StringLength(50)]
public string PartCode { get; set; }
[Key]
[Column(Order = 1)]
[StringLength(50)]
public string RuleBatch { get; set; }
public int LastNumber { get; set; }
[Required(AllowEmptyStrings = true)]
[StringLength(500)]
public string LastBarCode { get; set; }
public DateTime LastTime { get; set; }
public int State { get; set; }
}
}

4
SCP/Views/锦州锦恒/SupplierData/SCP_ASN.aspx

@ -28,10 +28,6 @@
</f:Button>--%>
<f:Button ID="btnShow" runat="server" Icon="Add" Text="显示查询面板" OnClick="btnShow_Click">
</f:Button>
<f:Button ID="btnPallet" runat="server" Icon="Add" Text="创建托盘" OnClick="btnPallet_Click" >
</f:Button>
<f:Button ID="btnPalletDetail" runat="server" Icon="Add" Text="查看托盘" OnClick="btnPalletDetail_Click" >
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>

54
SCP/Views/锦州锦恒/SupplierData/SCP_ASN.aspx.designer.cs

@ -86,24 +86,6 @@ namespace SCP.锦州锦恒.SupplierData
/// </remarks>
protected global::FineUI.Button btnShow;
/// <summary>
/// btnPallet 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUI.Button btnPallet;
/// <summary>
/// btnPalletDetail 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUI.Button btnPalletDetail;
/// <summary>
/// gp1 控件。
/// </summary>
@ -176,6 +158,42 @@ namespace SCP.锦州锦恒.SupplierData
/// </remarks>
protected global::FineUI.TextBox txtPO;
/// <summary>
/// TXT_SubSite 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUI.TextBox TXT_SubSite;
/// <summary>
/// TXT_Extend1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUI.TextBox TXT_Extend1;
/// <summary>
/// TXT_Extend2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUI.TextBox TXT_Extend2;
/// <summary>
/// TXT_Extend3 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUI.TextBox TXT_Extend3;
/// <summary>
/// FormRow_3 控件。
/// </summary>

9
SCP/Views/锦州锦恒/SupplierData/SCP_ASN_DETAIL.aspx

@ -62,10 +62,11 @@
<f:Button runat="server" ID="btnDel" Text="删除" Icon="ApplicationDelete" OnClick="btnDel_OnClick"></f:Button>--%>
<f:Button runat="server" ID="btnCreateBarCode" Text="创建条码" Icon="Printer" OnClick="CreateBarCode_Click"></f:Button>
<f:Button runat="server" ID="btnSelectedBarCode" Text="打印全部条码" EnablePostBack="true" Icon="Printer" OnClick="btnSelectedBarCode_Click"></f:Button>
<f:Button runat="server" ID="btnOutputPallet" Text="导出或打印托盘" Icon="Printer" OnClick="btnOutputPallet_Click" Hidden="true"></f:Button>
<f:Button runat="server" ID="btnBarCodeList" Text="显示条码列表" Icon="Layers" OnClick="btnBarCodeList_Click"></f:Button>
<f:Button runat="server" ID="btnCreatePallet" Text="生成托盘" EnablePostBack="true" Icon="Printer" OnClick="btnCreatePallet_Click"></f:Button>
<f:Button runat="server" ID="btnOutputPallet" Text="打印托盘条码" Icon="Printer" OnClick="btnSelectedPalletBarCode_Click"></f:Button>
<f:Button runat="server" ID="btnOutPut" Text="导出明细" Icon="PageExcel" OnClick="btnOutput_Click"></f:Button>
<f:TextBox runat = "server" Label = "模板规格" EmptyText = "" ID = "TXT_MarkType" Readonly="true" Hidden="true" />
<f:TextBox runat = "server" Label = "模板规格" EmptyText = "" ID = "TXT_MarkType" Readonly="true" Hidden="true" />
</Items>
</f:Toolbar>
</Items>
@ -146,6 +147,10 @@
<f:Window ID="WindowUpload" runat="server" Hidden="True"
WindowPosition="Center" IsModal="true" Title="选择标签规格" Target="Self" EnableIFrame="true"
IFrameUrl="about:blank" Height="200px" Width="400px" OnClose="WindowUpload1_Close">
</f:Window>
<f:Window ID="Window2" runat="server" Hidden="True"
WindowPosition="Center" IsModal="true" Title="选择托盘规格" Target="Self" EnableIFrame="true"
IFrameUrl="about:blank" Height="200px" Width="400px" OnClose="WindowUpload2_Close">
</f:Window>
</form>
<script>

110
SCP/Views/锦州锦恒/SupplierData/SCP_ASN_DETAIL.aspx.cs

@ -87,7 +87,20 @@ namespace SCP.锦州锦恒.SupplierData
}
}
});
SCP_PALLET_CONTROLLER.Get_TB_PALLETS_List(new TB_PALLETS() { AsnBillNum = TXT_AsnBillNum.Text.Trim() }, (ret) =>
{
if (ret.State == ReturnStatus.Succeed)
{
if (ret.Result.Count() > 0)
{
this.btnCreatePallet.Enabled = false;
}
else
{
this.btnCreatePallet.Enabled = true;
}
}
});
});
}
public void BindDetail()
@ -488,54 +501,11 @@ namespace SCP.锦州锦恒.SupplierData
string openUrl = string.Format("SCP_SELECT_MAKE.aspx?select={0}", HttpUtility.UrlEncode(TXT_MarkType.Text));
PageContext.RegisterStartupScript(WindowUpload.GetSaveStateReference(TXT_MarkType.ClientID) + WindowUpload.GetShowReference(openUrl));
}
protected void btnOutputPallet_Click(object sender, EventArgs e)
protected void btnSelectedPalletBarCode_Click(object sender, EventArgs e)
{
#region 计算托盘数量和发货数量是否相等
SearchV_TB_ASN_DETAILData((ret) => {
var _asn = Session["Asn"] as V_TB_ASN;
if (_asn == null)
{
Alert.Show("发货单不存在!");
return;
}
var _ls=SCP_ASN_CONTROLLER.Get_CAN_PALLET_QTY(ret.ToList());
var _errList = new List<string>();
_ls.ForEach(p => {
if(p.CanQty>0)
{
_errList.Add(string.Format("编号:{0}名称:{1},托盘数量总和小于发货单数量",p.PartCode,(p.PartDesc1+p.PartDesc2)));
}
});
if (_errList.Count > 0)
{
Alert.Show(string.Join("<BR>", _errList.ToArray()));
return;
}
List<string> _list = new List<string>();
_list.Add(_asn.AsnBillNum);
DataSet ds = SCP_EXCEL_CONTROLLER.GET_PALLET_EXECEL(_list);
PageBase.DataSetToExcel(ds, "打印导出托盘!");
});
#endregion
string openUrl = string.Format("SCP_SELECT_MAKE.aspx?select={0}", HttpUtility.UrlEncode(TXT_MarkType.Text));
PageContext.RegisterStartupScript(Window2.GetSaveStateReference(TXT_MarkType.ClientID) + Window2.GetShowReference(openUrl));
}
protected void btnPackage_Click(object sender, EventArgs e)
{
@ -557,5 +527,51 @@ namespace SCP.锦州锦恒.SupplierData
SCP_BARCODE_CONTROLLER.Save_TB_PRINT_COUNT(new TB_PRINT_COUNT() { BillNo = AsnBillNum, PrintType = (int)PrintType.BAR_CODE });
TXT_MarkType.Text = "";
}
protected void WindowUpload2_Close(object sender, WindowCloseEventArgs e)
{
if (string.IsNullOrEmpty(TXT_MarkType.Text))
{
Alert.Show("没有选择标签模板!");
return;
}
string AsnBillNum = Request["AsnBillNum"];
if (!string.IsNullOrEmpty(AsnBillNum))
{
var str = string.Format("window.open(\"../../../Handlers/GenerateReport.ashx?report={1}&data=105&type=pdf&filename=托盘标签.pdf&AsnBillNum={0}&open=\")", AsnBillNum, TXT_MarkType.Text);
PageContext.RegisterStartupScript(str);
}
SCP_BARCODE_CONTROLLER.Save_TB_PRINT_COUNT(new TB_PRINT_COUNT() { BillNo = AsnBillNum, PrintType = (int)PrintType.Pallet_CODE });
TXT_MarkType.Text = "";
}
protected void btnOutputPallet_Click(object sender, EventArgs e)
{
string AsnBillNum = Request["AsnBillNum"];
if (!string.IsNullOrEmpty(AsnBillNum))
{
var str = string.Format("window.open(\"../../../Handlers/GenerateReport.ashx?report=Material-lbl-5437&data=105&type=pdf&filename=托盘标签.pdf&AsnBillNum={0}&open=\")", AsnBillNum);
PageContext.RegisterStartupScript(str);
}
SCP_BARCODE_CONTROLLER.Save_TB_PRINT_COUNT(new TB_PRINT_COUNT() { BillNo = AsnBillNum, PrintType = (int)PrintType.Pallet_CODE });
}
protected void btnCreatePallet_Click(object sender, EventArgs e)
{
var _list = GetSelectedList();
if (_list.Count > 0)
{
btnCreatePallet.Enabled = false;
var ret = SCP_ASN_CONTROLLER.Save_TB_PALLET_JZJH(_list);
if (ret.State == ReturnStatus.Succeed)
{
Alert.Show("托码创建成功!");
}
else
{
btnCreatePallet.Enabled = true;
Alert.Show(string.Join("<br>", ret.MessageList));
}
}
}
}
}

26
SCP/Views/锦州锦恒/SupplierData/SCP_ASN_DETAIL.aspx.designer.cs

@ -231,22 +231,31 @@ namespace SCP.锦州锦恒.SupplierData
protected global::FineUI.Button btnSelectedBarCode;
/// <summary>
/// btnOutputPallet 控件。
/// btnBarCodeList 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUI.Button btnOutputPallet;
protected global::FineUI.Button btnBarCodeList;
/// <summary>
/// btnBarCodeList 控件。
/// btnCreatePallet 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUI.Button btnBarCodeList;
protected global::FineUI.Button btnCreatePallet;
/// <summary>
/// btnOutputPallet 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUI.Button btnOutputPallet;
/// <summary>
/// btnOutPut 控件。
@ -319,5 +328,14 @@ namespace SCP.锦州锦恒.SupplierData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUI.Window WindowUpload;
/// <summary>
/// Window2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUI.Window Window2;
}
}

4
SCP/default.aspx

@ -111,10 +111,10 @@
for (var i = 0; obj.options.length; i++)
{
if ('CNS' == obj.options[i].value) {
if ('JZ1' == obj.options[i].value) {
obj.options[i].selected = true;
_factory = document.getElementById(_factoryValue);
_factory.value = 'CNS';
_factory.value = 'JZ1';
}
}
}

Loading…
Cancel
Save