Exemple #1
0
        //第三次验证,判断该物料是否存在于该车间
        public static string GetMaterialConsumptionManual2(string str)
        {
            var context = LEDAO.APIGateWay.GetEntityContext();

            string[] strArray = str.Split(',');
            try
            {
                using (context)
                {
                    var res = context.P_GetMaterialConsumptionManual2(strArray[0], strArray[1], strArray[2], strArray[3], strArray[4]).ToList();
                    if (res.Count() > 0)
                    {
                        return(ConResult.GetJsonResult(res, true, null));
                    }
                    else
                    {
                        return(ConResult.GetJsonResult(null, false, "该物料[" + strArray[3] + "]不属于[" + strArray[4] + "]车间"));
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #2
0
        /// <summary>
        /// GetSFClstbyOrderNo 通过工单获取sfc条码
        /// </summary>
        /// <param name="orderNo">工单</param>
        /// <returns></returns>
        public static string GetSFClstbyOrderNo(string orderNo)
        {
            var context = LEDAO.APIGateWay.GetEntityContext();

            try
            {
                using (context)
                {
                    var res = from b in context.P_BarCodeBing orderby b.barcode where (b.order == orderNo)
                              select new
                    {
                        order   = b.order,
                        barcode = b.barcode
                    };
                    if (res.Count() > 0)
                    {
                        return(ConResult.GetJsonResult(res, true, null));   //返回P_BarCodeBing列表
                    }
                    else
                    {
                        return(ConResult.GetJsonResult(null, false, "当前工单[" + orderNo + "]下未找到批次号"));
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #3
0
        /// <summary>
        /// 加载后段工步
        /// </summary>
        /// <param name="PID">PID</param>
        /// <returns></returns>
        public static string GetStepAll(string pid)
        {
            var context = LEDAO.APIGateWay.GetEntityContext();

            try
            {
                using (context)
                {
                    int intpid = Convert.ToInt32(pid);
                    //var res = context.B_ProcessStep.Where(x => x.pid == intpid).OrderBy(x => x.idx).ToList();

                    var res = (from a in context.B_ProcessStep
                               join b in context.S_DriveList on a.drive_code equals b.drive_code
                               where
                               a.pid == intpid
                               select new
                    {
                        a.step_id,
                        a.Unit,
                        a.parameter,
                        a.parameter2,
                        a.mat_code,
                        a.ctrl_type,
                        a.triger,
                        a.is_record,
                        a.idx,
                        a.auto_restart,
                        a.autorun,
                        a.consume_type,
                        a.consume_percent,
                        a.allow_reuse,
                        a.format,
                        a.time_out,
                        a.drive_code,
                        a.type_id,
                        a.flow_code,
                        a.step_type,
                        a.step_name,
                        a.step_code,
                        a.process_code,
                        b.file_name
                    }).ToList();
                    if (res.Count() > 0)
                    {
                        return(ConResult.GetJsonResult(res, true, null));
                    }
                    return(ConResult.GetJsonResult(null, true, null));;
                    //else
                    //{
                    //    return ConResult.GetJsonResult(null, false, "步骤下没有工步");
                    //}
                }
            }
            catch (Exception ex)
            {
                return(ConResult.GetJsonResult(null, false, ex.ToString()));
            }
        }
Exemple #4
0
        /// <summary>
        /// 加载前段工步
        /// </summary>
        /// <param name="process">工艺</param>
        /// <returns></returns>
        public static string GetPreStepAll(string process)
        {
            var context = LEDAO.APIGateWay.GetEntityContext();

            try
            {
                using (context)
                {
                    //var res = context.B_PreStep.Where(x => x.process_code == process).OrderBy(x => x.idx);

                    var res = (from a in context.B_PreStep
                               join b in context.S_DriveList on a.drive_code equals b.drive_code
                               where
                               a.process_code == process
                               select new
                    {
                        a.IsKeySteps,
                        a.Unit,
                        a.parameter2,
                        a.triger,
                        a.is_record,
                        a.idx,
                        a.auto_restart,
                        a.autorun,
                        a.allow_reuse,
                        a.format,
                        a.time_out,
                        a.parameter,
                        a.drive_code,
                        a.type_id,
                        a.flow_code,
                        a.step_type,
                        a.step_name,
                        a.step_code,
                        a.process_code,
                        a.pre_id,
                        b.file_name
                    }).ToList();
                    if (res.Count() > 0)
                    {
                        return(ConResult.GetJsonResult(res, true, null));
                    }
                    else
                    {
                        return(ConResult.GetJsonResult(null, false, null));
                    }
                }
            }
            catch (Exception ex)
            {
                return(ConResult.GetJsonResult(null, false, ex.ToString()));
            }
        }
Exemple #5
0
        /// <summary>
        /// 通过工单获取工艺、批次最大数、工单数,工单
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        public static string GetProductFlow(string order)
        {
            var context = LEDAO.APIGateWay.GetEntityContext();

            try
            {
                using (context)
                {
                    var res = context.V_ProductFlow.Where(x => x.order_no == order).ToList();
                    if (res.Count() > 0)
                    {
                        return(ConResult.GetJsonResult(res.First(), true, null));
                    }
                    else
                    {
                        return(ConResult.GetJsonResult(null, false, "不存在此工单号"));
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #6
0
        /// <summary>
        /// 获取OK流的PID值
        /// </summary>
        /// <param name="split">工单,工艺,当前工序</param>
        /// <returns></returns>
        public static string GetFlowDetailOK(string split)
        {
            var context = LEDAO.APIGateWay.GetEntityContext();

            try
            {
                using (context)
                {
                    string[] Array       = split.Split(',');
                    string   flowcode    = Array[0];
                    string   processfrom = Array[1];
                    var      res         = context.B_Process_Flow_Detail.Where(x => x.flow_code == flowcode && x.process_from == processfrom && x.process_result == "OK").Select(c => c.pid);
                    if (res.Count() > 0)
                    {
                        return(ConResult.GetJsonResult(res.First(), true, null));
                    }
                    return(ConResult.GetJsonResult(null, false, "工单指定工艺与当前工序不匹配"));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #7
0
        /// <summary>
        /// 加载子工步
        /// </summary>
        /// <param name="pid"></param>
        /// <returns></returns>
        public static string GetSonStepAll(string json)
        {
            var context = LEDAO.APIGateWay.GetEntityContext();

            try
            {
                using (context)
                {
                    string[] data      = json.Split(',');
                    string   step_code = data[0].ToString();
                    string   flow_code = data[1].ToString();
                    var      res       = context.B_ProcessSonStep.Where(x => x.parentstepid == step_code && x.flow_code == flow_code).OrderBy(x => x.idx).ToList();
                    if (res.Count() > 0)
                    {
                        return(ConResult.GetJsonResult(res, true, null));
                    }
                    return(ConResult.GetJsonResult(null, true, null));
                }
            }
            catch (Exception ex)
            {
                return(ConResult.GetJsonResult(null, false, ex.ToString()));
            }
        }