プロジェクト

全般

プロフィール

リビジョン 474

堀内ほぼ5年前に追加

製品版バージョン2のアップデート

差分を表示:

trunk/src/ProcessManagement/ProcessManagement/Common/CommonMotions.cs
246 246
        {
247 247
            try
248 248
            {
249
                string strRet = string.Empty;
250

  
251 249
                CultureInfo culture = new CultureInfo("ja-JP", true);
252 250
                culture.DateTimeFormat.Calendar = new JapaneseCalendar();
253 251

  
254
                string result = TargetDate.ToString("ggyy年M月d日", culture);
255

  
256
                int strLength = 0;
257
                foreach (char c in result)
258
                {
259
                    if (char.IsNumber(c)) break;
260

  
261
                    strLength++;
262
                }
263

  
264
                strRet = result.Substring(0, strLength);
265

  
266
                return strRet;
252
                return TargetDate.ToString("gg", culture);
267 253
            }
268 254
            catch (Exception ex)
269 255
            {
......
767 753

  
768 754
            return upperval;
769 755
        }
756
        public static decimal DecimalRoundUp(decimal value, int pos)
757
        {
758
            // 何乗かを求める
759
            int posion = (int)Math.Pow(10, pos);
760

  
761
            return (Math.Ceiling(value * posion) / posion);
762
        }
770 763
        #endregion
771 764

  
772 765
        #region 0~26までの数字をA~Zに変換する
......
1876 1869

  
1877 1870
        #region ---------- 工事管理システム専用
1878 1871

  
1872
        #region システム起動確認データ取得
1873
        /// <summary>
1874
        /// システム起動確認データ取得
1875
        /// </summary>
1876
        public static void GetSystemExecute(ref SystemExecute recordRec)
1877
        {
1878
            IOSystemExecute SysExecDB = new IOSystemExecute();
1879
            try
1880
            {
1881
                // システムのバージョンをチェックする
1882
                // キーを取得する
1883
                int PCode = CommonDefine.ExePrimaryCode.First(x => x.Value.Equals("システムバージョン")).Key;
1884

  
1885
                // バージョン読込
1886
                string strSQL = SysExecDB.CreatePrimarykeyString(PCode);
1887
                if (!SysExecDB.SelectAction(strSQL, ref recordRec))
1888
                {   // レコード無時はエラー
1889
                    logger.ErrorFormat("バージョンチェックデータ読込みエラー:{0}", CommonMotions.GetMethodName());
1890
                    return;
1891
                }
1892
            }
1893
            catch (Exception ex)
1894
            {
1895
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
1896
            }
1897
            finally
1898
            {
1899
                SysExecDB.close(); SysExecDB = null;
1900
            }
1901
        }
1902
        #endregion
1903

  
1879 1904
        #region 製品版・確認運用時Trueを返す
1880 1905
        /// <summary>
1881 1906
        /// 製品版・確認運用時Trueを返す
......
1889 1914
                switch (ProductDefine.ProductType)
1890 1915
                {
1891 1916
                    case (int)ProductDefine.ProductTypeDef.Originals:
1892
                    case (int)ProductDefine.ProductTypeDef.ProductsModelType2:
1917
                    case (int)ProductDefine.ProductTypeDef.ProductsModelType2_1:
1918
                    case (int)ProductDefine.ProductTypeDef.ProductsModelType2_2:
1893 1919
                        break;
1894 1920
                    case (int)ProductDefine.ProductTypeDef.ProductsModelType1:
1895 1921
                        // 一人親方バージョンはtrue
......
3386 3412
                    strSQL.AppendFormat(" Base.ConstructionYear = {0}", TargetYear);
3387 3413

  
3388 3414
                strSQL.AppendFormat(" And Base.ConstructionPersonCode = {0}", PersonCode);
3389
                strSQL.Append(" And(");
3415
                strSQL.Append(" And (");
3390 3416
                strSQL.AppendFormat("DATE('{0}') <= DATE(Ledger.ConstructionStart)", dtLast.ToShortDateString());
3391 3417
                strSQL.AppendFormat(" And DATE(Ledger.ConstructionEnd) <= DATE('{0}')", dtDefaultEnd.ToShortDateString());
3392 3418
                strSQL.Append(")");
......
3580 3606
                    strSQL.AppendFormat(" WHERE B.PERSONCODE = {0}", PersonCode);
3581 3607
                    strSQL.Append("       AND B.STARTDATE <= A.d");
3582 3608

  
3583
                    //// 対象期に工事が有るかをチェックする
3584
                    //strSQL.Append("       And Exists(Select * From constructionbaseinfo As C");
3585
                    //if (BasePeriodYear())
3586
                    //{   // 営業期
3587
                    //    strSQL.AppendFormat("                     Where C.ConstructionPeriod = {0}", TargetYear);
3588
                    //}
3589
                    //else
3590
                    //{   // 工事年度
3591
                    //    strSQL.AppendFormat("                     Where C.ConstructionYear = {0}", TargetYear);
3592
                    //}
3593
                    //strSQL.Append("       And (C.SalesPersonCode = B.PersonCode Or C.SalesSubPersonCode = B.PersonCode");
3594
                    //strSQL.Append("       Or C.ConstructionPersonCode = B.PersonCode Or C.ConstrSubPersonCode = B.PersonCode");
3595
                    //strSQL.Append("       Or C.ConstructionInstructor = B.PersonCode)");
3596
                    //strSQL.AppendFormat(" And C.ConstructionStatusFlg != {0})", nNotOrderCode);
3597

  
3598 3609
                    strSQL.Append(" ORDER BY A.d, B.STARTDATE DESC) AS AX");
3599 3610
                    strSQL.Append(" GROUP BY AX.hiduke");
3600 3611
                    strSQL.Append(" ORDER BY AX.hiduke");
......
3676 3687
                        strSQL.Append(" Base.ConstructionYear");
3677 3688

  
3678 3689
                    strSQL.Append(", Base.ConstructionCode");
3679
                    strSQL.Append(", Base.ConstructionPersonCode");
3690
                    strSQL.Append(", LDetail.CompanyCode");
3680 3691
                    strSQL.Append(", Ledger.ConstructionStart");
3681 3692
                    strSQL.Append(", Ledger.ConstructionEnd");
3682 3693
                    strSQL.Append(", LDetail.GroupCount");
3683 3694
                    strSQL.Append(", LDetail.SalaryFlg");
3684 3695
                    strSQL.Append(", LDetail.SalaryDays");
3696
                    strSQL.Append(", LDetail.ComponentCode");
3685 3697
                    strSQL.Append(" From");
3686 3698
                    strSQL.Append(" constructionbaseinfo As Base");
3687 3699
                    strSQL.Append(" Inner Join constructionledger As Ledger");
......
3689 3701
                    strSQL.AppendFormat("  And DATE('{0}') <= DATE(Ledger.ConstructionEnd)", dtDefaultStart.ToShortDateString());
3690 3702
                    strSQL.Append(" Inner Join constructionledgerdetail As LDetail");
3691 3703
                    strSQL.Append("       On LDetail.ConstructionCode = Base.ConstructionCode");
3692
                    strSQL.AppendFormat(" And LDetail.GroupCount = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
3693
                    strSQL.AppendFormat(" And LDetail.CompanyCode = {0}", nPersonCode);
3694
                    strSQL.AppendFormat(" And LDetail.SalaryFlg = {0}", (int)CommonDefine.SalaryDevision.DaysInput);
3704
                    strSQL.AppendFormat("  And LDetail.GroupCount = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
3705
                    strSQL.AppendFormat("  And LDetail.ComponentCode = {0}", nDepCode);
3706
                    strSQL.AppendFormat("  And LDetail.CompanyCode = {0}", nPersonCode);
3707
                    strSQL.AppendFormat("  And LDetail.SalaryFlg = {0}", (int)CommonDefine.SalaryDevision.DaysInput);
3695 3708
                    strSQL.Append(" Where");
3696 3709

  
3697 3710
                    if (CommonMotions.BasePeriodYear())
......
3699 3712
                    else
3700 3713
                        strSQL.AppendFormat(" Base.ConstructionYear = {0}", TargetYear);
3701 3714

  
3715
                    strSQL.AppendFormat(" And Base.ConstrDepCode = {0}", nDepCode);
3702 3716
                    strSQL.AppendFormat(" And Base.ConstructionPersonCode = {0}", nPersonCode);
3703 3717
                    strSQL.Append(" And(");
3704 3718
                    strSQL.AppendFormat("DATE('{0}') <= DATE(Ledger.ConstructionStart)", edDate.ToShortDateString());
......
3712 3726
                        strSQL.Append(" Base.ConstructionYear");
3713 3727

  
3714 3728
                    strSQL.Append(", Base.ConstructionCode");
3715
                    strSQL.Append(", Base.ConstructionPersonCode");
3729
                    strSQL.Append(", LDetail.CompanyCode");
3716 3730
                    strSQL.Append(", Ledger.ConstructionStart");
3717 3731
                    strSQL.Append(", Ledger.ConstructionEnd");
3718 3732
                    strSQL.Append(", LDetail.GroupCount");
3719 3733
                    strSQL.Append(", LDetail.SalaryFlg");
3720 3734
                    strSQL.Append(", LDetail.SalaryDays");
3735
                    strSQL.Append(", LDetail.ComponentCode");
3721 3736
                    strSQL.Append(" From");
3722 3737
                    strSQL.Append(" constructionbaseinfo As Base");
3723 3738
                    strSQL.Append(" Inner Join constructionledger As Ledger");
3724 3739
                    strSQL.Append("       On Ledger.ConstructionCode = Base.ConstructionCode");
3725 3740
                    strSQL.Append(" Inner Join constructionledgerdetail As LDetail");
3726 3741
                    strSQL.Append("       On LDetail.ConstructionCode = Base.ConstructionCode");
3727
                    strSQL.AppendFormat(" And LDetail.GroupCount = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
3728
                    strSQL.AppendFormat(" And LDetail.CompanyCode = {0}", nPersonCode);
3729
                    strSQL.AppendFormat(" And LDetail.SalaryFlg = {0}", (int)CommonDefine.SalaryDevision.DaysInput);
3742
                    strSQL.AppendFormat("  And LDetail.GroupCount = {0}", (int)FrmConstructionLedger.DataGroup.Payroll);
3743
                    strSQL.AppendFormat("  And LDetail.ComponentCode = {0}", nDepCode);
3744
                    strSQL.AppendFormat("  And LDetail.CompanyCode = {0}", nPersonCode);
3745
                    strSQL.AppendFormat("  And LDetail.SalaryFlg = {0}", (int)CommonDefine.SalaryDevision.DaysInput);
3730 3746
                    strSQL.Append(" Where");
3731 3747

  
3732 3748
                    if (CommonMotions.BasePeriodYear())
......
3734 3750
                    else
3735 3751
                        strSQL.AppendFormat(" Base.ConstructionYear = {0}", PrevTargetYear);
3736 3752

  
3753
                    strSQL.AppendFormat(" And Base.ConstrDepCode = {0}", nDepCode);
3737 3754
                    strSQL.AppendFormat(" And Base.ConstructionPersonCode = {0}", nPersonCode);
3738 3755
                    strSQL.Append(" And(");
3739 3756
                    strSQL.AppendFormat("DATE('{0}') <= DATE(Ledger.ConstructionStart)", (stDate.AddDays(-1)).ToShortDateString());
......
3746 3763
                ArrayList ArData = new ArrayList();
3747 3764
                if (!SalDB.ExecuteReader(strSQL.ToString(), ref ArData)) return;
3748 3765

  
3749
                int DateCnt = 0;
3750
                int NextDiffDay = 0;
3751
                int PrevDiffDay = 0;
3752 3766
                foreach (object[] ObjRec in TargetList)
3753 3767
                {
3754 3768
                    int nDepCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.DepartmentCode]);
3755 3769
                    int nPersonCode = CommonMotions.cnvInt(ObjRec[(int)CommonLedgerData.GetPersonTerm.PersonCode]);
3756 3770

  
3757 3771
                    // 半端分の日数を取得する
3758
                    NextDiffDay = 0;
3759
                    PrevDiffDay = 0;
3760
                    NextDiffDay = ArData.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == TargetYear
3772
                    int NextDiffDay = ArData.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == TargetYear
3773
                                                                    && CommonMotions.cnvInt(x[8]) == nDepCode
3761 3774
                                                                    && CommonMotions.cnvInt(x[2]) == nPersonCode)
3762 3775
                                                            .Sum(y => CommonMotions.cnvInt(y[7]));
3763 3776

  
3764 3777
                    // 先期の半端分の日数を取得する
3765
                    PrevDiffDay = ArData.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == PrevTargetYear
3778
                    int PrevDiffDay = ArData.Cast<object[]>().Where(x => CommonMotions.cnvInt(x[0]) == PrevTargetYear
3779
                                                                    && CommonMotions.cnvInt(x[8]) == nDepCode
3766 3780
                                                                    && CommonMotions.cnvInt(x[2]) == nPersonCode)
3767 3781
                                                            .Sum(y => CommonMotions.cnvInt(y[7]));
3768 3782
                    // 同じデータを探す
3769
                    DateCnt = 0;
3783
                    int DateCnt = 0;
3770 3784
                    foreach (KeyValuePair<int, int> CurRec in wrkManCode)
3771 3785
                    {
3772 3786
                        if (CurRec.Key == nDepCode && CurRec.Value == nPersonCode) break;
......
3812 3826
                // ----- 計算開始日セット
3813 3827
                if (StartDate.Date == DateTime.MinValue.Date)
3814 3828
                {
3829
                    // 最小値ならば今期開始をセット
3815 3830
                    StartDate = dtDefaultStart;
3816 3831
                }
3817
                else if (dtDefaultStart.Date <= HireStartDate.Date && HireStartDate.Date <= dtDefaultEnd.Date)
3818
                {
3819
                    StartDate = HireStartDate;
3820
                }
3832
                //else if (dtDefaultStart.Date <= HireStartDate.Date && HireStartDate.Date <= dtDefaultEnd.Date)
3833
                //{
3834
                //    // 入社日が期内ならば開始を入社日にする
3835
                //    StartDate = HireStartDate;
3836
                //}
3821 3837
                else if (dtDefaultStart.Date < StartDate.Date)
3822 3838
                {
3839
                    // 今期工事の契約工期が今期の開始より小さい場合は今期開始をセット
3823 3840
                    StartDate = dtDefaultStart;
3824 3841
                }
3825 3842
                // 入社日が期内ならば開始を入社日にする
3826
                if (dtDefaultStart.Date < HireStartDate && HireStartDate.Date < dtDefaultEnd.Date)
3843
                if (dtDefaultStart.Date <= HireStartDate && HireStartDate.Date <= dtDefaultEnd.Date)
3827 3844
                {
3828 3845
                    StartDate = HireStartDate;
3829 3846
                }
3847
                // 部署移動開始日が今期ならばセットする
3848
                if (dtDefaultStart.Date <= DepHisStDate.Date && DepHisStDate.Date <= dtDefaultEnd.Date)
3849
                {
3850
                    if (StartDate.Date < DepHisStDate.Date) StartDate = DepHisStDate;
3851
                }
3830 3852

  
3831 3853
                // ----- 計算終了日セット
3832 3854
                // Defaultは期末
......
3837 3859
                {
3838 3860
                    CompDate = HireCompDate;
3839 3861
                }
3840

  
3841
                // 来季の開始があって期末日より小さい場合は置き換える
3842
                if (NextStartDate.Date != DateTime.MinValue.Date)
3862
                else if (DepHisCompDate.Date == DateTime.MaxValue.Date)
3843 3863
                {
3844
                    if (StartDate.Date < NextStartDate.Date && NextStartDate.Date < CompDate.Date)
3864
                    // 終了がマックスは今季終了をセットする
3865
                    CompDate = dtDefaultEnd;
3866
                }
3867
                else if (NextStartDate.Date != DateTime.MinValue.Date)
3868
                {
3869
                    // 来季の開始があって今期の場合は開始日-1に置き換える
3870
                    if (dtDefaultStart.Date < NextStartDate.Date && NextStartDate.Date < dtDefaultEnd.Date)
3845 3871
                    {
3846 3872
                        CompDate = NextStartDate.AddDays(-1);
3847 3873
                    }
3848 3874
                }
3849

  
3850
                // ----- 部署移動があればそちらの年月日を使用する
3851
                // 移動開始年月日が今期ならばセットする
3852
                if (dtDefaultStart.Date <= DepHisStDate.Date && DepHisStDate.Date <= dtDefaultEnd.Date)
3853
                {
3854
                    if (StartDate.Date < DepHisStDate.Date) StartDate = DepHisStDate;
3855
                }
3856

  
3857
                // 移動終了年月日が今期ならばセットする
3875
                // 部署移動終了日が今期ならばセットする
3858 3876
                if (dtDefaultStart.Date <= DepHisCompDate.Date && DepHisCompDate.Date <= dtDefaultEnd.Date)
3859 3877
                {
3860 3878
                    if (DepHisCompDate.Date < CompDate.Date) CompDate = DepHisCompDate;
3861 3879
                }
3862

  
3863

  
3864 3880
            }
3865 3881
            catch (Exception ex)
3866 3882
            {
trunk/src/ProcessManagement/ProcessManagement/Common/Process/ClsChangeLedgerData.cs
321 321

  
322 322
                    DateTime TargetDate = DateTime.Now.Date;
323 323
                    // 対象月より書込みカラム位置を取得する
324
                    //int ColPoint = CalcTargetMonthToColumn(LedgerRec.ConstructionStart, TargetDate);
325 324
                    int ColPoint = CalcTargetMonthToColumn(LedgerExDB, false, LedgerRec.ConstructionCode, TargetDate);
326 325

  
327 326
                    foreach (ConstructionLedgerDetail CurRec in DetailList)
......
554 553
                    if (wrkDate.Date != DateTime.MinValue.Date) dtStart = wrkDate;
555 554

  
556 555
                    // 承認日付より持ってくる
557
                    //Columncnt = CalcTargetMonthToColumn(dtStart, AppRec.PetitionApprovalDate);
558 556
                    Columncnt = CalcTargetMonthToColumn(LedgerExDB, false, LedgerRec.ConstructionCode, AppRec.PetitionApprovalDate);
559 557
                    ParaDate = new DateTime(AppRec.PetitionApprovalDate.Year
560 558
                                            , AppRec.PetitionApprovalDate.Month, 1);
......
629 627
                // キー作成
630 628
                StringBuilder strSQL = new StringBuilder();
631 629
                strSQL.Append(LedgerExDB.CreatePrimarykeyString(ConstrCode, GroupCount, LineCount, ColumnCount));
632
                //strSQL.Append(LedgerExDB.CreatePrimarykeyString(ConstrCode, GroupCount, LineCount));
633
                //strSQL.AppendFormat(" AND DATE(TargetMonth) = '{0}'", ColumnDate.ToShortDateString());
634 630

  
635 631
                // データ読込み
636 632
                List<ConstructionLedgerExcute> LedgerExList = new List<ConstructionLedgerExcute>();
......
989 985
        }
990 986
        #endregion
991 987

  
992
        #region 対象月の工事詳細台帳実行データを作成する(交通費・購入品等のみ)
993
        /// <summary>
994
        /// 対象月の工事詳細台帳実行データを作成する(交通費・購入品等のみ)
995
        /// </summary>
996
        /// <param name="PersonCode">担当者コード</param>
997
        /// <param name="TargetMonth">対象年月</param>
998
        /// <returns></returns>
999
        public static bool MakeLedgerData(IOCostDataOfPerson CostDB
1000
                                            , IOConstructionLedger LedgerDB
1001
                                            , IOConstructionLedgerDetail LedgerDetailDB
1002
                                            , IOConstructionLedgerExcute LedgerExcuteDB
1003
                                            , int PersonCode
1004
                                            , string TargetMonth)
1005
        {
1006
            try
1007
            {
1008
                List<int> ConstrCodeList = new List<int>();
1009

  
1010
                // 対象をまず削除する(対象月で削除する)
1011
                StringBuilder strDelSQL = new StringBuilder();
1012
                strDelSQL.Append("DELETE FROM CONSTRUCTIONLEDGEREXCUTE");
1013
                strDelSQL.Append(" WHERE CONSTRUCTIONCODE IN");
1014
                strDelSQL.Append(" (SELECT A1.CONSTRUCTIONCODE FROM CONSTRUCTIONBASEINFO A1");
1015
                strDelSQL.AppendFormat(" WHERE (A1.SALESPERSONCODE = {0}", PersonCode);
1016
                strDelSQL.AppendFormat(" OR A1.CONSTRUCTIONPERSONCODE = {0}", PersonCode);
1017
                strDelSQL.AppendFormat(" OR A1.CONSTRSUBPERSONCODE = {0}", PersonCode);
1018
                strDelSQL.AppendFormat(" OR A1.CONSTRUCTIONINSTRUCTOR = {0}))", PersonCode);
1019
                strDelSQL.AppendFormat(" AND GROUPCOUNT IN ({0}, {1}, {2}, {3}, {4}, {5})"
1020
                                                                , GetConstructionLedgerGroupNo((int)CostDataOfPerson.DataNoDef.Transport)
1021
                                                                , GetConstructionLedgerGroupNo((int)CostDataOfPerson.DataNoDef.Purchase)
1022
                                                                , GetConstructionLedgerGroupNo((int)CostDataOfPerson.DataNoDef.Lease)
1023
                                                                , GetConstructionLedgerGroupNo((int)CostDataOfPerson.DataNoDef.StoragePlace)
1024
                                                                , GetConstructionLedgerGroupNo((int)CostDataOfPerson.DataNoDef.Lodging)
1025
                                                                , GetConstructionLedgerGroupNo((int)CostDataOfPerson.DataNoDef.DisposalCost));
1026
                strDelSQL.AppendFormat(" AND DATE(TARGETMONTH) = '{0}'", (TargetMonth + "/01"));
1027
                LedgerExcuteDB.ExecuteNonQuery(strDelSQL.ToString(), false);
1028

  
1029
                for (int i = (int)CostDataOfPerson.DataNoDef.Transport; i <= (int)CostDataOfPerson.DataNoDef.DisposalCost; i++)
1030
                {
1031
                    StringBuilder strSQL = new StringBuilder();
1032
                    strSQL.Append("SELECT CONSTRUCTIONCODE, DATATYPE, DATE_FORMAT(ACTIONDATE,'%Y/%m'), SUM(ENTRYPRICE) FROM COSTDATAOFPERSON");
1033
                    strSQL.AppendFormat(" WHERE DATE_FORMAT(ACTIONDATE,'%Y/%m') = '{0}'", TargetMonth);
1034
                    strSQL.AppendFormat(" AND DATATYPE = {0}", i);
1035

  
1036
                    strSQL.Append(" AND CONSTRUCTIONCODE IN (SELECT A1.CONSTRUCTIONCODE FROM CONSTRUCTIONBASEINFO A1");
1037
                    strSQL.AppendFormat(" WHERE (A1.SALESPERSONCODE = {0}", PersonCode);
1038
                    strSQL.AppendFormat(" OR A1.CONSTRUCTIONPERSONCODE = {0}", PersonCode);
1039
                    strSQL.AppendFormat(" OR A1.CONSTRSUBPERSONCODE = {0}", PersonCode);
1040
                    strSQL.AppendFormat(" OR A1.CONSTRUCTIONINSTRUCTOR = {0}))", PersonCode);
1041

  
1042
                    strSQL.Append(" GROUP BY CONSTRUCTIONCODE, DATATYPE, DATE_FORMAT(ACTIONDATE,'%Y/%m')");
1043
                    strSQL.Append(" ORDER BY CONSTRUCTIONCODE, DATATYPE");
1044
                    ArrayList arList = new ArrayList();
1045
                    if (!CostDB.ExecuteReader(strSQL.ToString(), ref arList, false)) continue;
1046
                    if (arList.Count == 0) continue;
1047

  
1048
                    foreach (object[] wrkrec in arList)
1049
                    {
1050

  
1051
                        // 支払金額
1052
                        int PaymentPrice = CommonMotions.cnvInt(wrkrec[3]);
1053
                        // 支払金額無は処理しない
1054
                        if (PaymentPrice == 0) continue;
1055

  
1056
                        // 工事番号
1057
                        int ConstructionCode = CommonMotions.cnvInt(wrkrec[0]);
1058
                        // 工事番号退避
1059
                        ConstrCodeList.Add(ConstructionCode);
1060

  
1061
                        // グループ番号
1062
                        int DataType = i;
1063
                        int GroupNo = GetConstructionLedgerGroupNo(DataType);
1064

  
1065
                        // 工事詳細台帳よりデータの行・列を取得する
1066
                        int LineCnt = 0;
1067
                        int ColCnt = 0;
1068
                        // 台帳が無ければ処理しない
1069
                        if (!SearchTatgetConstructionLedger(LedgerDB, LedgerDetailDB, LedgerExcuteDB, ConstructionCode, GroupNo, TargetMonth, ref LineCnt, ref ColCnt)) continue;
1070

  
1071
                        ConstructionLedgerExcute excRec = new ConstructionLedgerExcute();
1072
                        // データ編集
1073
                        excRec.ConstructionCode = ConstructionCode;
1074
                        excRec.GroupCount = GroupNo;
1075
                        excRec.LineCount = LineCnt;
1076
                        excRec.ColumnCount = ColCnt;
1077
                        excRec.PaymentAmount = PaymentPrice;
1078
                        excRec.TargetMonth = CommonMotions.cnvDate(TargetMonth + "/01");
1079

  
1080
                        if (!LedgerExcuteDB.InsertAction(excRec, false))
1081
                        {
1082
                            return false;
1083
                        }
1084
                    }
1085
                }
1086

  
1087
                // 工事詳細台帳の更新
1088
                if (!LedgerRecalculate(LedgerExcuteDB, ConstrCodeList))
1089
                {
1090
                    return false;
1091
                }
1092

  
1093
                return true;
1094
            }
1095
            catch (System.Exception ex)
1096
            {
1097
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
1098
                return false;
1099
            }
1100
        }
1101
        #endregion
1102

  
1103 988
        #region 工事詳細台帳より対象データを探して実行データの行番号・列番号を返す(交通費・購入品等のみ)
1104 989
        /// <summary>
1105 990
        /// 工事詳細台帳より対象データを探して実行データの行番号・列番号を返す(交通費・購入品等のみ)
......
1128 1013
                if (wrkDate.Date != DateTime.MinValue.Date) dtStart = wrkDate;
1129 1014

  
1130 1015
                // 経過月数より列番号取得する
1131
                //ColCnt = CalcTargetMonthToColumn(dtStart, NowDates);
1132
                ColCnt = ClsChangeLedgerData.CalcTargetMonthToColumn(LedgerExcuteDB, false, ConstructionCode, NowDates);
1016
                ColCnt = CalcTargetMonthToColumn(LedgerExcuteDB, false, ConstructionCode, NowDates);
1133 1017

  
1134 1018
                // 工事詳細台帳明細データ読込み
1135 1019
                string strSQL = LedgerDetailDB.CreatePrimarykeyString(ConstructionCode, GroupNo);
......
1811 1695
                if (wrkDate.Date != DateTime.MinValue.Date) dtStart = wrkDate;
1812 1696

  
1813 1697
                // 経過月数より列番号取得する
1814
                //int ColCnt = CalcTargetMonthToColumn(dtStart, NowDates);
1815
                int ColCnt = ClsChangeLedgerData.CalcTargetMonthToColumn(ExecDB, false, nConstrCode, NowDates);
1698
                int ColCnt = CalcTargetMonthToColumn(ExecDB, false, nConstrCode, NowDates);
1816 1699

  
1817 1700
                // 工事詳細台帳実行データ読込み
1818 1701
                int nGroupNo = nGroupCount;
trunk/src/ProcessManagement/ProcessManagement/Common/Process/ClsExcute.cs
449 449
            /// 23:外 出
450 450
            /// </summary>
451 451
            GoOut,
452
            /// <summary>
453
            /// 24:請求取消
454
            /// </summary>
455
            OrderRequestCancel,
452 456
        }
453 457
        #endregion
454 458

  
......
476 480
        //                                                                        {8, "請求書承認"},
477 481
        //                                                                        };
478 482
        #endregion
479
        public static Dictionary<int, string> AppovalList = new Dictionary<int, string>() { 
480
                                                                                { (int)ApprovalListNo.EstimateApproval,             "積算見積書承認"},
481
                                                                                { (int)ApprovalListNo.EstimateBudgetApproval,       "積算予算書承認"},
482
                                                                                { (int)ApprovalListNo.ConstructionBudgetApproval,   "工事予算書承認"},
483
                                                                                { (int)ApprovalListNo.PurchaseOrderEntryApproval,   "注文書承認"},
484
                                                                                { (int)ApprovalListNo.OrderRequestApproval,         "請求承認"},
485
                                                                                { (int)ApprovalListNo.DRConstructionApproval,       "工事日報承認"},
486
                                                                                { (int)ApprovalListNo.DRProceedingsApproval,        "議事録承認"},
487
                                                                                { (int)ApprovalListNo.DRWorkApproval,               "出勤管理承認"},
488
                                                                                { (int)ApprovalListNo.CostomerRegistApproval,       "発注者登録承認"},
489
                                                                                { (int)ApprovalListNo.SubConstregistApproval,       "協力会社登録承認"},
490
                                                                                { (int)ApprovalListNo.FeePayment,                   "手間支払承認"},
491
                                                                                { (int)ApprovalListNo.SubConstrPayment,             "業者支払承認"},
492
                                                                                { (int)ApprovalListNo.SafetyPatrolApproval,         "安全パトロール承認"},
483
        public static Dictionary<int, string> AppovalList = new Dictionary<int, string>() {
484
                                                                                { (int)ApprovalListNo.EstimateApproval,             "積算見積書承認" },
485
                                                                                { (int)ApprovalListNo.EstimateBudgetApproval,       "積算予算書承認" },
486
                                                                                { (int)ApprovalListNo.ConstructionBudgetApproval,   "工事予算書承認" },
487
                                                                                { (int)ApprovalListNo.PurchaseOrderEntryApproval,   "注文書承認" },
488
                                                                                { (int)ApprovalListNo.OrderRequestApproval,         "請求承認" },
489
                                                                                { (int)ApprovalListNo.DRConstructionApproval,       "工事日報承認" },
490
                                                                                { (int)ApprovalListNo.DRProceedingsApproval,        "議事録承認" },
491
                                                                                { (int)ApprovalListNo.DRWorkApproval,               "出勤管理承認" },
492
                                                                                { (int)ApprovalListNo.CostomerRegistApproval,       "発注者登録承認" },
493
                                                                                { (int)ApprovalListNo.SubConstregistApproval,       "協力会社登録承認" },
494
                                                                                { (int)ApprovalListNo.FeePayment,                   "手間支払承認" },
495
                                                                                { (int)ApprovalListNo.SubConstrPayment,             "業者支払承認" },
496
                                                                                { (int)ApprovalListNo.SafetyPatrolApproval,         "安全パトロール承認" },
493 497
                                                                                { (int)ApprovalListNo.OutEarly,                     "早出承認" },
494 498
                                                                                { (int)ApprovalListNo.OverTime,                     "残業承認" },
495 499
                                                                                { (int)ApprovalListNo.HolidayWork,                  "休日出勤承認" },
......
498 502
                                                                                { (int)ApprovalListNo.PaidHolidays,                 "有給休暇承認" },
499 503
                                                                                { (int)ApprovalListNo.Absence,                      "欠勤承認" },
500 504
                                                                                { (int)ApprovalListNo.Late,                         "遅刻承認" },
501
                                                                                { (int)ApprovalListNo.LeaveEarly,                   "早退承認"},
502
                                                                                { (int)ApprovalListNo.GoOut,                        "外出承認"},
505
                                                                                { (int)ApprovalListNo.LeaveEarly,                   "早退承認" },
506
                                                                                { (int)ApprovalListNo.GoOut,                        "外出承認" },
507
                                                                                { (int)ApprovalListNo.OrderRequestCancel,           "請求取消" },
503 508
                                                                                };
504 509

  
505 510
        #endregion
......
558 563
                        // ----- 製品版(一人親方バージョン)
559 564
                        keyValues = FrmSecurity.GetExecKeyValuesProType1;
560 565
                        break;
561
                    case (int)ProductDefine.ProductTypeDef.ProductsModelType2:
566
                    case (int)ProductDefine.ProductTypeDef.ProductsModelType2_1:
567
                    case (int)ProductDefine.ProductTypeDef.ProductsModelType2_2:
562 568
                        // ----- 製品版(承認バージョン)
563 569
                        keyValues = FrmSecurity.GetExecKeyValuesProType2;
564 570
                        break;
......
1418 1424

  
1419 1425
                // パラメータセット
1420 1426
                frm.ConstructionCode = CurrentPara.IntExecParameter[0];
1421
                if (CurrentPara.IntExecParameter.Count > 1) frm.OrderNo = CurrentPara.IntExecParameter[2];
1427
                if (CurrentPara.IntExecParameter.Count > 2) frm.OrderNo = CurrentPara.IntExecParameter[2];
1422 1428

  
1423 1429
                if (CurrentPara.ArrayParameter.Count > 0)
1424 1430
                {
trunk/src/ProcessManagement/ProcessManagement/Common/Process/ClsMoveDepOfInfo.cs
66 66
        public static bool ChangePersonDep(IOConstructionBaseInfo BaseDB
67 67
                                    , IOConstructionBaseInfoDetail DetailDB
68 68
                                    , IOChgConstrCharge DepChgDB
69
                                    , IOConstructionLedgerDetail LedgerDB
69 70
                                    , int PersonCode
70 71
                                    , int nBeforeDepCode, int nAfterDepCode, string strAfterDepName)
71 72
        {
......
84 85
                // 工事担当変更履歴データ部署コード変更
85 86
                if(!ChgPersonDepChgConstrCharge(DepChgDB, arList, PersonCode, nAfterDepCode)) return false;
86 87

  
88
                // 工事詳細台帳データ部署変更
89
                if (!ChgPersonDepLedgerDetail(LedgerDB, arList, PersonCode, nAfterDepCode)) return false;
90

  
87 91
                return true;
88 92
            }
89 93
            catch (System.Exception ex)
......
458 462
            }
459 463
        }
460 464
        #endregion
465

  
466
        #region 工事詳細台帳データ部署変更
467
        /// <summary>
468
        /// 工事詳細台帳データ部署変更
469
        /// </summary>
470
        private static bool ChgPersonDepLedgerDetail(IOConstructionLedgerDetail LedgerDB
471
                                            , ArrayList arList
472
                                            , int PersonCode
473
                                            , int nAfterDepCode)
474
        {
475
            try
476
            {
477
                StringBuilder strSQL = new StringBuilder();
478
                strSQL.Append("Update constructionledgerdetail");
479
                strSQL.Append(" SET");
480
                strSQL.AppendFormat(" ComponentCode = {0}", nAfterDepCode);
481
                strSQL.Append(", UpdateDate = NOW()");
482
                strSQL.Append(" WHERE ConstructionCode IN (");
483

  
484
                bool bFirst = true;
485
                foreach (object[] objRec in arList)
486
                {
487
                    int nConstrCode = CommonMotions.cnvInt(objRec[(int)GetChgDepData.ConstronCode]);
488
                    if (!bFirst) strSQL.Append(", ");
489
                    strSQL.AppendFormat("{0}", nConstrCode);
490
                    bFirst = false;
491
                }
492
                strSQL.Append(" )");
493

  
494
                strSQL.AppendFormat(" And GroupCount in ({0}, {1}, {2})",(int)FrmConstructionLedger.DataGroup.Instructor
495
                                                                        , (int)FrmConstructionLedger.DataGroup.Assistant
496
                                                                        , (int)FrmConstructionLedger.DataGroup.Payroll);
497
                strSQL.AppendFormat(" And CompanyCode = {0}", PersonCode);
498

  
499
                if (!LedgerDB.ExecuteNonQuery(strSQL.ToString(), false)) return false;
500

  
501
                return true;
502
            }
503
            catch (System.Exception ex)
504
            {
505
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
506
                return false;
507
            }
508
            #endregion
509
        }
461 510
    }
462 511
}
trunk/src/ProcessManagement/ProcessManagement/Common/Process/ClsOtherProc.cs
728 728
                // 請求入力入力起動
729 729
                frm.ConstrCode = ClsProcessExist.GetParentConstrCode(ConstrCode);
730 730
                frm.SelectionMode = true;
731
                frm.SubForm = true;
731 732
                frm.ShowInTaskbar = true;
732 733

  
733 734
                frm.Show();
trunk/src/ProcessManagement/ProcessManagement/Common/Process/ClsProcessExist.cs
365 365
                        // ----- 製品版(一人親方バージョン)
366 366
                        GetProcessListMassProductionType1(ref ProcList, OperationPrcess);
367 367
                        break;
368
                    case (int)ProductDefine.ProductTypeDef.ProductsModelType2:
368
                    case (int)ProductDefine.ProductTypeDef.ProductsModelType2_1:
369
                    case (int)ProductDefine.ProductTypeDef.ProductsModelType2_2:
369 370
                        // ----- 製品版(承認バージョン)
370 371
                        GetProcessListMassProductionType2(ref ProcList, OperationPrcess);
371 372
                        break;
trunk/src/ProcessManagement/ProcessManagement/Common/Process/ClsSystemOnceExecute.cs
1445 1445
            IOMPersonDepartment ManDepDB = new IOMPersonDepartment();
1446 1446
            IOConstructionBaseInfo BaseDB = new IOConstructionBaseInfo();
1447 1447
            IOConstructionBaseInfoDetail DetailDB = new IOConstructionBaseInfoDetail();
1448
            IOConstructionLedgerDetail LDetailDB = new IOConstructionLedgerDetail();
1448 1449
            IOChgConstrCharge DepChgDB = new IOChgConstrCharge();
1449 1450
            try
1450 1451
            {
......
1467 1468
                ManDepDB.connect(); ManDepDB.beginTran();
1468 1469
                BaseDB.connect(); BaseDB.beginTran();
1469 1470
                DetailDB.connect(); DetailDB.beginTran();
1471
                LDetailDB.connect(); LDetailDB.beginTran();
1470 1472
                DepChgDB.connect(); DepChgDB.beginTran();
1471 1473

  
1472 1474
                int ChgDepCodeCnt = Enum.GetNames(typeof(IOMPersonInCharge.ColumnCnt)).Length;
......
1491 1493
                        BaseDB.rollback();
1492 1494
                        DetailDB.rollback();
1493 1495
                        DepChgDB.rollback();
1496
                        LDetailDB.rollback();
1494 1497
                        return false;
1495 1498
                    }
1496 1499

  
......
1504 1507
                        BaseDB.rollback();
1505 1508
                        DetailDB.rollback();
1506 1509
                        DepChgDB.rollback();
1510
                        LDetailDB.rollback();
1507 1511
                        return false;
1508 1512
                    }
1509 1513
                    if (ReadList.Count > 0)
......
1518 1522
                            BaseDB.rollback();
1519 1523
                            DetailDB.rollback();
1520 1524
                            DepChgDB.rollback();
1525
                            LDetailDB.rollback();
1521 1526
                            return false;
1522 1527
                        }
1523 1528
                    }
......
1534 1539
                        BaseDB.rollback();
1535 1540
                        DetailDB.rollback();
1536 1541
                        DepChgDB.rollback();
1542
                        LDetailDB.rollback();
1537 1543
                        return false;
1538 1544
                    }
1539 1545
                    if (ReadList.Count < 1)
......
1548 1554
                            BaseDB.rollback();
1549 1555
                            DetailDB.rollback();
1550 1556
                            DepChgDB.rollback();
1557
                            LDetailDB.rollback();
1551 1558
                            return false;
1552 1559
                        }
1553 1560
                    }
......
1564 1571
                        BaseDB.rollback();
1565 1572
                        DetailDB.rollback();
1566 1573
                        DepChgDB.rollback();
1574
                        LDetailDB.rollback();
1567 1575
                        return false;
1568 1576
                    }
1569 1577
                    if (ReadList.Count < 1)
......
1578 1586
                            BaseDB.rollback();
1579 1587
                            DetailDB.rollback();
1580 1588
                            DepChgDB.rollback();
1589
                            LDetailDB.rollback();
1581 1590
                            return false;
1582 1591
                        }
1583 1592
                    }
......
1592 1601
                            BaseDB.rollback();
1593 1602
                            DetailDB.rollback();
1594 1603
                            DepChgDB.rollback();
1604
                            LDetailDB.rollback();
1595 1605
                            return false;
1596 1606
                        }
1597 1607
                    }
1598 1608

  
1599 1609
                    // 工事情報の担当者部署変更処理
1600
                    if (!ClsMoveDepOfInfo.ChangePersonDep(BaseDB, DetailDB, DepChgDB
1610
                    if (!ClsMoveDepOfInfo.ChangePersonDep(BaseDB, DetailDB, DepChgDB, LDetailDB
1601 1611
                                                        , nPersonCode, OldDepCode, ChgDepCode, ChgDepName))
1602 1612
                    {
1603 1613
                        PersonDB.rollback();
......
1605 1615
                        BaseDB.rollback();
1606 1616
                        DetailDB.rollback();
1607 1617
                        DepChgDB.rollback();
1618
                        LDetailDB.rollback();
1608 1619
                        return false;
1609 1620
                    }
1610 1621
                }
......
1614 1625
                BaseDB.commit();
1615 1626
                DetailDB.commit();
1616 1627
                DepChgDB.commit();
1628
                LDetailDB.commit();
1617 1629

  
1618 1630
                return true;
1619 1631
            }
......
1629 1641
                BaseDB.close(); BaseDB = null;
1630 1642
                DetailDB.close(); BaseDB = null;
1631 1643
                DepChgDB.close(); DepChgDB = null;
1644
                LDetailDB.close(); LDetailDB = null;
1632 1645
            }
1633 1646
        }
1634 1647
        #endregion
......
1665 1678
                DateDB.connect();DateDB.beginTran();
1666 1679

  
1667 1680
                // 当月の25日開始、翌月5日のデータを1年分作成する
1668
                DateTime dtWrkYM = DateTime.Today.AddMonths(1).Date;
1681
                DateTime dtWrkYM = new DateTime(2019, 4, 1);
1682
                DateTime dtWrkYM2 = new DateTime(2019, 4, 1);
1669 1683
                DateTime[] dateTime = new DateTime[2];
1670 1684
                ClosingDateOfMonth DateRec = new ClosingDateOfMonth();
1671 1685
                for (int ix = 0; ix < 12; ix++)
1672 1686
                {
1673 1687
                    Array.Clear(dateTime, 0, dateTime.Length);
1674 1688
                    dateTime[0] = new DateTime(dtWrkYM.Year, dtWrkYM.Month, 25);                // 入力開始日
1675
                    dateTime[1] = new DateTime(dtWrkYM.Year, dtWrkYM.AddMonths(1).Month, 5);    // 入力終了日
1689
                    dtWrkYM2 = dtWrkYM.AddMonths(1);
1690
                    dateTime[1] = new DateTime(dtWrkYM2.Year, dtWrkYM2.Month, 5);               // 入力終了日
1676 1691

  
1677 1692
                    // データの存在によって処理を行う
1678 1693
                    int nYearKey = CommonMotions.cnvInt(dtWrkYM.ToString("yyyyMM"));
trunk/src/ProcessManagement/ProcessManagement/Common/ProductDefine.cs
45 45
            /// </summary>
46 46
            ProductsModelType1,
47 47
            /// <summary>
48
            ///  2:製品版:白虎・朱雀:承認版
48
            ///  2:製品版:白虎:承認機能(社内LAN版)
49 49
            /// </summary>
50
            ProductsModelType2,
50
            ProductsModelType2_1,
51 51
            /// <summary>
52
            ///  3:製品版:玄武:承認機能+工事管理機能追加版
52
            ///  3:製品版:朱雀:承認機能(VPSネットワーク版)
53 53
            /// </summary>
54
            ProductsModelType2_2,
55
            /// <summary>
56
            ///  4:製品版:玄武:承認機能+工事管理機能追加
57
            /// </summary>
54 58
            ProductsModelType3,
55 59
            /// <summary>
56
            ///  4:製品版:九尾:承認機能+工事管理機能追加版+人員管理機能追加
60
            ///  5:製品版:九尾:承認機能+工事管理機能追加版+人員管理機能追加
57 61
            /// </summary>
58 62
            ProductsModelType4,
59 63
            /// <summary>
60
            ///  5:製品版:麒麟:フル機能版
64
            ///  6:製品版:麒麟:フル機能
61 65
            /// </summary>
62 66
            ProductsModelType5,
63 67
            /// <summary>
64
            ///  6:製品版:鳳凰:フル機能版+カスタマイズ
68
            ///  7:製品版:鳳凰:フル機能+カスタマイズ
65 69
            /// </summary>
66 70
            ProductsModelType6,
67 71
        }
68 72
        #endregion
69 73

  
70
        #region 製品種別定義(サブ)
71
        /// <summary>
72
        /// 製品種別定義(サブ)
73
        /// </summary>
74
        public enum SubProductTypeDef
75
        {
76
            /// <summary>
77
            ///  0:サブ種別無し
78
            /// </summary>
79
            None = 0,
80
            /// <summary>
81
            ///  1:白虎
82
            /// </summary>
83
            Type1,
84
            /// <summary>
85
            ///  2:朱雀
86
            /// </summary>
87
            Type2,
88
        }
89
        #endregion
90

  
91 74
        #region システム構成名称
92 75
        /// <summary>
93 76
        /// システム構成名称
......
95 78
        public static Dictionary<int, string> ProductName = new Dictionary<int, string>() {
96 79
                                                                                { (int)ProductTypeDef.Originals,            "オリジナル"},
97 80
                                                                                { (int)ProductTypeDef.ProductsModelType1,   "青龍"},
98
                                                                                { (int)ProductTypeDef.ProductsModelType2,   "白虎朱雀"},
81
                                                                                { (int)ProductTypeDef.ProductsModelType2_1, "白虎"},
82
                                                                                { (int)ProductTypeDef.ProductsModelType2_2, "朱雀"},
99 83
                                                                                { (int)ProductTypeDef.ProductsModelType3,   "玄武"},
100 84
                                                                                { (int)ProductTypeDef.ProductsModelType4,   "九尾狐"},
101 85
                                                                                { (int)ProductTypeDef.ProductsModelType5,   "麒麟"},
102 86
                                                                                { (int)ProductTypeDef.ProductsModelType6,   "鳳凰"},
103 87
                                                                                };
88
        #endregion
104 89

  
105 90
        #region 構成説明
106 91
        /// <summary>
......
108 93
        /// </summary>
109 94
        public static Dictionary<int, string> ConfigurationExplanation= new Dictionary<int, string>() {
110 95
                                                                                { (int)ProductTypeDef.Originals,            "オリジナル"},
111
                                                                                { (int)ProductTypeDef.ProductsModelType1,   "一人親方版"},
112
                                                                                { (int)ProductTypeDef.ProductsModelType2,   "承認機能版"},
113
                                                                                { (int)ProductTypeDef.ProductsModelType3,   "承認機能\r\n工事管理機能版"},
114
                                                                                { (int)ProductTypeDef.ProductsModelType4,   "承認機能\r\n工事管理機能・人員管理機能版"},
115
                                                                                { (int)ProductTypeDef.ProductsModelType5,   "フル機能版"},
116
                                                                                { (int)ProductTypeDef.ProductsModelType6,   "フル機能版\r\nカスタマイズ"},
96
                                                                                { (int)ProductTypeDef.ProductsModelType1,   "工事管理機能版"},
97
                                                                                { (int)ProductTypeDef.ProductsModelType2_1, "工事管理機能・承認機能\n(社内LAN版)"},
98
                                                                                { (int)ProductTypeDef.ProductsModelType2_2, "工事管理機能・承認機能\n(VPSネットワーク版版)"},
99
                                                                                { (int)ProductTypeDef.ProductsModelType3,   "工事管理機能・承認機能\n管理機能強化"},
100
                                                                                { (int)ProductTypeDef.ProductsModelType4,   "工事管理機能・承認機能\n管理機能強化・社員管理機能"},
101
                                                                                { (int)ProductTypeDef.ProductsModelType5,   "フル機能"},
102
                                                                                { (int)ProductTypeDef.ProductsModelType6,   "フル機能\r\nカスタマイズ版"},
117 103
                                                                                };
118 104
        #endregion
119 105

  
106
        #region システム更新機能定義
107
        /// <summary>
108
        /// システム更新機能定義
109
        /// </summary>
110
        public enum UpdateProcessDef
111
        {
112
            /// <summary>
113
            /// 0:更新機能無
114
            /// </summary>
115
            None = 0,
116
            /// <summary>
117
            /// 1:更新機能有
118
            /// </summary>
119
            Exists,
120
        }
120 121
        #endregion
121 122

  
123
        #region Webサービス機能定義
124
        /// <summary>
125
        /// Webサービス機能定義
126
        /// </summary>
127
        public enum Web_ServiceDef
128
        {
129
            /// <summary>
130
            /// 0:更新機能無
131
            /// </summary>
132
            None = 0,
133
            /// <summary>
134
            /// 1:更新機能有
135
            /// </summary>
136
            Exists,
137
        }
122 138
        #endregion
123 139

  
140
        #region DBサーバータイプ
141
        /// <summary>
142
        /// DBサーバータイプ
143
        /// </summary>
144
        public enum StorageTypeDef
145
        {
146
            /// <summary>
147
            /// 0:社内LAN
148
            /// </summary>
149
            Internal_LAN = 0,
150
            /// <summary>
151
            /// 1:VPSサーバー
152
            /// </summary>
153
            VPS,
154
        }
155
        #endregion
156

  
157
        #endregion
158

  
124 159
        #region メンバ変数
125 160

  
126 161
        #region 製品種別
127 162
        /// <summary>
128 163
        /// 製品種別
129 164
        /// </summary>
130
        private static int m_ProductType = (int)ProductTypeDef.Originals;
165
        private static int m_ProductType = (int)ProductTypeDef.ProductsModelType1;
131 166
        #endregion
132 167

  
133
        #region 製品種別(サブ)
168
        #region 更新機能実装
134 169
        /// <summary>
135
        /// 製品種別(サブ)
170
        /// 更新機能実装
136 171
        /// </summary>
137
        private static int m_SubProductType = (int)SubProductTypeDef.None;
172
        private static int m_UpdateProcess = (int)UpdateProcessDef.None;
138 173
        #endregion
139 174

  
175
        #region Webサービス機能定義
176
        /// <summary>
177
        /// Webサービス機能定義
178
        /// </summary>
179
        private static int m_Web_Service = (int)Web_ServiceDef.None;
140 180
        #endregion
141 181

  
182
        #region DBサーバータイプ
183
        /// <summary>
184
        /// DBサーバータイプ
185
        /// </summary>
186
        private static int m_StorageType = (int)StorageTypeDef.Internal_LAN;
187
        #endregion
188

  
189
        #endregion
190

  
142 191
        #region コンストラクタ
143 192
        #endregion
144 193

  
......
150 199
        /// </summary>
151 200
        public static int ProductType
152 201
        {
202
            set { m_ProductType = value; }
153 203
            get { return m_ProductType; }
154 204
        }
155 205
        #endregion
156 206

  
157
        #region 製品種別(サブ)
207
        #region 更新機能実装
158 208
        /// <summary>
159
        /// 製品種別(サブ)
209
        /// 更新機能実装
160 210
        /// </summary>
161
        public static int SubProductType
211
        public static int UpdateProcess
162 212
        {
163
            get { return m_SubProductType; }
213
            set { m_UpdateProcess = value; }
214
            get { return m_UpdateProcess; }
164 215
        }
165 216
        #endregion
166 217

  
218
        #region Webサービス機能定義
219
        /// <summary>
220
        /// Webサービス機能定義
221
        /// </summary>
222
        public static int Web_Service
223
        {
224
            set { m_Web_Service = value; }
225
            get { return m_Web_Service; }
226
        }
167 227
        #endregion
168 228

  
229
        #region DBサーバータイプ
230
        /// <summary>
231
        /// DBサーバータイプ
232
        /// </summary>
233
        public static int StorageType
234
        {
235
            set { m_StorageType = value; }
236
            get { return m_StorageType; }
237
        }
238
        #endregion
239

  
240
        #endregion
241

  
169 242
        #region メソッド
170 243

  
171 244
        #region システム構成名称取得
......
177 250
            string strName = string.Empty;
178 251
            try
179 252
            {
180
                switch (m_ProductType)
181
                {
182
                    case (int)ProductTypeDef.Originals:
183
                    case (int)ProductTypeDef.ProductsModelType1:
184
                    case (int)ProductTypeDef.ProductsModelType3:
185
                    case (int)ProductTypeDef.ProductsModelType4:
186
                    case (int)ProductTypeDef.ProductsModelType5:
187
                    case (int)ProductTypeDef.ProductsModelType6:
188
                        strName = ProductName[m_ProductType];
189
                        break;
190
                    case (int)ProductTypeDef.ProductsModelType2:
191
                        if (m_SubProductType == (int)SubProductTypeDef.Type1)
192
                            strName = ProductName[m_ProductType].Replace("朱雀", "");
193
                        else
194
                            strName = ProductName[m_ProductType].Replace("白虎", "");
195
                        break;
196
                    default:
197
                        break;
198
                }
253
                strName = ProductName[m_ProductType];
199 254
            }
200 255
            catch (Exception ex)
201 256
            {
trunk/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOBeforeCreatingLedger.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Data;
6
using System.Collections;
7

  
8
using log4net;
9
using MySql.Data.MySqlClient;           // Data Provider for MySql
10

  
11
using ProcessManagement.DB.MySql;
12
using ProcessManagement.DB.Core;
13
using ProcessManagement.DataModel;
14
using ProcessManagement.Common;
15

  
16
namespace ProcessManagement.DB.IOAccess
17
{
18
    /// <summary>
19
    /// 工事詳細台帳作成前データDBアクセス
20
    /// </summary>
21
    public class IOBeforeCreatingLedger : MySqlProcess
22
    {
23
        #region 定義部
24
        /// <summary>
25
        /// log4netログを使用する
26
        /// </summary>
27
        private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
28
        #endregion
29

  
30
        #region 定数
31
        /// <summary>
32
        /// 工事詳細台帳作成前データフィールド並び
33
        /// </summary>
34
        public enum TblCol
35
        {
36
            /// <summary>
37
            /// 工事番号
38
            /// </summary>
39
            ConstructionCode = 0,
40
            /// <summary>
41
            /// グループ番号
42
            /// </summary>
43
            GroupCount,
44
            /// <summary>
45
            /// 対象年月
46
            /// </summary>
47
            TargetMonth,
48
            /// <summary>
49
            /// 支払金額
50
            /// </summary>
51
            PaymentAmount,
52

  
53
            EntryDate,
54
            UpdateDate,
55
        }
56
        #endregion
57

  
58
        #region コンストラクタ
59
        /// <summary>
60
        /// コンストラクタ
61
        /// </summary>
62
        /// <param name="ConnectionString"></param>
63
        public IOBeforeCreatingLedger()
64
            : base(DBCommon.Instance.DBConnectString)
65
        {
66
        }
67

  
68
        #endregion
69

  
70
        #region SELECT SQL作成
71
        /// <summary>
72
        /// SQL作成
73
        /// </summary>
74
        private string CreateSelectSQL()
75
        {
76
            // SQL作成
77
            StringBuilder strcmd = new StringBuilder();
78

  
79
            strcmd.Append("SELECT");
80

  
81
            bool bColFirst = true;
82
            string strWork = string.Empty;
83
            foreach (var gender in Enum.GetValues(typeof(TblCol)))
84
            {
85
                strWork = gender.ToString();
86
                if (!bColFirst) strcmd.Append(",");
87
                if (strWork.Equals("EntryDate") || strWork.Equals("UpdateDate"))
88
                {
89
                    strcmd.AppendFormat(" DATE_FORMAT({0}, '%Y/%m/%d %H:%i:%s')", strWork);
90
                }
91
                else
92
                {
93
                    strcmd.AppendFormat(" {0}", strWork);
94
                }
95
                bColFirst = false;
96
            }
97

  
98
            strcmd.Append(" FROM BeforeCreatingLedger");
99

  
100
            return strcmd.ToString();
101
        }
102
        #endregion
103

  
104
        #region 工事詳細台帳作成前データ検索
105
        /// <summary>
106
        /// 工事詳細台帳作成前データ検索
107
        /// </summary>
108
        public bool SelectAction(string AddSQLString, ref List<BeforeCreatingLedger> data, bool bConnect = true)
109
        {
110
            // インターフェース
111
            StringBuilder strcmd = new StringBuilder();
112
            ArrayList arData = new ArrayList();
113

  
114
            try
115
            {
116
                // SQL作成
117
                strcmd.Append(CreateSelectSQL());
118
                strcmd.Append(AddSQLString);
119

  
120
                // SQL実行
121
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
122

  
123
                // データセット
124
                foreach (object[] objwrk in arData)
125
                {
126
                    BeforeCreatingLedger work = new BeforeCreatingLedger();
127
                    Reader2Struct(objwrk, ref work);
128
                    data.Add(work);
129
                }
130

  
131
                return true;
132
            }
133
            catch (Exception ex)
134
            {
135
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
136
                return false;
137
            }
138
        }
139
        #endregion
140

  
141
        #region 工事詳細台帳作成前データ検索
142
        /// <summary>
143
        /// 工事詳細台帳作成前データ検索
144
        /// </summary>
145
        public bool SelectAction(string AddSQLString, ref BeforeCreatingLedger data, bool bConnect = true)
146
        {
147
            // インターフェース
148
            StringBuilder strcmd = new StringBuilder();
149
            ArrayList arData = new ArrayList();
150

  
151
            try
152
            {
153
                // SQL作成
154
                strcmd.Append(CreateSelectSQL());
155
                strcmd.Append(AddSQLString);
156

  
157
                // SQL実行
158
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
159
                if (arData.Count == 0) return false;
160

  
161
                // データセット
162
                foreach (object[] objwrk in arData)
163
                {
164
                    Reader2Struct(objwrk, ref data);
165
                    break;
166
                }
167

  
168
                return true;
169
            }
170
            catch (Exception ex)
171
            {
172
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
173
                return false;
174
            }
175
        }
176
        #endregion
177

  
178
        #region 工事詳細台帳作成前データ追加
179
        /// <summary>
180
        /// 工事詳細台帳作成前データ追加
181
        /// </summary>
182
        /// <param name="data">工事詳細台帳作成前データデータ</param>
183
        /// <returns>true:成功 false:失敗</returns>
184
        public bool InsertAction(BeforeCreatingLedger work, bool bConnect = true)
185
        {
186
            StringBuilder strcmd = new StringBuilder();
187
            try
188
            {
189

  
190
                bool bColFirst = true;
191
                strcmd.Append("INSERT INTO BeforeCreatingLedger");
192
                strcmd.Append(" (");
193
                foreach (var gender in Enum.GetValues(typeof(TblCol)))
194
                {
195
                    if (!bColFirst) strcmd.Append(", ");
196
                    strcmd.Append(gender.ToString());
197
                    bColFirst = false;
198
                }
199
                strcmd.Append(") VALUES (");
200

  
201
                strcmd.AppendFormat("  {0}", work.ConstructionCode);        // 工事番号
202
                strcmd.AppendFormat(", {0}", work.GroupCount);              // グループ番号
203
                strcmd.AppendFormat(", {0}", work.TargetMonth);             // 対象年月
204
                strcmd.AppendFormat(", {0}", work.PaymentAmount);           // 支払金額
205

  
206
                strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
207
                strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
208
                strcmd.Append(")");
209

  
210
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
211

  
212
                return true;
213
            }
214
            catch (Exception ex)
215
            {
216
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
217
                return false;
218
            }
219
        }
220
        #endregion
221

  
222
        #region 工事詳細台帳作成前データ追加
223
        /// <summary>
224
        /// 工事詳細台帳作成前データ追加
225
        /// </summary>
226
        /// <param name="data">工事詳細台帳作成前データデータ</param>
227
        /// <returns>true:成功 false:失敗</returns>
228
        public bool InsertAction(List<BeforeCreatingLedger> data, bool bConnect = true)
229
        {
230
            StringBuilder strcmd = new StringBuilder();
231
            try
232
            {
233
                bool bColFirst = true;
234
                strcmd.Append("INSERT INTO BeforeCreatingLedger");
235
                strcmd.Append(" (");
236
                foreach (var gender in Enum.GetValues(typeof(TblCol)))
237
                {
238
                    if (!bColFirst) strcmd.Append(", ");
239
                    strcmd.Append(gender.ToString());
240
                    bColFirst = false;
241
                }
242
                strcmd.Append(") VALUES");
243

  
244
                bool bDataFirst = true;
245
                foreach (BeforeCreatingLedger work in data)
246
                {
247
                    if (bDataFirst) strcmd.Append(" (");
248
                    else strcmd.Append(", (");
249

  
250
                    strcmd.AppendFormat("  {0}", work.ConstructionCode);        // 工事番号
251
                    strcmd.AppendFormat(", {0}", work.GroupCount);              // グループ番号
252
                    strcmd.AppendFormat(", {0}", work.TargetMonth);             // 対象年月
253
                    strcmd.AppendFormat(", {0}", work.PaymentAmount);           // 支払金額
254

  
255
                    strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
256
                    strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
257
                    strcmd.Append(")");
258

  
259
                    bDataFirst = false;
260
                }
261

  
262
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
263
                return true;
264
            }
265
            catch (Exception ex)
266
            {
267
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
268
                return false;
269
            }
270
        }
271
        #endregion
272

  
273
        #region 工事詳細台帳作成前データ更新
274
        /// <summary>
275
        /// 工事詳細台帳作成前データ更新
276
        /// </summary>
277
        /// <param name="AddSQLString">更新条件SQL文字列</param>
278
        /// <param name="data">工事詳細台帳作成前データデータ</param>
279
        /// <returns>true:成功 false:失敗</returns>
280
        public bool UpdateAction(string AddSQLString, BeforeCreatingLedger data, bool bConnect = true)
281
        {
282
            StringBuilder strcmd = new StringBuilder();
283
            try
284
            {
285
                strcmd.Append("UPDATE BeforeCreatingLedger");
286

  
287
                strcmd.Append(" SET");
288

  
289
                strcmd.AppendFormat(" ConstructionCode = {0}", data.ConstructionCode);	        // 工事番号
290

  
291
                strcmd.AppendFormat(", GroupCount = {0}", data.GroupCount);                     // グループ番号
292
                strcmd.AppendFormat(", TargetMonth = {0}", data.TargetMonth);                   // 対象年月
293
                strcmd.AppendFormat(", PaymentAmount = {0}", data.PaymentAmount);               // 支払金額
294

  
295
                strcmd.Append(", UpdateDate = NOW()");
296
                strcmd.Append(AddSQLString);
297

  
298
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
299

  
300
                return true;
301
            }
302
            catch (Exception ex)
303
            {
304
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
305
                return false;
306
            }
307
        }
308
        #endregion
309

  
310
        #region 工事詳細台帳作成前データ削除
311
        /// <summary>
312
        /// 工事詳細台帳作成前データ削除
313
        /// </summary>
314
        /// <param name="AddSQLString">削除条件SQL文字列</param>
315
        /// <param name="data">工事詳細台帳作成前データデータ</param>
316
        /// <returns>true:成功 false:失敗</returns>
317
        public bool DeleteAction(string AddSQLString, bool bConnect = true)
318
        {
319
            // インターフェース
320
            StringBuilder strcmd = new StringBuilder();
321
            try
322
            {
323
                strcmd.AppendFormat("{0}{1}", "DELETE FROM BeforeCreatingLedger", AddSQLString);
324

  
325
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
326

  
327
                return true;
328
            }
329
            catch (Exception ex)
330
            {
331
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
332
                return false;
333
            }
334
        }
335
        #endregion
336

  
337
        #region 1項目更新処理
338
        /// <summary>
339
        /// 1項目の更新を行う
340
        /// </summary>
341
        /// <returns></returns>
342
        public bool UpdateFeild(string strWhere, int FeildNo, object value, bool bConnect = true)
343
        {
344
            StringBuilder strcmd = new StringBuilder();
345
            try
346
            {
347
                strcmd.Append("UPDATE BeforeCreatingLedger");
348

  
349
                strcmd.Append(" SET");
350
                switch (FeildNo)
351
                {
352
                    // 工事番号
353
                    case (int)TblCol.ConstructionCode:
354
                        strcmd.AppendFormat(" ConstructionCode = {0}", ((int)value).ToString());
355
                        break;
356
                    // グループ番号
357
                    case (int)TblCol.GroupCount:
358
                        strcmd.AppendFormat(" GroupCount = {0}", ((int)value).ToString());
359
                        break;
360
                    // 対象年月
361
                    case (int)TblCol.TargetMonth:
362
                        strcmd.AppendFormat(" TargetMonth = {0}", ((int)value).ToString());
363
                        break;
364
                    // 支払金額
365
                    case (int)TblCol.PaymentAmount:
366
                        strcmd.AppendFormat(" PaymentAmount = {0}", ((long)value).ToString());
367
                        break;
368
                }
369

  
370
                strcmd.Append(", UpdateDate = NOW()");
371
                strcmd.Append(strWhere);
372

  
373
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
374

  
375
                return true;
376
            }
377
            catch (Exception ex)
378
            {
379
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
380
                return false;
381
            }
382
        }
383
        #endregion
384

  
385
        #region 1項目更新処理
386
        /// <summary>
387
        /// 1項目の更新を行う
388
        /// </summary>
389
        /// <returns></returns>
390
        public bool UpdateFeild(int ConstructionCode, int GroupCount, int TargetMonth, int FeildNo, object value, bool bConnect = true)
391
        {
392
            StringBuilder strcmd = new StringBuilder();
393
            try
394
            {
395
                strcmd.Append("UPDATE BeforeCreatingLedger");
396

  
397
                strcmd.Append(" SET");
398

  
399
                switch (FeildNo)
400
                {
401
                    // 工事番号
402
                    case (int)TblCol.ConstructionCode:
403
                        strcmd.AppendFormat(" ConstructionCode = {0}", (int)value);
404
                        break;
405
                    // グループ番号
406
                    case (int)TblCol.GroupCount:
407
                        strcmd.AppendFormat(" GroupCount = {0}", (int)value);
408
                        break;
409
                    // 対象年月
410
                    case (int)TblCol.TargetMonth:
411
                        strcmd.AppendFormat(" TargetMonth = {0}", ((int)value).ToString());
412
                        break;
413
                    // 支払金額
414
                    case (int)TblCol.PaymentAmount:
415
                        strcmd.AppendFormat(" PaymentAmount = {0}", (double)value);
416
                        break;
417
                    default:
418
                        break;
419
                }
420

  
421
                strcmd.Append(", UpdateDate = NOW()");
422
                strcmd.Append(CreatePrimarykeyString(ConstructionCode, GroupCount, TargetMonth));
423

  
424
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
425

  
426
                return true;
427
            }
428
            catch (Exception ex)
429
            {
430
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
431
                return false;
432
            }
433
        }
434
        #endregion
435

  
436
        #region MySQLDataReaderより構造体へセットする
... 差分の行数が表示可能な上限を超えました。超過分は表示しません。

他の形式にエクスポート: Unified diff