Ejemplo n.º 1
0
        /// <summary>
        /// 插入主表
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns>影响的行数</returns>
        /// <remarks>2017-05-31 罗勤尧 创建</remarks>
        public override int InsertEntity(IcStockBillTem entity)
        {
            //Context.Insert("icstockbill_tem", entity)
            //                .Execute();
            //return entity;

            var id = ContextKis.Insert <IcStockBillTem>("icstockbill_tem", entity)
                     .AutoMap()
                     .Execute();

            return(id);
        }
Ejemplo n.º 2
0
        //InsertKis
        public JsonResult InsertKis(JsonModel json)
        {
            string addds = JsonHelper.ToJson(json);

            Hyt.BLL.Log.LocalLogBo.Instance.WriteTo(addds, "Kis");
            if (json == null)
            {
                var sr                 = new StreamReader(Request.InputStream);
                var stream             = sr.ReadToEnd();
                JavaScriptSerializer s = new JavaScriptSerializer(); //继承自 System.Web.Script.Serialization;
                json = s.Deserialize <JsonModel>(stream);            //只要你的JSON串没问题就可以转
            }

            Hyt.Model.Kis.KisResultT <StockOutAddResponse> res = new KisResultT <StockOutAddResponse>();
            res.success    = false;
            res.message    = "失败";
            res.error_code = -1;
            res.data       = new StockOutAddResponse();
            //res.data.FBillNo = json.FBillNo;
            //res.data.OutFBillNo = json.FBillNo;


            IcStockBillTemBo target = new IcStockBillTemBo();             // TODO: 初始化为适当的值

            ICStockBillEntryTemBo targeta  = new ICStockBillEntryTemBo(); // TODO: 初始化为适当的值
            IcStockBillTem        soIdList = new IcStockBillTem();        // TODO: 初始化为适当的值

            soIdList.FInBillNo      = json.FBillNo;
            soIdList.FDate          = json.Fdate;
            soIdList.FTranType      = 21;
            soIdList.FBillerID      = "16394";
            soIdList.FBillNo        = json.FBillNo;
            soIdList.FConsignee     = json.FConsignee;
            soIdList.FCurrencyID    = "人民币";
            soIdList.FDeliveryPlace = "";

            soIdList.FDeptID        = json.FDeptID;
            soIdList.FEmpID         = json.FEmpID;
            soIdList.FentryCount    = 0;
            soIdList.FExplanation   = json.FExplanation;
            soIdList.FFetchDate     = "";
            soIdList.FFManagerID    = "-1";
            soIdList.FInventoryType = "";
            soIdList.FK3BillerID    = 0;
            soIdList.FK3BillTypeID  = 0;
            soIdList.FK3CurrencyID  = 1;
            soIdList.FK3DeptID      = 0;
            soIdList.FRob           = Int32.Parse(json.FROB);

            soIdList.FSupplyID   = json.FCustID;
            soIdList.FK3SupplyID = 2201;
            //主表插入数据
            var r = target.InsertEntity(soIdList);

            List <ICStockBillEntryTem> ItemList = new List <ICStockBillEntryTem>();

            // TODO: 初始化为适当的值
            foreach (JsonItem js in json.item)
            {
                ICStockBillEntryTem sost = new ICStockBillEntryTem();
                sost.FInBillNo  = json.FBillNo;
                sost.FDCStockID = js.FDCStockID;
                sost.FItemID    = js.FItemID;
                sost.FKFDate    = js.FKFDate;

                if (string.IsNullOrEmpty(js.FConsignPrice))
                {
                    sost.Fauxprice = 0;
                }
                else
                {
                    sost.Fauxprice = decimal.Parse(js.FConsignPrice);
                }

                if (string.IsNullOrEmpty(js.FConsignAmount))
                {
                    sost.Famount = 0;
                }
                else
                {
                    sost.Famount = decimal.Parse(js.FConsignAmount);
                }

                if (string.IsNullOrEmpty(js.FKFPeriod))
                {
                    sost.FKFPeriod = 0;
                }
                else
                {
                    sost.FKFPeriod = Int32.Parse(js.FKFPeriod);
                }

                sost.FPeriodDate = js.FPeriodDate;
                sost.FUnitID     = js.FUnitID;

                if (string.IsNullOrEmpty(js.Fauxqty))
                {
                    sost.Fauxqty = 0;
                    sost.FQty    = 0;
                }
                else
                {
                    sost.Fauxqty = decimal.Parse(js.Fauxqty);
                    sost.FQty    = decimal.Parse(js.Fauxqty);
                }
                sost.Fnote = js.Fnote;
                //明细表插入数据
                //targeta.InsertEntity(sost);
                ItemList.Add(sost);
            }

            if (r > 0)
            {
                var re = targeta.InsertEntityList(ItemList);
                if (re > 0)
                {
                    //执行存储过程
                    target.EXEC();
                    res.success         = true;
                    res.message         = "成功";
                    res.error_code      = 0;
                    res.data            = new StockOutAddResponse();
                    res.data.FBillNo    = json.FBillNo;
                    res.data.OutFBillNo = "";
                }
            }

            //
            return(Json(res, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 插入主表
        /// </summary>
        /// <param name="entity">实体</param>
        ///<remarks>2017-05-31 罗勤尧 创建</remarks>
        public int InsertEntity(IcStockBillTem entity)
        {
            var en = IIcStockBillTemDao.Instance.InsertEntity(entity);

            return(en);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 插入主表
 /// </summary>
 /// <param name="entity">主表实体</param>
 /// <returns>影响行数</returns>
 /// <remarks>2017-05-31 罗勤尧  创建</remarks>
 public abstract int InsertEntity(IcStockBillTem entity);