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.
515 lines
29 KiB
515 lines
29 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Runtime.Serialization;
|
|
using System.Data;
|
|
using ICS.WCF.Base;
|
|
using ICSSoft.Entity;
|
|
using System.Data.SqlClient;
|
|
|
|
namespace ICS.MaterialReturnGet
|
|
{
|
|
/*
|
|
* 点料退料产生新条码
|
|
*/
|
|
public class GetMaterialReturn
|
|
{
|
|
|
|
public FormICSCreatedArrivalNoticeModel CustGetMaterialReturn(OutSourePick o)
|
|
{
|
|
|
|
FormICSCreatedArrivalNoticeModel result = new FormICSCreatedArrivalNoticeModel();
|
|
using (SqlConnection conn = new SqlConnection(Appconfig.GetMESStr()))
|
|
{
|
|
conn.Open();
|
|
using (SqlTransaction trans = conn.BeginTransaction())
|
|
{
|
|
try
|
|
{
|
|
string sql = "";
|
|
int dtNo = 0;
|
|
string VouchRow;
|
|
SqlCommand cmd = new SqlCommand();
|
|
cmd.Connection = conn;
|
|
cmd.Transaction = trans;
|
|
|
|
StringBuilder strHead = new StringBuilder();
|
|
strHead.AppendLine("***************接口传入参数记录****************:");
|
|
strHead.AppendLine("传入条码:" + o.LotNo);
|
|
strHead.AppendLine("传入维护人:" + o.MUSER);
|
|
strHead.AppendLine("传入维护人名称:" + o.MUSERName);
|
|
strHead.AppendLine("传入站点:" + o.WorkPoint);
|
|
strHead.AppendLine("传入批次:" + o.VendorLot);
|
|
strHead.AppendLine("传入条码数量:" + o.LOTQTY);
|
|
foreach (PickInfoList item in o.PickInfoList)
|
|
{
|
|
strHead.AppendLine("传入存货编码:" + item.SubInvCode);
|
|
strHead.AppendLine("传入工单号:" + item.MOCode);
|
|
strHead.AppendLine("传入领料单号:" + item.VouchCode);
|
|
strHead.AppendLine("传入领料单行号:" + item.VouchRow);
|
|
strHead.AppendLine("传入供应商编码:" + item.DeleteStatus);
|
|
strHead.AppendLine("传入物料编码:" + item.InvCode);
|
|
strHead.AppendLine("传入数量:" + item.Quantity);
|
|
strHead.AppendLine("传入库房编码:" + item.WHCode);
|
|
strHead.AppendLine("传入库位:" + item.BinCode);
|
|
}
|
|
strHead.AppendLine("***************接口传入参数记录****************:");
|
|
Appconfig.WriteLogFile(strHead.ToString(), "点料退料产生新条码接口日志");
|
|
StringBuilder resultlog = new StringBuilder();
|
|
|
|
|
|
foreach (PickInfoList item in o.PickInfoList)
|
|
{
|
|
#region 判断输入合法
|
|
string BinCode = fenge(item.BinCode);
|
|
string WHID;
|
|
string checkSQL = @"select * from ICSMOBOM where MOCODE='{0}' AND WorkPoint='{1}'";
|
|
sql = string.Format(checkSQL, item.MOCode, o.WorkPoint);
|
|
DataTable chkdt = SQlReturnData(sql, cmd);
|
|
if (chkdt.Rows.Count <= 0)
|
|
{
|
|
throw new Exception("传入工单号:" + item.MOCode + "不存在,无法创建条码!");
|
|
}
|
|
|
|
checkSQL = @"select * from ICSINVENTORY where INVCODE='{0}' AND WorkPoint='{1}'";
|
|
sql = string.Format(checkSQL, item.InvCode, o.WorkPoint);
|
|
chkdt = SQlReturnData(sql, cmd);
|
|
if (chkdt.Rows.Count <= 0)
|
|
{
|
|
throw new Exception("传入料号:" + item.InvCode + "不存在,无法创建条码!");
|
|
}
|
|
|
|
checkSQL = @"select * from ICSMaterialPick where VouchCode='{0}' and VouchRow='{1}' AND WorkPoint='{1}'";
|
|
sql = string.Format(checkSQL, item.VouchCode, item.VouchRow, o.WorkPoint);
|
|
chkdt = SQlReturnData(sql, cmd);
|
|
if (chkdt.Rows.Count <= 0)
|
|
{
|
|
throw new Exception("传入领料单号:" + item.VouchCode + "和行号:" + item.VouchRow + "不存在!");
|
|
}
|
|
|
|
checkSQL = @"select Serial from ICSStorage
|
|
WHERE StorageCode='{0}' and WorkPoint='{1}'";
|
|
checkSQL = string.Format(checkSQL, item.WHCode, o.WorkPoint);
|
|
chkdt = SQlReturnData(checkSQL, cmd);
|
|
if (chkdt.Rows.Count == 0)
|
|
{
|
|
throw new Exception("传入仓库:" + item.WHCode + "不存在,无法创建条码!");
|
|
}
|
|
else
|
|
{
|
|
WHID = chkdt.Rows[0]["Serial"].ToString();
|
|
}
|
|
checkSQL = @"select Serial from ICSStack
|
|
WHERE StackCode = '{0}' and Storage_Serial='{1}' and WorkPoint='{2}'";
|
|
checkSQL = string.Format(checkSQL, BinCode, WHID, o.WorkPoint);
|
|
chkdt = SQlReturnData(checkSQL, cmd);
|
|
if (chkdt.Rows.Count == 0)
|
|
{
|
|
throw new Exception("传入库位:" + BinCode + "不属于传入仓库:" + item.WHCode + ",无法创建条码!");
|
|
}
|
|
#endregion
|
|
|
|
#region 生成退料单号
|
|
DateTime now = DateTime.Now.Date;
|
|
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.ICSOutSourePick.Where(a => a.VouchCode.Contains(date)).OrderByDescending(a => a.VouchCode);
|
|
sql = @"select TOP 1 VouchCode
|
|
from ICSMaterial
|
|
where VouchCode like'%{0}%' AND WorkPoint='{1}'
|
|
order by VouchCode desc";
|
|
sql = string.Format(sql, date, o.WorkPoint);
|
|
DataTable dtRow = SQlReturnData(sql, cmd);
|
|
string count = "001";
|
|
if (dtRow.Rows.Count > 0)
|
|
{
|
|
string VouchCode = dtRow.Rows[0]["VouchCode"].ToString();
|
|
count = "R" + date + (Convert.ToInt64(VouchCode.Remove(0, 9)) + 1).ToString().PadLeft(3, '0');
|
|
}
|
|
else
|
|
{
|
|
count = "R" + date + "001";
|
|
}
|
|
#endregion
|
|
|
|
#region 生成退料单行号
|
|
sql = @"select TOP 1 VouchRow
|
|
from ICSMaterialPick
|
|
where VouchCode='{0}' AND WorkPoint='{1}'
|
|
order by VouchRow desc";
|
|
sql = string.Format(sql, item.VouchCode, o.WorkPoint);
|
|
dtRow = SQlReturnData(sql, cmd);
|
|
if (dtRow.Rows.Count <= 0)
|
|
{
|
|
VouchRow = "0001";
|
|
}
|
|
else
|
|
{
|
|
VouchRow = (Convert.ToInt64(dtRow.Rows[0]["VouchRow"]) + 1).ToString().PadLeft(4, '0');
|
|
}
|
|
#endregion
|
|
string MOCode;
|
|
//获取工单号
|
|
checkSQL = @"select MOCode from ICSMaterialPick where VouchCode='{0}' AND VouchRow='{1}' AND WorkPoint='{2}'";
|
|
sql = string.Format(checkSQL, item.VouchCode, item.VouchRow, o.WorkPoint);
|
|
chkdt = SQlReturnData(sql, cmd);
|
|
if (chkdt.Rows.Count <= 0)
|
|
{
|
|
throw new Exception("传入领料单号:" + item.VouchCode + "和行号:" + item.VouchRow + "不存在!");
|
|
}
|
|
else
|
|
{
|
|
MOCode = dtRow.Rows[0]["MOCode"].ToString();
|
|
}
|
|
|
|
#region 生成退料单
|
|
#region 判断已退数量不能大于已领数量
|
|
string sql1 = @"SELECT SubInvCode,SUM(Quantity) as HasQuantity
|
|
FROM ICSMaterialPick
|
|
WHERE SubInvCode='{0}' AND WorkPoint='{1}' AND MoveType='领料'
|
|
GROUP BY SubInvCode";
|
|
sql1 = string.Format(sql1, item.SubInvCode, o.WorkPoint);
|
|
DataTable dt1 = SQlReturnData(sql1, cmd);
|
|
|
|
string sql2 = @"SELECT SubInvCode,SUM(Quantity) as Quantity
|
|
FROM ICSMaterialPick
|
|
WHERE SubInvCode='{0}' AND WorkPoint='{1}' AND MoveType='退料'
|
|
GROUP BY SubInvCode";
|
|
sql2 = string.Format(sql2, item.SubInvCode, o.WorkPoint);
|
|
DataTable dt2 = SQlReturnData(sql2, cmd);
|
|
//DataTable dt2 = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql1).Tables[1];
|
|
if (dt1.Rows.Count > 0 && dt2.Rows.Count > 0 && dt1.Rows[0]["HasQuantity"].ToString() != "" && dt2.Rows.Count > 0 && dt2.Rows[0]["Quantity"].ToString() != "")
|
|
{
|
|
if (Convert.ToDecimal(dt2.Rows[0]["Quantity"].ToString()) + Convert.ToDecimal(item.Quantity) > Convert.ToDecimal(dt1.Rows[0]["HasQuantity"].ToString()))
|
|
{
|
|
throw new Exception("退料单已退料总数量不能大于该物料已领数量");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 判断退料数量不能超过领料单行数量
|
|
string sql4 = @"SELECT Reservation,ReservationRow,SUM(HasQuantity) as HasQuantity
|
|
FROM ICSMaterialPick
|
|
WHERE Reservation='{0}' and ReservationRow='{1}' AND WorkPoint='{2}' AND MoveType='退料'
|
|
GROUP BY Reservation,ReservationRow";
|
|
sql4 = string.Format(sql4, item.VouchCode, item.VouchRow, o.WorkPoint);
|
|
DataTable dt4 = SQlReturnData(sql4, cmd);
|
|
|
|
string sql5 = @"SELECT Quantity
|
|
FROM ICSMaterialPick
|
|
WHERE VouchCode='{0}' and VouchRow='{1}' AND WorkPoint='{2}' AND MoveType='领料'
|
|
";
|
|
sql5 = string.Format(sql5, item.VouchCode, item.VouchRow, o.WorkPoint);
|
|
|
|
DataTable dt5 = SQlReturnData(sql5, cmd);
|
|
if (dt4.Rows.Count > 0 && dt5.Rows.Count > 0 && dt4.Rows[0]["HasQuantity"].ToString() != "" && dt5.Rows[0]["Quantity"].ToString() != "")
|
|
{
|
|
if (Convert.ToDecimal(dt4.Rows[0]["HasQuantity"].ToString()) + Convert.ToDecimal(item.Quantity) > Convert.ToDecimal(dt5.Rows[0]["Quantity"].ToString()))
|
|
{
|
|
throw new Exception("该物料的退料数量不能超过对应领料单行数量!");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
//更新ICSMaterial表
|
|
sql = string.Format(@"insert into ICSMaterial (ID,VouchCode,PickingSTATUS,ISALLINSTORAGE,CreateTIME,CreateUSER,MUSER,MUSERName,MTIME,WorkPoint,WHCode)
|
|
values (NEWID(),'{0}','新建','N',GETDATE(),'{1}','{2}','{3}',GETDATE(),'{4}','{5}')", count, o.MUSER, o.MUSERName, o.MUSER, o.MUSERName, o.WorkPoint, item.WHCode);
|
|
cmd.CommandText = sql;
|
|
dtNo = cmd.ExecuteNonQuery();
|
|
if (dtNo <= 0)
|
|
{
|
|
throw new Exception("生成退料申请单表头失败,请查看日志");
|
|
}
|
|
|
|
//更新ICSMaterialPick表
|
|
sql = string.Format(@"insert into ICSMaterialPick(ID,VouchCode,VouchRow,SubInvCode,InvCode,WHCode,HasQuantity,MoveType,MOCode,Quantity,Reservation,ReservationRow,DeleteStatus,cBatch,ORDERNO,EATTRIBUTE,MUSER,MUSERName,MTIME,VoucherDate,WorkPoint)
|
|
values( NEWID(),'{0}', '{1}', '{2}', '{3}' ,'{4}',0,'点料退料','{5}','{6}','{7}','{8}','{9}','{10}','','{11}','{12}','{13}',GETDATE(),GETDATE(),'{13}')"
|
|
, count, VouchRow, item.SubInvCode, item.SubInvCode, item.WHCode, MOCode, item.Quantity, item.VouchCode, item.VouchRow, item.DeleteStatus, item.DeleteStatus, MOCode, o.MUSER, o.MUSERName, o.WorkPoint);
|
|
cmd.CommandText = sql;
|
|
dtNo = cmd.ExecuteNonQuery();
|
|
if (dtNo <= 0)
|
|
{
|
|
throw new Exception("生成退料申请单失败,请查看日志");
|
|
}
|
|
#endregion
|
|
|
|
string SqlLotNO = @"select * from ICSItemLot where LotNO = '{0}' ";
|
|
sql = string.Format(SqlLotNO, o.LotNo);
|
|
DataTable dt = SQlReturnData(sql, cmd);
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
throw new Exception("条码已存在,不可重复退料");
|
|
}
|
|
//生成点料退料条码
|
|
sql = string.Format(@"INSERT INTO dbo.ICSITEMLot
|
|
( ID ,LotNO ,ItemCODE ,TransNO ,TransLine ,VENDORITEMCODE ,VENDORCODE ,
|
|
VenderLotNO ,PRODUCTDATE ,LOTQTY ,ACTIVE ,Exdate ,WorkPoint ,
|
|
MUSER ,MUSERName ,MTIME ,TYPE,ORDERNO)
|
|
values( NEWID(),'{0}','{1}','{2}','{3}','','',
|
|
'{4}',GETDATE(),'{5}','Y','2999-12-31 00:00:00.000','{6}',
|
|
'{7}','{8}',GETDATE(),'点料退料','')",
|
|
o.LotNo, item.InvCode, count, VouchRow, o.VendorLot, o.LOTQTY, o.WorkPoint, o.MUSER, o.MUSERName);
|
|
cmd.CommandText = sql;
|
|
dtNo = cmd.ExecuteNonQuery();
|
|
if (dtNo <= 0)
|
|
{
|
|
throw new Exception("点料退料产生新条码失败,请查看日志");
|
|
}
|
|
}
|
|
foreach (PickInfoList item in o.PickInfoList)
|
|
{
|
|
string BinCode = fenge(item.BinCode);
|
|
string NewBinCode = BinCode;
|
|
string INVCode = "";
|
|
string WHCode = "";
|
|
string TranNo = "";
|
|
string TranLine = "";
|
|
string ORDERNO = "";
|
|
#region 获取仓库库位等信息
|
|
sql = @"select ItemCODE
|
|
,TransNO
|
|
,TransLine
|
|
,ORDERNO
|
|
from ICSITEMLot
|
|
where LotNO='{0}' AND WorkPoint='{1}'";
|
|
sql = string.Format(sql, o.LotNo, o.WorkPoint);
|
|
DataTable dt = SQlReturnData(sql, cmd);
|
|
if (dt.Rows.Count == 0)
|
|
{
|
|
throw new Exception("获取条码信息失败!");
|
|
}
|
|
else
|
|
{
|
|
INVCode = dt.Rows[0]["ItemCODE"].ToString();
|
|
TranNo = dt.Rows[0]["TransNO"].ToString();
|
|
TranLine = dt.Rows[0]["TransLine"].ToString();
|
|
ORDERNO = dt.Rows[0]["ORDERNO"].ToString();
|
|
}
|
|
sql = @"select B.StorageCode
|
|
from ICSStack A
|
|
LEFT JOIN ICSStorage B
|
|
ON B.Serial=A.Storage_Serial
|
|
where StackCode='{0}'";
|
|
sql = string.Format(sql, NewBinCode);
|
|
dt = SQlReturnData(sql, cmd);
|
|
if (dt.Rows.Count == 0)
|
|
{
|
|
throw new Exception("获取仓库信息失败!");
|
|
}
|
|
else
|
|
{
|
|
WHCode = dt.Rows[0]["StorageCode"].ToString();
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region 更新ICSWareHouseInfo表
|
|
sql = @"update ICSWareHouseInfo
|
|
set QTY=QTY+{0},MTIME='{1}'
|
|
where INVCode='{2}' AND WHCode='{3}' AND BinCode='{4}' AND WorkPoint='{5}'";
|
|
sql = string.Format(sql, o.LOTQTY, DateTime.Now, INVCode, WHCode, NewBinCode, o.WorkPoint);
|
|
cmd.CommandText = sql;
|
|
dtNo = cmd.ExecuteNonQuery();
|
|
if (dtNo <= 0)
|
|
{
|
|
sql = @"insert into ICSWareHouseInfo
|
|
values
|
|
((select Serial from ICSStorage where StorageCode='{0}' and WorkPoint='{4}')
|
|
,'{0}'
|
|
,(SELECT Serial FROM ICSStack WHERE StackCode='{1}' and WorkPoint='{4}')
|
|
,'{1}'
|
|
,(SELECT ID FROM ICSINVENTORY WHERE INVCODE='{2}' and WorkPoint='{4}')
|
|
,'{2}',{3},'{4}','{5}','{6}',GETDATE(),NULL)";
|
|
sql = string.Format(sql, WHCode, NewBinCode, INVCode, o.LOTQTY, o.WorkPoint, o.MUSER, o.MUSERName);
|
|
cmd.CommandText = sql;
|
|
dtNo = cmd.ExecuteNonQuery();
|
|
if (dtNo <= 0)
|
|
{
|
|
throw new Exception("库存主表存入失败!");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 更新ICSWareHouseLotInfo表
|
|
sql = @"insert into ICSWareHouseLotInfo
|
|
Values
|
|
(NEWID(),'{0}',
|
|
(select Serial from ICSStorage where StorageCode='{1}' and WorkPoint='{5}'),
|
|
'{1}',
|
|
(SELECT Serial FROM ICSStack WHERE StackCode='{2}' and WorkPoint='{5}'),
|
|
'{2}',
|
|
(SELECT ID FROM ICSINVENTORY WHERE INVCODE='{3}' and WorkPoint='{5}'),
|
|
'{3}',{4},GETDATE(),'{5}','{6}','{7}',GETDATE(),'点料退料',0,0,'{8}')";
|
|
sql = string.Format(sql, o.LotNo, WHCode, NewBinCode, INVCode, o.LOTQTY, o.WorkPoint, o.MUSER, o.MUSERName, ORDERNO);
|
|
cmd.CommandText = sql;
|
|
dtNo = cmd.ExecuteNonQuery();
|
|
if (dtNo <= 0)
|
|
{
|
|
throw new Exception("库存子表数量增加失败!");
|
|
}
|
|
#endregion
|
|
|
|
#region 存入ICSWareHouseLotInfoLog表(日志)
|
|
sql = @"insert into ICSWareHouseLotInfoLog
|
|
Values
|
|
(NEWID(),'{0}','{1}','{2}','{3}','','','{8}','{9}'
|
|
,{4},null,'收','点料退料','{5}','{6}',GETDATE(),'{7}','','','','','未回写','','')";
|
|
sql = string.Format(sql, TranNo, TranLine, INVCode, o.LotNo, o.LOTQTY, o.MUSER, o.MUSERName, o.WorkPoint, WHCode, NewBinCode);
|
|
cmd.CommandText = sql;
|
|
dtNo = cmd.ExecuteNonQuery();
|
|
if (dtNo <= 0)
|
|
{
|
|
throw new Exception("日志表存入失败!");
|
|
}
|
|
#endregion
|
|
}
|
|
//生成U9退料单
|
|
#region 接口调用
|
|
try
|
|
{
|
|
List<ServiceCreateRIssue.IssueData> contextList = new List<ServiceCreateRIssue.IssueData>();
|
|
List<ServiceCreateRIssue.IssueLineData> contextLists = new List<ServiceCreateRIssue.IssueLineData>();
|
|
ServiceCreateRIssue.IssueData context = new ServiceCreateRIssue.IssueData();
|
|
ServiceCreateRIssue.IssueLineData contexts = new ServiceCreateRIssue.IssueLineData();
|
|
string StackCode = "";
|
|
string LLCode = "";
|
|
foreach (PickInfoList item in o.PickInfoList)
|
|
{
|
|
//context.linelist = contextLists.ToArray();
|
|
//contextList.Add(context);
|
|
context = new ServiceCreateRIssue.IssueData();
|
|
StackCode = item.WHCode;
|
|
LLCode = item.VouchCode;
|
|
context.LLCode = item.VouchCode;//领料单号
|
|
context.DocTypeCode = "2";//类型
|
|
context.OrgCode = o.WorkPoint;
|
|
contextLists = new List<ServiceCreateRIssue.IssueLineData>();
|
|
contexts = new ServiceCreateRIssue.IssueLineData();
|
|
contexts.LLLineNO = item.VouchRow;//领料单行号
|
|
contexts.ItemCode = item.InvCode;//料号
|
|
contexts.ItemQty = item.Quantity;//数量
|
|
contexts.WHCode = item.WHCode;//仓库
|
|
contexts.LotNO = o.VendorLot;//批号
|
|
contextLists.Add(contexts);
|
|
//if (i == dt.Rows.Count - 1)
|
|
//{
|
|
context.linelist = contextLists.ToArray();
|
|
contextList.Add(context);
|
|
//}
|
|
}
|
|
sql = @"UPDATE ICSWareHouseLotInfoLog SET EATTRIBUTE5='已回写'
|
|
where LotNO ='{0}' AND BusinessCode='点料退料'";
|
|
sql = string.Format(sql, o.LotNo);
|
|
cmd.CommandText = sql;
|
|
dtNo = cmd.ExecuteNonQuery();
|
|
if (dtNo <= 0)
|
|
{
|
|
throw new Exception("日志表更新失败!");
|
|
}
|
|
ServiceCreateRIssue.CreateRIssueClient client = new ServiceCreateRIssue.CreateRIssueClient();
|
|
ServiceCreateRIssue.CustCreateIssueOperationResult cresult = new ServiceCreateRIssue.CustCreateIssueOperationResult();
|
|
cresult = client.CreateIss(contextList.ToArray());
|
|
if (cresult.IsSuccess == false)
|
|
{
|
|
throw new Exception(cresult.MESSAGE);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception(ex.Message);
|
|
}
|
|
#endregion
|
|
result.Code = 0;
|
|
result.ResMsg = "点料退料产生新条码成功";
|
|
result.ResData = "{}";
|
|
result.IsCompress = false;
|
|
result.IsSuccess = true;
|
|
return result;
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = -1;
|
|
result.ResMsg = ex.Message;
|
|
result.ResData = null;
|
|
result.IsCompress = false;
|
|
result.IsSuccess = false;
|
|
StringBuilder str = new StringBuilder();
|
|
str.AppendLine("传入条码:" + o.LotNo);
|
|
str.AppendLine("传入维护人:" + o.MUSER);
|
|
str.AppendLine("传入维护人名称:" + o.MUSERName);
|
|
str.AppendLine("传入站点:" + o.WorkPoint);
|
|
str.AppendLine("传入批次:" + o.VendorLot);
|
|
str.AppendLine("传入条码数量:" + o.LOTQTY);
|
|
foreach (PickInfoList item in o.PickInfoList)
|
|
{
|
|
str.AppendLine("传入存货编码:" + item.SubInvCode);
|
|
str.AppendLine("传入工单号:" + item.MOCode);
|
|
str.AppendLine("传入领料单号:" + item.VouchCode);
|
|
str.AppendLine("传入供应商编码:" + item.DeleteStatus);
|
|
str.AppendLine("传入物料编码:" + item.InvCode);
|
|
str.AppendLine("传入数量:" + item.Quantity);
|
|
str.AppendLine("传入库房编码:" + item.WHCode);
|
|
str.AppendLine("传入库位:" + item.BinCode);
|
|
}
|
|
str.AppendLine("失败原因:" + ex.Message);
|
|
Appconfig.WriteLogFile(str.ToString(), "点料退料产生新条码接口日志");
|
|
}
|
|
|
|
}
|
|
conn.Close();
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 返回值
|
|
/// </summary>
|
|
public class FormICSCreatedArrivalNoticeModel
|
|
{
|
|
//0 :正常数据,-1:失败。
|
|
public int Code { get; set; }
|
|
public string ResMsg { get; set; }
|
|
public object ResData { get; set; }
|
|
public bool IsCompress { get; set; }
|
|
public bool IsSuccess { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// SQL执行方法
|
|
/// </summary>
|
|
/// <param name="SQl"></param>
|
|
/// <param name="cmd"></param>
|
|
/// <returns></returns>
|
|
public static DataTable SQlReturnData(string SQl, SqlCommand cmd)
|
|
{
|
|
DataTable dt = new DataTable();
|
|
cmd.CommandText = SQl;
|
|
SqlDataAdapter dr = new System.Data.SqlClient.SqlDataAdapter();
|
|
dr.SelectCommand = cmd;
|
|
dr.Fill(dt);
|
|
return dt;
|
|
}
|
|
|
|
//库位转换
|
|
public string fenge(string sourceString)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
for (int i = 0; i < sourceString.Length; i++)
|
|
{
|
|
if (i == 0 || i == 3)
|
|
{
|
|
sb.Append(sourceString[i].ToString()).Append("-");
|
|
}
|
|
else
|
|
{
|
|
sb.Append(sourceString[i]);
|
|
}
|
|
}
|
|
return sb.ToString();
|
|
}
|
|
}
|
|
|
|
}
|