|
@ -15,6 +15,7 @@ namespace ICSSoft.DataProject |
|
|
{ |
|
|
{ |
|
|
private static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
|
|
private static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
|
|
private static string connString = System.Configuration.ConfigurationManager.AppSettings["ERPConnStr"]; |
|
|
private static string connString = System.Configuration.ConfigurationManager.AppSettings["ERPConnStr"]; |
|
|
|
|
|
private static string ConnStr = System.Configuration.ConfigurationManager.AppSettings["ConnStr"]; |
|
|
private static string ERPDB = System.Configuration.ConfigurationManager.AppSettings["ERPDB"]; |
|
|
private static string ERPDB = System.Configuration.ConfigurationManager.AppSettings["ERPDB"]; |
|
|
private static string Type = System.Configuration.ConfigurationManager.AppSettings["Type"]; |
|
|
private static string Type = System.Configuration.ConfigurationManager.AppSettings["Type"]; |
|
|
//参数示例
|
|
|
//参数示例
|
|
@ -49,17 +50,24 @@ namespace ICSSoft.DataProject |
|
|
throw new Exception("传送数据为空!"); |
|
|
throw new Exception("传送数据为空!"); |
|
|
} |
|
|
} |
|
|
string res = string.Empty; |
|
|
string res = string.Empty; |
|
|
SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString); |
|
|
|
|
|
conn.Open(); |
|
|
|
|
|
SqlTransaction sqlTran = conn.BeginTransaction(); |
|
|
|
|
|
|
|
|
SqlConnection conn = new SqlConnection(); |
|
|
|
|
|
|
|
|
SqlCommand cmd = new SqlCommand(); |
|
|
SqlCommand cmd = new SqlCommand(); |
|
|
cmd.Transaction = sqlTran; |
|
|
|
|
|
cmd.Connection = conn; |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
string sql = string.Empty; |
|
|
string sql = string.Empty; |
|
|
foreach (ICSPOArrive info in infos) |
|
|
foreach (ICSPOArrive info in infos) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
connString = string.Format(connString, info.WorkPoint); |
|
|
|
|
|
conn = new System.Data.SqlClient.SqlConnection(connString); |
|
|
|
|
|
conn.Open(); |
|
|
|
|
|
SqlTransaction sqlTran = conn.BeginTransaction(); |
|
|
|
|
|
cmd = new SqlCommand(); |
|
|
|
|
|
cmd.Transaction = sqlTran; |
|
|
|
|
|
cmd.Connection = conn; |
|
|
|
|
|
|
|
|
if (info.MTime < new DateTime(2000, 01, 01)) |
|
|
if (info.MTime < new DateTime(2000, 01, 01)) |
|
|
throw new Exception("请输入正确的操作时间:" + info.MTime); |
|
|
throw new Exception("请输入正确的操作时间:" + info.MTime); |
|
|
sql = @" SELECT A.ID,A.cCode,A.cVenCode,D.cVenName,C.CDEPNAME,A.cDepCode,C.cDepName,A.cpocode,A.cMaker,A.cMakeTime,A.cverifier,A.caudittime,
|
|
|
sql = @" SELECT A.ID,A.cCode,A.cVenCode,D.cVenName,C.CDEPNAME,A.cDepCode,C.cDepName,A.cpocode,A.cMaker,A.cMakeTime,A.cverifier,A.caudittime,
|
|
@ -83,9 +91,7 @@ namespace ICSSoft.DataProject |
|
|
sql = string.Format(sql, info.DNCode, info.MTime, info.User); |
|
|
sql = string.Format(sql, info.DNCode, info.MTime, info.User); |
|
|
dt = DBHelper.SQlReturnData(sql, cmd); |
|
|
dt = DBHelper.SQlReturnData(sql, cmd); |
|
|
json = JsonConvert.SerializeObject(dt); |
|
|
json = JsonConvert.SerializeObject(dt); |
|
|
} |
|
|
|
|
|
cmd.Transaction.Commit(); |
|
|
cmd.Transaction.Commit(); |
|
|
return json; |
|
|
|
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
@ -102,6 +108,10 @@ namespace ICSSoft.DataProject |
|
|
conn.Dispose(); |
|
|
conn.Dispose(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return json; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 生成到货单
|
|
|
/// 生成到货单
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
@ -114,7 +124,7 @@ namespace ICSSoft.DataProject |
|
|
throw new Exception("传送数据为空!"); |
|
|
throw new Exception("传送数据为空!"); |
|
|
} |
|
|
} |
|
|
string res = string.Empty; |
|
|
string res = string.Empty; |
|
|
SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString); |
|
|
|
|
|
|
|
|
SqlConnection conn = new System.Data.SqlClient.SqlConnection(ConnStr); |
|
|
conn.Open(); |
|
|
conn.Open(); |
|
|
SqlTransaction sqlTran = conn.BeginTransaction(); |
|
|
SqlTransaction sqlTran = conn.BeginTransaction(); |
|
|
SqlCommand cmd = new SqlCommand(); |
|
|
SqlCommand cmd = new SqlCommand(); |
|
@ -130,12 +140,12 @@ namespace ICSSoft.DataProject |
|
|
string Lotnos = ""; |
|
|
string Lotnos = ""; |
|
|
foreach (var detail in info.details) |
|
|
foreach (var detail in info.details) |
|
|
{ |
|
|
{ |
|
|
sql = @"IF EXISTS(SELECT LOTNO FROM ICSASNDETAIL WHERE LOTNO='{1}' AND STNO='{2}' AND ISNULL(RECEIVEQTY,0)>0)
|
|
|
|
|
|
|
|
|
sql = @"IF EXISTS(SELECT LOTNO FROM ICSASNDETAIL WHERE LOTNO='{1}' AND STNO='{2}' AND ISNULL(RECEIVEQTY,0)>0) and WorkPoint='{3}'
|
|
|
RAISERROR('条码:{1},已到货不能重复到货!',16,1) |
|
|
RAISERROR('条码:{1},已到货不能重复到货!',16,1) |
|
|
UPDATE ICSASNDETAIL SET RECEIVEQTY=ISNULL(RECEIVEQTY,0)+{0} WHERE LOTNO='{1}' AND STNO='{2}' |
|
|
|
|
|
|
|
|
UPDATE ICSASNDETAIL SET RECEIVEQTY=ISNULL(RECEIVEQTY,0)+{0} WHERE LOTNO='{1}' AND STNO='{2}' and WorkPoint='{3}' |
|
|
--IF EXISTS(SELECT LOTNO FROM ICSASNDETAIL WHERE LOTNO='{1}' AND STNO='{2}' AND RECEIVEQTY>PLANQTY) |
|
|
--IF EXISTS(SELECT LOTNO FROM ICSASNDETAIL WHERE LOTNO='{1}' AND STNO='{2}' AND RECEIVEQTY>PLANQTY) |
|
|
-- RAISERROR('条码:{1},到货数量不能大于送货数量!',16,1)";
|
|
|
-- RAISERROR('条码:{1},到货数量不能大于送货数量!',16,1)";
|
|
|
sql = string.Format(sql, detail.Quantity, detail.LOTNO,info.ASNNO); |
|
|
|
|
|
|
|
|
sql = string.Format(sql, detail.Quantity, detail.LOTNO, info.ASNNO, info.WorkPoint); |
|
|
DBHelper.CmdExecuteNonQuery(sql, cmd, "送货单号:" + info.ASNNO + ",条码:" + detail.LOTNO + "未查询到对应数据!"); |
|
|
DBHelper.CmdExecuteNonQuery(sql, cmd, "送货单号:" + info.ASNNO + ",条码:" + detail.LOTNO + "未查询到对应数据!"); |
|
|
Lotnos += "'" + detail.LOTNO + "',"; |
|
|
Lotnos += "'" + detail.LOTNO + "',"; |
|
|
} |
|
|
} |
|
@ -171,49 +181,72 @@ namespace ICSSoft.DataProject |
|
|
public string CreatePUArrive(List<ICSPOArrive> Bills) |
|
|
public string CreatePUArrive(List<ICSPOArrive> Bills) |
|
|
{ |
|
|
{ |
|
|
string res = string.Empty; |
|
|
string res = string.Empty; |
|
|
SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString); |
|
|
|
|
|
conn.Open(); |
|
|
|
|
|
|
|
|
|
|
|
string str = ""; |
|
|
string str = ""; |
|
|
DataTable dt = null; |
|
|
DataTable dt = null; |
|
|
SqlTransaction sqlTran = conn.BeginTransaction(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SqlConnection conn = new SqlConnection(); |
|
|
|
|
|
|
|
|
SqlCommand cmd = new SqlCommand(); |
|
|
SqlCommand cmd = new SqlCommand(); |
|
|
cmd.Transaction = sqlTran; |
|
|
|
|
|
cmd.Connection = conn; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int num = 0; |
|
|
int num = 0; |
|
|
foreach (ICSPOArrive head in Bills) |
|
|
foreach (ICSPOArrive head in Bills) |
|
|
{ |
|
|
{ |
|
|
num = head.details.Count(); |
|
|
num = head.details.Count(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
DateTime time = DateTime.Now; |
|
|
|
|
|
Dictionary<string, int> dic = DBHelper.GetAllCode("" + ERPDB + "", "PuArrival", "" + num + ""); |
|
|
|
|
|
int iFatherId = Convert.ToInt32(dic["iFatherId"].ToString()); |
|
|
|
|
|
int iChildId = Convert.ToInt32( dic["iChildId"].ToString()); |
|
|
|
|
|
DateTime date=DateTime.Now; |
|
|
|
|
|
string iBaseCodeLen = DBHelper.GetAllRDCode("26", "" + time + "","admin"); |
|
|
|
|
|
|
|
|
|
|
|
//int iBaseCodeLen = Convert.ToInt32(dic["iBaseCodeLen"].ToString());
|
|
|
//int iBaseCodeLen = Convert.ToInt32(dic["iBaseCodeLen"].ToString());
|
|
|
//int cVouchCodeBase = Convert.ToInt32(dic["cVouchCodeBase"].ToString());
|
|
|
//int cVouchCodeBase = Convert.ToInt32(dic["cVouchCodeBase"].ToString());
|
|
|
List<ICSPOArrive> datas = new List<ICSPOArrive>(); |
|
|
List<ICSPOArrive> datas = new List<ICSPOArrive>(); |
|
|
string sql = ""; |
|
|
string sql = ""; |
|
|
int irowno = 0; |
|
|
int irowno = 0; |
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (ICSPOArrive head in Bills) |
|
|
foreach (ICSPOArrive head in Bills) |
|
|
{ |
|
|
{ |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
connString = string.Format(connString, head.WorkPoint); |
|
|
|
|
|
conn = new System.Data.SqlClient.SqlConnection(connString); |
|
|
|
|
|
conn.Open(); |
|
|
|
|
|
SqlTransaction sqlTran = conn.BeginTransaction(); |
|
|
|
|
|
cmd = new SqlCommand(); |
|
|
|
|
|
cmd.Transaction = sqlTran; |
|
|
|
|
|
cmd.Connection = conn; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string[] ss = head.WorkPoint.Split('_'); |
|
|
|
|
|
ERPDB = ss[1]; |
|
|
|
|
|
|
|
|
|
|
|
DateTime time = DateTime.Now; |
|
|
|
|
|
Dictionary<string, int> dic = DBHelper.GetAllCode("" + ERPDB + "", "PuArrival", "" + num + ""); |
|
|
|
|
|
int iFatherId = Convert.ToInt32(dic["iFatherId"].ToString()); |
|
|
|
|
|
int iChildId = Convert.ToInt32(dic["iChildId"].ToString()); |
|
|
|
|
|
DateTime date = DateTime.Now; |
|
|
|
|
|
string iBaseCodeLen = DBHelper.GetAllRDCode("26", "" + time + "", "admin"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string DEF_ID = DBHelper.GetDefaultTemplate(Type, cmd); |
|
|
string DEF_ID = DBHelper.GetDefaultTemplate(Type, cmd); |
|
|
#region 主表
|
|
|
#region 主表
|
|
|
sql = @"INSERT INTO PU_ArrivalVouch
|
|
|
|
|
|
|
|
|
sql = @"INSERT INTO dbo.PU_ArrivalVouch
|
|
|
(iVTid, ID, cCode, cPTCode, dDate, cVenCode, cDepCode, cPersonCode, cPayCode, cexch_name, iExchRate, iTaxRate, cMemo, cBusType, cMaker, bNegative, |
|
|
(iVTid, ID, cCode, cPTCode, dDate, cVenCode, cDepCode, cPersonCode, cPayCode, cexch_name, iExchRate, iTaxRate, cMemo, cBusType, cMaker, bNegative, |
|
|
iDiscountTaxType, iBillType, cMakeTime, cAuditDate, caudittime, cverifier, iverifystateex, IsWfControlled, iflowid, iPrintCount, cpocode) |
|
|
iDiscountTaxType, iBillType, cMakeTime, cAuditDate, caudittime, cverifier, iverifystateex, IsWfControlled, iflowid, iPrintCount, cpocode) |
|
|
SELECT @iVTid, @ID, @cCode, cPTCode, CONVERT(NVARCHAR(10), GETDATE(), 23), cVenCode, cDepCode, cPersonCode, cPayCode, cexch_name, nflat, iTaxRate, cMemo, '普通采购', @User, 0, |
|
|
SELECT @iVTid, @ID, @cCode, cPTCode, CONVERT(NVARCHAR(10), GETDATE(), 23), cVenCode, cDepCode, cPersonCode, cPayCode, cexch_name, nflat, iTaxRate, cMemo, '普通采购', @User, 0, |
|
|
iDiscountTaxType, 0, GETDATE(), CONVERT(NVARCHAR(10), GETDATE(), 23), GETDATE(), @User, 2, 0, 0, iPrintCount, cPOID |
|
|
iDiscountTaxType, 0, GETDATE(), CONVERT(NVARCHAR(10), GETDATE(), 23), GETDATE(), @User, 2, 0, 0, iPrintCount, cPOID |
|
|
FROM PO_Pomain WHERE 1=1 AND POID = @POID ";
|
|
|
FROM PO_Pomain WHERE 1=1 AND POID = @POID ";
|
|
|
|
|
|
|
|
|
cmd.Parameters.Clear(); |
|
|
cmd.Parameters.Clear(); |
|
|
cmd.Parameters.Add(new SqlParameter("@iVTid", DEF_ID)); |
|
|
cmd.Parameters.Add(new SqlParameter("@iVTid", DEF_ID)); |
|
|
cmd.Parameters.Add(new SqlParameter("@ID", iFatherId)); |
|
|
cmd.Parameters.Add(new SqlParameter("@ID", iFatherId)); |
|
|
cmd.Parameters.Add(new SqlParameter("@cCode", iBaseCodeLen)); |
|
|
cmd.Parameters.Add(new SqlParameter("@cCode", iBaseCodeLen)); |
|
|
cmd.Parameters.Add(new SqlParameter("@User", head.User)); |
|
|
cmd.Parameters.Add(new SqlParameter("@User", head.User)); |
|
|
cmd.Parameters.Add(new SqlParameter("@POID", head.POCode)); |
|
|
cmd.Parameters.Add(new SqlParameter("@POID", head.POCode)); |
|
|
|
|
|
|
|
|
//cmd.Parameters.Add(new SqlParameter("@dDate", data.dMate));
|
|
|
//cmd.Parameters.Add(new SqlParameter("@dDate", data.dMate));
|
|
|
cmd.CommandText = sql; |
|
|
cmd.CommandText = sql; |
|
|
try |
|
|
try |
|
@ -252,7 +285,7 @@ FROM PO_Pomain WHERE 1=1 AND POID = @POID "; |
|
|
|
|
|
|
|
|
irowno += 1; |
|
|
irowno += 1; |
|
|
sql = @"
|
|
|
sql = @"
|
|
|
INSERT INTO PU_ArrivalVouchs |
|
|
|
|
|
|
|
|
INSERT INTO dbo.PU_ArrivalVouchs |
|
|
(Autoid, ID, cInvCode, iQuantity, iOriCost, iOriTaxCost, iOriMoney, iOriTaxPrice, iOriSum, iCost, iMoney, iTaxPrice, iSum, iTaxRate, |
|
|
(Autoid, ID, cInvCode, iQuantity, iOriCost, iOriTaxCost, iOriMoney, iOriTaxPrice, iOriSum, iCost, iMoney, iTaxPrice, iSum, iTaxRate, |
|
|
iPOsID, fValidInQuan, fRealQuantity, fValidQuantity, fRetQuantity, fInValidInQuan, bGsp, fValidNum, fValidInNum, fRealNum, bTaxCost, |
|
|
iPOsID, fValidInQuan, fRealQuantity, fValidQuantity, fRetQuantity, fInValidInQuan, bGsp, fValidNum, fValidInNum, fRealNum, bTaxCost, |
|
|
SoType, fInvalidInNum, iinvexchrate, cordercode, RejectSource, iExpiratDateCalcu, iordertype, ivouchrowno, bgift, |
|
|
SoType, fInvalidInNum, iinvexchrate, cordercode, RejectSource, iExpiratDateCalcu, iordertype, ivouchrowno, bgift, |
|
@ -268,6 +301,7 @@ pd.ID, 0, @iQuantity, @iQuantity, 0, 0, 0, null, null, null, 1, |
|
|
@Batch, @cDefine37, null, null, null, null, null FROM PO_Podetails pd |
|
|
@Batch, @cDefine37, null, null, null, null, null FROM PO_Podetails pd |
|
|
left join po_pomain b on pd.poid=b.poid |
|
|
left join po_pomain b on pd.poid=b.poid |
|
|
WHERE pd.ID = @iPOsID ";
|
|
|
WHERE pd.ID = @iPOsID ";
|
|
|
|
|
|
|
|
|
cmd.Parameters.Clear(); |
|
|
cmd.Parameters.Clear(); |
|
|
cmd.Parameters.Add(new SqlParameter("@iPOsID", body.PODetailID)); |
|
|
cmd.Parameters.Add(new SqlParameter("@iPOsID", body.PODetailID)); |
|
|
cmd.Parameters.Add(new SqlParameter("@Autoid", iChildId)); |
|
|
cmd.Parameters.Add(new SqlParameter("@Autoid", iChildId)); |
|
@ -277,6 +311,7 @@ WHERE pd.ID = @iPOsID "; |
|
|
cmd.Parameters.Add(new SqlParameter("@cordercode", head.POCode)); |
|
|
cmd.Parameters.Add(new SqlParameter("@cordercode", head.POCode)); |
|
|
cmd.Parameters.Add(new SqlParameter("@ivouchrowno", irowno)); |
|
|
cmd.Parameters.Add(new SqlParameter("@ivouchrowno", irowno)); |
|
|
cmd.Parameters.Add(new SqlParameter("@dPDate", head.MTime)); |
|
|
cmd.Parameters.Add(new SqlParameter("@dPDate", head.MTime)); |
|
|
|
|
|
|
|
|
if (cMassUnit == 1) |
|
|
if (cMassUnit == 1) |
|
|
{ |
|
|
{ |
|
|
cmd.Parameters.Add(new SqlParameter("@dVDate", head.MTime.AddYears(iMassDate).Date)); |
|
|
cmd.Parameters.Add(new SqlParameter("@dVDate", head.MTime.AddYears(iMassDate).Date)); |
|
@ -332,11 +367,8 @@ LEFT JOIN dbo.Department C ON A.cDepCode = C.cDepCode LEFT JOIN dbo.Vendor D ON |
|
|
LEFT JOIN dbo.PO_Podetails E ON B.iPOsID = E.ID WHERE A.cverifier IS NOT NULL AND A.ID = '{0}' ";
|
|
|
LEFT JOIN dbo.PO_Podetails E ON B.iPOsID = E.ID WHERE A.cverifier IS NOT NULL AND A.ID = '{0}' ";
|
|
|
sql = string.Format(sql, iFatherId); |
|
|
sql = string.Format(sql, iFatherId); |
|
|
dt = DBHelper.SQlReturnData(sql, cmd); |
|
|
dt = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
str = JsonConvert.SerializeObject(dt); |
|
|
|
|
|
|
|
|
str += JsonConvert.SerializeObject(dt); |
|
|
cmd.Transaction.Commit(); |
|
|
cmd.Transaction.Commit(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
@ -344,6 +376,10 @@ LEFT JOIN dbo.PO_Podetails E ON B.iPOsID = E.ID WHERE A.cverifier IS NOT NULL AN |
|
|
log.Error(ex.Message); |
|
|
log.Error(ex.Message); |
|
|
throw new Exception(ex.Message); |
|
|
throw new Exception(ex.Message); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return str; |
|
|
return str; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -357,26 +393,30 @@ LEFT JOIN dbo.PO_Podetails E ON B.iPOsID = E.ID WHERE A.cverifier IS NOT NULL AN |
|
|
throw new Exception("传送数据为空!"); |
|
|
throw new Exception("传送数据为空!"); |
|
|
} |
|
|
} |
|
|
string res = string.Empty; |
|
|
string res = string.Empty; |
|
|
SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString); |
|
|
|
|
|
conn.Open(); |
|
|
|
|
|
SqlTransaction sqlTran = conn.BeginTransaction(); |
|
|
|
|
|
|
|
|
SqlConnection conn = new SqlConnection(); |
|
|
|
|
|
|
|
|
SqlCommand cmd = new SqlCommand(); |
|
|
SqlCommand cmd = new SqlCommand(); |
|
|
cmd.Transaction = sqlTran; |
|
|
|
|
|
cmd.Connection = conn; |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string sql = string.Empty; |
|
|
string sql = string.Empty; |
|
|
foreach (ICSPOArrive info in infos) |
|
|
foreach (ICSPOArrive info in infos) |
|
|
{ |
|
|
{ |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
connString = string.Format(connString, info.WorkPoint); |
|
|
|
|
|
conn = new System.Data.SqlClient.SqlConnection(connString); |
|
|
|
|
|
conn.Open(); |
|
|
|
|
|
SqlTransaction sqlTran = conn.BeginTransaction(); |
|
|
|
|
|
cmd = new SqlCommand(); |
|
|
|
|
|
cmd.Transaction = sqlTran; |
|
|
|
|
|
cmd.Connection = conn; |
|
|
if (info.MTime < new DateTime(2000, 01, 01)) |
|
|
if (info.MTime < new DateTime(2000, 01, 01)) |
|
|
throw new Exception("请输入正确的操作时间:" + info.MTime); |
|
|
throw new Exception("请输入正确的操作时间:" + info.MTime); |
|
|
sql = @"UPDATE dbo.PU_ArrivalVouch SET cVerifier ='" + info.User + @"' ,
|
|
|
sql = @"UPDATE dbo.PU_ArrivalVouch SET cVerifier ='" + info.User + @"' ,
|
|
|
cAuditTime=CONVERT(VARCHAR(50),GETDATE(),112),cAuditDate=GETDATE() WHERE ID='{0}'";
|
|
|
cAuditTime=CONVERT(VARCHAR(50),GETDATE(),112),cAuditDate=GETDATE() WHERE ID='{0}'";
|
|
|
sql = string.Format(sql, info.ID); |
|
|
sql = string.Format(sql, info.ID); |
|
|
DBHelper.CmdExecuteNonQuery(sql, cmd, "未查询到对应数据!"); |
|
|
DBHelper.CmdExecuteNonQuery(sql, cmd, "未查询到对应数据!"); |
|
|
} |
|
|
|
|
|
cmd.Transaction.Commit(); |
|
|
cmd.Transaction.Commit(); |
|
|
return json; |
|
|
|
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
@ -393,6 +433,10 @@ LEFT JOIN dbo.PO_Podetails E ON B.iPOsID = E.ID WHERE A.cverifier IS NOT NULL AN |
|
|
conn.Dispose(); |
|
|
conn.Dispose(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return json; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 删除请购单
|
|
|
/// 删除请购单
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
@ -406,26 +450,28 @@ LEFT JOIN dbo.PO_Podetails E ON B.iPOsID = E.ID WHERE A.cverifier IS NOT NULL AN |
|
|
throw new Exception("传送数据为空!"); |
|
|
throw new Exception("传送数据为空!"); |
|
|
} |
|
|
} |
|
|
string res = string.Empty; |
|
|
string res = string.Empty; |
|
|
SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString); |
|
|
|
|
|
conn.Open(); |
|
|
|
|
|
SqlTransaction sqlTran = conn.BeginTransaction(); |
|
|
|
|
|
|
|
|
SqlConnection conn = new SqlConnection(); |
|
|
|
|
|
|
|
|
SqlCommand cmd = new SqlCommand(); |
|
|
SqlCommand cmd = new SqlCommand(); |
|
|
cmd.Transaction = sqlTran; |
|
|
|
|
|
cmd.Connection = conn; |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
string sql = string.Empty; |
|
|
string sql = string.Empty; |
|
|
foreach (ICSPOArrive info in infos) |
|
|
foreach (ICSPOArrive info in infos) |
|
|
{ |
|
|
{ |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
connString = string.Format(connString, info.WorkPoint); |
|
|
|
|
|
conn = new System.Data.SqlClient.SqlConnection(connString); |
|
|
|
|
|
conn.Open(); |
|
|
|
|
|
SqlTransaction sqlTran = conn.BeginTransaction(); |
|
|
|
|
|
cmd = new SqlCommand(); |
|
|
|
|
|
cmd.Transaction = sqlTran; |
|
|
|
|
|
cmd.Connection = conn; |
|
|
if (info.MTime < new DateTime(2000, 01, 01)) |
|
|
if (info.MTime < new DateTime(2000, 01, 01)) |
|
|
throw new Exception("请输入正确的操作时间:" + info.MTime); |
|
|
throw new Exception("请输入正确的操作时间:" + info.MTime); |
|
|
sql = @" DELETE dbo.PU_ArrivalVouch WHERE ID='{0}'"; |
|
|
sql = @" DELETE dbo.PU_ArrivalVouch WHERE ID='{0}'"; |
|
|
sql = string.Format(sql, info.ID); |
|
|
sql = string.Format(sql, info.ID); |
|
|
DBHelper.CmdExecuteNonQuery(sql, cmd, "未查询到对应数据!"); |
|
|
DBHelper.CmdExecuteNonQuery(sql, cmd, "未查询到对应数据!"); |
|
|
} |
|
|
|
|
|
cmd.Transaction.Commit(); |
|
|
cmd.Transaction.Commit(); |
|
|
return res; |
|
|
|
|
|
; |
|
|
|
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
@ -443,5 +489,10 @@ LEFT JOIN dbo.PO_Podetails E ON B.iPOsID = E.ID WHERE A.cverifier IS NOT NULL AN |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return res; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |