//將盤點資料寫入TempInventory資料表 public void InsertTempInventory(List <String> InfoList, String sZoneID, String sStaffID, String sFuncCode, String sZoneSN, String sCopper) { //取得ZoneID //String sZoneID = GetZoneID(sZoneNo); var Info = new TempInventory(); //二維條碼 if (InfoList.Count == 12 && sCopper.Equals("1")) { //設定日期格式 DateTime dt = SetDateTime(int.Parse(InfoList[7].Substring(0, 4)), int.Parse(InfoList[7].Substring(4, 2)), int.Parse(InfoList[7].Substring(6, 2))); Info = new TempInventory { Thickness = InfoList[2], Widt = InfoList[3], Type = InfoList[10], Prod = InfoList[0], Leng = int.Parse((InfoList[4])), NewWeight = float.Parse(InfoList[5]), SrnmType = sFuncCode, ProductDate = dt, TransactionDate = DateTime.Now, StaffID = sStaffID, ZoneID = sZoneID, ZoneSN = sZoneSN, Splice = InfoList[6], Ptno = InfoList[11], //CustomerNO = "b", PackNo = InfoList[9], Thickness2 = InfoList[1] }; //寫入盤點資料寫入tempinventory資料表 } //松電工 else if (InfoList.Count == 12 && sCopper.Equals("4")) { //設定日期格式 DateTime dt = SetDateTime(int.Parse(InfoList[9].Substring(0, 4)), int.Parse(InfoList[9].Substring(4, 2)), int.Parse(InfoList[9].Substring(6, 2))); Info = new TempInventory { Thickness = InfoList[5], Widt = InfoList[6], Type = InfoList[11], Prod = InfoList[3], Leng = int.Parse((InfoList[7])), NewWeight = float.Parse(InfoList[2]), SrnmType = sFuncCode, ProductDate = dt, TransactionDate = DateTime.Now, StaffID = sStaffID, ZoneID = sZoneID, ZoneSN = sZoneSN, Splice = InfoList[8], Ptno = InfoList[0], //CustomerNO = "b", PackNo = InfoList[10], Thickness2 = InfoList[4] }; } //日系一般 else if (InfoList.Count == 9 && sCopper.Equals("5")) { //設定日期格式 DateTime dt = SetDateTime(int.Parse(InfoList[5].Substring(0, 2)) + 2000, int.Parse(InfoList[5].Substring(2, 2)), int.Parse(InfoList[5].Substring(4, 2))); Info = new TempInventory { //Thickness = InfoList[1],//日系一般沒有此項資料 Widt = InfoList[2], Type = InfoList[6], Prod = InfoList[0], Leng = int.Parse((InfoList[3])), NewWeight = float.Parse(InfoList[4]), SrnmType = sFuncCode, ProductDate = dt, TransactionDate = DateTime.Now, StaffID = sStaffID, ZoneID = sZoneID, ZoneSN = sZoneSN, //Splice = InfoList[5],沒有接頭數 //CustomerNO = sCustomer, //CtlNo1 = sCtlNo1, //CtlNo2 = sCtlNo2, Thickness2 = InfoList[1], Ptno = InfoList[7] //特殊記項為,InfoList[8],尚無用到 }; } //一維條碼 else if (InfoList.Count == 9) //else { //設定日期格式 DateTime dt = SetDateTime(int.Parse(InfoList[6].Substring(0, 2)) + 2000, int.Parse(InfoList[6].Substring(2, 2)), int.Parse(InfoList[6].Substring(4, 2))); Info = new TempInventory { Thickness = InfoList[1], Widt = InfoList[2], Type = InfoList[8], Prod = InfoList[0], Leng = int.Parse((InfoList[3])), NewWeight = float.Parse(InfoList[4]), SrnmType = sFuncCode, ProductDate = dt, TransactionDate = DateTime.Now, StaffID = sStaffID, ZoneID = sZoneID, ZoneSN = sZoneSN, Splice = InfoList[5], //CustomerNO = "b" //Ptno = InfoList[11] }; } //將差異資料寫入ImportInventory資料表 db.TempInventory.Add(Info); db.SaveChanges(); }
//將盤點資料寫入TempInventory資料表 public void InsertTempInventory(List<String> InfoList, String sZoneID, String sStaffID, String sFuncCode, String sZoneSN, String sCopper) { //取得ZoneID //String sZoneID = GetZoneID(sZoneNo); var Info = new TempInventory(); //二維條碼 if (InfoList.Count == 12 && sCopper.Equals("1")) { //設定日期格式 DateTime dt = SetDateTime(int.Parse(InfoList[7].Substring(0, 4)), int.Parse(InfoList[7].Substring(4, 2)), int.Parse(InfoList[7].Substring(6, 2))); Info = new TempInventory { Thickness = InfoList[2], Widt = InfoList[3], Type = InfoList[10], Prod = InfoList[0], Leng = int.Parse((InfoList[4])), NewWeight = float.Parse(InfoList[5]), SrnmType = sFuncCode, ProductDate = dt, TransactionDate = DateTime.Now, StaffID = sStaffID, ZoneID = sZoneID, ZoneSN = sZoneSN, Splice = InfoList[6], Ptno = InfoList[11], //CustomerNO = "b", PackNo = InfoList[9], Thickness2 = InfoList[1] }; //寫入盤點資料寫入tempinventory資料表 } //松電工 else if (InfoList.Count == 12 && sCopper.Equals("4")) { //設定日期格式 DateTime dt = SetDateTime(int.Parse(InfoList[9].Substring(0, 4)), int.Parse(InfoList[9].Substring(4, 2)), int.Parse(InfoList[9].Substring(6, 2))); Info = new TempInventory { Thickness = InfoList[5], Widt = InfoList[6], Type = InfoList[11], Prod = InfoList[3], Leng = int.Parse((InfoList[7])), NewWeight = float.Parse(InfoList[2]), SrnmType = sFuncCode, ProductDate = dt, TransactionDate = DateTime.Now, StaffID = sStaffID, ZoneID = sZoneID, ZoneSN = sZoneSN, Splice = InfoList[8], Ptno = InfoList[0], //CustomerNO = "b", PackNo = InfoList[10], Thickness2 = InfoList[4] }; } //日系一般 else if (InfoList.Count == 9 && sCopper.Equals("5")) { //設定日期格式 DateTime dt = SetDateTime(int.Parse(InfoList[5].Substring(0, 2)) + 2000, int.Parse(InfoList[5].Substring(2, 2)), int.Parse(InfoList[5].Substring(4, 2))); Info = new TempInventory { //Thickness = InfoList[1],//日系一般沒有此項資料 Widt = InfoList[2], Type = InfoList[6], Prod = InfoList[0], Leng = int.Parse((InfoList[3])), NewWeight = float.Parse(InfoList[4]), SrnmType = sFuncCode, ProductDate = dt, TransactionDate = DateTime.Now, StaffID = sStaffID, ZoneID = sZoneID, ZoneSN = sZoneSN, //Splice = InfoList[5],沒有接頭數 //CustomerNO = sCustomer, //CtlNo1 = sCtlNo1, //CtlNo2 = sCtlNo2, Thickness2 = InfoList[1], Ptno = InfoList[7] //特殊記項為,InfoList[8],尚無用到 }; } //一維條碼 else if (InfoList.Count == 9) //else { //設定日期格式 DateTime dt = SetDateTime(int.Parse(InfoList[6].Substring(0, 2)) + 2000, int.Parse(InfoList[6].Substring(2, 2)), int.Parse(InfoList[6].Substring(4, 2))); Info = new TempInventory { Thickness = InfoList[1], Widt = InfoList[2], Type = InfoList[8], Prod = InfoList[0], Leng = int.Parse((InfoList[3])), NewWeight = float.Parse(InfoList[4]), SrnmType = sFuncCode, ProductDate = dt, TransactionDate = DateTime.Now, StaffID = sStaffID, ZoneID = sZoneID, ZoneSN = sZoneSN, Splice = InfoList[5], //CustomerNO = "b" //Ptno = InfoList[11] }; } //將差異資料寫入ImportInventory資料表 db.TempInventory.Add(Info); db.SaveChanges(); }