Example #1
0
 public override void BeginOperationTransaction(BeginOperationTransactionArgs e)
 {
     try
     {
         if (e.DataEntitys != null && e.DataEntitys.Count <DynamicObject>() > 0)
         {
             foreach (DynamicObject item in e.DataEntitys)
             {
                 string sql = string.Empty;
                 //销售出库单id
                 string Fid = item["Id"].ToString();
                 sql += string.Format(@"/*dialect*/ update T_SAL_OUTSTOCKENTRY set FTotalARFNOTAXAMOUNTFOR=FAMOUNT,FTotalARFALLAMOUNTFOR=FALLAMOUNT
                                        from T_SAL_OUTSTOCKENTRY a inner join T_SAL_OUTSTOCKENTRY_F b on b.FENTRYID=a.FENTRYID where a.FID={0} and  FTotalARFNOTAXAMOUNTFOR=0", Fid);
                 sql += string.Format(@"/*dialect*/ update T_SAL_OUTSTOCK set FTotalARFNOTAXAMOUNTFOR_H=FBILLAMOUNT_LC,FTotalARFALLAMOUNTFOR_H=FBILLALLAMOUNT_LC from 
                           T_SAL_OUTSTOCK a inner join  T_SAL_OUTSTOCKFIN b on a.fid=b.fid  where a.FID={0} and FTotalARFNOTAXAMOUNTFOR_H=0", Fid);
                 //更新销售出库单
                 DBServiceHelper.Execute(Context, sql);
             }
         }
     }
     catch (Exception ex)
     {
         throw new KDException("", "保存失败:" + ex.ToString());
     }
 }
        /// <summary>
        ///累加日计划面积
        /// </summary>
        /// <param name="e"></param>
        public override void EndOperationTransaction(EndOperationTransactionArgs e)
        {
            base.EndOperationTransaction(e);
            IViewService Services = ServiceHelper.GetService <IViewService>();

            if (selectedRows != null && selectedRows.Count() != 0)
            {
                //IMetaDataService metadataService = Kingdee.BOS.App.ServiceHelper.GetService<IMetaDataService>();


                foreach (DynamicObject dy in selectedRows)
                {
                    string Id = Convert.ToString(dy["Id"]);


                    string LSNo = Convert.ToString(dy["F_SZXY_ProductNo"]);
                    if (LSNo != "" && !LSNo.IsNullOrEmptyOrWhiteSpace())
                    {
                        //改写流转状态
                        string UpdateStateSql = string.Format("/*dialect*/update SZXY_t_XYLS set  F_SZXY_CIRCULATIONSTATE1={0}   where F_SZXY_RECNO='{1}' ", 0, LSNo);
                        int    res            = DBServiceHelper.Execute(Context, UpdateStateSql);
                    }
                }
            }
        }
Example #3
0
        /// <summary>
        /// 保存后触发
        /// </summary>
        /// <param name="e"></param>
        public override void AfterSave(AfterSaveEventArgs e)
        {
            string sql = @"/*dialect*/ insert into PAEZ_t_BillRecordLog
(FUSERID,FDATETIME,FORGID,FSUBSYSTEMID,FOPERATENAME,FCLIENTIP,F_PAEZ_Bill,F_PAEZ_ColumnName,F_PAEZ_OldValue,F_PAEZ_NewValue,F_PAEZ_DataRowNumber,F_PAEZ_BILLNAME,F_PAEZ_BILLKEY) 
values('{0}','{1}','{2}','','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}')";

            foreach (var item in colist)
            {
                if (item["Old"] != item["New"])
                {
                    DBServiceHelper.Execute(this.Context, string.Format(sql,
                                                                        Context.UserName,
                                                                        DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                                                                        Context.CurrentOrganizationInfo.Name,
                                                                        item["OperateName"],
                                                                        Context.ClientInfo.IpAddress,
                                                                        View.BillBusinessInfo.Elements[0].Name,
                                                                        item["Column"],
                                                                        item["Old"],
                                                                        item["New"],
                                                                        item["Row"],
                                                                        billname,
                                                                        billkey));
                }
                item["Old"] = item["New"];

                //item["New"] = "";
            }
            //colist.Clear();
        }
        public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e)
        {
            try
            {
                string sql = string.Empty;
                if (e.DataEntitys != null && e.DataEntitys.Count <DynamicObject>() > 0)
                {
                    foreach (DynamicObject item in e.DataEntitys)
                    {
                        //收款单id
                        string Fid = item["Id"].ToString();
                        sql = string.Format(@"/*dialect*/ update T_AR_RECEIVEBILLSRCENTRY  SET FORDERQTY=t2.FQTY FROM T_AR_RECEIVEBILLSRCENTRY t1 
                                                inner join T_SAL_ORDERENTRY  t2 on t1.FORDERENTRYID=t2.FENTRYID 
                                                left join T_AR_RECEIVEBILL t3 on t3.FID=t1.FID where t3.FID={0}", Fid);

                        //更新收款单上的销售订单数量
                        DBServiceHelper.Execute(Context, sql);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new KDException("", "更新收款单上的销售订单数量失败:" + ex.ToString());
            }
        }
        /// <summary>
        ///累加日计划面积
        /// </summary>
        /// <param name="e"></param>
        public override void EndOperationTransaction(EndOperationTransactionArgs e)
        {
            base.EndOperationTransaction(e);
            IViewService Services = ServiceHelper.GetService <IViewService>();

            if (selectedRows != null && selectedRows.Count() != 0)
            {
                IMetaDataService metadataService = Kingdee.BOS.App.ServiceHelper.GetService <IMetaDataService>();


                foreach (DynamicObject dy in selectedRows)
                {
                    string Id = Convert.ToString(dy["Id"]);

                    if (dy["SZXY_TFJCDEntry2"] is DynamicObjectCollection Entry)
                    {
                        foreach (var item in Entry)
                        {
                            decimal PlyAvg = Convert.ToDecimal(item["F_SZXY_PLyAvg"]);

                            string TFCode = Convert.ToString(item["F_SZXY_TFNo1"]);
                            if (!TFCode.IsNullOrEmptyOrWhiteSpace() && Convert.ToInt32(PlyAvg) > 0)
                            {
                                string sql1 = $"/*dialect*/update SZXY_t_XYTFEntry  set F_SZXY_SJPLY={PlyAvg} " +
                                              $" where F_SZXY_COATCODE='{TFCode}' ";

                                DBServiceHelper.Execute(Context, sql1);
                            }
                        }
                    }
                }
            }
        }
Example #6
0
        /// <summary>
        ///累加日计划面积
        /// </summary>
        /// <param name="e"></param>
        public override void EndOperationTransaction(EndOperationTransactionArgs e)
        {
            base.EndOperationTransaction(e);
            IViewService Services = ServiceHelper.GetService <IViewService>();

            if (selectedRows != null && selectedRows.Count() != 0)
            {
                IMetaDataService metadataService = Kingdee.BOS.App.ServiceHelper.GetService <IMetaDataService>();
                //string SoureFormId = "SZXY_FHJTRSCJH";
                //获取单据元数据
                //FormMetadata BilMetada = metadataService.Load(Context, SoureFormId) as FormMetadata;

                foreach (DynamicObject dy in selectedRows)
                {
                    string Id = Convert.ToString(dy["Id"]);


                    if (dy["SZXY_XYLSEntry1"] is DynamicObjectCollection Entrys)
                    {
                        foreach (var item in Entrys.Where(op => !Convert.ToString(op["F_SZXY_PlasticNo1"]).IsNullOrEmptyOrWhiteSpace()))
                        {
                            string FHNo = Convert.ToString(item["F_SZXY_PlasticNo1"]);

                            if (!FHNo.IsNullOrEmptyOrWhiteSpace())
                            {
                                //改写流转状态
                                string UpdateStateSql = string.Format("/*dialect*/update SZXY_t_XYFH set  F_SZXY_Integer={0}   where F_SZXY_RecNo='{1}' ", 0, Convert.ToString(FHNo));
                                int    res            = DBServiceHelper.Execute(Context, UpdateStateSql);
                            }
                        }
                    }
                }
            }
        }
Example #7
0
        /// <summary>
        ///累加日计划面积
        /// </summary>
        /// <param name="e"></param>
        public override void EndOperationTransaction(EndOperationTransactionArgs e)
        {
            base.EndOperationTransaction(e);
            IViewService Services = ServiceHelper.GetService <IViewService>();

            if (selectedRows != null && selectedRows.Count() != 0)
            {
                IMetaDataService metadataService = Kingdee.BOS.App.ServiceHelper.GetService <IMetaDataService>();

                foreach (DynamicObject dy in selectedRows)
                {
                    string  Id   = Convert.ToString(dy["Id"]);
                    decimal Area = 0;

                    string RJHRowId = string.Empty;


                    if (dy["SZXY_SFDEntry"] is DynamicObjectCollection Entry)
                    {
                        foreach (var item in Entry)
                        {
                            Area = Convert.ToDecimal(item["F_SZXY_AREA"]);
                            //反写日计划实际完成面积
                            RJHRowId = Convert.ToString(item["F_SZXY_RJHEntryID"]);
                            if (!RJHRowId.IsNullOrEmptyOrWhiteSpace() && Convert.ToInt32(RJHRowId) > 0)
                            {
                                string sql1 = $"/*dialect*/update SZXY_t_SFJTRSCJHEntry  set F_SZXY_ProductionArea=F_SZXY_ProductionArea+{Area} " +
                                              $" where FEntryID={RJHRowId} ";
                                DBServiceHelper.Execute(Context, sql1);
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        ///累加日计划面积
        /// </summary>
        /// <param name="e"></param>
        public override void EndOperationTransaction(EndOperationTransactionArgs e)
        {
            base.EndOperationTransaction(e);
            IViewService Services = ServiceHelper.GetService <IViewService>();

            if (selectedRows != null && selectedRows.Count() != 0)
            {
                IMetaDataService metadataService = Kingdee.BOS.App.ServiceHelper.GetService <IMetaDataService>();
                string           SoureFormId     = "SZXY_FHJTRSCJH";
                //获取单据元数据
                FormMetadata BilMetada = metadataService.Load(Context, SoureFormId) as FormMetadata;

                foreach (DynamicObject dy in selectedRows)
                {
                    string  Id       = Convert.ToString(dy["Id"]);
                    decimal Area     = 0;
                    string  RJHFid   = string.Empty;
                    string  RJHRowId = string.Empty;
                    RJHFid   = Convert.ToString(dy["F_SZXY_FIDH"]);
                    Area     = Convert.ToDecimal(dy["F_SZXY_ProdArea"]);
                    RJHRowId = Convert.ToString(dy["F_SZXY_FEntryIDH"]);


                    if (Area > 0 && !RJHFid.IsNullOrEmptyOrWhiteSpace() && Convert.ToInt32(RJHFid) > 0 && Convert.ToInt32(RJHRowId) > 0)
                    {
                        //单据头反写复合日计划实际完成面积

                        string sql1 = $"/*dialect*/update SZXY_t_LSJTRSCJHEntry  set F_SZXY_ProdArea=F_SZXY_ProdArea-{Area} " +
                                      $"  where Fid={RJHFid}" +
                                      $" and FEntryID={RJHRowId} ";
                        DBServiceHelper.Execute(Context, sql1);
                    }
                }
            }
        }
        /// <summary>
        ///累加日计划面积
        /// </summary>
        /// <param name="e"></param>
        public override void EndOperationTransaction(EndOperationTransactionArgs e)
        {
            base.EndOperationTransaction(e);

            if (selectedRows != null && selectedRows.Count() != 0)
            {
                foreach (DynamicObject dy in selectedRows)
                {
                    string  Id   = Convert.ToString(dy["Id"]);
                    decimal Area = 0;

                    string RJHRowId = string.Empty;

                    if (dy["SZXY_BZDHEntry"] is DynamicObjectCollection Entry)
                    {
                        foreach (var item in Entry)
                        {
                            Area = Convert.ToDecimal(item["F_SZXY_AREA1"]);
                            //反写日计划实际完成面积
                            RJHRowId = Convert.ToString(item["F_SZXY_RJHEntryIDH"]);
                            if (!RJHRowId.IsNullOrEmptyOrWhiteSpace() && Convert.ToInt32(RJHRowId) > 0)
                            {
                                string sql1 = $"/*dialect*/update SZXY_t_BZRSCJHEntry  set F_SZXY_PRODUCTIONAREA=F_SZXY_PRODUCTIONAREA-{Area} " +
                                              $"  where  FEntryID={RJHRowId}";
                                DBServiceHelper.Execute(Context, sql1);
                            }
                        }
                    }
                }
            }
        }
Example #10
0
        /// <summary>
        /// 保存后,写入日志操作
        /// </summary>
        /// <param name="e"></param>
        public override void AfterSave(AfterSaveEventArgs e)
        {
            //List<SqlParam> lsp;
            //string sql = @"/*dialect*/ insert into PAEZ_t_BillRecordLog
            //(FUSERID,FDATETIME,FORGID,FSUBSYSTEMID,FOPERATENAME,FCLIENTIP,F_PAEZ_Bill,F_PAEZ_ColumnName,F_PAEZ_OldValue,F_PAEZ_NewValue,F_PAEZ_DataRowNumber)
            //values(@UserName,@time,@forgid,'','',@IP,@Bill,@ColumnName,@OldValue,@NewValue,@DataRowNumber)";
            //foreach (var item in colist)
            //{
            //    lsp = new List<SqlParam>() {
            //                    new SqlParam("@UserName",KDDbType.String,this.Context.UserName),
            //                    new SqlParam("@time",KDDbType.DateTime,System.DateTime.Now),
            //                    new SqlParam("@forgid",KDDbType.String,this.Context.CurrentOrganizationInfo.Name),
            //                    new SqlParam("@IP",KDDbType.String,this.Context.ClientInfo.IpAddress),
            //                    new SqlParam("@Bill",KDDbType.String,this.View.BillBusinessInfo.Elements[0].Name),
            //                    new SqlParam("@ColumnName",KDDbType.String,item["Column"]),
            //                    new SqlParam("@OldValue",KDDbType.String,item["Old"]),
            //                    new SqlParam("@NewValue",KDDbType.String,item["New"]),
            //                    new SqlParam("@DataRowNumber",KDDbType.String,item["Row"]),
            //                };
            //    DBServiceHelper.Execute(this.Context, sql, lsp);
            //}


            string sql = @"/*dialect*/ insert into PAEZ_t_BillRecordLog
(FUSERID,FDATETIME,FORGID,FSUBSYSTEMID,FOPERATENAME,FCLIENTIP,F_PAEZ_Bill,F_PAEZ_ColumnName,F_PAEZ_OldValue,F_PAEZ_NewValue,F_PAEZ_DataRowNumber) 
values('{0}','{1}','{2}','','','{3}','{4}','{5}','{6}','{7}','{8}')";

            foreach (var item in colist)
            {
                DBServiceHelper.Execute(this.Context, string.Format(sql, Context.UserName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Context.CurrentOrganizationInfo.Name
                                                                    , Context.ClientInfo.IpAddress, View.BillBusinessInfo.Elements[0].Name, item["Column"], item["Old"], item["New"], item["Row"]));
            }
            colist.Clear();
        }
Example #11
0
        ///<summary>
        ///修改含税单价
        ///</summary>
        private DynamicObjectCollection GetSplitSourceData(BusinessInfo billInfo, DynamicObjectCollection sourceData)
        {
            // DynamicObjectCollection newSourceData = new DynamicObjectCollection(sourceData.DynamicCollectionItemPropertyType);
            foreach (var oneSourceData in sourceData)
            {
                string FentrtyID = oneSourceData["FEntityDetail_FEntryID"].ToString();

                string sql = string.Format(@"select a.FTAXPRICE from  T_AR_RECEIVABLEENTRY_LK b inner join T_AR_RECEIVABLEENTRY a 
                                                    on a.FENTRYID=b.FENTRYID where b.FSID='{0}'", FentrtyID);
                //含税单价
                decimal FARFTAXPRICE = DBServiceHelper.ExecuteScalar <decimal>(this.Context, sql, 0, null);
                if (Math.Abs(FARFTAXPRICE) > 0)
                {
                    oneSourceData["FTaxPrice"] = FARFTAXPRICE;
                }
                //判断是否第一次下推
                sql = string.Format(@"select  count(*) as zongshu  from T_AR_RECEIVABLEENTRY_LK  where  FSID='{0}'", FentrtyID);
                decimal zongshu = DBServiceHelper.ExecuteScalar <decimal>(this.Context, sql, 0, null);
                if (zongshu > 0)
                {
                    oneSourceData["FIsLockPrice"] = 1;
                    //锁定所有财务应收单价
                    string upsql = string.Format(@"/*dialect*/ update T_AR_RECEIVABLEENTRY set FIsLockPrice=1 from T_AR_RECEIVABLEENTRY a 
                                                   inner join T_AR_RECEIVABLEENTRY_LK b on a.FENTRYID=b.FENTRYID  where  FSID='{0}'", FentrtyID);
                    //更新锁库字段
                    DBServiceHelper.Execute(Context, upsql);
                }
                else
                {
                    oneSourceData["FIsLockPrice"] = 0;
                }
            }
            return(sourceData);
        }
        /// <summary>
        /// 处理方法
        /// </summary>
        /// <param name="o">数据对象</param>
        private void Act_DoAfterSubmit(DynamicObject o)
        {
            string _FID = o["Id"].ToString();
            string _sql = "exec proc_czty_RndInContractName @FID='" + _FID + "'";

            DBServiceHelper.Execute(base.Context, _sql);
        }
Example #13
0
        public bool updateKingDeeDataBase(string model, List <string> SQLStatement, Dictionary <string, UpdateFields> updateMap, Context ctx)
        {
            List <string> statementList = new List <string>();

            foreach (KeyValuePair <string, UpdateFields> kvp in updateMap)
            {
                if (string.Equals(CustomerSQLObject.Customer, model, StringComparison.CurrentCultureIgnoreCase))
                {
                    CustomerUpdateFields customerUpdateFields = (CustomerUpdateFields)kvp.Value;
                    string statement = string.Format(SQLStatement[0], customerUpdateFields.FName, kvp.Key);
                    statementList.Add(statement);
                    CustomerFnunbers.Add(kvp.Key);
                }
                if (string.Equals(SupplierSQLObject.Supplier, model, StringComparison.CurrentCultureIgnoreCase))
                {
                    SupplierUpdateFields supplierUpdateFields = (SupplierUpdateFields)kvp.Value;
                    string statement1 = string.Format(SQLStatement[0], supplierUpdateFields.FName, kvp.Key);
                    string statement2 = string.Format(SQLStatement[1], supplierUpdateFields.FbankCode, kvp.Key);
                    string statement3 = string.Format(SQLStatement[2], supplierUpdateFields.FopenBankName, kvp.Key);
                    SupplierFnumbers.Add(kvp.Key);

                    using (KDTransactionScope trans = new KDTransactionScope(System.Transactions.TransactionScopeOption.Required))
                    {
                        if (DBServiceHelper.Execute(ctx, statement1) > 0)
                        {
                            if (DBServiceHelper.Execute(ctx, statement2) > 0)
                            {
                                if (DBServiceHelper.Execute(ctx, statement3) > 0)
                                {
                                    BussnessLog.WriteBussnessLog("", model + "更新", "更新金蝶数据库成功! fnumber=" + kvp.Key);
                                }
                                else
                                {
                                    BussnessLog.WriteBussnessLog("", model + "更新", "更新金蝶数据库失败! fnumber=" + kvp.Key);
                                }
                            }
                        }
                        trans.Complete();
                    }
                }
            }

            if (DBServiceHelper.ExecuteBatch(ctx, statementList) > 0)
            {
                foreach (string s in statementList)
                {
                    BussnessLog.WriteBussnessLog("", model + "更新", "更新金蝶数据库成功! 更新语句=" + s);
                }
            }
            else
            {
                foreach (string s in statementList)
                {
                    BussnessLog.WriteBussnessLog("", model + "更新", "更新金蝶数据库失败! 更新语句=" + s);
                }
            }

            return(true);
        }
Example #14
0
 public override void EndOperationTransaction(EndOperationTransactionArgs e)
 {
     try
     {
         if (e.DataEntitys != null && e.DataEntitys.Count <DynamicObject>() > 0)
         {
             foreach (DynamicObject item in e.DataEntitys)
             {
                 string FID             = item["Id"].ToString();
                 string FSetAccountType = item["FSetAccountType"].ToString();
                 if (FSetAccountType == "2" || FSetAccountType == "1")//暂估
                 {
                     string upsql           = "";
                     string F_YBG_Assistant = item["F_YBG_Assistant_Id"].ToString();
                     string sql             = string.Format(@"select FNUMBER  From T_BAS_ASSISTANTDATAENTRY  where FENTRYID='{0}'", F_YBG_Assistant);
                     //编码
                     string FNUMBER = DBServiceHelper.ExecuteScalar <string>(this.Context, sql, "0", null);
                     if (!FNUMBER.Contains("SN"))
                     {
                         //更新暂估应收
                         upsql = string.Format(@"/*dialect*/ update t_AR_receivableEntry set FIsLockPrice=1  where FID ='{0}'", FID);
                     }
                     else
                     {
                         //更新暂估应收
                         upsql = string.Format(@"/*dialect*/ update t_AR_receivableEntry set FIsLockPrice=0  where FID ='{0}'", FID);
                     }
                     //更新锁库字段
                     DBServiceHelper.Execute(Context, upsql);
                 }
                 //else
                 //{
                 //    string upsql = "";
                 //    string sql = string.Format(@"select arel.FSID from t_AR_receivable ar inner join t_AR_receivableEntry arE on ar.FID=arE.FID
                 //                           inner join T_AR_RECEIVABLEENTRY_LK arel on arel.FENTRYID=are.FENTRYID where ar.FID='{0}'", FID);
                 //    DataSet ds = DBServiceHelper.ExecuteDataSet(this.Context, sql);
                 //    DataTable dt = ds.Tables[0];
                 //    if (dt.Rows.Count > 0)
                 //    {
                 //        for (int i = 0; i < dt.Rows.Count; i++)
                 //        {
                 //            string FSID = dt.Rows[i]["FSID"].ToString();
                 //            //更新暂估应收
                 //            upsql += string.Format(@"/*dialect*/ update t_AR_receivableEntry set FIsLockPrice=1  where FENTRYID ='{0}'", FSID);
                 //        }
                 //    }
                 //    //锁定价格
                 //    DBServiceHelper.Execute(Context, upsql);
                 //}
             }
         }
     }
     catch (Exception ex)
     {
         throw new KDException("", "保存失败:" + ex.ToString());
     }
 }
Example #15
0
        /// <summary>
        ///累加日计划面积
        /// </summary>
        /// <param name="e"></param>
        public override void EndOperationTransaction(EndOperationTransactionArgs e)
        {
            base.EndOperationTransaction(e);
            IViewService Services = ServiceHelper.GetService <IViewService>();

            if (selectedRows != null && selectedRows.Count() != 0)
            {
                IMetaDataService metadataService = Kingdee.BOS.App.ServiceHelper.GetService <IMetaDataService>();
                //string SoureFormId = "SZXY_FHJTRSCJH";
                //获取单据元数据
                //FormMetadata BilMetada = metadataService.Load(Context, SoureFormId) as FormMetadata;

                foreach (DynamicObject dy in selectedRows)
                {
                    string  Id       = Convert.ToString(dy["Id"]);
                    decimal Area     = 0;
                    string  RJHFid   = string.Empty;
                    string  RJHRowId = string.Empty;
                    //RJHFid = Convert.ToString(dy["F_SZXY_FIDH"]);
                    //Area = Convert.ToDecimal(dy["F_SZXY_Area"]);
                    //RJHRowId = Convert.ToString(dy["F_SZXY_RJHEntryID"]);


                    if (dy["SZXY_XYFQEntry"] is DynamicObjectCollection Entry)
                    {
                        foreach (var item in Entry)
                        {
                            Area = Convert.ToDecimal(item["F_SZXY_AREA"]);
                            //反写日计划实际完成面积
                            RJHRowId = Convert.ToString(item["F_SZXY_RJHEntryID"]);
                            if (!RJHRowId.IsNullOrEmptyOrWhiteSpace() && Convert.ToInt32(RJHRowId) > 0)
                            {
                                string sql1 = $"/*dialect*/update SZXY_t_FQJTRSCJHEntry  set F_SZXY_ProductionArea=F_SZXY_ProductionArea-{Area}," +
                                              $"  where  FEntryID={RJHRowId}";

                                DBServiceHelper.Execute(Context, sql1);
                            }
                        }
                    }

                    //string SelSql = $"/*dialect*/select * from SZXY_t_XYFQEntry where SZXY_t_XYFQEntry.Fid={Id} ";
                    //DataSet SelDS= DBServiceHelper.ExecuteDataSet(Context, SelSql);

                    //if (SelDS != null && SelDS.Tables.Count > 0 && SelDS.Tables[0].Rows.Count > 0)
                    //{

                    //}

                    string SelSql = $"/*dialect*/insert into SZXY_t_XYFQEntry select  * from SZXY_t_XYFQEntryCopy where SZXY_t_XYFQEntryCopy.Fid={Id} ";
                    DBServiceHelper.Execute(Context, SelSql);
                    string DelSql = $"/*dialect*/delete from SZXY_t_XYFQEntryCopy  where SZXY_t_XYFQEntryCopy.Fid ={Id} ";
                    DBServiceHelper.Execute(Context, DelSql);
                }
            }
        }
Example #16
0
 /// <summary>
 /// 审核操作服务
 /// </summary>
 /// <param name="e"></param>
 public override void EndOperationTransaction(EndOperationTransactionArgs e)
 {
     try
     {
         string sql = string.Empty;
         if (e.DataEntitys != null && e.DataEntitys.Count <DynamicObject>() > 0)
         {
             foreach (DynamicObject item in e.DataEntitys)
             {
                 //收款单id
                 string Fid = item["Id"].ToString();
                 #region 注释
                 //sql = string.Format(@"select FORDERBILLNO,FORDERENTRYID,b.FREALRECAMOUNT from T_AR_RECEIVEBILL a
                 //                      inner join T_AR_RECEIVEBILLSRCENTRY b  on a.FID=b.fid
                 //                      where a.FID='{0}'", Fid);
                 //DataSet ds = DBServiceHelper.ExecuteDataSet(this.Context,sql);
                 //DataTable dt = ds.Tables[0];
                 //if (dt.Rows.Count > 0)
                 //{
                 //    string upsql = "";
                 //    for (int i = 0; i < dt.Rows.Count; i++)
                 //    {
                 //        //订单明细内码
                 //        string FORDERENTRYID = dt.Rows[i]["FORDERENTRYID"].ToString();
                 //        //本次收款金额
                 //        decimal FREALRECAMOUNT = Convert.ToDecimal(dt.Rows[i]["FREALRECAMOUNT"].ToString());
                 //        upsql += string.Format(@"/*dialect*/ update T_SAL_ORDERENTRY set FREALRECAMOUNT={0} where FENTRYID={1}", FREALRECAMOUNT, FORDERENTRYID);
                 //    }
                 //    //更新销售订单
                 //    DBServiceHelper.Execute(Context,upsql);
                 //}
                 #endregion
                 string upsql = "";
                 //收款单源单明细
                 DynamicObjectCollection RECEIVEBILLSRCENTRYList = item["RECEIVEBILLSRCENTRY"] as DynamicObjectCollection;
                 foreach (var entry in RECEIVEBILLSRCENTRYList)
                 {
                     //销售订单明细内码
                     string FORDERENTRYID = entry["FSRCORDERENTRYID"].ToString();
                     //本次收款金额
                     decimal FREALRECAMOUNT = Convert.ToDecimal(entry["REALRECAMOUNT"].ToString());
                     upsql += string.Format(@"/*dialect*/ update T_SAL_ORDERENTRY set FREALRECAMOUNT={0}+FREALRECAMOUNT  where FENTRYID={1}", FREALRECAMOUNT, FORDERENTRYID);
                 }
                 //更新销售订单
                 DBServiceHelper.Execute(Context, upsql);
             }
         }
     }
     catch (Exception ex)
     {
         throw new KDException("", "审核失败:" + ex.ToString());
     }
 }
Example #17
0
        /// <summary>
        /// 保存后触发
        /// </summary>
        /// <param name="e"></param>
        public override void AfterSave(AfterSaveEventArgs e)
        {
            string sql = @"/*dialect*/ insert into PAEZ_t_BillRecordLog
(FUSERID,FDATETIME,FORGID,FSUBSYSTEMID,FOPERATENAME,FCLIENTIP,F_PAEZ_Bill,F_PAEZ_ColumnName,F_PAEZ_OldValue,F_PAEZ_NewValue,F_PAEZ_DataRowNumber,F_PAEZ_BILLNAME,F_PAEZ_BILLKEY) 
values('{0}','{1}','{2}','','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}')";

            foreach (var item in colist)
            {
                if (item["Old"] != item["New"])
                {
                    DBServiceHelper.Execute(this.Context, string.Format(sql,
                                                                        Context.UserName,                             //用户
                                                                        DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), //操作时间
                                                                        Context.CurrentOrganizationInfo.Name,         //组织
                                                                        item["OperateName"],                          //操作类型
                                                                        Context.ClientInfo.IpAddress,                 //IP
                                                                        View.BillBusinessInfo.Elements[0].Name,       //单据
                                                                        item["Column"],                               //字段名
                                                                        item["Old"],                                  //改前
                                                                        item["New"],                                  //改后
                                                                        item["Row"],                                  //行
                                                                        billname,                                     //表名
                                                                        billkey));                                    //表标识
                }
                item["Old"] = item["New"];

                //表体
                foreach (var olditem in oldvaluesfoItem)
                {
                    if (olditem.ContainsKey(item["ColEntityKey"]) && olditem["Row"] == item["Row"])
                    {
                        if (olditem[item["ColEntityKey"]] != item["New"])
                        {
                            olditem[item["ColEntityKey"]] = item["New"];
                            StaticClass.oldvaluesfoItem   = oldvaluesfoItem;
                            break;
                        }
                    }
                }
                //主表
                if (oldvaluefoSubject.ContainsKey(item["ColEntityKey"]))
                {
                    if (oldvaluefoSubject[item["ColEntityKey"]] != item["New"])
                    {
                        oldvaluefoSubject[item["ColEntityKey"]] = item["New"];
                        StaticClass.oldvaluefoSubject           = oldvaluefoSubject;
                    }
                }
            }
            colist = colist.FindAll(item => item["Old"] != item["New"]);
        }
Example #18
0
        /// </summary>
        /// <param name="e"></param>
        public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e)
        {
            base.AfterExecuteOperationTransaction(e);

            if (this.OperationResult.IsSuccess && IdList != null && IdList.Count() > 0)
            {

                foreach (string RKTZD in IdList)
                {

                    string SQL = "/*dialect*/update  SZXY_t_BZRKTZD set F_SZXY_RKDNO=''  where FID='" + RKTZD + "'";

                    DBServiceHelper.Execute(this.Context, SQL);
                }
            }

        }
Example #19
0
        private void updateSQL(Context ctx, string ttemTableName)
        {
            DataSet ds  = null;
            string  SQL = "";

            SQL = "/*dialect*/SELECT 1 FROM SYSOBJECTS WHERE NAME ='" + ttemTableName + "'";
            ds  = DBServiceHelper.ExecuteDataSet(ctx, SQL);
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                SQL = "/*dialect*/DROP TABLE  " + ttemTableName + "";
                DBServiceHelper.Execute(ctx, SQL);
                SQL = "/*dialect*/CREATE TABLE " + ttemTableName + "(Id BIGINT IDENTITY(1,1) NOT NULL, Column1 INT NOT NULL)";
                DBServiceHelper.Execute(ctx, SQL);
            }
            else
            {
                SQL = "/*dialect*/CREATE TABLE " + ttemTableName + "(Id BIGINT IDENTITY(1,1) NOT NULL, Column1 INT NOT NULL)";
                DBServiceHelper.Execute(ctx, SQL);
            }
            //DoSQL(ztemTableName, zttemTableName, temTableName, ttemTableName);
        }
Example #20
0
        /// <summary>
        ///累加日计划面积
        /// </summary>
        /// <param name="e"></param>
        public override void EndOperationTransaction(EndOperationTransactionArgs e)
        {
            base.EndOperationTransaction(e);
            IViewService Services = ServiceHelper.GetService <IViewService>();

            if (selectedRows != null && selectedRows.Count() != 0)
            {
                foreach (DynamicObject dy in selectedRows)
                {
                    string  Id   = Convert.ToString(dy["Id"]);
                    decimal Area = 0;

                    string RJHRowId = string.Empty;

                    if (dy["F_SZXY_OrgId"] is DynamicObject OrgDO)
                    {
                        string OrgId = Convert.ToString(OrgDO["Id"]);



                        if (dy["SZXY_XYCPJYEntry"] is DynamicObjectCollection Entry)
                        {
                            foreach (var item in Entry)
                            {
                                string        FQNO    = Convert.ToString(item["F_SZXY_BarCode"]);
                                string        HD      = Convert.ToString(item["F_SZXY_HD"]);
                                string        BLDS    = Convert.ToString(item["F_SZXY_BLDS"]);
                                DynamicObject Culprit = item["F_SZXY_Culprit"] as DynamicObject;
                                DynamicObject XNDJ    = item["F_SZXY_XNDJ"] as DynamicObject;
                                //反写等级
                                if (XNDJ != null)
                                {
                                    long DJId = Convert.ToInt64(XNDJ[0]);
                                    if (DJId > 0)
                                    {
                                        string sql1 = $"/*dialect*/update SZXY_t_XYFQEntry  set F_SZXY_BLEVEL='{DJId}' " +
                                                      $"  where F_SZXY_BARCODEE= '{FQNO}' ";
                                        DBServiceHelper.Execute(Context, sql1);
                                        string sql2 = $"/*dialect*/update SZXY_t_FQJYDEntry  set F_SZXY_XNDJ='{DJId}' " +
                                                      $"  where F_SZXY_BARCODE= '{FQNO}' ";
                                        DBServiceHelper.Execute(Context, sql2);
                                    }
                                }
                                //反写 不良原因
                                if (Culprit != null)
                                {
                                    string BLYYId = Convert.ToString(Culprit[0]);
                                    if (!BLYYId.IsNullOrEmptyOrWhiteSpace())
                                    {
                                        string sql1 = $"/*dialect*/update SZXY_t_XYFQEntry  set F_SZXY_BLYY='{BLYYId}' " +
                                                      $"  where F_SZXY_BARCODEE= '{FQNO}' ";
                                        DBServiceHelper.Execute(Context, sql1);
                                        string sql2 = $"/*dialect*/update SZXY_t_FQJYDEntry  set F_SZXY_BLYY='{BLYYId}' " +
                                                      $"  where F_SZXY_BARCODE= '{FQNO}' ";
                                        DBServiceHelper.Execute(Context, sql2);
                                    }
                                }


                                //反写 弧度
                                if (!HD.IsNullOrEmptyOrWhiteSpace())
                                {
                                    string sql1 = $"/*dialect*/update SZXY_t_FQJYDEntry  set F_SZXY_ARC='{HD}' " +
                                                  $"  where F_SZXY_BARCODE= '{FQNO}' ";
                                    DBServiceHelper.Execute(Context, sql1);
                                }

                                //反写 波浪读数
                                if (!BLDS.IsNullOrEmptyOrWhiteSpace())
                                {
                                    string sql1 = $"/*dialect*/update SZXY_t_FQJYDEntry  set F_SZXY_BLDS='{BLDS}' " +
                                                  $"  where F_SZXY_BARCODE= '{FQNO}' ";
                                    DBServiceHelper.Execute(Context, sql1);
                                }
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        ///累加日计划面积
        /// </summary>
        /// <param name="e"></param>
        public override void EndOperationTransaction(EndOperationTransactionArgs e)
        {
            base.EndOperationTransaction(e);
            IViewService Services = ServiceHelper.GetService <IViewService>();

            if (selectedRows != null && selectedRows.Count() != 0)
            {
                IMetaDataService metadataService = Kingdee.BOS.App.ServiceHelper.GetService <IMetaDataService>();

                foreach (DynamicObject dy in selectedRows)
                {
                    string Id = Convert.ToString(dy["Id"]);
                    if (!Convert.ToString(dy["F_SZXY_Invalid"]).EqualsIgnoreCase("True"))
                    {
                        string  BZ        = "";
                        string  Orgid     = "";
                        string  Operator  = "";
                        decimal OrderQty  = 0;
                        string  Cust      = "";
                        string  CustBacth = "";
                        string  BC        = "";
                        if (dy["F_SZXY_TeamGroup"] is DynamicObject BZDO)
                        {
                            BZ = BZDO["Id"].ToString();
                        }


                        if (dy["F_SZXY_operator"] is DynamicObject OperatorDo)
                        {
                            Operator = OperatorDo["Id"].ToString();
                        }
                        if (dy["F_SZXY_CustCode"] is DynamicObject CustDo)
                        {
                            Cust = CustDo["Id"].ToString();
                        }
                        if (dy["F_SZXY_BC"] is DynamicObject BCDo)
                        {
                            BC = BCDo["Id"].ToString();
                        }
                        OrderQty  = Convert.ToDecimal(dy["F_SZXY_OrderQty"]);
                        CustBacth = dy["F_SZXY_CustBacth"].ToString();

                        if (dy["SZXY_BZKHXXDYBEntry"] is DynamicObjectCollection Entry && dy["F_SZXY_OrgId"] is DynamicObject OrgDo)
                        {
                            Orgid = OrgDo["Id"].ToString();
                            foreach (DynamicObject item in Entry)
                            {
                                string  F_SZXY_NO           = item["F_SZXY_NO"].ToString();
                                string  F_SZXY_NewDate      = item["F_SZXY_NewDate"].ToString();
                                string  F_SZXY_OriginalDate = item["F_SZXY_OriginalDate"].ToString();
                                string  F_SZXY_CustCartonNo = item["F_SZXY_CustCartonNo"].ToString();//新箱号
                                string  MoNo          = item["F_SZXY_ProductionTask1"].ToString();
                                string  MoLineNo      = item["F_SZXY_MoLineNo"].ToString();
                                string  Mat           = item["F_SZXY_Model_Id"].ToString();
                                decimal F_SZXY_PLy    = Convert.ToDecimal(item["F_SZXY_PLy"].ToString());
                                decimal F_SZXY_Width  = Convert.ToDecimal(item["F_SZXY_Width"].ToString());
                                decimal F_SZXY_Len    = Convert.ToDecimal(item["F_SZXY_Len"].ToString());
                                decimal F_SZXY_Area   = Convert.ToDecimal(item["F_SZXY_Area"].ToString());
                                decimal F_SZXY_volume = Convert.ToDecimal(item["F_SZXY_volume"].ToString());
                                string  SQLPJ         = "";
                                if (!F_SZXY_CustCartonNo.IsNullOrEmptyOrWhiteSpace())
                                {
                                    SQLPJ = $"  F_SZXY_CTNNO = '{F_SZXY_CustCartonNo}', ";
                                }

                                if (!F_SZXY_NO.IsNullOrEmptyOrWhiteSpace())
                                {
                                    long MoId     = 0;
                                    long FENTRYID = 0;
                                    if (!MoLineNo.IsNullOrEmptyOrWhiteSpace() && !MoNo.IsNullOrEmptyOrWhiteSpace())
                                    {
                                        string sql = $"/*dialect*/select T2.fid,T2.FENTRYID  from " +
                                                     $"T_PRD_MO T1 " +
                                                     $"inner join " +
                                                     $" T_PRD_MOENTRY T2 on T1.fid = T2.fid " +
                                                     $"where T1.FPRDORGID = '{Orgid}' and T1.FBILLNO='{MoNo}' and T2.FSEQ='{MoLineNo}'";

                                        DataSet Selds = DBServiceHelper.ExecuteDataSet(Context, sql);
                                        if (Selds != null && Selds.Tables.Count > 0 && Selds.Tables[0].Rows.Count > 0)
                                        {
                                            MoId     = Convert.ToInt64(Selds.Tables[0].Rows[0]["fid"].ToString());
                                            FENTRYID = Convert.ToInt64(Selds.Tables[0].Rows[0]["FENTRYID"].ToString());

                                            string updatesql1 = $"/*dialect*/update   SZXY_t_BZDHEntry " +
                                                                $"set " +
                                                                $"F_SZXY_DATE = '{F_SZXY_NewDate}', " +
                                                                $" F_SZXY_MATERIAL = '{Mat}', " +
                                                                $" F_SZXY_PLY = '{F_SZXY_PLy}', " +
                                                                $" F_SZXY_WIDTH = '{F_SZXY_Width}', " +
                                                                $" F_SZXY = '{F_SZXY_Len}', " +
                                                                $" F_SZXY_AREA1 = '{F_SZXY_Area}', " +
                                                                $" F_SZXY_TEAMGROUP1 = '{BZ}', " +
                                                                $" F_SZXY_CLASSES1 = '{BC}', " +
                                                                SQLPJ +
                                                                $" F_SZXY_OPERATOR = '{Operator}'," +
                                                                $" F_SZXY_CUSTBACTH = '{CustBacth}'," +
                                                                $" F_SZXY_BACTHQTY = '{OrderQty}'," +
                                                                $"  F_SZXY_PUDNO = '{MoNo}'," +
                                                                $"  F_SZXY_JQTY = '{F_SZXY_volume}'," +
                                                                $" F_SZXY_PUDLINENO = '{MoLineNo}' " +
                                                                $" where F_SZXY_CTNNO = '{F_SZXY_NO}'";
                                            DBServiceHelper.Execute(Context, updatesql1);

                                            //string updatesql2 = $"/*dialect*/update a   " +
                                            //     $"set a.F_SZXY_MOID={MoId} " +
                                            //     $" from  SZXY_t_BZD a,SZXY_t_BZDHEntry b  " +
                                            //     $" where a.Fid=B.Fid and  b.F_SZXY_CTNNO = '{F_SZXY_NO}'";
                                            //DBServiceHelper.Execute(Context, updatesql2);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        /// 操作事件后 审核 执行后
        /// </summary>
        /// <param name="e"></param>
        private void Act_ABO_AfterAudit(AfterDoOperationEventArgs e)
        {
            string _FSplitFlag = this.CZ_GetValue_DF("FSplitFlag", "0");

            //if (_FSplitFlag != "1")
            //{
            //    //仅转货款时有后续动作
            //    return;
            //}

            #region 原始SQL语句 2020-04-23 此SQL语句已校验

            /*
             * ----复写手工记帐单 已收款金额\r\n       Spilt|Split
             * --select d.FReceiptEID,je.F_Ora_SpiltAmount,isnull(d.FSplitAmt,0),je.F_Ora_SpiltAmountFor,j.FExchangeRate*isnull(d.FSplitAmt,0)
             * update je set je.F_Ora_SpiltAmount=isnull(d.FSplitAmt,0),je.F_Ora_SpiltAmountFor=j.FExchangeRate*isnull(d.FSplitAmt,0)
             * from(select FReceiptEID from T_CZ_ReceiptSplitDetail where FID=100005)z
             * inner join T_CN_JOURNALENTRY je on z.FReceiptEID=je.FEntryID inner join T_CN_JOURNAL j on je.FID=j.FID
             * left join(select z.FReceiptEID,sum(r.FSplitAmt)FSplitAmt
             *      from(select FReceiptEID from T_CZ_ReceiptSplitDetail where FID=100005)z
             *      inner join T_CZ_ReceiptSplitDetail rd on z.FReceiptEID=rd.FReceiptEID
             *      inner join T_CZ_ReceiptSplit r on rd.FID=r.FID and r.FDocumentStatus='C'
             *      group by z.FReceiptEID )d on z.FReceiptEID=d.FReceiptEID ;
             *
             * ----复写销售订单收款计划 已收款金额 \r\n
             * --select op.FEntryID,op.F_Ora_SplitAmount,isnull(d.FSplitAmount,0),F_Ora_SplitAmountFor,isnull(d.FSplitAmountFor,0)
             * update op set op.F_Ora_SplitAmount=isnull(d.FSplitAmount,0),op.FRecAmount=isnull(d.FSplitAmount,0),F_Ora_SplitAmountFor=isnull(d.FSplitAmountFor,0)
             * from(select FOrderPlanEID from T_CZ_ReceiptSplitOrderPlan where FID=100005)z
             * inner join t_Sal_OrderPlan op on z.FOrderPlanEID=op.FEntryID
             * left join(select z.FOrderPlanEID,sum(rp.FSplitAmount)FSplitAmount,sum(FSplitAmountFor)FSplitAmountFor
             *      from(select FOrderPlanEID from T_CZ_ReceiptSplitOrderPlan where FID=100005)z
             *      inner join T_CZ_ReceiptSplitOrderPlan rp on z.FOrderPlanEID=rp.FOrderPlanEID
             *      inner join T_CZ_ReceiptSplit r on rp.FID=r.FID and r.FDocumentStatus='C'
             *      group by z.FOrderPlanEID )d on z.FOrderPlanEID=d.FOrderPlanEID
             */
            #endregion
            string        _FID = this.CZ_GetFormID();
            StringBuilder _sb  = new StringBuilder();
            _sb.Append("/*dialect*/");
            //----复写手工记帐单 已收款金额
            //--select d.FReceiptEID,je.F_Ora_SpiltAmount,isnull(d.FSplitAmt,0),je.F_Ora_SpiltAmountFor,j.FExchangeRate*isnull(d.FSplitAmt,0)
            _sb.Append("update je set je.F_Ora_SplitAmount=isnull(d.FSplitAmt,0),je.F_Ora_SplitAmountFor=j.FExchangeRate*isnull(d.FSplitAmt,0) ");
            _sb.Append("from(select FReceiptEID from T_CZ_ReceiptSplitDetail where FID=" + _FID + ")z ");
            _sb.Append("inner join T_CN_JOURNALENTRY je on z.FReceiptEID=je.FEntryID inner join T_CN_JOURNAL j on je.FID=j.FID ");
            _sb.Append("left join(select z.FReceiptEID,sum(r.FSplitAmt)FSplitAmt ");
            _sb.Append("from(select FReceiptEID from T_CZ_ReceiptSplitDetail where FID=" + _FID + ")z ");
            _sb.Append("inner join T_CZ_ReceiptSplitDetail rd on z.FReceiptEID=rd.FReceiptEID ");
            _sb.Append("inner join T_CZ_ReceiptSplit r on rd.FID=r.FID and r.FDocumentStatus='C' ");
            _sb.Append("group by z.FReceiptEID )d on z.FReceiptEID=d.FReceiptEID ;");
            //----复写销售订单收款计划 已收款金额
            //--select op.FEntryID,op.F_Ora_ReceiveAmount,isnull(d.FSplitAmount,0),F_Ora_ReceiveAmountFor,isnull(d.FSplitAmountFor,0)
            //_sb.Append("update op set op.F_Ora_SplitAmount=isnull(d.FSplitAmount,0),op.FRecAmount=isnull(d.FSplitAmount,0), ");
            //_sb.Append("F_Ora_SplitAmountFor=isnull(d.FSplitAmountFor,0) ");
            _sb.Append("update op set op.F_Ora_SplitAmount=isnull(d.FSplitAmount,0),F_Ora_SplitAmountFor=isnull(d.FSplitAmountFor,0) ");
            _sb.Append("from(select FOrderPlanEID from T_CZ_ReceiptSplitOrderPlan where FID=" + _FID + ")z ");
            _sb.Append("inner join t_Sal_OrderPlan op on z.FOrderPlanEID=op.FEntryID ");
            _sb.Append("left join(select z.FOrderPlanEID,sum(rp.FSplitAmount)FSplitAmount,sum(FSplitAmountFor)FSplitAmountFor ");
            _sb.Append("from(select FOrderPlanEID from T_CZ_ReceiptSplitOrderPlan where FID=" + _FID + ")z ");
            _sb.Append("inner join T_CZ_ReceiptSplitOrderPlan rp on z.FOrderPlanEID=rp.FOrderPlanEID ");
            _sb.Append("inner join T_CZ_ReceiptSplit r on rp.FID=r.FID and r.FDocumentStatus='C' ");
            _sb.Append("group by z.FOrderPlanEID )d on z.FOrderPlanEID=d.FOrderPlanEID ");
            try
            {
                DBServiceHelper.Execute(base.Context, _sb.ToString());
            }
            catch (Exception ex)
            {
                this.View.ShowErrMessage("执行更新发生错误");
            }
        }
Example #23
0
        private void SetValue(DataSet LsDSA, string LsNo)
        {
            string F_SZXY_SeqH = Convert.ToString(this.Model.GetValue("F_SZXY_SeqH"));//层序
            string cx1         = "";
            string cx2         = "";

            if (this.Model.GetValue("F_SZXY_OrgId") is DynamicObject orgobj)
            {
                cx1 = $"1-{F_SZXY_SeqH}";
                cx2 = $"{Convert.ToInt32(F_SZXY_SeqH) + 1}-{  Convert.ToString(LsDSA.Tables[0].Rows[0]["层数"])}";

                bool IsRenZ = false;
                int  RZQTY  = 0;
                if (LsDSA != null && LsDSA.Tables.Count > 0 && LsDSA.Tables[0].Rows.Count > 0)
                {
                    int m = this.Model.GetEntryRowCount("F_SZXY_DFDEntity");
                    for (int i = 0; i < LsDSA.Tables[0].Rows.Count; i++)
                    {
                        int index = m + i;
                        if (i == 0)
                        {
                            //给单据头赋值
                            if (!Convert.ToString(LsDSA.Tables[0].Rows[i]["生产订单内码"]).IsNullOrEmptyOrWhiteSpace())
                            {
                                this.Model.SetValue("F_SZXY_MOID", Convert.ToInt64(LsDSA.Tables[0].Rows[i]["生产订单内码"]));
                            }
                            this.Model.SetValue("F_SZXY_PTNoH", LsDSA.Tables[0].Rows[i]["生产任务单号"].ToString());
                            this.Model.SetValue("F_SZXY_POLineNum", LsDSA.Tables[0].Rows[i]["生产订单行号"].ToString());
                            if (!Convert.ToString(LsDSA.Tables[0].Rows[i]["特殊标志"]).IsNullOrEmptyOrWhiteSpace())
                            {
                                this.Model.SetValue("F_SZXY_SpecialMarkH", Convert.ToString(LsDSA.Tables[0].Rows[i]["特殊标志"]));
                            }
                            if (!Convert.ToString(LsDSA.Tables[0].Rows[i]["班组"]).IsNullOrEmptyOrWhiteSpace())
                            {
                                this.Model.SetValue("F_SZXY_TeamGroup", Convert.ToInt64(LsDSA.Tables[0].Rows[i]["班组"]));
                            }
                            if (!Convert.ToString(LsDSA.Tables[0].Rows[i]["班次"]).IsNullOrEmptyOrWhiteSpace())
                            {
                                this.Model.SetValue("F_SZXY_Classes", Convert.ToInt64(LsDSA.Tables[0].Rows[i]["班次"]));
                            }
                            if (!Convert.ToString(LsDSA.Tables[0].Rows[i]["配方"]).IsNullOrEmptyOrWhiteSpace())
                            {
                                this.Model.SetValue("F_SZXY_FormulaH", Convert.ToString(LsDSA.Tables[0].Rows[i]["配方"]));
                            }
                            if (!Convert.ToString(LsDSA.Tables[0].Rows[i]["产品型号"]).IsNullOrEmptyOrWhiteSpace())
                            {
                                string RMat = Utils.GetRootMatId(Convert.ToString(LsDSA.Tables[0].Rows[i]["产品型号"]), orgobj["Id"].ToString(), Context);
                                this.Model.SetValue("F_SZXY_MaterialID1", RMat);
                                if (this.Model.GetValue("F_SZXY_MaterialID1") is DynamicObject MatDo)
                                {
                                    if (!Convert.ToString(MatDo["F_SZXY_renzenQTY"]).IsNullOrEmptyOrWhiteSpace())
                                    {
                                        IsRenZ = true;
                                        RZQTY  = Convert.ToInt32(MatDo["F_SZXY_renzenQTY"]);
                                    }
                                }
                            }
                            if (!Convert.ToString(LsDSA.Tables[0].Rows[i]["流延机"]).IsNullOrEmptyOrWhiteSpace())
                            {
                                this.Model.SetValue("F_SZXY_plasticMac", Convert.ToString(LsDSA.Tables[0].Rows[i]["流延机"]));
                            }
                            this.Model.SetValue("F_SZXY_AreaH", Convert.ToDecimal(LsDSA.Tables[0].Rows[i]["面积"]));
                            if (!Convert.ToString(LsDSA.Tables[0].Rows[i]["车间"]).IsNullOrEmptyOrWhiteSpace())
                            {
                                this.Model.SetValue("F_SZXY_CJ", Convert.ToInt64(LsDSA.Tables[0].Rows[i]["车间"]));
                            }

                            DynamicObject FCreatorIdobj = this.Model.GetValue("FCreatorId") as DynamicObject;
                            if (!Convert.ToString(FCreatorIdobj["Id"]).IsNullOrEmptyOrWhiteSpace())
                            {
                                this.Model.SetValue("F_SZXY_Recorder_Id", Convert.ToString(FCreatorIdobj["Id"]));
                            }
                            if (!Convert.ToString(LsDSA.Tables[0].Rows[i]["层数"]).IsNullOrEmptyOrWhiteSpace())
                            {
                                this.Model.SetValue("F_SZXY_Layer", Convert.ToString(LsDSA.Tables[0].Rows[i]["层数"]));
                            }
                            DynamicObject billobj = this.Model.DataObject;
                        }
                        //单据体赋值
                        this.Model.CreateNewEntryRow("F_SZXY_DFDEntity");
                        this.Model.SetValue("F_SZXY_StretchNO", LsNo, index);
                        this.Model.SetValue("F_SZXY_bipartitionWidth", Convert.ToDecimal(LsDSA.Tables[0].Rows[i]["宽度"]), index);
                        this.Model.SetValue("F_SZXY_bipartitionLen", Convert.ToDecimal(LsDSA.Tables[0].Rows[i]["长度"]), index);
                        this.Model.SetValue("F_SZXY_bipartitionArea", Convert.ToDecimal(LsDSA.Tables[0].Rows[i]["汇总面积"]), index);
                        this.Model.SetValue("F_SZXY_bipartition", Convert.ToString(LsDSA.Tables[0].Rows[i]["对分层数"]), index);
                        this.Model.SetValue("F_SZXY_StretchC", cx1, index);
                        string DFNo = "";//拉伸编号+拉伸层次
                        if (cx1 != "" && i == 0)
                        {
                            this.Model.SetValue("F_SZXY_StretchC", cx1, index);
                            //this.Model.SetValue("F_SZXY_bipartition", Convert.ToInt32(this.Model.GetValue("F_SZXY_SeqH")));
                            DFNo = $"{LsNo}{cx1}";

                            this.Model.SetValue("F_SZXY_bipartitionNO", DFNo, index);
                        }
                        if (cx2 != "" && i == 1)
                        {
                            this.Model.SetValue("F_SZXY_StretchC", cx2, index);
                            //this.Model.SetValue("F_SZXY_bipartition", Convert.ToInt32(this.Model.GetValue("F_SZXY_SeqH")));
                            DFNo = $"{LsNo}{cx2}";
                            this.Model.SetValue("F_SZXY_bipartitionNO", DFNo, index);

                            if (RZQTY > 0 && IsRenZ && BFTYPE.EqualsIgnoreCase("单层"))
                            {
                                string b1 = "";
                                string b2 = "";
                                //string LsNo = Convert.ToString(billobj["F_SZXY_ProductNo"]);
                                string  Before = Convert.ToString(Convert.ToInt32(ASEQ.ToString()) + 1);
                                string  selsql = $"select F_SZXY_RollNo from SZXY_t_XYLSEntry where F_SZXY_STRETCHNO='{LsNo}' and FSeq={Before} ";
                                DataSet Ds1    = DBServiceHelper.ExecuteDataSet(Context, selsql);
                                if (Ds1 != null && Ds1.Tables.Count > 0 && Ds1.Tables[0].Rows.Count > 0)
                                {
                                    b1 = Convert.ToString(Ds1.Tables[0].Rows[0]["F_SZXY_RollNo"]);
                                }
                                string  selsql1 = $"select top 1 F_SZXY_RollNo from SZXY_t_XYLSEntry where F_SZXY_STRETCHNO='{LsNo}' order by FSeq Desc";
                                DataSet Ds11    = DBServiceHelper.ExecuteDataSet(Context, selsql1);
                                if (Ds11 != null && Ds11.Tables.Count > 0 && Ds11.Tables[0].Rows.Count > 0)
                                {
                                    b2 = Convert.ToString(Ds11.Tables[0].Rows[0]["F_SZXY_RollNo"]);
                                    // b2 = String.Format("{0:D2}", Convert.ToInt32( b2));
                                }
                                cx2  = $"{b1}-{b2}";
                                DFNo = $"{LsNo}{cx2}";
                                this.Model.SetValue("F_SZXY_StretchC", cx2, index);
                            }
                            this.Model.SetValue("F_SZXY_bipartitionNO", DFNo, index);
                        }
                    }
                    //调用保存
                    //
                    string UpdateStateSql = string.Format("/*dialect*/update SZXY_t_XYLS set  F_SZXY_CirculationState1={0}   where F_SZXY_RecNo='{1}' ", 1, LsNo);
                    int    res            = DBServiceHelper.Execute(Context, UpdateStateSql);


                    View.Model.DataObject["FFormId"] = this.View.BusinessInfo.GetForm().Id;
                    Utils.Save(View, new DynamicObject[] { View.Model.DataObject }, Kingdee.BOS.Orm.OperateOption.Create(), Context);
                    this.View.UpdateView();
                }
                else
                {
                    this.View.ShowMessage("此编号没有匹配到数据!");
                }
                //if (LsDSB != null && LsDSB.Tables.Count > 0 && LsDSB.Tables[0].Rows.Count > 0)
                //{
                //    int m = this.Model.GetEntryRowCount("F_SZXY_DFDEntity");
                //    for (int i = 0; i < LsDSB.Tables[0].Rows.Count; i++)
                //    {
                //        int index = m + i;
                //        if (i == 0)
                //        //单据体赋值
                //        this.Model.CreateNewEntryRow("F_SZXY_DFDEntity");
                //        this.Model.SetValue("F_SZXY_StretchNO", LsNo, index);
                //        this.Model.SetValue("F_SZXY_bipartitionWidth", Convert.ToDecimal(LsDSB.Tables[0].Rows[i]["宽度"]), index);
                //        this.Model.SetValue("F_SZXY_bipartitionLen", Convert.ToDecimal(LsDSB.Tables[0].Rows[i]["长度"]), index);
                //        this.Model.SetValue("F_SZXY_bipartitionArea", Convert.ToDecimal(LsDSB.Tables[0].Rows[i]["汇总面积"]), index);
                //       // this.Model.SetValue("F_SZXY_bipartition", Convert.ToString(LsDSB.Tables[0].Rows[i]["对分层数"]), index);
                //        this.Model.SetValue("F_SZXY_StretchC", cx2, index);
                //        string DFNo = "";//拉伸编号+拉伸层次
                //        if (cx2!= "")
                //        {
                //            string[] strArr = cx2.Split('-');
                //            int A = Convert.ToInt32(strArr[0]);
                //            int B = Convert.ToInt32(strArr[1]);
                //            this.Model.SetValue("F_SZXY_bipartition", Convert.ToInt32(this.Model.GetValue("F_SZXY_SeqH")) - B);
                //            DFNo = $"{LsNo}{cx2}";
                //        }

                //        this.Model.SetValue("F_SZXY_bipartitionNO", DFNo, index);

                //    }

                //}
            }
        }
Example #24
0
        public override void BeginOperationTransaction(BeginOperationTransactionArgs e)
        {
            try
            {
                string sql = string.Empty;
                if (e.DataEntitys != null && e.DataEntitys.Count <DynamicObject>() > 0)
                {
                    foreach (DynamicObject item in e.DataEntitys)
                    {
                        string upsql = "";
                        string FID   = item["Id"].ToString();
                        //供应商
                        string F_YBG_Supplier = item["SupplierId_Id"].ToString();
                        //仓库
                        string F_YBG_Warehouse = item["F_YBG_Warehouse_Id"].ToString();
                        //业务模式
                        string CRBusinessModel     = item["F_YBG_BusinessModel"].ToString().Trim();
                        string F_YBG_BUSINESSMODEL = ""; //其他仓库默认01
                        if (string.IsNullOrEmpty(CRBusinessModel))
                        {
                            if (F_YBG_Supplier == "0" || F_YBG_Warehouse == "0")
                            {
                                throw new Exception("提交失败:未填写仓库和供应商!");
                            }
                            else
                            {
                                //仓库编码
                                sql = string.Format(@"select  FNumber from t_BD_Stock where FSTOCKID='{0}'", F_YBG_Warehouse);
                                string CKFNumber = DBServiceHelper.ExecuteScalar <string>(this.Context, sql, null, null);
                                //供应商编码 ---自营VEN00057  VEN00099 VEN00256
                                sql = string.Format(@"select  FNumber from t_BD_Supplier where FSUPPLIERID='{0}'", F_YBG_Supplier);
                                string SPFNUMBER = DBServiceHelper.ExecuteScalar <string>(this.Context, sql, null, null);

                                //珠海仓
                                if (CKFNumber.StartsWith("YBG001") || CKFNumber.StartsWith("YBG015") || CKFNumber.StartsWith("YBG017"))
                                {
                                    F_YBG_BUSINESSMODEL = "07"; //珠海自营 07
                                    upsql = string.Format(@"/*dialect*/ update t_PUR_POOrder set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID);
                                }
                                //自营
                                else
                                {
                                    F_YBG_BUSINESSMODEL = "05"; //自营 05
                                    upsql = string.Format(@"/*dialect*/ update t_PUR_POOrder set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID);
                                }
                            }
                            //更新业务模式
                            DBServiceHelper.Execute(this.Context, upsql);
                        }
                        else
                        {
                            #region 注释
                            //if (F_YBG_Supplier == "0" || F_YBG_Warehouse == "0")
                            //{
                            //    throw new Exception("提交失败:未填写仓库和供应商!");
                            //}
                            ////仓库编码
                            //sql = string.Format(@"select  FNumber from t_BD_Stock where FSTOCKID='{0}'", F_YBG_Warehouse);
                            //string CKFNumber = DBServiceHelper.ExecuteScalar<string>(this.Context, sql, null, null);
                            ////供应商编码 ---自营VEN00057  VEN00099 VEN00256
                            //sql = string.Format(@"select  FNumber from t_BD_Supplier where FSUPPLIERID='{0}'", F_YBG_Supplier);
                            //string SPFNUMBER = DBServiceHelper.ExecuteScalar<string>(this.Context, sql, null, null);
                            ////非嘉里开头的
                            //if (CKFNumber.StartsWith("ZF")) //挂靠01
                            //{
                            //    F_YBG_BUSINESSMODEL = "01";
                            //}
                            ////嘉里开头
                            //else if (CKFNumber.StartsWith("JLZF")) //04 挂靠自发
                            //{
                            //    F_YBG_BUSINESSMODEL = "04";

                            //}
                            ////嘉里物流主仓 嘉里苏宁移动仓
                            //else if (CKFNumber.StartsWith("JL002") || CKFNumber.StartsWith("JLSN001"))
                            //{
                            //    // 是壹办公供应商或者自营供应商
                            //    if (SPFNUMBER.Contains("VEN00057") || SPFNUMBER.Contains("VEN00099")) //自营 05
                            //    {
                            //        F_YBG_BUSINESSMODEL = "05";

                            //    }
                            //    else //代采 06
                            //    {
                            //        F_YBG_BUSINESSMODEL = "06";

                            //    }
                            //}
                            ////珠海仓
                            //else if (CKFNumber.StartsWith("YBG001") || CKFNumber.StartsWith("YBG015") || CKFNumber.StartsWith("YBG017"))
                            //{
                            //    F_YBG_BUSINESSMODEL = "07"; //珠海自营 07


                            //}
                            //// 观澜仓 车公庙仓
                            //else if (CKFNumber.StartsWith("YBG002") || CKFNumber.StartsWith("YBG003"))
                            //{
                            //    //壹办公供应商或者自营供应商
                            //    if (SPFNUMBER.Contains("VEN00057") || SPFNUMBER.Contains("VEN00099")) //自营直发02
                            //    {
                            //        F_YBG_BUSINESSMODEL = "02";

                            //    }
                            //    else //代采直发 03
                            //    {
                            //        F_YBG_BUSINESSMODEL = "03";

                            //    }

                            //}
                            //else //其他仓库默认01
                            //{
                            //    //壹办公供应商或者自营供应商
                            //    if (SPFNUMBER.Contains("VEN00057") || SPFNUMBER.Contains("VEN00099")) //自营 05
                            //    {
                            //        F_YBG_BUSINESSMODEL = "05"; //自营

                            //    }
                            //    else
                            //    {
                            //        F_YBG_BUSINESSMODEL = "01";
                            //    }
                            //}
                            //if (F_YBG_BUSINESSMODEL != CRBusinessModel)
                            //{
                            //    throw new Exception("采购订单业务模式改变了,不能提交!");
                            //}


                            #endregion
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("提交失败:" + ex.ToString());
            }
        }
Example #25
0
        /// <summary>
        ///点击确定按钮
        /// </summary>
        /// <param name="e"></param>
        public override void ButtonClick(ButtonClickEventArgs e)
        {
            if (e.Key.EqualsIgnoreCase("F_JD_BTNOK"))
            {
                try
                {
                    this.View.GetControl("F_JD_BTNOK").Enabled = false;
                    if (FileNameList.Count < 1)
                    {
                        this.View.ShowMessage("未检测到需要引入的excel文件!", MessageBoxType.Error);
                    }
                    else
                    {
                        ///读取excel到Dataset
                        DataSet dss_1;
                        string  sql       = string.Empty;
                        string  updatesql = string.Empty;
                        string  err_row   = "";
                        using (ExcelOperation helper = new ExcelOperation(this.View))
                        {
                            dss_1 = helper.ReadFromFile(FileNameList[0], 0, 0);
                        }
                        //获取当前所有物料
                        sql = "select FMASTERID, FNUMBER FROM T_BD_MATERIAL";
                        DataSet   ds      = DBServiceHelper.ExecuteDataSet(this.Context, sql);
                        DataTable dt_Item = ds.Tables[0];
                        dt_Item.PrimaryKey = new DataColumn[] { dt_Item.Columns["FNUMBER"] }; //设置主键
                        DataTable dt_ex = dss_1.Tables[0];
                        //读取excel
                        for (int i = 1; i < dt_ex.Rows.Count; i++)
                        {
                            //物料编码
                            string WlNumber = dt_ex.Rows[i][3].ToString();
                            //单位编码
                            string DWFnumber = dt_ex.Rows[i][5].ToString();
                            //pcs换算率
                            int Fdate = string.IsNullOrEmpty(dt_ex.Rows[i][7].ToString()) ? 0 : Convert.ToInt32(dt_ex.Rows[i][7].ToString());
                            //单箱数量
                            int Dxqty = string.IsNullOrEmpty(dt_ex.Rows[i][8].ToString()) ? 0 : Convert.ToInt32(dt_ex.Rows[i][8].ToString());

                            //判断是否存在改物料

                            DataRow dr_item = dt_Item.Rows.Find(dt_ex.Rows[i][3].ToString());

                            if (dr_item == null)
                            {
                                err_row += "第【" + i + "】行分录,物料代码【" + dt_ex.Rows[i][3].ToString() + "】不存在。\r\n";
                                continue;
                            }
                            else
                            {
                                if (DWFnumber == "PCS")
                                {
                                    Fdate = 1;
                                }
                                updatesql += "/*dialect*/  update T_BD_MATERIAL set FDXQTY=" + Dxqty + ",FPCSCONVERT=" + Fdate + " where FNUMBER='" + WlNumber + "';";
                            }
                        }
                        //更新
                        int reult = DBServiceHelper.Execute(this.Context, updatesql);
                        this.View.ShowMessage("更新成功 \r\n" + err_row.ToString(), MessageBoxType.AskOK);
                        this._FileList.Clear();
                        this.FileNameList.Clear();
                        this.View.GetControl("F_JD_FileUpdate").SetValue(DBNull.Value);
                        this.View.Refresh();
                        return;
                    }
                }
                catch (Exception ex)
                {
                    this.View.ShowMessage("更新换算率失败:" + ex.ToString(), MessageBoxType.Error);
                    this._FileList.Clear();
                    this.FileNameList.Clear();
                    this.View.GetControl("F_JD_FileUpdate").SetValue(DBNull.Value);
                    this.View.Refresh();
                    return;
                }
            }
        }
Example #26
0
        public override void BeginOperationTransaction(BeginOperationTransactionArgs e)
        {
            try
            {
                string sql = string.Empty;
                if (e.DataEntitys != null && e.DataEntitys.Count <DynamicObject>() > 0)
                {
                    foreach (DynamicObject item in e.DataEntitys)
                    {
                        //财务应收fid
                        string Fid = item["Id"].ToString();
                        //单据类型
                        string FBILLTYPEID = item["BillTypeID_Id"].ToString();
                        //只有财务应收的采用反写
                        #region
                        if (FBILLTYPEID == "5d18aa0e58407c")
                        {
                            string upsql      = "";
                            string UpdatesqlH = "";
                            sql = string.Format(@"select are.FORDERENTRYID as FORDERENTRYID,ar.FMODIFYDATE as 修改时间,ar.F_YBG_CheckBox,arE.FTAXPRICE as  含税单价,arE.FPRICE as 不含税单价,
                                                  are.FENTRYID as AreFENTRYID,arel.FBASICUNITQTY, arf.FALLAMOUNT as 表头价税合计,
                                                  arf.FNOTAXAMOUNT as 表头不含税金额 , are.FALLAMOUNTFOR as 表体价税合计,are.FIsModifyPrice,
                                                  arE.FNOTAXAMOUNTFOR as 表体不含税金额 ,arE.FPRICEQTY as 计价数量 ,arel.FSTABLENAME,arel.FSID
                                                   from t_AR_receivable ar inner join t_AR_receivableEntry arE on ar.FID=arE.FID
                                                   inner join T_AR_RECEIVABLEENTRY_LK arel on arel.FENTRYID=are.FENTRYID
                                                   left join t_AR_receivableFIN  arf on arf.FID=ar.FID  where ar.FID='{0}'", Fid);
                            DataSet   ds = DBServiceHelper.ExecuteDataSet(this.Context, sql);
                            DataTable dt = ds.Tables[0];
                            if (dt.Rows.Count > 0)
                            {
                                for (int i = 0; i < dt.Rows.Count; i++)
                                {
                                    string FORDERENTRYID = dt.Rows[i]["FORDERENTRYID"].ToString();
                                    string FSID          = dt.Rows[i]["FSID"].ToString();
                                    //是否修改了单价
                                    string FIsModifyPrice = dt.Rows[i]["FIsModifyPrice"].ToString();
                                    //decimal FALLAMOUNT = Convert.ToDecimal(dt.Rows[i]["表头价税合计"].ToString());
                                    // decimal FNOTAXAMOUNT = Convert.ToDecimal(dt.Rows[i]["表头不含税金额"].ToString());
                                    decimal FALLAMOUNTFOR   = Math.Abs(Convert.ToDecimal(dt.Rows[i]["表体价税合计"].ToString()));
                                    decimal FNOTAXAMOUNTFOR = Math.Abs(Convert.ToDecimal(dt.Rows[i]["表体不含税金额"].ToString()));
                                    decimal FPRICEQTY       = Math.Abs(Convert.ToDecimal(dt.Rows[i]["计价数量"].ToString()));
                                    decimal FBASICUNITQTY   = Math.Abs(Convert.ToDecimal(dt.Rows[i]["FBASICUNITQTY"].ToString())); //暂估基本数量、
                                    decimal FTAXPRICE       = Math.Abs(Convert.ToDecimal(dt.Rows[i]["含税单价"].ToString()));          //含税单价
                                    decimal FPRICE          = Math.Abs(Convert.ToDecimal(dt.Rows[i]["不含税单价"].ToString()));         //不含税单价
                                    string  FMODIFYDATE     = dt.Rows[i]["修改时间"].ToString();
                                    //string F_YBG_CheckBox= dt.Rows[i]["F_YBG_CheckBox"].ToString();
                                    if (FPRICEQTY != FBASICUNITQTY)
                                    {
                                        FALLAMOUNTFOR   = FALLAMOUNTFOR * (FBASICUNITQTY / FPRICEQTY);
                                        FNOTAXAMOUNTFOR = FNOTAXAMOUNTFOR * (FBASICUNITQTY / FPRICEQTY);
                                        FPRICEQTY       = FBASICUNITQTY;
                                    }
                                    //更新暂估应收
                                    upsql += string.Format(@"/*dialect*/ update t_AR_receivableEntry set FIsLockPrice=1  where FENTRYID ='{0}'", FSID);

                                    string FSTABLENAME = "";
                                    sql = string.Format(@"select FSID as 销售出库单FENTRYID ,FSBILLID as 销售出库单id,FSTABLENAME 
                                                          from  T_AR_RECEIVABLEENTRY_LK where FENTRYID={0}", FSID);
                                    DataSet   ds2 = DBServiceHelper.ExecuteDataSet(this.Context, sql);
                                    DataTable dt2 = ds2.Tables[0];
                                    if (dt2.Rows.Count > 0)
                                    {
                                        for (int j = 0; j < dt2.Rows.Count; j++)
                                        {
                                            FSTABLENAME = dt2.Rows[j]["FSTABLENAME"].ToString();
                                            if (FSTABLENAME == "T_SAL_OUTSTOCKENTRY")
                                            {
                                                //销售出库单表头
                                                UpdatesqlH += string.Format(@"/*dialect*/ update T_SAL_OUTSTOCK set FARFNOTAXAMOUNTFOR_H=FARFNOTAXAMOUNTFOR_H+{1},FARFALLAMOUNTFOR_H=FARFALLAMOUNTFOR_H+{2},FARFMODIFYDATE='{3}'   
                                                                                   from  T_SAL_OUTSTOCK a inner join T_SAL_OUTSTOCKENTRY_R b on a.FID=b.FID where a.FID ='{0}' and FSOENTRYID='{4}'", dt2.Rows[j]["销售出库单id"].ToString(), FNOTAXAMOUNTFOR, FALLAMOUNTFOR, FMODIFYDATE, FORDERENTRYID);
                                                //销售出库单表体
                                                upsql += string.Format(@"/*dialect*/ update T_SAL_OUTSTOCKENTRY set FARFNOTAXAMOUNTFOR=FARFNOTAXAMOUNTFOR+{1},FARFALLAMOUNTFOR=FARFALLAMOUNTFOR+{2} ,FARFQty=FARFQty+{3},FARFTAXPRICE={4},FIsModifyPrice={5},FARFPRICE={6}  
                                                                             from  T_SAL_OUTSTOCKENTRY a inner join T_SAL_OUTSTOCKENTRY_R b on a.FID=b.FID where a.FENTRYID ='{0}'and FSOENTRYID='{7}'", dt2.Rows[j]["销售出库单FENTRYID"].ToString(), FNOTAXAMOUNTFOR, FALLAMOUNTFOR, FPRICEQTY, FTAXPRICE, FIsModifyPrice, FPRICE, FORDERENTRYID);
                                            }
                                            else
                                            {
                                                //销售退货单表头
                                                UpdatesqlH += string.Format(@"/*dialect*/ update T_SAL_RETURNSTOCK set FARFNOTAXAMOUNTFOR_H=FARFNOTAXAMOUNTFOR_H+{1},FARFALLAMOUNTFOR_H=FARFALLAMOUNTFOR_H+{2},FARFMODIFYDATE='{3}'     
                                                                           from  T_SAL_RETURNSTOCK a inner join T_SAL_RETURNSTOCKENTRY b on a.FID=b.FID  
                                                                          where a.FID ='{0}'and FSOENTRYID='{4}'", dt2.Rows[j]["销售出库单id"].ToString(), FNOTAXAMOUNTFOR, FALLAMOUNTFOR, FMODIFYDATE, FORDERENTRYID);
                                                //销售退货表体
                                                upsql += string.Format(@"/*dialect*/ update T_SAL_RETURNSTOCKENTRY set FARFNOTAXAMOUNTFOR=FARFNOTAXAMOUNTFOR+{1},FARFALLAMOUNTFOR=FARFALLAMOUNTFOR+{2} ,FARFQty=FARFQty+{3},FARFTAXPRICE={5},FIsModifyPrice={6},FARFPRICE={7}    
                                                                               where FENTRYID ='{0}'and FSOENTRYID='{4}'", dt2.Rows[j]["销售出库单FENTRYID"].ToString(), FNOTAXAMOUNTFOR, FALLAMOUNTFOR, FPRICEQTY, FORDERENTRYID, FTAXPRICE, FIsModifyPrice, FPRICE);
                                            }
                                        }
                                    }
                                }
                                //更新销售出库单表头
                                DBServiceHelper.Execute(Context, UpdatesqlH);
                                //更新销售出库单表体
                                DBServiceHelper.Execute(Context, upsql);
                            }
                        }
                        #endregion
                    }
                }
            }
            catch (Exception ex)
            {
                throw new KDException("", "审核失败:" + ex.ToString());
            }
        }
Example #27
0
        /// <summary>
        /// 更新修改后的金额
        /// </summary>
        /// <param name="e"></param>
        public override void EndOperationTransaction(EndOperationTransactionArgs e)
        {
            try
            {
                string sql = string.Empty;
                if (e.DataEntitys != null && e.DataEntitys.Count <DynamicObject>() > 0)
                {
                    foreach (DynamicObject item in e.DataEntitys)
                    {
                        HashSet <string> hsset = new HashSet <string>();
                        //财务应收fid
                        string Fid = item["Id"].ToString();
                        //单据类型
                        string FBILLTYPEID = item["BillTypeID_Id"].ToString();
                        //只有财务应收的采用反写
                        #region
                        if (FBILLTYPEID == "5d18aa0e58407c")
                        {
                            string upsql = "";

                            string FSTABLENAME = "";
                            sql = string.Format(@"select ar.FMODIFYDATE as 修改时间,are.FENTRYID as AreFENTRYID,arel.FBASICUNITQTY, arf.FALLAMOUNT as 表头价税合计,arf.FNOTAXAMOUNT as 表头不含税金额 , are.FALLAMOUNTFOR as 表体价税合计,arE.FNOTAXAMOUNTFOR as 表体不含税金额 ,arE.FPRICEQTY as 计价数量 ,arel.FSTABLENAME,arel.FSID
                                                   from t_AR_receivable ar inner join t_AR_receivableEntry arE on ar.FID=arE.FID
                                                   inner join T_AR_RECEIVABLEENTRY_LK arel on arel.FENTRYID=are.FENTRYID
                                                   left join t_AR_receivableFIN  arf on arf.FID=ar.FID  where ar.FID='{0}'", Fid);
                            DataSet   ds = DBServiceHelper.ExecuteDataSet(this.Context, sql);
                            DataTable dt = ds.Tables[0];
                            if (dt.Rows.Count > 0)
                            {
                                for (int i = 0; i < dt.Rows.Count; i++)
                                {
                                    string FSID = dt.Rows[i]["FSID"].ToString();
                                    //decimal FALLAMOUNT = Convert.ToDecimal(dt.Rows[i]["表头价税合计"].ToString());
                                    // decimal FNOTAXAMOUNT = Convert.ToDecimal(dt.Rows[i]["表头不含税金额"].ToString());
                                    decimal FALLAMOUNTFOR   = Math.Abs(Convert.ToDecimal(dt.Rows[i]["表体价税合计"].ToString()));
                                    decimal FNOTAXAMOUNTFOR = Math.Abs(Convert.ToDecimal(dt.Rows[i]["表体不含税金额"].ToString()));
                                    decimal FPRICEQTY       = Math.Abs(Convert.ToDecimal(dt.Rows[i]["计价数量"].ToString()));
                                    decimal FBASICUNITQTY   = Math.Abs(Convert.ToDecimal(dt.Rows[i]["FBASICUNITQTY"].ToString()));//暂估基本数量
                                    string  FMODIFYDATE     = dt.Rows[i]["修改时间"].ToString();
                                    if (FPRICEQTY != FBASICUNITQTY)
                                    {
                                        FALLAMOUNTFOR   = FALLAMOUNTFOR * (FBASICUNITQTY / FPRICEQTY);
                                        FNOTAXAMOUNTFOR = FNOTAXAMOUNTFOR * (FBASICUNITQTY / FPRICEQTY);
                                        FPRICEQTY       = FBASICUNITQTY;
                                    }
                                    sql = string.Format(@"select FSID as 销售出库单FENTRYID ,FSBILLID as 销售出库单id,FSTABLENAME 
                                                          from  T_AR_RECEIVABLEENTRY_LK where FENTRYID={0}", FSID);
                                    DataSet   ds2 = DBServiceHelper.ExecuteDataSet(this.Context, sql);
                                    DataTable dt2 = ds2.Tables[0];
                                    if (dt2.Rows.Count > 0)
                                    {
                                        for (int j = 0; j < dt2.Rows.Count; j++)
                                        {
                                            FSTABLENAME = dt2.Rows[j]["FSTABLENAME"].ToString();
                                            if (FSTABLENAME == "T_SAL_OUTSTOCKENTRY")
                                            {
                                                hsset.Add(dt2.Rows[j]["销售出库单id"].ToString());
                                                //销售出库单表体
                                                upsql += string.Format(@"/*dialect*/update T_SAL_OUTSTOCKENTRY set FTotalARFNOTAXAMOUNTFOR=(b.FSALUNITQTY-FARFQty)*b.FPRICE+FARFQty*a.FARFPRICE,
                                                                              FTotalARFALLAMOUNTFOR=(b.FSALUNITQTY-FARFQty)*b.FPRICE+FARFQty*a.FARFPRICE +((b.FSALUNITQTY-FARFQty)*b.FPRICE+FARFQty*a.FARFPRICE)*FTAXRATE/100
                                                                             from T_SAL_OUTSTOCKENTRY a inner join T_SAL_OUTSTOCKENTRY_F b on b.FENTRYID=a.FENTRYID
                                                                             where a.FENTRYID={0}", dt2.Rows[j]["销售出库单FENTRYID"].ToString());
                                            }
                                            else
                                            {
                                                hsset.Add(dt2.Rows[j]["销售出库单id"].ToString());
                                                //销售退货表体
                                                upsql += string.Format(@"/*dialect*/ update T_SAL_RETURNSTOCKENTRY 
                                                                           set FTotalARFNOTAXAMOUNTFOR=(a.FREALQTY-FARFQty)*b.FPRICE+FARFQty*a.FARFPRICE,
                                                                           FTotalARFALLAMOUNTFOR=(a.FREALQTY-FARFQty)*b.FPRICE+FARFQty*a.FARFPRICE +((a.FREALQTY-FARFQty)*b.FPRICE+FARFQty*a.FARFPRICE)*FTAXRATE/100
                                                                           from T_SAL_RETURNSTOCKENTRY a inner join T_SAL_RETURNSTOCKENTRY_F b on b.FENTRYID=a.FENTRYID 
                                                                           where a.FENTRYID={0}", dt2.Rows[j]["销售出库单FENTRYID"].ToString());
                                            }
                                        }
                                    }
                                }
                                //更新销售出库单表体
                                DBServiceHelper.Execute(Context, upsql);
                            }
                            string UpdatesqlH = "";
                            //更新表头
                            foreach (var hs in hsset)
                            {
                                if (FSTABLENAME == "T_SAL_OUTSTOCKENTRY")
                                {
                                    sql = string.Format(@"select sum(FTotalARFNOTAXAMOUNTFOR) as FTotalARFNOTAXAMOUNTFOR_H,
                                            sum(FTotalARFALLAMOUNTFOR) as FTotalARFALLAMOUNTFOR_H  from T_SAL_OUTSTOCKENTRY where FID={0}", hs);

                                    DataSet   ds2 = DBServiceHelper.ExecuteDataSet(this.Context, sql);
                                    DataTable dt2 = ds2.Tables[0];
                                    if (dt2.Rows.Count > 0)
                                    {
                                        for (int j = 0; j < dt2.Rows.Count; j++)
                                        {
                                            decimal FTotalARFNOTAXAMOUNTFOR_H = Convert.ToDecimal(dt2.Rows[j]["FTotalARFNOTAXAMOUNTFOR_H"].ToString());
                                            decimal FTotalARFALLAMOUNTFOR_H   = Convert.ToDecimal(dt2.Rows[j]["FTotalARFALLAMOUNTFOR_H"].ToString());
                                            UpdatesqlH += string.Format(@"/*dialect*/ update T_SAL_OUTSTOCK set FTotalARFNOTAXAMOUNTFOR_H={1},
                                                     FTotalARFALLAMOUNTFOR_H={2} where FID={0}", hs, FTotalARFNOTAXAMOUNTFOR_H, FTotalARFALLAMOUNTFOR_H);
                                        }
                                    }
                                }
                                else
                                {
                                    sql = string.Format(@"select sum(FTotalARFNOTAXAMOUNTFOR) as FTotalARFNOTAXAMOUNTFOR_H,
                                            sum(FTotalARFALLAMOUNTFOR) as FTotalARFALLAMOUNTFOR_H  from T_SAL_RETURNSTOCKENTRY where FID={0}", hs);
                                    DataSet   ds2 = DBServiceHelper.ExecuteDataSet(this.Context, sql);
                                    DataTable dt2 = ds2.Tables[0];
                                    if (dt2.Rows.Count > 0)
                                    {
                                        for (int j = 0; j < dt2.Rows.Count; j++)
                                        {
                                            decimal FTotalARFNOTAXAMOUNTFOR_H = Convert.ToDecimal(dt2.Rows[j]["FTotalARFNOTAXAMOUNTFOR_H"].ToString());
                                            decimal FTotalARFALLAMOUNTFOR_H   = Convert.ToDecimal(dt2.Rows[j]["FTotalARFALLAMOUNTFOR_H"].ToString());
                                            UpdatesqlH += string.Format(@"/*dialect*/ update T_SAL_RETURNSTOCK set FTotalARFNOTAXAMOUNTFOR_H={1},
                                                     FTotalARFALLAMOUNTFOR_H={2} where FID={0}", hs, FTotalARFNOTAXAMOUNTFOR_H, FTotalARFALLAMOUNTFOR_H);
                                        }
                                    }
                                }
                            }
                            //更新销售出库单表头/销售退货单
                            DBServiceHelper.Execute(Context, UpdatesqlH);
                        }
                        #endregion
                    }
                }
            }
            catch (Exception ex)
            {
                throw new KDException("", "审核失败:" + ex.ToString());
            }
        }
 public void Run(Kingdee.BOS.Context ctx, Schedule schedule)
 {
     try
     {
         string sql = string.Empty;
         #region
         sql = string.Format(@"select  FID, F_YBG_WAREHOUSE ,F_YBG_SUPPLIER from  T_SAL_ORDER where FDOCUMENTSTATUS='C' or FDOCUMENTSTATUS='B' ");
         DataSet   ds = DBServiceHelper.ExecuteDataSet(ctx, sql);
         DataTable dt = ds.Tables[0];
         if (dt.Rows.Count > 0)
         {
             string upsql = "";
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 string FID = dt.Rows[i]["FID"].ToString();
                 //供应商
                 string F_YBG_Supplier = dt.Rows[i]["F_YBG_SUPPLIER"].ToString();
                 //仓库
                 string F_YBG_Warehouse     = dt.Rows[i]["F_YBG_WAREHOUSE"].ToString();
                 string F_YBG_BUSINESSMODEL = ""; //其他仓库默认01
                 //仓库编码
                 sql = string.Format(@"select  FNumber from t_BD_Stock where FSTOCKID='{0}'", F_YBG_Warehouse);
                 string CKFNumber = DBServiceHelper.ExecuteScalar <string>(ctx, sql, "0", null);
                 //供应商编码 ---自营VEN00057  VEN00099 VEN00256
                 sql = string.Format(@"select  FNumber from t_BD_Supplier where FSUPPLIERID='{0}'", F_YBG_Supplier);
                 string SPFNUMBER = DBServiceHelper.ExecuteScalar <string>(ctx, sql, "0", null);
                 if (CKFNumber == "0" || SPFNUMBER == "0")
                 {
                 }
                 else
                 {
                     //非嘉里开头的
                     if (CKFNumber.StartsWith("ZF")) //挂靠01
                     {
                         F_YBG_BUSINESSMODEL = "01";
                         upsql += string.Format(@"/*dialect*/ update T_SAL_ORDER set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID);
                     }
                     //嘉里开头
                     else if (CKFNumber.StartsWith("JLZF")) //04 挂靠自发
                     {
                         F_YBG_BUSINESSMODEL = "04";
                         upsql += string.Format(@"/*dialect*/ update T_SAL_ORDER set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID);
                     }
                     //嘉里物流主仓 嘉里苏宁移动仓
                     else if (CKFNumber.StartsWith("JL002") || CKFNumber.StartsWith("JLSN001"))
                     {
                         // 是壹办公供应商或者自营供应商
                         if (SPFNUMBER.Contains("VEN00057") || SPFNUMBER.Contains("VEN00099") || SPFNUMBER.Contains("P451")) //自营 05
                         {
                             F_YBG_BUSINESSMODEL = "05";
                             upsql += string.Format(@"/*dialect*/ update T_SAL_ORDER set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID);
                         }
                         else //代采 06
                         {
                             F_YBG_BUSINESSMODEL = "06";
                             upsql += string.Format(@"/*dialect*/ update T_SAL_ORDER set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID);
                         }
                     }
                     //珠海仓
                     else if (CKFNumber.StartsWith("YBG001") || CKFNumber.StartsWith("YBG015") || CKFNumber.StartsWith("YBG017"))
                     {
                         F_YBG_BUSINESSMODEL = "07"; //珠海自营 07
                         upsql += string.Format(@"/*dialect*/ update T_SAL_ORDER set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID);
                     }
                     // 观澜仓 车公庙仓
                     else if (CKFNumber.StartsWith("YBG002") || CKFNumber.StartsWith("YBG003"))
                     {
                         //壹办公供应商或者自营供应商
                         if (SPFNUMBER.Contains("VEN00057") || SPFNUMBER.Contains("VEN00099") || SPFNUMBER.Contains("P451")) //自营直发 05
                         {
                             F_YBG_BUSINESSMODEL = "02";
                             upsql += string.Format(@"/*dialect*/ update T_SAL_ORDER set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID);
                         }
                         else //代采直发 03
                         {
                             F_YBG_BUSINESSMODEL = "03";
                             upsql += string.Format(@"/*dialect*/ update T_SAL_ORDER set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID);
                         }
                     }
                     else //其他仓库默认01
                     {
                         //壹办公供应商或者自营供应商
                         if (SPFNUMBER.Contains("VEN00057") || SPFNUMBER.Contains("VEN00099") || SPFNUMBER.Contains("P451"))  //自营 05
                         {
                             F_YBG_BUSINESSMODEL = "05";
                             upsql += string.Format(@"/*dialect*/ update T_SAL_ORDER set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID);
                         }
                         else
                         {
                             F_YBG_BUSINESSMODEL = "01";
                             upsql += string.Format(@"/*dialect*/ update T_SAL_ORDER set F_YBG_BUSINESSMODEL='{0}' where FID ={1}", F_YBG_BUSINESSMODEL, FID);
                         }
                     }
                 }
             }
             //更新业务模式
             DBServiceHelper.Execute(ctx, upsql);
         }
         #endregion
     }
     catch (Exception ex)
     {
         throw new Exception("更新报错:" + ex.ToString());
     }
 }
        /// <summary>
        ///累加日计划面积
        /// </summary>
        /// <param name="e"></param>
        public override void EndOperationTransaction(EndOperationTransactionArgs e)
        {
            base.EndOperationTransaction(e);
            IViewService Services = ServiceHelper.GetService <IViewService>();

            if (selectedRows != null && selectedRows.Count() != 0)
            {
                IMetaDataService metadataService = Kingdee.BOS.App.ServiceHelper.GetService <IMetaDataService>();
                string           SoureFormId     = "SZXY_FHJTRSCJH";
                //获取单据元数据
                FormMetadata BilMetada = metadataService.Load(Context, SoureFormId) as FormMetadata;

                foreach (DynamicObject dy in selectedRows)
                {
                    string  Id       = Convert.ToString(dy["Id"]);
                    decimal Area     = 0;
                    string  RJHFid   = string.Empty;
                    string  RJHRowId = string.Empty;
                    RJHFid   = Convert.ToString(dy["F_SZXY_FIDH"]);
                    Area     = Convert.ToDecimal(dy["F_SZXY_InArea"]);
                    RJHRowId = Convert.ToString(dy["F_SZXY_FEntryIDH"]);
                    DynamicObject F_SZXY_MotherVolume = dy["F_SZXY_MotherVolume"] as  DynamicObject;
                    DynamicObject F_SZXY_ligature     = dy["F_SZXY_ligature"] as DynamicObject;


                    if (Area != 0 && !RJHFid.IsNullOrEmptyOrWhiteSpace() && Convert.ToInt32(RJHFid) > 0 && Convert.ToInt32(RJHRowId) > 0)
                    {
                        //单据头反写复合日计划实际完成面积

                        //DynamicObject RJHObejct = Utils.LoadFIDBillObject(this.Context, SoureFormId, RJHFid);
                        //if (RJHObejct["SZXY_FHJTRSCJHEntry"] is DynamicObjectCollection SoureEntry)
                        //{
                        //var Row = from row in SoureEntry
                        //          where Convert.ToString(row["id"]).EqualsIgnoreCase(RJHRowId)
                        //          select row;
                        //foreach (DynamicObject SoureRow in SoureEntry.Where(p => Convert.ToString(p["id"]).EqualsIgnoreCase(RJHRowId)))
                        //{
                        string MotherVolume = "";
                        string ligature     = "";
                        if (F_SZXY_MotherVolume != null)
                        {
                            MotherVolume = F_SZXY_MotherVolume["Id"].ToString();
                        }
                        if (F_SZXY_ligature != null)
                        {
                            ligature = F_SZXY_ligature["Id"].ToString();
                        }

                        string sql1 = $"/*dialect*/update SZXY_t_FHJTRSCJHEntry  set F_SZXY_ProductionArea=F_SZXY_ProductionArea+{Area}," +
                                      $" F_SZXY_WIRED='{ligature}', F_SZXY_MVolume='{MotherVolume}'" +
                                      $"  where Fid={RJHFid}" +
                                      $" and FEntryID={RJHRowId} ";
                        DBServiceHelper.Execute(Context, sql1);
                        //}

                        //}
                        //var saveResult = BusinessDataServiceHelper.Save(Context, BilMetada.BusinessInfo, RJHObejct);
                    }
                }
            }
        }
Example #30
0
 public void Run(Context ctx, Schedule schedule)
 {
     DBServiceHelper.Execute(ctx, "/*dialect*/update WWW_t_Cust_Entry100038 set F_WWW_TEXT4 = '一次更新'");
 }