You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
162 lines
5.7 KiB
162 lines
5.7 KiB
3 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using Stone.WinBiz.BasicData;
|
||
|
using Stone.Entity;
|
||
|
using System.Windows.Forms;
|
||
|
using Stone.Common;
|
||
|
using Gm_WMS.DataAccess.DataService;
|
||
|
using System.Data;
|
||
|
using Stone.WinBiz.JISData;
|
||
|
|
||
|
namespace Stone.WinBiz.Standard
|
||
|
{
|
||
|
public class F_JIS_VDA_ASN : F_Base
|
||
|
{
|
||
|
public string fileType = "";
|
||
|
public F_JIS_VDA_ASN()
|
||
|
{
|
||
|
this.type = "JIS_VDA_ASN";
|
||
|
this.name = "Standard件_ASN管理";
|
||
|
this.entity = new Entity_t_JIS_VDA();
|
||
|
this.entityView = new Entity_v_JIS_VDA();
|
||
|
this.strOrder = "PackageNo desc";
|
||
|
}
|
||
|
|
||
|
public override void BindPageData(string strWhere)
|
||
|
{
|
||
|
strWhere = "(" + strWhere + ") and [FileType]='" + fileType + "'";
|
||
|
|
||
|
base.BindPageData(strWhere);
|
||
|
}
|
||
|
|
||
|
public override void GetView(DataGridView dgv)
|
||
|
{
|
||
|
dgv.DataSource = dsMain.Tables[0];
|
||
|
dgv.Columns["ID"].Visible = false; //隐藏ID列
|
||
|
|
||
|
dgv.Columns["fileType"].HeaderText = "工厂";
|
||
|
dgv.Columns["AsnNumber"].HeaderText = "ASN编号";
|
||
|
dgv.Columns["PackageNo"].HeaderText = "装箱单号";
|
||
|
dgv.Columns["PartNumber"].HeaderText = "零件号";
|
||
|
dgv.Columns["Description"].HeaderText = "零件描述";
|
||
|
dgv.Columns["Date"].HeaderText = "需求日期";
|
||
|
dgv.Columns["LabelDate"].HeaderText = "标签日期";
|
||
|
dgv.Columns["Qty"].HeaderText = "数量";
|
||
|
dgv.Columns["releaseId"].HeaderText = "版本号";
|
||
|
dgv.Columns["location"].HeaderText = "卸货点";
|
||
|
dgv.Columns["locationCode"].HeaderText = "卸货点代码";
|
||
|
dgv.Columns["orderNumber"].HeaderText = "采购订单号";
|
||
|
|
||
|
dgv.Columns["IsPrintLabel"].HeaderText = "打印标签";
|
||
|
dgv.Columns["IsPackingVerification"].HeaderText = "装箱校验";
|
||
|
dgv.Columns["IsShipingVerification"].HeaderText = "发货校验";
|
||
|
dgv.Columns["IsPrintASN"].HeaderText = "打印ASN";
|
||
|
dgv.Columns["PrintASNTime"].HeaderText = "ASN打印时间";
|
||
|
dgv.Columns["IsUpload"].HeaderText = "是否上传";
|
||
|
dgv.Columns["UploadTime"].HeaderText = "上传时间";
|
||
|
|
||
|
|
||
|
|
||
|
MyGridViewStyle.GetGridViewState(dgv, "基础资料" + type);
|
||
|
MyGridViewStyle.SetDataGridMenuCommon(dgv);
|
||
|
MyGridViewStyle.SetDataGridRowNumber(dgv);
|
||
|
}
|
||
|
|
||
|
public override void Delete(int ID)
|
||
|
{
|
||
|
string LogID = "0";
|
||
|
try
|
||
|
{
|
||
|
DataTable dtData = entity.GetData("[ID]=" + ID).Tables[0];
|
||
|
if (dtData.Rows.Count == 0) throw new Exception("删除的记录不存在");
|
||
|
|
||
|
LogID = F_JIS_Log.WriteLogsStart($"删除ASN记录{dtData.Rows[0]["PackageNo"]}");
|
||
|
|
||
|
if (!Convert.ToBoolean(dtData.Rows[0]["IsUpload"]))
|
||
|
{
|
||
|
entity.Del(ID);
|
||
|
|
||
|
//删除DataSet中的记录
|
||
|
DataRow[] drDatas = dsMain.Tables[0].Select("ID=" + ID);
|
||
|
if (drDatas.Length > 0)
|
||
|
{
|
||
|
drDatas[0].Delete();
|
||
|
}
|
||
|
|
||
|
F_JIS_Log.WriteLogsEnd(LogID, true, "");
|
||
|
|
||
|
Stone.WinBiz.BasicData.F_Log.WriteLog("删除数据[" + this.name + "]");
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
throw new Exception("已经上传ASN的记录不能删除");
|
||
|
}
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
F_JIS_Log.WriteLogsEnd(LogID, false, ex.Message);
|
||
|
throw ex;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
#region STD流水号计算
|
||
|
|
||
|
//取下一个ASN编号
|
||
|
public static string GetVDA_AsnNumberPre(string filetype, int len)
|
||
|
{
|
||
|
string n = "";
|
||
|
if (filetype == "SY78") n = "7";
|
||
|
if (filetype == "SY88") n = "8";
|
||
|
|
||
|
string date = Convert.ToDateTime(MyDateTime.GetServerDateTime()).ToString("yyMMdd");
|
||
|
|
||
|
Entity_t_BillNo t_BillNo = new Entity_t_BillNo();
|
||
|
DataTable dtBillNo = t_BillNo.GetData($"[type]='VDAASN编号_{filetype}_{date}'").Tables[0];
|
||
|
int sn = 0;
|
||
|
if(dtBillNo.Rows.Count > 0)
|
||
|
{
|
||
|
sn = Convert.ToInt32(dtBillNo.Rows[0]["Value"]);
|
||
|
}
|
||
|
|
||
|
sn++;
|
||
|
return $"ADT{n}{date}" + MyStrings.PadLeftString(sn.ToString(), '0', len);
|
||
|
}
|
||
|
|
||
|
//取ASN编号
|
||
|
public static string GetVDA_AsnNumber(LocalDBService db, string filetype, int len)
|
||
|
{
|
||
|
string n = "";
|
||
|
if (filetype == "SY78") n = "7";
|
||
|
if (filetype == "SY88") n = "8";
|
||
|
|
||
|
string date = Convert.ToDateTime(MyDateTime.GetServerDateTime()).ToString("yyMMdd");
|
||
|
string type = $"VDAASN编号_{n}{date}";
|
||
|
|
||
|
int sn = Convert.ToInt32(db.Exec_Object($"exec p_GetBillNo 'VDAASN编号_{filetype}_{date}'"));
|
||
|
|
||
|
return $"ADT{n}{date}" + MyStrings.PadLeftString(sn.ToString(), '0', len);
|
||
|
}
|
||
|
|
||
|
//取装箱单号
|
||
|
public static string GetVDA_PackNumber(LocalDBService db, string type, int len)
|
||
|
{
|
||
|
string value = db.Exec_Object("exec p_GetBillNo 'VDA装箱单'").ToString();
|
||
|
|
||
|
return type + MyStrings.PadLeftString(value, '0', len);
|
||
|
}
|
||
|
|
||
|
//上传ASN报表编号
|
||
|
public static string GetVDA_AsnLiushui(LocalDBService db, string type, int len)
|
||
|
{
|
||
|
string value = db.Exec_Object("exec p_GetBillNo 'VDAASN流水号'").ToString();
|
||
|
|
||
|
return type + MyStrings.PadLeftString(value, '0', len);
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
}
|
||
|
}
|