public void updateIPQCDetails(RepairDetailRequest param)
        {
            DateTime           now   = SSGlobalConfig.Now;
            CV_QM_REPAIR_ORDER order = param.repairOrder;

            using (TransactionScope ts = new TransactionScope())
            {
                //明细
                foreach (CV_QM_REPAIR_IPQC_DETAIL detail in param.detailList)
                {
                    QM_REPAIR_IPQC_DETAIL tmp = new QM_REPAIR_IPQC_DETAIL()
                    {
                        PK = detail.PK,
                        QualityDecision = detail.QualityDecision
                    };
                    ipqc_detailbo.UpdateSome(tmp);

                    //string sql = "";
                    //if (detail.QualityDecision.Equals("OK"))
                    //{
                    //    //修改SN状态为prcs(2),并将LocPK改成包装
                    //    sql = string.Format(CultureInfo.InvariantCulture, ipqcSql2, 2,order.ReportLine, "TP06", detail.SN);
                    //}
                    //else
                    //{
                    //    //修改SN状态为qc(6)
                    //    sql = string.Format(CultureInfo.InvariantCulture, ipqcSql1, 6, detail.SN);
                    //}
                    //log.Info("updateIPQCDetails Sql : " + sql);
                    //bscbo.ExecuteNonQueryBySql(sql);

                    if (detail.QualityDecision.Equals("OK"))
                    {
                        //修改SN状态为prcs(2),并将LocPK改成包装
                        string sql = string.Format(CultureInfo.InvariantCulture, ipqcSql2, 2, order.ReportLine, "TP06", detail.SN);
                        log.Info("updateIPQCDetails Sql : " + sql);
                        alt_bscbo.ExecuteNonQueryBySql(sql);
                    }
                }

                QM_REPAIR_IPQC ipqc = new QM_REPAIR_IPQC()
                {
                    TGuid      = order.TGuid,
                    Status     = "关闭",
                    ModifiedBy = param.user,
                    ModifiedOn = now
                };
                //IPQC单状态
                ipqcbo.UpdateSome(ipqc);
                ts.Complete();
            }
        }
        public string createIPQC(RepairOrderRequest param)
        {
            DateTime now = SSGlobalConfig.Now;
            IList <CV_QM_REPAIR_ORDER>  orderList = param.orderList;
            Dictionary <string, string> dict      = new Dictionary <string, string>();

            dict.Add("PN", "IPQC");
            dict.Add("Y", now.ToString("yyyyMMdd"));
            string message = "";

            //创建IPQC表单
            using (TransactionScope ts = new TransactionScope())
            {
                string         ipqcSequence = createCode("IPQCRule", dict);
                QM_REPAIR_IPQC ipqc         = new QM_REPAIR_IPQC()
                {
                    TGuid          = Guid.NewGuid(),
                    Sequence       = ipqcSequence,
                    OrderID        = orderList[0].OrderID,
                    ReportLine     = orderList[0].ReportLine,
                    ReportWorkshop = orderList[0].ReportWorkshop,
                    DefID          = orderList[0].DefID,
                    DefName        = orderList[0].DefDescript,
                    Status         = "新建",
                    CreatedBy      = param.user,
                    CreatedOn      = now
                };
                ipqcbo.Insert(ipqc);
                foreach (CV_QM_REPAIR_ORDER tmp in orderList)
                {
                    QM_REPAIR_IPQC_DETAIL detail = new QM_REPAIR_IPQC_DETAIL()
                    {
                        TGuid           = ipqc.TGuid,
                        SN              = tmp.AbnormalitySN,
                        ReportID        = tmp.ReportID,
                        Result          = tmp.Result,
                        ReportTerminal  = tmp.ReportTerminal,
                        ProductDecision = tmp.ProductDecision,
                        QualityDecision = tmp.QualityDecision
                    };
                    ipqc_detailbo.Insert(detail);
                    //修改SN状态为IPQC(7)
                    string cmd_ipqcSql1 = string.Format(CultureInfo.InvariantCulture, ipqcSql1, 7, tmp.AbnormalitySN);
                    alt_bscbo.ExecuteNonQueryBySql(cmd_ipqcSql1);
                }

                //创建预警信息
                string cmd_altsql = string.Format(CultureInfo.InvariantCulture, ipqcAltSql, ipqc.DefID + ipqc.DefName, ipqc.OrderID, orderList[0].LineName, ipqcSequence);
                log.Info("createIPQC Sql : " + cmd_altsql);
                DataTable dt = alt_bscbo.GetDataTableBySql(cmd_altsql);
                if (dt.Rows.Count > 0)
                {
                    //开始推送
                    PM_ALT_MESSAGE msg = alt_messagebo.GetEntity(SafeConvert.ToInt64(dt.Rows[0]["MsgPK"].ToString()));
                    if (alt_bscbo.ExecuteNotify(msg))
                    {
                        message = ipqcSequence;
                        ts.Complete();
                    }
                    else
                    {
                        message = "NG,推送失败,请重新提交..";
                    }
                }
            }
            return(message);
        }