Ejemplo n.º 1
0
        /// <summary>
        /// 确认收货
        /// </summary>
        void QueRenShouHuo()
        {
            var info = new EyouSoft.Model.MDingDanShouHuoInfo();

            info.ChanPins      = new List <EyouSoft.Model.MDingDanChanPinInfo>();
            info.DaoHuoTime    = Utils.GetDateTime(Utils.GetFormValue(txtShiJiDaoHuoTime.UniqueID), DateTime.Now);
            info.DingDanId     = EditId;
            info.CgsShouHuoRen = Utils.GetFormValue(txtDaoHuoQueRenRenName.UniqueID);

            var txt_chanpin_mignxiid       = Utils.GetFormValues("txt_chanpin_mignxiid");
            var txt_chanpin_daohuoshuliang = Utils.GetFormValues("txt_chanpin_daohuoshuliang");

            if (txt_chanpin_mignxiid == null || txt_chanpin_mignxiid.Length == 0 || txt_chanpin_daohuoshuliang == null)
            {
                Utils.RCWE_AJAX("0", "表单异常");
            }
            if (txt_chanpin_mignxiid.Length != txt_chanpin_daohuoshuliang.Length)
            {
                Utils.RCWE_AJAX("0", "表单异常");
            }

            for (var i = 0; i < txt_chanpin_mignxiid.Length; i++)
            {
                var item = new EyouSoft.Model.MDingDanChanPinInfo();
                item.MingXiId       = txt_chanpin_mignxiid[i];
                item.DaoHuoShuLiang = Utils.GetDecimal(txt_chanpin_daohuoshuliang[i]);
                info.ChanPins.Add(item);
            }

            int bllRetCode1 = 0;
            int bllRetCode2 = 0;

            bllRetCode1 = new EyouSoft.BLL.BDingDan().SheZhiShouHuoInfo(info);

            if (bllRetCode1 == 1)
            {
                bllRetCode2 = new EyouSoft.BLL.BDingDan().SheZhiStatus(EditId, EyouSoft.Model.DingDanStatus.采购商确认收货, YongHuInfo.YongHuId);
            }

            if (bllRetCode2 == 1)
            {
                Utils.RCWE_AJAX("1", "操作成功");
            }
            else
            {
                Utils.RCWE_AJAX("0", "操作失败");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 采购单添加,返回1成功,其它失败
        /// </summary>
        /// <param name="info">实体</param>
        /// <returns></returns>
        public int CaiGouDan_C(EyouSoft.Model.MCaiGouDanInfo info)
        {
            if (info == null ||
                string.IsNullOrEmpty(info.CgsId) ||
                string.IsNullOrEmpty(info.CaiGouDanName) ||
                string.IsNullOrEmpty(info.CaoZuoRenId))
            {
                return(0);
            }
            if (info.ChanPins == null || info.ChanPins.Count == 0)
            {
                return(0);
            }

            info.CaiGouDanId = Guid.NewGuid().ToString();
            info.IssueTime   = DateTime.Now;

            List <EyouSoft.Model.MDingDanInfo> dingDans = new List <EyouSoft.Model.MDingDanInfo>();

            foreach (var item in info.ChanPins)
            {
                if (string.IsNullOrEmpty(item.GysId) || string.IsNullOrEmpty(item.ChanPinId))
                {
                    continue;
                }
                var item1 = dingDans.Find(temp => { if (temp.GysId == item.GysId)
                                                    {
                                                        return(true);
                                                    }
                                                    else
                                                    {
                                                        return(false);
                                                    } });
                item1 = item1 ?? new EyouSoft.Model.MDingDanInfo();

                if (string.IsNullOrEmpty(item1.DingDanId))
                {
                    item1.DingDanId = Guid.NewGuid().ToString();
                    item1.GysId     = item.GysId;
                    item1.ChanPins  = new List <EyouSoft.Model.MDingDanChanPinInfo>();
                    item1.Status    = EyouSoft.Model.DingDanStatus.计划采购;
                    item1.JinE      = 0;

                    dingDans.Add(item1);
                }

                var item2 = new EyouSoft.Model.MDingDanChanPinInfo();
                item2.MingXiId  = Guid.NewGuid().ToString();
                item2.ChanPinId = item.ChanPinId;
                item2.ShuLiang  = item.ShuLiang;

                item1.ChanPins.Add(item2);
            }

            if (dingDans == null || dingDans.Count == 0)
            {
                return(0);
            }

            int dalRetCode = dal.CaiGouDan_CU(info, dingDans);

            if (dalRetCode == 1)
            {
                var logInfo = new EyouSoft.Model.MCaoZuoLogInfo();
                logInfo.BiaoTi     = "添加采购单";
                logInfo.NeiRong    = "添加采购单,采购单编号:" + info.CaiGouDanId + "。";
                logInfo.GuanLianId = info.CaiGouDanId;
                BCaoZuoLog.Log_C(logInfo);
            }

            return(dalRetCode);
        }