예제 #1
0
        /// <summary>
        /// 修改WIP数据
        /// </summary>
        /// <param name="wip"></param>
        /// <returns></returns>
        public static string UpdateWIPSeed(string data)
        {
            var context = LEDAO.APIGateWay.GetEntityContext();

            ILE.LEResult res = new ILE.LEResult();
            try
            {
                using (context)
                {
                    string[]       arrdata = data.Split(',');
                    int            id      = Convert.ToInt32(arrdata[0]);
                    decimal        qty     = decimal.Parse(arrdata[1]);
                    P_Mat_WIP_Seed seed    = context.P_Mat_WIP_Seed.Where(c => c.id == id).First();
                    if (qty == 0)
                    {
                        seed.state = 2;
                    }
                    seed.lot_qty     = qty;
                    seed.unload_time = context.NewDate().First();
                    context.ObjectStateManager.ChangeObjectState(seed, EntityState.Modified);
                    context.SaveChanges();
                }
                res.Result = true;
                return(JsonConvert.SerializeObject(res));
            }
            catch (Exception)
            {
                res.Result = false;
                return(JsonConvert.SerializeObject(res));
            }
        }
예제 #2
0
        /// <summary>
        /// 修改WIP_seed的qty
        /// </summary>
        /// <param name="wip"></param>
        /// <returns></returns>
        public static string UpdateWIPSeedQty(string data)
        {
            string[] arrdata = data.Split(',');
            decimal  usedqty = decimal.Parse(arrdata[0].ToString());
            string   orderno = arrdata[2].ToString();
            string   matcode = arrdata[3].ToString();
            string   station = arrdata[4].ToString();
            string   lot_no  = arrdata[1].ToString();
            var      context = LEDAO.APIGateWay.GetEntityContext();

            ILE.LEResult res = new ILE.LEResult();
            try
            {
                using (context)
                {
                    P_Mat_WIP_Seed seed = context.P_Mat_WIP_Seed.Where(c => c.lot_no == lot_no && c.order_no == orderno && c.mat_code == matcode && c.station_code == station).First();
                    seed.lot_qty -= usedqty;
                    context.ObjectStateManager.ChangeObjectState(seed, EntityState.Modified);
                    context.SaveChanges();
                }
                res.Result = true;
                return(JsonConvert.SerializeObject(res));
            }
            catch (Exception)
            {
                res.Result = false;
                return(JsonConvert.SerializeObject(res));
            }
        }
예제 #3
0
        /// <summary>
        /// 删除投料记录
        /// </summary>
        /// <param name="strid"></param>
        /// <returns></returns>
        public static string DeleteWIPSeed(string strid)
        {
            var context = LEDAO.APIGateWay.GetEntityContext();

            ILE.LEResult res = new ILE.LEResult();
            try
            {
                using (context)
                {
                    int            id   = Convert.ToInt32(strid);
                    P_Mat_WIP_Seed seed = context.P_Mat_WIP_Seed.Where(c => c.id == id).First();
                    context.ObjectStateManager.ChangeObjectState(seed, EntityState.Deleted);
                    //long wip_id = Convert.ToInt64(seed.wip_id);
                    //P_Material_WIP wip = context.P_Material_WIP.Where(c => c.id == wip_id).First();
                    //wip.lot_qty += seed.lot_qty;
                    //context.ObjectStateManager.ChangeObjectState(wip, EntityState.Modified);
                    context.SaveChanges();
                }
                res.Result = true;
                return(JsonConvert.SerializeObject(res));
            }
            catch (Exception)
            {
                res.Result = false;
                return(JsonConvert.SerializeObject(res));
            }
        }