Exemplo n.º 1
0
        public bool GetOutSideByDeliveryToSRM(ref DeliveryReceive_Model DeliveryModel, UserInfo userModel, ref string strErrMsg)
        {
            try
            {
                DeliveryReceive_DB DRD = new DeliveryReceive_DB();

                if (DRD.CheckDeliveryNoIsExist(DeliveryModel.DeliveryNo) >= 1)
                {
                    strErrMsg = "送货单已经收货,送货单号:" + DeliveryModel.DeliveryNo;
                    return(false);
                }

                DeliveryReceive_Func DRF = new DeliveryReceive_Func();
                return(DRF.GetDeliveryInfoToSRM(ref DeliveryModel, userModel, ref strErrMsg));
            }
            catch (Exception ex)
            {
                strErrMsg = "Web异常:" + ex.Message;
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 收货过账,送货单,生产退料
        /// </summary>
        /// <param name="userModel"></param>
        /// <param name="strErrMsg"></param>
        /// <returns></returns>
        public string PostReceiveGoodsInfo(string strReceiveJson, string strUserJson)
        {
            bool   bSucc          = false;
            string strErrMsg      = string.Empty;
            string strPostAndTask = string.Empty;
            DeliveryReceive_Model DeliveryInfo = new DeliveryReceive_Model();
            DeliveryReceive_DB    DRD          = new DeliveryReceive_DB();

            try
            {
                if (string.IsNullOrEmpty(strReceiveJson))
                {
                    return(GetReturnJson(false, DeliveryInfo, "没有过账数据!"));
                }

                DeliveryInfo = JSONUtil.JSONHelper.JsonToObject <DeliveryReceive_Model>(strReceiveJson);
                //TODO:测试代码
                //DeliveryInfo.lstDeliveryDetail.ForEach(t => t.ReceiveQty = 20);

                if (DeliveryInfo == null || DeliveryInfo.lstDeliveryDetail == null || DeliveryInfo.lstDeliveryDetail.Count <= 0)
                {
                    return(GetReturnJson(false, DeliveryInfo, "解析客户端数据出错!"));
                }

                if (DeliveryInfo.lstDeliveryDetail.Where(t => t.ReceiveQty > 0).Count() == 0)
                {
                    return(GetReturnJson(false, DeliveryInfo, "收货数量都为零,请确认!"));
                }

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

                if (userModel == null || string.IsNullOrEmpty(userModel.UserNo))
                {
                    return(GetReturnJson(false, DeliveryInfo, "没有获取用户信息!"));
                }


                //送货单或退料单,只能收货一次
                if (DeliveryInfo.VoucherType == 10 || DeliveryInfo.VoucherType == 30)
                {
                    if (DRD.CheckDeliveryNoIsExist(DeliveryInfo.DeliveryNo) >= 1)
                    {
                        return(GetReturnJson(false, DeliveryInfo, "该单据已收货,单据号:" + DeliveryInfo.DeliveryNo));
                    }
                }
                TOOL.WriteLogMethod.WriteLog("方法:PostReceiveGoodsInfo---操作人:" + userModel.UserName + strReceiveJson);
                Receive_Post RPT = Receive_Factory.CreateFactoty(DeliveryInfo.VoucherType);
                bSucc = RPT.ReceiveInfoPostToSAP(ref DeliveryInfo, userModel, ref strErrMsg);

                if (bSucc == false)
                {
                    return(GetReturnJson(false, DeliveryInfo, strErrMsg));
                }

                //创建上架任务
                bSucc = RPT.CreateReceiveAndShelveTask(ref DeliveryInfo, userModel, ref strErrMsg);

                return(GetReturnJson(bSucc, DeliveryInfo, RPT.CreateMessage(DeliveryInfo, bSucc, strErrMsg)));
            }
            catch (Exception ex)
            {
                return(GetReturnJson(false, DeliveryInfo, "Web异常:" + ex.Message + ex.StackTrace));
            }
        }