コード例 #1
0
        //public override bool ReceiveInfoPostToSAP(ref DeliveryReceive_Model DeliveryInfo, UserInfo userModel, ref string strErrMsg)
        //{
        //    try
        //    {
        //        DeliveryReceive_SAP DRSAP = new DeliveryReceive_SAP();
        //        //TODO:测试代码------------
        //        //DeliveryInfo.IsQuality = 1;
        //        //-------------------------

        //        DeliveryInfo.IsShelvePost = DeliveryInfo.IsQuality == 1 ? 1 : 2;
        //        DeliveryInfo.materialDocModel.MaterialDocType = DeliveryInfo.IsQuality == 1 ? 60 : 10;
        //        return DRSAP.PostReceiveGoodsInfoToSAP(ref DeliveryInfo, userModel, ref strErrMsg);
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //}

        //public bool TaskInfoPostToSAP(ref DeliveryReceive_Model DeliveryInfo, UserInfo userModel, ref string strErrMsg)
        //{
        //    try
        //    {
        //        DeliveryReceive_SAP DRSAP = new DeliveryReceive_SAP();

        //        return DRSAP.PostTaskInfoToSAP(ref DeliveryInfo, userModel, ref strErrMsg);
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //}

        public override bool CreateReceiveAndShelveTask(ref DeliveryReceive_Model DeliveryInfo, UserInfo userModel, ref string strErrMsg)
        {
            try
            {
                bool bSucc = false;

                string strTaskNo = string.Empty;

                ReceiveGoods_DB RGD = new ReceiveGoods_DB();

                string strReceiveGoodsXml  = XMLUtil.XmlUtil.Serializer(typeof(DeliveryReceive_Model), DeliveryInfo);
                string strUserWareHouseXml = XMLUtil.XmlUtil.Serializer(typeof(UserInfo), userModel);

                TOOL.WriteLogMethod.WriteLog("方法:CreateReceiveAndShelveTask---操作人:" + userModel.UserName + strReceiveGoodsXml);
                TOOL.WriteLogMethod.WriteLog("方法:CreateReceiveAndShelveTask---操作人:" + userModel.UserName + strUserWareHouseXml);

                bSucc = RGD.CreateReceiveAndShelveTask(strReceiveGoodsXml, strUserWareHouseXml, userModel, ref strTaskNo, ref strErrMsg);

                if (bSucc == true)
                {
                    DeliveryInfo.TaskNo = strTaskNo;
                }

                return(bSucc);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        private void CreateOrderNum(ref DeliveryReceive_Model DeliveryModel)
        {
            int iCount = 0;

            foreach (var item in DeliveryModel.lstDeliveryDetail)
            {
                iCount       += 1;
                item.OrderNum = iCount.ToString();
            }
        }
コード例 #3
0
 public override string CreateMessage(DeliveryReceive_Model DeliveryInfo, bool bTask, string strTaskErrMsg)
 {
     if (bTask)
     {
         return("过账成功!\r\n" + "物料凭证:" + DeliveryInfo.materialDocModel.MaterialDoc + "\r\n" + "凭证年度:"
                + DeliveryInfo.materialDocModel.MaterialDocDate + "\r\n上架任务创建成功!" + "\r\n上架任务号:" + DeliveryInfo.TaskNo);
     }
     else
     {
         return(DeliveryInfo.Message = "过账成功!\r\n" + "物料凭证:" + DeliveryInfo.materialDocModel.MaterialDoc + "\r\n" + "凭证年度:"
                                       + DeliveryInfo.materialDocModel.MaterialDocDate + "\r\n上架任务创建失败:" + strTaskErrMsg);
     }
 }
コード例 #4
0
        public bool GetDeliveryInfoToSRM(ref DeliveryReceive_Model DeliveryModel, UserInfo userModel, ref string strErrMsg)
        {
            string strJson = string.Empty;

            //获取字符串
            string strResult = string.Empty;

            try
            {
                if (string.IsNullOrEmpty(DeliveryModel.DeliveryNo))
                {
                    strErrMsg = "送货单号不能为空!";
                    return(false);
                }



                //调用SRM接口
                strResult = HTTPUtils.HTTPUtils.GetResultXML(strURL, strAppend + DeliveryModel.DeliveryNo, null);
                //解析SRM接口数据
                DeliveryReceive_Model deliveryReceiveMdl = JSONHelper.JsonToObject <DeliveryReceive_Model>(strResult);

                if (deliveryReceiveMdl.Type.Equals("E"))
                {
                    strErrMsg = "没有获取到送货单数据!";
                    return(false);
                }

                if (deliveryReceiveMdl.Items.Count <= 0)
                {
                    strErrMsg = "SRM接口调用成功,但没有送货单数据!";
                    return(false);
                }

                DeliveryModel = DeliveryReceive_Http.CreateDeliveryInfo(deliveryReceiveMdl);
                CreateOrderNum(ref DeliveryModel);
                return(true);
            }
            catch (Exception ex)
            {
                strErrMsg = "Web异常:" + ex.Message;
                return(false);
            }
        }
コード例 #5
0
        public string GetDeliveryInfoForAndroid(string strDeliveryNo, string strUserJson)
        {
            string                strJson = string.Empty;
            DeliveryReceive_DB    DRD     = new DeliveryReceive_DB();
            DeliveryReceive_Model deliveryReceiveModel = new DeliveryReceive_Model();
            UserInfo              userModel;

            //获取字符串
            string strResult = string.Empty;

            try
            {
                if (string.IsNullOrEmpty(strDeliveryNo))
                {
                    deliveryReceiveModel.Status  = "E";
                    deliveryReceiveModel.Message = "送货单号不能为空!";
                    return(JSONHelper.ObjectToJson <DeliveryReceive_Model>(deliveryReceiveModel));
                }

                if (DRD.CheckDeliveryNoIsExist(strDeliveryNo) >= 1)
                {
                    deliveryReceiveModel.Status  = "E";
                    deliveryReceiveModel.Message = "送货单已经收货,送货单号:" + strDeliveryNo;
                    return(JSONHelper.ObjectToJson <DeliveryReceive_Model>(deliveryReceiveModel));
                }

                userModel = JSONHelper.JsonToObject <UserInfo>(strUserJson);

                //调用SRM接口
                strResult = HTTPUtils.HTTPUtils.GetResultXML(strURL, strAppend + strDeliveryNo, null);
                //解析SRM接口数据
                DeliveryReceive_Model deliveryReceiveMdl = JSONHelper.JsonToObject <DeliveryReceive_Model>(strResult);

                if (deliveryReceiveMdl.Type.Equals("E"))
                {
                    deliveryReceiveMdl.Status = "E";
                    return(JSONHelper.ObjectToJson <DeliveryReceive_Model>(deliveryReceiveMdl));
                }

                if (deliveryReceiveMdl.Items.Count <= 0)
                {
                    deliveryReceiveMdl.Status  = "E";
                    deliveryReceiveMdl.Message = "SRM接口调用成功,但没有送货单数据!";

                    return(JSONHelper.ObjectToJson <DeliveryReceive_Model>(deliveryReceiveMdl));
                }

                deliveryReceiveModel = DeliveryReceive_Http.CreateDeliveryInfo(deliveryReceiveMdl);

                foreach (var item in deliveryReceiveModel.lstDeliveryDetail)
                {
                    item.IsUrgent = DRD.GetIsUrgent(item.MaterialNo) == 0 ? 2 : 1;
                }

                deliveryReceiveModel.Status = "S";
                strJson = JSONHelper.ObjectToJson(deliveryReceiveModel);

                return(strJson);
            }
            catch (Exception ex)
            {
                deliveryReceiveModel.Status  = "E";
                deliveryReceiveModel.Message = "Web异常:" + ex.Message + ex.StackTrace;
                return(JSONHelper.ObjectToJson <DeliveryReceive_Model>(deliveryReceiveModel));
            }
        }
コード例 #6
0
        public static DeliveryReceive_Model CreateDeliveryInfo(DeliveryReceive_Model deliveryReceiveModelForSRM)
        {
            string value;
            DeliveryReceive_Model deliveryReceiveMdl = new DeliveryReceive_Model();

            deliveryReceiveMdl.lstDeliveryDetail = new List <DeliveryReceiveDetail_Model>();

            deliveryReceiveMdl.SupCode          = deliveryReceiveModelForSRM.Dghead.SupCode;
            deliveryReceiveMdl.SupName          = deliveryReceiveModelForSRM.Dghead.SupName;
            deliveryReceiveMdl.VoucherType      = 10;
            deliveryReceiveMdl.IsReceivePost    = 2;
            deliveryReceiveMdl.IsShelvePost     = 2;
            deliveryReceiveMdl.IsQuality        = 2;
            deliveryReceiveMdl.materialDocModel = new MaterialDocument.MaterialDoc_Model()
            {
                MaterialDoc = string.Empty, MaterialDocDate = string.Empty
            };
            deliveryReceiveMdl.MoveType = string.Empty;

            foreach (var items in deliveryReceiveModelForSRM.Items)
            {
                DeliveryReceiveDetail_Model DRDM = new DeliveryReceiveDetail_Model();
                deliveryReceiveMdl.DeliveryNo = items.TryGetValue("KEYCODE", out value) == true ? value : string.Empty;
                deliveryReceiveMdl.Plant      = items.TryGetValue("17", out value) == true ? value : string.Empty;
                deliveryReceiveMdl.PlantName  = string.Empty;
                deliveryReceiveMdl.Titel      = "送货单:" + deliveryReceiveMdl.DeliveryNo;

                DRDM.DeliveryNo           = items.TryGetValue("KEYCODE", out value) == true ? value : string.Empty;
                DRDM.CreateTime           = items.TryGetValue("CREATEDTIME", out value) == true ? value : string.Empty;
                DRDM.RowNo                = items.TryGetValue("1", out value) == true ? value : string.Empty;
                DRDM.VoucherNo            = items.TryGetValue("2", out value) == true ? value : string.Empty;
                DRDM.MaterialNo           = items.TryGetValue("3", out value) == true ? value : string.Empty;
                DRDM.MaterialDesc         = items.TryGetValue("4", out value) == true ? value : string.Empty;
                DRDM.ClaimArriveTime      = items.TryGetValue("5", out value) == true ? value : string.Empty;
                DRDM.Unit                 = items.TryGetValue("6", out value) == true ? value : string.Empty;
                DRDM.CurrentlyDeliveryNum = items.TryGetValue("7", out value) == true?Convert.ToInt32(value) : 0;

                DRDM.ClaimDeliveryNum = items.TryGetValue("8", out value) == true?Convert.ToInt32(getValue(value)) : 0;

                DRDM.ReadyDeliveryNum = items.TryGetValue("9", out value) == true?Convert.ToInt32(getValue(value)) : 0;

                DRDM.WaitDeliveryNum = items.TryGetValue("10", out value) == true?Convert.ToInt32(getValue(value)) : 0;

                DRDM.InRoadDeliveryNum = items.TryGetValue("11", out value) == true?Convert.ToInt32(getValue(value)) : 0;

                DRDM.ReceiveTime          = items.TryGetValue("12", out value) == true ? value : string.Empty;
                DRDM.DeliveryAddress      = items.TryGetValue("13", out value) == true ? value : string.Empty;
                DRDM.CorrespondDepartment = items.TryGetValue("14", out value) == true ? value : string.Empty;
                DRDM.WorkCode             = items.TryGetValue("15", out value) == true ? value : string.Empty;
                DRDM.JingxinName          = items.TryGetValue("16", out value) == true ? value : string.Empty;
                DRDM.Plant           = items.TryGetValue("17", out value) == true ? value : string.Empty;
                DRDM.PrdVersion      = items.TryGetValue("18", out value) == true ? value : string.Empty;
                DRDM.IsUrgent        = 1;//默认是不加急的物料
                DRDM.PlantName       = string.Empty;
                DRDM.StorageLoc      = string.Empty;
                DRDM.PrdReturnReason = string.Empty;
                DRDM.Barcode         = string.Empty;
                DRDM.SerialNo        = string.Empty;
                DRDM.ReserveNumber   = string.Empty;
                DRDM.ReserveRowNo    = string.Empty;
                DRDM.TrackNo         = string.Empty;
                deliveryReceiveMdl.lstDeliveryDetail.Add(DRDM);
            }
            return(deliveryReceiveMdl);
        }