/// <summary> /// 质检扫描--------------add by cym 2017-12-14 /// </summary> /// <param name="BarCode"></param> /// <returns></returns> public string GetOutBarCodeInfoForQuanADF_Product(string BarCode) { BaseMessage_Model <T_StockInfo> model = new BaseMessage_Model <T_StockInfo>(); try { string strError = string.Empty; string SerialNo = string.Empty; string BarCodeType = string.Empty; T_OutBarCodeInfo BarCodeInfo = new T_OutBarCodeInfo(); T_OutBarCode_Func tfunc = new T_OutBarCode_Func(); //验证条码正确性 if (tfunc.GetSerialNoByBarCode(BarCode, ref SerialNo, ref BarCodeType, ref strError) == false) { model.HeaderStatus = "E"; model.Message = strError; return(JSONHelper.ObjectToJson <BaseMessage_Model <T_StockInfo> >(model)); } if (BarCodeType == "2") { model.HeaderStatus = "E"; model.Message = "托盘条码不支持整托操作!"; return(JSONHelper.ObjectToJson <BaseMessage_Model <T_StockInfo> >(model)); } T_StockInfo stockModel = new T_StockInfo(); BarCodeInfo.SerialNo = SerialNo; //读取条码库存数据 if (GetBarCodeIsStock(BarCodeInfo.SerialNo, ref stockModel, ref strError) == false) { model.HeaderStatus = "E"; model.Message = strError; return(JSONHelper.ObjectToJson <BaseMessage_Model <T_StockInfo> >(model)); } //update by cym 2018-1-4 if (stockModel.Status != 1) { model.HeaderStatus = "E"; model.Message = "该条码不是待检状态,不能取样!"; return(JSONHelper.ObjectToJson <BaseMessage_Model <T_StockInfo> >(model)); } model.HeaderStatus = "S"; model.ModelJson = stockModel; return(JSONHelper.ObjectToJson <BaseMessage_Model <T_StockInfo> >(model)); } catch (Exception ex) { model.HeaderStatus = "E"; model.Message = ex.Message; return(JSONHelper.ObjectToJson <BaseMessage_Model <T_StockInfo> >(model)); } }
private static T_StockInfo GetAmoutInnerStock(T_StockInfo stockModel, T_OutBarCodeInfo innerBarCodeModel) { T_StockInfo t_stock = new T_StockInfo(); t_stock = stockModel; t_stock.Barcode = innerBarCodeModel.BarCode; t_stock.SerialNo = innerBarCodeModel.SerialNo; t_stock.BarCodeType = innerBarCodeModel.BarcodeType; t_stock.Qty = innerBarCodeModel.Qty.ToDecimal(); t_stock.WareHouseID = stockModel.WareHouseID; t_stock.Status = 3; return(t_stock); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ReportViewer1.LocalReport.EnableExternalImages = true; List <PrintModel> lista = new List <PrintModel>(); if (Request["serialnos"] != null) { string serialnos = Request["serialnos"].ToString(); string[] serialno = serialnos.Split(','); for (int i = 0; i < serialno.Length; i++) { if (!string.IsNullOrEmpty(serialno[i])) { T_OutBarCode_Func t_OutBarCode_Func = new T_OutBarCode_Func(); string strMsg = ""; T_OutBarCodeInfo t_OutBarCodeInfo = new T_OutBarCodeInfo(); t_OutBarCode_Func.GetOutBarCodeInfoBySerialNo(serialno[i], ref t_OutBarCodeInfo, ref strMsg); lista.Add(new PrintModel { DataColumn1 = t_OutBarCodeInfo.MaterialNo, DataColumn2 = t_OutBarCodeInfo.MaterialDesc, DataColumn3 = t_OutBarCodeInfo.EAN, DataColumn4 = t_OutBarCodeInfo.ErpVoucherNo, DataColumn5 = t_OutBarCodeInfo.EDate.ToString(), DataColumn6 = t_OutBarCodeInfo.BatchNo, DataColumn7 = t_OutBarCodeInfo.Qty.ToString(), DataColumn8 = t_OutBarCodeInfo.receivetime.ToString(), DataColumn9 = Common.PrintRdlc.ConvertImageToString(Common.PrintRdlc.GetQRImg(t_OutBarCodeInfo.BarCode)), }); } } } ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource rds = new ReportDataSource("PrintInDs", lista); ReportViewer1.LocalReport.DataSources.Add(rds); ReportViewer1.LocalReport.Refresh(); } }
private string GetTaskTransSqlList(UserModel user, T_OutBarCodeInfo model, T_YSDetailInfo detailModel) { int id = base.GetTableIDBySqlServerTaskTrans("t_tasktrans"); string strSql = "SET IDENTITY_INSERT t_tasktrans on ;insert into t_tasktrans(id, Serialno, Materialno, Materialdesc, Supcuscode, " + "Supcusname, Qty, Tasktype, Vouchertype, Creater, Createtime,TaskdetailsId, Unit, Unitname,partno,materialnoid,erpvoucherno,voucherno," + "Strongholdcode,Strongholdname,Companycode,Supprdbatch,taskno,batchno,barcode,status,materialdoc,houseprop,ean,FromWarehouseNo,FromWarehouseName,FromHouseNo,FromAreaNo,ToWarehouseNo,ToWarehouseName,ToHouseNo,ToAreaNo,PalletNo)" + " values ('" + id + "' , '" + model.SerialNo + "'," + " '" + model.MaterialNo + "','" + model.MaterialDesc + "','','','" + model.Qty + "','206'," + " 45,'" + user.UserName + "',getdate(),'" + model.ID + "', " + "'" + detailModel.Unit + "','" + detailModel.UnitName + "','','" + detailModel.MaterialNoID + "','" + detailModel.ErpVoucherNo + "'," + " '" + detailModel.VoucherNo + "','" + detailModel.StrongHoldCode + "','" + detailModel.StrongHoldName + "','" + detailModel.CompanyCode + "'," + " '" + model.SupPrdBatch + "','" + detailModel.TaskNo + "'," + " '" + model.BatchNo + "' ,'" + model.BarCode + "','" + model.Status + "','" + detailModel.MaterialDoc + "','',''," + " (select WAREHOUSENO from T_WAREHOUSE where id ='" + model.WareHouseID + "')," + " (select WAREHOUSENAME from T_WAREHOUSE where id ='" + model.WareHouseID + "'), " + " (select HOUSENO from T_HOUSE where id='" + model.HouseID + "')," + " (select AREANO from T_AREA where id ='" + model.AreaID + "')," + " '',''," + " ''," + " '','" + model.PalletNo + "' ) SET IDENTITY_INSERT t_tasktrans off ";//,(select ID from v_Area a where warehouseno = '" + model.ToErpWarehouse + "' and AREANO = '" + model.ToErpAreaNo + "'),'" + model.AreaID + "','" + model.WareHouseID + "','" + model.HouseID + "' return(strSql); }
/// <summary> /// 外箱条码没有收货,需要查询是否已经拼托,如果拼托要返回整托信息,如果没有拼托则返回单个条码,用条码类封装 /// </summary> /// <param name="SerialNo"></param> /// <param name="?"></param> /// <param name="?"></param> /// <returns></returns> private bool GetPalletInfoBySerialNo(string SerialNo, ref List <T_OutBarCodeInfo> modelList, ref string strError) { bool bSucc = false; string strFilter = string.Empty; T_OutBarCodeInfo model = new T_OutBarCodeInfo(); T_OutBarCode_Func toc = new T_OutBarCode_Func(); T_PalletDetail_Func palletFunc = new T_PalletDetail_Func(); List <T_PalletDetailInfo> lstPallet = new List <T_PalletDetailInfo>(); T_OutBarCodeInfo outBarCodeModel = new T_OutBarCodeInfo(); List <T_OutBarCodeInfo> HModelList = new List <T_OutBarCodeInfo>(); T_OutBarcode_DB odb = new T_OutBarcode_DB(); decimal SumPalletQty = 0; //外箱条码不存在 if (outBarCodeFunc.GetOutBarCodeInfoBySerialNo(SerialNo, ref model, ref strError) == false) { return(false); } strFilter = "palletno = (select palletno from t_Palletdetail where barcode = '" + model.BarCode + "')"; //外箱条码存在,但是没有组托,需要生成新的托盘类,返回客户端 if (palletFunc.GetPalletByPalletNo(strFilter, ref lstPallet, ref strError) == false) { if (toc.GetOutBarCodeInfoBySerialNo(SerialNo, ref outBarCodeModel, ref strError) == false) { return(false); } if (outBarCodeModel.BarcodeType == 5) //混箱 { model.BarcodeType = 5; model.lstBarCode = odb.GetBarCodeOutAll(model.BarCode); } modelList.Add(model); bSucc = true; } else //已经组托,根据组托条码获取条码类 { if (outBarCodeFunc.GetOutBarCodeByPalletNo(lstPallet[0].PalletNo, ref modelList, ref strError) == false) { bSucc = false; } else { HModelList = modelList.Where(t => t.BarcodeType == 5).ToList(); if (HModelList != null && HModelList.Count > 0) { foreach (var item in HModelList) { modelList.Find(t => t.ID == item.ID).lstBarCode = odb.GetBarCodeOutAll(item.BarCode); } } modelList.ForEach(t => t.PalletNo = lstPallet[0].PalletNo); SumPalletQty = modelList.Sum(t1 => t1.Qty).ToDecimal(); modelList.ForEach(t => t.PalletQty = SumPalletQty); bSucc = true; } } return(bSucc); }
//启用序列号管理 public override bool GetStockByBarCode(T_StockInfo model, ref List <T_StockInfo> modelList, ref string strError) { string strSerialNo = string.Empty; string BarCodeType = string.Empty; int iWareHouseID = 0; T_Stock_Func sfunc = new T_Stock_Func(); T_StockInfo newModel = new T_StockInfo(); List <T_StockInfo> newModelList = new List <T_StockInfo>(); T_Stock_DB db = new T_Stock_DB(); T_OutBarCode_Func toc = new T_OutBarCode_Func(); T_OutBarCodeInfo outBarCodeModel = new T_OutBarCodeInfo(); T_OutBarCodeInfo JBarCodeModel = new T_OutBarCodeInfo(); T_OutBarcode_DB odb = new T_OutBarcode_DB(); //if (model.Barcode.Contains("@") == true) //{ // strSerialNo = OutBarCode_DeCode.GetEndSerialNo(model.Barcode); // //根据序列号查库存 // if (sfunc.GetStockByBarCode(strSerialNo, ref newModel, ref strError) == false) // { // return false; // } //} //else //{ // iWareHouseID = model.WareHouseID; // newModelList = db.GetStockByWHBarCode(model); // if (newModelList == null || newModelList.Count==0) // { // strError = Language_CHS.StockIsEmpty; // return false; // } // if (string.IsNullOrEmpty(model.ErpVoucherNo)) // { // newModelList = newModelList.Where(t => t.TaskDetailesID == 0).ToList(); // } // else // { // newModelList = newModelList.Where(t => t.TaskDetailesID > 0).ToList(); // } //} if ((model.Barcode.Length == 13 || model.Barcode.Length == 14) && model.ScanType != 2) //69码,复核的时候用 { iWareHouseID = model.WareHouseID; newModelList = db.GetStockByWHBarCode(model); if (newModelList == null || newModelList.Count == 0) { strError = Language_CHS.StockIsEmpty; return(false); } if (string.IsNullOrEmpty(model.ErpVoucherNo)) { newModelList = newModelList.Where(t => t.TaskDetailesID == 0).ToList(); } else { newModelList = newModelList.Where(t => t.TaskDetailesID > 0).ToList(); } modelList = newModelList; } else { if (outBarCodeFunc.GetSerialNoByBarCode(model.Barcode, ref strSerialNo, ref BarCodeType, ref strError) == false) { return(false); } if (BarCodeType == "1") { //根据序列号查库存 if (sfunc.GetStockByBarCode(strSerialNo, ref newModel, ref strError) == false) { return(false); } //扫描到的是外箱 newModel.IsPalletOrBox = 1; } else if (BarCodeType == "2") { if (sfunc.GetStockInfoByPalletNo(strSerialNo, ref modelList, ref strError) == false) { return(false); } //扫描到的是托盘 modelList.ForEach(t => t.IsPalletOrBox = 2); List <T_StockInfo> HStockList = modelList.Where(t => t.BarCodeType == 5).ToList(); if (HStockList != null && HStockList.Count > 0) { foreach (var item in HStockList) { item.lstHBarCode = GetNewListStock(item.Barcode, item);//odb.GetBarCodeOutAll(model.Barcode); item.lstHBarCode.ForEach(t => t.WareHouseID = item.WareHouseID); item.lstHBarCode.ForEach(t => t.HouseID = item.HouseID); item.lstHBarCode.ForEach(t => t.AreaID = item.AreaID); } } } if (!string.IsNullOrEmpty(model.JBarCode)) { string strJSerialNo = string.Empty; if (OutBarCode_DeCode.GetSubBarcodeType(model.JBarCode) != "1") { strError = "您扫描的不是J箱条码!"; return(false); } strJSerialNo = OutBarCode_DeCode.GetSubBarcodeSerialNo(model.JBarCode); if (toc.GetOutBarCodeInfoBySerialNo(strJSerialNo, ref JBarCodeModel, ref strError) == false) { return(false); } if (odb.GetJBarCodeIsScan(strJSerialNo) > 0) { strError = "J箱条码已经扫描,不能重复扫描!"; return(false); } if (JBarCodeModel.fserialno.Substring(0, 1) == "2") //J箱对应中盒 { //根据中盒找外箱 if (toc.GetOutBarCodeInfoBySerialNo(JBarCodeModel.fserialno, ref JBarCodeModel, ref strError) == false) { return(false); } } if (model.Barcode.CompareTo(JBarCodeModel.fserialno) != 0) { strError = "外箱条码不包含J箱码!"; return(false); } else { //J箱码转换库存类 modelList.Add(GetAmoutInnerStock(newModel, JBarCodeModel)); } } //外箱条码需要查看条码是否是混箱 if (BarCodeType == "1" && string.IsNullOrEmpty(model.JBarCode)) { if (toc.GetOutBarCodeInfoBySerialNo(strSerialNo, ref outBarCodeModel, ref strError) == false) { return(false); } if (outBarCodeModel.BarcodeType == 5) //混箱 { newModel.BarCodeType = 5; newModel.lstHBarCode = GetNewListStock(model.Barcode, newModel);//odb.GetBarCodeOutAll(model.Barcode); newModel.lstHBarCode.ForEach(t => t.WareHouseID = newModel.WareHouseID); newModel.lstHBarCode.ForEach(t => t.HouseID = newModel.HouseID); newModel.lstHBarCode.ForEach(t => t.AreaID = newModel.AreaID); } else//不是混箱 { newModel.BarCodeType = outBarCodeModel.BarcodeType; //查看是否J箱 newModel.lstBarCode = odb.GetBarCodeOutAll(model.Barcode); //newModel.lstBarCode.ForEach(t => t.WareHouseID = newModel.WareHouseID); //newModel.lstBarCode.ForEach(t => t.HouseID = newModel.HouseID); //newModel.lstBarCode.ForEach(t => t.AreaID = newModel.AreaID); if (newModel.lstBarCode == null || newModel.lstBarCode.Count == 0) { newModel.ISJ = "2";//不是J箱 } else if (newModel.lstBarCode[0].BarcodeType == 1) { newModel.ISJ = "1"; //是J想 } else if (newModel.lstBarCode[0].BarcodeType == 2) //找到中盒 { //根据中盒找J箱 newModel.lstBarCode = odb.GetBarCodeOutAll(newModel.lstBarCode[0].BarCode); //newModel.lstBarCode.ForEach(t => t.WareHouseID = newModel.WareHouseID); //newModel.lstBarCode.ForEach(t => t.HouseID = newModel.HouseID); //newModel.lstBarCode.ForEach(t => t.AreaID = newModel.AreaID); if (newModel.lstBarCode == null || newModel.lstBarCode.Count == 0) { newModel.ISJ = "2";//不是J箱 } else if (newModel.lstBarCode[0].BarcodeType == 1) { newModel.ISJ = "1";//是J箱 } } newModel.lstBarCode = null; } modelList.Add(newModel); } } ////整箱或者零数发货 //if (model.ScanType == 2 || model.ScanType == 3) //{ // if (model.Barcode.Contains("@") == true) // { // modelList.Add(newModel); // } // else // { // modelList.AddRange(newModelList); // } //} ////整托发货 //if (model.ScanType == 1 && model.Barcode.Contains("@") == true) //{ // if (string.IsNullOrEmpty(newModel.PalletNo)) // { // strError = Language_CHS.StockPEmpty; // return false; // } // if (sfunc.GetStockInfoByPalletNo(newModel.PalletNo, ref modelList, ref strError) == false) // { // return false; // } //} decimal SumQty = modelList.Sum(t1 => t1.Qty).ToDecimal(); modelList.ForEach(t => t.PalletQty = SumQty); return(true); }
public bool GetBarCodeByPalletDetailnewByCym(List <T_PalletDetailInfo> modelList, ref List <T_OutBarCodeInfo> lstBarCode, ref string strError) { try { string strSql = ""; List <string> lstSql = new List <string>(); string strKey = ""; foreach (var item in modelList) { if (string.IsNullOrEmpty(strKey)) { strKey = "N'" + item.SerialNo + "'"; } else { strKey += (",N'" + item.SerialNo + "'"); } } lstBarCode = new List <T_OutBarCodeInfo>(); strSql = "select * from t_outbarcode t where t.SerialNo in (" + strKey + ")"; using (IDataReader dr = dbFactory.ExecuteReader(strSql)) { while (dr.Read()) { T_OutBarCodeInfo model = new T_OutBarCodeInfo(); model.Qty = dr["Qty"].ToDecimalNull(); model.Unit = dr["Unit"].ToString(); model.SupCode = dr["SupCode"].ToDBString(); model.SupName = dr["SupName"].ToDBString(); model.SerialNo = dr["SerialNo"].ToDBString(); model.BatchNo = dr["Batchno"].ToDBString(); model.ErpVoucherNo = dr["ErpVoucherNo"].ToDBString(); model.MaterialNo = dr["MaterialNo"].ToDBString(); model.MaterialDesc = dr["MaterialDesc"].ToDBString(); model.OutPackQty = dr["OutPackQty"].ToDecimalNull(); model.PrintQty = dr["PrintQty"].ToDecimalNull(); model.BarCode = dr["BarCode"].ToDBString(); model.Creater = dr["Creater"].ToDBString(); model.CreateTime = dr["CreateTime"].ToDateTime(); model.MaterialNoID = dr["Materialnoid"].ToInt32(); model.StrongHoldCode = dr["Strongholdcode"].ToDBString(); model.StrongHoldName = dr["Strongholdname"].ToDBString(); model.CompanyCode = dr["Companycode"].ToDBString(); model.ProductDate = dr["Productdate"].ToDateTime(); model.EDate = dr["EDate"].ToDateTime(); //model.ZXBarcode = dr["ZXBarcode"].ToDBString(); lstBarCode.Add(model); } } if (lstBarCode.Count > 0) { return(true); } else { return(false); } } catch (Exception ex) { strError = ex.Message; return(false); } }
public bool GetBarCodeByPalletDetailnew(List <T_PalletDetailInfo> modelList, ref List <T_OutBarCodeInfo> lstBarCode, ref string strError) { try { int iResult = 0; DataSet ds; string strOutStockTaskXml = XmlUtil.Serializer(typeof(List <T_PalletDetailInfo>), modelList); OracleParameter[] cmdParms = new OracleParameter[] { new OracleParameter("strPalletDetailXml", OracleDbType.NClob), new OracleParameter("BarCodeCur", OracleDbType.RefCursor, ParameterDirection.Output), new OracleParameter("bResult", OracleDbType.Int32, ParameterDirection.Output), new OracleParameter("ErrString", OracleDbType.NVarchar2, 200, strError, ParameterDirection.Output) }; cmdParms[0].Value = strOutStockTaskXml; cmdParms[1].Value = ParameterDirection.Output; cmdParms[2].Value = ParameterDirection.Output; cmdParms[3].Value = ParameterDirection.Output; ds = dbFactory.ExecuteDataSetForCursor(ref iResult, ref strError, dbFactory.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "p_getbarcodedetails", cmdParms); DataTable dt = ds.Tables[0]; if (iResult == 1) { for (int i = 0; i < dt.Rows.Count; i++) { T_OutBarCodeInfo model = new T_OutBarCodeInfo(); DataRow dr = dt.Rows[i]; model.Qty = dr["Qty"].ToDecimalNull(); model.Unit = dr["Unit"].ToString(); model.SupCode = dr["SupCode"].ToDBString(); model.SupName = dr["SupName"].ToDBString(); model.SerialNo = dr["SerialNo"].ToDBString(); model.BatchNo = dr["Batchno"].ToDBString(); model.ErpVoucherNo = dr["ErpVoucherNo"].ToDBString(); model.MaterialNo = dr["MaterialNo"].ToDBString(); model.MaterialDesc = dr["MaterialDesc"].ToDBString(); model.OutPackQty = dr["OutPackQty"].ToDecimalNull(); model.PrintQty = dr["PrintQty"].ToDecimalNull(); model.BarCode = dr["BarCode"].ToDBString(); model.Creater = dr["Creater"].ToDBString(); model.CreateTime = dr["CreateTime"].ToDateTime(); model.MaterialNoID = dr["Materialnoid"].ToInt32(); model.StrongHoldCode = dr["Strongholdcode"].ToDBString(); model.StrongHoldName = dr["Strongholdname"].ToDBString(); model.CompanyCode = dr["Companycode"].ToDBString(); model.ProductDate = dr["Productdate"].ToDateTime(); model.EDate = dr["EDate"].ToDateTime(); lstBarCode.Add(model); } //lstBarCode = TOOL.DataTableToList.DataSetToList<T_OutBarCodeInfo>(dt); strError = string.Empty; } return(iResult == 1 ? true : false); } catch (Exception ex) { throw ex; } }