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.
204 lines
9.0 KiB
204 lines
9.0 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using Stone.Common;
|
|
using Stone.Entity;
|
|
using System.Data;
|
|
using Gm_WMS.DataAccess.DataService;
|
|
|
|
namespace Stone.WinBiz.JISAdmin
|
|
{
|
|
public class F_JIS5000_AutoPrint
|
|
{
|
|
#region 自动打印装配单和标签
|
|
public static void ProcessDataAssembly()
|
|
{
|
|
if (MyAppconfig.ReadValue("JIS是否打印装配单").Trim() != "是") return;
|
|
|
|
string PackageGroupNames = "";
|
|
if (MyAppconfig.ReadValue("JIS打印前保装配单").Trim() == "是") PackageGroupNames = ",'前保'";
|
|
if (MyAppconfig.ReadValue("JIS打印后保装配单").Trim() == "是") PackageGroupNames += ",'后保'";
|
|
if (MyAppconfig.ReadValue("JIS打印左门槛装配单").Trim() == "是") PackageGroupNames += ",'左门槛'";
|
|
if (MyAppconfig.ReadValue("JIS打印右门槛装配单").Trim() == "是") PackageGroupNames += ",'右门槛'";
|
|
if (MyAppconfig.ReadValue("JIS打印扰流板装配单").Trim() == "是") PackageGroupNames += ",'扰流板'";
|
|
|
|
|
|
if (PackageGroupNames == "") return;
|
|
PackageGroupNames = PackageGroupNames.Substring(1, PackageGroupNames.Length - 1);
|
|
|
|
string strWhere = "[IsPrintAssemble]=0 and PackageGroupName in({0})";
|
|
strWhere = string.Format(strWhere, PackageGroupNames);
|
|
|
|
Entity_t_JIS_Seq5000 t_JIS_Seq5000 = new Entity_t_JIS_Seq5000();
|
|
DataSet dsData = t_JIS_Seq5000.GetData("top 1 *", strWhere, "[SequenceNumber] asc, [SwetTime] asc");
|
|
if (dsData.Tables[0].Rows.Count == 0) return;
|
|
dsData.Tables[0].TableName = "BillHead";
|
|
|
|
t_JIS_Seq5000.Edit("[IsPrintAssemble]=1, [PrintTimeAssemble]=getdate()", "[ID]=" + dsData.Tables[0].Rows[0]["ID"].ToString());
|
|
|
|
F_JIS5000_Print.PrintAssembly(dsData);
|
|
F_JIS5000_Print.PrintAssemblyLabel(dsData);
|
|
|
|
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 自动打印装箱单
|
|
public static void PrintPackingList(string PackageGroupName)
|
|
{
|
|
if (MyAppconfig.ReadValue("JIS是否打印装箱单").Trim() != "是") return;
|
|
int PackageCount = Convert.ToInt32(MyAppconfig.ReadValue("JIS" + PackageGroupName + "装箱数"));
|
|
|
|
|
|
Entity_t_JIS_Seq5000 t_JIS_Seq5000 = new Entity_t_JIS_Seq5000();
|
|
|
|
DataSet dsTop = t_JIS_Seq5000.GetData("top 1 *", "IsPrintPackingList=1 and PackageGroupName='" + PackageGroupName + "' and PrintPackingListTime is null", "[SequenceNumber] asc, [SwetTime] asc");
|
|
if (dsTop.Tables[0].Rows.Count == 0) return;
|
|
|
|
string BillNo = dsTop.Tables[0].Rows[0]["PackingListNumber"].ToString();
|
|
string PagerNumber = dsTop.Tables[0].Rows[0]["PagerNumber"].ToString();
|
|
|
|
DataSet dsPrint = t_JIS_Seq5000.GetData("", "[PackingListNumber]='" + BillNo + "'", "[SequenceNumber] asc, [SwetTime] asc");
|
|
|
|
t_JIS_Seq5000.Edit("[PrintPackingListTime]=getdate()", "[PackingListNumber]='" + BillNo + "'");
|
|
|
|
F_JIS5000_Print.PrintPackingList(dsPrint, BillNo, PackageGroupName, PagerNumber);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 打印装箱单时连续性判断
|
|
|
|
public static void IsContinuous(DataSet dsData, string PackageGroupName, LocalDBService db)
|
|
{
|
|
DataSet ds1 = dsData.Clone();
|
|
DataSet ds2 = dsData.Clone();
|
|
|
|
foreach (DataRow drData in dsData.Tables[0].Rows)
|
|
{
|
|
if (ds1.Tables[0].Rows.Count > 0)
|
|
{
|
|
if (ds1.Tables[0].Select("[PartsFamily]='" + drData["PartsFamily"].ToString().Trim() + "'").Length > 0)
|
|
{
|
|
ds1.Tables[0].Rows.Add(drData.ItemArray);
|
|
}
|
|
else
|
|
{
|
|
ds2.Tables[0].Rows.Add(drData.ItemArray);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ds1.Tables[0].Rows.Add(drData.ItemArray);
|
|
}
|
|
}
|
|
|
|
|
|
if (ds1.Tables[0].Rows.Count > 0) IsContinuous1(ds1, PackageGroupName, db);
|
|
if (ds2.Tables[0].Rows.Count > 0) IsContinuous1(ds2, PackageGroupName, db);
|
|
|
|
|
|
}
|
|
|
|
public static void IsContinuous1(DataSet dsData, string PackageGroupName, LocalDBService db)
|
|
{
|
|
int firstCheckSequence = 0;
|
|
Entity_t_JIS_Seq5000 t_JIS_Seq5000 = new Entity_t_JIS_Seq5000(db);
|
|
string strWhere = "[IsPrintPackingList]=1 and PackageGroupName = '" + PackageGroupName + "' and [PartsFamily]='" + dsData.Tables[0].Rows[0]["PartsFamily"].ToString().Trim() + "'";
|
|
DataSet dsLastData = t_JIS_Seq5000.GetData("top 1 CheckSequence ", strWhere, "[SequenceNumber] desc, [SwetTime] desc");
|
|
if (dsLastData.Tables[0].Rows.Count > 0) firstCheckSequence = Convert.ToInt32(dsLastData.Tables[0].Rows[0]["CheckSequence"]);
|
|
|
|
if (firstCheckSequence == 0) firstCheckSequence = Convert.ToInt32(dsData.Tables[0].Rows[0]["CheckSequence"]) - 1;
|
|
|
|
int lastCheckSequence = Convert.ToInt32(dsData.Tables[0].Rows[dsData.Tables[0].Rows.Count - 1]["CheckSequence"]);
|
|
|
|
if (lastCheckSequence - firstCheckSequence != dsData.Tables[0].Rows.Count)
|
|
throw new Exception(PackageGroupName + " CheckSequence [" + firstCheckSequence + "] 不连续");
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region ReOrder
|
|
|
|
public static void ProcessDataAssemblyReOrder()
|
|
{
|
|
if (MyAppconfig.ReadValue("JIS是否打印装配单").Trim() != "是") return;
|
|
|
|
string PackageGroupNames = "";
|
|
if (MyAppconfig.ReadValue("JIS打印前保装配单").Trim() == "是") PackageGroupNames = ",'前保'";
|
|
if (MyAppconfig.ReadValue("JIS打印后保装配单").Trim() == "是") PackageGroupNames += ",'后保'";
|
|
if (MyAppconfig.ReadValue("JIS打印左门槛装配单").Trim() == "是") PackageGroupNames += ",'左门槛'";
|
|
if (MyAppconfig.ReadValue("JIS打印右门槛装配单").Trim() == "是") PackageGroupNames += ",'右门槛'";
|
|
if (MyAppconfig.ReadValue("JIS打印扰流板装配单").Trim() == "是") PackageGroupNames += ",'扰流板'";
|
|
|
|
if (PackageGroupNames == "") return;
|
|
PackageGroupNames = PackageGroupNames.Substring(1, PackageGroupNames.Length - 1);
|
|
|
|
string strWhere = "[IsPrintAssemble]=0 and PackageGroupName in({0})";
|
|
strWhere = string.Format(strWhere, PackageGroupNames);
|
|
|
|
Entity_t_JIS_Seq5000_ReOrder t_JIS_Seq5000_ReOrder = new Entity_t_JIS_Seq5000_ReOrder();
|
|
DataSet dsData = t_JIS_Seq5000_ReOrder.GetData("", strWhere, "[SwetTime] asc");
|
|
if (dsData.Tables[0].Rows.Count == 0) return;
|
|
dsData.Tables[0].TableName = "BillHead";
|
|
|
|
t_JIS_Seq5000_ReOrder.Edit("[IsPrintAssemble]=1, [PrintTimeAssemble]=getdate()", strWhere);
|
|
|
|
|
|
F_JIS5000_Print_ReOrder.PrintAssembly(dsData);
|
|
|
|
F_JIS5000_Print_ReOrder.PrintAssemblyLabel(dsData);
|
|
|
|
|
|
}
|
|
|
|
|
|
public static void ProcessDataPackingListReOrder()
|
|
{
|
|
if (MyAppconfig.ReadValue("JIS是否打印装箱单").Trim() != "是") return;
|
|
|
|
if (MyAppconfig.ReadValue("JIS打印前保装箱单").Trim() == "是") PrintPackingListReOrder("前保");
|
|
|
|
if (MyAppconfig.ReadValue("JIS打印后保装箱单").Trim() == "是") PrintPackingListReOrder("后保");
|
|
|
|
if (MyAppconfig.ReadValue("JIS打印左门槛装箱单").Trim() == "是") PrintPackingListReOrder("左门槛");
|
|
|
|
if (MyAppconfig.ReadValue("JIS打印左门槛装箱单").Trim() == "是") PrintPackingListReOrder("右门槛");
|
|
|
|
}
|
|
|
|
public static void PrintPackingListReOrder(string PackageGroupName)
|
|
{
|
|
Gm_WMS.DataAccess.DataService.LocalDBService db = new Gm_WMS.DataAccess.DataService.LocalDBService();
|
|
if (MyAppconfig.ReadValue("JIS是否打印装箱单").Trim() != "是") return;
|
|
|
|
int PackageCount = Convert.ToInt32(MyAppconfig.ReadValue("JIS" + PackageGroupName + "装箱数"));
|
|
|
|
Entity_t_JIS_Seq5000_ReOrder t_JIS_Seq5000_ReOrder = new Entity_t_JIS_Seq5000_ReOrder();
|
|
|
|
string strWhere = "[IsPrintAssemble]=1 and [IsPrintPackingList]=0 and PackageGroupName = '" + PackageGroupName + "'";
|
|
|
|
DataSet dsData = t_JIS_Seq5000_ReOrder.GetData("top " + PackageCount + " *", strWhere, "[SwetTime], SequenceNumber asc");
|
|
if (dsData.Tables[0].Rows.Count == 0) return;
|
|
|
|
|
|
string BillNo = F_JIS5000_Print_ReOrder.GetPackingListNumber(PackageGroupName);
|
|
string PagerNumber = F_JIS5000_Print_ReOrder.GetNumber(PackageGroupName, 2);
|
|
|
|
for (int i = 0; i < dsData.Tables[0].Rows.Count; i++)
|
|
{
|
|
t_JIS_Seq5000_ReOrder.Edit("[IsPrintPackingList]=1, [PackingListNumber]='" + BillNo + "', [PagerNumber]='" + PagerNumber + "'", "[ID]=" + dsData.Tables[0].Rows[i]["ID"].ToString());
|
|
}
|
|
|
|
F_JIS5000_Print_ReOrder.PrintPackingList(dsData, BillNo, PackageGroupName, PagerNumber);
|
|
|
|
}
|
|
#endregion
|
|
}
|
|
}
|
|
|