/// <summary> /// 新增一条记录 /// </summary> /// <param name="qcRecord">质检实体</param> /// <returns></returns> public static bool InsertOneQCRecord(eh_SAPRecord qcRecord) { bool rbool = true; using (DCCarManagementDataContext db = new DCCarManagementDataContext()) { try { rbool = LinQBaseDao.InsertOne(db, qcRecord); } catch { rbool = false; } finally { db.Connection.Close(); } } return(rbool); }
/// <summary> /// SAP数据 /// </summary> /// <param name="sql"></param> /// <returns></returns> public static eh_SAPRecord GetSAP(string sql) { DataSet dataset = LinQBaseDao.Query(sql); eh_SAPRecord gSap = new eh_SAPRecord(); foreach (DataRow dr in dataset.Tables[0].Rows) { gSap.Sap_ID = int.Parse(dr["Sap_ID"].ToString()); gSap.Sap_Identify = dr["Sap_Identify"].ToString(); gSap.Sap_InCarNumber = dr["Sap_InCarNumber"].ToString(); gSap.Sap_InCarOperate = dr["Sap_InCarOperate"].ToString(); gSap.Sap_InCRFLG = dr["Sap_InCRFLG"].ToString(); gSap.Sap_InNO = dr["Sap_InNO"].ToString(); gSap.Sap_InTime = Convert.ToDateTime(dr["Sap_InTime"].ToString()); gSap.Sap_OutEMSG = dr["Sap_OutEMSG"].ToString(); gSap.Sap_OutETYPE = dr["Sap_OutETYPE"].ToString(); gSap.Sap_OutHG = dr["Sap_OutHG"].ToString(); gSap.Sap_OutKDATB = Convert.ToDateTime(dr["Sap_OutKDATB"].ToString()); gSap.Sap_OutKDATE = Convert.ToDateTime(dr["Sap_OutKDATE"].ToString()); gSap.Sap_OutMAKTX = dr["Sap_OutMAKTX"].ToString(); gSap.Sap_OutNAME1C = dr["Sap_OutNAME1C"].ToString(); gSap.Sap_OutNAME1P = dr["Sap_OutNAME1P"].ToString(); gSap.Sap_OutOFLAG = dr["Sap_OutOFLAG"].ToString(); gSap.Sap_OutTELNUMBER = dr["Sap_OutTELNUMBER"].ToString(); gSap.Sap_OutXZ = dr["Sap_OutXZ"].ToString(); gSap.Sap_Remark = dr["Sap_Remark"].ToString(); gSap.Sap_Serialnumber = dr["Sap_Serialnumber"].ToString(); //if (dr["Sap_State"]==null) //{ //} //else //{ // gSap.Sap_State = int.Parse(dr["Sap_State"].ToString()); //} gSap.Sap_Type = dr["Sap_Type"].ToString(); } return(gSap); }
public void GetSapDate(string strSerialnumber) { string strSql = "select top 1 * from eh_SAPRecord where sap_state='1' and Sap_Serialnumber='" + strSerialnumber + "' and Sap_InCRFLG is null order by Sap_ID desc"; DataSet ds = LinQBaseDao.Query(strSql); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { eh_SAPRecord sapobj = new eh_SAPRecord(); sapobj.Sap_ID = CommonalityEntity.GetInt(ds.Tables[0].Rows[0]["Sap_ID"]); sapobj.Sap_Identify = ds.Tables[0].Rows[0]["Sap_Identify"].ToString(); sapobj.Sap_InCarNumber = ds.Tables[0].Rows[0]["Sap_InCarNumber"].ToString(); sapobj.Sap_InCarOperate = ds.Tables[0].Rows[0]["Sap_InCarOperate"].ToString(); sapobj.Sap_InCRFLG = ds.Tables[0].Rows[0]["Sap_InCarOperate"].ToString(); sapobj.Sap_InNO = ds.Tables[0].Rows[0]["Sap_InNO"].ToString(); sapobj.Sap_InTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["Sap_InTime"]); sapobj.Sap_OutEMSG = ds.Tables[0].Rows[0]["Sap_OutEMSG"].ToString(); sapobj.Sap_OutETYPE = ds.Tables[0].Rows[0]["Sap_OutETYPE"].ToString(); sapobj.Sap_OutHG = ds.Tables[0].Rows[0]["Sap_OutHG"].ToString(); sapobj.Sap_OutKDATB = Convert.ToDateTime(ds.Tables[0].Rows[0]["Sap_OutKDATB"]); sapobj.Sap_OutKDATE = Convert.ToDateTime(ds.Tables[0].Rows[0]["Sap_OutKDATE"]); sapobj.Sap_OutMAKTX = ds.Tables[0].Rows[0]["Sap_OutMAKTX"].ToString(); sapobj.Sap_OutNAME1C = ds.Tables[0].Rows[0]["Sap_OutNAME1C"].ToString(); sapobj.Sap_OutNAME1P = ds.Tables[0].Rows[0]["Sap_OutNAME1P"].ToString(); sapobj.Sap_OutOFLAG = ds.Tables[0].Rows[0]["Sap_OutOFLAG"].ToString(); sapobj.Sap_OutTELNUMBER = ds.Tables[0].Rows[0]["Sap_OutTELNUMBER"].ToString(); sapobj.Sap_OutXZ = ds.Tables[0].Rows[0]["Sap_OutXZ"].ToString(); sapobj.Sap_Remark = ds.Tables[0].Rows[0]["Sap_Remark"].ToString(); sapobj.Sap_Serialnumber = ds.Tables[0].Rows[0]["Sap_Serialnumber"].ToString(); sapobj.Sap_State = CommonalityEntity.GetInt(ds.Tables[0].Rows[0]["Sap_State"].ToString()); sapobj.Sap_Type = ds.Tables[0].Rows[0]["Sap_Type"].ToString(); } } }
/// 添加车辆信息 /// </summary> /// <param name="strid">车辆基础信息ID</param> /// <returns></returns> private int insertcar(string strid) { string CarName = ""; string pno = ""; string CarInfo_Carriage = ""; string CustomerInfoName = ""; string chkCarInfo_Bail = ""; string txtCarInfo_Height = ""; string txtCarInfo_Weight = ""; if (!string.IsNullOrEmpty(CommonalityEntity.SAP_ID)) { string sql = "Select * from eh_Saprecord where SAP_ID =" + CommonalityEntity.SAP_ID; List <eh_SAPRecord> list = LinQBaseDao.GetItemsForListing <eh_SAPRecord>(sql).ToList(); if (list != null) { eh_SAPRecord item = list[0]; if (!string.IsNullOrEmpty(item.Sap_InNO)) { pno = item.Sap_InNO;//送货单号 PNO = pno; } DataTable dt; if (item.Sap_InCarNumber != null || item.Sap_InCarNumber != "") { CarName = item.Sap_InCarNumber;//车牌号 } if (item.Sap_OutNAME1C != null || item.Sap_OutNAME1C != "") { CustomerInfoName = item.Sap_OutNAME1C;//客户 } if (item.Sap_OutNAME1C == null || item.Sap_OutNAME1C == "") { if (item.Sap_OutNAME1P != "" || item.Sap_OutNAME1P != null) { CustomerInfoName = item.Sap_OutNAME1P;//供应商 } } if (CustomerInfoName != "") { DataTable CustomerInfo_IDDT = LinQBaseDao.Query("select CustomerInfo_ID from CustomerInfo where CustomerInfo_Name='" + CustomerInfoName + "'").Tables[0]; //如果数据库有就赋值没有就添加 if (CustomerInfo_IDDT.Rows.Count > 0) { CustomerInfo_ID = CustomerInfo_IDDT.Rows[0][0].ToString(); } else { CustomerInfo_ID = LinQBaseDao.GetSingle("insert CustomerInfo(CustomerInfo_Name,CustomerInfo_State,CustomerInfo_Time) values('" + CustomerInfoName + "','启动',GETDATE()) select @@identity").ToString(); } } if (item.Sap_OutMAKTX != null || item.Sap_OutMAKTX != "") { CarInfo_Carriage = item.Sap_OutMAKTX;//物料描述 } if (item.Sap_OutOFLAG != null || item.Sap_OutOFLAG != "") { if (item.Sap_OutOFLAG == "X") { chkCarInfo_Bail = "True"; } else { chkCarInfo_Bail = "False"; } } if (item.Sap_OutHG != null || item.Sap_OutHG != "") { txtCarInfo_Height = item.Sap_OutHG; } if (item.Sap_OutXZ != null || item.Sap_OutXZ != "") { txtCarInfo_Weight = item.Sap_OutXZ; } } } else { chkCarInfo_Bail = "False"; CarName = dtviewcarstate.Rows[0]["CarInfo_Name"].ToString(); CustomerInfo_ID = dtviewcarstate.Rows[0]["CustomerInfo_ID"].ToString(); } int str = 0; #region 车辆信息 CarInfo carInfo = new CarInfo(); //得到车辆类型编号 carInfo.CarInfo_CarType_ID = CheckProperties.ce.carType_ID; //车牌号 carInfo.CarInfo_Name = CarName; carInfo.CarInfo_State = "启动"; carInfo.CarInfo_Remark = "成品二次排队"; carInfo.CarInfo_Carriage = CarInfo_Carriage; carInfo.CarInfo_Height = txtCarInfo_Height; carInfo.CarInfo_Weight = txtCarInfo_Weight; carInfo.CarInfo_Car_ID = Convert.ToInt32(strid); //公司编号 if (!string.IsNullOrEmpty(CustomerInfo_ID)) { carInfo.CarInfo_CustomerInfo_ID = int.Parse(CustomerInfo_ID); } carInfo.CarInfo_Operate = CommonalityEntity.USERNAME; carInfo.CarInfo_Time = CommonalityEntity.GetServersTime(); carInfo.CarInfo_Bail = chkCarInfo_Bail; carInfo.CarInfo_PO = pno; string carSql = "insert into CarInfo(CarInfo_CustomerInfo_ID,CarInfo_CarType_ID,CarInfo_Name,CarInfo_State,CarInfo_Carriage,CarInfo_Weight,CarInfo_Height,CarInfo_Bail,CarInfo_PO,CarInfo_Time,CarInfo_Remark,CarInfo_Operate,CarInfo_Car_ID) values(" + carInfo.CarInfo_CustomerInfo_ID + "," + carInfo.CarInfo_CarType_ID + ",'" + carInfo.CarInfo_Name + "','" + carInfo.CarInfo_State + "','" + carInfo.CarInfo_Carriage + "','" + carInfo.CarInfo_Weight + "','" + carInfo.CarInfo_Height + "','" + carInfo.CarInfo_Bail + "','" + carInfo.CarInfo_PO + "','" + carInfo.CarInfo_Time + "','" + carInfo.CarInfo_Remark + "','" + carInfo.CarInfo_Operate + "'," + strid + ")"; carSql = carSql + " select @@identity"; str = int.Parse(LinQBaseDao.GetSingle(carSql).ToString());//得到当前的车辆编号 #endregion return(str); }