/// <summary> /// 根据散装箱码返回数据 /// </summary> /// <param name="strSerialNo"></param> /// <returns></returns> public List <T_BoxingInfo> GetModelBySerial(string strSerialNo) { try { T_BoxingInfo boxmodel = new T_BoxingInfo(); List <T_BoxingInfo> modelList = new List <T_BoxingInfo>(); string strsql = "SELECT * from t_Boxing where serialno = '" + strSerialNo + "'"; using (IDataReader dr = dbFactory.ExecuteReader(System.Data.CommandType.Text, strsql)) { while (dr.Read()) { boxmodel.ID = dbFactory.ToModelValue(dr, "ID").ToInt32(); boxmodel.MaterialNo = dbFactory.ToModelValue(dr, "MaterialNo").ToDBString(); boxmodel.MaterialName = dbFactory.ToModelValue(dr, "MaterialName").ToDBString(); boxmodel.Qty = dbFactory.ToModelValue(dr, "Qty").ToDecimal(); boxmodel.SerialNo = dbFactory.ToModelValue(dr, "SerialNo").ToDBString(); boxmodel.TaskNo = dbFactory.ToModelValue(dr, "TaskNo").ToDBString(); boxmodel.Status = dbFactory.ToModelValue(dr, "Status").ToInt32(); boxmodel.IsDel = dbFactory.ToModelValue(dr, "Creater").ToInt32(); boxmodel.ErpVoucherNo = dbFactory.ToModelValue(dr, "ErpVoucherNo").ToDBString(); boxmodel.FserialNo = dbFactory.ToModelValue(dr, "FserialNo").ToDBString(); boxmodel.CustomerNo = dbFactory.ToModelValue(dr, "CustomerNo").ToDBString(); boxmodel.CustomerName = dbFactory.ToModelValue(dr, "CustomerName").ToDBString(); modelList.Add(boxmodel); } } return(modelList); } catch (Exception ex) { throw new Exception(ex.Message); } }
public List <T_BoxingInfo> GetFserialNoByErpvoucherNo(List <T_OutStockInfo> modelListOutStock) { try { List <T_BoxingInfo> modelList = new List <T_BoxingInfo>(); string strErpvoucherNo = string.Empty; foreach (var item in modelListOutStock) { strErpvoucherNo += "\'" + item.ErpVoucherNo + "\'" + ","; } strErpvoucherNo = strErpvoucherNo.TrimEnd(','); string strsql = "SELECT ISNULL(fserialno,'') as fserialno FROM t_Boxing WHERE erpvoucherno IN (" + strErpvoucherNo + ") GROUP BY fserialno"; using (IDataReader dr = dbFactory.ExecuteReader(System.Data.CommandType.Text, strsql)) { while (dr.Read()) { T_BoxingInfo boxmodel = new T_BoxingInfo(); boxmodel.FserialNo = dbFactory.ToModelValue(dr, "FserialNo").ToDBString(); modelList.Add(boxmodel); } } if (modelList != null && modelList.Count > 0) { modelList = modelList.Where(t => t.FserialNo != "").ToList(); } return(modelList); } catch (Exception ex) { throw new Exception(ex.Message); } }
public List <T_BoxingInfo> GetMessageForPrint(string filter, string flag) { List <T_BoxingInfo> lstBoxInfo = new List <T_BoxingInfo>(); try { string strsql = ""; if (flag == "1") { strsql = "select palletno from t_palletdetail where barcode = '" + filter + "'"; } if (flag == "2") { strsql = "select top 1 t_outbarcode.materialno,t_outbarcode.materialdesc,t_outbarcode.qty,t_outbarcode.serialno,v.* from t_outbarcode left join t_tasktrans on t_outbarcode.barcode=t_tasktrans.barcode left join (select CUSTOMERNAME,ERPVOUCHERNO,fromerpwarehousename,toerpwarehousename,erpnote from v_outstockdetail) v on v.erpvoucherno=t_tasktrans.erpvoucherno where t_outbarcode.barcode='" + filter + "' and t_tasktrans.tasktype=2"; } if (flag == "3") { strsql = "select t_boxing.*,v.* from t_boxing left join (select top 1 CUSTOMERNAME,ERPVOUCHERNO,fromerpwarehousename,toerpwarehousename,erpnote from v_outstockdetail where erpvoucherno = '" + filter + "' ) v on v.erpvoucherno = t_boxing.erpvoucherno where t_boxing.erpvoucherno = '" + filter + "'"; } using (IDataReader dr = dbFactory.ExecuteReader(System.Data.CommandType.Text, strsql)) { while (dr.Read()) { if (flag == "1") { T_BoxingInfo boxmodel = new T_BoxingInfo(); boxmodel.SerialNo = (string)dbFactory.ToModelValue(dr, "palletno"); lstBoxInfo.Add(boxmodel); } if (flag == "2") { T_BoxingInfo boxmodel = new T_BoxingInfo(); boxmodel.MaterialNo = (string)dbFactory.ToModelValue(dr, "materialno"); boxmodel.MaterialName = (string)dbFactory.ToModelValue(dr, "materialdesc"); boxmodel.Qty = dbFactory.ToModelValue(dr, "qty").ToDecimal(); boxmodel.SerialNo = (string)dbFactory.ToModelValue(dr, "SerialNo"); boxmodel.Remark1 = (string)dbFactory.ToModelValue(dr, "ERPVOUCHERNO") + ";" + (string)dbFactory.ToModelValue(dr, "CUSTOMERNAME") + ";" + (string)dbFactory.ToModelValue(dr, "fromerpwarehousename") + ";" + (string)dbFactory.ToModelValue(dr, "toerpwarehousename") + ";" + (string)dbFactory.ToModelValue(dr, "erpnote"); lstBoxInfo.Add(boxmodel); } if (flag == "3") { T_BoxingInfo boxmodel = new T_BoxingInfo(); boxmodel.MaterialNo = (string)dbFactory.ToModelValue(dr, "MaterialNo"); boxmodel.MaterialName = (string)dbFactory.ToModelValue(dr, "MaterialName"); boxmodel.TaskNo = (string)dbFactory.ToModelValue(dr, "TaskNo"); boxmodel.ErpVoucherNo = (string)dbFactory.ToModelValue(dr, "ErpVoucherNo"); boxmodel.Remark = (string)dbFactory.ToModelValue(dr, "Remark"); boxmodel.SerialNo = (string)dbFactory.ToModelValue(dr, "SerialNo"); boxmodel.Qty = dbFactory.ToModelValue(dr, "qty").ToDecimal(); boxmodel.Remark1 = (string)dbFactory.ToModelValue(dr, "ERPVOUCHERNO") + ";" + (string)dbFactory.ToModelValue(dr, "CUSTOMERNAME") + ";" + (string)dbFactory.ToModelValue(dr, "fromerpwarehousename") + ";" + (string)dbFactory.ToModelValue(dr, "toerpwarehousename") + ";" + (string)dbFactory.ToModelValue(dr, "erpnote"); lstBoxInfo.Add(boxmodel); } } } return(lstBoxInfo); } catch (Exception ex) { return(null); } }