プロジェクト

全般

プロフィール

リビジョン 60

山内7年以上前に追加

運用VPS対応MySql版(テスト中)(Oracle版はリビジョン50)
実装状況は、/svn/pmana/trunk/Document/運用支援資料の現場監督秘書ビーアイテイ担当機能一覧.xlsx

差分を表示:

branches/src/ProcessManagement/ProcessManagement/Common/CommonDefine.cs
1678 1678
        }
1679 1679
        #endregion
1680 1680

  
1681
        #region 資材返却期限
1682
        /// <summary>
1683
        /// 資材返却期限コントロールアイテム      // Add BIT 2017/03/18
1684
        /// </summary>
1685
        public static string[,] MaterualLimitItem = new string[2,4] {
1686
                                                                      { "資材返却", "本日返却期限の資材があります。",   "0xFF0000", "0x000000" },
1687
                                                                      { "資材返却", "返却期限を過ぎた資材があります。", "0x808080", "0xFF0000" }
1688
                                                                    };
1689
        public static List<KeyValuePair<int, int>> MaterualStatusCheckList = new List<KeyValuePair<int, int>>{
1690
            new KeyValuePair<int, int>((int)CommonDefine.TermDateCheckTiming.CheckSchdule1, 0),
1691
            new KeyValuePair<int, int>((int)CommonDefine.TermDateCheckTiming.CheckSchdule3, 1)};
1692
        #endregion
1693

  
1681 1694
    }
1682 1695
}
branches/src/ProcessManagement/ProcessManagement/Common/Process/ClsChangeLedgerData.cs
773 773
        /// </summary>
774 774
        /// <param name="TargetMonth"></param>
775 775
        /// <returns></returns>
776
        private static int CalcTargetMonthToColumn(DateTime StartDate, DateTime TargetMonth)
776
        public static int CalcTargetMonthToColumn(DateTime StartDate, DateTime TargetMonth)
777 777
        {
778 778
            FrmConstructionLedger frm = new FrmConstructionLedger();
779 779
            int Columncnt = frm.GetGridColumsCount - 1;
branches/src/ProcessManagement/ProcessManagement/Common/Process/ClsExcute.cs
114 114
            ConstructionExpenses = 126,         // 126:施工経費区分登録
115 115
            MaterialKind = 127,                 // 127:資材種類マスタ
116 116
            MaterialItem = 128,                 // 128:資材品目マスタ
117
            SalesConfirm = 129,                 // 129:売上確認
117 118
        }
118 119
        #endregion
119 120

  
......
206 207
                                                                                { (int)MaintenanceExecuteNo.ConstructionExpenses,       "施工経費区分登録"},           // 126
207 208
                                                                                { (int)MaintenanceExecuteNo.MaterialKind,               "資材種類登録"},              // 127
208 209
                                                                                { (int)MaintenanceExecuteNo.MaterialItem,               "資材品目登録"},              // 128
210
                                                                                { (int)MaintenanceExecuteNo.SalesConfirm,               "売上確認"},              // 128
209 211
                                                                                };
210 212
        #endregion
211 213

  
......
470 472
                        case (int)ProcessExecuteNo.RequestInput:                         // 31:請求入力
471 473
                            ProcessExecuteNo_RequestInput(m_ProcControlPara[NowPoint]);
472 474
                            break;
475
                        case (int)ProcessExecuteNo.RequestPrint:                        // 32:請求書印刷
476
                            ProcessExecuteNo_RequestPrint(m_ProcControlPara[NowPoint]);
477
                            break;
473 478

  
474 479
                        #endregion  
475 480

  
......
559 564
                        case (int)MaintenanceExecuteNo.MaterialItem:                    // 128:資材品目マスタ
560 565
                            MaintenanceExecuteNo_MaterialItems(m_ProcControlPara[NowPoint]);
561 566
                            break;
567
                        case (int)MaintenanceExecuteNo.SalesConfirm:                    // 129:売上確認
568
                            MaintenanceExecuteNo_SalesConfirm(m_ProcControlPara[NowPoint]);
569
                            break;
562 570

  
563 571

  
564 572
                        #endregion
......
1900 1908
            FrmRequestSummaryList frm = new FrmRequestSummaryList();
1901 1909
            try
1902 1910
            {
1911
                int ProcessNo = (int)ProcessExecuteNo.RequestSummaryList;
1912

  
1913
                // 起動・編集フラグ
1914
                int EditFlg = (int)CommonDefine.ProcessDataEdit.Reference;
1915
                if (!ClsSecurityPermission.GetExecutePermission(ProcessNo, ref EditFlg))
1916
                {
1917
                    BackProcess();
1918
                    return;
1919
                }
1920

  
1921
                if (EditFlg == (int)CommonDefine.ProcessDataEdit.Reference) frm.EditLock = true;
1922

  
1903 1923
                // パラメータセット
1904 1924
                frm.Labourkind = CurrentPara.IntExecParameter[0];
1905 1925

  
......
1924 1944
        /// <returns></returns>
1925 1945
        public static void ProcessExecuteNo_RequestInput(ProcessParameter CurrentPara)
1926 1946
        {
1927
            // 工事案件選択画面
1928
            FrmConstructionDiag frmCnstDlg = new FrmConstructionDiag();
1929 1947

  
1930
            // 工事一覧の表示に必要なデータを設定(担当者コード、工事担当者検索)
1931
            frmCnstDlg.PersonCode = CommonMotions.LoginUserData.PersonCode;
1932
            frmCnstDlg.PersonCharge = (int)FrmConstructionDiag.PersonChargePoint.Construction;
1933
            frmCnstDlg.SelectType = CurrentPara.IntExecParameter[0];
1948
            int nConstructionCode = 0;
1949
            bool bEdit = true;
1934 1950

  
1935
            // 工事案件選択画面のオープン
1936
            frmCnstDlg.ShowDialog();
1951
            if( CurrentPara.BoolExecParameter[0] == false )
1952
            {
1937 1953

  
1954
                // 工事案件選択画面
1955
                FrmConstructionDiag frmCnstDlg = new FrmConstructionDiag();
1956

  
1957
                // 工事一覧の表示に必要なデータを設定(担当者コード、工事担当者検索)
1958
                frmCnstDlg.PersonCode = CommonMotions.LoginUserData.PersonCode;
1959
                frmCnstDlg.PersonCharge = (int)FrmConstructionDiag.PersonChargePoint.Construction;
1960
                frmCnstDlg.SelectType = CurrentPara.IntExecParameter[3];
1961

  
1962
                // 工事案件選択画面のオープン
1963
                frmCnstDlg.ShowDialog();
1964

  
1965
                nConstructionCode = frmCnstDlg.ConstructionCode;
1966

  
1967
                frmCnstDlg.Dispose();
1968
                frmCnstDlg = null;
1969

  
1970
            }
1971
            else{
1972
                nConstructionCode = CurrentPara.IntExecParameter[0];
1973

  
1974
                bEdit = false;
1975
            }
1976

  
1977

  
1938 1978
            // 工事番号を取得できなかった場合
1939
            if (0 == frmCnstDlg.ConstructionCode)
1979
            if (0 == nConstructionCode)
1940 1980
            {
1941 1981
                ClsExcute.BackProcess();
1942 1982
                return;
......
1949 1989
            {
1950 1990

  
1951 1991
                // 工事案件選択画面で選択された工事番号をセット
1952
                frm.ConstructionCode = frmCnstDlg.ConstructionCode;
1992
                frm.ConstructionCode = nConstructionCode;
1993
                frm.ApprovalCode = CurrentPara.IntExecParameter[1];
1994
                frm.OrderNo = CurrentPara.IntExecParameter[2];
1995
                frm.EditFlg = bEdit;
1953 1996

  
1954 1997
                // 請求入力の表示
1955 1998
                frm.ShowDialog();
......
1977 2020
            FrmSelectPayment frm = new FrmSelectPayment();
1978 2021
            try
1979 2022
            {
2023
                int ProcessNo = (int)ProcessExecuteNo.PaymentConfirmation;
2024

  
2025
                // 起動・編集フラグ
2026
                int EditFlg = (int)CommonDefine.ProcessDataEdit.Reference;
2027
                if (!ClsSecurityPermission.GetExecutePermission(ProcessNo, ref EditFlg))
2028
                {
2029
                    BackProcess();
2030
                    return;
2031
                }
2032

  
2033
                // フォーム表示
1980 2034
                frm.ShowDialog();
1981 2035
            }
1982 2036
            catch (Exception ex)
......
1990 2044
        }
1991 2045
        #endregion
1992 2046

  
2047
        #region 請求書印刷
2048
        /// <summary>
2049
        /// 請求書印刷
2050
        /// </summary>
2051
        /// <param name="CurrentPara"></param>
2052
        public static void ProcessExecuteNo_RequestPrint(ProcessParameter CurrentPara)
2053
        {
2054
            // 入金確認
2055
            FrmEntryReqSelOrderer frm = new FrmEntryReqSelOrderer();
2056
            try
2057
            {
2058
                int ProcessNo = (int)ProcessExecuteNo.PaymentConfirmation;
2059

  
2060
                // 起動・編集フラグ
2061
                int EditFlg = (int)CommonDefine.ProcessDataEdit.Reference;
2062
                if (!ClsSecurityPermission.GetExecutePermission(ProcessNo, ref EditFlg))
2063
                {
2064
                    BackProcess();
2065
                    return;
2066
                }
2067

  
2068
                // フォーム表示
2069
                frm.ShowDialog();
2070
            }
2071
            catch (Exception ex)
2072
            {
2073
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
2074
            }
2075
            finally
2076
            {
2077
                frm.Dispose(); frm = null;
2078
            }
2079
        }
2080
        #endregion
2081

  
1993 2082
        #region マスタメンテナンス
1994 2083
        // ----------------- メンテナンス起動
1995 2084
        #region 管理マスタ
......
2901 2990
        }
2902 2991
        #endregion
2903 2992

  
2993
        #region 売上確認
2994
        /// <summary>
2995
        /// 売上確認
2996
        /// </summary>
2997
        /// <param name="CurrentPara"></param>
2998
        public static void MaintenanceExecuteNo_SalesConfirm(ProcessParameter CurrentPara)
2999
        {
3000
            // 売上確認
3001
            FrmSalesConfirm frm = new FrmSalesConfirm();
3002
            try
3003
            {
3004
                int ProcessNo = (int)MaintenanceExecuteNo.SalesConfirm;
3005
                // 起動・編集フラグ
3006
                int EditFlg = (int)CommonDefine.ProcessDataEdit.Reference;
3007
                if (!ClsSecurityPermission.GetExecutePermission(ProcessNo, ref EditFlg))
3008
                {
3009
                    BackProcess();
3010
                    return;
3011
                }
3012

  
3013
                // フォーム表示
3014
                frm.ShowDialog();
3015
            }
3016
            catch (Exception ex)
3017
            {
3018
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
3019
            }
3020
            finally
3021
            {
3022
                frm.Dispose(); frm = null;
3023
            }
3024
        }
2904 3025
        #endregion
2905 3026

  
3027
        #endregion
3028

  
2906 3029
        #region サブフォーム
2907 3030
        #region 掲示板メッセージ入力
2908 3031
        /// <summary>
branches/src/ProcessManagement/ProcessManagement/Common/Process/ClsProcessExist.cs
925 925
                foreach (RequestDataDetail dt in ReqDtlList)
926 926
                {
927 927
                    // 最終承認されている(承認済)の場合
928
                    if (ClsApprovalPermission.CheckApprovalData(m_ConstructionCode, (int)ClsExcute.ApprovalListNo.OrderBillingApproval, dt.OrderNo))
929
                    {
930
                        Approvedflg = true;
931
                        break;
932
                    }
928
//                    if (ClsApprovalPermission.CheckApprovalData(m_ConstructionCode, (int)ClsExcute.ApprovalListNo.OrderBillingApproval, dt.OrderNo))
929
//                    {
930
//                        Approvedflg = true;
931
//                        break;
932
//                   }
933 933
                }
934 934

  
935 935
                return Approvedflg;
branches/src/ProcessManagement/ProcessManagement/Common/Process/ClsSecurityPermission.cs
34 34
        #endregion
35 35

  
36 36
        #region 定数
37

  
38
        #region 保護区分
39
        /// <summary>
40
        /// 保護区分
41
        /// </summary>
42
        public enum SecRangeType
43
        {
44
            AllDepartment = 1,
45
            MultiDepartment = 2,
46
            OneDepartment = 3,
47
            InCharge = 4,
48
        }
37 49
        #endregion
38 50

  
51
        #endregion
52

  
53
        #region ユーザ情報
54
        /// <summary>
55
        /// ユーザ情報
56
        /// </summary>
57
        public class UserInfo
58
        {
59
            public CommonDefine.SecurityRankPos m_Type { get; set; }            // 権限
60
            public int m_GeneralAffairsFlg { get; set; }                        // 総務業務フラグ
61
            public SecRangeType m_SecRange { get; set; }                        // 保護区分
62
            public bool CanEditDeposit
63
            {
64
                get { return m_GeneralAffairsFlg == 1; }
65
            }
66
            public bool CanEditDepositDetail
67
            {
68
                get { return m_GeneralAffairsFlg == 0; }
69
            }
70
        }
71
        #endregion
72

  
39 73
        #region 旧セキュリティメソッド
40 74
        #region 工事データアクセス許可
41 75
        /// <summary>
......
1112 1146
        }
1113 1147
        #endregion
1114 1148

  
1149
        #region ユーザタイプ判定
1150
        /// <summary>
1151
        /// ユーザタイプ判定
1152
        /// </summary>
1153
        public static void SetUserType(UserInfo userInfo)
1154
        {
1155
            try
1156
            {
1157
                // 保護区分ランク
1158
                // システム管理者・特別権限
1159
                if (CommonMotions.LoginUserData.PersonCode == CommonDefine.AdminCode
1160
                 || CommonMotions.LoginUserData.SecurityManagement == CommonDefine.SecurityRankList[(int)CommonDefine.SecurityRankPos.SpecialAuthority].Key)
1161
                {
1162
                    // 特別権限
1163
                    userInfo.m_Type = CommonDefine.SecurityRankPos.SpecialAuthority;
1164
                }
1165
                // 統括者権限
1166
                else if (CommonMotions.LoginUserData.SecurityManagement == CommonDefine.SecurityRankList[(int)CommonDefine.SecurityRankPos.FreeAuthority].Key)
1167
                {
1168
                    // 統括者権限
1169
                    userInfo.m_Type = CommonDefine.SecurityRankPos.FreeAuthority;
1170

  
1171
                }
1172
                // 所属長権限
1173
                else if (CommonMotions.LoginUserData.SecurityManagement == CommonDefine.SecurityRankList[(int)CommonDefine.SecurityRankPos.LimitedAuthority].Key)
1174
                {
1175
                    // 所属長権限
1176
                    userInfo.m_Type = CommonDefine.SecurityRankPos.LimitedAuthority;
1177

  
1178
                }
1179
                // 一般権限
1180
                else if (CommonMotions.LoginUserData.SecurityManagement == CommonDefine.SecurityRankList[(int)CommonDefine.SecurityRankPos.NormalAuthority].Key)
1181
                {
1182
                    // 一般権限
1183
                    userInfo.m_Type = CommonDefine.SecurityRankPos.NormalAuthority;
1184
                }
1185

  
1186
                // 保護区分範囲
1187
                userInfo.m_SecRange = (SecRangeType)CommonMotions.LoginUserSecurity.SecRange;
1188
                // 総務業務フラグ
1189
                userInfo.m_GeneralAffairsFlg = CommonMotions.LoginUserSecurity.GeneralAffairs;
1190
            }
1191
            catch (Exception ex)
1192
            {
1193
                logger.ErrorFormat("システムエラー:{0}:{1}", ex.Message);
1194
            }
1195
        }
1115 1196
        #endregion
1197

  
1198
        #endregion
1116 1199
    }
1117 1200
}
branches/src/ProcessManagement/ProcessManagement/Common/Process/ClsSystemOnceExecute.cs
86 86
                if (!(ProcessFlg = UpDateTargetDate(DateTime.Now))) return;
87 87

  
88 88
                // ----- データチェック
89
                // 資材返却期限のチェックを行う
90
                if (!(ProcessFlg = MaterialLimitCheck(m_lastsessionDate))) return;
91

  
89 92
                // 日付の期限チェックを行う
90 93
                if(!(ProcessFlg = SubmittedDateCheck(m_lastsessionDate))) return;
91 94

  
......
248 251
        }
249 252
        #endregion
250 253

  
254
        #region 資材返却ステータス取得処理
255
        /// <summary>
256
        /// 資材返却ステータス取得処理
257
        /// </summary>
258
        /// <returns></returns>
259
        public void MaterualStatusCheck(MaterialRecordInfo checkRec, DateTime CriteriaDate, ref TermMaster TermRec)
260
        {
261
            try
262
            {
263
                // 対象日付を設定
264
                DateTime Target = checkRec.RepayPlanDate;
265

  
266
                TermMaster TermMasterData = new TermMaster();
267

  
268
                // 当日のチェック 今日を基準に対象日と比較する
269
                if (Target.Date == CriteriaDate.Date)
270
                {
271
                    TermMasterData.CheckSchdule = (int)CommonDefine.TermDateCheckTiming.CheckSchdule1;
272
                    TermMasterData.TermDays     = CommonDefine.MaterualStatusCheckList[0].Value;
273
                    TermMasterData.SendTitle    = CommonDefine.MaterualLimitItem[0, 0];
274
                    TermMasterData.SendMessage  = CommonDefine.MaterualLimitItem[0, 1];
275
                    TermMasterData.BackColor    = CommonDefine.MaterualLimitItem[0, 2];
276
                    TermMasterData.ForeColor    = CommonDefine.MaterualLimitItem[0, 3];
277
                }
278
                // 後日以降継続のチェック 今日を基準に経過日(1日)が過ぎているか比較する
279
                if (Target.AddDays(1).Date <= CriteriaDate.Date)
280
                {
281
                    TermMasterData.CheckSchdule = (int)CommonDefine.TermDateCheckTiming.CheckSchdule3;
282
                    TermMasterData.TermDays     = CommonDefine.MaterualStatusCheckList[1].Value;
283
                    TermMasterData.SendTitle    = CommonDefine.MaterualLimitItem[1, 0];
284
                    TermMasterData.SendMessage  = CommonDefine.MaterualLimitItem[1, 1];
285
                    TermMasterData.BackColor    = CommonDefine.MaterualLimitItem[1, 2];
286
                    TermMasterData.ForeColor    = CommonDefine.MaterualLimitItem[1, 3];
287
                }
288

  
289
                TermRec = TermMasterData;
290
            }
291
            catch (Exception ex)
292
            {
293
                logger.ErrorFormat("システムエラー:{0}", ex.Message);
294
            }
295
        }
296
        #endregion
297

  
298
        #region 秘書からのメッセージ作成
299
        /// <summary>
300
        /// 秘書からのメッセージ作成
301
        /// </summary>
302
        private bool MakeSecretaryMassageData(IOMessageBoardData mbdDB,
303
                                        IOMessageBoardTerget mbtDB,
304
                                        IOConstructionBaseInfoDetail cbiDB,
305
                                        MaterialRecordInfo wrkRec, TermMaster CheckRec, DateTime CriteriaDate)
306
        {
307
            try
308
            {
309
                // 工事名称・担当者取得
310
                string strSQL = "SELECT A.DETAILSTRING, C.PERSONCODE CCODE, C.PERSONNAME CNAME";
311
                strSQL += " FROM ConstructionBaseInfo P";
312
                strSQL += string.Format(" LEFT JOIN PERSONINCHARGEMASTER C ON C.PERSONCODE = {0}", wrkRec.PersonCode);
313
                strSQL += " , CONSTRUCTIONBASEINFODETAIL A";
314
                strSQL += string.Format(" WHERE P.CONSTRUCTIONCODE = {0}", wrkRec.ConstructionCode);
315
                strSQL += string.Format(" AND A.CONSTRUCTIONCODE = P.CONSTRUCTIONCODE AND A.DETAILNO = {0}", (int)ConstructionBaseInfoDetail.DetailDataNo.ConstructionName);
316
                ArrayList arList = new ArrayList();
317
                if (!cbiDB.ExecuteReader(strSQL, ref arList)) return false;
318

  
319
                string DetailString = string.Empty;
320
                int SalesPersonCode = 0;
321
                string SalesPersonName = string.Empty;
322
                int ConstructionPersonCode = 0;
323
                string ConstructionPersonName = string.Empty;
324
                foreach (object[] onjwrk in arList)
325
                {
326
                    DetailString = CommonMotions.cnvString(onjwrk[0]);
327
                    ConstructionPersonCode = CommonMotions.cnvInt(onjwrk[1]);
328
                    ConstructionPersonName = CommonMotions.cnvString(onjwrk[2]);
329
                    break;
330
                }
331

  
332
                // 新規メッセージ作成
333
                MessageBoardData WriteData = new MessageBoardData();
334
                List<MessageBoardTerget> WriteDetail = new List<MessageBoardTerget>();
335

  
336
                // 掲示板メッセージ
337
                WriteData.FromCode = CommonDefine.s_MsgBoardSystemCode;	                                    // 書込み者コード
338
                WriteData.FromName = string.Format(CommonDefine.s_MsgBoardSystemNameFormat, "秘書");        // 書込み者名
339

  
340
                WriteData.MessageTitle = CheckRec.SendTitle;                                                // 伝言タイトル
341

  
342
                // リンク情報
343
                WriteData.LinkType = (int)CommonDefine.LinkType.ConstructionInfo;
344
                WriteData.LinkMessage = string.Format("工事番号:{0} 工事名称:{1}"
345
                                                                            , CommonMotions.cnvStringCodeFromInt(wrkRec.ConstructionCode, "-", 8)
346
                                                                            , DetailString);
347
                WriteData.LinkCode = string.Format("{0}", CommonMotions.cnvStringCodeFromInt(wrkRec.ConstructionCode, "-", 8));
348

  
349
                // 伝言内容
350
                WriteData.MessageContent = CheckRec.SendMessage;
351

  
352

  
353
                //WriteData.WritingDate = DateTime.Now;	                                                    // 書込み日付
354
                WriteData.WritingDate = CriteriaDate.Date + DateTime.Now.TimeOfDay;	                        // 書込み日付
355
                WriteData.PersonCode = CommonDefine.s_MsgBoardSystemCode;	                                // 書込み担当者コード
356
                WriteData.ShareFlag = 1;	                                                                // 管理者対象フラグ
357

  
358
                WriteData.BackColor = CheckRec.BackColor;                                                   // 背景色セット
359
                WriteData.MessageColor = CheckRec.ForeColor;                                                // 背景色セット
360

  
361
                // 掲示板対象者テーブル
362
                MessageBoardTerget DetailTbl = new MessageBoardTerget();
363
                DetailTbl.ToCode = ConstructionPersonCode;                                                  // 対象者コード
364
                DetailTbl.ToName = ConstructionPersonName;	                                                // 対象者
365
                WriteDetail.Add(DetailTbl);
366

  
367
                // メッセージフラグを自動に設定する
368
                WriteData.MessageFlag = (int)CommonDefine.MessageFlg.Secretary;
369

  
370
                // 掲示板へメッセージを載せる
371
                if (!ClsMessageBoradAccess.CreateMessage(mbdDB, mbtDB, WriteData, WriteDetail)) return false;
372

  
373
                return true;
374
            }
375
            catch (Exception ex)
376
            {
377
                logger.ErrorFormat("システムエラー:{0}", ex.Message);
378
                return false;
379
            }
380
        }
381
        #endregion
382

  
383
        #region 資材返却期限チェック処理
384
        /// <summary>
385
        /// チェック処理
386
        /// </summary>
387
        /// <returns></returns>
388
        public bool MaterialLimitCheck(DateTime StartDate)
389
        {
390
            IOConstructionBaseInfo cbiDB = new IOConstructionBaseInfo();
391
            IOConstructionBaseInfoDetail cbiDDB = new IOConstructionBaseInfoDetail();
392
            IOMessageBoardData mbdDB = new IOMessageBoardData();
393
            IOMessageBoardTerget mbtDB = new IOMessageBoardTerget();
394

  
395
            string strSQL = "SELECT";
396
            strSQL += " t1.MaterialItemCode";
397
            strSQL += ", t1.ProcessDate";
398
            strSQL += ", t1.SeqNo";
399
            strSQL += ", t1.RecKind";
400
            strSQL += ", t1.ConstructionCode";
401
            strSQL += ", t1.PersonCode";
402
            strSQL += ", t1.MaterialCount";
403
            strSQL += ", MAX(t1.REPAYPLANDATE) AS RepayPlanDate";
404
            strSQL += ", t1.CommentText";
405
            strSQL += ", t1.EntryDate";
406
            strSQL += ", t1.UpdateDate";
407
            strSQL += " FROM";
408
            strSQL += " MATERIALRECORDINFO AS t1";
409
            strSQL += " INNER JOIN CONSTRUCTIONMATERIALINFO AS t2";
410
            strSQL += " ON t1.CONSTRUCTIONCODE = t2.CONSTRUCTIONCODE";
411
            strSQL += " AND t1.MATERIALITEMCODE = t2.MATERIALITEMCODE";
412
            strSQL += " AND t2.COMPLETEFLG = 0";
413
            strSQL += " WHERE";
414
            strSQL += " t1.CONSTRUCTIONCODE > 0";
415
            strSQL += " AND t1.CONSTRUCTIONCODE IS NOT NULL";
416
            strSQL += " AND t1.RECKIND = 0";
417
            strSQL += " AND t1.REPAYPLANDATE <= DATE_FORMAT(NOW(), '%Y/%m/%d')";
418
            strSQL += " GROUP BY";
419
            strSQL += " t1.CONSTRUCTIONCODE";
420
            strSQL += ", t1.PERSONCODE";
421
            strSQL += " ORDER BY";
422
            strSQL += " t1.CONSTRUCTIONCODE";
423
            strSQL += " , t1.REPAYPLANDATE";
424

  
425
            try
426
            {
427
                cbiDB.connect(); cbiDB.beginTran();
428
                cbiDDB.connect(); cbiDDB.beginTran();
429
                mbdDB.connect(); mbdDB.beginTran();
430
                mbtDB.connect(); mbtDB.beginTran();
431

  
432
                bool procflg = true;
433

  
434
                // 資材履歴情報の返却未完了の貸出データを取得する
435
                IOMaterialRecordInfo mrDB = new IOMaterialRecordInfo();
436
                ArrayList mrData = new ArrayList();
437
                List<MaterialRecordInfo> data = new List<MaterialRecordInfo>();
438

  
439
                if (mrDB.ExecuteReader(strSQL, ref mrData))
440
                {
441
                    foreach (object[] objwrk in mrData)
442
                    {
443
                        MaterialRecordInfo wrkRec = new MaterialRecordInfo();
444
                        mrDB.Reader2Struct(objwrk, ref wrkRec);
445
                        // チェック
446
                        TermMaster term = new TermMaster();
447
                        MaterualStatusCheck(wrkRec, StartDate, ref term);
448

  
449
                        // メッセージ作成 掲示板にメッセージを載せる処理
450
                        if (!MakeSecretaryMassageData(mbdDB, mbtDB, cbiDDB, wrkRec, term, StartDate))
451
                        {
452
                            procflg = false;
453
                            break;
454
                        }
455
                    }
456

  
457
                    if (procflg)
458
                    {
459
                        cbiDB.commit();
460
                        cbiDDB.commit();
461
                        mbdDB.commit();
462
                        mbtDB.commit();
463
                    }
464
                    else
465
                    {
466
                        cbiDB.rollback();
467
                        cbiDDB.rollback();
468
                        mbdDB.rollback();
469
                        mbtDB.rollback();
470
                    }
471

  
472
                    return procflg;
473
                }
474
            }
475
            catch (Exception ex)
476
            {
477
                logger.ErrorFormat("システムエラー:{0}", ex.Message);
478
                return false;
479
            }
480
            finally
481
            {
482
                cbiDB.close(); cbiDB = null;
483
                cbiDDB.close(); cbiDDB = null;
484
                mbdDB.close(); mbdDB = null;
485
                mbtDB.close(); mbtDB = null;
486
            }
487
            return true;
488
        }
489
        #endregion
490

  
251 491
        #region 工事情報チェック処理
252 492
        /// <summary>
253 493
        /// 日付の期限チェックを行う
......
623 863
                strSQL += string.Format(" < STR_TO_DATE('{0}','%Y/%m/%d')", DateTime.Now.ToShortDateString());
624 864
                strSQL += string.Format(" AND CONSTRUCTIONSTATUSFLG IN({0}, {1})", iCode2, iCode3);
625 865
                strSQL += string.Format(" AND ESTIMATETYPE IN ({0}, {1}))", (int)CommonDefine.BaseInfoEstimateType.Normal, (int)CommonDefine.BaseInfoEstimateType.GetBudget);
626
                strSQL += " ) AS TMP"; // MySql対応(Updateの副問合せ対応)
866
                strSQL += " ) AS TMP )"; // MySql対応(Updateの副問合せ対応)
627 867
                if (!BaseDB.ExecuteNonQuery(strSQL))
628 868
                {
629 869
                    logger.ErrorFormat("工事基本情報更新エラー 非受注案件移行処理失敗:{0}:{1}", CommonMotions.GetMethodName(), strSQL);
......
701 941
                string strSQL = "SELECT A.PERSONCODE, A.MONTHLYSALARY, A.YEARSALARY, A.STARTDATE, C.MONTHLYSALARY, C.YEARSALARY";
702 942
                strSQL += " FROM PERSONSALARYMASTER A,";
703 943
                strSQL += " (SELECT PERSONCODE, MAX(STARTDATE) sDate FROM PERSONSALARYMASTER";
704
                strSQL += string.Format(" WHERE DATE(STARTDATE) <= STR_TO_DATE('{0}') GROUP BY PERSONCODE) B,", DateTime.Today.ToShortDateString());
944
                strSQL += string.Format(" WHERE DATE(STARTDATE) <= STR_TO_DATE('{0}', '%Y/%m/%d') GROUP BY PERSONCODE) B,", DateTime.Today.ToShortDateString());
705 945
                strSQL += " PERSONINCHARGEMASTER C";
706 946
                strSQL += "  WHERE A.PERSONCODE = B.PERSONCODE AND A.STARTDATE = B.sDate";
707 947
                strSQL += " AND C.PERSONCODE = A.PERSONCODE";
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IODepositData.cs
38 38
            OrderersCode,
39 39
            TargetDate,
40 40
            SeqNo,
41
            BusinessPeriod,
41 42
            DepositDate,
43
            DepositAmount,
42 44
            DepositAmountCash,
43 45
            DepositAmountBill,
44 46
            EntryDate,
......
73 75
            strcmd += ",OrderersCode";
74 76
            strcmd += ",TargetDate";
75 77
            strcmd += ",SeqNo";
78
            strcmd += ",BusinessPeriod";
76 79
            strcmd += ",DATE_FORMAT(DepositDate, '%Y/%m/%d')";
80
            strcmd += ",DepositAmount";
77 81
            strcmd += ",DepositAmountCash";
78 82
            strcmd += ",DepositAmountBill";
79 83
            strcmd += ",DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')";
......
209 213
                    strcmd += string.Format(", {0}", data.OrderersCode.ToString());
210 214
                    strcmd += string.Format(", {0}", data.TargetDate.ToString());
211 215
                    strcmd += string.Format(", {0}", data.SeqNo.ToString());
216
                    strcmd += string.Format(", {0}", data.BusinessPeriod.ToString());
212 217
                    strcmd += string.Format(", DATE_FORMAT('{0}','%Y/%m/%d')", data.DepositDate.ToShortDateString());
218
                    strcmd += string.Format(", {0}", data.DepositAmount.ToString());
213 219
                    strcmd += string.Format(", {0}", data.DepositAmountCash.ToString());
214 220
                    strcmd += string.Format(", {0}", data.DepositAmountBill.ToString());
215 221
                    strcmd += ", DATE_FORMAT(DATE_FORMAT(NOW(),'%Y/%m/%d %H:%i:%s'),'%Y/%m/%d %H:%i:%s')";
......
249 255
                strcmd += string.Format(",OrderersCode = {0}", data.OrderersCode.ToString());
250 256
                strcmd += string.Format(",TargetDate = {0}", data.TargetDate.ToString());
251 257
                strcmd += string.Format(",SeqNo = {0}", data.SeqNo.ToString());
258
                strcmd += string.Format(",BusinessPeriod = {0}", data.BusinessPeriod.ToString());
252 259
                strcmd += string.Format(",DepositDate = DATE_FORMAT('{0}','%Y%m%d')", data.DepositDate.ToString());
260
                strcmd += string.Format(",DepositAmount = {0}", data.DepositAmount.ToString());
253 261
                strcmd += string.Format(",DepositAmountCash = {0}", data.DepositAmountCash.ToString());
254 262
                strcmd += string.Format(",DepositAmountBill = {0}", data.DepositAmountBill.ToString());
255 263
                strcmd += ", UpdateDate = DATE_FORMAT(DATE_FORMAT(NOW(),'%Y/%m/%d %H:%i:%s'),'%Y/%m/%d %H:%i:%s')";
......
309 317
                wrk.OrderersCode = int.Parse(objwrk[(int)ColumnName.OrderersCode].ToString());
310 318
                wrk.TargetDate = objwrk[(int)ColumnName.TargetDate].ToString();
311 319
                wrk.SeqNo = int.Parse(objwrk[(int)ColumnName.SeqNo].ToString());
320
                wrk.BusinessPeriod = int.Parse(objwrk[(int)ColumnName.BusinessPeriod].ToString());
312 321
                wrk.DepositDate = DateTime.Parse(objwrk[(int)ColumnName.DepositDate].ToString());
322
                wrk.DepositAmount = int.Parse(objwrk[(int)ColumnName.DepositAmount].ToString());
313 323
                wrk.DepositAmountCash = int.Parse(objwrk[(int)ColumnName.DepositAmountCash].ToString());
314 324
                wrk.DepositAmountBill = int.Parse(objwrk[(int)ColumnName.DepositAmountBill].ToString());
315 325

  
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IODepositDataDetail.cs
87 87
                strcmd = "SELECT";
88 88
                strcmd += " OrderersDivision";
89 89
                strcmd += " ,OrderersCode";
90
                strcmd += " ,DATE_FORMAT(TargetDate, '%Y/%m/%d')";
90
                strcmd += " ,CAST(TargetDate As Char)";
91 91
                strcmd += " ,SeqNo";
92 92
                strcmd += " ,LineCount";
93 93
                strcmd += " ,RequestNo";
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOInvoiceData.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
using System.Collections;
7

  
8
using log4net;
9
using MySql.Data.MySqlClient;
10

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

  
15
using ProcessManagement.Common;
16

  
17
namespace ProcessManagement.DB.IOAccess
18
{
19
    /// <summary>
20
    /// 請求書データアクセスクラス
21
    /// </summary>
22
    public class IOInvoiceData : MySqlProcess
23
    {
24
        #region 定義部
25
        /// <summary>
26
        /// log4netログを使用する
27
        /// </summary>
28
        private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
29
        #endregion
30

  
31
        #region 定数
32
        /// <summary>
33
        /// 請求データフィールド並び
34
        /// </summary>
35
        public enum NameColumn
36
        {
37
            InvoiceNo = 0,
38
            OrderersDivision,
39
            OrderersCode,
40
            RequestMonth,
41
            SeqNo,
42
            CretateDate,
43
            RequestDate,
44
            RequestName,
45
            TotalAmount,
46
            TaxAmount,
47
            Comment1,
48
            Comment2,
49
            Comment3,
50
            Comment4,
51
            Comment5,
52
            CompleteFlg,
53
            ENTRY_DATE,
54
            UPDATE_DATE,
55
        }
56
        #endregion
57

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

  
68
        #endregion
69

  
70

  
71
        #region 請求書データ検索(1件取得)
72
        /// <summary>
73
        /// 請求書データ検索(複数件取得)
74
        /// </summary>
75
        /// <param name="AddSQLString"></param>
76
        /// <param name="data"></param>
77
        /// <param name="bConnect"></param>
78
        /// <returns></returns>
79
        public bool SelectAction(string AddSQLString, ref InvoiceData data, bool bConnect = true)
80
        {
81
            //Oracle インターフェース
82
            string strcmd = "";
83
            ArrayList arData = new ArrayList();
84

  
85
            try
86
            {
87
                // SQL作成(oracleのDateTime型が変換できないのでCharに変換しておく)
88
                strcmd = CreateSelectSQL();
89
                strcmd += AddSQLString;
90

  
91
                // SQL実行
92
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return false;
93

  
94
                // データセット
95
                foreach (object[] objwrk in arData)
96
                {
97
                    Reader2Struct(objwrk, ref data);
98
                    break;
99
                }
100

  
101
                return true;
102
            }
103
            catch (Exception ex)
104
            {
105
                logger.ErrorFormat("システムエラー::{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
106
                return false;
107
            }
108
        }
109
        #endregion
110
        #region 請求書データ検索(複数件取得)
111
        /// <summary>
112
        /// 請求書データ検索(複数件取得)
113
        /// </summary>
114
        /// <param name="AddSQLString"></param>
115
        /// <param name="data"></param>
116
        /// <param name="bConnect"></param>
117
        /// <returns></returns>
118
        public bool SelectAction(string AddSQLString, ref List<InvoiceData> data, bool bConnect = true)
119
        {
120
            //Oracle インターフェース
121
            string strcmd = "";
122
            ArrayList arData = new ArrayList();
123

  
124
            try
125
            {
126
                // SQL作成(oracleのDateTime型が変換できないのでCharに変換しておく)
127
                strcmd = CreateSelectSQL();
128
                strcmd += AddSQLString;
129

  
130
                // SQL実行
131
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return false;
132

  
133
                // データセット
134
                foreach (object[] objwrk in arData)
135
                {
136
                    InvoiceData work = new InvoiceData();
137
                    Reader2Struct(objwrk, ref work);
138
                    data.Add(work);
139
                }
140

  
141
                return true;
142
            }
143
            catch (Exception ex)
144
            {
145
                logger.ErrorFormat("システムエラー::{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
146
                return false;
147
            }
148
        }
149
        #endregion
150

  
151
        #region 請求書データ複数追加
152
        /// <summary>
153
        /// 請求書データ複数追加
154
        /// </summary>
155
        /// <param name="data">請求データ</param>
156
        /// <returns>true:成功 false:失敗</returns>
157
        public bool InsertAction(List<InvoiceData> data, bool bConnect = true)
158
        {
159
            string strcmd = "";
160
            try
161
            {
162

  
163
                foreach (InvoiceData work in data)
164
                {
165
                    if (!InsertAction(work, bConnect)) return false;
166
                }
167
                return true;
168
            }
169
            catch (Exception ex)
170
            {
171
                logger.ErrorFormat("システムエラー::{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
172
                return false;
173
            }
174
        }
175
        #endregion
176

  
177
        #region 請求書データ1件追加
178
        /// <summary>
179
        /// 請求書データ1件追加
180
        /// </summary>
181
        /// <param name="data"></param>
182
        /// <param name="bConnect"></param>
183
        /// <returns></returns>
184
        public bool InsertAction(InvoiceData data, bool bConnect = true)
185
        {
186
            string strcmd = "";
187
            try
188
            {
189

  
190
                strcmd = "INSERT INTO InvoiceData";
191
                strcmd += " VALUES (";
192

  
193
                strcmd += string.Format(" {0}", data.InvoiceNo.ToString());
194
                strcmd += string.Format(", {0}", data.OrderersDivision.ToString());
195
                strcmd += string.Format(", {0}", data.OrderersCode.ToString());
196
                strcmd += string.Format(", {0}", data.RequestMonth.ToString());
197
                strcmd += string.Format(", {0}", data.SeqNo.ToString());
198
                strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d')", data.CretateDate.ToShortDateString());
199
                strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d')", data.RequestDate.ToShortDateString());
200
                strcmd += string.Format(", '{0}'", data.RequestName.ToString());
201
                strcmd += string.Format(", {0}", data.TotalAmount.ToString());    
202
                strcmd += string.Format(", {0}", data.TaxAmount.ToString());
203
                strcmd += string.Format(", '{0}'", data.Comment1.ToString());
204
                strcmd += string.Format(", '{0}'", data.Comment2.ToString());
205
                strcmd += string.Format(", '{0}'", data.Comment3.ToString());
206
                strcmd += string.Format(", '{0}'", data.Comment4.ToString());
207
                strcmd += string.Format(", '{0}'", data.Comment5.ToString());
208
                strcmd += string.Format(", {0}", data.CompleteFlg.ToString());
209
                strcmd += ", DATE_FORMAT(DATE_FORMAT(NOW(),'%Y/%m/%d %H:%i:%s'),'%Y/%m/%d %H:%i:%s')";
210
                strcmd += ", DATE_FORMAT(DATE_FORMAT(NOW(),'%Y/%m/%d %H:%i:%s'),'%Y/%m/%d %H:%i:%s')";
211
                strcmd = strcmd + ")";
212

  
213
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
214

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

  
225
        #region 請求書データ更新
226
        /// <summary>
227
        /// 請求データ更新
228
        /// </summary>
229
        /// <param name="AddSQLString">更新条件SQL文字列</param>
230
        /// <param name="data">請求書データ</param>
231
        /// <returns>true:成功 false:失敗</returns>
232
        public bool UpdateAction(string AddSQLString, InvoiceData data, bool bConnect = true)
233
        {
234
            string strcmd = "";
235
            try
236
            {
237

  
238
                strcmd = "UPDATE InvoiceData";
239

  
240
                strcmd += " SET";
241

  
242
                strcmd += string.Format(" OrderersDivision = {0}", data.OrderersDivision.ToString());
243
                strcmd += string.Format(", OrderersCode = {0}", data.OrderersCode.ToString());
244
                strcmd += string.Format(", RequestMonth = {0}", data.RequestMonth.ToString());
245
                strcmd += string.Format(", SeqNo = {0}", data.SeqNo.ToString());
246
                strcmd += string.Format(", CretateDate = STR_TO_DATE('{0}','%Y/%m/%d')", data.CretateDate.ToShortDateString());
247
                strcmd += string.Format(", RequestDate = STR_TO_DATE('{0}','%Y/%m/%d')", data.RequestDate.ToShortDateString());
248
                strcmd += string.Format(", RequestName = '{0}'", data.RequestName.ToString());
249
                strcmd += string.Format(", TotalAmount = {0}", data.TotalAmount.ToString());
250
                strcmd += string.Format(", TaxAmount = {0}", data.TaxAmount.ToString());
251
                strcmd += string.Format(", Comment1 = '{0}'", data.Comment1.ToString());
252
                strcmd += string.Format(", Comment2 = '{0}'", data.Comment2.ToString());
253
                strcmd += string.Format(", Comment3 = '{0}'", data.Comment3.ToString());
254
                strcmd += string.Format(", Comment4 = '{0}'", data.Comment4.ToString());
255
                strcmd += string.Format(", Comment5 = '{0}'", data.Comment5.ToString());
256
                strcmd += string.Format(", CompleteFlg = {0}", data.CompleteFlg.ToString());
257
                strcmd += ", UpdateDate = DATE_FORMAT(DATE_FORMAT(NOW(),'%Y/%m/%d %H:%i:%s'),'%Y/%m/%d %H:%i:%s')";
258

  
259
                strcmd += AddSQLString;
260

  
261
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
262

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

  
273
        #region 請求書データ削除
274
        /// <summary>
275
        /// 請求データ削除
276
        /// </summary>
277
        /// <param name="AddSQLString">削除条件SQL文字列</param>
278
        /// <param name="bConnect"></param>
279
        /// <returns></returns>
280
        public bool DeleteAction(string AddSQLString, bool bConnect = true)
281
        {
282
            //Oracle インターフェース
283
            string strcmd = "";
284
            try
285
            {
286
                strcmd = string.Format("{0}{1}", "DELETE FROM InvoiceData", AddSQLString);
287

  
288
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
289

  
290
                return true;
291
            }
292
            catch (Exception ex)
293
            {
294
                logger.ErrorFormat("システムエラー::{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
295
                return false;
296
            }
297
        }
298
        #endregion
299

  
300
        #region OracleDataReaderより構造体へセットする
301
        /// <summary>
302
        /// OracleDataReaderより構造体へセットする
303
        /// </summary>
304
        /// <param name="reader">OracleDataReader</param>
305
        /// <param name="wrk">構造体</param>
306
        public void Reader2Struct(object[] objwrk, ref InvoiceData wrk)
307
        {
308
            try
309
            {
310
                // データ取得
311
                wrk.InvoiceNo = int.Parse(objwrk[(int)NameColumn.InvoiceNo].ToString());
312
                
313
                wrk.OrderersDivision = int.Parse(objwrk[(int)NameColumn.OrderersDivision].ToString());
314
                wrk.OrderersCode = int.Parse(objwrk[(int)NameColumn.OrderersCode].ToString());
315
                wrk.RequestMonth = int.Parse(objwrk[(int)NameColumn.RequestMonth].ToString());
316
                wrk.SeqNo = int.Parse(objwrk[(int)NameColumn.SeqNo].ToString());
317

  
318
                wrk.CretateDate = DateTime.Parse(objwrk[(int)NameColumn.CretateDate].ToString());
319
                wrk.RequestDate = DateTime.Parse(objwrk[(int)NameColumn.RequestDate].ToString());
320

  
321
                wrk.RequestName = objwrk[(int)NameColumn.RequestName].ToString();
322

  
323
                wrk.TotalAmount = int.Parse(objwrk[(int)NameColumn.TotalAmount].ToString());
324
                wrk.TaxAmount = int.Parse(objwrk[(int)NameColumn.TaxAmount].ToString());
325

  
326
                wrk.Comment1 = objwrk[(int)NameColumn.Comment1].ToString();
327
                wrk.Comment2 = objwrk[(int)NameColumn.Comment2].ToString();
328
                wrk.Comment3 = objwrk[(int)NameColumn.Comment3].ToString();
329
                wrk.Comment4 = objwrk[(int)NameColumn.Comment4].ToString();
330
                wrk.Comment5 = objwrk[(int)NameColumn.Comment5].ToString();
331

  
332
                wrk.CompleteFlg = int.Parse(objwrk[(int)NameColumn.CompleteFlg].ToString());
333

  
334
                wrk.EntryDate = DateTime.Parse(objwrk[(int)NameColumn.ENTRY_DATE].ToString());
335
                wrk.UpdateDate = DateTime.Parse(objwrk[(int)NameColumn.UPDATE_DATE].ToString());
336
            }
337
            catch (MySqlException myex)
338
            {
339
                logger.ErrorFormat("MySQLエラー:{0}:{1}", CommonMotions.GetMethodName(2), myex.Message);
340
            }
341
            catch (Exception ex)
342
            {
343
                logger.ErrorFormat("システムエラー::{0}:{1}:{2}", CommonMotions.GetMethodName(), ex.Message);
344
            }
345
        }
346
        #endregion
347

  
348
        #region 構造体クリア
349
        /// <summary>
350
        /// 構造体クリア
351
        /// </summary>
352
        /// <param name="wrk"></param>
353
        public void ClearStruct(ref InvoiceData wrk)
354
        {
355
            try
356
            {
357
                // データ取得
358
                wrk.InvoiceNo = 0;
359
                
360
                wrk.OrderersDivision = 0;
361
                wrk.OrderersCode = 0;
362
                wrk.RequestMonth = 0;
363
                wrk.SeqNo = 0;
364
                
365
                wrk.CretateDate = DateTime.MinValue;
366
                wrk.RequestDate = DateTime.MinValue;
367
                
368
                wrk.RequestName = "";
369
                
370
                wrk.TotalAmount = 0;
371
                wrk.TaxAmount = 0;
372
                
373
                wrk.Comment1 = "";
374
                wrk.Comment2 = "";
375
                wrk.Comment3 = "";
376
                wrk.Comment4 = "";
377
                wrk.Comment5 = "";
378

  
379
                wrk.CompleteFlg = 0;
380

  
381
                wrk.EntryDate = DateTime.Now;
382
                wrk.UpdateDate = DateTime.Now;
383
            }
384
            catch (MySqlException myex)
385
            {
386
                logger.ErrorFormat("MySQLエラー:{0}:{1}", CommonMotions.GetMethodName(2), myex.Message);
387
            }
388
            catch (Exception ex)
389
            {
390
                logger.ErrorFormat("システムエラー::{0}:{1}:{2}", CommonMotions.GetMethodName(), ex.Message);
391
            }
392
        }
393
        #endregion
394

  
395
        #region 主キー検索の文字列を返す
396
        /// <summary>
397
        /// 主キー検索の文字列を返す
398
        /// </summary>
399
        /// <param name="InvoiceNo">請求書No</param>
400
        /// <returns>Where文字列</returns>
401
        public string CreatePrimarykeyString(int InvoiceNo)
402
        {
403
            string strWork = string.Empty;
404
            try
405
            {
406
                strWork = string.Format(" Where InvoiceNo = {0}", InvoiceNo.ToString());
407
            }
408
            catch (Exception ex)
409
            {
410
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork);
411
            }
412

  
413
            return strWork;
414
        }
415
        #endregion
416

  
417
        #region サブキー検索の文字列を返す
418
        /// <summary>
419
        /// サブキー検索の文字列を返す
420
        /// </summary>
421
        /// <param name="OrderersDivision">発注者区分</param>
422
        /// <param name="OrderersCode">発注者コード</param>
423
        /// <param name="RequestMonth">請求月</param>
424
        /// <param name="SeqNo">連番</param>
425
        /// <returns>Where文字列</returns>
426
        public string CreateSubkeyString(int OrderersDivision, int OrderersCode, int RequestMonth = -1, int SeqNo = -1 )
427
        {
428
            string strWork = string.Empty;
429
            try
430
            {
431
                strWork = string.Format(" Where OrderersDivision = {0} and OrderersCode = {1}", OrderersDivision.ToString(),OrderersCode.ToString() );
432
                if( RequestMonth != -1 ){
433
                    strWork += string.Format(" and RequestMonth = {0}", RequestMonth.ToString() ) ;
434
                }
435
                if( SeqNo != -1 ){
436
                    strWork += string.Format(" and SeqNo = {0}", SeqNo.ToString() ) ;
437
                }
438
            }
439
            catch (Exception ex)
440
            {
441
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork);
442
            }
443

  
444
            return strWork;
445
        }
446
        #endregion
447

  
448
        #region 請求書Noの採番
449
        public int NumberingInvoiceNo(int RequestMonth, bool bConnect = true)
450
        {
451
            int ret = -1;
452

  
453
            string sql = "";
454
            ArrayList arData = new ArrayList();
455

  
456
            try
457
            {
458
                sql = string.Format("SELECT IFNULL(MAX(InvoiceNo),0) FROM InvoiceData WHERE RequestMonth = {0}", RequestMonth);
459

  
460
                // SQL実行
461
                if (!ExecuteReader(sql, ref arData, bConnect)) return -1;
462

  
463
                // データセット
464
                foreach (object[] objwrk in arData)
465
                {
466
                    ret = int.Parse(objwrk[0].ToString());
467
                    break;
468
                }
469

  
470
                if (ret > 0)
471
                {
472
                    ret++;
473
                }
474
                else
475
                {
476
                    ret = (RequestMonth * 1000) + 1;
477
                }
478

  
479
            }
480
            catch (Exception ex)
481
            {
482
                logger.ErrorFormat("システムエラー::{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, sql);
483
            }
484

  
485
            return ret;
486

  
487
        }
488
        #endregion
489

  
490
        #region 連番の採番
491
        public int NumberingSeqNo(int nOrderersDivision, int nOrderersCode, int RequestMonth, bool bConnect = true)
492
        {
493
            int ret = -1;
494

  
495
            string sql = "";
496
            ArrayList arData = new ArrayList();
497

  
498
            try
499
            {
500
                sql = "SELECT IFNULL(MAX(SeqNo),0) FROM InvoiceData" ;
501
                sql += string.Format(" WHERE OrderersDivision = {0}", nOrderersDivision);
502
                sql += string.Format(" AND OrderersCode = {0}", nOrderersCode);
503
                sql += string.Format(" AND RequestMonth = {0}", RequestMonth);
504

  
505
                // SQL実行
506
                if (!ExecuteReader(sql, ref arData, bConnect)) return -1;
507

  
508
                // データセット
509
                foreach (object[] objwrk in arData)
510
                {
511
                    ret = int.Parse(objwrk[0].ToString());
512
                    break;
513
                }
514

  
515
                ret++;
516

  
517
            }
518
            catch (Exception ex)
519
            {
520
                logger.ErrorFormat("システムエラー::{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, sql);
521
            }
522

  
523
            return ret;
524

  
525
        }
526
        #endregion
527

  
528
        #region SELECT SQL作成
529
        private string CreateSelectSQL()
530
        {
531
            string strcmd = "SELECT";
532
            strcmd += " InvoiceNo";
533
            strcmd += " ,OrderersDivision";
534
            strcmd += " ,OrderersCode";
535
            strcmd += " ,RequestMonth";
536
            strcmd += " ,SeqNo";
537
            strcmd += " ,DATE_FORMAT(CretateDate, '%Y/%m/%d')";
538
            strcmd += " ,DATE_FORMAT(RequestDate, '%Y/%m/%d')";
539
            strcmd += " ,RequestName";
540
            strcmd += " ,TotalAmount";
541
            strcmd += " ,TaxAmount";
542
            strcmd += " ,Comment1";
543
            strcmd += " ,Comment2";
544
            strcmd += " ,Comment3";
545
            strcmd += " ,Comment4";
546
            strcmd += " ,Comment5";
547
            strcmd += " ,CompleteFlg";
548
            strcmd += " ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')";
549
            strcmd += " ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')";
550
            strcmd += " FROM InvoiceData";
551

  
552
            return strcmd;
553
        }
554
        #endregion
555

  
556

  
557
    }
558

  
559
}
560

  
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IORequestData.cs
35 35
        public enum NameColumn
36 36
        {
37 37
            RequestNo = 0,
38
            ConstructionCode,
39
            OrderersDivision,
40
            OrderersCode,
41
            AmountPaid,
42
            PricePaid,
43
            TaxPricePaid,
44
            PriceBalance,
45
            TaxBalance,
46
            AmountBlance,
38
            MainConstructionCode,
39
            ConstructionName,
40
            ContractAmount,
41
            PaidAmount,
42
            RequestAmount0,
43
            RequestAmount1,
44
            RequestAmount2,
45
            RequestAmount3,
46
            RequestAmount4,
47
            RequestAmount5,
48
            RequestAmount6,
49
            UnclaimedAmount,
50
            UnpaidAmount,
51
            TaxAmount,
52
            Note,
47 53
            ENTRY_DATE,
48 54
            UPDATE_DATE,
49 55
        }
......
80 86
                // SQL作成(oracleのDateTime型が変換できないのでCharに変換しておく)
81 87
                strcmd = "SELECT";
82 88
                strcmd += " RequestNo";
83
                strcmd += " ,ConstructionCode";
84
                strcmd += " ,OrderersDivision";
85
                strcmd += " ,OrderersCode";
86
                strcmd += " ,AmountPaid";
87
                strcmd += " ,PricePaid";
88
                strcmd += " ,TaxPricePaid";
89
                strcmd += " ,PriceBalance";
90
                strcmd += " ,TaxBalance";
91
                strcmd += " ,AmountBlance";
89
                strcmd += " ,MainConstructionCode";
90

  
91
                strcmd += " ,ConstructionName";
92
                strcmd += " ,ContractAmount";
93
                strcmd += " ,PaidAmount";
94
                strcmd += " ,RequestAmount0";
95
                strcmd += " ,RequestAmount1";
96
                strcmd += " ,RequestAmount2";
97
                strcmd += " ,RequestAmount3";
98
                strcmd += " ,RequestAmount4";
99
                strcmd += " ,RequestAmount5";
100
                strcmd += " ,RequestAmount6";
101
                strcmd += " ,UnclaimedAmount";
102
                strcmd += " ,UnpaidAmount";
103
                strcmd += " ,TaxAmount";
104
                strcmd += " ,Note";
92 105
                strcmd += " ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')";
93 106
                strcmd += " ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')";
94 107
                strcmd += " FROM RequestData";
......
155 168
            {
156 169

  
157 170
                strcmd = "INSERT INTO RequestData";
158

  
159 171
                strcmd += " VALUES (";
160 172

  
161 173
                strcmd += string.Format(" {0}", data.RequestNo.ToString());
162
                strcmd += string.Format(", {0}", data.ConstructionCode.ToString());
163
                strcmd += string.Format(", {0}", data.OrderersDivision.ToString());
164
                strcmd += string.Format(", {0}", data.OrderersCode.ToString());
165
                strcmd += string.Format(", {0}", data.AmountPaid.ToString());
166
                strcmd += string.Format(", {0}", data.PricePaid.ToString());
167
                strcmd += string.Format(", {0}", data.TaxPricePaid.ToString());
168
                strcmd += string.Format(", {0}", data.PriceBalance.ToString());
169
                strcmd += string.Format(", {0}", data.TaxBalance.ToString());
170
                strcmd += string.Format(", {0}", data.AmountBlance.ToString());
171 174

  
175
                strcmd += string.Format(", {0}", data.MainConstructionCode.ToString());
176
                strcmd += string.Format(", '{0}'", data.ConstructionName.ToString());
177

  
178
                strcmd += string.Format(", {0}", data.ContractAmount.ToString());
179
                strcmd += string.Format(", {0}", data.PaidAmount.ToString());
180
                strcmd += string.Format(", {0}", data.RequestAmount0.ToString());
181
                strcmd += string.Format(", {0}", data.RequestAmount1.ToString());
182
                strcmd += string.Format(", {0}", data.RequestAmount2.ToString());
183
                strcmd += string.Format(", {0}", data.RequestAmount3.ToString());
184
                strcmd += string.Format(", {0}", data.RequestAmount4.ToString());
185
                strcmd += string.Format(", {0}", data.RequestAmount5.ToString());
186
                strcmd += string.Format(", {0}", data.RequestAmount6.ToString());
187
                strcmd += string.Format(", {0}", data.UnclaimedAmount.ToString());
188
                strcmd += string.Format(", {0}", data.UnpaidAmount.ToString());
189
                strcmd += string.Format(", {0}", data.TaxAmount.ToString());
190
                strcmd += string.Format(", '{0}'", data.Note.ToString());
191

  
172 192
                strcmd += ", DATE_FORMAT(DATE_FORMAT(NOW(),'%Y/%m/%d %H:%i:%s'),'%Y/%m/%d %H:%i:%s')";
173 193
                strcmd += ", DATE_FORMAT(DATE_FORMAT(NOW(),'%Y/%m/%d %H:%i:%s'),'%Y/%m/%d %H:%i:%s')";
174 194
                strcmd = strcmd + ")";
......
202 222

  
203 223
                strcmd += " SET";
204 224

  
205
                // strcmd += string.Format(" RequestNo = {0}", data.RequestNo.ToString());
206
                strcmd += string.Format(" ConstructionCode = {0}", data.ConstructionCode.ToString());
207
                strcmd += string.Format(",OrderersDivision = {0}", data.OrderersDivision.ToString());
208
                strcmd += string.Format(",OrderersCode = {0}", data.OrderersCode.ToString());
209
                strcmd += string.Format(",AmountPaid = {0}", data.AmountPaid.ToString());
210
                strcmd += string.Format(",PricePaid = {0}", data.PricePaid.ToString());
211
                strcmd += string.Format(",TaxPricePaid = {0}", data.TaxPricePaid.ToString());
212
                strcmd += string.Format(",PriceBalance = {0}", data.PriceBalance.ToString());
213
                strcmd += string.Format(",TaxBalance = {0}", data.TaxBalance.ToString());
214
                strcmd += string.Format(",AmountBlance = {0}", data.AmountBlance.ToString());
225
                strcmd += string.Format(" ConstructionName = '{0}'", data.ConstructionName.ToString());
226
                strcmd += string.Format(",ContractAmount = {0}", data.ContractAmount.ToString());
227
                strcmd += string.Format(",PaidAmount = {0}", data.PaidAmount.ToString());
215 228

  
229
                strcmd += string.Format(",RequestAmount0 = {0}", data.RequestAmount0.ToString());
230
                strcmd += string.Format(",RequestAmount1 = {0}", data.RequestAmount1.ToString());
231
                strcmd += string.Format(",RequestAmount2 = {0}", data.RequestAmount2.ToString());
232
                strcmd += string.Format(",RequestAmount3 = {0}", data.RequestAmount3.ToString());
233
                strcmd += string.Format(",RequestAmount4 = {0}", data.RequestAmount4.ToString());
234
                strcmd += string.Format(",RequestAmount5 = {0}", data.RequestAmount5.ToString());
235
                strcmd += string.Format(",RequestAmount6 = {0}", data.RequestAmount6.ToString());
236

  
237
                strcmd += string.Format(",UnclaimedAmount = {0}", data.UnclaimedAmount.ToString());
238
                strcmd += string.Format(",UnpaidAmount = {0}", data.UnpaidAmount.ToString());
239
                strcmd += string.Format(",TaxAmount = {0}", data.TaxAmount.ToString());
240
                strcmd += string.Format(",Note = '{0}'", data.Note.ToString());
241

  
216 242
                strcmd += ", UpdateDate = DATE_FORMAT(DATE_FORMAT(NOW(),'%Y/%m/%d %H:%i:%s'),'%Y/%m/%d %H:%i:%s')";
217 243

  
218
                strcmd += string.Format(" Where RequestNo = {0}", data.RequestNo.ToString());
244
                strcmd += string.Format(" Where RequestNo = {0} And MainConstructionCode = {1}", data.RequestNo.ToString(), data.MainConstructionCode.ToString());
219 245
                strcmd += AddSQLString;
220 246

  
221 247
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
......
230 256
        }
231 257
        #endregion
232 258

  
259
        #region 請求データ更新(複数件更新)
260
        /// <summary>
261
        /// 請求データ更新(複数件更新)
262
        /// </summary>
263
        /// <param name="lst">請求データリスト</param>
264
        /// <returns>true:成功 false:失敗</returns>
265
        public bool UpdateAction(List<RequestData> lst, bool bConnect = true)
266
        {
267
            string sql;
268

  
269
            foreach( RequestData data in lst )
270
            {
271
                sql = CreatePrimarykeyString( data.RequestNo, data.MainConstructionCode );
272

  
273
                if( UpdateAction( sql, data, bConnect ) == false)
274
                {
275
                    return false;
276
                }
277
            }
278
            return true;
279
        }
280
        #endregion
281

  
233 282
        #region 請求データ削除
234 283
        /// <summary>
235 284
        /// 請求データ削除
......
269 318
            {
270 319
                // データ取得
271 320
                wrk.RequestNo = int.Parse(objwrk[(int)NameColumn.RequestNo].ToString());
272
                wrk.ConstructionCode = int.Parse(objwrk[(int)NameColumn.ConstructionCode].ToString());
273
                wrk.OrderersDivision = int.Parse(objwrk[(int)NameColumn.OrderersDivision].ToString());
274
                wrk.OrderersCode = int.Parse(objwrk[(int)NameColumn.OrderersCode].ToString());
275
                wrk.AmountPaid = int.Parse(objwrk[(int)NameColumn.AmountPaid].ToString());
276
                wrk.PricePaid = int.Parse(objwrk[(int)NameColumn.PricePaid].ToString());
277
                wrk.TaxPricePaid = int.Parse(objwrk[(int)NameColumn.TaxPricePaid].ToString());
278
                wrk.PriceBalance = int.Parse(objwrk[(int)NameColumn.PriceBalance].ToString());
279
                wrk.TaxBalance = int.Parse(objwrk[(int)NameColumn.TaxBalance].ToString());
280
                wrk.AmountBlance = int.Parse(objwrk[(int)NameColumn.AmountBlance].ToString());
321
                wrk.MainConstructionCode = int.Parse(objwrk[(int)NameColumn.MainConstructionCode].ToString());
281 322

  
323
                wrk.ConstructionName = objwrk[(int)NameColumn.ConstructionName].ToString();
324
                wrk.ContractAmount = int.Parse(objwrk[(int)NameColumn.ContractAmount].ToString());
325
                wrk.PaidAmount = int.Parse(objwrk[(int)NameColumn.PaidAmount].ToString());
326
                wrk.RequestAmount0 = int.Parse(objwrk[(int)NameColumn.RequestAmount0].ToString());
327
                wrk.RequestAmount1 = int.Parse(objwrk[(int)NameColumn.RequestAmount1].ToString());
328
                wrk.RequestAmount2 = int.Parse(objwrk[(int)NameColumn.RequestAmount2].ToString());
329
                wrk.RequestAmount3 = int.Parse(objwrk[(int)NameColumn.RequestAmount3].ToString());
330
                wrk.RequestAmount4 = int.Parse(objwrk[(int)NameColumn.RequestAmount4].ToString());
331
                wrk.RequestAmount5 = int.Parse(objwrk[(int)NameColumn.RequestAmount5].ToString());
332
                wrk.RequestAmount6 = int.Parse(objwrk[(int)NameColumn.RequestAmount6].ToString());
333
                wrk.UnclaimedAmount = int.Parse(objwrk[(int)NameColumn.UnclaimedAmount].ToString());
334
                wrk.UnpaidAmount = int.Parse(objwrk[(int)NameColumn.UnpaidAmount].ToString());
335
                wrk.TaxAmount = int.Parse(objwrk[(int)NameColumn.TaxAmount].ToString());
336
                wrk.Note = objwrk[(int)NameColumn.Note].ToString();
337

  
282 338
                wrk.EntryDate = DateTime.Parse(objwrk[(int)NameColumn.ENTRY_DATE].ToString());
283 339
                wrk.UpdateDate = DateTime.Parse(objwrk[(int)NameColumn.UPDATE_DATE].ToString());
284 340
            }
......
304 360
            {
305 361
                // データ取得
306 362
                wrk.RequestNo = 0;
... 差分の行数が表示可能な上限を超えました。超過分は表示しません。

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