プロジェクト

全般

プロフィール

リビジョン 230

堀内7年以上前に追加

請求分割フラグ更新処理追加

差分を表示:

branches/ddl/CreateBilling/CreateBilling/CreateBilling.csproj
337 337
    <Compile Include="..\..\ProcessManagement\ProcessManagement\DataModel\RequestHead.cs">
338 338
      <Link>DataModel\RequestHead.cs</Link>
339 339
    </Compile>
340
    <Compile Include="..\..\ProcessManagement\ProcessManagement\DataModel\RequestOrderDate.cs">
341
      <Link>DataModel\RequestOrderDate.cs</Link>
342
    </Compile>
340 343
    <Compile Include="..\..\ProcessManagement\ProcessManagement\DataModel\SalesGraphData.cs">
341 344
      <Link>DataModel\SalesGraphData.cs</Link>
342 345
    </Compile>
......
700 703
    <Compile Include="..\..\ProcessManagement\ProcessManagement\DB\IOAccess\IORequestHead.cs">
701 704
      <Link>DB\IOAccess\IORequestHead.cs</Link>
702 705
    </Compile>
706
    <Compile Include="..\..\ProcessManagement\ProcessManagement\DB\IOAccess\IORequestOrderDate.cs">
707
      <Link>DB\IOAccess\IORequestOrderDate.cs</Link>
708
    </Compile>
703 709
    <Compile Include="..\..\ProcessManagement\ProcessManagement\DB\IOAccess\IOSalesGraphData.cs">
704 710
      <Link>DB\IOAccess\IOSalesGraphData.cs</Link>
705 711
    </Compile>
branches/ddl/CreateBilling/CreateBilling/CreateBillingDataAux.cs
185 185
        {
186 186
            try
187 187
            {
188
                string strRet = "select B.*,";
189
                strRet += " E.DetailString,";           // 0
190
                strRet += " D.DetailString,";           // 1
191
                strRet += " C.JoinFlg,";                // 2
192
                strRet += " C.TyingFlg,";               // 3
193
                strRet += " C.BillingDate,";            // 4
194
                strRet += " C.BillingSplitFlg,";        // 5
195
                strRet += " C.OrderersDivision,";       // 6
196
                strRet += " C.OrderersCode,";           // 7
197
                strRet += " A.OrdersDecisionPrice,";    // 8
198
                strRet += " C.ConstructionPersonCode";  // 9
188
                StringBuilder strRet = new StringBuilder();
189
                strRet.Append("select B.*,");
190
                strRet.Append(" E.DetailString,");           // 0
191
                strRet.Append(" D.DetailString,");           // 1
192
                strRet.Append(" C.JoinFlg,");                // 2
193
                strRet.Append(" C.TyingFlg,");               // 3
194
                strRet.Append(" C.BillingDate,");            // 4
195
                strRet.Append(" C.BillingSplitFlg,");        // 5
196
                strRet.Append(" C.OrderersDivision,");       // 6
197
                strRet.Append(" C.OrderersCode,");           // 7
198
                strRet.Append(" A.OrdersDecisionPrice,");    // 8
199
                strRet.Append(" C.ConstructionPersonCode");  // 9
199 200

  
200
                strRet += " FROM";
201
                strRet += " constructionledger AS A,";
202
                strRet += " constructionledgerexcute AS B,";
203
                strRet += " constructionbaseinfo AS C,";
204
                strRet += " constructionbaseinfodetail AS D,";
205
                strRet += " constructionbaseinfodetail AS E";
201
                strRet.Append(" FROM");
202
                strRet.Append(" constructionledger AS A,");
203
                strRet.Append(" constructionledgerexcute AS B,");
204
                strRet.Append(" constructionbaseinfo AS C,");
205
                strRet.Append(" constructionbaseinfodetail AS D,");
206
                strRet.Append(" constructionbaseinfodetail AS E");
206 207

  
207
                strRet += " WHERE";
208
                strRet += " A.ConstructionPeriod = 16";
209
                strRet += " AND B.ConstructionCode = A.ConstructionCode";
210
                strRet += " AND B.GroupCount = 14";
211
                strRet += " AND C.ConstructionCode = A.ConstructionCode";
212
                strRet += " AND D.ConstructionCode = A.ConstructionCode";
213
                strRet += string.Format(" AND D.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DetailDataNo.ConstructionName);
214
                strRet += " AND E.ConstructionCode = A.ConstructionCode";
215
                strRet += string.Format(" AND E.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DetailDataNo.OrderersName);
208
                strRet.Append(" WHERE");
209
                // strRet.Append(" A.ConstructionPeriod = 16");
210
                // strRet.Append(" AND B.ConstructionCode = A.ConstructionCode");
211
                strRet.Append(" B.ConstructionCode = A.ConstructionCode");
212
                strRet.Append(" AND B.GroupCount = 14");
213
                strRet.Append(" AND C.ConstructionCode = A.ConstructionCode");
214
                strRet.Append(" AND D.ConstructionCode = A.ConstructionCode");
215
                strRet.AppendFormat(" AND D.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DetailDataNo.ConstructionName);
216
                strRet.Append(" AND E.ConstructionCode = A.ConstructionCode");
217
                strRet.AppendFormat(" AND E.DetailNo = {0}", (int)ConstructionBaseInfoDetail.DetailDataNo.OrderersName);
216 218

  
217
                strRet += " order by B.ConstructionCode, B.LineCount, B.ColumnCount";
219
                strRet.Append(" order by B.ConstructionCode, B.LineCount, B.ColumnCount");
218 220

  
219 221

  
220
                return strRet;
222
                return strRet.ToString();
221 223
            }
222 224
            catch (Exception ex)
223 225
            {
......
243 245
            IOMApproval ApprovalMastDB = new IOMApproval();
244 246
            IOProcessApproval AppDB = new IOProcessApproval();
245 247
            IORequestOrderDate ReqDateDB = new IORequestOrderDate();
248
            IOConstructionBaseInfo BaseDB = new IOConstructionBaseInfo();
246 249
            strMsg = "請求データ作成";
247 250
            try
248 251
            {
......
259 262
                ApprovalMastDB.connect(); ApprovalMastDB.beginTran();
260 263
                AppDB.connect(); AppDB.beginTran();
261 264
                ReqDateDB.connect(); ReqDateDB.beginTran();
265
                BaseDB.connect(); BaseDB.beginTran();
262 266

  
263
                string strOrderSQL = string.Empty;
267
                StringBuilder strOrderSQL = new StringBuilder();
264 268
                int nTargetmonth = 0;
265 269
                int nRequestNo = 0;
266 270
                int nInvoiceNo = 0;
......
286 290
                    nInvoiceNo = InvoiceDB.NumberingInvoiceNo(nTargetmonth, false);
287 291

  
288 292
                    // 受付番号
289
                    strOrderSQL = "select count(*) from requesthead";
290
                    strOrderSQL += string.Format(" where ReqConstructionCode = {0}", InRec.ConstructionCode);
293
                    strOrderSQL.Clear();
294
                    strOrderSQL.Append("select count(*) from requesthead");
295
                    strOrderSQL.AppendFormat(" where ReqConstructionCode = {0}", InRec.ConstructionCode);
291 296
                    ArrayList arData = new ArrayList();
292
                    if (!HeadDB.ExecuteReader(strOrderSQL, ref arData, false)) return false;
297
                    if (!HeadDB.ExecuteReader(strOrderSQL.ToString(), ref arData, false)) return false;
293 298
                    obiWork = (object[])arData[0];
294 299
                    nOrderNo = CommonMotions.cnvInt(obiWork[0]) + 1;
295 300

  
......
310 315
                    // 請求書日付データ作成
311 316
                    if (!(bcommit = CreateRequestOrderDate(ReqDateDB, objRec, InRec, nInvoiceNo, nOrderNo, nTargetmonth, ref strMsg))) break;
312 317
                }
318
                // 請求回数フラグ更新
319
                bcommit = UpdateBaseInfoBillingSplitFlg(HeadDB,BaseDB, ref  strMsg);
313 320

  
314 321
                if (!bcommit)
315 322
                {
......
321 328
                    DepositDDB.rollback();
322 329
                    AppDB.rollback();
323 330
                    ReqDateDB.rollback();
331
                    BaseDB.rollback();
324 332
                }
325 333

  
326 334
                return true;
......
335 343
                DepositDDB.rollback();
336 344
                AppDB.rollback();
337 345
                ReqDateDB.rollback();
346
                BaseDB.rollback();
338 347

  
339 348
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
340 349
                strMsg += string.Format(" システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
......
353 362
                DepositDDB.commit();
354 363
                AppDB.commit();
355 364
                ReqDateDB.commit();
365
                BaseDB.commit();
356 366

  
357 367
                HeadDB.close(); HeadDB = null;
358 368
                DataDB.close(); DataDB = null;
......
362 372
                DepositDDB.close(); DepositDDB = null;
363 373
                AppDB.close(); AppDB = null;
364 374
                ReqDateDB.close(); ReqDateDB = null;
375
                BaseDB.close(); BaseDB = null;
365 376
            }
366 377
        }
367 378
        #endregion
......
829 840
            }
830 841
        }
831 842
        #endregion
843

  
844
        #region 請求回数フラグ更新
845
        /// <summary>
846
        /// 請求回数フラグ更新
847
        /// </summary>
848
        /// <param name="BaseDB"></param>
849
        /// <param name="strMsg"></param>
850
        /// <returns></returns>
851
        private bool UpdateBaseInfoBillingSplitFlg(IORequestHead HeadDB,
852
                                                    IOConstructionBaseInfo BaseDB,
853
                                                    ref string strMsg)
854
        {
855
            try
856
            {
857
                StringBuilder strSQL = new StringBuilder();
858
                strSQL.Append("select A.REQCONSTRUCTIONCODE, count(*) as Dcnt");
859
                strSQL.Append(" from requesthead as A, constructionledger as B");
860
                strSQL.Append(" where B.ConstructionCode = A.REQCONSTRUCTIONCODE");
861
                strSQL.Append(" group by REQCONSTRUCTIONCODE");
862
                strSQL.Append(" order by Dcnt, REQCONSTRUCTIONCODE");
863

  
864
                ArrayList arList = new ArrayList();
865
                HeadDB.ExecuteReader(strSQL.ToString(), ref arList, false);
866

  
867
                int ConstrCode = 0;
868
                int DataCnt = 0;
869
                foreach (object[] objRec in arList)
870
                {
871
                    ConstrCode = CommonMotions.cnvInt(objRec[0]);
872
                    DataCnt = CommonMotions.cnvInt(objRec[1]);
873

  
874
                    if (DataCnt > 1)
875
                    {
876
                        if(!BaseDB.UpdateFeild(ConstrCode,
877
                                            (int)IOConstructionBaseInfo.TableColumn.BillingSplitFlg,
878
                                            (int)CommonDefine.BaseInfoBillingSplitFlg.SplitBilling,
879
                                            false))
880
                        {
881
                            return false;
882
                        }
883
                    }
884
                    else
885
                    {
886
                        if (!BaseDB.UpdateFeild(ConstrCode,
887
                                            (int)IOConstructionBaseInfo.TableColumn.BillingSplitFlg,
888
                                            (int)CommonDefine.BaseInfoBillingSplitFlg.AllOnBilling,
889
                                            false))
890
                        {
891
                            return false;
892
                        }
893
                    }
894
                }
895

  
896
                return true;
897
            }
898
            catch (Exception ex)
899
            {
900
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
901
                strMsg += string.Format(" システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
902
                return false;
903
            }
904
        }
905
        #endregion
832 906
    }
833 907
}

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