Ejemplo n.º 1
0
        public ActionResult MdfyRecievGdsType(String wmsno, String gdsid, String gdstype, String newgdstype)
        {
            gdsid = GetGdsidByGdsidOrBcd(gdsid);
            ////正在生成拣货单,请稍候重试
            //string quRetrv = GetQuByGdsid(gdsid, LoginInfo.DefStoreid).FirstOrDefault();
            //if (DoingRetrieve(LoginInfo.DefStoreid, quRetrv))
            //{
            //    return RInfo( "I0233" );
            //}

            if (gdsid == null)
            {
                return(RInfo("I0234"));
            }

            /*var qry = from e in WmsDc.wms_blldtl
             *        where e.wmsno == wmsno
             *        && e.gdsid == gdsid
             *        select e;
             * var arrqry = qry.ToArray();
             * if (arrqry.Length <= 0)
             * {
             *  return RNoData("N0127");
             * }
             * wms_blldtl dtl = arrqry[0];*/
            var qry = from e in WmsDc.wms_blltp
                      where e.wmsno == wmsno &&
                      e.bllid == WMSConst.BLL_TYPE_REVIECEBLL &&
                      e.gdsid == gdsid &&
                      e.gdstype == gdstype
                      select e;
            var arrqry = qry.ToArray();

            /*wms_blldtl[] dtls = GetDtl(wmsno).Where(e => e.gdsid == gdsid && e.gdstype == gdstype).ToArray();
             * if (arrqry.Length <= 0 || dtls.Length <= 0)
             * {
             *  return RNoData("N0128");
             * }*/
            wms_blltp tp = arrqry[0];

            tp.gdstype = gdstype;

            /*wms_blldtl dtl = dtls.FirstOrDefault();
             * dtl.gdstype = gdstype;*/
            try
            {
                WmsDc.SubmitChanges();

                return(RSucc("成功", arrqry[0], "S0114"));
            }
            catch (Exception ex)
            {
                return(RErr(ex.Message, "E0029"));
            }
        }
Ejemplo n.º 2
0
        public ActionResult BokRecievGds(String wmsno, String gdsid, String gdstypes, String qtys, String tpcodes, String pkgids, String vlddat)
        {
            using (TransactionScope scop = new TransactionScope(TransactionScopeOption.Required, options))
            {
                gdsid = GetGdsidByGdsidOrBcd(gdsid);
                if (gdsid == null)
                {
                    return(RInfo("I0057"));
                }

                String[]      sqtys   = qtys.Split(',');
                List <double> lstqtys = new List <double>();
                foreach (String s in sqtys)
                {
                    lstqtys.Add(double.Parse(s));
                }
                double[] qty     = lstqtys.ToArray();
                String[] tpcode  = tpcodes.Split(',');
                String[] pkgid   = pkgids.Split(',');
                String[] gdstype = gdstypes.Split(',');


                //1.判断收货单是否已经审核,如果审核则退出
                var qrymst = from e in WmsDc.wms_bllmst
                             where e.wmsno == wmsno && e.bllid == WMSConst.BLL_TYPE_REVIECEBLL
                             select e;
                var qry11 = from e in WmsDc.wms_blldtl
                            join e1 in WmsDc.wms_bllmst on e.wmsno equals e1.wmsno
                            where e.wmsno == wmsno && e.bllid == WMSConst.BLL_TYPE_REVIECEBLL && (e.gdsid == gdsid) && /*&& e.rcdidx == rcdidx*/
                            e.vlddat == vlddat
                            select e;
                var qry1 = from e in WmsDc.wms_blldtl
                           join e1 in WmsDc.wms_bllmst on e.wmsno equals e1.wmsno
                           join e2 in WmsDc.bcd on e.gdsid equals e2.gdsid
                           where e.wmsno == wmsno && e.bllid == WMSConst.BLL_TYPE_REVIECEBLL && (e.gdsid == gdsid) &&/*&& e.rcdidx == rcdidx*/
                           e.vlddat == vlddat
                           select new { e, e1 };
                var qry = from e in qry1
                          select new
                {
                    wmsno    = e.e.wmsno.Trim(),
                    lnknewno = e.e1.lnknewno.Trim(),
                    e.e1.chkflg,
                    bllid = e.e1.bllid,
                    e.e1.qu,
                    gdsid = e.e.gdsid,
                    e.e.qty,
                    gdstype = e.e.gdstype,
                    rcdidx  = e.e.rcdidx,
                    preqty  = e.e.preqty,
                    mkr     = e.e1.mkr
                };
                var arrqry = qry.ToArray();


                //var arrqry11 = qry11.ToArray();
                foreach (wms_blldtl bdtl11 in qry11)
                {
                    bdtl11.qty = Math.Round(bdtl11.preqty, 4, MidpointRounding.AwayFromZero);
                }


                //0.删除商品审核
                var qrysh = from e in WmsDc.wms_blltp
                            where e.savdptid == LoginInfo.DefSavdptid &&
                            e.qu == arrqry[0].qu &&
                            e.gdsid == gdsid &&
                            e.bllid == WMSConst.BLL_TYPE_REVIECEBLL &&
                            e.wmsno == wmsno
                            /*&& e.rcdidx == rcdidx*/
                            select e;
                var arrqrysh = qrysh.ToArray();
                if (arrqrysh != null && arrqrysh.Length > 0)
                {
                    WmsDc.wms_blltp.DeleteAllOnSubmit(arrqrysh);
                    iDelTpDtl(arrqrysh, qrymst.FirstOrDefault());
                }
                //WmsDc.SubmitChanges();

                //1.1.没有找到订单
                if (arrqry.Length <= 0)
                {
                    return(RNoData("N0033"));
                }
                //1.3.盘点是否是同一个操作人
                if (!IsSameLogin(arrqry[0].mkr))
                {
                    return(RInfo("I0058", LoginInfo.Usrid, arrqry[0].mkr));
                }

                //1.2.订单已经审核

                /*if (arrqry[0].chkflg == GetY())
                 * {
                 *  return RRInfo("I0429" ,,);
                 *
                 * }*/
                //2.判断托盘参数和数量参数的数目是否一致
                if (qty.Length != tpcode.Length || pkgid.Length != qty.Length)
                {
                    return(RInfo("I0059"));
                }
                //3.将商品导入托盘表
                List <wms_blltp> blltps = new List <wms_blltp>();
                for (int i = 0; i < tpcode.Length; i++)
                {
                    wms_blltp blltp = new wms_blltp();
                    blltp.wmsno    = wmsno;
                    blltp.bllid    = arrqry[0].bllid;
                    blltp.qu       = arrqry[0].qu;
                    blltp.rcdidx   = arrqry[0].rcdidx;
                    blltp.rcdidxtp = i;
                    blltp.gdsid    = arrqry[0].gdsid;
                    blltp.pkgid    = pkgid[i];
                    blltp.qty      = Math.Round(qty[i], 4, MidpointRounding.AwayFromZero);
                    blltp.tpcode   = tpcode[i];
                    blltp.savdptid = LoginInfo.DefSavdptid;
                    blltp.gdstype  = gdstype[i];
                    blltp.bokflg   = GetN();
                    blltp.bkr      = "";
                    blltp.bokdat   = "";
                    blltps.Add(blltp);
                }

                WmsDc.wms_blltp.InsertAllOnSubmit(blltps);
                var qry2 = from e in qry1
                           select e.e;
                var arrqry2 = qry2.ToArray();
                //5.修改实收数量,并登帐
                arrqry2[0].qty    = Math.Round(blltps.Sum(s => s.qty), 4, MidpointRounding.AwayFromZero);
                arrqry2[0].bokflg = GetY();
                arrqry2[0].bokdat = DateTime.Now.ToString("yyyyMMddHHmmss");
                arrqry2[0].bkr    = LoginInfo.Usrid;

                //6.判断实收是否大于应收
                if (arrqry2[0].qty > arrqry[0].preqty)
                {
                    return(RInfo("I0060"));
                }
                else
                {
                    String savdptid = LoginInfo.DefSavdptid;
                    //按照实收数量收货, 记日志
                    if (arrqry2[0].qty != arrqry[0].preqty)
                    {
                        Log.i(LoginInfo.Usrid, this.Mdlid, wmsno, WMSConst.BLL_TYPE_REVIECEBLL,
                              "收货审核", arrqry[0].gdsid.Trim() + ":应收:" + arrqry[0].preqty + ";实收:" + arrqry2[0].qty,
                              arrqry[0].qu, savdptid);
                    }
                }

                try
                {
                    WmsDc.SubmitChanges();
                    scop.Complete();
                    object obj = new
                    {
                        wms_blldtl = arrqry2[0],
                        wms_blltp  = blltps
                    };
                    return(RSucc("成功", obj, "S0210"));
                }
                catch (Exception ex)
                {
                    return(RErr(ex.Message, "E0007"));
                }
            }
        }