public bool GetProdDetailByProdOrdID(ProdHead model, ref ProdHead prod, ref string strError) { ReadAPI_DB DB = new ReadAPI_DB(); try { string prodmgrID = string.Empty; using (SqlDataReader dr = DB.ReadData(ReadApiType.PRODBOOK_1, model.ProdOrdID)) { if (dr.Read()) { prodmgrID = dr["ProdMgrID"].ToDBString(); } } if (string.IsNullOrEmpty(prodmgrID)) { strError = "该订单暂无制法数据"; return(false); } using (SqlDataReader dr = DB.ReadData(ReadApiType.PROD, model.ProdOrdID)) { while (dr.Read()) { if (prod == null) { prod = (GetHeadModelFromDataReader(dr, prodmgrID)); prod.lstDetails = new List <ProdDetails>(); } prod.lstDetails.Add(GetModelFromDataReader(dr)); } if (prod == null) { throw new Exception("未找到数据!"); } return(true); } } catch (Exception ex) { strError = ex.Message; return(false); } finally { } }
public string GetReceiptByPoNbr(string strPoNo, string strUserJson) { ReadAPI_DB DB = new ReadAPI_DB(); ReceiptHead model = null; bool bSucc = false; string strError = string.Empty; try { UserInfo user = JSONUtil.JSONHelper.JsonToObject <UserInfo>(strUserJson); using (SqlDataReader dr = DB.ReadData(ReadApiType.RECEIPT, strPoNo)) { while (dr.Read()) { if (model == null) { model = (GetHeadModelFromDataReader(dr)); model.lstDetails = new List <ReceiptDetails>(); } model.lstDetails.Add(GetModelFromDataReader(dr)); } if (model == null) { throw new Exception("未找到数据!"); } bSucc = true; return(GetReturnJson(bSucc, model, strError)); } } catch (Exception ex) { strError = ex.Message; bSucc = false; model = new ReceiptHead(); return(GetReturnJson(bSucc, model, strError)); } finally { } }
public string GetTransferTo01(string strMaterialNo, string strBatchNo, string startDate, string endDate, string strUserJson) { ReadAPI_DB DB = new ReadAPI_DB(); Transfer model = null; bool bSucc = false; string strError = string.Empty; try { UserInfo user = JSONUtil.JSONHelper.JsonToObject <UserInfo>(strUserJson); using (SqlDataReader dr = DB.ReadData(ReadApiType.TRANSFER_TO01, strMaterialNo, strBatchNo, startDate, endDate)) { while (dr.Read()) { if (model == null) { model = (GetModelFromDataReader(dr)); } } if (model == null) { throw new Exception("未找到数据!"); } bSucc = true; return(GetReturnJson(bSucc, model, strError)); } } catch (Exception ex) { strError = ex.Message; bSucc = false; model = new Transfer(); return(GetReturnJson(bSucc, model, strError)); } finally { } }
public bool GetInventoryByInvtID(ref Inventory model, ref string strError) { ReadAPI_DB DB = new ReadAPI_DB(); try { using (SqlDataReader dr = DB.ReadData(ReadApiType.INVENTORY, model.InvtID)) { if (dr.Read()) { model = (GetModelFromDataReader(dr)); } return(true); } } catch (Exception ex) { strError = ex.Message; return(false); } finally { } }