/// <summary>
        /// 返回送货单列表
        /// </summary>
        /// <param name="xmldoc"></param>
        /// <returns></returns>
        public static List <PrintBarcode.Barcode_Model> getSendOrderList(XmlDocument xmldoc)
        {
            // PrintBarcode.Barcode_Model deliveryModel = new PrintBarcode.Barcode_Model();
            //DeliveryReceive_Model model = new DeliveryReceive_Model();
            List <PrintBarcode.Barcode_Model> lstBarcode = new List <PrintBarcode.Barcode_Model>();

            string deliveryNo  = "Null"; //送货单号
            string supName     = "Null"; //获取供应商名称
            string supCode     = "Null"; //获取供应商编码
            string factory     = "Null"; //京信工厂
            string factoryName = "Null"; //京信工厂名称

            XmlElement root = null;

            root = xmldoc.DocumentElement;

            XmlNodeList sup = null;

            sup = root.SelectNodes("/root/DGHEAD");

            foreach (XmlNode x in sup)
            {
                if (x.ChildNodes.Count != 0)
                {
                    supName = string.IsNullOrEmpty(x["SUPNAME"].InnerText) ? "Null" : x["SUPNAME"].InnerText;
                    supCode = string.IsNullOrEmpty(x["SUPCODE"].InnerText) ? "Null" : x["SUPCODE"].InnerText;
                }
            }


            //获取Item列表
            XmlNodeList listnodes = null;

            listnodes = root.SelectNodes("/root/ITEMS/Item");
            PrintBarcode.Barcode_Func func = new PrintBarcode.Barcode_Func();

            foreach (XmlNode node in listnodes)
            {
                PrintBarcode.Barcode_Model send = new PrintBarcode.Barcode_Model();
                send.VOUCHERTYPE          = "10";
                send.BARCODETYPE          = 10;
                send.Supplier             = node["SUPPLIER"].InnerText;
                send.Comba                = node["COMBA"].InnerText;
                send.DELIVERYNO           = node["KEYCODE"].InnerText;
                send.CreateTime           = node["CREATEDTIME"].InnerText;
                send.ROWNO                = node["1"].InnerText;
                send.VOUCHERNO            = node["2"].InnerText;
                send.MATERIALNO           = node["3"].InnerText;
                send.MATERIALDESC         = node["4"].InnerText;
                send.ClaimArriveTime      = string.IsNullOrEmpty(node["5"].InnerText) ? string.Empty : node["5"].InnerText;
                send.Unit                 = node["6"].InnerText;
                send.CURRENTLYDELIVERYNUM = string.IsNullOrEmpty(node["7"].InnerText) ? 0 : Int32.Parse(node["7"].InnerText);
                send.ClaimDeliveryNum     = getValue(node["8"].InnerText);
                send.ReadyDeliveryNum     = getValue(node["9"].InnerText);
                send.WaitDeliveryNum      = getValue(node["10"].InnerText);
                send.InRoadDeliveryNum    = getValue(node["11"].InnerText);
                send.ReceiveTime          = node["12"].InnerText;
                send.DeliveryAddress      = node["13"].InnerText;
                send.CorrespondDepartment = node["14"].InnerText;
                send.WorkCode             = node["15"].InnerText;
                send.JingxinName          = node["16"].InnerText;
                send.Plant                = node["17"].InnerText;
                send.PRDVERSION           = node["18"].InnerText;

                send.SUPNAME = supName;
                send.SUPCODE = supCode;

                deliveryNo = send.DELIVERYNO;
                factory    = send.Plant;

                func.GetPurchaseByDelivery(ref send);

                //deliveryModel.lstDeliveryDetail = new List<DeliveryReceiveDetail_Model>();
                //deliveryModel.lstDeliveryDetail.Add(send);

                lstBarcode.Add(send);
            }

            return(lstBarcode);
        }
Exemple #2
0
        public string SaveCheckTransScan(int checkID, string strBarcode, string strAreaNo, string strUserJson, bool isTray)
        {
            CheckTransInfo model = new CheckTransInfo();
            string strError = string.Empty;

            try
            {
                //AreaInfo area = JSONHelper.JsonToObject<AreaInfo>(strAreaNo);

                UserInfo user = JSONHelper.JsonToObject<UserInfo>(strUserJson);
                if (user == null || string.IsNullOrEmpty(user.UserNo))
                {
                    model.Status = "E";
                    model.Message = "用户信息获取失败!";
                    return JSONHelper.ObjectToJson(model);
                }
                Area_Func func = new Area_Func();
                AreaInfo area = new AreaInfo();
                area.AreaNo = strAreaNo;
                string strErrMsg = null;
                if (!func.GetAreaByAreaNo(ref area, user, ref strErrMsg))
                {
                    throw new Exception(strErrMsg);
                }
                if (area == null || string.IsNullOrEmpty(area.AreaNo))
                {
                    model.Status = "E";
                    model.Message = "货位信息获取失败!";
                    return JSONHelper.ObjectToJson(model);
                }

                PrintBarcode.Barcode_Func bfunc = new PrintBarcode.Barcode_Func();
                model.ScanBarcode = bfunc.GetCheckBarcode(checkID, strBarcode, isTray, ref strError);
                if (model.ScanBarcode == null)
                {
                    model.Status = "E";
                    model.Message = "条码信息获取失败!" + strError;
                    return JSONHelper.ObjectToJson(model);
                }
                List<string> lstBarcode = new List<string>();
                bool res = true;
                model.CheckID = checkID;
                model.AreaNo = area.AreaNo;
                model.HouseNo = area.HouseNo;
                model.WarehouseNo = area.WarehouseNo;

                model.Operator = user.UserNo;
                model.Barcode = model.ScanBarcode.BARCODE;
                model.SerialNo = model.ScanBarcode.SERIALNO;
                model.BatchNo = model.ScanBarcode.BATCHNO;
                model.SN = model.ScanBarcode.SN;
                model.MaterialNo = model.ScanBarcode.MATERIALNO;
                model.MaterialDesc = model.ScanBarcode.MATERIALDESC;

                model.ScanQty = model.ScanBarcode.QTY;
                if (isTray)
                {
                    res = SaveCheckTransList(ref model, user, ref strError);
                }
                else
                {

                    res = SaveCheckTrans(ref model, user, ref strError);
                }

                if (res)
                {
                    model.Status = "S";
                    return JSONHelper.ObjectToJson(model);
                }
                else
                {
                    model.Status = "E";
                    model.Message = strError;
                    return JSONHelper.ObjectToJson(model);
                }
            }
            catch (Exception ex)
            {
                model.Status = "E";
                model.Message = "Web异常:" + ex.Message + ex.StackTrace;
                //if (Common_Func.IsOracleError(model.Message, ref strError)) model.Message = strError;
                return JSONHelper.ObjectToJson(model);
            }
        }
Exemple #3
0
        public string SaveCheckTransScanPro(int checkID, string strBarcode, string strAreaNo, string strUserJson, bool isTray)
        {
            CheckTransInfo model = new CheckTransInfo();
            string strError = string.Empty;

            try
            {
                //AreaInfo area = JSONHelper.JsonToObject<AreaInfo>(strAreaNo);

                UserInfo user = JSONHelper.JsonToObject<UserInfo>(strUserJson);
                if (user == null || string.IsNullOrEmpty(user.UserNo))
                {
                    model.Status = "E";
                    model.Message = "用户信息获取失败!";
                    return JSONHelper.ObjectToJson(model);
                }
                Area_Func func = new Area_Func();
                AreaInfo area = new AreaInfo();
                area.AreaNo = strAreaNo;
                string strErrMsg = null;
                if (!func.GetAreaByAreaNo(ref area, user, ref strErrMsg))
                {
                    throw new Exception(strErrMsg);
                }
                if (area == null || string.IsNullOrEmpty(area.AreaNo))
                {
                    model.Status = "E";
                    model.Message = "货位信息获取失败!";
                    return JSONHelper.ObjectToJson(model);
                }

                PrintBarcode.Barcode_Func bfunc = new PrintBarcode.Barcode_Func();
                model.ScanBarcode = bfunc.GetCheckBarcode(checkID, strBarcode, isTray, ref strError);
                if (model.ScanBarcode == null)
                {
                    model.Status = "E";
                    model.Message = "条码信息获取失败!" + strError;
                    return JSONHelper.ObjectToJson(model);
                }
                List<string> lstBarcode = new List<string>();
                if (isTray)
                {
                    foreach (var item in model.ScanBarcode.tray_Model.listDetails)
                    {
                        lstBarcode.AddRange(item.listBarcode);
                    }
                }
                else
                {
                    lstBarcode.Add(model.ScanBarcode.SERIALNO);
                }
                bool res = true;
                List<Barcode_Model> lstScanBar = new List<Barcode_Model>();
                foreach (var item in lstBarcode)
                {
                    Barcode_Model bar = bfunc.GetCheckBarcode(item, ref strError);
                    if (bar != null && !string.IsNullOrEmpty(bar.SERIALNO))
                        lstScanBar.Add(bar);
                }
                foreach (var item in lstScanBar)
                {
                    model = new CheckTransInfo();
                    model.CheckID = checkID;

                    model.AreaNo = area.AreaNo;
                    model.HouseNo = area.HouseNo;
                    model.WarehouseNo = area.WarehouseNo;

                    model.Operator = user.UserNo;
                    model.Barcode = item.BARCODE;
                    model.SerialNo = item.SERIALNO;
                    model.BatchNo = item.BATCHNO;
                    model.SN = item.SN;
                    model.MaterialNo = item.MATERIALNO;
                    model.MaterialDesc = item.MATERIALDESC;
                    model.ScanQty = item.QTY;
                    res = SaveCheckTrans(ref model, user, ref strError);
                    if (!res)
                        break;
                }

                if (res)
                {
                    model.Status = "S";
                    return JSONHelper.ObjectToJson(model);
                }
                else
                {
                    model.Status = "E";
                    model.Message = strError;
                    return JSONHelper.ObjectToJson(model);
                }
            }
            catch (Exception ex)
            {
                model.Status = "E";
                model.Message = "Web异常:" + ex.Message + ex.StackTrace;
                //if (Common_Func.IsOracleError(model.Message, ref strError)) model.Message = strError;
                return JSONHelper.ObjectToJson(model);
            }
        }
Exemple #4
0
        public string SaveCheckTransForAndroid(string strCheckTransJson, string strAreaJson, string strUserJson)
        {
            CheckTransInfo model = new CheckTransInfo();
            string strError = string.Empty;

            try
            {
                model = JSONHelper.JsonToObject<CheckTransInfo>(strCheckTransJson);
                if (model == null || string.IsNullOrEmpty(model.Barcode))
                {
                    model = new CheckTransInfo();
                    model.Status = "E";
                    model.Message = "盘点扫描信息获取失败!请重新扫描!";
                    return JSONHelper.ObjectToJson(model);
                }

                UserInfo user = JSONHelper.JsonToObject<UserInfo>(strUserJson);
                if (user == null || string.IsNullOrEmpty(user.UserNo))
                {
                    model.Status = "E";
                    model.Message = "用户信息获取失败!";
                    return JSONHelper.ObjectToJson(model);
                }

                AreaInfo area = JSONHelper.JsonToObject<AreaInfo>(strAreaJson);
                if (area == null || string.IsNullOrEmpty(area.AreaNo))
                {
                    model.Status = "E";
                    model.Message = "货位信息获取失败!";
                    return JSONHelper.ObjectToJson(model);
                }

                PrintBarcode.Barcode_Func bfunc = new PrintBarcode.Barcode_Func();
                model.ScanBarcode = bfunc.GetCheckBarcode(model.CheckID, model.Barcode, false, ref strError);
                if (model.ScanBarcode == null)
                {
                    model.Status = "E";
                    model.Message = "条码信息获取失败!" + strError;
                    return JSONHelper.ObjectToJson(model);
                }

                model.AreaNo = area.AreaNo;
                model.HouseNo = area.HouseNo;
                model.WarehouseNo = area.WarehouseNo;

                model.Operator = user.UserNo;
                model.Barcode = model.ScanBarcode.BARCODE;
                model.SerialNo = model.ScanBarcode.SERIALNO;
                model.BatchNo = model.ScanBarcode.BATCHNO;
                model.SN = model.ScanBarcode.SN;
                model.MaterialNo = model.ScanBarcode.MATERIALNO;
                model.MaterialDesc = model.ScanBarcode.MATERIALDESC;

                bool bResult = SaveCheckTrans(ref model, user, ref strError);

                if (bResult)
                {
                    model.Status = "S";
                    return JSONHelper.ObjectToJson(model);
                }
                else
                {
                    model.Status = "E";
                    model.Message = strError;
                    return JSONHelper.ObjectToJson(model);
                }
            }
            catch (Exception ex)
            {
                model.Status = "E";
                model.Message = "Web异常:" + ex.Message + ex.StackTrace;
                return JSONHelper.ObjectToJson(model);
            }
        }