232
This commit is contained in:
@@ -56,6 +56,7 @@ namespace Pilot_KD_Parino.Sal_Order
|
||||
}
|
||||
int tempFid = int.Parse(dt.Select(t => t["FSBILLID"]).FirstOrDefault().ToString());
|
||||
string tablename = dt.Select(t => t["FSTABLENAME"]).FirstOrDefault().ToString();
|
||||
int xiaoFid = 0;
|
||||
//找到采购订单
|
||||
for (int kk = 0; kk < 6 && tablename.ToUpper() != "T_PUR_POORDERENTRY"; kk++)
|
||||
{
|
||||
@@ -79,20 +80,46 @@ namespace Pilot_KD_Parino.Sal_Order
|
||||
if (dt == null || dt.Count == 0)
|
||||
{
|
||||
|
||||
this.View.ShowMessage("没有上查关联的跨组织的采购订单");
|
||||
//this.View.ShowMessage("没有上查关联的跨组织的采购订单");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
tablename = dt.Select(t => t["FSTABLENAME"]).FirstOrDefault().ToString();
|
||||
//if (tablename.ToUpper() != "T_PUR_POORDERENTRY")
|
||||
// this.View.ShowMessage("没有上查关联的跨组织的采购订单 " + tablename);
|
||||
tempFid = int.Parse(dt.Select(t => t["FSBILLID"]).FirstOrDefault().ToString());
|
||||
}
|
||||
tempFid = int.Parse(dt.Select(t => t["FSBILLID"]).FirstOrDefault().ToString());
|
||||
|
||||
}
|
||||
if (tablename.ToUpper() != "T_PUR_POORDERENTRY")
|
||||
{
|
||||
throw new KDBusinessException("", "没有上查关联的跨组织的采购订单:" + tablename);
|
||||
{
|
||||
getSourceSql = $@"/*dialect*/SELECT FSTABLENAME,FSBILLID,FENTRYID FROM dbo.T_PUR_POORDERENTRY_LK
|
||||
WHERE FSBILLID= {tempFid}";
|
||||
dt = DBServiceHelper.ExecuteDynamicObject(this.Context, getSourceSql);
|
||||
if (dt == null || dt.Count == 0)
|
||||
{
|
||||
throw new KDBusinessException("", "没有上查关联的跨组织的采购订单:" + tablename);
|
||||
}
|
||||
else
|
||||
{
|
||||
xiaoFid = tempFid;
|
||||
//tablename = dt.Select(t => t["FSTABLENAME"]).FirstOrDefault().ToString();
|
||||
//tempFid = int.Parse(dt.Select(t => t["FSBILLID"]).FirstOrDefault().ToString());
|
||||
|
||||
var FENTRYIDList = dt.Select(t => int.Parse(t["FENTRYID"].ToString())).ToList();
|
||||
string ids = string.Join(",", FENTRYIDList);
|
||||
getSourceSql = $@"/*dialect*/ SELECT FID FROM T_PUR_POORDERENTRY WHERE FENTRYID IN({ids})";
|
||||
dt = DBServiceHelper.ExecuteDynamicObject(this.Context, getSourceSql);
|
||||
if (dt == null || dt.Count == 0)
|
||||
{
|
||||
throw new KDBusinessException("", "没有上查关联的跨组织的采购订单:" + tablename);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempFid =int.Parse( dt.FirstOrDefault()["FID"].ToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int stockId = 0;
|
||||
@@ -111,7 +138,7 @@ namespace Pilot_KD_Parino.Sal_Order
|
||||
}
|
||||
|
||||
//找到最开始的销售订单
|
||||
for (int kk = 0; kk < 6 && tablename.ToUpper() != "T_SAL_ORDERENTRY"; kk++)
|
||||
for (int kk = 0; kk < 6 && tablename.ToUpper() != "T_SAL_ORDERENTRY" && xiaoFid==0; kk++)
|
||||
{
|
||||
////发货通知单
|
||||
tempFid = int.Parse(dt.Select(t => t["FSBILLID"]).FirstOrDefault().ToString());
|
||||
@@ -133,13 +160,14 @@ namespace Pilot_KD_Parino.Sal_Order
|
||||
}
|
||||
tempFid = int.Parse(dt.Select(t => t["FSBILLID"]).FirstOrDefault().ToString());
|
||||
}
|
||||
if (tablename.ToUpper() != "T_SAL_ORDERENTRY")
|
||||
if (tablename.ToUpper() != "T_SAL_ORDERENTRY" && xiaoFid == 0)
|
||||
{
|
||||
|
||||
throw new KDBusinessException("", "推送销售发货通知单失败,没有上查关联的跨组织的销售订单:" + tablename);
|
||||
|
||||
}
|
||||
|
||||
if (xiaoFid > 0)
|
||||
tempFid = xiaoFid;
|
||||
result = Invoke("SAL_SaleOrder", "SAL_DELIVERYNOTICE", tempFid.ToString(), "193822715afc48aa9fa6d6beca7700ab", ref stockId);
|
||||
sheet = result.SuccessDataEnity.FirstOrDefault();
|
||||
result = Invoke("SAL_DELIVERYNOTICE", "SAL_OUTSTOCK", sheet["id"].ToString(), "ad0779a4685a43a08f08d2e42d7bf3e9", ref stockId);
|
||||
|
||||
Reference in New Issue
Block a user