/// <summary>
        /// 创建空记录
        /// </summary>
        /// <param name="otherColumns">除了公共字段code、sql_code、description以外的其他字段</param>
        /// <returns></returns>
        private DataTable CreateEmptyTable(params string[] otherColumns)
        {
            //公共字段
            List <string> columnNames = new List <string> {
                "code",
                "sql_code",
                "description"
            };
            List <Type> types = new List <Type> {
                typeof(int),
                typeof(string),
                typeof(string)
            };

            if (otherColumns != null && otherColumns.Length > 0)
            {
                columnNames.AddRange(otherColumns);
                for (int i = 0; i < otherColumns.Length; i++)
                {
                    types.Add(typeof(string));
                }
            }

            DataTable dt = UtilsClass.CreateDataTable("result", columnNames.ToArray(), types.ToArray());

            return(dt);
        }
        /// <summary>
        /// 创建临时表#Table_scan的列映射
        /// </summary>
        /// <param name="dtTempScanDetail"></param>
        /// <param name="lstColumnMappingsScanDetail"></param>
        private void CreateTempTableMapping(ref DataTable dtTempScanDetail, ref List <BulkCopyColumnMapping> lstColumnMappingsScanDetail)
        {
            #region ScanDetail表
            string[] scanColumnsDetail = new string[] {
                // "Table_scan_detail_ID",  //主键
                "info_lot_no", //信息批号
                "site_no",     //转入库位
                "barcode_no",
                "item_no",
                "item_feature_no",
                "warehouse_no",
                "storage_spaces_no",
                "lot_no",
                "picking_qty",
                "picking_unit_no",
                "doc_no",
                "seq"    //工厂
            };
            dtTempScanDetail = UtilsClass.CreateDataTable("", scanColumnsDetail,
                                                          new Type[] {
                // typeof(object),    //主键
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(decimal),
                typeof(string),
                typeof(string),
                typeof(int)
            });

            //创建map对照表
            Dictionary <string, string> dicScanDetail = new Dictionary <string, string>();
            foreach (string key in scanColumnsDetail)
            {
                dicScanDetail.Add(key, key);
            }
            lstColumnMappingsScanDetail = UtilsClass.CreateBulkMapping(dicScanDetail);
            #endregion
        }
Пример #3
0
        /// <summary>
        /// 创建批量修改所需要的DataTable和Mapping
        /// </summary>
        private void CreateRelateTable(ref DataTable issueReceiptD
                                       , ref List <BulkCopyColumnMapping> issueReceiptDMap)
        {
            #region 创建领料单身表
            string[] issueReceiptDColumns = new string[] {
                "DOC_NO",            //单号
                "SequenceNumber",    //序号
                "ISSUE_RECEIPT_QTY", //领退料数量
                "PLANT_CODE",        //工厂编号
                "ITEM_CODE",         //品号
                "ITEM_FEATURE_CODE", //特征码
                "UNIT_CODE",         //单位编号
                "WAREHOUSE_CODE",    //仓库编号
                "BIN_CODE",          //库位编号
                "LOT_CODE",          //批号
                "BARCODE_NO"         //条码
            };
            issueReceiptD = UtilsClass.CreateDataTable("ISSUE_RECEIPT_D", issueReceiptDColumns,
                                                       new Type[] {
                typeof(string),       //单号
                typeof(int),          //序号
                typeof(decimal),      //领退料数量
                typeof(string),       //工厂编号
                typeof(string),       //品号
                typeof(string),       //特征码
                typeof(string),       //单位编号
                typeof(string),       //仓库编号
                typeof(string),       //库位编号
                typeof(string),       //批号
                typeof(string)        //条码
            });

            //创建map对照表
            Dictionary <string, string> dicIssueReceiptD = new Dictionary <string, string>();
            foreach (string key in issueReceiptDColumns)
            {
                dicIssueReceiptD.Add(key, key);
            }
            issueReceiptDMap = UtilsClass.CreateBulkMapping(dicIssueReceiptD);
            #endregion
        }