Browse Source

添加备注上传

callm 2 weeks ago
parent
commit
6c713226de
1 changed files with 9 additions and 2 deletions
  1. 9 2
      FileWatcher/UploadMakePlan.cs

+ 9 - 2
FileWatcher/UploadMakePlan.cs

@@ -91,6 +91,7 @@ namespace FileWatcher
                         int orderdetnoIndex = -1;
                         int ordercodeIndex = -1;
                         int planqtyIndex = -1;
+                        int remarkIndex = -1;
 
                         for (int colIndex = 0; colIndex < headerRow.LastCellNum; colIndex++)
                         {
@@ -114,10 +115,14 @@ namespace FileWatcher
                                 {
                                     planqtyIndex = colIndex;
                                 }
+                                else if (headerValue.Contains("备注"))
+                                {
+                                    remarkIndex = colIndex;
+                                }
                             }
                         }
 
-                        if (wccodeIndex == -1 || orderdetnoIndex == -1 || ordercodeIndex == -1 || planqtyIndex == -1)
+                        if (wccodeIndex == -1 || orderdetnoIndex == -1 || ordercodeIndex == -1 || planqtyIndex == -1||remarkIndex==-1)
                         {
                             Console.WriteLine("Required columns not found in the header.");
                             continue;
@@ -135,15 +140,17 @@ namespace FileWatcher
                                     string orderdetno = row.GetCell(orderdetnoIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).ToString();
                                     string ordercode = row.GetCell(ordercodeIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).ToString();
                                     string planqty = row.GetCell(planqtyIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).NumericCellValue.ToString();
+                                    string remark = row.GetCell(remarkIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).ToString();
                                     if (!string.IsNullOrEmpty(wccode) && !string.IsNullOrEmpty(orderdetno) && !string.IsNullOrEmpty(ordercode))
                                     {
-                                        string insertQuery = "INSERT INTO MakePlanDetail (mpd_mpid,mpd_id,mpd_wccode, mpd_orderdetno, mpd_ordercode,mpd_outqty) VALUES (" + id + ",MakePlanDetail_seq.nextval,:1, :2, :3,:4)";
+                                        string insertQuery = "INSERT INTO MakePlanDetail (mpd_mpid,mpd_id,mpd_wccode, mpd_orderdetno, mpd_ordercode,mpd_outqty,mpd_remark) VALUES (" + id + ",MakePlanDetail_seq.nextval,:1, :2, :3,:4,:5)";
                                         using (OracleCommand cmd = new OracleCommand(insertQuery, conn))
                                         {
                                             cmd.Parameters.Add(new OracleParameter(":1", wccode));
                                             cmd.Parameters.Add(new OracleParameter(":2", orderdetno));
                                             cmd.Parameters.Add(new OracleParameter(":3", ordercode));
                                             cmd.Parameters.Add(new OracleParameter(":4", planqty));
+                                            cmd.Parameters.Add(new OracleParameter(":5", remark));
                                             cmd.ExecuteNonQuery();
                                         }
                                     }