北京安通林JIS系统
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.
 
 
 

110 lines
4.3 KiB

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Gm_WMS.DataAccess.DataService;
using Stone.Common;
using Stone.Entity;
using Stone.WinBiz.BasicData;
using Stone.WinBiz.SystemData;
namespace Stone.WinBiz.ProductionPlan
{
public class F_Plan
{
public static string GetBillNo(LocalDBService db)
{
string type = "Y" + MyDateTime.GetServerDateTime().ToString("yyMMdd");
return type + F_BillNo.GetBillNo(db, "序列单" + "_" + type, 6);
}
public static void ReleasePlan(DataTable dtData, DataTable dtAll)
{
LocalDBService db = null;
try
{
db = new LocalDBService();
db.BeginTrans();
Entity_t_JIS_Assemble t_JIS_Assemble = new Entity_t_JIS_Assemble(db);
Entity_t_JIS_List t_JIS_List = new Entity_t_JIS_List(db);
int PackageQty = Convert.ToInt32(F_Appconfig.GetValue("PackageQty"));
string ReleaseTime = MyDateTime.GetServerDateTime().ToString("yyyy-MM-dd HH:mm:ss");
string BillNo = "";
int n = 0;
foreach (DataRow drData in dtData.Rows)
{
string productionNumber = drData["productionNumber"].ToString();
string PartType = drData["PartType"].ToString();
if (t_JIS_Assemble.GetData($"[productionNumber]='{productionNumber}'").Tables[0].Rows.Count > 0)
throw new Exception($"{productionNumber} 重复发布");
n++;
if(n == 1)
{
BillNo = F_Plan.GetBillNo(db);
}
DataRow drNew = t_JIS_Assemble.Table.NewRow();
drNew["CarModelCode"] = drData["CarModelCode"].ToString();
drNew["productionNumber"] = drData["productionNumber"].ToString();
drNew["itemNumber"] = drData["itemNumber"].ToString();
drNew["description"] = drData["description"].ToString();
drNew["sequenceNumber"] = drData["sequenceNumber"].ToString();
drNew["assemblyDate"] = drData["assemblyDate"];
drNew["vehicleModelCode"] = drData["vehicleModelCode"].ToString();
drNew["partType"] = drData["partType"].ToString();
drNew["ReleaseTime"] = ReleaseTime;
drNew["ReleaseUser"] = User.UserInfo.UserName;
drNew["BillNo"] = BillNo;
drNew["Sort"] = n;
t_JIS_Assemble.Add(drNew);
DataRow[] drLists = dtAll.Select($"[productionNumber]='{productionNumber}'");
foreach(DataRow drList in drLists)
{
DataRow drNewList = t_JIS_List.Table.NewRow();
drNewList["CarModelCode"] = drList["CarModelCode"].ToString();
drNewList["productionNumber"] = drList["productionNumber"].ToString();
drNewList["itemNumber"] = drList["itemNumber"].ToString();
drNewList["description"] = drList["description"].ToString();
drNewList["quantity"] = drList["quantity"].ToString();
drNewList["sequenceNumber"] = drList["sequenceNumber"].ToString();
drNewList["assemblyDate"] = drList["assemblyDate"].ToString();
drNewList["vehicleModelCode"] = drList["vehicleModelCode"].ToString();
drNewList["partType"] = drList["partType"].ToString();
drNewList["IsMajor"] = drList["IsMajor"].ToString();
drNewList["IsKey"] = drList["IsKey"].ToString();
drNewList["BillNo"] = BillNo;
t_JIS_List.Add(drNewList);
}
if (n >= PackageQty) n = 0;
}
db.Commit();
}
catch (Exception ex)
{
if (db != null) db.Rollback();
throw ex;
}
finally
{
if (db != null) db.EndTrans();
}
}
}
}