Example #1
0
      /// <summary>
      /// 设置默认币种及精度绑定
      /// </summary>
      private void SetDefaultCurrency()
      {
          GetProfileValueProxy bpObj = new GetProfileValueProxy();

          bpObj.ProfileCode = "BALocalCurrency";
          bpObj.ProfileOrg  = long.Parse(PDContext.Current.OrgID);
          PVDTOData pVDTOData = bpObj.Do();
          long      currency  = long.Parse(pVDTOData.ProfileValue);
          //if (pVDTOData != null)
          //{
          //    //这个BPHelperExtend是用的一个通用查询BP,如果没有这个BP的话,则自己可写一个BP返回相关下面用到的币种信息即可。
          //    CurrencyData currency = CurrencyData(long.Parse(pVDTOData.ProfileValue));

          //    //参数的默认币种
          //    if (currency != null)
          //    {

          //        //货币符号
          //       // this.ShipPlanDetailFeeHead_ShipPlanDetailFeeLine.cur.DefaultValue = currency.Symbol;
          //        //金额精度
          //        this.ShipPlanDetailFeeHead_ShipPlanDetailFeeLine.FieldCurrency_MoneyRound_Precision.DefaultValue = currency.MoneyRound.Precision;
          //        this.ShipPlanDetailFeeHead_ShipPlanDetailFeeLine.FieldCurrency_MoneyRound_RoundType.DefaultValue = currency.MoneyRound.RoundType;
          //        this.ShipPlanDetailFeeHead_ShipPlanDetailFeeLine.FieldCurrency_MoneyRound_RoundValue.DefaultValue = currency.MoneyRound.RoundValue;
          //        //单价精度
          //        this.ShipPlanDetailFeeHead_ShipPlanDetailFeeLine.FieldCurrency_PriceRound_Precision.DefaultValue = currency.PriceRound.Precision;
          //        this.ShipPlanDetailFeeHead_ShipPlanDetailFeeLine.FieldCurrency_PriceRound_RoundType.DefaultValue = currency.PriceRound.RoundType;
          //        this.ShipPlanDetailFeeHead_ShipPlanDetailFeeLine.FieldCurrency_PriceRound_RoundValue.DefaultValue = currency.PriceRound.RoundValue;
          //    }
          //}
      }
Example #2
0
        public void AfterCreateChildControls()
        {
            GetProfileValueProxy bpObj = new GetProfileValueProxy();

            bpObj.ProfileCode = "SysLineNo";
            PVDTOData pVTDOData = bpObj.Do();

            //行GRID
            ((IAutoRowNo)this.DataGrid10.Columns["LineNum"]).Sequence      = true;
            ((IAutoRowNo)this.DataGrid10.Columns["LineNum"]).SequenceStep  = Int32.Parse(pVTDOData.ProfileValue);
            ((IAutoRowNo)this.DataGrid10.Columns["LineNum"]).SequenceStart = Int32.Parse(pVTDOData.ProfileValue);

            ((IAutoRowNo)this.DataGrid11.Columns["LineNum"]).Sequence      = true;
            ((IAutoRowNo)this.DataGrid11.Columns["LineNum"]).SequenceStep  = Int32.Parse(pVTDOData.ProfileValue);
            ((IAutoRowNo)this.DataGrid11.Columns["LineNum"]).SequenceStart = Int32.Parse(pVTDOData.ProfileValue);

            UFIDA.U9.UI.PDHelper.PersonalizationHelper.SetPersonalizationEnable((UFSoft.UBF.UI.FormProcess.BaseWebForm) this, true);

            //处理弹性域
            UFIDA.U9.UI.PDHelper.FlexFieldHelper.SetDescFlexField(this.FlexFieldPicker0, this.Model.PrePayment, "DescFlexField");

            UFIDA.U9.UI.PDHelper.PDFormMessage.ShowConfirmDialog(this.Page, "46bb3e82-1ef2-45d7-a9ff-51dee196f0de", "580", "408", Title, wpFindID.ClientID, this.BtnFind, null);
            //取得提示信息资源:是否删除当前记录
            string message = PDResource.GetDeleteConfirmInfo();

            //绑定注册弹出对话框到删除按钮
            PDFormMessage.ShowConfirmDialog(this.Page, message, "", this.BtnDelete);
        }
Example #3
0
        /// <summary>
        ///     获取Token操时时间
        /// </summary>
        /// <returns></returns>
        public static int GetTokenTimeoutSecond()
        {
            GetProfileValueProxy getProfileValue = new GetProfileValueProxy();

            getProfileValue.ProfileCode      = "Cust_WS_TokenTimeout";
            getProfileValue.IsThrowException = true;
            PVDTOData pV = getProfileValue.Do();

            return(int.Parse(pV.ProfileValue));
        }
      /// <summary>
      /// 设置默认币种及精度绑定
      /// </summary>
      private void SetDefaultCurrency()
      {
          GetProfileValueProxy bpObj = new GetProfileValueProxy();

          bpObj.ProfileCode = "FTFIFee";
          bpObj.ProfileOrg  = long.Parse(PDContext.Current.OrgID);
          PVDTOData pVDTOData = bpObj.Do();

          if (pVDTOData != null)
          {
              this.ShipPlanDetailHead.FieldFIFeeRate.DefaultValue = pVDTOData.ProfileValue;
          }
      }
Example #5
0
        //public static string GetAddress(string oldurl)
        //{
        //    string str = HttpRuntime.AppDomainAppPath.ToString();
        //    string xmlAddress = "\\bin\\DMSAPIServiceConfig.xml";
        //    str += xmlAddress;

        //    if (File.Exists(str))
        //    {
        //        XmlDocument doc = new XmlDocument();
        //        doc.Load(str);
        //        XmlNodeList list = null;

        //        //list = doc.GetElementsByTagName("services");

        //        if (Context.LoginOrg.Code == Const_OrgCode_Electric)
        //        {
        //            list = doc.GetElementsByTagName("servicesElectric");
        //        }
        //        else if (Context.LoginOrg.Code == Const_OrgCode_Hubei
        //            || Context.LoginOrg.Code == Const_OrgCode_Chengdu
        //            )
        //        {
        //            list = doc.GetElementsByTagName("servicesHubei");
        //        }

        //        if (list != null
        //            && list.Count > 0
        //            && list[0] != null
        //            )
        //        {
        //            string newurl = list[0].Attributes["url"].Value;
        //            //string strr = oldurl.Replace("http://", "");
        //            //int t = strr.IndexOf("/");
        //            //string h = strr.Substring(0, t);
        //            //return oldurl.Replace(h, newurl);

        //            int index = oldurl.LastIndexOf("/");
        //            string svName = oldurl.Substring(index);

        //            newurl += svName;

        //            return newurl;
        //        }
        //        else
        //        {
        //            string strIP = GetInternalIP();

        //            throw new BusinessException(string.Format("没有找到服务器[{0}]组织[{1}]对应的DMS地址,请检查配置文件内容[{2}]!"
        //                , strIP
        //                , Context.LoginOrg.Name + "," + Context.LoginOrg.Code
        //                , xmlAddress
        //                ));
        //        }
        //    }
        //    else
        //    {
        //        string strIP = GetInternalIP();

        //        throw new BusinessException(string.Format("没有找到服务器[{0}]组织[{1}]对应的DMS配置文件,请检查配置文件是否存在[{2}]!"
        //            , strIP
        //            , Context.LoginOrg.Name + "," + Context.LoginOrg.Code
        //            , xmlAddress
        //            ));
        //    }
        //}

        #endregion

        public static bool IsUsedDMSAPI()
        {
            string returnvalue         = string.Empty;
            GetProfileValueProxy bpObj = new GetProfileValueProxy();

            bpObj.ProfileCode = ("IsUsedDMSAPI");
            PVDTOData pVTDOData = bpObj.Do();

            if (pVTDOData != null)
            {
                returnvalue = pVTDOData.ProfileValue;
            }
            return(!(returnvalue.ToLower() == "false"));
        }
Example #6
0
        public void AfterCreateChildControls()
        {
            //传递隐藏域wpFindID的客户端ID;注意:隐藏域wpFindID会记录参照选择的记录ID;
            UFIDA.U9.UI.PDHelper.PDFormMessage.ShowConfirmDialog(this.Page, "20c7184a-cbe8-456a-a04a-7009ff19ae3f", "580", "408", Title, wpFindID.ClientID, this.BtnFind, null);
            //设置默认行号
            GetProfileValueProxy bpObj = new GetProfileValueProxy();

            bpObj.ProfileCode = "SysLineNo";
            PVDTOData pVTDOData = bpObj.Do();

            ((IAutoRowNo)this.DataGrid5.Columns["RowNo"]).Sequence      = true;
            ((IAutoRowNo)this.DataGrid5.Columns["RowNo"]).SequenceStep  = Int32.Parse(pVTDOData.ProfileValue);
            ((IAutoRowNo)this.DataGrid5.Columns["RowNo"]).SequenceStart = Int32.Parse(pVTDOData.ProfileValue);
        }
        public void AfterCreateChildControls()
        {
            //取得当前卡片参照的属性变量:FormID、Width、Height、Title;
            //传递隐藏域wpFindID的客户端ID;注意:隐藏域wpFindID会记录参照选择的记录ID;
            UFIDA.U9.UI.PDHelper.PDFormMessage.ShowConfirmDialog(this.Page, "26d05bf6-2094-4412-b87e-25251e5bba52", "580", "408", Title, wpFindID.ClientID, this.BtnFind, null);
            FlexFieldHelper.SetDescFlexField(this.FlexFieldPicker0, this.Model.BillNoItemHead);//启用弹性域
            //行号设置
            GetProfileValueProxy bpObj = new GetProfileValueProxy();

            bpObj.ProfileCode = "SysLineNo";
            bpObj.ProfileOrg  = long.Parse(PDContext.Current.OrgID);

            PVDTOData pVDTOData = bpObj.Do();

            SetGridAutoNumber(this.DataGrid5, "RowNo", pVDTOData);
            CellDataChangedPostBack();
        }
Example #8
0
        public void AfterCreateChildControls()
        {
            //传递隐藏域wpFindID的客户端ID;注意:隐藏域wpFindID会记录参照选择的记录ID;
            UFIDA.U9.UI.PDHelper.PDFormMessage.ShowConfirmDialog(this.Page, "97448199-3fa7-44e8-9f1a-a90e2c830a41", "580", "408", Title, wpFindID.ClientID, this.BtnFind, null);
            FlexFieldHelper.SetDescFlexField(this.FlexFieldPicker0, this.Model.DiscountHead);//启用弹性域
            //行号设置
            GetProfileValueProxy bpObj = new GetProfileValueProxy();

            bpObj.ProfileCode = "SysLineNo";
            bpObj.ProfileOrg  = long.Parse(PDContext.Current.OrgID);
            PVDTOData pVDTOData = bpObj.Do();

            SetGridAutoNumber(this.DataGrid5, "RowNo", pVDTOData);

            Register_CallBack_Fee_DoCustomerAction();
            CustGridControl_Discount();
            CustGridControl_Prices();
        }
        public void AfterCreateChildControls()
        {
            PDFormMessage.ShowConfirmDialog(this.Page, "b8f14aa2-0341-404a-8208-7948bb6eb946", "580", "408", Title, wpFindID.ClientID, this.BtnFind, null);//绑定查找菜单
            //取得提示信息资源:是否删除当前记录
            string message = PDResource.GetDeleteConfirmInfo();

            //绑定注册弹出对话框到删除按钮
            PDFormMessage.ShowConfirmDialog(this.Page, message, "", this.BtnDelete);
            PDFormMessage.ShowConfirmDialog(this.Page, "确认放弃当前记录?", "", this.BtnCancel);
            //设置默认行号
            GetProfileValueProxy bpObj = new GetProfileValueProxy();

            bpObj.ProfileCode = "SysLineNo";
            PVDTOData pVTDOData = bpObj.Do();

            //行GRID
            ((IAutoRowNo)this.DataGrid8.Columns["RowNo"]).Sequence      = true;
            ((IAutoRowNo)this.DataGrid8.Columns["RowNo"]).SequenceStep  = Int32.Parse(pVTDOData.ProfileValue);
            ((IAutoRowNo)this.DataGrid8.Columns["RowNo"]).SequenceStart = Int32.Parse(pVTDOData.ProfileValue);
            CellDataChangedPostBack();
        }
        public void AfterCreateChildControls()
        {
            //传递隐藏域wpFindID的客户端ID;注意:隐藏域wpFindID会记录参照选择的记录ID;
            UFIDA.U9.UI.PDHelper.PDFormMessage.ShowConfirmDialog(this.Page, "1f33826d-a184-48e2-9d7e-6a340eb6fb41", "580", "408", Title, wpFindID.ClientID, this.BtnFind, null);
            FlexFieldHelper.SetDescFlexField(this.FlexFieldPicker0, this.Model.BrokerageHead);//启用弹性域
            //设置默认行号
            GetProfileValueProxy bpObj = new GetProfileValueProxy();

            bpObj.ProfileCode = "SysLineNo";
            PVDTOData pVTDOData = bpObj.Do();

            ((IAutoRowNo)this.DataGrid5.Columns["RowID"]).Sequence      = true;
            ((IAutoRowNo)this.DataGrid5.Columns["RowID"]).SequenceStep  = Int32.Parse(pVTDOData.ProfileValue);
            ((IAutoRowNo)this.DataGrid5.Columns["RowID"]).SequenceStart = Int32.Parse(pVTDOData.ProfileValue);

            //this.Model.BrokerageHead_BrokerageLine.FocusedRecord.ValidDate = DateTime.Now;
            //this.Model.BrokerageHead_BrokerageLine.FocusedRecord.UnValidDate = DateTime.MaxValue;
            //this.DataGrid5.Columns["Valid"].Visible = true;//

            Register_CallBack_Fee_DoCustomerAction();
        }
        public void AfterCreateChildControls()
        {
            //查找
            //取得当前卡片参照的属性变量:FormID、Width、Height、Title;
            //传递隐藏域wpFindID的客户端ID;注意:隐藏域wpFindID会记录参照选择的记录ID;
            //PDFormMessage.ShowConfirmDialog(this.Page, "c94a196b-f36d-49af-bf4f-cbd67012e042", Title, wpFindID.ClientID, this.BtnFind, null);

            //拉单
            // PDFormMessage.ShowConfirmDialog(this.Page, "2a8fdf43-38d4-4108-bc9c-dc254cc314b1","820","680", Title, wpFindID.ClientID,(IUFButton)this.PODocNO90, null);



            // 实现个性化
            UFIDA.U9.UI.PDHelper.PersonalizationHelper.SetPersonalizationEnable(this, true);

            // 实现删除提示是否需要删除
            //UFIDA.U9.UI.PDHelper.PDFormMessage.ShowDelConfirmDialog(this.Page, UFIDA.U9.UI.PDHelper.PDResource.GetDeleteConfirmInfo(), "是否删除该记录信息", this.BtnDelete);


            // 提示是否需要取消
            UFIDA.U9.UI.PDHelper.PDFormMessage.ShowDelConfirmDialog(this.Page, "确定取消预装柜", "是否取消预装柜", this.BtnClose);

            PDFormMessage.ShowConfirmDialog(this.Page, "确定装柜?", "", this.BtnOk);
            //实现弹性域控件绑定
            FlexFieldHelper.SetDescFlexField(this.FlexFieldPicker0, this.Model.InstalledArkHead);

            //设置默认行号
            GetProfileValueProxy bpObj = new GetProfileValueProxy();

            bpObj.ProfileCode = "SysLineNo";
            PVDTOData pVTDOData = bpObj.Do();

            //行GRID
            ((IAutoRowNo)this.DataGrid12.Columns["RowNo"]).Sequence      = true;
            ((IAutoRowNo)this.DataGrid12.Columns["RowNo"]).SequenceStep  = Int32.Parse(pVTDOData.ProfileValue);
            ((IAutoRowNo)this.DataGrid12.Columns["RowNo"]).SequenceStart = Int32.Parse(pVTDOData.ProfileValue);

            SumDeliveryCellDataChangedPostBack();//柜明细行:装柜数量改变事件
        }
        public void AfterCreateChildControls()
        {
            PDFormMessage.ShowConfirmDialog(this.Page, "a2444b4f-df60-4e10-a78e-2d9f2a4ade08", "580", "408", Title, wpFindID.ClientID, this.BtnFind, null); //绑定查找菜单
            FlexFieldHelper.SetDescFlexField(this.FlexFieldPicker0, this.Model.SoOrderSaleHead);                                                            //启用弹性域
            //行号设置
            GetProfileValueProxy bpObj = new GetProfileValueProxy();

            bpObj.ProfileCode = "SysLineNo";
            PVDTOData pVTDOData = bpObj.Do();

            ((IAutoRowNo)this.DataGrid5.Columns["RowNo"]).Sequence      = true;
            ((IAutoRowNo)this.DataGrid5.Columns["RowNo"]).SequenceStep  = Int32.Parse(pVTDOData.ProfileValue);
            ((IAutoRowNo)this.DataGrid5.Columns["RowNo"]).SequenceStart = Int32.Parse(pVTDOData.ProfileValue);

            this.DataGrid5.Columns["RowNo"].Enabled = false; //行号不可编辑
            this.DocumentSate109.Enabled            = false; //状态不可编辑

            string message = PDResource.GetDeleteConfirmInfo();

            //绑定注册弹出对话框到删除按钮
            PDFormMessage.ShowConfirmDialog(this.Page, message, "", this.BtnDelete);
        }
Example #13
0
        private List <ShipPlanIDDTO> CreatShipPlanList(CreatShipPlan bpObj)
        {
            List <ShipPlanIDDTO> listShip = new List <ShipPlanIDDTO>();

            using (ISession session = Session.Open())
            {
                ShipPlanDetailBE.ShipPlanDetailHead shipPlan = ShipPlanDetailBE.ShipPlanDetailHead.Create();
                ShipDetailTypeBE.ShipDetailType     formType = ShipDetailTypeBE.ShipDetailType.Finder.Find("IsCreatedByPush=1");
                if (formType == null)
                {
                    throw new Exception("未设置出运明细单生单的单据类型,请设置出运明细单单据类型为“上游单据推出”");
                }
                shipPlan.DocumnetType       = formType;
                shipPlan.SourceDocumnetType = AllEnumBE.SourceTypeEnum.SoOrder;
                shipPlan.Status             = AllEnumBE.DocumnetSate.OpenState;        //单据状态
                shipPlan.ShipPlanState      = AllEnumBE.ShipPlanStateEnum.NotShipPlan; //出运状态
                shipPlan.BusinessDate       = DateTime.Now;
                //设置默认行号
                GetProfileValueProxy lineNo = new GetProfileValueProxy();
                lineNo.ProfileCode = "SysLineNo";
                PVDTOData pVTDOData = lineNo.Do();
                string    row       = pVTDOData.ProfileValue;

                //财务费率
                decimal fiFeeRate           = 0;
                GetProfileValueProxy bpObj1 = new GetProfileValueProxy();
                bpObj1.ProfileCode = "FTFIFee";
                bpObj1.ProfileOrg  = Base.Context.LoginOrg.ID;
                PVDTOData pVDTOData = bpObj1.Do();
                if (pVDTOData != null && pVDTOData.ProfileValue != null)
                {
                    fiFeeRate = decimal.Parse(pVDTOData.ProfileValue);
                }

                string docNo = "", shipplingType = "", soLine = "";
                long   customer = 0, currenty = 0;
                int    count = 1;


                foreach (SOLineIDDTO lineDto in bpObj.SOLineIDDTO)
                {
                    UFIDA.U9.SM.SO.SOLine line = SM.SO.SOLine.Finder.FindByID(lineDto.SOLine);
                    if (line == null)
                    {
                        continue;
                    }
                    //不同的客户、币种、装箱方式不允许拉式生成同一个出运明细单
                    if (count > 1)
                    {
                        if (customer != 0 && customer != line.SO.OrderBy.Customer.ID)
                        {
                            throw new Exception("销售订单" + line.SO.DocNo + "的客户与单号" + docNo + "的客户不一致,不能生成同一个出运明细单");
                        }
                        if (currenty != 0 && currenty != line.SO.TC.ID)
                        {
                            throw new Exception("销售订单" + line.SO.DocNo + "的币种与单号" + docNo + "的币种不一致,不能生成同一个出运明细单");
                        }
                        if (shipplingType != "" && shipplingType != line.DescFlexField.PubDescSeg11)
                        {
                            throw new Exception("销售订单" + line.SO.DocNo + "行号" + line.DocLineNo + "的装箱方式与单号" + docNo + "行号" + soLine + "装箱方式不一致,不能生成同一个出运明细单");
                        }
                    }
                    docNo         = line.SO.DocNo;
                    customer      = line.SO.OrderBy.Customer.ID;
                    currenty      = line.SO.TC.ID;
                    shipplingType = line.DescFlexField.PubDescSeg11;
                    soLine        = line.DocLineNo.ToString();

                    //赋值表头信息
                    shipPlan.SaleMan = line.SO.Seller;           //业务员
                    shipPlan.Client  = line.SO.OrderBy.Customer; //客户
                    if (line.SO.OrderBy.Customer != null)
                    {
                        // shipPlan.Consignee = line.SO.OrderBy.Customer.a
                        //提箱港区	地区档案	从销售订单带出,从客户带出
                        if (line.SO.OrderBy.Customer.Territory != null)
                        {
                            shipPlan.CargoPort = line.SO.OrderBy.Customer.Territory;//
                        }
                    }
                    if (line.SO.ShipToSite != null && line.SO.ShipToSite.CustomerSite != null)//收货位置
                    {
                        //shipPlan.
                    }
                    shipPlan.Department = line.SO.SaleDepartment; //部门
                    shipPlan.Currency   = line.SO.TC;             //币种
                    shipPlan.DealMode   = line.SO.BargainMode;    //成交方式
                    //贸易国别	国家\地区档案	从销售订单带出
                    //shipPlan.Country = line.SO.
                    shipPlan.Transportation = line.SO.TransMode;
                    //
                    if (line.SO.DescFlexField.PrivateDescSeg14 != "")
                    {
                        Base.Organization.Organization org = Base.Organization.Organization.FindByCode(line.SO.DescFlexField.PrivateDescSeg14);
                        if (org != null)
                        {
                            shipPlan.GetOrderOrg = org;
                        }
                        else
                        {
                            throw new Exception("销售订单" + line.SO.DocNo + "接单组织为空,不能生成出运明细单");
                        }
                    }
                    else
                    {
                        throw new Exception("销售订单" + line.SO.DocNo + "接单组织为空,不能生成出运明细单");
                    }

                    //出口口岸	港口档案	从销售订单带出
                    shipPlan.ExportPort = line.SO.ShippingPort;
                    //进港区	地区档案	从销售订单带出
                    //shipPlan.IntoPort
                    //目的口岸	港口档案	从销售订单带出
                    shipPlan.DestinationPort = line.SO.AimPort;
                    //运输方式
                    shipPlan.Transportation = line.SO.TransMode;
                    //贸易方式
                    shipPlan.TradeMode = line.SO.TradeMode;
                    //收汇天数,从销售订单公共扩展字段1带出
                    if (line.SO.OrderBy.CustomerKey.GetEntity().DescFlexField.PubDescSeg1 == "")
                    {
                        shipPlan.NumberDay = 0;
                    }
                    else
                    {
                        shipPlan.NumberDay = Convert.ToInt32(line.SO.OrderBy.CustomerKey.GetEntity().DescFlexField.PubDescSeg1);
                    }

                    //赋值表体信息
                    ShipPlanDetailBE.ShipPlanDetailLine shipLine = ShipPlanDetailBE.ShipPlanDetailLine.Create(shipPlan);
                    //包装工厂	值集值	从销售订单行带出
                    //Base.FlexField.ValueSet.DefineValue flexField = Base.FlexField.ValueSet.DefineValue.Finder.Find("Code='Z022'");
                    if (line.DescFlexField.PrivateDescSeg18 != "")
                    {
                        Base.FlexField.ValueSet.DefineValue flexField = Base.FlexField.ValueSet.DefineValue.Finder.Find("ValueSetDef.Code='Z002' and Code='" + line.DescFlexField.PrivateDescSeg18 + "'");
                        // flexField.ValueSetDef.CodeAttribute
                        shipLine.PackingHouse = flexField;
                    }

                    if (line.DescFlexField.PrivateDescSeg12 != "") //验货方式直接
                    {
                        Base.FlexField.ValueSet.DefineValue flexField = Base.FlexField.ValueSet.DefineValue.Finder.Find("ValueSetDef.Code='Z009' and Code='" + line.DescFlexField.PrivateDescSeg12 + "'");
                        shipLine.ExamineCargoMode = flexField;
                        //shipLine.ExamineCargoMode = AllEnumBE.ExamineCargoModeEnum.GetFromValue(line.DescFlexField.PrivateDescSeg12);
                    }
                    //else
                    //    shipLine.ExamineCargoMode = AllEnumBE.ExamineCargoModeEnum.Empty;
                    shipLine.RowNo     = Convert.ToInt32(row);
                    shipLine.SrcSO     = line.SO;
                    shipLine.SrcDocNo  = line.SO.DocNo;
                    shipLine.SrcLineID = line.ID;
                    shipLine.SrcLineNo = line.DocLineNo.ToString();
                    //shipLine.SrcSOKey  = line.
                    if (line.ItemInfo == null || line.ItemInfo.ItemID == null)
                    {
                        throw new Exception("销售订单" + line.SO.DocNo + "行" + line.DocLineNo + "找不见对应料品信息,不能生成出运明细单");
                    }
                    shipLine.Item       = line.ItemInfo.ItemID;
                    shipLine.Standard   = line.ItemInfo.ItemID.SPECS;
                    shipLine.NumberUom  = line.TU;
                    shipLine.Ultimately = line.FinallyPriceTC;//最终价
                    //外销价	十进制	销售订单带出
                    if (line.DescFlexField.PrivateDescSeg5 != "")
                    {
                        shipLine.ExportSales = decimal.Parse(line.DescFlexField.PrivateDescSeg5);//外销价
                    }
                    shipLine.Qty            = lineDto.ShipQty;
                    shipPlan.FinancialCost += shipPlan.FinancialCost + (shipLine.ExportSales * shipLine.Qty * fiFeeRate / 100);
                    //反写销售订单已出运数量
                    //if (line.DescFlexField.PrivateDescSeg8 != "")
                    //{
                    //    line.DescFlexField.PrivateDescSeg8 = (decimal.Parse(line.DescFlexField.PrivateDescSeg8) + lineDto.ShipQty).ToString();//反写销售订单行的已出运数量
                    //}
                    //else
                    //    line.DescFlexField.PrivateDescSeg8 = lineDto.ShipQty.ToString();

                    //验货方式销售订单行私有字段12

                    //带出料品的总箱数、内箱数、外箱数、毛重、净重、体积、长、宽、高,体积、总体积
                    //料品的字表字段
                    ItemSubTable itemsub = ItemSubTable.Finder.Find("ItemMaster=" + line.ItemInfo.ItemID.ID);
                    if (itemsub != null)
                    {
                        //string sumBoxNumber = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg3;//料品的扩展字段;箱数
                        //string inBoxNumber = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg27;//料品的扩展字段;内箱数
                        //string outerBoxNumber = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg28;//料品的扩展字段;外箱数
                        //string grossWeight = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg2;//料品的扩展字段:毛重
                        ////string netWeight = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg3;//料品的扩展字段:净重
                        //string length = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg8;//料品的扩展字段:长
                        //string weith = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg9;//料品的扩展字段:宽
                        //string hight = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg10;//料品的扩展字段:高

                        //string sumBoxNumber = itemsub.BoxNumber; ;//料品的扩展字段;箱数
                        //string inBoxNumber = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg27;//料品的扩展字段;内箱数
                        //string outerBoxNumber = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg28;//料品的扩展字段;外箱数
                        //string grossWeight = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg2;//料品的扩展字段:毛重
                        ////string netWeight = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg3;//料品的扩展字段:净重
                        //string length = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg8;//料品的扩展字段:长
                        //string weith = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg9;//料品的扩展字段:宽
                        //string hight = line.ItemInfo.ItemIDKey.GetEntity().DescFlexField.PrivateDescSeg10;//料品的扩展字段:高

                        shipLine.SumBoxNumber   = itemsub.BoxNumber;
                        shipLine.InBoxNumber    = itemsub.InnerBoxNumber;
                        shipLine.OuterBoxNumber = itemsub.OutBoxNumber;
                        shipLine.GrossWeight    = itemsub.GrossWeight;                 //毛重
                        shipLine.NetWeight      = itemsub.NetWeight;                   //净重
                        shipLine.SumGross       = shipLine.GrossWeight * shipLine.Qty; //总毛重
                        shipLine.Length         = itemsub.BoxLong;
                        shipLine.Weith          = itemsub.BoxWidth;
                        shipLine.Higth          = itemsub.BoxHight;
                        shipLine.Bulks          = shipLine.Length * shipLine.Weith * shipLine.Higth; //体积
                        shipLine.SumBulk        = shipLine.Bulks * shipLine.Qty;                     //总体积
                    }

                    #region 产生佣金表,放到BE里生成
                    //if (line.DescFlexField.PrivateDescSeg6.ToLower() == "true")
                    //{
                    //    OrderLineBrokerage.EntityList brokerage = OrderLineBrokerage.Finder.FindAll("OrderLineID='" + line.ID + "'");
                    //    if (brokerage != null && brokerage.Count > 0)
                    //    {
                    //        OrderLineBrokerage shipLineBroke = null;
                    //        foreach (OrderLineBrokerage orderBrokerage in brokerage)
                    //        {
                    //            shipLineBroke = OrderLineBrokerage.Create();
                    //            shipLineBroke.SourceType = AllEnumBE.SourceTypeEnum.ShipPlanDoc;
                    //            shipLineBroke.ShipPlanLine = shipLine;
                    //            shipLineBroke.ShipPlanRowNo = int.Parse(row);
                    //            shipLineBroke.Client = orderBrokerage.Client;
                    //            shipLineBroke.Product = orderBrokerage.Product;
                    //            shipLineBroke.BrokerageRatio = orderBrokerage.BrokerageRatio;
                    //            shipLineBroke.Payee = orderBrokerage.Payee;
                    //            shipLineBroke.PayAmount = orderBrokerage.PayAmount;
                    //            shipLineBroke.PayCurrency = orderBrokerage.PayCurrency;
                    //            shipLineBroke.OutPayment = orderBrokerage.OutPayment;
                    //            shipLineBroke.OrderCurrency = orderBrokerage.OrderCurrency;
                    //            shipLineBroke.Rate = orderBrokerage.Rate;
                    //        }
                    //    }
                    //}
                    #endregion

                    row = (int.Parse(row) + int.Parse(pVTDOData.ProfileValue)).ToString();
                    count++;
                }
                session.Commit();
                ShipPlanIDDTO shipID = new ShipPlanIDDTO();
                shipID.DocNo    = shipPlan.DocNo;
                shipID.ShipPlan = shipPlan.ID;
                listShip.Add(shipID);
            }
            return(listShip);
        }
        /// <summary>
        /// 创建包装业务员奖金
        /// </summary>
        /// <param name="bpObj">BP入口参数:会计期间集合</param>
        /// <param name="dsPayment">付款通知单数据集</param>
        /// <param name="bonusCoefficient">奖金系数</param>
        /// <param name="degradationCoefficient">降价系数</param>
        /// <param name="DeliveryExpectDay">基准交期</param>
        private string CreatePackagingOperatorBonus(CalculateOperatorBonus bpObj, DataTable dsPayment, decimal packaingBonusCoefficient)
        {
            if (dsPayment == null || dsPayment.Rows.Count == 0)
            {
                return("");
            }
            var groupOperators             = dsPayment.Rows.Cast <DataRow>().GroupBy(t => t["Operators_Code"].ToString());
            BonusOperatorDocType bonusType = BonusOperatorDocType.Finder.Find("BuzType=1 and IsCreatedByPush=1");

            if (bonusType == null)
            {
                throw new Exception("请设置产品包装业务员单据类型并设置为上游单据推出");
            }
            using (ISession session = Session.Open())
            {
                BonusPackagingDoc bonusProduct = BonusPackagingDoc.Create();
                bonusProduct.DocumentTypeKey = bonusType.Key; //单据类型
                bonusProduct.BusinessDate    = DateTime.Now;  //业务日期
                bonusProduct.Status          = EnumBE.FICommonStatusEnum.Opened;
                if (bpObj.BonusCalcuteList[0].SOBAccountingPeriod != null && bpObj.BonusCalcuteList[0].SOBAccountingPeriod.AccountPeriod != null)
                {
                    bonusProduct.AccountPeriodKey = bpObj.BonusCalcuteList[0].SOBAccountingPeriod.AccountPeriod.AccountingCalendarKey; //会计日历
                }
                bonusProduct.CurrencyKey = Base.Currency.Currency.Finder.Find("Code='C001'").Key;                                      //币种只会为人民币,
                bonusProduct.Oprator     = Base.Context.LoginUser;
                bonusProduct.OprateDate  = DateTime.Now;

                //设置默认行号
                GetProfileValueProxy lineNo = new GetProfileValueProxy();
                lineNo.ProfileCode = "SysLineNo";
                PVDTOData pVTDOData = lineNo.Do();
                string    row       = pVTDOData.ProfileValue;
                //根据业务员分组后的付款通知单数据
                foreach (var groupOperator in groupOperators)
                {
                    decimal sumPayment           = 0; //付款单总额,
                    decimal sumPerformance       = 0; //业绩单总额
                    decimal productBonusTotal    = 0; //新产品奖金合计
                    decimal depreciateBonusTotal = 0; //降价奖金合计
                    decimal bonusTotal           = 0; //奖金合计
                    long    operatorsKey         = Convert.ToInt64(groupOperator.First <DataRow>()["Operators"].ToString());
                    long    dept = Convert.ToInt64(groupOperator.First <DataRow>()["Department"].ToString());
                    BonusPackagingDocLine productLine = BonusPackagingDocLine.Create(bonusProduct); //业务员奖金明细行
                    productLine.DocLineNo = Convert.ToInt32(row);                                   //行号
                    if (operatorsKey > 0)
                    {
                        productLine.OperatorsKey = CBO.HR.Operator.Operators.Finder.FindByID(operatorsKey).Key;//业务员
                    }
                    if (dept > 0)
                    {
                        productLine.DepartmentKey = CBO.HR.Department.Department.Finder.FindByID(dept).Key;//部门
                    }
                    //设置默认行号
                    string subRow = pVTDOData.ProfileValue;
                    foreach (DataRow Operator in groupOperator)
                    {
                        if (Convert.ToInt32(Operator["SrcDocType"].ToString()) != EnumBE.PaySrcDocTypeEnum.Rcv.Value)
                        {
                            continue;
                        }
                        BonusPackagingDocSubLine subLine = BonusPackagingDocSubLine.Create(productLine);
                        subLine.DocLineNo     = Convert.ToInt32(subRow);
                        subLine.OperatorsKey  = CBO.HR.Operator.Operators.Finder.FindByID(operatorsKey).Key; //业务员
                        subLine.DepartmentKey = CBO.HR.Department.Department.Finder.FindByID(dept).Key;      //部门
                        decimal payment = decimal.Parse(Operator["Payment"].ToString());                     //付款单金额,转换成人民币
                        subLine.PaymentMey = payment;                                                        //付款单小类金额
                        sumPayment        += payment;
                        //获得产品系数档案
                        ProductCoefficient coefficient = ProductCoefficient.Finder.Find("ItemMaster.Code='" + Operator["Item_Code"].ToString() + "'");
                        if (coefficient == null)
                        {
                            throw new Exception("料品" + Operator["Item_Code"].ToString() + " " + Operator["Item_Name"].ToString() + "没有维护类别系数档案");
                        }
                        subLine.CategoryCoefficient = coefficient;                                                                                                         //类别系数
                        subLine.PaymentRowCount     = groupOperator.Where <DataRow>(p => p["PaymentID"].ToString() == Operator["PaymentID"].ToString()).Count <DataRow>(); //付款单行数

                        decimal customerCoefficient = 1;
                        //1、如果来源采购订单有接单客户则算取出客户的客户难易系数,否则默认1
                        if (Operator["Customer"].ToString() != "")
                        {
                            CBO.SCM.Customer.Customer customer = CBO.SCM.Customer.Customer.Finder.FindByID(Operator["Customer"].ToString());
                            if (customer != null && customer.DescFlexField.PubDescSeg24 != "")
                            {
                                customerCoefficient = decimal.Parse(customer.DescFlexField.PubDescSeg24);
                            }
                        }
                        subLine.CustomerCoefficient = customerCoefficient;      //客户难易系数
                        subLine.ItemCoefficient     = packaingBonusCoefficient; //小类奖金系数
                        //计算奖金:付款通知单行数*类别系数*客户难易系数 + 付款单小类金额*千分之4*客户难易系数
                        subLine.Bonus = subLine.PaymentRowCount * coefficient.Coefficien * customerCoefficient * +payment * packaingBonusCoefficient * customerCoefficient;
                        //subLine.ExpectMey = //预期奖金
                        subLine.PaymentDocKey = PaymentBE.Payment.Finder.FindByID(Operator["PaymentID"].ToString()).Key;
                        subLine.PaymentDocNo  = Operator["Payment_DocNo"].ToString();
                        subLine.ItemKey       = CBO.SCM.Item.ItemMaster.Finder.FindByID(Operator["Item"].ToString()).Key;
                        subLine.SrcDocLineNo  = Convert.ToInt32(Operator["SrcDocLineNo"].ToString());

                        //降价奖金
                        subRow = (int.Parse(subRow) + int.Parse(pVTDOData.ProfileValue)).ToString();//自增行号
                    }
                    productLine.SumPayment = sumPayment;

                    productLine.BonusTotal = bonusTotal;
                    row = (int.Parse(row) + int.Parse(pVTDOData.ProfileValue)).ToString();//自增行号
                }
                session.Commit();
                return(bonusProduct.DocNo);
            }
        }
        /// <summary>
        /// 创建采购业务员奖金
        /// </summary>
        /// <param name="bpObj">BP入口参数:会计期间集合</param>
        /// <param name="dsPayment">付款通知单数据集</param>
        /// <param name="bonusCoefficient">奖金系数</param>
        /// <param name="degradationCoefficient">降价系数</param>
        /// <param name="DeliveryExpectDay">基准交期</param>
        private string CreateProductOperatorBonus(CalculateOperatorBonus bpObj, DataTable dsPayment, decimal bonusCoefficient, decimal degradationCoefficient, int DeliveryExpectDay)
        {
            if (dsPayment == null || dsPayment.Rows.Count == 0)
            {
                return("");
            }
            var groupOperators             = dsPayment.Rows.Cast <DataRow>().GroupBy(t => t["Operators_Code"].ToString());
            BonusOperatorDocType bonusType = BonusOperatorDocType.Finder.Find("BuzType=0 and IsCreatedByPush=1");

            if (bonusType == null)
            {
                throw new Exception("请设置产品采购业务员单据类型并设置为上游单据推出");
            }
            using (ISession session = Session.Open())
            {
                BonusProductDoc bonusProduct = BonusProductDoc.Create();
                bonusProduct.DocumentTypeKey = bonusType.Key; //单据类型
                bonusProduct.BusinessDate    = DateTime.Now;  //业务日期
                bonusProduct.Status          = EnumBE.FICommonStatusEnum.Opened;
                if (bpObj.BonusCalcuteList[0].SOBAccountingPeriod != null && bpObj.BonusCalcuteList[0].SOBAccountingPeriod.AccountPeriod != null)
                {
                    bonusProduct.AccountPeriodKey = bpObj.BonusCalcuteList[0].SOBAccountingPeriod.AccountPeriod.AccountingCalendarKey; //会计日历
                }
                bonusProduct.CurrencyKey = Base.Currency.Currency.Finder.Find("Code='C001'").Key;                                      //币种只会为人民币,写死
                bonusProduct.Oprator     = Base.Context.LoginUser;
                bonusProduct.OprateDate  = DateTime.Now;

                //设置默认行号
                GetProfileValueProxy lineNo = new GetProfileValueProxy();
                lineNo.ProfileCode = "SysLineNo";
                PVDTOData pVTDOData = lineNo.Do();
                string    row       = pVTDOData.ProfileValue;
                //根据业务员分组后的付款通知单数据
                foreach (var groupOperator in groupOperators)
                {
                    decimal             sumPayment           = 0; //付款单总额,
                    decimal             sumPerformance       = 0; //业绩单总额
                    decimal             productBonusTotal    = 0; //新产品奖金合计
                    decimal             depreciateBonusTotal = 0; //降价奖金合计
                    decimal             bonusTotal           = 0; //奖金合计
                    long                operatorsKey         = Convert.ToInt64(groupOperator.First <DataRow>()["Operators"].ToString());
                    long                dept        = Convert.ToInt64(groupOperator.First <DataRow>()["Department"].ToString());
                    BonusProductDocLine productLine = BonusProductDocLine.Create(bonusProduct); //业务员奖金明细行
                    productLine.DocLineNo = Convert.ToInt32(row);                               //行号
                    if (operatorsKey > 0)
                    {
                        productLine.OperatorsKey = CBO.HR.Operator.Operators.Finder.FindByID(operatorsKey).Key;//业务员
                    }
                    if (dept > 0)
                    {
                        productLine.DepartmentKey = CBO.HR.Department.Department.Finder.FindByID(dept).Key;//部门
                    }
                    //设置默认行号
                    string subRow = pVTDOData.ProfileValue;
                    foreach (DataRow Operator in groupOperator)
                    {
                        if (Convert.ToInt32(Operator["SrcDocType"].ToString()) != EnumBE.PaySrcDocTypeEnum.Rcv.Value)
                        {
                            continue;
                        }
                        BonusProductDocSubLine subLine = BonusProductDocSubLine.Create(productLine);
                        subLine.DocLineNo     = Convert.ToInt32(subRow);
                        subLine.OperatorsKey  = CBO.HR.Operator.Operators.Finder.FindByID(operatorsKey).Key; //业务员
                        subLine.DepartmentKey = CBO.HR.Department.Department.Finder.FindByID(dept).Key;      //部门
                        decimal payment = decimal.Parse(Operator["Payment"].ToString());                     //付款单金额,转换成人民币
                        subLine.Payment = payment;
                        sumPayment     += payment;
                        //获得产品系数档案
                        ProductCoefficient coefficient = ProductCoefficient.Finder.Find("ItemMaster.Code='" + Operator["Item_Code"].ToString() + "'");
                        if (coefficient == null)
                        {
                            throw new Exception("料品" + Operator["Item_Code"].ToString() + " " + Operator["Item_Name"].ToString() + "没有维护产品系数");
                        }
                        subLine.ProductCoefficient    = coefficient; //产品系数
                        subLine.NewProductCoefficient = coefficient; //新产品系数
                        //来源类型入库单取实际入库时间
                        if (Convert.ToInt32(Operator["Item_Code"].ToString()) == 3)
                        {
                            if (Operator["Item_Code"].ToString() != "")
                            {
                                long rcvId = Convert.ToInt64(Operator["Item_Code"].ToString());
                                if (rcvId > 0)
                                {
                                    PM.Rcv.RcvLine rcvLine = PM.Rcv.RcvLine.Finder.FindByID(rcvId);
                                    if (rcvLine != null)
                                    {
                                        subLine.PracticalRcvTime = rcvLine.ConfirmDate;//实际入库时间
                                    }
                                    else
                                    {
                                        throw new Exception("付款通知单" + Operator["Payment_DocNo"].ToString() + "行" + Operator["SrcDocLineNo"].ToString() + "找不到来源入库单");
                                    }
                                }
                            }
                        }

                        //应交货日期取收购单上的应交货日期。
                        //PM.PO.POShipLine shipLine = PM.PO.POShipLine.Finder.FindByID(Operator["POShipLineID"].ToString());
                        //if (shipLine != null)
                        //{
                        //    subLine.DeliveryTime = shipLine.DeliveryDate;//应交货日期
                        //}
                        if (Operator["SPDelivery"].ToString() != "")
                        {
                            subLine.DeliveryTime = DateTime.Parse(Operator["SPDelivery"].ToString());
                        }
                        subLine.DegradationCoefficient = degradationCoefficient; //降价系数,预置参数

                        //计算交付预期与计算奖金相关
                        //1、如果来源采购
                        #region 计算交付预期和奖金,默认1
                        decimal deliveryExpect = 1;
                        //库存采购不考虑逾期,用采购单据类型编号判断;
                        //判断如果逾期,则置为-1
                        if (Operator["DocumentType"].ToString() != "PO03")  ///库存采购单据类型编码目前默认PO03,后期基础数据准备完成后相应改动
                        {
                            //在奖金计算时,如果该批号对应的数量大于在预留表里面的对应批号的数量,说明多余的数量已转自由库存,
                            //需同时计算不考虑逾期的奖金和预留数量对应的受预期影响的奖金两部分
                            if (Operator["Lot"].ToString() != "")
                            {
                                long lot = Convert.ToInt64(Operator["Lot"].ToString());
                                //获取预留表批号
                                UFIDA.U9.ATP.Reserve.Reserve reserve = ATP.Reserve.Reserve.Finder.Find("SupplyLot=" + lot + "");
                                if (reserve != null && reserve.ReserveQtyIU < decimal.Parse(Operator["PayQty"].ToString()))
                                {
                                    //比预留表多余的数量表示已经转自由库存,不考虑预期,计算奖金
                                    subLine.Bonus = decimal.Parse(Operator["FinallyPrice"].ToString()) * (decimal.Parse(Operator["PayQty"].ToString()) - reserve.ReserveQtyIU) * bonusCoefficient * coefficient.Coefficien * coefficient.ProductCoeffien * deliveryExpect;
                                    //实际入库时间-收购单(供应计划)下单日>基准交期,并且大于交货日期,则逾期系数为-1,负奖金,需要扣奖金;
                                    if (subLine.DeliveryTime != null && (subLine.PracticalRcvTime - Convert.ToDateTime(Operator["CreatedOn"].ToString())).Days > DeliveryExpectDay && subLine.PracticalRcvTime > subLine.DeliveryTime)//逾期,扣奖金
                                    {
                                        deliveryExpect         = -1;
                                        subLine.DeliveryExpect = deliveryExpect;
                                        //计算奖金
                                        subLine.Bonus += decimal.Parse(Operator["FinallyPrice"].ToString()) * reserve.ReserveQtyIU * bonusCoefficient * coefficient.Coefficien * coefficient.ProductCoeffien * deliveryExpect;
                                    }
                                    else
                                    {
                                        deliveryExpect         = 1;
                                        subLine.DeliveryExpect = deliveryExpect;
                                        //计算奖金
                                        subLine.Bonus += decimal.Parse(Operator["FinallyPrice"].ToString()) * reserve.ReserveQtyIU * bonusCoefficient * coefficient.Coefficien * coefficient.ProductCoeffien * deliveryExpect;
                                    }
                                }
                                else
                                {
                                    //throw new Exception("付款通知单" + Operator["Payment_DocNo"].ToString() + "行" + Operator["SrcDocLineNo"].ToString() + "入库批号找不到预留表对应批号");
                                    //实际入库时间-收购单(供应计划)下单日>基准交期,并且大于交货日期,则逾期系数为-1,负奖金,需要扣奖金;
                                    if (subLine.DeliveryTime != null && (subLine.PracticalRcvTime - Convert.ToDateTime(Operator["CreatedOn"].ToString())).Days > DeliveryExpectDay && subLine.PracticalRcvTime > subLine.DeliveryTime)//逾期,扣奖金
                                    {
                                        deliveryExpect         = -1;
                                        subLine.DeliveryExpect = deliveryExpect;
                                        //计算奖金
                                        subLine.Bonus = payment * bonusCoefficient * coefficient.Coefficien * coefficient.ProductCoeffien * deliveryExpect;
                                    }
                                    else
                                    {
                                        deliveryExpect         = 1;
                                        subLine.DeliveryExpect = deliveryExpect;
                                        //计算奖金
                                        subLine.Bonus = payment * bonusCoefficient * coefficient.Coefficien * coefficient.ProductCoeffien * deliveryExpect;
                                    }
                                }
                            }
                            else //找不到对应批号,直接判断是否逾期,正常流程基本不存在的
                            {
                                //实际入库时间-收购单(供应计划)下单日>基准交期,并且大于交货日期,则逾期系数为-1,负奖金,需要扣奖金;
                                if (subLine.DeliveryTime != null && (subLine.PracticalRcvTime - Convert.ToDateTime(Operator["CreatedOn"].ToString())).Days > DeliveryExpectDay && subLine.PracticalRcvTime > subLine.DeliveryTime)//逾期,扣奖金
                                {
                                    deliveryExpect         = -1;
                                    subLine.DeliveryExpect = deliveryExpect;
                                    //计算奖金
                                    subLine.Bonus = payment * bonusCoefficient * coefficient.Coefficien * coefficient.ProductCoeffien * deliveryExpect;
                                }
                                else
                                {
                                    deliveryExpect         = 1;
                                    subLine.DeliveryExpect = deliveryExpect;
                                    //计算奖金
                                    subLine.Bonus = payment * bonusCoefficient * coefficient.Coefficien * coefficient.ProductCoeffien * deliveryExpect;
                                }
                            }
                        }
                        else  //库存采购
                        {
                            //库存采购不考虑逾期
                            deliveryExpect         = 1;
                            subLine.DeliveryExpect = deliveryExpect;
                            //计算奖金
                            subLine.Bonus = payment * bonusCoefficient * coefficient.Coefficien * coefficient.ProductCoeffien * deliveryExpect;
                        }

                        #endregion


                        subLine.PaymentDocKey = PaymentBE.Payment.Finder.FindByID(Operator["PaymentID"].ToString()).Key;
                        subLine.PaymentDocNo  = Operator["Payment_DocNo"].ToString();
                        subLine.ItemKey       = CBO.SCM.Item.ItemMaster.Finder.FindByID(Operator["Item"].ToString()).Key;
                        subLine.SrcDocLineNo  = Convert.ToInt32(Operator["SrcDocLineNo"].ToString());

                        //降价奖金
                        ProductDepreciate productDepreciate = ProductDepreciate.Finder.Find("ItemMaster.Code='" + Operator["Item_Code"].ToString() + "'");
                        if (productDepreciate != null)
                        {
                            depreciateBonusTotal += productDepreciate.CanPrice * Decimal.Parse(Operator["PayQty"].ToString()) * degradationCoefficient;
                        }

                        subRow = (int.Parse(subRow) + int.Parse(pVTDOData.ProfileValue)).ToString();//自增行号
                    }
                    productLine.SumPayment           = sumPayment;
                    productLine.SumPerformance       = sumPerformance;
                    productLine.ProductBonusTotal    = productBonusTotal;
                    productLine.DepreciateBonusTotal = depreciateBonusTotal;
                    productLine.BonusTotal           = bonusTotal;
                    row = (int.Parse(row) + int.Parse(pVTDOData.ProfileValue)).ToString();//自增行号
                }
                session.Commit();
                return(bonusProduct.DocNo);
            }
        }
Example #16
0
 public static bool IsUsedDMSAPI()
 {
     string returnvalue = string.Empty;
     GetProfileValueProxy bpObj = new GetProfileValueProxy();
     bpObj.ProfileCode = ("IsUsedDMSAPI");
     PVDTOData pVTDOData = bpObj.Do();
     if (pVTDOData != null)
     {
         returnvalue = pVTDOData.ProfileValue;
     }
     return !(returnvalue.ToLower() == "false");
 }