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.
103 lines
3.2 KiB
103 lines
3.2 KiB
1 month ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Data;
|
||
|
using System.Linq;
|
||
|
using System.Reflection;
|
||
|
using System.Text;
|
||
|
using MESClassLibrary.BLL;
|
||
|
using MESClassLibrary.BLL.Log;
|
||
|
using MESClassLibrary.EFModel;
|
||
|
using MESClassLibrary.Enum;
|
||
|
using MESClassLibrary.Model;
|
||
|
using Newtonsoft.Json;
|
||
|
using Newtonsoft.Json.Converters;
|
||
|
|
||
|
namespace MESClassLibrary.DAL.Injection
|
||
|
{
|
||
|
public class WmsDAL
|
||
|
{
|
||
|
public string SaveInterface(DataTable barCodeTable)
|
||
|
{
|
||
|
LocalDBService local = new LocalDBService(SqlHelper.GetConnSting());
|
||
|
try
|
||
|
{
|
||
|
local.BeginTrans();
|
||
|
foreach (DataRow dr in barCodeTable.Rows)
|
||
|
{
|
||
|
string sql = $" insert into tb_Injectionn_Interface(PackageCode,OneBarCode,BarCode,Remark)" +
|
||
|
$" values ('{dr["BoxNo"]}','{dr["OneBarCode"]}','{dr["BarCode"]}','')";
|
||
|
local.Exec_NonQuery(sql);
|
||
|
}
|
||
|
local.Commit();
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
if (local != null)
|
||
|
{
|
||
|
local.Rollback();
|
||
|
}
|
||
|
return ex.Message;
|
||
|
}
|
||
|
finally
|
||
|
{
|
||
|
if (local != null)
|
||
|
{
|
||
|
local.EndTrans();
|
||
|
}
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public bool DeleteRecord(LocalDBService localDB,string boxNo,string oneBarCode,string barCode )
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
string sql = $"delete from tb_Injectionn_Interface where PackageCode='{boxNo}' and OneBarCode='{oneBarCode}' and BarCode='{barCode}'";
|
||
|
localDB.Exec_NonQuery(sql);
|
||
|
return true;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
public bool AddRecord(LocalDBService localDB, string boxNo, string oneBarCode, string barCode)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
string sql = $"insert into tb_Injectionn_Interface(PackageCode,OneBarCode,BarCode,Remark) values ('{boxNo}','{oneBarCode}','{barCode}','')";
|
||
|
localDB.Exec_NonQuery(sql);
|
||
|
return true;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 箱码是否已传递到wms
|
||
|
/// </summary>
|
||
|
/// <param name="pacakgCode"></param>
|
||
|
/// <returns></returns>
|
||
|
public bool IsSendPackageCode(string pacakgCode)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
string sql = $" select * from tb_Injectionn_Interface where PackageCode='{pacakgCode}'";
|
||
|
DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0];
|
||
|
|
||
|
return dt.Rows.Count>0;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|