示例#1
0
        //添加本地采购入库单
        public retmsg Add(MyRdRecord01 mymodel, List <MyRdRecords01> mylist, string constr)
        {
            retmsg ret = new retmsg();

            try
            {
                //对应赋值
                RdRecord01         zbmodel = ZbModelMakerDy(mymodel, mylist);
                List <RdRecords01> zbslist = ZbsListMaker(mylist);


                ret = new Rd01Bll().Add(zbmodel, zbslist, constr);

                return(ret);
            }
            catch (Exception ex)
            {
                ret.flag    = "error";
                ret.message = "002:" + ex.Message;
                return(ret);
            }
        }
示例#2
0
        //生成主表model 对应赋值
        public RdRecord01 ZbModelMakerDy(MyRdRecord01 mymodel, List <MyRdRecords01> mylist)
        {
            RdRecord01 m = new RdRecord01();

            m.cBusType = "普通采购";
            m.cSource  = "库存";
            m.cRdCode  = "0101";
            m.cPTCode  = "01";
            //m.dDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
            m.dDate  = DateTime.Parse(mymodel.create_date.Substring(0, 10));//erp传过来的时间
            m.cMaker = mymodel.create_by_name;
            //m.dnmaketime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            m.dnmaketime = DateTime.Parse(mymodel.create_date);
            m.cMemo      = mymodel.remarks;
            m.cVouchType = "01";//mymodel.type;
            m.cWhCode    = mylist.First().u8_cWhCode;
            m.cVenCode   = mylist.First().u8_cVenCode;
            m.cDepCode   = mylist.First().u8_cDepCode;
            m.iTaxRate   = mylist.First().iTaxRate;
            m.bredvouch  = mymodel.bredvouch;//红蓝标识
            return(m);
        }
示例#3
0
        //检测采购入库单参数
        public retmsg CheckMyRd01(MyRdRecord01 model, List <MyRdRecords01> list, string constr)
        {
            retmsg    ret = new retmsg();
            string    sql = "";
            DataTable dt  = new DataTable();

            //主表

            if (string.IsNullOrEmpty(model.create_by_name))
            {
                ret.flag    = "error";
                ret.message = "创建者名称为空";
                return(ret);
            }

            //子表
            foreach (var i in list)
            {
                if (string.IsNullOrEmpty(i.goods_code))
                {
                    ret.flag    = "error";
                    ret.message = "商品编码为空";
                    return(ret);
                }
                else
                {
                    //检测是不是存在存货档案中
                    sql = @"select * from Inventory  where cInvMnemCode = '" + i.goods_code + "'";//cInvMnemCode 助记码
                    dt  = U8DataHelper.GetDataTable(constr, sql);
                    if (dt.Rows.Count == 0)
                    {
                        ret.flag    = "error";
                        ret.message = "存货档案中查询不到" + i.goods_code;
                        return(ret);
                    }
                }
                if (string.IsNullOrEmpty(i.supplier_name))
                {
                    ret.flag    = "error";
                    ret.message = "供应商名称为空";
                    return(ret);
                }
                else
                {
                    //检测是不是存在供应商档案中
                    sql = @"select * from Vendor where cVenName = '" + i.supplier_name + "'";//cVenMnemCode 助记码
                    dt  = U8DataHelper.GetDataTable(constr, sql);
                    if (dt.Rows.Count == 0)
                    {
                        ret.flag    = "error";
                        ret.message = "供应商档案中查询不到" + i.supplier_name;
                        return(ret);
                    }
                }
                if (string.IsNullOrEmpty(i.storage_name))
                {
                    ret.flag    = "error";
                    ret.message = "仓库名称为空";
                    return(ret);
                }
                else
                {
                    //检测是不是存在仓库档案中
                    sql = @"select * from Warehouse where cWhName = '" + i.storage_name + "'";
                    dt  = U8DataHelper.GetDataTable(constr, sql);
                    if (dt.Rows.Count == 0)
                    {
                        ret.flag    = "error";
                        ret.message = "仓库档案中查询不到" + i.storage_name;
                        return(ret);
                    }
                }
                if (string.IsNullOrEmpty(i.dept_name))
                {
                    ret.flag    = "error";
                    ret.message = "部门名称为空";
                    return(ret);
                }
                else
                {
                    //检测是不是存在仓库档案中 部门名称要模糊查询,20190525
                    sql = @"select * from Department where cDepName like '%" + i.dept_name + "%'";
                    dt  = U8DataHelper.GetDataTable(constr, sql);
                    if (dt.Rows.Count == 0)
                    {
                        ret.flag    = "error";
                        ret.message = "部门档案中模糊查询不到" + i.dept_name;
                        return(ret);
                    }
                }
            }

            return(ret);
        }