private void CreateROAdjustItem(GatherSettlementInfo entity, string solist) { CustomDataCommand command = DataCommandManager.CreateCustomDataCommandFromConfig("InsertConsignSettleGatherRO_Adjust"); using (DynamicQuerySqlBuilder builder = new DynamicQuerySqlBuilder(command.CommandText, command, null, "b.SONumber DESC")) { if (entity.VendorInfo.SysNo.HasValue) { builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "ship.MerchantSysNo", DbType.Int32, "@VendorSysNo", QueryConditionOperatorType.Equal, entity.VendorInfo.SysNo); builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "main.CompanyCode", DbType.AnsiStringFixedLength, "@CompanyCode", QueryConditionOperatorType.Equal, entity.CompanyCode); builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "s.ReferenceType", DbType.AnsiStringFixedLength, "@ReferenceType", QueryConditionOperatorType.IsNull, DBNull.Value); } command.CommandText = builder.BuildQuerySql(); string strSQL3 = string.Empty; // ##OrderDate3## if (entity.CreateDateFrom.HasValue) { strSQL3 += " AND main.CreateTime>'" + entity.CreateDateFrom.Value.ToShortDateString() + "'"; } if (entity.CreateDateTo.HasValue) { strSQL3 += " AND main.CreateTime<'" + entity.CreateDateTo.Value.AddDays(1).ToShortDateString() + "'"; } command.CommandText = command.CommandText.Replace("##OrderDate3##", strSQL3); } command.CommandText = command.CommandText.Replace("#SONumber#", solist) .Replace("#StoreCompanyCode#", "'" + entity.CompanyCode + "'") .Replace("#CompanyCode#", "'" + entity.CompanyCode + "'") .Replace("#InUser#", "'" + entity.CreateUserName + "'") .Replace("#SettlementSysNo#", entity.SysNo.Value.ToString()); command.ExecuteNonQuery(); }
private void btnCreate_Click(object sender, RoutedEventArgs e) { //创建代收结算单: if (!gatherInfoVM.VendorInfo.SysNo.HasValue || string.IsNullOrEmpty(gatherInfoVM.VendorInfo.VendorBasicInfo.VendorNameLocal)) { Window.Alert(ResGatherNew.AlertMsg_VendorSelect); return; } if (gatherInfoVM.GatherSettlementItemInfoList == null || gatherInfoVM.GatherSettlementItemInfoList.Count <= 0) { Window.Alert(ResGatherNew.AlertMsg_SearchEmpty); return; } GatherSettlementInfo info = EntityConverter <GatherSettlementInfoVM, GatherSettlementInfo> .Convert(gatherInfoVM, (s, t) => { t.SourceStockInfo = new BizEntity.Inventory.StockInfo() { SysNo = s.StockSysNo }; }); serviceFacade.CreateGatherSettlementInfo(info, (obj, args) => { if (args.FaultsHandle()) { return; } //创建成功,转到编辑页面: Window.Navigate(string.Format("/ECCentral.Portal.UI.PO/GatherMaintain/{0}", args.Result.SysNo.Value), true); }); }
private void UpdateTotal(GatherSettlementInfo entity) { DataCommand command = DataCommandManager.GetDataCommand("UpdateVendorSettleGatherToAmt"); command.SetParameterValue("@SysNo", entity.SysNo); command.ExecuteNonQuery(); }
/// <summary> /// 代收结算单 - 取消审核 /// </summary> /// <param name="info"></param> /// <returns></returns> public GatherSettlementInfo CancelAuditGatherSettlement(GatherSettlementInfo info) { GatherSettlementInfo oldSettle = GatherSettlementDA.GetVendorSettleGatherInfo(info); if (oldSettle.SettleStatus != GatherSettleStatus.AUD) { //该结算单不是已审核状态,不能进行取消审核操作! throw new BizException(GetMessageString("Gather_Audited_Invalid_CancelAudit")); } info.SettleStatus = GatherSettleStatus.ORG; GatherSettlementDA.UpdateGatherSettlementStatus(info, false); //发送取消审核Message EventPublisher.Publish(new GatherSettlementAuditCanceledMessage() { SettlementSysNo = info.SysNo.Value, CurrentUserSysNo = ServiceContext.Current.UserSysNo }); //写LOG: // CommonService.WriteLog<VendorSettleGatherEntity>(entity, " CancelAudited Gather ", entity.SysNo.Value.ToString(), (int)LogType.Purchase_Verify_InStock); ExternalDomainBroker.CreateLog(" CancelAudited Gather " , BizEntity.Common.BizLogType.Purchase_Verify_InStock , info.SysNo.Value , info.CompanyCode); return(info); }
/// <summary> /// 审核供应商代收结算信息 /// </summary> /// <param name="info"></param> /// <returns></returns> public GatherSettlementInfo AuditGatherSettlement(GatherSettlementInfo info) { GatherSettlementInfo oldSettle = GatherSettlementDA.GetVendorSettleGatherInfo(info); if (oldSettle.SettleStatus != GatherSettleStatus.ORG) { //该结算单不是待审核状态,不能进行审核操作 throw new BizException(GetMessageString("Gather_Orgin_Invalid_Audit")); } //if (oldSettle.InUser == info.AuditUser.UserDisplayName) //{ // //创建人和审核人不能相同 // throw new BizException(GetMessageString("Gather_WaitingAudit_CreateUser")); //} //更新代收结算单状态: info.SettleStatus = GatherSettleStatus.AUD; GatherSettlementDA.UpdateGatherSettlementStatus(info, true); //发送审核Message EventPublisher.Publish(new GatherSettlementAuditedMessage() { SettlementSysNo = info.SysNo.Value, CurrentUserSysNo = ServiceContext.Current.UserSysNo }); //写Log: //CommonService.WriteLog<VendorSettleGatherEntity>(entity, " Audit Gather ", entity.SysNo.Value.ToString(), (int)LogType.Purchase_Verify_InStock); ExternalDomainBroker.CreateLog(" Audit Gather " , BizEntity.Common.BizLogType.Purchase_Verify_InStock , info.SysNo.Value , info.CompanyCode); return(info); }
public GatherSettlementInfo GetVendorSettleGatherInfo(GatherSettlementInfo info) { DataCommand command = DataCommandManager.GetDataCommand("GetSettleGatherEntityBySettleSysNo"); command.SetParameterValue("@SysNo", info.SysNo); return(command.ExecuteEntity <GatherSettlementInfo>()); }
/// <summary> /// 获取所有供应商代收结算单Items /// </summary> /// <param name="info"></param> /// <returns></returns> public virtual List <GatherSettlementItemInfo> GetAllSettleGatherItems(GatherSettlementInfo info) { List <GatherSettlementItemInfo> shippingChargeList = GatherSettlementDA.LoadConsignSettlementAllShippingCharge(info); List <GatherSettlementItemInfo> productList = GatherSettlementDA.QueryConsignSettlementProductList(info); List <GatherSettlementItemInfo> ro_adjustItems = GatherSettlementDA.QueryConsignSettleGatherROAdjust(info); return(shippingChargeList.Union(productList).Union(ro_adjustItems).ToList()); }
/// <summary> /// 获取代收结算单信息 /// </summary> /// <param name="gatherSettlementSysNo">代收结算单编号</param> /// <returns>代收结算单信息</returns> public GatherSettlementInfo GetGatherSettlementInfo(int gatherSettlementSysNo) { GatherSettlementInfo info = new GatherSettlementInfo() { SysNo = gatherSettlementSysNo }; return(ObjectFactory <GatherSettlementProcessor> .Instance.LoadGetherSettlement(info)); }
public GatherSettlementInfo LoadGatherSettlementInfo(int gatherSysNo) { GatherSettlementInfo gatherInfo = new GatherSettlementInfo() { SysNo = gatherSysNo }; return(GatherSettlementProcessor.LoadGetherSettlement(gatherInfo)); }
//public VendorSettleGatherMsg Create(VendorSettleGatherMsg entity, List<int> payPeriodTypes, List<int> soList) public GatherSettlementInfo Create(GatherSettlementInfo entity, List <int> payPeriodTypes, List <int> soList) { DataCommand command = DataCommandManager.GetDataCommand("CreateVendorSettleGather"); #region command.SetParameterValue("@MerchantSysNo", entity.VendorSysNo); //@@ command.SetParameterValue("@StockSysNo", entity.StockSysNo); //@@ //command.SetParameterValue("@MerchantSysNo", entity.VendorInfo.SysNo); command.SetParameterValue("@MerchantSysNo", entity.VendorSysNo); //command.SetParameterValue("@StockSysNo", entity.SourceStockInfo.SysNo); command.SetParameterValue("@StockSysNo", entity.StockSysNo); #endregion command.SetParameterValue("@TotalAmt", entity.TotalAmt); command.SetParameterValue("@InUser", GlobalSettings.UserName); command.SetParameterValue("@InDate", DateTime.Now); command.SetParameterValue("@EditUser", GlobalSettings.UserName); command.SetParameterValue("@EditDate", DateTime.Now); command.SetParameterValue("@CurrencySysNo", "CNY"); command.SetParameterValue("@Status", (int)entity.Status); command.SetParameterValue("@CompanyCode", GlobalSettings.CompanyCode); command.SetParameterValue("@StoreCompanyCode", GlobalSettings.StoreCompanyCode); command.SetParameterValue("@Memo", entity.Memo); //////////////////////////////////////////////////////////////////// entity.SysNo = System.Convert.ToInt32(command.ExecuteScalar()); /////////////////////////////////////////////////////////////////////// //@@if (entity.SettleGatherItems != null && entity.SettleGatherItems.Count > 0) if (entity.GatherSettlementItemInfoList != null && entity.GatherSettlementItemInfoList.Count > 0) { List <string> listString = new List <string>(); int k = 0; foreach (int soNumber in soList) { if (k % 500 == 0) { listString.Add(soNumber.ToString()); } else { listString[k / 500] = listString[k / 500] + "," + soNumber.ToString(); } k++; } foreach (string solist in listString) { CreateItems(entity, payPeriodTypes, solist); } ////////////////////////////////////////////////////////////////////////////////// UpdateTotal(entity); } return(entity); }
/// <summary> /// 更新代收结算单 /// </summary> /// <param name="info"></param> /// <param name="callback"></param> public void UpdateGatherSettlementInfo(GatherSettlementInfo info, EventHandler <RestClientEventArgs <object> > callback) { info.CompanyCode = CPApplication.Current.CompanyCode; info.CreateUserSysNo = CPApplication.Current.LoginUser.UserSysNo; info.CreateUserName = CPApplication.Current.LoginUser.DisplayName; string relativeUrl = "/POService/GatherSettlement/UpdateGatherSettlement"; restClient.Update(relativeUrl, info, callback); }
/// <summary> /// 根据AccLog构建代收结算单 /// </summary> /// <param name="acclogList">AccLog</param> /// <returns>代收结算单列表</returns> private List <GatherSettlementInfo> GetVendorSettleList(List <GatherSettleInfo> acclogList) { //计算TotalAmt List <GatherSettlementInfo> settleGatherList = new List <GatherSettlementInfo>(); var result = from item in acclogList group item by item.VendorSysno; foreach (var data in result) { var stockGroup = data.GroupBy(ite => ite.WarehouseNumber); foreach (var re in stockGroup) { GatherSettlementInfo msg = new GatherSettlementInfo(); msg.GatherSettlementItemInfoList = new List <GatherSettlementItemInfo>(); msg.VendorSysNo = data.Key; //@@ msg.StockSysNo = re.Key; //@@ foreach (var it in re) { GatherSettlementItemInfo itemsg = new GatherSettlementItemInfo(); itemsg.InvoiceNumber = it.InvoiceNumber; itemsg.OrderDate = it.OrderDate; itemsg.OriginalPrice = it.OriginalPrice; //??itemsg.Point = it.Point; itemsg.Point = Convert.ToInt32(it.Point); itemsg.ProductID = it.ProductID; itemsg.ProductName = it.ProductName; itemsg.ProductSysNo = it.ProductSysNo; itemsg.Quantity = it.Quantity; itemsg.SettleStatus = it.SettleStatus; //@@ itemsg.SettleSysNo = it.SettleSysNo; //??itemsg.SettleType = it.SettleType; itemsg.SettleType = it.EnumSettleType; itemsg.SoItemSysno = it.SoItemSysno; //@@ itemsg.SONumber = it.SONumber; itemsg.StockName = it.StockName; itemsg.SysNo = it.SysNo; //@@ itemsg.TransactionNumber = it.TransactionNumber; //@@ itemsg.VendorSysno = it.VendorSysno; //@@ itemsg.WarehouseNumber = it.WarehouseNumber; itemsg.PromotionDiscount = it.PromotionDiscount; //优惠券折扣 msg.GatherSettlementItemInfoList.Add(itemsg); } if (msg.GatherSettlementItemInfoList.Count > 0) { msg.TotalAmt = msg.GatherSettlementItemInfoList.Sum(d => (d.OriginalPrice * d.Quantity) + (d.PromotionDiscount.HasValue ? d.PromotionDiscount.Value : 0)).Value; } settleGatherList.Add(msg); } } return(settleGatherList); }
/// <summary> /// 代收结算单 - 取消作废 /// </summary> /// <param name="info"></param> /// <returns></returns> public GatherSettlementInfo CancelAbandonGatherSettlement(GatherSettlementInfo info) { //写LOG:CommonService.WriteLog<VendorSettleGatherEntity>(entity, " CancelAbandon VendorSettle ", entity.SysNo.Value.ToString(), (int)LogType.VendorSettle_CancelAbandon); ExternalDomainBroker.CreateLog(" CancelAbandon Gather " , BizEntity.Common.BizLogType.Purchase_Verify_InStock , info.SysNo.Value , info.CompanyCode); return(info); }
public List <GatherSettlementItemInfo> GetSettleGatherItemsInfoPage(GatherSettlementInfo info) { CustomDataCommand command = DataCommandManager.CreateCustomDataCommandFromConfig("GetVendorSettleGatherItemsPageBySysNo"); using (DynamicQuerySqlBuilder builder = new DynamicQuerySqlBuilder(command.CommandText, command, null, "b.SysNo DESC")) { command.CommandText = builder.BuildQuerySql(); command.CommandText = command.CommandText.Replace("@SettleSysNo", info.SysNo.Value.ToString()); return(command.ExecuteEntityList <GatherSettlementItemInfo>()); } }
public GatherSettlementInfo UpdateGatherSettlementSettleStatus(GatherSettlementInfo info) { DataCommand command = DataCommandManager.GetDataCommand("UpdateVendorSettleGatherSettleStatus"); command.SetParameterValue("@Status", info.SettleStatus.ToString()); command.SetParameterValue("@SysNo", info.SysNo); command.SetParameterValue("@SettleUser", info.CreateUserName); command.SetParameterValue("@SettleDate", DateTime.Now); command.ExecuteNonQuery(); return(info); }
/// <summary> /// 审核代收结算单 /// </summary> /// <param name="info"></param> /// <param name="callback"></param> public void AuditGatherSettlementInfo(GatherSettlementInfo info, EventHandler <RestClientEventArgs <object> > callback) { info.CompanyCode = CPApplication.Current.CompanyCode; if (info.AuditUser == null) { info.AuditUser = new BizEntity.Common.UserInfo(); } info.AuditUser.UserDisplayName = CPApplication.Current.LoginUser.DisplayName; string relativeUrl = "/POService/GatherSettlement/AuditGatherSettlement"; restClient.Update(relativeUrl, info, callback); }
private void CreateGatherItem(GatherSettlementInfo entity, string solist) { CustomDataCommand command = DataCommandManager.CreateCustomDataCommandFromConfig("InsertConsignSettleGatherItems"); using (DynamicQuerySqlBuilder builder = new DynamicQuerySqlBuilder(command.CommandText, command, null, "b.SONumber DESC")) { if (entity.VendorInfo.SysNo.HasValue) { builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "ship.MerchantSysNo", DbType.Int32, "@VendorSysNo", QueryConditionOperatorType.Equal, entity.VendorInfo.SysNo.Value); } builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "s.ReferenceType", DbType.AnsiStringFixedLength, "@ReferenceType", QueryConditionOperatorType.IsNull, DBNull.Value); builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "main.CompanyCode", DbType.AnsiStringFixedLength, "@CompanyCode", QueryConditionOperatorType.Equal, entity.CompanyCode); command.CommandText = builder.BuildQuerySql(); string strSQl1 = string.Empty, strSQl2 = string.Empty; // ##OrderDate1## ##OrderDate2## if (!string.IsNullOrEmpty(entity.ReferenceSysNo)) { strSQl1 += " AND main.SONumber =" + entity.ReferenceSysNo.ToString() + " "; strSQl2 += " AND main.SysNo = " + entity.ReferenceSysNo.ToString() + " "; } if (entity.CreateDateFrom.HasValue) { strSQl1 += " AND main.OrderDate>'" + entity.CreateDateFrom.Value.ToShortDateString() + "'"; strSQl2 += " AND main.CreateTime>'" + entity.CreateDateFrom.Value.ToShortDateString() + "'"; } if (entity.CreateDateTo.HasValue) { strSQl1 += " AND main.OrderDate<'" + entity.CreateDateTo.Value.AddDays(1).ToShortDateString() + "'"; strSQl2 += " AND main.CreateTime<'" + entity.CreateDateTo.Value.AddDays(1).ToShortDateString() + "'"; } if (entity.SourceStockInfo.SysNo.HasValue) { strSQl1 += " AND main.WarehouseNumber=" + entity.SourceStockInfo.SysNo.Value.ToString() + " "; strSQl2 += " AND register.LocationWarehouse=" + entity.SourceStockInfo.SysNo.Value.ToString() + " "; } else { throw new BizException("未选择仓库,不能进行该操作!"); } command.CommandText = command.CommandText.Replace("##OrderDate1##", strSQl1).Replace("##OrderDate2##", strSQl2); } command.CommandText = command.CommandText.Replace("#SONumber#", solist) .Replace("#StoreCompanyCode#", "'" + entity.CompanyCode + "'") .Replace("#CompanyCode#", "'" + entity.CompanyCode + "'") .Replace("#InUser#", "'" + entity.CreateUserName + "'") .Replace("#SettlementSysNo#", entity.SysNo.Value.ToString()); command.ExecuteNonQuery(); }
public List <GatherSettlementItemInfo> QueryConsignSettleGatherROAdjust(GatherSettlementInfo info) { CustomDataCommand command = DataCommandManager.CreateCustomDataCommandFromConfig("QueryConsignSettleGatherRO_Adjust"); using (DynamicQuerySqlBuilder builder = new DynamicQuerySqlBuilder(command.CommandText, command, null, "b.SONumber DESC")) { if (info.VendorInfo.SysNo.HasValue) { builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "ship.MerchantSysNo", DbType.Int32, "@VendorSysNo", QueryConditionOperatorType.Equal, info.VendorInfo.SysNo); builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "main.CompanyCode", DbType.AnsiStringFixedLength, "@CompanyCode", QueryConditionOperatorType.Equal, info.CompanyCode); builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "s.ReferenceType", DbType.AnsiStringFixedLength, "@ReferenceType", QueryConditionOperatorType.IsNull, DBNull.Value); } command.CommandText = builder.BuildQuerySql(); string strSQL3 = string.Empty; //##OrderDate3## if (!string.IsNullOrEmpty(info.ReferenceSysNo)) { strSQL3 += " AND main.SysNo = " + info.ReferenceSysNo + " "; } if (info.CreateDateFrom.HasValue) { strSQL3 += " AND main.CreateTime>'" + info.CreateDateFrom.Value.ToShortDateString() + "'"; } if (info.CreateDateTo.HasValue) { strSQL3 += " AND main.CreateTime<'" + info.CreateDateTo.Value.AddDays(1).ToShortDateString() + "'"; } if (info.OutStockRefundDateFrom.HasValue) { strSQL3 += " AND main.RefundTime>'" + info.OutStockRefundDateFrom.ToString() + "'"; } if (info.OutStockRefundDateTo.HasValue) { strSQL3 += " AND main.RefundTime<'" + info.OutStockRefundDateTo.ToString() + "'"; } //补偿退款单与仓库无关,无需根据仓库筛选 //if (entity.StockSysNo.HasValue) //{ // strSQL3 += " AND so.StockSysNo=" + entity.StockSysNo.Value.ToString() + " "; //} //else //{ // throw new BusinessException("未选择仓库,不能进行该操作!"); //} command.CommandText = command.CommandText.Replace("##OrderDate3##", strSQL3); } return(command.ExecuteEntityList <GatherSettlementItemInfo>()); }
public GatherSettlementInfo UpdateGatherSettlement(GatherSettlementInfo info) { DataCommand command = DataCommandManager.GetDataCommand("UpdateVendorSettleGather"); command.SetParameterValue("@MerchantSysNo", info.VendorInfo.SysNo.Value); command.SetParameterValue("@StockSysNo", info.SourceStockInfo.SysNo.Value); command.SetParameterValue("@TotalAmt", info.TotalAmt); command.SetParameterValue("@EditUser", info.CreateUserName); command.SetParameterValue("@EditDate", DateTime.Now); command.SetParameterValue("@SysNo", info.SysNo); command.ExecuteNonQuery(); return(info); }
/// <summary> /// 修改供应商代收结算信息 /// </summary> /// <param name="info"></param> /// <returns></returns> public GatherSettlementInfo UpdateGatherSettlement(GatherSettlementInfo info) { List <GatherSettlementItemInfo> deletetlist = GatherSettlementDA.GetSettleGatherItems(info); //获取已经存在的代收结算单基本信息: GatherSettlementInfo oldSettle = GatherSettlementDA.GetVendorSettleGatherInfo(info); if (oldSettle.SettleStatus != GatherSettleStatus.ORG) { //该代收结算单不是待审核状态,不能进行删除操作! throw new BizException(GetMessageString("Gather_Orgin_Invalid")); } //获取已经存在的代收结算单Item信息: List <GatherSettlementItemInfo> oldlist = GatherSettlementDA.GetSettleGatherItems(info.SysNo.Value); if (deletetlist.Count >= oldlist.Count) { //不能全部删除代收结算单Item throw new BizException(GetMessageString("Gather_DeleteAllItems")); } TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { //删除Item操作: foreach (GatherSettlementItemInfo item in deletetlist) { GatherSettlementDA.DeleteSettleItem(item, info.SysNo.Value); } //修改主表信息: info = GatherSettlementDA.UpdateGatherSettlement(info); //写LOG: //CommonService.WriteLog<VendorSettleGatherEntity>(entity, " Update Gather ", entity.SysNo.Value.ToString(), (int)LogType.Purchase_Verify_InStock); ExternalDomainBroker.CreateLog(" Update Gather " , BizEntity.Common.BizLogType.Purchase_Verify_InStock , info.SysNo.Value , info.CompanyCode); scope.Complete(); return(info); } }
protected override bool NeedProcess(GatherSettlementAuditedMessage msg) { if (msg.SettlementSysNo <= 0) { return(false); } GatherSettlementInfo gatherSettlementInfo = ObjectFactory <IPOBizInteract> .Instance.GetGatherSettlementInfo(msg.SettlementSysNo); if (gatherSettlementInfo == null) { return(false); } return(gatherSettlementInfo.SettleStatus == GatherSettleStatus.AUD); }
protected override PayItemInfo PreCheckForCancelAbandon(PayItemInfo entity, out PayableInfo payableInfo) { var payItemInfo = base.PreCheckForCancelAbandon(entity, out payableInfo); GatherSettlementInfo collectionSettlement = ExternalDomainBroker.GetGatherSettlementInfo(payItemInfo.OrderSysNo.Value); if (collectionSettlement.SettleStatus == GatherSettleStatus.SET) { if (payItemInfo.PayStyle != PayItemStyle.Normal) { ThrowBizException("PayItem_CancelAbandon_VendorSettleOrderStatusNotMatchPayStyleForGatherSettlement"); } } else { ThrowBizException("PayItem_CancelAbandon_VendorSettleOrderStatusNotSettledForGatherSettlement"); } return(payItemInfo); }
private int CreateItems(GatherSettlementInfo entity, List <int> payPeriodTypes, string soNumberList) { CustomDataCommand command = DataCommandManager.CreateCustomDataCommandFromConfig("InnertGatherSettleItemsList"); using (DynamicQuerySqlBuilder builder = new DynamicQuerySqlBuilder(command.CommandText, command, null, "Consign.SysNo desc")) { builder.ConditionConstructor.AddInCondition <int>(QueryConditionRelationType.AND, "Vendor.PayPeriodType", DbType.Int32, payPeriodTypes); builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "main.CompanyCode", DbType.String, "@CompanyCode", QueryConditionOperatorType.Equal, GlobalSettings.CompanyCode); builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "s.ReferenceType", DbType.String, "@ReferenceType", QueryConditionOperatorType.IsNull, DBNull.Value); command.CommandText = builder.BuildQuerySql(); } command.CommandText = command.CommandText.Replace("#SettlementSysNo#", entity.SysNo.Value.ToString()) .Replace("#WarehouseNumber#", entity.StockSysNo.Value.ToString()) //.Replace("#WarehouseNumber#", entity.SourceStockInfo.SysNo.Value.ToString()) .Replace("#SONumber#", soNumberList) .Replace("#VendorSysno#", entity.VendorSysNo.Value.ToString()); //.Replace("#VendorSysno#", entity.VendorInfo.SysNo.Value.ToString()); return(command.ExecuteNonQuery()); }
public List <GatherSettlementItemInfo> GetSettleGatherItems(GatherSettlementInfo info) { StringBuilder strBuid = new StringBuilder(); strBuid.Append(" AND ( 1=2 "); if (info.GatherSettlementItemInfoList != null) { foreach (var item in info.GatherSettlementItemInfoList) { strBuid.Append(string.Format(" OR (ReferenceSysNo={0} AND ReferenceType = '{1}') ", item.OrderSysNo, item.SettleType.Value.ToString())); } } strBuid.Append(" ) "); DataCommand command = DataCommandManager.GetDataCommand("GetCheckSettleGatherItemsBySettleSysNo"); command.SetParameterValue("@SettleSysNo", info.SysNo); command.ReplaceParameterValue("@WHERESTRING", strBuid.ToString()); return(command.ExecuteEntityList <GatherSettlementItemInfo>()); }
protected override void PreCheckForCreate(PayItemInfo entity) { base.PreCheckForCreate(entity); GatherSettlementInfo collectionSettlement = ExternalDomainBroker.GetGatherSettlementInfo(entity.OrderSysNo.Value); if (collectionSettlement == null) { ThrowBizException("PayItem_OrderNotExisitsFormat", entity.OrderSysNo); } //填写代收结算单上的CompanyCode为付款单CompanyCode entity.CompanyCode = collectionSettlement.CompanyCode; entity.OrderStatus = (int?)collectionSettlement.SettleStatus; if (collectionSettlement.SettleStatus == GatherSettleStatus.SET) { if (entity.PayStyle != PayItemStyle.Normal) { ThrowBizException("PayItem_Create_OnlyCanAddNormalPayForVendorSettleOrder"); } } else { ThrowBizException("PayItem_Create_SettleStatusInvalid"); } List <PayableInfo> payList = PayableBizProcessor.GetListByCriteria(new PayableInfo { OrderSysNo = entity.OrderSysNo, OrderType = entity.OrderType }); //如果该单据已经有应付了,对该应付作检查 if (payList != null && payList.Count > 0) { ReferencePayableInfo = payList[0]; if (ReferencePayableInfo.PayStatus == PayableStatus.FullPay) { ThrowBizException("PayItem_Create_FullPay"); } } }
/// <summary> /// 创建供应商代收结算信息(人工创建) /// </summary> /// <param name="info"></param> /// <returns></returns> public GatherSettlementInfo CreateGatherSettlement(GatherSettlementInfo info) { info.GatherSettlementItemInfoList = GetAllSettleGatherItems(info); //验证仓库号 : if (null != info.GatherSettlementItemInfoList && 0 < info.GatherSettlementItemInfoList.Count) { foreach (var item in info.GatherSettlementItemInfoList) { //if (item.SettleType != GatherSettleType.RO_Adjust //&& item.StockSysNo != info.SourceStockInfo.SysNo.Value) if (item.StockSysNo != info.SourceStockInfo.SysNo.Value) { //单据号为{0}的{1}单,仓库号和代收单仓库不一致! throw new BizException(string.Format(GetMessageString("Gather_StockNotTheSame"), item.OrderSysNo, item.SettleType.ToString())); } } } ///创建操作: info.SettleStatus = GatherSettleStatus.ORG; using (TransactionScope ts = new TransactionScope()) { info.TotalAmt = info.GatherSettlementItemInfoList.Sum(i => (i.SalePrice * i.ProductQuantity) + (i.PromotionDiscount.HasValue?i.PromotionDiscount.Value:0)); GatherSettlementDA.CreateGatherSettlement(info); //发送创建Message EventPublisher.Publish(new CreateGatherSettlementMessage() { SettlementSysNo = info.SysNo.Value, CurrentUserSysNo = ServiceContext.Current.UserSysNo }); //写日志: CommonService.WriteLog<VendorSettleGatherEntity>(entity, " Create Gather ", entity.SysNo.Value.ToString(), (int)LogType.Purchase_Verify_InStock); ExternalDomainBroker.CreateLog(" Create Gather " , BizEntity.Common.BizLogType.Purchase_Verify_InStock , info.SysNo.Value , info.CompanyCode); ts.Complete(); } return(info); }
/// <summary> /// 代收结算单 - 作废 /// </summary> /// <param name="info"></param> /// <returns></returns> public GatherSettlementInfo AbandonGatherSettlement(GatherSettlementInfo info) { info.SettleStatus = GatherSettleStatus.ABD; GatherSettlementDA.UpdateGatherSettlementStatus(info, false); //发送作废Message EventPublisher.Publish(new GatherSettlementAbandonedMessage() { SettlementSysNo = info.SysNo.Value, CurrentUserSysNo = ServiceContext.Current.UserSysNo }); //写LOG;CommonService.WriteLog<VendorSettleGatherEntity>(entity, " Abandon Gather ", entity.SysNo.Value.ToString(), (int)LogType.Purchase_Verify_InStock); ExternalDomainBroker.CreateLog(" Abandon Gather " , BizEntity.Common.BizLogType.Purchase_Verify_InStock , info.SysNo.Value , info.CompanyCode); return(info); }
public GatherSettlementInfo LoadGatherSettlement(GatherSettlementInfo info) { GatherSettlementInfo settle = new GatherSettlementInfo(); CustomDataCommand command = DataCommandManager.CreateCustomDataCommandFromConfig("GetVendorSettleGatherBySysNo"); using (DynamicQuerySqlBuilder builder = new DynamicQuerySqlBuilder(command.CommandText, command, null, "Settle.SysNo DESC")) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "Settle.SysNo", DbType.Int32, "@SettleSysNo", QueryConditionOperatorType.Equal, info.SysNo); command.CommandText = builder.BuildQuerySql(); } settle = command.ExecuteEntity <GatherSettlementInfo>(); return(settle); }
/// <summary> /// 代收结算单 - 取消结算 /// </summary> /// <param name="info"></param> /// <returns></returns> public GatherSettlementInfo CancelSettleGatherSettlement(GatherSettlementInfo info) { //1 检查当前结算单状态 if (info.SettleStatus != GatherSettleStatus.SET) { //当前结算单的状态不为已结算状态! throw new BizException(GetMessageString("Gather_Settle_Invalid")); } ////2 检查付款单是否作废,如果付款单未作废抛出异常(调用Invoice接口) if (!ExternalDomainBroker.IsAbandonGatherPayItem(info.SysNo.Value)) { throw new BizException(GetMessageString("Gather_Settle_Abandon_CancelSettle")); } GatherSettlementInfo oldSettle = GatherSettlementDA.GetVendorSettleGatherInfo(info); if (info.SettleStatus != GatherSettleStatus.SET) { //该结算单不是已结算状态,不能进行取消结算操作! throw new BizException(GetMessageString("Gather_Settle_Invalid_CancelSettle")); } info.SettleStatus = GatherSettleStatus.AUD; GatherSettlementDA.UpdateGatherSettlementStatus(info, false); //发送取消结算Message EventPublisher.Publish(new GatherSettlementSettleCanceledMessage() { SettlementSysNo = info.SysNo.Value, CurrentUserSysNo = ServiceContext.Current.UserSysNo }); //写LOG:CommonService.WriteLog<VendorSettleGatherEntity>(entity, " CancelSettled Gather ", entity.SysNo.Value.ToString(), (int)LogType.Purchase_Verify_InStock); ExternalDomainBroker.CreateLog(" CancelSettled Gather " , BizEntity.Common.BizLogType.Purchase_Verify_InStock , info.SysNo.Value , info.CompanyCode); return(info); }
/// <summary> /// 代收结算单 - 结算 /// </summary> /// <param name="info"></param> /// <returns></returns> public GatherSettlementInfo SettleGatherSettlement(GatherSettlementInfo info) { info.SettleStatus = GatherSettleStatus.SET; GatherSettlementInfo oldSettle = GatherSettlementDA.GetVendorSettleGatherInfo(info); if (oldSettle.SettleStatus != GatherSettleStatus.AUD) { //该结算单不是已审核状态,不能进行结算操作! throw new BizException(GetMessageString("Gather_Audited_Invalid_Settle")); } GatherSettlementDA.UpdateGatherSettlementSettleStatus(info); //调用Invoice接口,创建PayItem: ExternalDomainBroker.CreatePayItem( new PayItemInfo() { OrderSysNo = info.SysNo.Value, PayAmt = info.TotalAmt, OrderType = PayableOrderType.CollectionSettlement, PayStyle = PayItemStyle.Normal }); //发送结算Message EventPublisher.Publish(new GatherSettlementSettledMessage() { SettlementSysNo = info.SysNo.Value, CurrentUserSysNo = ServiceContext.Current.UserSysNo }); //写Log: //CommonService.WriteLog<VendorSettleGatherEntity>(entity, " Settle Gather ", entity.SysNo.Value.ToString(), (int)LogType.Purchase_Verify_InStock); ExternalDomainBroker.CreateLog(" Settle Gather " , BizEntity.Common.BizLogType.Purchase_Verify_InStock , info.SysNo.Value , info.CompanyCode); return(info); }