Esempio n. 1
0
 /// <summary>
 /// 获取U9数据
 /// </summary>
 private bool gainData(string DeliveryNoteID, int DRAW_EXAM_INTERFACE_ID)
 {
     try
     {
         LWGETWebReference.QualityPaperManagement_v001 LWGET = new LWGETWebReference.QualityPaperManagement_v001();
         LWGET.Url = Common.GainURL;
         string OrganizationID = Common.OrganizationID;
         string DepartmentName = ""; //部门名称
         string BinID          = ""; //堆位ID
         string BinName        = ""; //堆位名称
         LWGET.UseDefaultCredentials = true;
         LWGET.RequestHeader         = new LWGETWebReference.RequestHeaderType()
         {
             SourceID = Common.SourceID
         };
         //返回部门ID
         //DeliveryNoteID = "DHPOF00077015";
         string DepartmentID = LWGET.GetBinForDeliveryNote(OrganizationID, DeliveryNoteID, out DepartmentName, out BinID, out BinName);
         if (!string.IsNullOrEmpty(DepartmentID))
         {
             //限制只能有一条数据
             DataTable dtRLPD = LinQBaseDao.Query("select * from RegisterLoosePaperDistribution where R_DRAW_EXAM_INTERFACE_ID=" + DRAW_EXAM_INTERFACE_ID).Tables[0];
             if (dtRLPD.Rows.Count == 0)
             {
                 RegisterLoosePaperDistribution rpdb = new RegisterLoosePaperDistribution();
                 rpdb.OrganizationID           = OrganizationID;
                 rpdb.DepartmentCode           = DepartmentID;
                 rpdb.ExtensionField2          = BinID;
                 rpdb.R_DRAW_EXAM_INTERFACE_ID = DRAW_EXAM_INTERFACE_ID;
                 rpdb.issend = false;
                 if (LinQBaseDao.InsertOne(dc, rpdb))
                 {
                     return(true);
                 }
                 else
                 {
                     return(false);
                 }
             }
             else
             {
                 return(true);
             }
         }
         else
         {
             return(false);
         }
         //DepartmentID:050703  BinName:15-25國廢倉 BinID:15-25    DepartmentName:生産部-二十一車間(PM13)-21車間制漿
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(false);
     }
 }
        /// <summary>
        /// 保存过磅信息
        /// </summary>
        /// <param name="carinoutid">车辆通行总记录ID</param>
        /// <param name="content">送货车辆EBELN(PO号)、成品车辆WTD_ID(委托单)、三废车辆VBELN(交货单号)</param>
        /// <param name="type">业务类型(进门地磅、出门地磅、装货第一次过磅、卸货第一次过磅、装货第二次过磅、卸货第二次过磅)</param>
        /// <param name="wie">过磅重量</param>
        private void save(string carinoutid, string content, string type, string wie)
        {
            BusinessRecord busin = new BusinessRecord();

            busin.BusinessRecord_CarInOutRecord_ID = Convert.ToInt32(carinoutid);
            busin.BusinessRecord_Content           = content;
            busin.BusinessRecord_State             = "启动";
            busin.BusinessRecord_Type         = type;
            busin.BusinessRecord_Weight       = Convert.ToDouble(wie);
            busin.BusinessRecord_WeightTime   = CommonalityEntity.GetServersTime();
            busin.BusinessRecord_WeightPerson = CommonalityEntity.USERNAME;
            if (LinQBaseDao.InsertOne <BusinessRecord>(new DCCarManagementDataContext(), busin))
            {
                CommonalityEntity.WriteLogData("新增", "记录IC卡(小票)号为:" + txtSerialnumber.Text.Trim() + "的" + type + "信息", CommonalityEntity.USERNAME);//添加操作日志
            }
        }
        /// <summary>
        /// 新增一条质检记录
        /// </summary>
        /// <param name="qcRecord">质检实体</param>
        /// <returns></returns>
        public static bool InsertOneCamera(Camera eh_Fvn)
        {
            bool rbool = true;

            using (DCCarManagementDataContext db = new DCCarManagementDataContext())
            {
                try
                {
                    rbool = LinQBaseDao.InsertOne(db, eh_Fvn);
                }
                catch
                {
                    rbool = false;
                }
                finally { db.Connection.Close(); }
            }
            return(rbool);
        }
        /// <summary>
        /// 新增一条记录
        /// </summary>
        /// <param name="qcRecord">质检实体</param>
        /// <returns></returns>
        public static bool InsertOneQCRecord(Driveway qcRecord)
        {
            bool rbool = true;

            using (DCCarManagementDataContext db = new DCCarManagementDataContext())
            {
                try
                {
                    rbool = LinQBaseDao.InsertOne(db, qcRecord);
                }
                catch
                {
                    rbool = false;
                }
                finally { db.Connection.Close(); }
            }
            return(rbool);
        }
        /// <summary>
        /// 记录车辆通行详细
        /// </summary>
        /// <param name="CarInOutRecord_ID">车辆通行编号</param>
        /// <param name="DrivewayStrategy_ID">通行策略编号</param>
        /// <param name="Remark">车辆通行详细备注</param>
        /// <param name="Abnormal">是否通行异常</param>
        /// <param name="DrivewayID">当前通道编号</param>
        /// <param name="DrivewayStrategy_Sort">通行策略顺序号</param>
        private void SaveCarInOutInfoRecord(int carinoutrecord_id, int drivewaystrategy_id, string state, string remark, string abnor, int drivewayid, int drivewaystrategy_sort)
        {
            CarInOutInfoRecord carinout = new CarInOutInfoRecord();

            carinout.CarInOutInfoRecord_CarInOutRecord_ID   = carinoutrecord_id;
            carinout.CarInOutInfoRecord_DrivewayStrategy_ID = drivewaystrategy_id;
            carinout.CarInOutInfoRecord_State      = state;
            carinout.CarInOutInfoRecord_Remark     = remark;
            carinout.CarInOutInfoRecord_Abnormal   = abnor;
            carinout.CarInOutInfoRecord_DrivewayID = drivewayid;
            //carinout.CarInOutInfoRecord_DrivewayStrategy_Sort = drivewaystrategy_sort;
            carinout.CarInOutInfoRecord_Time = CommonalityEntity.GetServersTime();
            if (LinQBaseDao.InsertOne <CarInOutInfoRecord>(new DCCarManagementDataContext(), carinout))
            {
                string carinfoid   = LinQBaseDao.Query("select CarInOutRecord_CarInfo_ID from CarInOutRecord where CarInOutRecord_ID =" + carinoutrecord_id + "").Tables[0].Rows[0][0].ToString();
                string carinfoname = LinQBaseDao.Query("select CarInfo_Name from CarInfo where CarInfo_ID =" + carinfoid + "").Tables[0].Rows[0][0].ToString();
                CommonalityEntity.WriteLogData("新增", "记录车牌号为:" + carinfoname + "的车辆通行信息", CommonalityEntity.USERNAME);//添加操作日志
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 查询单条 返回实体
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="fun"></param>
        /// <returns></returns>
        //public static UserInfo Single(Expression<Func<UserInfo, bool>> fun)
        //{
        //    using (DCCarManagementDataContext db = new DCCarManagementDataContext())
        //    {
        //        try
        //        {
        //            return LinQBaseDao.Single<UserInfo>(db, fun);
        //        }
        //        catch
        //        {
        //            return null;
        //        }
        //        finally
        //        {
        //            db.Connection.Close();
        //        }
        //    }
        //}

        /// <summary>
        /// 新增一条质检记录
        /// </summary>
        /// <param name="qcRecord">用户实体</param>
        ///    /// <param name="rint">新增后自动增长编号</param>
        /// <returns></returns>
        public static bool InsertOneQCRecord(UserInfo qcRecord, out int rint)
        {
            rint = 0;
            bool rbool = true;

            using (DCCarManagementDataContext db = new DCCarManagementDataContext())
            {
                try
                {
                    rbool = LinQBaseDao.InsertOne(db, qcRecord);
                    rint  = db.UserInfo.Max(p => p.UserId);
                }
                catch
                {
                    rbool = false;
                }
                finally { db.Connection.Close(); }
            }
            return(rbool);
        }
Esempio n. 7
0
        //将重置好了的信息添加到重置申请表,状态为已审批
        public void addcz()
        {
            addsqlwhere = " where 1=1";

            addsqlwhere += " and CarInfo_Name = '" + gridevewSortReset.SelectedRows[0].Cells["CarInfo_Name"].Value.ToString() + "'";

            string    sql   = "select CarInfo_ID,CarInfo_Name,SmallTicket_ID,SmallTicket_Serialnumber,SmallTicket_SortNumber,ICCard_ID,ICCard_Value from View_CarState " + addsqlwhere + "";
            DataTable table = LinQBaseDao.Query(sql).Tables[0];

            sortReset sr = new sortReset();

            //组装对象
            sr.sortReset_CarInfo_ID   = Convert.ToInt32(table.Rows[0]["CarInfo_ID"].ToString());
            sr.sortReset_CarInfo_Name = table.Rows[0]["CarInfo_Name"].ToString();
            sr.sortReset_QTongxing    = txtqian.Text.Trim();
            sr.sortReset_HTongxing    = cbohou.Text.Trim();
            //判断是有小票的还是是有IC卡的车辆信息

            if (!string.IsNullOrEmpty(table.Rows[0]["SmallTicket_Serialnumber"].ToString()))
            {
                sr.sortReset_SmallTicket_Serialnumber = table.Rows[0]["SmallTicket_Serialnumber"].ToString();
            }
            else if (!string.IsNullOrEmpty(table.Rows[0]["ICCard_Value"].ToString()) && !string.IsNullOrEmpty(table.Rows[0]["ICCard_ID"].ToString()))
            {
                sr.sortReset_SmallTicket_ICCard_ID    = Convert.ToInt32(table.Rows[0]["ICCard_ID"].ToString());
                sr.sortReset_SmallTicket_ICCard_Value = table.Rows[0]["ICCard_Value"].ToString();
            }

            sr.sortReset_SmallTicket_SortNumber        = table.Rows[0]["SmallTicket_SortNumber"].ToString();
            sr.sortReset_SortNumberInfo_SmallTicket_ID = Convert.ToInt32(table.Rows[0]["SmallTicket_ID"].ToString());
            sr.sortReset_ShenQingTime = CommonalityEntity.GetServersTime();
            sr.sortReset_SortTime     = CommonalityEntity.GetServersTime();
            sr.sortReset_ShenQingRen  = CommonalityEntity.USERNAME;
            sr.sortReset_Sortren      = CommonalityEntity.USERNAME;
            sr.sortReset_Sortjg       = 1;//0为未处理,1为已处理
            sr.sortReset_Remark       = txtRemark.Text.Trim();
            if (LinQBaseDao.InsertOne <sortReset>(new DCCarManagementDataContext(), sr))
            {
                CommonalityEntity.WriteLogData("修改", "特权重置了车牌为" + table.Rows[0]["CarInfo_Name"].ToString() + "的车辆通行状态。", CommonalityEntity.USERNAME);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 登记方法
        /// </summary>
        private void QcInfoAdd()
        {
            try
            {
                if (lvwUserList.SelectedRows.Count > 0)
                {
                    int           id                   = Convert.ToInt32(lvwUserList.SelectedRows[0].Cells["DRAW_EXAM_INTERFACE_ID"].Value);
                    StringBuilder sbMessage            = new StringBuilder();
                    int           QCInfo_Dictionary_ID = 0;
                    int           QCInfo_STATE         = 0;
                    var           dictionary           = DictionaryDAL.Query();
                    foreach (var m in dictionary)
                    {
                        if (m.Dictionary_Name == "质检中")
                        {
                            QCInfo_Dictionary_ID = m.Dictionary_ID;
                        }
                        if (m.Dictionary_Name == "启动")
                        {
                            QCInfo_STATE = m.Dictionary_ID; //数据状态(启动)
                        }
                    }
                    int irnt = 0;

                    #region ykWarning: 和U9交互 纸种为 LSOP1的不和U9交互 ,测试的时候,可以删除U9交互,发布的时候务必要还原。
                    //#if !DEBUG
                    string PROD_ID = lvwUserList.SelectedRows[0].Cells["PROD_ID"].Value.ToString();
                    if (isIdebarJoinU9(PROD_ID))
                    {
                        DataSet ds = LinQBaseDao.Query("select SHIPMENT_NO,CNTR_NO from dbo.DRAW_EXAM_INTERFACE where DRAW_EXAM_INTERFACE_ID=" + id);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            string SHIPMENT_NO = ds.Tables[0].Rows[0][0].ToString();
                            if (!gainData(SHIPMENT_NO, id))
                            {
                                string CNTR_NO = ds.Tables[0].Rows[0][0].ToString();
                                MessageBox.Show(CNTR_NO + "从U9获取数据失败,不能登记!");
                                return;
                            }
                        }
                        else
                        {
                            MessageBox.Show("登记失败!");
                            return;
                        }
                    }
                    else
                    {
                        DataSet ds = LinQBaseDao.Query("select SHIPMENT_NO,CNTR_NO from dbo.DRAW_EXAM_INTERFACE where DRAW_EXAM_INTERFACE_ID=" + id);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            RegisterLoosePaperDistribution rpdb = new RegisterLoosePaperDistribution();
                            rpdb.R_DRAW_EXAM_INTERFACE_ID = id;
                            rpdb.issend = false;
                            LinQBaseDao.InsertOne(dc, rpdb);
                        }
                    }
                    //#endif
                    #endregion

                    if (YesNoDengJi(id))
                    {
                        MessageBox.Show("该信息已登记过", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        Bangding_Load(RegistrationWhere());//更新数据
                        ids.Clear();
                        return;
                    }
                    var qf = new QCInfo();

                    qf.QCInfo_Dictionary_ID = QCInfo_Dictionary_ID;
                    qf.QCInfo_STATE         = QCInfo_STATE;
                    int k = QCInfoDAL.GetIntDRAWCount(id);//抽样总次数
                    qf.QCInfo_PumpingPackets = k;
                    #region 周意 规则加上后需要修改
                    //e ReckonWaterTestCount(qf.QCInfo_ID);
                    qf.QCInfo_UnpackBefore_MOIST_PER_COUNT = OneCQCount + TwoCQCount;
                    qf.QCInfo_UnpackBack_MOIST_COUNT       = OneCHCount + TwoCHCount;
                    #endregion
                    qf.QCInfo_DRAW_EXAM_INTERFACE_ID = id;
                    qf.QCInfo_DEGREE    = 1;                                           //检测次数
                    qf.QCInfo_TIME      = DateTime.Now;                                //日期时间
                    qf.QCInfo_Client_ID = Common.CLIENTID;                             //客户端配置编号
                    qf.QCInfo_UserId    = EMEWE.Common.Converter.ToInt(Common.USERID); //记录人:当前登录人

                    //修改抽样表状态
                    Action <DRAW_EXAM_INTERFACE> ap = n =>
                    {
                        //liemrao begin update 20160901
                        //n.IS_DengJi = Convert.ToChar("Y");
                        n.IS_DengJi = "Y";
                        //end update
                    };
                    Expression <Func <DRAW_EXAM_INTERFACE, bool> > p1 = n => n.DRAW_EXAM_INTERFACE_ID == id;
                    bool rboolDRAW_EXAM_INTERFACEDAL = DRAW_EXAM_INTERFACEDAL.Update(p1, ap);
                    if (rboolDRAW_EXAM_INTERFACEDAL)
                    {
                        if (QCInfoDAL.addQCInfoDAL(qf))
                        {
                            irnt++;
                            sbMessage.Append(id + ",");
                            Common.WriteLogData("新增", "登记数据抽样编号为:" + id, Common.NAME); //操作日志
                            #region 抽包
                            getPackets(qf.QCInfo_ID, id);
                            #endregion
                        }
                        else
                        {
                            //修改抽样表状态
                            Action <DRAW_EXAM_INTERFACE> ap2 = n =>
                            {
                                n.IS_DengJi = null;
                            };
                            Expression <Func <DRAW_EXAM_INTERFACE, bool> > p2 = n => n.DRAW_EXAM_INTERFACE_ID == id;
                            DRAW_EXAM_INTERFACEDAL.Update(p2, ap2);
                        }
                    }
                    if (!string.IsNullOrEmpty(sbMessage.ToString()))
                    {
                        DialogResult dia = MessageBox.Show("登记数据抽样编号为:" + sbMessage.ToString() + "成功\r\n是否现场抽包?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                        if (dia.Equals(DialogResult.Yes))
                        {
                            tChoosePacks.Enabled = false;
                            ChoosePacks();
                            tChoosePacks.Enabled = true;
                        }
                    }
                    else//没有选中
                    {
                        MessageBox.Show("请选择列表再开始质检!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            catch
            {
                MessageBox.Show("登记失败", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            finally
            {
                page = new PageControl();
                page.PageMaxCount = tscbxPageSize2.SelectedItem.ToString();
                Bangding_Load(RegistrationWhere());//更新数据
            }
        }
Esempio n. 9
0
        //申请重置
        private void btnshenqing_Click(object sender, EventArgs e)
        {
            addsqlwhere = " where 1=1";
            if (txtRemark.Text.Trim() == "")
            {
                MessageBox.Show("重置原因不能为空。", "提示");
                return;
            }
            if (gridevewSortReset.SelectedRows.Count > 1)
            {
                MessageBox.Show("每次只能对一辆车进行重置申请。", "提示");
                return;
            }
            else if (gridevewSortReset.SelectedRows.Count == 0)
            {
                MessageBox.Show("请选择一个车辆信息进行重置申请。", "提示");
                return;
            }
            if (txtqian.Text.ToString() == cbohou.SelectedText.ToString())
            {
                MessageBox.Show("重置后状态不能与重置前是相同的状态。", "提示");
                return;
            }
            if (string.IsNullOrEmpty(cbohou.Text))
            {
                MessageBox.Show("请选择重置后状态。", "提示");
                return;
            }
            if (gridevewSortReset.SelectedRows.Count == 1)
            {
                string sqlcc = "select sortReset_SortNumberInfo_SmallTicket_ID from sortReset where sortReset_CarInfo_ID = " + gridevewSortReset.SelectedRows[0].Cells["CarInfo_ID"].Value.ToString() + " and sortReset_Sortjg = 0";
                int    count = LinQBaseDao.Query(sqlcc).Tables[0].Rows.Count;
                if (count >= 1)
                {
                    MessageBox.Show("该车辆已有一条未审批的记录,不能重复添加。", "提示");
                }
                else if (count == 0)
                {
                    addsqlwhere += " and CarInfo_Name = '" + gridevewSortReset.SelectedRows[0].Cells["CarInfo_Name"].Value.ToString() + "'";

                    string    sql   = "select CarInfo_ID,CarInfo_Name,SmallTicket_ID,SmallTicket_Serialnumber,SmallTicket_SortNumber,ICCard_ID,ICCard_Value from View_CarState " + addsqlwhere + "";
                    DataTable table = LinQBaseDao.Query(sql).Tables[0];

                    sortReset sr = new sortReset();
                    sr.sortReset_CarInfo_ID   = Convert.ToInt32(table.Rows[0]["CarInfo_ID"].ToString());
                    sr.sortReset_CarInfo_Name = table.Rows[0]["CarInfo_Name"].ToString();
                    sr.sortReset_QTongxing    = txtqian.Text.Trim();
                    sr.sortReset_HTongxing    = cbohou.Text.Trim();

                    //判断是有小票的还是是有IC卡的车辆信息
                    if (table.Rows[0]["ICCard_Value"].ToString() == "" && table.Rows[0]["ICCard_ID"].ToString() == "")
                    {
                        sr.sortReset_SmallTicket_Serialnumber = table.Rows[0]["SmallTicket_Serialnumber"].ToString();
                    }
                    else if (table.Rows[0]["SmallTicket_Serialnumber"].ToString() == "")
                    {
                        sr.sortReset_SmallTicket_ICCard_ID    = Convert.ToInt32(table.Rows[0]["ICCard_ID"].ToString());
                        sr.sortReset_SmallTicket_ICCard_Value = table.Rows[0]["ICCard_Value"].ToString();
                    }

                    sr.sortReset_SmallTicket_SortNumber        = table.Rows[0]["SmallTicket_SortNumber"].ToString();
                    sr.sortReset_SortNumberInfo_SmallTicket_ID = Convert.ToInt32(table.Rows[0]["SmallTicket_ID"].ToString());
                    sr.sortReset_ShenQingTime = CommonalityEntity.GetServersTime();
                    sr.sortReset_ShenQingRen  = CommonalityEntity.USERNAME;
                    sr.sortReset_Sortjg       = 0;
                    sr.sortReset_Remark       = txtRemark.Text.Trim();

                    if (LinQBaseDao.InsertOne <sortReset>(new DCCarManagementDataContext(), sr))
                    {
                        MessageBox.Show("申请成功!!!", "提示");

                        txtqian.Text         = "";
                        txtchepai.Text       = "";
                        txtmengang.Text      = "";
                        txtpaiduihao.Text    = "";
                        txtxiaopiao.Text     = "";
                        cbohou.SelectedIndex = 0;
                        cbohou.Enabled       = false;
                        btnshenqing.Enabled  = false;
                    }
                    else
                    {
                        CommonalityEntity.WriteLogData("增加", "申请了车牌为" + table.Rows[0]["CarInfo_Name"].ToString() + "的状态重置申请。", CommonalityEntity.USERNAME);
                        MessageBox.Show("申请失败!!!", "提示");
                        txtchepai.Text    = "";
                        txtmengang.Text   = "";
                        txtpaiduihao.Text = "";
                        txtxiaopiao.Text  = "";
                    }
                }
            }
        }