using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace LYFZ.Software.MainBusiness.DoorCityProcess { public struct PerGoodImg { public string strGoodName; public List listImgs; } public partial class frmSaveN8Selection : LYFZ.Software.UI.DoorCityProcess.frmSaveN8Selection { LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder(); LYFZ.BLL.BLL_ErpProduct ptbll = new BLL.BLL_ErpProduct(); private LYFZ.Model.Model_ErpOrder currentModel = null; private LYFZ.Model.Model_ErpOrderDigital currentModelDigital = null; /// /// 当前订单(儿童订单的次数)的商品列表; /// private List photoModelList = null; private string n8ServerUserDirectory = ""; private DAL.N8Process.DAL_N8ResultViewGoProduct dalResultViewGoProduct = null; private DAL.N8Process.DAL_N8ResultItem dalResultItem = null; private DAL.N8Process.DAL_N8Album dalAlbum = null; LYFZ.BLL.ManufactureProductsAndReservationProductsStatisticalProcess reservationProductList = null; BLL.ProductSelectedPhotoInfo currentSelectPhotoInfo = null; LYFZ.BLL.BLL_ErpOrder currentOrderBll = new BLL.BLL_ErpOrder(); /// /// 每个商品,有多少版面; /// private List listPerGoodPage = new List(); /// /// 每个商品,有多少相片(不包含商品所有版面的相片); /// private List listPerGoodImg = new List(); /// /// 每个商品的每个版面,有多少相片; /// private List listPerGoodPageImg = new List(); public LYFZ.Model.Model_ErpOrder CurrentModel { get { return currentModel; } set { currentModel = value; } } public LYFZ.Model.Model_ErpOrderDigital CurrentModelDigital { get { return currentModelDigital; } set { currentModelDigital = value; } } public List PhotoModelList { get { return photoModelList; } set { photoModelList = value; } } public string N8ServerUserDirectory { get { return n8ServerUserDirectory; } set { n8ServerUserDirectory = value; } } public frmSaveN8Selection() { this.Load += FrmSaveN8Selection_Load; this.btn_Save.Click += Btn_Save_Click; this.btn_Cancel.Click += Btn_Cancel_Click; this.dgv_product.CellDoubleClick += Dgv_product_CellDoubleClick; this.dgv_product.CellValueChanged += Dgv_product_CellValueChanged; this.ck_Pickup.CheckedChanged += Ck_Pickup_CheckedChanged; this.ck_Expedited.CheckedChanged += Ck_Expedited_CheckedChanged; this.dt_Pickup.ValueChanged += Dt_Pickup_ValueChanged; this.tx_Money.KeyPress += Tx_Money_KeyPress; this.btn_AddMoney.Click += Btn_AddMoney_Click; this.link_record.LinkClicked += Link_record_LinkClicked; } private void Link_record_LinkClicked( object sender, LinkLabelLinkClickedEventArgs e ) { System.Data.DataTable tb = null; LYFZ.ExtendControlLibrary.FrmLoadHandling.LoadDoWorkMethod( delegate ( object obj, BackgroundWorker backgroundWorker ) { backgroundWorker.ReportProgress( 0, "正在加载..." ); tb = this.orbll.DAL.GetOrderPickupMoneyDataTable( this.CurrentModel.Ord_Number, this.CurrentModelDigital.Ordv_ViceNumber, Convert.ToInt32( this.CurrentModel.Ord_Type ), this.CurrentModelDigital.Ordv_DigitalNumber ); } ); if ( tb != null ) { PhotoSelectSystem.frmPlusickRecord fprod = new PhotoSelectSystem.frmPlusickRecord(); fprod.TbPlusickRecord = tb; fprod.Ord_Number = this.CurrentModel.Ord_Number; fprod.Ordv_ViceNumber = this.CurrentModelDigital.Ordv_ViceNumber; fprod.Ord_Type = Convert.ToInt32( this.CurrentModel.Ord_Type ); fprod.Ordv_DigitalNumber = this.CurrentModelDigital.Ordv_DigitalNumber; fprod.ShowDialog(); } } private void Btn_AddMoney_Click( object sender, EventArgs e ) { decimal currentPickSumMoney = Convert.ToDecimal( this.tx_Money.Text );//当前加挑总金额 decimal currentPickMoney = 0;//当前加挑金额 string currentPickInfo = "";//当前加挑商品内容信息 frmPlusPickDescription pickInfo = new frmPlusPickDescription( currentPickSumMoney ); if ( pickInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK ) { currentPickMoney = pickInfo.PickMoney; currentPickInfo = pickInfo.PickInfo; LYFZ.Model.Model_ErpPlusPickItems pickModel = new Model.Model_ErpPlusPickItems(); pickModel.Plu_Number = LYFZ.BLL.BLL_ErpCustomer.GetLateStagePlusPickNumber(); pickModel.Plu_OrdNumber = this.CurrentModel.Ord_Number; pickModel.Plu_OrdViceNumber = this.CurrentModelDigital.Ordv_ViceNumber; pickModel.Plu_Amount = currentPickMoney; pickModel.Plu_CreateTime = SDateTime.Now; pickModel.Plu_GoodsCosts = "0"; pickModel.Plu_RecordedPerson = LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID; pickModel.Plu_SourceType = "1"; pickModel.Plu_Goods = currentPickInfo; pickModel.Plu_OpenSingle = LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID; pickModel.Plu_TwoPinsCategory = "BEBCABBAAHFCJBJGJ"; pickModel.Plu_DividedShop = LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID; if ( this.currentOrderBll.DAL.SetOrderPickupMoney( pickModel ) ) { this.tx_Money.Text = (currentPickSumMoney + currentPickMoney).ToString(); LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog( EnumPublic.SystemLogsType.选片操作日志, "[订单号:" + this.CurrentModelDigital.Ordv_Number + "(" + this.CurrentModelDigital.Ordv_ViceNumber + ")]选片加挑金额变更 (" + currentPickInfo + ")" + currentPickMoney + "元", LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name ); } } } private void Tx_Money_KeyPress( object sender, KeyPressEventArgs e ) { if ( !Char.IsNumber( e.KeyChar ) && !Char.IsPunctuation( e.KeyChar ) && !Char.IsControl( e.KeyChar ) ) { e.Handled = true;//消除不合适字符 } else if ( Char.IsPunctuation( e.KeyChar ) ) { if ( tx_Money.SelectionStart == 0 ) { if ( tx_Money.Text.LastIndexOf( '-' ) == -1 ) return; } if ( tx_Money.SelectionStart == 1 ) { if ( tx_Money.Text.LastIndexOf( '-' ) != -1 && e.KeyChar == '.' ) e.Handled = true; } if ( e.KeyChar != '.' || tx_Money.Text.LastIndexOf( '.' ) != -1 ) { e.Handled = true; } } if ( tx_Money.SelectionStart == 0 ) { if ( tx_Money.Text.LastIndexOf( '-' ) != -1 ) e.Handled = true; } } private void Dt_Pickup_ValueChanged( object sender, EventArgs e ) { foreach ( DataGridViewRow row in this.dgv_product.Rows ) { row.Cells[7].Value = this.dt_Pickup.Value.ToString( "yyyy-MM-dd" ); UpdateDataGridViewRowProduct( row ); } } private void Ck_Expedited_CheckedChanged( object sender, EventArgs e ) { foreach ( DataGridViewRow row in this.dgv_product.Rows ) { if ( this.ck_Expedited.Checked ) { row.Cells[4].Value = "加急"; } else { row.Cells[4].Value = ""; } UpdateDataGridViewRowProduct( row ); if ( row.Cells[0].Value == null || row.Cells[0].Value.ToString().Length <= 0 ) { row.Cells[4].Value = ""; row.Cells[5].Value = ""; } } } private void Ck_Pickup_CheckedChanged( object sender, EventArgs e ) { if ( ck_Pickup.Checked == true ) { dt_Pickup.Enabled = true; foreach ( DataGridViewRow row in this.dgv_product.Rows ) { row.Cells[7].Value = this.dt_Pickup.Value.ToString( "yyyy-MM-dd" ); UpdateDataGridViewRowProduct( row ); } } else { dt_Pickup.Enabled = false; } } private void Dgv_product_CellValueChanged( object sender, DataGridViewCellEventArgs e ) { DataGridViewCell vCell = this.dgv_product.Rows[e.RowIndex].Cells[e.ColumnIndex]; object cValue = vCell.Value; try { switch ( vCell.ColumnIndex ) { case 3: { int number = 1; if ( cValue != null ) { if ( !int.TryParse( cValue.ToString().Trim(), out number ) ) { vCell.Value = 1; } else if ( number <= 0 ) { vCell.Value = 1; } } else { vCell.Value = 1; } } break; case 7: if ( vCell.Value != null && vCell.Value.ToString().Trim().Length > 0 ) { DateTime PickDate; if ( !DateTime.TryParse( cValue.ToString().Trim(), out PickDate ) ) { vCell.Value = ""; } if ( this.dt_Pickup.Value.ToString( "yyyy-MM-dd" ) != PickDate.ToString( "yyyy-MM-dd" ) ) { this.ck_Pickup.Checked = false; } } break; case 8: { } break; } UpdateDataGridViewRowProduct( this.dgv_product.Rows[vCell.RowIndex] ); } catch { } } private void Dgv_product_CellDoubleClick( object sender, DataGridViewCellEventArgs e ) { if ( e.RowIndex < 0 || e.ColumnIndex < 0 ) { return; } DataGridViewCell vCell = this.dgv_product.Rows[e.RowIndex].Cells[e.ColumnIndex]; object cValue = vCell.Value; try { switch ( vCell.ColumnIndex ) { case 4: { if ( cValue.ToString() == "加急" ) { vCell.Value = ""; } else { vCell.Value = "加急"; } UpdateDataGridViewRowProduct( this.dgv_product.Rows[vCell.RowIndex] ); } break; case 7: if ( vCell.Value == null || cValue.ToString().Trim().Length <= 0 ) { vCell.Value = this.ck_Pickup.Checked ? this.dt_Pickup.Value.ToString( "yyyy-MM-dd" ) : DateTime.Now.ToString( "yyyy-MM-dd" ); UpdateDataGridViewRowProduct( this.dgv_product.Rows[vCell.RowIndex] ); } break; default: break; } } catch { } } private void Btn_Cancel_Click( object sender, EventArgs e ) { this.Close(); } private void Btn_Save_Click( object sender, EventArgs e ) { #region 同步N8的选版备注到数据库中; // 加载选版的备注信息item.data; string Notexml = string.Format( "{0}\\选版结果\\item.data", N8ServerUserDirectory ); dalResultItem = new DAL.N8Process.DAL_N8ResultItem( Notexml ); dalResultItem.LoadResultItem(); List listNotes = null; string strItemNotes = null; // 获取原备注; if ( this.CurrentModelDigital != null && this.CurrentModelDigital.Ordv_SelectionFilm.Length > 0 ) { listNotes = this.CurrentModelDigital.Ordv_SelectionFilm.Split( '*' ).ToList(); } // N8选版备注, 直接覆盖现有的选版备注;; if ( dalResultItem.ListResultItem.Count > 0 ) { strItemNotes = "?"; foreach ( Model.N8Process.N8ResultItem item in dalResultItem.ListResultItem ) { strItemNotes += string.Format( "{0}:{1}|", item.path, item.comment ); } strItemNotes.TrimEnd( '|' ); strItemNotes = LYFZ.WinAPI.SDKSecurity.EncodeHex16String( strItemNotes ); // 转码; if ( listNotes != null ) currentModelDigital.Ordv_SelectionFilm = listNotes[0] + string.Format( "*{0}*", strItemNotes ); else currentModelDigital.Ordv_SelectionFilm = string.Format( "*{0}*", strItemNotes ); } // 保存时,设置成N8选版模式; currentModelDigital.Ordv_IsN8Model = true; #endregion this.CurrentModelDigital.Ordv_LookDesignClaim = tx_CustomerRequire.Text; if ( this.currentOrderBll.DAL.SaveSelectionFilm( LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID, this.CurrentModelDigital.Ordv_ViceNumber, this.CurrentModelDigital.Ordv_SelectionFilm, LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, this.CurrentModelDigital, this.PhotoModelList, this.CurrentModelDigital.Ordv_DesignValidation ) ) { MessageBoxCustom.Show( "保存成功" ); } } private void FrmSaveN8Selection_Load( object sender, EventArgs e ) { FillDialogWithData(); } private void FillDialogWithData() { this.currentSelectPhotoInfo = new BLL.ProductSelectedPhotoInfo( this.CurrentModelDigital.Ordv_DesignValidation, Model.Model_ErpOrder.DirectoryType.DesignPiece ); //读取当前订单已选设计片信息 LYFZ.ExtendControlLibrary.FrmLoadHandling.LoadDoWorkMethod( delegate ( object obj, BackgroundWorker backgroundWorker ) { try { reservationProductList = new BLL.ManufactureProductsAndReservationProductsStatisticalProcess( this.CurrentModel.Ord_Number, this.CurrentModelDigital.Ordv_ViceNumber, this.PhotoModelList, this.currentSelectPhotoInfo ); } catch { } } ); LoadN8ViewGoResult(); // 订单号; this.tx_OrderNumber.Text = CurrentModel.Ord_Number; // 获取顾客资料; LYFZ.BLL.BLL_ErpCustomer cusBll = new BLL.BLL_ErpCustomer(); this.tx_Customer.Text = cusBll.GetCustomerNameList( this.currentModel.Ord_Number, "," ); // 获取顾客要求; this.tx_CustomerRequire.Text = CurrentModelDigital.Ordv_LookDesignClaim; // 入底数量; this.tx_films.Text = CurrentModel.Ord_IntoBottom.ToString(); // 入册数量; this.tx_album.Text = CurrentModel.Ord_IntoRegister.ToString(); // 加挑总金额; this.tx_Money.Text = currentOrderBll.DAL.GetOrderPickupMoney( this.CurrentModel.Ord_Number, this.CurrentModelDigital.Ordv_ViceNumber, Convert.ToInt32( this.CurrentModel.Ord_Type ), this.CurrentModelDigital.Ordv_DigitalNumber ).ToString(); // 重新获取选版结果; photoModelList = currentOrderBll.GetOrderProductList( this.CurrentModel.Ord_Number, this.CurrentModelDigital.Ordv_ViceNumber, DAL.OrderProductType.制作商品 ); List productLists = currentOrderBll.GetOrderProductList( this.CurrentModel.Ord_Number, this.CurrentModelDigital.Ordv_ViceNumber, DAL.OrderProductType.预约商品 ); foreach ( LYFZ.Model.Model_ErpOrderProductList opl in photoModelList ) { DataGridViewRow dgr = new DataGridViewRow(); dgr.CreateCells( this.dgv_product ); dgr.Tag = opl; dgr.Cells[0].Value = opl.OPlist_ProdNumber; dgr.Cells[1].Value = opl.OPlist_ProdName; dgr.Cells[2].Value = opl.OPlist_ProdSoldPrice; dgr.Cells[3].Value = opl.OPlist_ProdQuantity; dgr.Cells[4].Value = opl.OPlist_IsExpedited ? "加急" : ""; foreach ( PerGoodImg pi in this.listPerGoodPage ) { if ( pi.strGoodName.Equals( opl.OPlist_ProdName ) ) { dgr.Cells[5].Value = pi.listImgs.Count; break; } } foreach ( PerGoodImg pi in this.listPerGoodImg ) { if ( pi.strGoodName.Equals( opl.OPlist_ProdName ) ) { dgr.Cells[6].Value = pi.listImgs.Count; break; } } // 预约取件日期; if ( opl.OPlist_ReservationTakeTime.Ticks != 0 ) dgr.Cells[7].Value = opl.OPlist_ReservationTakeTime; dgr.Cells[8].Value = opl.OPlist_Remark; if ( !IsHasReservationProduct( opl, productLists ) ) { dgr.Cells[0].Style.BackColor = Color.Red; } this.dgv_product.Rows.Add( dgr ); } } /// /// 加载N8选版结果; /// private void LoadN8ViewGoResult() { // 加载商品版面结果vgproduct.data; string vgproductxml = string.Format( "{0}\\选版结果\\vgproduct.data", N8ServerUserDirectory ); dalResultViewGoProduct = new DAL.N8Process.DAL_N8ResultViewGoProduct( vgproductxml ); dalResultViewGoProduct.LoadResultViewGoProduct(); foreach ( Model.N8Process.N8ResultViewGoProduct product in dalResultViewGoProduct.ListResultViewGoProduct ) { foreach ( string img in product.ListItem ) { if ( img.StartsWith( "\\版面\\" ) ) { if ( !IsTheGoodImgExists( this.listPerGoodPage, product.Name, img.Substring( "\\版面\\".Length ) ) ) { InsertImgToGood( this.listPerGoodPage, product.Name, img.Substring( "\\版面\\".Length ) ); } } else if ( img.StartsWith( "\\照片\\" ) ) { if ( !IsTheGoodImgExists( this.listPerGoodImg, product.Name, img.Substring( "\\照片\\".Length ) ) ) { InsertImgToGood( this.listPerGoodImg, product.Name, img.Substring( "\\照片\\".Length ) ); } } } } // 加载版面相片album.pwt; string albumxml = string.Format( "{0}\\版面\\album.pwt", N8ServerUserDirectory ); dalAlbum = new DAL.N8Process.DAL_N8Album( albumxml ); dalAlbum.LoadAlbum(); foreach ( PerGoodImg pi in this.listPerGoodPage ) { foreach ( string page in pi.listImgs ) { foreach ( Model.N8Process.N8Album album in dalAlbum.ListAlbum ) { // 同一版面; if ( page.Equals( album.N8PageFileName.TrimEnd( ".jpg".ToCharArray() ).ToLower() ) ) { foreach ( Model.N8Process.N8PageCell cell in album.ListItem ) { string file = cell.N8PageCellFileName.Substring( cell.N8PageCellFileName.LastIndexOf( '\\' ) + 1 ); if ( !IsTheGoodImgExists( this.listPerGoodImg, pi.strGoodName, file ) ) { InsertImgToGood( this.listPerGoodImg, pi.strGoodName, file ); } } } } } } try { // 是否有新商品增加、减少; StringBuilder strSQL = new StringBuilder(); strSQL.Append( "(" ); #region N8新增了哪些产品 // 添加了哪些或减少(不是删除)哪些; LYFZ.BLL.BLL_ErpOrderProductList ordProdBll = new BLL.BLL_ErpOrderProductList(); List commdinfoList = new List(); foreach ( Model.N8Process.N8ResultViewGoProduct product in dalResultViewGoProduct.ListResultViewGoProduct ) { int nNewCount = dalResultViewGoProduct.GetResultViewGoProductCount( product.Id ); int nOldCount = GetProductCount( product.Id ); // 商品选版前后的数量是否有添加; if ( nNewCount > nOldCount ) {// 加挑了商品; for ( int i = nOldCount; i < nNewCount; i++ ) { Model.Model_ErpProduct pp = ptbll.GetModel( "Prod_Number", product.Id ); Model.Model_ErpOrderProductList plt = GetSelectOrderProduct( pp ); photoModelList.Add( plt ); commdinfoList.Add( ordProdBll.GetAddCommandInfo( plt ) ); } } else if ( nNewCount < nOldCount ) {// 减少了商品,只减没有选片的,如果选片关联了相片的,不减; string tempDelIdList = ""; for ( int i = nOldCount; i > nNewCount; i-- ) { foreach ( LYFZ.Model.Model_ErpOrderProductList opl in photoModelList ) { if ( opl.OPlist_ProdNumber.Equals( product.Id ) ) { string name = product.Name; if ( product.Name.EndsWith( ")" ) && product.Name[product.Name.Length - 3] == '(' ) name = product.Name.Substring( 0, product.Name.Length - 3 ); // if ( -1 == CurrentModelDigital.Ordv_SelectionFilm.IndexOf( product.Name ) ) // 选片和N8选版只取一个,不会同时存在; {// 没有任何相关关联,可以删除; tempDelIdList += opl.ID + ","; photoModelList.Remove( opl ); } break; } } } string delSql = "delete [dbo].[tb_ErpOrderProductList] where id in (" + tempDelIdList.Trim( ',' ) + ")"; Helper.SQLHelper.ExecuteSql( delSql ); } } // 事务来保存新增的商品; int ret = Helper.SQLHelper.ExecuteSqlTran( commdinfoList ); #endregion #region N8删除了哪些产品 // 删除了哪些或增加了哪些; List tmplist = new List(); for ( int i = photoModelList.Count - 1; i > -1; i-- ) { int nNewCount = GetProductCount( photoModelList[i].OPlist_ProdNumber ); int nOldCount = dalResultViewGoProduct.GetResultViewGoProductCount( photoModelList[i].OPlist_ProdNumber ); if ( nNewCount != nOldCount ) {// 删除了哪些; //if ( -1 == CurrentModelDigital.Ordv_SelectionFilm.IndexOf( photoModelList[i].OPlist_ProdName ) )//选片和N8选版只取一个,不会同时存在; {// 没有任何相关关联,可以删除; string delSql = "delete [dbo].[tb_ErpOrderProductList] where id = " + photoModelList[i].ID + ""; Helper.SQLHelper.ExecuteSql( delSql ); photoModelList.RemoveAt( i ); } continue; } } #endregion } catch ( Exception ex ) { } } private bool IsTheGoodImgExists( List listPerGoodImg, string good, string image ) { bool bExists = false; image = image.ToLower(); image = image.TrimEnd( ".jpg".ToCharArray() ); foreach ( PerGoodImg pi in listPerGoodImg ) { if ( pi.strGoodName.Equals( good ) ) { foreach ( string img in pi.listImgs ) { if ( img.Equals( image ) ) { bExists = true; break; } } break; } } return bExists; } private void InsertImgToGood( List listPerGoodImg, string good, string image ) { bool bGoodExist = false; image = image.ToLower(); image = image.TrimEnd( ".jpg".ToCharArray() ); foreach ( PerGoodImg pi in listPerGoodImg ) { if ( pi.strGoodName.Equals( good ) ) { bGoodExist = true; pi.listImgs.Add( image ); break; } } if ( !bGoodExist ) { PerGoodImg pi = new PerGoodImg(); pi.strGoodName = good; pi.listImgs = new List(); pi.listImgs.Add( image ); listPerGoodImg.Add( pi ); } } /// /// 更新当前行的商品对象 /// /// void UpdateDataGridViewRowProduct( DataGridViewRow row, bool isupdate = true ) { if ( row.Tag != null ) { LYFZ.Model.Model_ErpOrderProductList ordProduct = (LYFZ.Model.Model_ErpOrderProductList)row.Tag; if ( ordProduct.OPlist_UniquelyIdentity == LYFZ.BLL.SelectPhotoHandling.IntoFilmText || ordProduct.OPlist_UniquelyIdentity == LYFZ.BLL.SelectPhotoHandling.IntoBookText ) { return; } if ( row.Cells[3].Value != null ) { int oldProdQuantity = ordProduct.OPlist_ProdQuantity; int newProdQuantity = Convert.ToInt32( row.Cells[3].Value ); ordProduct.OPlist_ProdQuantity = newProdQuantity; row.Cells[3].Style.ForeColor = this.reservationProductList.GetRowProdQuantityTextColor( ordProduct ); if ( row.Cells[3].Style.ForeColor.Name == Color.Red.Name && newProdQuantity > oldProdQuantity ) { if ( ExMessageBoxCustom.Show( "您输入的数量大于预约数量,是否确定要继续输入?", msgBoxButton: MessageBoxButtons.YesNo ) == System.Windows.Forms.DialogResult.No ) { row.Cells[3].Value = oldProdQuantity; ordProduct.OPlist_ProdQuantity = oldProdQuantity; row.Cells[3].Style.ForeColor = this.reservationProductList.GetRowProdQuantityTextColor( ordProduct ); } } } if ( row.Cells[4].Value != null ) { if ( row.Cells[4].Value.ToString().Trim().Length > 0 ) { ordProduct.OPlist_IsExpedited = true; } else { ordProduct.OPlist_IsExpedited = false; } } if ( row.Cells[7].Value != null ) { if ( row.Cells[7].Value.ToString().Trim().Length > 0 ) { ordProduct.OPlist_ExpeditedTime = Convert.ToDateTime( row.Cells[7].Value.ToString() ); } else { ordProduct.OPlist_ExpeditedTime = Convert.ToDateTime( "1900-01-01" ); } ordProduct.OPlist_ReservationTakeTime = ordProduct.OPlist_ExpeditedTime; } else { ordProduct.OPlist_ExpeditedTime = Convert.ToDateTime( "1900-01-01" ); ordProduct.OPlist_ReservationTakeTime = ordProduct.OPlist_ExpeditedTime; } if ( row.Cells[8].Value != null ) { ordProduct.OPlist_Remark = row.Cells[8].Value.ToString().Trim(); } else { ordProduct.OPlist_Remark = ""; } } } /// /// 返回商品个数 /// /// /// private int GetProductCount( string productId ) { int nCount = 0; foreach ( LYFZ.Model.Model_ErpOrderProductList opl in photoModelList ) { if ( opl.OPlist_ProdNumber.Equals( productId ) ) { ++nCount; } } return nCount; } LYFZ.Model.Model_ErpOrderProductList GetSelectOrderProduct( LYFZ.Model.Model_ErpProduct pModel ) { //this.CMainPhotoSelect.SelectedPieceInfoModify = true; LYFZ.Model.Model_ErpOrderProductList ordProdructModel = new LYFZ.Model.Model_ErpOrderProductList(); ordProdructModel.OPlist_DividedShop = LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID; ordProdructModel.OPlist_ProdNumber = pModel.Prod_Number; ordProdructModel.OPlist_ProdName = pModel.Prod_Name; ordProdructModel.OPlist_ProdQuantity = 1; ordProdructModel.OPlist_ProdSoldPrice = pModel.Prod_SalesPrice; ordProdructModel.OPlist_CostPrice = pModel.Prod_CostPrice; ordProdructModel.OPlist_Class = pModel.Prod_Class; ordProdructModel.OPlist_Batch = pModel.Prod_Batch; ordProdructModel.OPlist_Unit = pModel.Prod_Unit; ordProdructModel.OPlist_Type = "2"; ordProdructModel.OPlist_OriginalP = pModel.Prod_Batch; ordProdructModel.OPlist_OrderNumber = this.CurrentModel.Ord_Number; ordProdructModel.OPlist_ViceNumber = this.CurrentModelDigital.Ordv_ViceNumber; ordProdructModel.OPlist_UniquelyIdentity = LYFZ.DAL.DAL_ErpOrderProductList.GetPorductUniquelyIdentity(); ordProdructModel.OPlist_OrderByNumber = GetNewOPlistOrderByNumber(); return ordProdructModel; } /// /// 临时计数器 /// int tempOrderByNumberCount = 0; /// /// 获取新的排序编号 /// /// int GetNewOPlistOrderByNumber() { int retOrderByNumber = 0; tempOrderByNumberCount++; foreach ( LYFZ.Model.Model_ErpOrderProductList opl in photoModelList ) { if ( opl != null ) { if ( opl.OPlist_OrderByNumber > retOrderByNumber ) { retOrderByNumber = opl.OPlist_OrderByNumber; } } } return retOrderByNumber + tempOrderByNumberCount; } /// /// 判断一个制作商品是否有对应的预约商品, 如果没有则表示该商品为加挑商品; /// /// 制作商品 /// 预约商品列表 /// bool IsHasReservationProduct( LYFZ.Model.Model_ErpOrderProductList model, List list ) { bool has = false; foreach ( LYFZ.Model.Model_ErpOrderProductList item in list ) { if ( item.OPlist_OrderByNumber == model.OPlist_OrderByNumber ) { has = true; break; } } return has; } } }