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.
679 lines
28 KiB
679 lines
28 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using ICSSoft.Frame.Data.Entity;
|
|
using System.Data;
|
|
using ICSSoft.Base.Config.DBHelper;
|
|
using ICSSoft.Base.Config.AppConfig;
|
|
namespace ICSSoft.Frame.Data.DAL
|
|
{
|
|
public class ICSSOPriceSheetDAL
|
|
{
|
|
public static List<FormICSStorageUIModel> SearchStorageInfoList(string dsconn)
|
|
{
|
|
try
|
|
{
|
|
List<FormICSStorageUIModel> returns = new List<FormICSStorageUIModel>();
|
|
string sql = @"select [Serial],[StorageCode],[StorageName]
|
|
from [ICSStorage]";
|
|
sql = string.Format(sql);
|
|
DataTable dt = DBHelper.ExecuteDataset(dsconn, CommandType.Text, sql).Tables[0];
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
FormICSStorageUIModel smodel = new FormICSStorageUIModel();
|
|
smodel.Serial = dr["Serial"].ToString();
|
|
smodel.StorageCode = dr["StorageCode"].ToString();
|
|
smodel.StorageName = dr["StorageName"].ToString();
|
|
|
|
if (!returns.Contains(smodel))
|
|
returns.Add(smodel);
|
|
}
|
|
return returns;
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
public static List<FormICSVendorUIModel> SearchVendorInfoList(string dsconn)
|
|
{
|
|
try
|
|
{
|
|
List<FormICSVendorUIModel> returnv = new List<FormICSVendorUIModel>();
|
|
string sql = @"select [ID],[VendorCode],[VendorName]
|
|
from [ICSVendor]";
|
|
sql = string.Format(sql);
|
|
DataTable dt = DBHelper.ExecuteDataset(dsconn, CommandType.Text, sql).Tables[0];
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
FormICSVendorUIModel vmodel = new FormICSVendorUIModel();
|
|
vmodel.ID = dr["ID"].ToString();
|
|
vmodel.VendorCode = dr["VendorCode"].ToString();
|
|
vmodel.VendorName = dr["VendorName"].ToString();
|
|
|
|
if (!returnv.Contains(vmodel))
|
|
returnv.Add(vmodel);
|
|
}
|
|
return returnv;
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#region 新增和修改
|
|
public static void Add(List<XS001_0001_E001_2020> SoMainList, List<XS001_0001_E002_2020> SoDetailLIist, string dsconn)
|
|
{
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
foreach (XS001_0001_E001_2020 info in SoMainList)
|
|
{
|
|
bool isNew = false;
|
|
var line = db.XS001_0001_E001_2020.SingleOrDefault(a => a.ID == info.ID);
|
|
if (line == null)
|
|
{
|
|
isNew = true;
|
|
line = new XS001_0001_E001_2020();
|
|
line.ID = info.ID;//单据号
|
|
}
|
|
line.cSOCode = info.cSOCode;//销售订单号
|
|
line.cCusName = info.cCusName;//客户名称
|
|
line.cSoType = info.cSoType;//销售类型
|
|
line.iNum = info.iNum;//数量
|
|
line.cinvtype = info.cinvtype;//工艺要求
|
|
line.cInvCode = info.cInvCode;//存货编码
|
|
line.cInvName = info.cInvName;//存货名称
|
|
line.cInvStd = info.cInvStd;//图号
|
|
line.iWeight = info.iWeight;//重量
|
|
line.cMake = info.cMake;//维护人
|
|
line.dMakeTime = info.dMakeTime;//维护时间
|
|
line.dDate = info.dDate;//销售订单日期
|
|
line.iPrice = info.iPrice;//产品单价
|
|
if (isNew)
|
|
{
|
|
db.XS001_0001_E001_2020.InsertOnSubmit(line);
|
|
}
|
|
}
|
|
foreach (XS001_0001_E002_2020 infos in SoDetailLIist)
|
|
{
|
|
bool isNews = false;
|
|
var lines = db.XS001_0001_E002_2020.SingleOrDefault(a => a.RefMainID == infos.RefMainID && a.RefRowID == infos.RefRowID);
|
|
if (lines == null)
|
|
{
|
|
isNews = true;
|
|
lines = new XS001_0001_E002_2020();
|
|
lines.RefMainID = infos.RefMainID;//单据号
|
|
lines.RefRowID = infos.RefRowID;//行号
|
|
}
|
|
lines.cInvCode = infos.cInvCode;//存货编码
|
|
lines.cInvName = infos.cInvName;//存货名称
|
|
lines.cInvStd = infos.cInvStd;//图号
|
|
lines.cItem = infos.cItem;//报价项目
|
|
lines.iPrice = infos.iPrice;//含税单价
|
|
lines.XS001_0001_E001_PK = infos.XS001_0001_E001_PK;//工序
|
|
lines.UAP_VoucherTransform_Rowkey = infos.UAP_VoucherTransform_Rowkey;//备注
|
|
if (isNews)
|
|
{
|
|
db.XS001_0001_E002_2020.InsertOnSubmit(lines);
|
|
}
|
|
}
|
|
db.SubmitChanges();
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 新增明细 MRO领料单
|
|
/// </summary>
|
|
public static string AddAndEditDetail(FormICSPickingModel Picking, string dsconn)
|
|
{
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
bool isNew = false;
|
|
|
|
#region 201907705注释 ZM表头信息变更没有保存
|
|
//var line = db.ICSMaterial.SingleOrDefault(a => a.ID == Picking.ID);
|
|
//if (line == null)
|
|
//{
|
|
// isNew = true;
|
|
// line = new ICSMaterial();
|
|
// line.ID = AppConfig.GetGuid();
|
|
// line.VouchCode = Picking.VouchCode;
|
|
// line.PickingSTATUS = "新建";
|
|
// line.ISALLINSTORAGE = "N";
|
|
// line.CreateTIME = Picking.CreateTIME;
|
|
// line.CreateUSER = Picking.CreateUSER;
|
|
// line.MUSER = AppConfig.UserId;
|
|
// line.MUSERName = AppConfig.UserName;
|
|
// line.MTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
|
|
// line.WorkPoint = AppConfig.WorkPointCode;
|
|
// line.IsMROItem = Picking.IsMROItem;
|
|
// line.AuditMan = Picking.AuditMan;
|
|
// line.AuditTime = Picking.AuditTime;
|
|
// line.MEMO = Picking.MEMO;
|
|
//}
|
|
#endregion
|
|
|
|
var line = db.ICSMaterial.SingleOrDefault(a => a.ID == Picking.ID);
|
|
if (line == null)
|
|
{
|
|
isNew = true;
|
|
line = new ICSMaterial();
|
|
line.ID = AppConfig.GetGuid();
|
|
}
|
|
line.VouchCode = Picking.VouchCode;
|
|
line.PickingSTATUS = "新建";
|
|
line.ISALLINSTORAGE = "N";
|
|
line.CreateTIME = Picking.CreateTIME;
|
|
line.CreateUSER = Picking.CreateUSER;
|
|
line.MUSER = AppConfig.UserId;
|
|
line.MUSERName = AppConfig.UserName;
|
|
line.MTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
|
|
line.WorkPoint = AppConfig.WorkPointCode;
|
|
line.IsMROItem = Picking.IsMROItem;
|
|
line.AuditMan = Picking.AuditMan;
|
|
line.AuditTime = Picking.AuditTime;
|
|
line.MEMO = Picking.MEMO;
|
|
line.IsPickingOrBack = Picking.IsPickingOrBack;
|
|
line.OutCategory = Picking.OutCategory;
|
|
//line.IsMROItem = Picking.IsMROItem;
|
|
//line.IsPickingOrBack = Picking.IsPickingOrBack;
|
|
|
|
if (isNew)
|
|
{
|
|
db.ICSMaterial.InsertOnSubmit(line);
|
|
}
|
|
foreach (FormICSPickingDetailModel ICSMaterialPick in Picking.FormICSPickingDetail)
|
|
{
|
|
//20191111之前的
|
|
//var codes = db.ICSMaterialPick.Where(a => a.SubInvCode == ICSMaterialPick.SubInvCode && a.VouchCode == ICSMaterialPick.VouchCode && a.ID != Convert.ToInt32(ICSMaterialPick.ID));
|
|
//if (codes != null && codes.Count() > 0)
|
|
//{
|
|
// throw new Exception("该物料已存在,不能重复添加");
|
|
//}
|
|
//20191111修改
|
|
var codes = db.ICSMaterialPick.Where(a => a.SubInvCode == ICSMaterialPick.SubInvCode && a.VouchCode == ICSMaterialPick.VouchCode && a.ID != Convert.ToInt32(ICSMaterialPick.ID)&&a.VoucherNO==ICSMaterialPick.VoucherNO);
|
|
if (codes != null && codes.Count() > 0)
|
|
{
|
|
throw new Exception("该物料已存在,不能重复添加");
|
|
}
|
|
|
|
|
|
bool detailIsNew = false;
|
|
var detailLine = db.ICSMaterialPick.SingleOrDefault(a => a.ID == Convert.ToInt32(ICSMaterialPick.ID));
|
|
if (detailLine == null)
|
|
{
|
|
detailIsNew = true;
|
|
detailLine = new ICSMaterialPick();
|
|
}
|
|
detailLine.VoucherNO = ICSMaterialPick.VoucherNO;
|
|
detailLine.VouchRow = ICSMaterialPick.VouchRow;
|
|
detailLine.VouchCode = ICSMaterialPick.VouchCode;
|
|
detailLine.SubInvCode = ICSMaterialPick.SubInvCode;
|
|
detailLine.InvCode = ICSMaterialPick.SubInvCode;
|
|
detailLine.WHCode = ICSMaterialPick.WHCode;
|
|
detailLine.HasQuantity = 0;
|
|
detailLine.SupplyQuantity = ICSMaterialPick.SupplyQuantity;//20190911新增总单重
|
|
if (line.IsPickingOrBack == 3)
|
|
{
|
|
detailLine.MoveType = "退料";//"退料"; 退料单可能关联工单
|
|
detailLine.MOCode = ICSMaterialPick.MOCode;
|
|
detailLine.MORow = ICSMaterialPick.MORow;
|
|
|
|
}
|
|
else
|
|
{
|
|
detailLine.MoveType = "领料";//"领料不关联工单
|
|
//detailLine.MOCode = ICSMaterialPick.MOCode; //20190705ZM拿掉关联工单
|
|
//detailLine.MORow = ICSMaterialPick.MORow; //20190705ZM拿掉
|
|
detailLine.MOCode = "";
|
|
detailLine.MORow = "";
|
|
}
|
|
|
|
//detailLine.MOCode = ICSMaterialPick.MOCode; //20190705ZM拿掉关联工单
|
|
//detailLine.MORow = ICSMaterialPick.MORow; //20190705ZM拿掉
|
|
//detailLine.MOCode = "";
|
|
//detailLine.MORow = "";
|
|
detailLine.Quantity = Convert.ToDecimal(ICSMaterialPick.Quantity);//应退数量
|
|
//detailLine.HasQuantity = Convert.ToInt32(ICSMaterialPick.HasQuantity);//已退数量
|
|
//detailLine.MUSERName = AppConfig.UserName;//入库用户
|
|
detailLine.MUSER = AppConfig.UserCode;
|
|
detailLine.MUSERName = AppConfig.UserName;
|
|
detailLine.MTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
|
|
detailLine.VoucherDate = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
|
|
detailLine.WorkPoint = AppConfig.WorkPointCode;
|
|
detailLine.Remarks = ICSMaterialPick.Remarks;
|
|
detailLine.DDNo = ICSMaterialPick.DDNo;
|
|
//ZM增加部门、出库类型
|
|
detailLine.Dept = ICSMaterialPick.Dept;
|
|
detailLine.OutCategory = ICSMaterialPick.OutCategory;
|
|
detailLine.RDCode = ICSMaterialPick.RDCode;
|
|
|
|
if (detailIsNew)
|
|
{
|
|
db.ICSMaterialPick.InsertOnSubmit(detailLine);
|
|
}
|
|
}
|
|
db.SubmitChanges();
|
|
db.Transaction.Commit();
|
|
return line.ID;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取领料单号
|
|
/// </summary>
|
|
/// <param name="dsconn"></param>
|
|
/// <returns></returns>
|
|
public static string GetOutInNo(string dsconn)
|
|
{
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
DateTime now = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss");
|
|
string date = now.Year.ToString() + (now.Month < 10 ? "0" + now.Month : now.Month.ToString()) + (now.Day < 10 ? "0" + now.Day : now.Day.ToString());
|
|
var ITEMLot = db.XS001_0001_E001_2020.Where(a => a.ID.Contains(date)).OrderByDescending(a => a.ID);
|
|
string count = "001";
|
|
if (ITEMLot != null && ITEMLot.Count() > 0)
|
|
{
|
|
string VouchCode = ITEMLot.First().ID;
|
|
count = (Convert.ToInt64(VouchCode) + 1).ToString().PadLeft(2, '0');
|
|
}
|
|
else
|
|
{
|
|
count = date + "001";
|
|
}
|
|
db.Connection.Close();
|
|
return count;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取领料单行号
|
|
/// </summary>
|
|
/// <param name="dsconn"></param>
|
|
/// <returns></returns>
|
|
public static string GetPickingRowNo(string VouchCode, string dsconn)
|
|
{
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
string count = "1";
|
|
if (!string.IsNullOrWhiteSpace(VouchCode))
|
|
{
|
|
var ITEMLot = db.ICSMaterialPick.Where(a => a.VouchCode.Contains(VouchCode)).OrderByDescending(a => a.VouchRow);
|
|
if (ITEMLot != null && ITEMLot.Count() > 0)
|
|
{
|
|
count = (Convert.ToInt64(ITEMLot.First().VouchRow) + 1).ToString();
|
|
}
|
|
}
|
|
db.Connection.Close();
|
|
return count;
|
|
}
|
|
#endregion
|
|
|
|
#region 入库单代码是否存在
|
|
public static bool IsIncluding(string noCODE, string workpoint, string dsconn)
|
|
{
|
|
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
var line = db.ICSMaterial.SingleOrDefault(a => a.VouchCode == noCODE && a.WorkPoint == workpoint);
|
|
if (line == null)
|
|
return true;
|
|
else
|
|
return false;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 通过入库代码查询
|
|
public static List<FormICSPickingModel> SearchInfoByID(string Rguid, string dsconn)
|
|
{
|
|
List<FormICSPickingModel> INVR = new List<FormICSPickingModel>();
|
|
string sql = @"";
|
|
sql = string.Format(sql, Rguid);
|
|
DataTable dt = DBHelper.ExecuteDataset(dsconn, CommandType.Text, sql).Tables[0];
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
FormICSPickingModel returnInfo = new FormICSPickingModel();
|
|
returnInfo.WHCode = dr["WHCode"].ToString();
|
|
returnInfo.VouchCode = dr["VouchCode"].ToString();
|
|
returnInfo.MTIME = Convert.ToDateTime(dr["MTIME"].ToString());
|
|
returnInfo.MUSERName = dr["MUSER"].ToString();
|
|
//20190705 ZM
|
|
|
|
returnInfo.Dept = dr["Dept"].ToString();
|
|
returnInfo.OutCategory = dr["OutCategory"].ToString();
|
|
returnInfo.MEMO = dr["MEMO"].ToString();
|
|
returnInfo.IsMROItem = bool.Parse(dr["IsMROItem"].ToString());
|
|
returnInfo.RDCode = dr["RDCode"].ToString();
|
|
if (!INVR.Contains(returnInfo))
|
|
{
|
|
INVR.Add(returnInfo);
|
|
}
|
|
}
|
|
//}
|
|
return INVR;
|
|
}
|
|
#endregion
|
|
|
|
#region 删除
|
|
public static void deleteInfo(string code, string dsconn)
|
|
{
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
var lines = db.XS001_0001_E001_2020.Where(a => a.ID == code);
|
|
var _lines = db.XS001_0001_E002_2020.Where(a => a.RefMainID == code);
|
|
db.XS001_0001_E001_2020.DeleteAllOnSubmit(lines);
|
|
db.XS001_0001_E002_2020.DeleteAllOnSubmit(_lines);
|
|
db.SubmitChanges();
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除入库单明细
|
|
/// </summary>
|
|
/// <param name="RIDList"></param>
|
|
/// <param name="dsconn"></param>
|
|
public static void deleteDetailInfo(string code,string row, string dsconn)
|
|
{
|
|
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
var lines = db.XS001_0001_E002_2020.Where(a => a.RefMainID == code &&a.RefRowID == row);
|
|
db.XS001_0001_E002_2020.DeleteAllOnSubmit(lines);
|
|
db.SubmitChanges();
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
public static bool IsIncludingDetail(List<string> RIDList, string dsconn)
|
|
{
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
bool flag = false;
|
|
var lines = db.ICSMaterialPick.Where(a => RIDList.Contains(a.ID.ToString()));
|
|
if (lines.Count() != 0)
|
|
flag = true;
|
|
|
|
return flag;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 子件资料信息
|
|
public static DataTable GetDetail(string MoSql)
|
|
{
|
|
try
|
|
{
|
|
string sql = @"SELECT
|
|
a.ID,
|
|
a.VouchCode,
|
|
A.VouchRow,
|
|
a.MOCODE,
|
|
a.MORow,
|
|
a.SubInvCode,
|
|
a.Quantity,
|
|
a.HasQuantity,
|
|
a.WHCode,
|
|
c.StorageName,
|
|
b.INVNAME,
|
|
b.INVSTD,
|
|
b.INVUOM,
|
|
a.MTIME,
|
|
a.MUSERName as MUSER,
|
|
a.VoucherNO as MoverCode, a.RDCode
|
|
FROM
|
|
ICSMaterialPick a
|
|
LEFT JOIN ICSINVENTORY b ON a.InvCode=b.INVCODE AND a.WorkPoint=b.WorkPoint
|
|
LEFT JOIN ICSStorage c ON a.WHCode=c.StorageCode AND a.WorkPoint = c.WorkPoint
|
|
|
|
where VouchCode IN (SELECT a.VouchCode FROM(" + MoSql + ")a) AND a.WorkPoint ='" + AppConfig.WorkPointCode + @"'
|
|
order by VouchCode,VouchRow ";
|
|
sql = string.Format(sql);
|
|
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
|
|
return dt;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
public static DataTable GetDetailList(string VouchCode, string dsconn)
|
|
{
|
|
try
|
|
{
|
|
string sql = @"SELECT
|
|
'' as isSelect,
|
|
a.cInvCode as InvCode,
|
|
a.cInvName as InvName,
|
|
a.cInvStd as DNumber,--图号
|
|
a.cItem as QuotationItem,--报价项目
|
|
CAST(a.iPrice as NUMERIC(10,2)) as SingleMoney,--含税单价
|
|
a.RefRowID as SORow,
|
|
a.RefMainID as SOCode,
|
|
a.UAP_VoucherTransform_Rowkey AS Memo,--备注
|
|
b.ID,
|
|
b.cSOCode,
|
|
b.cSoType,
|
|
b.cCusName,
|
|
b.cInvStd,
|
|
b.cInvCode as InvCodes,
|
|
CAST(a.XS001_0001_E001_PK as varchar(10)) as OpCode,
|
|
CAST(b.iNum as NUMERIC(10,2)) as iNum,
|
|
b.cSOCode+b.cInvCode+ISNULL(b.cinvtype, '') as IDs,
|
|
CAST(b.iWeight as NUMERIC(10,2)) as iWeight,
|
|
b.dDate,
|
|
CAST(b.iPrice as NUMERIC(10,2)) as iPrice,
|
|
b.cinvtype
|
|
FROM XS001_0001_E002_2020 a
|
|
LEFT JOIN XS001_0001_E001_2020 b ON a.RefMainID=b.ID
|
|
WHERE RefMainID='{0}'";
|
|
sql = string.Format(sql, VouchCode);
|
|
DataTable dt = DBHelper.ExecuteDataset(AppConfig.GetDataBaseConnectStringByKey("[DB.ERP]"), CommandType.Text, sql).Tables[0];
|
|
return dt;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
public static DataTable GetDetailInfo(string code, string row, string dsconn)
|
|
{
|
|
try
|
|
{
|
|
string sql = @"SELECT
|
|
b.ID,
|
|
b.cSOCode,
|
|
b.cCusName,
|
|
b.cInvCode,
|
|
b.cInvName,
|
|
b.cInvStd,
|
|
b.cFree4,
|
|
a.XS001_0001_E001_PK,
|
|
a.XS001_0001_E002_PK,
|
|
b.cSoType,
|
|
b.iNum,
|
|
b.iWeight,
|
|
a.UAP_VoucherTransform_Rowkey,
|
|
a.RefMainID
|
|
FROM XS001_0001_E002_2020 a
|
|
LEFT JOIN XS001_0001_E001_2020 b ON a.RefMainID=b.ID
|
|
WHERE a.RefMainID='{0}' AND a.RefRowID='{1}'";
|
|
sql = string.Format(sql, code,row);
|
|
DataTable dt = DBHelper.ExecuteDataset(AppConfig.GetDataBaseConnectStringByKey("[DB.ERP]"), CommandType.Text, sql).Tables[0];
|
|
return dt;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region MRO领料单审核
|
|
public static void Check(string id, string dsconn)
|
|
{
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
var line = db.ICSMaterial.SingleOrDefault(a => a.ID == id);
|
|
line.PickingSTATUS = "已审核";
|
|
line.AuditMan = AppConfig.UserCode;
|
|
line.AuditTime = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss");
|
|
|
|
db.SubmitChanges();
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 弃审
|
|
public static void DiscardedTrialCheck(string id, string dsconn)
|
|
{
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
var line = db.ICSMaterial.SingleOrDefault(a => a.ID == id);
|
|
line.PickingSTATUS = "新增";
|
|
line.AuditMan = null;
|
|
line.AuditTime = null;
|
|
//line.AuditMan = AppConfig.UserCode;
|
|
//line.AuditTime = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss");
|
|
db.SubmitChanges();
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
//RefuseCheck
|
|
|
|
|
|
#region 拒绝
|
|
public static void RefuseCheck(string id, string dsconn)
|
|
{
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
var line = db.ICSMaterial.SingleOrDefault(a => a.ID == id);
|
|
line.PickingSTATUS = "拒绝";
|
|
line.AuditMan = AppConfig.UserCode;
|
|
line.AuditTime = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss");
|
|
db.SubmitChanges();
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 通过ID查询
|
|
public static DataTable searchInfoByID(string ID, string dsconn)
|
|
{
|
|
|
|
string sql = @"SELECT
|
|
a.ID,
|
|
a.VouchCode,
|
|
a.WHCode,
|
|
a.PickingSTATUS,
|
|
a.VENDORCODE,
|
|
a.PickingTYPE,
|
|
a.MEMO,
|
|
a.CreateTIME,
|
|
a.CreateUSER,
|
|
a.WorkPoint,
|
|
a.MUSER,
|
|
a.MUSERName,
|
|
a.MTIME,
|
|
a.EATTRIBUTE1,
|
|
a.ISALLINSTORAGE,
|
|
a.AuditMan,
|
|
a.AuditTime
|
|
FROM
|
|
ICSMaterial a
|
|
where a.ID='{0}'";
|
|
sql = string.Format(sql, ID);
|
|
DataTable dt = DBHelper.ExecuteDataset(dsconn, CommandType.Text, sql).Tables[0];
|
|
|
|
return dt;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|