예제 #1
0
    protected void BtnSave_Click(object sender, DirectEventArgs e)
    {
        Y_GBCode _Y_GBCode = new Y_GBCode();
        if (Hid.Text.Length > 0)
            _Y_GBCode = WMSFactory.Y_GBCode.FindById(Hid.Text);

        //_Y_GBCode.Id = ; //自增
        _Y_GBCode.Code = TxtCode.Text; //国标码
        _Y_GBCode.StyleId = ""; //新款式编号


        bool isok = false;
        if (Hid.Text.Length > 0)
            isok = WMSFactory.Y_GBCode.Update(_Y_GBCode);
        else
            isok = WMSFactory.Y_GBCode.Add(_Y_GBCode);
        if (isok)
        {
            Y_GBCode_Win.Hide();
            Y_GBCode_Grid.Reload();
            MsgBox.NotifiShow("恭喜您,操作成功!", "OK");
        }
        else
            MsgBox.MessageShow("操作失败,请您重试!", "ERROR");
    }
예제 #2
0
    protected void BtnSave_Click(object sender, DirectEventArgs e)
    {
        Y_GBCode _Y_GBCode = new Y_GBCode();

        if (Hid.Text.Length > 0)
        {
            _Y_GBCode = WMSFactory.Y_GBCode.FindById(Hid.Text);
        }

        //_Y_GBCode.Id = ; //自增
        _Y_GBCode.Code    = TxtCode.Text; //国标码
        _Y_GBCode.StyleId = "";           //新款式编号


        bool isok = false;

        if (Hid.Text.Length > 0)
        {
            isok = WMSFactory.Y_GBCode.Update(_Y_GBCode);
        }
        else
        {
            isok = WMSFactory.Y_GBCode.Add(_Y_GBCode);
        }
        if (isok)
        {
            Y_GBCode_Win.Hide();
            Y_GBCode_Grid.Reload();
            MsgBox.NotifiShow("恭喜您,操作成功!", "OK");
        }
        else
        {
            MsgBox.MessageShow("操作失败,请您重试!", "ERROR");
        }
    }
예제 #3
0
    //删除数据
    protected void BtnDel_Click(object sender, DirectEventArgs e)
    {
        int Success = 0, Failed = 0;
        RowSelectionModel sm = Y_GBCode_Grid.SelectionModel.Primary as RowSelectionModel;

        foreach (SelectedRow row in sm.SelectedRows)
        {
            Y_GBCode _Y_GBCode = new Y_GBCode();
            _Y_GBCode.Id = int.Parse(row.RecordID);
            if (WMSFactory.Y_GBCode.Del(_Y_GBCode))
            {
                Success++;
            }
            else
            {
                Failed++;
            }
        }
        Y_GBCode_Grid.Reload();
        if (Failed > 0)
        {
            MsgBox.MessageShow("删除操作完成,成功" + Success.ToString() + "条,失败" + Failed.ToString() + "条!", "OK");
        }
        else
        {
            MsgBox.NotifiShow("删除操作完成,成功" + Success.ToString() + "条,失败" + Failed.ToString() + "条!", "OK");
        }
    }
예제 #4
0
 //删除数据
 protected void BtnDel_Click(object sender, DirectEventArgs e)
 {
     int Success = 0, Failed = 0;
     RowSelectionModel sm = Y_GBCode_Grid.SelectionModel.Primary as RowSelectionModel;
     foreach (SelectedRow row in sm.SelectedRows)
     {
         Y_GBCode _Y_GBCode = new Y_GBCode();
         _Y_GBCode.Id = int.Parse(row.RecordID);
         if (WMSFactory.Y_GBCode.Del(_Y_GBCode)) Success++;
         else Failed++;
     }
     Y_GBCode_Grid.Reload();
     if (Failed > 0)
         MsgBox.MessageShow("删除操作完成,成功" + Success.ToString() + "条,失败" + Failed.ToString() + "条!", "OK");
     else
         MsgBox.NotifiShow("删除操作完成,成功" + Success.ToString() + "条,失败" + Failed.ToString() + "条!", "OK");
 }
예제 #5
0
    //导入
    protected void Btnsave_Click(object sender, DirectEventArgs e)
    {
        try
        {
            string filename = UpFile.PostedFile.FileName;
            string ext = Path.GetExtension(filename).ToLower();
            if (ext != ".xls" && ext != ".xlsx")
            {
                X.Msg.Notify("失败", "<font color='red'>文件格式不正确,仅支持.xls(Excel)格式文件!</font>").Show();
                return;
            }
            filename = DateTime.Now.ToString("yyyyMMddHHmmss") + ext;
            UpFile.PostedFile.SaveAs(Server.MapPath("File/" + filename));
            DataTable dt = new DataTable();
            CJ_DevelopHelper.OtherCon_Str = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("File/" + filename) + ";Extended Properties='Excel 8.0;HDR=YES;IMEX=1;'";
            CJ_DevelopHelper.SqlStr = "select 国标码,'' as 备注 from [sheet1$] where 国标码<>''";
            dt = CJ_DevelopHelper.Other_ReturnDateTable;
            if (dt.Rows.Count <= 0)
            {
                X.Msg.Alert("提醒", "导入的文件无记录!").Show();
                return;
            }
            DataTable dtCopy = dt.Clone();
            for(int i=0;i<dt.Rows.Count;i++)
            {
                try
                {
                    Y_GBCode code = new Y_GBCode();
                    code.Code = dt.Rows[i]["国标码"].ToString();
                    code.StyleId = "";
                    if (!WMSFactory.Y_GBCode.Add(code))
                    {
                        DataRow newDR = dtCopy.NewRow();//新表创建新行
                        newDR.ItemArray = dt.Rows[i].ItemArray;//旧表结构行赋给新表结构行
                        newDR["备注"]="请检查长度或是否已存在该国标码";
                        dtCopy.Rows.Add(newDR);
                    }
                }
                catch (Exception error)
                {
                    DataRow newDR = dtCopy.NewRow();//新表创建新行
                    newDR.ItemArray = dt.Rows[i].ItemArray;//旧表结构行赋给新表结构行
                    newDR["备注"] = "异常:"+error.Message;
                    dtCopy.ImportRow(newDR);
                }
            }
            if (File.Exists(Server.MapPath("File/" + filename)))
                File.Delete(Server.MapPath("File/" + filename));

            Y_GBCode_Grid.Reload();
            if (dtCopy.Rows.Count > 0)
            {
                string ErrFile = "File/GBK-ERROR-ROWS-" + filename;
                ExcelHelper.ExportExcelWithAspose(dtCopy, Server.MapPath(ErrFile));
                X.Msg.Alert("提醒", "存在错误记录,请先检查!<br />请下载异常文件<a href='" + ErrFile + "' target='_blank'>异常记录</a>,修改后重新上传提交!").Show();
            }
            else
            {
                X.Msg.Alert("提醒", "国标码导入成功!").Show();
            }
        }
        catch (Exception error)
        {
            X.Msg.Alert("错误", error.Message + "!请认真检查文档!").Show();
        }
    }
예제 #6
0
    //导入
    protected void Btnsave_Click(object sender, DirectEventArgs e)
    {
        try
        {
            string filename = UpFile.PostedFile.FileName;
            string ext      = Path.GetExtension(filename).ToLower();
            if (ext != ".xls" && ext != ".xlsx")
            {
                X.Msg.Notify("失败", "<font color='red'>文件格式不正确,仅支持.xls(Excel)格式文件!</font>").Show();
                return;
            }
            filename = DateTime.Now.ToString("yyyyMMddHHmmss") + ext;
            UpFile.PostedFile.SaveAs(Server.MapPath("File/" + filename));
            DataTable dt = new DataTable();
            CJ_DevelopHelper.OtherCon_Str = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("File/" + filename) + ";Extended Properties='Excel 8.0;HDR=YES;IMEX=1;'";
            CJ_DevelopHelper.SqlStr       = "select 国标码,'' as 备注 from [sheet1$] where 国标码<>''";
            dt = CJ_DevelopHelper.Other_ReturnDateTable;
            if (dt.Rows.Count <= 0)
            {
                X.Msg.Alert("提醒", "导入的文件无记录!").Show();
                return;
            }
            DataTable dtCopy = dt.Clone();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                try
                {
                    Y_GBCode code = new Y_GBCode();
                    code.Code    = dt.Rows[i]["国标码"].ToString();
                    code.StyleId = "";
                    if (!WMSFactory.Y_GBCode.Add(code))
                    {
                        DataRow newDR = dtCopy.NewRow();        //新表创建新行
                        newDR.ItemArray = dt.Rows[i].ItemArray; //旧表结构行赋给新表结构行
                        newDR["备注"]     = "请检查长度或是否已存在该国标码";
                        dtCopy.Rows.Add(newDR);
                    }
                }
                catch (Exception error)
                {
                    DataRow newDR = dtCopy.NewRow();        //新表创建新行
                    newDR.ItemArray = dt.Rows[i].ItemArray; //旧表结构行赋给新表结构行
                    newDR["备注"]     = "异常:" + error.Message;
                    dtCopy.ImportRow(newDR);
                }
            }
            if (File.Exists(Server.MapPath("File/" + filename)))
            {
                File.Delete(Server.MapPath("File/" + filename));
            }

            Y_GBCode_Grid.Reload();
            if (dtCopy.Rows.Count > 0)
            {
                string ErrFile = "File/GBK-ERROR-ROWS-" + filename;
                ExcelHelper.ExportExcelWithAspose(dtCopy, Server.MapPath(ErrFile));
                X.Msg.Alert("提醒", "存在错误记录,请先检查!<br />请下载异常文件<a href='" + ErrFile + "' target='_blank'>异常记录</a>,修改后重新上传提交!").Show();
            }
            else
            {
                X.Msg.Alert("提醒", "国标码导入成功!").Show();
            }
        }
        catch (Exception error)
        {
            X.Msg.Alert("错误", error.Message + "!请认真检查文档!").Show();
        }
    }
예제 #7
0
 //查询
 protected void BtnSearch_Click(object sender, EventArgs e)
 {
     lbInfo.Text      = "";
     TxtDoType.Text   = "";
     TxtGBK.Text      = "";
     TxtGrade.Text    = "";
     TxtSafeType.Text = "";
     try
     {
         if (TxtStyleId.Text.Trim().Length <= 0 || TxtColorId.Text.Trim().Length <= 0)
         {
             lbInfo.Text = "款式编号和颜色编号不能为空!";
             return;
         }
         IList <Y_StyleFoundation> style = WMSFactory.Y_StyleFoundation.FindByCondition(string.Format("(StyleId='{0}' OR OldStyleId='{0}') AND (ColorId='{1}' OR OldColorId='{1}')", TxtStyleId.Text.Trim(), TxtColorId.Text.Trim()));
         if (style.Count <= 0)
         {
             lbInfo.Text = "没有找到任何记录!";
             return;
         }
         Y_StyleFoundation sf = style[0];
         //赋值,获取基本信息
         lbBrand.Text       = sf.BrName;
         lbdprice.Text      = sf.J_Price.ToString();
         lbPinM.Text        = sf.S_Name;
         lbCd.Text          = sf.Production;
         lbcf.Text          = sf.Fabric == null ? "" : sf.Fabric.Replace(";", "<br />").Replace(";", "<br />");
         TxtOldStyleID.Text = sf.OldClothingId;
         //获取颜色
         DataTable dt = WMSFactory.Y_GBCode.Query("SELECT c_name FROM F22.dbo.j_color where colorid='" + sf.ColorId + "'");
         if (dt != null && dt.Rows.Count > 0)
         {
             lbColor.Text = dt.Rows[0][0].ToString();
         }
         //获取国标码信息
         IList <Y_StylePrint> printlist = WMSFactory.Y_StylePrint.FindByCondition("StyleId='" + sf.StyleId + sf.ColorId + "'");
         if (printlist.Count > 0)
         {
             TxtDoType.Text   = printlist[0].DoType;
             TxtGBK.Text      = printlist[0].GBCode;
             TxtGrade.Text    = printlist[0].Grade;
             TxtSafeType.Text = printlist[0].SafeType;
         }
         else
         {//随机分配一个国标码
             IList <Y_GBCode> codeList = WMSFactory.Y_GBCode.FindByCondition(string.Format("StyleId='{0}'", sf.StyleId));
             Y_GBCode         gbcode   = null;
             if (codeList.Count > 0)
             {
                 gbcode = codeList[0];
             }
             else
             {
                 IList <Y_GBCode> codes = WMSFactory.Y_GBCode.FindAllByPage(0, 1, 1, "", "StyleId='' or StyleId is null");
                 if (codes.Count > 0)
                 {
                     gbcode = codes[0];
                 }
             }
             if (gbcode == null)
             {
                 lbInfo.Text = "没有可用的国标码了,请上传新的国标码!";
                 return;
             }
             //插入
             Y_StylePrint p = new Y_StylePrint();
             p.StyleId      = sf.StyleId + sf.ColorId;
             p.GBCode       = gbcode.Code;
             gbcode.StyleId = sf.StyleId;//国标码不到颜色
             if (WMSFactory.Y_StylePrint.Add(p) && WMSFactory.Y_GBCode.Update(gbcode))
             {
                 TxtGBK.Text = gbcode.Code;
             }
             else
             {
                 lbInfo.Text = "国标码分配失败,请重新单击‘查 询’按钮!";
                 return;
             }
         }
         //加载尺码信息
         RPSize.DataSource = style;
         RPSize.DataBind();
     }
     catch (Exception error)
     {
         lbInfo.Text = "异常:" + error.Message;
     }
 }