public SortedDictionary <int, MaterielProOccupiedInfo> getMaterielProOccupiedList() { m_materielProlist.Clear(); SortedDictionary <int, MaterielProOccupiedOrderTable> list = MaterielProOccupiedOrder.getInctance().getAllReviewMaterielProOccupiedOrderInfo(); for (int index = 0; index < list.Count; index++) { MaterielProOccupiedOrderTable record = new MaterielProOccupiedOrderTable(); record = (MaterielProOccupiedOrderTable)list[index]; SortedDictionary <int, MaterielProOccupiedOrderDetailsTable> listDetails = MaterielProOccupiedOrderDetails.getInctance().getMaterielProOccupiedInfoFromBillNumber(record.billNumber); for (int index2 = 0; index2 < listDetails.Count; index2++) { MaterielProOccupiedOrderDetailsTable recordDeatils = new MaterielProOccupiedOrderDetailsTable(); recordDeatils = (MaterielProOccupiedOrderDetailsTable)listDetails[index2]; addDeatisToList(recordDeatils.materielID, record.applyStaffName, recordDeatils.value); } } return(m_materielProlist); }
private void load() { m_tableDataList.Clear(); string querySQL = "SELECT [PKEY],[ROW_NUMBER],[MATERIEL_ID], [BILL_NUMBER],[PRICE],[VALUE],[NOTE], [IS_CANCEL] FROM [WAREHOUSE_MANAGEMENT_PRO_OCCUPIED_DETAILS] ORDER BY [PKEY] DESC"; using (DataTable dataTable = DatabaseAccessFactoryInstance.Instance.QueryDataTable(FormMain.DB_NAME, querySQL)) { foreach (DataRow row in dataTable.Rows) { MaterielProOccupiedOrderDetailsTable record = new MaterielProOccupiedOrderDetailsTable(); record.pkey = DbDataConvert.ToInt32(row["PKEY"]); record.rowNumber = DbDataConvert.ToString(row["ROW_NUMBER"]); record.billNumber = DbDataConvert.ToString(row["BILL_NUMBER"]); record.materielID = DbDataConvert.ToInt32(row["MATERIEL_ID"]); // 根据物料ID得到物料相关信息 MaterielTable materiel = Materiel.getInctance().getMaterielInfoFromPkey(record.materielID); record.materielName = materiel.name; record.materielModel = materiel.model; record.materielUnitSale = AuxiliaryMaterial.getInctance().getAuxiliaryMaterialNameFromPkey("BASE_UNIT_LIST", materiel.unitSale); record.price = DbDataConvert.ToDouble(row["PRICE"]); record.value = DbDataConvert.ToDouble(row["VALUE"]); record.sumMoney = record.price * record.value; record.note = DbDataConvert.ToString(row["NOTE"]); record.isCancel = DbDataConvert.ToString(row["IS_CANCEL"]); m_tableDataList.Add(m_tableDataList.Count, record); } } }
public void insert(ArrayList orderDetailsRecords) { if (orderDetailsRecords.Count <= 0) { return; } else { try { for (int i = 0; i < orderDetailsRecords.Count; i++) { MaterielProOccupiedOrderDetailsTable record = (MaterielProOccupiedOrderDetailsTable)orderDetailsRecords[i]; if (i == 0 && checkBillIsExist(record.billNumber)) { // 根据单据编号,判断库中是否已经存在该单据 如果存在单据首先删除单据,然后再执行插入操作 delete(record.billNumber); } string insert = "INSERT INTO [dbo].[WAREHOUSE_MANAGEMENT_PRO_OCCUPIED_DETAILS]([ROW_NUMBER],[MATERIEL_ID],[BILL_NUMBER]"; insert += ",[PRICE],[VALUE],[NOTE],[IS_CANCEL])VALUES("; insert += "'" + record.rowNumber + "',"; insert += record.materielID + ","; insert += "'" + record.billNumber + "',"; insert += record.price + ","; insert += record.value + ","; insert += "'" + record.note + "', 0"; insert += ")"; try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, insert); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } } load(); } catch (Exception) { } } }
public bool checkBillIsExist(string billNumber) { bool isRet = false; foreach (KeyValuePair <int, MaterielProOccupiedOrderDetailsTable> index in m_tableDataList) { MaterielProOccupiedOrderDetailsTable record = new MaterielProOccupiedOrderDetailsTable(); if (index.Value.billNumber == billNumber) { isRet = true; break; } } return(isRet); }