using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using Stone.Entity; using Stone.Common; using Stone.DataService.Biz.BizPublic; namespace Stone.DataService.Biz.Bill { public class F_BillShip { public static DataSet Submit(Command cmd, DataSet dsData) { string UserName = cmd.Pars[0]; Gm_WMS.DataAccess.DataService.LocalDBService db = null; try { db = new Gm_WMS.DataAccess.DataService.LocalDBService(); db.BeginTrans(); Entity_t_JIS_Seq5000 t_JIS_Seq5000 = new Entity_t_JIS_Seq5000(); Entity_t_ShipBill t_ShipBill = new Entity_t_ShipBill(db); string BillNo = MyDateTime.Format(MyDateTimeType.BillNo); foreach (DataRow drData in dsData.Tables[0].Rows) { string PackingListNumber = drData["PackingListNumber"].ToString(); if (t_ShipBill.GetData("[PackingListNumber]='" + PackingListNumber + "'").Tables[0].Rows.Count > 0) throw new Exception(PackingListNumber + " 已经扫描过了"); DataSet dsJIS = t_JIS_Seq5000.GetData("[PackingListNumber]='" + PackingListNumber + "'"); if (dsJIS.Tables[0].Rows.Count == 0) throw new Exception(PackingListNumber + " 在JIS中不存在"); foreach (DataRow drJIS in dsJIS.Tables[0].Rows) { DataRow drNew = t_ShipBill.Table.NewRow(); drNew["BillNo"] = BillNo; drNew["PackingListNumber"] = PackingListNumber; drNew["OrderNumber"] = drJIS["OrderNumber"].ToString(); drNew["partNumber"] = drJIS["partNumber"].ToString(); drNew["PartName"] = drJIS["PartName"].ToString(); drNew["PartColor"] = drJIS["PartColor"].ToString(); drNew["UserName"] = UserName; t_ShipBill.Add(drNew); } } db.Commit(); return MyDataSet.GetDataByString(BillNo); } catch (Exception ex) { if (db != null) db.Rollback(); throw ex; } finally { if (db != null) db.EndTrans(); } } } }