3322
This commit is contained in:
parent
a4976430a8
commit
8af0c7f62a
@ -916,28 +916,28 @@ namespace Pilot_KD_Parino.QPHY_AutoWrire
|
||||
if(benci==0)
|
||||
continue;
|
||||
this.View.Model.CreateNewEntryRow("FEntity2");
|
||||
this.View.Model.SetValue("FROWID", Guid.NewGuid().ToString(), Rowindex + 1);
|
||||
this.View.Model.SetValue("FPARENTROWID", FROWID, Rowindex + 1);
|
||||
this.View.Model.SetValue("FBILLNO2", tempList2[i].FBIllNO, Rowindex + 1);
|
||||
this.View.Model.SetValue("FROWID", Guid.NewGuid().ToString(), Rowindex );
|
||||
this.View.Model.SetValue("FPARENTROWID", FROWID, Rowindex );
|
||||
this.View.Model.SetValue("FBILLNO2", tempList2[i].FBIllNO, Rowindex );
|
||||
if (DateTime.TryParseExact(tempList2[i].FDate, dateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime parsedDate))
|
||||
{
|
||||
this.View.Model.SetValue("FDate2", tempList2[i].FDate, Rowindex + 1);
|
||||
this.View.Model.SetValue("FDate2", tempList2[i].FDate, Rowindex );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.View.Model.SetValue("FDate2", DateTime.Now.AddDays(-1 * Convert.ToInt32(tempList2[i].FDate)).ToString("yyyy-MM-dd"), Rowindex + 1);
|
||||
this.View.Model.SetValue("FDate2", DateTime.Now.AddDays(-1 * Convert.ToInt32(tempList2[i].FDate)).ToString("yyyy-MM-dd"), Rowindex );
|
||||
}
|
||||
this.View.Model.SetValue("F_MBBA_Decimal_imu", tempList2[i].FALLAMOUNT, Rowindex + 1);
|
||||
this.View.Model.SetValue("FClient2", tempList2[i].FClient, Rowindex + 1);
|
||||
this.View.Model.SetValue("F_RowNew", 2, Rowindex + 1);
|
||||
this.View.Model.SetValue("FCreated2", tempList2[i].FCreated, Rowindex + 1);
|
||||
this.View.Model.SetValue("FCONTRACTNUMBER2", tempList2[i].FCONTRACTNUMBER, Rowindex + 1);
|
||||
this.View.Model.SetValue("FSalesman2", tempList2[i].FSalesman, Rowindex + 1);
|
||||
this.View.Model.SetValue("F_MBBA_Decimal_qtr", tempList2[i].FDAMOUNT, Rowindex + 1);
|
||||
this.View.Model.SetValue("F_PendingAmount", tempList2[i].FDAMOUNT, Rowindex + 1);
|
||||
this.View.Model.SetValue("F_BenCi", benci, Rowindex + 1);
|
||||
this.View.Model.SetValue("F_MBBA_Decimal_3iy", tempList2[i].FYAMOUNT, Rowindex + 1);
|
||||
this.View.Model.SetValue("F_ISHX", false, Rowindex + 1);
|
||||
this.View.Model.SetValue("F_MBBA_Decimal_imu", tempList2[i].FALLAMOUNT, Rowindex );
|
||||
this.View.Model.SetValue("FClient2", tempList2[i].FClient, Rowindex );
|
||||
this.View.Model.SetValue("F_RowNew", 2, Rowindex );
|
||||
this.View.Model.SetValue("FCreated2", tempList2[i].FCreated, Rowindex );
|
||||
this.View.Model.SetValue("FCONTRACTNUMBER2", tempList2[i].FCONTRACTNUMBER, Rowindex );
|
||||
this.View.Model.SetValue("FSalesman2", tempList2[i].FSalesman, Rowindex );
|
||||
this.View.Model.SetValue("F_MBBA_Decimal_qtr", tempList2[i].FDAMOUNT, Rowindex );
|
||||
this.View.Model.SetValue("F_PendingAmount", tempList2[i].FDAMOUNT, Rowindex );
|
||||
this.View.Model.SetValue("F_BenCi", benci, Rowindex );
|
||||
this.View.Model.SetValue("F_MBBA_Decimal_3iy", tempList2[i].FYAMOUNT, Rowindex );
|
||||
this.View.Model.SetValue("F_ISHX", false, Rowindex );
|
||||
|
||||
}
|
||||
|
||||
|
@ -37,10 +37,11 @@ namespace Pilot_KD_Parino.Sal_Order
|
||||
{
|
||||
base.AfterBarItemClick(e);
|
||||
|
||||
//this.View.ShowMessage("669977");
|
||||
|
||||
|
||||
if (e.BarItemKey.Equals("tbPushSalOut111", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
||||
var FEntity = this.View.Model.DataObject;
|
||||
var id = FEntity["id"];
|
||||
string formid = FEntity["FFormId"].ToString();
|
||||
@ -79,9 +80,9 @@ namespace Pilot_KD_Parino.Sal_Order
|
||||
|
||||
if (dt == null || dt.Count == 0)
|
||||
{
|
||||
|
||||
break;
|
||||
//this.View.ShowMessage("没有上查关联的跨组织的采购订单");
|
||||
return;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -168,40 +169,43 @@ namespace Pilot_KD_Parino.Sal_Order
|
||||
}
|
||||
if (xiaoFid > 0)
|
||||
tempFid = xiaoFid;
|
||||
//找到最开始的销售发货通知单
|
||||
{
|
||||
getSourceSql = $@"/*dialect*/SELECT FSTABLENAME,FSBILLID,FENTRYID FROM dbo.T_SAL_DELIVERYNOTICEENTRY_LK
|
||||
WHERE FSBILLID= {tempFid}";
|
||||
dt = DBServiceHelper.ExecuteDynamicObject(this.Context, getSourceSql);
|
||||
if (dt == null || dt.Count == 0)
|
||||
{
|
||||
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);
|
||||
tempFid = int.Parse(sheet["id"].ToString());
|
||||
//throw new KDBusinessException("", "没有上查关联的跨组织的采购订单:" + tablename);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var FENTRYIDList = dt.Select(t => int.Parse(t["FENTRYID"].ToString())).ToList();
|
||||
string ids = string.Join(",", FENTRYIDList);
|
||||
getSourceSql = $@"/*dialect*/ SELECT FID FROM T_SAL_DELIVERYNOTICEENTRY 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());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//result = Invoke("SAL_SaleOrder", "SAL_DELIVERYNOTICE", tempFid.ToString(), "193822715afc48aa9fa6d6beca7700ab", ref stockId);
|
||||
//sheet = result.SuccessDataEnity.FirstOrDefault();
|
||||
result = Invoke("SAL_DELIVERYNOTICE", "SAL_OUTSTOCK", tempFid.ToString(), "ad0779a4685a43a08f08d2e42d7bf3e9", ref stockId);
|
||||
|
||||
this.View.ShowMessage("跨组织下推订单完成");
|
||||
|
||||
//this.View.ShowMessage("就是这个按钮"+ id);
|
||||
|
||||
//ListSelectedRowCollection rows =new ListSelectedRowCollection();
|
||||
//List<string> pkIds = new List<string>();
|
||||
//List<object> pkEntryIds = new List<object>();
|
||||
//if (rows.Count <= 0)
|
||||
//{
|
||||
// this.View.ShowMessage("请选择对应的发货通知单!!!");
|
||||
// return;
|
||||
//}
|
||||
//foreach (var row in rows)
|
||||
//{
|
||||
// sBillNo = row.BillNo.ToString();//发货通知单号
|
||||
// sId = Convert.ToInt64(row.PrimaryKeyValue);//发货通知单ID
|
||||
// sEntryId = Convert.ToInt64(row.EntryPrimaryKeyValue);//发货通知单ID
|
||||
// string sSql = "select FID from T_SAL_DELIVERYNOTICEENTRY where FID= " + sId + " and FENTRYID= " + sEntryId + " and abs(FBaseUnitQty) > abs(FBASEJOINOUTQTY) ";
|
||||
// sSql = String.Format(@"/*dialect*/" + sSql);
|
||||
// var dt = DBServiceHelper.ExecuteDynamicObject(this.Context, sSql);
|
||||
// if (dt.Count > 0)
|
||||
// {
|
||||
// string getSourceSql = "select FID from T_SAL_DELIVERYNOTICE where FBILLNO='" + sBillNo + "'";
|
||||
// IOperationResult result = Invoke("SAL_DELIVERYNOTICE", "SAL_OUTSTOCK", getSourceSql, "ad0779a4685a43a08f08d2e42d7bf3e9");
|
||||
// }
|
||||
//}//进入下一个循环生成下一个系列的分布式调出单
|
||||
//if (flag)
|
||||
//{
|
||||
// this.View.ShowMessage("生成对应系列的分布式调出单完成!!!");
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@ -411,123 +415,7 @@ namespace Pilot_KD_Parino.Sal_Order
|
||||
|
||||
|
||||
|
||||
private IOperationResult Invoke2(string source, string target, string tempFid, string sargetBillTypeId)
|
||||
{
|
||||
try
|
||||
{
|
||||
IOperationResult result = new OperationResult();
|
||||
//获取单据转换规则
|
||||
ConvertRuleElement ruleElement = ServiceHelper.GetService<IConvertService>().GetConvertRules(this.Context, source, target).FirstOrDefault();
|
||||
|
||||
//如下代码 直接通过查询数据库获取单据转换源单数据
|
||||
ListSelectedRowCollection rows = new ListSelectedRowCollection();
|
||||
int i = 0;
|
||||
ListSelectedRow row = new ListSelectedRow(tempFid, string.Empty, i++, source);
|
||||
rows.Add(row);
|
||||
|
||||
PushArgs pushArgs = new PushArgs(ruleElement, rows.ToArray());
|
||||
pushArgs.TargetBillTypeId = sargetBillTypeId;//单据类型
|
||||
//转换生成目标单
|
||||
ConvertOperationResult convertResult = ServiceHelper.GetService<IConvertService>().Push(this.Context, pushArgs);
|
||||
|
||||
////合并转换操作结果
|
||||
//result.MergeResult(convertResult);
|
||||
|
||||
////目标单据数据集合
|
||||
DynamicObject[] destObjs = convertResult.TargetDataEntities.Select(r => r.DataEntity).ToArray();
|
||||
//根据实际情况,处理目标单据数据
|
||||
//destObjs[0]["Date"] = Convert.ToDateTime(sDate);
|
||||
DynamicObjectCollection col_FEntityDetail;
|
||||
var sdsas= JsonHelper.ToJson(destObjs);
|
||||
Logger.Error("目标单据数据集合", sdsas, new Exception ());
|
||||
this.View.ShowMessage("好了好了,就是这个按钮");
|
||||
//return result;
|
||||
////if (target == "SAL_OUTSTOCK")//销售出库
|
||||
////{
|
||||
//col_FEntityDetail = destObjs[0]["SAL_OUTSTOCKENTRY"] as DynamicObjectCollection;
|
||||
////}
|
||||
////else
|
||||
////{//销售退货
|
||||
//// col_FEntityDetail = destObjs[0]["SAL_RETURNSTOCKENTRY"] as DynamicObjectCollection;
|
||||
////}
|
||||
//#region
|
||||
//long sStockOrgID = 0;
|
||||
//sStockOrgID = Convert.ToInt64(destObjs[0]["StockOrgId_Id"]);
|
||||
|
||||
|
||||
//foreach (var item in col_FEntityDetail)
|
||||
//{
|
||||
// //item["KeeperID_Id"] = item["OwnerID_Id"];//保管者
|
||||
|
||||
// string sStockSql = "select FOrgStockId from v_BusinessOrgId where FORGID= " + sStockOrgID + " ";
|
||||
// sStockSql = String.Format(@"/*dialect*/" + sStockSql);
|
||||
// var dt = DBServiceHelper.ExecuteDynamicObject(this.Context, sStockSql);
|
||||
|
||||
// //if (dt.Count > 0 && Convert.ToInt64(dt[0]["FOrgStockId"]) != 0)
|
||||
// if (dt.Count > 0)
|
||||
// {
|
||||
// //var targetBillMeta = ServiceHelper.GetService<IMetaDataService>().Load(this.Context, target) as FormMetadata;
|
||||
// //BusinessInfo info = targetBillMeta.BusinessInfo;
|
||||
// //BaseDataField stockFld = info.GetField("FStockId") as BaseDataField;
|
||||
// //long stockId = Convert.ToInt64(dt[0]["FOrgStockId"]);
|
||||
// //IViewService viewService = ServiceHelper.GetService<IViewService>();
|
||||
// //DynamicObject[] stockObjs = viewService.LoadFromCache(this.Context, new object[] { stockId }, stockFld.RefFormDynamicObjectType);
|
||||
// //stockFld.RefIDDynamicProperty.SetValue(item, stockId);
|
||||
// //stockFld.DynamicProperty.SetValue(item, stockObjs[0]);
|
||||
|
||||
// item["StockID_Id"] = Convert.ToInt64(dt[0]["FOrgStockId"]);
|
||||
// }
|
||||
//}
|
||||
//#endregion
|
||||
|
||||
////目标单元数据
|
||||
FormMetadata destFormMetadata = ServiceHelper.GetService<IMetaDataService>().Load(this.Context, target) as FormMetadata;
|
||||
|
||||
////保存目标单据
|
||||
IOperationResult saveResult = ServiceHelper.GetService<ISaveService>().Save(this.Context, destFormMetadata.BusinessInfo, destObjs, OperateOption.Create());
|
||||
////合并保存操作结果
|
||||
//result.MergeResult(saveResult);
|
||||
//根据操作结果构造返回结果
|
||||
if ((saveResult.ValidationErrors != null && saveResult.ValidationErrors.Count > 0))
|
||||
//|| (result.OperateResult != null && result.OperateResult.Count > 0))
|
||||
{
|
||||
var errorInfo = string.Join(";", saveResult.ValidationErrors.Select(x => x.Message));
|
||||
//this.View.ShowErrMessage("调用下推, 导致自动保存失败 原因:" + errorInfo);
|
||||
|
||||
//result.IsSuccess = false;
|
||||
//this.View.ShowErrMessage("调用下推, 导致自动保存失败 原因:" + saveResult.ValidationErrors[0].Message.ToString());
|
||||
throw new KDBusinessException("", "未知原因导致自动保存失败原因:" + errorInfo);
|
||||
}
|
||||
return result;
|
||||
//this.View.ShowMessage("1");
|
||||
// 取到需要自动提交、审核的单据内码
|
||||
object[] pkArray = (from p in destObjs select p[0]).ToArray();
|
||||
//设置提交参数
|
||||
IOperationResult submitResult = ServiceHelper.GetService<ISubmitService>().Submit(this.Context, destFormMetadata.BusinessInfo, pkArray, "Submit", OperateOption.Create());
|
||||
|
||||
// 判断提交结果,如果失败,则内部会抛出错误,回滚代码
|
||||
if (submitResult.IsSuccess == false)
|
||||
{
|
||||
throw new KDBusinessException("", "未知原因导致自动提交失败!");
|
||||
}
|
||||
//设置审核参数
|
||||
IOperationResult auditResult = ServiceHelper.GetService<IAuditService>().Audit(this.Context, destFormMetadata.BusinessInfo, pkArray, OperateOption.Create());
|
||||
// 判断提交结果,如果失败,则内部会抛出错误,回滚代码
|
||||
if (auditResult.IsSuccess == false)
|
||||
{
|
||||
throw new KDBusinessException("", "未知原因导致自动审核失败!");
|
||||
}
|
||||
//显示下推后的单据
|
||||
//ShowPushResult("k0f9e182dbc5247fcabc9479ddb300fa3", convertResult, destObjs);
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error("同步报关信息时", "同步报关信息时 error:" + ex.Message + ex.StackTrace, ex);
|
||||
throw ex;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ using Kingdee.BOS.App.Data;
|
||||
namespace Pilot_KD_Parino.VRYF_FHTZDHXJL
|
||||
{
|
||||
[HotUpdate]
|
||||
[Description("核销记录单--更新销售订单金额")]
|
||||
[Description("核销记录单(发货通知单)--更新销售订单金额")]
|
||||
public class UpdateAmount : AbstractOperationServicePlugIn
|
||||
{
|
||||
public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user