Ejemplo n.º 1
0
        /// <summary>
        /// 收货获取条码信息(不支持托盘,只是单个条码信息)
        /// </summary>
        /// <param name="SerialNo"></param>
        /// <returns></returns>
        public string GetT_SerialNoADF(string SerialNo)
        {
            //T_SerialNo_Func tfun = new T_SerialNo_Func();
            //return tfun.CheckSerialNo(SerialNo);
            T_OutBarCode_Func tfunc = new T_OutBarCode_Func();

            return(tfunc.GetOutBarCodeInfo(SerialNo));
        }
Ejemplo n.º 2
0
        /// <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));
            }
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
        public string GetOffList(string ErpVoucherno)
        {
            T_OutBarCode_Func tfunc = new T_OutBarCode_Func();

            return(tfunc.GetOffList(ErpVoucherno));
        }
Ejemplo n.º 5
0
        public string GetBarCodeSerialno(string Serialno)
        {
            T_OutBarCode_Func tfunc = new T_OutBarCode_Func();

            return(tfunc.GetBarCodeSerialno(Serialno));
        }
Ejemplo n.º 6
0
        public string GetBarCodeFirst(string ReceiveTime)
        {
            T_OutBarCode_Func tfunc = new T_OutBarCode_Func();

            return(tfunc.GetBarCodeFirst(ReceiveTime));
        }
Ejemplo n.º 7
0
        public string GetOutBarCodeForYS(string BarCode)
        {
            T_OutBarCode_Func tfunc = new T_OutBarCode_Func();

            return(tfunc.GetOutBarCodeForYS(BarCode));
        }
Ejemplo n.º 8
0
        public string GetErpVoucherNo(string BarCode)
        {
            T_OutBarCode_Func func = new T_OutBarCode_Func();

            return(func.GetErpVoucherNo(BarCode));
        }
Ejemplo n.º 9
0
        public string GetBarcodeModelForJADF(string Serialno)
        {
            T_OutBarCode_Func tfunc = new T_OutBarCode_Func();

            return(tfunc.GetBarcodeModelForJADF(Serialno));
        }
Ejemplo n.º 10
0
        /// <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);
        }
Ejemplo n.º 11
0
        public string PostZh(string UserJson, string ModelJson, string Guid)
        {
            BaseMessage_Model <List <T_OutBarCodeInfo> > messageModel = new BaseMessage_Model <List <T_OutBarCodeInfo> >();

            try
            {
                string strError = "";
                if (Guid != "")
                {
                    if (!CheckGuid(Guid, ref strError))
                    {
                        messageModel.HeaderStatus = "E";
                        messageModel.Message      = "GUID已经存在,不能重复提交-" + strError;
                        return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <List <T_OutBarCodeInfo> > >(messageModel));
                    }
                }

                if (string.IsNullOrEmpty(UserJson) || string.IsNullOrEmpty(ModelJson) || string.IsNullOrEmpty(Guid))
                {
                    messageModel.HeaderStatus = "E";
                    messageModel.Message      = "参数不能为空";
                    return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <List <T_OutBarCodeInfo> > >(messageModel));
                }

                List <U9Zh> modelList = JSONHelper.JsonToObject <List <U9Zh> >(ModelJson);
                UserModel   user      = JSONHelper.JsonToObject <UserModel>(UserJson);

                modelList.ForEach(t => t.PostUser = user.UserNo);
                modelList.ForEach(t => t.GUID     = Guid);

                modelList.ForEach(item =>
                {
                    item.PostUser = user.UserName;
                    item.GUID     = Guid;

                    List <U9ZhDetail> detail = new List <U9ZhDetail>();
                    //检验明细里面有没有重复的条码
                    item.detail.ForEach(itemdetail => {
                        foreach (var barcode in itemdetail.barcodeList)
                        {
                            U9ZhDetail itemdetailLimk = T_Material_Batch_DB.DeepCopyByXml <U9ZhDetail>(itemdetail);
                            itemdetailLimk.Qty        = barcode.Qty;
                            itemdetailLimk.BatchNo    = barcode.BatchNo;
                            detail.Add(itemdetailLimk);
                        }
                    });
                    item.detail = detail;
                });


                //modelList.ForEach(item=> {
                //    item.PostUser = user.UserNo;
                //    item.GUID = Guid;

                //    if (item.Type == 0 && item.barcodeList.Count > 0)
                //    {
                //        item.BatchNo = item.barcodeList[0].BatchNo;
                //    }
                //    if (item.Type == 1 && item.barcodeList.Count == item.detail.Count)
                //    {
                //        //扫描的条码给明细行赋值
                //        for (int i = 0; i < item.detail.Count; i++)
                //        {
                //            for (int j = 0; j < item.barcodeList.Count; j++)
                //            {
                //                if (item.detail[i].MaterialNo == item.barcodeList[j].MaterialNo)
                //                {
                //                    item.detail[i].BatchNo = item.barcodeList[j].BatchNo;
                //                }
                //            }
                //        }
                //    }

                //});


                string ERPJson = BILBasic.JSONUtil.JSONHelper.ObjectToJson <List <U9Zh> >(modelList);

                BILBasic.Interface.T_Interface_Func tfunc = new BILBasic.Interface.T_Interface_Func();
                LogNet.LogInfo("---------------------------ERPJsonBefore:" + ERPJson);
                string interfaceJson = tfunc.PostModelListToInterface(ERPJson);

                messageModel = BILBasic.JSONUtil.JSONHelper.JsonToObject <BaseMessage_Model <List <T_OutBarCodeInfo> > >(interfaceJson);

                LogNet.LogInfo("--------------------------ERPJsonAfter:" + messageModel);

                //过账失败直接返回
                if (messageModel.HeaderStatus == "E" && !string.IsNullOrEmpty(messageModel.Message))
                {
                    return(interfaceJson);
                }
                else if (messageModel.HeaderStatus == "S" && !string.IsNullOrEmpty(messageModel.MaterialDoc)) //过账成功,并且生成了凭证要记录数据库
                {
                    modelList.ForEach(t => t.MaterialDoc = messageModel.MaterialDoc);
                }

                LogNet.LogInfo("ymh:ERPtoWMS-" + BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <List <T_OutBarCodeInfo> > >(messageModel));
                string SerialNos = "";
                if (db.PostZh(user, modelList, ref strError, ref SerialNos) == false)
                {
                    messageModel.HeaderStatus = "E";
                    messageModel.Message      = strError;
                    LogNet.LogInfo("ymh:WMS-失败");
                }
                else
                {
                    SerialNos = SerialNos.Substring(0, SerialNos.Length - 1);
                    T_OutBarCode_Func       fuc    = new T_OutBarCode_Func();
                    List <T_OutBarCodeInfo> models = new List <T_OutBarCodeInfo>();
                    fuc.GetOutBarCodeInfoBySerialNos(SerialNos, ref models, ref strError);
                    messageModel.HeaderStatus = "S";
                    messageModel.Message      = "转换操作成功!";
                    messageModel.ModelJson    = models;
                    LogNet.LogInfo("ymh:WMS-成功");
                }

                return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <List <T_OutBarCodeInfo> > >(messageModel));
            }
            catch (Exception ex)
            {
                messageModel.HeaderStatus = "E";
                messageModel.Message      = ex.Message;
                return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <List <T_OutBarCodeInfo> > >(messageModel));
            }
        }
Ejemplo n.º 12
0
        //启用序列号管理
        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);
        }